Still 3 digit compile errors? Fixed a bunch, probably broke a bit too

This commit is contained in:
grimmauld 2020-09-23 11:15:32 +02:00
parent 2f2a5674f3
commit 5538441e9f
70 changed files with 420 additions and 379 deletions

View file

@ -143,15 +143,13 @@ public class CreateJEI implements IModPlugin {
ItemStack splashingFan = fan ItemStack splashingFan = fan
.copy() .copy()
.setDisplayName(new StringTextComponent(TextFormatting.RESET + Lang.translate("recipe.splashing.fan"))); .setDisplayName(Lang.translate("recipe.splashing.fan").formatted(TextFormatting.RESET));
ItemStack smokingFan = fan ItemStack smokingFan = fan
.copy() .copy()
.setDisplayName( .setDisplayName(Lang.translate("recipe.smokingViaFan.fan").formatted(TextFormatting.RESET));
new StringTextComponent(TextFormatting.RESET + Lang.translate("recipe.smokingViaFan.fan")));
ItemStack blastingFan = fan ItemStack blastingFan = fan
.copy() .copy()
.setDisplayName( .setDisplayName(Lang.translate("recipe.blastingViaFan.fan").formatted(TextFormatting.RESET));
new StringTextComponent(TextFormatting.RESET + Lang.translate("recipe.blastingViaFan.fan")));
registration.addRecipeCatalyst(new ItemStack(AllBlocks.MILLSTONE.get()), millingCategory.getUid()); registration.addRecipeCatalyst(new ItemStack(AllBlocks.MILLSTONE.get()), millingCategory.getUid());
registration.addRecipeCatalyst(new ItemStack(AllBlocks.CRUSHING_WHEEL.get()), crushingCategory.getUid()); registration.addRecipeCatalyst(new ItemStack(AllBlocks.CRUSHING_WHEEL.get()), crushingCategory.getUid());

View file

@ -2,6 +2,7 @@ package com.simibubi.create.compat.jei;
import java.util.function.Supplier; import java.util.function.Supplier;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.drawable.IDrawable;
@ -32,7 +33,7 @@ public class DoubleItemIcon implements IDrawable {
} }
@Override @Override
public void draw(int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
if (primaryStack == null) { if (primaryStack == null) {
primaryStack = primarySupplier.get(); primaryStack = primarySupplier.get();
secondaryStack = secondarySupplier.get(); secondaryStack = secondarySupplier.get();
@ -41,21 +42,21 @@ public class DoubleItemIcon implements IDrawable {
RenderHelper.enable(); RenderHelper.enable();
RenderSystem.color4f(1, 1, 1, 1); RenderSystem.color4f(1, 1, 1, 1);
RenderSystem.enableDepthTest(); RenderSystem.enableDepthTest();
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.translated(xOffset, yOffset, 0); matrixStack.translate(xOffset, yOffset, 0);
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.translated(1, 1, 0); matrixStack.translate(1, 1, 0);
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(primaryStack, 0, 0); Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(primaryStack, 0, 0);
RenderSystem.popMatrix(); matrixStack.pop();
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.translated(10, 10, 100); matrixStack.translate(10, 10, 100);
RenderSystem.scaled(.5, .5, .5); matrixStack.scale(.5f, .5f, .5f);
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(secondaryStack, 0, 0); Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(secondaryStack, 0, 0);
RenderSystem.popMatrix(); matrixStack.pop();
RenderSystem.popMatrix(); matrixStack.pop();
RenderSystem.enableBlend(); RenderSystem.enableBlend();
} }

View file

@ -1,5 +1,6 @@
package com.simibubi.create.compat.jei; package com.simibubi.create.compat.jei;
import com.mojang.blaze3d.matrix.MatrixStack;
import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.drawable.IDrawable;
public class EmptyBackground implements IDrawable { public class EmptyBackground implements IDrawable {
@ -23,7 +24,7 @@ public class EmptyBackground implements IDrawable {
} }
@Override @Override
public void draw(int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
} }
} }

View file

@ -1,5 +1,6 @@
package com.simibubi.create.compat.jei; package com.simibubi.create.compat.jei;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.gui.AllGuiTextures; import com.simibubi.create.foundation.gui.AllGuiTextures;
import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.drawable.IDrawable;
@ -24,9 +25,9 @@ public class ScreenResourceWrapper implements IDrawable {
} }
@Override @Override
public void draw(int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
resource.bind(); 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); 256);
} }

View file

@ -1,5 +1,6 @@
package com.simibubi.create.compat.jei.category; package com.simibubi.create.compat.jei.category;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.gui.GuiGameElement;
@ -20,15 +21,15 @@ public class BlastingViaFanCategory extends ProcessingViaFanCategory<AbstractCoo
} }
@Override @Override
public void renderAttachedBlock() { public void renderAttachedBlock(MatrixStack matrixStack) {
RenderSystem.pushMatrix(); matrixStack.push();
GuiGameElement.of(Fluids.LAVA) GuiGameElement.of(Fluids.LAVA)
.scale(24) .scale(24)
.atLocal(0, 0, 2) .atLocal(0, 0, 2)
.render(); .render();
RenderSystem.popMatrix(); matrixStack.pop();
} }
} }

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.compat.jei.category.BlockCuttingCategory.CondensedBlockCuttingRecipe; import com.simibubi.create.compat.jei.category.BlockCuttingCategory.CondensedBlockCuttingRecipe;
import com.simibubi.create.compat.jei.category.animations.AnimatedSaw; import com.simibubi.create.compat.jei.category.animations.AnimatedSaw;
@ -57,16 +58,16 @@ public class BlockCuttingCategory extends CreateRecipeCategory<CondensedBlockCut
} }
@Override @Override
public void draw(CondensedBlockCuttingRecipe recipe, double mouseX, double mouseY) { public void draw(CondensedBlockCuttingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
AllGuiTextures.JEI_SLOT.draw(4, 4); AllGuiTextures.JEI_SLOT.draw(matrixStack, 4, 4);
int size = recipe.getOutputs().size(); int size = recipe.getOutputs().size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
int xOffset = (i % 5) * 19; int xOffset = (i % 5) * 19;
int yOffset = (i / 5) * -19; int yOffset = (i / 5) * -19;
AllGuiTextures.JEI_SLOT.draw(77 + xOffset, 47 + yOffset); AllGuiTextures.JEI_SLOT.draw(matrixStack, 77 + xOffset, 47 + yOffset);
} }
AllGuiTextures.JEI_DOWN_ARROW.draw(31, 6); AllGuiTextures.JEI_DOWN_ARROW.draw(matrixStack, 31, 6);
saw.draw(33, 37); saw.draw(matrixStack, 33, 37);
} }
public static class CondensedBlockCuttingRecipe extends StonecuttingRecipe { public static class CondensedBlockCuttingRecipe extends StonecuttingRecipe {

View file

@ -7,6 +7,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.ScreenResourceWrapper; import com.simibubi.create.compat.jei.ScreenResourceWrapper;
@ -64,25 +65,24 @@ public class BlockzapperUpgradeCategory extends CreateRecipeCategory<Blockzapper
} }
@Override @Override
public List<String> getTooltipStrings(BlockzapperUpgradeRecipe recipe, double mouseX, double mouseY) { public List<ITextComponent> getTooltipStrings(BlockzapperUpgradeRecipe recipe, double mouseX, double mouseY) {
List<String> list = new ArrayList<>(); List<ITextComponent> list = new ArrayList<>();
if (mouseX < 91 || mouseX > 91 + 52 || mouseY < 1 || mouseY > 53) if (mouseX < 91 || mouseX > 91 + 52 || mouseY < 1 || mouseY > 53)
return list; return list;
list.addAll(recipe.getRecipeOutput() list.addAll(recipe.getRecipeOutput()
.getTooltip(Minecraft.getInstance().player, .getTooltip(Minecraft.getInstance().player,
Minecraft.getInstance().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED Minecraft.getInstance().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED
: ITooltipFlag.TooltipFlags.NORMAL) : ITooltipFlag.TooltipFlags.NORMAL));
.stream().map(ITextComponent::getFormattedText).collect(Collectors.toList()));
return list; return list;
} }
@Override @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; FontRenderer font = Minecraft.getInstance().fontRenderer;
String componentName = ITextComponent componentName =
Lang.translate("blockzapper.component." + Lang.asId(recipe.getUpgradedComponent().name())); Lang.translate("blockzapper.component." + Lang.asId(recipe.getUpgradedComponent().name()));
String text = "+ " + recipe.getTier().color + componentName; 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); 0x8B8B8B);
RenderSystem.pushMatrix(); RenderSystem.pushMatrix();

View file

@ -46,8 +46,8 @@ public abstract class CreateRecipeCategory<T extends IRecipe<?>> implements IRec
} }
@Override @Override
public ITextComponent getTitle() { public String getTitle() {
return Lang.translate("recipe." + name); return Lang.translate("recipe." + name).getUnformattedComponentText();
} }
@Override @Override
@ -86,8 +86,7 @@ public abstract class CreateRecipeCategory<T extends IRecipe<?>> implements IRec
return; return;
ProcessingOutput output = results.get(slotIndex - 1); ProcessingOutput output = results.get(slotIndex - 1);
if (output.getChance() != 1) if (output.getChance() != 1)
tooltip.add(1, TextFormatting.GOLD tooltip.add(1, Lang.translate("recipe.processing.chance", (int) (output.getChance() * 100)).formatted(TextFormatting.GOLD));
+ Lang.translate("recipe.processing.chance", (int) (output.getChance() * 100)));
}); });
} }
@ -98,9 +97,8 @@ public abstract class CreateRecipeCategory<T extends IRecipe<?>> implements IRec
if (!catalystIndices.containsKey(slotIndex)) if (!catalystIndices.containsKey(slotIndex))
return; return;
Float chance = catalystIndices.get(slotIndex); Float chance = catalystIndices.get(slotIndex);
tooltip.add(1, TextFormatting.YELLOW + Lang.translate("recipe.processing.catalyst")); tooltip.add(1, Lang.translate("recipe.processing.catalyst").formatted(TextFormatting.YELLOW));
tooltip.add(2, TextFormatting.GOLD tooltip.add(2, Lang.translate("recipe.processing.chanceToReturn", (int) (chance.floatValue() * 100)).formatted(TextFormatting.GOLD));
+ Lang.translate("recipe.processing.chanceToReturn", (int) (chance.floatValue() * 100)));
}); });
} }

View file

@ -3,6 +3,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.category.animations.AnimatedCrushingWheels; import com.simibubi.create.compat.jei.category.animations.AnimatedCrushingWheels;
@ -53,17 +54,17 @@ public class CrushingCategory extends CreateRecipeCategory<AbstractCrushingRecip
} }
@Override @Override
public void draw(AbstractCrushingRecipe recipe, double mouseX, double mouseY) { public void draw(AbstractCrushingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
List<ProcessingOutput> results = recipe.getRollableResults(); List<ProcessingOutput> results = recipe.getRollableResults();
AllGuiTextures.JEI_SLOT.draw(50, 2); AllGuiTextures.JEI_SLOT.draw(matrixStack, 50, 2);
AllGuiTextures.JEI_DOWN_ARROW.draw(72, 7); AllGuiTextures.JEI_DOWN_ARROW.draw(matrixStack, 72, 7);
int size = results.size(); int size = results.size();
int offset = -size * 19 / 2; int offset = -size * 19 / 2;
for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) 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);
} }
} }

View file

@ -5,6 +5,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.compat.jei.category.animations.AnimatedCrafter; import com.simibubi.create.compat.jei.category.animations.AnimatedCrafter;
@ -40,9 +41,9 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ShapedRecip
} }
@Override @Override
public void render(int xPosition, int yPosition, ItemStack ingredient) { public void render(MatrixStack matrixStack, int xPosition, int yPosition, ItemStack ingredient) {
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.translated(xPosition, yPosition, 0); matrixStack.translate(xPosition, yPosition, 0);
float scale = getScale(recipe); float scale = getScale(recipe);
RenderSystem.scaled(scale, scale, scale); RenderSystem.scaled(scale, scale, scale);
@ -62,16 +63,12 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ShapedRecip
} }
@Override @Override
public List<String> getTooltip(ItemStack ingredient, ITooltipFlag tooltipFlag) { public List<ITextComponent> getTooltip(ItemStack ingredient, ITooltipFlag tooltipFlag) {
Minecraft minecraft = Minecraft.getInstance(); Minecraft minecraft = Minecraft.getInstance();
PlayerEntity player = minecraft.player; PlayerEntity player = minecraft.player;
List<String> list; List<ITextComponent> list;
try { try {
list = ingredient list = ingredient.getTooltip(player, tooltipFlag);
.getTooltip(player, tooltipFlag)
.stream()
.map(ITextComponent::getFormattedText)
.collect(Collectors.toList());
} catch (RuntimeException | LinkageError e) { } catch (RuntimeException | LinkageError e) {
return new ArrayList<>(); return new ArrayList<>();
} }
@ -85,9 +82,9 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ShapedRecip
for (int k = 0; k < list.size(); ++k) { for (int k = 0; k < list.size(); ++k) {
if (k == 0) { if (k == 0) {
list.set(k, rarity.color + list.get(k)); list.set(k, list.get(k).copy().formatted(rarity.color));
} else { } else {
list.set(k, TextFormatting.GRAY + list.get(k)); list.set(k, list.get(k).copy().formatted(TextFormatting.GRAY));
} }
} }
@ -149,26 +146,26 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ShapedRecip
} }
@Override @Override
public void draw(ShapedRecipe recipe, double mouseX, double mouseY) { public void draw(ShapedRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
RenderSystem.pushMatrix(); matrixStack.push();
float scale = getScale(recipe); float scale = getScale(recipe);
RenderSystem.translated(getXPadding(recipe), getYPadding(recipe), 0); matrixStack.translate(getXPadding(recipe), getYPadding(recipe), 0);
for (int row = 0; row < recipe.getHeight(); row++) for (int row = 0; row < recipe.getHeight(); row++)
for (int col = 0; col < recipe.getWidth(); col++) for (int col = 0; col < recipe.getWidth(); col++)
if (!recipe.getIngredients().get(row * recipe.getWidth() + col).hasNoMatchingItems()) { if (!recipe.getIngredients().get(row * recipe.getWidth() + col).hasNoMatchingItems()) {
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.translated((int) col * 19 * scale, (int) row * 19 * scale, 0); matrixStack.translate(col * 19 * scale, row * 19 * scale, 0);
RenderSystem.scaled(scale, scale, scale); matrixStack.scale(scale, scale, scale);
AllGuiTextures.JEI_SLOT.draw(0, 0); AllGuiTextures.JEI_SLOT.draw(matrixStack, 0, 0);
RenderSystem.popMatrix(); matrixStack.pop();
} }
RenderSystem.popMatrix(); matrixStack.pop();
AllGuiTextures.JEI_SLOT.draw(133, 80); AllGuiTextures.JEI_SLOT.draw(matrixStack, 133, 80);
AllGuiTextures.JEI_DOWN_ARROW.draw(128, 59); AllGuiTextures.JEI_DOWN_ARROW.draw(matrixStack, 128, 59);
crafter.draw(129, 25); crafter.draw(matrixStack, 129, 25);
RenderSystem.pushMatrix(); RenderSystem.pushMatrix();
RenderSystem.translated(0, 0, 300); RenderSystem.translated(0, 0, 300);
@ -182,7 +179,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ShapedRecip
} }
Minecraft.getInstance().fontRenderer Minecraft.getInstance().fontRenderer
.drawStringWithShadow(amount + "", 142, 39, 0xFFFFFF); .drawWithShadow(matrixStack, amount + "", 142, 39, 0xFFFFFF);
RenderSystem.popMatrix(); RenderSystem.popMatrix();
} }

