ForgeCraft Playtesting, Part I

- Fixed various rendering in JEI and UIs
- Fixed oxidized blocks not allowing to be harvested
- Fixed missing titles and tooltips in JEI and other UIs
This commit is contained in:
simibubi 2020-10-13 19:56:12 +02:00
parent 442d89e09e
commit 9b5707cba6
19 changed files with 98 additions and 133 deletions

View File

@ -45,9 +45,8 @@ public enum AllKeys {
return keybind.isKeyDown(); return keybind.isKeyDown();
} }
// TODO this should return ITextComponent
public String getBoundKey() { public String getBoundKey() {
return keybind.getBoundKeyLocalizedText().getUnformattedComponentText().toUpperCase(); return keybind.getBoundKeyLocalizedText().getString().toUpperCase();
} }
public int getBoundCode() { public int getBoundCode() {

View File

@ -46,16 +46,14 @@ public class DoubleItemIcon implements IDrawable {
matrixStack.translate(xOffset, yOffset, 0); matrixStack.translate(xOffset, yOffset, 0);
matrixStack.push(); matrixStack.push();
matrixStack.translate(1, 1, 0); matrixStack.translate(1, 17, 0);
GuiGameElement.GuiItemRenderBuilder.renderItemIntoGUI(matrixStack, primaryStack); GuiGameElement.of(primaryStack).render(matrixStack);
// Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(primaryStack, 0, 0);
matrixStack.pop(); matrixStack.pop();
matrixStack.push(); matrixStack.push();
matrixStack.translate(10, 10, 100); matrixStack.translate(10, 19, 100);
matrixStack.scale(.5f, .5f, .5f); matrixStack.scale(.5f, .5f, .5f);
GuiGameElement.GuiItemRenderBuilder.renderItemIntoGUI(matrixStack, secondaryStack); GuiGameElement.of(secondaryStack).render(matrixStack);
// Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(secondaryStack, 0, 0);
matrixStack.pop(); matrixStack.pop();
matrixStack.pop(); matrixStack.pop();

View File

@ -46,7 +46,7 @@ public abstract class CreateRecipeCategory<T extends IRecipe<?>> implements IRec
@Override @Override
public String getTitle() { public String getTitle() {
return Lang.translate("recipe." + name).getUnformattedComponentText(); return Lang.translate("recipe." + name).getString();
} }
@Override @Override

View File

@ -22,12 +22,12 @@ import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Rarity;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
import net.minecraft.item.crafting.ShapedRecipe; import net.minecraft.item.crafting.ShapedRecipe;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
public class MechanicalCraftingCategory extends CreateRecipeCategory<ShapedRecipe> { public class MechanicalCraftingCategory extends CreateRecipeCategory<ShapedRecipe> {
@ -47,6 +47,8 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ShapedRecip
matrixStack.scale(scale, scale, scale); matrixStack.scale(scale, scale, scale);
if (ingredient != null) { if (ingredient != null) {
RenderSystem.pushMatrix();
RenderSystem.multMatrix(matrixStack.peek().getModel());
RenderSystem.enableDepthTest(); RenderSystem.enableDepthTest();
RenderHelper.enable(); RenderHelper.enable();
Minecraft minecraft = Minecraft.getInstance(); Minecraft minecraft = Minecraft.getInstance();
@ -56,6 +58,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ShapedRecip
itemRenderer.renderItemOverlayIntoGUI(font, ingredient, 0, 0, null); itemRenderer.renderItemOverlayIntoGUI(font, ingredient, 0, 0, null);
RenderSystem.disableBlend(); RenderSystem.disableBlend();
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
RenderSystem.popMatrix();
} }
matrixStack.pop(); matrixStack.pop();
@ -65,29 +68,14 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ShapedRecip
public List<ITextComponent> 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<ITextComponent> list;
try { try {
list = ingredient.getTooltip(player, tooltipFlag); return ingredient.getTooltip(player, tooltipFlag);
} catch (RuntimeException | LinkageError e) { } catch (RuntimeException | LinkageError e) {
return new ArrayList<>(); List<ITextComponent> list = new ArrayList<>();
TranslationTextComponent crash = new TranslationTextComponent("jei.tooltip.error.crash");
list.add(crash.formatted(TextFormatting.RED));
return list;
} }
Rarity rarity;
try {
rarity = ingredient.getRarity();
} catch (RuntimeException | LinkageError e) {
rarity = Rarity.COMMON;
}
for (int k = 0; k < list.size(); ++k) {
if (k == 0) {
list.set(k, list.get(k).copy().formatted(rarity.color));
} else {
list.set(k, list.get(k).copy().formatted(TextFormatting.GRAY));
}
}
return list;
} }
} }

View File

@ -71,10 +71,10 @@ public class PolishingCategory extends CreateRecipeCategory<SandPaperPolishingRe
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(); matrixStack.translate(0, 30, 0);
matrixStack.scale(2, 2, 2); matrixStack.scale(2, 2, 2);
matrixStack.translate(getBackground().getWidth() / 4 - 8, 1, 0); matrixStack.translate(getBackground().getWidth() / 4 - 8, 1, 0);
GuiGameElement.GuiItemRenderBuilder.renderItemIntoGUI(matrixStack, renderedSandpaper); GuiGameElement.of(renderedSandpaper).render(matrixStack);
matrixStack.pop(); matrixStack.pop();
} }

