From 0d924bc1f7d4ca9e7a1e7d2ff271414fe620dd87 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Sat, 14 Sep 2019 18:21:30 +0200 Subject: [PATCH] Internationalize! - Moved all language specific content to the lang file - Tooltips are now loaded from the lang file --- .../java/com/simibubi/create/AllBlocks.java | 6 +- .../java/com/simibubi/create/AllItems.java | 6 +- .../java/com/simibubi/create/AllKeys.java | 4 +- .../java/com/simibubi/create/AllPackets.java | 2 +- .../com/simibubi/create/ClientEvents.java | 24 ++ .../com/simibubi/create/CreateConfig.java | 3 +- .../block/IBlockWithScrollableValue.java | 21 +- .../create/foundation/block/InfoBlock.java | 32 --- .../foundation/gui/TextInputPromptScreen.java | 9 +- .../foundation/gui/ToolSelectionScreen.java | 60 ++-- .../foundation/gui/widgets/ScrollInput.java | 9 +- .../gui/widgets/SelectionScrollInput.java | 10 +- .../foundation/item/AbstractToolItem.java | 15 +- .../create/foundation/item/InfoItem.java | 31 -- .../foundation/utility/ContainerListener.java | 7 - .../create/foundation/utility/ITooltip.java | 13 - .../foundation/utility/ItemDescription.java | 59 +--- .../create/foundation/utility/Lang.java | 33 +++ .../foundation/utility/TooltipHelper.java | 151 ++++++++++ .../foundation/utility/TooltipHolder.java | 19 -- .../com/simibubi/create/modules/IModule.java | 55 ++++ .../contraptions/base/KineticBlock.java | 4 +- .../contraptions/generators/MotorBlock.java | 13 +- .../generators/WaterWheelBlock.java | 7 - .../receivers/CrushingWheelBlock.java | 11 - .../contraptions/receivers/DrillBlock.java | 11 - .../receivers/EncasedFanBlock.java | 6 - .../receivers/HarvesterBlock.java | 27 +- .../receivers/MechanicalPressBlock.java | 8 - .../receivers/TurntableBlock.java | 7 - .../constructs/AbstractChassisBlock.java | 3 +- .../constructs/MechanicalBearingBlock.java | 10 - .../constructs/MechanicalPistonBlock.java | 9 - .../constructs/MovingConstructHandler.java | 7 +- .../receivers/constructs/PistonPoleBlock.java | 30 +- .../constructs/RotationChassisBlock.java | 4 +- .../contraptions/relays/ClutchBlock.java | 11 - .../contraptions/relays/EncasedBeltBlock.java | 10 - .../relays/EncasedShaftBlock.java | 7 - .../contraptions/relays/GearboxBlock.java | 9 - .../contraptions/relays/GearshiftBlock.java | 9 - .../contraptions/relays/ShaftBlock.java | 7 - .../contraptions/relays/belt/BeltBlock.java | 8 +- .../placementHandgun/BuilderGunItem.java | 69 ++--- .../placementHandgun/BuilderGunScreen.java | 21 +- .../placementHandgun/PlacementPatterns.java | 18 +- .../symmetry/SymmetryEffectPacket.java | 2 +- .../symmetry/SymmetryHandler.java | 6 +- .../symmetry/SymmetryWandItem.java | 62 ++-- .../symmetry/SymmetryWandScreen.java | 39 +-- .../block/CrossPlaneSymmetryBlock.java | 4 +- .../symmetry/block/PlaneSymmetryBlock.java | 4 +- .../symmetry/block/SymmetryBlock.java | 2 +- .../block/TriplePlaneSymmetryBlock.java | 2 +- .../client/SymmetryWandItemRenderer.java | 2 +- .../symmetry/client/SymmetryWandModel.java | 2 +- .../symmetry/mirror/CrossPlaneMirror.java | 7 +- .../symmetry/mirror/EmptyMirror.java | 2 +- .../symmetry/mirror/PlaneMirror.java | 7 +- .../symmetry/mirror/SymmetryMirror.java | 10 +- .../symmetry/mirror/TriplePlaneMirror.java | 5 +- .../curiosities/tools/BlazingToolItem.java | 13 - .../curiosities/tools/RoseQuartzToolItem.java | 10 - .../tools/ShadowSteelToolItem.java | 13 - .../modules/gardens/TreeFertilizerItem.java | 13 +- .../modules/logistics/FrequencyHandler.java | 4 +- .../logistics/block/FlexcrateBlock.java | 16 +- .../logistics/block/FlexcrateScreen.java | 12 +- .../logistics/block/IBlockWithFilter.java | 3 +- .../logistics/block/IBlockWithFrequency.java | 7 +- .../logistics/block/RedstoneBridgeBlock.java | 39 +-- .../logistics/block/StockswitchBlock.java | 31 +- .../logistics/block/StockswitchScreen.java | 28 +- .../block/diodes/FlexpeaterBlock.java | 3 +- .../block/diodes/FlexpeaterTileEntity.java | 7 +- .../modules/logistics/item/FilterItem.java | 16 +- .../schematics/ClientSchematicLoader.java | 7 +- .../schematics/ServerSchematicLoader.java | 8 +- .../schematics/block/CreativeCrateBlock.java | 15 +- .../schematics/block/SchematicTableBlock.java | 32 +-- .../block/SchematicTableScreen.java | 23 +- .../schematics/block/SchematicannonBlock.java | 13 +- .../block/SchematicannonScreen.java | 127 ++++----- .../block/SchematicannonTileEntity.java | 30 +- .../client/SchematicAndQuillHandler.java | 27 +- .../client/SchematicEditScreen.java | 18 +- .../schematics/client/SchematicHandler.java | 31 +- .../schematics/client/tools/Tools.java | 47 +-- .../schematics/item/SchematicItem.java | 11 +- .../packet/ConfigureSchematicannonPacket.java | 6 +- .../resources/assets/create/lang/en_us.json | 268 ++++++++++++++++++ 91 files changed, 960 insertions(+), 969 deletions(-) delete mode 100644 src/main/java/com/simibubi/create/foundation/block/InfoBlock.java delete mode 100644 src/main/java/com/simibubi/create/foundation/item/InfoItem.java delete mode 100644 src/main/java/com/simibubi/create/foundation/utility/ContainerListener.java delete mode 100644 src/main/java/com/simibubi/create/foundation/utility/ITooltip.java create mode 100644 src/main/java/com/simibubi/create/foundation/utility/Lang.java create mode 100644 src/main/java/com/simibubi/create/foundation/utility/TooltipHelper.java delete mode 100644 src/main/java/com/simibubi/create/foundation/utility/TooltipHolder.java rename src/main/java/com/simibubi/create/modules/{ => curiosities}/symmetry/SymmetryEffectPacket.java (96%) rename src/main/java/com/simibubi/create/modules/{ => curiosities}/symmetry/SymmetryHandler.java (96%) rename src/main/java/com/simibubi/create/modules/{ => curiosities}/symmetry/SymmetryWandItem.java (79%) rename src/main/java/com/simibubi/create/modules/{ => curiosities}/symmetry/SymmetryWandScreen.java (82%) rename src/main/java/com/simibubi/create/modules/{ => curiosities}/symmetry/block/CrossPlaneSymmetryBlock.java (83%) rename src/main/java/com/simibubi/create/modules/{ => curiosities}/symmetry/block/PlaneSymmetryBlock.java (83%) rename src/main/java/com/simibubi/create/modules/{ => curiosities}/symmetry/block/SymmetryBlock.java (79%) rename src/main/java/com/simibubi/create/modules/{ => curiosities}/symmetry/block/TriplePlaneSymmetryBlock.java (75%) rename src/main/java/com/simibubi/create/modules/{ => curiosities}/symmetry/client/SymmetryWandItemRenderer.java (96%) rename src/main/java/com/simibubi/create/modules/{ => curiosities}/symmetry/client/SymmetryWandModel.java (90%) rename src/main/java/com/simibubi/create/modules/{ => curiosities}/symmetry/mirror/CrossPlaneMirror.java (86%) rename src/main/java/com/simibubi/create/modules/{ => curiosities}/symmetry/mirror/EmptyMirror.java (94%) rename src/main/java/com/simibubi/create/modules/{ => curiosities}/symmetry/mirror/PlaneMirror.java (85%) rename src/main/java/com/simibubi/create/modules/{ => curiosities}/symmetry/mirror/SymmetryMirror.java (94%) rename src/main/java/com/simibubi/create/modules/{ => curiosities}/symmetry/mirror/TriplePlaneMirror.java (88%) diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 06bd7e32a..06362e269 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -32,6 +32,9 @@ import com.simibubi.create.modules.contraptions.relays.ShaftBlock; import com.simibubi.create.modules.contraptions.relays.ShaftHalfBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltSupportBlock; +import com.simibubi.create.modules.curiosities.symmetry.block.CrossPlaneSymmetryBlock; +import com.simibubi.create.modules.curiosities.symmetry.block.PlaneSymmetryBlock; +import com.simibubi.create.modules.curiosities.symmetry.block.TriplePlaneSymmetryBlock; import com.simibubi.create.modules.gardens.CocoaLogBlock; import com.simibubi.create.modules.logistics.block.BeltFunnelBlock; import com.simibubi.create.modules.logistics.block.EntityDetectorBlock; @@ -45,9 +48,6 @@ import com.simibubi.create.modules.logistics.block.diodes.PulseRepeaterBlock; import com.simibubi.create.modules.schematics.block.CreativeCrateBlock; import com.simibubi.create.modules.schematics.block.SchematicTableBlock; import com.simibubi.create.modules.schematics.block.SchematicannonBlock; -import com.simibubi.create.modules.symmetry.block.CrossPlaneSymmetryBlock; -import com.simibubi.create.modules.symmetry.block.PlaneSymmetryBlock; -import com.simibubi.create.modules.symmetry.block.TriplePlaneSymmetryBlock; import net.minecraft.block.Block; import net.minecraft.block.Block.Properties; diff --git a/src/main/java/com/simibubi/create/AllItems.java b/src/main/java/com/simibubi/create/AllItems.java index 6df8f4638..c579bb095 100644 --- a/src/main/java/com/simibubi/create/AllItems.java +++ b/src/main/java/com/simibubi/create/AllItems.java @@ -7,12 +7,12 @@ import com.simibubi.create.modules.curiosities.ChromaticCompoundCubeItem; import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItem; import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItemRenderer; import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunModel; +import com.simibubi.create.modules.curiosities.symmetry.SymmetryWandItem; +import com.simibubi.create.modules.curiosities.symmetry.client.SymmetryWandItemRenderer; +import com.simibubi.create.modules.curiosities.symmetry.client.SymmetryWandModel; import com.simibubi.create.modules.gardens.TreeFertilizerItem; import com.simibubi.create.modules.schematics.item.SchematicAndQuillItem; import com.simibubi.create.modules.schematics.item.SchematicItem; -import com.simibubi.create.modules.symmetry.SymmetryWandItem; -import com.simibubi.create.modules.symmetry.client.SymmetryWandItemRenderer; -import com.simibubi.create.modules.symmetry.client.SymmetryWandModel; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.color.ItemColors; diff --git a/src/main/java/com/simibubi/create/AllKeys.java b/src/main/java/com/simibubi/create/AllKeys.java index 2baa4a4c1..ee857e4f6 100644 --- a/src/main/java/com/simibubi/create/AllKeys.java +++ b/src/main/java/com/simibubi/create/AllKeys.java @@ -9,7 +9,7 @@ import net.minecraftforge.fml.client.registry.ClientRegistry; public enum AllKeys { - TOOL_MENU("Tool Menu (Hold)", GLFW.GLFW_KEY_LEFT_ALT), + TOOL_MENU("toolmenu", GLFW.GLFW_KEY_LEFT_ALT), ACTIVATE_TOOL("", GLFW.GLFW_KEY_LEFT_CONTROL), ; @@ -20,7 +20,7 @@ public enum AllKeys { private boolean modifiable; private AllKeys(String description, int defaultKey) { - this.description = description; + this.description = Create.ID + ".keyinfo." + description; this.key = defaultKey; this.modifiable = !description.isEmpty(); } diff --git a/src/main/java/com/simibubi/create/AllPackets.java b/src/main/java/com/simibubi/create/AllPackets.java index d6f1dccfa..4cda41e0c 100644 --- a/src/main/java/com/simibubi/create/AllPackets.java +++ b/src/main/java/com/simibubi/create/AllPackets.java @@ -9,13 +9,13 @@ import com.simibubi.create.foundation.packet.SimplePacketBase; import com.simibubi.create.modules.contraptions.generators.ConfigureMotorPacket; import com.simibubi.create.modules.contraptions.receivers.constructs.ConfigureChassisPacket; import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunBeamPacket; +import com.simibubi.create.modules.curiosities.symmetry.SymmetryEffectPacket; import com.simibubi.create.modules.logistics.block.diodes.ConfigureFlexpeaterPacket; import com.simibubi.create.modules.logistics.packet.ConfigureFlexcratePacket; import com.simibubi.create.modules.logistics.packet.ConfigureStockswitchPacket; import com.simibubi.create.modules.schematics.packet.ConfigureSchematicannonPacket; import com.simibubi.create.modules.schematics.packet.SchematicPlacePacket; import com.simibubi.create.modules.schematics.packet.SchematicUploadPacket; -import com.simibubi.create.modules.symmetry.SymmetryEffectPacket; import net.minecraft.network.PacketBuffer; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/com/simibubi/create/ClientEvents.java b/src/main/java/com/simibubi/create/ClientEvents.java index 07c5e349c..66c95f5ea 100644 --- a/src/main/java/com/simibubi/create/ClientEvents.java +++ b/src/main/java/com/simibubi/create/ClientEvents.java @@ -1,11 +1,17 @@ package com.simibubi.create; +import java.util.ArrayList; +import java.util.List; + import com.simibubi.create.foundation.block.IBlockWithScrollableValue; import com.simibubi.create.foundation.gui.ScreenOpener; +import com.simibubi.create.foundation.utility.TooltipHelper; import com.simibubi.create.modules.contraptions.receivers.TurntableHandler; import com.simibubi.create.modules.contraptions.relays.belt.BeltItemHandler; import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.text.ITextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.InputEvent.KeyInputEvent; import net.minecraftforge.client.event.InputEvent.MouseInputEvent; @@ -16,12 +22,16 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.TickEvent.ClientTickEvent; import net.minecraftforge.event.TickEvent.Phase; import net.minecraftforge.event.TickEvent.RenderTickEvent; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @EventBusSubscriber(value = Dist.CLIENT) public class ClientEvents { + private static final String itemPrefix = "item." + Create.ID; + private static final String blockPrefix = "block." + Create.ID; + @SubscribeEvent public static void onTick(ClientTickEvent event) { if (event.phase == Phase.START) @@ -93,6 +103,20 @@ public class ClientEvents { CreateClient.schematicAndQuillHandler.onMouseInput(button, pressed); } + @SubscribeEvent + public static void addToItemTooltip(ItemTooltipEvent event) { + ItemStack stack = event.getItemStack(); + String translationKey = stack.getItem().getTranslationKey(stack); + if (!translationKey.startsWith(itemPrefix) && !translationKey.startsWith(blockPrefix)) + return; + + if (TooltipHelper.hasTooltip(stack)) { + List toolTip = new ArrayList<>(); + TooltipHelper.getTooltip(stack).addInformation(toolTip); + event.getToolTip().addAll(1, toolTip); + } + } + @SubscribeEvent public static void onRenderTick(RenderTickEvent event) { if (!isGameActive()) diff --git a/src/main/java/com/simibubi/create/CreateConfig.java b/src/main/java/com/simibubi/create/CreateConfig.java index e8a0c5b47..5823c6067 100644 --- a/src/main/java/com/simibubi/create/CreateConfig.java +++ b/src/main/java/com/simibubi/create/CreateConfig.java @@ -64,6 +64,7 @@ public class CreateConfig { CreateConfig(final ForgeConfigSpec.Builder builder) { initGeneral(builder); initContraptions(builder); + initSchematics(builder); initCuriosities(builder); initLogistics(builder); initGardens(builder); @@ -256,7 +257,7 @@ public class CreateConfig { builder.pop(); } - public void initSchematics(final ForgeConfigSpec.Builder builder) { + private void initSchematics(final ForgeConfigSpec.Builder builder) { builder.comment("The Schematics Module").push("schematics"); String basePath = "create.config.schematics."; String name = ""; diff --git a/src/main/java/com/simibubi/create/foundation/block/IBlockWithScrollableValue.java b/src/main/java/com/simibubi/create/foundation/block/IBlockWithScrollableValue.java index f3fb4c8f9..eef2e3afb 100644 --- a/src/main/java/com/simibubi/create/foundation/block/IBlockWithScrollableValue.java +++ b/src/main/java/com/simibubi/create/foundation/block/IBlockWithScrollableValue.java @@ -1,6 +1,7 @@ package com.simibubi.create.foundation.block; import com.mojang.blaze3d.platform.GlStateManager; +import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.TessellatorHelper; import com.simibubi.create.foundation.utility.VecHelper; @@ -61,7 +62,7 @@ public interface IBlockWithScrollableValue { return; if (!mc.player.isAllowEdit()) return; - + IBlockWithScrollableValue block = (IBlockWithScrollableValue) state.getBlock(); Vec3d pos = new Vec3d(blockPos); @@ -76,7 +77,7 @@ public interface IBlockWithScrollableValue { cursor = VecHelper.rotate(cursor, facing == Direction.UP ? -90 : facing == Direction.DOWN ? 90 : 0, Axis.Z) .add(.5, .5, .5); boolean contains = bb.contains(cursor); - + TessellatorHelper.prepareForDrawing(); GlStateManager.enableBlend(); GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, @@ -84,7 +85,7 @@ public interface IBlockWithScrollableValue { GlStateManager.DestFactor.ZERO); GlStateManager.disableTexture(); GlStateManager.depthMask(false); - + Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(3, DefaultVertexFormats.POSITION_COLOR); @@ -122,7 +123,7 @@ public interface IBlockWithScrollableValue { if (contains) { GlStateManager.pushMatrix(); - GlStateManager.translated(bb.getZSize() + 1/32f, -1/16f, 0); + GlStateManager.translated(bb.getZSize() + 1 / 32f, -1 / 16f, 0); GlStateManager.scaled(textScale, -textScale, textScale); String text = block.getValueName(state, world, blockPos); @@ -131,7 +132,7 @@ public interface IBlockWithScrollableValue { mc.fontRenderer.drawString(text, 1, 1, 0x224433); GlStateManager.translated(0, 0, 1 / 4f); - text = TextFormatting.ITALIC + ""; + text = TextFormatting.ITALIC + "<" + Lang.translate("action.scroll") + ">"; mc.fontRenderer.drawString(text, 0, 10, 0xBBBBCC); GlStateManager.translated(0, 0, -1 / 4f); mc.fontRenderer.drawString(text, 1, 11, 0x111111); @@ -143,8 +144,8 @@ public interface IBlockWithScrollableValue { String numberText = block.getCurrentValue(state, world, blockPos) + ""; int stringWidth = mc.fontRenderer.getStringWidth(numberText); float numberScale = 4 / 128f * (6f / stringWidth); - GlStateManager.translated(7/64f, -5/64f, 0); - + GlStateManager.translated(7 / 64f, -5 / 64f, 0); + GlStateManager.scaled(numberScale, -numberScale, numberScale); mc.fontRenderer.drawString(numberText, 0, 0, 0xFFFFFF); @@ -156,12 +157,12 @@ public interface IBlockWithScrollableValue { GlStateManager.lineWidth(1); TessellatorHelper.cleanUpAfterDrawing(); } - + public static boolean onScroll(double delta) { RayTraceResult objectMouseOver = Minecraft.getInstance().objectMouseOver; if (!(objectMouseOver instanceof BlockRayTraceResult)) return false; - + BlockRayTraceResult result = (BlockRayTraceResult) objectMouseOver; Minecraft mc = Minecraft.getInstance(); ClientWorld world = mc.world; @@ -186,7 +187,7 @@ public interface IBlockWithScrollableValue { .add(.5, .5, .5); if (!bb.contains(cursor)) return false; - + block.onScroll(state, world, blockPos, delta); return true; } diff --git a/src/main/java/com/simibubi/create/foundation/block/InfoBlock.java b/src/main/java/com/simibubi/create/foundation/block/InfoBlock.java deleted file mode 100644 index 2118e9d1f..000000000 --- a/src/main/java/com/simibubi/create/foundation/block/InfoBlock.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.simibubi.create.foundation.block; - -import java.util.List; - -import com.simibubi.create.foundation.utility.ITooltip; -import com.simibubi.create.foundation.utility.TooltipHolder; - -import net.minecraft.block.Block; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.world.IBlockReader; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - -public abstract class InfoBlock extends Block implements ITooltip { - - protected TooltipHolder info; - - public InfoBlock(Properties properties) { - super(properties); - info = new TooltipHolder(this); - } - - @Override - @OnlyIn(value = Dist.CLIENT) - public void addInformation(ItemStack stack, IBlockReader worldIn, List tooltip, - ITooltipFlag flagIn) { - info.addInformation(tooltip); - } - -} diff --git a/src/main/java/com/simibubi/create/foundation/gui/TextInputPromptScreen.java b/src/main/java/com/simibubi/create/foundation/gui/TextInputPromptScreen.java index 8b582a652..934cea3d7 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/TextInputPromptScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/TextInputPromptScreen.java @@ -4,11 +4,16 @@ import java.util.function.Consumer; import org.lwjgl.glfw.GLFW; +import com.simibubi.create.foundation.utility.Lang; + import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.client.gui.widget.button.Button; public class TextInputPromptScreen extends AbstractSimiScreen { + private final String defaultConfirm = Lang.translate("action.confirm"); + private final String defaultAbort = Lang.translate("action.abort"); + private Consumer callback; private Consumer abortCallback; @@ -27,8 +32,8 @@ public class TextInputPromptScreen extends AbstractSimiScreen { this.callback = callBack; this.abortCallback = abortCallback; - buttonTextConfirm = "Confirm"; - buttonTextAbort = "Abort"; + buttonTextConfirm = defaultConfirm; + buttonTextAbort = defaultAbort; confirmed = false; } diff --git a/src/main/java/com/simibubi/create/foundation/gui/ToolSelectionScreen.java b/src/main/java/com/simibubi/create/foundation/gui/ToolSelectionScreen.java index 2be65faea..441ccd322 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/ToolSelectionScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/ToolSelectionScreen.java @@ -5,6 +5,7 @@ import java.util.function.Consumer; import com.mojang.blaze3d.platform.GlStateManager; import com.simibubi.create.AllKeys; +import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.modules.schematics.client.tools.Tools; import net.minecraft.client.MainWindow; @@ -15,12 +16,15 @@ import net.minecraft.util.text.StringTextComponent; public class ToolSelectionScreen extends Screen { + public final String scrollToCycle = Lang.translate("gui.toolmenu.cycle"); + public final String holdToFocus = "gui.toolmenu.focusKey"; + protected List tools; protected Consumer callback; public boolean focused; private float yOffset; protected int selection; - + protected int w; protected int h; @@ -32,21 +36,21 @@ public class ToolSelectionScreen extends Screen { focused = false; yOffset = 0; selection = 0; - + callback.accept(tools.get(selection)); w = Math.max(tools.size() * 50 + 30, 220); h = 30; } - + public void setSelectedElement(Tools tool) { if (!tools.contains(tool)) return; selection = tools.indexOf(tool); } - + public void cycle(int direction) { - selection += (direction < 0)? 1 : -1; + selection += (direction < 0) ? 1 : -1; selection = (selection + tools.size()) % tools.size(); } @@ -55,27 +59,27 @@ public class ToolSelectionScreen extends Screen { int x = (mainWindow.getScaledWidth() - w) / 2 + 15; int y = mainWindow.getScaledHeight() - h - 75; - + GlStateManager.pushMatrix(); - GlStateManager.translatef(0, -yOffset, focused? 100 : 0); - + GlStateManager.translatef(0, -yOffset, focused ? 100 : 0); + ScreenResources gray = ScreenResources.GRAY; GlStateManager.enableBlend(); - GlStateManager.color4f(1, 1, 1, focused? 7 / 8f : 1 / 2f); + GlStateManager.color4f(1, 1, 1, focused ? 7 / 8f : 1 / 2f); Minecraft.getInstance().getTextureManager().bindTexture(gray.location); blit(x - 15, y, gray.startX, gray.startY, w, h, gray.width, gray.height); - + float toolTipAlpha = yOffset / 10; FontRenderer font = minecraft.fontRenderer; List toolTip = tools.get(selection).getDescription(); int stringAlphaComponent = ((int) (toolTipAlpha * 0xFF)) << 24; - + if (toolTipAlpha > 0.25f) { GlStateManager.color4f(.7f, .7f, .8f, toolTipAlpha); blit(x - 15, y + 33, gray.startX, gray.startY, w, h + 22, gray.width, gray.height); GlStateManager.color4f(1, 1, 1, 1); - + if (toolTip.size() > 0) drawString(font, toolTip.get(0), x - 10, y + 38, 0xEEEEEE + stringAlphaComponent); if (toolTip.size() > 1) @@ -85,48 +89,52 @@ public class ToolSelectionScreen extends Screen { if (toolTip.size() > 3) drawString(font, toolTip.get(3), x - 10, y + 72, 0xCCCCDD + stringAlphaComponent); } - + GlStateManager.color4f(1, 1, 1, 1); if (tools.size() > 1) { String keyName = AllKeys.TOOL_MENU.getBoundKey(); int width = minecraft.mainWindow.getScaledWidth(); if (!focused) - drawCenteredString(minecraft.fontRenderer, "Hold [" + keyName + "] to focus", width/2, y - 10, 0xCCDDFF); + drawCenteredString(minecraft.fontRenderer, Lang.translate(holdToFocus, keyName), width / 2, y - 10, + 0xCCDDFF); else - drawCenteredString(minecraft.fontRenderer, "[SCROLL] to Cycle", width/2, y - 10, 0xCCDDFF); + drawCenteredString(minecraft.fontRenderer, scrollToCycle, width / 2, y - 10, 0xCCDDFF); } else { x += 65; } - + for (int i = 0; i < tools.size(); i++) { GlStateManager.pushMatrix(); - - float alpha = focused? 1 : .2f; + + float alpha = focused ? 1 : .2f; if (i == selection) { GlStateManager.translatef(0, -10, 0); - drawCenteredString(minecraft.fontRenderer, tools.get(i).getDisplayName(), x + i * 50 + 24, y + 28, 0xCCDDFF); + drawCenteredString(minecraft.fontRenderer, tools.get(i).getDisplayName(), x + i * 50 + 24, y + 28, + 0xCCDDFF); alpha = 1; } GlStateManager.color4f(0, 0, 0, alpha); tools.get(i).getIcon().draw(this, x + i * 50 + 16, y + 12); GlStateManager.color4f(1, 1, 1, alpha); tools.get(i).getIcon().draw(this, x + i * 50 + 16, y + 11); - + GlStateManager.popMatrix(); } - + GlStateManager.popMatrix(); } - + public void update() { - if (focused) yOffset += (10 - yOffset) * .1f; - else yOffset *= .9f; + if (focused) + yOffset += (10 - yOffset) * .1f; + else + yOffset *= .9f; } - + public void renderPassive(float partialTicks) { draw(partialTicks); } - + @Override public void onClose() { callback.accept(tools.get(selection)); diff --git a/src/main/java/com/simibubi/create/foundation/gui/widgets/ScrollInput.java b/src/main/java/com/simibubi/create/foundation/gui/widgets/ScrollInput.java index 7a01d7511..ccbacc6a3 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/widgets/ScrollInput.java +++ b/src/main/java/com/simibubi/create/foundation/gui/widgets/ScrollInput.java @@ -3,6 +3,7 @@ package com.simibubi.create.foundation.gui.widgets; import java.util.function.Consumer; import com.simibubi.create.AllKeys; +import com.simibubi.create.foundation.utility.Lang; import net.minecraft.util.text.TextFormatting; @@ -10,7 +11,9 @@ public class ScrollInput extends AbstractSimiWidget { protected Consumer onScroll; protected int state; - protected String title = "Choose an option"; + protected String title = Lang.translate("gui.scrollInput.defaultTitle"); + protected final String scrollToModify = Lang.translate("gui.scrollInput.scrollToModify"); + protected final String shiftScrollsFaster = Lang.translate("gui.scrollInput.shiftScrollsFaster"); protected Label displayLabel; protected int min, max; @@ -107,8 +110,8 @@ public class ScrollInput extends AbstractSimiWidget { protected void updateTooltip() { toolTip.clear(); toolTip.add(TextFormatting.BLUE + title); - toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + "Scroll to Modify"); - toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + "Shift to Scroll faster"); + toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + scrollToModify); + toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + shiftScrollsFaster); } } diff --git a/src/main/java/com/simibubi/create/foundation/gui/widgets/SelectionScrollInput.java b/src/main/java/com/simibubi/create/foundation/gui/widgets/SelectionScrollInput.java index 0c5fded72..b3e528baa 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/widgets/SelectionScrollInput.java +++ b/src/main/java/com/simibubi/create/foundation/gui/widgets/SelectionScrollInput.java @@ -3,10 +3,13 @@ package com.simibubi.create.foundation.gui.widgets; import java.util.ArrayList; import java.util.List; +import com.simibubi.create.foundation.utility.Lang; + import net.minecraft.util.text.TextFormatting; public class SelectionScrollInput extends ScrollInput { + private final String scrollToSelect = Lang.translate("gui.scrollInput.scrollToSelect"); protected List options; public SelectionScrollInput(int xIn, int yIn, int widthIn, int heightIn) { @@ -25,7 +28,7 @@ public class SelectionScrollInput extends ScrollInput { protected void writeToLabel() { displayLabel.text = options.get(state); } - + @Override public boolean mouseScrolled(double mouseX, double mouseY, double delta) { return super.mouseScrolled(mouseX, mouseY, -delta); @@ -33,7 +36,8 @@ public class SelectionScrollInput extends ScrollInput { @Override protected void updateTooltip() { - super.updateTooltip(); + toolTip.clear(); + toolTip.add(TextFormatting.BLUE + title); for (int i = min; i < max; i++) { StringBuilder result = new StringBuilder(); if (i == state) @@ -42,7 +46,7 @@ public class SelectionScrollInput extends ScrollInput { result.append(TextFormatting.GRAY).append("> ").append(options.get(i)); toolTip.add(result.toString()); } - toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + "Scroll to Select"); + toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + scrollToSelect); } } diff --git a/src/main/java/com/simibubi/create/foundation/item/AbstractToolItem.java b/src/main/java/com/simibubi/create/foundation/item/AbstractToolItem.java index 441c75be6..49dff47b6 100644 --- a/src/main/java/com/simibubi/create/foundation/item/AbstractToolItem.java +++ b/src/main/java/com/simibubi/create/foundation/item/AbstractToolItem.java @@ -9,11 +9,7 @@ import static com.simibubi.create.foundation.item.AllToolTypes.SWORD; import java.util.Collections; import java.util.List; -import com.simibubi.create.foundation.utility.ITooltip; -import com.simibubi.create.foundation.utility.TooltipHolder; - import net.minecraft.block.BlockState; -import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.IItemTier; import net.minecraft.item.ItemStack; @@ -22,7 +18,6 @@ import net.minecraft.item.Items; import net.minecraft.item.ToolItem; import net.minecraft.util.ActionResultType; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.ITextComponent; import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraftforge.common.ToolType; @@ -31,15 +26,13 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @EventBusSubscriber -public abstract class AbstractToolItem extends ToolItem implements ITooltip { +public abstract class AbstractToolItem extends ToolItem { - protected TooltipHolder info; protected AllToolTypes[] toolTypes; public AbstractToolItem(float attackDamageIn, float attackSpeedIn, IItemTier tier, Properties builder, AllToolTypes... types) { super(attackDamageIn, attackSpeedIn, tier, Collections.emptySet(), setToolTypes(builder, tier, types)); - info = new TooltipHolder(this); toolTypes = types; } @@ -62,12 +55,6 @@ public abstract class AbstractToolItem extends ToolItem implements ITooltip { return false; } - @Override - public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { - info.addInformation(tooltip); - super.addInformation(stack, worldIn, tooltip, flagIn); - } - @Override public ActionResultType onItemUse(ItemUseContext context) { if (hasType(HOE) && !context.isPlacerSneaking()) diff --git a/src/main/java/com/simibubi/create/foundation/item/InfoItem.java b/src/main/java/com/simibubi/create/foundation/item/InfoItem.java deleted file mode 100644 index 3797ee202..000000000 --- a/src/main/java/com/simibubi/create/foundation/item/InfoItem.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.simibubi.create.foundation.item; - -import java.util.List; - -import com.simibubi.create.foundation.utility.ITooltip; -import com.simibubi.create.foundation.utility.TooltipHolder; - -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.world.World; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - -public abstract class InfoItem extends Item implements ITooltip { - - protected TooltipHolder info; - - public InfoItem(Properties properties) { - super(properties); - info = new TooltipHolder(this); - } - - @Override - @OnlyIn(value = Dist.CLIENT) - public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { - info.addInformation(tooltip); - } - -} diff --git a/src/main/java/com/simibubi/create/foundation/utility/ContainerListener.java b/src/main/java/com/simibubi/create/foundation/utility/ContainerListener.java deleted file mode 100644 index 617471b7b..000000000 --- a/src/main/java/com/simibubi/create/foundation/utility/ContainerListener.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.simibubi.create.foundation.utility; - -public class ContainerListener { - - - -} diff --git a/src/main/java/com/simibubi/create/foundation/utility/ITooltip.java b/src/main/java/com/simibubi/create/foundation/utility/ITooltip.java deleted file mode 100644 index f6ad252c7..000000000 --- a/src/main/java/com/simibubi/create/foundation/utility/ITooltip.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.simibubi.create.foundation.utility; - -import com.simibubi.create.foundation.utility.ItemDescription.Palette; - -public interface ITooltip { - - public ItemDescription getDescription(); - - public default String h(String s, Palette palette) { - return ItemDescription.hightlight(s, palette); - } - -} diff --git a/src/main/java/com/simibubi/create/foundation/utility/ItemDescription.java b/src/main/java/com/simibubi/create/foundation/utility/ItemDescription.java index 7106cae78..83002860f 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/ItemDescription.java +++ b/src/main/java/com/simibubi/create/foundation/utility/ItemDescription.java @@ -1,5 +1,6 @@ package com.simibubi.create.foundation.utility; +import static com.simibubi.create.foundation.utility.TooltipHelper.cutString; import static net.minecraft.util.text.TextFormatting.AQUA; import static net.minecraft.util.text.TextFormatting.BLUE; import static net.minecraft.util.text.TextFormatting.DARK_GRAY; @@ -26,13 +27,16 @@ import net.minecraft.util.text.TextFormatting; public class ItemDescription { - public static final int maxCharsPerLine = 35; + public static final ItemDescription MISSING = new ItemDescription(null); public static ITextComponent trim = new StringTextComponent( WHITE + "" + STRIKETHROUGH + " "); public enum Palette { - Blue(BLUE, AQUA), Green(DARK_GREEN, GREEN), Yellow(GOLD, YELLOW), Red(DARK_RED, RED), + Blue(BLUE, AQUA), + Green(DARK_GREEN, GREEN), + Yellow(GOLD, YELLOW), + Red(DARK_RED, RED), Purple(DARK_PURPLE, LIGHT_PURPLE), ; @@ -56,24 +60,23 @@ public class ItemDescription { lines = new ArrayList<>(); linesOnShift = new ArrayList<>(); linesOnCtrl = new ArrayList<>(); - trim = new StringTextComponent(WHITE + "" + STRIKETHROUGH + " "); } public ItemDescription withSummary(String summary) { - add(linesOnShift, cutString(summary, palette.color)); - linesOnShift.add(trim); + add(linesOnShift, cutString(summary, palette.color, palette.hColor)); + add(linesOnShift, ""); return this; } public ItemDescription withBehaviour(String condition, String behaviour) { add(linesOnShift, GRAY + condition); - add(linesOnShift, cutString(behaviour, palette.color, 1)); + add(linesOnShift, cutString(behaviour, palette.color, palette.hColor, 1)); return this; } public ItemDescription withControl(String condition, String action) { add(linesOnCtrl, GRAY + condition); - add(linesOnCtrl, cutString(action, palette.color, 1)); + add(linesOnCtrl, cutString(action, palette.color, palette.hColor, 1)); return this; } @@ -96,15 +99,15 @@ public class ItemDescription { list.add(0, new StringTextComponent(tabs)); if (shift || ctrl) - list.add(1, trim); + list.add(1, new StringTextComponent("")); } } - + if (!hasDescription) linesOnShift = lines; if (!hasControls) linesOnCtrl = lines; - + return this; } @@ -112,42 +115,6 @@ public class ItemDescription { return palette.hColor + s + palette.color; } - public List cutString(String s, TextFormatting defaultColor) { - return cutString(s, defaultColor, 0); - } - - public List cutString(String s, TextFormatting defaultColor, int indent) { - - String lineStart = defaultColor.toString(); - for (int i = 0; i < indent; i++) - lineStart += " "; - - String[] words = s.split(" "); - List lines = new ArrayList<>(); - StringBuilder currentLine = new StringBuilder(lineStart); - boolean firstWord = true; - - for (int i = 0; i < words.length; i++) { - String word = words[i]; - boolean lastWord = i == words.length - 1; - - if (!lastWord && !firstWord && currentLine.length() + word.length() > maxCharsPerLine) { - lines.add(currentLine.toString()); - currentLine = new StringBuilder(lineStart); - firstWord = true; - } - - currentLine.append((firstWord ? "" : " ") + word); - firstWord = false; - } - - if (!firstWord) { - lines.add(currentLine.toString()); - } - - return lines; - } - public static void add(List infoList, List textLines) { textLines.forEach(s -> add(infoList, s)); } diff --git a/src/main/java/com/simibubi/create/foundation/utility/Lang.java b/src/main/java/com/simibubi/create/foundation/utility/Lang.java new file mode 100644 index 000000000..a095dafb7 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/utility/Lang.java @@ -0,0 +1,33 @@ +package com.simibubi.create.foundation.utility; + +import java.util.ArrayList; +import java.util.List; + +import com.simibubi.create.Create; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.text.TranslationTextComponent; + +public class Lang { + + public static String translate(String key, Object... args) { + return getTranslationComponent(key, args).getFormattedText(); + } + + private static TranslationTextComponent getTranslationComponent(String key, Object... args) { + return new TranslationTextComponent(Create.ID + "." + key, args); + } + + public static void sendStatus(PlayerEntity player, String key, Object... args) { + player.sendStatusMessage(getTranslationComponent(key, args), true); + } + + public static List translatedOptions(String prefix, String... keys) { + List result = new ArrayList<>(keys.length); + for (String key : keys) { + result.add(translate(prefix + "." + key)); + } + return result; + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/utility/TooltipHelper.java b/src/main/java/com/simibubi/create/foundation/utility/TooltipHelper.java new file mode 100644 index 000000000..f100ae595 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/utility/TooltipHelper.java @@ -0,0 +1,151 @@ +package com.simibubi.create.foundation.utility; + +import static net.minecraft.util.text.TextFormatting.DARK_GRAY; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.mojang.bridge.game.Language; +import com.simibubi.create.foundation.utility.ItemDescription.Palette; +import com.simibubi.create.modules.IModule; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemStack; +import net.minecraft.util.text.TextFormatting; + +public class TooltipHelper { + + public static final int maxCharsPerLine = 35; + public static final Map cachedTooltips = new HashMap<>(); + public static Language cachedLanguage; + + public static String holdShift(Palette color, boolean highlighted) { + TextFormatting colorFormat = highlighted ? color.hColor : color.color; + return DARK_GRAY + + Lang.translate("tooltip.holdKey", colorFormat + Lang.translate("tooltip.keyShift") + DARK_GRAY); + } + + public static List cutString(String s, TextFormatting defaultColor, TextFormatting highlightColor) { + return cutString(s, defaultColor, highlightColor, 0); + } + + public static List cutString(String s, TextFormatting defaultColor, TextFormatting highlightColor, + int indent) { + String lineStart = defaultColor.toString(); + for (int i = 0; i < indent; i++) + lineStart += " "; + + String[] words = s.split(" "); + List lines = new ArrayList<>(); + StringBuilder currentLine = new StringBuilder(lineStart); + boolean firstWord = true; + + for (int i = 0; i < words.length; i++) { + String word = words[i]; + if (word.matches("_.+_")) { + word = highlightColor + word.substring(1, word.length() - 1) + defaultColor; + } + + boolean lastWord = i == words.length - 1; + + if (!lastWord && !firstWord && currentLine.length() + word.length() > maxCharsPerLine) { + lines.add(currentLine.toString()); + currentLine = new StringBuilder(lineStart); + firstWord = true; + } + + currentLine.append((firstWord ? "" : " ") + word); + firstWord = false; + } + + if (!firstWord) { + lines.add(currentLine.toString()); + } + + return lines; + } + + private static void checkLocale() { + Language currentLanguage = Minecraft.getInstance().getLanguageManager().getCurrentLanguage(); + if (cachedLanguage != currentLanguage) { + cachedTooltips.clear(); + cachedLanguage = currentLanguage; + } + } + + public static boolean hasTooltip(ItemStack stack) { + checkLocale(); + cachedTooltips.clear(); + String key = getTooltipTranslationKey(stack); + if (cachedTooltips.containsKey(key)) + return cachedTooltips.get(key) != ItemDescription.MISSING; + return findTooltip(stack); + } + + public static ItemDescription getTooltip(ItemStack stack) { + checkLocale(); + String key = getTooltipTranslationKey(stack); + if (cachedTooltips.containsKey(key)) { + ItemDescription itemDescription = cachedTooltips.get(key); + if (itemDescription != ItemDescription.MISSING) + return itemDescription; + } + return null; + } + + private static boolean findTooltip(ItemStack stack) { + String key = getTooltipTranslationKey(stack); + if (I18n.hasKey(key)) { + cachedTooltips.put(key, buildToolTip(key, IModule.of(stack))); + return true; + } + cachedTooltips.put(key, ItemDescription.MISSING); + return false; + } + + private static ItemDescription buildToolTip(String translationKey, IModule module) { + ItemDescription tooltip = new ItemDescription(module.getToolTipColor()); + String summaryKey = translationKey + ".summary"; + + // Summary + if (I18n.hasKey(summaryKey)) + tooltip = tooltip.withSummary(I18n.format(summaryKey)); + + // Behaviours + for (int i = 1; i < 100; i++) { + String conditionKey = translationKey + ".condition" + i; + String behaviourKey = translationKey + ".behaviour" + i; + if (!I18n.hasKey(conditionKey)) + break; + tooltip.withBehaviour(I18n.format(conditionKey), I18n.format(behaviourKey)); + } + + // Controls + for (int i = 1; i < 100; i++) { + String controlKey = translationKey + ".control" + i; + String actionKey = translationKey + ".action" + i; + if (!I18n.hasKey(controlKey)) + break; + tooltip.withControl(I18n.format(controlKey), I18n.format(actionKey)); + } + + return tooltip.createTabs(); + } + + public static String getTooltipTranslationKey(ItemStack stack) { + if (stack.getItem() instanceof BlockItem) { + return getTooltipTranslationKey(((BlockItem) stack.getItem()).getBlock()); + } + return stack.getItem().getTranslationKey() + ".tooltip"; + } + + public static String getTooltipTranslationKey(Block block) { + return block.getTranslationKey() + ".tooltip"; + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/utility/TooltipHolder.java b/src/main/java/com/simibubi/create/foundation/utility/TooltipHolder.java deleted file mode 100644 index 2c2dc7450..000000000 --- a/src/main/java/com/simibubi/create/foundation/utility/TooltipHolder.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.simibubi.create.foundation.utility; - -import java.util.List; - -import net.minecraft.util.text.ITextComponent; - -public class TooltipHolder { - - private ItemDescription toolTip; - - public TooltipHolder(ITooltip item) { - toolTip = item.getDescription(); - } - - public void addInformation(List tooltip) { - toolTip.addInformation(tooltip); - } - -} diff --git a/src/main/java/com/simibubi/create/modules/IModule.java b/src/main/java/com/simibubi/create/modules/IModule.java index 53baa417a..283f50fbf 100644 --- a/src/main/java/com/simibubi/create/modules/IModule.java +++ b/src/main/java/com/simibubi/create/modules/IModule.java @@ -1,6 +1,14 @@ package com.simibubi.create.modules; +import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllItems; import com.simibubi.create.CreateConfig; +import com.simibubi.create.foundation.utility.ItemDescription.Palette; + +import net.minecraft.block.Block; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; public interface IModule { @@ -26,6 +34,53 @@ public interface IModule { return false; } } + + public default Palette getToolTipColor() { + String module = getModuleName(); + + if (module.equals("materials")) + return Palette.Purple; + + switch (module) { + case "contraptions": + return Palette.Red; + case "palettes": + return Palette.Yellow; + case "curiosities": + return Palette.Purple; + case "logistics": + return Palette.Yellow; + case "schematics": + return Palette.Blue; + case "gardens": + return Palette.Green; + default: + return Palette.Purple; + } + } + + public static IModule of(ItemStack stack) { + Item item = stack.getItem(); + if (item instanceof BlockItem) + return ofBlock(((BlockItem) item).getBlock()); + return ofItem(item); + } + + static IModule ofItem(Item item) { + for (AllItems allItems : AllItems.values()) { + if (allItems.get() == item) + return allItems.module; + } + return null; + } + + static IModule ofBlock(Block block) { + for (AllBlocks allBlocks : AllBlocks.values()) { + if (allBlocks.get() == block) + return allBlocks.module; + } + return null; + } public default boolean isEnabled() { return isActive(getModuleName()); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticBlock.java index f41b881ad..3ec2e3b67 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticBlock.java @@ -1,9 +1,9 @@ package com.simibubi.create.modules.contraptions.base; -import com.simibubi.create.foundation.block.InfoBlock; import com.simibubi.create.foundation.utility.ItemDescription.Palette; import com.simibubi.create.modules.contraptions.RotationPropagator; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.material.PushReaction; import net.minecraft.tileentity.TileEntity; @@ -15,7 +15,7 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; import net.minecraft.world.World; -public abstract class KineticBlock extends InfoBlock implements IRotate { +public abstract class KineticBlock extends Block implements IRotate { protected static final Palette color = Palette.Red; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/generators/MotorBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/generators/MotorBlock.java index b8a37aaef..faffc09a4 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/generators/MotorBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/generators/MotorBlock.java @@ -2,7 +2,7 @@ package com.simibubi.create.modules.contraptions.generators; import com.simibubi.create.foundation.block.IBlockWithScrollableValue; import com.simibubi.create.foundation.block.IWithTileEntity; -import com.simibubi.create.foundation.utility.ItemDescription; +import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock; import net.minecraft.block.BlockState; @@ -57,15 +57,6 @@ public class MotorBlock extends HorizontalKineticBlock return true; } - // IToolTip - - @Override - public ItemDescription getDescription() { - return new ItemDescription(color).withSummary("Provides Rotational Power.") - .withControl("When R-Clicked", "Opens the " + h("Configuration Screen", color)).createTabs(); - - } - @Override public int getCurrentValue(BlockState state, IWorld world, BlockPos pos) { MotorTileEntity tileEntity = (MotorTileEntity) world.getTileEntity(pos); @@ -81,7 +72,7 @@ public class MotorBlock extends HorizontalKineticBlock @Override public String getValueName(BlockState state, IWorld world, BlockPos pos) { - return "Speed"; + return Lang.translate("generic.speed"); } @Override diff --git a/src/main/java/com/simibubi/create/modules/contraptions/generators/WaterWheelBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/generators/WaterWheelBlock.java index 6749ca058..374e568e9 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/generators/WaterWheelBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/generators/WaterWheelBlock.java @@ -1,7 +1,6 @@ package com.simibubi.create.modules.contraptions.generators; import com.simibubi.create.AllBlocks; -import com.simibubi.create.foundation.utility.ItemDescription; import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock; import net.minecraft.block.BlockState; @@ -132,10 +131,4 @@ public class WaterWheelBlock extends HorizontalKineticBlock { return state.get(HORIZONTAL_FACING).getAxis(); } - @Override - public ItemDescription getDescription() { - return new ItemDescription(color).withSummary("Creates Rotational Power from " + h("Water streams", color) + " around it.") - .createTabs(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelBlock.java index 7af651eff..9f5fbccb5 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/CrushingWheelBlock.java @@ -3,7 +3,6 @@ package com.simibubi.create.modules.contraptions.receivers; import static com.simibubi.create.modules.contraptions.receivers.CrushingWheelControllerBlock.VALID; import com.simibubi.create.AllBlocks; -import com.simibubi.create.foundation.utility.ItemDescription; import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock; @@ -167,14 +166,4 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock { return false; } - @Override - public ItemDescription getDescription() { - return new ItemDescription(color) - .withSummary("Using rotational force, two of these Wheels can grind up anything that falls into them.") - .withBehaviour("When next other Wheel", - "Grinds up Mobs, Players and Items into their components. Wheels have to rotate at exact " - + h("Opposite Speeds", color) + ", dragging inputs into them from above.") - .createTabs(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/DrillBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/DrillBlock.java index 2eee59dd5..8fe0ec51b 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/DrillBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/DrillBlock.java @@ -2,7 +2,6 @@ package com.simibubi.create.modules.contraptions.receivers; import java.util.List; -import com.simibubi.create.foundation.utility.ItemDescription; import com.simibubi.create.modules.contraptions.base.DirectionalKineticBlock; import com.simibubi.create.modules.contraptions.base.IRotate; import com.simibubi.create.modules.contraptions.receivers.constructs.IHaveMovementBehavior; @@ -168,14 +167,4 @@ public class DrillBlock extends DirectionalKineticBlock implements IHaveMovement return false; } - @Override - public ItemDescription getDescription() { - return new ItemDescription(color) - .withSummary("Using Rotational Force, this component can break blocks in front of it.") - .withBehaviour("When Rotated", h("Breaks blocks", color) + " right in front of it.") - .withBehaviour("When being pushed by Mechanical Piston", - h("Breaks the Blocks", color) + " it is being pushed into.") - .createTabs(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/EncasedFanBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/EncasedFanBlock.java index 51b1fe268..ea253fccd 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/EncasedFanBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/EncasedFanBlock.java @@ -1,7 +1,6 @@ package com.simibubi.create.modules.contraptions.receivers; import com.simibubi.create.foundation.block.IWithTileEntity; -import com.simibubi.create.foundation.utility.ItemDescription; import com.simibubi.create.modules.contraptions.relays.EncasedShaftBlock; import net.minecraft.block.Block; @@ -16,11 +15,6 @@ import net.minecraft.world.World; public class EncasedFanBlock extends EncasedShaftBlock implements IWithTileEntity { - @Override - public ItemDescription getDescription() { - return new ItemDescription(color).withSummary("Exchange rotational power for air flow and back.").createTabs(); - } - @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) { return new EncasedFanTileEntity(); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/HarvesterBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/HarvesterBlock.java index 6ffc4cd60..d0cbb36d7 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/HarvesterBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/HarvesterBlock.java @@ -3,10 +3,6 @@ package com.simibubi.create.modules.contraptions.receivers; import java.util.List; import com.simibubi.create.AllBlocks; -import com.simibubi.create.foundation.utility.ITooltip; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; -import com.simibubi.create.foundation.utility.TooltipHolder; import com.simibubi.create.modules.contraptions.receivers.constructs.IHaveMovementBehavior; import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalPistonTileEntity; @@ -16,7 +12,6 @@ import net.minecraft.block.Blocks; import net.minecraft.block.CropsBlock; import net.minecraft.block.HorizontalBlock; import net.minecraft.block.SugarCaneBlock; -import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemStack; @@ -31,24 +26,20 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.util.text.ITextComponent; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; import net.minecraftforge.common.IPlantable; -public class HarvesterBlock extends HorizontalBlock implements IHaveMovementBehavior, ITooltip { +public class HarvesterBlock extends HorizontalBlock implements IHaveMovementBehavior { public static final VoxelShape SHAPE_SOUTH = makeCuboidShape(0, 4, 0, 16, 12, 6), SHAPE_NORTH = makeCuboidShape(0, 4, 10, 16, 12, 16), SHAPE_WEST = makeCuboidShape(10, 4, 0, 16, 12, 16), SHAPE_EAST = makeCuboidShape(0, 4, 0, 6, 12, 16); - private TooltipHolder info; - public HarvesterBlock() { super(Properties.from(Blocks.IRON_BLOCK)); - info = new TooltipHolder(this); } @Override @@ -208,20 +199,4 @@ public class HarvesterBlock extends HorizontalBlock implements IHaveMovementBeha return Blocks.AIR.getDefaultState(); } - @Override - public void addInformation(ItemStack stack, IBlockReader worldIn, List tooltip, - ITooltipFlag flagIn) { - info.addInformation(tooltip); - } - - @Override - public ItemDescription getDescription() { - Palette color = Palette.Red; - return new ItemDescription(color).withSummary("Ideal for cutting crops using Mechanical Constructs.") - .withBehaviour("When pushed by Mechanical Piston", - "Cuts Crops to their initial growth state and drops their harvest.") - .createTabs(); - - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalPressBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalPressBlock.java index 420ee4865..c89ab4b66 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalPressBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalPressBlock.java @@ -7,8 +7,6 @@ import java.util.Optional; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.block.IRenderUtilityBlock; import com.simibubi.create.foundation.block.IWithTileEntity; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock; import com.simibubi.create.modules.contraptions.relays.belt.AllBeltAttachments.BeltAttachmentState; @@ -48,12 +46,6 @@ public class MechanicalPressBlock extends HorizontalKineticBlock return SHAPE; } - @Override - public ItemDescription getDescription() { - Palette color = Palette.Red; - return new ItemDescription(color).withSummary("Applies pressure to items below it.").createTabs(); - } - @Override public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/TurntableBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/TurntableBlock.java index 418dd4701..7412ecf8b 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/TurntableBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/TurntableBlock.java @@ -1,6 +1,5 @@ package com.simibubi.create.modules.contraptions.receivers; -import com.simibubi.create.foundation.utility.ItemDescription; import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.modules.contraptions.base.KineticBlock; import com.simibubi.create.modules.contraptions.base.KineticTileEntity; @@ -106,10 +105,4 @@ public class TurntableBlock extends KineticBlock { return false; } - @Override - public ItemDescription getDescription() { - return new ItemDescription(color).withSummary("Turns rotational Force into raw Motion Sickness.") - .withBehaviour("When Rotated", "Rotates any Entities standing on top.").createTabs(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/AbstractChassisBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/AbstractChassisBlock.java index 35af0d582..fb5fa52c6 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/AbstractChassisBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/AbstractChassisBlock.java @@ -2,6 +2,7 @@ package com.simibubi.create.modules.contraptions.receivers.constructs; import com.simibubi.create.foundation.block.IBlockWithScrollableValue; import com.simibubi.create.foundation.block.IWithTileEntity; +import com.simibubi.create.foundation.utility.Lang; import net.minecraft.block.BlockState; import net.minecraft.block.RotatedPillarBlock; @@ -75,7 +76,7 @@ public abstract class AbstractChassisBlock extends RotatedPillarBlock @Override public String getValueName(BlockState state, IWorld world, BlockPos pos) { - return "Range"; + return Lang.translate("generic.range"); } @Override diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalBearingBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalBearingBlock.java index 8caab484b..cada4e80d 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalBearingBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalBearingBlock.java @@ -1,8 +1,6 @@ package com.simibubi.create.modules.contraptions.receivers.constructs; import com.simibubi.create.foundation.block.IWithTileEntity; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; import com.simibubi.create.modules.contraptions.base.DirectionalKineticBlock; import net.minecraft.block.Block; @@ -21,14 +19,6 @@ public class MechanicalBearingBlock extends DirectionalKineticBlock super(Properties.from(Blocks.PISTON)); } - @Override - public ItemDescription getDescription() { - Palette color = Palette.Red; - return new ItemDescription(color) - .withSummary("Rotates attached structures around its axis. Can be used to generate rotational energy.") - .createTabs(); - } - @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) { return new MechanicalBearingTileEntity(); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalPistonBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalPistonBlock.java index 4a57f7548..2ced37da1 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalPistonBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalPistonBlock.java @@ -2,7 +2,6 @@ package com.simibubi.create.modules.contraptions.receivers.constructs; import com.simibubi.create.AllBlocks; import com.simibubi.create.CreateConfig; -import com.simibubi.create.foundation.utility.ItemDescription; import com.simibubi.create.modules.contraptions.base.KineticBlock; import net.minecraft.block.Block; @@ -197,12 +196,4 @@ public class MechanicalPistonBlock extends KineticBlock { return VoxelShapes.fullCube(); } - @Override - public ItemDescription getDescription() { - return new ItemDescription(color) - .withSummary("With " + h("Piston Poles", color) + " at the rear, will " - + h("move Attached Structures", color) + " based on its input rotation speed.") - .withBehaviour("When Rotated", "Translates attached Structure accordingly.").createTabs(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MovingConstructHandler.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MovingConstructHandler.java index 5f92019dc..db1e88ad1 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MovingConstructHandler.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MovingConstructHandler.java @@ -36,19 +36,19 @@ public class MovingConstructHandler { public void onLoadWorld(IWorld world) { movingPistons.put(world, new ArrayList<>()); - Create.logger.info("Prepared Construct List for " + world.getDimension().getType().getRegistryName()); + Create.logger.debug("Prepared Construct List for " + world.getDimension().getType().getRegistryName()); } public void onUnloadWorld(IWorld world) { movingPistons.remove(world); - Create.logger.info("Removed Construct List for " + world.getDimension().getType().getRegistryName()); + Create.logger.debug("Removed Construct List for " + world.getDimension().getType().getRegistryName()); } public static void moveEntities(MechanicalPistonTileEntity te, float movementSpeed, Direction movementDirection, float newOffset) { if (TranslationConstruct.isFrozen()) return; - + World world = te.getWorld(); Vec3d movementVec = new Vec3d(te.getBlockState().get(BlockStateProperties.FACING).getDirectionVec()); TranslationConstruct construct = te.movingConstruct; @@ -135,7 +135,6 @@ public class MovingConstructHandler { } } - if (!allowedMovement.equals(movement)) { if (allowedMovement.y != movement.y) { entity.fall(entity.fallDistance, 1); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/PistonPoleBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/PistonPoleBlock.java index f227ad990..0df3d5d55 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/PistonPoleBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/PistonPoleBlock.java @@ -1,22 +1,14 @@ package com.simibubi.create.modules.contraptions.receivers.constructs; -import java.util.List; - import com.simibubi.create.AllBlocks; import com.simibubi.create.CreateConfig; import com.simibubi.create.foundation.block.ProperDirectionalBlock; -import com.simibubi.create.foundation.utility.ITooltip; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.TooltipHolder; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalPistonBlock.PistonState; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; -import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItemUseContext; -import net.minecraft.item.ItemStack; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; @@ -25,27 +17,15 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.util.text.ITextComponent; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -public class PistonPoleBlock extends ProperDirectionalBlock implements ITooltip { +public class PistonPoleBlock extends ProperDirectionalBlock { - private TooltipHolder info; public PistonPoleBlock() { super(Properties.from(Blocks.PISTON_HEAD)); setDefaultState(getDefaultState().with(FACING, Direction.UP)); - info = new TooltipHolder(this); - } - - @Override - @OnlyIn(value = Dist.CLIENT) - public void addInformation(ItemStack stack, IBlockReader worldIn, List tooltip, - ITooltipFlag flagIn) { - info.addInformation(tooltip); } @Override @@ -112,12 +92,4 @@ public class PistonPoleBlock extends ProperDirectionalBlock implements ITooltip return getDefaultState().with(FACING, context.getFace().getOpposite()); } - @Override - public ItemDescription getDescription() { - Palette color = Palette.Red; - return new ItemDescription(color).withSummary( - "Attach to the back of a " + h("Mechanical Piston", color) + " to increase its extension length.") - .createTabs(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/RotationChassisBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/RotationChassisBlock.java index 52be5d370..b4098ac30 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/RotationChassisBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/RotationChassisBlock.java @@ -1,5 +1,7 @@ package com.simibubi.create.modules.contraptions.receivers.constructs; +import com.simibubi.create.foundation.utility.Lang; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -31,7 +33,7 @@ public class RotationChassisBlock extends AbstractChassisBlock { @Override public String getValueName(BlockState state, IWorld world, BlockPos pos) { - return "Radius"; + return Lang.translate("generic.radius"); } @Override diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/ClutchBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/ClutchBlock.java index 13a7b20ca..2205548f7 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/ClutchBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/ClutchBlock.java @@ -1,8 +1,5 @@ package com.simibubi.create.modules.contraptions.relays; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; - import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockReader; @@ -14,12 +11,4 @@ public class ClutchBlock extends GearshiftBlock { return new ClutchTileEntity(); } - @Override - public ItemDescription getDescription() { - Palette color = Palette.Red; - return new ItemDescription(color).withSummary("A controllable rotation switch for connected shafts.") - .withBehaviour("When Powered", h("Stops", color) + " conveying rotation to the other side.") - .createTabs(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/EncasedBeltBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/EncasedBeltBlock.java index c125eb0a6..fea9e9363 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/EncasedBeltBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/EncasedBeltBlock.java @@ -1,7 +1,6 @@ package com.simibubi.create.modules.contraptions.relays; import com.google.common.base.Predicates; -import com.simibubi.create.foundation.utility.ItemDescription; import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock; import net.minecraft.block.Block; @@ -104,13 +103,4 @@ public class EncasedBeltBlock extends RotatedPillarKineticBlock { return true; } - @Override - public ItemDescription getDescription() { - return new ItemDescription(color) - .withSummary("Relays rotation through its block and to an attached Encased Belt.") - .withBehaviour("When Attached to other Encased Belt", - "Attached Block will have the exact same rotation speed and direction. Attached Belts do not have to face the same way.") - .createTabs(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/EncasedShaftBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/EncasedShaftBlock.java index 1816fe06d..9301eb08f 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/EncasedShaftBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/EncasedShaftBlock.java @@ -1,6 +1,5 @@ package com.simibubi.create.modules.contraptions.relays; -import com.simibubi.create.foundation.utility.ItemDescription; import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock; import net.minecraft.block.BlockState; @@ -52,10 +51,4 @@ public class EncasedShaftBlock extends RotatedPillarKineticBlock { return state.get(AXIS); } - @Override - public ItemDescription getDescription() { - return new ItemDescription(color) - .withSummary("Relays a rotation through its block, similar to an exposed Axle.").createTabs(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/GearboxBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/GearboxBlock.java index 8314cf8f5..2abc89192 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/GearboxBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/GearboxBlock.java @@ -1,6 +1,5 @@ package com.simibubi.create.modules.contraptions.relays; -import com.simibubi.create.foundation.utility.ItemDescription; import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock; import net.minecraft.block.BlockState; @@ -40,12 +39,4 @@ public class GearboxBlock extends RotatedPillarKineticBlock { return true; } - // IToolTip - - @Override - public ItemDescription getDescription() { - return new ItemDescription(color) - .withSummary("Relays Rotation to Four directions. Reverses straight connections.").createTabs(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/GearshiftBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/GearshiftBlock.java index 794966272..31a792392 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/GearshiftBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/GearshiftBlock.java @@ -1,7 +1,5 @@ package com.simibubi.create.modules.contraptions.relays; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; import com.simibubi.create.modules.contraptions.RotationPropagator; import com.simibubi.create.modules.contraptions.base.KineticTileEntity; @@ -31,13 +29,6 @@ public class GearshiftBlock extends EncasedShaftBlock { return new GearshiftTileEntity(); } - @Override - public ItemDescription getDescription() { - Palette color = Palette.Red; - return new ItemDescription(color).withSummary("A controllable rotation switch for connected shafts.") - .withBehaviour("When Powered", h("Reverses", color) + " the incoming rotation on the other side.").createTabs(); - } - @Override protected void fillStateContainer(Builder builder) { builder.add(POWERED); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/ShaftBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/ShaftBlock.java index c5a9915b8..58b033073 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/ShaftBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/ShaftBlock.java @@ -1,6 +1,5 @@ package com.simibubi.create.modules.contraptions.relays; -import com.simibubi.create.foundation.utility.ItemDescription; import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock; import net.minecraft.block.BlockState; @@ -62,10 +61,4 @@ public class ShaftBlock extends RotatedPillarKineticBlock { return state.get(AXIS); } - @Override - public ItemDescription getDescription() { - return new ItemDescription(color).withSummary("A straight connection for rotating blocks along its axis.") - .createTabs(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java index 4d8dc0e47..905be6235 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java @@ -7,7 +7,6 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.foundation.block.IWithTileEntity; import com.simibubi.create.foundation.block.IWithoutBlockItem; -import com.simibubi.create.foundation.utility.ItemDescription; import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltTileEntity.TransportedEntityInfo; @@ -24,9 +23,9 @@ import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; -import net.minecraft.util.Hand; import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.AxisDirection; +import net.minecraft.util.Hand; import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; @@ -411,9 +410,4 @@ public class BeltBlock extends HorizontalKineticBlock implements IWithoutBlockIt return shape; } - @Override - public ItemDescription getDescription() { - return new ItemDescription(color); - } - } diff --git a/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/BuilderGunItem.java b/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/BuilderGunItem.java index d1c91e3b4..8c4831f24 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/BuilderGunItem.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/BuilderGunItem.java @@ -12,10 +12,10 @@ import com.simibubi.create.AllItems; import com.simibubi.create.AllPackets; import com.simibubi.create.Create; import com.simibubi.create.foundation.gui.ScreenOpener; -import com.simibubi.create.foundation.item.InfoItem; import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.ItemDescription; import com.simibubi.create.foundation.utility.ItemDescription.Palette; +import com.simibubi.create.foundation.utility.Lang; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -27,6 +27,7 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.fluid.IFluidState; +import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUseContext; @@ -62,19 +63,19 @@ import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.network.PacketDistributor; -public class BuilderGunItem extends InfoItem { +public class BuilderGunItem extends Item { public static enum ComponentTier { - None(TextFormatting.DARK_GRAY + "Andesite Alloy"), - BlazeBrass(TextFormatting.GOLD + "Blaze Brass"), - ChorusChrome(TextFormatting.LIGHT_PURPLE + "Chorus Chrome"), + None(TextFormatting.DARK_GRAY), + BlazeBrass(TextFormatting.GOLD), + ChorusChrome(TextFormatting.LIGHT_PURPLE), ; - protected String displayName; + protected TextFormatting color; - private ComponentTier(String displayName) { - this.displayName = displayName; + private ComponentTier(TextFormatting color) { + this.color = color; } } @@ -91,36 +92,25 @@ public class BuilderGunItem extends InfoItem { return UseAction.NONE; } - @Override - public ItemDescription getDescription() { - Palette palette = Palette.Purple; - return new ItemDescription(palette).withSummary("Novel gadget for placing or exchanging blocks at a distance.") - .withControl("L-Click at Block", "Sets blocks placed by the tool to the targeted block.") - .withControl("R-Click at Block", - h("Places", palette) + " or " + h("Replaces", palette) + " the targeted block.") - .withControl("R-Click while Sneaking", "Opens the " + h("Configuration", palette) + " Interface") - .createTabs(); - } - @Override @OnlyIn(Dist.CLIENT) public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { if (stack.hasTag() && stack.getTag().contains("BlockUsed")) { String usedblock = NBTUtil.readBlockState(stack.getTag().getCompound("BlockUsed")).getBlock() .getTranslationKey(); - ItemDescription.add(tooltip, TextFormatting.DARK_GRAY + "Using: " + TextFormatting.GRAY - + new TranslationTextComponent(usedblock).getFormattedText()); + ItemDescription.add(tooltip, TextFormatting.DARK_GRAY + Lang.translate("blockzapper.usingBlock", + TextFormatting.GRAY + new TranslationTextComponent(usedblock).getFormattedText())); } - - super.addInformation(stack, worldIn, tooltip, flagIn); - Palette palette = Palette.Purple; if (Screen.hasShiftDown()) { - ItemDescription.add(tooltip, palette.color + "Component Tiers:"); + ItemDescription.add(tooltip, palette.color + Lang.translate("blockzapper.componentUpgrades")); for (Components c : Components.values()) { ComponentTier tier = getTier(c, stack); - ItemDescription.add(tooltip, "> " + TextFormatting.GRAY + c.name() + ": " + tier.displayName); + ItemDescription.add(tooltip, + "> " + TextFormatting.GRAY + Lang.translate("blockzapper.component." + c.name().toLowerCase()) + + ": " + tier.color + + Lang.translate("blockzapper.componentTier." + tier.name().toLowerCase())); } } } @@ -198,8 +188,8 @@ public class BuilderGunItem extends InfoItem { else { world.playSound(player, player.getPosition(), SoundEvents.BLOCK_NOTE_BLOCK_BASS, SoundCategory.BLOCKS, 1f, 0.5f); - player.sendStatusMessage(new StringTextComponent(TextFormatting.RED + "Left-Click a Block to set Material"), - true); + player.sendStatusMessage( + new StringTextComponent(TextFormatting.RED + Lang.translate("blockzapper.leftClickToSet")), true); return new ActionResult(ActionResultType.FAIL, item); } @@ -224,26 +214,8 @@ public class BuilderGunItem extends InfoItem { -0.1f, 1); Vec3d barrelPos = start.add(barrelPosNoTransform.rotatePitch(pitch).rotateYaw(yaw)); - // Client side - Shoot visual laser + // Client side if (world.isRemote) { -// BuilderGunHandler.addBeam(new LaserBeam(barrelPos, raytrace.getHitVec())); -// -// if (getTier(Components.Amplifier, item) == ComponentTier.BlazeBrass) { -// BuilderGunHandler.addBeam(new LaserBeam( -// start.add(barrelPosNoTransform.add(-.09f, -.08f, 0).rotatePitch(pitch).rotateYaw(yaw)), -// raytrace.getHitVec())); -// } -// if (getTier(Components.Amplifier, item) == ComponentTier.ChorusChrome) { -// BuilderGunHandler.addBeam(new LaserBeam( -// start.add(barrelPosNoTransform.add(-.09f, -.08f, 0).rotatePitch(pitch).rotateYaw(yaw)), -// raytrace.getHitVec())); -// BuilderGunHandler.addBeam(new LaserBeam( -// start.add(barrelPosNoTransform.add(.09f, -.08f, 0).rotatePitch(pitch).rotateYaw(yaw)), -// raytrace.getHitVec())); -// } -// -// BuilderGunHandler.shoot(hand); -// applyCooldown(player, item, gunInOtherHand); BuilderGunHandler.dontAnimateItem(hand); return new ActionResult(ActionResultType.SUCCESS, item); } @@ -263,7 +235,8 @@ public class BuilderGunItem extends InfoItem { continue; if (!player.isCreative() && BlockHelper.findAndRemoveInInventory(stateToUse, player, 1) == 0) { player.getCooldownTracker().setCooldown(item.getItem(), 20); - player.sendStatusMessage(new StringTextComponent(TextFormatting.RED + "Out of Blocks!"), true); + player.sendStatusMessage( + new StringTextComponent(TextFormatting.RED + Lang.translate("blockzapper.empty")), true); return new ActionResult(ActionResultType.SUCCESS, item); } diff --git a/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/BuilderGunScreen.java b/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/BuilderGunScreen.java index 6c48b821c..0aeb49d81 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/BuilderGunScreen.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/BuilderGunScreen.java @@ -15,6 +15,7 @@ import com.simibubi.create.foundation.gui.widgets.Indicator.State; import com.simibubi.create.foundation.gui.widgets.Label; import com.simibubi.create.foundation.gui.widgets.ScrollInput; import com.simibubi.create.foundation.packet.NbtPacket; +import com.simibubi.create.foundation.utility.Lang; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -39,6 +40,9 @@ public class BuilderGunScreen extends AbstractSimiScreen { private boolean offhand; private float animationProgress; + private final String title = Lang.translate("gui.blockzapper.title"); + private final String patternSection = Lang.translate("gui.blockzapper.patternSection"); + private IconButton replaceModeButton; private Indicator replaceModeIndicator; private IconButton spreadDiagonallyButton; @@ -72,24 +76,23 @@ public class BuilderGunScreen extends AbstractSimiScreen { replaceModeButton = new IconButton(i + 51, j + 41, ScreenResources.ICON_REPLACE_SOLID); if (nbt.contains("Replace") && nbt.getBoolean("Replace")) replaceModeIndicator.state = State.ON; - replaceModeButton.setToolTip("Replace Mode"); + replaceModeButton.setToolTip(Lang.translate("gui.blockzapper.replaceMode")); spreadDiagonallyIndicator = new Indicator(i + 74, j + 36, ""); spreadDiagonallyButton = new IconButton(i + 74, j + 41, ScreenResources.ICON_FOLLOW_DIAGONAL); if (nbt.contains("SearchDiagonal") && nbt.getBoolean("SearchDiagonal")) spreadDiagonallyIndicator.state = State.ON; - spreadDiagonallyButton.setToolTip("Follow Diagonals"); + spreadDiagonallyButton.setToolTip(Lang.translate("gui.blockzapper.searchDiagonal")); spreadMaterialIndicator = new Indicator(i + 92, j + 36, ""); spreadMaterialButton = new IconButton(i + 92, j + 41, ScreenResources.ICON_FOLLOW_MATERIAL); if (nbt.contains("SearchFuzzy") && nbt.getBoolean("SearchFuzzy")) spreadMaterialIndicator.state = State.ON; - spreadMaterialButton.setToolTip("Ignore Material Borders"); + spreadMaterialButton.setToolTip(Lang.translate("gui.blockzapper.searchFuzzy")); spreadRangeLabel = new Label(i + 119, j + 46, "").withShadow().withSuffix("m"); - spreadRangeInput = new ScrollInput(i + 115, j + 43, 22, 14) - .withRange(1, BuilderGunItem.getMaxAoe(item)).setState(1) - .titled("Spread Range").writingTo(spreadRangeLabel); + spreadRangeInput = new ScrollInput(i + 115, j + 43, 22, 14).withRange(1, BuilderGunItem.getMaxAoe(item)) + .setState(1).titled(Lang.translate("gui.blockzapper.range")).writingTo(spreadRangeLabel); if (nbt.contains("SearchDistance")) spreadRangeInput.setState(nbt.getInt("SearchDistance")); @@ -104,7 +107,7 @@ public class BuilderGunScreen extends AbstractSimiScreen { int id = patternButtons.size(); PlacementPatterns pattern = PlacementPatterns.values()[id]; patternButtons.add(new IconButton(i + 147 + col * 18, j + 23 + row * 18, pattern.icon)); - patternButtons.get(id).setToolTip(pattern.displayName); + patternButtons.get(id).setToolTip(Lang.translate("gui.blockzapper.pattern." + pattern.translationKey)); } } @@ -173,8 +176,8 @@ public class BuilderGunScreen extends AbstractSimiScreen { int j = guiTop; ScreenResources.PLACEMENT_GUN.draw(this, i, j); - font.drawStringWithShadow("Handheld Blockzapper", i + 8, j + 10, 0xCCDDFF); - font.drawString("Patterns", i + 148, j + 11, ScreenResources.FONT_COLOR); + font.drawStringWithShadow(title, i + 8, j + 10, 0xCCDDFF); + font.drawString(patternSection, i + 148, j + 11, ScreenResources.FONT_COLOR); minecraft.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); GlStateManager.enableBlend(); diff --git a/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/PlacementPatterns.java b/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/PlacementPatterns.java index 6d1858e02..0fffb637a 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/PlacementPatterns.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/placementHandgun/PlacementPatterns.java @@ -4,18 +4,18 @@ import com.simibubi.create.foundation.gui.ScreenResources; public enum PlacementPatterns { - Solid("Solid Material", ScreenResources.ICON_PATTERN_SOLID), - Checkered("Checkerboard", ScreenResources.ICON_PATTERN_CHECKERED), - InverseCheckered("Inversed Checkerboard", ScreenResources.ICON_PATTERN_CHECKERED_INVERSED), - Chance25("25% Roll", ScreenResources.ICON_PATTERN_CHANCE_25), - Chance50("50% Roll", ScreenResources.ICON_PATTERN_CHANCE_50), - Chance75("75% Roll", ScreenResources.ICON_PATTERN_CHANCE_75); + Solid(ScreenResources.ICON_PATTERN_SOLID), + Checkered(ScreenResources.ICON_PATTERN_CHECKERED), + InverseCheckered(ScreenResources.ICON_PATTERN_CHECKERED_INVERSED), + Chance25(ScreenResources.ICON_PATTERN_CHANCE_25), + Chance50(ScreenResources.ICON_PATTERN_CHANCE_50), + Chance75(ScreenResources.ICON_PATTERN_CHANCE_75); - public String displayName; + public String translationKey; public ScreenResources icon; - private PlacementPatterns(String displayName, ScreenResources icon) { - this.displayName = displayName; + private PlacementPatterns(ScreenResources icon) { + this.translationKey = name().toLowerCase(); this.icon = icon; } diff --git a/src/main/java/com/simibubi/create/modules/symmetry/SymmetryEffectPacket.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryEffectPacket.java similarity index 96% rename from src/main/java/com/simibubi/create/modules/symmetry/SymmetryEffectPacket.java rename to src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryEffectPacket.java index a74e89d61..d07ecf9d2 100644 --- a/src/main/java/com/simibubi/create/modules/symmetry/SymmetryEffectPacket.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryEffectPacket.java @@ -1,4 +1,4 @@ -package com.simibubi.create.modules.symmetry; +package com.simibubi.create.modules.curiosities.symmetry; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/simibubi/create/modules/symmetry/SymmetryHandler.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryHandler.java similarity index 96% rename from src/main/java/com/simibubi/create/modules/symmetry/SymmetryHandler.java rename to src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryHandler.java index e26ba94a4..07c82ec7b 100644 --- a/src/main/java/com/simibubi/create/modules/symmetry/SymmetryHandler.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryHandler.java @@ -1,4 +1,4 @@ -package com.simibubi.create.modules.symmetry; +package com.simibubi.create.modules.curiosities.symmetry; import java.util.Random; @@ -7,8 +7,8 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.platform.GlStateManager; import com.simibubi.create.AllItems; import com.simibubi.create.foundation.utility.TessellatorHelper; -import com.simibubi.create.modules.symmetry.mirror.EmptyMirror; -import com.simibubi.create.modules.symmetry.mirror.SymmetryMirror; +import com.simibubi.create.modules.curiosities.symmetry.mirror.EmptyMirror; +import com.simibubi.create.modules.curiosities.symmetry.mirror.SymmetryMirror; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; diff --git a/src/main/java/com/simibubi/create/modules/symmetry/SymmetryWandItem.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryWandItem.java similarity index 79% rename from src/main/java/com/simibubi/create/modules/symmetry/SymmetryWandItem.java rename to src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryWandItem.java index ae5d9df81..299a43217 100644 --- a/src/main/java/com/simibubi/create/modules/symmetry/SymmetryWandItem.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryWandItem.java @@ -1,4 +1,4 @@ -package com.simibubi.create.modules.symmetry; +package com.simibubi.create.modules.curiosities.symmetry; import static com.simibubi.create.CreateConfig.parameters; @@ -9,20 +9,18 @@ import java.util.Map; import com.simibubi.create.AllPackets; import com.simibubi.create.foundation.gui.ScreenOpener; -import com.simibubi.create.foundation.item.InfoItem; import com.simibubi.create.foundation.utility.BlockHelper; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; -import com.simibubi.create.modules.symmetry.mirror.CrossPlaneMirror; -import com.simibubi.create.modules.symmetry.mirror.EmptyMirror; -import com.simibubi.create.modules.symmetry.mirror.PlaneMirror; -import com.simibubi.create.modules.symmetry.mirror.SymmetryMirror; +import com.simibubi.create.modules.curiosities.symmetry.mirror.CrossPlaneMirror; +import com.simibubi.create.modules.curiosities.symmetry.mirror.EmptyMirror; +import com.simibubi.create.modules.curiosities.symmetry.mirror.PlaneMirror; +import com.simibubi.create.modules.curiosities.symmetry.mirror.SymmetryMirror; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUseContext; import net.minecraft.item.Rarity; @@ -35,36 +33,21 @@ import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.network.PacketDistributor; -public class SymmetryWandItem extends InfoItem { +public class SymmetryWandItem extends Item { + + public static final String SYMMETRY = "symmetry"; + private static final String ENABLE = "enable"; - public static final String $SYMMETRY = "symmetry"; - private static final String $ENABLE = "enable"; - public SymmetryWandItem(Properties properties) { super(properties.maxStackSize(1).rarity(Rarity.UNCOMMON)); } - @Override - public ItemDescription getDescription() { - Palette palette = Palette.Purple; - return new ItemDescription(palette) - .withSummary("Perfectly mirrors your Block placement across the configured planes.") - .withBehaviour("When in Hotbar", "Stays Active") - .withControl("R-Click on Ground", - h("Creates", palette) + " or " + h("Moves", palette) + " the Mirror") - .withControl("R-Click in the Air", h("Removes", palette) + " the active Mirror") - .withControl("R-Click while Sneaking", "Opens the " + h("Configuration Screen", palette)) - .createTabs(); - } - @Override public ActionResultType onItemUse(ItemUseContext context) { PlayerEntity player = context.getPlayer(); @@ -87,12 +70,12 @@ public class SymmetryWandItem extends InfoItem { if (context.getWorld().isRemote || context.getHand() != Hand.MAIN_HAND) return ActionResultType.SUCCESS; - CompoundNBT compound = wand.getTag().getCompound($SYMMETRY); + CompoundNBT compound = wand.getTag().getCompound(SYMMETRY); pos = pos.offset(context.getFace()); SymmetryMirror previousElement = SymmetryMirror.fromNBT(compound); // No Shift -> Make / Move Mirror - wand.getTag().putBoolean($ENABLE, true); + wand.getTag().putBoolean(ENABLE, true); Vec3d pos3d = new Vec3d(pos.getX(), pos.getY(), pos.getZ()); SymmetryMirror newElement = new PlaneMirror(pos3d); @@ -102,8 +85,7 @@ public class SymmetryWandItem extends InfoItem { ? PlaneMirror.Align.XY.ordinal() : PlaneMirror.Align.YZ.ordinal()); newElement.enable = true; - player.sendStatusMessage(new StringTextComponent(TextFormatting.GREEN + "New Plane created"), true); - wand.getTag().putBoolean($ENABLE, true); + wand.getTag().putBoolean(ENABLE, true); } else { previousElement.setPosition(pos3d); @@ -126,7 +108,7 @@ public class SymmetryWandItem extends InfoItem { } compound = newElement.writeToNbt(); - wand.getTag().put($SYMMETRY, compound); + wand.getTag().put(SYMMETRY, compound); player.setHeldItem(context.getHand(), wand); return ActionResultType.SUCCESS; @@ -149,7 +131,7 @@ public class SymmetryWandItem extends InfoItem { } // No Shift -> Clear Mirror - wand.getTag().putBoolean($ENABLE, false); + wand.getTag().putBoolean(ENABLE, false); return new ActionResult(ActionResultType.SUCCESS, wand); } @@ -159,21 +141,21 @@ public class SymmetryWandItem extends InfoItem { } private static void checkNBT(ItemStack wand) { - if (!wand.hasTag() || !wand.getTag().contains($SYMMETRY)) { + if (!wand.hasTag() || !wand.getTag().contains(SYMMETRY)) { wand.setTag(new CompoundNBT()); - wand.getTag().put($SYMMETRY, new EmptyMirror(new Vec3d(0, 0, 0)).writeToNbt()); - wand.getTag().putBoolean($ENABLE, false); + wand.getTag().put(SYMMETRY, new EmptyMirror(new Vec3d(0, 0, 0)).writeToNbt()); + wand.getTag().putBoolean(ENABLE, false); } } public static boolean isEnabled(ItemStack stack) { checkNBT(stack); - return stack.getTag().getBoolean($ENABLE); + return stack.getTag().getBoolean(ENABLE); } public static SymmetryMirror getMirror(ItemStack stack) { checkNBT(stack); - return SymmetryMirror.fromNBT((CompoundNBT) stack.getTag().getCompound($SYMMETRY)); + return SymmetryMirror.fromNBT((CompoundNBT) stack.getTag().getCompound(SYMMETRY)); } public static void apply(World world, ItemStack wand, PlayerEntity player, BlockPos pos, BlockState block) { @@ -185,7 +167,7 @@ public class SymmetryWandItem extends InfoItem { Map blockSet = new HashMap<>(); blockSet.put(pos, block); - SymmetryMirror symmetry = SymmetryMirror.fromNBT((CompoundNBT) wand.getTag().getCompound($SYMMETRY)); + SymmetryMirror symmetry = SymmetryMirror.fromNBT((CompoundNBT) wand.getTag().getCompound(SYMMETRY)); Vec3d mirrorPos = symmetry.getPosition(); if (mirrorPos.distanceTo(new Vec3d(pos)) > parameters.maxSymmetryWandRange.get()) @@ -240,7 +222,7 @@ public class SymmetryWandItem extends InfoItem { Map blockSet = new HashMap<>(); blockSet.put(pos, air); - SymmetryMirror symmetry = SymmetryMirror.fromNBT((CompoundNBT) wand.getTag().getCompound($SYMMETRY)); + SymmetryMirror symmetry = SymmetryMirror.fromNBT((CompoundNBT) wand.getTag().getCompound(SYMMETRY)); Vec3d mirrorPos = symmetry.getPosition(); if (mirrorPos.distanceTo(new Vec3d(pos)) > parameters.maxSymmetryWandRange.get()) diff --git a/src/main/java/com/simibubi/create/modules/symmetry/SymmetryWandScreen.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryWandScreen.java similarity index 82% rename from src/main/java/com/simibubi/create/modules/symmetry/SymmetryWandScreen.java rename to src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryWandScreen.java index f0888923a..459a730b0 100644 --- a/src/main/java/com/simibubi/create/modules/symmetry/SymmetryWandScreen.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/SymmetryWandScreen.java @@ -1,4 +1,4 @@ -package com.simibubi.create.modules.symmetry; +package com.simibubi.create.modules.curiosities.symmetry; import org.lwjgl.opengl.GL11; @@ -10,11 +10,12 @@ import com.simibubi.create.foundation.gui.widgets.Label; import com.simibubi.create.foundation.gui.widgets.ScrollInput; import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput; import com.simibubi.create.foundation.packet.NbtPacket; -import com.simibubi.create.modules.symmetry.mirror.CrossPlaneMirror; -import com.simibubi.create.modules.symmetry.mirror.EmptyMirror; -import com.simibubi.create.modules.symmetry.mirror.PlaneMirror; -import com.simibubi.create.modules.symmetry.mirror.SymmetryMirror; -import com.simibubi.create.modules.symmetry.mirror.TriplePlaneMirror; +import com.simibubi.create.foundation.utility.Lang; +import com.simibubi.create.modules.curiosities.symmetry.mirror.CrossPlaneMirror; +import com.simibubi.create.modules.curiosities.symmetry.mirror.EmptyMirror; +import com.simibubi.create.modules.curiosities.symmetry.mirror.PlaneMirror; +import com.simibubi.create.modules.curiosities.symmetry.mirror.SymmetryMirror; +import com.simibubi.create.modules.curiosities.symmetry.mirror.TriplePlaneMirror; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.RenderHelper; @@ -36,6 +37,9 @@ public class SymmetryWandScreen extends AbstractSimiScreen { private ScrollInput areaAlign; private Label labelAlign; + private final String mirrorType = Lang.translate("gui.symmetryWand.mirrorType"); + private final String orientation = Lang.translate("gui.symmetryWand.orientation"); + private SymmetryMirror currentElement; private float animationProgress; private ItemStack wand; @@ -62,8 +66,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen { int state = currentElement instanceof TriplePlaneMirror ? 2 : currentElement instanceof CrossPlaneMirror ? 1 : 0; areaType = new SelectionScrollInput(guiLeft + 119, guiTop + 12, 70, 14) - .forOptions(SymmetryMirror.TOOLTIP_ELEMENTS).titled("Type of Mirror").writingTo(labelType) - .setState(state); + .forOptions(SymmetryMirror.getMirrors()).titled(mirrorType).writingTo(labelType).setState(state); areaType.calling(position -> { switch (position) { @@ -83,7 +86,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen { }); widgets.clear(); - + initAlign(currentElement); widgets.add(labelAlign); @@ -98,7 +101,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen { } areaAlign = new SelectionScrollInput(guiLeft + 119, guiTop + 32, 70, 14).forOptions(element.getAlignToolTips()) - .titled("Direction").writingTo(labelAlign).setState(element.getOrientationIndex()) + .titled(orientation).writingTo(labelAlign).setState(element.getOrientationIndex()) .calling(element::setOrientation); widgets.add(areaAlign); @@ -117,8 +120,8 @@ public class SymmetryWandScreen extends AbstractSimiScreen { int x = guiLeft + 63; int y = guiTop + 15; - font.drawString("Symmetry", x, y, ScreenResources.FONT_COLOR); - font.drawString("Direction", x, y + 20, ScreenResources.FONT_COLOR); + font.drawString(mirrorType, x - 5, y, ScreenResources.FONT_COLOR); + font.drawString(orientation, x - 5, y + 20, ScreenResources.FONT_COLOR); minecraft.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); GlStateManager.enableBlend(); @@ -128,25 +131,25 @@ public class SymmetryWandScreen extends AbstractSimiScreen { GlStateManager.pushLightingAttributes(); GlStateManager.pushMatrix(); - + RenderHelper.enableStandardItemLighting(); GlStateManager.enableBlend(); GlStateManager.enableRescaleNormal(); GlStateManager.enableAlphaTest(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); - GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.translated((this.width - this.sWidth) / 2 + 250, this.height / 2 + this.sHeight / 2, 100); GlStateManager.rotatef(-30, .4f, 0, -.2f); GlStateManager.rotatef(90 + 0.2f * animationProgress, 0, 1, 0); GlStateManager.scaled(100, -100, 100); itemRenderer.renderItem(wand, itemRenderer.getModelWithOverrides(wand)); - + GlStateManager.disableAlphaTest(); GlStateManager.disableRescaleNormal(); GlStateManager.disableLighting(); - + GlStateManager.popMatrix(); GlStateManager.popAttributes(); } @@ -169,7 +172,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen { public void removed() { ItemStack heldItemMainhand = minecraft.player.getHeldItemMainhand(); CompoundNBT compound = heldItemMainhand.getTag(); - compound.put(SymmetryWandItem.$SYMMETRY, currentElement.writeToNbt()); + compound.put(SymmetryWandItem.SYMMETRY, currentElement.writeToNbt()); heldItemMainhand.setTag(compound); AllPackets.channel.send(PacketDistributor.SERVER.noArg(), new NbtPacket(heldItemMainhand)); minecraft.player.setHeldItem(Hand.MAIN_HAND, heldItemMainhand); diff --git a/src/main/java/com/simibubi/create/modules/symmetry/block/CrossPlaneSymmetryBlock.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/block/CrossPlaneSymmetryBlock.java similarity index 83% rename from src/main/java/com/simibubi/create/modules/symmetry/block/CrossPlaneSymmetryBlock.java rename to src/main/java/com/simibubi/create/modules/curiosities/symmetry/block/CrossPlaneSymmetryBlock.java index 0c4625892..ee48c3e05 100644 --- a/src/main/java/com/simibubi/create/modules/symmetry/block/CrossPlaneSymmetryBlock.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/block/CrossPlaneSymmetryBlock.java @@ -1,6 +1,6 @@ -package com.simibubi.create.modules.symmetry.block; +package com.simibubi.create.modules.curiosities.symmetry.block; -import com.simibubi.create.modules.symmetry.mirror.CrossPlaneMirror; +import com.simibubi.create.modules.curiosities.symmetry.mirror.CrossPlaneMirror; import net.minecraft.block.Block; import net.minecraft.block.BlockState; diff --git a/src/main/java/com/simibubi/create/modules/symmetry/block/PlaneSymmetryBlock.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/block/PlaneSymmetryBlock.java similarity index 83% rename from src/main/java/com/simibubi/create/modules/symmetry/block/PlaneSymmetryBlock.java rename to src/main/java/com/simibubi/create/modules/curiosities/symmetry/block/PlaneSymmetryBlock.java index 397968299..97295d7aa 100644 --- a/src/main/java/com/simibubi/create/modules/symmetry/block/PlaneSymmetryBlock.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/block/PlaneSymmetryBlock.java @@ -1,6 +1,6 @@ -package com.simibubi.create.modules.symmetry.block; +package com.simibubi.create.modules.curiosities.symmetry.block; -import com.simibubi.create.modules.symmetry.mirror.PlaneMirror; +import com.simibubi.create.modules.curiosities.symmetry.mirror.PlaneMirror; import net.minecraft.block.Block; import net.minecraft.block.BlockState; diff --git a/src/main/java/com/simibubi/create/modules/symmetry/block/SymmetryBlock.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/block/SymmetryBlock.java similarity index 79% rename from src/main/java/com/simibubi/create/modules/symmetry/block/SymmetryBlock.java rename to src/main/java/com/simibubi/create/modules/curiosities/symmetry/block/SymmetryBlock.java index fe84e7665..2db463846 100644 --- a/src/main/java/com/simibubi/create/modules/symmetry/block/SymmetryBlock.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/block/SymmetryBlock.java @@ -1,4 +1,4 @@ -package com.simibubi.create.modules.symmetry.block; +package com.simibubi.create.modules.curiosities.symmetry.block; import com.simibubi.create.foundation.block.IRenderUtilityBlock; diff --git a/src/main/java/com/simibubi/create/modules/symmetry/block/TriplePlaneSymmetryBlock.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/block/TriplePlaneSymmetryBlock.java similarity index 75% rename from src/main/java/com/simibubi/create/modules/symmetry/block/TriplePlaneSymmetryBlock.java rename to src/main/java/com/simibubi/create/modules/curiosities/symmetry/block/TriplePlaneSymmetryBlock.java index 4bbc70d5c..4bcefc9b9 100644 --- a/src/main/java/com/simibubi/create/modules/symmetry/block/TriplePlaneSymmetryBlock.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/block/TriplePlaneSymmetryBlock.java @@ -1,4 +1,4 @@ -package com.simibubi.create.modules.symmetry.block; +package com.simibubi.create.modules.curiosities.symmetry.block; import net.minecraft.block.material.Material; diff --git a/src/main/java/com/simibubi/create/modules/symmetry/client/SymmetryWandItemRenderer.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/client/SymmetryWandItemRenderer.java similarity index 96% rename from src/main/java/com/simibubi/create/modules/symmetry/client/SymmetryWandItemRenderer.java rename to src/main/java/com/simibubi/create/modules/curiosities/symmetry/client/SymmetryWandItemRenderer.java index 53d924d19..7fd3ba0ff 100644 --- a/src/main/java/com/simibubi/create/modules/symmetry/client/SymmetryWandItemRenderer.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/client/SymmetryWandItemRenderer.java @@ -1,4 +1,4 @@ -package com.simibubi.create.modules.symmetry.client; +package com.simibubi.create.modules.curiosities.symmetry.client; import com.mojang.blaze3d.platform.GLX; import com.mojang.blaze3d.platform.GlStateManager; diff --git a/src/main/java/com/simibubi/create/modules/symmetry/client/SymmetryWandModel.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/client/SymmetryWandModel.java similarity index 90% rename from src/main/java/com/simibubi/create/modules/symmetry/client/SymmetryWandModel.java rename to src/main/java/com/simibubi/create/modules/curiosities/symmetry/client/SymmetryWandModel.java index 74e36d3be..837850453 100644 --- a/src/main/java/com/simibubi/create/modules/symmetry/client/SymmetryWandModel.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/client/SymmetryWandModel.java @@ -1,4 +1,4 @@ -package com.simibubi.create.modules.symmetry.client; +package com.simibubi.create.modules.curiosities.symmetry.client; import com.simibubi.create.foundation.block.CustomRenderItemBakedModel; diff --git a/src/main/java/com/simibubi/create/modules/symmetry/mirror/CrossPlaneMirror.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/CrossPlaneMirror.java similarity index 86% rename from src/main/java/com/simibubi/create/modules/symmetry/mirror/CrossPlaneMirror.java rename to src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/CrossPlaneMirror.java index 17f6db70f..2b39d9533 100644 --- a/src/main/java/com/simibubi/create/modules/symmetry/mirror/CrossPlaneMirror.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/CrossPlaneMirror.java @@ -1,4 +1,4 @@ -package com.simibubi.create.modules.symmetry.mirror; +package com.simibubi.create.modules.curiosities.symmetry.mirror; import java.util.HashMap; import java.util.List; @@ -6,7 +6,8 @@ import java.util.Map; import com.google.common.collect.ImmutableList; import com.simibubi.create.AllBlocks; -import com.simibubi.create.modules.symmetry.block.CrossPlaneSymmetryBlock; +import com.simibubi.create.foundation.utility.Lang; +import com.simibubi.create.modules.curiosities.symmetry.block.CrossPlaneSymmetryBlock; import net.minecraft.block.BlockState; import net.minecraft.util.IStringSerializable; @@ -90,7 +91,7 @@ public class CrossPlaneMirror extends SymmetryMirror { @Override public List getAlignToolTips() { - return ImmutableList.of("Orthogonal", "Diagonal"); + return ImmutableList.of(Lang.translate("orientation.orthogonal"), Lang.translate("orientation.diagonal")); } } diff --git a/src/main/java/com/simibubi/create/modules/symmetry/mirror/EmptyMirror.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/EmptyMirror.java similarity index 94% rename from src/main/java/com/simibubi/create/modules/symmetry/mirror/EmptyMirror.java rename to src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/EmptyMirror.java index e11016f6d..400f680af 100644 --- a/src/main/java/com/simibubi/create/modules/symmetry/mirror/EmptyMirror.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/EmptyMirror.java @@ -1,4 +1,4 @@ -package com.simibubi.create.modules.symmetry.mirror; +package com.simibubi.create.modules.curiosities.symmetry.mirror; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/com/simibubi/create/modules/symmetry/mirror/PlaneMirror.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/PlaneMirror.java similarity index 85% rename from src/main/java/com/simibubi/create/modules/symmetry/mirror/PlaneMirror.java rename to src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/PlaneMirror.java index 493ec63e3..485dd9719 100644 --- a/src/main/java/com/simibubi/create/modules/symmetry/mirror/PlaneMirror.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/PlaneMirror.java @@ -1,4 +1,4 @@ -package com.simibubi.create.modules.symmetry.mirror; +package com.simibubi.create.modules.curiosities.symmetry.mirror; import java.util.HashMap; import java.util.List; @@ -6,7 +6,8 @@ import java.util.Map; import com.google.common.collect.ImmutableList; import com.simibubi.create.AllBlocks; -import com.simibubi.create.modules.symmetry.block.PlaneSymmetryBlock; +import com.simibubi.create.foundation.utility.Lang; +import com.simibubi.create.modules.curiosities.symmetry.block.PlaneSymmetryBlock; import net.minecraft.block.BlockState; import net.minecraft.util.IStringSerializable; @@ -85,7 +86,7 @@ public class PlaneMirror extends SymmetryMirror { @Override public List getAlignToolTips() { - return ImmutableList.of("Mirror Z", "Mirror X"); + return ImmutableList.of(Lang.translate("orientation.alongZ"), Lang.translate("orientation.alongX")); } } diff --git a/src/main/java/com/simibubi/create/modules/symmetry/mirror/SymmetryMirror.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/SymmetryMirror.java similarity index 94% rename from src/main/java/com/simibubi/create/modules/symmetry/mirror/SymmetryMirror.java rename to src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/SymmetryMirror.java index 7ed6ae192..dba22ce68 100644 --- a/src/main/java/com/simibubi/create/modules/symmetry/mirror/SymmetryMirror.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/SymmetryMirror.java @@ -1,10 +1,11 @@ -package com.simibubi.create.modules.symmetry.mirror; +package com.simibubi.create.modules.curiosities.symmetry.mirror; import java.util.HashMap; import java.util.List; import java.util.Map; import com.google.common.collect.ImmutableList; +import com.simibubi.create.foundation.utility.Lang; import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; @@ -27,8 +28,6 @@ public abstract class SymmetryMirror { public static final String CROSS_PLANE = "cross_plane"; public static final String TRIPLE_PLANE = "triple_plane"; - public static final List TOOLTIP_ELEMENTS = ImmutableList.of("Mirror once", "Rectanglar", "Octagonal"); - protected Vec3d position; protected IStringSerializable orientation; protected int orientationIndex; @@ -40,6 +39,11 @@ public abstract class SymmetryMirror { orientationIndex = 0; } + public static List getMirrors() { + return ImmutableList.of(Lang.translate("symmetry.mirror.plane"), Lang.translate("symmetry.mirror.doublePlane"), + Lang.translate("symmetry.mirror.triplePlane")); + } + public IStringSerializable getOrientation() { return orientation; } diff --git a/src/main/java/com/simibubi/create/modules/symmetry/mirror/TriplePlaneMirror.java b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/TriplePlaneMirror.java similarity index 88% rename from src/main/java/com/simibubi/create/modules/symmetry/mirror/TriplePlaneMirror.java rename to src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/TriplePlaneMirror.java index da743921a..13cdf7cc9 100644 --- a/src/main/java/com/simibubi/create/modules/symmetry/mirror/TriplePlaneMirror.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/symmetry/mirror/TriplePlaneMirror.java @@ -1,4 +1,4 @@ -package com.simibubi.create.modules.symmetry.mirror; +package com.simibubi.create.modules.curiosities.symmetry.mirror; import java.util.HashMap; import java.util.List; @@ -6,6 +6,7 @@ import java.util.Map; import com.google.common.collect.ImmutableList; import com.simibubi.create.AllBlocks; +import com.simibubi.create.foundation.utility.Lang; import net.minecraft.block.BlockState; import net.minecraft.util.IStringSerializable; @@ -60,7 +61,7 @@ public class TriplePlaneMirror extends SymmetryMirror { @Override public List getAlignToolTips() { - return ImmutableList.of("Horizontal"); + return ImmutableList.of(Lang.translate("orientation.horizontal")); } } diff --git a/src/main/java/com/simibubi/create/modules/curiosities/tools/BlazingToolItem.java b/src/main/java/com/simibubi/create/modules/curiosities/tools/BlazingToolItem.java index f152d9048..1cd86842b 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/tools/BlazingToolItem.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/tools/BlazingToolItem.java @@ -7,8 +7,6 @@ import java.util.Optional; import com.simibubi.create.foundation.item.AbstractToolItem; import com.simibubi.create.foundation.item.AllToolTypes; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; import com.simibubi.create.foundation.utility.ItemHelper; import com.simibubi.create.foundation.utility.VecHelper; @@ -24,7 +22,6 @@ import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraft.world.dimension.DimensionType; @@ -94,14 +91,4 @@ public class BlazingToolItem extends AbstractToolItem { drops.addAll(smeltedStacks); } - @Override - public ItemDescription getDescription() { - Palette color = Palette.Purple; - return new ItemDescription(color).withSummary("A tool forged from fiery Blaze Brass.") - .withBehaviour("When in Nether", "Using the tool will not affect durability.") - .withBehaviour("Outside of Nether, When [Forge#5828] Fixed", - TextFormatting.STRIKETHROUGH + "Tool smelts drops of broken blocks") - .createTabs(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/curiosities/tools/RoseQuartzToolItem.java b/src/main/java/com/simibubi/create/modules/curiosities/tools/RoseQuartzToolItem.java index 444144788..ca88e0026 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/tools/RoseQuartzToolItem.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/tools/RoseQuartzToolItem.java @@ -2,8 +2,6 @@ package com.simibubi.create.modules.curiosities.tools; import com.simibubi.create.foundation.item.AbstractToolItem; import com.simibubi.create.foundation.item.AllToolTypes; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; public class RoseQuartzToolItem extends AbstractToolItem { @@ -11,12 +9,4 @@ public class RoseQuartzToolItem extends AbstractToolItem { super(attackDamageIn, attackSpeedIn, AllToolTiers.ROSE_QUARTZ, builder, types); } - @Override - public ItemDescription getDescription() { - Palette color = Palette.Purple; - return new ItemDescription(color).withSummary( - "A Tool of finest craftmansship with sturdy materials and detailed decoration. The extended handle allows, at a slight cost of speed, for a " - + h("greater reach distance", color) + "."); - } - } diff --git a/src/main/java/com/simibubi/create/modules/curiosities/tools/ShadowSteelToolItem.java b/src/main/java/com/simibubi/create/modules/curiosities/tools/ShadowSteelToolItem.java index 7a7ba5f11..78aecf55e 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/tools/ShadowSteelToolItem.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/tools/ShadowSteelToolItem.java @@ -4,13 +4,10 @@ import java.util.List; import com.simibubi.create.foundation.item.AbstractToolItem; import com.simibubi.create.foundation.item.AllToolTypes; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.IWorld; public class ShadowSteelToolItem extends AbstractToolItem { @@ -20,16 +17,6 @@ public class ShadowSteelToolItem extends AbstractToolItem { super(attackDamageIn, attackSpeedIn, AllToolTiers.SHADOW_STEEL, builder, types); } - @Override - public ItemDescription getDescription() { - Palette color = Palette.Purple; - return new ItemDescription(color) - .withSummary("The fast moving shadow material allows for quick riddance of blocks and entities.") - .withBehaviour("When [Forge#5828] Fixed", - TextFormatting.STRIKETHROUGH + "Broken blocks do not drop any items.") - .createTabs(); - } - @Override public void modifyDrops(List drops, IWorld world, BlockPos pos, ItemStack tool, BlockState state) { drops.clear(); diff --git a/src/main/java/com/simibubi/create/modules/gardens/TreeFertilizerItem.java b/src/main/java/com/simibubi/create/modules/gardens/TreeFertilizerItem.java index 38b7a6238..00f864cce 100644 --- a/src/main/java/com/simibubi/create/modules/gardens/TreeFertilizerItem.java +++ b/src/main/java/com/simibubi/create/modules/gardens/TreeFertilizerItem.java @@ -2,9 +2,6 @@ package com.simibubi.create.modules.gardens; import java.util.Random; -import com.simibubi.create.foundation.item.InfoItem; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; import com.simibubi.create.foundation.utility.PlacementSimulationWorld; import net.minecraft.block.Block; @@ -12,24 +9,18 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.SaplingBlock; import net.minecraft.item.BoneMealItem; +import net.minecraft.item.Item; import net.minecraft.item.ItemUseContext; import net.minecraft.util.ActionResultType; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -public class TreeFertilizerItem extends InfoItem { +public class TreeFertilizerItem extends Item { public TreeFertilizerItem(Properties properties) { super(properties); } - @Override - public ItemDescription getDescription() { - return new ItemDescription(Palette.Green) - .withSummary("A powerful combination of minerals suitable for common tree types.") - .withBehaviour("When used on Sapling", "Grows Trees regardless of their spacing Conditions").createTabs(); - } - @Override public ActionResultType onItemUse(ItemUseContext context) { BlockState state = context.getWorld().getBlockState(context.getPos()); diff --git a/src/main/java/com/simibubi/create/modules/logistics/FrequencyHandler.java b/src/main/java/com/simibubi/create/modules/logistics/FrequencyHandler.java index c1ca02594..febbde892 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/FrequencyHandler.java +++ b/src/main/java/com/simibubi/create/modules/logistics/FrequencyHandler.java @@ -50,12 +50,12 @@ public class FrequencyHandler { public void onLoadWorld(IWorld world) { connections.put(world, new HashMap<>()); - Create.logger.info("Prepared Network Space for " + world.getDimension().getType().getRegistryName()); + Create.logger.debug("Prepared Network Space for " + world.getDimension().getType().getRegistryName()); } public void onUnloadWorld(IWorld world) { connections.remove(world); - Create.logger.info("Removed Network Space for " + world.getDimension().getType().getRegistryName()); + Create.logger.debug("Removed Network Space for " + world.getDimension().getType().getRegistryName()); } private static Pair getNetworkKey(IHaveWireless actor) { diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/FlexcrateBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/FlexcrateBlock.java index 09922e817..d2053d06f 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/FlexcrateBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/FlexcrateBlock.java @@ -1,9 +1,6 @@ package com.simibubi.create.modules.logistics.block; -import com.simibubi.create.foundation.block.InfoBlock; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; - +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.entity.player.PlayerEntity; @@ -19,7 +16,7 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import net.minecraftforge.fml.network.NetworkHooks; -public class FlexcrateBlock extends InfoBlock { +public class FlexcrateBlock extends Block { public static final VoxelShape SHAPE = makeCuboidShape(1, 0, 1, 15, 14, 15); @@ -56,15 +53,6 @@ public class FlexcrateBlock extends InfoBlock { return new FlexcrateTileEntity(); } - @Override - public ItemDescription getDescription() { - Palette color = Palette.Yellow; - return new ItemDescription(color) - .withSummary("This Storage Container allows Manual control over its capacity. It can hold up to " - + h("16 Stacks", color) + " of Items.") - .createTabs(); - } - @Override public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) { if (worldIn.getTileEntity(pos) == null) diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/FlexcrateScreen.java b/src/main/java/com/simibubi/create/modules/logistics/block/FlexcrateScreen.java index 2bb0a4feb..b573915f8 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/FlexcrateScreen.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/FlexcrateScreen.java @@ -11,6 +11,7 @@ import com.simibubi.create.foundation.gui.ScreenElementRenderer; import com.simibubi.create.foundation.gui.ScreenResources; import com.simibubi.create.foundation.gui.widgets.Label; import com.simibubi.create.foundation.gui.widgets.ScrollInput; +import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.modules.logistics.packet.ConfigureFlexcratePacket; import net.minecraft.block.BlockState; @@ -24,6 +25,9 @@ public class FlexcrateScreen extends AbstractSimiContainerScreen lastModification = 0); allowedItems.onChanged(); widgets.add(allowedItemsLabel); @@ -55,13 +59,13 @@ public class FlexcrateScreen extends AbstractSimiContainerScreen slot * 64) diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/IBlockWithFilter.java b/src/main/java/com/simibubi/create/modules/logistics/block/IBlockWithFilter.java index 02f95149a..475443ac1 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/IBlockWithFilter.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/IBlockWithFilter.java @@ -1,6 +1,7 @@ package com.simibubi.create.modules.logistics.block; import com.mojang.blaze3d.platform.GlStateManager; +import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.TessellatorHelper; import net.minecraft.block.BlockState; @@ -127,7 +128,7 @@ public interface IBlockWithFilter { GlStateManager.translated(17.5f, -5f, -5f); GlStateManager.rotated(67.5f, 1, 0, 0); - String text = "Filter"; + String text = Lang.translate("logistics.filter"); Minecraft.getInstance().fontRenderer.drawString(text, 0, 0, 0x88FFBB); GlStateManager.translated(0, 0, -1/4f); Minecraft.getInstance().fontRenderer.drawString(text, 1, 1, 0x224433); diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/IBlockWithFrequency.java b/src/main/java/com/simibubi/create/modules/logistics/block/IBlockWithFrequency.java index bdbd6e901..6c35f5a7c 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/IBlockWithFrequency.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/IBlockWithFrequency.java @@ -3,6 +3,7 @@ package com.simibubi.create.modules.logistics.block; import org.apache.commons.lang3.tuple.Pair; import com.mojang.blaze3d.platform.GlStateManager; +import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.TessellatorHelper; import com.simibubi.create.modules.logistics.IHaveWireless; @@ -14,8 +15,8 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; -import net.minecraft.util.Hand; import net.minecraft.util.Direction.Axis; +import net.minecraft.util.Hand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; @@ -138,7 +139,7 @@ public interface IBlockWithFrequency { GlStateManager.scaled(textScale, -textScale, textScale); GlStateManager.translated(19.5f, -5f, 10f); - String text = "Freq. #2"; + String text = Lang.translate("logistics.secondFrequency"); Minecraft.getInstance().fontRenderer.drawString(text, 0, 0, 0xFFFF99); GlStateManager.translated(0, 0, -1 / 4f); Minecraft.getInstance().fontRenderer.drawString(text, 1, 1, 0x444433); @@ -158,7 +159,7 @@ public interface IBlockWithFrequency { GlStateManager.scaled(textScale, -textScale, textScale); GlStateManager.translated(19.5f, -5f, 10f); - String text = "Freq. #1"; + String text = Lang.translate("logistics.firstFrequency"); Minecraft.getInstance().fontRenderer.drawString(text, 0, 0, 0xFFFF99); GlStateManager.translated(0, 0, -1 / 4f); Minecraft.getInstance().fontRenderer.drawString(text, 1, 1, 0x444433); diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/RedstoneBridgeBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/RedstoneBridgeBlock.java index ba7821d94..95ce3f1a2 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/RedstoneBridgeBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/RedstoneBridgeBlock.java @@ -6,19 +6,13 @@ import java.util.List; import org.apache.commons.lang3.tuple.Pair; import com.simibubi.create.foundation.block.ProperDirectionalBlock; -import com.simibubi.create.foundation.utility.ITooltip; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; -import com.simibubi.create.foundation.utility.TooltipHolder; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; -import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItemUseContext; -import net.minecraft.item.ItemStack; import net.minecraft.state.BooleanProperty; import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.properties.BlockStateProperties; @@ -33,14 +27,11 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.util.text.ITextComponent; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -public class RedstoneBridgeBlock extends ProperDirectionalBlock implements ITooltip, IBlockWithFrequency { +public class RedstoneBridgeBlock extends ProperDirectionalBlock implements IBlockWithFrequency { public static final BooleanProperty POWERED = BlockStateProperties.POWERED; public static final BooleanProperty RECEIVER = BooleanProperty.create("receiver"); @@ -53,11 +44,8 @@ public class RedstoneBridgeBlock extends ProperDirectionalBlock implements ITool NORTH_SHAPE = makeCuboidShape(3, 1, 13, 13, 15, 17), EAST_SHAPE = makeCuboidShape(-1, 1, 3, 3, 15, 13), WEST_SHAPE = makeCuboidShape(13, 1, 3, 17, 15, 13); - private TooltipHolder info; - public RedstoneBridgeBlock() { super(Properties.from(Blocks.DARK_OAK_LOG)); - info = new TooltipHolder(this); cacheItemPositions(); setDefaultState(getDefaultState().with(POWERED, false).with(RECEIVER, false)); } @@ -251,29 +239,4 @@ public class RedstoneBridgeBlock extends ProperDirectionalBlock implements ITool return state.get(FACING); } - @Override - @OnlyIn(value = Dist.CLIENT) - public void addInformation(ItemStack stack, IBlockReader worldIn, List tooltip, - ITooltipFlag flagIn) { - info.addInformation(tooltip); - } - - @Override - public ItemDescription getDescription() { - Palette color = Palette.Yellow; - return new ItemDescription(color) - .withSummary("Endpoints for " + h("Wireless Redstone", color) + " connections. Can be assigned " - + h("Frequencies", color) + " using any item. Signal can travel distances up to " - + h("128m", color)) - .withBehaviour("When Powered", - "Bridges of the same " + h("Frequency", color) + " will provide a Redstone signal.") - .withControl("When R-Clicked with an Item", - "Sets the " + h("Frequency", color) + " to that item. A total of " - + h("two different items", color) - + " can be used in combination for defining a Frequency.") - .withControl("When R-Clicked while Sneaking", - "Toggles between " + h("Receiver", color) + " and " + h("Transmitter", color) + " Mode. ") - .createTabs(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchBlock.java index fd425fe38..765dc0ad3 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchBlock.java @@ -1,21 +1,13 @@ package com.simibubi.create.modules.logistics.block; -import java.util.List; - import com.simibubi.create.foundation.gui.ScreenOpener; -import com.simibubi.create.foundation.utility.ITooltip; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; -import com.simibubi.create.foundation.utility.TooltipHolder; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.HorizontalBlock; -import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItemUseContext; -import net.minecraft.item.ItemStack; import net.minecraft.state.IntegerProperty; import net.minecraft.state.StateContainer.Builder; import net.minecraft.tileentity.TileEntity; @@ -23,7 +15,6 @@ import net.minecraft.util.Direction; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.text.ITextComponent; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; @@ -31,14 +22,12 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.DistExecutor; -public class StockswitchBlock extends HorizontalBlock implements ITooltip { +public class StockswitchBlock extends HorizontalBlock { public static final IntegerProperty INDICATOR = IntegerProperty.create("indicator", 0, 6); - private TooltipHolder info; public StockswitchBlock() { super(Properties.from(Blocks.ANDESITE)); - info = new TooltipHolder(this); } @Override @@ -87,12 +76,6 @@ public class StockswitchBlock extends HorizontalBlock implements ITooltip { return te == null || !te.powered ? 0 : 15 ; } - @Override - public void addInformation(ItemStack stack, IBlockReader worldIn, List tooltip, - ITooltipFlag flagIn) { - info.addInformation(tooltip); - } - @Override protected void fillStateContainer(Builder builder) { builder.add(HORIZONTAL_FACING, INDICATOR); @@ -136,16 +119,4 @@ public class StockswitchBlock extends HorizontalBlock implements ITooltip { return new StockswitchTileEntity(); } - @Override - public ItemDescription getDescription() { - Palette color = Palette.Yellow; - return new ItemDescription(color) - .withSummary("Toggles a Redstone signal based on the " + h("Storage Space", color) - + " in the attached Container.") - .withBehaviour("When below Lower Limit", "Stops providing " + h("Redstone Power", color)) - .withBehaviour("When above Upper Limit", - "Starts providing " + h("Redstone Power", color) + " until Lower Limit is reached again.") - .withControl("When R-Clicked", "Opens the " + h("Configuration Screen", color)).createTabs(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchScreen.java b/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchScreen.java index 52d8c8746..3dcb21ba4 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchScreen.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchScreen.java @@ -12,6 +12,7 @@ import com.simibubi.create.foundation.gui.ScreenElementRenderer; import com.simibubi.create.foundation.gui.ScreenResources; import com.simibubi.create.foundation.gui.widgets.Label; import com.simibubi.create.foundation.gui.widgets.ScrollInput; +import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.modules.logistics.packet.ConfigureStockswitchPacket; import net.minecraft.block.BlockState; @@ -23,6 +24,14 @@ public class StockswitchScreen extends AbstractSimiScreen { private ScrollInput onAbove; private Label onAboveLabel; + private final String title = Lang.translate("gui.stockswitch.title"); + private final String startAbove = Lang.translate("gui.stockswitch.startAbove"); + private final String startAt = Lang.translate("gui.stockswitch.startAt"); + private final String stopBelow = Lang.translate("gui.stockswitch.stopBelow"); + private final String stopAt = Lang.translate("gui.stockswitch.stopAt"); + private final String lowerLimit = Lang.translate("gui.stockswitch.lowerLimit"); + private final String upperLimit = Lang.translate("gui.stockswitch.upperLimit"); + private int lastModification; private StockswitchTileEntity te; private float cursorPos; @@ -40,7 +49,7 @@ public class StockswitchScreen extends AbstractSimiScreen { 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("Lower Threshold") + offBelow = new ScrollInput(guiLeft + 113, guiTop + 69, 33, 14).withRange(0, 96).titled(lowerLimit) .calling(state -> { offBelowLabel.text = state + "%"; lastModification = 0; @@ -51,7 +60,7 @@ public class StockswitchScreen extends AbstractSimiScreen { }).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("Upper Threshold") + onAbove = new ScrollInput(guiLeft + 113, guiTop + 52, 33, 14).withRange(5, 101).titled(upperLimit) .calling(state -> { onAboveLabel.text = state + "%"; lastModification = 0; @@ -71,13 +80,10 @@ public class StockswitchScreen extends AbstractSimiScreen { int hFontColor = 0xD3CBBE; int fontColor = 0x4B3A22; STOCKSWITCH.draw(this, guiLeft, guiTop); - font.drawStringWithShadow("Stockpile Switch", - guiLeft - 3 + (STOCKSWITCH.width - font.getStringWidth("Stockpile Switch")) / 2, guiTop + 10, - hFontColor); - font.drawString("Start Signal " + (onAbove.getState() == 100 ? "at" : "above"), guiLeft + 13, guiTop + 55, - fontColor); - font.drawString("Stop Signal " + (offBelow.getState() == 0 ? "at" : "below"), guiLeft + 13, guiTop + 72, - fontColor); + font.drawStringWithShadow(title, guiLeft - 3 + (STOCKSWITCH.width - font.getStringWidth(title)) / 2, + guiTop + 10, hFontColor); + font.drawString(onAbove.getState() == 100 ? startAt : startAbove, guiLeft + 13, guiTop + 55, fontColor); + font.drawString(offBelow.getState() == 0 ? stopAt : stopBelow, guiLeft + 13, guiTop + 72, fontColor); ScreenResources sprite = ScreenResources.STOCKSWITCH_INTERVAL; float lowerBound = offBelow.getState() / 100f * (sprite.width - 20) + 10; @@ -108,12 +114,12 @@ public class StockswitchScreen extends AbstractSimiScreen { @Override public void tick() { super.tick(); - + if (te.currentLevel == -1) cursorPos = 0; else cursorPos += (te.currentLevel - cursorPos) / 4; - + if (lastModification >= 0) lastModification++; diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterBlock.java index 86e6f780a..fa484cb95 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterBlock.java @@ -2,6 +2,7 @@ package com.simibubi.create.modules.logistics.block.diodes; import com.simibubi.create.foundation.block.IBlockWithScrollableValue; import com.simibubi.create.foundation.block.IWithTileEntity; +import com.simibubi.create.foundation.utility.Lang; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -83,7 +84,7 @@ public class FlexpeaterBlock extends RedstoneDiodeBlock FlexpeaterTileEntity te = (FlexpeaterTileEntity) world.getTileEntity(pos); if (te == null) return ""; - return "Delay (" + te.getUnit() + ")"; + return Lang.translate("generic.delay") + " (" + te.getUnit() + ")"; } @Override diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterTileEntity.java b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterTileEntity.java index 1b569d69d..25f7053d3 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterTileEntity.java @@ -6,6 +6,7 @@ import static net.minecraft.block.RedstoneDiodeBlock.POWERED; import com.simibubi.create.AllPackets; import com.simibubi.create.AllTileEntities; import com.simibubi.create.foundation.block.SyncedTileEntity; +import com.simibubi.create.foundation.utility.Lang; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.ITickableTileEntity; @@ -84,10 +85,10 @@ public class FlexpeaterTileEntity extends SyncedTileEntity implements ITickableT public String getUnit() { if (newMaxState < 20) - return "Ticks"; + return Lang.translate("generic.unit.ticks"); if (newMaxState < 20 * 60) - return "Seconds"; - return "Minutes"; + return Lang.translate("generic.unit.seconds"); + return Lang.translate("generic.unit.minutes"); } @Override diff --git a/src/main/java/com/simibubi/create/modules/logistics/item/FilterItem.java b/src/main/java/com/simibubi/create/modules/logistics/item/FilterItem.java index 5b165b090..d1b462875 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/item/FilterItem.java +++ b/src/main/java/com/simibubi/create/modules/logistics/item/FilterItem.java @@ -1,13 +1,10 @@ package com.simibubi.create.modules.logistics.item; -import com.simibubi.create.foundation.item.InfoItem; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; - import net.minecraft.client.renderer.color.IItemColor; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class FilterItem extends InfoItem { +public class FilterItem extends Item { public static class Color implements IItemColor { @Override @@ -26,13 +23,4 @@ public class FilterItem extends InfoItem { super(properties); } - @Override - public ItemDescription getDescription() { - Palette color = Palette.Yellow; - return new ItemDescription(color) - .withSummary("Holds information for controlling input, output and detection of objects.") - .withControl("R-Click while Sneaking", "Opens the " + h("Configuration Screen", color)) - .withControl("When Entity punched", "Creates a filter with the target set to the Entity.").createTabs(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/schematics/ClientSchematicLoader.java b/src/main/java/com/simibubi/create/modules/schematics/ClientSchematicLoader.java index b737a66cf..70d96e6da 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/ClientSchematicLoader.java +++ b/src/main/java/com/simibubi/create/modules/schematics/ClientSchematicLoader.java @@ -19,6 +19,7 @@ import java.util.Map; import com.simibubi.create.AllPackets; import com.simibubi.create.Create; import com.simibubi.create.foundation.utility.FilesHelper; +import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.modules.schematics.packet.SchematicUploadPacket; import net.minecraft.client.Minecraft; @@ -68,10 +69,10 @@ public class ClientSchematicLoader { // Too big Integer maxSize = parameters.maxTotalSchematicSize.get(); if (size > maxSize * 1000) { - Minecraft.getInstance().player - .sendMessage(new StringTextComponent("Your schematic is too large (" + size / 1000 + " KB).")); + Minecraft.getInstance().player.sendMessage(new StringTextComponent( + Lang.translate("schematics.uploadTooLarge") + " (" + size / 1000 + " KB).")); Minecraft.getInstance().player.sendMessage( - new StringTextComponent("The maximum allowed schematic file size is: " + maxSize + " KB")); + new StringTextComponent(Lang.translate("schematics.maxAllowedSize") + " " + maxSize + " KB")); return; } diff --git a/src/main/java/com/simibubi/create/modules/schematics/ServerSchematicLoader.java b/src/main/java/com/simibubi/create/modules/schematics/ServerSchematicLoader.java index e9227fb01..67eaff271 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/ServerSchematicLoader.java +++ b/src/main/java/com/simibubi/create/modules/schematics/ServerSchematicLoader.java @@ -27,6 +27,7 @@ import net.minecraft.block.BlockState; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TranslationTextComponent; public class ServerSchematicLoader { @@ -91,9 +92,10 @@ public class ServerSchematicLoader { // Too big Integer maxFileSize = parameters.maxTotalSchematicSize.get(); if (size > maxFileSize * 1000) { - player.sendMessage(new StringTextComponent("Your schematic is too large (" + size / 1000 + " KB).")); - player.sendMessage( - new StringTextComponent("The maximum allowed schematic file size is: " + maxFileSize + " KB")); + player.sendMessage(new TranslationTextComponent("create.schematics.uploadTooLarge") + .appendSibling(new StringTextComponent(" (" + size / 1000 + " KB)."))); + player.sendMessage(new TranslationTextComponent("create.schematics.maxAllowedSize") + .appendSibling(new StringTextComponent(" " + maxFileSize + " KB"))); return; } diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/CreativeCrateBlock.java b/src/main/java/com/simibubi/create/modules/schematics/block/CreativeCrateBlock.java index 4e90e0f24..791e1689e 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/CreativeCrateBlock.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/CreativeCrateBlock.java @@ -1,9 +1,6 @@ package com.simibubi.create.modules.schematics.block; -import com.simibubi.create.foundation.block.InfoBlock; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; - +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.material.Material; import net.minecraft.util.math.BlockPos; @@ -11,7 +8,7 @@ import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; -public class CreativeCrateBlock extends InfoBlock { +public class CreativeCrateBlock extends Block { protected static final VoxelShape shape = makeCuboidShape(1, 0, 1, 15, 14, 15); @@ -35,12 +32,4 @@ public class CreativeCrateBlock extends InfoBlock { return shape; } - @Override - public ItemDescription getDescription() { - Palette blue = Palette.Blue; - return new ItemDescription(blue) - .withSummary("Grants an attached " + h("Schematicannon", blue) + " unlimited access to blocks.") - .createTabs(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableBlock.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableBlock.java index d50ba15a3..777676558 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableBlock.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableBlock.java @@ -1,41 +1,26 @@ package com.simibubi.create.modules.schematics.block; -import java.util.List; - -import com.simibubi.create.foundation.utility.ITooltip; -import com.simibubi.create.foundation.utility.ItemDescription; -import com.simibubi.create.foundation.utility.ItemDescription.Palette; -import com.simibubi.create.foundation.utility.TooltipHolder; - import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.HorizontalBlock; -import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.inventory.InventoryHelper; import net.minecraft.item.BlockItemUseContext; -import net.minecraft.item.ItemStack; import net.minecraft.state.StateContainer.Builder; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.text.ITextComponent; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.network.NetworkHooks; -public class SchematicTableBlock extends HorizontalBlock implements ITooltip { - - private TooltipHolder info; +public class SchematicTableBlock extends HorizontalBlock { public SchematicTableBlock() { super(Properties.from(Blocks.OAK_PLANKS)); - info = new TooltipHolder(this); } @Override @@ -49,13 +34,6 @@ public class SchematicTableBlock extends HorizontalBlock implements ITooltip { return false; } - @Override - @OnlyIn(value = Dist.CLIENT) - public void addInformation(ItemStack stack, IBlockReader worldIn, List tooltip, - ITooltipFlag flagIn) { - info.addInformation(tooltip); - } - @Override public BlockState getStateForPlacement(BlockItemUseContext context) { return this.getDefaultState().with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite()); @@ -102,12 +80,4 @@ public class SchematicTableBlock extends HorizontalBlock implements ITooltip { } - @Override - public ItemDescription getDescription() { - Palette color = Palette.Blue; - return new ItemDescription(color).withSummary("Writes saved Schematics onto an " + h("Empty Schematic", color)) - .withBehaviour("When given an Empty Schematic", "Uploads the chosen File from your Schematics Folder") - .createTabs(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java index 501f35b44..3a0b44198 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableScreen.java @@ -15,6 +15,7 @@ import com.simibubi.create.foundation.gui.widgets.IconButton; import com.simibubi.create.foundation.gui.widgets.Label; import com.simibubi.create.foundation.gui.widgets.ScrollInput; import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput; +import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.modules.schematics.ClientSchematicLoader; import net.minecraft.client.Minecraft; @@ -35,6 +36,12 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen icons = ImmutableList.of(ScreenResources.ICON_DONT_REPLACE, ScreenResources.ICON_REPLACE_SOLID, ScreenResources.ICON_REPLACE_ANY, ScreenResources.ICON_REPLACE_EMPTY); - List toolTips = ImmutableList.of("Don't Replace Solid Blocks", "Replace Solid with Solid", - "Replace Solid with Any", "Replace Solid with Empty"); + List toolTips = ImmutableList.of(Lang.translate("gui.schematicannon.option.dontReplaceSolid"), + Lang.translate("gui.schematicannon.option.replaceWithSolid"), + Lang.translate("gui.schematicannon.option.replaceWithAny"), + Lang.translate("gui.schematicannon.option.replaceWithEmpty")); for (int i = 0; i < 4; i++) { replaceLevelIndicators.add(new Indicator(x + 16 + i * 18, y + 96, "")); @@ -86,12 +103,12 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen"); + if (w instanceof IconButton) { + IconButton button = (IconButton) w; + if (!button.getToolTip().isEmpty()) { + button.setToolTip(button.getToolTip().get(0)); + button.getToolTip().add(TooltipHelper.holdShift(Palette.Blue, hasShiftDown())); } + } if (hasShiftDown()) { - if (skipMissingButton.isHovered()) { - List tip = skipMissingButton.getToolTip(); - tip.remove(1); - tip.add(TextFormatting.BLUE - + (skipMissingIndicator.state == State.ON ? "Currently Enabled" : "Currently Disabled")); - tip.add(TextFormatting.GRAY + "If the Schematicannon cannot find"); - tip.add(TextFormatting.GRAY + "a required Block for placement, it"); - tip.add(TextFormatting.GRAY + "will continue at the next Location."); - } - if (skipTilesButton.isHovered()) { - List tip = skipTilesButton.getToolTip(); - tip.remove(1); - tip.add(TextFormatting.BLUE - + (skipTilesIndicator.state == State.ON ? "Currently Enabled" : "Currently Disabled")); - tip.add(TextFormatting.GRAY + "The Schematicannon will avoid replacing"); - tip.add(TextFormatting.GRAY + "data holding blocks such as Chests."); - } - if (replaceLevelButtons.get(0).isHovered()) { - List tip = replaceLevelButtons.get(0).getToolTip(); - tip.remove(1); - tip.add(TextFormatting.BLUE + (replaceLevelIndicators.get(0).state == State.ON ? "Currently Enabled" - : "Currently Disabled")); - tip.add(TextFormatting.GRAY + "The cannon will never replace"); - tip.add(TextFormatting.GRAY + "any Solid blocks in its working area,"); - tip.add(TextFormatting.GRAY + "only non-Solid and Air."); - } - if (replaceLevelButtons.get(1).isHovered()) { - List tip = replaceLevelButtons.get(1).getToolTip(); - tip.remove(1); - tip.add(TextFormatting.BLUE + (replaceLevelIndicators.get(1).state == State.ON ? "Currently Enabled" - : "Currently Disabled")); - tip.add(TextFormatting.GRAY + "The cannon will only replace"); - tip.add(TextFormatting.GRAY + "Solid blocks in its working area,"); - tip.add(TextFormatting.GRAY + "if the Schematic contains a solid"); - tip.add(TextFormatting.GRAY + "Block at their location."); - } - if (replaceLevelButtons.get(2).isHovered()) { - List tip = replaceLevelButtons.get(2).getToolTip(); - tip.remove(1); - tip.add(TextFormatting.BLUE + (replaceLevelIndicators.get(2).state == State.ON ? "Currently Enabled" - : "Currently Disabled")); - tip.add(TextFormatting.GRAY + "The cannon will replace"); - tip.add(TextFormatting.GRAY + "Solid blocks in its working area,"); - tip.add(TextFormatting.GRAY + "if the Schematic contains any"); - tip.add(TextFormatting.GRAY + "Block at their location."); - } - if (replaceLevelButtons.get(3).isHovered()) { - List tip = replaceLevelButtons.get(3).getToolTip(); - tip.remove(1); - tip.add(TextFormatting.BLUE + (replaceLevelIndicators.get(3).state == State.ON ? "Currently Enabled" - : "Currently Disabled")); - tip.add(TextFormatting.GRAY + "The cannon will clear out all"); - tip.add(TextFormatting.GRAY + "blocks in its working area,"); - tip.add(TextFormatting.GRAY + "including those replaced by Air."); - } - + fillToolTip(skipMissingButton, skipMissingIndicator, "skipMissing"); + fillToolTip(skipTilesButton, skipTilesIndicator, "skipTileEntities"); + fillToolTip(replaceLevelButtons.get(0), replaceLevelIndicators.get(0), "dontReplaceSolid"); + fillToolTip(replaceLevelButtons.get(1), replaceLevelIndicators.get(1), "replaceWithSolid"); + fillToolTip(replaceLevelButtons.get(2), replaceLevelIndicators.get(2), "replaceWithAny"); + fillToolTip(replaceLevelButtons.get(3), replaceLevelIndicators.get(3), "replaceWithEmpty"); } } + private void fillToolTip(IconButton button, Indicator indicator, String tooltipKey) { + if (!button.isHovered()) + return; + boolean enabled = indicator.state == State.ON; + List tip = button.getToolTip(); + tip.add(TextFormatting.BLUE + (enabled ? optionEnabled : optionDisabled)); + tip.addAll(TooltipHelper.cutString(Lang.translate("gui.schematicannon.option." + tooltipKey + ".description"), + GRAY, GRAY)); + } + @Override protected void renderWindow(int mouseX, int mouseY, float partialTicks) { ScreenResources.PLAYER_INVENTORY.draw(this, guiLeft - 10, guiTop + 145); @@ -224,9 +203,9 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen= paperX && mouseY >= paperY && mouseX <= paperX + 16 && mouseY <= paperY + 16) { - renderTooltip("Material List Printer", mouseX, mouseY); + renderTooltip(listPrinter, mouseX, mouseY); } super.renderWindowForeground(mouseX, mouseY, partialTicks); diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonTileEntity.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonTileEntity.java index 13f54b2d2..e039f314d 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonTileEntity.java @@ -181,7 +181,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka attachedInventories = new LinkedList<>(); flyingBlocks = new LinkedList<>(); inventory = new SchematicannonInventory(); - statusMsg = "Idle"; + statusMsg = "idle"; state = State.STOPPED; replaceMode = 2; neighbourCheckCooldown = NEIGHBOUR_CHECKING; @@ -392,7 +392,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka if (blueprint.isEmpty()) { state = State.STOPPED; - statusMsg = "Idle"; + statusMsg = "idle"; sendUpdate = true; return; } @@ -416,7 +416,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka if (fuelLevel <= 0) { fuelLevel = 0; state = State.PAUSED; - statusMsg = "Out of Gunpowder"; + statusMsg = "noGunpowder"; sendUpdate = true; return; } @@ -443,7 +443,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka // Check block if (!getWorld().isAreaLoaded(target, 0)) { blockNotLoaded = true; - statusMsg = "Block is not loaded"; + statusMsg = "targetNotLoaded"; state = State.PAUSED; return; } else { @@ -455,7 +455,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka BlockState blockState = blockReader.getBlockState(target); if (!shouldPlace(target, blockState)) { - statusMsg = "Searching"; + statusMsg = "searching"; blockSkipped = true; return; } @@ -469,7 +469,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka if (!findItemInAttachedInventories(requiredItem)) { if (skipMissing) { - statusMsg = "Skipping"; + statusMsg = "skipping"; blockSkipped = true; if (missingBlock != null) { missingBlock = null; @@ -480,16 +480,16 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka missingBlock = blockState; state = State.PAUSED; - statusMsg = "Missing Block: "; + statusMsg = "missingBlock"; return; } // Success state = State.RUNNING; if (blockState.getBlock() != Blocks.AIR) - statusMsg = "Placing: " + blocksPlaced + " / " + blocksToPlace; + statusMsg = "placing"; else - statusMsg = "Clearing Blocks"; + statusMsg = "clearing"; launchBlock(target, blockState); printerCooldown = parameters.schematicannonDelay.get(); fuelLevel -= getFuelUsageRate(); @@ -504,14 +504,14 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka protected void initializePrinter(ItemStack blueprint) { if (!blueprint.hasTag()) { state = State.STOPPED; - statusMsg = "Invalid Blueprint"; + statusMsg = "schematicInvalid"; sendUpdate = true; return; } if (!blueprint.getTag().getBoolean("Deployed")) { state = State.STOPPED; - statusMsg = "Blueprint not Deployed"; + statusMsg = "schematicNotPlaced"; sendUpdate = true; return; } @@ -522,7 +522,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka if (activeTemplate.getSize().equals(BlockPos.ZERO)) { state = State.STOPPED; - statusMsg = "Schematic File Expired"; + statusMsg = "schematicExpired"; inventory.setStackInSlot(0, ItemStack.EMPTY); inventory.setStackInSlot(1, new ItemStack(AllItems.EMPTY_BLUEPRINT.get())); return; @@ -530,7 +530,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka if (!anchor.withinDistance(getPos(), MAX_ANCHOR_DISTANCE)) { state = State.STOPPED; - statusMsg = "Target too Far Away"; + statusMsg = "targetOutsideRange"; return; } @@ -539,7 +539,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka activeTemplate.addBlocksToWorld(blockReader, schematicAnchor, SchematicItem.getSettings(blueprint)); schematicLoaded = true; state = State.PAUSED; - statusMsg = "Ready"; + statusMsg = "ready"; updateChecklist(); sendUpdate = true; blocksToPlace += blocksPlaced; @@ -603,7 +603,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka inventory.setStackInSlot(1, new ItemStack(AllItems.EMPTY_BLUEPRINT.get(), inventory.getStackInSlot(1).getCount() + 1)); state = State.STOPPED; - statusMsg = "Finished"; + statusMsg = "finished"; resetPrinter(); target = getPos().add(1, 0, 0); world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_NOTE_BLOCK_BELL, diff --git a/src/main/java/com/simibubi/create/modules/schematics/client/SchematicAndQuillHandler.java b/src/main/java/com/simibubi/create/modules/schematics/client/SchematicAndQuillHandler.java index 58c1698a0..54e45628d 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/client/SchematicAndQuillHandler.java +++ b/src/main/java/com/simibubi/create/modules/schematics/client/SchematicAndQuillHandler.java @@ -15,6 +15,7 @@ import com.simibubi.create.AllSpecialTextures; import com.simibubi.create.foundation.gui.ScreenOpener; import com.simibubi.create.foundation.gui.TextInputPromptScreen; import com.simibubi.create.foundation.utility.FilesHelper; +import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.RaycastHelper; import com.simibubi.create.foundation.utility.RaycastHelper.PredicateTraceResult; import com.simibubi.create.foundation.utility.TessellatorHelper; @@ -38,8 +39,6 @@ import net.minecraft.util.math.MutableBoundingBox; import net.minecraft.util.math.RayTraceResult.Type; import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.gen.feature.template.Template; public class SchematicAndQuillHandler { @@ -84,10 +83,8 @@ public class SchematicAndQuillHandler { firstPos = new BlockPos(bb.minX, bb.minY, bb.minZ); secondPos = new BlockPos(bb.maxX, bb.maxY, bb.maxZ); - Minecraft.getInstance().player.sendStatusMessage( - new StringTextComponent( - "Schematic size: " + (bb.getXSize()) + "x" + (bb.getYSize()) + "x" + (bb.getZSize())), - true); + Lang.sendStatus(Minecraft.getInstance().player, "schematicAndQuill.dimensions", bb.getXSize(), + bb.getYSize(), bb.getZSize()); } return true; @@ -104,33 +101,33 @@ public class SchematicAndQuillHandler { if (player.isSneaking()) { firstPos = null; secondPos = null; - player.sendStatusMessage(new StringTextComponent("Removed selection."), true); + Lang.sendStatus(player, "schematicAndQuill.abort"); return; } if (secondPos != null) { TextInputPromptScreen guiScreenIn = new TextInputPromptScreen(this::saveSchematic, s -> { }); - guiScreenIn.setTitle("Enter a name for the Schematic:"); - guiScreenIn.setButtonTextConfirm("Save"); - guiScreenIn.setButtonTextAbort("Cancel"); + guiScreenIn.setTitle(Lang.translate("schematicAndQuill.prompt")); + guiScreenIn.setButtonTextConfirm(Lang.translate("action.saveToFile")); + guiScreenIn.setButtonTextAbort(Lang.translate("action.discard")); ScreenOpener.open(guiScreenIn); return; } if (selectedPos == null) { - player.sendStatusMessage(new StringTextComponent("Hold [CTRL] to select Air blocks."), true); + Lang.sendStatus(player, "schematicAndQuill.noTarget"); return; } if (firstPos != null) { secondPos = selectedPos; - player.sendStatusMessage(new StringTextComponent(TextFormatting.GREEN + "Second position set."), true); + Lang.sendStatus(player, "schematicAndQuill.secondPos"); return; } firstPos = selectedPos; - player.sendStatusMessage(new StringTextComponent(TextFormatting.GREEN + "First position set."), true); + Lang.sendStatus(player, "schematicAndQuill.firstPos"); } public void saveSchematic(String string) { @@ -140,7 +137,7 @@ public class SchematicAndQuillHandler { new BlockPos(bb.getXSize(), bb.getYSize(), bb.getZSize()), false, Blocks.AIR); if (string.isEmpty()) - string = "My Schematic"; + string = Lang.translate("schematicAndQuill.fallbackName"); String folderPath = "schematics"; FilesHelper.createFolderIfMissing(folderPath); @@ -160,7 +157,7 @@ public class SchematicAndQuillHandler { } firstPos = null; secondPos = null; - Minecraft.getInstance().player.sendStatusMessage(new StringTextComponent("Saved as " + filepath), true); + Lang.sendStatus(Minecraft.getInstance().player, "schematicAndQuill.saved", filepath); } public void render() { diff --git a/src/main/java/com/simibubi/create/modules/schematics/client/SchematicEditScreen.java b/src/main/java/com/simibubi/create/modules/schematics/client/SchematicEditScreen.java index 813851f61..f4aae8c14 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/client/SchematicEditScreen.java +++ b/src/main/java/com/simibubi/create/modules/schematics/client/SchematicEditScreen.java @@ -3,7 +3,6 @@ package com.simibubi.create.modules.schematics.client; import java.util.Collections; import java.util.List; -import com.google.common.collect.ImmutableList; import com.mojang.blaze3d.platform.GlStateManager; import com.simibubi.create.AllItems; import com.simibubi.create.CreateClient; @@ -12,6 +11,7 @@ import com.simibubi.create.foundation.gui.ScreenResources; import com.simibubi.create.foundation.gui.widgets.Label; import com.simibubi.create.foundation.gui.widgets.ScrollInput; import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput; +import com.simibubi.create.foundation.utility.Lang; import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.item.ItemStack; @@ -25,9 +25,13 @@ public class SchematicEditScreen extends AbstractSimiScreen { private TextFieldWidget yInput; private TextFieldWidget zInput; - private static final List rotationOptions = ImmutableList.of("None", "Clockwise 90", "Clockwise 180", - "Clockwise 270"); - private static final List mirrorOptions = ImmutableList.of("None", "Left-Right", "Front-Back"); + private final List rotationOptions = Lang.translatedOptions("schematic.rotation", "none", "cw90", "cw180", + "cw270"); + private final List mirrorOptions = Lang.translatedOptions("schematic.mirror", "none", "leftRight", + "frontBack"); + private final String positionLabel = Lang.translate("schematic.position"); + private final String rotationLabel = Lang.translate("schematic.rotation"); + private final String mirrorLabel = Lang.translate("schematic.mirror"); private ScrollInput rotationArea; private ScrollInput mirrorArea; @@ -126,9 +130,9 @@ public class SchematicEditScreen extends AbstractSimiScreen { font.drawStringWithShadow(handler.cachedSchematicName, x + 103 - font.getStringWidth(handler.cachedSchematicName) / 2, y + 10, 0xDDEEFF); - font.drawString("Position", x + 10, y + 32, ScreenResources.FONT_COLOR); - font.drawString("Rotation", x + 10, y + 52, ScreenResources.FONT_COLOR); - font.drawString("Mirror", x + 10, y + 72, ScreenResources.FONT_COLOR); + font.drawString(positionLabel, x + 10, y + 32, ScreenResources.FONT_COLOR); + font.drawString(rotationLabel, x + 10, y + 52, ScreenResources.FONT_COLOR); + font.drawString(mirrorLabel, x + 10, y + 72, ScreenResources.FONT_COLOR); GlStateManager.pushMatrix(); GlStateManager.translated(guiLeft + 220, guiTop + 20, 0); diff --git a/src/main/java/com/simibubi/create/modules/schematics/client/SchematicHandler.java b/src/main/java/com/simibubi/create/modules/schematics/client/SchematicHandler.java index c93a90bdf..2eaba818c 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/client/SchematicHandler.java +++ b/src/main/java/com/simibubi/create/modules/schematics/client/SchematicHandler.java @@ -1,6 +1,8 @@ package com.simibubi.create.modules.schematics.client; +import java.util.Arrays; import java.util.HashMap; +import java.util.List; import com.google.common.collect.ImmutableList; import com.simibubi.create.AllItems; @@ -10,6 +12,7 @@ import com.simibubi.create.CreateClient; import com.simibubi.create.foundation.gui.ToolSelectionScreen; import com.simibubi.create.foundation.packet.NbtPacket; import com.simibubi.create.foundation.type.Cuboid; +import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.TessellatorHelper; import com.simibubi.create.modules.schematics.SchematicWorld; import com.simibubi.create.modules.schematics.client.tools.Tools; @@ -44,6 +47,9 @@ public class SchematicHandler { public int slot; public ItemStack item; + private final List mirrors = Arrays.asList("none", "leftRight", "frontBack"); + private final List rotations = Arrays.asList("none", "cw90", "cw180", "cw270"); + public Tools currentTool; public ToolSelectionScreen selectionScreen; @@ -194,7 +200,7 @@ public class SchematicHandler { } public void sync() { - Minecraft.getInstance().player.sendStatusMessage(new StringTextComponent("Syncing..."), true); + message(Lang.translate("schematics.synchronizing")); AllPackets.channel.sendToServer(new NbtPacket(item, slot)); if (deployed) { @@ -246,22 +252,23 @@ public class SchematicHandler { if (m == Mirror.NONE) { cachedSettings.setMirror(mirror); anchor = anchor.add(anchorOffset); - Minecraft.getInstance().player.sendStatusMessage( - new StringTextComponent("Mirror: " + cachedSettings.getMirror().toString()), true); + message(Lang.translate("schematic.mirror") + ": " + + Lang.translate("schematic.mirror." + mirrors.get(cachedSettings.getMirror().ordinal()))); } else if (m == mirror) { cachedSettings.setMirror(Mirror.NONE); anchor = anchor.subtract(anchorOffset); - Minecraft.getInstance().player.sendStatusMessage( - new StringTextComponent("Mirror: " + cachedSettings.getMirror().toString()), true); + message(Lang.translate("schematic.mirror") + ": " + + Lang.translate("schematic.mirror." + mirrors.get(cachedSettings.getMirror().ordinal()))); } else if (m != mirror) { cachedSettings.setMirror(Mirror.NONE); anchor = anchor.add(anchorOffset); cachedSettings.setRotation(r.add(Rotation.CLOCKWISE_180)); - Minecraft.getInstance().player.sendStatusMessage( - new StringTextComponent("Mirror: None, Rotation: " + cachedSettings.getRotation().toString()), - true); + message(Lang.translate("schematic.mirror") + ": " + + Lang.translate("schematic.mirror." + mirrors.get(cachedSettings.getMirror().ordinal())) + ", " + + Lang.translate("schematic.rotation") + ": " + + Lang.translate("schematic.rotation." + rotations.get(cachedSettings.getRotation().ordinal()))); } item.getTag().put("Anchor", NBTUtil.writeBlockPos(anchor)); @@ -271,6 +278,10 @@ public class SchematicHandler { markDirty(); } + public void message(String msg) { + Minecraft.getInstance().player.sendStatusMessage(new StringTextComponent(msg), true); + } + public void rotate(Rotation rotation) { Rotation r = cachedSettings.getRotation(); BlockPos center = centerOfSchematic(); @@ -282,8 +293,8 @@ public class SchematicHandler { item.getTag().put("Anchor", NBTUtil.writeBlockPos(anchor)); item.getTag().putString("Rotation", cachedSettings.getRotation().name()); - Minecraft.getInstance().player.sendStatusMessage( - new StringTextComponent("Rotation: " + cachedSettings.getRotation().toString()), true); + message(Lang.translate("schematic.rotation") + ": " + + Lang.translate("schematic.rotation." + rotations.get(cachedSettings.getRotation().ordinal()))); markDirty(); } diff --git a/src/main/java/com/simibubi/create/modules/schematics/client/tools/Tools.java b/src/main/java/com/simibubi/create/modules/schematics/client/tools/Tools.java index 87908e183..60a090217 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/client/tools/Tools.java +++ b/src/main/java/com/simibubi/create/modules/schematics/client/tools/Tools.java @@ -4,51 +4,24 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import com.google.common.collect.ImmutableList; import com.simibubi.create.foundation.gui.ScreenResources; - -import net.minecraft.util.text.TextFormatting; +import com.simibubi.create.foundation.utility.Lang; public enum Tools { - Deploy(new DeployTool(), "Deploy", ScreenResources.ICON_TOOL_DEPLOY, ImmutableList.of( - "Moves the structure to a location.", - "Right-Click on the ground to place.", - "Hold [Ctrl] to select at a fixed distance.", - "[Ctrl]-Scroll to change the distance." - )), - Move(new MoveTool(), "Move XZ", ScreenResources.ICON_TOOL_MOVE_XZ, ImmutableList.of( - "Shifts the Schematic Horizontally", - "Point at the Schematic and [CTRL]-Scroll to push it." - )), - MoveY(new MoveVerticalTool(), "Move Y", ScreenResources.ICON_TOOL_MOVE_Y, ImmutableList.of( - "Shifts the Schematic Vertically", - "[CTRL]-Scroll to move it up/down" - )), - Rotate(new RotateTool(), "Rotate", ScreenResources.ICON_TOOL_ROTATE, ImmutableList.of( - "Rotates the Schematic around its center.", - "[CTRL]-Scroll to rotate by 90 Degrees" - )), - Print(new PlaceTool(), "Print", ScreenResources.ICON_CONFIRM, ImmutableList.of( - "Instantly places the structure in the world", - "[Right-Click] to confirm placement at the current location.", - TextFormatting.ITALIC + "(Creative only)" - )), - Flip(new FlipTool(), "Flip", ScreenResources.ICON_TOOL_MIRROR, ImmutableList.of( - "Flips the Schematic along the face you select.", - "Point at the Schematic and [CTRL]-Scroll to flip it." - )); + Deploy(new DeployTool(), ScreenResources.ICON_TOOL_DEPLOY), + Move(new MoveTool(), ScreenResources.ICON_TOOL_MOVE_XZ), + MoveY(new MoveVerticalTool(), ScreenResources.ICON_TOOL_MOVE_Y), + Rotate(new RotateTool(), ScreenResources.ICON_TOOL_ROTATE), + Print(new PlaceTool(), ScreenResources.ICON_CONFIRM), + Flip(new FlipTool(), ScreenResources.ICON_TOOL_MIRROR); private ISchematicTool tool; - private String displayName; private ScreenResources icon; - private List description; - private Tools(ISchematicTool tool, String name, ScreenResources icon, List description) { + private Tools(ISchematicTool tool, ScreenResources icon) { this.tool = tool; - this.displayName = name; this.icon = icon; - this.description = description; } public ISchematicTool getTool() { @@ -56,7 +29,7 @@ public enum Tools { } public String getDisplayName() { - return displayName; + return Lang.translate("schematic.tool." + name().toLowerCase()); } public ScreenResources getIcon() { @@ -72,7 +45,7 @@ public enum Tools { } public List getDescription() { - return description; + return Lang.translatedOptions("schematic.tool." + name().toLowerCase() + ".description", "0", "1", "2", "3"); } } diff --git a/src/main/java/com/simibubi/create/modules/schematics/item/SchematicItem.java b/src/main/java/com/simibubi/create/modules/schematics/item/SchematicItem.java index 3be80408b..f193e0846 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/item/SchematicItem.java +++ b/src/main/java/com/simibubi/create/modules/schematics/item/SchematicItem.java @@ -11,6 +11,7 @@ import org.apache.commons.io.IOUtils; import com.simibubi.create.AllItems; import com.simibubi.create.AllKeys; +import com.simibubi.create.CreateConfig; import com.simibubi.create.foundation.gui.ScreenOpener; import com.simibubi.create.modules.schematics.client.SchematicEditScreen; @@ -58,15 +59,17 @@ public class SchematicItem extends Item { blueprint.setTag(tag); writeSize(blueprint); - blueprint.setDisplayName(new StringTextComponent(TextFormatting.RESET + "" + TextFormatting.WHITE - + "Schematic (" + TextFormatting.GOLD + schematic + TextFormatting.WHITE + ")")); - return blueprint; } @Override @OnlyIn(value = Dist.CLIENT) public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { + if (stack.hasTag()) { + if (stack.getTag().contains("File")) + tooltip.add(new StringTextComponent(TextFormatting.GOLD + stack.getTag().getString("File"))); + } + if (AllKeys.shiftDown()) { TextFormatting gray = TextFormatting.GRAY; tooltip.add(new StringTextComponent(gray + "Holds a structure to be printed")); @@ -104,7 +107,7 @@ public class SchematicItem extends Item { String filepath = ""; if (Thread.currentThread().getThreadGroup() == SidedThreadGroups.SERVER) - filepath = "schematics/uploaded/" + owner + "/" + schematic; + filepath = CreateConfig.parameters.schematicPath + "/" + owner + "/" + schematic; else filepath = "schematics/" + schematic; diff --git a/src/main/java/com/simibubi/create/modules/schematics/packet/ConfigureSchematicannonPacket.java b/src/main/java/com/simibubi/create/modules/schematics/packet/ConfigureSchematicannonPacket.java index bbe111009..70937df2d 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/packet/ConfigureSchematicannonPacket.java +++ b/src/main/java/com/simibubi/create/modules/schematics/packet/ConfigureSchematicannonPacket.java @@ -73,15 +73,15 @@ public class ConfigureSchematicannonPacket extends SimplePacketBase { case PLAY: te.state = State.RUNNING; - te.statusMsg = "Running"; + te.statusMsg = "running"; break; case PAUSE: te.state = State.PAUSED; - te.statusMsg = "Paused"; + te.statusMsg = "paused"; break; case STOP: te.state = State.STOPPED; - te.statusMsg = "Stopped"; + te.statusMsg = "stopped"; break; default: break; diff --git a/src/main/resources/assets/create/lang/en_us.json b/src/main/resources/assets/create/lang/en_us.json index 5f5a97482..b57e5e916 100644 --- a/src/main/resources/assets/create/lang/en_us.json +++ b/src/main/resources/assets/create/lang/en_us.json @@ -1,4 +1,7 @@ { + + "_comment": "-------------------------] GAME ELEMENTS [------------------------------------------------", + "item.create.symmetry_wand": "Staff of Symmetry", "item.create.placement_handgun": "Handheld Blockzapper", "item.create.tree_fertilizer": "Tree Fertilizer", @@ -133,11 +136,276 @@ "block.create.cocoa_log": "Cocoa Jungle Log", "block.create.shop_shelf": "Shelf", + + "_comment": "-------------------------] UI & MESSAGES [------------------------------------------------", "death.attack.create.crush": "%1$s was processed by Crushing Wheels", "death.attack.create.fan_fire": "%1$s was burned to death by hot air", "death.attack.create.fan_lava": "%1$s was burned to death by lava fan", "death.attack.create.drill": "%1$s was impaled by Mechanical Drill", + "create.generic.range": "Range", + "create.generic.radius": "Radius", + "create.generic.speed": "Speed", + "create.generic.delay": "Delay", + "create.generic.unit.ticks": "Ticks", + "create.generic.unit.seconds": "Seconds", + "create.generic.unit.minutes": "Minutes", + + "create.action.scroll": "Scroll", + "create.action.confirm": "Confirm", + "create.action.abort": "Abort", + "create.action.saveToFile": "Save", + "create.action.discard": "Discard", + + "create.keyinfo.toolmenu": "Focus Tool Menu", + + "create.gui.scrollInput.defaultTitle": "Choose an Option:", + "create.gui.scrollInput.scrollToModify": "Scroll to Modify", + "create.gui.scrollInput.scrollToSelect": "Scroll to Select", + "create.gui.scrollInput.shiftScrollsFaster": "Shift to Scroll faster", + + "create.gui.toolmenu.focusKey": "Hold [%1$s] to Focus", + "create.gui.toolmenu.cycle": "[SCROLL] to Cycle", + + "create.gui.symmetryWand.mirrorType": "Mirror", + "create.gui.symmetryWand.orientation": "Orientation", + "create.symmetry.mirror.plane": "Mirror once", + "create.symmetry.mirror.doublePlane": "Rectangular", + "create.symmetry.mirror.triplePlane": "Octagonal", + "create.orientation.orthogonal": "Orthogonal", + "create.orientation.diagonal": "Diagonal", + "create.orientation.horizontal": "Horizontal", + "create.orientation.alongZ": "Along Z", + "create.orientation.alongX": "Along X", + + "create.gui.blockzapper.title": "Handheld Blockzapper", + "create.gui.blockzapper.replaceMode": "Replace Mode", + "create.gui.blockzapper.searchDiagonal": "Follow Diagonals", + "create.gui.blockzapper.searchFuzzy": "Ignore Material Borders", + "create.gui.blockzapper.range": "Spread Range", + "create.gui.blockzapper.patternSection": "Patterns", + "create.gui.blockzapper.pattern.solid": "Solid", + "create.gui.blockzapper.pattern.checkered": "Checkerboard", + "create.gui.blockzapper.pattern.inversecheckered": "Inversed Checkerboard", + "create.gui.blockzapper.pattern.chance25": "25% Roll", + "create.gui.blockzapper.pattern.chance50": "50% Roll", + "create.gui.blockzapper.pattern.chance75": "75% Roll", + + "create.blockzapper.usingBlock": "Using: %1$s", + "create.blockzapper.componentUpgrades": "Component Upgrades:", + "create.blockzapper.component.body": "Body", + "create.blockzapper.component.amplifier": "Amplifier", + "create.blockzapper.component.accelerator": "Accelerator", + "create.blockzapper.component.retriever": "Retriever", + "create.blockzapper.component.scope": "Scope", + "create.blockzapper.componentTier.none": "None", + "create.blockzapper.componentTier.blazebrass": "Blaze Brass", + "create.blockzapper.componentTier.choruschrome": "Chorus Chrome", + "create.blockzapper.leftClickToSet": "Left-Click a Block to set Material", + "create.blockzapper.empty": "Out of Blocks!", + + "create.logistics.filter": "Filter", + "create.logistics.firstFrequency": "Freq. #1", + "create.logistics.secondFrequency": "Freq. #2", + + "create.gui.flexcrate.title": "FlexCrate", + "create.gui.flexcrate.storageSpace": "Storage Space", + + "create.gui.stockswitch.title": "Stockpile Switch", + "create.gui.stockswitch.lowerLimit": "Lower Threshold", + "create.gui.stockswitch.upperLimit": "Upper Threshold", + "create.gui.stockswitch.startAt": "Start Signal at", + "create.gui.stockswitch.startAbove": "Start Signal above", + "create.gui.stockswitch.stopAt": "Stop Signal at", + "create.gui.stockswitch.stopBelow": "Stop Signal below", + + "create.schematicAndQuill.dimensions": "Schematic Size: %1$sx%2$sx%3$s", + "create.schematicAndQuill.firstPos": "First position set.", + "create.schematicAndQuill.secondPos": "Second position set.", + "create.schematicAndQuill.noTarget": "Hold [Ctrl] to select Air blocks.", + "create.schematicAndQuill.abort": "Removed selection.", + "create.schematicAndQuill.prompt": "Enter a name for the Schematic:", + "create.schematicAndQuill.fallbackName": "My Schematic", + "create.schematicAndQuill.saved": "Saved as %1$s", + + "create.schematic.position": "Position", + "create.schematic.rotation": "Rotation", + "create.schematic.rotation.none": "None", + "create.schematic.rotation.cw90": "Clockwise 90", + "create.schematic.rotation.cw180": "Clockwise 180", + "create.schematic.rotation.cw270": "Clockwise 270", + "create.schematic.mirror": "Mirror", + "create.schematic.mirror.none": "None", + "create.schematic.mirror.frontBack": "Front-Back", + "create.schematic.mirror.leftRight": "Left-Right", + + "create.schematic.tool.deploy": "Deploy", + "create.schematic.tool.move": "Move XZ", + "create.schematic.tool.movey": "Move Y", + "create.schematic.tool.rotate": "Rotate", + "create.schematic.tool.print": "Print", + "create.schematic.tool.flip": "Flip", + + "create.schematic.tool.deploy.description.0": "Moves the structure to a location.", + "create.schematic.tool.deploy.description.1": "Right-Click on the ground to place.", + "create.schematic.tool.deploy.description.2": "Hold [Ctrl] to select at a fixed distance.", + "create.schematic.tool.deploy.description.3": "[Ctrl]-Scroll to change the distance.", + "create.schematic.tool.move.description.0": "Shifts the Schematic Horizontally", + "create.schematic.tool.move.description.1": "Point at the Schematic and [CTRL]-Scroll to push it.", + "create.schematic.tool.move.description.2": "", + "create.schematic.tool.move.description.3": "", + "create.schematic.tool.movey.description.0": "Shifts the Schematic Vertically", + "create.schematic.tool.movey.description.1": "[CTRL]-Scroll to move it up/down", + "create.schematic.tool.movey.description.2": "", + "create.schematic.tool.movey.description.3": "", + "create.schematic.tool.rotate.description.0": "Rotates the Schematic around its center.", + "create.schematic.tool.rotate.description.1": "[CTRL]-Scroll to rotate by 90 Degrees", + "create.schematic.tool.rotate.description.2": "", + "create.schematic.tool.rotate.description.3": "", + "create.schematic.tool.print.description.0": "Instantly places the structure in the world", + "create.schematic.tool.print.description.1": "[Right-Click] to confirm placement at the current location.", + "create.schematic.tool.print.description.2": "This tool is for Creative Mode only.", + "create.schematic.tool.print.description.3": "", + "create.schematic.tool.flip.description.0": "Flips the Schematic along the face you select.", + "create.schematic.tool.flip.description.1": "Point at the Schematic and [CTRL]-Scroll to flip it.", + "create.schematic.tool.flip.description.2": "", + "create.schematic.tool.flip.description.3": "", + + "create.schematics.synchronizing": "Syncing...", + "create.schematics.uploadTooLarge": "Your schematic is too large", + "create.schematics.maxAllowedSize": "The maximum allowed schematic file size is:", + + "create.gui.schematicTable.title": "Schematic Table", + "create.gui.schematicTable.availableSchematics": "Available Schematics", + "create.gui.schematicTable.noSchematics": "No Schematics Saved", + "create.gui.schematicTable.uploading": "Uploading...", + "create.gui.schematicTable.finished": "Upload Finished!", + + "create.gui.schematicannon.title": "Schematicannon", + "create.gui.schematicannon.settingsTitle": "Placement Settings", + "create.gui.schematicannon.listPrinter": "Material List Printer", + "create.gui.schematicannon.gunpowderLevel": "Gunpowder at %1$s%%", + "create.gui.schematicannon.shotsRemaining": "Shots left: %1$s", + "create.gui.schematicannon.shotsRemainingWithBackup": "With backup: %1$s", + "create.gui.schematicannon.optionEnabled": "Currently Enabled", + "create.gui.schematicannon.optionDisabled": "Currently Disabled", + "create.gui.schematicannon.option.dontReplaceSolid": "Don't Replace Solid Blocks", + "create.gui.schematicannon.option.replaceWithSolid": "Replace Solid with Solid", + "create.gui.schematicannon.option.replaceWithAny": "Replace Solid with Any", + "create.gui.schematicannon.option.replaceWithEmpty": "Replace Solid with Empty", + "create.gui.schematicannon.option.skipMissing": "Skip missing Blocks", + "create.gui.schematicannon.option.skipTileEntities": "Protect Tile Entities", + + "create.gui.schematicannon.option.skipMissing.description": "If the Schematicannon cannot find a required Block for placement, it will continue at the next Location.", + "create.gui.schematicannon.option.skipTileEntities.description": "The Schematicannon will avoid replacing data holding blocks such as Chests.", + "create.gui.schematicannon.option.dontReplaceSolid.description": "The cannon will never replace any Solid blocks in its working area, only non-Solid and Air.", + "create.gui.schematicannon.option.replaceWithSolid.description": "The cannon will only replace Solid blocks in its working area, if the Schematic contains a solid Block at their location.", + "create.gui.schematicannon.option.replaceWithAny.description": "The cannon will replace Solid blocks in its working area, if the Schematic contains any Block at their location.", + "create.gui.schematicannon.option.replaceWithEmpty.description": "The cannon will clear out all blocks in its working area, including those replaced by Air.", + + "create.schematicannon.status.idle": "Idle", + "create.schematicannon.status.ready": "Ready", + "create.schematicannon.status.running": "Running", + "create.schematicannon.status.finished": "Finished", + "create.schematicannon.status.paused": "Paused", + "create.schematicannon.status.stopped": "Stopped", + "create.schematicannon.status.noGunpowder": "Out of Gunpowder", + "create.schematicannon.status.targetNotLoaded": "Block is not loaded", + "create.schematicannon.status.targetOutsideRange": "Target too Far Away", + "create.schematicannon.status.searching": "Searching", + "create.schematicannon.status.skipping": "Skipping", + "create.schematicannon.status.missingBlock": "Missing Block:", + "create.schematicannon.status.placing": "Placing", + "create.schematicannon.status.clearing": "Clearing Blocks", + "create.schematicannon.status.schematicInvalid": "Schematic Invalid", + "create.schematicannon.status.schematicNotPlaced": "Schematic not Deployed", + "create.schematicannon.status.schematicExpired": "Schematic File Expired", + + "create.tooltip.holdKey": "Hold [%1$s]", + "create.tooltip.holdKeyOrKey": "Hold [%1$s] or [%2$s]", + "create.tooltip.keyShift": "Shift", + "create.tooltip.keyCtrl": "Ctrl", + + "_comment": "-------------------------] ITEM DESCRIPTIONS [------------------------------------------------", + + "item.create.example_item.tooltip": "EXAMPLE ITEM (marker that this tooltip exists)", + "item.create.example_item.tooltip.summary": "A brief description of the item. _Underscores_ highlight a term.", + "item.create.example_item.tooltip.condition1": "When this", + "item.create.example_item.tooltip.behaviour1": "Then this item does this. (behaviours show on shift)", + "item.create.example_item.tooltip.condition2": "And When this", + "item.create.example_item.tooltip.behaviour2": "You can add as many behaviours as you like", + "item.create.example_item.tooltip.control1": "When Ctrl pressed", + "item.create.example_item.tooltip.action1": "These controls are displayed.", + + "item.create.symmetry_wand.tooltip": "SYMMETRY WAND", + "item.create.symmetry_wand.tooltip.summary": "Perfectly mirrors your Block placement across the configured planes.", + "item.create.symmetry_wand.tooltip.condition1": "When in Hotbar", + "item.create.symmetry_wand.tooltip.behaviour1": "Stays Active", + "item.create.symmetry_wand.tooltip.control1": "R-Click on Ground", + "item.create.symmetry_wand.tooltip.action1": "_Creates_ or _Moves_ the Mirror", + "item.create.symmetry_wand.tooltip.control2": "R-Click in the Air", + "item.create.symmetry_wand.tooltip.action2": "_Removes_ the active Mirror", + "item.create.symmetry_wand.tooltip.control3": "R-Click while Sneaking", + "item.create.symmetry_wand.tooltip.action3": "Opens the _Configuration_ _Interface_", + + "item.create.placement_handgun.tooltip": "BLOCKZAPPER", + "item.create.placement_handgun.tooltip.summary": "Novel gadget for placing or exchanging blocks at a distance.", + "item.create.placement_handgun.tooltip.control1": "L-Click at Block", + "item.create.placement_handgun.tooltip.action1": "Sets blocks placed by the tool to the targeted block.", + "item.create.placement_handgun.tooltip.control2": "R-Click at Block", + "item.create.placement_handgun.tooltip.action2": "_Places_ or _Replaces_ the targeted block.", + "item.create.placement_handgun.tooltip.control3": "R-Click while Sneaking", + "item.create.placement_handgun.tooltip.action3": "Opens the _Configuration_ _Interface_", + + "item.create.tree_fertilizer.tooltip": "TREE FERTILIZER", + "item.create.tree_fertilizer.tooltip.summary": "A powerful combination of minerals suitable for common tree types.", + "item.create.tree_fertilizer.tooltip.condition1": "When used on Sapling", + "item.create.tree_fertilizer.tooltip.behaviour1": "Grows Trees regardless of their spacing Conditions", + + "block.create.creative_crate.tooltip": "CREATIVE CRATE", + "block.create.creative_crate.tooltip.summary": "tis a crate", + + "block.create.schematic_table.tooltip": "SCHEMATIC TABLE", + "block.create.schematic_table.tooltip.summary": "Writes saved Schematics onto an _Empty_ _Schematic_", + "block.create.schematic_table.tooltip.condition1": "When given an Empty Schematic", + "block.create.schematic_table.tooltip.behaviour1": "Uploads a chosen File from your Schematics Folder", + + "block.create.gearbox.tooltip": "GEARBOX", + "block.create.gearbox.tooltip.summary": "Relays Rotation to Four directions. Reverses straight connections.", + + "block.create.gearshift.tooltip": "GEARSHIFT", + "block.create.gearshift.tooltip.summary": "A controllable rotation switch for connected shafts.", + "block.create.gearshift.tooltip.condition1": "When Powered", + "block.create.gearshift.tooltip.behaviour1": "_Reverses_ the incoming rotation on the other side.", + + "block.create.clutch.tooltip": "CLUTCH", + "block.create.clutch.tooltip.summary": "A controllable rotation switch for connected shafts.", + "block.create.clutch.tooltip.condition1": "When Powered", + "block.create.clutch.tooltip.behaviour1": "_Stops_ conveying rotation to the other side.", + + "block.create.encased_belt.tooltip": "ENCASED_BELT", + "block.create.encased_belt.tooltip.summary": "Relays rotation through its block and to an attached Encased Belt.", + "block.create.encased_belt.tooltip.condition1": "When Attached to other Encased Belt", + "block.create.encased_belt.tooltip.behaviour1": "Attached Block will have the exact same rotation speed and direction. Attached Belts do not have to face the same way.", + + "block.create.stockswitch.tooltip": "STOCKSWITCH", + "block.create.stockswitch.tooltip.summary": "Toggles a Redstone signal based on the _Storage_ _Space_ in the attached Container.", + "block.create.stockswitch.tooltip.condition1": "When below Lower Limit", + "block.create.stockswitch.tooltip.behaviour1": "Stops providing _Redstone_ _Power_", + "block.create.stockswitch.tooltip.condition2": "When above Upper Limit", + "block.create.stockswitch.tooltip.behaviour2": "Starts providing _Redstone_ _Power_ until Lower Limit is reached again.", + "block.create.stockswitch.tooltip.control1": "When R-Clicked", + "block.create.stockswitch.tooltip.action1": "Opens the _Configuration_ _Screen_", + + "block.create.redstone_bridge.tooltip": "REDSTONE_LINK", + "block.create.redstone_bridge.tooltip.summary": "Endpoints for _Wireless_ _Redstone_ connections. Can be assigned _Frequencies_ using any item. Signal can travel distances up to _128m_", + "block.create.redstone_bridge.tooltip.condition1": "When Powered", + "block.create.redstone_bridge.tooltip.behaviour1": "Bridges of the same _Frequency_ will provide a Redstone signal.", + "block.create.redstone_bridge.tooltip.control1": "When R-Clicked with an Item", + "block.create.redstone_bridge.tooltip.action1": "Sets the _Frequency_ to that item. A total of _two_ _different_ _items_ can be used in combination for defining a Frequency.", + "block.create.redstone_bridge.tooltip.control2": "When R-Clicked while Sneaking", + "block.create.redstone_bridge.tooltip.action2": "Toggles between _Receiver_ and _Transmitter_ Mode.", + "itemGroup.create": "Create" }