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.belt.BeltBlock;
import com.simibubi.create.modules.contraptions.relays.belt.BeltSupportBlock;
import com.simibubi.create.modules.curiosities.symmetry.block.CrossPlaneSymmetryBlock;
import com.simibubi.create.modules.curiosities.symmetry.block.PlaneSymmetryBlock;
import com.simibubi.create.modules.curiosities.symmetry.block.TriplePlaneSymmetryBlock;
import com.simibubi.create.modules.gardens.CocoaLogBlock;
import com.simibubi.create.modules.logistics.block.BeltFunnelBlock;
import com.simibubi.create.modules.logistics.block.EntityDetectorBlock;
@ -45,9 +48,6 @@ import com.simibubi.create.modules.logistics.block.diodes.PulseRepeaterBlock;
import com.simibubi.create.modules.schematics.block.CreativeCrateBlock;
import com.simibubi.create.modules.schematics.block.SchematicTableBlock;
import com.simibubi.create.modules.schematics.block.SchematicannonBlock;
import com.simibubi.create.modules.symmetry.block.CrossPlaneSymmetryBlock;
import com.simibubi.create.modules.symmetry.block.PlaneSymmetryBlock;
import com.simibubi.create.modules.symmetry.block.TriplePlaneSymmetryBlock;
import net.minecraft.block.Block;
import net.minecraft.block.Block.Properties;

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

View file

