Update to 1.15.1

This commit is contained in:
Marcel Konrad
2019-12-26 19:18:34 +01:00
parent d68b9126d0
commit efdcf51c23
29 changed files with 416 additions and 285 deletions

View File

@@ -7,7 +7,6 @@ import net.minecraft.nbt.INBT;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
import net.minecraft.nbt.StringNBT; import net.minecraft.nbt.StringNBT;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@@ -24,7 +23,7 @@ public class ComponentDisplay implements IBuilderComponent
if(this.name.getText() != null && !this.name.getText().isEmpty()) if(this.name.getText() != null && !this.name.getText().isEmpty())
{ {
display.putString("Name", ITextComponent.Serializer.toJson(new StringTextComponent(this.name.toString()))); display.putString("Name", ITextComponent.Serializer.toJson(this.name));
} }
ListNBT lore = new ListNBT(); ListNBT lore = new ListNBT();
@@ -33,7 +32,7 @@ public class ComponentDisplay implements IBuilderComponent
{ {
if(this.lore[x] != null && !this.lore[x].isEmpty()) if(this.lore[x] != null && !this.lore[x].isEmpty())
{ {
lore.add(new StringNBT(this.lore[x])); lore.add(StringNBT.func_229705_a_(this.lore[x]));
} }
} }

View File

@@ -68,37 +68,37 @@ public class ComponentSummon implements IBuilderComponent
if(this.name.equalsIgnoreCase("Cat")) if(this.name.equalsIgnoreCase("Cat"))
{ {
this.tag = "CatType"; this.tag = "CatType";
return new IntNBT(this.random.nextInt(3) + 1); return IntNBT.func_229692_a_(this.random.nextInt(3) + 1);
} }
else if(this.name.equalsIgnoreCase("Farmer") || this.name.equalsIgnoreCase("Fisherman") || this.name.equalsIgnoreCase("Shepherd") || this.name.equalsIgnoreCase("Fletcher")) else if(this.name.equalsIgnoreCase("Farmer") || this.name.equalsIgnoreCase("Fisherman") || this.name.equalsIgnoreCase("Shepherd") || this.name.equalsIgnoreCase("Fletcher"))
{ {
this.tag = "Profession"; this.tag = "Profession";
return new IntNBT(0); return IntNBT.func_229692_a_(0);
} }
else if(this.name.equalsIgnoreCase("Librarian") || this.name.equalsIgnoreCase("Carthographer")) else if(this.name.equalsIgnoreCase("Librarian") || this.name.equalsIgnoreCase("Carthographer"))
{ {
this.tag = "Profession"; this.tag = "Profession";
return new IntNBT(1); return IntNBT.func_229692_a_(1);
} }
else if(this.name.equalsIgnoreCase("Cleric") || this.name.equalsIgnoreCase("Priest")) else if(this.name.equalsIgnoreCase("Cleric") || this.name.equalsIgnoreCase("Priest"))
{ {
this.tag = "Profession"; this.tag = "Profession";
return new IntNBT(2); return IntNBT.func_229692_a_(2);
} }
else if(this.name.equalsIgnoreCase("Armorer") || this.name.equalsIgnoreCase("Blacksmith") || this.name.equalsIgnoreCase("WeaponSmith") || this.name.equalsIgnoreCase("ToolSmith")) else if(this.name.equalsIgnoreCase("Armorer") || this.name.equalsIgnoreCase("Blacksmith") || this.name.equalsIgnoreCase("WeaponSmith") || this.name.equalsIgnoreCase("ToolSmith"))
{ {
this.tag = "Profession"; this.tag = "Profession";
return new IntNBT(3); return IntNBT.func_229692_a_(3);
} }
else if(this.name.equalsIgnoreCase("Butcher") || this.name.equalsIgnoreCase("Leatherworker")) else if(this.name.equalsIgnoreCase("Butcher") || this.name.equalsIgnoreCase("Leatherworker"))
{ {
this.tag = "Profession"; this.tag = "Profession";
return new IntNBT(4); return IntNBT.func_229692_a_(4);
} }
else if(this.name.equalsIgnoreCase("Nitwit")) else if(this.name.equalsIgnoreCase("Nitwit"))
{ {
this.tag = "Profession"; this.tag = "Profession";
return new IntNBT(5); return IntNBT.func_229692_a_(5);
} }
if(this.entity != null) if(this.entity != null)
@@ -108,7 +108,7 @@ public class ComponentSummon implements IBuilderComponent
if(StringUtils.containsIgnoreCase(this.name, "Baby")) if(StringUtils.containsIgnoreCase(this.name, "Baby"))
{ {
this.tag = "IsBaby"; this.tag = "IsBaby";
return new ByteNBT((byte) 1); return ByteNBT.func_229671_a_((byte) 1);
} }
} }
else if(this.entity.equals(EntityType.CHICKEN.getRegistryName())) else if(this.entity.equals(EntityType.CHICKEN.getRegistryName()))

View File

@@ -80,7 +80,7 @@ public class ComponentTag<T> implements IBuilderComponent
return null; return null;
} }
return new StringNBT(string); return StringNBT.func_229705_a_(string);
} }
else if(this.value instanceof INBT) else if(this.value instanceof INBT)
{ {
@@ -98,27 +98,27 @@ public class ComponentTag<T> implements IBuilderComponent
} }
else if(this.value instanceof Integer) else if(this.value instanceof Integer)
{ {
return new IntNBT((Integer) this.value); return IntNBT.func_229692_a_((Integer) this.value);
} }
else if(this.value instanceof Byte) else if(this.value instanceof Byte)
{ {
return new ByteNBT((Byte) this.value); return ByteNBT.func_229671_a_((Byte) this.value);
} }
else if(this.value instanceof Float) else if(this.value instanceof Float)
{ {
return new FloatNBT((Float) this.value); return FloatNBT.func_229689_a_((Float) this.value);
} }
else if(this.value instanceof Double) else if(this.value instanceof Double)
{ {
return new DoubleNBT((Double) this.value); return DoubleNBT.func_229684_a_((Double) this.value);
} }
else if(this.value instanceof Long) else if(this.value instanceof Long)
{ {
return new LongNBT((Long) this.value); return LongNBT.func_229698_a_((Long) this.value);
} }
else if(this.value instanceof Short) else if(this.value instanceof Short)
{ {
return new ShortNBT((Short) this.value); return ShortNBT.func_229701_a_((Short) this.value);
} }
else if(this.value instanceof Byte[]) else if(this.value instanceof Byte[])
{ {

View File

@@ -23,7 +23,7 @@ public class BuilderSignEditor extends BuilderData
for(int x = 0; x < 4; x++) for(int x = 0; x < 4; x++)
{ {
this.sign[x] = this.registerNBTComponent(new ComponentTag<SignText>("Text" + (x + 1), new SignText(x), text -> new StringNBT(text.toString()))); this.sign[x] = this.registerNBTComponent(new ComponentTag<SignText>("Text" + (x + 1), new SignText(x), text -> StringNBT.func_229705_a_(text.toString())));
} }
} }

View File