View File

@ -4,6 +4,7 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.gui.AllGuiTextures; import com.simibubi.create.foundation.gui.AllGuiTextures;
import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.gui.GuiGameElement;
import com.simibubi.create.foundation.utility.MatrixStacker;
public class AnimatedCrafter extends AnimatedKinetics { public class AnimatedCrafter extends AnimatedKinetics {
@ -14,19 +15,20 @@ public class AnimatedCrafter extends AnimatedKinetics {
AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13); AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13);
matrixStack.translate(3, 16, 0); matrixStack.translate(3, 16, 0);
// RenderSystem.rotatef(-12.5f, 1, 0, 0); MatrixStacker.of(matrixStack)
// RenderSystem.rotatef(-22.5f, 0, 1, 0); .rotateX(-12.5f)
.rotateY(-22.5f);
int scale = 22; int scale = 22;
GuiGameElement.of(cogwheel()) GuiGameElement.of(cogwheel())
.rotateBlock(90, 0, getCurrentAngle()) .rotateBlock(90, 0, getCurrentAngle())
.scale(scale) .scale(scale)
.render(matrixStack); .render(matrixStack);
GuiGameElement.of(AllBlocks.MECHANICAL_CRAFTER.getDefaultState()) GuiGameElement.of(AllBlocks.MECHANICAL_CRAFTER.getDefaultState())
.rotateBlock(0, 180, 0) .rotateBlock(0, 180, 0)
.scale(scale) .scale(scale)
.render(matrixStack); .render(matrixStack);
matrixStack.pop(); matrixStack.pop();
} }

View File

@ -19,7 +19,7 @@ public class AnimatedSaw extends AnimatedKinetics {
AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13); AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13);
matrixStack.translate(0, 0, 200); matrixStack.translate(0, 0, 200);
matrixStack.translate(-6, 19, 0); matrixStack.translate(29, 17, 0);
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-22.5f)); matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-22.5f));
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(90-225f)); matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(90-225f));
int scale = 25; int scale = 25;

View File

@ -149,11 +149,11 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
label(matrixStack, 127, yOffset - 3, instruction.speedModifier.label); label(matrixStack, 127, yOffset - 3, instruction.speedModifier.label);
} }
textRenderer.drawWithShadow(matrixStack, title, guiLeft - 3 + (background.width - textRenderer.getWidth(title)) / 2, guiTop + 10, textRenderer.drawWithShadow(matrixStack, title, guiLeft - 3 + (background.width - textRenderer.getWidth(title)) / 2, guiTop + 3,
hFontColor); 0xffffff);
GuiGameElement.of(renderedItem) GuiGameElement.of(renderedItem)
.at(guiLeft + background.width + 20, guiTop + 50) .at(guiLeft + background.width + 10, guiTop + 180)
.scale(5) .scale(5)
.render(matrixStack); .render(matrixStack);
} }

View File