@ -9,7 +9,7 @@ import net.minecraftforge.fml.client.registry.ClientRegistry;
public enum AllKeys {
TOOL_MENU("Tool Menu (Hold)", GLFW.GLFW_KEY_LEFT_ALT),
TOOL_MENU("toolmenu", GLFW.GLFW_KEY_LEFT_ALT),
ACTIVATE_TOOL("", GLFW.GLFW_KEY_LEFT_CONTROL),
;
@ -20,7 +20,7 @@ public enum AllKeys {
private boolean modifiable;
private AllKeys(String description, int defaultKey) {
this.description = description;
this.description = Create.ID + ".keyinfo." + description;
this.key = defaultKey;
this.modifiable = !description.isEmpty();
}

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

View file

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

View file

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

View file

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

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 com.simibubi.create.foundation.utility.Lang;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.gui.widget.button.Button;
public class TextInputPromptScreen extends AbstractSimiScreen {
private final String defaultConfirm = Lang.translate("action.confirm");
private final String defaultAbort = Lang.translate("action.abort");
private Consumer<String> callback;
private Consumer<String> abortCallback;
@ -27,8 +32,8 @@ public class TextInputPromptScreen extends AbstractSimiScreen {
this.callback = callBack;
this.abortCallback = abortCallback;
buttonTextConfirm = "Confirm";
buttonTextAbort = "Abort";
buttonTextConfirm = defaultConfirm;
buttonTextAbort = defaultAbort;
confirmed = false;
}

View file

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

View file

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

View file

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

View file

@ -9,11 +9,7 @@ import static com.simibubi.create.foundation.item.AllToolTypes.SWORD;
import java.util.Collections;
import java.util.List;
import com.simibubi.create.foundation.utility.ITooltip;
import com.simibubi.create.foundation.utility.TooltipHolder;
import net.minecraft.block.BlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.IItemTier;
import net.minecraft.item.ItemStack;
@ -22,7 +18,6 @@ import net.minecraft.item.Items;
import net.minecraft.item.ToolItem;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
@ -31,15 +26,13 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
@EventBusSubscriber
public abstract class AbstractToolItem extends ToolItem implements ITooltip {
public abstract class AbstractToolItem extends ToolItem {
protected TooltipHolder info;
protected AllToolTypes[] toolTypes;
public AbstractToolItem(float attackDamageIn, float attackSpeedIn, IItemTier tier, Properties builder,
AllToolTypes... types) {
super(attackDamageIn, attackSpeedIn, tier, Collections.emptySet(), setToolTypes(builder, tier, types));
info = new TooltipHolder(this);
toolTypes = types;
}
@ -62,12 +55,6 @@ public abstract class AbstractToolItem extends ToolItem implements ITooltip {
return false;
}
@Override
public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
info.addInformation(tooltip);
super.addInformation(stack, worldIn, tooltip, flagIn);
}
@Override
public ActionResultType onItemUse(ItemUseContext context) {
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;
import static com.simibubi.create.foundation.utility.TooltipHelper.cutString;
import static net.minecraft.util.text.TextFormatting.AQUA;
import static net.minecraft.util.text.TextFormatting.BLUE;
import static net.minecraft.util.text.TextFormatting.DARK_GRAY;
@ -26,13 +27,16 @@ import net.minecraft.util.text.TextFormatting;
public class ItemDescription {
public static final int maxCharsPerLine = 35;
public static final ItemDescription MISSING = new ItemDescription(null);
public static ITextComponent trim = new StringTextComponent(
WHITE + "" + STRIKETHROUGH + " ");
public enum Palette {
Blue(BLUE, AQUA), Green(DARK_GREEN, GREEN), Yellow(GOLD, YELLOW), Red(DARK_RED, RED),
Blue(BLUE, AQUA),
Green(DARK_GREEN, GREEN),
Yellow(GOLD, YELLOW),
Red(DARK_RED, RED),
Purple(DARK_PURPLE, LIGHT_PURPLE),
;
@ -56,24 +60,23 @@ public class ItemDescription {
lines = new ArrayList<>();
linesOnShift = new ArrayList<>();
linesOnCtrl = new ArrayList<>();
trim = new StringTextComponent(WHITE + "" + STRIKETHROUGH + " ");
}
public ItemDescription withSummary(String summary) {
add(linesOnShift, cutString(summary, palette.color));
linesOnShift.add(trim);
add(linesOnShift, cutString(summary, palette.color, palette.hColor));
add(linesOnShift, "");
return this;
}
public ItemDescription withBehaviour(String condition, String behaviour) {
add(linesOnShift, GRAY + condition);
add(linesOnShift, cutString(behaviour, palette.color, 1));
add(linesOnShift, cutString(behaviour, palette.color, palette.hColor, 1));
return this;
}
public ItemDescription withControl(String condition, String action) {
add(linesOnCtrl, GRAY + condition);
add(linesOnCtrl, cutString(action, palette.color, 1));
add(linesOnCtrl, cutString(action, palette.color, palette.hColor, 1));
return this;
}
@ -96,15 +99,15 @@ public class ItemDescription {
list.add(0, new StringTextComponent(tabs));
if (shift || ctrl)
list.add(1, trim);
list.add(1, new StringTextComponent(""));
}
}
if (!hasDescription)
linesOnShift = lines;
if (!hasControls)
linesOnCtrl = lines;
return this;
}
@ -112,42 +115,6 @@ public class ItemDescription {
return palette.hColor + s + palette.color;
}
public List<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) {
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;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.CreateConfig;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public interface IModule {
@ -26,6 +34,53 @@ public interface IModule {
return false;
}
}
public default Palette getToolTipColor() {
String module = getModuleName();
if (module.equals("materials"))
return Palette.Purple;
switch (module) {
case "contraptions":
return Palette.Red;
case "palettes":
return Palette.Yellow;
case "curiosities":
return Palette.Purple;
case "logistics":
return Palette.Yellow;
case "schematics":
return Palette.Blue;
case "gardens":
return Palette.Green;
default:
return Palette.Purple;
}
}
public static IModule of(ItemStack stack) {
Item item = stack.getItem();
if (item instanceof BlockItem)
return ofBlock(((BlockItem) item).getBlock());
return ofItem(item);
}
static IModule ofItem(Item item) {
for (AllItems allItems : AllItems.values()) {
if (allItems.get() == item)
return allItems.module;
}
return null;
}
static IModule ofBlock(Block block) {
for (AllBlocks allBlocks : AllBlocks.values()) {
if (allBlocks.get() == block)
return allBlocks.module;
}
return null;
}
public default boolean isEnabled() {
return isActive(getModuleName());

View file

@ -1,9 +1,9 @@
package com.simibubi.create.modules.contraptions.base;
import com.simibubi.create.foundation.block.InfoBlock;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.modules.contraptions.RotationPropagator;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.PushReaction;
import net.minecraft.tileentity.TileEntity;
@ -15,7 +15,7 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
public abstract class KineticBlock extends InfoBlock implements IRotate {
public abstract class KineticBlock extends Block implements IRotate {
protected static final Palette color = Palette.Red;

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.IWithTileEntity;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock;
import net.minecraft.block.BlockState;
@ -57,15 +57,6 @@ public class MotorBlock extends HorizontalKineticBlock
return true;
}
// IToolTip
@Override
public ItemDescription getDescription() {
return new ItemDescription(color).withSummary("Provides Rotational Power.")
.withControl("When R-Clicked", "Opens the " + h("Configuration Screen", color)).createTabs();
}
@Override
public int getCurrentValue(BlockState state, IWorld world, BlockPos pos) {
MotorTileEntity tileEntity = (MotorTileEntity) world.getTileEntity(pos);
@ -81,7 +72,7 @@ public class MotorBlock extends HorizontalKineticBlock
@Override
public String getValueName(BlockState state, IWorld world, BlockPos pos) {
return "Speed";
return Lang.translate("generic.speed");
}
@Override

View file

@ -1,7 +1,6 @@
package com.simibubi.create.modules.contraptions.generators;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock;
import net.minecraft.block.BlockState;
@ -132,10 +131,4 @@ public class WaterWheelBlock extends HorizontalKineticBlock {
return state.get(HORIZONTAL_FACING).getAxis();
}
@Override
public ItemDescription getDescription() {
return new ItemDescription(color).withSummary("Creates Rotational Power from " + h("Water streams", color) + " around it.")
.createTabs();
}
}

View file

@ -3,7 +3,6 @@ package com.simibubi.create.modules.contraptions.receivers;
import static com.simibubi.create.modules.contraptions.receivers.CrushingWheelControllerBlock.VALID;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
@ -167,14 +166,4 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock {
return false;
}
@Override
public ItemDescription getDescription() {
return new ItemDescription(color)
.withSummary("Using rotational force, two of these Wheels can grind up anything that falls into them.")
.withBehaviour("When next other Wheel",
"Grinds up Mobs, Players and Items into their components. Wheels have to rotate at exact "
+ h("Opposite Speeds", color) + ", dragging inputs into them from above.")
.createTabs();
}
}

View file

@ -2,7 +2,6 @@ package com.simibubi.create.modules.contraptions.receivers;
import java.util.List;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.DirectionalKineticBlock;
import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.receivers.constructs.IHaveMovementBehavior;
@ -168,14 +167,4 @@ public class DrillBlock extends DirectionalKineticBlock implements IHaveMovement
return false;
}
@Override
public ItemDescription getDescription() {
return new ItemDescription(color)
.withSummary("Using Rotational Force, this component can break blocks in front of it.")
.withBehaviour("When Rotated", h("Breaks blocks", color) + " right in front of it.")
.withBehaviour("When being pushed by Mechanical Piston",
h("Breaks the Blocks", color) + " it is being pushed into.")
.createTabs();
}
}

View file

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

View file

@ -3,10 +3,6 @@ package com.simibubi.create.modules.contraptions.receivers;
import java.util.List;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.utility.ITooltip;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.TooltipHolder;
import com.simibubi.create.modules.contraptions.receivers.constructs.IHaveMovementBehavior;
import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalPistonTileEntity;
@ -16,7 +12,6 @@ import net.minecraft.block.Blocks;
import net.minecraft.block.CropsBlock;
import net.minecraft.block.HorizontalBlock;
import net.minecraft.block.SugarCaneBlock;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
@ -31,24 +26,20 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.IPlantable;
public class HarvesterBlock extends HorizontalBlock implements IHaveMovementBehavior, ITooltip {
public class HarvesterBlock extends HorizontalBlock implements IHaveMovementBehavior {
public static final VoxelShape SHAPE_SOUTH = makeCuboidShape(0, 4, 0, 16, 12, 6),
SHAPE_NORTH = makeCuboidShape(0, 4, 10, 16, 12, 16), SHAPE_WEST = makeCuboidShape(10, 4, 0, 16, 12, 16),
SHAPE_EAST = makeCuboidShape(0, 4, 0, 6, 12, 16);
private TooltipHolder info;
public HarvesterBlock() {
super(Properties.from(Blocks.IRON_BLOCK));
info = new TooltipHolder(this);
}
@Override
@ -208,20 +199,4 @@ public class HarvesterBlock extends HorizontalBlock implements IHaveMovementBeha
return Blocks.AIR.getDefaultState();
}
@Override
public void addInformation(ItemStack stack, IBlockReader worldIn, List<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.foundation.block.IRenderUtilityBlock;
import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.VecHelper;
import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock;
import com.simibubi.create.modules.contraptions.relays.belt.AllBeltAttachments.BeltAttachmentState;
@ -48,12 +46,6 @@ public class MechanicalPressBlock extends HorizontalKineticBlock
return SHAPE;
}
@Override
public ItemDescription getDescription() {
Palette color = Palette.Red;
return new ItemDescription(color).withSummary("Applies pressure to items below it.").createTabs();
}
@Override
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) {

View file

@ -1,6 +1,5 @@
package com.simibubi.create.modules.contraptions.receivers;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.VecHelper;
import com.simibubi.create.modules.contraptions.base.KineticBlock;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
@ -106,10 +105,4 @@ public class TurntableBlock extends KineticBlock {
return false;
}
@Override
public ItemDescription getDescription() {
return new ItemDescription(color).withSummary("Turns rotational Force into raw Motion Sickness.")
.withBehaviour("When Rotated", "Rotates any Entities standing on top.").createTabs();
}
}

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

View file

@ -1,8 +1,6 @@
package com.simibubi.create.modules.contraptions.receivers.constructs;
import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.modules.contraptions.base.DirectionalKineticBlock;
import net.minecraft.block.Block;
@ -21,14 +19,6 @@ public class MechanicalBearingBlock extends DirectionalKineticBlock
super(Properties.from(Blocks.PISTON));
}
@Override
public ItemDescription getDescription() {
Palette color = Palette.Red;
return new ItemDescription(color)
.withSummary("Rotates attached structures around its axis. Can be used to generate rotational energy.")
.createTabs();
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new MechanicalBearingTileEntity();

View file

@ -2,7 +2,6 @@ package com.simibubi.create.modules.contraptions.receivers.constructs;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateConfig;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.KineticBlock;
import net.minecraft.block.Block;
@ -197,12 +196,4 @@ public class MechanicalPistonBlock extends KineticBlock {
return VoxelShapes.fullCube();
}
@Override
public ItemDescription getDescription() {
return new ItemDescription(color)
.withSummary("With " + h("Piston Poles", color) + " at the rear, will "
+ h("move Attached Structures", color) + " based on its input rotation speed.")
.withBehaviour("When Rotated", "Translates attached Structure accordingly.").createTabs();
}
}

View file

@ -36,19 +36,19 @@ public class MovingConstructHandler {
public void onLoadWorld(IWorld world) {
movingPistons.put(world, new ArrayList<>());
Create.logger.info("Prepared Construct List for " + world.getDimension().getType().getRegistryName());
Create.logger.debug("Prepared Construct List for " + world.getDimension().getType().getRegistryName());
}
public void onUnloadWorld(IWorld world) {
movingPistons.remove(world);
Create.logger.info("Removed Construct List for " + world.getDimension().getType().getRegistryName());
Create.logger.debug("Removed Construct List for " + world.getDimension().getType().getRegistryName());
}
public static void moveEntities(MechanicalPistonTileEntity te, float movementSpeed, Direction movementDirection,
float newOffset) {
if (TranslationConstruct.isFrozen())
return;
World world = te.getWorld();
Vec3d movementVec = new Vec3d(te.getBlockState().get(BlockStateProperties.FACING).getDirectionVec());
TranslationConstruct construct = te.movingConstruct;
@ -135,7 +135,6 @@ public class MovingConstructHandler {
}
}
if (!allowedMovement.equals(movement)) {
if (allowedMovement.y != movement.y) {
entity.fall(entity.fallDistance, 1);

View file

@ -1,22 +1,14 @@
package com.simibubi.create.modules.contraptions.receivers.constructs;
import java.util.List;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateConfig;
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import com.simibubi.create.foundation.utility.ITooltip;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.TooltipHolder;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalPistonBlock.PistonState;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
@ -25,27 +17,15 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class PistonPoleBlock extends ProperDirectionalBlock implements ITooltip {
public class PistonPoleBlock extends ProperDirectionalBlock {
private TooltipHolder info;
public PistonPoleBlock() {
super(Properties.from(Blocks.PISTON_HEAD));
setDefaultState(getDefaultState().with(FACING, Direction.UP));
info = new TooltipHolder(this);
}
@Override
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
info.addInformation(tooltip);
}
@Override
@ -112,12 +92,4 @@ public class PistonPoleBlock extends ProperDirectionalBlock implements ITooltip
return getDefaultState().with(FACING, context.getFace().getOpposite());
}
@Override
public ItemDescription getDescription() {
Palette color = Palette.Red;
return new ItemDescription(color).withSummary(
"Attach to the back of a " + h("Mechanical Piston", color) + " to increase its extension length.")
.createTabs();
}
}

View file

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

View file

@ -1,8 +1,5 @@
package com.simibubi.create.modules.contraptions.relays;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
@ -14,12 +11,4 @@ public class ClutchBlock extends GearshiftBlock {
return new ClutchTileEntity();
}
@Override
public ItemDescription getDescription() {
Palette color = Palette.Red;
return new ItemDescription(color).withSummary("A controllable rotation switch for connected shafts.")
.withBehaviour("When Powered", h("Stops", color) + " conveying rotation to the other side.")
.createTabs();
}
}

View file

@ -1,7 +1,6 @@
package com.simibubi.create.modules.contraptions.relays;
import com.google.common.base.Predicates;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
import net.minecraft.block.Block;
@ -104,13 +103,4 @@ public class EncasedBeltBlock extends RotatedPillarKineticBlock {
return true;
}
@Override
public ItemDescription getDescription() {
return new ItemDescription(color)
.withSummary("Relays rotation through its block and to an attached Encased Belt.")
.withBehaviour("When Attached to other Encased Belt",
"Attached Block will have the exact same rotation speed and direction. Attached Belts do not have to face the same way.")
.createTabs();
}
}

View file

@ -1,6 +1,5 @@
package com.simibubi.create.modules.contraptions.relays;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
import net.minecraft.block.BlockState;
@ -52,10 +51,4 @@ public class EncasedShaftBlock extends RotatedPillarKineticBlock {
return state.get(AXIS);
}
@Override
public ItemDescription getDescription() {
return new ItemDescription(color)
.withSummary("Relays a rotation through its block, similar to an exposed Axle.").createTabs();
}
}

View file

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

View file

@ -1,7 +1,5 @@
package com.simibubi.create.modules.contraptions.relays;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.modules.contraptions.RotationPropagator;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
@ -31,13 +29,6 @@ public class GearshiftBlock extends EncasedShaftBlock {
return new GearshiftTileEntity();
}
@Override
public ItemDescription getDescription() {
Palette color = Palette.Red;
return new ItemDescription(color).withSummary("A controllable rotation switch for connected shafts.")
.withBehaviour("When Powered", h("Reverses", color) + " the incoming rotation on the other side.").createTabs();
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(POWERED);

View file

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

View file

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

View file

@ -12,10 +12,10 @@ import com.simibubi.create.AllItems;
import com.simibubi.create.AllPackets;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.item.InfoItem;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -27,6 +27,7 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.fluid.IFluidState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
@ -62,19 +63,19 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.network.PacketDistributor;
public class BuilderGunItem extends InfoItem {
public class BuilderGunItem extends Item {
public static enum ComponentTier {
None(TextFormatting.DARK_GRAY + "Andesite Alloy"),
BlazeBrass(TextFormatting.GOLD + "Blaze Brass"),
ChorusChrome(TextFormatting.LIGHT_PURPLE + "Chorus Chrome"),
None(TextFormatting.DARK_GRAY),
BlazeBrass(TextFormatting.GOLD),
ChorusChrome(TextFormatting.LIGHT_PURPLE),
;
protected String displayName;
protected TextFormatting color;
private ComponentTier(String displayName) {
this.displayName = displayName;
private ComponentTier(TextFormatting color) {
this.color = color;
}
}
@ -91,36 +92,25 @@ public class BuilderGunItem extends InfoItem {
return UseAction.NONE;
}
@Override
public ItemDescription getDescription() {
Palette palette = Palette.Purple;
return new ItemDescription(palette).withSummary("Novel gadget for placing or exchanging blocks at a distance.")
.withControl("L-Click at Block", "Sets blocks placed by the tool to the targeted block.")
.withControl("R-Click at Block",
h("Places", palette) + " or " + h("Replaces", palette) + " the targeted block.")
.withControl("R-Click while Sneaking", "Opens the " + h("Configuration", palette) + " Interface")
.createTabs();
}
@Override
@OnlyIn(Dist.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
if (stack.hasTag() && stack.getTag().contains("BlockUsed")) {
String usedblock = NBTUtil.readBlockState(stack.getTag().getCompound("BlockUsed")).getBlock()
.getTranslationKey();
ItemDescription.add(tooltip, TextFormatting.DARK_GRAY + "Using: " + TextFormatting.GRAY
+ new TranslationTextComponent(usedblock).getFormattedText());
ItemDescription.add(tooltip, TextFormatting.DARK_GRAY + Lang.translate("blockzapper.usingBlock",
TextFormatting.GRAY + new TranslationTextComponent(usedblock).getFormattedText()));
}
super.addInformation(stack, worldIn, tooltip, flagIn);
Palette palette = Palette.Purple;
if (Screen.hasShiftDown()) {
ItemDescription.add(tooltip, palette.color + "Component Tiers:");
ItemDescription.add(tooltip, palette.color + Lang.translate("blockzapper.componentUpgrades"));
for (Components c : Components.values()) {
ComponentTier tier = getTier(c, stack);
ItemDescription.add(tooltip, "> " + TextFormatting.GRAY + c.name() + ": " + tier.displayName);
ItemDescription.add(tooltip,
"> " + TextFormatting.GRAY + Lang.translate("blockzapper.component." + c.name().toLowerCase())
+ ": " + tier.color
+ Lang.translate("blockzapper.componentTier." + tier.name().toLowerCase()));
}
}
}
@ -198,8 +188,8 @@ public class BuilderGunItem extends InfoItem {
else {
world.playSound(player, player.getPosition(), SoundEvents.BLOCK_NOTE_BLOCK_BASS, SoundCategory.BLOCKS, 1f,
0.5f);
player.sendStatusMessage(new StringTextComponent(TextFormatting.RED + "Left-Click a Block to set Material"),
true);
player.sendStatusMessage(
new StringTextComponent(TextFormatting.RED + Lang.translate("blockzapper.leftClickToSet")), true);
return new ActionResult<ItemStack>(ActionResultType.FAIL, item);
}
@ -224,26 +214,8 @@ public class BuilderGunItem extends InfoItem {
-0.1f, 1);
Vec3d barrelPos = start.add(barrelPosNoTransform.rotatePitch(pitch).rotateYaw(yaw));
// Client side - Shoot visual laser
// Client side
if (world.isRemote) {
// BuilderGunHandler.addBeam(new LaserBeam(barrelPos, raytrace.getHitVec()));
//
// if (getTier(Components.Amplifier, item) == ComponentTier.BlazeBrass) {
// BuilderGunHandler.addBeam(new LaserBeam(
// start.add(barrelPosNoTransform.add(-.09f, -.08f, 0).rotatePitch(pitch).rotateYaw(yaw)),
// raytrace.getHitVec()));
// }
// if (getTier(Components.Amplifier, item) == ComponentTier.ChorusChrome) {
// BuilderGunHandler.addBeam(new LaserBeam(
// start.add(barrelPosNoTransform.add(-.09f, -.08f, 0).rotatePitch(pitch).rotateYaw(yaw)),
// raytrace.getHitVec()));
// BuilderGunHandler.addBeam(new LaserBeam(
// start.add(barrelPosNoTransform.add(.09f, -.08f, 0).rotatePitch(pitch).rotateYaw(yaw)),
// raytrace.getHitVec()));
// }
//
// BuilderGunHandler.shoot(hand);
// applyCooldown(player, item, gunInOtherHand);
BuilderGunHandler.dontAnimateItem(hand);
return new ActionResult<ItemStack>(ActionResultType.SUCCESS, item);
}
@ -263,7 +235,8 @@ public class BuilderGunItem extends InfoItem {
continue;
if (!player.isCreative() && BlockHelper.findAndRemoveInInventory(stateToUse, player, 1) == 0) {
player.getCooldownTracker().setCooldown(item.getItem(), 20);
player.sendStatusMessage(new StringTextComponent(TextFormatting.RED + "Out of Blocks!"), true);
player.sendStatusMessage(
new StringTextComponent(TextFormatting.RED + Lang.translate("blockzapper.empty")), true);
return new ActionResult<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.ScrollInput;
import com.simibubi.create.foundation.packet.NbtPacket;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
@ -39,6 +40,9 @@ public class BuilderGunScreen extends AbstractSimiScreen {
private boolean offhand;
private float animationProgress;
private final String title = Lang.translate("gui.blockzapper.title");
private final String patternSection = Lang.translate("gui.blockzapper.patternSection");
private IconButton replaceModeButton;
private Indicator replaceModeIndicator;
private IconButton spreadDiagonallyButton;
@ -72,24 +76,23 @@ public class BuilderGunScreen extends AbstractSimiScreen {
replaceModeButton = new IconButton(i + 51, j + 41, ScreenResources.ICON_REPLACE_SOLID);
if (nbt.contains("Replace") && nbt.getBoolean("Replace"))
replaceModeIndicator.state = State.ON;
replaceModeButton.setToolTip("Replace Mode");
replaceModeButton.setToolTip(Lang.translate("gui.blockzapper.replaceMode"));
spreadDiagonallyIndicator = new Indicator(i + 74, j + 36, "");
spreadDiagonallyButton = new IconButton(i + 74, j + 41, ScreenResources.ICON_FOLLOW_DIAGONAL);
if (nbt.contains("SearchDiagonal") && nbt.getBoolean("SearchDiagonal"))
spreadDiagonallyIndicator.state = State.ON;
spreadDiagonallyButton.setToolTip("Follow Diagonals");
spreadDiagonallyButton.setToolTip(Lang.translate("gui.blockzapper.searchDiagonal"));
spreadMaterialIndicator = new Indicator(i + 92, j + 36, "");
spreadMaterialButton = new IconButton(i + 92, j + 41, ScreenResources.ICON_FOLLOW_MATERIAL);
if (nbt.contains("SearchFuzzy") && nbt.getBoolean("SearchFuzzy"))
spreadMaterialIndicator.state = State.ON;
spreadMaterialButton.setToolTip("Ignore Material Borders");
spreadMaterialButton.setToolTip(Lang.translate("gui.blockzapper.searchFuzzy"));
spreadRangeLabel = new Label(i + 119, j + 46, "").withShadow().withSuffix("m");
spreadRangeInput = new ScrollInput(i + 115, j + 43, 22, 14)
.withRange(1, BuilderGunItem.getMaxAoe(item)).setState(1)
.titled("Spread Range").writingTo(spreadRangeLabel);
spreadRangeInput = new ScrollInput(i + 115, j + 43, 22, 14).withRange(1, BuilderGunItem.getMaxAoe(item))
.setState(1).titled(Lang.translate("gui.blockzapper.range")).writingTo(spreadRangeLabel);
if (nbt.contains("SearchDistance"))
spreadRangeInput.setState(nbt.getInt("SearchDistance"));
@ -104,7 +107,7 @@ public class BuilderGunScreen extends AbstractSimiScreen {
int id = patternButtons.size();
PlacementPatterns pattern = PlacementPatterns.values()[id];
patternButtons.add(new IconButton(i + 147 + col * 18, j + 23 + row * 18, pattern.icon));
patternButtons.get(id).setToolTip(pattern.displayName);
patternButtons.get(id).setToolTip(Lang.translate("gui.blockzapper.pattern." + pattern.translationKey));
}
}
@ -173,8 +176,8 @@ public class BuilderGunScreen extends AbstractSimiScreen {
int j = guiTop;
ScreenResources.PLACEMENT_GUN.draw(this, i, j);
font.drawStringWithShadow("Handheld Blockzapper", i + 8, j + 10, 0xCCDDFF);
font.drawString("Patterns", i + 148, j + 11, ScreenResources.FONT_COLOR);
font.drawStringWithShadow(title, i + 8, j + 10, 0xCCDDFF);
font.drawString(patternSection, i + 148, j + 11, ScreenResources.FONT_COLOR);
minecraft.getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
GlStateManager.enableBlend();

View file

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

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.List;

View file

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

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

View file

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

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.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.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;

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;

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.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;

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.List;
@ -6,7 +6,8 @@ import java.util.Map;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.modules.symmetry.block.CrossPlaneSymmetryBlock;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.curiosities.symmetry.block.CrossPlaneSymmetryBlock;
import net.minecraft.block.BlockState;
import net.minecraft.util.IStringSerializable;
@ -90,7 +91,7 @@ public class CrossPlaneMirror extends SymmetryMirror {
@Override
public List<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.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.List;
@ -6,7 +6,8 @@ import java.util.Map;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.modules.symmetry.block.PlaneSymmetryBlock;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.curiosities.symmetry.block.PlaneSymmetryBlock;
import net.minecraft.block.BlockState;
import net.minecraft.util.IStringSerializable;
@ -85,7 +86,7 @@ public class PlaneMirror extends SymmetryMirror {
@Override
public List<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.List;
import java.util.Map;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundNBT;
@ -27,8 +28,6 @@ public abstract class SymmetryMirror {
public static final String CROSS_PLANE = "cross_plane";
public static final String TRIPLE_PLANE = "triple_plane";
public static final List<String> TOOLTIP_ELEMENTS = ImmutableList.of("Mirror once", "Rectanglar", "Octagonal");
protected Vec3d position;
protected IStringSerializable orientation;
protected int orientationIndex;
@ -40,6 +39,11 @@ public abstract class SymmetryMirror {
orientationIndex = 0;
}
public static List<String> getMirrors() {
return ImmutableList.of(Lang.translate("symmetry.mirror.plane"), Lang.translate("symmetry.mirror.doublePlane"),
Lang.translate("symmetry.mirror.triplePlane"));
}
public IStringSerializable getOrientation() {
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.List;
@ -6,6 +6,7 @@ import java.util.Map;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.BlockState;
import net.minecraft.util.IStringSerializable;
@ -60,7 +61,7 @@ public class TriplePlaneMirror extends SymmetryMirror {
@Override
public List<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.AllToolTypes;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.ItemHelper;
import com.simibubi.create.foundation.utility.VecHelper;
@ -24,7 +22,6 @@ import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
@ -94,14 +91,4 @@ public class BlazingToolItem extends AbstractToolItem {
drops.addAll(smeltedStacks);
}
@Override
public ItemDescription getDescription() {
Palette color = Palette.Purple;
return new ItemDescription(color).withSummary("A tool forged from fiery Blaze Brass.")
.withBehaviour("When in Nether", "Using the tool will not affect durability.")
.withBehaviour("Outside of Nether, When [Forge#5828] Fixed",
TextFormatting.STRIKETHROUGH + "Tool smelts drops of broken blocks")
.createTabs();
}
}

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.AllToolTypes;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
public class RoseQuartzToolItem extends AbstractToolItem {
@ -11,12 +9,4 @@ public class RoseQuartzToolItem extends AbstractToolItem {
super(attackDamageIn, attackSpeedIn, AllToolTiers.ROSE_QUARTZ, builder, types);
}
@Override
public ItemDescription getDescription() {
Palette color = Palette.Purple;
return new ItemDescription(color).withSummary(
"A Tool of finest craftmansship with sturdy materials and detailed decoration. The extended handle allows, at a slight cost of speed, for a "
+ h("greater reach distance", color) + ".");
}
}

View file

@ -4,13 +4,10 @@ import java.util.List;
import com.simibubi.create.foundation.item.AbstractToolItem;
import com.simibubi.create.foundation.item.AllToolTypes;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IWorld;
public class ShadowSteelToolItem extends AbstractToolItem {
@ -20,16 +17,6 @@ public class ShadowSteelToolItem extends AbstractToolItem {
super(attackDamageIn, attackSpeedIn, AllToolTiers.SHADOW_STEEL, builder, types);
}
@Override
public ItemDescription getDescription() {
Palette color = Palette.Purple;
return new ItemDescription(color)
.withSummary("The fast moving shadow material allows for quick riddance of blocks and entities.")
.withBehaviour("When [Forge#5828] Fixed",
TextFormatting.STRIKETHROUGH + "Broken blocks do not drop any items.")
.createTabs();
}
@Override
public void modifyDrops(List<ItemStack> drops, IWorld world, BlockPos pos, ItemStack tool, BlockState state) {
drops.clear();

View file

@ -2,9 +2,6 @@ package com.simibubi.create.modules.gardens;
import java.util.Random;
import com.simibubi.create.foundation.item.InfoItem;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.PlacementSimulationWorld;
import net.minecraft.block.Block;
@ -12,24 +9,18 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.SaplingBlock;
import net.minecraft.item.BoneMealItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemUseContext;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class TreeFertilizerItem extends InfoItem {
public class TreeFertilizerItem extends Item {
public TreeFertilizerItem(Properties properties) {
super(properties);
}
@Override
public ItemDescription getDescription() {
return new ItemDescription(Palette.Green)
.withSummary("A powerful combination of minerals suitable for common tree types.")
.withBehaviour("When used on Sapling", "Grows Trees regardless of their spacing Conditions").createTabs();
}
@Override
public ActionResultType onItemUse(ItemUseContext context) {
BlockState state = context.getWorld().getBlockState(context.getPos());

View file

@ -50,12 +50,12 @@ public class FrequencyHandler {
public void onLoadWorld(IWorld world) {
connections.put(world, new HashMap<>());
Create.logger.info("Prepared Network Space for " + world.getDimension().getType().getRegistryName());
Create.logger.debug("Prepared Network Space for " + world.getDimension().getType().getRegistryName());
}
public void onUnloadWorld(IWorld world) {
connections.remove(world);
Create.logger.info("Removed Network Space for " + world.getDimension().getType().getRegistryName());
Create.logger.debug("Removed Network Space for " + world.getDimension().getType().getRegistryName());
}
private static Pair<Frequency, Frequency> getNetworkKey(IHaveWireless actor) {

View file

@ -1,9 +1,6 @@
package com.simibubi.create.modules.logistics.block;
import com.simibubi.create.foundation.block.InfoBlock;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity;
@ -19,7 +16,7 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.NetworkHooks;
public class FlexcrateBlock extends InfoBlock {
public class FlexcrateBlock extends Block {
public static final VoxelShape SHAPE = makeCuboidShape(1, 0, 1, 15, 14, 15);
@ -56,15 +53,6 @@ public class FlexcrateBlock extends InfoBlock {
return new FlexcrateTileEntity();
}
@Override
public ItemDescription getDescription() {
Palette color = Palette.Yellow;
return new ItemDescription(color)
.withSummary("This Storage Container allows Manual control over its capacity. It can hold up to "
+ h("16 Stacks", color) + " of Items.")
.createTabs();
}
@Override
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
if (worldIn.getTileEntity(pos) == null)

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.widgets.Label;
import com.simibubi.create.foundation.gui.widgets.ScrollInput;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.logistics.packet.ConfigureFlexcratePacket;
import net.minecraft.block.BlockState;
@ -24,6 +25,9 @@ public class FlexcrateScreen extends AbstractSimiContainerScreen<FlexcrateContai
private ScrollInput allowedItems;
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) {
super(container, inv, title);
te = container.te;
@ -37,8 +41,8 @@ public class FlexcrateScreen extends AbstractSimiContainerScreen<FlexcrateContai
widgets.clear();
allowedItemsLabel = new Label(guiLeft + 100 + 70, guiTop + 107, "").colored(0xD3CBBE).withShadow();
allowedItems = new ScrollInput(guiLeft + 100 + 65, guiTop + 104, 41, 14).titled("Storage Space")
.withRange(1, 1025).writingTo(allowedItemsLabel).withShiftStep(64).setState(te.allowedAmount)
allowedItems = new ScrollInput(guiLeft + 100 + 65, guiTop + 104, 41, 14).titled(storageSpace).withRange(1, 1025)
.writingTo(allowedItemsLabel).withShiftStep(64).setState(te.allowedAmount)
.calling(s -> lastModification = 0);
allowedItems.onChanged();
widgets.add(allowedItemsLabel);
@ -55,13 +59,13 @@ public class FlexcrateScreen extends AbstractSimiContainerScreen<FlexcrateContai
int fontColor = 0x4B3A22;
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);
String itemCount = "" + te.itemCount;
font.drawString(itemCount, crateLeft + 53 - font.getStringWidth(itemCount), crateTop + 107, fontColor);
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++) {
if (allowedItems.getState() > slot * 64)

View file

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

View file

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

View file

@ -6,19 +6,13 @@ import java.util.List;
import org.apache.commons.lang3.tuple.Pair;
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import com.simibubi.create.foundation.utility.ITooltip;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.TooltipHolder;
import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.state.properties.BlockStateProperties;
@ -33,14 +27,11 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class RedstoneBridgeBlock extends ProperDirectionalBlock implements ITooltip, IBlockWithFrequency {
public class RedstoneBridgeBlock extends ProperDirectionalBlock implements IBlockWithFrequency {
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
public static final BooleanProperty RECEIVER = BooleanProperty.create("receiver");
@ -53,11 +44,8 @@ public class RedstoneBridgeBlock extends ProperDirectionalBlock implements ITool
NORTH_SHAPE = makeCuboidShape(3, 1, 13, 13, 15, 17), EAST_SHAPE = makeCuboidShape(-1, 1, 3, 3, 15, 13),
WEST_SHAPE = makeCuboidShape(13, 1, 3, 17, 15, 13);
private TooltipHolder info;
public RedstoneBridgeBlock() {
super(Properties.from(Blocks.DARK_OAK_LOG));
info = new TooltipHolder(this);
cacheItemPositions();
setDefaultState(getDefaultState().with(POWERED, false).with(RECEIVER, false));
}
@ -251,29 +239,4 @@ public class RedstoneBridgeBlock extends ProperDirectionalBlock implements ITool
return state.get(FACING);
}
@Override
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, IBlockReader worldIn, List<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;
import java.util.List;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.utility.ITooltip;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.TooltipHolder;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.HorizontalBlock;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.IntegerProperty;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.tileentity.TileEntity;
@ -23,7 +15,6 @@ import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
@ -31,14 +22,12 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor;
public class StockswitchBlock extends HorizontalBlock implements ITooltip {
public class StockswitchBlock extends HorizontalBlock {
public static final IntegerProperty INDICATOR = IntegerProperty.create("indicator", 0, 6);
private TooltipHolder info;
public StockswitchBlock() {
super(Properties.from(Blocks.ANDESITE));
info = new TooltipHolder(this);
}
@Override
@ -87,12 +76,6 @@ public class StockswitchBlock extends HorizontalBlock implements ITooltip {
return te == null || !te.powered ? 0 : 15 ;
}
@Override
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
info.addInformation(tooltip);
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(HORIZONTAL_FACING, INDICATOR);
@ -136,16 +119,4 @@ public class StockswitchBlock extends HorizontalBlock implements ITooltip {
return new StockswitchTileEntity();
}
@Override
public ItemDescription getDescription() {
Palette color = Palette.Yellow;
return new ItemDescription(color)
.withSummary("Toggles a Redstone signal based on the " + h("Storage Space", color)
+ " in the attached Container.")
.withBehaviour("When below Lower Limit", "Stops providing " + h("Redstone Power", color))
.withBehaviour("When above Upper Limit",
"Starts providing " + h("Redstone Power", color) + " until Lower Limit is reached again.")
.withControl("When R-Clicked", "Opens the " + h("Configuration Screen", color)).createTabs();
}
}

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

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

View file

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

View file

@ -1,13 +1,10 @@
package com.simibubi.create.modules.logistics.item;
import com.simibubi.create.foundation.item.InfoItem;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class FilterItem extends InfoItem {
public class FilterItem extends Item {
public static class Color implements IItemColor {
@Override
@ -26,13 +23,4 @@ public class FilterItem extends InfoItem {
super(properties);
}
@Override
public ItemDescription getDescription() {
Palette color = Palette.Yellow;
return new ItemDescription(color)
.withSummary("Holds information for controlling input, output and detection of objects.")
.withControl("R-Click while Sneaking", "Opens the " + h("Configuration Screen", color))
.withControl("When Entity punched", "Creates a filter with the target set to the Entity.").createTabs();
}
}

View file

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

View file

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

View file

@ -1,9 +1,6 @@
package com.simibubi.create.modules.schematics.block;
import com.simibubi.create.foundation.block.InfoBlock;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.util.math.BlockPos;
@ -11,7 +8,7 @@ import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
public class CreativeCrateBlock extends InfoBlock {
public class CreativeCrateBlock extends Block {
protected static final VoxelShape shape = makeCuboidShape(1, 0, 1, 15, 14, 15);
@ -35,12 +32,4 @@ public class CreativeCrateBlock extends InfoBlock {
return shape;
}
@Override
public ItemDescription getDescription() {
Palette blue = Palette.Blue;
return new ItemDescription(blue)
.withSummary("Grants an attached " + h("Schematicannon", blue) + " unlimited access to blocks.")
.createTabs();
}
}

View file

@ -1,41 +1,26 @@
package com.simibubi.create.modules.schematics.block;
import java.util.List;
import com.simibubi.create.foundation.utility.ITooltip;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.TooltipHolder;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.HorizontalBlock;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.network.NetworkHooks;
public class SchematicTableBlock extends HorizontalBlock implements ITooltip {
private TooltipHolder info;
public class SchematicTableBlock extends HorizontalBlock {
public SchematicTableBlock() {
super(Properties.from(Blocks.OAK_PLANKS));
info = new TooltipHolder(this);
}
@Override
@ -49,13 +34,6 @@ public class SchematicTableBlock extends HorizontalBlock implements ITooltip {
return false;
}
@Override
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
info.addInformation(tooltip);
}
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
return this.getDefaultState().with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite());
@ -102,12 +80,4 @@ public class SchematicTableBlock extends HorizontalBlock implements ITooltip {
}
@Override
public ItemDescription getDescription() {
Palette color = Palette.Blue;
return new ItemDescription(color).withSummary("Writes saved Schematics onto an " + h("Empty Schematic", color))
.withBehaviour("When given an Empty Schematic", "Uploads the chosen File from your Schematics Folder")
.createTabs();
}
}

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.ScrollInput;
import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.schematics.ClientSchematicLoader;
import net.minecraft.client.Minecraft;
@ -35,6 +36,12 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
private IconButton refreshButton;
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 chasingProgress;
private float lastChasingProgress;
@ -60,7 +67,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
schematicsLabel.text = "";
if (!availableSchematics.isEmpty()) {
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(schematicsLabel);
}
@ -89,18 +96,18 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
int mainTop = guiTop - 16;
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);
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())
font.drawString("Upload Finished!", mainLeft + 60, mainTop + 10, ScreenResources.FONT_COLOR);
font.drawString(finished, mainLeft + 60, mainTop + 10, ScreenResources.FONT_COLOR);
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) {
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);
@ -174,7 +181,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
@Override
public boolean mouseClicked(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_) {
ClientSchematicLoader schematicSender = CreateClient.schematicSender;
if (confirmButton.active && confirmButton.isHovered() && ((SchematicTableContainer) container).canWrite()
&& schematicsArea != null) {
@ -195,7 +202,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
if (!availableSchematics.isEmpty()) {
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);
} else {
schematicsArea = null;

View file

@ -1,10 +1,8 @@
package com.simibubi.create.modules.schematics.block;
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.Blocks;
import net.minecraft.entity.player.PlayerEntity;
@ -22,7 +20,7 @@ import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.NetworkHooks;
public class SchematicannonBlock extends InfoBlock {
public class SchematicannonBlock extends Block {
public SchematicannonBlock() {
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;
import static net.minecraft.util.text.TextFormatting.GRAY;
import java.util.Collections;
import java.util.List;
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.Indicator;
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.Option;
@ -41,6 +46,16 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
protected IconButton resetButton;
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,
ITextComponent 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);
pauseIndicator = new Indicator(x + 88, y + 50, "");
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;
Collections.addAll(widgets, playButton, playIndicator, pauseButton, pauseIndicator, resetButton,
resetIndicator);
@ -73,8 +88,10 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
List<ScreenResources> icons = ImmutableList.of(ScreenResources.ICON_DONT_REPLACE,
ScreenResources.ICON_REPLACE_SOLID, ScreenResources.ICON_REPLACE_ANY,
ScreenResources.ICON_REPLACE_EMPTY);
List<String> toolTips = ImmutableList.of("Don't Replace Solid Blocks", "Replace Solid with Solid",
"Replace Solid with Any", "Replace Solid with Empty");
List<String> toolTips = ImmutableList.of(Lang.translate("gui.schematicannon.option.dontReplaceSolid"),
Lang.translate("gui.schematicannon.option.replaceWithSolid"),
Lang.translate("gui.schematicannon.option.replaceWithAny"),
Lang.translate("gui.schematicannon.option.replaceWithEmpty"));
for (int i = 0; i < 4; i++) {
replaceLevelIndicators.add(new Indicator(x + 16 + i * 18, y + 96, ""));
@ -86,12 +103,12 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
// Other Settings
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, "");
Collections.addAll(widgets, skipMissingButton, skipMissingIndicator);
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, "");
Collections.addAll(widgets, skipTilesButton, skipTilesIndicator);
@ -143,72 +160,34 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
protected void handleTooltips() {
for (Widget w : widgets)
if (w instanceof IconButton)
if (!((IconButton) w).getToolTip().isEmpty()) {
((IconButton) w).setToolTip(((IconButton) w).getToolTip().get(0));
((IconButton) w).getToolTip().add(TextFormatting.DARK_GRAY + "< Hold Shift >");
if (w instanceof IconButton) {
IconButton button = (IconButton) w;
if (!button.getToolTip().isEmpty()) {
button.setToolTip(button.getToolTip().get(0));
button.getToolTip().add(TooltipHelper.holdShift(Palette.Blue, hasShiftDown()));
}
}
if (hasShiftDown()) {
if (skipMissingButton.isHovered()) {
List<String> tip = skipMissingButton.getToolTip();
tip.remove(1);
tip.add(TextFormatting.BLUE
+ (skipMissingIndicator.state == State.ON ? "Currently Enabled" : "Currently Disabled"));
tip.add(TextFormatting.GRAY + "If the Schematicannon cannot find");
tip.add(TextFormatting.GRAY + "a required Block for placement, it");
tip.add(TextFormatting.GRAY + "will continue at the next Location.");
}
if (skipTilesButton.isHovered()) {
List<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.");
}
fillToolTip(skipMissingButton, skipMissingIndicator, "skipMissing");
fillToolTip(skipTilesButton, skipTilesIndicator, "skipTileEntities");
fillToolTip(replaceLevelButtons.get(0), replaceLevelIndicators.get(0), "dontReplaceSolid");
fillToolTip(replaceLevelButtons.get(1), replaceLevelIndicators.get(1), "replaceWithSolid");
fillToolTip(replaceLevelButtons.get(2), replaceLevelIndicators.get(2), "replaceWithAny");
fillToolTip(replaceLevelButtons.get(3), replaceLevelIndicators.get(3), "replaceWithEmpty");
}
}
private void fillToolTip(IconButton button, Indicator indicator, String tooltipKey) {
if (!button.isHovered())
return;
boolean enabled = indicator.state == State.ON;
List<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
protected void renderWindow(int mouseX, int mouseY, float partialTicks) {
ScreenResources.PLAYER_INVENTORY.draw(this, guiLeft - 10, guiTop + 145);
@ -224,9 +203,9 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
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);
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.drawString("Placement Settings", guiLeft + 20 + 13, guiTop + 84, ScreenResources.FONT_COLOR);
font.drawString("Inventory", guiLeft - 10 + 7, guiTop + 145 + 6, 0x666666);
font.drawString(settingsTitle, guiLeft + 20 + 13, guiTop + 84, ScreenResources.FONT_COLOR);
font.drawString(playerInventory.getDisplayName().getFormattedText(), guiLeft - 10 + 7, guiTop + 145 + 6,
0x666666);
}
protected void renderCannon() {
@ -295,10 +275,9 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
int shotsLeft = (int) (te.fuelLevel / fuelUsageRate);
int shotsLeftWithItems = (int) (shotsLeft
+ te.inventory.getStackInSlot(4).getCount() * (te.getFuelAddedByGunPowder() / fuelUsageRate));
renderTooltip(
ImmutableList.of("Gunpowder at " + (int) (te.fuelLevel * 100) + "%",
TextFormatting.GRAY + "Shots left: " + TextFormatting.BLUE + shotsLeft,
TextFormatting.GRAY + "With backup: " + TextFormatting.BLUE + shotsLeftWithItems),
renderTooltip(ImmutableList.of(Lang.translate(_gunpowderLevel, "" + (int) (te.fuelLevel * 100)),
GRAY + Lang.translate(_shotsRemaining, "" + TextFormatting.BLUE + shotsLeft),
GRAY + Lang.translate(_shotsRemainingWithBackup, "" + TextFormatting.BLUE + shotsLeftWithItems)),
mouseX, mouseY);
}
@ -312,7 +291,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
int paperX = guiLeft + 20 + 202, paperY = guiTop + 20;
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);

View file

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

View file

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

View file

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

View file

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

View file

@ -4,51 +4,24 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.foundation.gui.ScreenResources;
import net.minecraft.util.text.TextFormatting;
import com.simibubi.create.foundation.utility.Lang;
public enum Tools {
Deploy(new DeployTool(), "Deploy", ScreenResources.ICON_TOOL_DEPLOY, ImmutableList.of(
"Moves the structure to a location.",
"Right-Click on the ground to place.",
"Hold [Ctrl] to select at a fixed distance.",
"[Ctrl]-Scroll to change the distance."
)),
Move(new MoveTool(), "Move XZ", ScreenResources.ICON_TOOL_MOVE_XZ, ImmutableList.of(
"Shifts the Schematic Horizontally",
"Point at the Schematic and [CTRL]-Scroll to push it."
)),
MoveY(new MoveVerticalTool(), "Move Y", ScreenResources.ICON_TOOL_MOVE_Y, ImmutableList.of(
"Shifts the Schematic Vertically",
"[CTRL]-Scroll to move it up/down"
)),
Rotate(new RotateTool(), "Rotate", ScreenResources.ICON_TOOL_ROTATE, ImmutableList.of(
"Rotates the Schematic around its center.",
"[CTRL]-Scroll to rotate by 90 Degrees"
)),
Print(new PlaceTool(), "Print", ScreenResources.ICON_CONFIRM, ImmutableList.of(
"Instantly places the structure in the world",
"[Right-Click] to confirm placement at the current location.",
TextFormatting.ITALIC + "(Creative only)"
)),
Flip(new FlipTool(), "Flip", ScreenResources.ICON_TOOL_MIRROR, ImmutableList.of(
"Flips the Schematic along the face you select.",
"Point at the Schematic and [CTRL]-Scroll to flip it."
));
Deploy(new DeployTool(), ScreenResources.ICON_TOOL_DEPLOY),
Move(new MoveTool(), ScreenResources.ICON_TOOL_MOVE_XZ),
MoveY(new MoveVerticalTool(), ScreenResources.ICON_TOOL_MOVE_Y),
Rotate(new RotateTool(), ScreenResources.ICON_TOOL_ROTATE),
Print(new PlaceTool(), ScreenResources.ICON_CONFIRM),
Flip(new FlipTool(), ScreenResources.ICON_TOOL_MIRROR);
private ISchematicTool tool;
private String displayName;
private ScreenResources icon;
private List<String> description;
private Tools(ISchematicTool tool, String name, ScreenResources icon, List<String> description) {
private Tools(ISchematicTool tool, ScreenResources icon) {
this.tool = tool;
this.displayName = name;
this.icon = icon;
this.description = description;
}
public ISchematicTool getTool() {
@ -56,7 +29,7 @@ public enum Tools {
}
public String getDisplayName() {
return displayName;
return Lang.translate("schematic.tool." + name().toLowerCase());
}
public ScreenResources getIcon() {
@ -72,7 +45,7 @@ public enum Tools {
}
public List<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.AllKeys;
import com.simibubi.create.CreateConfig;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.modules.schematics.client.SchematicEditScreen;
@ -58,15 +59,17 @@ public class SchematicItem extends Item {
blueprint.setTag(tag);
writeSize(blueprint);
blueprint.setDisplayName(new StringTextComponent(TextFormatting.RESET + "" + TextFormatting.WHITE
+ "Schematic (" + TextFormatting.GOLD + schematic + TextFormatting.WHITE + ")"));
return blueprint;
}
@Override
@OnlyIn(value = Dist.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<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()) {
TextFormatting gray = TextFormatting.GRAY;
tooltip.add(new StringTextComponent(gray + "Holds a structure to be printed"));
@ -104,7 +107,7 @@ public class SchematicItem extends Item {
String filepath = "";
if (Thread.currentThread().getThreadGroup() == SidedThreadGroups.SERVER)
filepath = "schematics/uploaded/" + owner + "/" + schematic;
filepath = CreateConfig.parameters.schematicPath + "/" + owner + "/" + schematic;
else
filepath = "schematics/" + schematic;

View file

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

View file

@ -1,4 +1,7 @@
{
"_comment": "-------------------------] GAME ELEMENTS [------------------------------------------------",
"item.create.symmetry_wand": "Staff of Symmetry",
"item.create.placement_handgun": "Handheld Blockzapper",
"item.create.tree_fertilizer": "Tree Fertilizer",
@ -133,11 +136,276 @@
"block.create.cocoa_log": "Cocoa Jungle Log",
"block.create.shop_shelf": "Shelf",
"_comment": "-------------------------] UI & MESSAGES [------------------------------------------------",
"death.attack.create.crush": "%1$s was processed by Crushing Wheels",
"death.attack.create.fan_fire": "%1$s was burned to death by hot air",
"death.attack.create.fan_lava": "%1$s was burned to death by lava fan",
"death.attack.create.drill": "%1$s was impaled by Mechanical Drill",
"create.generic.range": "Range",
"create.generic.radius": "Radius",
"create.generic.speed": "Speed",
"create.generic.delay": "Delay",
"create.generic.unit.ticks": "Ticks",
"create.generic.unit.seconds": "Seconds",
"create.generic.unit.minutes": "Minutes",
"create.action.scroll": "Scroll",
"create.action.confirm": "Confirm",
"create.action.abort": "Abort",
"create.action.saveToFile": "Save",
"create.action.discard": "Discard",
"create.keyinfo.toolmenu": "Focus Tool Menu",
"create.gui.scrollInput.defaultTitle": "Choose an Option:",
"create.gui.scrollInput.scrollToModify": "Scroll to Modify",
"create.gui.scrollInput.scrollToSelect": "Scroll to Select",
"create.gui.scrollInput.shiftScrollsFaster": "Shift to Scroll faster",
"create.gui.toolmenu.focusKey": "Hold [%1$s] to Focus",
"create.gui.toolmenu.cycle": "[SCROLL] to Cycle",
"create.gui.symmetryWand.mirrorType": "Mirror",
"create.gui.symmetryWand.orientation": "Orientation",
"create.symmetry.mirror.plane": "Mirror once",
"create.symmetry.mirror.doublePlane": "Rectangular",
"create.symmetry.mirror.triplePlane": "Octagonal",
"create.orientation.orthogonal": "Orthogonal",
"create.orientation.diagonal": "Diagonal",
"create.orientation.horizontal": "Horizontal",
"create.orientation.alongZ": "Along Z",
"create.orientation.alongX": "Along X",
"create.gui.blockzapper.title": "Handheld Blockzapper",
"create.gui.blockzapper.replaceMode": "Replace Mode",
"create.gui.blockzapper.searchDiagonal": "Follow Diagonals",
"create.gui.blockzapper.searchFuzzy": "Ignore Material Borders",
"create.gui.blockzapper.range": "Spread Range",
"create.gui.blockzapper.patternSection": "Patterns",
"create.gui.blockzapper.pattern.solid": "Solid",
"create.gui.blockzapper.pattern.checkered": "Checkerboard",
"create.gui.blockzapper.pattern.inversecheckered": "Inversed Checkerboard",
"create.gui.blockzapper.pattern.chance25": "25% Roll",
"create.gui.blockzapper.pattern.chance50": "50% Roll",
"create.gui.blockzapper.pattern.chance75": "75% Roll",
"create.blockzapper.usingBlock": "Using: %1$s",
"create.blockzapper.componentUpgrades": "Component Upgrades:",
"create.blockzapper.component.body": "Body",
"create.blockzapper.component.amplifier": "Amplifier",
"create.blockzapper.component.accelerator": "Accelerator",
"create.blockzapper.component.retriever": "Retriever",
"create.blockzapper.component.scope": "Scope",
"create.blockzapper.componentTier.none": "None",
"create.blockzapper.componentTier.blazebrass": "Blaze Brass",
"create.blockzapper.componentTier.choruschrome": "Chorus Chrome",
"create.blockzapper.leftClickToSet": "Left-Click a Block to set Material",
"create.blockzapper.empty": "Out of Blocks!",
"create.logistics.filter": "Filter",
"create.logistics.firstFrequency": "Freq. #1",
"create.logistics.secondFrequency": "Freq. #2",
"create.gui.flexcrate.title": "FlexCrate",
"create.gui.flexcrate.storageSpace": "Storage Space",
"create.gui.stockswitch.title": "Stockpile Switch",
"create.gui.stockswitch.lowerLimit": "Lower Threshold",
"create.gui.stockswitch.upperLimit": "Upper Threshold",
"create.gui.stockswitch.startAt": "Start Signal at",
"create.gui.stockswitch.startAbove": "Start Signal above",
"create.gui.stockswitch.stopAt": "Stop Signal at",
"create.gui.stockswitch.stopBelow": "Stop Signal below",
"create.schematicAndQuill.dimensions": "Schematic Size: %1$sx%2$sx%3$s",
"create.schematicAndQuill.firstPos": "First position set.",
"create.schematicAndQuill.secondPos": "Second position set.",
"create.schematicAndQuill.noTarget": "Hold [Ctrl] to select Air blocks.",
"create.schematicAndQuill.abort": "Removed selection.",
"create.schematicAndQuill.prompt": "Enter a name for the Schematic:",
"create.schematicAndQuill.fallbackName": "My Schematic",
"create.schematicAndQuill.saved": "Saved as %1$s",
"create.schematic.position": "Position",
"create.schematic.rotation": "Rotation",
"create.schematic.rotation.none": "None",
"create.schematic.rotation.cw90": "Clockwise 90",
"create.schematic.rotation.cw180": "Clockwise 180",
"create.schematic.rotation.cw270": "Clockwise 270",
"create.schematic.mirror": "Mirror",
"create.schematic.mirror.none": "None",
"create.schematic.mirror.frontBack": "Front-Back",
"create.schematic.mirror.leftRight": "Left-Right",
"create.schematic.tool.deploy": "Deploy",
"create.schematic.tool.move": "Move XZ",
"create.schematic.tool.movey": "Move Y",
"create.schematic.tool.rotate": "Rotate",
"create.schematic.tool.print": "Print",
"create.schematic.tool.flip": "Flip",
"create.schematic.tool.deploy.description.0": "Moves the structure to a location.",
"create.schematic.tool.deploy.description.1": "Right-Click on the ground to place.",
"create.schematic.tool.deploy.description.2": "Hold [Ctrl] to select at a fixed distance.",
"create.schematic.tool.deploy.description.3": "[Ctrl]-Scroll to change the distance.",
"create.schematic.tool.move.description.0": "Shifts the Schematic Horizontally",
"create.schematic.tool.move.description.1": "Point at the Schematic and [CTRL]-Scroll to push it.",
"create.schematic.tool.move.description.2": "",
"create.schematic.tool.move.description.3": "",
"create.schematic.tool.movey.description.0": "Shifts the Schematic Vertically",
"create.schematic.tool.movey.description.1": "[CTRL]-Scroll to move it up/down",
"create.schematic.tool.movey.description.2": "",
"create.schematic.tool.movey.description.3": "",
"create.schematic.tool.rotate.description.0": "Rotates the Schematic around its center.",
"create.schematic.tool.rotate.description.1": "[CTRL]-Scroll to rotate by 90 Degrees",
"create.schematic.tool.rotate.description.2": "",
"create.schematic.tool.rotate.description.3": "",
"create.schematic.tool.print.description.0": "Instantly places the structure in the world",
"create.schematic.tool.print.description.1": "[Right-Click] to confirm placement at the current location.",
"create.schematic.tool.print.description.2": "This tool is for Creative Mode only.",
"create.schematic.tool.print.description.3": "",
"create.schematic.tool.flip.description.0": "Flips the Schematic along the face you select.",
"create.schematic.tool.flip.description.1": "Point at the Schematic and [CTRL]-Scroll to flip it.",
"create.schematic.tool.flip.description.2": "",
"create.schematic.tool.flip.description.3": "",
"create.schematics.synchronizing": "Syncing...",
"create.schematics.uploadTooLarge": "Your schematic is too large",
"create.schematics.maxAllowedSize": "The maximum allowed schematic file size is:",
"create.gui.schematicTable.title": "Schematic Table",
"create.gui.schematicTable.availableSchematics": "Available Schematics",
"create.gui.schematicTable.noSchematics": "No Schematics Saved",
"create.gui.schematicTable.uploading": "Uploading...",
"create.gui.schematicTable.finished": "Upload Finished!",
"create.gui.schematicannon.title": "Schematicannon",
"create.gui.schematicannon.settingsTitle": "Placement Settings",
"create.gui.schematicannon.listPrinter": "Material List Printer",
"create.gui.schematicannon.gunpowderLevel": "Gunpowder at %1$s%%",
"create.gui.schematicannon.shotsRemaining": "Shots left: %1$s",
"create.gui.schematicannon.shotsRemainingWithBackup": "With backup: %1$s",
"create.gui.schematicannon.optionEnabled": "Currently Enabled",
"create.gui.schematicannon.optionDisabled": "Currently Disabled",
"create.gui.schematicannon.option.dontReplaceSolid": "Don't Replace Solid Blocks",
"create.gui.schematicannon.option.replaceWithSolid": "Replace Solid with Solid",
"create.gui.schematicannon.option.replaceWithAny": "Replace Solid with Any",
"create.gui.schematicannon.option.replaceWithEmpty": "Replace Solid with Empty",
"create.gui.schematicannon.option.skipMissing": "Skip missing Blocks",
"create.gui.schematicannon.option.skipTileEntities": "Protect Tile Entities",
"create.gui.schematicannon.option.skipMissing.description": "If the Schematicannon cannot find a required Block for placement, it will continue at the next Location.",
"create.gui.schematicannon.option.skipTileEntities.description": "The Schematicannon will avoid replacing data holding blocks such as Chests.",
"create.gui.schematicannon.option.dontReplaceSolid.description": "The cannon will never replace any Solid blocks in its working area, only non-Solid and Air.",
"create.gui.schematicannon.option.replaceWithSolid.description": "The cannon will only replace Solid blocks in its working area, if the Schematic contains a solid Block at their location.",
"create.gui.schematicannon.option.replaceWithAny.description": "The cannon will replace Solid blocks in its working area, if the Schematic contains any Block at their location.",
"create.gui.schematicannon.option.replaceWithEmpty.description": "The cannon will clear out all blocks in its working area, including those replaced by Air.",
"create.schematicannon.status.idle": "Idle",
"create.schematicannon.status.ready": "Ready",
"create.schematicannon.status.running": "Running",
"create.schematicannon.status.finished": "Finished",
"create.schematicannon.status.paused": "Paused",
"create.schematicannon.status.stopped": "Stopped",
"create.schematicannon.status.noGunpowder": "Out of Gunpowder",
"create.schematicannon.status.targetNotLoaded": "Block is not loaded",
"create.schematicannon.status.targetOutsideRange": "Target too Far Away",
"create.schematicannon.status.searching": "Searching",
"create.schematicannon.status.skipping": "Skipping",
"create.schematicannon.status.missingBlock": "Missing Block:",
"create.schematicannon.status.placing": "Placing",
"create.schematicannon.status.clearing": "Clearing Blocks",
"create.schematicannon.status.schematicInvalid": "Schematic Invalid",
"create.schematicannon.status.schematicNotPlaced": "Schematic not Deployed",
"create.schematicannon.status.schematicExpired": "Schematic File Expired",
"create.tooltip.holdKey": "Hold [%1$s]",
"create.tooltip.holdKeyOrKey": "Hold [%1$s] or [%2$s]",
"create.tooltip.keyShift": "Shift",
"create.tooltip.keyCtrl": "Ctrl",
"_comment": "-------------------------] ITEM DESCRIPTIONS [------------------------------------------------",
"item.create.example_item.tooltip": "EXAMPLE ITEM (marker that this tooltip exists)",
"item.create.example_item.tooltip.summary": "A brief description of the item. _Underscores_ highlight a term.",
"item.create.example_item.tooltip.condition1": "When this",
"item.create.example_item.tooltip.behaviour1": "Then this item does this. (behaviours show on shift)",
"item.create.example_item.tooltip.condition2": "And When this",
"item.create.example_item.tooltip.behaviour2": "You can add as many behaviours as you like",
"item.create.example_item.tooltip.control1": "When Ctrl pressed",
"item.create.example_item.tooltip.action1": "These controls are displayed.",
"item.create.symmetry_wand.tooltip": "SYMMETRY WAND",
"item.create.symmetry_wand.tooltip.summary": "Perfectly mirrors your Block placement across the configured planes.",
"item.create.symmetry_wand.tooltip.condition1": "When in Hotbar",
"item.create.symmetry_wand.tooltip.behaviour1": "Stays Active",
"item.create.symmetry_wand.tooltip.control1": "R-Click on Ground",
"item.create.symmetry_wand.tooltip.action1": "_Creates_ or _Moves_ the Mirror",
"item.create.symmetry_wand.tooltip.control2": "R-Click in the Air",
"item.create.symmetry_wand.tooltip.action2": "_Removes_ the active Mirror",
"item.create.symmetry_wand.tooltip.control3": "R-Click while Sneaking",
"item.create.symmetry_wand.tooltip.action3": "Opens the _Configuration_ _Interface_",
"item.create.placement_handgun.tooltip": "BLOCKZAPPER",
"item.create.placement_handgun.tooltip.summary": "Novel gadget for placing or exchanging blocks at a distance.",
"item.create.placement_handgun.tooltip.control1": "L-Click at Block",
"item.create.placement_handgun.tooltip.action1": "Sets blocks placed by the tool to the targeted block.",
"item.create.placement_handgun.tooltip.control2": "R-Click at Block",
"item.create.placement_handgun.tooltip.action2": "_Places_ or _Replaces_ the targeted block.",
"item.create.placement_handgun.tooltip.control3": "R-Click while Sneaking",
"item.create.placement_handgun.tooltip.action3": "Opens the _Configuration_ _Interface_",
"item.create.tree_fertilizer.tooltip": "TREE FERTILIZER",
"item.create.tree_fertilizer.tooltip.summary": "A powerful combination of minerals suitable for common tree types.",
"item.create.tree_fertilizer.tooltip.condition1": "When used on Sapling",
"item.create.tree_fertilizer.tooltip.behaviour1": "Grows Trees regardless of their spacing Conditions",
"block.create.creative_crate.tooltip": "CREATIVE CRATE",
"block.create.creative_crate.tooltip.summary": "tis a crate",
"block.create.schematic_table.tooltip": "SCHEMATIC TABLE",
"block.create.schematic_table.tooltip.summary": "Writes saved Schematics onto an _Empty_ _Schematic_",
"block.create.schematic_table.tooltip.condition1": "When given an Empty Schematic",
"block.create.schematic_table.tooltip.behaviour1": "Uploads a chosen File from your Schematics Folder",
"block.create.gearbox.tooltip": "GEARBOX",
"block.create.gearbox.tooltip.summary": "Relays Rotation to Four directions. Reverses straight connections.",
"block.create.gearshift.tooltip": "GEARSHIFT",
"block.create.gearshift.tooltip.summary": "A controllable rotation switch for connected shafts.",
"block.create.gearshift.tooltip.condition1": "When Powered",
"block.create.gearshift.tooltip.behaviour1": "_Reverses_ the incoming rotation on the other side.",
"block.create.clutch.tooltip": "CLUTCH",
"block.create.clutch.tooltip.summary": "A controllable rotation switch for connected shafts.",
"block.create.clutch.tooltip.condition1": "When Powered",
"block.create.clutch.tooltip.behaviour1": "_Stops_ conveying rotation to the other side.",
"block.create.encased_belt.tooltip": "ENCASED_BELT",
"block.create.encased_belt.tooltip.summary": "Relays rotation through its block and to an attached Encased Belt.",
"block.create.encased_belt.tooltip.condition1": "When Attached to other Encased Belt",
"block.create.encased_belt.tooltip.behaviour1": "Attached Block will have the exact same rotation speed and direction. Attached Belts do not have to face the same way.",
"block.create.stockswitch.tooltip": "STOCKSWITCH",
"block.create.stockswitch.tooltip.summary": "Toggles a Redstone signal based on the _Storage_ _Space_ in the attached Container.",
"block.create.stockswitch.tooltip.condition1": "When below Lower Limit",
"block.create.stockswitch.tooltip.behaviour1": "Stops providing _Redstone_ _Power_",
"block.create.stockswitch.tooltip.condition2": "When above Upper Limit",
"block.create.stockswitch.tooltip.behaviour2": "Starts providing _Redstone_ _Power_ until Lower Limit is reached again.",
"block.create.stockswitch.tooltip.control1": "When R-Clicked",
"block.create.stockswitch.tooltip.action1": "Opens the _Configuration_ _Screen_",
"block.create.redstone_bridge.tooltip": "REDSTONE_LINK",
"block.create.redstone_bridge.tooltip.summary": "Endpoints for _Wireless_ _Redstone_ connections. Can be assigned _Frequencies_ using any item. Signal can travel distances up to _128m_",
"block.create.redstone_bridge.tooltip.condition1": "When Powered",
"block.create.redstone_bridge.tooltip.behaviour1": "Bridges of the same _Frequency_ will provide a Redstone signal.",
"block.create.redstone_bridge.tooltip.control1": "When R-Clicked with an Item",
"block.create.redstone_bridge.tooltip.action1": "Sets the _Frequency_ to that item. A total of _two_ _different_ _items_ can be used in combination for defining a Frequency.",
"block.create.redstone_bridge.tooltip.control2": "When R-Clicked while Sneaking",
"block.create.redstone_bridge.tooltip.action2": "Toggles between _Receiver_ and _Transmitter_ Mode.",
"itemGroup.create": "Create"
}