Internationalize!

- Moved all language specific content to the lang file
- Tooltips are now loaded from the lang file
This commit is contained in:
simibubi 2019-09-14 18:21:30 +02:00
parent 47cde5abb2
commit 0d924bc1f7
91 changed files with 960 additions and 969 deletions

View file

@ -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.ShaftHalfBlock;
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.modules.contraptions.relays.belt.BeltSupportBlock; 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.gardens.CocoaLogBlock;
import com.simibubi.create.modules.logistics.block.BeltFunnelBlock; import com.simibubi.create.modules.logistics.block.BeltFunnelBlock;
import com.simibubi.create.modules.logistics.block.EntityDetectorBlock; 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.CreativeCrateBlock;
import com.simibubi.create.modules.schematics.block.SchematicTableBlock; import com.simibubi.create.modules.schematics.block.SchematicTableBlock;
import com.simibubi.create.modules.schematics.block.SchematicannonBlock; 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;
import net.minecraft.block.Block.Properties; import net.minecraft.block.Block.Properties;

View file

@ -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.BuilderGunItem;
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItemRenderer; import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItemRenderer;
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunModel; 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.gardens.TreeFertilizerItem;
import com.simibubi.create.modules.schematics.item.SchematicAndQuillItem; import com.simibubi.create.modules.schematics.item.SchematicAndQuillItem;
import com.simibubi.create.modules.schematics.item.SchematicItem; 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.Minecraft;
import net.minecraft.client.renderer.color.ItemColors; import net.minecraft.client.renderer.color.ItemColors;

View file