@@ -349,7 +349,7 @@ public class BuilderSummon extends CommandBuilderNBT
{ {
if(string.getUnformattedComponentText() != null && !string.getUnformattedComponentText().isEmpty()) if(string.getUnformattedComponentText() != null && !string.getUnformattedComponentText().isEmpty())
{ {
return new StringNBT(string.serialize()); return StringNBT.func_229705_a_(string.serialize());
} }
return null; return null;

View File

@@ -21,7 +21,7 @@ public class ConfigCategorySettings
private final BooleanValue pause; private final BooleanValue pause;
private final BooleanValue customTimes; private final BooleanValue customTimes;
private final BooleanValue permissionQuery; private final BooleanValue permissionQuery;
private final BooleanValue highlightBlocks; // private final BooleanValue highlightBlocks;
private final IntValue dawn; private final IntValue dawn;
private final IntValue noon; private final IntValue noon;
private final IntValue sunset; private final IntValue sunset;
@@ -68,10 +68,10 @@ public class ConfigCategorySettings
.translation("gui.worldhandler.config.settings.permission_query") .translation("gui.worldhandler.config.settings.permission_query")
.comment("Whether or not the permission query is enabled") .comment("Whether or not the permission query is enabled")
.define("permission_query", true); .define("permission_query", true);
this.highlightBlocks = builder // this.highlightBlocks = builder
.translation("gui.worldhandler.config.settings.highlight_blocks") // .translation("gui.worldhandler.config.settings.highlight_blocks")
.comment("Whether or not selected blocks will be highlighted") // .comment("Whether or not selected blocks will be highlighted")
.define("highlight_blocks", true); // .define("highlight_blocks", true);
this.dawn = builder this.dawn = builder
.translation("gui.worldhandler.config.settings.custom_time_dawn") .translation("gui.worldhandler.config.settings.custom_time_dawn")
@@ -188,15 +188,15 @@ public class ConfigCategorySettings
Config.set(this.permissionQuery, enabled); Config.set(this.permissionQuery, enabled);
} }
public boolean highlightBlocks() // public boolean highlightBlocks()
{ // {
return this.highlightBlocks.get(); // return this.highlightBlocks.get();
} // }
//
public void setHighlightBlocks(boolean enabled) // public void setHighlightBlocks(boolean enabled)
{ // {
Config.set(this.highlightBlocks, enabled); // Config.set(this.highlightBlocks, enabled);
} // }
public int getDawn() public int getDawn()
{ {

View File

@@ -1,20 +1,13 @@
package exopandora.worldhandler.event; package exopandora.worldhandler.event;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.ParseResults; import com.mojang.brigadier.ParseResults;
import com.mojang.brigadier.StringReader; import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.CommandSyntaxException;
import exopandora.worldhandler.config.Config;
import exopandora.worldhandler.util.BlockHelper;
import exopandora.worldhandler.util.CommandHelper; import exopandora.worldhandler.util.CommandHelper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.command.CommandSource; import net.minecraft.command.CommandSource;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.ClientChatEvent; import net.minecraftforge.client.event.ClientChatEvent;
@@ -27,63 +20,66 @@ public class ClientEventHandler
@SubscribeEvent @SubscribeEvent
public static void renderWorldLastEvent(RenderWorldLastEvent event) public static void renderWorldLastEvent(RenderWorldLastEvent event)
{ {
if(Config.getSettings().highlightBlocks() && Minecraft.getInstance().world != null && Minecraft.getInstance().getRenderManager().info != null) // if(Config.getSettings().highlightBlocks() && Minecraft.getInstance().world != null && Minecraft.getInstance().getRenderManager().info != null)
{ // {
GlStateManager.pushMatrix(); // final double constant = 0.0020000000949949026D;
GlStateManager.disableAlphaTest(); // Vec3d projected = Minecraft.getInstance().getRenderManager().info.getProjectedView();
GlStateManager.enableBlend(); //
GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); // double minX = Math.min(BlockHelper.getPos1().getX(), BlockHelper.getPos2().getX()) - constant - projected.getX();
GlStateManager.lineWidth(2.0F); // double minY = Math.min(BlockHelper.getPos1().getY(), BlockHelper.getPos2().getY()) - constant - projected.getY();
GlStateManager.disableTexture(); // double minZ = Math.min(BlockHelper.getPos1().getZ(), BlockHelper.getPos2().getZ()) - constant - projected.getZ();
GlStateManager.depthMask(false); //
// double maxX = Math.max(BlockHelper.getPos1().getX(), BlockHelper.getPos2().getX()) + constant - projected.getX() + 1;
final double constant = 0.0020000000949949026D; // double maxY = Math.max(BlockHelper.getPos1().getY(), BlockHelper.getPos2().getY()) + constant - projected.getY() + 1;
Vec3d projected = Minecraft.getInstance().getRenderManager().info.getProjectedView(); // double maxZ = Math.max(BlockHelper.getPos1().getZ(), BlockHelper.getPos2().getZ()) + constant - projected.getZ() + 1;
//
double minX = Math.min(BlockHelper.getPos1().getX(), BlockHelper.getPos2().getX()) - constant - projected.x; // IVertexBuilder builder = Minecraft.getInstance().func_228019_au_().func_228487_b_().getBuffer(RenderType.func_228659_m_());
double minY = Math.min(BlockHelper.getPos1().getY(), BlockHelper.getPos2().getY()) - constant - projected.y; // WorldRenderer.func_228427_a_(event.getMatrixStack(), builder, minX, minY, minZ, maxX, maxY, maxZ, 1.0F, 0.5F, 0.5F, 1.0F);
double minZ = Math.min(BlockHelper.getPos1().getZ(), BlockHelper.getPos2().getZ()) - constant - projected.z; //
// RenderSystem.pushMatrix();
double maxX = Math.max(BlockHelper.getPos1().getX(), BlockHelper.getPos2().getX()) + constant - projected.x + 1; // RenderSystem.disableAlphaTest();
double maxY = Math.max(BlockHelper.getPos1().getY(), BlockHelper.getPos2().getY()) + constant - projected.y + 1; // RenderSystem.enableBlend();
double maxZ = Math.max(BlockHelper.getPos1().getZ(), BlockHelper.getPos2().getZ()) + constant - projected.z + 1; // RenderSystem.defaultBlendFunc();
// RenderSystem.lineWidth(2.0F);
Tessellator tesselator = Tessellator.getInstance(); // RenderSystem.disableTexture();
BufferBuilder buffer = tesselator.getBuffer(); // RenderSystem.depthMask(false);
//
final int alpha = 255; // Tessellator tesselator = Tessellator.getInstance();
final int color1 = 223; // BufferBuilder buffer = tesselator.getBuffer();
final int color2 = 127; //
// final int alpha = 255;
GlStateManager.lineWidth(2.0F); // final int color1 = 223;
buffer.begin(3, DefaultVertexFormats.POSITION_COLOR); // final int color2 = 127;
buffer.pos(minX, minY, minZ).color((float) color1, (float) color1, (float) color1, 0.0F).endVertex(); //
buffer.pos(minX, minY, minZ).color(color1, color1, color1, alpha).endVertex(); // RenderSystem.lineWidth(2.0F);
buffer.pos(maxX, minY, minZ).color(color1, color2, color2, alpha).endVertex(); // buffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
buffer.pos(maxX, minY, maxZ).color(color1, color1, color1, alpha).endVertex(); // buffer.func_225582_a_(minX, minY, minZ).func_225586_a_(color1, color1, color1, 0).endVertex();
buffer.pos(minX, minY, maxZ).color(color1, color1, color1, alpha).endVertex(); // buffer.func_225582_a_(minX, minY, minZ).func_225586_a_(color1, color1, color1, alpha).endVertex();
buffer.pos(minX, minY, minZ).color(color2, color2, color1, alpha).endVertex(); // buffer.func_225582_a_(maxX, minY, minZ).func_225586_a_(color1, color2, color2, alpha).endVertex();
buffer.pos(minX, maxY, minZ).color(color2, color1, color2, alpha).endVertex(); // buffer.func_225582_a_(maxX, minY, maxZ).func_225586_a_(color1, color1, color1, alpha).endVertex();
buffer.pos(maxX, maxY, minZ).color(color1, color1, color1, alpha).endVertex(); // buffer.func_225582_a_(minX, minY, maxZ).func_225586_a_(color1, color1, color1, alpha).endVertex();
buffer.pos(maxX, maxY, maxZ).color(color1, color1, color1, alpha).endVertex(); // buffer.func_225582_a_(minX, minY, minZ).func_225586_a_(color2, color2, color1, alpha).endVertex();
buffer.pos(minX, maxY, maxZ).color(color1, color1, color1, alpha).endVertex(); // buffer.func_225582_a_(minX, maxY, minZ).func_225586_a_(color2, color1, color2, alpha).endVertex();
buffer.pos(minX, maxY, minZ).color(color1, color1, color1, alpha).endVertex(); // buffer.func_225582_a_(maxX, maxY, minZ).func_225586_a_(color1, color1, color1, alpha).endVertex();
buffer.pos(minX, maxY, maxZ).color(color1, color1, color1, alpha).endVertex(); // buffer.func_225582_a_(maxX, maxY, maxZ).func_225586_a_(color1, color1, color1, alpha).endVertex();
buffer.pos(minX, minY, maxZ).color(color1, color1, color1, alpha).endVertex(); // buffer.func_225582_a_(minX, maxY, maxZ).func_225586_a_(color1, color1, color1, alpha).endVertex();
buffer.pos(maxX, minY, maxZ).color(color1, color1, color1, alpha).endVertex(); // buffer.func_225582_a_(minX, maxY, minZ).func_225586_a_(color1, color1, color1, alpha).endVertex();
buffer.pos(maxX, maxY, maxZ).color(color1, color1, color1, alpha).endVertex(); // buffer.func_225582_a_(minX, maxY, maxZ).func_225586_a_(color1, color1, color1, alpha).endVertex();
buffer.pos(maxX, maxY, minZ).color(color1, color1, color1, alpha).endVertex(); // buffer.func_225582_a_(minX, minY, maxZ).func_225586_a_(color1, color1, color1, alpha).endVertex();
buffer.pos(maxX, minY, minZ).color(color1, color1, color1, alpha).endVertex(); // buffer.func_225582_a_(maxX, minY, maxZ).func_225586_a_(color1, color1, color1, alpha).endVertex();
buffer.pos(maxX, minY, minZ).color((float) color1, (float) color1, (float) color1, 0.0F).endVertex(); // buffer.func_225582_a_(maxX, maxY, maxZ).func_225586_a_(color1, color1, color1, alpha).endVertex();
tesselator.draw(); // buffer.func_225582_a_(maxX, maxY, minZ).func_225586_a_(color1, color1, color1, alpha).endVertex();
// buffer.func_225582_a_(maxX, minY, minZ).func_225586_a_(color1, color1, color1, alpha).endVertex();
GlStateManager.lineWidth(1.0F); // buffer.func_225582_a_(maxX, minY, minZ).func_225586_a_(color1, color1, color1, 0).endVertex();
GlStateManager.depthMask(true); // tesselator.draw();
GlStateManager.enableTexture(); //
GlStateManager.disableBlend(); // RenderSystem.lineWidth(1.0F);
GlStateManager.enableAlphaTest(); // RenderSystem.depthMask(true);
GlStateManager.popMatrix(); // RenderSystem.enableTexture();
} // RenderSystem.disableBlend();
// RenderSystem.enableAlphaTest();
// RenderSystem.popMatrix();
// }
} }
@SubscribeEvent @SubscribeEvent

View File

@@ -0,0 +1,24 @@
package exopandora.worldhandler.gui;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class DummyScreen extends Screen
{
private final Runnable runnable;
public DummyScreen(Runnable runnable)
{
super(new StringTextComponent(""));
this.runnable = runnable;
}
@Override
protected void init()
{
this.runnable.run();
}
}

View File

@@ -1,6 +1,6 @@
package exopandora.worldhandler.gui.button; package exopandora.worldhandler.gui.button;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem;
import exopandora.worldhandler.config.Config; import exopandora.worldhandler.config.Config;
import exopandora.worldhandler.util.ActionHandler; import exopandora.worldhandler.util.ActionHandler;
@@ -29,11 +29,10 @@ public class GuiButtonBase extends Button
@Override @Override
protected void renderBg(Minecraft minecraft, int mouseX, int mouseY) protected void renderBg(Minecraft minecraft, int mouseX, int mouseY)
{ {
GlStateManager.enableBlend(); RenderSystem.enableBlend();
GlStateManager.color4f(Config.getSkin().getButtonRedF(), Config.getSkin().getButtonGreenF(), Config.getSkin().getButtonBlueF(), Config.getSkin().getButtonAlphaF()); RenderSystem.color4f(Config.getSkin().getButtonRedF(), Config.getSkin().getButtonGreenF(), Config.getSkin().getButtonBlueF(), Config.getSkin().getButtonAlphaF());
int hovered = this.getYImage(this.isHovered()); int hovered = this.getYImage(this.isHovered());
Minecraft.getInstance().getTextureManager().bindTexture(ResourceHelper.getButtonTexture()); Minecraft.getInstance().getTextureManager().bindTexture(ResourceHelper.getButtonTexture());
if(Config.getSkin().getTextureType().equals("resourcepack")) if(Config.getSkin().getTextureType().equals("resourcepack"))
@@ -47,7 +46,7 @@ public class GuiButtonBase extends Button
this.blit(this.x + this.width / 2, this.y, 200 - this.width / 2, hovered * 20, this.width / 2, this.height); this.blit(this.x + this.width / 2, this.y, 200 - this.width / 2, hovered * 20, this.width / 2, this.height);
} }
GlStateManager.disableBlend(); RenderSystem.disableBlend();
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
} }
} }