@ -123,7 +123,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
renderBlock(matrixStack); renderBlock(matrixStack);
GuiGameElement.of(wand) GuiGameElement.of(wand)
.at(guiLeft + 170, guiTop + 200) .at(guiLeft + 190, guiTop + 420)
.scale(4) .scale(4)
.rotate(-70, 20, 20) .rotate(-70, 20, 20)
.render(matrixStack); .render(matrixStack);
@ -131,10 +131,9 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
protected void renderBlock(MatrixStack ms) { protected void renderBlock(MatrixStack ms) {
ms.push(); ms.push();
ms.translate(guiLeft + 18, guiTop + 11, 20); ms.translate(guiLeft + 26f, guiTop + 37, 20);
ms.translate(guiLeft + 25.5f, guiTop + 21, 20); ms.scale(16, 16, 16);
ms.multiply(new Vector3f(.3f, 1f, 0f).getDegreesQuaternion(-22.5f)); ms.multiply(new Vector3f(.3f, 1f, 0f).getDegreesQuaternion(-22.5f));
ms.scale(16, -16, 16);
currentElement.applyModelTransform(ms); currentElement.applyModelTransform(ms);
// RenderSystem.multMatrix(ms.peek().getModel()); // RenderSystem.multMatrix(ms.peek().getModel());
GuiGameElement.of(currentElement.getModel()) GuiGameElement.of(currentElement.getModel())

View File

@ -97,7 +97,7 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen<Adjustabl
} }
GuiGameElement.of(renderedItem) GuiGameElement.of(renderedItem)
.at(guiLeft + ADJUSTABLE_CRATE.width + 110, guiTop + 40) .at(guiLeft + ADJUSTABLE_CRATE.width + 110, guiTop + 120)
.scale(5) .scale(5)
.render(matrixStack); .render(matrixStack);
} }

View File

@ -49,38 +49,6 @@ public class StockpileSwitchScreen extends AbstractSimiScreen {
setWindowSize(background.width + 50, background.height); setWindowSize(background.width + 50, background.height);
super.init(); super.init();
widgets.clear(); widgets.clear();
/*
<<<<<<< HEAD
cursorPos = te.currentLevel == -1 ? 0 : te.currentLevel;
offBelowLabel = new Label(guiLeft + 116, guiTop + 72, "").colored(0xD3CBBE)
.withShadow();
offBelow = new ScrollInput(guiLeft + 113, guiTop + 69, 33, 14).withRange(0, 96)
.titled(lowerLimit)
.calling(state -> {
offBelowLabel.text = new StringTextComponent(state + "%");
lastModification = 0;
if (onAbove.getState() - 4 <= state) {
onAbove.setState(state + 5);
onAbove.onChanged();
}
})
.setState((int) (te.offWhenBelow * 100));
onAboveLabel = new Label(guiLeft + 116, guiTop + 55, "").colored(0xD3CBBE)
.withShadow();
onAbove = new ScrollInput(guiLeft + 113, guiTop + 52, 33, 14).withRange(5, 101)
.titled(upperLimit)
.calling(state -> {
onAboveLabel.text = new StringTextComponent(state + "%");
lastModification = 0;
if (offBelow.getState() + 4 >= state) {
offBelow.setState(state - 5);
offBelow.onChanged();
}
})
.setState((int) (te.onWhenAbove * 100));
=======*/
cursor = LerpedFloat.linear() cursor = LerpedFloat.linear()
.startWithValue(te.getLevelForDisplay()); .startWithValue(te.getLevelForDisplay());
@ -158,7 +126,7 @@ public class StockpileSwitchScreen extends AbstractSimiScreen {
matrixStack.push(); matrixStack.push();
GuiGameElement.of(renderedItem) GuiGameElement.of(renderedItem)
.at(guiLeft + STOCKSWITCH.width + 15, guiTop + 20) .at(guiLeft + STOCKSWITCH.width + 15, guiTop + 120)
.scale(5) .scale(5)
.render(matrixStack); .render(matrixStack);
matrixStack.pop(); matrixStack.pop();

View File

@ -43,8 +43,10 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
super.init(); super.init();
widgets.clear(); widgets.clear();
resetButton = new IconButton(guiLeft + background.width - 62, guiTop + background.height - 24, AllIcons.I_TRASH); resetButton =
confirmButton = new IconButton(guiLeft + background.width - 33, guiTop + background.height - 24, AllIcons.I_CONFIRM); new IconButton(guiLeft + background.width - 62, guiTop + background.height - 24, AllIcons.I_TRASH);
confirmButton =
new IconButton(guiLeft + background.width - 33, guiTop + background.height - 24, AllIcons.I_CONFIRM);
widgets.add(resetButton); widgets.add(resetButton);
widgets.add(confirmButton); widgets.add(confirmButton);
@ -63,9 +65,9 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
textRenderer.draw(ms, I18n.format(container.filterItem.getTranslationKey()), x + 15, y + 3, 0xdedede); textRenderer.draw(ms, I18n.format(container.filterItem.getTranslationKey()), x + 15, y + 3, 0xdedede);
GuiGameElement.of(container.filterItem) GuiGameElement.of(container.filterItem)
.at(guiLeft + background.width, guiTop +background.height -60) .at(guiLeft + background.width, guiTop + background.height + 25)
.scale(5) .scale(5)
.render(ms); .render(ms);
} }
@ -75,7 +77,8 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
super.tick(); super.tick();
handleIndicators(); handleIndicators();
if (!container.player.getHeldItemMainhand().equals(container.filterItem, false)) if (!container.player.getHeldItemMainhand()
.equals(container.filterItem, false))
client.player.closeScreen(); client.player.closeScreen();
} }
@ -96,9 +99,12 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
List<IconButton> tooltipButtons = getTooltipButtons(); List<IconButton> tooltipButtons = getTooltipButtons();
for (IconButton button : tooltipButtons) { for (IconButton button : tooltipButtons) {
if (!button.getToolTip().isEmpty()) { if (!button.getToolTip()
button.setToolTip(button.getToolTip().get(0)); .isEmpty()) {
button.getToolTip().add(TooltipHelper.holdShift(Palette.Yellow, hasShiftDown())); button.setToolTip(button.getToolTip()
.get(0));
button.getToolTip()
.add(TooltipHelper.holdShift(Palette.Yellow, hasShiftDown()));
} }
} }
@ -144,8 +150,7 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
return mouseClicked; return mouseClicked;
} }
protected void contentsCleared() { protected void contentsCleared() {}
}
protected void sendOptionUpdate(Option option) { protected void sendOptionUpdate(Option option) {
AllPackets.channel.sendToServer(new FilterScreenPacket(option)); AllPackets.channel.sendToServer(new FilterScreenPacket(option));

View File

@ -116,7 +116,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
textRenderer.drawWithShadow(matrixStack, noSchematics, mainLeft + 54, mainTop + 26, 0xd3d3d3); textRenderer.drawWithShadow(matrixStack, noSchematics, mainLeft + 54, mainTop + 26, 0xd3d3d3);
GuiGameElement.of(renderedItem) GuiGameElement.of(renderedItem)
.at(mainLeft + 217, mainTop + 48) .at(mainLeft + 217, mainTop + 98)
.scale(3) .scale(3)
.render(matrixStack); .render(matrixStack);

View File

@ -261,7 +261,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
renderBlueprintHighlight(matrixStack); renderBlueprintHighlight(matrixStack);
GuiGameElement.of(renderedItem) GuiGameElement.of(renderedItem)
.at(guiLeft + 230, guiTop + 110) .at(guiLeft + 230, guiTop + 190)
.scale(5) .scale(5)
.render(matrixStack); .render(matrixStack);

View File

@ -152,10 +152,10 @@ public class SchematicEditScreen extends AbstractSimiScreen {
x + 93 - textRenderer.getStringWidth(handler.getCurrentSchematicName()) / 2, y + 3, 0xffffff); x + 93 - textRenderer.getStringWidth(handler.getCurrentSchematicName()) / 2, y + 3, 0xffffff);
matrixStack.push(); matrixStack.push();
matrixStack.translate(guiLeft + 200, guiTop + 80, 0); matrixStack.translate(guiLeft + 200, guiTop + 130, 0);
matrixStack.scale(3, 3, 3); matrixStack.scale(3, 3, 3);
GuiGameElement.GuiItemRenderBuilder.renderItemIntoGUI(matrixStack, new ItemStack(AllItems.SCHEMATIC.get())); GuiGameElement.of(AllItems.SCHEMATIC.asStack())
// itemRenderer.renderItemIntoGUI(new ItemStack(AllItems.SCHEMATIC.get()), 0, 0); .render(matrixStack);
matrixStack.pop(); matrixStack.pop();
} }

View File

@ -66,10 +66,9 @@ public class SchematicPromptScreen extends AbstractSimiScreen {
textRenderer.drawWithShadow(ms, title, guiLeft + (sWidth / 2) - (textRenderer.getWidth(title) / 2), guiTop + 3, textRenderer.drawWithShadow(ms, title, guiLeft + (sWidth / 2) - (textRenderer.getWidth(title) / 2), guiTop + 3,
0xffffff); 0xffffff);
ms.push(); ms.push();
ms.translate(guiLeft + 22, guiTop + 23, 0); ms.translate(guiLeft + 22, guiTop + 39, 0);
GuiGameElement.GuiItemRenderBuilder.renderItemIntoGUI(ms, AllItems.SCHEMATIC.asStack()); GuiGameElement.of(AllItems.SCHEMATIC.asStack()).render(ms);
ms.pop(); ms.pop();
// itemRenderer.renderItemIntoGUI(AllItems.SCHEMATIC.asStack(), guiLeft + 22, guiTop + 23);
} }
@Override @Override

View File

@ -187,7 +187,7 @@ public class GuiGameElement {
BlockRendererDispatcher blockRenderer = mc.getBlockRendererDispatcher(); BlockRendererDispatcher blockRenderer = mc.getBlockRendererDispatcher();
IRenderTypeBuffer.Impl buffer = mc.getBufferBuilders() IRenderTypeBuffer.Impl buffer = mc.getBufferBuilders()
.getEntityVertexConsumers(); .getEntityVertexConsumers();
RenderType renderType = blockState.getBlock() == Blocks.AIR ? Atlases.getEntityTranslucentCull() // FIXME .getEntityTranslucent() RenderType renderType = blockState.getBlock() == Blocks.AIR ? Atlases.getEntityTranslucentCull()
: RenderTypeLookup.getEntityBlockLayer(blockState, true); : RenderTypeLookup.getEntityBlockLayer(blockState, true);
IVertexBuilder vb = buffer.getBuffer(renderType); IVertexBuilder vb = buffer.getBuffer(renderType);
@ -292,36 +292,40 @@ public class GuiGameElement {
@Override @Override
public void render(MatrixStack matrixStack) { public void render(MatrixStack matrixStack) {
prepareMatrix(matrixStack); prepareMatrix(matrixStack);
// matrixStack.translate(0, 80, 0);
transformMatrix(matrixStack); transformMatrix(matrixStack);
matrixStack.scale(1, -1, 1);
matrixStack.translate(0, 0, -75);
renderItemIntoGUI(matrixStack, stack); renderItemIntoGUI(matrixStack, stack);
cleanUpMatrix(matrixStack); cleanUpMatrix(matrixStack);
} }
public static void renderItemIntoGUI(MatrixStack matrixStack, ItemStack stack) { public static void renderItemIntoGUI(MatrixStack matrixStack, ItemStack stack) {
ItemRenderer renderer = Minecraft.getInstance().getItemRenderer(); ItemRenderer renderer = Minecraft.getInstance()
.getItemRenderer();
IBakedModel bakedModel = renderer.getItemModelWithOverrides(stack, null, null); IBakedModel bakedModel = renderer.getItemModelWithOverrides(stack, null, null);
matrixStack.push(); matrixStack.push();
renderer.textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); renderer.textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
renderer.textureManager.getTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE).setBlurMipmapDirect(false, false); renderer.textureManager.getTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE)
.setBlurMipmapDirect(false, false);
RenderSystem.enableRescaleNormal(); RenderSystem.enableRescaleNormal();
RenderSystem.enableAlphaTest(); RenderSystem.enableAlphaTest();
RenderSystem.defaultAlphaFunc(); RenderSystem.defaultAlphaFunc();
RenderSystem.enableBlend(); RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA,
GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
matrixStack.translate((float)0, (float)0, 100.0F + renderer.zLevel); matrixStack.translate((float) 0, (float) 0, 100.0F + renderer.zLevel);
matrixStack.translate(8.0F, 8.0F, 0.0F); matrixStack.translate(8.0F, 8.0F, 0.0F);
matrixStack.scale(1.0F, -1.0F, 1.0F);
matrixStack.scale(16.0F, 16.0F, 16.0F); matrixStack.scale(16.0F, 16.0F, 16.0F);
IRenderTypeBuffer.Impl irendertypebuffer$impl = Minecraft.getInstance().getBufferBuilders().getEntityVertexConsumers(); IRenderTypeBuffer.Impl irendertypebuffer$impl = Minecraft.getInstance()
.getBufferBuilders()
.getEntityVertexConsumers();
boolean flag = !bakedModel.isSideLit(); boolean flag = !bakedModel.isSideLit();
if (flag) { if (flag) {
RenderHelper.disableGuiDepthLighting(); RenderHelper.disableGuiDepthLighting();
} }
renderer.renderItem(stack, ItemCameraTransforms.TransformType.GUI, false, matrixStack, irendertypebuffer$impl, 15728880, OverlayTexture.DEFAULT_UV, bakedModel); renderer.renderItem(stack, ItemCameraTransforms.TransformType.GUI, false, matrixStack,
irendertypebuffer$impl, 15728880, OverlayTexture.DEFAULT_UV, bakedModel);
irendertypebuffer$impl.draw(); irendertypebuffer$impl.draw();
RenderSystem.enableDepthTest(); RenderSystem.enableDepthTest();
if (flag) { if (flag) {
@ -330,6 +334,7 @@ public class GuiGameElement {
RenderSystem.disableAlphaTest(); RenderSystem.disableAlphaTest();
RenderSystem.disableRescaleNormal(); RenderSystem.disableRescaleNormal();
RenderSystem.enableCull();
matrixStack.pop(); matrixStack.pop();
} }

View File

@ -17,7 +17,8 @@ import net.minecraft.util.text.StringTextComponent;
public class ToolSelectionScreen extends Screen { public class ToolSelectionScreen extends Screen {
public final String scrollToCycle = Lang.translate("gui.toolmenu.cycle").getUnformattedComponentText(); public final String scrollToCycle = Lang.translate("gui.toolmenu.cycle")
.getString();
public final String holdToFocus = "gui.toolmenu.focusKey"; public final String holdToFocus = "gui.toolmenu.focusKey";
protected List<Tools> tools; protected List<Tools> tools;
@ -63,7 +64,6 @@ public class ToolSelectionScreen extends Screen {
if (!initialized) if (!initialized)
init(mc, mainWindow.getScaledWidth(), mainWindow.getScaledHeight()); init(mc, mainWindow.getScaledWidth(), mainWindow.getScaledHeight());
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;
@ -74,11 +74,14 @@ public class ToolSelectionScreen extends Screen {
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(matrixStack, 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;
List<ITextComponent> toolTip = tools.get(selection).getDescription(); List<ITextComponent> 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) {
@ -99,10 +102,11 @@ public class ToolSelectionScreen extends Screen {
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 = client.getWindow().getScaledWidth(); int width = client.getWindow()
.getScaledWidth();
if (!focused) if (!focused)
drawCenteredString(matrixStack, client.fontRenderer, Lang.translate(holdToFocus, keyName).getUnformattedComponentText(), width / 2, y - 10, drawCenteredText(matrixStack, client.fontRenderer, Lang.translate(holdToFocus, keyName), width / 2,
0xCCDDFF); y - 10, 0xCCDDFF);
else else
drawCenteredString(matrixStack, client.fontRenderer, scrollToCycle, width / 2, y - 10, 0xCCDDFF); drawCenteredString(matrixStack, client.fontRenderer, scrollToCycle, width / 2, y - 10, 0xCCDDFF);
} else { } else {
@ -115,14 +119,19 @@ public class ToolSelectionScreen extends Screen {
float alpha = focused ? 1 : .2f; float alpha = focused ? 1 : .2f;
if (i == selection) { if (i == selection) {
matrixStack.translate(0, -10, 0); matrixStack.translate(0, -10, 0);
drawCenteredString(matrixStack, client.fontRenderer, tools.get(i).getDisplayName().getUnformattedComponentText(), x + i * 50 + 24, y + 28, drawCenteredString(matrixStack, client.fontRenderer, tools.get(i)
0xCCDDFF); .getDisplayName()
.getString(), x + i * 50 + 24, y + 28, 0xCCDDFF);
alpha = 1; alpha = 1;
} }
RenderSystem.color4f(0, 0, 0, alpha); RenderSystem.color4f(0, 0, 0, alpha);
tools.get(i).getIcon().draw(matrixStack, 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(matrixStack, this, x + i * 50 + 16, y + 11); tools.get(i)
.getIcon()
.draw(matrixStack, this, x + i * 50 + 16, y + 11);
matrixStack.pop(); matrixStack.pop();
} }

View File

@ -71,13 +71,6 @@ public class OxidizingBlock extends Block {
} }
} }
@Override
public float getPlayerRelativeBlockHardness(BlockState blockState, PlayerEntity player, IBlockReader worldIn,
BlockPos pos) {
return super.getPlayerRelativeBlockHardness(blockState, player, worldIn, pos)
- 0.2f * blockState.get(OXIDIZATION);
}
@Override @Override
public ActionResultType onUse(BlockState state, World world, BlockPos pos, public ActionResultType onUse(BlockState state, World world, BlockPos pos,
PlayerEntity player, Hand hand, BlockRayTraceResult blockRayTraceResult) { PlayerEntity player, Hand hand, BlockRayTraceResult blockRayTraceResult) {