@ -9,7 +9,7 @@ import net.minecraftforge.fml.client.registry.ClientRegistry;
public enum AllKeys { 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), ACTIVATE_TOOL("", GLFW.GLFW_KEY_LEFT_CONTROL),
; ;
@ -20,7 +20,7 @@ public enum AllKeys {
private boolean modifiable; private boolean modifiable;
private AllKeys(String description, int defaultKey) { private AllKeys(String description, int defaultKey) {
this.description = description; this.description = Create.ID + ".keyinfo." + description;
this.key = defaultKey; this.key = defaultKey;
this.modifiable = !description.isEmpty(); this.modifiable = !description.isEmpty();
} }

View file

@ -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.generators.ConfigureMotorPacket;
import com.simibubi.create.modules.contraptions.receivers.constructs.ConfigureChassisPacket; import com.simibubi.create.modules.contraptions.receivers.constructs.ConfigureChassisPacket;
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunBeamPacket; 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.block.diodes.ConfigureFlexpeaterPacket;
import com.simibubi.create.modules.logistics.packet.ConfigureFlexcratePacket; import com.simibubi.create.modules.logistics.packet.ConfigureFlexcratePacket;
import com.simibubi.create.modules.logistics.packet.ConfigureStockswitchPacket; import com.simibubi.create.modules.logistics.packet.ConfigureStockswitchPacket;
import com.simibubi.create.modules.schematics.packet.ConfigureSchematicannonPacket; import com.simibubi.create.modules.schematics.packet.ConfigureSchematicannonPacket;
import com.simibubi.create.modules.schematics.packet.SchematicPlacePacket; import com.simibubi.create.modules.schematics.packet.SchematicPlacePacket;
import com.simibubi.create.modules.schematics.packet.SchematicUploadPacket; import com.simibubi.create.modules.schematics.packet.SchematicUploadPacket;
import com.simibubi.create.modules.symmetry.SymmetryEffectPacket;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;

View file

@ -1,11 +1,17 @@
package com.simibubi.create; package com.simibubi.create;
import java.util.ArrayList;
import java.util.List;
import com.simibubi.create.foundation.block.IBlockWithScrollableValue; import com.simibubi.create.foundation.block.IBlockWithScrollableValue;
import com.simibubi.create.foundation.gui.ScreenOpener; 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.receivers.TurntableHandler;
import com.simibubi.create.modules.contraptions.relays.belt.BeltItemHandler; import com.simibubi.create.modules.contraptions.relays.belt.BeltItemHandler;
import net.minecraft.client.Minecraft; 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.api.distmarker.Dist;
import net.minecraftforge.client.event.InputEvent.KeyInputEvent; import net.minecraftforge.client.event.InputEvent.KeyInputEvent;
import net.minecraftforge.client.event.InputEvent.MouseInputEvent; 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.ClientTickEvent;
import net.minecraftforge.event.TickEvent.Phase; import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.event.TickEvent.RenderTickEvent; import net.minecraftforge.event.TickEvent.RenderTickEvent;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
@EventBusSubscriber(value = Dist.CLIENT) @EventBusSubscriber(value = Dist.CLIENT)
public class ClientEvents { public class ClientEvents {
private static final String itemPrefix = "item." + Create.ID;
private static final String blockPrefix = "block." + Create.ID;
@SubscribeEvent @SubscribeEvent
public static void onTick(ClientTickEvent event) { public static void onTick(ClientTickEvent event) {
if (event.phase == Phase.START) if (event.phase == Phase.START)
@ -93,6 +103,20 @@ public class ClientEvents {
CreateClient.schematicAndQuillHandler.onMouseInput(button, pressed); 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<ITextComponent> toolTip = new ArrayList<>();
TooltipHelper.getTooltip(stack).addInformation(toolTip);
event.getToolTip().addAll(1, toolTip);
}
}
@SubscribeEvent @SubscribeEvent
public static void onRenderTick(RenderTickEvent event) { public static void onRenderTick(RenderTickEvent event) {
if (!isGameActive()) if (!isGameActive())

View file

@ -64,6 +64,7 @@ public class CreateConfig {
CreateConfig(final ForgeConfigSpec.Builder builder) { CreateConfig(final ForgeConfigSpec.Builder builder) {
initGeneral(builder); initGeneral(builder);
initContraptions(builder); initContraptions(builder);
initSchematics(builder);
initCuriosities(builder); initCuriosities(builder);
initLogistics(builder); initLogistics(builder);
initGardens(builder); initGardens(builder);
@ -256,7 +257,7 @@ public class CreateConfig {
builder.pop(); builder.pop();
} }
public void initSchematics(final ForgeConfigSpec.Builder builder) { private void initSchematics(final ForgeConfigSpec.Builder builder) {
builder.comment("The Schematics Module").push("schematics"); builder.comment("The Schematics Module").push("schematics");
String basePath = "create.config.schematics."; String basePath = "create.config.schematics.";
String name = ""; String name = "";

View file

@ -1,6 +1,7 @@
package com.simibubi.create.foundation.block; package com.simibubi.create.foundation.block;
import com.mojang.blaze3d.platform.GlStateManager; 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.TessellatorHelper;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
@ -61,7 +62,7 @@ public interface IBlockWithScrollableValue {
return; return;
if (!mc.player.isAllowEdit()) if (!mc.player.isAllowEdit())
return; return;
IBlockWithScrollableValue block = (IBlockWithScrollableValue) state.getBlock(); IBlockWithScrollableValue block = (IBlockWithScrollableValue) state.getBlock();
Vec3d pos = new Vec3d(blockPos); 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) cursor = VecHelper.rotate(cursor, facing == Direction.UP ? -90 : facing == Direction.DOWN ? 90 : 0, Axis.Z)
.add(.5, .5, .5); .add(.5, .5, .5);
boolean contains = bb.contains(cursor); boolean contains = bb.contains(cursor);
TessellatorHelper.prepareForDrawing(); TessellatorHelper.prepareForDrawing();
GlStateManager.enableBlend(); GlStateManager.enableBlend();
GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA,
@ -84,7 +85,7 @@ public interface IBlockWithScrollableValue {
GlStateManager.DestFactor.ZERO); GlStateManager.DestFactor.ZERO);
GlStateManager.disableTexture(); GlStateManager.disableTexture();
GlStateManager.depthMask(false); GlStateManager.depthMask(false);
Tessellator tessellator = Tessellator.getInstance(); Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer(); BufferBuilder bufferbuilder = tessellator.getBuffer();
bufferbuilder.begin(3, DefaultVertexFormats.POSITION_COLOR); bufferbuilder.begin(3, DefaultVertexFormats.POSITION_COLOR);
@ -122,7 +123,7 @@ public interface IBlockWithScrollableValue {
if (contains) { if (contains) {
GlStateManager.pushMatrix(); 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); GlStateManager.scaled(textScale, -textScale, textScale);
String text = block.getValueName(state, world, blockPos); String text = block.getValueName(state, world, blockPos);
@ -131,7 +132,7 @@ public interface IBlockWithScrollableValue {
mc.fontRenderer.drawString(text, 1, 1, 0x224433); mc.fontRenderer.drawString(text, 1, 1, 0x224433);
GlStateManager.translated(0, 0, 1 / 4f); GlStateManager.translated(0, 0, 1 / 4f);
text = TextFormatting.ITALIC + "<Scroll>"; text = TextFormatting.ITALIC + "<" + Lang.translate("action.scroll") + ">";
mc.fontRenderer.drawString(text, 0, 10, 0xBBBBCC); mc.fontRenderer.drawString(text, 0, 10, 0xBBBBCC);
GlStateManager.translated(0, 0, -1 / 4f); GlStateManager.translated(0, 0, -1 / 4f);
mc.fontRenderer.drawString(text, 1, 11, 0x111111); mc.fontRenderer.drawString(text, 1, 11, 0x111111);
@ -143,8 +144,8 @@ public interface IBlockWithScrollableValue {
String numberText = block.getCurrentValue(state, world, blockPos) + ""; String numberText = block.getCurrentValue(state, world, blockPos) + "";
int stringWidth = mc.fontRenderer.getStringWidth(numberText); int stringWidth = mc.fontRenderer.getStringWidth(numberText);
float numberScale = 4 / 128f * (6f / stringWidth); 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); GlStateManager.scaled(numberScale, -numberScale, numberScale);
mc.fontRenderer.drawString(numberText, 0, 0, 0xFFFFFF); mc.fontRenderer.drawString(numberText, 0, 0, 0xFFFFFF);
@ -156,12 +157,12 @@ public interface IBlockWithScrollableValue {
GlStateManager.lineWidth(1); GlStateManager.lineWidth(1);
TessellatorHelper.cleanUpAfterDrawing(); TessellatorHelper.cleanUpAfterDrawing();
} }
public static boolean onScroll(double delta) { public static boolean onScroll(double delta) {
RayTraceResult objectMouseOver = Minecraft.getInstance().objectMouseOver; RayTraceResult objectMouseOver = Minecraft.getInstance().objectMouseOver;
if (!(objectMouseOver instanceof BlockRayTraceResult)) if (!(objectMouseOver instanceof BlockRayTraceResult))
return false; return false;
BlockRayTraceResult result = (BlockRayTraceResult) objectMouseOver; BlockRayTraceResult result = (BlockRayTraceResult) objectMouseOver;
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
ClientWorld world = mc.world; ClientWorld world = mc.world;
@ -186,7 +187,7 @@ public interface IBlockWithScrollableValue {
.add(.5, .5, .5); .add(.5, .5, .5);
if (!bb.contains(cursor)) if (!bb.contains(cursor))
return false; return false;
block.onScroll(state, world, blockPos, delta); block.onScroll(state, world, blockPos, delta);
return true; return true;
} }

View file

@ -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<ITextComponent> tooltip,
ITooltipFlag flagIn) {
info.addInformation(tooltip);
}
}

View file

@ -4,11 +4,16 @@ import java.util.function.Consumer;
import org.lwjgl.glfw.GLFW; 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.TextFieldWidget;
import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.gui.widget.button.Button;
public class TextInputPromptScreen extends AbstractSimiScreen { public class TextInputPromptScreen extends AbstractSimiScreen {
private final String defaultConfirm = Lang.translate("action.confirm");
private final String defaultAbort = Lang.translate("action.abort");
private Consumer<String> callback; private Consumer<String> callback;
private Consumer<String> abortCallback; private Consumer<String> abortCallback;
@ -27,8 +32,8 @@ public class TextInputPromptScreen extends AbstractSimiScreen {
this.callback = callBack; this.callback = callBack;
this.abortCallback = abortCallback; this.abortCallback = abortCallback;
buttonTextConfirm = "Confirm"; buttonTextConfirm = defaultConfirm;
buttonTextAbort = "Abort"; buttonTextAbort = defaultAbort;
confirmed = false; confirmed = false;
} }

View file

@ -5,6 +5,7 @@ import java.util.function.Consumer;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllKeys; import com.simibubi.create.AllKeys;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.schematics.client.tools.Tools; import com.simibubi.create.modules.schematics.client.tools.Tools;
import net.minecraft.client.MainWindow; import net.minecraft.client.MainWindow;
@ -15,12 +16,15 @@ import net.minecraft.util.text.StringTextComponent;
public class ToolSelectionScreen extends Screen { public class ToolSelectionScreen extends Screen {
public final String scrollToCycle = Lang.translate("gui.toolmenu.cycle");
public final String holdToFocus = "gui.toolmenu.focusKey";
protected List<Tools> tools; protected List<Tools> tools;
protected Consumer<Tools> callback; protected Consumer<Tools> callback;
public boolean focused; public boolean focused;
private float yOffset; private float yOffset;
protected int selection; protected int selection;
protected int w; protected int w;
protected int h; protected int h;
@ -32,21 +36,21 @@ public class ToolSelectionScreen extends Screen {
focused = false; focused = false;
yOffset = 0; yOffset = 0;
selection = 0; selection = 0;
callback.accept(tools.get(selection)); callback.accept(tools.get(selection));
w = Math.max(tools.size() * 50 + 30, 220); w = Math.max(tools.size() * 50 + 30, 220);
h = 30; h = 30;
} }
public void setSelectedElement(Tools tool) { public void setSelectedElement(Tools tool) {
if (!tools.contains(tool)) if (!tools.contains(tool))
return; return;
selection = tools.indexOf(tool); selection = tools.indexOf(tool);
} }
public void cycle(int direction) { public void cycle(int direction) {
selection += (direction < 0)? 1 : -1; selection += (direction < 0) ? 1 : -1;
selection = (selection + tools.size()) % tools.size(); selection = (selection + tools.size()) % tools.size();
} }
@ -55,27 +59,27 @@ public class ToolSelectionScreen extends Screen {
int x = (mainWindow.getScaledWidth() - w) / 2 + 15; int x = (mainWindow.getScaledWidth() - w) / 2 + 15;
int y = mainWindow.getScaledHeight() - h - 75; int y = mainWindow.getScaledHeight() - h - 75;
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.translatef(0, -yOffset, focused? 100 : 0); GlStateManager.translatef(0, -yOffset, focused ? 100 : 0);
ScreenResources gray = ScreenResources.GRAY; ScreenResources gray = ScreenResources.GRAY;
GlStateManager.enableBlend(); 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); Minecraft.getInstance().getTextureManager().bindTexture(gray.location);
blit(x - 15, y, gray.startX, gray.startY, w, h, gray.width, gray.height); blit(x - 15, y, gray.startX, gray.startY, w, h, gray.width, gray.height);
float toolTipAlpha = yOffset / 10; float toolTipAlpha = yOffset / 10;
FontRenderer font = minecraft.fontRenderer; FontRenderer font = minecraft.fontRenderer;
List<String> toolTip = tools.get(selection).getDescription(); List<String> toolTip = tools.get(selection).getDescription();
int stringAlphaComponent = ((int) (toolTipAlpha * 0xFF)) << 24; int stringAlphaComponent = ((int) (toolTipAlpha * 0xFF)) << 24;
if (toolTipAlpha > 0.25f) { if (toolTipAlpha > 0.25f) {
GlStateManager.color4f(.7f, .7f, .8f, toolTipAlpha); GlStateManager.color4f(.7f, .7f, .8f, toolTipAlpha);
blit(x - 15, y + 33, gray.startX, gray.startY, w, h + 22, gray.width, gray.height); blit(x - 15, y + 33, gray.startX, gray.startY, w, h + 22, gray.width, gray.height);
GlStateManager.color4f(1, 1, 1, 1); GlStateManager.color4f(1, 1, 1, 1);
if (toolTip.size() > 0) if (toolTip.size() > 0)
drawString(font, toolTip.get(0), x - 10, y + 38, 0xEEEEEE + stringAlphaComponent); drawString(font, toolTip.get(0), x - 10, y + 38, 0xEEEEEE + stringAlphaComponent);
if (toolTip.size() > 1) if (toolTip.size() > 1)
@ -85,48 +89,52 @@ public class ToolSelectionScreen extends Screen {
if (toolTip.size() > 3) if (toolTip.size() > 3)
drawString(font, toolTip.get(3), x - 10, y + 72, 0xCCCCDD + stringAlphaComponent); drawString(font, toolTip.get(3), x - 10, y + 72, 0xCCCCDD + stringAlphaComponent);
} }
GlStateManager.color4f(1, 1, 1, 1); GlStateManager.color4f(1, 1, 1, 1);
if (tools.size() > 1) { if (tools.size() > 1) {
String keyName = AllKeys.TOOL_MENU.getBoundKey(); String keyName = AllKeys.TOOL_MENU.getBoundKey();
int width = minecraft.mainWindow.getScaledWidth(); int width = minecraft.mainWindow.getScaledWidth();
if (!focused) 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 else
drawCenteredString(minecraft.fontRenderer, "[SCROLL] to Cycle", width/2, y - 10, 0xCCDDFF); drawCenteredString(minecraft.fontRenderer, scrollToCycle, width / 2, y - 10, 0xCCDDFF);
} else { } else {
x += 65; x += 65;
} }
for (int i = 0; i < tools.size(); i++) { for (int i = 0; i < tools.size(); i++) {
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
float alpha = focused? 1 : .2f; float alpha = focused ? 1 : .2f;
if (i == selection) { if (i == selection) {
GlStateManager.translatef(0, -10, 0); 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; alpha = 1;
} }
GlStateManager.color4f(0, 0, 0, alpha); GlStateManager.color4f(0, 0, 0, alpha);
tools.get(i).getIcon().draw(this, x + i * 50 + 16, y + 12); tools.get(i).getIcon().draw(this, x + i * 50 + 16, y + 12);
GlStateManager.color4f(1, 1, 1, alpha); GlStateManager.color4f(1, 1, 1, alpha);
tools.get(i).getIcon().draw(this, x + i * 50 + 16, y + 11); tools.get(i).getIcon().draw(this, x + i * 50 + 16, y + 11);
GlStateManager.popMatrix(); GlStateManager.popMatrix();
} }
GlStateManager.popMatrix(); GlStateManager.popMatrix();
} }
public void update() { public void update() {
if (focused) yOffset += (10 - yOffset) * .1f; if (focused)
else yOffset *= .9f; yOffset += (10 - yOffset) * .1f;
else
yOffset *= .9f;
} }
public void renderPassive(float partialTicks) { public void renderPassive(float partialTicks) {
draw(partialTicks); draw(partialTicks);
} }
@Override @Override
public void onClose() { public void onClose() {
callback.accept(tools.get(selection)); callback.accept(tools.get(selection));

View file

@ -3,6 +3,7 @@ package com.simibubi.create.foundation.gui.widgets;
import java.util.function.Consumer; import java.util.function.Consumer;
import com.simibubi.create.AllKeys; import com.simibubi.create.AllKeys;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
@ -10,7 +11,9 @@ public class ScrollInput extends AbstractSimiWidget {
protected Consumer<Integer> onScroll; protected Consumer<Integer> onScroll;
protected int state; 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 Label displayLabel;
protected int min, max; protected int min, max;
@ -107,8 +110,8 @@ public class ScrollInput extends AbstractSimiWidget {
protected void updateTooltip() { protected void updateTooltip() {
toolTip.clear(); toolTip.clear();
toolTip.add(TextFormatting.BLUE + title); toolTip.add(TextFormatting.BLUE + title);
toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + "Scroll to Modify"); toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + scrollToModify);
toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + "Shift to Scroll faster"); toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + shiftScrollsFaster);
} }
} }

View file

@ -3,10 +3,13 @@ package com.simibubi.create.foundation.gui.widgets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
public class SelectionScrollInput extends ScrollInput { public class SelectionScrollInput extends ScrollInput {
private final String scrollToSelect = Lang.translate("gui.scrollInput.scrollToSelect");
protected List<String> options; protected List<String> options;
public SelectionScrollInput(int xIn, int yIn, int widthIn, int heightIn) { public SelectionScrollInput(int xIn, int yIn, int widthIn, int heightIn) {
@ -25,7 +28,7 @@ public class SelectionScrollInput extends ScrollInput {
protected void writeToLabel() { protected void writeToLabel() {
displayLabel.text = options.get(state); displayLabel.text = options.get(state);
} }
@Override @Override
public boolean mouseScrolled(double mouseX, double mouseY, double delta) { public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
return super.mouseScrolled(mouseX, mouseY, -delta); return super.mouseScrolled(mouseX, mouseY, -delta);
@ -33,7 +36,8 @@ public class SelectionScrollInput extends ScrollInput {
@Override @Override
protected void updateTooltip() { protected void updateTooltip() {
super.updateTooltip(); toolTip.clear();
toolTip.add(TextFormatting.BLUE + title);
for (int i = min; i < max; i++) { for (int i = min; i < max; i++) {
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
if (i == state) if (i == state)
@ -42,7 +46,7 @@ public class SelectionScrollInput extends ScrollInput {
result.append(TextFormatting.GRAY).append("> ").append(options.get(i)); result.append(TextFormatting.GRAY).append("> ").append(options.get(i));
toolTip.add(result.toString()); toolTip.add(result.toString());
} }
toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + "Scroll to Select"); toolTip.add(TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + scrollToSelect);
} }
} }

View file

@ -9,11 +9,7 @@ import static com.simibubi.create.foundation.item.AllToolTypes.SWORD;
import java.util.Collections; import java.util.Collections;
import java.util.List; 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.block.BlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.IItemTier; import net.minecraft.item.IItemTier;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -22,7 +18,6 @@ import net.minecraft.item.Items;
import net.minecraft.item.ToolItem; import net.minecraft.item.ToolItem;
import net.minecraft.util.ActionResultType; import net.minecraft.util.ActionResultType;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ToolType; import net.minecraftforge.common.ToolType;
@ -31,15 +26,13 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
@EventBusSubscriber @EventBusSubscriber
public abstract class AbstractToolItem extends ToolItem implements ITooltip { public abstract class AbstractToolItem extends ToolItem {
protected TooltipHolder info;
protected AllToolTypes[] toolTypes; protected AllToolTypes[] toolTypes;
public AbstractToolItem(float attackDamageIn, float attackSpeedIn, IItemTier tier, Properties builder, public AbstractToolItem(float attackDamageIn, float attackSpeedIn, IItemTier tier, Properties builder,
AllToolTypes... types) { AllToolTypes... types) {
super(attackDamageIn, attackSpeedIn, tier, Collections.emptySet(), setToolTypes(builder, tier, types)); super(attackDamageIn, attackSpeedIn, tier, Collections.emptySet(), setToolTypes(builder, tier, types));
info = new TooltipHolder(this);
toolTypes = types; toolTypes = types;
} }
@ -62,12 +55,6 @@ public abstract class AbstractToolItem extends ToolItem implements ITooltip {
return false; return false;
} }
@Override
public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
info.addInformation(tooltip);
super.addInformation(stack, worldIn, tooltip, flagIn);
}
@Override @Override
public ActionResultType onItemUse(ItemUseContext context) { public ActionResultType onItemUse(ItemUseContext context) {
if (hasType(HOE) && !context.isPlacerSneaking()) if (hasType(HOE) && !context.isPlacerSneaking())

View file

@ -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<ITextComponent> tooltip, ITooltipFlag flagIn) {
info.addInformation(tooltip);
}
}

View file

@ -1,7 +0,0 @@
package com.simibubi.create.foundation.utility;
public class ContainerListener {
}

View file

@ -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);
}
}

View file

@ -1,5 +1,6 @@
package com.simibubi.create.foundation.utility; 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.AQUA;
import static net.minecraft.util.text.TextFormatting.BLUE; import static net.minecraft.util.text.TextFormatting.BLUE;
import static net.minecraft.util.text.TextFormatting.DARK_GRAY; import static net.minecraft.util.text.TextFormatting.DARK_GRAY;
@ -26,13 +27,16 @@ import net.minecraft.util.text.TextFormatting;
public class ItemDescription { public class ItemDescription {
public static final int maxCharsPerLine = 35; public static final ItemDescription MISSING = new ItemDescription(null);
public static ITextComponent trim = new StringTextComponent( public static ITextComponent trim = new StringTextComponent(
WHITE + "" + STRIKETHROUGH + " "); WHITE + "" + STRIKETHROUGH + " ");
public enum Palette { 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), Purple(DARK_PURPLE, LIGHT_PURPLE),
; ;
@ -56,24 +60,23 @@ public class ItemDescription {
lines = new ArrayList<>(); lines = new ArrayList<>();
linesOnShift = new ArrayList<>(); linesOnShift = new ArrayList<>();
linesOnCtrl = new ArrayList<>(); linesOnCtrl = new ArrayList<>();
trim = new StringTextComponent(WHITE + "" + STRIKETHROUGH + " ");
} }
public ItemDescription withSummary(String summary) { public ItemDescription withSummary(String summary) {
add(linesOnShift, cutString(summary, palette.color)); add(linesOnShift, cutString(summary, palette.color, palette.hColor));
linesOnShift.add(trim); add(linesOnShift, "");
return this; return this;
} }
public ItemDescription withBehaviour(String condition, String behaviour) { public ItemDescription withBehaviour(String condition, String behaviour) {
add(linesOnShift, GRAY + condition); add(linesOnShift, GRAY + condition);
add(linesOnShift, cutString(behaviour, palette.color, 1)); add(linesOnShift, cutString(behaviour, palette.color, palette.hColor, 1));
return this; return this;
} }
public ItemDescription withControl(String condition, String action) { public ItemDescription withControl(String condition, String action) {
add(linesOnCtrl, GRAY + condition); add(linesOnCtrl, GRAY + condition);
add(linesOnCtrl, cutString(action, palette.color, 1)); add(linesOnCtrl, cutString(action, palette.color, palette.hColor, 1));
return this; return this;
} }
@ -96,15 +99,15 @@ public class ItemDescription {
list.add(0, new StringTextComponent(tabs)); list.add(0, new StringTextComponent(tabs));
if (shift || ctrl) if (shift || ctrl)
list.add(1, trim); list.add(1, new StringTextComponent(""));
} }
} }
if (!hasDescription) if (!hasDescription)
linesOnShift = lines; linesOnShift = lines;
if (!hasControls) if (!hasControls)
linesOnCtrl = lines; linesOnCtrl = lines;
return this; return this;
} }
@ -112,42 +115,6 @@ public class ItemDescription {
return palette.hColor + s + palette.color; return palette.hColor + s + palette.color;
} }
public List<String> cutString(String s, TextFormatting defaultColor) {
return cutString(s, defaultColor, 0);
}
public List<String> cutString(String s, TextFormatting defaultColor, int indent) {
String lineStart = defaultColor.toString();
for (int i = 0; i < indent; i++)
lineStart += " ";
String[] words = s.split(" ");
List<String> 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<ITextComponent> infoList, List<String> textLines) { public static void add(List<ITextComponent> infoList, List<String> textLines) {
textLines.forEach(s -> add(infoList, s)); textLines.forEach(s -> add(infoList, s));
} }

View file

@ -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<String> translatedOptions(String prefix, String... keys) {
List<String> result = new ArrayList<>(keys.length);
for (String key : keys) {
result.add(translate(prefix + "." + key));
}
return result;
}
}

View file

@ -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<String, ItemDescription> 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<String> cutString(String s, TextFormatting defaultColor, TextFormatting highlightColor) {
return cutString(s, defaultColor, highlightColor, 0);
}
public static List<String> 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<String> 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";
}
}

View file

@ -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<ITextComponent> tooltip) {
toolTip.addInformation(tooltip);
}
}

View file

@ -1,6 +1,14 @@
package com.simibubi.create.modules; package com.simibubi.create.modules;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.CreateConfig; 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 { public interface IModule {
@ -26,6 +34,53 @@ public interface IModule {
return false; 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() { public default boolean isEnabled() {
return isActive(getModuleName()); return isActive(getModuleName());

View file

@ -1,9 +1,9 @@
package com.simibubi.create.modules.contraptions.base; 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.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.modules.contraptions.RotationPropagator; import com.simibubi.create.modules.contraptions.RotationPropagator;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.material.PushReaction; import net.minecraft.block.material.PushReaction;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -15,7 +15,7 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.World; 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; protected static final Palette color = Palette.Red;

View file

@ -2,7 +2,7 @@ package com.simibubi.create.modules.contraptions.generators;
import com.simibubi.create.foundation.block.IBlockWithScrollableValue; import com.simibubi.create.foundation.block.IBlockWithScrollableValue;
import com.simibubi.create.foundation.block.IWithTileEntity; 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 com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -57,15 +57,6 @@ public class MotorBlock extends HorizontalKineticBlock
return true; 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 @Override
public int getCurrentValue(BlockState state, IWorld world, BlockPos pos) { public int getCurrentValue(BlockState state, IWorld world, BlockPos pos) {
MotorTileEntity tileEntity = (MotorTileEntity) world.getTileEntity(pos); MotorTileEntity tileEntity = (MotorTileEntity) world.getTileEntity(pos);
@ -81,7 +72,7 @@ public class MotorBlock extends HorizontalKineticBlock
@Override @Override
public String getValueName(BlockState state, IWorld world, BlockPos pos) { public String getValueName(BlockState state, IWorld world, BlockPos pos) {
return "Speed"; return Lang.translate("generic.speed");
} }
@Override @Override

View file

@ -1,7 +1,6 @@
package com.simibubi.create.modules.contraptions.generators; package com.simibubi.create.modules.contraptions.generators;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock; import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -132,10 +131,4 @@ public class WaterWheelBlock extends HorizontalKineticBlock {
return state.get(HORIZONTAL_FACING).getAxis(); 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();
}
} }

View file

@ -3,7 +3,6 @@ package com.simibubi.create.modules.contraptions.receivers;
import static com.simibubi.create.modules.contraptions.receivers.CrushingWheelControllerBlock.VALID; import static com.simibubi.create.modules.contraptions.receivers.CrushingWheelControllerBlock.VALID;
import com.simibubi.create.AllBlocks; 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.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock; import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
@ -167,14 +166,4 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock {
return false; 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();
}
} }

View file

@ -2,7 +2,6 @@ package com.simibubi.create.modules.contraptions.receivers;
import java.util.List; 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.DirectionalKineticBlock;
import com.simibubi.create.modules.contraptions.base.IRotate; import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.receivers.constructs.IHaveMovementBehavior; import com.simibubi.create.modules.contraptions.receivers.constructs.IHaveMovementBehavior;
@ -168,14 +167,4 @@ public class DrillBlock extends DirectionalKineticBlock implements IHaveMovement
return false; 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();
}
} }

View file

@ -1,7 +1,6 @@
package com.simibubi.create.modules.contraptions.receivers; package com.simibubi.create.modules.contraptions.receivers;
import com.simibubi.create.foundation.block.IWithTileEntity; import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.relays.EncasedShaftBlock; import com.simibubi.create.modules.contraptions.relays.EncasedShaftBlock;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -16,11 +15,6 @@ import net.minecraft.world.World;
public class EncasedFanBlock extends EncasedShaftBlock implements IWithTileEntity<EncasedFanTileEntity> { public class EncasedFanBlock extends EncasedShaftBlock implements IWithTileEntity<EncasedFanTileEntity> {
@Override
public ItemDescription getDescription() {
return new ItemDescription(color).withSummary("Exchange rotational power for air flow and back.").createTabs();
}
@Override @Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) { public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new EncasedFanTileEntity(); return new EncasedFanTileEntity();

View file

@ -3,10 +3,6 @@ package com.simibubi.create.modules.contraptions.receivers;
import java.util.List; import java.util.List;
import com.simibubi.create.AllBlocks; 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.IHaveMovementBehavior;
import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalPistonTileEntity; 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.CropsBlock;
import net.minecraft.block.HorizontalBlock; import net.minecraft.block.HorizontalBlock;
import net.minecraft.block.SugarCaneBlock; import net.minecraft.block.SugarCaneBlock;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack; 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.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.IPlantable; 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), 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_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); SHAPE_EAST = makeCuboidShape(0, 4, 0, 6, 12, 16);
private TooltipHolder info;
public HarvesterBlock() { public HarvesterBlock() {
super(Properties.from(Blocks.IRON_BLOCK)); super(Properties.from(Blocks.IRON_BLOCK));
info = new TooltipHolder(this);
} }
@Override @Override
@ -208,20 +199,4 @@ public class HarvesterBlock extends HorizontalBlock implements IHaveMovementBeha
return Blocks.AIR.getDefaultState(); return Blocks.AIR.getDefaultState();
} }
@Override
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> 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();
}
} }

View file