View File

@@ -1,6 +1,6 @@
package exopandora.worldhandler.gui.button; package exopandora.worldhandler.gui.button;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem;
import exopandora.worldhandler.util.ActionHandler; import exopandora.worldhandler.util.ActionHandler;
import exopandora.worldhandler.util.ResourceHelper; import exopandora.worldhandler.util.ResourceHelper;
@@ -38,16 +38,16 @@ public class GuiButtonIcon extends GuiButtonTooltip
{ {
if(this.isHovered()) if(this.isHovered())
{ {
GlStateManager.color4f(1.0F, 1.0F, 0.6F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 0.6F, 1.0F);
} }
else else
{ {
GlStateManager.color4f(0.95F, 0.95F, 0.95F, 1.0F); RenderSystem.color4f(0.95F, 0.95F, 0.95F, 1.0F);
} }
} }
else else
{ {
GlStateManager.color4f(0.8F, 0.8F, 0.8F, 1.0F); RenderSystem.color4f(0.8F, 0.8F, 0.8F, 1.0F);
} }
this.blit(this.x + this.width / 2 - 4, this.y + 6, this.icon.getX() * 8, this.icon.getY() * 8, 8, 8); this.blit(this.x + this.width / 2 - 4, this.y + 6, this.icon.getX() * 8, this.icon.getY() * 8, 8, 8);

View File

@@ -1,6 +1,6 @@
package exopandora.worldhandler.gui.button; package exopandora.worldhandler.gui.button;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem;
import exopandora.worldhandler.util.ActionHandler; import exopandora.worldhandler.util.ActionHandler;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@@ -31,13 +31,13 @@ public class GuiButtonItem extends GuiButtonBase
{ {
super.renderBg(Minecraft.getInstance(), mouseX, mouseY); super.renderBg(Minecraft.getInstance(), mouseX, mouseY);
GlStateManager.enableRescaleNormal(); RenderSystem.enableRescaleNormal();
RenderHelper.enableGUIStandardItemLighting(); RenderHelper.func_227784_d_();
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(this.stack, this.x + this.width / 2 - 8, this.y + 2); Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(this.stack, this.x + this.width / 2 - 8, this.y + 2);
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
GlStateManager.disableRescaleNormal(); RenderSystem.disableRescaleNormal();
GlStateManager.enableAlphaTest(); RenderSystem.enableAlphaTest();
} }
} }

View File

@@ -1,6 +1,6 @@
package exopandora.worldhandler.gui.button; package exopandora.worldhandler.gui.button;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem;
import exopandora.worldhandler.Main; import exopandora.worldhandler.Main;
import exopandora.worldhandler.config.Config; import exopandora.worldhandler.config.Config;
@@ -52,7 +52,7 @@ public class GuiButtonPiano extends GuiButtonBase
} }
int hoverstate = this.getYImage(this.isHovered); int hoverstate = this.getYImage(this.isHovered);
GlStateManager.color4f(1.0F, 1.0F, 1.0F, Config.getSkin().getButtonAlphaF()); RenderSystem.color4f(1.0F, 1.0F, 1.0F, Config.getSkin().getButtonAlphaF());
Minecraft.getInstance().getTextureManager().bindTexture(NOTE); Minecraft.getInstance().getTextureManager().bindTexture(NOTE);
switch(this.type) switch(this.type)

View File

