mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 21:33:41 +01:00
GuiGameReposition
- adjust the position of the item renderer for gui elements - include a warning when joining a world while fabulous graphics are enabled
This commit is contained in:
parent
73f87ab44e
commit
e26191aaf7
27 changed files with 118 additions and 52 deletions
|
@ -9,6 +9,7 @@ import com.simibubi.create.content.schematics.client.SchematicHandler;
|
||||||
import com.simibubi.create.foundation.ResourceReloadHandler;
|
import com.simibubi.create.foundation.ResourceReloadHandler;
|
||||||
import com.simibubi.create.foundation.block.render.CustomBlockModels;
|
import com.simibubi.create.foundation.block.render.CustomBlockModels;
|
||||||
import com.simibubi.create.foundation.block.render.SpriteShifter;
|
import com.simibubi.create.foundation.block.render.SpriteShifter;
|
||||||
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.gui.UIRenderHelper;
|
import com.simibubi.create.foundation.gui.UIRenderHelper;
|
||||||
import com.simibubi.create.foundation.item.CustomItemModels;
|
import com.simibubi.create.foundation.item.CustomItemModels;
|
||||||
import com.simibubi.create.foundation.item.CustomRenderedItems;
|
import com.simibubi.create.foundation.item.CustomRenderedItems;
|
||||||
|
@ -28,11 +29,19 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.BlockModelShapes;
|
import net.minecraft.client.renderer.BlockModelShapes;
|
||||||
import net.minecraft.client.renderer.model.IBakedModel;
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.client.settings.GraphicsFanciness;
|
||||||
import net.minecraft.inventory.container.PlayerContainer;
|
import net.minecraft.inventory.container.PlayerContainer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.resources.IReloadableResourceManager;
|
import net.minecraft.resources.IReloadableResourceManager;
|
||||||
import net.minecraft.resources.IResourceManager;
|
import net.minecraft.resources.IResourceManager;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.text.ChatType;
|
||||||
|
import net.minecraft.util.text.IFormattableTextComponent;
|
||||||
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
|
import net.minecraft.util.text.TextComponentUtils;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.util.text.event.ClickEvent;
|
||||||
|
import net.minecraft.util.text.event.HoverEvent;
|
||||||
import net.minecraft.world.IWorld;
|
import net.minecraft.world.IWorld;
|
||||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||||
|
@ -212,4 +221,24 @@ public class CreateClient {
|
||||||
|
|
||||||
ContraptionRenderDispatcher.invalidateAll();
|
ContraptionRenderDispatcher.invalidateAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void checkGraphicsFanciness() {
|
||||||
|
Minecraft mc = Minecraft.getInstance();
|
||||||
|
if (mc.player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (mc.gameSettings.graphicsMode != GraphicsFanciness.FABULOUS)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (AllConfigs.CLIENT.ignoreFabulousWarning.get())
|
||||||
|
return;
|
||||||
|
|
||||||
|
IFormattableTextComponent text = TextComponentUtils.bracketed(new StringTextComponent("WARN")).formatted(TextFormatting.GOLD)
|
||||||
|
.append(new StringTextComponent(" Some of Create's visual features will not be available while Fabulous graphics are enabled!"))
|
||||||
|
.styled(style -> style
|
||||||
|
.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/create dismissFabulousWarning"))
|
||||||
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("Click here to disable this warning"))));
|
||||||
|
|
||||||
|
mc.ingameGUI.addChatMessage(ChatType.CHAT, text, mc.player.getUniqueID());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,12 +46,12 @@ public class DoubleItemIcon implements IDrawable {
|
||||||
matrixStack.translate(xOffset, yOffset, 0);
|
matrixStack.translate(xOffset, yOffset, 0);
|
||||||
|
|
||||||
matrixStack.push();
|
matrixStack.push();
|
||||||
matrixStack.translate(1, 17, 0);
|
matrixStack.translate(1, 1, 0);
|
||||||
GuiGameElement.of(primaryStack).render(matrixStack);
|
GuiGameElement.of(primaryStack).render(matrixStack);
|
||||||
matrixStack.pop();
|
matrixStack.pop();
|
||||||
|
|
||||||
matrixStack.push();
|
matrixStack.push();
|
||||||
matrixStack.translate(10, 19, 100);
|
matrixStack.translate(10, 10, 100);
|
||||||
matrixStack.scale(.5f, .5f, .5f);
|
matrixStack.scale(.5f, .5f, .5f);
|
||||||
GuiGameElement.of(secondaryStack).render(matrixStack);
|
GuiGameElement.of(secondaryStack).render(matrixStack);
|
||||||
matrixStack.pop();
|
matrixStack.pop();
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class BlockzapperUpgradeCategory extends CreateRecipeCategory<Blockzapper
|
||||||
font.drawWithShadow(matrixStack, textComponent, (BLOCKZAPPER_UPGRADE_RECIPE.width - font.getStringWidth(textComponent.getString())) / 2f, 57, 0x8B8B8B);
|
font.drawWithShadow(matrixStack, textComponent, (BLOCKZAPPER_UPGRADE_RECIPE.width - font.getStringWidth(textComponent.getString())) / 2f, 57, 0x8B8B8B);
|
||||||
|
|
||||||
GuiGameElement.of(recipe.getRecipeOutput())
|
GuiGameElement.of(recipe.getRecipeOutput())
|
||||||
.at(90, 55)
|
.at(90, 0)
|
||||||
.scale(3.5)
|
.scale(3.5)
|
||||||
.render(matrixStack);
|
.render(matrixStack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,8 +156,8 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
|
||||||
matrixStack.scale(scale, scale, scale);
|
matrixStack.scale(scale, scale, scale);
|
||||||
|
|
||||||
if (ingredient != null) {
|
if (ingredient != null) {
|
||||||
matrixStack.push();
|
RenderSystem.pushMatrix();
|
||||||
matrixStack.peek().getModel().multiply(matrixStack.peek().getModel());
|
RenderSystem.multMatrix(matrixStack.peek().getModel());
|
||||||
RenderSystem.enableDepthTest();
|
RenderSystem.enableDepthTest();
|
||||||
RenderHelper.enable();
|
RenderHelper.enable();
|
||||||
Minecraft minecraft = Minecraft.getInstance();
|
Minecraft minecraft = Minecraft.getInstance();
|
||||||
|
@ -167,7 +167,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
|
||||||
itemRenderer.renderItemOverlayIntoGUI(font, ingredient, 0, 0, null);
|
itemRenderer.renderItemOverlayIntoGUI(font, ingredient, 0, 0, null);
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
RenderHelper.disableStandardItemLighting();
|
RenderHelper.disableStandardItemLighting();
|
||||||
matrixStack.pop();
|
RenderSystem.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
matrixStack.pop();
|
matrixStack.pop();
|
||||||
|
|
|
@ -57,7 +57,6 @@ public class PolishingCategory extends CreateRecipeCategory<SandPaperPolishingRe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(SandPaperPolishingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
|
public void draw(SandPaperPolishingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
|
||||||
matrixStack.push();
|
|
||||||
AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 28);
|
AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 28);
|
||||||
getRenderedSlot(recipe, 0).draw(matrixStack, 131, 28);
|
getRenderedSlot(recipe, 0).draw(matrixStack, 131, 28);
|
||||||
AllGuiTextures.JEI_SHADOW.draw(matrixStack, 61, 21);
|
AllGuiTextures.JEI_SHADOW.draw(matrixStack, 61, 21);
|
||||||
|
@ -73,11 +72,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);
|
||||||
matrixStack.translate(0, 30, 0);
|
GuiGameElement.of(renderedSandpaper)
|
||||||
matrixStack.scale(2, 2, 2);
|
.at(getBackground().getWidth() / 2 - 16, 0, 0)
|
||||||
matrixStack.translate(getBackground().getWidth() / 4 - 8, 1, 0);
|
.scale(2)
|
||||||
GuiGameElement.of(renderedSandpaper).render(matrixStack);
|
.render(matrixStack);
|
||||||
matrixStack.pop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,13 +75,12 @@ public class GoggleConfigScreen extends AbstractSimiScreen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||||
ms.push();
|
|
||||||
int posX = this.width / 2 + offsetX;
|
int posX = this.width / 2 + offsetX;
|
||||||
int posY = this.height / 2 + offsetY;
|
int posY = this.height / 2 + offsetY;
|
||||||
renderTooltip(ms, tooltip, posX, posY);
|
renderTooltip(ms, tooltip, posX, posY);
|
||||||
|
|
||||||
ItemStack item = AllItems.GOGGLES.asStack();
|
ItemStack item = AllItems.GOGGLES.asStack();
|
||||||
GuiGameElement.of(item).atLocal(posX + 10, posY, 450).render(ms);
|
GuiGameElement.of(item).at(posX + 10, posY - 16, 450).render(ms);
|
||||||
ms.pop();
|
GuiGameElement.of(item).at(0, 0, 450).render(ms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,15 +141,11 @@ public class GoggleOverlayRenderer {
|
||||||
.getScaledHeight());
|
.getScaledHeight());
|
||||||
int posX = tooltipScreen.width / 2 + AllConfigs.CLIENT.overlayOffsetX.get();
|
int posX = tooltipScreen.width / 2 + AllConfigs.CLIENT.overlayOffsetX.get();
|
||||||
int posY = tooltipScreen.height / 2 + AllConfigs.CLIENT.overlayOffsetY.get();
|
int posY = tooltipScreen.height / 2 + AllConfigs.CLIENT.overlayOffsetY.get();
|
||||||
// tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2,
|
|
||||||
// tooltipScreen.height / 2);
|
|
||||||
tooltipScreen.renderTooltip(ms, tooltip, posX, posY);
|
tooltipScreen.renderTooltip(ms, tooltip, posX, posY);
|
||||||
|
|
||||||
ItemStack item = AllItems.GOGGLES.asStack();
|
ItemStack item = AllItems.GOGGLES.asStack();
|
||||||
// GuiGameElement.of(item).at(tooltipScreen.width / 2 + 10, tooltipScreen.height
|
|
||||||
// / 2 - 16).render();
|
|
||||||
GuiGameElement.of(item)
|
GuiGameElement.of(item)
|
||||||
.atLocal(posX + 10, posY, 450)
|
.at(posX + 10, posY - 16, 450)
|
||||||
.render(ms);
|
.render(ms);
|
||||||
ms.pop();
|
ms.pop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
|
||||||
0xffffff);
|
0xffffff);
|
||||||
|
|
||||||
GuiGameElement.of(renderedItem)
|
GuiGameElement.of(renderedItem)
|
||||||
.at(guiLeft + background.width + 10, guiTop + 180, -150)
|
.at(guiLeft + background.width + 10, guiTop + 100, -150)
|
||||||
.scale(5)
|
.scale(5)
|
||||||
.render(matrixStack);
|
.render(matrixStack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ public class ZapperScreen extends AbstractSimiScreen {
|
||||||
|
|
||||||
protected void renderZapper(MatrixStack matrixStack) {
|
protected void renderZapper(MatrixStack matrixStack) {
|
||||||
GuiGameElement.of(zapper)
|
GuiGameElement.of(zapper)
|
||||||
.at((this.width - this.sWidth) / 2 + 220, this.height / 2 - this.sHeight / 4 + 30, -150)
|
.at((this.width - this.sWidth) / 2 + 200, this.height / 2 - this.sHeight / 4 + 25, -150)//TODO
|
||||||
.scale(4)
|
.scale(4)
|
||||||
.render(matrixStack);
|
.render(matrixStack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class AdjustableCrateScreen extends AbstractSimiContainerScreen<Adjustabl
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiGameElement.of(renderedItem)
|
GuiGameElement.of(renderedItem)
|
||||||
.at(guiLeft + ADJUSTABLE_CRATE.width + 110, guiTop + 120, -150)
|
.at(guiLeft + ADJUSTABLE_CRATE.width + 110, guiTop + 70, -150)
|
||||||
.scale(5)
|
.scale(5)
|
||||||
.render(matrixStack);
|
.render(matrixStack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ public class StockpileSwitchScreen extends AbstractSimiScreen {
|
||||||
|
|
||||||
matrixStack.push();
|
matrixStack.push();
|
||||||
GuiGameElement.of(renderedItem)
|
GuiGameElement.of(renderedItem)
|
||||||
.at(guiLeft + STOCKSWITCH.width + 15, guiTop + 120, -250)
|
.at(guiLeft + STOCKSWITCH.width + 15, guiTop + 40, -250)
|
||||||
.scale(5)
|
.scale(5)
|
||||||
.render(matrixStack);
|
.render(matrixStack);
|
||||||
matrixStack.pop();
|
matrixStack.pop();
|
||||||
|
|
|
@ -121,7 +121,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 + 98, -150)
|
.at(mainLeft + 217, mainTop + 50, -150)
|
||||||
.scale(3)
|
.scale(3)
|
||||||
.render(matrixStack);
|
.render(matrixStack);
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
||||||
renderBlueprintHighlight(matrixStack);
|
renderBlueprintHighlight(matrixStack);
|
||||||
|
|
||||||
GuiGameElement.of(renderedItem)
|
GuiGameElement.of(renderedItem)
|
||||||
.at(guiLeft + 230, guiTop + 190, -200)
|
.at(guiLeft + 230, guiTop + 110, -200)
|
||||||
.scale(5)
|
.scale(5)
|
||||||
.render(matrixStack);
|
.render(matrixStack);
|
||||||
|
|
||||||
|
@ -272,12 +272,10 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
||||||
|
|
||||||
if (te.missingItem != null) {
|
if (te.missingItem != null) {
|
||||||
stringWidth += 15;
|
stringWidth += 15;
|
||||||
matrixStack.push();
|
|
||||||
GuiGameElement.of(te.missingItem)
|
GuiGameElement.of(te.missingItem)
|
||||||
.at(guiLeft + 150, guiTop + 62, 100)
|
.at(guiLeft + 150, guiTop + 46, 100)
|
||||||
.scale(1)
|
.scale(1)
|
||||||
.render(matrixStack);
|
.render(matrixStack);
|
||||||
matrixStack.pop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
textRenderer.drawWithShadow(matrixStack, msg, guiLeft + 20 + 102 - stringWidth / 2, guiTop + 50, 0xCCDDFF);
|
textRenderer.drawWithShadow(matrixStack, msg, guiLeft + 20 + 102 - stringWidth / 2, guiTop + 50, 0xCCDDFF);
|
||||||
|
|
|
@ -151,12 +151,10 @@ public class SchematicEditScreen extends AbstractSimiScreen {
|
||||||
textRenderer.drawWithShadow(matrixStack, handler.getCurrentSchematicName(),
|
textRenderer.drawWithShadow(matrixStack, handler.getCurrentSchematicName(),
|
||||||
x + 93 - textRenderer.getStringWidth(handler.getCurrentSchematicName()) / 2, y + 3, 0xffffff);
|
x + 93 - textRenderer.getStringWidth(handler.getCurrentSchematicName()) / 2, y + 3, 0xffffff);
|
||||||
|
|
||||||
matrixStack.push();
|
|
||||||
matrixStack.translate(guiLeft + 200, guiTop + 130, 0);
|
|
||||||
matrixStack.scale(3, 3, 3);
|
|
||||||
GuiGameElement.of(AllItems.SCHEMATIC.asStack())
|
GuiGameElement.of(AllItems.SCHEMATIC.asStack())
|
||||||
|
.at(guiLeft + 200, guiTop + 82, 0)
|
||||||
|
.scale(3)
|
||||||
.render(matrixStack);
|
.render(matrixStack);
|
||||||
matrixStack.pop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -65,10 +65,9 @@ public class SchematicPromptScreen extends AbstractSimiScreen {
|
||||||
AllGuiTextures.SCHEMATIC_PROMPT.draw(ms, this, guiLeft, guiTop);
|
AllGuiTextures.SCHEMATIC_PROMPT.draw(ms, this, guiLeft, guiTop);
|
||||||
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();
|
GuiGameElement.of(AllItems.SCHEMATIC.asStack())
|
||||||
ms.translate(guiLeft + 22, guiTop + 39, 0);
|
.at(guiLeft + 22, guiTop + 23, 0)
|
||||||
GuiGameElement.of(AllItems.SCHEMATIC.asStack()).render(ms);
|
.render(ms);
|
||||||
ms.pop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -52,6 +52,7 @@ import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.world.IWorld;
|
import net.minecraft.world.IWorld;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
import net.minecraftforge.client.event.ClientPlayerNetworkEvent;
|
||||||
import net.minecraftforge.client.event.EntityViewRenderEvent;
|
import net.minecraftforge.client.event.EntityViewRenderEvent;
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||||
|
@ -120,6 +121,11 @@ public class ClientEvents {
|
||||||
ContraptionRenderDispatcher.tick();
|
ContraptionRenderDispatcher.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onJoin(ClientPlayerNetworkEvent.LoggedInEvent event) {
|
||||||
|
CreateClient.checkGraphicsFanciness();
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onLoadWorld(WorldEvent.Load event) {
|
public static void onLoadWorld(WorldEvent.Load event) {
|
||||||
IWorld world = event.getWorld();
|
IWorld world = event.getWorld();
|
||||||
|
|
|
@ -24,6 +24,7 @@ public class AllCommands {
|
||||||
//general purpose
|
//general purpose
|
||||||
.then(new ToggleExperimentalRenderingCommand().register())
|
.then(new ToggleExperimentalRenderingCommand().register())
|
||||||
.then(new ToggleDebugCommand().register())
|
.then(new ToggleDebugCommand().register())
|
||||||
|
.then(FabulousWarningCommand.register())
|
||||||
.then(OverlayConfigCommand.register())
|
.then(OverlayConfigCommand.register())
|
||||||
.then(FixLightingCommand.register())
|
.then(FixLightingCommand.register())
|
||||||
.then(HighlightCommand.register())
|
.then(HighlightCommand.register())
|
||||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.text.ChatType;
|
||||||
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.StringTextComponent;
|
||||||
|
@ -73,6 +74,7 @@ public class ConfigureConfigPacket extends SimplePacketBase {
|
||||||
overlayReset(() -> Actions::overlayReset),
|
overlayReset(() -> Actions::overlayReset),
|
||||||
experimentalRendering(() -> Actions::experimentalRendering),
|
experimentalRendering(() -> Actions::experimentalRendering),
|
||||||
openPonder(() -> Actions::openPonder),
|
openPonder(() -> Actions::openPonder),
|
||||||
|
fabulousWarning(() -> Actions::fabulousWarning)
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -161,6 +163,12 @@ public class ConfigureConfigPacket extends SimplePacketBase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
private static void fabulousWarning(String value) {
|
||||||
|
AllConfigs.CLIENT.ignoreFabulousWarning.set(true);
|
||||||
|
Minecraft.getInstance().ingameGUI.addChatMessage(ChatType.CHAT, new StringTextComponent("Disabled Fabulous graphics warning"), Minecraft.getInstance().player.getUniqueID());
|
||||||
|
}
|
||||||
|
|
||||||
private static IFormattableTextComponent boolToText(boolean b) {
|
private static IFormattableTextComponent boolToText(boolean b) {
|
||||||
return b
|
return b
|
||||||
? new StringTextComponent("enabled").formatted(TextFormatting.DARK_GREEN)
|
? new StringTextComponent("enabled").formatted(TextFormatting.DARK_GREEN)
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.simibubi.create.foundation.command;
|
||||||
|
|
||||||
|
import net.minecraft.command.CommandSource;
|
||||||
|
import net.minecraft.command.Commands;
|
||||||
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
|
import net.minecraftforge.fml.network.PacketDistributor;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.Command;
|
||||||
|
import com.mojang.brigadier.builder.ArgumentBuilder;
|
||||||
|
import com.simibubi.create.foundation.networking.AllPackets;
|
||||||
|
|
||||||
|
public class FabulousWarningCommand {
|
||||||
|
|
||||||
|
public static ArgumentBuilder<CommandSource, ?> register() {
|
||||||
|
return Commands.literal("dismissFabulousWarning")
|
||||||
|
.requires(AllCommands.sourceIsPlayer)
|
||||||
|
.executes(ctx -> {
|
||||||
|
ServerPlayerEntity player = ctx.getSource().asPlayer();
|
||||||
|
|
||||||
|
AllPackets.channel.send(
|
||||||
|
PacketDistributor.PLAYER.with(() -> player),
|
||||||
|
new ConfigureConfigPacket(ConfigureConfigPacket.Actions.fabulousWarning.name(), "")
|
||||||
|
);
|
||||||
|
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ public class CClient extends ConfigBase {
|
||||||
public ConfigInt overlayOffsetX = i(20, Integer.MIN_VALUE, Integer.MAX_VALUE, "overlayOffsetX", "Offset the overlay from goggle- and hover- information by this many pixels on the X axis; Use /create overlay");
|
public ConfigInt overlayOffsetX = i(20, Integer.MIN_VALUE, Integer.MAX_VALUE, "overlayOffsetX", "Offset the overlay from goggle- and hover- information by this many pixels on the X axis; Use /create overlay");
|
||||||
public ConfigInt overlayOffsetY = i(0, Integer.MIN_VALUE, Integer.MAX_VALUE, "overlayOffsetY", "Offset the overlay from goggle- and hover- information by this many pixels on the Y axis; Use /create overlay");
|
public ConfigInt overlayOffsetY = i(0, Integer.MIN_VALUE, Integer.MAX_VALUE, "overlayOffsetY", "Offset the overlay from goggle- and hover- information by this many pixels on the Y axis; Use /create overlay");
|
||||||
public ConfigBool smoothPlacementIndicator = b(false, "smoothPlacementIndicator", "Use an alternative indicator when showing where the assisted placement ends up relative to your crosshair");
|
public ConfigBool smoothPlacementIndicator = b(false, "smoothPlacementIndicator", "Use an alternative indicator when showing where the assisted placement ends up relative to your crosshair");
|
||||||
|
public ConfigBool ignoreFabulousWarning = b(false, "ignoreFabulousWarning", "Setting this to true will prevent Create from sending you a warning when playing with Fabulous graphics enabled");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|
|
@ -43,6 +43,12 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
|
||||||
this.ySize = height;
|
this.ySize = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawForeground(MatrixStack p_230451_1_, int p_230451_2_, int p_230451_3_) {
|
||||||
|
//no-op to prevent screen- and inventory-title from being rendered at incorrect location
|
||||||
|
//could also set this.titleX/Y and this.playerInventoryTitleX/Y to the proper values instead
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||||
partialTicks = Minecraft.getInstance().getRenderPartialTicks();
|
partialTicks = Minecraft.getInstance().getRenderPartialTicks();
|
||||||
|
|
|
@ -304,7 +304,7 @@ public class GuiGameElement {
|
||||||
GlStateManager.DestFactor.ONE_MINUS_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(16.0F, 16.0F, 16.0F);
|
matrixStack.scale(16.0F, 16.0F, 16.0F);
|
||||||
IRenderTypeBuffer.Impl irendertypebuffer$impl = Minecraft.getInstance()
|
IRenderTypeBuffer.Impl irendertypebuffer$impl = Minecraft.getInstance()
|
||||||
.getBufferBuilders()
|
.getBufferBuilders()
|
||||||
|
|
|
@ -491,7 +491,7 @@ public class PonderUI extends NavigatableSimiScreen {
|
||||||
{
|
{
|
||||||
// Chapter title
|
// Chapter title
|
||||||
ms.push();
|
ms.push();
|
||||||
ms.translate(0, 0, 800);
|
ms.translate(0, 0, 100);
|
||||||
int x = 31 + 20 + 8;
|
int x = 31 + 20 + 8;
|
||||||
int y = 31;
|
int y = 31;
|
||||||
|
|
||||||
|
@ -515,7 +515,7 @@ public class PonderUI extends NavigatableSimiScreen {
|
||||||
ms.translate(x, y, 0);
|
ms.translate(x, y, 0);
|
||||||
ms.multiply(Vector3f.NEGATIVE_X.getDegreesQuaternion(indexDiff * -75));
|
ms.multiply(Vector3f.NEGATIVE_X.getDegreesQuaternion(indexDiff * -75));
|
||||||
ms.translate(0, 0, 5);
|
ms.translate(0, 0, 5);
|
||||||
FontHelper.drawSplitString(textRenderer, title, 0, 0, left.x - 51,
|
FontHelper.drawSplitString(ms, textRenderer, title, 0, 0, left.x - 51,
|
||||||
ColorHelper.applyAlpha(textColor, 1 - indexDiff));
|
ColorHelper.applyAlpha(textColor, 1 - indexDiff));
|
||||||
ms.pop();
|
ms.pop();
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,7 @@ public class PonderTagScreen extends NavigatableSimiScreen {
|
||||||
|
|
||||||
PonderUI.renderBox(ms, x - 3, y - 3, w + 6, h + 6, false);
|
PonderUI.renderBox(ms, x - 3, y - 3, w + 6, h + 6, false);
|
||||||
ms.translate(0, 0, 100);
|
ms.translate(0, 0, 100);
|
||||||
FontHelper.drawSplitString(textRenderer, desc, x, y, w, 0xeeeeee);
|
FontHelper.drawSplitString(ms, textRenderer, desc, x, y, w, 0xeeeeee);
|
||||||
ms.pop();
|
ms.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.simibubi.create.foundation.ponder.PonderScene;
|
||||||
import com.simibubi.create.foundation.ponder.PonderUI;
|
import com.simibubi.create.foundation.ponder.PonderUI;
|
||||||
import com.simibubi.create.foundation.ponder.content.PonderPalette;
|
import com.simibubi.create.foundation.ponder.content.PonderPalette;
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
|
import com.simibubi.create.foundation.utility.FontHelper;
|
||||||
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.vector.Matrix4f;
|
import net.minecraft.util.math.vector.Matrix4f;
|
||||||
|
@ -124,12 +125,8 @@ public class TextWindowElement extends AnimatedOverlayElement {
|
||||||
ms.pop();
|
ms.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < lines.size(); i++) {
|
FontHelper.drawSplitString(ms, screen.getFontRenderer(), bakedText, targetX - 10, 3, textWidth,
|
||||||
ITextProperties s = lines.get(i);
|
ColorHelper.applyAlpha(brighterColor, fade));
|
||||||
// FIXME: Probably completely broken
|
|
||||||
screen.getFontRenderer()
|
|
||||||
.drawTrimmed(s, 20, targetX - 10, 3 + 9 * i, ColorHelper.applyAlpha(brighterColor, fade));
|
|
||||||
}
|
|
||||||
ms.pop();
|
ms.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class PonderButton extends AbstractSimiWidget {
|
||||||
borderColorEnd = ColorHelper.applyAlpha(borderColorEnd, fade);
|
borderColorEnd = ColorHelper.applyAlpha(borderColorEnd, fade);
|
||||||
|
|
||||||
PonderUI.renderBox(ms, x, y, width, height, backgroundColor, borderColorStart, borderColorEnd);
|
PonderUI.renderBox(ms, x, y, width, height, backgroundColor, borderColorStart, borderColorEnd);
|
||||||
ms.translate(0, 0, 800);
|
ms.translate(0, 0, 100);
|
||||||
|
|
||||||
if (icon != null) {
|
if (icon != null) {
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
|
@ -124,7 +124,7 @@ public class PonderButton extends AbstractSimiWidget {
|
||||||
}
|
}
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
ms.push();
|
ms.push();
|
||||||
ms.translate(0, 0, -800);
|
ms.translate(0, 0, -100);
|
||||||
GuiGameElement.of(item)
|
GuiGameElement.of(item)
|
||||||
.at(x - 2, y - 2)
|
.at(x - 2, y - 2)
|
||||||
.scale(1.5f)
|
.scale(1.5f)
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.text.BreakIterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
@ -52,9 +53,9 @@ public final class FontHelper {
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawSplitString(FontRenderer font, String text, int x, int y, int width, int color) {
|
public static void drawSplitString(MatrixStack ms, FontRenderer font, String text, int x, int y, int width, int color) {
|
||||||
List<String> list = cutString(font, text, width);
|
List<String> list = cutString(font, text, width);
|
||||||
Matrix4f matrix4f = TransformationMatrix.identity().getMatrix();
|
Matrix4f matrix4f = ms.peek().getModel();
|
||||||
|
|
||||||
for (String s : list) {
|
for (String s : list) {
|
||||||
float f = (float) x;
|
float f = (float) x;
|
||||||
|
|
Loading…
Reference in a new issue