View file

@ -3,6 +3,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.category.animations.AnimatedMillstone; import com.simibubi.create.compat.jei.category.animations.AnimatedMillstone;
@ -58,24 +59,24 @@ public class MillingCategory extends CreateRecipeCategory<AbstractCrushingRecipe
} }
@Override @Override
public void draw(AbstractCrushingRecipe recipe, double mouseX, double mouseY) { public void draw(AbstractCrushingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
int size = recipe.getRollableResultsAsItemStacks() int size = recipe.getRollableResultsAsItemStacks()
.size(); .size();
AllGuiTextures.JEI_SLOT.draw(14, 8); AllGuiTextures.JEI_SLOT.draw(matrixStack, 14, 8);
AllGuiTextures.JEI_ARROW.draw(85, 32); AllGuiTextures.JEI_ARROW.draw(matrixStack, 85, 32);
AllGuiTextures.JEI_DOWN_ARROW.draw(43, 4); AllGuiTextures.JEI_DOWN_ARROW.draw(matrixStack, 43, 4);
millstone.draw(48, 27); millstone.draw(matrixStack, 48, 27);
if (size == 1) { if (size == 1) {
getRenderedSlot(recipe, 0).draw(139, 27); getRenderedSlot(recipe, 0).draw(matrixStack, 139, 27);
return; return;
} }
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
int xOffset = i % 2 == 0 ? 0 : 19; int xOffset = i % 2 == 0 ? 0 : 19;
int yOffset = (i / 2) * -19; int yOffset = (i / 2) * -19;
getRenderedSlot(recipe, i).draw(133 + xOffset, 27 + yOffset); getRenderedSlot(recipe, i).draw(matrixStack, 133 + xOffset, 27 + yOffset);
} }
} }

View file

@ -3,6 +3,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import org.apache.commons.lang3.mutable.MutableInt; import org.apache.commons.lang3.mutable.MutableInt;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
@ -76,7 +77,7 @@ public class MixingCategory extends CreateRecipeCategory<MixingRecipe> {
} }
@Override @Override
public void draw(MixingRecipe recipe, double mouseX, double mouseY) { public void draw(MixingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
List<Pair<Ingredient, MutableInt>> actualIngredients = ItemHelper.condenseIngredients(recipe.getIngredients()); List<Pair<Ingredient, MutableInt>> actualIngredients = ItemHelper.condenseIngredients(recipe.getIngredients());
int size = actualIngredients.size(); int size = actualIngredients.size();
@ -84,16 +85,16 @@ public class MixingCategory extends CreateRecipeCategory<MixingRecipe> {
HeatCondition requiredHeat = recipe.getRequiredHeat(); HeatCondition requiredHeat = recipe.getRequiredHeat();
int yOffset = requiredHeat != HeatCondition.NONE ? 30 : 10; int yOffset = requiredHeat != HeatCondition.NONE ? 30 : 10;
for (int i = 0; i < size; i++) 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_SLOT.draw(matrixStack, 141, 50 + yOffset);
AllGuiTextures.JEI_DOWN_ARROW.draw(136, 32 + yOffset); AllGuiTextures.JEI_DOWN_ARROW.draw(matrixStack, 136, 32 + yOffset);
AllGuiTextures.JEI_SHADOW.draw(81, 57 + yOffset); AllGuiTextures.JEI_SHADOW.draw(matrixStack, 81, 57 + yOffset);
if (requiredHeat != HeatCondition.NONE) if (requiredHeat != HeatCondition.NONE)
heater.withHeat(requiredHeat.visualizeAsBlazeBurner()) heater.withHeat(requiredHeat.visualizeAsBlazeBurner())
.draw(getBackground().getWidth() / 2 + 3, 55); .draw(matrixStack, getBackground().getWidth() / 2 + 3, 55);
mixer.draw(getBackground().getWidth() / 2 + 3, 34); mixer.draw(matrixStack, getBackground().getWidth() / 2 + 3, 34);
} }
} }

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.ConversionRecipe; import com.simibubi.create.compat.jei.ConversionRecipe;
import com.simibubi.create.content.contraptions.processing.ProcessingOutput; import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
@ -49,11 +50,11 @@ public class MysteriousItemConversionCategory extends CreateRecipeCategory<Conve
} }
@Override @Override
public void draw(ConversionRecipe recipe, double mouseX, double mouseY) { public void draw(ConversionRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
AllGuiTextures.JEI_SLOT.draw(26, 16); AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 16);
AllGuiTextures.JEI_SLOT.draw(131, 16); AllGuiTextures.JEI_SLOT.draw(matrixStack, 131, 16);
AllGuiTextures.JEI_LONG_ARROW.draw(52, 20); AllGuiTextures.JEI_LONG_ARROW.draw(matrixStack, 52, 20);
AllGuiTextures.JEI_QUESTION_MARK.draw(77, 5); AllGuiTextures.JEI_QUESTION_MARK.draw(matrixStack, 77, 5);
} }
} }

View file

@ -2,6 +2,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.Arrays; import java.util.Arrays;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.compat.jei.category.animations.AnimatedPress; import com.simibubi.create.compat.jei.category.animations.AnimatedPress;
import com.simibubi.create.foundation.gui.AllGuiTextures; import com.simibubi.create.foundation.gui.AllGuiTextures;
@ -55,17 +56,17 @@ public class PackingCategory extends CreateRecipeCategory<IRecipe<?>> {
} }
@Override @Override
public void draw(IRecipe<?> recipe, double mouseX, double mouseY) { public void draw(IRecipe<?> recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
NonNullList<Ingredient> ingredients2 = recipe.getIngredients(); NonNullList<Ingredient> ingredients2 = recipe.getIngredients();
int size = ingredients2.size(); int size = ingredients2.size();
int rows = size == 4 ? 2 : 3; int rows = size == 4 ? 2 : 3;
for (int i = 0; i < size; i++) { 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_SLOT.draw(matrixStack, 141, 50);
AllGuiTextures.JEI_DOWN_ARROW.draw(136, 32); AllGuiTextures.JEI_DOWN_ARROW.draw(matrixStack, 136, 32);
AllGuiTextures.JEI_SHADOW.draw(81, 57); AllGuiTextures.JEI_SHADOW.draw(matrixStack, 81, 57);
press.draw(getBackground().getWidth() / 2 + 6, 30); press.draw(matrixStack, getBackground().getWidth() / 2 + 6, 30);
} }
} }

View file

@ -3,6 +3,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.content.contraptions.processing.ProcessingOutput; import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
@ -54,25 +55,25 @@ public class PolishingCategory extends CreateRecipeCategory<SandPaperPolishingRe
} }
@Override @Override
public void draw(SandPaperPolishingRecipe recipe, double mouseX, double mouseY) { public void draw(SandPaperPolishingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
AllGuiTextures.JEI_SLOT.draw(26, 28); AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 28);
getRenderedSlot(recipe, 0).draw(131, 28); getRenderedSlot(recipe, 0).draw(matrixStack, 131, 28);
AllGuiTextures.JEI_SHADOW.draw(61, 21); AllGuiTextures.JEI_SHADOW.draw(matrixStack, 61, 21);
AllGuiTextures.JEI_LONG_ARROW.draw(52, 32); AllGuiTextures.JEI_LONG_ARROW.draw(matrixStack, 52, 32);
NonNullList<Ingredient> ingredients = recipe.getIngredients(); NonNullList<Ingredient> ingredients = recipe.getIngredients();
ItemStack[] matchingStacks = ingredients.get(0).getMatchingStacks(); ItemStack[] matchingStacks = ingredients.get(0).getMatchingStacks();
if (matchingStacks.length == 0) if (matchingStacks.length == 0)
return; return;
RenderSystem.pushMatrix(); matrixStack.push();
CompoundNBT tag = renderedSandpaper.getOrCreateTag(); CompoundNBT tag = renderedSandpaper.getOrCreateTag();
tag.put("Polishing", matchingStacks[0].serializeNBT()); tag.put("Polishing", matchingStacks[0].serializeNBT());
tag.putBoolean("JEI", true); tag.putBoolean("JEI", true);
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
RenderSystem.scaled(2, 2, 2); matrixStack.scale(2, 2, 2);
itemRenderer.renderItemIntoGUI(renderedSandpaper, getBackground().getWidth() / 4 - 8, 1); itemRenderer.renderItemIntoGUI(renderedSandpaper, getBackground().getWidth() / 4 - 8, 1);
RenderSystem.popMatrix(); matrixStack.pop();
} }
} }

View file

@ -3,6 +3,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.category.animations.AnimatedPress; import com.simibubi.create.compat.jei.category.animations.AnimatedPress;
@ -51,14 +52,14 @@ public class PressingCategory extends CreateRecipeCategory<PressingRecipe> {
} }
@Override @Override
public void draw(PressingRecipe recipe, double mouseX, double mouseY) { public void draw(PressingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
AllGuiTextures.JEI_SLOT.draw(26, 50); AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 50);
getRenderedSlot(recipe, 0).draw(131, 50); getRenderedSlot(recipe, 0).draw(matrixStack, 131, 50);
if (recipe.getRollableResults().size() > 1) if (recipe.getRollableResults().size() > 1)
getRenderedSlot(recipe, 1).draw(131 + 19, 50); getRenderedSlot(recipe, 1).draw(matrixStack, 131 + 19, 50);
AllGuiTextures.JEI_SHADOW.draw(61, 41); AllGuiTextures.JEI_SHADOW.draw(matrixStack, 61, 41);
AllGuiTextures.JEI_LONG_ARROW.draw(52, 54); AllGuiTextures.JEI_LONG_ARROW.draw(matrixStack, 52, 54);
press.draw(getBackground().getWidth() / 2 - 17, 22); press.draw(matrixStack, getBackground().getWidth() / 2 - 17, 22);
} }
} }

View file

@ -2,6 +2,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.Arrays; import java.util.Arrays;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks; 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.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.math.vector.Quaternion;
public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends CreateRecipeCategory<T> { public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends CreateRecipeCategory<T> {
@ -40,21 +42,21 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
itemStacks.set(1, recipe.getRecipeOutput()); itemStacks.set(1, recipe.getRecipeOutput());
} }
protected void renderWidgets(T recipe, double mouseX, double mouseY) { protected void renderWidgets(MatrixStack matrixStack, T recipe, double mouseX, double mouseY) {
AllGuiTextures.JEI_SLOT.draw(20, 47); AllGuiTextures.JEI_SLOT.draw(matrixStack, 20, 47);
AllGuiTextures.JEI_SLOT.draw(139, 47); AllGuiTextures.JEI_SLOT.draw(matrixStack, 139, 47);
AllGuiTextures.JEI_SHADOW.draw(47, 29); AllGuiTextures.JEI_SHADOW.draw(matrixStack, 47, 29);
AllGuiTextures.JEI_LIGHT.draw(66, 39); AllGuiTextures.JEI_LIGHT.draw(matrixStack, 66, 39);
AllGuiTextures.JEI_LONG_ARROW.draw(53, 51); AllGuiTextures.JEI_LONG_ARROW.draw(matrixStack, 53, 51);
} }
@Override @Override
public void draw(T recipe, double mouseX, double mouseY) { public void draw(T recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
renderWidgets(recipe, mouseX, mouseY); renderWidgets(matrixStack, recipe, mouseX, mouseY);
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.translatef(56, 33, 0); matrixStack.translate(56, 33, 0);
RenderSystem.rotatef(-12.5f, 1, 0, 0); matrixStack.multiply(new Quaternion( -12.5f, 1, 0, 0));
RenderSystem.rotatef(22.5f, 0, 1, 0); matrixStack.multiply(new Quaternion( 22.5f, 0, 1, 0));
int scale = 24; int scale = 24;
GuiGameElement.of(AllBlockPartials.ENCASED_FAN_INNER) GuiGameElement.of(AllBlockPartials.ENCASED_FAN_INNER)
@ -68,10 +70,10 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
.scale(scale) .scale(scale)
.render(); .render();
renderAttachedBlock(); renderAttachedBlock(matrixStack);
RenderSystem.popMatrix(); matrixStack.pop();
} }
public abstract void renderAttachedBlock(); public abstract void renderAttachedBlock(MatrixStack matrixStack);
} }

View file

@ -3,6 +3,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.compat.jei.category.animations.AnimatedSaw; import com.simibubi.create.compat.jei.category.animations.AnimatedSaw;
import com.simibubi.create.content.contraptions.components.saw.CuttingRecipe; import com.simibubi.create.content.contraptions.components.saw.CuttingRecipe;
@ -53,16 +54,16 @@ public class SawingCategory extends CreateRecipeCategory<CuttingRecipe> {
} }
@Override @Override
public void draw(CuttingRecipe recipe, double mouseX, double mouseY) { public void draw(CuttingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
AllGuiTextures.JEI_SLOT.draw(43, 4); AllGuiTextures.JEI_SLOT.draw(matrixStack, 43, 4);
int size = recipe.getRollableResults().size(); int size = recipe.getRollableResults().size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
int xOffset = i % 2 == 0 ? 0 : 19; int xOffset = i % 2 == 0 ? 0 : 19;
int yOffset = (i / 2) * -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); AllGuiTextures.JEI_DOWN_ARROW.draw(matrixStack, 70, 6);
saw.draw(72, 42); saw.draw(matrixStack, 72, 42);
} }
} }