@@ -2,7 +2,7 @@ package exopandora.worldhandler.gui.button;
import java.util.Objects; import java.util.Objects;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem;
import exopandora.worldhandler.config.Config; import exopandora.worldhandler.config.Config;
import exopandora.worldhandler.gui.container.Container; import exopandora.worldhandler.gui.container.Container;
@@ -38,15 +38,15 @@ public class GuiSlider extends GuiButtonBase
int xOffset = Config.getSkin().getTextureType().equals("resourcepack") ? 0 : -46; int xOffset = Config.getSkin().getTextureType().equals("resourcepack") ? 0 : -46;
GlStateManager.pushMatrix(); RenderSystem.pushMatrix();
GlStateManager.enableBlend(); RenderSystem.enableBlend();
GlStateManager.color4f(Config.getSkin().getButtonRedF(), Config.getSkin().getButtonGreenF(), Config.getSkin().getButtonBlueF(), Config.getSkin().getButtonAlphaF()); RenderSystem.color4f(Config.getSkin().getButtonRedF(), Config.getSkin().getButtonGreenF(), Config.getSkin().getButtonBlueF(), Config.getSkin().getButtonAlphaF());
this.blit(this.x + (int) (this.persistence.getValue() * (float) (this.width - 8)), this.y, 0, 66 + xOffset, 4, 20); this.blit(this.x + (int) (this.persistence.getValue() * (float) (this.width - 8)), this.y, 0, 66 + xOffset, 4, 20);
this.blit(this.x + (int) (this.persistence.getValue() * (float) (this.width - 8)) + 4, this.y, 196, 66 + xOffset, 4, 20); this.blit(this.x + (int) (this.persistence.getValue() * (float) (this.width - 8)) + 4, this.y, 196, 66 + xOffset, 4, 20);
GlStateManager.disableBlend(); RenderSystem.disableBlend();
GlStateManager.popMatrix(); RenderSystem.popMatrix();
} }
@Override @Override

View File

