From 9497c1c1d4f1d9afc08a709cc720be4385e5a68c Mon Sep 17 00:00:00 2001 From: Zelophed Date: Sat, 21 Mar 2020 19:49:46 +0100 Subject: [PATCH] added some tags and changed a couple tooltips - added limestone, weathered limestone, gabbro, dolomite and scoria (as well as their polished variants) to #forge:stone - added #forge:storage_blocks/copper to #forge:storage_blocks - added copper block to #forge:storage_blocks/copper - added config value for the furnace generators speed - added the generation speed of water wheel, encased fan and furnace generator to their tooltips - goggles now show the power of a analog lever when worn --- .../com/simibubi/create/config/CKinetics.java | 2 + .../foundation/item/ItemDescription.java | 58 ++++++++++++------- .../redstone/AnalogLeverTileEntity.java | 3 + .../gauge/GaugeInformationRenderer.java | 14 +++-- .../resources/assets/create/lang/en_us.json | 5 +- .../data/forge/tags/blocks/stone.json | 16 +++++ .../forge/tags/blocks/storage_blocks.json | 6 ++ .../tags/blocks/storage_blocks/copper.json | 6 ++ .../data/forge/tags/items/stone.json | 16 +++++ .../data/forge/tags/items/storage_blocks.json | 6 ++ .../tags/items/storage_blocks/copper.json | 6 ++ 11 files changed, 111 insertions(+), 27 deletions(-) create mode 100644 src/main/resources/data/forge/tags/blocks/stone.json create mode 100644 src/main/resources/data/forge/tags/blocks/storage_blocks.json create mode 100644 src/main/resources/data/forge/tags/blocks/storage_blocks/copper.json create mode 100644 src/main/resources/data/forge/tags/items/stone.json create mode 100644 src/main/resources/data/forge/tags/items/storage_blocks.json create mode 100644 src/main/resources/data/forge/tags/items/storage_blocks/copper.json diff --git a/src/main/java/com/simibubi/create/config/CKinetics.java b/src/main/java/com/simibubi/create/config/CKinetics.java index 073eb5991..1a8b992b2 100644 --- a/src/main/java/com/simibubi/create/config/CKinetics.java +++ b/src/main/java/com/simibubi/create/config/CKinetics.java @@ -7,6 +7,7 @@ public class CKinetics extends ConfigBase { public ConfigInt crushingDamage = i(4, 0, "crushingDamage", Comments.crushingDamage); public ConfigInt maxMotorSpeed = i(256, 64, "maxMotorSpeed", Comments.rpm, Comments.maxMotorSpeed); public ConfigInt waterWheelSpeed = i(5, 1, "waterWheelSpeed", Comments.rpm, Comments.waterWheelSpeed); + public ConfigInt furnaceEngineSpeed = i(16, 1, "furnaceEngineSpeed", Comments.rpm, Comments.furnaceEngineSpeed); public ConfigInt maxRotationSpeed = i(256, 64, "maxRotationSpeed", Comments.rpm, Comments.maxRotationSpeed); public ConfigEnum ignoreDeployerAttacks = e(DeployerAggroSetting.CREEPERS, "ignoreDeployerAttacks", Comments.ignoreDeployerAttacks); @@ -69,6 +70,7 @@ public class CKinetics extends ConfigBase { static String stress = "Fine tune the kinetic stats of individual components"; static String ignoreDeployerAttacks = "Select what mobs should ignore Deployers when attacked by them."; static String waterWheelSpeed = "Rotation speed gained by a water wheel for each side with running water. (halved if not against blades)"; + static String furnaceEngineSpeed = "Base rotation speed for the furnace engine generator"; static String disableStress = "Disable the Stress mechanic altogether."; static String kineticValidationFrequency = "Game ticks between Kinetic Blocks checking whether their source is still valid."; } diff --git a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java index f58337de5..63d47a7dc 100644 --- a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java +++ b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java @@ -1,26 +1,5 @@ package com.simibubi.create.foundation.item; -import static com.simibubi.create.foundation.item.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; -import static net.minecraft.util.text.TextFormatting.DARK_GREEN; -import static net.minecraft.util.text.TextFormatting.DARK_PURPLE; -import static net.minecraft.util.text.TextFormatting.DARK_RED; -import static net.minecraft.util.text.TextFormatting.GOLD; -import static net.minecraft.util.text.TextFormatting.GRAY; -import static net.minecraft.util.text.TextFormatting.GREEN; -import static net.minecraft.util.text.TextFormatting.LIGHT_PURPLE; -import static net.minecraft.util.text.TextFormatting.RED; -import static net.minecraft.util.text.TextFormatting.STRIKETHROUGH; -import static net.minecraft.util.text.TextFormatting.WHITE; -import static net.minecraft.util.text.TextFormatting.YELLOW; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - import com.simibubi.create.AllItems; import com.simibubi.create.config.AllConfigs; import com.simibubi.create.config.CKinetics; @@ -28,8 +7,10 @@ import com.simibubi.create.foundation.utility.Lang; 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 com.simibubi.create.modules.contraptions.components.fan.EncasedFanBlock; import com.simibubi.create.modules.contraptions.components.flywheel.engine.EngineBlock; - +import com.simibubi.create.modules.contraptions.components.flywheel.engine.FurnaceEngineBlock; +import com.simibubi.create.modules.contraptions.components.waterwheel.WaterWheelBlock; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.Screen; @@ -40,6 +21,14 @@ import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import static com.simibubi.create.foundation.item.TooltipHelper.cutString; +import static net.minecraft.util.text.TextFormatting.*; + public class ItemDescription { public static final ItemDescription MISSING = new ItemDescription(null); @@ -144,6 +133,12 @@ public class ItemDescription { add(linesOnShift, GRAY + Lang.translate("tooltip.capacityProvided")); add(linesOnShift, level); + + String genSpeed = generatorSpeed(block, rpmUnit); + if (!genSpeed.equals("")){ + add(linesOnShift, ""); + add(linesOnShift, GREEN + genSpeed); + } } if (hasSpeedRequirement || hasStressImpact || hasStressCapacity) @@ -269,4 +264,23 @@ public class ItemDescription { return linesOnShift; } + private String generatorSpeed(Block block, String unitRPM){ + String value = ""; + + if (block instanceof WaterWheelBlock) { + int baseSpeed = AllConfigs.SERVER.kinetics.waterWheelSpeed.get(); + value = baseSpeed + "-" + (baseSpeed * 3); + } + + else if (block instanceof EncasedFanBlock) + value = AllConfigs.SERVER.kinetics.generatingFanSpeed.get().toString(); + + else if (block instanceof FurnaceEngineBlock) { + int baseSpeed = AllConfigs.SERVER.kinetics.furnaceEngineSpeed.get(); + value = baseSpeed + "-" + (baseSpeed * 2); + } + + return !value.equals("") ? Lang.translate("tooltip.generationSpeed", value, unitRPM) : ""; + } + } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/redstone/AnalogLeverTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/redstone/AnalogLeverTileEntity.java index f4b3790c2..63b0bd5c2 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/redstone/AnalogLeverTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/redstone/AnalogLeverTileEntity.java @@ -69,4 +69,7 @@ public class AnalogLeverTileEntity extends SmartTileEntity { sendData(); } + public int getState() { + return state; + } } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeInformationRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeInformationRenderer.java index aeaa8c39d..3bbaf5bb5 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeInformationRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/gauge/GaugeInformationRenderer.java @@ -20,6 +20,7 @@ import com.simibubi.create.modules.contraptions.base.IRotate.SpeedLevel; import com.simibubi.create.modules.contraptions.base.IRotate.StressImpact; import com.simibubi.create.modules.contraptions.base.KineticTileEntity; +import com.simibubi.create.modules.contraptions.redstone.AnalogLeverTileEntity; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.Screen; @@ -42,6 +43,7 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber; public class GaugeInformationRenderer { private static DecimalFormat decimalFormat = new DecimalFormat("#.##"); + private static String spacing = " "; @SubscribeEvent public static void lookingAtBlocksThroughGogglesShowsTooltip(RenderGameOverlayEvent.Post event) { @@ -64,7 +66,7 @@ public class GaugeInformationRenderer { if (!AllItems.GOGGLES.typeOf(goggles) && !notFastEnough) return; - if (mc.player.isSneaking()) + if (mc.player.isSneaking() && !(te instanceof AnalogLeverTileEntity)) return; List tooltip = new ArrayList<>(); @@ -79,6 +81,8 @@ public class GaugeInformationRenderer { addGeneratorTooltip(state, tooltip, (GeneratingKineticTileEntity) te); if (te instanceof KineticTileEntity) addStressTooltip(state, tooltip, (KineticTileEntity) te); + if (te instanceof AnalogLeverTileEntity) + addLeverTooltip(state, tooltip, (AnalogLeverTileEntity) te); } if (tooltip.isEmpty()) @@ -117,7 +121,6 @@ public class GaugeInformationRenderer { } private static void addStressTooltip(BlockState state, List tooltip, KineticTileEntity te) { - String spacing = " "; float stressApplied = te.getStressApplied(); if (stressApplied == 0 || !StressImpact.isEnabled()) return; @@ -139,7 +142,6 @@ public class GaugeInformationRenderer { } private static void addGeneratorTooltip(BlockState state, List tooltip, GeneratingKineticTileEntity te) { - String spacing = " "; float addedStressCapacity = te.getAddedStressCapacity(); if (addedStressCapacity == 0 || !StressImpact.isEnabled()) return; @@ -182,7 +184,6 @@ public class GaugeInformationRenderer { String _atCurrentSpeed = Lang.translate("gui.goggles.at_current_speed"); String _baseValue = Lang.translate("gui.goggles.base_value"); - String spacing = " "; tooltip.add(spacing + _infoHeader); if (AllBlocks.STRESS_GAUGE.typeOf(state)) { @@ -261,6 +262,11 @@ public class GaugeInformationRenderer { } } + private static void addLeverTooltip(BlockState state, List tooltip, AnalogLeverTileEntity te) { + int leverState = te.getState(); + tooltip.add(spacing + Lang.translate("tooltip.analogStrength", leverState)); + } + private static String format(double d) { return decimalFormat.format(d); } diff --git a/src/main/resources/assets/create/lang/en_us.json b/src/main/resources/assets/create/lang/en_us.json index d3e4c9652..7a881dd14 100644 --- a/src/main/resources/assets/create/lang/en_us.json +++ b/src/main/resources/assets/create/lang/en_us.json @@ -310,7 +310,7 @@ "create.generic.unit.ticks": "Ticks", "create.generic.unit.seconds": "Seconds", "create.generic.unit.minutes": "Minutes", - "create.generic.unit.rpm": "rpm", + "create.generic.unit.rpm": "RPM", "create.generic.unit.stress": "su", "create.generic.unit.degrees": "°", @@ -607,6 +607,9 @@ "create.tooltip.capacityProvided.medium": "Medium", "create.tooltip.capacityProvided.high": "Large", "create.tooltip.capacityProvided.asGenerator": "(As Generator)", + "create.tooltip.generationSpeed" : "Generates at %1$s %2$s", + + "create.tooltip.analogStrength": "Analog Strength: %1$s/15", "create.tooltip.wip": "WIP", "create.tooltip.workInProgress": "Work in progress!", diff --git a/src/main/resources/data/forge/tags/blocks/stone.json b/src/main/resources/data/forge/tags/blocks/stone.json new file mode 100644 index 000000000..a891eebb6 --- /dev/null +++ b/src/main/resources/data/forge/tags/blocks/stone.json @@ -0,0 +1,16 @@ +{ + "replace": false, + "values": [ + "create:limestone", + "create:polished_limestone", + "create:weathered_limestone", + "create:polished_weathered_limestone", + "create:gabbro", + "create:polished_gabbro", + "create:dolomite", + "create:polished_dolomite", + "create:scoria", + "create:polished_scoria" + + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/blocks/storage_blocks.json b/src/main/resources/data/forge/tags/blocks/storage_blocks.json new file mode 100644 index 000000000..fe1a1db93 --- /dev/null +++ b/src/main/resources/data/forge/tags/blocks/storage_blocks.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "#forge:storage_blocks/copper" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/blocks/storage_blocks/copper.json b/src/main/resources/data/forge/tags/blocks/storage_blocks/copper.json new file mode 100644 index 000000000..0b5561d1f --- /dev/null +++ b/src/main/resources/data/forge/tags/blocks/storage_blocks/copper.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "create:copper_block" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/stone.json b/src/main/resources/data/forge/tags/items/stone.json new file mode 100644 index 000000000..a891eebb6 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/stone.json @@ -0,0 +1,16 @@ +{ + "replace": false, + "values": [ + "create:limestone", + "create:polished_limestone", + "create:weathered_limestone", + "create:polished_weathered_limestone", + "create:gabbro", + "create:polished_gabbro", + "create:dolomite", + "create:polished_dolomite", + "create:scoria", + "create:polished_scoria" + + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/storage_blocks.json b/src/main/resources/data/forge/tags/items/storage_blocks.json new file mode 100644 index 000000000..fe1a1db93 --- /dev/null +++ b/src/main/resources/data/forge/tags/items/storage_blocks.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "#forge:storage_blocks/copper" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/forge/tags/items/storage_blocks/copper.json b/src/main/resources/data/forge/tags/items/storage_blocks/copper.json new file mode 100644 index 000000000..0b5561d1f --- /dev/null +++ b/src/main/resources/data/forge/tags/items/storage_blocks/copper.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "create:copper_block" + ] +} \ No newline at end of file