@ -7,8 +7,6 @@ import java.util.Optional;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.block.IRenderUtilityBlock; import com.simibubi.create.foundation.block.IRenderUtilityBlock;
import com.simibubi.create.foundation.block.IWithTileEntity; 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.foundation.utility.VecHelper;
import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock; import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock;
import com.simibubi.create.modules.contraptions.relays.belt.AllBeltAttachments.BeltAttachmentState; import com.simibubi.create.modules.contraptions.relays.belt.AllBeltAttachments.BeltAttachmentState;
@ -48,12 +46,6 @@ public class MechanicalPressBlock extends HorizontalKineticBlock
return SHAPE; return SHAPE;
} }
@Override
public ItemDescription getDescription() {
Palette color = Palette.Red;
return new ItemDescription(color).withSummary("Applies pressure to items below it.").createTabs();
}
@Override @Override
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) { boolean isMoving) {

View file

@ -1,6 +1,5 @@
package com.simibubi.create.modules.contraptions.receivers; 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.foundation.utility.VecHelper;
import com.simibubi.create.modules.contraptions.base.KineticBlock; import com.simibubi.create.modules.contraptions.base.KineticBlock;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
@ -106,10 +105,4 @@ public class TurntableBlock extends KineticBlock {
return false; 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();
}
} }

View file

@ -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.IBlockWithScrollableValue;
import com.simibubi.create.foundation.block.IWithTileEntity; import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.RotatedPillarBlock; import net.minecraft.block.RotatedPillarBlock;
@ -75,7 +76,7 @@ public abstract class AbstractChassisBlock extends RotatedPillarBlock
@Override @Override
public String getValueName(BlockState state, IWorld world, BlockPos pos) { public String getValueName(BlockState state, IWorld world, BlockPos pos) {
return "Range"; return Lang.translate("generic.range");
} }
@Override @Override

View file

@ -1,8 +1,6 @@
package com.simibubi.create.modules.contraptions.receivers.constructs; package com.simibubi.create.modules.contraptions.receivers.constructs;
import com.simibubi.create.foundation.block.IWithTileEntity; 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 com.simibubi.create.modules.contraptions.base.DirectionalKineticBlock;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -21,14 +19,6 @@ public class MechanicalBearingBlock extends DirectionalKineticBlock
super(Properties.from(Blocks.PISTON)); 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 @Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) { public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new MechanicalBearingTileEntity(); return new MechanicalBearingTileEntity();

View file

@ -2,7 +2,6 @@ package com.simibubi.create.modules.contraptions.receivers.constructs;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateConfig; import com.simibubi.create.CreateConfig;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.KineticBlock; import com.simibubi.create.modules.contraptions.base.KineticBlock;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -197,12 +196,4 @@ public class MechanicalPistonBlock extends KineticBlock {
return VoxelShapes.fullCube(); 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();
}
} }

View file

@ -36,19 +36,19 @@ public class MovingConstructHandler {
public void onLoadWorld(IWorld world) { public void onLoadWorld(IWorld world) {
movingPistons.put(world, new ArrayList<>()); 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) { public void onUnloadWorld(IWorld world) {
movingPistons.remove(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, public static void moveEntities(MechanicalPistonTileEntity te, float movementSpeed, Direction movementDirection,
float newOffset) { float newOffset) {
if (TranslationConstruct.isFrozen()) if (TranslationConstruct.isFrozen())
return; return;
World world = te.getWorld(); World world = te.getWorld();
Vec3d movementVec = new Vec3d(te.getBlockState().get(BlockStateProperties.FACING).getDirectionVec()); Vec3d movementVec = new Vec3d(te.getBlockState().get(BlockStateProperties.FACING).getDirectionVec());
TranslationConstruct construct = te.movingConstruct; TranslationConstruct construct = te.movingConstruct;
@ -135,7 +135,6 @@ public class MovingConstructHandler {
} }
} }
if (!allowedMovement.equals(movement)) { if (!allowedMovement.equals(movement)) {
if (allowedMovement.y != movement.y) { if (allowedMovement.y != movement.y) {
entity.fall(entity.fallDistance, 1); entity.fall(entity.fallDistance, 1);

View file

@ -1,22 +1,14 @@
package com.simibubi.create.modules.contraptions.receivers.constructs; package com.simibubi.create.modules.contraptions.receivers.constructs;
import java.util.List;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateConfig; import com.simibubi.create.CreateConfig;
import com.simibubi.create.foundation.block.ProperDirectionalBlock; 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 com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalPistonBlock.PistonState;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis; 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.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; 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() { public PistonPoleBlock() {
super(Properties.from(Blocks.PISTON_HEAD)); super(Properties.from(Blocks.PISTON_HEAD));
setDefaultState(getDefaultState().with(FACING, Direction.UP)); setDefaultState(getDefaultState().with(FACING, Direction.UP));
info = new TooltipHolder(this);
}
@Override
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
info.addInformation(tooltip);
} }
@Override @Override
@ -112,12 +92,4 @@ public class PistonPoleBlock extends ProperDirectionalBlock implements ITooltip
return getDefaultState().with(FACING, context.getFace().getOpposite()); 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();
}
} }

View file

@ -1,5 +1,7 @@
package com.simibubi.create.modules.contraptions.receivers.constructs; package com.simibubi.create.modules.contraptions.receivers.constructs;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
@ -31,7 +33,7 @@ public class RotationChassisBlock extends AbstractChassisBlock {
@Override @Override
public String getValueName(BlockState state, IWorld world, BlockPos pos) { public String getValueName(BlockState state, IWorld world, BlockPos pos) {
return "Radius"; return Lang.translate("generic.radius");
} }
@Override @Override

View file

@ -1,8 +1,5 @@
package com.simibubi.create.modules.contraptions.relays; 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.block.BlockState;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
@ -14,12 +11,4 @@ public class ClutchBlock extends GearshiftBlock {
return new ClutchTileEntity(); 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();
}
} }

View file

@ -1,7 +1,6 @@
package com.simibubi.create.modules.contraptions.relays; package com.simibubi.create.modules.contraptions.relays;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock; import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -104,13 +103,4 @@ public class EncasedBeltBlock extends RotatedPillarKineticBlock {
return true; 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();
}
} }

View file

@ -1,6 +1,5 @@
package com.simibubi.create.modules.contraptions.relays; package com.simibubi.create.modules.contraptions.relays;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock; import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -52,10 +51,4 @@ public class EncasedShaftBlock extends RotatedPillarKineticBlock {
return state.get(AXIS); 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();
}
} }

View file

@ -1,6 +1,5 @@
package com.simibubi.create.modules.contraptions.relays; package com.simibubi.create.modules.contraptions.relays;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock; import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -40,12 +39,4 @@ public class GearboxBlock extends RotatedPillarKineticBlock {
return true; return true;
} }
// IToolTip
@Override
public ItemDescription getDescription() {
return new ItemDescription(color)
.withSummary("Relays Rotation to Four directions. Reverses straight connections.").createTabs();
}
} }

View file

@ -1,7 +1,5 @@
package com.simibubi.create.modules.contraptions.relays; 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.RotationPropagator;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
@ -31,13 +29,6 @@ public class GearshiftBlock extends EncasedShaftBlock {
return new GearshiftTileEntity(); 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 @Override
protected void fillStateContainer(Builder<Block, BlockState> builder) { protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(POWERED); builder.add(POWERED);

View file

@ -1,6 +1,5 @@
package com.simibubi.create.modules.contraptions.relays; package com.simibubi.create.modules.contraptions.relays;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock; import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -62,10 +61,4 @@ public class ShaftBlock extends RotatedPillarKineticBlock {
return state.get(AXIS); return state.get(AXIS);
} }
@Override
public ItemDescription getDescription() {
return new ItemDescription(color).withSummary("A straight connection for rotating blocks along its axis.")
.createTabs();
}
} }

View file

@ -7,7 +7,6 @@ import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.block.IWithTileEntity; import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.block.IWithoutBlockItem; 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.base.HorizontalKineticBlock;
import com.simibubi.create.modules.contraptions.relays.belt.BeltTileEntity.TransportedEntityInfo; 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.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.Direction.AxisDirection;
import net.minecraft.util.Hand;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
@ -411,9 +410,4 @@ public class BeltBlock extends HorizontalKineticBlock implements IWithoutBlockIt
return shape; return shape;
} }
@Override
public ItemDescription getDescription() {
return new ItemDescription(color);
}
} }

View file