@@ -9,7 +9,7 @@ import java.util.function.BiConsumer;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem;
import exopandora.worldhandler.Main; import exopandora.worldhandler.Main;
import exopandora.worldhandler.builder.impl.BuilderWorldHandler; import exopandora.worldhandler.builder.impl.BuilderWorldHandler;
@@ -190,26 +190,6 @@ public class GuiWorldHandler extends Container
} }
} }
private int getContentX()
{
return this.getBackgroundX() + 8;
}
private int getContentY()
{
return this.getBackgroundY() + 33;
}
private int getXOffset()
{
return 0;
}
private int getYOffset()
{
return Config.getSettings().shortcuts() ? 11 : 8;
}
@Override @Override
public void tick() public void tick()
{ {
@@ -300,55 +280,6 @@ public class GuiWorldHandler extends Container
this.content.onPlayerNameChanged(GuiWorldHandler.player); this.content.onPlayerNameChanged(GuiWorldHandler.player);
} }
private void defaultColor()
{
this.defaultColor(1.0F);
}
private void defaultColor(float alpha)
{
GlStateManager.enableBlend();
GlStateManager.color4f(Config.getSkin().getBackgroundRedF(), Config.getSkin().getBackgroundGreenF(), Config.getSkin().getBackgroundBlueF(), alpha * Config.getSkin().getBackgroundAlphaF());
}
private void darkColor()
{
GlStateManager.enableBlend();
GlStateManager.color4f(Config.getSkin().getBackgroundRedF() - 0.3F, Config.getSkin().getBackgroundGreenF() - 0.3F, Config.getSkin().getBackgroundBlueF() - 0.3F, Config.getSkin().getBackgroundAlphaF());
}
private void bindBackground()
{
Minecraft.getInstance().getTextureManager().bindTexture(ResourceHelper.getBackgroundTexture());
}
@Nullable
protected String getSplash()
{
Calendar calendar = Calendar.getInstance();
int day = calendar.get(Calendar.DAY_OF_MONTH);
int month = calendar.get(Calendar.MONTH) + 1;
if(day == 12 && month == 24)
{
return "Merry X-mas!";
}
else if(day == 1 && month == 1)
{
return "Happy new year!";
}
else if(day == 10 && month == 31)
{
return "OOoooOOOoooo! Spooky!";
}
else if(day == 3 && month == 28)
{
return (calendar.get(Calendar.YEAR) - 2013) + " Years of World Handler!";
}
return null;
}
@Override @Override
public void render(int mouseX, int mouseY, float partialTicks) public void render(int mouseX, int mouseY, float partialTicks)
{ {
@@ -361,6 +292,7 @@ public class GuiWorldHandler extends Container
if(Config.getSkin().drawBackground()) if(Config.getSkin().drawBackground())
{ {
this.setBlitOffset(-1);
super.renderBackground(); super.renderBackground();
} }
@@ -375,6 +307,7 @@ public class GuiWorldHandler extends Container
//TABS //TABS
this.setBlitOffset(0);
this.forEachTab(this::drawTab); this.forEachTab(this::drawTab);
this.defaultColor(); this.defaultColor();
@@ -412,7 +345,7 @@ public class GuiWorldHandler extends Container
if(mouseX >= watchX && mouseX <= watchX + 9 && mouseY >= watchY && mouseY <= watchY + 9) if(mouseX >= watchX && mouseX <= watchX + 9 && mouseY >= watchY && mouseY <= watchY + 9)
{ {
GuiUtils.drawHoveringText(Arrays.asList(TextFormatting.formatWorldTime(Minecraft.getInstance().world.getDayTime())), mouseX, mouseY + 9, this.width, this.height, this.width, this.font); GuiUtils.drawHoveringText(Arrays.asList(TextFormatting.formatWorldTime(Minecraft.getInstance().world.getDayTime())), mouseX, mouseY + 9, this.width, this.height, this.width, this.font);
GlStateManager.disableLighting(); RenderSystem.disableLighting();
} }
} }
} }
@@ -446,19 +379,19 @@ public class GuiWorldHandler extends Container
if(this.splash != null) if(this.splash != null)
{ {
GlStateManager.pushMatrix(); RenderSystem.pushMatrix();
RenderHelper.enableGUIStandardItemLighting(); RenderHelper.func_227784_d_();
GlStateManager.disableLighting(); RenderSystem.disableLighting();
GlStateManager.translatef((float) (backgroundX + 212), backgroundY + 15, 0.0F); RenderSystem.translatef((float) (backgroundX + 212), backgroundY + 15, 0.0F);
GlStateManager.rotatef(17.0F, 0.0F, 0.0F, 1.0F); RenderSystem.rotatef(17.0F, 0.0F, 0.0F, 1.0F);
float scale = 1.1F - MathHelper.abs(MathHelper.sin((float) (System.currentTimeMillis() % 1000L) / 1000.0F * (float) Math.PI * 2.0F) * 0.1F); float scale = 1.1F - MathHelper.abs(MathHelper.sin((float) (System.currentTimeMillis() % 1000L) / 1000.0F * (float) Math.PI * 2.0F) * 0.1F);
scale = scale * 100.0F / this.font.getStringWidth(this.splash); scale = scale * 100.0F / this.font.getStringWidth(this.splash);
GlStateManager.scalef(scale, scale, scale); RenderSystem.scalef(scale, scale, scale);
this.drawCenteredString(this.font, this.splash, 0, (int) scale, 0xFFFF00); this.drawCenteredString(this.font, this.splash, 0, (int) scale, 0xFFFF00);
GlStateManager.popMatrix(); RenderSystem.popMatrix();
} }
//TOOLTIPS //TOOLTIPS
@@ -510,6 +443,7 @@ public class GuiWorldHandler extends Container
} }
this.bindBackground(); this.bindBackground();
this.setBlitOffset(-1);
this.blit((int) (backgroundX + xOffset), (int) (backgroundY + yOffset), 0, 0, (int) Math.ceil(this.tabHalf), fHeight); this.blit((int) (backgroundX + xOffset), (int) (backgroundY + yOffset), 0, 0, (int) Math.ceil(this.tabHalf), fHeight);
this.blit((int) (backgroundX + this.tabHalf + xOffset), (int) (backgroundY + yOffset), this.bgTextureWidth - (int) Math.floor(this.tabHalf + 1), 0, (int) Math.floor(this.tabHalf + 1), fHeight); this.blit((int) (backgroundX + this.tabHalf + xOffset), (int) (backgroundY + yOffset), this.bgTextureWidth - (int) Math.floor(this.tabHalf + 1), 0, (int) Math.floor(this.tabHalf + 1), fHeight);
@@ -596,6 +530,7 @@ public class GuiWorldHandler extends Container
} }
} }
this.setBlitOffset(0);
this.drawCenteredString(this.font, TextFormatting.shortenString(net.minecraft.util.text.TextFormatting.UNDERLINE + tab.getTabTitle(), (int) this.tabWidth, this.font), (int) (backgroundX + this.tabHalf + xOffset), (int) (backgroundY - 13), color); this.drawCenteredString(this.font, TextFormatting.shortenString(net.minecraft.util.text.TextFormatting.UNDERLINE + tab.getTabTitle(), (int) this.tabWidth, this.font), (int) (backgroundX + this.tabHalf + xOffset), (int) (backgroundY - 13), color);
} }
@@ -640,6 +575,75 @@ public class GuiWorldHandler extends Container
return super.keyPressed(keyCode, scanCode, modifiers); return super.keyPressed(keyCode, scanCode, modifiers);
} }
private void defaultColor()
{
this.defaultColor(1.0F);
}
private void defaultColor(float alpha)
{
RenderSystem.enableBlend();
RenderSystem.color4f(Config.getSkin().getBackgroundRedF(), Config.getSkin().getBackgroundGreenF(), Config.getSkin().getBackgroundBlueF(), alpha * Config.getSkin().getBackgroundAlphaF());
}
private void darkColor()
{
RenderSystem.enableBlend();
RenderSystem.color4f(Config.getSkin().getBackgroundRedF() - 0.3F, Config.getSkin().getBackgroundGreenF() - 0.3F, Config.getSkin().getBackgroundBlueF() - 0.3F, Config.getSkin().getBackgroundAlphaF());
}
private void bindBackground()
{
Minecraft.getInstance().getTextureManager().bindTexture(ResourceHelper.getBackgroundTexture());
}
private int getContentX()
{
return this.getBackgroundX() + 8;
}
private int getContentY()
{
return this.getBackgroundY() + 33;
}
private int getXOffset()
{
return 0;
}
private int getYOffset()
{
return Config.getSettings().shortcuts() ? 11 : 8;
}
@Nullable
protected String getSplash()
{
Calendar calendar = Calendar.getInstance();
int day = calendar.get(Calendar.DAY_OF_MONTH);
int month = calendar.get(Calendar.MONTH) + 1;
if(day == 12 && month == 24)
{
return "Merry X-mas!";
}
else if(day == 1 && month == 1)
{
return "Happy new year!";
}
else if(day == 10 && month == 31)
{
return "OOoooOOOoooo! Spooky!";
}
else if(day == 3 && month == 28)
{
return (calendar.get(Calendar.YEAR) - 2013) + " Years of World Handler!";
}
return null;
}
@Override @Override
public void onClose() public void onClose()
{ {

View File

@@ -1,17 +1,23 @@
package exopandora.worldhandler.gui.content.impl; package exopandora.worldhandler.gui.content.impl;
import exopandora.worldhandler.gui.DummyScreen;
import exopandora.worldhandler.gui.button.GuiButtonBase; import exopandora.worldhandler.gui.button.GuiButtonBase;
import exopandora.worldhandler.gui.container.Container; import exopandora.worldhandler.gui.container.Container;
import exopandora.worldhandler.util.ActionHelper; import exopandora.worldhandler.util.ActionHelper;
import exopandora.worldhandler.util.Connection;
import exopandora.worldhandler.util.Connection.DedicatedConnection;
import exopandora.worldhandler.util.Connection.IntegratedConnection;
import exopandora.worldhandler.util.Connection.Type;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.ConnectingScreen; import net.minecraft.client.gui.screen.ConnectingScreen;
import net.minecraft.client.gui.screen.DirtMessageScreen;
import net.minecraft.client.gui.screen.MainMenuScreen; import net.minecraft.client.gui.screen.MainMenuScreen;
import net.minecraft.client.gui.screen.MultiplayerScreen; import net.minecraft.client.gui.screen.MultiplayerScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.WorldSelectionScreen; import net.minecraft.client.gui.screen.WorldSelectionScreen;
import net.minecraft.client.multiplayer.ServerData; import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.realms.RealmsBridge;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@@ -26,49 +32,66 @@ public class ContentChangeWorld extends ContentChild
container.add(new GuiButtonBase(x + 116 / 2, y + 24, 232 / 2, 20, I18n.format("gui.worldhandler.change_world.singleplayer"), () -> container.add(new GuiButtonBase(x + 116 / 2, y + 24, 232 / 2, 20, I18n.format("gui.worldhandler.change_world.singleplayer"), () ->
{ {
Minecraft.getInstance().displayGuiScreen(new WorldSelectionScreen(container)); Connection connection = ContentChangeWorld.disconnect();
Minecraft.getInstance().displayGuiScreen(new WorldSelectionScreen(new DummyScreen(() -> ContentChangeWorld.reconnect(connection))));
})); }));
container.add(new GuiButtonBase(x + 116 / 2, y + 48, 232 / 2, 20, I18n.format("gui.worldhandler.change_world.multiplayer"), () -> container.add(new GuiButtonBase(x + 116 / 2, y + 48, 232 / 2, 20, I18n.format("gui.worldhandler.change_world.multiplayer"), () ->
{ {
ServerData server = Minecraft.getInstance().getCurrentServerData(); Connection connection = ContentChangeWorld.disconnect();
Minecraft.getInstance().displayGuiScreen(new MultiplayerScreen(new DummyScreen(() -> ContentChangeWorld.reconnect(connection))));
if(server != null)
{
Minecraft.getInstance().world.sendQuittingDisconnectingPacket();
Minecraft.getInstance().loadWorld(null);
Minecraft.getInstance().displayGuiScreen(new MultiplayerScreen(new Screen(new StringTextComponent(""))
{
@Override
public void init()
{
Minecraft.getInstance().displayGuiScreen(new ConnectingScreen(new MainMenuScreen(), Minecraft.getInstance(), server));
Minecraft.getInstance().mouseHelper.grabMouse();
}
}));
}
else
{
String worldName = Minecraft.getInstance().getIntegratedServer().getWorldName();
String folderName = Minecraft.getInstance().getIntegratedServer().getFolderName();
Minecraft.getInstance().world.sendQuittingDisconnectingPacket();
Minecraft.getInstance().loadWorld(null);
Minecraft.getInstance().displayGuiScreen(new MultiplayerScreen(new Screen(new StringTextComponent(""))
{
@Override
public void init()
{
Minecraft.getInstance().launchIntegratedServer(folderName, worldName, null);
Minecraft.getInstance().displayGuiScreen(null);
Minecraft.getInstance().mouseHelper.grabMouse();
}
}));
}
})); }));
} }
private static Connection disconnect()
{
boolean isIntegrated = Minecraft.getInstance().isIntegratedServerRunning();
boolean isRealms = Minecraft.getInstance().isConnectedToRealms();
ServerData data = Minecraft.getInstance().getCurrentServerData();
if(isIntegrated)
{
String worldName = Minecraft.getInstance().getIntegratedServer().getWorldName();
String folderName = Minecraft.getInstance().getIntegratedServer().getFolderName();
Minecraft.getInstance().world.sendQuittingDisconnectingPacket();
Minecraft.getInstance().func_213231_b(new DirtMessageScreen(new TranslationTextComponent("menu.savingLevel")));
return new IntegratedConnection(Type.INTEGRATED, worldName, folderName);
}
Minecraft.getInstance().world.sendQuittingDisconnectingPacket();
Minecraft.getInstance().func_213254_o();
if(isRealms)
{
return null;
}
return new DedicatedConnection(Type.DEDICATED, data);
}
private static void reconnect(Connection connection)
{
if(connection == null)
{
RealmsBridge realmsbridge = new RealmsBridge();
realmsbridge.switchToRealms(new MainMenuScreen());
}
else if(connection instanceof IntegratedConnection)
{
IntegratedConnection integrated = (IntegratedConnection) connection;
Minecraft.getInstance().launchIntegratedServer(integrated.getFolderName(), integrated.getWorldName(), null);
Minecraft.getInstance().mouseHelper.grabMouse();
}
else if(connection instanceof DedicatedConnection)
{
DedicatedConnection dedicated = (DedicatedConnection) connection;
Minecraft.getInstance().displayGuiScreen(new ConnectingScreen(new MainMenuScreen(), Minecraft.getInstance(), dedicated.getData()));
Minecraft.getInstance().mouseHelper.grabMouse();
}
}
@Override @Override
public String getTitle() public String getTitle()
{ {

View File

@@ -86,7 +86,7 @@ public class ContentMain extends Content
container.add(new GuiButtonBase(x + 78, y + 96, 76, 20, I18n.format("gui.worldhandler.resourcepack"), () -> container.add(new GuiButtonBase(x + 78, y + 96, 76, 20, I18n.format("gui.worldhandler.resourcepack"), () ->
{ {
Minecraft.getInstance().gameSettings.saveOptions(); Minecraft.getInstance().gameSettings.saveOptions();
Minecraft.getInstance().displayGuiScreen(new ResourcePacksScreen(container)); Minecraft.getInstance().displayGuiScreen(new ResourcePacksScreen(container, Minecraft.getInstance().gameSettings));
})); }));
container.add(new GuiButtonBase(x + 158, y + 96, 74, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame)); container.add(new GuiButtonBase(x + 158, y + 96, 74, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
} }

View File

@@ -1,6 +1,6 @@
package exopandora.worldhandler.gui.content.impl; package exopandora.worldhandler.gui.content.impl;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem;
import exopandora.worldhandler.Main; import exopandora.worldhandler.Main;
import exopandora.worldhandler.builder.ICommandBuilder; import exopandora.worldhandler.builder.ICommandBuilder;
@@ -178,7 +178,7 @@ public class ContentNoteEditor extends Content
{ {
if(this.isActive) if(this.isActive)
{ {
GlStateManager.color3f(1.0F, 1.0F, 1.0F); RenderSystem.color3f(1.0F, 1.0F, 1.0F);
Minecraft.getInstance().getTextureManager().bindTexture(NOTE); Minecraft.getInstance().getTextureManager().bindTexture(NOTE);
container.blit(x - 1, y - 1, 0, 0, 8, 59); container.blit(x - 1, y - 1, 0, 0, 8, 59);
@@ -194,16 +194,16 @@ public class ContentNoteEditor extends Content
{ {
float scale = 4; float scale = 4;
GlStateManager.color3f(1.0F, 1.0F, 1.0F); RenderSystem.color3f(1.0F, 1.0F, 1.0F);
GlStateManager.pushMatrix(); RenderSystem.pushMatrix();
RenderHelper.enableGUIStandardItemLighting(); RenderHelper.func_227784_d_();
GlStateManager.translatef(container.width / 2 - 8 * scale, container.height / 2 - 15 - 8 * scale, 0); RenderSystem.translatef(container.width / 2 - 8 * scale, container.height / 2 - 15 - 8 * scale, 0);
GlStateManager.scalef(scale, scale, scale); RenderSystem.scalef(scale, scale, scale);
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(new ItemStack(Blocks.NOTE_BLOCK), 0, 0); Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(new ItemStack(Blocks.NOTE_BLOCK), 0, 0);
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
GlStateManager.popMatrix(); RenderSystem.popMatrix();
String displayString = I18n.format("gui.worldhandler.blocks.note_block_editor.look_at_note_block", KeyHandler.KEY_WORLD_HANDLER.getLocalizedName()); String displayString = I18n.format("gui.worldhandler.blocks.note_block_editor.look_at_note_block", KeyHandler.KEY_WORLD_HANDLER.getLocalizedName());
FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer; FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;

View File

@@ -1,6 +1,6 @@
package exopandora.worldhandler.gui.content.impl; package exopandora.worldhandler.gui.content.impl;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem;
import exopandora.worldhandler.builder.ICommandBuilder; import exopandora.worldhandler.builder.ICommandBuilder;
import exopandora.worldhandler.builder.impl.BuilderGeneric; import exopandora.worldhandler.builder.impl.BuilderGeneric;
@@ -115,9 +115,9 @@ public class ContentPlayer extends Content
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, I18n.format("gui.worldhandler.entities.player.position.copy_position"), () -> container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, I18n.format("gui.worldhandler.entities.player.position.copy_position"), () ->
{ {
int posX = MathHelper.floor(Minecraft.getInstance().player.posX); int posX = MathHelper.floor(Minecraft.getInstance().player.func_226277_ct_());
int posY = MathHelper.floor(Minecraft.getInstance().player.posY); int posY = MathHelper.floor(Minecraft.getInstance().player.func_226278_cu_());
int posZ = MathHelper.floor(Minecraft.getInstance().player.posZ); int posZ = MathHelper.floor(Minecraft.getInstance().player.func_226281_cx_());
Minecraft.getInstance().keyboardListener.setClipboardString(posX + " " + posY + " " + posZ); Minecraft.getInstance().keyboardListener.setClipboardString(posX + " " + posY + " " + posZ);
})); }));
@@ -148,9 +148,9 @@ public class ContentPlayer extends Content
@Override @Override
public void tick(Container container) public void tick(Container container)
{ {
this.posXField.setText("X: " + MathHelper.floor(Minecraft.getInstance().player.posX)); this.posXField.setText("X: " + MathHelper.floor(Minecraft.getInstance().player.func_226277_ct_()));
this.posYField.setText("Y: " + MathHelper.floor(Minecraft.getInstance().player.posY)); this.posYField.setText("Y: " + MathHelper.floor(Minecraft.getInstance().player.func_226278_cu_()));
this.posZField.setText("Z: " + MathHelper.floor(Minecraft.getInstance().player.posZ)); this.posZField.setText("Z: " + MathHelper.floor(Minecraft.getInstance().player.func_226281_cx_()));
this.scoreField.setText(I18n.format("gui.worldhandler.entities.player.score") + ": " + Minecraft.getInstance().player.getScore()); this.scoreField.setText(I18n.format("gui.worldhandler.entities.player.score") + ": " + Minecraft.getInstance().player.getScore());
this.coinsField.setText(I18n.format("gui.worldhandler.entities.player.score.experience") + ": " + Minecraft.getInstance().player.experienceLevel + "L"); this.coinsField.setText(I18n.format("gui.worldhandler.entities.player.score.experience") + ": " + Minecraft.getInstance().player.experienceLevel + "L");
this.xpField.setText(I18n.format("gui.worldhandler.entities.player.score.experience_coins") + ": " + Minecraft.getInstance().player.experienceTotal); this.xpField.setText(I18n.format("gui.worldhandler.entities.player.score.experience_coins") + ": " + Minecraft.getInstance().player.experienceTotal);
@@ -168,9 +168,9 @@ public class ContentPlayer extends Content
Screen.fill(container.width / 2 - playerNameWidth - 1 + 59, yPos - 74, container.width / 2 + playerNameWidth + 1 + 59, yPos - 65, 0x3F000000); Screen.fill(container.width / 2 - playerNameWidth - 1 + 59, yPos - 74, container.width / 2 + playerNameWidth + 1 + 59, yPos - 65, 0x3F000000);
Minecraft.getInstance().fontRenderer.drawString(Minecraft.getInstance().player.getName().getFormattedText(), container.width / 2 - playerNameWidth + 59, yPos - 73, 0xE0E0E0); Minecraft.getInstance().fontRenderer.drawString(Minecraft.getInstance().player.getName().getFormattedText(), container.width / 2 - playerNameWidth + 59, yPos - 73, 0xE0E0E0);
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
InventoryScreen.drawEntityOnScreen(xPos, yPos, 30, xPos - mouseX, yPos - mouseY - 44, Minecraft.getInstance().player); InventoryScreen.func_228187_a_(xPos, yPos, 30, xPos - mouseX, yPos - mouseY - 44, Minecraft.getInstance().player);
GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); RenderSystem.defaultBlendFunc();
} }
else if(Page.SCORE.equals(this.page)) else if(Page.SCORE.equals(this.page))
{ {

View File

@@ -200,7 +200,7 @@ public class ContentPotions extends ContentChild
container.init(); container.init();
})); }));
boolean enabled = this.builderPotion.getAmplifier() >= 0; boolean enabled = this.builderPotion.getAmplifier() >= 0 && this.builderPotion.getDuration() > 0;
button1.active = enabled; button1.active = enabled;
button2.active = enabled; button2.active = enabled;

