From 0bf30b2f93508258c78547a7da1269f1ce873ce8 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Wed, 27 Nov 2019 09:29:29 +0100 Subject: [PATCH] It's exactly Stressful! - Added configurable levels of speed for requirements - Added tooltip information to mechanical blocks with Stress Impact, Stress Capacity and Required speed level - Fixed Belt connector not being a blockitem - Made Stress capacity configuration more generic --- .../com/simibubi/create/ClientEvents.java | 3 + .../com/simibubi/create/CreateConfig.java | 86 +++++++++++++++---- .../foundation/utility/ItemDescription.java | 59 +++++++++++++ .../foundation/utility/TooltipHelper.java | 24 +++--- .../modules/contraptions/base/IRotate.java | 23 +++++ .../contraptions/base/KineticTileEntity.java | 29 ++++++- .../generators/MotorTileEntity.java | 5 -- .../generators/WaterWheelTileEntity.java | 6 -- .../receivers/EncasedFanTileEntity.java | 4 +- .../receivers/MechanicalMixerBlock.java | 5 ++ .../receivers/MechanicalMixerTileEntity.java | 2 +- .../MechanicalBearingTileEntity.java | 7 +- .../relays/belt/BeltConnectorItem.java | 14 ++- .../resources/assets/create/lang/en_us.json | 18 +++- 14 files changed, 229 insertions(+), 56 deletions(-) diff --git a/src/main/java/com/simibubi/create/ClientEvents.java b/src/main/java/com/simibubi/create/ClientEvents.java index 11c3b3ecf..4ea8402b6 100644 --- a/src/main/java/com/simibubi/create/ClientEvents.java +++ b/src/main/java/com/simibubi/create/ClientEvents.java @@ -8,11 +8,13 @@ import com.simibubi.create.foundation.gui.ScreenOpener; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.TooltipHelper; import com.simibubi.create.modules.contraptions.KineticDebugger; +import com.simibubi.create.modules.contraptions.base.IRotate; import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.modules.contraptions.receivers.TurntableHandler; import com.simibubi.create.modules.contraptions.relays.belt.BeltConnectorItemHandler; import net.minecraft.client.Minecraft; +import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.util.text.ITextComponent; import net.minecraftforge.api.distmarker.Dist; @@ -131,6 +133,7 @@ public class ClientEvents { TooltipHelper.getTooltip(stack).addInformation(toolTip); event.getToolTip().addAll(1, toolTip); } + } @SubscribeEvent diff --git a/src/main/java/com/simibubi/create/CreateConfig.java b/src/main/java/com/simibubi/create/CreateConfig.java index 320943489..8d6cb1ed7 100644 --- a/src/main/java/com/simibubi/create/CreateConfig.java +++ b/src/main/java/com/simibubi/create/CreateConfig.java @@ -9,6 +9,7 @@ import org.apache.commons.lang3.tuple.Pair; import com.simibubi.create.modules.contraptions.base.KineticBlock; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; import net.minecraftforge.common.ForgeConfigSpec.Builder; @@ -60,11 +61,12 @@ public class CreateConfig { inWorldProcessingTime; public IntValue maxChassisForTranslation, maxChassisForRotation, maxChassisRange, maxPistonPoles; - public DoubleValue waterWheelCapacity; - public DoubleValue generatingFanCapacity; - public DoubleValue mechanicalBearingCapacity; - public DoubleValue motorCapacity; - public Map stressEntries = new HashMap<>(); + public Map stressCapacityEntries = new HashMap<>(); + public Map stressEntries = new HashMap<>(); + + public DoubleValue mediumSpeed, fastSpeed; + public DoubleValue mediumStressImpact, highStressImpact; + public DoubleValue mediumCapacity, highCapacity; // Logistics public IntValue extractorDelay, extractorAmount, linkRange; @@ -332,6 +334,36 @@ public class CreateConfig { } private void initStress(final ForgeConfigSpec.Builder builder) { + builder.comment("Configure speed/capacity levels for requirements and indicators.").push("rotationLevels"); + String basePath = "create.config.rotationLevels."; + String name = ""; + + name = "mediumSpeed"; + mediumSpeed = builder.comment("", "[in Degrees/Tick]", "Minimum speed of rotation to be considered 'medium'") + .translation(basePath + name).defineInRange(name, 32D, 0D, 4096D); + + name = "fastSpeed"; + mediumSpeed = builder.comment("", "[in Degrees/Tick]", "Minimum speed of rotation to be considered 'fast'") + .translation(basePath + name).defineInRange(name, 512D, 0D, 65535D); + + name = "mediumStressImpact"; + mediumStressImpact = builder.comment("", "Minimum stress impact to be considered 'medium'") + .translation(basePath + name).defineInRange(name, 8D, 0D, 4096D); + + name = "highStressImpact"; + highStressImpact = builder.comment("", "Minimum stress impact to be considered 'high'") + .translation(basePath + name).defineInRange(name, 32D, 0D, 65535D); + + name = "mediumCapacity"; + mediumCapacity = builder.comment("", "Minimum added Capacity by sources to be considered 'medium'") + .translation(basePath + name).defineInRange(name, 128D, 0D, 4096D); + + name = "highCapacity"; + highCapacity = builder.comment("", "Minimum added Capacity by sources to be considered 'high'") + .translation(basePath + name).defineInRange(name, 512D, 0D, 65535D); + + builder.pop(); + builder.comment( "Configure the individual stress impact of mechanical blocks. Note that this cost is doubled for every speed increase it receives.") .push("stress"); @@ -345,18 +377,10 @@ public class CreateConfig { builder.comment("Configure how much stress a source can accommodate.").push("capacity"); - String basePath = "create.config.capacity."; - String name = ""; - - name = "waterWheelCapacity"; - waterWheelCapacity = builder.comment("").translation(basePath + name).defineInRange(name, 32D, 0D, 4096D); - name = "generatingFanCapacity"; - generatingFanCapacity = builder.comment("").translation(basePath + name).defineInRange(name, 64D, 0D, 4096D); - name = "mechanicalBearingCapacity"; - mechanicalBearingCapacity = builder.comment("").translation(basePath + name).defineInRange(name, 256D, 0D, - 4096D); - name = "motorCapacity"; - motorCapacity = builder.comment("").translation(basePath + name).defineInRange(name, 1024D, 0D, 4096D); + for (AllBlocks block : AllBlocks.values()) { + if (block.get() instanceof KineticBlock) + initStressCapacityEntry(block, builder); + } builder.pop(); @@ -365,10 +389,36 @@ public class CreateConfig { private void initStressEntry(AllBlocks block, final ForgeConfigSpec.Builder builder) { String basePath = "create.config.stress."; String name = block.name(); - stressEntries.put(block.get().getRegistryName().getPath(), builder.comment("").translation(basePath + name) + stressEntries.put(block.get().getRegistryName(), builder.comment("").translation(basePath + name) .defineInRange(name, getDefaultStressImpact(block), 0, 2048)); } + private void initStressCapacityEntry(AllBlocks block, final ForgeConfigSpec.Builder builder) { + double defaultStressCapacity = getDefaultStressCapacity(block); + if (defaultStressCapacity == -1) + return; + String basePath = "create.config.stressCapacity."; + String name = block.name(); + stressCapacityEntries.put(block.get().getRegistryName(), + builder.comment("").translation(basePath + name).defineInRange(name, defaultStressCapacity, 0, 4096D)); + } + + public static double getDefaultStressCapacity(AllBlocks block) { + + switch (block) { + case MOTOR: + return 1024; + case ENCASED_FAN: + return 64; + case WATER_WHEEL: + return 32; + case MECHANICAL_BEARING: + return 128; + default: + return -1; + } + } + public static double getDefaultStressImpact(AllBlocks block) { switch (block) { diff --git a/src/main/java/com/simibubi/create/foundation/utility/ItemDescription.java b/src/main/java/com/simibubi/create/foundation/utility/ItemDescription.java index 99145c52b..5b86469d4 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/ItemDescription.java +++ b/src/main/java/com/simibubi/create/foundation/utility/ItemDescription.java @@ -1,5 +1,6 @@ package com.simibubi.create.foundation.utility; +import static com.simibubi.create.CreateConfig.parameters; 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; @@ -20,7 +21,13 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import com.simibubi.create.modules.contraptions.base.IRotate; +import com.simibubi.create.modules.contraptions.base.IRotate.SpeedLevel; +import com.simibubi.create.modules.contraptions.base.IRotate.StressImpact; + +import net.minecraft.block.Block; import net.minecraft.client.gui.screen.Screen; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; @@ -68,6 +75,58 @@ public class ItemDescription { return this; } + public ItemDescription withKineticStats(IRotate block) { + SpeedLevel minimumRequiredSpeedLevel = block.getMinimumRequiredSpeedLevel(); + boolean hasSpeedRequirement = minimumRequiredSpeedLevel != SpeedLevel.NONE; + ResourceLocation id = ((Block) block).getRegistryName(); + boolean hasStressImpact = parameters.stressEntries.containsKey(id); + boolean hasStressCapacity = parameters.stressCapacityEntries.containsKey(id); + + if (hasSpeedRequirement) { + List speedLevels = Lang.translatedOptions("tooltip.speedRequirement", "none", "medium", "high"); + int index = minimumRequiredSpeedLevel.ordinal(); + String level = minimumRequiredSpeedLevel.getColor() + makeProgressBar(3, index) + speedLevels.get(index); + add(linesOnShift, GRAY + Lang.translate("tooltip.speedRequirement")); + add(linesOnShift, level); + } + if (hasStressImpact) { + List stressLevels = Lang.translatedOptions("tooltip.stressImpact", "low", "medium", "high"); + double impact = parameters.stressEntries.get(id).get(); + StressImpact impactId = impact >= parameters.highStressImpact.get() ? StressImpact.HIGH + : (impact >= parameters.mediumStressImpact.get() ? StressImpact.MEDIUM : StressImpact.LOW); + int index = impactId.ordinal(); + String level = impactId.getColor() + makeProgressBar(3, index) + stressLevels.get(index); + add(linesOnShift, GRAY + Lang.translate("tooltip.stressImpact")); + add(linesOnShift, level); + + } + if (hasStressCapacity) { + List stressCapacityLevels = Lang.translatedOptions("tooltip.capacityProvided", "low", "medium", + "high"); + double capacity = parameters.stressCapacityEntries.get(id).get(); + StressImpact impactId = capacity >= parameters.highCapacity.get() ? StressImpact.LOW + : (capacity >= parameters.mediumCapacity.get() ? StressImpact.MEDIUM : StressImpact.HIGH); + int index = StressImpact.values().length - 1 - impactId.ordinal(); + String level = impactId.getColor() + makeProgressBar(3, index) + stressCapacityLevels.get(index); + add(linesOnShift, GRAY + Lang.translate("tooltip.capacityProvided")); + add(linesOnShift, level); + } + + if (hasSpeedRequirement || hasStressImpact || hasStressCapacity) + add(linesOnShift, ""); + return this; + } + + protected String makeProgressBar(int length, int filledLength) { + String bar = " "; + int emptySpaces = length - 1 - filledLength; + for (int i = 0; i <= filledLength; i++) + bar += "\u2588"; + for (int i = 0; i < emptySpaces; i++) + bar += "\u2592"; + return bar + " "; + } + public ItemDescription withBehaviour(String condition, String behaviour) { add(linesOnShift, GRAY + condition); add(linesOnShift, cutString(behaviour, palette.color, palette.hColor, 1)); diff --git a/src/main/java/com/simibubi/create/foundation/utility/TooltipHelper.java b/src/main/java/com/simibubi/create/foundation/utility/TooltipHelper.java index f100ae595..9232a4ee7 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/TooltipHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/TooltipHelper.java @@ -10,8 +10,8 @@ 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 com.simibubi.create.modules.contraptions.base.IRotate; -import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.item.BlockItem; @@ -80,7 +80,7 @@ public class TooltipHelper { public static boolean hasTooltip(ItemStack stack) { checkLocale(); - cachedTooltips.clear(); +// cachedTooltips.clear(); String key = getTooltipTranslationKey(stack); if (cachedTooltips.containsKey(key)) return cachedTooltips.get(key) != ItemDescription.MISSING; @@ -101,14 +101,15 @@ public class TooltipHelper { private static boolean findTooltip(ItemStack stack) { String key = getTooltipTranslationKey(stack); if (I18n.hasKey(key)) { - cachedTooltips.put(key, buildToolTip(key, IModule.of(stack))); + cachedTooltips.put(key, buildToolTip(key, stack)); return true; } cachedTooltips.put(key, ItemDescription.MISSING); return false; } - private static ItemDescription buildToolTip(String translationKey, IModule module) { + private static ItemDescription buildToolTip(String translationKey, ItemStack stack) { + IModule module = IModule.of(stack); ItemDescription tooltip = new ItemDescription(module.getToolTipColor()); String summaryKey = translationKey + ".summary"; @@ -116,6 +117,14 @@ public class TooltipHelper { if (I18n.hasKey(summaryKey)) tooltip = tooltip.withSummary(I18n.format(summaryKey)); + // Requirements + if (stack.getItem() instanceof BlockItem) { + BlockItem item = (BlockItem) stack.getItem(); + if (item.getBlock() instanceof IRotate) { + tooltip = tooltip.withKineticStats((IRotate) item.getBlock()); + } + } + // Behaviours for (int i = 1; i < 100; i++) { String conditionKey = translationKey + ".condition" + i; @@ -138,14 +147,7 @@ public class TooltipHelper { } public static String getTooltipTranslationKey(ItemStack stack) { - if (stack.getItem() instanceof BlockItem) { - return getTooltipTranslationKey(((BlockItem) stack.getItem()).getBlock()); - } return stack.getItem().getTranslationKey() + ".tooltip"; } - public static String getTooltipTranslationKey(Block block) { - return block.getTranslationKey() + ".tooltip"; - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/IRotate.java b/src/main/java/com/simibubi/create/modules/contraptions/base/IRotate.java index 7a5abf1d9..1f87a3950 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/IRotate.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/IRotate.java @@ -6,10 +6,29 @@ import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; public interface IRotate { + public enum SpeedLevel { + NONE, MEDIUM, FAST; + + public TextFormatting getColor() { + return this == NONE ? TextFormatting.GREEN + : this == MEDIUM ? TextFormatting.AQUA : TextFormatting.LIGHT_PURPLE; + } + } + + public enum StressImpact { + LOW, MEDIUM, HIGH; + + public TextFormatting getColor() { + return this == LOW ? TextFormatting.YELLOW + : this == MEDIUM ? TextFormatting.GOLD : TextFormatting.RED; + } + } + public boolean hasShaftTowards(World world, BlockPos pos, BlockState state, Direction face); public boolean hasCogsTowards(World world, BlockPos pos, BlockState state, Direction face); @@ -20,4 +39,8 @@ public interface IRotate { return ActionResultType.PASS; } + public default SpeedLevel getMinimumRequiredSpeedLevel() { + return SpeedLevel.NONE; + } + } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java index 914c18d37..408c7f029 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java @@ -14,13 +14,16 @@ import com.simibubi.create.CreateConfig; import com.simibubi.create.foundation.block.SyncedTileEntity; import com.simibubi.create.modules.contraptions.KineticNetwork; import com.simibubi.create.modules.contraptions.RotationPropagator; +import com.simibubi.create.modules.contraptions.base.IRotate.SpeedLevel; +import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.NBTUtil; import net.minecraft.particles.RedstoneParticleData; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.ForgeConfigSpec.DoubleValue; @@ -59,12 +62,16 @@ public abstract class KineticTileEntity extends SyncedTileEntity implements ITic } public float getAddedStressCapacity() { - return 0; + Map capacityMap = CreateConfig.parameters.stressCapacityEntries; + ResourceLocation path = getBlockState().getBlock().getRegistryName(); + if (!capacityMap.containsKey(path)) + return 0; + return capacityMap.get(path).get().floatValue(); } public float getStressApplied() { - Map stressEntries = CreateConfig.parameters.stressEntries; - String path = getBlockState().getBlock().getRegistryName().getPath(); + Map stressEntries = CreateConfig.parameters.stressEntries; + ResourceLocation path = getBlockState().getBlock().getRegistryName(); if (!stressEntries.containsKey(path)) return 1; return stressEntries.get(path).get().floatValue(); @@ -282,11 +289,25 @@ public abstract class KineticTileEntity extends SyncedTileEntity implements ITic } } + public boolean isSpeedRequirementFulfilled() { + BlockState state = getBlockState(); + if (!(getBlockState().getBlock() instanceof IRotate)) + return true; + IRotate def = (IRotate) state.getBlock(); + SpeedLevel minimumRequiredSpeedLevel = def.getMinimumRequiredSpeedLevel(); + if (minimumRequiredSpeedLevel == null) + return true; + if (minimumRequiredSpeedLevel == SpeedLevel.MEDIUM) + return Math.abs(getSpeed()) >= CreateConfig.parameters.mediumSpeed.get(); + if (minimumRequiredSpeedLevel == SpeedLevel.FAST) + return Math.abs(getSpeed()) >= CreateConfig.parameters.fastSpeed.get(); + return true; + } + public void addDebugInformation(List lines) { lines.add("Speed: " + GREEN + speed); lines.add("Cost: " + GREEN + getStressApplied() + WHITE + "/" + GREEN + getAddedStressCapacity()); lines.add("Stress: " + GREEN + currentStress + WHITE + "/" + GREEN + maxStress); -// lines.add("Network: " + (hasNetwork() ? networkID.toString() : "Missing")); } } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/generators/MotorTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/generators/MotorTileEntity.java index 1ca65409f..4b54548cf 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/generators/MotorTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/generators/MotorTileEntity.java @@ -30,11 +30,6 @@ public class MotorTileEntity extends GeneratingKineticTileEntity { return generatedSpeed; } - @Override - public float getAddedStressCapacity() { - return CreateConfig.parameters.motorCapacity.get().floatValue(); - } - @Override public boolean hasFastRenderer() { return true; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/generators/WaterWheelTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/generators/WaterWheelTileEntity.java index 53b7bcd81..dfa3743dd 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/generators/WaterWheelTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/generators/WaterWheelTileEntity.java @@ -4,7 +4,6 @@ import java.util.HashMap; import java.util.Map; import com.simibubi.create.AllTileEntities; -import com.simibubi.create.CreateConfig; import com.simibubi.create.modules.contraptions.base.GeneratingKineticTileEntity; import net.minecraft.nbt.CompoundNBT; @@ -60,9 +59,4 @@ public class WaterWheelTileEntity extends GeneratingKineticTileEntity { return speed; } - @Override - public float getAddedStressCapacity() { - return CreateConfig.parameters.waterWheelCapacity.get().floatValue(); - } - } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/EncasedFanTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/EncasedFanTileEntity.java index cb684146e..dd0fc8a2c 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/EncasedFanTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/EncasedFanTileEntity.java @@ -91,7 +91,7 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity { @Override public float getAddedStressCapacity() { - return isGenerator ? CreateConfig.parameters.generatingFanCapacity.get().floatValue() : 0; + return isGenerator ? super.getAddedStressCapacity() : 0; } @Override @@ -196,7 +196,7 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity { return; EncasedFanBeltHandler.tickBelts(this, affectedBelts); - + List frontEntities = world.getEntitiesWithinAABBExcludingEntity(null, frontBB); for (Entity entity : frontEntities) { moveEntity(entity, true); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalMixerBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalMixerBlock.java index 62837bb05..63528c02f 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalMixerBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalMixerBlock.java @@ -132,5 +132,10 @@ public class MechanicalMixerBlock extends KineticBlock return 0; return tileEntity.currentValue; } + + @Override + public SpeedLevel getMinimumRequiredSpeedLevel() { + return SpeedLevel.MEDIUM; + } } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalMixerTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalMixerTileEntity.java index 8601c3d3e..a0ecf96df 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalMixerTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalMixerTileEntity.java @@ -179,7 +179,7 @@ public class MechanicalMixerTileEntity extends KineticTileEntity { return; } - if (speed < 32) + if (!isSpeedRequirementFulfilled()) return; if (!checkBasin) return; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalBearingTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalBearingTileEntity.java index 750ba20b6..b1d481dbc 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalBearingTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/constructs/MechanicalBearingTileEntity.java @@ -1,7 +1,6 @@ package com.simibubi.create.modules.contraptions.receivers.constructs; import com.simibubi.create.AllTileEntities; -import com.simibubi.create.CreateConfig; import com.simibubi.create.modules.contraptions.base.GeneratingKineticTileEntity; import net.minecraft.block.BlockState; @@ -43,7 +42,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity { @Override public float getAddedStressCapacity() { - return isWindmill ? CreateConfig.parameters.mechanicalBearingCapacity.get().floatValue() : 0; + return isWindmill ? super.getAddedStressCapacity() : 0; } public void neighbourChanged() { @@ -52,9 +51,9 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity { return; isWindmill = shouldWindmill; - if (isWindmill && !running) + if (isWindmill && !running) assembleNextTick = true; - if (isWindmill && running) + if (isWindmill && running) updateGeneratedRotation(); if (!isWindmill && running) { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltConnectorItem.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltConnectorItem.java index cdef9d8e0..80fc29885 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltConnectorItem.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltConnectorItem.java @@ -11,7 +11,7 @@ import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Part; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Slope; import net.minecraft.block.BlockState; -import net.minecraft.item.Item; +import net.minecraft.item.BlockItem; import net.minecraft.item.ItemUseContext; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.NBTUtil; @@ -23,12 +23,17 @@ import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -public class BeltConnectorItem extends Item { +public class BeltConnectorItem extends BlockItem { public BeltConnectorItem(Properties properties) { - super(properties); + super(AllBlocks.BELT.block, properties); } - + + @Override + public String getTranslationKey() { + return getDefaultTranslationKey(); + } + @Override public ActionResultType onItemUse(ItemUseContext context) { if (context.isPlacerSneaking()) { @@ -218,4 +223,5 @@ public class BeltConnectorItem extends Item { return true; } + } diff --git a/src/main/resources/assets/create/lang/en_us.json b/src/main/resources/assets/create/lang/en_us.json index 91bb471c4..2daf1499c 100644 --- a/src/main/resources/assets/create/lang/en_us.json +++ b/src/main/resources/assets/create/lang/en_us.json @@ -380,7 +380,23 @@ "create.tooltip.holdKeyOrKey": "Hold [%1$s] or [%2$s]", "create.tooltip.keyShift": "Shift", "create.tooltip.keyCtrl": "Ctrl", - + + "create.tooltip.speedRequirement": "Speed Requirement: %1$s", + "create.tooltip.speedRequirement.none": "None", + "create.tooltip.speedRequirement.medium": "Moderate", + "create.tooltip.speedRequirement.high": "Fast", + + "create.tooltip.stressImpact": "Stress Impact: %1$s", + "create.tooltip.stressImpact.low": "Low", + "create.tooltip.stressImpact.medium": "Moderate", + "create.tooltip.stressImpact.high": "High", + + "create.tooltip.capacityProvided": "Stress Capacity: %1$s", + "create.tooltip.capacityProvided.low": "Small", + "create.tooltip.capacityProvided.medium": "Medium", + "create.tooltip.capacityProvided.high": "Large", + + "create.mechanical_mixer.min_ingredients": "Min. Ingredients", "_comment": "-------------------------] ITEM DESCRIPTIONS [------------------------------------------------",