View file

@ -1,5 +1,6 @@
package com.simibubi.create.compat.jei.category; package com.simibubi.create.compat.jei.category;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.gui.GuiGameElement;
@ -19,7 +20,7 @@ public class SmokingViaFanCategory extends ProcessingViaFanCategory<SmokingRecip
} }
@Override @Override
public void renderAttachedBlock() { public void renderAttachedBlock(MatrixStack matrixStack) {
GuiGameElement.of(Blocks.FIRE.getDefaultState()) GuiGameElement.of(Blocks.FIRE.getDefaultState())
.scale(24) .scale(24)

View file

@ -3,6 +3,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.content.contraptions.components.fan.SplashingRecipe; import com.simibubi.create.content.contraptions.components.fan.SplashingRecipe;
@ -57,37 +58,37 @@ public class SplashingCategory extends ProcessingViaFanCategory<SplashingRecipe>
} }
@Override @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() int size = recipe.getRollableResultsAsItemStacks()
.size(); .size();
AllGuiTextures.JEI_SLOT.draw(20, 47); AllGuiTextures.JEI_SLOT.draw(matrixStack, 20, 47);
AllGuiTextures.JEI_SHADOW.draw(47, 29); AllGuiTextures.JEI_SHADOW.draw(matrixStack, 47, 29);
AllGuiTextures.JEI_SHADOW.draw(66, 39); AllGuiTextures.JEI_SHADOW.draw(matrixStack, 66, 39);
AllGuiTextures.JEI_LONG_ARROW.draw(53, 51); AllGuiTextures.JEI_LONG_ARROW.draw(matrixStack, 53, 51);
if (size == 1) { if (size == 1) {
getRenderedSlot(recipe, 0).draw(139, 47); getRenderedSlot(recipe, 0).draw(matrixStack, 139, 47);
return; return;
} }
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
int xOffset = i % 2 == 0 ? 0 : 19; int xOffset = i % 2 == 0 ? 0 : 19;
int yOffset = (i / 2) * -19; int yOffset = (i / 2) * -19;
getRenderedSlot(recipe, i).draw(133 + xOffset, 47 + yOffset); getRenderedSlot(recipe, i).draw(matrixStack, 133 + xOffset, 47 + yOffset);
} }
} }
@Override @Override
public void renderAttachedBlock() { public void renderAttachedBlock(MatrixStack matrixStack) {
RenderSystem.pushMatrix(); matrixStack.push();
GuiGameElement.of(Fluids.WATER) GuiGameElement.of(Fluids.WATER)
.scale(24) .scale(24)
.atLocal(0, 0, 2) .atLocal(0, 0, 2)
.render(); .render();
RenderSystem.popMatrix(); matrixStack.pop();
} }
} }

View file