View File

@@ -36,7 +36,7 @@ public class ContentSettings extends ContentChild
SETTINGS.add(new BooleanSetting("pause_game", Config.CLIENT.getSettings()::pause, Config.CLIENT.getSettings()::setPause)); SETTINGS.add(new BooleanSetting("pause_game", Config.CLIENT.getSettings()::pause, Config.CLIENT.getSettings()::setPause));
SETTINGS.add(new BooleanSetting("custom_times", Config.CLIENT.getSettings()::customTimes, Config.CLIENT.getSettings()::setCustomTimes)); SETTINGS.add(new BooleanSetting("custom_times", Config.CLIENT.getSettings()::customTimes, Config.CLIENT.getSettings()::setCustomTimes));
SETTINGS.add(new BooleanSetting("permission_query", Config.CLIENT.getSettings()::permissionQuery, Config.CLIENT.getSettings()::setPermissionQuery)); SETTINGS.add(new BooleanSetting("permission_query", Config.CLIENT.getSettings()::permissionQuery, Config.CLIENT.getSettings()::setPermissionQuery));
SETTINGS.add(new BooleanSetting("highlight_blocks", Config.CLIENT.getSettings()::highlightBlocks, Config.CLIENT.getSettings()::setHighlightBlocks)); // SETTINGS.add(new BooleanSetting("highlight_blocks", Config.CLIENT.getSettings()::highlightBlocks, Config.CLIENT.getSettings()::setHighlightBlocks));
SETTINGS.add(new IntegerSetting("custom_time_dawn", Config.CLIENT.getSettings()::getDawn, Config.CLIENT.getSettings()::setDawn)); SETTINGS.add(new IntegerSetting("custom_time_dawn", Config.CLIENT.getSettings()::getDawn, Config.CLIENT.getSettings()::setDawn));
SETTINGS.add(new IntegerSetting("custom_time_noon", Config.CLIENT.getSettings()::getNoon, Config.CLIENT.getSettings()::setNoon)); SETTINGS.add(new IntegerSetting("custom_time_noon", Config.CLIENT.getSettings()::getNoon, Config.CLIENT.getSettings()::setNoon));
SETTINGS.add(new IntegerSetting("custom_time_sunset", Config.CLIENT.getSettings()::getSunset, Config.CLIENT.getSettings()::setSunset)); SETTINGS.add(new IntegerSetting("custom_time_sunset", Config.CLIENT.getSettings()::getSunset, Config.CLIENT.getSettings()::setSunset));