@ -12,10 +12,10 @@ import com.simibubi.create.AllItems;
import com.simibubi.create.AllPackets; import com.simibubi.create.AllPackets;
import com.simibubi.create.Create; import com.simibubi.create.Create;
import com.simibubi.create.foundation.gui.ScreenOpener; 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.BlockHelper;
import com.simibubi.create.foundation.utility.ItemDescription; import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette; import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; 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.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.fluid.IFluidState; import net.minecraft.fluid.IFluidState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext; import net.minecraft.item.ItemUseContext;
@ -62,19 +63,19 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.network.PacketDistributor; import net.minecraftforge.fml.network.PacketDistributor;
public class BuilderGunItem extends InfoItem { public class BuilderGunItem extends Item {
public static enum ComponentTier { public static enum ComponentTier {
None(TextFormatting.DARK_GRAY + "Andesite Alloy"), None(TextFormatting.DARK_GRAY),
BlazeBrass(TextFormatting.GOLD + "Blaze Brass"), BlazeBrass(TextFormatting.GOLD),
ChorusChrome(TextFormatting.LIGHT_PURPLE + "Chorus Chrome"), ChorusChrome(TextFormatting.LIGHT_PURPLE),
; ;
protected String displayName; protected TextFormatting color;
private ComponentTier(String displayName) { private ComponentTier(TextFormatting color) {
this.displayName = displayName; this.color = color;
} }
} }
@ -91,36 +92,25 @@ public class BuilderGunItem extends InfoItem {
return UseAction.NONE; 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 @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) { public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
if (stack.hasTag() && stack.getTag().contains("BlockUsed")) { if (stack.hasTag() && stack.getTag().contains("BlockUsed")) {
String usedblock = NBTUtil.readBlockState(stack.getTag().getCompound("BlockUsed")).getBlock() String usedblock = NBTUtil.readBlockState(stack.getTag().getCompound("BlockUsed")).getBlock()
.getTranslationKey(); .getTranslationKey();
ItemDescription.add(tooltip, TextFormatting.DARK_GRAY + "Using: " + TextFormatting.GRAY ItemDescription.add(tooltip, TextFormatting.DARK_GRAY + Lang.translate("blockzapper.usingBlock",
+ new TranslationTextComponent(usedblock).getFormattedText()); TextFormatting.GRAY + new TranslationTextComponent(usedblock).getFormattedText()));
} }
super.addInformation(stack, worldIn, tooltip, flagIn);
Palette palette = Palette.Purple; Palette palette = Palette.Purple;
if (Screen.hasShiftDown()) { if (Screen.hasShiftDown()) {
ItemDescription.add(tooltip, palette.color + "Component Tiers:"); ItemDescription.add(tooltip, palette.color + Lang.translate("blockzapper.componentUpgrades"));
for (Components c : Components.values()) { for (Components c : Components.values()) {
ComponentTier tier = getTier(c, stack); 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 { else {
world.playSound(player, player.getPosition(), SoundEvents.BLOCK_NOTE_BLOCK_BASS, SoundCategory.BLOCKS, 1f, world.playSound(player, player.getPosition(), SoundEvents.BLOCK_NOTE_BLOCK_BASS, SoundCategory.BLOCKS, 1f,
0.5f); 0.5f);
player.sendStatusMessage(new StringTextComponent(TextFormatting.RED + "Left-Click a Block to set Material"), player.sendStatusMessage(
true); new StringTextComponent(TextFormatting.RED + Lang.translate("blockzapper.leftClickToSet")), true);
return new ActionResult<ItemStack>(ActionResultType.FAIL, item); return new ActionResult<ItemStack>(ActionResultType.FAIL, item);
} }
@ -224,26 +214,8 @@ public class BuilderGunItem extends InfoItem {
-0.1f, 1); -0.1f, 1);
Vec3d barrelPos = start.add(barrelPosNoTransform.rotatePitch(pitch).rotateYaw(yaw)); Vec3d barrelPos = start.add(barrelPosNoTransform.rotatePitch(pitch).rotateYaw(yaw));
// Client side - Shoot visual laser // Client side
if (world.isRemote) { 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); BuilderGunHandler.dontAnimateItem(hand);
return new ActionResult<ItemStack>(ActionResultType.SUCCESS, item); return new ActionResult<ItemStack>(ActionResultType.SUCCESS, item);
} }
@ -263,7 +235,8 @@ public class BuilderGunItem extends InfoItem {
continue; continue;
if (!player.isCreative() && BlockHelper.findAndRemoveInInventory(stateToUse, player, 1) == 0) { if (!player.isCreative() && BlockHelper.findAndRemoveInInventory(stateToUse, player, 1) == 0) {
player.getCooldownTracker().setCooldown(item.getItem(), 20); 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<ItemStack>(ActionResultType.SUCCESS, item); return new ActionResult<ItemStack>(ActionResultType.SUCCESS, item);
} }

View file

@ -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.Label;
import com.simibubi.create.foundation.gui.widgets.ScrollInput; import com.simibubi.create.foundation.gui.widgets.ScrollInput;
import com.simibubi.create.foundation.packet.NbtPacket; import com.simibubi.create.foundation.packet.NbtPacket;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
@ -39,6 +40,9 @@ public class BuilderGunScreen extends AbstractSimiScreen {
private boolean offhand; private boolean offhand;
private float animationProgress; 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 IconButton replaceModeButton;
private Indicator replaceModeIndicator; private Indicator replaceModeIndicator;
private IconButton spreadDiagonallyButton; private IconButton spreadDiagonallyButton;
@ -72,24 +76,23 @@ public class BuilderGunScreen extends AbstractSimiScreen {
replaceModeButton = new IconButton(i + 51, j + 41, ScreenResources.ICON_REPLACE_SOLID); replaceModeButton = new IconButton(i + 51, j + 41, ScreenResources.ICON_REPLACE_SOLID);
if (nbt.contains("Replace") && nbt.getBoolean("Replace")) if (nbt.contains("Replace") && nbt.getBoolean("Replace"))
replaceModeIndicator.state = State.ON; replaceModeIndicator.state = State.ON;
replaceModeButton.setToolTip("Replace Mode"); replaceModeButton.setToolTip(Lang.translate("gui.blockzapper.replaceMode"));
spreadDiagonallyIndicator = new Indicator(i + 74, j + 36, ""); spreadDiagonallyIndicator = new Indicator(i + 74, j + 36, "");
spreadDiagonallyButton = new IconButton(i + 74, j + 41, ScreenResources.ICON_FOLLOW_DIAGONAL); spreadDiagonallyButton = new IconButton(i + 74, j + 41, ScreenResources.ICON_FOLLOW_DIAGONAL);
if (nbt.contains("SearchDiagonal") && nbt.getBoolean("SearchDiagonal")) if (nbt.contains("SearchDiagonal") && nbt.getBoolean("SearchDiagonal"))
spreadDiagonallyIndicator.state = State.ON; spreadDiagonallyIndicator.state = State.ON;
spreadDiagonallyButton.setToolTip("Follow Diagonals"); spreadDiagonallyButton.setToolTip(Lang.translate("gui.blockzapper.searchDiagonal"));
spreadMaterialIndicator = new Indicator(i + 92, j + 36, ""); spreadMaterialIndicator = new Indicator(i + 92, j + 36, "");
spreadMaterialButton = new IconButton(i + 92, j + 41, ScreenResources.ICON_FOLLOW_MATERIAL); spreadMaterialButton = new IconButton(i + 92, j + 41, ScreenResources.ICON_FOLLOW_MATERIAL);
if (nbt.contains("SearchFuzzy") && nbt.getBoolean("SearchFuzzy")) if (nbt.contains("SearchFuzzy") && nbt.getBoolean("SearchFuzzy"))
spreadMaterialIndicator.state = State.ON; spreadMaterialIndicator.state = State.ON;
spreadMaterialButton.setToolTip("Ignore Material Borders"); spreadMaterialButton.setToolTip(Lang.translate("gui.blockzapper.searchFuzzy"));
spreadRangeLabel = new Label(i + 119, j + 46, "").withShadow().withSuffix("m"); spreadRangeLabel = new Label(i + 119, j + 46, "").withShadow().withSuffix("m");
spreadRangeInput = new ScrollInput(i + 115, j + 43, 22, 14) spreadRangeInput = new ScrollInput(i + 115, j + 43, 22, 14).withRange(1, BuilderGunItem.getMaxAoe(item))
.withRange(1, BuilderGunItem.getMaxAoe(item)).setState(1) .setState(1).titled(Lang.translate("gui.blockzapper.range")).writingTo(spreadRangeLabel);
.titled("Spread Range").writingTo(spreadRangeLabel);
if (nbt.contains("SearchDistance")) if (nbt.contains("SearchDistance"))
spreadRangeInput.setState(nbt.getInt("SearchDistance")); spreadRangeInput.setState(nbt.getInt("SearchDistance"));
@ -104,7 +107,7 @@ public class BuilderGunScreen extends AbstractSimiScreen {
int id = patternButtons.size(); int id = patternButtons.size();
PlacementPatterns pattern = PlacementPatterns.values()[id]; PlacementPatterns pattern = PlacementPatterns.values()[id];
patternButtons.add(new IconButton(i + 147 + col * 18, j + 23 + row * 18, pattern.icon)); patternButtons.add(new IconButton(i + 147 + col * 18, j + 23 + row * 18, pattern.icon));
patternButtons.get(id).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; int j = guiTop;
ScreenResources.PLACEMENT_GUN.draw(this, i, j); ScreenResources.PLACEMENT_GUN.draw(this, i, j);
font.drawStringWithShadow("Handheld Blockzapper", i + 8, j + 10, 0xCCDDFF); font.drawStringWithShadow(title, i + 8, j + 10, 0xCCDDFF);
font.drawString("Patterns", i + 148, j + 11, ScreenResources.FONT_COLOR); font.drawString(patternSection, i + 148, j + 11, ScreenResources.FONT_COLOR);
minecraft.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); minecraft.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
GlStateManager.enableBlend(); GlStateManager.enableBlend();

View file

@ -4,18 +4,18 @@ import com.simibubi.create.foundation.gui.ScreenResources;
public enum PlacementPatterns { public enum PlacementPatterns {
Solid("Solid Material", ScreenResources.ICON_PATTERN_SOLID), Solid(ScreenResources.ICON_PATTERN_SOLID),
Checkered("Checkerboard", ScreenResources.ICON_PATTERN_CHECKERED), Checkered(ScreenResources.ICON_PATTERN_CHECKERED),
InverseCheckered("Inversed Checkerboard", ScreenResources.ICON_PATTERN_CHECKERED_INVERSED), InverseCheckered(ScreenResources.ICON_PATTERN_CHECKERED_INVERSED),
Chance25("25% Roll", ScreenResources.ICON_PATTERN_CHANCE_25), Chance25(ScreenResources.ICON_PATTERN_CHANCE_25),
Chance50("50% Roll", ScreenResources.ICON_PATTERN_CHANCE_50), Chance50(ScreenResources.ICON_PATTERN_CHANCE_50),
Chance75("75% Roll", ScreenResources.ICON_PATTERN_CHANCE_75); Chance75(ScreenResources.ICON_PATTERN_CHANCE_75);
public String displayName; public String translationKey;
public ScreenResources icon; public ScreenResources icon;
private PlacementPatterns(String displayName, ScreenResources icon) { private PlacementPatterns(ScreenResources icon) {
this.displayName = displayName; this.translationKey = name().toLowerCase();
this.icon = icon; this.icon = icon;
} }

View file

@ -1,4 +1,4 @@
package com.simibubi.create.modules.symmetry; package com.simibubi.create.modules.curiosities.symmetry;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.modules.symmetry; package com.simibubi.create.modules.curiosities.symmetry;
import java.util.Random; import java.util.Random;
@ -7,8 +7,8 @@ import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.utility.TessellatorHelper; import com.simibubi.create.foundation.utility.TessellatorHelper;
import com.simibubi.create.modules.symmetry.mirror.EmptyMirror; import com.simibubi.create.modules.curiosities.symmetry.mirror.EmptyMirror;
import com.simibubi.create.modules.symmetry.mirror.SymmetryMirror; import com.simibubi.create.modules.curiosities.symmetry.mirror.SymmetryMirror;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.client.entity.player.ClientPlayerEntity;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.modules.symmetry; package com.simibubi.create.modules.curiosities.symmetry;
import static com.simibubi.create.CreateConfig.parameters; import static com.simibubi.create.CreateConfig.parameters;
@ -9,20 +9,18 @@ import java.util.Map;
import com.simibubi.create.AllPackets; import com.simibubi.create.AllPackets;
import com.simibubi.create.foundation.gui.ScreenOpener; 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.BlockHelper;
import com.simibubi.create.foundation.utility.ItemDescription; import com.simibubi.create.modules.curiosities.symmetry.mirror.CrossPlaneMirror;
import com.simibubi.create.foundation.utility.ItemDescription.Palette; import com.simibubi.create.modules.curiosities.symmetry.mirror.EmptyMirror;
import com.simibubi.create.modules.symmetry.mirror.CrossPlaneMirror; import com.simibubi.create.modules.curiosities.symmetry.mirror.PlaneMirror;
import com.simibubi.create.modules.symmetry.mirror.EmptyMirror; import com.simibubi.create.modules.curiosities.symmetry.mirror.SymmetryMirror;
import com.simibubi.create.modules.symmetry.mirror.PlaneMirror;
import com.simibubi.create.modules.symmetry.mirror.SymmetryMirror;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext; import net.minecraft.item.ItemUseContext;
import net.minecraft.item.Rarity; 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.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.ISelectionContext; 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.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.network.PacketDistributor; 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) { public SymmetryWandItem(Properties properties) {
super(properties.maxStackSize(1).rarity(Rarity.UNCOMMON)); 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 @Override
public ActionResultType onItemUse(ItemUseContext context) { public ActionResultType onItemUse(ItemUseContext context) {
PlayerEntity player = context.getPlayer(); PlayerEntity player = context.getPlayer();
@ -87,12 +70,12 @@ public class SymmetryWandItem extends InfoItem {
if (context.getWorld().isRemote || context.getHand() != Hand.MAIN_HAND) if (context.getWorld().isRemote || context.getHand() != Hand.MAIN_HAND)
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
CompoundNBT compound = wand.getTag().getCompound($SYMMETRY); CompoundNBT compound = wand.getTag().getCompound(SYMMETRY);
pos = pos.offset(context.getFace()); pos = pos.offset(context.getFace());
SymmetryMirror previousElement = SymmetryMirror.fromNBT(compound); SymmetryMirror previousElement = SymmetryMirror.fromNBT(compound);
// No Shift -> Make / Move Mirror // 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()); Vec3d pos3d = new Vec3d(pos.getX(), pos.getY(), pos.getZ());
SymmetryMirror newElement = new PlaneMirror(pos3d); SymmetryMirror newElement = new PlaneMirror(pos3d);
@ -102,8 +85,7 @@ public class SymmetryWandItem extends InfoItem {
? PlaneMirror.Align.XY.ordinal() ? PlaneMirror.Align.XY.ordinal()
: PlaneMirror.Align.YZ.ordinal()); : PlaneMirror.Align.YZ.ordinal());
newElement.enable = true; newElement.enable = true;
player.sendStatusMessage(new StringTextComponent(TextFormatting.GREEN + "New Plane created"), true); wand.getTag().putBoolean(ENABLE, true);
wand.getTag().putBoolean($ENABLE, true);
} else { } else {
previousElement.setPosition(pos3d); previousElement.setPosition(pos3d);
@ -126,7 +108,7 @@ public class SymmetryWandItem extends InfoItem {
} }
compound = newElement.writeToNbt(); compound = newElement.writeToNbt();
wand.getTag().put($SYMMETRY, compound); wand.getTag().put(SYMMETRY, compound);
player.setHeldItem(context.getHand(), wand); player.setHeldItem(context.getHand(), wand);
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
@ -149,7 +131,7 @@ public class SymmetryWandItem extends InfoItem {
} }
// No Shift -> Clear Mirror // No Shift -> Clear Mirror
wand.getTag().putBoolean($ENABLE, false); wand.getTag().putBoolean(ENABLE, false);
return new ActionResult<ItemStack>(ActionResultType.SUCCESS, wand); return new ActionResult<ItemStack>(ActionResultType.SUCCESS, wand);
} }
@ -159,21 +141,21 @@ public class SymmetryWandItem extends InfoItem {
} }
private static void checkNBT(ItemStack wand) { 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.setTag(new CompoundNBT());
wand.getTag().put($SYMMETRY, new EmptyMirror(new Vec3d(0, 0, 0)).writeToNbt()); wand.getTag().put(SYMMETRY, new EmptyMirror(new Vec3d(0, 0, 0)).writeToNbt());
wand.getTag().putBoolean($ENABLE, false); wand.getTag().putBoolean(ENABLE, false);
} }
} }
public static boolean isEnabled(ItemStack stack) { public static boolean isEnabled(ItemStack stack) {
checkNBT(stack); checkNBT(stack);
return stack.getTag().getBoolean($ENABLE); return stack.getTag().getBoolean(ENABLE);
} }
public static SymmetryMirror getMirror(ItemStack stack) { public static SymmetryMirror getMirror(ItemStack stack) {
checkNBT(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) { public static void apply(World world, ItemStack wand, PlayerEntity player, BlockPos pos, BlockState block) {
@ -185,7 +167,7 @@ public class SymmetryWandItem extends InfoItem {
Map<BlockPos, BlockState> blockSet = new HashMap<>(); Map<BlockPos, BlockState> blockSet = new HashMap<>();
blockSet.put(pos, block); 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(); Vec3d mirrorPos = symmetry.getPosition();
if (mirrorPos.distanceTo(new Vec3d(pos)) > parameters.maxSymmetryWandRange.get()) if (mirrorPos.distanceTo(new Vec3d(pos)) > parameters.maxSymmetryWandRange.get())
@ -240,7 +222,7 @@ public class SymmetryWandItem extends InfoItem {
Map<BlockPos, BlockState> blockSet = new HashMap<>(); Map<BlockPos, BlockState> blockSet = new HashMap<>();
blockSet.put(pos, air); 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(); Vec3d mirrorPos = symmetry.getPosition();
if (mirrorPos.distanceTo(new Vec3d(pos)) > parameters.maxSymmetryWandRange.get()) if (mirrorPos.distanceTo(new Vec3d(pos)) > parameters.maxSymmetryWandRange.get())

View file

@ -1,4 +1,4 @@
package com.simibubi.create.modules.symmetry; package com.simibubi.create.modules.curiosities.symmetry;
import org.lwjgl.opengl.GL11; 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.ScrollInput;
import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput; import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput;
import com.simibubi.create.foundation.packet.NbtPacket; import com.simibubi.create.foundation.packet.NbtPacket;
import com.simibubi.create.modules.symmetry.mirror.CrossPlaneMirror; import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.symmetry.mirror.EmptyMirror; import com.simibubi.create.modules.curiosities.symmetry.mirror.CrossPlaneMirror;
import com.simibubi.create.modules.symmetry.mirror.PlaneMirror; import com.simibubi.create.modules.curiosities.symmetry.mirror.EmptyMirror;
import com.simibubi.create.modules.symmetry.mirror.SymmetryMirror; import com.simibubi.create.modules.curiosities.symmetry.mirror.PlaneMirror;
import com.simibubi.create.modules.symmetry.mirror.TriplePlaneMirror; 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.BufferBuilder;
import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.RenderHelper;
@ -36,6 +37,9 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
private ScrollInput areaAlign; private ScrollInput areaAlign;
private Label labelAlign; private Label labelAlign;
private final String mirrorType = Lang.translate("gui.symmetryWand.mirrorType");
private final String orientation = Lang.translate("gui.symmetryWand.orientation");
private SymmetryMirror currentElement; private SymmetryMirror currentElement;
private float animationProgress; private float animationProgress;
private ItemStack wand; private ItemStack wand;
@ -62,8 +66,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
int state = currentElement instanceof TriplePlaneMirror ? 2 int state = currentElement instanceof TriplePlaneMirror ? 2
: currentElement instanceof CrossPlaneMirror ? 1 : 0; : currentElement instanceof CrossPlaneMirror ? 1 : 0;
areaType = new SelectionScrollInput(guiLeft + 119, guiTop + 12, 70, 14) areaType = new SelectionScrollInput(guiLeft + 119, guiTop + 12, 70, 14)
.forOptions(SymmetryMirror.TOOLTIP_ELEMENTS).titled("Type of Mirror").writingTo(labelType) .forOptions(SymmetryMirror.getMirrors()).titled(mirrorType).writingTo(labelType).setState(state);
.setState(state);
areaType.calling(position -> { areaType.calling(position -> {
switch (position) { switch (position) {
@ -83,7 +86,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
}); });
widgets.clear(); widgets.clear();
initAlign(currentElement); initAlign(currentElement);
widgets.add(labelAlign); widgets.add(labelAlign);
@ -98,7 +101,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
} }
areaAlign = new SelectionScrollInput(guiLeft + 119, guiTop + 32, 70, 14).forOptions(element.getAlignToolTips()) areaAlign = new SelectionScrollInput(guiLeft + 119, guiTop + 32, 70, 14).forOptions(element.getAlignToolTips())
.titled("Direction").writingTo(labelAlign).setState(element.getOrientationIndex()) .titled(orientation).writingTo(labelAlign).setState(element.getOrientationIndex())
.calling(element::setOrientation); .calling(element::setOrientation);
widgets.add(areaAlign); widgets.add(areaAlign);
@ -117,8 +120,8 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
int x = guiLeft + 63; int x = guiLeft + 63;
int y = guiTop + 15; int y = guiTop + 15;
font.drawString("Symmetry", x, y, ScreenResources.FONT_COLOR); font.drawString(mirrorType, x - 5, y, ScreenResources.FONT_COLOR);
font.drawString("Direction", x, y + 20, ScreenResources.FONT_COLOR); font.drawString(orientation, x - 5, y + 20, ScreenResources.FONT_COLOR);
minecraft.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE); minecraft.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
GlStateManager.enableBlend(); GlStateManager.enableBlend();
@ -128,25 +131,25 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
GlStateManager.pushLightingAttributes(); GlStateManager.pushLightingAttributes();
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
RenderHelper.enableStandardItemLighting(); RenderHelper.enableStandardItemLighting();
GlStateManager.enableBlend(); GlStateManager.enableBlend();
GlStateManager.enableRescaleNormal(); GlStateManager.enableRescaleNormal();
GlStateManager.enableAlphaTest(); GlStateManager.enableAlphaTest();
GlStateManager.alphaFunc(516, 0.1F); GlStateManager.alphaFunc(516, 0.1F);
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); 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.translated((this.width - this.sWidth) / 2 + 250, this.height / 2 + this.sHeight / 2, 100);
GlStateManager.rotatef(-30, .4f, 0, -.2f); GlStateManager.rotatef(-30, .4f, 0, -.2f);
GlStateManager.rotatef(90 + 0.2f * animationProgress, 0, 1, 0); GlStateManager.rotatef(90 + 0.2f * animationProgress, 0, 1, 0);
GlStateManager.scaled(100, -100, 100); GlStateManager.scaled(100, -100, 100);
itemRenderer.renderItem(wand, itemRenderer.getModelWithOverrides(wand)); itemRenderer.renderItem(wand, itemRenderer.getModelWithOverrides(wand));
GlStateManager.disableAlphaTest(); GlStateManager.disableAlphaTest();
GlStateManager.disableRescaleNormal(); GlStateManager.disableRescaleNormal();
GlStateManager.disableLighting(); GlStateManager.disableLighting();
GlStateManager.popMatrix(); GlStateManager.popMatrix();
GlStateManager.popAttributes(); GlStateManager.popAttributes();
} }
@ -169,7 +172,7 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
public void removed() { public void removed() {
ItemStack heldItemMainhand = minecraft.player.getHeldItemMainhand(); ItemStack heldItemMainhand = minecraft.player.getHeldItemMainhand();
CompoundNBT compound = heldItemMainhand.getTag(); CompoundNBT compound = heldItemMainhand.getTag();
compound.put(SymmetryWandItem.$SYMMETRY, currentElement.writeToNbt()); compound.put(SymmetryWandItem.SYMMETRY, currentElement.writeToNbt());
heldItemMainhand.setTag(compound); heldItemMainhand.setTag(compound);
AllPackets.channel.send(PacketDistributor.SERVER.noArg(), new NbtPacket(heldItemMainhand)); AllPackets.channel.send(PacketDistributor.SERVER.noArg(), new NbtPacket(heldItemMainhand));
minecraft.player.setHeldItem(Hand.MAIN_HAND, heldItemMainhand); minecraft.player.setHeldItem(Hand.MAIN_HAND, heldItemMainhand);

View file

@ -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.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;

View file

@ -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.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;

View file

@ -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; import com.simibubi.create.foundation.block.IRenderUtilityBlock;

View file

@ -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; import net.minecraft.block.material.Material;

View file

@ -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.GLX;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;

View file

@ -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; import com.simibubi.create.foundation.block.CustomRenderItemBakedModel;

View file

@ -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.HashMap;
import java.util.List; import java.util.List;
@ -6,7 +6,8 @@ import java.util.Map;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.simibubi.create.AllBlocks; 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.block.BlockState;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
@ -90,7 +91,7 @@ public class CrossPlaneMirror extends SymmetryMirror {
@Override @Override
public List<String> getAlignToolTips() { public List<String> getAlignToolTips() {
return ImmutableList.of("Orthogonal", "Diagonal"); return ImmutableList.of(Lang.translate("orientation.orthogonal"), Lang.translate("orientation.diagonal"));
} }
} }

View file

@ -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.HashMap;
import java.util.List; import java.util.List;

View file

@ -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.HashMap;
import java.util.List; import java.util.List;
@ -6,7 +6,8 @@ import java.util.Map;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.simibubi.create.AllBlocks; 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.block.BlockState;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
@ -85,7 +86,7 @@ public class PlaneMirror extends SymmetryMirror {
@Override @Override
public List<String> getAlignToolTips() { public List<String> getAlignToolTips() {
return ImmutableList.of("Mirror Z", "Mirror X"); return ImmutableList.of(Lang.translate("orientation.alongZ"), Lang.translate("orientation.alongX"));
} }
} }

View file

@ -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.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundNBT; 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 CROSS_PLANE = "cross_plane";
public static final String TRIPLE_PLANE = "triple_plane"; public static final String TRIPLE_PLANE = "triple_plane";
public static final List<String> TOOLTIP_ELEMENTS = ImmutableList.of("Mirror once", "Rectanglar", "Octagonal");
protected Vec3d position; protected Vec3d position;
protected IStringSerializable orientation; protected IStringSerializable orientation;
protected int orientationIndex; protected int orientationIndex;
@ -40,6 +39,11 @@ public abstract class SymmetryMirror {
orientationIndex = 0; orientationIndex = 0;
} }
public static List<String> getMirrors() {
return ImmutableList.of(Lang.translate("symmetry.mirror.plane"), Lang.translate("symmetry.mirror.doublePlane"),
Lang.translate("symmetry.mirror.triplePlane"));
}
public IStringSerializable getOrientation() { public IStringSerializable getOrientation() {
return orientation; return orientation;
} }

View file

@ -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.HashMap;
import java.util.List; import java.util.List;
@ -6,6 +6,7 @@ import java.util.Map;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
@ -60,7 +61,7 @@ public class TriplePlaneMirror extends SymmetryMirror {
@Override @Override
public List<String> getAlignToolTips() { public List<String> getAlignToolTips() {
return ImmutableList.of("Horizontal"); return ImmutableList.of(Lang.translate("orientation.horizontal"));
} }
} }

View file

@ -7,8 +7,6 @@ import java.util.Optional;
import com.simibubi.create.foundation.item.AbstractToolItem; import com.simibubi.create.foundation.item.AbstractToolItem;
import com.simibubi.create.foundation.item.AllToolTypes; 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.ItemHelper;
import com.simibubi.create.foundation.utility.VecHelper; 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.SoundEvents;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.dimension.DimensionType;
@ -94,14 +91,4 @@ public class BlazingToolItem extends AbstractToolItem {
drops.addAll(smeltedStacks); 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();
}
} }

View file

@ -2,8 +2,6 @@ package com.simibubi.create.modules.curiosities.tools;
import com.simibubi.create.foundation.item.AbstractToolItem; import com.simibubi.create.foundation.item.AbstractToolItem;
import com.simibubi.create.foundation.item.AllToolTypes; 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 { public class RoseQuartzToolItem extends AbstractToolItem {
@ -11,12 +9,4 @@ public class RoseQuartzToolItem extends AbstractToolItem {
super(attackDamageIn, attackSpeedIn, AllToolTiers.ROSE_QUARTZ, builder, types); 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) + ".");
}
} }

