From 5538441e9fe66e46f8a0db6fa91e575f8a02437e Mon Sep 17 00:00:00 2001 From: grimmauld Date: Wed, 23 Sep 2020 11:15:32 +0200 Subject: [PATCH] Still 3 digit compile errors? Fixed a bunch, probably broke a bit too --- .../simibubi/create/compat/jei/CreateJEI.java | 8 ++- .../create/compat/jei/DoubleItemIcon.java | 23 ++++---- .../create/compat/jei/EmptyBackground.java | 3 +- .../compat/jei/ScreenResourceWrapper.java | 5 +- .../jei/category/BlastingViaFanCategory.java | 7 +-- .../jei/category/BlockCuttingCategory.java | 11 ++-- .../category/BlockzapperUpgradeCategory.java | 14 ++--- .../jei/category/CreateRecipeCategory.java | 12 ++--- .../compat/jei/category/CrushingCategory.java | 11 ++-- .../category/MechanicalCraftingCategory.java | 47 ++++++++-------- .../compat/jei/category/MillingCategory.java | 15 +++--- .../compat/jei/category/MixingCategory.java | 15 +++--- .../MysteriousItemConversionCategory.java | 11 ++-- .../compat/jei/category/PackingCategory.java | 13 ++--- .../jei/category/PolishingCategory.java | 17 +++--- .../compat/jei/category/PressingCategory.java | 15 +++--- .../category/ProcessingViaFanCategory.java | 32 +++++------ .../compat/jei/category/SawingCategory.java | 11 ++-- .../jei/category/SmokingViaFanCategory.java | 3 +- .../jei/category/SplashingCategory.java | 21 ++++---- .../animations/AnimatedCrushingWheels.java | 10 ++-- .../animations/AnimatedMillstone.java | 13 ++--- .../category/animations/AnimatedMixer.java | 14 ++--- .../category/animations/AnimatedPress.java | 14 ++--- .../base/GeneratingKineticTileEntity.java | 4 +- .../components/actors/SeatEntity.java | 5 +- .../structureMovement/ContraptionEntity.java | 7 +-- .../structureMovement/MovementContext.java | 6 +-- .../sequencer/InstructionSpeedModifiers.java | 9 +++- .../sequencer/SequencedGearshiftScreen.java | 17 +++--- .../contraptions/relays/belt/BeltBlock.java | 8 +-- .../relays/encased/AdjustablePulleyBlock.java | 5 -- .../symmetry/SymmetryWandScreen.java | 11 ++-- .../symmetry/mirror/CrossPlaneMirror.java | 3 +- .../symmetry/mirror/EmptyMirror.java | 3 +- .../symmetry/mirror/PlaneMirror.java | 3 +- .../symmetry/mirror/SymmetryMirror.java | 2 +- .../symmetry/mirror/TriplePlaneMirror.java | 3 +- .../curiosities/tools/ExtendoGripItem.java | 24 +++++---- .../curiosities/zapper/ZapperScreen.java | 11 ++-- .../zapper/blockzapper/BlockzapperScreen.java | 17 +++--- .../zapper/terrainzapper/Brush.java | 3 +- .../zapper/terrainzapper/CylinderBrush.java | 3 +- .../zapper/terrainzapper/SphereBrush.java | 3 +- .../terrainzapper/WorldshaperScreen.java | 16 +++--- .../inventories/AdjustableCrateScreen.java | 16 +++--- .../block/redstone/StockpileSwitchScreen.java | 12 ++--- .../item/filter/AbstractFilterScreen.java | 4 +- .../item/filter/AttributeFilterScreen.java | 6 +-- .../logistics/item/filter/FilterScreen.java | 9 ++-- .../content/schematics/MaterialChecklist.java | 24 +++++---- .../content/schematics/SchematicWorld.java | 19 ++++--- .../schematics/ServerSchematicLoader.java | 14 ++--- .../schematics/block/LaunchedItem.java | 2 +- .../block/SchematicTableScreen.java | 4 +- .../block/SchematicannonScreen.java | 39 +++++++------- .../block/SchematicannonTileEntity.java | 2 +- .../client/SchematicEditScreen.java | 10 ++-- .../client/SchematicHotbarSlotOverlay.java | 5 +- .../simibubi/create/events/CommonEvents.java | 8 +-- .../advancement/KineticBlockTrigger.java | 2 +- .../simibubi/create/foundation/block/ITE.java | 2 - .../CustomRenderedItemModelRenderer.java | 2 +- .../foundation/gui/ToolSelectionScreen.java | 53 ++++++++++--------- .../foundation/gui/widgets/IconButton.java | 2 +- .../foundation/gui/widgets/Indicator.java | 8 +-- .../foundation/item/ItemDescription.java | 32 +++++------ .../item/PartialItemModelRenderer.java | 11 ++-- .../create/foundation/item/TooltipHelper.java | 2 +- .../resources/META-INF/accesstransformer.cfg | 3 +- 70 files changed, 420 insertions(+), 379 deletions(-) diff --git a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java index 41ba41b63..ed8357930 100644 --- a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java +++ b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java @@ -143,15 +143,13 @@ public class CreateJEI implements IModPlugin { ItemStack splashingFan = fan .copy() - .setDisplayName(new StringTextComponent(TextFormatting.RESET + Lang.translate("recipe.splashing.fan"))); + .setDisplayName(Lang.translate("recipe.splashing.fan").formatted(TextFormatting.RESET)); ItemStack smokingFan = fan .copy() - .setDisplayName( - new StringTextComponent(TextFormatting.RESET + Lang.translate("recipe.smokingViaFan.fan"))); + .setDisplayName(Lang.translate("recipe.smokingViaFan.fan").formatted(TextFormatting.RESET)); ItemStack blastingFan = fan .copy() - .setDisplayName( - new StringTextComponent(TextFormatting.RESET + Lang.translate("recipe.blastingViaFan.fan"))); + .setDisplayName(Lang.translate("recipe.blastingViaFan.fan").formatted(TextFormatting.RESET)); registration.addRecipeCatalyst(new ItemStack(AllBlocks.MILLSTONE.get()), millingCategory.getUid()); registration.addRecipeCatalyst(new ItemStack(AllBlocks.CRUSHING_WHEEL.get()), crushingCategory.getUid()); diff --git a/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java b/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java index 176209d17..9850a2db1 100644 --- a/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java +++ b/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java @@ -2,6 +2,7 @@ package com.simibubi.create.compat.jei; import java.util.function.Supplier; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import mezz.jei.api.gui.drawable.IDrawable; @@ -32,7 +33,7 @@ public class DoubleItemIcon implements IDrawable { } @Override - public void draw(int xOffset, int yOffset) { + public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { if (primaryStack == null) { primaryStack = primarySupplier.get(); secondaryStack = secondarySupplier.get(); @@ -41,21 +42,21 @@ public class DoubleItemIcon implements IDrawable { RenderHelper.enable(); RenderSystem.color4f(1, 1, 1, 1); RenderSystem.enableDepthTest(); - RenderSystem.pushMatrix(); - RenderSystem.translated(xOffset, yOffset, 0); + matrixStack.push(); + matrixStack.translate(xOffset, yOffset, 0); - RenderSystem.pushMatrix(); - RenderSystem.translated(1, 1, 0); + matrixStack.push(); + matrixStack.translate(1, 1, 0); Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(primaryStack, 0, 0); - RenderSystem.popMatrix(); + matrixStack.pop(); - RenderSystem.pushMatrix(); - RenderSystem.translated(10, 10, 100); - RenderSystem.scaled(.5, .5, .5); + matrixStack.push(); + matrixStack.translate(10, 10, 100); + matrixStack.scale(.5f, .5f, .5f); Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(secondaryStack, 0, 0); - RenderSystem.popMatrix(); + matrixStack.pop(); - RenderSystem.popMatrix(); + matrixStack.pop(); RenderSystem.enableBlend(); } diff --git a/src/main/java/com/simibubi/create/compat/jei/EmptyBackground.java b/src/main/java/com/simibubi/create/compat/jei/EmptyBackground.java index 38cac2394..504a3418a 100644 --- a/src/main/java/com/simibubi/create/compat/jei/EmptyBackground.java +++ b/src/main/java/com/simibubi/create/compat/jei/EmptyBackground.java @@ -1,5 +1,6 @@ package com.simibubi.create.compat.jei; +import com.mojang.blaze3d.matrix.MatrixStack; import mezz.jei.api.gui.drawable.IDrawable; public class EmptyBackground implements IDrawable { @@ -23,7 +24,7 @@ public class EmptyBackground implements IDrawable { } @Override - public void draw(int xOffset, int yOffset) { + public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { } } diff --git a/src/main/java/com/simibubi/create/compat/jei/ScreenResourceWrapper.java b/src/main/java/com/simibubi/create/compat/jei/ScreenResourceWrapper.java index 374f52c65..720d2944e 100644 --- a/src/main/java/com/simibubi/create/compat/jei/ScreenResourceWrapper.java +++ b/src/main/java/com/simibubi/create/compat/jei/ScreenResourceWrapper.java @@ -1,5 +1,6 @@ package com.simibubi.create.compat.jei; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.gui.AllGuiTextures; import mezz.jei.api.gui.drawable.IDrawable; @@ -24,9 +25,9 @@ public class ScreenResourceWrapper implements IDrawable { } @Override - public void draw(int xOffset, int yOffset) { + public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { resource.bind(); - AbstractGui.drawTexture(xOffset, yOffset, 0, resource.startX, resource.startY, resource.width, resource.height, 256, + AbstractGui.drawTexture(matrixStack, xOffset, yOffset, 0, resource.startX, resource.startY, resource.width, resource.height, 256, 256); } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/BlastingViaFanCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/BlastingViaFanCategory.java index 96b526d40..8545f3d9e 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/BlastingViaFanCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/BlastingViaFanCategory.java @@ -1,5 +1,6 @@ package com.simibubi.create.compat.jei.category; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllItems; import com.simibubi.create.foundation.gui.GuiGameElement; @@ -20,15 +21,15 @@ public class BlastingViaFanCategory extends ProcessingViaFanCategory getTooltipStrings(BlockzapperUpgradeRecipe recipe, double mouseX, double mouseY) { - List list = new ArrayList<>(); + public List getTooltipStrings(BlockzapperUpgradeRecipe recipe, double mouseX, double mouseY) { + List list = new ArrayList<>(); if (mouseX < 91 || mouseX > 91 + 52 || mouseY < 1 || mouseY > 53) return list; list.addAll(recipe.getRecipeOutput() .getTooltip(Minecraft.getInstance().player, Minecraft.getInstance().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED - : ITooltipFlag.TooltipFlags.NORMAL) - .stream().map(ITextComponent::getFormattedText).collect(Collectors.toList())); + : ITooltipFlag.TooltipFlags.NORMAL)); return list; } @Override - public void draw(BlockzapperUpgradeRecipe recipe, double mouseX, double mouseY) { + public void draw(BlockzapperUpgradeRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { FontRenderer font = Minecraft.getInstance().fontRenderer; - String componentName = + ITextComponent componentName = Lang.translate("blockzapper.component." + Lang.asId(recipe.getUpgradedComponent().name())); String text = "+ " + recipe.getTier().color + componentName; - font.drawStringWithShadow(text, (BLOCKZAPPER_UPGRADE_RECIPE.width - font.getStringWidth(text)) / 2, 57, + font.drawWithShadow(matrixStack, text, (BLOCKZAPPER_UPGRADE_RECIPE.width - font.getStringWidth(text)) / 2, 57, 0x8B8B8B); RenderSystem.pushMatrix(); diff --git a/src/main/java/com/simibubi/create/compat/jei/category/CreateRecipeCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/CreateRecipeCategory.java index 8c5c00bb5..a7f151d4c 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/CreateRecipeCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/CreateRecipeCategory.java @@ -46,8 +46,8 @@ public abstract class CreateRecipeCategory> implements IRec } @Override - public ITextComponent getTitle() { - return Lang.translate("recipe." + name); + public String getTitle() { + return Lang.translate("recipe." + name).getUnformattedComponentText(); } @Override @@ -86,8 +86,7 @@ public abstract class CreateRecipeCategory> implements IRec return; ProcessingOutput output = results.get(slotIndex - 1); if (output.getChance() != 1) - tooltip.add(1, TextFormatting.GOLD - + Lang.translate("recipe.processing.chance", (int) (output.getChance() * 100))); + tooltip.add(1, Lang.translate("recipe.processing.chance", (int) (output.getChance() * 100)).formatted(TextFormatting.GOLD)); }); } @@ -98,9 +97,8 @@ public abstract class CreateRecipeCategory> implements IRec if (!catalystIndices.containsKey(slotIndex)) return; Float chance = catalystIndices.get(slotIndex); - tooltip.add(1, TextFormatting.YELLOW + Lang.translate("recipe.processing.catalyst")); - tooltip.add(2, TextFormatting.GOLD - + Lang.translate("recipe.processing.chanceToReturn", (int) (chance.floatValue() * 100))); + tooltip.add(1, Lang.translate("recipe.processing.catalyst").formatted(TextFormatting.YELLOW)); + tooltip.add(2, Lang.translate("recipe.processing.chanceToReturn", (int) (chance.floatValue() * 100)).formatted(TextFormatting.GOLD)); }); } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/CrushingCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/CrushingCategory.java index 64129fc4c..25c1b5eaf 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/CrushingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/CrushingCategory.java @@ -3,6 +3,7 @@ package com.simibubi.create.compat.jei.category; import java.util.Arrays; import java.util.List; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.compat.jei.category.animations.AnimatedCrushingWheels; @@ -53,17 +54,17 @@ public class CrushingCategory extends CreateRecipeCategory results = recipe.getRollableResults(); - AllGuiTextures.JEI_SLOT.draw(50, 2); - AllGuiTextures.JEI_DOWN_ARROW.draw(72, 7); + AllGuiTextures.JEI_SLOT.draw(matrixStack, 50, 2); + AllGuiTextures.JEI_DOWN_ARROW.draw(matrixStack, 72, 7); int size = results.size(); int offset = -size * 19 / 2; for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) - getRenderedSlot(recipe, outputIndex).draw(getBackground().getWidth() / 2 + offset + 19 * outputIndex, 78); + getRenderedSlot(recipe, outputIndex).draw(matrixStack, getBackground().getWidth() / 2 + offset + 19 * outputIndex, 78); - crushingWheels.draw(62, 59); + crushingWheels.draw(matrixStack, 62, 59); } } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java index 8f93ffa81..f0127891a 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java @@ -5,6 +5,7 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlocks; import com.simibubi.create.compat.jei.category.animations.AnimatedCrafter; @@ -40,9 +41,9 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory getTooltip(ItemStack ingredient, ITooltipFlag tooltipFlag) { + public List getTooltip(ItemStack ingredient, ITooltipFlag tooltipFlag) { Minecraft minecraft = Minecraft.getInstance(); PlayerEntity player = minecraft.player; - List list; + List list; try { - list = ingredient - .getTooltip(player, tooltipFlag) - .stream() - .map(ITextComponent::getFormattedText) - .collect(Collectors.toList()); + list = ingredient.getTooltip(player, tooltipFlag); } catch (RuntimeException | LinkageError e) { return new ArrayList<>(); } @@ -85,9 +82,9 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory { } @Override - public void draw(MixingRecipe recipe, double mouseX, double mouseY) { + public void draw(MixingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { List> actualIngredients = ItemHelper.condenseIngredients(recipe.getIngredients()); int size = actualIngredients.size(); @@ -84,16 +85,16 @@ public class MixingCategory extends CreateRecipeCategory { HeatCondition requiredHeat = recipe.getRequiredHeat(); int yOffset = requiredHeat != HeatCondition.NONE ? 30 : 10; for (int i = 0; i < size; i++) - AllGuiTextures.JEI_SLOT.draw(16 + xOffset + (i % 3) * 19, 50 - (i / 3) * 19 + yOffset); + AllGuiTextures.JEI_SLOT.draw(matrixStack, 16 + xOffset + (i % 3) * 19, 50 - (i / 3) * 19 + yOffset); - AllGuiTextures.JEI_SLOT.draw(141, 50 + yOffset); - AllGuiTextures.JEI_DOWN_ARROW.draw(136, 32 + yOffset); - AllGuiTextures.JEI_SHADOW.draw(81, 57 + yOffset); + AllGuiTextures.JEI_SLOT.draw(matrixStack, 141, 50 + yOffset); + AllGuiTextures.JEI_DOWN_ARROW.draw(matrixStack, 136, 32 + yOffset); + AllGuiTextures.JEI_SHADOW.draw(matrixStack, 81, 57 + yOffset); if (requiredHeat != HeatCondition.NONE) heater.withHeat(requiredHeat.visualizeAsBlazeBurner()) - .draw(getBackground().getWidth() / 2 + 3, 55); - mixer.draw(getBackground().getWidth() / 2 + 3, 34); + .draw(matrixStack, getBackground().getWidth() / 2 + 3, 55); + mixer.draw(matrixStack, getBackground().getWidth() / 2 + 3, 34); } } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/MysteriousItemConversionCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/MysteriousItemConversionCategory.java index f473e05ec..f69e15fda 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/MysteriousItemConversionCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/MysteriousItemConversionCategory.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllItems; import com.simibubi.create.compat.jei.ConversionRecipe; import com.simibubi.create.content.contraptions.processing.ProcessingOutput; @@ -49,11 +50,11 @@ public class MysteriousItemConversionCategory extends CreateRecipeCategory> { } @Override - public void draw(IRecipe recipe, double mouseX, double mouseY) { + public void draw(IRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { NonNullList ingredients2 = recipe.getIngredients(); int size = ingredients2.size(); int rows = size == 4 ? 2 : 3; for (int i = 0; i < size; i++) { - AllGuiTextures.JEI_SLOT.draw((rows == 2 ? 26 : 17) + (i % rows) * 19, 50 - (i / rows) * 19); + AllGuiTextures.JEI_SLOT.draw(matrixStack, (rows == 2 ? 26 : 17) + (i % rows) * 19, 50 - (i / rows) * 19); } - AllGuiTextures.JEI_SLOT.draw(141, 50); - AllGuiTextures.JEI_DOWN_ARROW.draw(136, 32); - AllGuiTextures.JEI_SHADOW.draw(81, 57); - press.draw(getBackground().getWidth() / 2 + 6, 30); + AllGuiTextures.JEI_SLOT.draw(matrixStack, 141, 50); + AllGuiTextures.JEI_DOWN_ARROW.draw(matrixStack, 136, 32); + AllGuiTextures.JEI_SHADOW.draw(matrixStack, 81, 57); + press.draw(matrixStack, getBackground().getWidth() / 2 + 6, 30); } } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/PolishingCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/PolishingCategory.java index 9f78bd908..9f0a7da56 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/PolishingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/PolishingCategory.java @@ -3,6 +3,7 @@ package com.simibubi.create.compat.jei.category; import java.util.Arrays; import java.util.List; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllItems; import com.simibubi.create.content.contraptions.processing.ProcessingOutput; @@ -54,25 +55,25 @@ public class PolishingCategory extends CreateRecipeCategory ingredients = recipe.getIngredients(); ItemStack[] matchingStacks = ingredients.get(0).getMatchingStacks(); if (matchingStacks.length == 0) return; - RenderSystem.pushMatrix(); + matrixStack.push(); CompoundNBT tag = renderedSandpaper.getOrCreateTag(); tag.put("Polishing", matchingStacks[0].serializeNBT()); tag.putBoolean("JEI", true); ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); - RenderSystem.scaled(2, 2, 2); + matrixStack.scale(2, 2, 2); itemRenderer.renderItemIntoGUI(renderedSandpaper, getBackground().getWidth() / 4 - 8, 1); - RenderSystem.popMatrix(); + matrixStack.pop(); } } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/PressingCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/PressingCategory.java index 6bf0aba1b..de3c73d56 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/PressingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/PressingCategory.java @@ -3,6 +3,7 @@ package com.simibubi.create.compat.jei.category; import java.util.Arrays; import java.util.List; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.compat.jei.category.animations.AnimatedPress; @@ -51,14 +52,14 @@ public class PressingCategory extends CreateRecipeCategory { } @Override - public void draw(PressingRecipe recipe, double mouseX, double mouseY) { - AllGuiTextures.JEI_SLOT.draw(26, 50); - getRenderedSlot(recipe, 0).draw(131, 50); + public void draw(PressingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { + AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 50); + getRenderedSlot(recipe, 0).draw(matrixStack, 131, 50); if (recipe.getRollableResults().size() > 1) - getRenderedSlot(recipe, 1).draw(131 + 19, 50); - AllGuiTextures.JEI_SHADOW.draw(61, 41); - AllGuiTextures.JEI_LONG_ARROW.draw(52, 54); - press.draw(getBackground().getWidth() / 2 - 17, 22); + getRenderedSlot(recipe, 1).draw(matrixStack, 131 + 19, 50); + AllGuiTextures.JEI_SHADOW.draw(matrixStack, 61, 41); + AllGuiTextures.JEI_LONG_ARROW.draw(matrixStack, 52, 54); + press.draw(matrixStack, getBackground().getWidth() / 2 - 17, 22); } } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/ProcessingViaFanCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/ProcessingViaFanCategory.java index 4778bf058..60bbd79a3 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/ProcessingViaFanCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/ProcessingViaFanCategory.java @@ -2,6 +2,7 @@ package com.simibubi.create.compat.jei.category; import java.util.Arrays; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; @@ -15,6 +16,7 @@ import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.ingredients.IIngredients; import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.math.vector.Quaternion; public abstract class ProcessingViaFanCategory> extends CreateRecipeCategory { @@ -40,21 +42,21 @@ public abstract class ProcessingViaFanCategory> extends Cre itemStacks.set(1, recipe.getRecipeOutput()); } - protected void renderWidgets(T recipe, double mouseX, double mouseY) { - AllGuiTextures.JEI_SLOT.draw(20, 47); - AllGuiTextures.JEI_SLOT.draw(139, 47); - AllGuiTextures.JEI_SHADOW.draw(47, 29); - AllGuiTextures.JEI_LIGHT.draw(66, 39); - AllGuiTextures.JEI_LONG_ARROW.draw(53, 51); + protected void renderWidgets(MatrixStack matrixStack, T recipe, double mouseX, double mouseY) { + AllGuiTextures.JEI_SLOT.draw(matrixStack, 20, 47); + AllGuiTextures.JEI_SLOT.draw(matrixStack, 139, 47); + AllGuiTextures.JEI_SHADOW.draw(matrixStack, 47, 29); + AllGuiTextures.JEI_LIGHT.draw(matrixStack, 66, 39); + AllGuiTextures.JEI_LONG_ARROW.draw(matrixStack, 53, 51); } @Override - public void draw(T recipe, double mouseX, double mouseY) { - renderWidgets(recipe, mouseX, mouseY); - RenderSystem.pushMatrix(); - RenderSystem.translatef(56, 33, 0); - RenderSystem.rotatef(-12.5f, 1, 0, 0); - RenderSystem.rotatef(22.5f, 0, 1, 0); + public void draw(T recipe, MatrixStack matrixStack, double mouseX, double mouseY) { + renderWidgets(matrixStack, recipe, mouseX, mouseY); + matrixStack.push(); + matrixStack.translate(56, 33, 0); + matrixStack.multiply(new Quaternion( -12.5f, 1, 0, 0)); + matrixStack.multiply(new Quaternion( 22.5f, 0, 1, 0)); int scale = 24; GuiGameElement.of(AllBlockPartials.ENCASED_FAN_INNER) @@ -68,10 +70,10 @@ public abstract class ProcessingViaFanCategory> extends Cre .scale(scale) .render(); - renderAttachedBlock(); - RenderSystem.popMatrix(); + renderAttachedBlock(matrixStack); + matrixStack.pop(); } - public abstract void renderAttachedBlock(); + public abstract void renderAttachedBlock(MatrixStack matrixStack); } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/SawingCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/SawingCategory.java index e80686a35..749f8d483 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/SawingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/SawingCategory.java @@ -3,6 +3,7 @@ package com.simibubi.create.compat.jei.category; import java.util.Arrays; import java.util.List; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlocks; import com.simibubi.create.compat.jei.category.animations.AnimatedSaw; import com.simibubi.create.content.contraptions.components.saw.CuttingRecipe; @@ -53,16 +54,16 @@ public class SawingCategory extends CreateRecipeCategory { } @Override - public void draw(CuttingRecipe recipe, double mouseX, double mouseY) { - AllGuiTextures.JEI_SLOT.draw(43, 4); + public void draw(CuttingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { + AllGuiTextures.JEI_SLOT.draw(matrixStack, 43, 4); int size = recipe.getRollableResults().size(); for (int i = 0; i < size; i++) { int xOffset = i % 2 == 0 ? 0 : 19; int yOffset = (i / 2) * -19; - getRenderedSlot(recipe, i).draw(117 + xOffset, 47 + yOffset); + getRenderedSlot(recipe, i).draw(matrixStack, 117 + xOffset, 47 + yOffset); } - AllGuiTextures.JEI_DOWN_ARROW.draw(70, 6); - saw.draw(72, 42); + AllGuiTextures.JEI_DOWN_ARROW.draw(matrixStack, 70, 6); + saw.draw(matrixStack, 72, 42); } } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/SmokingViaFanCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/SmokingViaFanCategory.java index 5be594658..4835bb79c 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/SmokingViaFanCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/SmokingViaFanCategory.java @@ -1,5 +1,6 @@ package com.simibubi.create.compat.jei.category; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllItems; import com.simibubi.create.foundation.gui.GuiGameElement; @@ -19,7 +20,7 @@ public class SmokingViaFanCategory extends ProcessingViaFanCategory } @Override - protected void renderWidgets(SplashingRecipe recipe, double mouseX, double mouseY) { + protected void renderWidgets(MatrixStack matrixStack, SplashingRecipe recipe, double mouseX, double mouseY) { int size = recipe.getRollableResultsAsItemStacks() .size(); - AllGuiTextures.JEI_SLOT.draw(20, 47); - AllGuiTextures.JEI_SHADOW.draw(47, 29); - AllGuiTextures.JEI_SHADOW.draw(66, 39); - AllGuiTextures.JEI_LONG_ARROW.draw(53, 51); + AllGuiTextures.JEI_SLOT.draw(matrixStack, 20, 47); + AllGuiTextures.JEI_SHADOW.draw(matrixStack, 47, 29); + AllGuiTextures.JEI_SHADOW.draw(matrixStack, 66, 39); + AllGuiTextures.JEI_LONG_ARROW.draw(matrixStack, 53, 51); if (size == 1) { - getRenderedSlot(recipe, 0).draw(139, 47); + getRenderedSlot(recipe, 0).draw(matrixStack, 139, 47); return; } for (int i = 0; i < size; i++) { int xOffset = i % 2 == 0 ? 0 : 19; int yOffset = (i / 2) * -19; - getRenderedSlot(recipe, i).draw(133 + xOffset, 47 + yOffset); + getRenderedSlot(recipe, i).draw(matrixStack, 133 + xOffset, 47 + yOffset); } } @Override - public void renderAttachedBlock() { - RenderSystem.pushMatrix(); + public void renderAttachedBlock(MatrixStack matrixStack) { + matrixStack.push(); GuiGameElement.of(Fluids.WATER) .scale(24) .atLocal(0, 0, 2) .render(); - RenderSystem.popMatrix(); + matrixStack.pop(); } } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrushingWheels.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrushingWheels.java index 8650d216e..0077655c7 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrushingWheels.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedCrushingWheels.java @@ -1,20 +1,24 @@ package com.simibubi.create.compat.jei.category.animations; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.gui.GuiGameElement; +import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.block.BlockState; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.vector.Quaternion; public class AnimatedCrushingWheels extends AnimatedKinetics { @Override - public void draw(int xOffset, int yOffset) { + public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { RenderSystem.enableDepthTest(); - RenderSystem.translatef(xOffset, yOffset, 100); - RenderSystem.rotatef(-22.5f, 0, 1, 0); + matrixStack.translate(xOffset, yOffset, 100); + matrixStack.multiply(new Quaternion(-22.5f, 0, 1, 0)); + // RenderSystem.rotatef(-22.5f, 0, 1, 0); int scale = 22; BlockState wheel = AllBlocks.CRUSHING_WHEEL.get() diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMillstone.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMillstone.java index 95f9238de..da99938ff 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMillstone.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMillstone.java @@ -1,5 +1,6 @@ package com.simibubi.create.compat.jei.category.animations; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; @@ -9,11 +10,11 @@ import com.simibubi.create.foundation.gui.GuiGameElement; public class AnimatedMillstone extends AnimatedKinetics { @Override - public void draw(int xOffset, int yOffset) { - RenderSystem.pushMatrix(); - RenderSystem.translatef(xOffset, yOffset, 0); - AllGuiTextures.JEI_SHADOW.draw(-16, 13); - RenderSystem.translatef(-2, 18, 0); + public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { + matrixStack.push(); + matrixStack.translate(xOffset, yOffset, 0); + AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13); + matrixStack.translate(-2, 18, 0); int scale = 22; GuiGameElement.of(AllBlockPartials.MILLSTONE_COG) @@ -26,7 +27,7 @@ public class AnimatedMillstone extends AnimatedKinetics { .scale(scale) .render(); - RenderSystem.popMatrix(); + matrixStack.pop(); } } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMixer.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMixer.java index a45e77ecd..7d7c18d1b 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMixer.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMixer.java @@ -1,5 +1,6 @@ package com.simibubi.create.compat.jei.category.animations; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; @@ -7,15 +8,16 @@ import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.vector.Quaternion; public class AnimatedMixer extends AnimatedKinetics { @Override - public void draw(int xOffset, int yOffset) { - RenderSystem.pushMatrix(); - RenderSystem.translatef(xOffset, yOffset, 200); - RenderSystem.rotatef(-15.5f, 1, 0, 0); - RenderSystem.rotatef(22.5f, 0, 1, 0); + public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { + matrixStack.push(); + matrixStack.translate(xOffset, yOffset, 200); + matrixStack.multiply(new Quaternion(-15.5f, 1, 0, 0)); + matrixStack.multiply(new Quaternion( 22.5f, 0, 1, 0)); int scale = 23; GuiGameElement.of(cogwheel()) @@ -47,7 +49,7 @@ public class AnimatedMixer extends AnimatedKinetics { .scale(scale) .render(); - RenderSystem.popMatrix(); + matrixStack.pop(); } } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedPress.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedPress.java index 4bafd18ed..46ab6f553 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedPress.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedPress.java @@ -2,6 +2,7 @@ package com.simibubi.create.compat.jei.category.animations; import static com.simibubi.create.foundation.utility.AnimationTickHolder.ticks; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; @@ -9,6 +10,7 @@ import com.simibubi.create.foundation.gui.GuiGameElement; import net.minecraft.client.Minecraft; import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.vector.Quaternion; public class AnimatedPress extends AnimatedKinetics { @@ -19,11 +21,11 @@ public class AnimatedPress extends AnimatedKinetics { } @Override - public void draw(int xOffset, int yOffset) { - RenderSystem.pushMatrix(); - RenderSystem.translatef(xOffset, yOffset, 100); - RenderSystem.rotatef(-15.5f, 1, 0, 0); - RenderSystem.rotatef(22.5f, 0, 1, 0); + public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { + matrixStack.push(); + matrixStack.translate(xOffset, yOffset, 100); + matrixStack.multiply(new Quaternion( -15.5f, 1, 0, 0)); + matrixStack.multiply(new Quaternion( 22.5f, 0, 1, 0)); int scale = basin ? 20 : 24; GuiGameElement.of(shaft(Axis.Z)) @@ -46,7 +48,7 @@ public class AnimatedPress extends AnimatedKinetics { .scale(scale) .render(); - RenderSystem.popMatrix(); + matrixStack.pop(); } private float getAnimatedHeadOffset() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/GeneratingKineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/base/GeneratingKineticTileEntity.java index 159de3af7..48e1c34b3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/GeneratingKineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/GeneratingKineticTileEntity.java @@ -70,8 +70,8 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity { float stressTotal = stressBase * speed; String stressString = spacing + "%s%s" + Lang.translate("generic.unit.stress") + " " + TextFormatting.DARK_GRAY + "%s"; - tooltip.add(String.format(stressString, IHaveGoggleInformation.format(stressBase), Lang.translate("gui.goggles.base_value").getUnformattedComponentText())); - tooltip.add(String.format(stressString, TextFormatting.GRAY, IHaveGoggleInformation.format(stressTotal), Lang.translate("gui.goggles.at_current_speed").getUnformattedComponentText())); + tooltip.add(ITextComponent.of(String.format(stressString, IHaveGoggleInformation.format(stressBase), Lang.translate("gui.goggles.base_value").getUnformattedComponentText()))); + tooltip.add(ITextComponent.of(String.format(stressString, TextFormatting.GRAY, IHaveGoggleInformation.format(stressTotal), Lang.translate("gui.goggles.at_current_speed").getUnformattedComponentText()))); added = true; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatEntity.java index ff049d3a1..faa25f9d3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatEntity.java @@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.actors; import com.simibubi.create.AllEntityTypes; -import net.minecraft.client.renderer.culling.ClippingHelperImpl; +import net.minecraft.client.renderer.culling.ClippingHelper; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.entity.Entity; @@ -95,8 +95,7 @@ public class SeatEntity extends Entity implements IEntityAdditionalSpawnData { } @Override - public boolean shouldRender(SeatEntity p_225626_1_, ClippingHelperImpl p_225626_2_, double p_225626_3_, - double p_225626_5_, double p_225626_7_) { + public boolean shouldRender(SeatEntity p_225626_1_, ClippingHelper p_225626_2_, double p_225626_3_, double p_225626_5_, double p_225626_7_) { return false; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionEntity.java index 071eef5be..9c3b9f9c2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionEntity.java @@ -33,7 +33,6 @@ import net.minecraft.block.material.PushReaction; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; -import net.minecraft.entity.ProjectileEntity; import net.minecraft.entity.item.BoatEntity; import net.minecraft.entity.item.HangingEntity; import net.minecraft.entity.item.minecart.AbstractMinecartEntity; @@ -59,10 +58,6 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.math.shapes.IBooleanFunction; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.World; import net.minecraft.world.gen.feature.template.Template.BlockInfo; import net.minecraftforge.api.distmarker.Dist; @@ -207,7 +202,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD } @Override - public void updatePassengerPosition(Entity passenger, IMoveCallback callback) { + protected void updatePassengerPosition(Entity passenger, IMoveCallback callback) { if (!isPassenger(passenger)) return; Vector3d transformedVector = getPassengerPosition(passenger); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementContext.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementContext.java index fd60631e6..710497ffd 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementContext.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementContext.java @@ -17,7 +17,7 @@ public class MovementContext { public Vector3d motion; public Vector3d relativeMotion; public Vector3d rotation; - public World world; + public ServerWorld world; public BlockState state; public BlockPos localPos; public CompoundNBT tileData; @@ -28,7 +28,7 @@ public class MovementContext { public Contraption contraption; public Object temporaryData; - public MovementContext(World world, BlockInfo info) { + public MovementContext(ServerWorld world, BlockInfo info) { this.world = world; this.state = info.state; this.tileData = info.nbt; @@ -53,7 +53,7 @@ public class MovementContext { return (((int) (length * modifier + 100 * Math.signum(length))) / 100) * 100; } - public static MovementContext readNBT(World world, BlockInfo info, CompoundNBT nbt) { + public static MovementContext readNBT(ServerWorld world, BlockInfo info, CompoundNBT nbt) { MovementContext context = new MovementContext(world, info); context.motion = VecHelper.readNBT(nbt.getList("Motion", NBT.TAG_DOUBLE)); context.relativeMotion = VecHelper.readNBT(nbt.getList("RelativeMotion", NBT.TAG_DOUBLE)); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/InstructionSpeedModifiers.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/InstructionSpeedModifiers.java index ad6204f13..4bda0b981 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/InstructionSpeedModifiers.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/InstructionSpeedModifiers.java @@ -14,13 +14,18 @@ public enum InstructionSpeedModifiers { String translationKey; int value; - String label; + ITextComponent label; - private InstructionSpeedModifiers(int modifier, String label) { + private InstructionSpeedModifiers(int modifier, ITextComponent label) { this.label = label; translationKey = "gui.sequenced_gearshift.speed." + Lang.asId(name()); value = modifier; } + private InstructionSpeedModifiers(int modifier, String label) { + this.label = ITextComponent.of(label); + translationKey = "gui.sequenced_gearshift.speed." + Lang.asId(name()); + value = modifier; + } static List getOptions() { List options = new ArrayList<>(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftScreen.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftScreen.java index 27b8d1fd1..9b3048dae 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftScreen.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftScreen.java @@ -12,6 +12,7 @@ import com.simibubi.create.foundation.utility.Lang; import net.minecraft.item.ItemStack; import net.minecraft.nbt.ListNBT; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; import java.util.Vector; @@ -20,7 +21,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen { private final ItemStack renderedItem = AllBlocks.SEQUENCED_GEARSHIFT.asStack(); private final AllGuiTextures background = AllGuiTextures.SEQUENCER; - private final String title = Lang.translate("gui.sequenced_gearshift.title"); + private final ITextComponent title = Lang.translate("gui.sequenced_gearshift.title"); private ListNBT compareTag; private Vector instructions; private BlockPos pos; @@ -114,7 +115,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen { @Override protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { int hFontColor = 0xD3CBBE; - background.draw(this, guiLeft, guiTop); + background.draw(matrixStack, this, guiLeft, guiTop); for (int row = 0; row < instructions.capacity(); row++) { AllGuiTextures toDraw = AllGuiTextures.SEQUENCER_EMPTY; @@ -123,12 +124,12 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen { if (row < instructions.size()) { Instruction instruction = instructions.get(row); SequencerInstructions def = instruction.instruction; - def.background.draw(guiLeft + 14, guiTop + 29 + yOffset); + def.background.draw(matrixStack, guiLeft + 14, guiTop + 29 + yOffset); label(matrixStack, 32, 6 + yOffset, Lang.translate(def.translationKey)); if (def.hasValueParameter) { - String text = def.formatValue(instruction.value); - int stringWidth = textRenderer.getStringWidth(text); + ITextComponent text = ITextComponent.of(def.formatValue(instruction.value)); + int stringWidth = textRenderer.getWidth(text); label(matrixStack, 85 + (12 - stringWidth / 2), 6 + yOffset, text); } if (def.hasSpeedParameter) @@ -137,10 +138,10 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen { continue; } - toDraw.draw(guiLeft + 14, guiTop + 29 + yOffset); + toDraw.draw(matrixStack, guiLeft + 14, guiTop + 29 + yOffset); } - textRenderer.drawWithShadow(matrixStack, title, guiLeft - 3 + (background.width - textRenderer.getStringWidth(title)) / 2, guiTop + 10, + textRenderer.drawWithShadow(matrixStack, title, guiLeft - 3 + (background.width - textRenderer.getWidth(title)) / 2, guiTop + 10, hFontColor); GuiGameElement.of(renderedItem) @@ -149,7 +150,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen { .render(); } - private void label(MatrixStack matrixStack, int x, int y, String text) { + private void label(MatrixStack matrixStack, int x, int y, ITextComponent text) { textRenderer.drawWithShadow(matrixStack, text, guiLeft + x, guiTop + 26 + y, 0xFFFFEE); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java index e200a2e97..fedbb8ed9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java @@ -24,7 +24,6 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; -import net.minecraft.block.material.Material; import net.minecraft.client.particle.ParticleManager; import net.minecraft.entity.Entity; import net.minecraft.entity.MobEntity; @@ -58,8 +57,9 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -import net.minecraft.world.WorldType; import net.minecraft.loot.LootParameters; +import net.minecraft.world.gen.DebugChunkGenerator; +import net.minecraft.world.server.ServerWorld; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.Tags; @@ -128,7 +128,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE getAlignToolTips() { + public List getAlignToolTips() { return ImmutableList.of(Lang.translate("orientation.orthogonal"), Lang.translate("orientation.diagonal")); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/EmptyMirror.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/EmptyMirror.java index 65f3546c4..d7cdd00b5 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/EmptyMirror.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/EmptyMirror.java @@ -11,6 +11,7 @@ import net.minecraft.block.BlockState; import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.text.ITextComponent; public class EmptyMirror extends SymmetryMirror { @@ -54,7 +55,7 @@ public class EmptyMirror extends SymmetryMirror { } @Override - public List getAlignToolTips() { + public List getAlignToolTips() { return ImmutableList.of(); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/PlaneMirror.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/PlaneMirror.java index 5b409f2bc..497ecc269 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/PlaneMirror.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/PlaneMirror.java @@ -14,6 +14,7 @@ import net.minecraft.block.BlockState; import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.text.ITextComponent; public class PlaneMirror extends SymmetryMirror { @@ -95,7 +96,7 @@ public class PlaneMirror extends SymmetryMirror { } @Override - public List getAlignToolTips() { + public List getAlignToolTips() { return ImmutableList.of(Lang.translate("orientation.alongZ"), Lang.translate("orientation.alongX")); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/SymmetryMirror.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/SymmetryMirror.java index d3ac0ebe9..33f4f5ff2 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/SymmetryMirror.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/SymmetryMirror.java @@ -206,6 +206,6 @@ public abstract class SymmetryMirror { this.position = pos3d; } - public abstract List getAlignToolTips(); + public abstract List getAlignToolTips(); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/TriplePlaneMirror.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/TriplePlaneMirror.java index e152974b5..586b4145b 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/TriplePlaneMirror.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/mirror/TriplePlaneMirror.java @@ -12,6 +12,7 @@ import net.minecraft.block.BlockState; import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.text.ITextComponent; public class TriplePlaneMirror extends SymmetryMirror { @@ -60,7 +61,7 @@ public class TriplePlaneMirror extends SymmetryMirror { } @Override - public List getAlignToolTips() { + public List getAlignToolTips() { return ImmutableList.of(Lang.translate("orientation.horizontal")); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java index dcc67e25d..bc4b35552 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java @@ -12,6 +12,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.ai.attributes.Attribute; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.item.ItemFrameEntity; import net.minecraft.entity.player.PlayerEntity; @@ -21,6 +22,7 @@ import net.minecraft.item.Item; import net.minecraft.item.Rarity; import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.DamageSource; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.EntityRayTraceResult; import net.minecraft.util.math.MathHelper; @@ -29,6 +31,7 @@ import net.minecraft.util.math.vector.Vector3d; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.event.InputEvent.ClickInputEvent; +import net.minecraftforge.common.ForgeMod; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -38,19 +41,19 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @EventBusSubscriber public class ExtendoGripItem extends Item { - static Multimap rangeModifier; - static Multimap doubleRangeModifier; + static Multimap rangeModifier; + static Multimap doubleRangeModifier; static { // Holding an ExtendoGrip rangeModifier = HashMultimap.create(); - rangeModifier.put(PlayerEntity.REACH_DISTANCE.getName(), + rangeModifier.put(ForgeMod.REACH_DISTANCE.get(), new AttributeModifier(UUID.fromString("7f7dbdb2-0d0d-458a-aa40-ac7633691f66"), "Range modifier", 3, AttributeModifier.Operation.ADDITION)); // Holding two ExtendoGrips o.O doubleRangeModifier = HashMultimap.create(); - doubleRangeModifier.put(PlayerEntity.REACH_DISTANCE.getName(), + doubleRangeModifier.put(ForgeMod.REACH_DISTANCE.get(), new AttributeModifier(UUID.fromString("8f7dbdb2-0d0d-458a-aa40-ac7633691f66"), "Range modifier", 5, AttributeModifier.Operation.ADDITION)); } @@ -82,14 +85,13 @@ public class ExtendoGripItem extends Item { if (holdingExtendo != wasHoldingExtendo) { if (!holdingExtendo) { - player.getAttributes() - .removeAttributeModifiers(rangeModifier); + player.getAttributes().removeModifiers(rangeModifier); persistentData.remove(marker); } else { if (player instanceof ServerPlayerEntity) AllTriggers.EXTENDO.trigger((ServerPlayerEntity) player); player.getAttributes() - .applyAttributeModifiers(rangeModifier); + .addTemporaryModifiers(rangeModifier); persistentData.putBoolean(marker, true); } } @@ -97,13 +99,13 @@ public class ExtendoGripItem extends Item { if (holdingDualExtendo != wasHoldingDualExtendo) { if (!holdingDualExtendo) { player.getAttributes() - .removeAttributeModifiers(doubleRangeModifier); + .removeModifiers(doubleRangeModifier); persistentData.remove(dualMarker); } else { if (player instanceof ServerPlayerEntity) AllTriggers.GIGA_EXTENDO.trigger((ServerPlayerEntity) player); player.getAttributes() - .applyAttributeModifiers(doubleRangeModifier); + .addTemporaryModifiers(doubleRangeModifier); persistentData.putBoolean(dualMarker, true); } } @@ -121,7 +123,7 @@ public class ExtendoGripItem extends Item { return; // Modified version of GameRenderer#getMouseOver - double d0 = player.getAttribute(PlayerEntity.REACH_DISTANCE) + double d0 = player.getAttribute(ForgeMod.REACH_DISTANCE.get()) .getValue(); if (!player.isCreative()) d0 -= 0.5f; @@ -162,7 +164,7 @@ public class ExtendoGripItem extends Item { int strength = 2; float yaw = entity.rotationYaw * ((float) Math.PI / 180F); if (target instanceof LivingEntity) { - ((LivingEntity) target).knockBack(entity, strength, MathHelper.sin(yaw), -MathHelper.cos(yaw)); + ((LivingEntity) target).takeKnockback(strength, MathHelper.sin(yaw), -MathHelper.cos(yaw)); return; } target.addVelocity(-MathHelper.sin(yaw) * strength, 0.1D, MathHelper.cos(yaw) * strength); diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperScreen.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperScreen.java index 4af858788..8a32ebe26 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperScreen.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperScreen.java @@ -21,6 +21,7 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.NBTUtil; import net.minecraft.util.Hand; import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; @SuppressWarnings("deprecation") public class ZapperScreen extends AbstractSimiScreen { @@ -30,9 +31,9 @@ public class ZapperScreen extends AbstractSimiScreen { protected float animationProgress; protected AllGuiTextures background; - protected final String patternSection = Lang.translate("gui.blockzapper.patternSection"); + protected final ITextComponent patternSection = Lang.translate("gui.blockzapper.patternSection"); - protected String title; + protected ITextComponent title; protected Vector patternButtons; protected int brightColor; protected int fontColor; @@ -42,7 +43,7 @@ public class ZapperScreen extends AbstractSimiScreen { this.background = background; this.zapper = zapper; this.offhand = offhand; - title = ""; + title = StringTextComponent.EMPTY; brightColor = 0xCCDDFF; fontColor = AllGuiTextures.FONT_COLOR; } @@ -65,7 +66,7 @@ public class ZapperScreen extends AbstractSimiScreen { PlacementPatterns pattern = PlacementPatterns.values()[id]; patternButtons.add(new IconButton(i + 147 + col * 18, j + 23 + row * 18, pattern.icon)); patternButtons.get(id) - .setToolTip(ITextComponent.of(Lang.translate("gui.blockzapper.pattern." + pattern.translationKey))); + .setToolTip(Lang.translate("gui.blockzapper.pattern." + pattern.translationKey)); } } @@ -81,7 +82,7 @@ public class ZapperScreen extends AbstractSimiScreen { int i = guiLeft - 20; int j = guiTop; - background.draw(this, i, j); + background.draw(matrixStack, this, i, j); drawOnBackground(matrixStack, i, j); client.getTextureManager() diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperScreen.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperScreen.java index 62168da6a..436d045e7 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperScreen.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperScreen.java @@ -15,11 +15,12 @@ import com.simibubi.create.foundation.utility.Lang; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; public class BlockzapperScreen extends ZapperScreen { - private final String needsUpgradedAmplifier = Lang.translate("gui.blockzapper.needsUpgradedAmplifier"); + private final ITextComponent needsUpgradedAmplifier = Lang.translate("gui.blockzapper.needsUpgradedAmplifier"); private IconButton replaceModeButton; private Indicator replaceModeIndicator; @@ -44,23 +45,23 @@ public class BlockzapperScreen extends ZapperScreen { int j = guiTop; CompoundNBT nbt = zapper.getOrCreateTag(); - replaceModeIndicator = new Indicator(i + 51, j + 36, ""); + replaceModeIndicator = new Indicator(i + 51, j + 36, StringTextComponent.EMPTY); replaceModeButton = new IconButton(i + 51, j + 41, AllIcons.I_REPLACE_SOLID); if (nbt.contains("Replace") && nbt.getBoolean("Replace")) replaceModeIndicator.state = State.ON; - replaceModeButton.setToolTip(ITextComponent.of(Lang.translate("gui.blockzapper.replaceMode"))); + replaceModeButton.setToolTip(Lang.translate("gui.blockzapper.replaceMode")); - spreadDiagonallyIndicator = new Indicator(i + 74, j + 36, ""); + spreadDiagonallyIndicator = new Indicator(i + 74, j + 36, StringTextComponent.EMPTY); spreadDiagonallyButton = new IconButton(i + 74, j + 41, AllIcons.I_FOLLOW_DIAGONAL); if (nbt.contains("SearchDiagonal") && nbt.getBoolean("SearchDiagonal")) spreadDiagonallyIndicator.state = State.ON; - spreadDiagonallyButton.setToolTip(ITextComponent.of(Lang.translate("gui.blockzapper.searchDiagonal"))); + spreadDiagonallyButton.setToolTip(Lang.translate("gui.blockzapper.searchDiagonal")); - spreadMaterialIndicator = new Indicator(i + 92, j + 36, ""); + spreadMaterialIndicator = new Indicator(i + 92, j + 36, StringTextComponent.EMPTY); spreadMaterialButton = new IconButton(i + 92, j + 41, AllIcons.I_FOLLOW_MATERIAL); if (nbt.contains("SearchFuzzy") && nbt.getBoolean("SearchFuzzy")) spreadMaterialIndicator.state = State.ON; - spreadMaterialButton.setToolTip(ITextComponent.of(Lang.translate("gui.blockzapper.searchFuzzy"))); + spreadMaterialButton.setToolTip(Lang.translate("gui.blockzapper.searchFuzzy")); spreadRangeLabel = new Label(i + 119, j + 46, "").withShadow().withSuffix("m"); spreadRangeInput = new ScrollInput(i + 115, j + 43, 22, 14).withRange(1, BlockzapperItem.getMaxAoe(zapper)) @@ -69,7 +70,7 @@ public class BlockzapperScreen extends ZapperScreen { if (nbt.contains("SearchDistance")) spreadRangeInput.setState(nbt.getInt("SearchDistance")); if (BlockzapperItem.getMaxAoe(zapper) == 2) - spreadRangeInput.getToolTip().add(1, ITextComponent.of(TextFormatting.RED + needsUpgradedAmplifier)); + spreadRangeInput.getToolTip().add(1,needsUpgradedAmplifier.copy().formatted(TextFormatting.RED)); Collections.addAll(widgets, replaceModeButton, replaceModeIndicator, spreadDiagonallyButton, spreadDiagonallyIndicator, spreadMaterialButton, spreadMaterialIndicator, spreadRangeLabel, diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/Brush.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/Brush.java index d44399076..f2cb47c88 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/Brush.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/Brush.java @@ -7,6 +7,7 @@ import com.simibubi.create.foundation.utility.Lang; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.text.ITextComponent; public abstract class Brush { @@ -33,7 +34,7 @@ public abstract class Brush { return 0; } - String getParamLabel(int paramIndex) { + ITextComponent getParamLabel(int paramIndex) { return Lang .translate(paramIndex == 0 ? "generic.width" : paramIndex == 1 ? "generic.height" : "generic.length"); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/CylinderBrush.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/CylinderBrush.java index 3cfeb9137..b3943bbba 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/CylinderBrush.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/CylinderBrush.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import net.minecraft.util.text.ITextComponent; import org.apache.commons.lang3.tuple.Pair; import com.simibubi.create.foundation.utility.Lang; @@ -72,7 +73,7 @@ public class CylinderBrush extends Brush { } @Override - String getParamLabel(int paramIndex) { + ITextComponent getParamLabel(int paramIndex) { return paramIndex == 0 ? Lang.translate("generic.radius") : super.getParamLabel(paramIndex); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/SphereBrush.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/SphereBrush.java index a5686c6a7..b7865c5ac 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/SphereBrush.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/SphereBrush.java @@ -11,6 +11,7 @@ import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.text.ITextComponent; public class SphereBrush extends Brush { @@ -49,7 +50,7 @@ public class SphereBrush extends Brush { } @Override - String getParamLabel(int paramIndex) { + ITextComponent getParamLabel(int paramIndex) { return Lang.translate("generic.radius"); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperScreen.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperScreen.java index 50b07b413..c6b099360 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperScreen.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperScreen.java @@ -22,9 +22,9 @@ import net.minecraft.util.text.ITextComponent; public class WorldshaperScreen extends ZapperScreen { - protected final String placementSection = Lang.translate("gui.terrainzapper.placement"); - protected final String toolSection = Lang.translate("gui.terrainzapper.tool"); - protected final List brushOptions = + protected final ITextComponent placementSection = Lang.translate("gui.terrainzapper.placement"); + protected final ITextComponent toolSection = Lang.translate("gui.terrainzapper.tool"); + protected final List brushOptions = Lang.translatedOptions("gui.terrainzapper.brush", "cuboid", "sphere", "cylinder"); protected Vector toolButtons; @@ -72,7 +72,7 @@ public class WorldshaperScreen extends ZapperScreen { TerrainTools tool = toolValues[id]; toolButtons.add(new IconButton(i + 8 + id * 18, j + 76, tool.icon)); toolButtons.get(id) - .setToolTip(ITextComponent.of(Lang.translate("gui.terrainzapper.tool." + tool.translationKey))); + .setToolTip(Lang.translate("gui.terrainzapper.tool." + tool.translationKey)); } if (nbt.contains("Tool")) @@ -86,7 +86,7 @@ public class WorldshaperScreen extends ZapperScreen { PlacementOptions option = placementValues[id]; placementButtons.add(new IconButton(i + 147 + id * 18, j + 76, option.icon)); placementButtons.get(id) - .setToolTip(ITextComponent.of(Lang.translate("gui.terrainzapper.placement." + option.translationKey))); + .setToolTip(Lang.translate("gui.terrainzapper.placement." + option.translationKey)); } if (nbt.contains("Placement")) @@ -122,9 +122,9 @@ public class WorldshaperScreen extends ZapperScreen { ScrollInput input = new ScrollInput(i + 55 + 18 * index, j + 43, 14, 14) .withRange(currentBrush.getMin(index), currentBrush.getMax(index) + 1) .writingTo(label) - .titled(currentBrush.getParamLabel(index)) + .titled(currentBrush.getParamLabel(index).copy()) .calling(state -> { - label.x = i + 62 + 18 * indexFinal - textRenderer.getStringWidth(label.text) / 2; + label.x = i + 62 + 18 * indexFinal - textRenderer.getWidth(label.text) / 2; }); input.setState(params[index]); input.onChanged(); @@ -178,7 +178,7 @@ public class WorldshaperScreen extends ZapperScreen { Brush currentBrush = TerrainBrushes.values()[brushInput.getState()].get(); for (int index = 2; index >= currentBrush.amtParams; index--) { - AllGuiTextures.TERRAINZAPPER_INACTIVE_PARAM.draw(i + 55 + index * 18, j + 43); + AllGuiTextures.TERRAINZAPPER_INACTIVE_PARAM.draw(matrixStack, i + 55 + index * 18, j + 43); } textRenderer.draw(matrixStack, toolSection, i + 8, j + 64, fontColor); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateScreen.java b/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateScreen.java index a247d6e20..5afcc4312 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateScreen.java @@ -33,8 +33,8 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen extraAreas; private final ItemStack renderedItem = AllBlocks.ADJUSTABLE_CRATE.asStack(); - private final String title = Lang.translate("gui.adjustable_crate.title"); - private final String storageSpace = Lang.translate("gui.adjustable_crate.storageSpace"); + private final ITextComponent title = Lang.translate("gui.adjustable_crate.title"); + private final ITextComponent storageSpace = Lang.translate("gui.adjustable_crate.storageSpace"); public AdjustableCrateScreen(AdjustableCrateContainer container, PlayerInventory inv, ITextComponent title) { super(container, inv, title); @@ -50,7 +50,7 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen { - offBelowLabel.text = state + "%"; + offBelowLabel.text = ITextComponent.of(state + "%"); lastModification = 0; if (onAbove.getState() - 4 <= state) { onAbove.setState(state + 5); @@ -71,7 +71,7 @@ public class StockpileSwitchScreen extends AbstractSimiScreen { onAbove = new ScrollInput(guiLeft + 113, guiTop + 52, 33, 14).withRange(5, 101) .titled(upperLimit) .calling(state -> { - onAboveLabel.text = state + "%"; + onAboveLabel.text = ITextComponent.of(state + "%"); lastModification = 0; if (offBelow.getState() + 4 >= state) { offBelow.setState(state - 5); @@ -89,7 +89,7 @@ public class StockpileSwitchScreen extends AbstractSimiScreen { protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { int hFontColor = 0xD3CBBE; int fontColor = 0x4B3A22; - STOCKSWITCH.draw(this, guiLeft, guiTop); + STOCKSWITCH.draw(matrixStack, this, guiLeft, guiTop); textRenderer.drawWithShadow(matrixStack, title, guiLeft - 3 + (STOCKSWITCH.width - textRenderer.getWidth(title)) / 2, guiTop + 10, hFontColor); textRenderer.draw(matrixStack, onAbove.getState() == 100 ? startAt : startAbove, guiLeft + 13, guiTop + 55, fontColor); @@ -108,14 +108,14 @@ public class StockpileSwitchScreen extends AbstractSimiScreen { drawTexture(matrixStack, (int) (guiLeft + upperBound), guiTop + 26, (int) (sprite.startX + upperBound), sprite.startY, (int) (sprite.width - upperBound), sprite.height); - AllGuiTextures.STOCKSWITCH_BOUND_LEFT.draw(this, (int) (guiLeft + lowerBound) - 1, guiTop + 24); - AllGuiTextures.STOCKSWITCH_BOUND_RIGHT.draw(this, (int) (guiLeft + upperBound) - 5, guiTop + 24); + AllGuiTextures.STOCKSWITCH_BOUND_LEFT.draw(matrixStack, this, (int) (guiLeft + lowerBound) - 1, guiTop + 24); + AllGuiTextures.STOCKSWITCH_BOUND_RIGHT.draw(matrixStack, this, (int) (guiLeft + upperBound) - 5, guiTop + 24); AllGuiTextures cursor = te.powered ? AllGuiTextures.STOCKSWITCH_CURSOR_ON : AllGuiTextures.STOCKSWITCH_CURSOR_OFF; RenderSystem.pushMatrix(); RenderSystem.translatef((cursorPos * (sprite.width - 20) + 10), 0, 0); - cursor.draw(this, guiLeft - 4, guiTop + 24); + cursor.draw(matrixStack, this, guiLeft - 4, guiTop + 24); RenderSystem.popMatrix(); RenderSystem.pushMatrix(); diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java index a422a3740..cfcdc7213 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java @@ -54,11 +54,11 @@ public abstract class AbstractFilterScreen ex protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) { int x = guiLeft; int y = guiTop; - background.draw(this, x, y); + background.draw(ms, this, x, y); int invX = x + 50; int invY = y + background.height + 10; - PLAYER_INVENTORY.draw(this, invX, invY); + PLAYER_INVENTORY.draw(ms, this, invX, invY); textRenderer.draw(ms, playerInventory.getDisplayName(), invX + 7, invY + 6, 0x666666); textRenderer.draw(ms, I18n.format(container.filterItem.getTranslationKey()), x + 15, y + 9, 0x5B5037); diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterScreen.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterScreen.java index 7e601a0d4..ebb1e4e54 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterScreen.java @@ -68,9 +68,9 @@ public class AttributeFilterScreen extends AbstractFilterScreen { @@ -47,16 +48,16 @@ public class FilterScreen extends AbstractFilterScreen { blacklist.setToolTip(blacklistN); whitelist = new IconButton(x + 76, y + 72, AllIcons.I_WHITELIST); whitelist.setToolTip(whitelistN); - blacklistIndicator = new Indicator(x + 58, y + 67, ""); - whitelistIndicator = new Indicator(x + 76, y + 67, ""); + blacklistIndicator = new Indicator(x + 58, y + 67, StringTextComponent.EMPTY); + whitelistIndicator = new Indicator(x + 76, y + 67, StringTextComponent.EMPTY); widgets.addAll(Arrays.asList(blacklist, whitelist, blacklistIndicator, whitelistIndicator)); respectNBT = new IconButton(x + 98, y + 72, AllIcons.I_RESPECT_NBT); respectNBT.setToolTip(respectDataN); ignoreNBT = new IconButton(x + 116, y + 72, AllIcons.I_IGNORE_NBT); ignoreNBT.setToolTip(ignoreDataN); - respectNBTIndicator = new Indicator(x + 98, y + 67, ""); - ignoreNBTIndicator = new Indicator(x + 116, y + 67, ""); + respectNBTIndicator = new Indicator(x + 98, y + 67, StringTextComponent.EMPTY); + ignoreNBTIndicator = new Indicator(x + 116, y + 67, StringTextComponent.EMPTY); widgets.addAll(Arrays.asList(respectNBT, ignoreNBT, respectNBTIndicator, ignoreNBTIndicator)); handleIndicators(); } diff --git a/src/main/java/com/simibubi/create/content/schematics/MaterialChecklist.java b/src/main/java/com/simibubi/create/content/schematics/MaterialChecklist.java index d4e05a2a3..c02e8ad71 100644 --- a/src/main/java/com/simibubi/create/content/schematics/MaterialChecklist.java +++ b/src/main/java/com/simibubi/create/content/schematics/MaterialChecklist.java @@ -17,6 +17,7 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.StringNBT; import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TranslationTextComponent; @@ -91,9 +92,9 @@ public class MaterialChecklist { Collections.sort(keys, (item1, item2) -> { Locale locale = Locale.ENGLISH; String name1 = - new TranslationTextComponent(item1.getTranslationKey()).getFormattedText().toLowerCase(locale); + new TranslationTextComponent(item1.getTranslationKey()).getUnformattedComponentText().toLowerCase(locale); String name2 = - new TranslationTextComponent(item2.getTranslationKey()).getFormattedText().toLowerCase(locale); + new TranslationTextComponent(item2.getTranslationKey()).getUnformattedComponentText().toLowerCase(locale); return name1.compareTo(name2); }); @@ -149,20 +150,23 @@ public class MaterialChecklist { return amount; } - private String gatheredEntry(ItemStack item, int amount) { + private ITextComponent gatheredEntry(ItemStack item, int amount) { int stacks = amount / 64; int remainder = amount % 64; - ITextComponent tc = new TranslationTextComponent(item.getTranslationKey()); - return TextFormatting.DARK_GREEN + tc.getFormattedText() + " \\u2714\n x" + amount + TextFormatting.GRAY + " | " - + stacks + "\\u25A4 +" + remainder + "\n"; + TranslationTextComponent tc = new TranslationTextComponent(item.getTranslationKey()); + return tc.append(" \\u2714\n x" + amount).formatted(TextFormatting.DARK_GREEN).append(new StringTextComponent(" | " + + stacks + "\\u25A4 +" + remainder + "\n").formatted(TextFormatting.GRAY)); + // return TextFormatting.DARK_GREEN + tc.getFormattedText() + " \\u2714\n x" + amount + TextFormatting.GRAY + " | " + // + stacks + "\\u25A4 +" + remainder + "\n"; } - private String unfinishedEntry(ItemStack item, int amount) { + private ITextComponent unfinishedEntry(ItemStack item, int amount) { int stacks = amount / 64; int remainder = amount % 64; - ITextComponent tc = new TranslationTextComponent(item.getTranslationKey()); - return TextFormatting.BLUE + tc.getFormattedText() + "\n x" + amount + TextFormatting.GRAY + " | " + stacks - + "\\u25A4 +" + remainder + "\n"; + TranslationTextComponent tc = new TranslationTextComponent(item.getTranslationKey()); + return tc.append("\n x" + amount).formatted(TextFormatting.BLUE).append(new StringTextComponent(" | " + stacks + "\\u25A4 +" + remainder + "\n").formatted(TextFormatting.GRAY)); + // return TextFormatting.BLUE + tc.getFormattedText() + "\n x" + amount + TextFormatting.GRAY + " | " + stacks + // + "\\u25A4 +" + remainder + "\n"; } } diff --git a/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java b/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java index 81478be86..57135191d 100644 --- a/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java +++ b/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java @@ -7,9 +7,10 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.function.Predicate; +import java.util.stream.Stream; import com.simibubi.create.foundation.utility.BlockHelper; -import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld; +import com.simibubi.create.foundation.utility.worldWrappers.WrappedServerWorld; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -28,8 +29,10 @@ import net.minecraft.util.math.MutableBoundingBox; import net.minecraft.world.*; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biomes; +import net.minecraft.world.server.ServerTickList; +import net.minecraft.world.server.ServerWorld; -public class SchematicWorld extends WrappedWorld implements IServerWorld { +public class SchematicWorld extends WrappedServerWorld { private Map blocks; private Map tileEntities; @@ -38,11 +41,11 @@ public class SchematicWorld extends WrappedWorld implements IServerWorld { public BlockPos anchor; public boolean renderMode; - public SchematicWorld(World original) { + public SchematicWorld(ServerWorld original) { this(BlockPos.ZERO, original); } - public SchematicWorld(BlockPos anchor, World original) { + public SchematicWorld(BlockPos anchor, ServerWorld original) { super(original); this.blocks = new HashMap<>(); this.tileEntities = new HashMap<>(); @@ -69,8 +72,8 @@ public class SchematicWorld extends WrappedWorld implements IServerWorld { return entities.add(entityIn); } - public List getEntities() { - return entities; + public Stream getEntities() { + return entities.stream(); } @Override @@ -171,12 +174,12 @@ public class SchematicWorld extends WrappedWorld implements IServerWorld { } @Override - public ITickList getPendingBlockTicks() { + public ServerTickList getPendingBlockTicks() { return EmptyTickList.get(); } @Override - public ITickList getPendingFluidTicks() { + public ServerTickList getPendingFluidTicks() { return EmptyTickList.get(); } diff --git a/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java b/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java index 3755dff63..c97d56bab 100644 --- a/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java +++ b/src/main/java/com/simibubi/create/content/schematics/ServerSchematicLoader.java @@ -84,9 +84,9 @@ public class ServerSchematicLoader { public void handleNewUpload(ServerPlayerEntity player, String schematic, long size, BlockPos pos) { String playerPath = getSchematicPath() + "/" + player.getName() - .getFormattedText(); + .getUnformattedComponentText(); String playerSchematicId = player.getName() - .getFormattedText() + "/" + schematic; + .getUnformattedComponentText() + "/" + schematic; FilesHelper.createFolderIfMissing(playerPath); // Unsupported Format @@ -98,9 +98,9 @@ public class ServerSchematicLoader { Integer maxFileSize = getConfig().maxTotalSchematicSize.get(); if (size > maxFileSize * 1000) { player.sendMessage(new TranslationTextComponent("create.schematics.uploadTooLarge") - .appendSibling(new StringTextComponent(" (" + size / 1000 + " KB)."))); + .append(new StringTextComponent(" (" + size / 1000 + " KB).")), player.getUniqueID()); player.sendMessage(new TranslationTextComponent("create.schematics.maxAllowedSize") - .appendSibling(new StringTextComponent(" " + maxFileSize + " KB"))); + .append(new StringTextComponent(" " + maxFileSize + " KB")), player.getUniqueID()); return; } @@ -152,7 +152,7 @@ public class ServerSchematicLoader { public void handleWriteRequest(ServerPlayerEntity player, String schematic, byte[] data) { String playerSchematicId = player.getName() - .getFormattedText() + "/" + schematic; + .getUnformattedComponentText() + "/" + schematic; if (activeUploads.containsKey(playerSchematicId)) { SchematicUploadEntry entry = activeUploads.get(playerSchematicId); @@ -223,7 +223,7 @@ public class ServerSchematicLoader { public void handleFinishedUpload(ServerPlayerEntity player, String schematic) { String playerSchematicId = player.getName() - .getFormattedText() + "/" + schematic; + .getUnformattedComponentText() + "/" + schematic; if (activeUploads.containsKey(playerSchematicId)) { try { @@ -245,7 +245,7 @@ public class ServerSchematicLoader { return; table.finishUpload(); table.inventory.setStackInSlot(1, SchematicItem.create(schematic, player.getName() - .getFormattedText())); + .getUnformattedComponentText())); } catch (IOException e) { Create.logger.error("Exception Thrown when finishing Upload: " + playerSchematicId); diff --git a/src/main/java/com/simibubi/create/content/schematics/block/LaunchedItem.java b/src/main/java/com/simibubi/create/content/schematics/block/LaunchedItem.java index b4ab5975f..f523499c0 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/LaunchedItem.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/LaunchedItem.java @@ -129,7 +129,7 @@ public abstract class LaunchedItem { else if (state.getBlock() != Blocks.SEA_PICKLE && state.getBlock() instanceof IPlantable) state = ((IPlantable) state.getBlock()).getPlant(world, target); - if (world.dimension.doesWaterVaporize() && state.getFluidState().getFluid().isIn(FluidTags.WATER)) { + if (world.getDimension().isUltrawarm() && state.getFluidState().getFluid().isIn(FluidTags.WATER)) { int i = target.getX(); int j = target.getY(); int k = target.getZ(); diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java index 452a05ac7..941756030 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java @@ -94,10 +94,10 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen(); @@ -194,16 +195,13 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen tip = button.getToolTip(); tip.add((enabled ? optionEnabled : optionDisabled).copy().formatted(TextFormatting.BLUE)); - tip - .addAll(TooltipHelper - .cutString(Lang.translate("gui.schematicannon.option." + tooltipKey + ".description"), GRAY, - GRAY)); + TooltipHelper.cutString(Lang.translate("gui.schematicannon.option." + tooltipKey + ".description"), GRAY, GRAY).forEach(s -> tip.add(new StringTextComponent(s).formatted(GRAY))); } @Override protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { - AllGuiTextures.PLAYER_INVENTORY.draw(this, guiLeft - 10, guiTop + 145); - AllGuiTextures.SCHEMATICANNON_BG.draw(this, guiLeft + 20, guiTop); + AllGuiTextures.PLAYER_INVENTORY.draw(matrixStack, this, guiLeft - 10, guiTop + 145); + AllGuiTextures.SCHEMATICANNON_BG.draw(matrixStack, this, guiLeft + 20, guiTop); SchematicannonTileEntity te = container.getTileEntity(); renderPrintingProgress(matrixStack, te.schematicProgress); @@ -211,7 +209,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen tooltip = new ArrayList<>(); + List tooltip = new ArrayList<>(); float f = te.hasCreativeCrate ? 100 : te.fuelLevel * 100; tooltip.add(Lang.translate(_gunpowderLevel, "" + (int) f)); if (!te.hasCreativeCrate) - tooltip.add(GRAY + Lang.translate(_shotsRemaining, "" + TextFormatting.BLUE + shotsLeft)); + tooltip.add(Lang.translate(_shotsRemaining, "" + TextFormatting.BLUE + shotsLeft).formatted(GRAY)); if (shotsLeftWithItems != shotsLeft) tooltip - .add(GRAY + Lang - .translate(_shotsRemainingWithBackup, "" + TextFormatting.BLUE + shotsLeftWithItems)); + .add(Lang.translate(_shotsRemainingWithBackup, "" + TextFormatting.BLUE + shotsLeftWithItems).formatted(GRAY)); - renderTooltip(tooltip, mouseX, mouseY); + renderTooltip(matrixStack, tooltip, mouseX, mouseY); } if (te.missingItem != null) { diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java index 336723c09..944489299 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java @@ -539,7 +539,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC schematicAnchor = anchor; blockReader = new SchematicWorld(schematicAnchor, world); PlacementSettings settings = SchematicItem.getSettings(blueprint); - activeTemplate.place(blockReader, schematicAnchor, settings); + activeTemplate.place(blockReader, schematicAnchor, settings, blockReader.getRandom()); schematicLoaded = true; state = State.PAUSED; statusMsg = "ready"; diff --git a/src/main/java/com/simibubi/create/content/schematics/client/SchematicEditScreen.java b/src/main/java/com/simibubi/create/content/schematics/client/SchematicEditScreen.java index 6f0b73d73..b834ee2aa 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/SchematicEditScreen.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/SchematicEditScreen.java @@ -133,7 +133,7 @@ public class SchematicEditScreen extends AbstractSimiScreen { protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { int x = guiLeft; int y = guiTop; - AllGuiTextures.SCHEMATIC.draw(this, x, y); + AllGuiTextures.SCHEMATIC.draw(matrixStack, this, x, y); textRenderer.drawWithShadow(matrixStack, handler.getCurrentSchematicName(), x + 103 - textRenderer.getStringWidth(handler.getCurrentSchematicName()) / 2, y + 10, 0xDDEEFF); @@ -142,11 +142,11 @@ public class SchematicEditScreen extends AbstractSimiScreen { textRenderer.draw(matrixStack, rotationLabel, x + 10, y + 52, AllGuiTextures.FONT_COLOR); textRenderer.draw(matrixStack, mirrorLabel, x + 10, y + 72, AllGuiTextures.FONT_COLOR); - RenderSystem.pushMatrix(); - RenderSystem.translated(guiLeft + 220, guiTop + 20, 0); - RenderSystem.scaled(3, 3, 3); + matrixStack.push(); + matrixStack.translate(guiLeft + 220, guiTop + 20, 0); + matrixStack.scale(3, 3, 3); itemRenderer.renderItemIntoGUI(new ItemStack(AllItems.SCHEMATIC.get()), 0, 0); - RenderSystem.popMatrix(); + matrixStack.pop(); } @Override diff --git a/src/main/java/com/simibubi/create/content/schematics/client/SchematicHotbarSlotOverlay.java b/src/main/java/com/simibubi/create/content/schematics/client/SchematicHotbarSlotOverlay.java index 0190de43a..63250ae0a 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/SchematicHotbarSlotOverlay.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/SchematicHotbarSlotOverlay.java @@ -1,5 +1,6 @@ package com.simibubi.create.content.schematics.client; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.gui.AllGuiTextures; @@ -9,12 +10,12 @@ import net.minecraft.client.gui.AbstractGui; public class SchematicHotbarSlotOverlay extends AbstractGui { - public void renderOn(int slot) { + public void renderOn(MatrixStack matrixStack, int slot) { MainWindow mainWindow = Minecraft.getInstance().getWindow(); int x = mainWindow.getScaledWidth() / 2 - 92; int y = mainWindow.getScaledHeight() - 23; RenderSystem.enableAlphaTest(); - AllGuiTextures.BLUEPRINT_SLOT.draw(this, x + 20 * slot, y); + AllGuiTextures.BLUEPRINT_SLOT.draw(matrixStack, this, x + 20 * slot, y); RenderSystem.disableAlphaTest(); } diff --git a/src/main/java/com/simibubi/create/events/CommonEvents.java b/src/main/java/com/simibubi/create/events/CommonEvents.java index c5fedd175..885c4f19b 100644 --- a/src/main/java/com/simibubi/create/events/CommonEvents.java +++ b/src/main/java/com/simibubi/create/events/CommonEvents.java @@ -12,6 +12,8 @@ import com.simibubi.create.foundation.utility.recipe.RecipeFinder; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; +import net.minecraft.resources.IReloadableResourceManager; +import net.minecraft.resources.IResourceManager; import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraftforge.event.TickEvent.Phase; @@ -73,9 +75,9 @@ public class CommonEvents { @SubscribeEvent public static void serverAboutToStart(FMLServerAboutToStartEvent event) { - event.getServer() - .getResourceManager() - .addReloadListener(RecipeFinder.LISTENER); + IResourceManager manager = event.getServer().getDataPackRegistries().getResourceManager(); + if (manager instanceof IReloadableResourceManager) + ((IReloadableResourceManager) manager).addReloadListener(RecipeFinder.LISTENER); } @SubscribeEvent diff --git a/src/main/java/com/simibubi/create/foundation/advancement/KineticBlockTrigger.java b/src/main/java/com/simibubi/create/foundation/advancement/KineticBlockTrigger.java index a72bc6f78..51d634b3b 100644 --- a/src/main/java/com/simibubi/create/foundation/advancement/KineticBlockTrigger.java +++ b/src/main/java/com/simibubi/create/foundation/advancement/KineticBlockTrigger.java @@ -35,7 +35,7 @@ public class KineticBlockTrigger extends CriterionTriggerBase { + block = Registry.BLOCK.getOrEmpty(resourcelocation).orElseThrow(() -> { return new JsonSyntaxException("Unknown block type '" + resourcelocation + "'"); }); } diff --git a/src/main/java/com/simibubi/create/foundation/block/ITE.java b/src/main/java/com/simibubi/create/foundation/block/ITE.java index abc375a1c..5c70ad04b 100644 --- a/src/main/java/com/simibubi/create/foundation/block/ITE.java +++ b/src/main/java/com/simibubi/create/foundation/block/ITE.java @@ -61,8 +61,6 @@ public interface ITE { if (world == null) return notAvailable; DimensionType type = world.getDimension(); - if (type == null) - return notAvailable; ResourceLocation registryName = type.getRegistryName(); if (registryName == null) return notAvailable; diff --git a/src/main/java/com/simibubi/create/foundation/block/render/CustomRenderedItemModelRenderer.java b/src/main/java/com/simibubi/create/foundation/block/render/CustomRenderedItemModelRenderer.java index 40e20a5a3..a9874eea3 100644 --- a/src/main/java/com/simibubi/create/foundation/block/render/CustomRenderedItemModelRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/block/render/CustomRenderedItemModelRenderer.java @@ -17,7 +17,7 @@ public class CustomRenderedItemModelRenderer M mainModel = ((M) Minecraft.getInstance() .getItemRenderer() .getItemModelWithOverrides(stack, null, null)); - PartialItemModelRenderer renderer = PartialItemModelRenderer.of(stack, ms, buffer, overlay); + PartialItemModelRenderer renderer = PartialItemModelRenderer.of(stack, p_239207_2_, ms, buffer, overlay); ms.push(); ms.translate(0.5F, 0.5F, 0.5F); diff --git a/src/main/java/com/simibubi/create/foundation/gui/ToolSelectionScreen.java b/src/main/java/com/simibubi/create/foundation/gui/ToolSelectionScreen.java index 1457d8fc3..44550e3e9 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/ToolSelectionScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/ToolSelectionScreen.java @@ -3,6 +3,7 @@ package com.simibubi.create.foundation.gui; import java.util.List; import java.util.function.Consumer; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllKeys; import com.simibubi.create.content.schematics.client.tools.Tools; @@ -12,11 +13,13 @@ import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.screen.Screen; +import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TranslationTextComponent; public class ToolSelectionScreen extends Screen { - public final String scrollToCycle = Lang.translate("gui.toolmenu.cycle"); + public final String scrollToCycle = Lang.translate("gui.toolmenu.cycle").getUnformattedComponentText(); public final String holdToFocus = "gui.toolmenu.focusKey"; protected List tools; @@ -30,7 +33,7 @@ public class ToolSelectionScreen extends Screen { public ToolSelectionScreen(List tools, Consumer callback) { super(new StringTextComponent("Tool Selection")); - this.minecraft = Minecraft.getInstance(); + this.client = Minecraft.getInstance(); this.tools = tools; this.callback = callback; focused = false; @@ -54,74 +57,74 @@ public class ToolSelectionScreen extends Screen { selection = (selection + tools.size()) % tools.size(); } - private void draw(float partialTicks) { + private void draw(MatrixStack matrixStack, float partialTicks) { MainWindow mainWindow = Minecraft.getInstance().getWindow(); int x = (mainWindow.getScaledWidth() - w) / 2 + 15; int y = mainWindow.getScaledHeight() - h - 75; - RenderSystem.pushMatrix(); - RenderSystem.translatef(0, -yOffset, focused ? 100 : 0); + matrixStack.push(); + matrixStack.translate(0, -yOffset, focused ? 100 : 0); AllGuiTextures gray = AllGuiTextures.GRAY; RenderSystem.enableBlend(); RenderSystem.color4f(1, 1, 1, focused ? 7 / 8f : 1 / 2f); Minecraft.getInstance().getTextureManager().bindTexture(gray.location); - drawTexture(x - 15, y, gray.startX, gray.startY, w, h, gray.width, gray.height); + drawTexture(matrixStack, x - 15, y, gray.startX, gray.startY, w, h, gray.width, gray.height); float toolTipAlpha = yOffset / 10; - FontRenderer font = minecraft.fontRenderer; - List toolTip = tools.get(selection).getDescription(); + FontRenderer font = client.fontRenderer; + List toolTip = tools.get(selection).getDescription(); int stringAlphaComponent = ((int) (toolTipAlpha * 0xFF)) << 24; if (toolTipAlpha > 0.25f) { RenderSystem.color4f(.7f, .7f, .8f, toolTipAlpha); - drawTexture(x - 15, y + 33, gray.startX, gray.startY, w, h + 22, gray.width, gray.height); + drawTexture(matrixStack, x - 15, y + 33, gray.startX, gray.startY, w, h + 22, gray.width, gray.height); RenderSystem.color4f(1, 1, 1, 1); if (toolTip.size() > 0) - drawString(font, toolTip.get(0), x - 10, y + 38, 0xEEEEEE + stringAlphaComponent); + drawString(matrixStack, font, toolTip.get(0), x - 10, y + 38, 0xEEEEEE + stringAlphaComponent); if (toolTip.size() > 1) - drawString(font, toolTip.get(1), x - 10, y + 50, 0xCCDDFF + stringAlphaComponent); + drawString(matrixStack, font, toolTip.get(1), x - 10, y + 50, 0xCCDDFF + stringAlphaComponent); if (toolTip.size() > 2) - drawString(font, toolTip.get(2), x - 10, y + 60, 0xCCDDFF + stringAlphaComponent); + drawString(matrixStack, font, toolTip.get(2), x - 10, y + 60, 0xCCDDFF + stringAlphaComponent); if (toolTip.size() > 3) - drawString(font, toolTip.get(3), x - 10, y + 72, 0xCCCCDD + stringAlphaComponent); + drawString(matrixStack, font, toolTip.get(3), x - 10, y + 72, 0xCCCCDD + stringAlphaComponent); } RenderSystem.color4f(1, 1, 1, 1); if (tools.size() > 1) { String keyName = AllKeys.TOOL_MENU.getBoundKey(); - int width = minecraft.getWindow().getScaledWidth(); + int width = client.getWindow().getScaledWidth(); if (!focused) - drawCenteredString(minecraft.fontRenderer, Lang.translate(holdToFocus, keyName), width / 2, y - 10, + drawCenteredString(matrixStack, client.fontRenderer, Lang.translate(holdToFocus, keyName).getUnformattedComponentText(), width / 2, y - 10, 0xCCDDFF); else - drawCenteredString(minecraft.fontRenderer, scrollToCycle, width / 2, y - 10, 0xCCDDFF); + drawCenteredString(matrixStack, client.fontRenderer, scrollToCycle, width / 2, y - 10, 0xCCDDFF); } else { x += 65; } for (int i = 0; i < tools.size(); i++) { - RenderSystem.pushMatrix(); + matrixStack.push(); float alpha = focused ? 1 : .2f; if (i == selection) { - RenderSystem.translatef(0, -10, 0); - drawCenteredString(minecraft.fontRenderer, tools.get(i).getDisplayName(), x + i * 50 + 24, y + 28, + matrixStack.translate(0, -10, 0); + drawCenteredString(matrixStack, client.fontRenderer, tools.get(i).getDisplayName().getUnformattedComponentText(), x + i * 50 + 24, y + 28, 0xCCDDFF); alpha = 1; } RenderSystem.color4f(0, 0, 0, alpha); - tools.get(i).getIcon().draw(this, x + i * 50 + 16, y + 12); + tools.get(i).getIcon().draw(matrixStack, this, x + i * 50 + 16, y + 12); RenderSystem.color4f(1, 1, 1, alpha); - tools.get(i).getIcon().draw(this, x + i * 50 + 16, y + 11); + tools.get(i).getIcon().draw(matrixStack, this, x + i * 50 + 16, y + 11); - RenderSystem.popMatrix(); + matrixStack.pop(); } - RenderSystem.popMatrix(); + matrixStack.pop(); } public void update() { @@ -131,8 +134,8 @@ public class ToolSelectionScreen extends Screen { yOffset *= .9f; } - public void renderPassive(float partialTicks) { - draw(partialTicks); + public void renderPassive(MatrixStack matrixStack, float partialTicks) { + draw(matrixStack, partialTicks); } @Override diff --git a/src/main/java/com/simibubi/create/foundation/gui/widgets/IconButton.java b/src/main/java/com/simibubi/create/foundation/gui/widgets/IconButton.java index eed3be1ed..7f66463c1 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/widgets/IconButton.java +++ b/src/main/java/com/simibubi/create/foundation/gui/widgets/IconButton.java @@ -28,7 +28,7 @@ public class IconButton extends AbstractSimiWidget { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); AllGuiTextures.BUTTON.bind(); drawTexture(matrixStack, x, y, button.startX, button.startY, button.width, button.height); - icon.draw(this, x + 1, y + 1); + icon.draw(matrixStack, this, x + 1, y + 1); } } diff --git a/src/main/java/com/simibubi/create/foundation/gui/widgets/Indicator.java b/src/main/java/com/simibubi/create/foundation/gui/widgets/Indicator.java index 0d03dc8c0..a28b4edcb 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/widgets/Indicator.java +++ b/src/main/java/com/simibubi/create/foundation/gui/widgets/Indicator.java @@ -1,7 +1,9 @@ package com.simibubi.create.foundation.gui.widgets; import com.google.common.collect.ImmutableList; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.gui.AllGuiTextures; +import net.minecraft.util.text.ITextComponent; public class Indicator extends AbstractSimiWidget { @@ -12,14 +14,14 @@ public class Indicator extends AbstractSimiWidget { public State state; - public Indicator(int x, int y, String tooltip) { + public Indicator(int x, int y, ITextComponent tooltip) { super(x, y, AllGuiTextures.INDICATOR.width, AllGuiTextures.INDICATOR.height); this.toolTip = ImmutableList.of(tooltip); this.state = State.OFF; } @Override - public void render(int mouseX, int mouseY, float partialTicks ) { + public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks ) { AllGuiTextures toDraw; switch(state) { case ON: toDraw = AllGuiTextures.INDICATOR_WHITE; break; @@ -29,7 +31,7 @@ public class Indicator extends AbstractSimiWidget { case GREEN: toDraw = AllGuiTextures.INDICATOR_GREEN; break; default: toDraw = AllGuiTextures.INDICATOR; break; } - toDraw.draw(this, x, y); + toDraw.draw(matrixStack, this, x, y); } } diff --git a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java index d963b44e2..006aed374 100644 --- a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java +++ b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java @@ -83,7 +83,7 @@ public class ItemDescription { } public ItemDescription withSummary(ITextComponent summary) { - add(linesOnShift, cutString(summary, palette.color, palette.hColor)); + addStrings(linesOnShift, cutString(summary, palette.color, palette.hColor)); add(linesOnShift, ""); return this; } @@ -105,9 +105,9 @@ public class ItemDescription { AllItems.GOGGLES.get() == Minecraft.getInstance().player.getItemStackFromSlot(EquipmentSlotType.HEAD) .getItem(); - String rpmUnit = Lang.translate("generic.unit.rpm"); + ITextComponent rpmUnit = Lang.translate("generic.unit.rpm"); if (hasSpeedRequirement) { - List speedLevels = Lang.translatedOptions("tooltip.speedRequirement", "none", "medium", "high"); + List speedLevels = Lang.translatedOptions("tooltip.speedRequirement", "none", "medium", "high"); int index = minimumRequiredSpeedLevel.ordinal(); String level = minimumRequiredSpeedLevel.getTextColor() + makeProgressBar(3, index) + speedLevels.get(index); @@ -115,13 +115,13 @@ public class ItemDescription { if (hasGlasses) level += " (" + minimumRequiredSpeedLevel.getSpeedValue() + rpmUnit + "+)"; - add(linesOnShift, GRAY + Lang.translate("tooltip.speedRequirement")); + add(linesOnShift, Lang.translate("tooltip.speedRequirement").formatted(GRAY)); add(linesOnShift, level); } - String stressUnit = Lang.translate("generic.unit.stress"); + ITextComponent stressUnit = Lang.translate("generic.unit.stress"); if (hasStressImpact && !(!isEngine && ((IRotate) block).hideStressImpact())) { - List stressLevels = Lang.translatedOptions("tooltip.stressImpact", "low", "medium", "high"); + List stressLevels = Lang.translatedOptions("tooltip.stressImpact", "low", "medium", "high"); double impact = impacts.get(id) .get(); StressImpact impactId = impact >= config.highStressImpact.get() ? StressImpact.HIGH @@ -133,12 +133,12 @@ public class ItemDescription { level += " (" + impacts.get(id) .get() + stressUnit + ")"; - add(linesOnShift, GRAY + Lang.translate("tooltip.stressImpact")); + add(linesOnShift, Lang.translate("tooltip.stressImpact").formatted(GRAY)); add(linesOnShift, level); } if (hasStressCapacity) { - List stressCapacityLevels = + List stressCapacityLevels = Lang.translatedOptions("tooltip.capacityProvided", "low", "medium", "high"); double capacity = capacities.get(id) .get(); @@ -179,13 +179,13 @@ public class ItemDescription { public ItemDescription withBehaviour(String condition, String behaviour) { add(linesOnShift, GRAY + condition); - add(linesOnShift, cutString(behaviour, palette.color, palette.hColor, 1)); + addStrings(linesOnShift, cutString(behaviour, palette.color, palette.hColor, 1)); return this; } public ItemDescription withControl(String condition, String action) { add(linesOnCtrl, GRAY + condition); - add(linesOnCtrl, cutString(action, palette.color, palette.hColor, 1)); + addStrings(linesOnCtrl, cutString(action, palette.color, palette.hColor, 1)); return this; } @@ -194,12 +194,12 @@ public class ItemDescription { boolean hasControls = !linesOnCtrl.isEmpty(); if (hasDescription || hasControls) { - String[] holdKey = Lang.translate("tooltip.holdKey", "$") + String[] holdKey = Lang.translate("tooltip.holdKey", "$").getUnformattedComponentText() .split("\\$"); - String[] holdKeyOrKey = Lang.translate("tooltip.holdKeyOrKey", "$", "$") + String[] holdKeyOrKey = Lang.translate("tooltip.holdKeyOrKey", "$", "$").getUnformattedComponentText() .split("\\$"); - String keyShift = Lang.translate("tooltip.keyShift"); - String keyCtrl = Lang.translate("tooltip.keyCtrl"); + ITextComponent keyShift = Lang.translate("tooltip.keyShift"); + ITextComponent keyCtrl = Lang.translate("tooltip.keyCtrl"); for (List list : Arrays.asList(lines, linesOnShift, linesOnCtrl)) { boolean shift = list == linesOnShift; boolean ctrl = list == linesOnCtrl; @@ -248,7 +248,7 @@ public class ItemDescription { return palette.hColor + s + palette.color; } - public static void add(List infoList, List textLines) { + public static void addStrings(List infoList, List textLines) { textLines.forEach(s -> add(infoList, s)); } @@ -295,7 +295,7 @@ public class ItemDescription { return linesOnShift; } - private IFormattableTextComponent generatorSpeed(Block block, String unitRPM) { + private IFormattableTextComponent generatorSpeed(Block block, ITextComponent unitRPM) { String value = ""; if (block instanceof WaterWheelBlock) { diff --git a/src/main/java/com/simibubi/create/foundation/item/PartialItemModelRenderer.java b/src/main/java/com/simibubi/create/foundation/item/PartialItemModelRenderer.java index 2478c6d34..d5779c3ab 100644 --- a/src/main/java/com/simibubi/create/foundation/item/PartialItemModelRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/item/PartialItemModelRenderer.java @@ -12,6 +12,7 @@ import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.item.ItemStack; import net.minecraft.util.Direction; import net.minecraftforge.client.model.data.EmptyModelData; @@ -24,6 +25,7 @@ public class PartialItemModelRenderer { ItemStack stack; int overlay; MatrixStack ms; + ItemCameraTransforms.TransformType transformType; IRenderTypeBuffer buffer; static PartialItemModelRenderer get() { @@ -32,11 +34,12 @@ public class PartialItemModelRenderer { return instance; } - public static PartialItemModelRenderer of(ItemStack stack, MatrixStack ms, IRenderTypeBuffer buffer, int overlay) { + public static PartialItemModelRenderer of(ItemStack stack, ItemCameraTransforms.TransformType transformType, MatrixStack ms, IRenderTypeBuffer buffer, int overlay) { PartialItemModelRenderer instance = get(); instance.stack = stack; instance.buffer = buffer; instance.ms = ms; + instance.transformType = transformType; instance.overlay = overlay; return instance; } @@ -70,7 +73,7 @@ public class PartialItemModelRenderer { else stack.getItem() .getItemStackTileEntityRenderer() - .render(stack, ms, buffer, light, overlay); + .render(stack, transformType, ms, buffer, light, overlay); ms.pop(); } @@ -83,12 +86,12 @@ public class PartialItemModelRenderer { for (Direction direction : Direction.values()) { random.setSeed(42L); - ir.renderBakedItemQuads(ms, p_229114_6_, model.getQuads((BlockState) null, direction, random, data), stack, + ir.renderBakedItemQuads(ms, p_229114_6_, model.getQuads(null, direction, random, data), stack, light, overlay); } random.setSeed(42L); - ir.renderBakedItemQuads(ms, p_229114_6_, model.getQuads((BlockState) null, (Direction) null, random, data), + ir.renderBakedItemQuads(ms, p_229114_6_, model.getQuads(null, null, random, data), stack, light, overlay); } diff --git a/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java b/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java index e88e06901..6dec1a9e7 100644 --- a/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java +++ b/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java @@ -143,7 +143,7 @@ public class TooltipHelper { // Summary if (I18n.hasKey(summaryKey)) - tooltip = tooltip.withSummary(I18n.format(summaryKey)); + tooltip = tooltip.withSummary(ITextComponent.of(I18n.format(summaryKey))); // Requirements if (stack.getItem() instanceof BlockItem) { diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index b22a85caa..d16903b7c 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -15,4 +15,5 @@ public-f net.minecraft.world.chunk.ChunkStatus field_222617_m #FULL public net.minecraft.world.chunk.ChunkStatus$IGenerationWorker public net.minecraft.world.chunk.ChunkStatus$ILoadingWorker -public net.minecraft.client.gui.FontRenderer func_238419_a_(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/gui/fonts/Font; # getFontStorage \ No newline at end of file +public net.minecraft.client.gui.FontRenderer func_238419_a_(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/gui/fonts/Font; # getFontStorage +protected net.minecraft.entity.Entity func_226266_a_(Lnet/minecraft/entity/Entity;Lnet/minecraft/entity/Entity$IMoveCallback;)V # updatePassengerPosition \ No newline at end of file