View File

@@ -2,7 +2,7 @@ package exopandora.worldhandler.gui.content.impl;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem;
import exopandora.worldhandler.builder.ICommandBuilder; import exopandora.worldhandler.builder.ICommandBuilder;
import exopandora.worldhandler.builder.impl.BuilderSignEditor; import exopandora.worldhandler.builder.impl.BuilderSignEditor;
@@ -179,16 +179,16 @@ public class ContentSignEditor extends Content
{ {
float scale = 4; float scale = 4;
GlStateManager.color3f(1.0F, 1.0F, 1.0F); RenderSystem.color3f(1.0F, 1.0F, 1.0F);
GlStateManager.pushMatrix(); RenderSystem.pushMatrix();
RenderHelper.enableGUIStandardItemLighting(); RenderHelper.func_227784_d_();
GlStateManager.translatef(container.width / 2 - 8.5F * scale, container.height / 2 - 15 - 8.5F * scale, 0); RenderSystem.translatef(container.width / 2 - 8.5F * scale, container.height / 2 - 15 - 8.5F * scale, 0);
GlStateManager.scalef(scale, scale, scale); RenderSystem.scalef(scale, scale, scale);
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(new ItemStack(Items.OAK_SIGN), 0, 0); Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(new ItemStack(Items.OAK_SIGN), 0, 0);
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
GlStateManager.popMatrix(); RenderSystem.popMatrix();
String displayString = I18n.format("gui.worldhandler.blocks.sign_editor.look_at_sign", KeyHandler.KEY_WORLD_HANDLER.getLocalizedName()); String displayString = I18n.format("gui.worldhandler.blocks.sign_editor.look_at_sign", KeyHandler.KEY_WORLD_HANDLER.getLocalizedName());
FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer; FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;

View File

@@ -4,9 +4,8 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.lwjgl.opengl.GL11;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.mojang.blaze3d.systems.RenderSystem;
import exopandora.worldhandler.builder.ICommandBuilder; import exopandora.worldhandler.builder.ICommandBuilder;
import exopandora.worldhandler.builder.impl.BuilderSummon; import exopandora.worldhandler.builder.impl.BuilderSummon;
@@ -594,8 +593,9 @@ public class ContentSummon extends Content
} }
else if(Page.EQUIPMENT.equals(this.page)) else if(Page.EQUIPMENT.equals(this.page))
{ {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getInstance().getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/beacon.png")); Minecraft.getInstance().getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/beacon.png"));
container.setBlitOffset(0);
for(int row = 0; row < 3; row++) for(int row = 0; row < 3; row++)
{ {

View File

@@ -1,8 +1,10 @@
package exopandora.worldhandler.util; package exopandora.worldhandler.util;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.stream.Collectors;
import net.minecraft.advancements.Advancement; import net.minecraft.advancements.Advancement;
import net.minecraft.advancements.AdvancementManager; import net.minecraft.advancements.AdvancementManager;
@@ -10,6 +12,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.profiler.IProfiler; import net.minecraft.profiler.IProfiler;
import net.minecraft.resources.IFutureReloadListener; import net.minecraft.resources.IFutureReloadListener;
import net.minecraft.resources.IResourceManager; import net.minecraft.resources.IResourceManager;
import net.minecraft.resources.IResourcePack;
import net.minecraft.resources.ResourcePackInfo; import net.minecraft.resources.ResourcePackInfo;
import net.minecraft.resources.ResourcePackType; import net.minecraft.resources.ResourcePackType;
import net.minecraft.resources.SimpleReloadableResourceManager; import net.minecraft.resources.SimpleReloadableResourceManager;
@@ -30,13 +33,13 @@ public class AdvancementHelper implements IFutureReloadListener
return CompletableFuture.supplyAsync(() -> return CompletableFuture.supplyAsync(() ->
{ {
SimpleReloadableResourceManager serverResourceManager = new SimpleReloadableResourceManager(ResourcePackType.SERVER_DATA, Thread.currentThread()); SimpleReloadableResourceManager serverResourceManager = new SimpleReloadableResourceManager(ResourcePackType.SERVER_DATA, Thread.currentThread());
Minecraft.getInstance().getResourcePackList().getEnabledPacks().stream().map(ResourcePackInfo::getResourcePack).forEach(serverResourceManager::addResourcePack);
serverResourceManager.addReloadListener(new NetworkTagManager()); serverResourceManager.addReloadListener(new NetworkTagManager());
serverResourceManager.addReloadListener(this.manager); serverResourceManager.addReloadListener(this.manager);
return serverResourceManager; return serverResourceManager;
}).thenCompose(stage::markCompleteAwaitingOthers).thenAcceptAsync(serverResourceManager -> }).thenCompose(stage::markCompleteAwaitingOthers).thenAcceptAsync(serverResourceManager ->
{ {
serverResourceManager.initialReload(backgroundExecutor, gameExecutor, CompletableFuture.completedFuture(Unit.INSTANCE)); List<IResourcePack> list = Minecraft.getInstance().getResourcePackList().getEnabledPacks().stream().map(ResourcePackInfo::getResourcePack).collect(Collectors.toList());
serverResourceManager.reloadResources(backgroundExecutor, gameExecutor, CompletableFuture.completedFuture(Unit.INSTANCE), list);
}); });
} }