View file

@ -4,13 +4,10 @@ import java.util.List;
import com.simibubi.create.foundation.item.AbstractToolItem; import com.simibubi.create.foundation.item.AbstractToolItem;
import com.simibubi.create.foundation.item.AllToolTypes; 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.block.BlockState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
public class ShadowSteelToolItem extends AbstractToolItem { public class ShadowSteelToolItem extends AbstractToolItem {
@ -20,16 +17,6 @@ public class ShadowSteelToolItem extends AbstractToolItem {
super(attackDamageIn, attackSpeedIn, AllToolTiers.SHADOW_STEEL, builder, types); 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 @Override
public void modifyDrops(List<ItemStack> drops, IWorld world, BlockPos pos, ItemStack tool, BlockState state) { public void modifyDrops(List<ItemStack> drops, IWorld world, BlockPos pos, ItemStack tool, BlockState state) {
drops.clear(); drops.clear();

View file

@ -2,9 +2,6 @@ package com.simibubi.create.modules.gardens;
import java.util.Random; 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 com.simibubi.create.foundation.utility.PlacementSimulationWorld;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -12,24 +9,18 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.SaplingBlock; import net.minecraft.block.SaplingBlock;
import net.minecraft.item.BoneMealItem; import net.minecraft.item.BoneMealItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemUseContext; import net.minecraft.item.ItemUseContext;
import net.minecraft.util.ActionResultType; import net.minecraft.util.ActionResultType;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class TreeFertilizerItem extends InfoItem { public class TreeFertilizerItem extends Item {
public TreeFertilizerItem(Properties properties) { public TreeFertilizerItem(Properties properties) {
super(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 @Override
public ActionResultType onItemUse(ItemUseContext context) { public ActionResultType onItemUse(ItemUseContext context) {
BlockState state = context.getWorld().getBlockState(context.getPos()); BlockState state = context.getWorld().getBlockState(context.getPos());

View file

@ -50,12 +50,12 @@ public class FrequencyHandler {
public void onLoadWorld(IWorld world) { public void onLoadWorld(IWorld world) {
connections.put(world, new HashMap<>()); 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) { public void onUnloadWorld(IWorld world) {
connections.remove(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<Frequency, Frequency> getNetworkKey(IHaveWireless actor) { private static Pair<Frequency, Frequency> getNetworkKey(IHaveWireless actor) {

View file

@ -1,9 +1,6 @@
package com.simibubi.create.modules.logistics.block; package com.simibubi.create.modules.logistics.block;
import com.simibubi.create.foundation.block.InfoBlock; import net.minecraft.block.Block;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -19,7 +16,7 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.network.NetworkHooks; 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); public static final VoxelShape SHAPE = makeCuboidShape(1, 0, 1, 15, 14, 15);
@ -56,15 +53,6 @@ public class FlexcrateBlock extends InfoBlock {
return new FlexcrateTileEntity(); 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 @Override
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) { public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
if (worldIn.getTileEntity(pos) == null) if (worldIn.getTileEntity(pos) == null)

View file

@ -11,6 +11,7 @@ import com.simibubi.create.foundation.gui.ScreenElementRenderer;
import com.simibubi.create.foundation.gui.ScreenResources; import com.simibubi.create.foundation.gui.ScreenResources;
import com.simibubi.create.foundation.gui.widgets.Label; import com.simibubi.create.foundation.gui.widgets.Label;
import com.simibubi.create.foundation.gui.widgets.ScrollInput; import com.simibubi.create.foundation.gui.widgets.ScrollInput;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.logistics.packet.ConfigureFlexcratePacket; import com.simibubi.create.modules.logistics.packet.ConfigureFlexcratePacket;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -24,6 +25,9 @@ public class FlexcrateScreen extends AbstractSimiContainerScreen<FlexcrateContai
private ScrollInput allowedItems; private ScrollInput allowedItems;
private int lastModification; private int lastModification;
private final String title = Lang.translate("gui.flexcrate.title");
private final String storageSpace = Lang.translate("gui.flexcrate.storageSpace");
public FlexcrateScreen(FlexcrateContainer container, PlayerInventory inv, ITextComponent title) { public FlexcrateScreen(FlexcrateContainer container, PlayerInventory inv, ITextComponent title) {
super(container, inv, title); super(container, inv, title);
te = container.te; te = container.te;
@ -37,8 +41,8 @@ public class FlexcrateScreen extends AbstractSimiContainerScreen<FlexcrateContai
widgets.clear(); widgets.clear();
allowedItemsLabel = new Label(guiLeft + 100 + 70, guiTop + 107, "").colored(0xD3CBBE).withShadow(); allowedItemsLabel = new Label(guiLeft + 100 + 70, guiTop + 107, "").colored(0xD3CBBE).withShadow();
allowedItems = new ScrollInput(guiLeft + 100 + 65, guiTop + 104, 41, 14).titled("Storage Space") allowedItems = new ScrollInput(guiLeft + 100 + 65, guiTop + 104, 41, 14).titled(storageSpace).withRange(1, 1025)
.withRange(1, 1025).writingTo(allowedItemsLabel).withShiftStep(64).setState(te.allowedAmount) .writingTo(allowedItemsLabel).withShiftStep(64).setState(te.allowedAmount)
.calling(s -> lastModification = 0); .calling(s -> lastModification = 0);
allowedItems.onChanged(); allowedItems.onChanged();
widgets.add(allowedItemsLabel); widgets.add(allowedItemsLabel);
@ -55,13 +59,13 @@ public class FlexcrateScreen extends AbstractSimiContainerScreen<FlexcrateContai
int fontColor = 0x4B3A22; int fontColor = 0x4B3A22;
FLEXCRATE.draw(this, crateLeft, crateTop); FLEXCRATE.draw(this, crateLeft, crateTop);
font.drawStringWithShadow("FlexCrate", crateLeft - 3 + (FLEXCRATE.width - font.getStringWidth("FlexCrate")) / 2, font.drawStringWithShadow(title, crateLeft - 3 + (FLEXCRATE.width - font.getStringWidth(title)) / 2,
crateTop + 10, hFontColor); crateTop + 10, hFontColor);
String itemCount = "" + te.itemCount; String itemCount = "" + te.itemCount;
font.drawString(itemCount, crateLeft + 53 - font.getStringWidth(itemCount), crateTop + 107, fontColor); font.drawString(itemCount, crateLeft + 53 - font.getStringWidth(itemCount), crateTop + 107, fontColor);
PLAYER_INVENTORY.draw(this, invLeft, invTop); PLAYER_INVENTORY.draw(this, invLeft, invTop);
font.drawString("Inventory", invLeft + 7, invTop + 6, 0x666666); font.drawString(playerInventory.getDisplayName().getFormattedText(), invLeft + 7, invTop + 6, 0x666666);
for (int slot = 0; slot < 16; slot++) { for (int slot = 0; slot < 16; slot++) {
if (allowedItems.getState() > slot * 64) if (allowedItems.getState() > slot * 64)

View file

@ -1,6 +1,7 @@
package com.simibubi.create.modules.logistics.block; package com.simibubi.create.modules.logistics.block;
import com.mojang.blaze3d.platform.GlStateManager; 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.TessellatorHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -127,7 +128,7 @@ public interface IBlockWithFilter {
GlStateManager.translated(17.5f, -5f, -5f); GlStateManager.translated(17.5f, -5f, -5f);
GlStateManager.rotated(67.5f, 1, 0, 0); GlStateManager.rotated(67.5f, 1, 0, 0);
String text = "Filter"; String text = Lang.translate("logistics.filter");
Minecraft.getInstance().fontRenderer.drawString(text, 0, 0, 0x88FFBB); Minecraft.getInstance().fontRenderer.drawString(text, 0, 0, 0x88FFBB);
GlStateManager.translated(0, 0, -1/4f); GlStateManager.translated(0, 0, -1/4f);
Minecraft.getInstance().fontRenderer.drawString(text, 1, 1, 0x224433); Minecraft.getInstance().fontRenderer.drawString(text, 1, 1, 0x224433);

View file

@ -3,6 +3,7 @@ package com.simibubi.create.modules.logistics.block;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import com.mojang.blaze3d.platform.GlStateManager; 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.TessellatorHelper;
import com.simibubi.create.modules.logistics.IHaveWireless; 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.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
@ -138,7 +139,7 @@ public interface IBlockWithFrequency {
GlStateManager.scaled(textScale, -textScale, textScale); GlStateManager.scaled(textScale, -textScale, textScale);
GlStateManager.translated(19.5f, -5f, 10f); GlStateManager.translated(19.5f, -5f, 10f);
String text = "Freq. #2"; String text = Lang.translate("logistics.secondFrequency");
Minecraft.getInstance().fontRenderer.drawString(text, 0, 0, 0xFFFF99); Minecraft.getInstance().fontRenderer.drawString(text, 0, 0, 0xFFFF99);
GlStateManager.translated(0, 0, -1 / 4f); GlStateManager.translated(0, 0, -1 / 4f);
Minecraft.getInstance().fontRenderer.drawString(text, 1, 1, 0x444433); Minecraft.getInstance().fontRenderer.drawString(text, 1, 1, 0x444433);
@ -158,7 +159,7 @@ public interface IBlockWithFrequency {
GlStateManager.scaled(textScale, -textScale, textScale); GlStateManager.scaled(textScale, -textScale, textScale);
GlStateManager.translated(19.5f, -5f, 10f); GlStateManager.translated(19.5f, -5f, 10f);
String text = "Freq. #1"; String text = Lang.translate("logistics.firstFrequency");
Minecraft.getInstance().fontRenderer.drawString(text, 0, 0, 0xFFFF99); Minecraft.getInstance().fontRenderer.drawString(text, 0, 0, 0xFFFF99);
GlStateManager.translated(0, 0, -1 / 4f); GlStateManager.translated(0, 0, -1 / 4f);
Minecraft.getInstance().fontRenderer.drawString(text, 1, 1, 0x444433); Minecraft.getInstance().fontRenderer.drawString(text, 1, 1, 0x444433);

View file

@ -6,19 +6,13 @@ import java.util.List;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import com.simibubi.create.foundation.block.ProperDirectionalBlock; 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 com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty; import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.StateContainer.Builder;
import net.minecraft.state.properties.BlockStateProperties; 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.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import net.minecraft.world.World; 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 POWERED = BlockStateProperties.POWERED;
public static final BooleanProperty RECEIVER = BooleanProperty.create("receiver"); 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), 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); WEST_SHAPE = makeCuboidShape(13, 1, 3, 17, 15, 13);
private TooltipHolder info;
public RedstoneBridgeBlock() { public RedstoneBridgeBlock() {
super(Properties.from(Blocks.DARK_OAK_LOG)); super(Properties.from(Blocks.DARK_OAK_LOG));
info = new TooltipHolder(this);
cacheItemPositions(); cacheItemPositions();
setDefaultState(getDefaultState().with(POWERED, false).with(RECEIVER, false)); setDefaultState(getDefaultState().with(POWERED, false).with(RECEIVER, false));
} }
@ -251,29 +239,4 @@ public class RedstoneBridgeBlock extends ProperDirectionalBlock implements ITool
return state.get(FACING); return state.get(FACING);
} }
@Override
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> 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();
}
} }

View file

@ -1,21 +1,13 @@
package com.simibubi.create.modules.logistics.block; package com.simibubi.create.modules.logistics.block;
import java.util.List;
import com.simibubi.create.foundation.gui.ScreenOpener; 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.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.HorizontalBlock; import net.minecraft.block.HorizontalBlock;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.IntegerProperty; import net.minecraft.state.IntegerProperty;
import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.StateContainer.Builder;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -23,7 +15,6 @@ import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -31,14 +22,12 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor; 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); public static final IntegerProperty INDICATOR = IntegerProperty.create("indicator", 0, 6);
private TooltipHolder info;
public StockswitchBlock() { public StockswitchBlock() {
super(Properties.from(Blocks.ANDESITE)); super(Properties.from(Blocks.ANDESITE));
info = new TooltipHolder(this);
} }
@Override @Override
@ -87,12 +76,6 @@ public class StockswitchBlock extends HorizontalBlock implements ITooltip {
return te == null || !te.powered ? 0 : 15 ; return te == null || !te.powered ? 0 : 15 ;
} }
@Override
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
info.addInformation(tooltip);
}
@Override @Override
protected void fillStateContainer(Builder<Block, BlockState> builder) { protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(HORIZONTAL_FACING, INDICATOR); builder.add(HORIZONTAL_FACING, INDICATOR);
@ -136,16 +119,4 @@ public class StockswitchBlock extends HorizontalBlock implements ITooltip {
return new StockswitchTileEntity(); 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();
}
} }

View file

@ -12,6 +12,7 @@ import com.simibubi.create.foundation.gui.ScreenElementRenderer;
import com.simibubi.create.foundation.gui.ScreenResources; import com.simibubi.create.foundation.gui.ScreenResources;
import com.simibubi.create.foundation.gui.widgets.Label; import com.simibubi.create.foundation.gui.widgets.Label;
import com.simibubi.create.foundation.gui.widgets.ScrollInput; import com.simibubi.create.foundation.gui.widgets.ScrollInput;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.logistics.packet.ConfigureStockswitchPacket; import com.simibubi.create.modules.logistics.packet.ConfigureStockswitchPacket;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -23,6 +24,14 @@ public class StockswitchScreen extends AbstractSimiScreen {
private ScrollInput onAbove; private ScrollInput onAbove;
private Label onAboveLabel; 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 int lastModification;
private StockswitchTileEntity te; private StockswitchTileEntity te;
private float cursorPos; private float cursorPos;
@ -40,7 +49,7 @@ public class StockswitchScreen extends AbstractSimiScreen {
cursorPos = te.currentLevel == -1 ? 0 : te.currentLevel; cursorPos = te.currentLevel == -1 ? 0 : te.currentLevel;
offBelowLabel = new Label(guiLeft + 116, guiTop + 72, "").colored(0xD3CBBE).withShadow(); 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 -> { .calling(state -> {
offBelowLabel.text = state + "%"; offBelowLabel.text = state + "%";
lastModification = 0; lastModification = 0;
@ -51,7 +60,7 @@ public class StockswitchScreen extends AbstractSimiScreen {
}).setState((int) (te.offWhenBelow * 100)); }).setState((int) (te.offWhenBelow * 100));
onAboveLabel = new Label(guiLeft + 116, guiTop + 55, "").colored(0xD3CBBE).withShadow(); 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 -> { .calling(state -> {
onAboveLabel.text = state + "%"; onAboveLabel.text = state + "%";
lastModification = 0; lastModification = 0;
@ -71,13 +80,10 @@ public class StockswitchScreen extends AbstractSimiScreen {
int hFontColor = 0xD3CBBE; int hFontColor = 0xD3CBBE;
int fontColor = 0x4B3A22; int fontColor = 0x4B3A22;
STOCKSWITCH.draw(this, guiLeft, guiTop); STOCKSWITCH.draw(this, guiLeft, guiTop);
font.drawStringWithShadow("Stockpile Switch", font.drawStringWithShadow(title, guiLeft - 3 + (STOCKSWITCH.width - font.getStringWidth(title)) / 2,
guiLeft - 3 + (STOCKSWITCH.width - font.getStringWidth("Stockpile Switch")) / 2, guiTop + 10, guiTop + 10, hFontColor);
hFontColor); font.drawString(onAbove.getState() == 100 ? startAt : startAbove, guiLeft + 13, guiTop + 55, fontColor);
font.drawString("Start Signal " + (onAbove.getState() == 100 ? "at" : "above"), guiLeft + 13, guiTop + 55, font.drawString(offBelow.getState() == 0 ? stopAt : stopBelow, guiLeft + 13, guiTop + 72, fontColor);
fontColor);
font.drawString("Stop Signal " + (offBelow.getState() == 0 ? "at" : "below"), guiLeft + 13, guiTop + 72,
fontColor);
ScreenResources sprite = ScreenResources.STOCKSWITCH_INTERVAL; ScreenResources sprite = ScreenResources.STOCKSWITCH_INTERVAL;
float lowerBound = offBelow.getState() / 100f * (sprite.width - 20) + 10; float lowerBound = offBelow.getState() / 100f * (sprite.width - 20) + 10;
@ -108,12 +114,12 @@ public class StockswitchScreen extends AbstractSimiScreen {
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();
if (te.currentLevel == -1) if (te.currentLevel == -1)
cursorPos = 0; cursorPos = 0;
else else
cursorPos += (te.currentLevel - cursorPos) / 4; cursorPos += (te.currentLevel - cursorPos) / 4;
if (lastModification >= 0) if (lastModification >= 0)
lastModification++; lastModification++;

View file

@ -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.IBlockWithScrollableValue;
import com.simibubi.create.foundation.block.IWithTileEntity; import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -83,7 +84,7 @@ public class FlexpeaterBlock extends RedstoneDiodeBlock
FlexpeaterTileEntity te = (FlexpeaterTileEntity) world.getTileEntity(pos); FlexpeaterTileEntity te = (FlexpeaterTileEntity) world.getTileEntity(pos);
if (te == null) if (te == null)
return ""; return "";
return "Delay (" + te.getUnit() + ")"; return Lang.translate("generic.delay") + " (" + te.getUnit() + ")";
} }
@Override @Override

View file

@ -6,6 +6,7 @@ import static net.minecraft.block.RedstoneDiodeBlock.POWERED;
import com.simibubi.create.AllPackets; import com.simibubi.create.AllPackets;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
import com.simibubi.create.foundation.block.SyncedTileEntity; import com.simibubi.create.foundation.block.SyncedTileEntity;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
@ -84,10 +85,10 @@ public class FlexpeaterTileEntity extends SyncedTileEntity implements ITickableT
public String getUnit() { public String getUnit() {
if (newMaxState < 20) if (newMaxState < 20)
return "Ticks"; return Lang.translate("generic.unit.ticks");
if (newMaxState < 20 * 60) if (newMaxState < 20 * 60)
return "Seconds"; return Lang.translate("generic.unit.seconds");
return "Minutes"; return Lang.translate("generic.unit.minutes");
} }
@Override @Override

View file

@ -1,13 +1,10 @@
package com.simibubi.create.modules.logistics.item; 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.client.renderer.color.IItemColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class FilterItem extends InfoItem { public class FilterItem extends Item {
public static class Color implements IItemColor { public static class Color implements IItemColor {
@Override @Override
@ -26,13 +23,4 @@ public class FilterItem extends InfoItem {
super(properties); 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();
}
} }

View file

@ -19,6 +19,7 @@ import java.util.Map;
import com.simibubi.create.AllPackets; import com.simibubi.create.AllPackets;
import com.simibubi.create.Create; import com.simibubi.create.Create;
import com.simibubi.create.foundation.utility.FilesHelper; import com.simibubi.create.foundation.utility.FilesHelper;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.schematics.packet.SchematicUploadPacket; import com.simibubi.create.modules.schematics.packet.SchematicUploadPacket;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -68,10 +69,10 @@ public class ClientSchematicLoader {
// Too big // Too big
Integer maxSize = parameters.maxTotalSchematicSize.get(); Integer maxSize = parameters.maxTotalSchematicSize.get();
if (size > maxSize * 1000) { if (size > maxSize * 1000) {
Minecraft.getInstance().player Minecraft.getInstance().player.sendMessage(new StringTextComponent(
.sendMessage(new StringTextComponent("Your schematic is too large (" + size / 1000 + " KB).")); Lang.translate("schematics.uploadTooLarge") + " (" + size / 1000 + " KB)."));
Minecraft.getInstance().player.sendMessage( Minecraft.getInstance().player.sendMessage(
new StringTextComponent("The maximum allowed schematic file size is: " + maxSize + " KB")); new StringTextComponent(Lang.translate("schematics.maxAllowedSize") + " " + maxSize + " KB"));
return; return;
} }

View file

@ -27,6 +27,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
public class ServerSchematicLoader { public class ServerSchematicLoader {
@ -91,9 +92,10 @@ public class ServerSchematicLoader {
// Too big // Too big
Integer maxFileSize = parameters.maxTotalSchematicSize.get(); Integer maxFileSize = parameters.maxTotalSchematicSize.get();
if (size > maxFileSize * 1000) { if (size > maxFileSize * 1000) {
player.sendMessage(new StringTextComponent("Your schematic is too large (" + size / 1000 + " KB).")); player.sendMessage(new TranslationTextComponent("create.schematics.uploadTooLarge")
player.sendMessage( .appendSibling(new StringTextComponent(" (" + size / 1000 + " KB).")));
new StringTextComponent("The maximum allowed schematic file size is: " + maxFileSize + " KB")); player.sendMessage(new TranslationTextComponent("create.schematics.maxAllowedSize")
.appendSibling(new StringTextComponent(" " + maxFileSize + " KB")));
return; return;
} }

View file

@ -1,9 +1,6 @@
package com.simibubi.create.modules.schematics.block; package com.simibubi.create.modules.schematics.block;
import com.simibubi.create.foundation.block.InfoBlock; import net.minecraft.block.Block;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.util.math.BlockPos; 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.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader; 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); protected static final VoxelShape shape = makeCuboidShape(1, 0, 1, 15, 14, 15);
@ -35,12 +32,4 @@ public class CreativeCrateBlock extends InfoBlock {
return shape; 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();
}
} }

View file

@ -1,41 +1,26 @@
package com.simibubi.create.modules.schematics.block; 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.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.HorizontalBlock; import net.minecraft.block.HorizontalBlock;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.InventoryHelper; import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.StateContainer.Builder;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.network.NetworkHooks; import net.minecraftforge.fml.network.NetworkHooks;
public class SchematicTableBlock extends HorizontalBlock implements ITooltip { public class SchematicTableBlock extends HorizontalBlock {
private TooltipHolder info;
public SchematicTableBlock() { public SchematicTableBlock() {
super(Properties.from(Blocks.OAK_PLANKS)); super(Properties.from(Blocks.OAK_PLANKS));
info = new TooltipHolder(this);
} }
@Override @Override
@ -49,13 +34,6 @@ public class SchematicTableBlock extends HorizontalBlock implements ITooltip {
return false; return false;
} }
@Override
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
info.addInformation(tooltip);
}
@Override @Override
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockItemUseContext context) {
return this.getDefaultState().with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite()); 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();
}
} }

View file

@ -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.Label;
import com.simibubi.create.foundation.gui.widgets.ScrollInput; import com.simibubi.create.foundation.gui.widgets.ScrollInput;
import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput; import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.schematics.ClientSchematicLoader; import com.simibubi.create.modules.schematics.ClientSchematicLoader;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -35,6 +36,12 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
private IconButton refreshButton; private IconButton refreshButton;
private Label schematicsLabel; private Label schematicsLabel;
private final String title = Lang.translate("gui.schematicTable.title");
private final String uploading = Lang.translate("gui.schematicTable.uploading");
private final String finished = Lang.translate("gui.schematicTable.finished");
private final String noSchematics = Lang.translate("gui.schematicTable.noSchematics");
private final String availableSchematicsTitle = Lang.translate("gui.schematicTable.availableSchematics");
private float progress; private float progress;
private float chasingProgress; private float chasingProgress;
private float lastChasingProgress; private float lastChasingProgress;
@ -60,7 +67,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
schematicsLabel.text = ""; schematicsLabel.text = "";
if (!availableSchematics.isEmpty()) { if (!availableSchematics.isEmpty()) {
schematicsArea = new SelectionScrollInput(mainLeft + 33, mainTop + 23, 134, 14) schematicsArea = new SelectionScrollInput(mainLeft + 33, mainTop + 23, 134, 14)
.forOptions(availableSchematics).titled("Available Schematics").writingTo(schematicsLabel); .forOptions(availableSchematics).titled(availableSchematicsTitle).writingTo(schematicsLabel);
widgets.add(schematicsArea); widgets.add(schematicsArea);
widgets.add(schematicsLabel); widgets.add(schematicsLabel);
} }
@ -89,18 +96,18 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
int mainTop = guiTop - 16; int mainTop = guiTop - 16;
ScreenResources.PLAYER_INVENTORY.draw(this, x - 16, y + 70 + 14); ScreenResources.PLAYER_INVENTORY.draw(this, x - 16, y + 70 + 14);
font.drawString("Inventory", x - 15 + 7, y + 64 + 26, 0x666666); font.drawString(playerInventory.getDisplayName().getFormattedText(), x - 15 + 7, y + 64 + 26, 0x666666);
SCHEMATIC_TABLE.draw(this, mainLeft, mainTop); SCHEMATIC_TABLE.draw(this, mainLeft, mainTop);
if (container.getTileEntity().isUploading) if (container.getTileEntity().isUploading)
font.drawString("Uploading...", mainLeft + 76, mainTop + 10, ScreenResources.FONT_COLOR); font.drawString(uploading, mainLeft + 76, mainTop + 10, ScreenResources.FONT_COLOR);
else if (container.getSlot(1).getHasStack()) else if (container.getSlot(1).getHasStack())
font.drawString("Upload Finished!", mainLeft + 60, mainTop + 10, ScreenResources.FONT_COLOR); font.drawString(finished, mainLeft + 60, mainTop + 10, ScreenResources.FONT_COLOR);
else else
font.drawString("Schematic Table", mainLeft + 60, mainTop + 10, ScreenResources.FONT_COLOR); font.drawString(title, mainLeft + 60, mainTop + 10, ScreenResources.FONT_COLOR);
if (schematicsArea == null) { if (schematicsArea == null) {
font.drawStringWithShadow(" No Schematics Saved ", mainLeft + 39, mainTop + 26, 0xFFDD44); font.drawStringWithShadow(noSchematics, mainLeft + 39, mainTop + 26, 0xFFDD44);
} }
minecraft.getTextureManager().bindTexture(SCHEMATIC_TABLE_PROGRESS.location); minecraft.getTextureManager().bindTexture(SCHEMATIC_TABLE_PROGRESS.location);
@ -174,7 +181,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
@Override @Override
public boolean mouseClicked(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_) { public boolean mouseClicked(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_) {
ClientSchematicLoader schematicSender = CreateClient.schematicSender; ClientSchematicLoader schematicSender = CreateClient.schematicSender;
if (confirmButton.active && confirmButton.isHovered() && ((SchematicTableContainer) container).canWrite() if (confirmButton.active && confirmButton.isHovered() && ((SchematicTableContainer) container).canWrite()
&& schematicsArea != null) { && schematicsArea != null) {
@ -195,7 +202,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
if (!availableSchematics.isEmpty()) { if (!availableSchematics.isEmpty()) {
schematicsArea = new SelectionScrollInput(guiLeft - 56 + 33, guiTop - 16 + 23, 134, 14) schematicsArea = new SelectionScrollInput(guiLeft - 56 + 33, guiTop - 16 + 23, 134, 14)
.forOptions(availableSchematics).titled("Available Schematics").writingTo(schematicsLabel); .forOptions(availableSchematics).titled(availableSchematicsTitle).writingTo(schematicsLabel);
widgets.add(schematicsArea); widgets.add(schematicsArea);
} else { } else {
schematicsArea = null; schematicsArea = null;

View file

@ -1,10 +1,8 @@
package com.simibubi.create.modules.schematics.block; package com.simibubi.create.modules.schematics.block;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
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.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -22,7 +20,7 @@ import net.minecraft.world.IWorldReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.network.NetworkHooks; import net.minecraftforge.fml.network.NetworkHooks;
public class SchematicannonBlock extends InfoBlock { public class SchematicannonBlock extends Block {
public SchematicannonBlock() { public SchematicannonBlock() {
super(Properties.from(Blocks.DISPENSER)); super(Properties.from(Blocks.DISPENSER));
@ -92,11 +90,4 @@ public class SchematicannonBlock extends InfoBlock {
} }
@Override
public ItemDescription getDescription() {
Palette color = Palette.Blue;
return new ItemDescription(color).withSummary("Prints a deployed " + h("Schematic", color)
+ " into the world using blocks from inventories placed right next to it.").createTabs();
}
} }

View file

@ -1,5 +1,7 @@
package com.simibubi.create.modules.schematics.block; package com.simibubi.create.modules.schematics.block;
import static net.minecraft.util.text.TextFormatting.GRAY;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
@ -13,6 +15,9 @@ import com.simibubi.create.foundation.gui.ScreenResources;
import com.simibubi.create.foundation.gui.widgets.IconButton; import com.simibubi.create.foundation.gui.widgets.IconButton;
import com.simibubi.create.foundation.gui.widgets.Indicator; import com.simibubi.create.foundation.gui.widgets.Indicator;
import com.simibubi.create.foundation.gui.widgets.Indicator.State; import com.simibubi.create.foundation.gui.widgets.Indicator.State;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.TooltipHelper;
import com.simibubi.create.modules.schematics.packet.ConfigureSchematicannonPacket; import com.simibubi.create.modules.schematics.packet.ConfigureSchematicannonPacket;
import com.simibubi.create.modules.schematics.packet.ConfigureSchematicannonPacket.Option; import com.simibubi.create.modules.schematics.packet.ConfigureSchematicannonPacket.Option;
@ -41,6 +46,16 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
protected IconButton resetButton; protected IconButton resetButton;
protected Indicator resetIndicator; protected Indicator resetIndicator;
private final String title = Lang.translate("gui.schematicannon.title");
private final String settingsTitle = Lang.translate("gui.schematicannon.settingsTitle");
private final String listPrinter = Lang.translate("gui.schematicannon.listPrinter");
private final String _gunpowderLevel = "gui.schematicannon.gunpowderLevel";
private final String _shotsRemaining = "gui.schematicannon.shotsRemaining";
private final String _shotsRemainingWithBackup = "gui.schematicannon.shotsRemainingWithBackup";
private final String optionEnabled = Lang.translate("gui.schematicannon.optionEnabled");
private final String optionDisabled = Lang.translate("gui.schematicannon.optionDisabled");
public SchematicannonScreen(SchematicannonContainer container, PlayerInventory inventory, public SchematicannonScreen(SchematicannonContainer container, PlayerInventory inventory,
ITextComponent p_i51105_3_) { ITextComponent p_i51105_3_) {
super(container, inventory, p_i51105_3_); super(container, inventory, p_i51105_3_);
@ -62,7 +77,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
pauseButton = new IconButton(x + 88, y + 55, ScreenResources.ICON_PAUSE); pauseButton = new IconButton(x + 88, y + 55, ScreenResources.ICON_PAUSE);
pauseIndicator = new Indicator(x + 88, y + 50, ""); pauseIndicator = new Indicator(x + 88, y + 50, "");
resetButton = new IconButton(x + 106, y + 55, ScreenResources.ICON_STOP); resetButton = new IconButton(x + 106, y + 55, ScreenResources.ICON_STOP);
resetIndicator = new Indicator(x + 106, y + 50, "Not Running"); resetIndicator = new Indicator(x + 106, y + 50, "");
resetIndicator.state = State.RED; resetIndicator.state = State.RED;
Collections.addAll(widgets, playButton, playIndicator, pauseButton, pauseIndicator, resetButton, Collections.addAll(widgets, playButton, playIndicator, pauseButton, pauseIndicator, resetButton,
resetIndicator); resetIndicator);
@ -73,8 +88,10 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
List<ScreenResources> icons = ImmutableList.of(ScreenResources.ICON_DONT_REPLACE, List<ScreenResources> icons = ImmutableList.of(ScreenResources.ICON_DONT_REPLACE,
ScreenResources.ICON_REPLACE_SOLID, ScreenResources.ICON_REPLACE_ANY, ScreenResources.ICON_REPLACE_SOLID, ScreenResources.ICON_REPLACE_ANY,
ScreenResources.ICON_REPLACE_EMPTY); ScreenResources.ICON_REPLACE_EMPTY);
List<String> toolTips = ImmutableList.of("Don't Replace Solid Blocks", "Replace Solid with Solid", List<String> toolTips = ImmutableList.of(Lang.translate("gui.schematicannon.option.dontReplaceSolid"),
"Replace Solid with Any", "Replace Solid with Empty"); 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++) { for (int i = 0; i < 4; i++) {
replaceLevelIndicators.add(new Indicator(x + 16 + i * 18, y + 96, "")); replaceLevelIndicators.add(new Indicator(x + 16 + i * 18, y + 96, ""));
@ -86,12 +103,12 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
// Other Settings // Other Settings
skipMissingButton = new IconButton(x + 106, y + 101, ScreenResources.ICON_SKIP_MISSING); skipMissingButton = new IconButton(x + 106, y + 101, ScreenResources.ICON_SKIP_MISSING);
skipMissingButton.setToolTip("Skip missing Blocks"); skipMissingButton.setToolTip(Lang.translate("gui.schematicannon.option.skipMissing"));
skipMissingIndicator = new Indicator(x + 106, y + 96, ""); skipMissingIndicator = new Indicator(x + 106, y + 96, "");
Collections.addAll(widgets, skipMissingButton, skipMissingIndicator); Collections.addAll(widgets, skipMissingButton, skipMissingIndicator);
skipTilesButton = new IconButton(x + 124, y + 101, ScreenResources.ICON_SKIP_TILES); skipTilesButton = new IconButton(x + 124, y + 101, ScreenResources.ICON_SKIP_TILES);
skipTilesButton.setToolTip("Protect Tile Entities"); skipTilesButton.setToolTip(Lang.translate("gui.schematicannon.option.skipTileEntities"));
skipTilesIndicator = new Indicator(x + 124, y + 96, ""); skipTilesIndicator = new Indicator(x + 124, y + 96, "");
Collections.addAll(widgets, skipTilesButton, skipTilesIndicator); Collections.addAll(widgets, skipTilesButton, skipTilesIndicator);
@ -143,72 +160,34 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
protected void handleTooltips() { protected void handleTooltips() {
for (Widget w : widgets) for (Widget w : widgets)
if (w instanceof IconButton) if (w instanceof IconButton) {
if (!((IconButton) w).getToolTip().isEmpty()) { IconButton button = (IconButton) w;
((IconButton) w).setToolTip(((IconButton) w).getToolTip().get(0)); if (!button.getToolTip().isEmpty()) {
((IconButton) w).getToolTip().add(TextFormatting.DARK_GRAY + "< Hold Shift >"); button.setToolTip(button.getToolTip().get(0));
button.getToolTip().add(TooltipHelper.holdShift(Palette.Blue, hasShiftDown()));
} }
}
if (hasShiftDown()) { if (hasShiftDown()) {
if (skipMissingButton.isHovered()) { fillToolTip(skipMissingButton, skipMissingIndicator, "skipMissing");
List<String> tip = skipMissingButton.getToolTip(); fillToolTip(skipTilesButton, skipTilesIndicator, "skipTileEntities");
tip.remove(1); fillToolTip(replaceLevelButtons.get(0), replaceLevelIndicators.get(0), "dontReplaceSolid");
tip.add(TextFormatting.BLUE fillToolTip(replaceLevelButtons.get(1), replaceLevelIndicators.get(1), "replaceWithSolid");
+ (skipMissingIndicator.state == State.ON ? "Currently Enabled" : "Currently Disabled")); fillToolTip(replaceLevelButtons.get(2), replaceLevelIndicators.get(2), "replaceWithAny");
tip.add(TextFormatting.GRAY + "If the Schematicannon cannot find"); fillToolTip(replaceLevelButtons.get(3), replaceLevelIndicators.get(3), "replaceWithEmpty");
tip.add(TextFormatting.GRAY + "a required Block for placement, it");
tip.add(TextFormatting.GRAY + "will continue at the next Location.");
}
if (skipTilesButton.isHovered()) {
List<String> 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<String> 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<String> 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<String> 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<String> 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.");
}
} }
} }
private void fillToolTip(IconButton button, Indicator indicator, String tooltipKey) {
if (!button.isHovered())
return;
boolean enabled = indicator.state == State.ON;
List<String> tip = button.getToolTip();
tip.add(TextFormatting.BLUE + (enabled ? optionEnabled : optionDisabled));
tip.addAll(TooltipHelper.cutString(Lang.translate("gui.schematicannon.option." + tooltipKey + ".description"),
GRAY, GRAY));
}
@Override @Override
protected void renderWindow(int mouseX, int mouseY, float partialTicks) { protected void renderWindow(int mouseX, int mouseY, float partialTicks) {
ScreenResources.PLAYER_INVENTORY.draw(this, guiLeft - 10, guiTop + 145); ScreenResources.PLAYER_INVENTORY.draw(this, guiLeft - 10, guiTop + 145);
@ -224,9 +203,9 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
renderCannon(); renderCannon();
font.drawString("Schematicannon", guiLeft + 80, guiTop + 10, ScreenResources.FONT_COLOR); font.drawString(title, guiLeft + 80, guiTop + 10, ScreenResources.FONT_COLOR);
String msg = te.statusMsg; String msg = Lang.translate("schematicannon.status." + te.statusMsg);
int stringWidth = font.getStringWidth(msg); int stringWidth = font.getStringWidth(msg);
if (te.missingBlock != null) { if (te.missingBlock != null) {
@ -237,8 +216,9 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
font.drawStringWithShadow(msg, guiLeft + 20 + 96 - stringWidth / 2, guiTop + 30, 0xCCDDFF); font.drawStringWithShadow(msg, guiLeft + 20 + 96 - stringWidth / 2, guiTop + 30, 0xCCDDFF);
font.drawString("Placement Settings", guiLeft + 20 + 13, guiTop + 84, ScreenResources.FONT_COLOR); font.drawString(settingsTitle, guiLeft + 20 + 13, guiTop + 84, ScreenResources.FONT_COLOR);
font.drawString("Inventory", guiLeft - 10 + 7, guiTop + 145 + 6, 0x666666); font.drawString(playerInventory.getDisplayName().getFormattedText(), guiLeft - 10 + 7, guiTop + 145 + 6,
0x666666);
} }
protected void renderCannon() { protected void renderCannon() {
@ -295,10 +275,9 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
int shotsLeft = (int) (te.fuelLevel / fuelUsageRate); int shotsLeft = (int) (te.fuelLevel / fuelUsageRate);
int shotsLeftWithItems = (int) (shotsLeft int shotsLeftWithItems = (int) (shotsLeft
+ te.inventory.getStackInSlot(4).getCount() * (te.getFuelAddedByGunPowder() / fuelUsageRate)); + te.inventory.getStackInSlot(4).getCount() * (te.getFuelAddedByGunPowder() / fuelUsageRate));
renderTooltip( renderTooltip(ImmutableList.of(Lang.translate(_gunpowderLevel, "" + (int) (te.fuelLevel * 100)),
ImmutableList.of("Gunpowder at " + (int) (te.fuelLevel * 100) + "%", GRAY + Lang.translate(_shotsRemaining, "" + TextFormatting.BLUE + shotsLeft),
TextFormatting.GRAY + "Shots left: " + TextFormatting.BLUE + shotsLeft, GRAY + Lang.translate(_shotsRemainingWithBackup, "" + TextFormatting.BLUE + shotsLeftWithItems)),
TextFormatting.GRAY + "With backup: " + TextFormatting.BLUE + shotsLeftWithItems),
mouseX, mouseY); mouseX, mouseY);
} }
@ -312,7 +291,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
int paperX = guiLeft + 20 + 202, paperY = guiTop + 20; int paperX = guiLeft + 20 + 202, paperY = guiTop + 20;
if (mouseX >= paperX && mouseY >= paperY && mouseX <= paperX + 16 && mouseY <= paperY + 16) { if (mouseX >= paperX && mouseY >= paperY && mouseX <= paperX + 16 && mouseY <= paperY + 16) {
renderTooltip("Material List Printer", mouseX, mouseY); renderTooltip(listPrinter, mouseX, mouseY);
} }
super.renderWindowForeground(mouseX, mouseY, partialTicks); super.renderWindowForeground(mouseX, mouseY, partialTicks);

View file

@ -181,7 +181,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
attachedInventories = new LinkedList<>(); attachedInventories = new LinkedList<>();
flyingBlocks = new LinkedList<>(); flyingBlocks = new LinkedList<>();
inventory = new SchematicannonInventory(); inventory = new SchematicannonInventory();
statusMsg = "Idle"; statusMsg = "idle";
state = State.STOPPED; state = State.STOPPED;
replaceMode = 2; replaceMode = 2;
neighbourCheckCooldown = NEIGHBOUR_CHECKING; neighbourCheckCooldown = NEIGHBOUR_CHECKING;
@ -392,7 +392,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
if (blueprint.isEmpty()) { if (blueprint.isEmpty()) {
state = State.STOPPED; state = State.STOPPED;
statusMsg = "Idle"; statusMsg = "idle";
sendUpdate = true; sendUpdate = true;
return; return;
} }
@ -416,7 +416,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
if (fuelLevel <= 0) { if (fuelLevel <= 0) {
fuelLevel = 0; fuelLevel = 0;
state = State.PAUSED; state = State.PAUSED;
statusMsg = "Out of Gunpowder"; statusMsg = "noGunpowder";
sendUpdate = true; sendUpdate = true;
return; return;
} }
@ -443,7 +443,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
// Check block // Check block
if (!getWorld().isAreaLoaded(target, 0)) { if (!getWorld().isAreaLoaded(target, 0)) {
blockNotLoaded = true; blockNotLoaded = true;
statusMsg = "Block is not loaded"; statusMsg = "targetNotLoaded";
state = State.PAUSED; state = State.PAUSED;
return; return;
} else { } else {
@ -455,7 +455,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
BlockState blockState = blockReader.getBlockState(target); BlockState blockState = blockReader.getBlockState(target);
if (!shouldPlace(target, blockState)) { if (!shouldPlace(target, blockState)) {
statusMsg = "Searching"; statusMsg = "searching";
blockSkipped = true; blockSkipped = true;
return; return;
} }
@ -469,7 +469,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
if (!findItemInAttachedInventories(requiredItem)) { if (!findItemInAttachedInventories(requiredItem)) {
if (skipMissing) { if (skipMissing) {
statusMsg = "Skipping"; statusMsg = "skipping";
blockSkipped = true; blockSkipped = true;
if (missingBlock != null) { if (missingBlock != null) {
missingBlock = null; missingBlock = null;
@ -480,16 +480,16 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
missingBlock = blockState; missingBlock = blockState;
state = State.PAUSED; state = State.PAUSED;
statusMsg = "Missing Block: "; statusMsg = "missingBlock";
return; return;
} }
// Success // Success
state = State.RUNNING; state = State.RUNNING;
if (blockState.getBlock() != Blocks.AIR) if (blockState.getBlock() != Blocks.AIR)
statusMsg = "Placing: " + blocksPlaced + " / " + blocksToPlace; statusMsg = "placing";
else else
statusMsg = "Clearing Blocks"; statusMsg = "clearing";
launchBlock(target, blockState); launchBlock(target, blockState);
printerCooldown = parameters.schematicannonDelay.get(); printerCooldown = parameters.schematicannonDelay.get();
fuelLevel -= getFuelUsageRate(); fuelLevel -= getFuelUsageRate();
@ -504,14 +504,14 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
protected void initializePrinter(ItemStack blueprint) { protected void initializePrinter(ItemStack blueprint) {
if (!blueprint.hasTag()) { if (!blueprint.hasTag()) {
state = State.STOPPED; state = State.STOPPED;
statusMsg = "Invalid Blueprint"; statusMsg = "schematicInvalid";
sendUpdate = true; sendUpdate = true;
return; return;
} }
if (!blueprint.getTag().getBoolean("Deployed")) { if (!blueprint.getTag().getBoolean("Deployed")) {
state = State.STOPPED; state = State.STOPPED;
statusMsg = "Blueprint not Deployed"; statusMsg = "schematicNotPlaced";
sendUpdate = true; sendUpdate = true;
return; return;
} }
@ -522,7 +522,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
if (activeTemplate.getSize().equals(BlockPos.ZERO)) { if (activeTemplate.getSize().equals(BlockPos.ZERO)) {
state = State.STOPPED; state = State.STOPPED;
statusMsg = "Schematic File Expired"; statusMsg = "schematicExpired";
inventory.setStackInSlot(0, ItemStack.EMPTY); inventory.setStackInSlot(0, ItemStack.EMPTY);
inventory.setStackInSlot(1, new ItemStack(AllItems.EMPTY_BLUEPRINT.get())); inventory.setStackInSlot(1, new ItemStack(AllItems.EMPTY_BLUEPRINT.get()));
return; return;
@ -530,7 +530,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
if (!anchor.withinDistance(getPos(), MAX_ANCHOR_DISTANCE)) { if (!anchor.withinDistance(getPos(), MAX_ANCHOR_DISTANCE)) {
state = State.STOPPED; state = State.STOPPED;
statusMsg = "Target too Far Away"; statusMsg = "targetOutsideRange";
return; return;
} }
@ -539,7 +539,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
activeTemplate.addBlocksToWorld(blockReader, schematicAnchor, SchematicItem.getSettings(blueprint)); activeTemplate.addBlocksToWorld(blockReader, schematicAnchor, SchematicItem.getSettings(blueprint));
schematicLoaded = true; schematicLoaded = true;
state = State.PAUSED; state = State.PAUSED;
statusMsg = "Ready"; statusMsg = "ready";
updateChecklist(); updateChecklist();
sendUpdate = true; sendUpdate = true;
blocksToPlace += blocksPlaced; blocksToPlace += blocksPlaced;
@ -603,7 +603,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
inventory.setStackInSlot(1, inventory.setStackInSlot(1,
new ItemStack(AllItems.EMPTY_BLUEPRINT.get(), inventory.getStackInSlot(1).getCount() + 1)); new ItemStack(AllItems.EMPTY_BLUEPRINT.get(), inventory.getStackInSlot(1).getCount() + 1));
state = State.STOPPED; state = State.STOPPED;
statusMsg = "Finished"; statusMsg = "finished";
resetPrinter(); resetPrinter();
target = getPos().add(1, 0, 0); target = getPos().add(1, 0, 0);
world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_NOTE_BLOCK_BELL, world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_NOTE_BLOCK_BELL,

View file

@ -15,6 +15,7 @@ import com.simibubi.create.AllSpecialTextures;
import com.simibubi.create.foundation.gui.ScreenOpener; import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.gui.TextInputPromptScreen; import com.simibubi.create.foundation.gui.TextInputPromptScreen;
import com.simibubi.create.foundation.utility.FilesHelper; 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;
import com.simibubi.create.foundation.utility.RaycastHelper.PredicateTraceResult; import com.simibubi.create.foundation.utility.RaycastHelper.PredicateTraceResult;
import com.simibubi.create.foundation.utility.TessellatorHelper; 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.RayTraceResult.Type;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i; 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; import net.minecraft.world.gen.feature.template.Template;
public class SchematicAndQuillHandler { public class SchematicAndQuillHandler {
@ -84,10 +83,8 @@ public class SchematicAndQuillHandler {
firstPos = new BlockPos(bb.minX, bb.minY, bb.minZ); firstPos = new BlockPos(bb.minX, bb.minY, bb.minZ);
secondPos = new BlockPos(bb.maxX, bb.maxY, bb.maxZ); secondPos = new BlockPos(bb.maxX, bb.maxY, bb.maxZ);
Minecraft.getInstance().player.sendStatusMessage( Lang.sendStatus(Minecraft.getInstance().player, "schematicAndQuill.dimensions", bb.getXSize(),
new StringTextComponent( bb.getYSize(), bb.getZSize());
"Schematic size: " + (bb.getXSize()) + "x" + (bb.getYSize()) + "x" + (bb.getZSize())),
true);
} }
return true; return true;
@ -104,33 +101,33 @@ public class SchematicAndQuillHandler {
if (player.isSneaking()) { if (player.isSneaking()) {
firstPos = null; firstPos = null;
secondPos = null; secondPos = null;
player.sendStatusMessage(new StringTextComponent("Removed selection."), true); Lang.sendStatus(player, "schematicAndQuill.abort");
return; return;
} }
if (secondPos != null) { if (secondPos != null) {
TextInputPromptScreen guiScreenIn = new TextInputPromptScreen(this::saveSchematic, s -> { TextInputPromptScreen guiScreenIn = new TextInputPromptScreen(this::saveSchematic, s -> {
}); });
guiScreenIn.setTitle("Enter a name for the Schematic:"); guiScreenIn.setTitle(Lang.translate("schematicAndQuill.prompt"));
guiScreenIn.setButtonTextConfirm("Save"); guiScreenIn.setButtonTextConfirm(Lang.translate("action.saveToFile"));
guiScreenIn.setButtonTextAbort("Cancel"); guiScreenIn.setButtonTextAbort(Lang.translate("action.discard"));
ScreenOpener.open(guiScreenIn); ScreenOpener.open(guiScreenIn);
return; return;
} }
if (selectedPos == null) { if (selectedPos == null) {
player.sendStatusMessage(new StringTextComponent("Hold [CTRL] to select Air blocks."), true); Lang.sendStatus(player, "schematicAndQuill.noTarget");
return; return;
} }
if (firstPos != null) { if (firstPos != null) {
secondPos = selectedPos; secondPos = selectedPos;
player.sendStatusMessage(new StringTextComponent(TextFormatting.GREEN + "Second position set."), true); Lang.sendStatus(player, "schematicAndQuill.secondPos");
return; return;
} }
firstPos = selectedPos; firstPos = selectedPos;
player.sendStatusMessage(new StringTextComponent(TextFormatting.GREEN + "First position set."), true); Lang.sendStatus(player, "schematicAndQuill.firstPos");
} }
public void saveSchematic(String string) { public void saveSchematic(String string) {
@ -140,7 +137,7 @@ public class SchematicAndQuillHandler {
new BlockPos(bb.getXSize(), bb.getYSize(), bb.getZSize()), false, Blocks.AIR); new BlockPos(bb.getXSize(), bb.getYSize(), bb.getZSize()), false, Blocks.AIR);
if (string.isEmpty()) if (string.isEmpty())
string = "My Schematic"; string = Lang.translate("schematicAndQuill.fallbackName");
String folderPath = "schematics"; String folderPath = "schematics";
FilesHelper.createFolderIfMissing(folderPath); FilesHelper.createFolderIfMissing(folderPath);
@ -160,7 +157,7 @@ public class SchematicAndQuillHandler {
} }
firstPos = null; firstPos = null;
secondPos = null; secondPos = null;
Minecraft.getInstance().player.sendStatusMessage(new StringTextComponent("Saved as " + filepath), true); Lang.sendStatus(Minecraft.getInstance().player, "schematicAndQuill.saved", filepath);
} }
public void render() { public void render() {

View file

@ -3,7 +3,6 @@ package com.simibubi.create.modules.schematics.client;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.CreateClient; 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.Label;
import com.simibubi.create.foundation.gui.widgets.ScrollInput; import com.simibubi.create.foundation.gui.widgets.ScrollInput;
import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput; 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.client.gui.widget.TextFieldWidget;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -25,9 +25,13 @@ public class SchematicEditScreen extends AbstractSimiScreen {
private TextFieldWidget yInput; private TextFieldWidget yInput;
private TextFieldWidget zInput; private TextFieldWidget zInput;
private static final List<String> rotationOptions = ImmutableList.of("None", "Clockwise 90", "Clockwise 180", private final List<String> rotationOptions = Lang.translatedOptions("schematic.rotation", "none", "cw90", "cw180",
"Clockwise 270"); "cw270");
private static final List<String> mirrorOptions = ImmutableList.of("None", "Left-Right", "Front-Back"); private final List<String> 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 rotationArea;
private ScrollInput mirrorArea; private ScrollInput mirrorArea;
@ -126,9 +130,9 @@ public class SchematicEditScreen extends AbstractSimiScreen {
font.drawStringWithShadow(handler.cachedSchematicName, font.drawStringWithShadow(handler.cachedSchematicName,
x + 103 - font.getStringWidth(handler.cachedSchematicName) / 2, y + 10, 0xDDEEFF); x + 103 - font.getStringWidth(handler.cachedSchematicName) / 2, y + 10, 0xDDEEFF);
font.drawString("Position", x + 10, y + 32, ScreenResources.FONT_COLOR); font.drawString(positionLabel, x + 10, y + 32, ScreenResources.FONT_COLOR);
font.drawString("Rotation", x + 10, y + 52, ScreenResources.FONT_COLOR); font.drawString(rotationLabel, x + 10, y + 52, ScreenResources.FONT_COLOR);
font.drawString("Mirror", x + 10, y + 72, ScreenResources.FONT_COLOR); font.drawString(mirrorLabel, x + 10, y + 72, ScreenResources.FONT_COLOR);
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.translated(guiLeft + 220, guiTop + 20, 0); GlStateManager.translated(guiLeft + 220, guiTop + 20, 0);

View file

@ -1,6 +1,8 @@
package com.simibubi.create.modules.schematics.client; package com.simibubi.create.modules.schematics.client;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.simibubi.create.AllItems; 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.gui.ToolSelectionScreen;
import com.simibubi.create.foundation.packet.NbtPacket; import com.simibubi.create.foundation.packet.NbtPacket;
import com.simibubi.create.foundation.type.Cuboid; 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.foundation.utility.TessellatorHelper;
import com.simibubi.create.modules.schematics.SchematicWorld; import com.simibubi.create.modules.schematics.SchematicWorld;
import com.simibubi.create.modules.schematics.client.tools.Tools; import com.simibubi.create.modules.schematics.client.tools.Tools;
@ -44,6 +47,9 @@ public class SchematicHandler {
public int slot; public int slot;
public ItemStack item; public ItemStack item;
private final List<String> mirrors = Arrays.asList("none", "leftRight", "frontBack");
private final List<String> rotations = Arrays.asList("none", "cw90", "cw180", "cw270");
public Tools currentTool; public Tools currentTool;
public ToolSelectionScreen selectionScreen; public ToolSelectionScreen selectionScreen;
@ -194,7 +200,7 @@ public class SchematicHandler {
} }
public void sync() { public void sync() {
Minecraft.getInstance().player.sendStatusMessage(new StringTextComponent("Syncing..."), true); message(Lang.translate("schematics.synchronizing"));
AllPackets.channel.sendToServer(new NbtPacket(item, slot)); AllPackets.channel.sendToServer(new NbtPacket(item, slot));
if (deployed) { if (deployed) {
@ -246,22 +252,23 @@ public class SchematicHandler {
if (m == Mirror.NONE) { if (m == Mirror.NONE) {
cachedSettings.setMirror(mirror); cachedSettings.setMirror(mirror);
anchor = anchor.add(anchorOffset); anchor = anchor.add(anchorOffset);
Minecraft.getInstance().player.sendStatusMessage( message(Lang.translate("schematic.mirror") + ": "
new StringTextComponent("Mirror: " + cachedSettings.getMirror().toString()), true); + Lang.translate("schematic.mirror." + mirrors.get(cachedSettings.getMirror().ordinal())));
} else if (m == mirror) { } else if (m == mirror) {
cachedSettings.setMirror(Mirror.NONE); cachedSettings.setMirror(Mirror.NONE);
anchor = anchor.subtract(anchorOffset); anchor = anchor.subtract(anchorOffset);
Minecraft.getInstance().player.sendStatusMessage( message(Lang.translate("schematic.mirror") + ": "
new StringTextComponent("Mirror: " + cachedSettings.getMirror().toString()), true); + Lang.translate("schematic.mirror." + mirrors.get(cachedSettings.getMirror().ordinal())));
} else if (m != mirror) { } else if (m != mirror) {
cachedSettings.setMirror(Mirror.NONE); cachedSettings.setMirror(Mirror.NONE);
anchor = anchor.add(anchorOffset); anchor = anchor.add(anchorOffset);
cachedSettings.setRotation(r.add(Rotation.CLOCKWISE_180)); cachedSettings.setRotation(r.add(Rotation.CLOCKWISE_180));
Minecraft.getInstance().player.sendStatusMessage( message(Lang.translate("schematic.mirror") + ": "
new StringTextComponent("Mirror: None, Rotation: " + cachedSettings.getRotation().toString()), + Lang.translate("schematic.mirror." + mirrors.get(cachedSettings.getMirror().ordinal())) + ", "
true); + Lang.translate("schematic.rotation") + ": "
+ Lang.translate("schematic.rotation." + rotations.get(cachedSettings.getRotation().ordinal())));
} }
item.getTag().put("Anchor", NBTUtil.writeBlockPos(anchor)); item.getTag().put("Anchor", NBTUtil.writeBlockPos(anchor));
@ -271,6 +278,10 @@ public class SchematicHandler {
markDirty(); markDirty();
} }
public void message(String msg) {
Minecraft.getInstance().player.sendStatusMessage(new StringTextComponent(msg), true);
}
public void rotate(Rotation rotation) { public void rotate(Rotation rotation) {
Rotation r = cachedSettings.getRotation(); Rotation r = cachedSettings.getRotation();
BlockPos center = centerOfSchematic(); BlockPos center = centerOfSchematic();
@ -282,8 +293,8 @@ public class SchematicHandler {
item.getTag().put("Anchor", NBTUtil.writeBlockPos(anchor)); item.getTag().put("Anchor", NBTUtil.writeBlockPos(anchor));
item.getTag().putString("Rotation", cachedSettings.getRotation().name()); item.getTag().putString("Rotation", cachedSettings.getRotation().name());
Minecraft.getInstance().player.sendStatusMessage( message(Lang.translate("schematic.rotation") + ": "
new StringTextComponent("Rotation: " + cachedSettings.getRotation().toString()), true); + Lang.translate("schematic.rotation." + rotations.get(cachedSettings.getRotation().ordinal())));
markDirty(); markDirty();
} }

View file

@ -4,51 +4,24 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.foundation.gui.ScreenResources; import com.simibubi.create.foundation.gui.ScreenResources;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.util.text.TextFormatting;
public enum Tools { public enum Tools {
Deploy(new DeployTool(), "Deploy", ScreenResources.ICON_TOOL_DEPLOY, ImmutableList.of( Deploy(new DeployTool(), ScreenResources.ICON_TOOL_DEPLOY),
"Moves the structure to a location.", Move(new MoveTool(), ScreenResources.ICON_TOOL_MOVE_XZ),
"Right-Click on the ground to place.", MoveY(new MoveVerticalTool(), ScreenResources.ICON_TOOL_MOVE_Y),
"Hold [Ctrl] to select at a fixed distance.", Rotate(new RotateTool(), ScreenResources.ICON_TOOL_ROTATE),
"[Ctrl]-Scroll to change the distance." Print(new PlaceTool(), ScreenResources.ICON_CONFIRM),
)), Flip(new FlipTool(), ScreenResources.ICON_TOOL_MIRROR);
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."
));
private ISchematicTool tool; private ISchematicTool tool;
private String displayName;
private ScreenResources icon; private ScreenResources icon;
private List<String> description;
private Tools(ISchematicTool tool, String name, ScreenResources icon, List<String> description) { private Tools(ISchematicTool tool, ScreenResources icon) {
this.tool = tool; this.tool = tool;
this.displayName = name;
this.icon = icon; this.icon = icon;
this.description = description;
} }
public ISchematicTool getTool() { public ISchematicTool getTool() {
@ -56,7 +29,7 @@ public enum Tools {
} }
public String getDisplayName() { public String getDisplayName() {
return displayName; return Lang.translate("schematic.tool." + name().toLowerCase());
} }
public ScreenResources getIcon() { public ScreenResources getIcon() {
@ -72,7 +45,7 @@ public enum Tools {
} }
public List<String> getDescription() { public List<String> getDescription() {
return description; return Lang.translatedOptions("schematic.tool." + name().toLowerCase() + ".description", "0", "1", "2", "3");
} }
} }

View file

@ -11,6 +11,7 @@ import org.apache.commons.io.IOUtils;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.AllKeys; import com.simibubi.create.AllKeys;
import com.simibubi.create.CreateConfig;
import com.simibubi.create.foundation.gui.ScreenOpener; import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.modules.schematics.client.SchematicEditScreen; import com.simibubi.create.modules.schematics.client.SchematicEditScreen;
@ -58,15 +59,17 @@ public class SchematicItem extends Item {
blueprint.setTag(tag); blueprint.setTag(tag);
writeSize(blueprint); writeSize(blueprint);
blueprint.setDisplayName(new StringTextComponent(TextFormatting.RESET + "" + TextFormatting.WHITE
+ "Schematic (" + TextFormatting.GOLD + schematic + TextFormatting.WHITE + ")"));
return blueprint; return blueprint;
} }
@Override @Override
@OnlyIn(value = Dist.CLIENT) @OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) { public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
if (stack.hasTag()) {
if (stack.getTag().contains("File"))
tooltip.add(new StringTextComponent(TextFormatting.GOLD + stack.getTag().getString("File")));
}
if (AllKeys.shiftDown()) { if (AllKeys.shiftDown()) {
TextFormatting gray = TextFormatting.GRAY; TextFormatting gray = TextFormatting.GRAY;
tooltip.add(new StringTextComponent(gray + "Holds a structure to be printed")); tooltip.add(new StringTextComponent(gray + "Holds a structure to be printed"));
@ -104,7 +107,7 @@ public class SchematicItem extends Item {
String filepath = ""; String filepath = "";
if (Thread.currentThread().getThreadGroup() == SidedThreadGroups.SERVER) if (Thread.currentThread().getThreadGroup() == SidedThreadGroups.SERVER)
filepath = "schematics/uploaded/" + owner + "/" + schematic; filepath = CreateConfig.parameters.schematicPath + "/" + owner + "/" + schematic;
else else
filepath = "schematics/" + schematic; filepath = "schematics/" + schematic;

View file

@ -73,15 +73,15 @@ public class ConfigureSchematicannonPacket extends SimplePacketBase {
case PLAY: case PLAY:
te.state = State.RUNNING; te.state = State.RUNNING;
te.statusMsg = "Running"; te.statusMsg = "running";
break; break;
case PAUSE: case PAUSE:
te.state = State.PAUSED; te.state = State.PAUSED;
te.statusMsg = "Paused"; te.statusMsg = "paused";
break; break;
case STOP: case STOP:
te.state = State.STOPPED; te.state = State.STOPPED;
te.statusMsg = "Stopped"; te.statusMsg = "stopped";
break; break;
default: default:
break; break;

View file

@ -1,4 +1,7 @@
{ {
"_comment": "-------------------------] GAME ELEMENTS [------------------------------------------------",
"item.create.symmetry_wand": "Staff of Symmetry", "item.create.symmetry_wand": "Staff of Symmetry",
"item.create.placement_handgun": "Handheld Blockzapper", "item.create.placement_handgun": "Handheld Blockzapper",
"item.create.tree_fertilizer": "Tree Fertilizer", "item.create.tree_fertilizer": "Tree Fertilizer",
@ -133,11 +136,276 @@
"block.create.cocoa_log": "Cocoa Jungle Log", "block.create.cocoa_log": "Cocoa Jungle Log",
"block.create.shop_shelf": "Shelf", "block.create.shop_shelf": "Shelf",
"_comment": "-------------------------] UI & MESSAGES [------------------------------------------------",
"death.attack.create.crush": "%1$s was processed by Crushing Wheels", "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_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.fan_lava": "%1$s was burned to death by lava fan",
"death.attack.create.drill": "%1$s was impaled by Mechanical Drill", "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" "itemGroup.create": "Create"
} }