@ -1,20 +1,24 @@
package com.simibubi.create.compat.jei.category.animations; package com.simibubi.create.compat.jei.category.animations;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.gui.GuiGameElement;
import com.simibubi.create.foundation.utility.MatrixStacker;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.vector.Quaternion;
public class AnimatedCrushingWheels extends AnimatedKinetics { public class AnimatedCrushingWheels extends AnimatedKinetics {
@Override @Override
public void draw(int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
RenderSystem.enableDepthTest(); RenderSystem.enableDepthTest();
RenderSystem.translatef(xOffset, yOffset, 100); matrixStack.translate(xOffset, yOffset, 100);
RenderSystem.rotatef(-22.5f, 0, 1, 0); matrixStack.multiply(new Quaternion(-22.5f, 0, 1, 0));
// RenderSystem.rotatef(-22.5f, 0, 1, 0);
int scale = 22; int scale = 22;
BlockState wheel = AllBlocks.CRUSHING_WHEEL.get() BlockState wheel = AllBlocks.CRUSHING_WHEEL.get()

View file

@ -1,5 +1,6 @@
package com.simibubi.create.compat.jei.category.animations; package com.simibubi.create.compat.jei.category.animations;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
@ -9,11 +10,11 @@ import com.simibubi.create.foundation.gui.GuiGameElement;
public class AnimatedMillstone extends AnimatedKinetics { public class AnimatedMillstone extends AnimatedKinetics {
@Override @Override
public void draw(int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.translatef(xOffset, yOffset, 0); matrixStack.translate(xOffset, yOffset, 0);
AllGuiTextures.JEI_SHADOW.draw(-16, 13); AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13);
RenderSystem.translatef(-2, 18, 0); matrixStack.translate(-2, 18, 0);
int scale = 22; int scale = 22;
GuiGameElement.of(AllBlockPartials.MILLSTONE_COG) GuiGameElement.of(AllBlockPartials.MILLSTONE_COG)
@ -26,7 +27,7 @@ public class AnimatedMillstone extends AnimatedKinetics {
.scale(scale) .scale(scale)
.render(); .render();
RenderSystem.popMatrix(); matrixStack.pop();
} }
} }

View file

@ -1,5 +1,6 @@
package com.simibubi.create.compat.jei.category.animations; package com.simibubi.create.compat.jei.category.animations;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
@ -7,15 +8,16 @@ import com.simibubi.create.foundation.gui.GuiGameElement;
import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Quaternion;
public class AnimatedMixer extends AnimatedKinetics { public class AnimatedMixer extends AnimatedKinetics {
@Override @Override
public void draw(int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.translatef(xOffset, yOffset, 200); matrixStack.translate(xOffset, yOffset, 200);
RenderSystem.rotatef(-15.5f, 1, 0, 0); matrixStack.multiply(new Quaternion(-15.5f, 1, 0, 0));
RenderSystem.rotatef(22.5f, 0, 1, 0); matrixStack.multiply(new Quaternion( 22.5f, 0, 1, 0));
int scale = 23; int scale = 23;
GuiGameElement.of(cogwheel()) GuiGameElement.of(cogwheel())
@ -47,7 +49,7 @@ public class AnimatedMixer extends AnimatedKinetics {
.scale(scale) .scale(scale)
.render(); .render();
RenderSystem.popMatrix(); matrixStack.pop();
} }
} }

View file

@ -2,6 +2,7 @@ package com.simibubi.create.compat.jei.category.animations;
import static com.simibubi.create.foundation.utility.AnimationTickHolder.ticks; import static com.simibubi.create.foundation.utility.AnimationTickHolder.ticks;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
@ -9,6 +10,7 @@ import com.simibubi.create.foundation.gui.GuiGameElement;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.vector.Quaternion;
public class AnimatedPress extends AnimatedKinetics { public class AnimatedPress extends AnimatedKinetics {
@ -19,11 +21,11 @@ public class AnimatedPress extends AnimatedKinetics {
} }
@Override @Override
public void draw(int xOffset, int yOffset) { public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.translatef(xOffset, yOffset, 100); matrixStack.translate(xOffset, yOffset, 100);
RenderSystem.rotatef(-15.5f, 1, 0, 0); matrixStack.multiply(new Quaternion( -15.5f, 1, 0, 0));
RenderSystem.rotatef(22.5f, 0, 1, 0); matrixStack.multiply(new Quaternion( 22.5f, 0, 1, 0));
int scale = basin ? 20 : 24; int scale = basin ? 20 : 24;
GuiGameElement.of(shaft(Axis.Z)) GuiGameElement.of(shaft(Axis.Z))
@ -46,7 +48,7 @@ public class AnimatedPress extends AnimatedKinetics {
.scale(scale) .scale(scale)
.render(); .render();
RenderSystem.popMatrix(); matrixStack.pop();
} }
private float getAnimatedHeadOffset() { private float getAnimatedHeadOffset() {

View file

@ -70,8 +70,8 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
float stressTotal = stressBase * speed; float stressTotal = stressBase * speed;
String stressString = spacing + "%s%s" + Lang.translate("generic.unit.stress") + " " + TextFormatting.DARK_GRAY + "%s"; 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(ITextComponent.of(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, TextFormatting.GRAY, IHaveGoggleInformation.format(stressTotal), Lang.translate("gui.goggles.at_current_speed").getUnformattedComponentText())));
added = true; added = true;
} }

View file

@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.actors;
import com.simibubi.create.AllEntityTypes; 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.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
@ -95,8 +95,7 @@ public class SeatEntity extends Entity implements IEntityAdditionalSpawnData {
} }
@Override @Override
public boolean shouldRender(SeatEntity p_225626_1_, ClippingHelperImpl p_225626_2_, double p_225626_3_, public boolean shouldRender(SeatEntity p_225626_1_, ClippingHelper p_225626_2_, double p_225626_3_, double p_225626_5_, double p_225626_7_) {
double p_225626_5_, double p_225626_7_) {
return false; return false;
} }

View file

@ -33,7 +33,6 @@ import net.minecraft.block.material.PushReaction;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.ProjectileEntity;
import net.minecraft.entity.item.BoatEntity; import net.minecraft.entity.item.BoatEntity;
import net.minecraft.entity.item.HangingEntity; import net.minecraft.entity.item.HangingEntity;
import net.minecraft.entity.item.minecart.AbstractMinecartEntity; 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.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector3d; 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.World;
import net.minecraft.world.gen.feature.template.Template.BlockInfo; import net.minecraft.world.gen.feature.template.Template.BlockInfo;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
@ -207,7 +202,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
} }
@Override @Override
public void updatePassengerPosition(Entity passenger, IMoveCallback callback) { protected void updatePassengerPosition(Entity passenger, IMoveCallback callback) {
if (!isPassenger(passenger)) if (!isPassenger(passenger))
return; return;
Vector3d transformedVector = getPassengerPosition(passenger); Vector3d transformedVector = getPassengerPosition(passenger);

View file

@ -17,7 +17,7 @@ public class MovementContext {
public Vector3d motion; public Vector3d motion;
public Vector3d relativeMotion; public Vector3d relativeMotion;
public Vector3d rotation; public Vector3d rotation;
public World world; public ServerWorld world;
public BlockState state; public BlockState state;
public BlockPos localPos; public BlockPos localPos;
public CompoundNBT tileData; public CompoundNBT tileData;
@ -28,7 +28,7 @@ public class MovementContext {
public Contraption contraption; public Contraption contraption;
public Object temporaryData; public Object temporaryData;
public MovementContext(World world, BlockInfo info) { public MovementContext(ServerWorld world, BlockInfo info) {
this.world = world; this.world = world;
this.state = info.state; this.state = info.state;
this.tileData = info.nbt; this.tileData = info.nbt;
@ -53,7 +53,7 @@ public class MovementContext {
return (((int) (length * modifier + 100 * Math.signum(length))) / 100) * 100; 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); MovementContext context = new MovementContext(world, info);
context.motion = VecHelper.readNBT(nbt.getList("Motion", NBT.TAG_DOUBLE)); context.motion = VecHelper.readNBT(nbt.getList("Motion", NBT.TAG_DOUBLE));
context.relativeMotion = VecHelper.readNBT(nbt.getList("RelativeMotion", NBT.TAG_DOUBLE)); context.relativeMotion = VecHelper.readNBT(nbt.getList("RelativeMotion", NBT.TAG_DOUBLE));

View file

@ -14,13 +14,18 @@ public enum InstructionSpeedModifiers {
String translationKey; String translationKey;
int value; int value;
String label; ITextComponent label;
private InstructionSpeedModifiers(int modifier, String label) { private InstructionSpeedModifiers(int modifier, ITextComponent label) {
this.label = label; this.label = label;
translationKey = "gui.sequenced_gearshift.speed." + Lang.asId(name()); translationKey = "gui.sequenced_gearshift.speed." + Lang.asId(name());
value = modifier; 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<ITextComponent> getOptions() { static List<ITextComponent> getOptions() {
List<ITextComponent> options = new ArrayList<>(); List<ITextComponent> options = new ArrayList<>();

View file

@ -12,6 +12,7 @@ import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import java.util.Vector; import java.util.Vector;
@ -20,7 +21,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
private final ItemStack renderedItem = AllBlocks.SEQUENCED_GEARSHIFT.asStack(); private final ItemStack renderedItem = AllBlocks.SEQUENCED_GEARSHIFT.asStack();
private final AllGuiTextures background = AllGuiTextures.SEQUENCER; 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 ListNBT compareTag;
private Vector<Instruction> instructions; private Vector<Instruction> instructions;
private BlockPos pos; private BlockPos pos;
@ -114,7 +115,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
@Override @Override
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
int hFontColor = 0xD3CBBE; int hFontColor = 0xD3CBBE;
background.draw(this, guiLeft, guiTop); background.draw(matrixStack, this, guiLeft, guiTop);
for (int row = 0; row < instructions.capacity(); row++) { for (int row = 0; row < instructions.capacity(); row++) {
AllGuiTextures toDraw = AllGuiTextures.SEQUENCER_EMPTY; AllGuiTextures toDraw = AllGuiTextures.SEQUENCER_EMPTY;
@ -123,12 +124,12 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
if (row < instructions.size()) { if (row < instructions.size()) {
Instruction instruction = instructions.get(row); Instruction instruction = instructions.get(row);
SequencerInstructions def = instruction.instruction; 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)); label(matrixStack, 32, 6 + yOffset, Lang.translate(def.translationKey));
if (def.hasValueParameter) { if (def.hasValueParameter) {
String text = def.formatValue(instruction.value); ITextComponent text = ITextComponent.of(def.formatValue(instruction.value));
int stringWidth = textRenderer.getStringWidth(text); int stringWidth = textRenderer.getWidth(text);
label(matrixStack, 85 + (12 - stringWidth / 2), 6 + yOffset, text); label(matrixStack, 85 + (12 - stringWidth / 2), 6 + yOffset, text);
} }
if (def.hasSpeedParameter) if (def.hasSpeedParameter)
@ -137,10 +138,10 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
continue; 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); hFontColor);
GuiGameElement.of(renderedItem) GuiGameElement.of(renderedItem)
@ -149,7 +150,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
.render(); .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); textRenderer.drawWithShadow(matrixStack, text, guiLeft + x, guiTop + 26 + y, 0xFFFFEE);
} }

View file

@ -24,7 +24,6 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.material.Material;
import net.minecraft.client.particle.ParticleManager; import net.minecraft.client.particle.ParticleManager;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.MobEntity; import net.minecraft.entity.MobEntity;
@ -58,8 +57,9 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.loot.LootParameters; 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.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.Tags; import net.minecraftforge.common.Tags;
@ -128,7 +128,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
} }
@Override @Override
public void spawnAdditionalDrops(BlockState state, World worldIn, BlockPos pos, ItemStack stack) { public void spawnAdditionalDrops(BlockState state, ServerWorld worldIn, BlockPos pos, ItemStack p_220062_4_) {
BeltTileEntity controllerTE = BeltHelper.getControllerTE(worldIn, pos); BeltTileEntity controllerTE = BeltHelper.getControllerTE(worldIn, pos);
if (controllerTE != null) if (controllerTE != null)
controllerTE.getInventory() controllerTE.getInventory()
@ -370,7 +370,7 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE<BeltTileEnt
} }
public static void initBelt(World world, BlockPos pos) { public static void initBelt(World world, BlockPos pos) {
if (world.isRemote || world.getWorldType() == WorldType.DEBUG_ALL_BLOCK_STATES) if (world instanceof ServerWorld && ((ServerWorld) world).getChunkProvider().getChunkGenerator() instanceof DebugChunkGenerator)
return; return;
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);

View file

@ -41,11 +41,6 @@ public class AdjustablePulleyBlock extends EncasedBeltBlock implements ITE<Adjus
withTileEntityDo(worldIn, pos, AdjustablePulleyTileEntity::neighborChanged); withTileEntityDo(worldIn, pos, AdjustablePulleyTileEntity::neighborChanged);
} }
@Override
public void updateNeighbors(BlockState stateIn, IWorld worldIn, BlockPos pos, int flags) {
super.updateNeighbors(stateIn, worldIn, pos, flags);
}
@Override @Override
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockItemUseContext context) {
return super.getStateForPlacement(context).with(POWERED, context.getWorld().isBlockPowered(context.getPos())); return super.getStateForPlacement(context).with(POWERED, context.getWorld().isBlockPowered(context.getPos()));

View file

@ -18,6 +18,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.network.PacketDistributor; import net.minecraftforge.fml.network.PacketDistributor;
public class SymmetryWandScreen extends AbstractSimiScreen { public class SymmetryWandScreen extends AbstractSimiScreen {
@ -27,8 +28,8 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
private ScrollInput areaAlign; private ScrollInput areaAlign;
private Label labelAlign; private Label labelAlign;
private final String mirrorType = Lang.translate("gui.symmetryWand.mirrorType"); private final ITextComponent mirrorType = Lang.translate("gui.symmetryWand.mirrorType");
private final String orientation = Lang.translate("gui.symmetryWand.orientation"); private final ITextComponent orientation = Lang.translate("gui.symmetryWand.orientation");
private SymmetryMirror currentElement; private SymmetryMirror currentElement;
private ItemStack wand; private ItemStack wand;
@ -58,7 +59,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
int state = int state =
currentElement instanceof TriplePlaneMirror ? 2 : currentElement instanceof CrossPlaneMirror ? 1 : 0; currentElement instanceof TriplePlaneMirror ? 2 : currentElement instanceof CrossPlaneMirror ? 1 : 0;
areaType = new SelectionScrollInput(guiLeft + 119, guiTop + 12, 70, 14).forOptions(SymmetryMirror.getMirrors()) areaType = new SelectionScrollInput(guiLeft + 119, guiTop + 12, 70, 14).forOptions(SymmetryMirror.getMirrors())
.titled(mirrorType) .titled(mirrorType.copy())
.writingTo(labelType) .writingTo(labelType)
.setState(state); .setState(state);
@ -95,7 +96,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
} }
areaAlign = new SelectionScrollInput(guiLeft + 119, guiTop + 32, 70, 14).forOptions(element.getAlignToolTips()) areaAlign = new SelectionScrollInput(guiLeft + 119, guiTop + 32, 70, 14).forOptions(element.getAlignToolTips())
.titled(orientation) .titled(orientation.copy())
.writingTo(labelAlign) .writingTo(labelAlign)
.setState(element.getOrientationIndex()) .setState(element.getOrientationIndex())
.calling(element::setOrientation); .calling(element::setOrientation);
@ -105,7 +106,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
@Override @Override
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
AllGuiTextures.WAND_SYMMETRY.draw(this, guiLeft, guiTop); AllGuiTextures.WAND_SYMMETRY.draw(matrixStack, this, guiLeft, guiTop);
int x = guiLeft + 63; int x = guiLeft + 63;
int y = guiTop + 15; int y = guiTop + 15;

View file

@ -14,6 +14,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent;
public class CrossPlaneMirror extends SymmetryMirror { public class CrossPlaneMirror extends SymmetryMirror {
@ -99,7 +100,7 @@ public class CrossPlaneMirror extends SymmetryMirror {
} }
@Override @Override
public List<String> getAlignToolTips() { public List<ITextComponent> getAlignToolTips() {
return ImmutableList.of(Lang.translate("orientation.orthogonal"), Lang.translate("orientation.diagonal")); return ImmutableList.of(Lang.translate("orientation.orthogonal"), Lang.translate("orientation.diagonal"));
} }

View file

@ -11,6 +11,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent;
public class EmptyMirror extends SymmetryMirror { public class EmptyMirror extends SymmetryMirror {
@ -54,7 +55,7 @@ public class EmptyMirror extends SymmetryMirror {
} }
@Override @Override
public List<String> getAlignToolTips() { public List<ITextComponent> getAlignToolTips() {
return ImmutableList.of(); return ImmutableList.of();
} }

View file

@ -14,6 +14,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent;
public class PlaneMirror extends SymmetryMirror { public class PlaneMirror extends SymmetryMirror {
@ -95,7 +96,7 @@ public class PlaneMirror extends SymmetryMirror {
} }
@Override @Override
public List<String> getAlignToolTips() { public List<ITextComponent> getAlignToolTips() {
return ImmutableList.of(Lang.translate("orientation.alongZ"), Lang.translate("orientation.alongX")); return ImmutableList.of(Lang.translate("orientation.alongZ"), Lang.translate("orientation.alongX"));
} }

View file

@ -206,6 +206,6 @@ public abstract class SymmetryMirror {
this.position = pos3d; this.position = pos3d;
} }
public abstract List<String> getAlignToolTips(); public abstract List<ITextComponent> getAlignToolTips();
} }

View file

@ -12,6 +12,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent;
public class TriplePlaneMirror extends SymmetryMirror { public class TriplePlaneMirror extends SymmetryMirror {
@ -60,7 +61,7 @@ public class TriplePlaneMirror extends SymmetryMirror {
} }
@Override @Override
public List<String> getAlignToolTips() { public List<ITextComponent> getAlignToolTips() {
return ImmutableList.of(Lang.translate("orientation.horizontal")); return ImmutableList.of(Lang.translate("orientation.horizontal"));
} }

View file

@ -12,6 +12,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.Attribute;
import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.item.ItemFrameEntity; import net.minecraft.entity.item.ItemFrameEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -21,6 +22,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.Rarity; import net.minecraft.item.Rarity;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.EntityRayTraceResult; import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.MathHelper; 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.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.InputEvent.ClickInputEvent; 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.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.event.entity.player.AttackEntityEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@ -38,19 +41,19 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
@EventBusSubscriber @EventBusSubscriber
public class ExtendoGripItem extends Item { public class ExtendoGripItem extends Item {
static Multimap<String, AttributeModifier> rangeModifier; static Multimap<Attribute, AttributeModifier> rangeModifier;
static Multimap<String, AttributeModifier> doubleRangeModifier; static Multimap<Attribute, AttributeModifier> doubleRangeModifier;
static { static {
// Holding an ExtendoGrip // Holding an ExtendoGrip
rangeModifier = HashMultimap.create(); 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, new AttributeModifier(UUID.fromString("7f7dbdb2-0d0d-458a-aa40-ac7633691f66"), "Range modifier", 3,
AttributeModifier.Operation.ADDITION)); AttributeModifier.Operation.ADDITION));
// Holding two ExtendoGrips o.O // Holding two ExtendoGrips o.O
doubleRangeModifier = HashMultimap.create(); 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, new AttributeModifier(UUID.fromString("8f7dbdb2-0d0d-458a-aa40-ac7633691f66"), "Range modifier", 5,
AttributeModifier.Operation.ADDITION)); AttributeModifier.Operation.ADDITION));
} }
@ -82,14 +85,13 @@ public class ExtendoGripItem extends Item {
if (holdingExtendo != wasHoldingExtendo) { if (holdingExtendo != wasHoldingExtendo) {
if (!holdingExtendo) { if (!holdingExtendo) {
player.getAttributes() player.getAttributes().removeModifiers(rangeModifier);
.removeAttributeModifiers(rangeModifier);
persistentData.remove(marker); persistentData.remove(marker);
} else { } else {
if (player instanceof ServerPlayerEntity) if (player instanceof ServerPlayerEntity)
AllTriggers.EXTENDO.trigger((ServerPlayerEntity) player); AllTriggers.EXTENDO.trigger((ServerPlayerEntity) player);
player.getAttributes() player.getAttributes()
.applyAttributeModifiers(rangeModifier); .addTemporaryModifiers(rangeModifier);
persistentData.putBoolean(marker, true); persistentData.putBoolean(marker, true);
} }
} }
@ -97,13 +99,13 @@ public class ExtendoGripItem extends Item {
if (holdingDualExtendo != wasHoldingDualExtendo) { if (holdingDualExtendo != wasHoldingDualExtendo) {
if (!holdingDualExtendo) { if (!holdingDualExtendo) {
player.getAttributes() player.getAttributes()
.removeAttributeModifiers(doubleRangeModifier); .removeModifiers(doubleRangeModifier);
persistentData.remove(dualMarker); persistentData.remove(dualMarker);
} else { } else {
if (player instanceof ServerPlayerEntity) if (player instanceof ServerPlayerEntity)
AllTriggers.GIGA_EXTENDO.trigger((ServerPlayerEntity) player); AllTriggers.GIGA_EXTENDO.trigger((ServerPlayerEntity) player);
player.getAttributes() player.getAttributes()
.applyAttributeModifiers(doubleRangeModifier); .addTemporaryModifiers(doubleRangeModifier);
persistentData.putBoolean(dualMarker, true); persistentData.putBoolean(dualMarker, true);
} }
} }
@ -121,7 +123,7 @@ public class ExtendoGripItem extends Item {
return; return;
// Modified version of GameRenderer#getMouseOver // Modified version of GameRenderer#getMouseOver
double d0 = player.getAttribute(PlayerEntity.REACH_DISTANCE) double d0 = player.getAttribute(ForgeMod.REACH_DISTANCE.get())
.getValue(); .getValue();
if (!player.isCreative()) if (!player.isCreative())
d0 -= 0.5f; d0 -= 0.5f;
@ -162,7 +164,7 @@ public class ExtendoGripItem extends Item {
int strength = 2; int strength = 2;
float yaw = entity.rotationYaw * ((float) Math.PI / 180F); float yaw = entity.rotationYaw * ((float) Math.PI / 180F);
if (target instanceof LivingEntity) { 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; return;
} }
target.addVelocity(-MathHelper.sin(yaw) * strength, 0.1D, MathHelper.cos(yaw) * strength); target.addVelocity(-MathHelper.sin(yaw) * strength, 0.1D, MathHelper.cos(yaw) * strength);

View file

@ -21,6 +21,7 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTUtil; import net.minecraft.nbt.NBTUtil;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class ZapperScreen extends AbstractSimiScreen { public class ZapperScreen extends AbstractSimiScreen {
@ -30,9 +31,9 @@ public class ZapperScreen extends AbstractSimiScreen {
protected float animationProgress; protected float animationProgress;
protected AllGuiTextures background; 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<IconButton> patternButtons; protected Vector<IconButton> patternButtons;
protected int brightColor; protected int brightColor;
protected int fontColor; protected int fontColor;
@ -42,7 +43,7 @@ public class ZapperScreen extends AbstractSimiScreen {
this.background = background; this.background = background;
this.zapper = zapper; this.zapper = zapper;
this.offhand = offhand; this.offhand = offhand;
title = ""; title = StringTextComponent.EMPTY;
brightColor = 0xCCDDFF; brightColor = 0xCCDDFF;
fontColor = AllGuiTextures.FONT_COLOR; fontColor = AllGuiTextures.FONT_COLOR;
} }
@ -65,7 +66,7 @@ public class ZapperScreen extends AbstractSimiScreen {
PlacementPatterns pattern = PlacementPatterns.values()[id]; PlacementPatterns pattern = PlacementPatterns.values()[id];
patternButtons.add(new IconButton(i + 147 + col * 18, j + 23 + row * 18, pattern.icon)); patternButtons.add(new IconButton(i + 147 + col * 18, j + 23 + row * 18, pattern.icon));
patternButtons.get(id) 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 i = guiLeft - 20;
int j = guiTop; int j = guiTop;
background.draw(this, i, j); background.draw(matrixStack, this, i, j);
drawOnBackground(matrixStack, i, j); drawOnBackground(matrixStack, i, j);
client.getTextureManager() client.getTextureManager()

View file

@ -15,11 +15,12 @@ import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
public class BlockzapperScreen extends ZapperScreen { 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 IconButton replaceModeButton;
private Indicator replaceModeIndicator; private Indicator replaceModeIndicator;
@ -44,23 +45,23 @@ public class BlockzapperScreen extends ZapperScreen {
int j = guiTop; int j = guiTop;
CompoundNBT nbt = zapper.getOrCreateTag(); 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); replaceModeButton = new IconButton(i + 51, j + 41, AllIcons.I_REPLACE_SOLID);
if (nbt.contains("Replace") && nbt.getBoolean("Replace")) if (nbt.contains("Replace") && nbt.getBoolean("Replace"))
replaceModeIndicator.state = State.ON; 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); spreadDiagonallyButton = new IconButton(i + 74, j + 41, AllIcons.I_FOLLOW_DIAGONAL);
if (nbt.contains("SearchDiagonal") && nbt.getBoolean("SearchDiagonal")) if (nbt.contains("SearchDiagonal") && nbt.getBoolean("SearchDiagonal"))
spreadDiagonallyIndicator.state = State.ON; 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); spreadMaterialButton = new IconButton(i + 92, j + 41, AllIcons.I_FOLLOW_MATERIAL);
if (nbt.contains("SearchFuzzy") && nbt.getBoolean("SearchFuzzy")) if (nbt.contains("SearchFuzzy") && nbt.getBoolean("SearchFuzzy"))
spreadMaterialIndicator.state = State.ON; 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"); spreadRangeLabel = new Label(i + 119, j + 46, "").withShadow().withSuffix("m");
spreadRangeInput = new ScrollInput(i + 115, j + 43, 22, 14).withRange(1, BlockzapperItem.getMaxAoe(zapper)) 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")) if (nbt.contains("SearchDistance"))
spreadRangeInput.setState(nbt.getInt("SearchDistance")); spreadRangeInput.setState(nbt.getInt("SearchDistance"));
if (BlockzapperItem.getMaxAoe(zapper) == 2) 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, Collections.addAll(widgets, replaceModeButton, replaceModeIndicator, spreadDiagonallyButton,
spreadDiagonallyIndicator, spreadMaterialButton, spreadMaterialIndicator, spreadRangeLabel, spreadDiagonallyIndicator, spreadMaterialButton, spreadMaterialIndicator, spreadRangeLabel,

View file

@ -7,6 +7,7 @@ import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent;
public abstract class Brush { public abstract class Brush {
@ -33,7 +34,7 @@ public abstract class Brush {
return 0; return 0;
} }
String getParamLabel(int paramIndex) { ITextComponent getParamLabel(int paramIndex) {
return Lang return Lang
.translate(paramIndex == 0 ? "generic.width" : paramIndex == 1 ? "generic.height" : "generic.length"); .translate(paramIndex == 0 ? "generic.width" : paramIndex == 1 ? "generic.height" : "generic.length");
} }

View file

@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import net.minecraft.util.text.ITextComponent;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
@ -72,7 +73,7 @@ public class CylinderBrush extends Brush {
} }
@Override @Override
String getParamLabel(int paramIndex) { ITextComponent getParamLabel(int paramIndex) {
return paramIndex == 0 ? Lang.translate("generic.radius") : super.getParamLabel(paramIndex); return paramIndex == 0 ? Lang.translate("generic.radius") : super.getParamLabel(paramIndex);
} }

View file

@ -11,6 +11,7 @@ import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent;
public class SphereBrush extends Brush { public class SphereBrush extends Brush {
@ -49,7 +50,7 @@ public class SphereBrush extends Brush {
} }
@Override @Override
String getParamLabel(int paramIndex) { ITextComponent getParamLabel(int paramIndex) {
return Lang.translate("generic.radius"); return Lang.translate("generic.radius");
} }

View file

@ -22,9 +22,9 @@ import net.minecraft.util.text.ITextComponent;
public class WorldshaperScreen extends ZapperScreen { public class WorldshaperScreen extends ZapperScreen {
protected final String placementSection = Lang.translate("gui.terrainzapper.placement"); protected final ITextComponent placementSection = Lang.translate("gui.terrainzapper.placement");
protected final String toolSection = Lang.translate("gui.terrainzapper.tool"); protected final ITextComponent toolSection = Lang.translate("gui.terrainzapper.tool");
protected final List<String> brushOptions = protected final List<ITextComponent> brushOptions =
Lang.translatedOptions("gui.terrainzapper.brush", "cuboid", "sphere", "cylinder"); Lang.translatedOptions("gui.terrainzapper.brush", "cuboid", "sphere", "cylinder");
protected Vector<IconButton> toolButtons; protected Vector<IconButton> toolButtons;
@ -72,7 +72,7 @@ public class WorldshaperScreen extends ZapperScreen {
TerrainTools tool = toolValues[id]; TerrainTools tool = toolValues[id];
toolButtons.add(new IconButton(i + 8 + id * 18, j + 76, tool.icon)); toolButtons.add(new IconButton(i + 8 + id * 18, j + 76, tool.icon));
toolButtons.get(id) 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")) if (nbt.contains("Tool"))
@ -86,7 +86,7 @@ public class WorldshaperScreen extends ZapperScreen {
PlacementOptions option = placementValues[id]; PlacementOptions option = placementValues[id];
placementButtons.add(new IconButton(i + 147 + id * 18, j + 76, option.icon)); placementButtons.add(new IconButton(i + 147 + id * 18, j + 76, option.icon));
placementButtons.get(id) 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")) 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) ScrollInput input = new ScrollInput(i + 55 + 18 * index, j + 43, 14, 14)
.withRange(currentBrush.getMin(index), currentBrush.getMax(index) + 1) .withRange(currentBrush.getMin(index), currentBrush.getMax(index) + 1)
.writingTo(label) .writingTo(label)
.titled(currentBrush.getParamLabel(index)) .titled(currentBrush.getParamLabel(index).copy())
.calling(state -> { .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.setState(params[index]);
input.onChanged(); input.onChanged();
@ -178,7 +178,7 @@ public class WorldshaperScreen extends ZapperScreen {
Brush currentBrush = TerrainBrushes.values()[brushInput.getState()].get(); Brush currentBrush = TerrainBrushes.values()[brushInput.getState()].get();
for (int index = 2; index >= currentBrush.amtParams; index--) { 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); textRenderer.draw(matrixStack, toolSection, i + 8, j + 64, fontColor);

View file

@ -33,8 +33,8 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen<Adjustabl
private List<Rectangle2d> extraAreas; private List<Rectangle2d> extraAreas;
private final ItemStack renderedItem = AllBlocks.ADJUSTABLE_CRATE.asStack(); private final ItemStack renderedItem = AllBlocks.ADJUSTABLE_CRATE.asStack();
private final String title = Lang.translate("gui.adjustable_crate.title"); private final ITextComponent title = Lang.translate("gui.adjustable_crate.title");
private final String storageSpace = Lang.translate("gui.adjustable_crate.storageSpace"); private final ITextComponent storageSpace = Lang.translate("gui.adjustable_crate.storageSpace");
public AdjustableCrateScreen(AdjustableCrateContainer container, PlayerInventory inv, ITextComponent title) { public AdjustableCrateScreen(AdjustableCrateContainer container, PlayerInventory inv, ITextComponent title) {
super(container, inv, title); super(container, inv, title);
@ -50,7 +50,7 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen<Adjustabl
allowedItemsLabel = new Label(guiLeft + 100 + 70, guiTop + 107, "").colored(0xD3CBBE) allowedItemsLabel = new Label(guiLeft + 100 + 70, guiTop + 107, "").colored(0xD3CBBE)
.withShadow(); .withShadow();
allowedItems = new ScrollInput(guiLeft + 100 + 65, guiTop + 104, 41, 14).titled(storageSpace) allowedItems = new ScrollInput(guiLeft + 100 + 65, guiTop + 104, 41, 14).titled(storageSpace.copy())
.withRange(1, (container.doubleCrate ? 2049 : 1025)) .withRange(1, (container.doubleCrate ? 2049 : 1025))
.writingTo(allowedItemsLabel) .writingTo(allowedItemsLabel)
.withShiftStep(64) .withShiftStep(64)
@ -75,16 +75,16 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen<Adjustabl
if (container.doubleCrate) { if (container.doubleCrate) {
crateLeft -= 72; crateLeft -= 72;
FLEXCRATE_DOUBLE.draw(this, crateLeft, crateTop); FLEXCRATE_DOUBLE.draw(matrixStack, this, crateLeft, crateTop);
} else } else
FLEXCRATE.draw(this, crateLeft, crateTop); FLEXCRATE.draw(matrixStack, this, crateLeft, crateTop);
textRenderer.drawWithShadow(matrixStack, title, crateLeft - 3 + (FLEXCRATE.width - textRenderer.getStringWidth(title)) / 2, textRenderer.drawWithShadow(matrixStack, title, crateLeft - 3 + (FLEXCRATE.width - textRenderer.getWidth(title)) / 2,
crateTop + 10, hFontColor); crateTop + 10, hFontColor);
String itemCount = "" + te.itemCount; String itemCount = "" + te.itemCount;
textRenderer.draw(matrixStack, itemCount, guiLeft + 100 + 53 - textRenderer.getStringWidth(itemCount), crateTop + 107, fontColor); textRenderer.draw(matrixStack, itemCount, guiLeft + 100 + 53 - textRenderer.getStringWidth(itemCount), crateTop + 107, fontColor);
PLAYER_INVENTORY.draw(this, invLeft, invTop); PLAYER_INVENTORY.draw(matrixStack, this, invLeft, invTop);
textRenderer.draw(matrixStack, playerInventory.getDisplayName(), invLeft + 7, invTop + 6, 0x666666); textRenderer.draw(matrixStack, playerInventory.getDisplayName(), invLeft + 7, invTop + 6, 0x666666);
for (int slot = 0; slot < (container.doubleCrate ? 32 : 16); slot++) { for (int slot = 0; slot < (container.doubleCrate ? 32 : 16); slot++) {
@ -93,7 +93,7 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen<Adjustabl
int slotsPerRow = (container.doubleCrate ? 8 : 4); int slotsPerRow = (container.doubleCrate ? 8 : 4);
int x = crateLeft + 23 + (slot % slotsPerRow) * 18; int x = crateLeft + 23 + (slot % slotsPerRow) * 18;
int y = crateTop + 24 + (slot / slotsPerRow) * 18; int y = crateTop + 24 + (slot / slotsPerRow) * 18;
AllGuiTextures.FLEXCRATE_LOCKED_SLOT.draw(this, x, y); AllGuiTextures.FLEXCRATE_LOCKED_SLOT.draw(matrixStack, this, x, y);
} }
GuiGameElement.of(renderedItem) GuiGameElement.of(renderedItem)

View file

@ -57,7 +57,7 @@ public class StockpileSwitchScreen extends AbstractSimiScreen {
offBelow = new ScrollInput(guiLeft + 113, guiTop + 69, 33, 14).withRange(0, 96) offBelow = new ScrollInput(guiLeft + 113, guiTop + 69, 33, 14).withRange(0, 96)
.titled(lowerLimit) .titled(lowerLimit)
.calling(state -> { .calling(state -> {
offBelowLabel.text = state + "%"; offBelowLabel.text = ITextComponent.of(state + "%");
lastModification = 0; lastModification = 0;
if (onAbove.getState() - 4 <= state) { if (onAbove.getState() - 4 <= state) {
onAbove.setState(state + 5); 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) onAbove = new ScrollInput(guiLeft + 113, guiTop + 52, 33, 14).withRange(5, 101)
.titled(upperLimit) .titled(upperLimit)
.calling(state -> { .calling(state -> {
onAboveLabel.text = state + "%"; onAboveLabel.text = ITextComponent.of(state + "%");
lastModification = 0; lastModification = 0;
if (offBelow.getState() + 4 >= state) { if (offBelow.getState() + 4 >= state) {
offBelow.setState(state - 5); offBelow.setState(state - 5);
@ -89,7 +89,7 @@ public class StockpileSwitchScreen extends AbstractSimiScreen {
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
int hFontColor = 0xD3CBBE; int hFontColor = 0xD3CBBE;
int fontColor = 0x4B3A22; 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, textRenderer.drawWithShadow(matrixStack, title, guiLeft - 3 + (STOCKSWITCH.width - textRenderer.getWidth(title)) / 2,
guiTop + 10, hFontColor); guiTop + 10, hFontColor);
textRenderer.draw(matrixStack, onAbove.getState() == 100 ? startAt : startAbove, guiLeft + 13, guiTop + 55, fontColor); 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, drawTexture(matrixStack, (int) (guiLeft + upperBound), guiTop + 26, (int) (sprite.startX + upperBound), sprite.startY,
(int) (sprite.width - upperBound), sprite.height); (int) (sprite.width - upperBound), sprite.height);
AllGuiTextures.STOCKSWITCH_BOUND_LEFT.draw(this, (int) (guiLeft + lowerBound) - 1, guiTop + 24); AllGuiTextures.STOCKSWITCH_BOUND_LEFT.draw(matrixStack, this, (int) (guiLeft + lowerBound) - 1, guiTop + 24);
AllGuiTextures.STOCKSWITCH_BOUND_RIGHT.draw(this, (int) (guiLeft + upperBound) - 5, guiTop + 24); AllGuiTextures.STOCKSWITCH_BOUND_RIGHT.draw(matrixStack, this, (int) (guiLeft + upperBound) - 5, guiTop + 24);
AllGuiTextures cursor = AllGuiTextures cursor =
te.powered ? AllGuiTextures.STOCKSWITCH_CURSOR_ON : AllGuiTextures.STOCKSWITCH_CURSOR_OFF; te.powered ? AllGuiTextures.STOCKSWITCH_CURSOR_ON : AllGuiTextures.STOCKSWITCH_CURSOR_OFF;
RenderSystem.pushMatrix(); RenderSystem.pushMatrix();
RenderSystem.translatef((cursorPos * (sprite.width - 20) + 10), 0, 0); 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.popMatrix();
RenderSystem.pushMatrix(); RenderSystem.pushMatrix();

View file

@ -54,11 +54,11 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) { protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
int x = guiLeft; int x = guiLeft;
int y = guiTop; int y = guiTop;
background.draw(this, x, y); background.draw(ms, this, x, y);
int invX = x + 50; int invX = x + 50;
int invY = y + background.height + 10; 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, playerInventory.getDisplayName(), invX + 7, invY + 6, 0x666666);
textRenderer.draw(ms, I18n.format(container.filterItem.getTranslationKey()), x + 15, y + 9, 0x5B5037); textRenderer.draw(ms, I18n.format(container.filterItem.getTranslationKey()), x + 15, y + 9, 0x5B5037);

View file

@ -68,9 +68,9 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
blacklist = new IconButton(x + 120, y + 58, AllIcons.I_WHITELIST_NOT); blacklist = new IconButton(x + 120, y + 58, AllIcons.I_WHITELIST_NOT);
blacklist.setToolTip(blacklistN); blacklist.setToolTip(blacklistN);
whitelistDisIndicator = new Indicator(x + 84, y + 53, ""); whitelistDisIndicator = new Indicator(x + 84, y + 53, StringTextComponent.EMPTY);
whitelistConIndicator = new Indicator(x + 102, y + 53, ""); whitelistConIndicator = new Indicator(x + 102, y + 53, StringTextComponent.EMPTY);
blacklistIndicator = new Indicator(x + 120, y + 53, ""); blacklistIndicator = new Indicator(x + 120, y + 53, StringTextComponent.EMPTY);
widgets.addAll(Arrays.asList(blacklist, whitelistCon, whitelistDis, blacklistIndicator, whitelistConIndicator, widgets.addAll(Arrays.asList(blacklist, whitelistCon, whitelistDis, blacklistIndicator, whitelistConIndicator,
whitelistDisIndicator)); whitelistDisIndicator));

View file

@ -13,6 +13,7 @@ import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.IFormattableTextComponent; import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
public class FilterScreen extends AbstractFilterScreen<FilterContainer> { public class FilterScreen extends AbstractFilterScreen<FilterContainer> {
@ -47,16 +48,16 @@ public class FilterScreen extends AbstractFilterScreen<FilterContainer> {
blacklist.setToolTip(blacklistN); blacklist.setToolTip(blacklistN);
whitelist = new IconButton(x + 76, y + 72, AllIcons.I_WHITELIST); whitelist = new IconButton(x + 76, y + 72, AllIcons.I_WHITELIST);
whitelist.setToolTip(whitelistN); whitelist.setToolTip(whitelistN);
blacklistIndicator = new Indicator(x + 58, y + 67, ""); blacklistIndicator = new Indicator(x + 58, y + 67, StringTextComponent.EMPTY);
whitelistIndicator = new Indicator(x + 76, y + 67, ""); whitelistIndicator = new Indicator(x + 76, y + 67, StringTextComponent.EMPTY);
widgets.addAll(Arrays.asList(blacklist, whitelist, blacklistIndicator, whitelistIndicator)); widgets.addAll(Arrays.asList(blacklist, whitelist, blacklistIndicator, whitelistIndicator));
respectNBT = new IconButton(x + 98, y + 72, AllIcons.I_RESPECT_NBT); respectNBT = new IconButton(x + 98, y + 72, AllIcons.I_RESPECT_NBT);
respectNBT.setToolTip(respectDataN); respectNBT.setToolTip(respectDataN);
ignoreNBT = new IconButton(x + 116, y + 72, AllIcons.I_IGNORE_NBT); ignoreNBT = new IconButton(x + 116, y + 72, AllIcons.I_IGNORE_NBT);
ignoreNBT.setToolTip(ignoreDataN); ignoreNBT.setToolTip(ignoreDataN);
respectNBTIndicator = new Indicator(x + 98, y + 67, ""); respectNBTIndicator = new Indicator(x + 98, y + 67, StringTextComponent.EMPTY);
ignoreNBTIndicator = new Indicator(x + 116, y + 67, ""); ignoreNBTIndicator = new Indicator(x + 116, y + 67, StringTextComponent.EMPTY);
widgets.addAll(Arrays.asList(respectNBT, ignoreNBT, respectNBTIndicator, ignoreNBTIndicator)); widgets.addAll(Arrays.asList(respectNBT, ignoreNBT, respectNBTIndicator, ignoreNBTIndicator));
handleIndicators(); handleIndicators();
} }

View file

@ -17,6 +17,7 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
import net.minecraft.nbt.StringNBT; import net.minecraft.nbt.StringNBT;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.util.text.TranslationTextComponent;
@ -91,9 +92,9 @@ public class MaterialChecklist {
Collections.sort(keys, (item1, item2) -> { Collections.sort(keys, (item1, item2) -> {
Locale locale = Locale.ENGLISH; Locale locale = Locale.ENGLISH;
String name1 = String name1 =
new TranslationTextComponent(item1.getTranslationKey()).getFormattedText().toLowerCase(locale); new TranslationTextComponent(item1.getTranslationKey()).getUnformattedComponentText().toLowerCase(locale);
String name2 = String name2 =
new TranslationTextComponent(item2.getTranslationKey()).getFormattedText().toLowerCase(locale); new TranslationTextComponent(item2.getTranslationKey()).getUnformattedComponentText().toLowerCase(locale);
return name1.compareTo(name2); return name1.compareTo(name2);
}); });
@ -149,20 +150,23 @@ public class MaterialChecklist {
return amount; return amount;
} }
private String gatheredEntry(ItemStack item, int amount) { private ITextComponent gatheredEntry(ItemStack item, int amount) {
int stacks = amount / 64; int stacks = amount / 64;
int remainder = amount % 64; int remainder = amount % 64;
ITextComponent tc = new TranslationTextComponent(item.getTranslationKey()); TranslationTextComponent tc = new TranslationTextComponent(item.getTranslationKey());
return TextFormatting.DARK_GREEN + tc.getFormattedText() + " \\u2714\n x" + amount + TextFormatting.GRAY + " | " return tc.append(" \\u2714\n x" + amount).formatted(TextFormatting.DARK_GREEN).append(new StringTextComponent(" | "
+ stacks + "\\u25A4 +" + remainder + "\n"; + 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 stacks = amount / 64;
int remainder = amount % 64; int remainder = amount % 64;
ITextComponent tc = new TranslationTextComponent(item.getTranslationKey()); TranslationTextComponent tc = new TranslationTextComponent(item.getTranslationKey());
return TextFormatting.BLUE + tc.getFormattedText() + "\n x" + amount + TextFormatting.GRAY + " | " + stacks return tc.append("\n x" + amount).formatted(TextFormatting.BLUE).append(new StringTextComponent(" | " + stacks + "\\u25A4 +" + remainder + "\n").formatted(TextFormatting.GRAY));
+ "\\u25A4 +" + remainder + "\n"; // return TextFormatting.BLUE + tc.getFormattedText() + "\n x" + amount + TextFormatting.GRAY + " | " + stacks
// + "\\u25A4 +" + remainder + "\n";
} }
} }

View file

@ -7,9 +7,10 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Stream;
import com.simibubi.create.foundation.utility.BlockHelper; 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.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -28,8 +29,10 @@ import net.minecraft.util.math.MutableBoundingBox;
import net.minecraft.world.*; import net.minecraft.world.*;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes; 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<BlockPos, BlockState> blocks; private Map<BlockPos, BlockState> blocks;
private Map<BlockPos, TileEntity> tileEntities; private Map<BlockPos, TileEntity> tileEntities;
@ -38,11 +41,11 @@ public class SchematicWorld extends WrappedWorld implements IServerWorld {
public BlockPos anchor; public BlockPos anchor;
public boolean renderMode; public boolean renderMode;
public SchematicWorld(World original) { public SchematicWorld(ServerWorld original) {
this(BlockPos.ZERO, original); this(BlockPos.ZERO, original);
} }
public SchematicWorld(BlockPos anchor, World original) { public SchematicWorld(BlockPos anchor, ServerWorld original) {
super(original); super(original);
this.blocks = new HashMap<>(); this.blocks = new HashMap<>();
this.tileEntities = new HashMap<>(); this.tileEntities = new HashMap<>();
@ -69,8 +72,8 @@ public class SchematicWorld extends WrappedWorld implements IServerWorld {
return entities.add(entityIn); return entities.add(entityIn);
} }
public List<Entity> getEntities() { public Stream<Entity> getEntities() {
return entities; return entities.stream();
} }
@Override @Override
@ -171,12 +174,12 @@ public class SchematicWorld extends WrappedWorld implements IServerWorld {
} }
@Override @Override
public ITickList<Block> getPendingBlockTicks() { public ServerTickList<Block> getPendingBlockTicks() {
return EmptyTickList.get(); return EmptyTickList.get();
} }
@Override @Override
public ITickList<Fluid> getPendingFluidTicks() { public ServerTickList<Fluid> getPendingFluidTicks() {
return EmptyTickList.get(); return EmptyTickList.get();
} }

View file

@ -84,9 +84,9 @@ public class ServerSchematicLoader {
public void handleNewUpload(ServerPlayerEntity player, String schematic, long size, BlockPos pos) { public void handleNewUpload(ServerPlayerEntity player, String schematic, long size, BlockPos pos) {
String playerPath = getSchematicPath() + "/" + player.getName() String playerPath = getSchematicPath() + "/" + player.getName()
.getFormattedText(); .getUnformattedComponentText();
String playerSchematicId = player.getName() String playerSchematicId = player.getName()
.getFormattedText() + "/" + schematic; .getUnformattedComponentText() + "/" + schematic;
FilesHelper.createFolderIfMissing(playerPath); FilesHelper.createFolderIfMissing(playerPath);
// Unsupported Format // Unsupported Format
@ -98,9 +98,9 @@ public class ServerSchematicLoader {
Integer maxFileSize = getConfig().maxTotalSchematicSize.get(); Integer maxFileSize = getConfig().maxTotalSchematicSize.get();
if (size > maxFileSize * 1000) { if (size > maxFileSize * 1000) {
player.sendMessage(new TranslationTextComponent("create.schematics.uploadTooLarge") 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") player.sendMessage(new TranslationTextComponent("create.schematics.maxAllowedSize")
.appendSibling(new StringTextComponent(" " + maxFileSize + " KB"))); .append(new StringTextComponent(" " + maxFileSize + " KB")), player.getUniqueID());
return; return;
} }
@ -152,7 +152,7 @@ public class ServerSchematicLoader {
public void handleWriteRequest(ServerPlayerEntity player, String schematic, byte[] data) { public void handleWriteRequest(ServerPlayerEntity player, String schematic, byte[] data) {
String playerSchematicId = player.getName() String playerSchematicId = player.getName()
.getFormattedText() + "/" + schematic; .getUnformattedComponentText() + "/" + schematic;
if (activeUploads.containsKey(playerSchematicId)) { if (activeUploads.containsKey(playerSchematicId)) {
SchematicUploadEntry entry = activeUploads.get(playerSchematicId); SchematicUploadEntry entry = activeUploads.get(playerSchematicId);
@ -223,7 +223,7 @@ public class ServerSchematicLoader {
public void handleFinishedUpload(ServerPlayerEntity player, String schematic) { public void handleFinishedUpload(ServerPlayerEntity player, String schematic) {
String playerSchematicId = player.getName() String playerSchematicId = player.getName()
.getFormattedText() + "/" + schematic; .getUnformattedComponentText() + "/" + schematic;
if (activeUploads.containsKey(playerSchematicId)) { if (activeUploads.containsKey(playerSchematicId)) {
try { try {
@ -245,7 +245,7 @@ public class ServerSchematicLoader {
return; return;
table.finishUpload(); table.finishUpload();
table.inventory.setStackInSlot(1, SchematicItem.create(schematic, player.getName() table.inventory.setStackInSlot(1, SchematicItem.create(schematic, player.getName()
.getFormattedText())); .getUnformattedComponentText()));
} catch (IOException e) { } catch (IOException e) {
Create.logger.error("Exception Thrown when finishing Upload: " + playerSchematicId); Create.logger.error("Exception Thrown when finishing Upload: " + playerSchematicId);

View file

@ -129,7 +129,7 @@ public abstract class LaunchedItem {
else if (state.getBlock() != Blocks.SEA_PICKLE && state.getBlock() instanceof IPlantable) else if (state.getBlock() != Blocks.SEA_PICKLE && state.getBlock() instanceof IPlantable)
state = ((IPlantable) state.getBlock()).getPlant(world, target); 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 i = target.getX();
int j = target.getY(); int j = target.getY();
int k = target.getZ(); int k = target.getZ();

View file

@ -94,10 +94,10 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
int mainLeft = guiLeft - 56; int mainLeft = guiLeft - 56;
int mainTop = guiTop - 16; int mainTop = guiTop - 16;
AllGuiTextures.PLAYER_INVENTORY.draw(this, x - 16, y + 70 + 14); AllGuiTextures.PLAYER_INVENTORY.draw(matrixStack, this, x - 16, y + 70 + 14);
textRenderer.draw(matrixStack, playerInventory.getDisplayName(), x - 15 + 7, y + 64 + 26, 0x666666); textRenderer.draw(matrixStack, playerInventory.getDisplayName(), x - 15 + 7, y + 64 + 26, 0x666666);
SCHEMATIC_TABLE.draw(this, mainLeft, mainTop); SCHEMATIC_TABLE.draw(matrixStack, this, mainLeft, mainTop);
if (container.getTileEntity().isUploading) if (container.getTileEntity().isUploading)
textRenderer.draw(matrixStack, uploading, mainLeft + 76, mainTop + 10, AllGuiTextures.FONT_COLOR); textRenderer.draw(matrixStack, uploading, mainLeft + 76, mainTop + 10, AllGuiTextures.FONT_COLOR);

View file

@ -22,6 +22,7 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.text.IFormattableTextComponent; import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import java.util.ArrayList; import java.util.ArrayList;
@ -79,11 +80,11 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
// Play Pause Stop // Play Pause Stop
playButton = new IconButton(x + 70, y + 55, AllIcons.I_PLAY); playButton = new IconButton(x + 70, y + 55, AllIcons.I_PLAY);
playIndicator = new Indicator(x + 70, y + 50, ""); playIndicator = new Indicator(x + 70, y + 50, StringTextComponent.EMPTY);
pauseButton = new IconButton(x + 88, y + 55, AllIcons.I_PAUSE); pauseButton = new IconButton(x + 88, y + 55, AllIcons.I_PAUSE);
pauseIndicator = new Indicator(x + 88, y + 50, ""); pauseIndicator = new Indicator(x + 88, y + 50, StringTextComponent.EMPTY);
resetButton = new IconButton(x + 106, y + 55, AllIcons.I_STOP); resetButton = new IconButton(x + 106, y + 55, AllIcons.I_STOP);
resetIndicator = new Indicator(x + 106, y + 50, ""); resetIndicator = new Indicator(x + 106, y + 50, StringTextComponent.EMPTY);
resetIndicator.state = State.RED; resetIndicator.state = State.RED;
Collections Collections
.addAll(widgets, playButton, playIndicator, pauseButton, pauseIndicator, resetButton, resetIndicator); .addAll(widgets, playButton, playIndicator, pauseButton, pauseIndicator, resetButton, resetIndicator);
@ -101,7 +102,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
Lang.translate("gui.schematicannon.option.replaceWithEmpty")); Lang.translate("gui.schematicannon.option.replaceWithEmpty"));
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
replaceLevelIndicators.add(new Indicator(x + 16 + i * 18, y + 96, "")); replaceLevelIndicators.add(new Indicator(x + 16 + i * 18, y + 96, StringTextComponent.EMPTY));
replaceLevelButtons.add(new IconButton(x + 16 + i * 18, y + 101, icons.get(i))); replaceLevelButtons.add(new IconButton(x + 16 + i * 18, y + 101, icons.get(i)));
replaceLevelButtons.get(i).setToolTip(toolTips.get(i)); replaceLevelButtons.get(i).setToolTip(toolTips.get(i));
} }
@ -111,12 +112,12 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
// Other Settings // Other Settings
skipMissingButton = new IconButton(x + 106, y + 101, AllIcons.I_SKIP_MISSING); skipMissingButton = new IconButton(x + 106, y + 101, AllIcons.I_SKIP_MISSING);
skipMissingButton.setToolTip(Lang.translate("gui.schematicannon.option.skipMissing")); skipMissingButton.setToolTip(Lang.translate("gui.schematicannon.option.skipMissing"));
skipMissingIndicator = new Indicator(x + 106, y + 96, ""); skipMissingIndicator = new Indicator(x + 106, y + 96, StringTextComponent.EMPTY);
Collections.addAll(widgets, skipMissingButton, skipMissingIndicator); Collections.addAll(widgets, skipMissingButton, skipMissingIndicator);
skipTilesButton = new IconButton(x + 124, y + 101, AllIcons.I_SKIP_TILES); skipTilesButton = new IconButton(x + 124, y + 101, AllIcons.I_SKIP_TILES);
skipTilesButton.setToolTip(Lang.translate("gui.schematicannon.option.skipTileEntities")); skipTilesButton.setToolTip(Lang.translate("gui.schematicannon.option.skipTileEntities"));
skipTilesIndicator = new Indicator(x + 124, y + 96, ""); skipTilesIndicator = new Indicator(x + 124, y + 96, StringTextComponent.EMPTY);
Collections.addAll(widgets, skipTilesButton, skipTilesIndicator); Collections.addAll(widgets, skipTilesButton, skipTilesIndicator);
extraAreas = new ArrayList<>(); extraAreas = new ArrayList<>();
@ -194,16 +195,13 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
boolean enabled = indicator.state == State.ON; boolean enabled = indicator.state == State.ON;
List<ITextComponent> tip = button.getToolTip(); List<ITextComponent> tip = button.getToolTip();
tip.add((enabled ? optionEnabled : optionDisabled).copy().formatted(TextFormatting.BLUE)); tip.add((enabled ? optionEnabled : optionDisabled).copy().formatted(TextFormatting.BLUE));
tip TooltipHelper.cutString(Lang.translate("gui.schematicannon.option." + tooltipKey + ".description"), GRAY, GRAY).forEach(s -> tip.add(new StringTextComponent(s).formatted(GRAY)));
.addAll(TooltipHelper
.cutString(Lang.translate("gui.schematicannon.option." + tooltipKey + ".description"), GRAY,
GRAY));
} }
@Override @Override
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
AllGuiTextures.PLAYER_INVENTORY.draw(this, guiLeft - 10, guiTop + 145); AllGuiTextures.PLAYER_INVENTORY.draw(matrixStack, this, guiLeft - 10, guiTop + 145);
AllGuiTextures.SCHEMATICANNON_BG.draw(this, guiLeft + 20, guiTop); AllGuiTextures.SCHEMATICANNON_BG.draw(matrixStack, this, guiLeft + 20, guiTop);
SchematicannonTileEntity te = container.getTileEntity(); SchematicannonTileEntity te = container.getTileEntity();
renderPrintingProgress(matrixStack, te.schematicProgress); renderPrintingProgress(matrixStack, te.schematicProgress);
@ -211,7 +209,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
renderChecklistPrinterProgress(matrixStack, te.bookPrintingProgress); renderChecklistPrinterProgress(matrixStack, te.bookPrintingProgress);
if (!te.inventory.getStackInSlot(0).isEmpty()) if (!te.inventory.getStackInSlot(0).isEmpty())
renderBlueprintHighlight(); renderBlueprintHighlight(matrixStack);
GuiGameElement.of(renderedItem) GuiGameElement.of(renderedItem)
.at(guiLeft + 240, guiTop + 120) .at(guiLeft + 240, guiTop + 120)
@ -242,8 +240,8 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
// 0xd3d3d3d3); // 0xd3d3d3d3);
} }
protected void renderBlueprintHighlight() { protected void renderBlueprintHighlight(MatrixStack matrixStack) {
AllGuiTextures.SCHEMATICANNON_HIGHLIGHT.draw(this, guiLeft + 20 + 8, guiTop + 31); AllGuiTextures.SCHEMATICANNON_HIGHLIGHT.draw(matrixStack, this, guiLeft + 20 + 8, guiTop + 31);
} }
protected void renderPrintingProgress(MatrixStack matrixStack, float progress) { protected void renderPrintingProgress(MatrixStack matrixStack, float progress) {
@ -264,7 +262,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
protected void renderFuelBar(MatrixStack matrixStack, float amount) { protected void renderFuelBar(MatrixStack matrixStack, float amount) {
AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_FUEL; AllGuiTextures sprite = AllGuiTextures.SCHEMATICANNON_FUEL;
if (container.getTileEntity().hasCreativeCrate) { if (container.getTileEntity().hasCreativeCrate) {
AllGuiTextures.SCHEMATICANNON_FUEL_CREATIVE.draw(this, guiLeft + 20 + 73, guiTop + 135); AllGuiTextures.SCHEMATICANNON_FUEL_CREATIVE.draw(matrixStack, this, guiLeft + 20 + 73, guiTop + 135);
return; return;
} }
client.getTextureManager().bindTexture(sprite.location); client.getTextureManager().bindTexture(sprite.location);
@ -285,17 +283,16 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
int shotsLeftWithItems = (int) (shotsLeft int shotsLeftWithItems = (int) (shotsLeft
+ te.inventory.getStackInSlot(4).getCount() * (te.getFuelAddedByGunPowder() / fuelUsageRate)); + te.inventory.getStackInSlot(4).getCount() * (te.getFuelAddedByGunPowder() / fuelUsageRate));
List<String> tooltip = new ArrayList<>(); List<ITextComponent> tooltip = new ArrayList<>();
float f = te.hasCreativeCrate ? 100 : te.fuelLevel * 100; float f = te.hasCreativeCrate ? 100 : te.fuelLevel * 100;
tooltip.add(Lang.translate(_gunpowderLevel, "" + (int) f)); tooltip.add(Lang.translate(_gunpowderLevel, "" + (int) f));
if (!te.hasCreativeCrate) 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) if (shotsLeftWithItems != shotsLeft)
tooltip tooltip
.add(GRAY + Lang .add(Lang.translate(_shotsRemainingWithBackup, "" + TextFormatting.BLUE + shotsLeftWithItems).formatted(GRAY));
.translate(_shotsRemainingWithBackup, "" + TextFormatting.BLUE + shotsLeftWithItems));
renderTooltip(tooltip, mouseX, mouseY); renderTooltip(matrixStack, tooltip, mouseX, mouseY);
} }
if (te.missingItem != null) { if (te.missingItem != null) {

View file

@ -539,7 +539,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
schematicAnchor = anchor; schematicAnchor = anchor;
blockReader = new SchematicWorld(schematicAnchor, world); blockReader = new SchematicWorld(schematicAnchor, world);
PlacementSettings settings = SchematicItem.getSettings(blueprint); PlacementSettings settings = SchematicItem.getSettings(blueprint);
activeTemplate.place(blockReader, schematicAnchor, settings); activeTemplate.place(blockReader, schematicAnchor, settings, blockReader.getRandom());
schematicLoaded = true; schematicLoaded = true;
state = State.PAUSED; state = State.PAUSED;
statusMsg = "ready"; statusMsg = "ready";

View file

@ -133,7 +133,7 @@ public class SchematicEditScreen extends AbstractSimiScreen {
protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { protected void renderWindow(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
int x = guiLeft; int x = guiLeft;
int y = guiTop; int y = guiTop;
AllGuiTextures.SCHEMATIC.draw(this, x, y); AllGuiTextures.SCHEMATIC.draw(matrixStack, this, x, y);
textRenderer.drawWithShadow(matrixStack, handler.getCurrentSchematicName(), textRenderer.drawWithShadow(matrixStack, handler.getCurrentSchematicName(),
x + 103 - textRenderer.getStringWidth(handler.getCurrentSchematicName()) / 2, y + 10, 0xDDEEFF); 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, rotationLabel, x + 10, y + 52, AllGuiTextures.FONT_COLOR);
textRenderer.draw(matrixStack, mirrorLabel, x + 10, y + 72, AllGuiTextures.FONT_COLOR); textRenderer.draw(matrixStack, mirrorLabel, x + 10, y + 72, AllGuiTextures.FONT_COLOR);
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.translated(guiLeft + 220, guiTop + 20, 0); matrixStack.translate(guiLeft + 220, guiTop + 20, 0);
RenderSystem.scaled(3, 3, 3); matrixStack.scale(3, 3, 3);
itemRenderer.renderItemIntoGUI(new ItemStack(AllItems.SCHEMATIC.get()), 0, 0); itemRenderer.renderItemIntoGUI(new ItemStack(AllItems.SCHEMATIC.get()), 0, 0);
RenderSystem.popMatrix(); matrixStack.pop();
} }
@Override @Override

View file

@ -1,5 +1,6 @@
package com.simibubi.create.content.schematics.client; package com.simibubi.create.content.schematics.client;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.foundation.gui.AllGuiTextures; import com.simibubi.create.foundation.gui.AllGuiTextures;
@ -9,12 +10,12 @@ import net.minecraft.client.gui.AbstractGui;
public class SchematicHotbarSlotOverlay extends AbstractGui { public class SchematicHotbarSlotOverlay extends AbstractGui {
public void renderOn(int slot) { public void renderOn(MatrixStack matrixStack, int slot) {
MainWindow mainWindow = Minecraft.getInstance().getWindow(); MainWindow mainWindow = Minecraft.getInstance().getWindow();
int x = mainWindow.getScaledWidth() / 2 - 92; int x = mainWindow.getScaledWidth() / 2 - 92;
int y = mainWindow.getScaledHeight() - 23; int y = mainWindow.getScaledHeight() - 23;
RenderSystem.enableAlphaTest(); RenderSystem.enableAlphaTest();
AllGuiTextures.BLUEPRINT_SLOT.draw(this, x + 20 * slot, y); AllGuiTextures.BLUEPRINT_SLOT.draw(matrixStack, this, x + 20 * slot, y);
RenderSystem.disableAlphaTest(); RenderSystem.disableAlphaTest();
} }

View file

@ -12,6 +12,8 @@ import com.simibubi.create.foundation.utility.recipe.RecipeFinder;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.resources.IReloadableResourceManager;
import net.minecraft.resources.IResourceManager;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.event.TickEvent.Phase; import net.minecraftforge.event.TickEvent.Phase;
@ -73,9 +75,9 @@ public class CommonEvents {
@SubscribeEvent @SubscribeEvent
public static void serverAboutToStart(FMLServerAboutToStartEvent event) { public static void serverAboutToStart(FMLServerAboutToStartEvent event) {
event.getServer() IResourceManager manager = event.getServer().getDataPackRegistries().getResourceManager();
.getResourceManager() if (manager instanceof IReloadableResourceManager)
.addReloadListener(RecipeFinder.LISTENER); ((IReloadableResourceManager) manager).addReloadListener(RecipeFinder.LISTENER);
} }
@SubscribeEvent @SubscribeEvent

View file

@ -35,7 +35,7 @@ public class KineticBlockTrigger extends CriterionTriggerBase<KineticBlockTrigge
Block block = null; Block block = null;
if (json.has("block")) { if (json.has("block")) {
ResourceLocation resourcelocation = new ResourceLocation(JSONUtils.getString(json, "block")); ResourceLocation resourcelocation = new ResourceLocation(JSONUtils.getString(json, "block"));
block = Registry.BLOCK.getValue(resourcelocation).orElseThrow(() -> { block = Registry.BLOCK.getOrEmpty(resourcelocation).orElseThrow(() -> {
return new JsonSyntaxException("Unknown block type '" + resourcelocation + "'"); return new JsonSyntaxException("Unknown block type '" + resourcelocation + "'");
}); });
} }

View file

@ -61,8 +61,6 @@ public interface ITE<T extends TileEntity> {
if (world == null) if (world == null)
return notAvailable; return notAvailable;
DimensionType type = world.getDimension(); DimensionType type = world.getDimension();
if (type == null)
return notAvailable;
ResourceLocation registryName = type.getRegistryName(); ResourceLocation registryName = type.getRegistryName();
if (registryName == null) if (registryName == null)
return notAvailable; return notAvailable;

View file

@ -17,7 +17,7 @@ public class CustomRenderedItemModelRenderer<M extends CustomRenderedItemModel>
M mainModel = ((M) Minecraft.getInstance() M mainModel = ((M) Minecraft.getInstance()
.getItemRenderer() .getItemRenderer()
.getItemModelWithOverrides(stack, null, null)); .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.push();
ms.translate(0.5F, 0.5F, 0.5F); ms.translate(0.5F, 0.5F, 0.5F);

View file

@ -3,6 +3,7 @@ package com.simibubi.create.foundation.gui;
import java.util.List; import java.util.List;
import java.util.function.Consumer; import java.util.function.Consumer;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllKeys; import com.simibubi.create.AllKeys;
import com.simibubi.create.content.schematics.client.tools.Tools; 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.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
public class ToolSelectionScreen extends Screen { 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"; public final String holdToFocus = "gui.toolmenu.focusKey";
protected List<Tools> tools; protected List<Tools> tools;
@ -30,7 +33,7 @@ public class ToolSelectionScreen extends Screen {
public ToolSelectionScreen(List<Tools> tools, Consumer<Tools> callback) { public ToolSelectionScreen(List<Tools> tools, Consumer<Tools> callback) {
super(new StringTextComponent("Tool Selection")); super(new StringTextComponent("Tool Selection"));
this.minecraft = Minecraft.getInstance(); this.client = Minecraft.getInstance();
this.tools = tools; this.tools = tools;
this.callback = callback; this.callback = callback;
focused = false; focused = false;
@ -54,74 +57,74 @@ public class ToolSelectionScreen extends Screen {
selection = (selection + tools.size()) % tools.size(); selection = (selection + tools.size()) % tools.size();
} }
private void draw(float partialTicks) { private void draw(MatrixStack matrixStack, float partialTicks) {
MainWindow mainWindow = Minecraft.getInstance().getWindow(); MainWindow mainWindow = Minecraft.getInstance().getWindow();
int x = (mainWindow.getScaledWidth() - w) / 2 + 15; int x = (mainWindow.getScaledWidth() - w) / 2 + 15;
int y = mainWindow.getScaledHeight() - h - 75; int y = mainWindow.getScaledHeight() - h - 75;
RenderSystem.pushMatrix(); matrixStack.push();
RenderSystem.translatef(0, -yOffset, focused ? 100 : 0); matrixStack.translate(0, -yOffset, focused ? 100 : 0);
AllGuiTextures gray = AllGuiTextures.GRAY; AllGuiTextures gray = AllGuiTextures.GRAY;
RenderSystem.enableBlend(); RenderSystem.enableBlend();
RenderSystem.color4f(1, 1, 1, focused ? 7 / 8f : 1 / 2f); RenderSystem.color4f(1, 1, 1, focused ? 7 / 8f : 1 / 2f);
Minecraft.getInstance().getTextureManager().bindTexture(gray.location); 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; float toolTipAlpha = yOffset / 10;
FontRenderer font = minecraft.fontRenderer; FontRenderer font = client.fontRenderer;
List<String> toolTip = tools.get(selection).getDescription(); List<TranslationTextComponent> toolTip = tools.get(selection).getDescription();
int stringAlphaComponent = ((int) (toolTipAlpha * 0xFF)) << 24; int stringAlphaComponent = ((int) (toolTipAlpha * 0xFF)) << 24;
if (toolTipAlpha > 0.25f) { if (toolTipAlpha > 0.25f) {
RenderSystem.color4f(.7f, .7f, .8f, toolTipAlpha); 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); RenderSystem.color4f(1, 1, 1, 1);
if (toolTip.size() > 0) 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) 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) 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) 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); RenderSystem.color4f(1, 1, 1, 1);
if (tools.size() > 1) { if (tools.size() > 1) {
String keyName = AllKeys.TOOL_MENU.getBoundKey(); String keyName = AllKeys.TOOL_MENU.getBoundKey();
int width = minecraft.getWindow().getScaledWidth(); int width = client.getWindow().getScaledWidth();
if (!focused) 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); 0xCCDDFF);
else else
drawCenteredString(minecraft.fontRenderer, scrollToCycle, width / 2, y - 10, 0xCCDDFF); drawCenteredString(matrixStack, client.fontRenderer, scrollToCycle, width / 2, y - 10, 0xCCDDFF);
} else { } else {
x += 65; x += 65;
} }
for (int i = 0; i < tools.size(); i++) { for (int i = 0; i < tools.size(); i++) {
RenderSystem.pushMatrix(); matrixStack.push();
float alpha = focused ? 1 : .2f; float alpha = focused ? 1 : .2f;
if (i == selection) { if (i == selection) {
RenderSystem.translatef(0, -10, 0); matrixStack.translate(0, -10, 0);
drawCenteredString(minecraft.fontRenderer, tools.get(i).getDisplayName(), x + i * 50 + 24, y + 28, drawCenteredString(matrixStack, client.fontRenderer, tools.get(i).getDisplayName().getUnformattedComponentText(), x + i * 50 + 24, y + 28,
0xCCDDFF); 0xCCDDFF);
alpha = 1; alpha = 1;
} }
RenderSystem.color4f(0, 0, 0, alpha); 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); 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() { public void update() {
@ -131,8 +134,8 @@ public class ToolSelectionScreen extends Screen {
yOffset *= .9f; yOffset *= .9f;
} }
public void renderPassive(float partialTicks) { public void renderPassive(MatrixStack matrixStack, float partialTicks) {
draw(partialTicks); draw(matrixStack, partialTicks);
} }
@Override @Override

View file

@ -28,7 +28,7 @@ public class IconButton extends AbstractSimiWidget {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
AllGuiTextures.BUTTON.bind(); AllGuiTextures.BUTTON.bind();
drawTexture(matrixStack, x, y, button.startX, button.startY, button.width, button.height); 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);
} }
} }

View file

@ -1,7 +1,9 @@
package com.simibubi.create.foundation.gui.widgets; package com.simibubi.create.foundation.gui.widgets;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.gui.AllGuiTextures; import com.simibubi.create.foundation.gui.AllGuiTextures;
import net.minecraft.util.text.ITextComponent;
public class Indicator extends AbstractSimiWidget { public class Indicator extends AbstractSimiWidget {
@ -12,14 +14,14 @@ public class Indicator extends AbstractSimiWidget {
public State state; 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); super(x, y, AllGuiTextures.INDICATOR.width, AllGuiTextures.INDICATOR.height);
this.toolTip = ImmutableList.of(tooltip); this.toolTip = ImmutableList.of(tooltip);
this.state = State.OFF; this.state = State.OFF;
} }
@Override @Override
public void render(int mouseX, int mouseY, float partialTicks ) { public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks ) {
AllGuiTextures toDraw; AllGuiTextures toDraw;
switch(state) { switch(state) {
case ON: toDraw = AllGuiTextures.INDICATOR_WHITE; break; case ON: toDraw = AllGuiTextures.INDICATOR_WHITE; break;
@ -29,7 +31,7 @@ public class Indicator extends AbstractSimiWidget {
case GREEN: toDraw = AllGuiTextures.INDICATOR_GREEN; break; case GREEN: toDraw = AllGuiTextures.INDICATOR_GREEN; break;
default: toDraw = AllGuiTextures.INDICATOR; break; default: toDraw = AllGuiTextures.INDICATOR; break;
} }
toDraw.draw(this, x, y); toDraw.draw(matrixStack, this, x, y);
} }
} }

View file

@ -83,7 +83,7 @@ public class ItemDescription {
} }
public ItemDescription withSummary(ITextComponent summary) { public ItemDescription withSummary(ITextComponent summary) {
add(linesOnShift, cutString(summary, palette.color, palette.hColor)); addStrings(linesOnShift, cutString(summary, palette.color, palette.hColor));
add(linesOnShift, ""); add(linesOnShift, "");
return this; return this;
} }
@ -105,9 +105,9 @@ public class ItemDescription {
AllItems.GOGGLES.get() == Minecraft.getInstance().player.getItemStackFromSlot(EquipmentSlotType.HEAD) AllItems.GOGGLES.get() == Minecraft.getInstance().player.getItemStackFromSlot(EquipmentSlotType.HEAD)
.getItem(); .getItem();
String rpmUnit = Lang.translate("generic.unit.rpm"); ITextComponent rpmUnit = Lang.translate("generic.unit.rpm");
if (hasSpeedRequirement) { if (hasSpeedRequirement) {
List<String> speedLevels = Lang.translatedOptions("tooltip.speedRequirement", "none", "medium", "high"); List<ITextComponent> speedLevels = Lang.translatedOptions("tooltip.speedRequirement", "none", "medium", "high");
int index = minimumRequiredSpeedLevel.ordinal(); int index = minimumRequiredSpeedLevel.ordinal();
String level = String level =
minimumRequiredSpeedLevel.getTextColor() + makeProgressBar(3, index) + speedLevels.get(index); minimumRequiredSpeedLevel.getTextColor() + makeProgressBar(3, index) + speedLevels.get(index);
@ -115,13 +115,13 @@ public class ItemDescription {
if (hasGlasses) if (hasGlasses)
level += " (" + minimumRequiredSpeedLevel.getSpeedValue() + rpmUnit + "+)"; level += " (" + minimumRequiredSpeedLevel.getSpeedValue() + rpmUnit + "+)";
add(linesOnShift, GRAY + Lang.translate("tooltip.speedRequirement")); add(linesOnShift, Lang.translate("tooltip.speedRequirement").formatted(GRAY));
add(linesOnShift, level); add(linesOnShift, level);
} }
String stressUnit = Lang.translate("generic.unit.stress"); ITextComponent stressUnit = Lang.translate("generic.unit.stress");
if (hasStressImpact && !(!isEngine && ((IRotate) block).hideStressImpact())) { if (hasStressImpact && !(!isEngine && ((IRotate) block).hideStressImpact())) {
List<String> stressLevels = Lang.translatedOptions("tooltip.stressImpact", "low", "medium", "high"); List<ITextComponent> stressLevels = Lang.translatedOptions("tooltip.stressImpact", "low", "medium", "high");
double impact = impacts.get(id) double impact = impacts.get(id)
.get(); .get();
StressImpact impactId = impact >= config.highStressImpact.get() ? StressImpact.HIGH StressImpact impactId = impact >= config.highStressImpact.get() ? StressImpact.HIGH
@ -133,12 +133,12 @@ public class ItemDescription {
level += " (" + impacts.get(id) level += " (" + impacts.get(id)
.get() + stressUnit + ")"; .get() + stressUnit + ")";
add(linesOnShift, GRAY + Lang.translate("tooltip.stressImpact")); add(linesOnShift, Lang.translate("tooltip.stressImpact").formatted(GRAY));
add(linesOnShift, level); add(linesOnShift, level);
} }
if (hasStressCapacity) { if (hasStressCapacity) {
List<String> stressCapacityLevels = List<ITextComponent> stressCapacityLevels =
Lang.translatedOptions("tooltip.capacityProvided", "low", "medium", "high"); Lang.translatedOptions("tooltip.capacityProvided", "low", "medium", "high");
double capacity = capacities.get(id) double capacity = capacities.get(id)
.get(); .get();
@ -179,13 +179,13 @@ public class ItemDescription {
public ItemDescription withBehaviour(String condition, String behaviour) { public ItemDescription withBehaviour(String condition, String behaviour) {
add(linesOnShift, GRAY + condition); add(linesOnShift, GRAY + condition);
add(linesOnShift, cutString(behaviour, palette.color, palette.hColor, 1)); addStrings(linesOnShift, cutString(behaviour, palette.color, palette.hColor, 1));
return this; return this;
} }
public ItemDescription withControl(String condition, String action) { public ItemDescription withControl(String condition, String action) {
add(linesOnCtrl, GRAY + condition); add(linesOnCtrl, GRAY + condition);
add(linesOnCtrl, cutString(action, palette.color, palette.hColor, 1)); addStrings(linesOnCtrl, cutString(action, palette.color, palette.hColor, 1));
return this; return this;
} }
@ -194,12 +194,12 @@ public class ItemDescription {
boolean hasControls = !linesOnCtrl.isEmpty(); boolean hasControls = !linesOnCtrl.isEmpty();
if (hasDescription || hasControls) { if (hasDescription || hasControls) {
String[] holdKey = Lang.translate("tooltip.holdKey", "$") String[] holdKey = Lang.translate("tooltip.holdKey", "$").getUnformattedComponentText()
.split("\\$"); .split("\\$");
String[] holdKeyOrKey = Lang.translate("tooltip.holdKeyOrKey", "$", "$") String[] holdKeyOrKey = Lang.translate("tooltip.holdKeyOrKey", "$", "$").getUnformattedComponentText()
.split("\\$"); .split("\\$");
String keyShift = Lang.translate("tooltip.keyShift"); ITextComponent keyShift = Lang.translate("tooltip.keyShift");
String keyCtrl = Lang.translate("tooltip.keyCtrl"); ITextComponent keyCtrl = Lang.translate("tooltip.keyCtrl");
for (List<ITextComponent> list : Arrays.asList(lines, linesOnShift, linesOnCtrl)) { for (List<ITextComponent> list : Arrays.asList(lines, linesOnShift, linesOnCtrl)) {
boolean shift = list == linesOnShift; boolean shift = list == linesOnShift;
boolean ctrl = list == linesOnCtrl; boolean ctrl = list == linesOnCtrl;
@ -248,7 +248,7 @@ public class ItemDescription {
return palette.hColor + s + palette.color; return palette.hColor + s + palette.color;
} }
public static void add(List<ITextComponent> infoList, List<String> textLines) { public static void addStrings(List<ITextComponent> infoList, List<String> textLines) {
textLines.forEach(s -> add(infoList, s)); textLines.forEach(s -> add(infoList, s));
} }
@ -295,7 +295,7 @@ public class ItemDescription {
return linesOnShift; return linesOnShift;
} }
private IFormattableTextComponent generatorSpeed(Block block, String unitRPM) { private IFormattableTextComponent generatorSpeed(Block block, ITextComponent unitRPM) {
String value = ""; String value = "";
if (block instanceof WaterWheelBlock) { if (block instanceof WaterWheelBlock) {

View file

@ -12,6 +12,7 @@ import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraftforge.client.model.data.EmptyModelData; import net.minecraftforge.client.model.data.EmptyModelData;
@ -24,6 +25,7 @@ public class PartialItemModelRenderer {
ItemStack stack; ItemStack stack;
int overlay; int overlay;
MatrixStack ms; MatrixStack ms;
ItemCameraTransforms.TransformType transformType;
IRenderTypeBuffer buffer; IRenderTypeBuffer buffer;
static PartialItemModelRenderer get() { static PartialItemModelRenderer get() {
@ -32,11 +34,12 @@ public class PartialItemModelRenderer {
return instance; 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(); PartialItemModelRenderer instance = get();
instance.stack = stack; instance.stack = stack;
instance.buffer = buffer; instance.buffer = buffer;
instance.ms = ms; instance.ms = ms;
instance.transformType = transformType;
instance.overlay = overlay; instance.overlay = overlay;
return instance; return instance;
} }
@ -70,7 +73,7 @@ public class PartialItemModelRenderer {
else else
stack.getItem() stack.getItem()
.getItemStackTileEntityRenderer() .getItemStackTileEntityRenderer()
.render(stack, ms, buffer, light, overlay); .render(stack, transformType, ms, buffer, light, overlay);
ms.pop(); ms.pop();
} }
@ -83,12 +86,12 @@ public class PartialItemModelRenderer {
for (Direction direction : Direction.values()) { for (Direction direction : Direction.values()) {
random.setSeed(42L); 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); light, overlay);
} }
random.setSeed(42L); 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); stack, light, overlay);
} }

View file

@ -143,7 +143,7 @@ public class TooltipHelper {
// Summary // Summary
if (I18n.hasKey(summaryKey)) if (I18n.hasKey(summaryKey))
tooltip = tooltip.withSummary(I18n.format(summaryKey)); tooltip = tooltip.withSummary(ITextComponent.of(I18n.format(summaryKey)));
// Requirements // Requirements
if (stack.getItem() instanceof BlockItem) { if (stack.getItem() instanceof BlockItem) {

View file

@ -16,3 +16,4 @@ public net.minecraft.world.chunk.ChunkStatus$IGenerationWorker
public net.minecraft.world.chunk.ChunkStatus$ILoadingWorker 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 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