View File

@@ -0,0 +1,68 @@
package exopandora.worldhandler.util;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public abstract class Connection
{
private final Type type;
public Connection(Type type)
{
this.type = type;
}
public Type getType()
{
return this.type;
}
@OnlyIn(Dist.CLIENT)
public static enum Type
{
INTEGRATED,
DEDICATED;
}
@OnlyIn(Dist.CLIENT)
public static class IntegratedConnection extends Connection
{
private final String worldName;
private final String folderName;
public IntegratedConnection(Type type, String worldName, String folderName)
{
super(type);
this.worldName = worldName;
this.folderName = folderName;
}
public String getWorldName()
{
return this.worldName;
}
public String getFolderName()
{
return this.folderName;
}
}
@OnlyIn(Dist.CLIENT)
public static class DedicatedConnection extends Connection
{
private final ServerData data;
public DedicatedConnection(Type type, ServerData data)
{
super(type);
this.data = data;
}
public ServerData getData()
{
return this.data;
}
}
}

View File

@@ -1,6 +1,6 @@
package exopandora.worldhandler.util; package exopandora.worldhandler.util;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem;
import exopandora.worldhandler.config.Config; import exopandora.worldhandler.config.Config;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@@ -25,29 +25,29 @@ public class UtilRender
float rotationHour = (360 / 12) * (hour >= 12 ? (hour - 12) : hour) - 180F; float rotationHour = (360 / 12) * (hour >= 12 ? (hour - 12) : hour) - 180F;
float rotationMinute = (360 / 60) * minute - 180F; float rotationMinute = (360 / 60) * minute - 180F;
GlStateManager.pushMatrix(); RenderSystem.pushMatrix();
GlStateManager.translatef(width + 5, height + 5, 0F); RenderSystem.translatef(width + 5, height + 5, 0F);
GlStateManager.scalef(0.25F, 0.25F, 0.25F); RenderSystem.scalef(0.25F, 0.25F, 0.25F);
GlStateManager.rotatef(rotationHour, 0F, 0F, 1F); RenderSystem.rotatef(rotationHour, 0F, 0F, 1F);
Screen.fill(-1, -1, 1, 11, 0xFF383838); Screen.fill(-1, -1, 1, 11, 0xFF383838);
GlStateManager.rotatef(-rotationHour, 0F, 0F, 1F); RenderSystem.rotatef(-rotationHour, 0F, 0F, 1F);
GlStateManager.rotatef(rotationMinute, 0F, 0F, 1F); RenderSystem.rotatef(rotationMinute, 0F, 0F, 1F);
Screen.fill(-1, -1, 1, 15, 0xFF6F6F6F); Screen.fill(-1, -1, 1, 15, 0xFF6F6F6F);
GlStateManager.rotatef(-rotationMinute, 0F, 0F, 1F); RenderSystem.rotatef(-rotationMinute, 0F, 0F, 1F);
GlStateManager.color3f(1.0F, 1.0F, 1.0F); RenderSystem.color3f(1.0F, 1.0F, 1.0F);
GlStateManager.popMatrix(); RenderSystem.popMatrix();
GlStateManager.color3f(Config.getSkin().getButtonRedF(), Config.getSkin().getButtonGreenF(), Config.getSkin().getButtonBlueF()); RenderSystem.color3f(Config.getSkin().getButtonRedF(), Config.getSkin().getButtonGreenF(), Config.getSkin().getButtonBlueF());
Minecraft.getInstance().getTextureManager().bindTexture(ResourceHelper.getIconTexture()); Minecraft.getInstance().getTextureManager().bindTexture(ResourceHelper.getIconTexture());
gui.blit(width + 0, height, 48, 0, 10, 10); gui.blit(width + 0, height, 48, 0, 10, 10);
GlStateManager.pushMatrix(); RenderSystem.pushMatrix();
GlStateManager.scalef(0.5F, 0.5F, 0.5F); RenderSystem.scalef(0.5F, 0.5F, 0.5F);
Screen.fill((width + 5) * 2 - 1, (height + 4) * 2 + 1, (width + 6) * 2 - 1, (height + 5) * 2 + 1, 0xFF000000); Screen.fill((width + 5) * 2 - 1, (height + 4) * 2 + 1, (width + 6) * 2 - 1, (height + 5) * 2 + 1, 0xFF000000);
GlStateManager.popMatrix(); RenderSystem.popMatrix();
} }
} }

View File

@@ -223,6 +223,11 @@
"gui.worldhandler.gamerules.rule.gameLoopFunction": "Game Loop Funktion", "gui.worldhandler.gamerules.rule.gameLoopFunction": "Game Loop Funktion",
"gui.worldhandler.gamerules.rule.maxCommandChainLength": "Kommandokettenlänge", "gui.worldhandler.gamerules.rule.maxCommandChainLength": "Kommandokettenlänge",
"gui.worldhandler.gamerules.rule.disableRaids": "Deaktiviere Überfälle", "gui.worldhandler.gamerules.rule.disableRaids": "Deaktiviere Überfälle",
"gui.worldhandler.gamerules.rule.doImmediateRespawn": "Sofortiger Respawn",
"gui.worldhandler.gamerules.rule.doInsomnia": "Schlaflosigkeit",
"gui.worldhandler.gamerules.rule.drowningDamage": "Ertrinkungsschaden",
"gui.worldhandler.gamerules.rule.fallDamage": "Fallschaden",
"gui.worldhandler.gamerules.rule.fireDamage": "Feuerschaden",
"gui.worldhandler.world_info.start": "Start", "gui.worldhandler.world_info.start": "Start",
"gui.worldhandler.world_info.world": "Welt", "gui.worldhandler.world_info.world": "Welt",

View File

@@ -222,6 +222,11 @@
"gui.worldhandler.gamerules.rule.gameLoopFunction": "Game Loop Function", "gui.worldhandler.gamerules.rule.gameLoopFunction": "Game Loop Function",
"gui.worldhandler.gamerules.rule.maxCommandChainLength": "Command Chain Length", "gui.worldhandler.gamerules.rule.maxCommandChainLength": "Command Chain Length",
"gui.worldhandler.gamerules.rule.disableRaids": "Disable Raids", "gui.worldhandler.gamerules.rule.disableRaids": "Disable Raids",
"gui.worldhandler.gamerules.rule.doImmediateRespawn": "Immediate Respawn",
"gui.worldhandler.gamerules.rule.doInsomnia": "Insomnia",
"gui.worldhandler.gamerules.rule.drowningDamage": "Drowning Damage",
"gui.worldhandler.gamerules.rule.fallDamage": "Fall Damage",
"gui.worldhandler.gamerules.rule.fireDamage": "Fire Damage",
"gui.worldhandler.world_info.start": "Start", "gui.worldhandler.world_info.start": "Start",
"gui.worldhandler.world_info.world": "World", "gui.worldhandler.world_info.world": "World",

View File

@@ -223,6 +223,11 @@
"gui.worldhandler.gamerules.rule.gameLoopFunction": "每刻运行的函数", "gui.worldhandler.gamerules.rule.gameLoopFunction": "每刻运行的函数",
"gui.worldhandler.gamerules.rule.maxCommandChainLength": "命令连锁长度", "gui.worldhandler.gamerules.rule.maxCommandChainLength": "命令连锁长度",
"gui.worldhandler.gamerules.rule.disableRaids": "Disable Raids", "gui.worldhandler.gamerules.rule.disableRaids": "Disable Raids",
"gui.worldhandler.gamerules.rule.doImmediateRespawn": "Immediate Respawn",
"gui.worldhandler.gamerules.rule.doInsomnia": "Insomnia",
"gui.worldhandler.gamerules.rule.drowningDamage": "Drowning Damage",
"gui.worldhandler.gamerules.rule.fallDamage": "Fall Damage",
"gui.worldhandler.gamerules.rule.fireDamage": "Fire Damage",
"gui.worldhandler.world_info.start": "首选项", "gui.worldhandler.world_info.start": "首选项",
"gui.worldhandler.world_info.world": "世界", "gui.worldhandler.world_info.world": "世界",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB