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();
}
// TODO this should return ITextComponent
public String getBoundKey() {
return keybind.getBoundKeyLocalizedText().getUnformattedComponentText().toUpperCase();
return keybind.getBoundKeyLocalizedText().getString().toUpperCase();
}
public int getBoundCode() {

View file

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

View file

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

View file

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

View file

@ -71,10 +71,10 @@ public class PolishingCategory extends CreateRecipeCategory<SandPaperPolishingRe
CompoundNBT tag = renderedSandpaper.getOrCreateTag();
tag.put("Polishing", matchingStacks[0].serializeNBT());
tag.putBoolean("JEI", true);
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
matrixStack.translate(0, 30, 0);
matrixStack.scale(2, 2, 2);
matrixStack.translate(getBackground().getWidth() / 4 - 8, 1, 0);
GuiGameElement.GuiItemRenderBuilder.renderItemIntoGUI(matrixStack, renderedSandpaper);
GuiGameElement.of(renderedSandpaper).render(matrixStack);
matrixStack.pop();
}

View file

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

View file

@ -19,7 +19,7 @@ public class AnimatedSaw extends AnimatedKinetics {
AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13);
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_Y.getDegreesQuaternion(90-225f));
int scale = 25;

View file

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

View file

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

View file

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

View file

@ -49,38 +49,6 @@ public class StockpileSwitchScreen extends AbstractSimiScreen {
setWindowSize(background.width + 50, background.height);
super.init();
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()
.startWithValue(te.getLevelForDisplay());
@ -158,7 +126,7 @@ public class StockpileSwitchScreen extends AbstractSimiScreen {
matrixStack.push();
GuiGameElement.of(renderedItem)
.at(guiLeft + STOCKSWITCH.width + 15, guiTop + 20)
.at(guiLeft + STOCKSWITCH.width + 15, guiTop + 120)
.scale(5)
.render(matrixStack);
matrixStack.pop();

View file

@ -43,8 +43,10 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
super.init();
widgets.clear();
resetButton = 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);
resetButton =
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(confirmButton);
@ -63,7 +65,7 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
textRenderer.draw(ms, I18n.format(container.filterItem.getTranslationKey()), x + 15, y + 3, 0xdedede);
GuiGameElement.of(container.filterItem)
.at(guiLeft + background.width, guiTop +background.height -60)
.at(guiLeft + background.width, guiTop + background.height + 25)
.scale(5)
.render(ms);
@ -75,7 +77,8 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
super.tick();
handleIndicators();
if (!container.player.getHeldItemMainhand().equals(container.filterItem, false))
if (!container.player.getHeldItemMainhand()
.equals(container.filterItem, false))
client.player.closeScreen();
}
@ -96,9 +99,12 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
List<IconButton> tooltipButtons = getTooltipButtons();
for (IconButton button : tooltipButtons) {
if (!button.getToolTip().isEmpty()) {
button.setToolTip(button.getToolTip().get(0));
button.getToolTip().add(TooltipHelper.holdShift(Palette.Yellow, hasShiftDown()));
if (!button.getToolTip()
.isEmpty()) {
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;
}
protected void contentsCleared() {
}
protected void contentsCleared() {}
protected void sendOptionUpdate(Option 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);
GuiGameElement.of(renderedItem)
.at(mainLeft + 217, mainTop + 48)
.at(mainLeft + 217, mainTop + 98)
.scale(3)
.render(matrixStack);

View file

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

View file

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

View file

@ -187,7 +187,7 @@ public class GuiGameElement {
BlockRendererDispatcher blockRenderer = mc.getBlockRendererDispatcher();
IRenderTypeBuffer.Impl buffer = mc.getBufferBuilders()
.getEntityVertexConsumers();
RenderType renderType = blockState.getBlock() == Blocks.AIR ? Atlases.getEntityTranslucentCull() // FIXME .getEntityTranslucent()
RenderType renderType = blockState.getBlock() == Blocks.AIR ? Atlases.getEntityTranslucentCull()
: RenderTypeLookup.getEntityBlockLayer(blockState, true);
IVertexBuilder vb = buffer.getBuffer(renderType);
@ -292,36 +292,40 @@ public class GuiGameElement {
@Override
public void render(MatrixStack matrixStack) {
prepareMatrix(matrixStack);
// matrixStack.translate(0, 80, 0);
transformMatrix(matrixStack);
matrixStack.scale(1, -1, 1);
matrixStack.translate(0, 0, -75);
renderItemIntoGUI(matrixStack, stack);
cleanUpMatrix(matrixStack);
}
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);
matrixStack.push();
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.enableAlphaTest();
RenderSystem.defaultAlphaFunc();
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);
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.scale(1.0F, -1.0F, 1.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();
if (flag) {
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();
RenderSystem.enableDepthTest();
if (flag) {
@ -330,6 +334,7 @@ public class GuiGameElement {
RenderSystem.disableAlphaTest();
RenderSystem.disableRescaleNormal();
RenderSystem.enableCull();
matrixStack.pop();
}

View file

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

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
public ActionResultType onUse(BlockState state, World world, BlockPos pos,
PlayerEntity player, Hand hand, BlockRayTraceResult blockRayTraceResult) {