From 282a9a6f3aff05b9bd6ab9b434d6413bec9d9af9 Mon Sep 17 00:00:00 2001 From: grimmauld Date: Sat, 10 Jul 2021 18:46:44 +0200 Subject: [PATCH] Fix valve handles not having a tooltip --- .../simibubi/create/foundation/item/ItemDescription.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 ea25a62e8..b9579d81d 100644 --- a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java +++ b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java @@ -22,10 +22,12 @@ import java.util.Arrays; import java.util.List; import java.util.Map; +import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.content.contraptions.base.IRotate; import com.simibubi.create.content.contraptions.base.IRotate.SpeedLevel; import com.simibubi.create.content.contraptions.base.IRotate.StressImpact; +import com.simibubi.create.content.contraptions.components.crank.ValveHandleBlock; import com.simibubi.create.content.contraptions.components.fan.EncasedFanBlock; import com.simibubi.create.content.contraptions.components.flywheel.engine.EngineBlock; import com.simibubi.create.content.contraptions.components.flywheel.engine.FurnaceEngineBlock; @@ -92,6 +94,7 @@ public class ItemDescription { List list = new ArrayList<>(); boolean isEngine = block instanceof EngineBlock; + boolean isHandle = block instanceof ValveHandleBlock; CKinetics config = AllConfigs.SERVER.kinetics; SpeedLevel minimumRequiredSpeedLevel = isEngine ? SpeedLevel.NONE : ((IRotate) block).getMinimumRequiredSpeedLevel(); @@ -101,7 +104,7 @@ public class ItemDescription { Map> capacities = config.stressValues.getCapacities(); boolean hasStressImpact = impacts.containsKey(id) && impacts.get(id) .get() > 0 && StressImpact.isEnabled(); - boolean hasStressCapacity = capacities.containsKey(id) && StressImpact.isEnabled(); + boolean hasStressCapacity = (isHandle || capacities.containsKey(id)) && StressImpact.isEnabled(); boolean hasGlasses = AllItems.GOGGLES.get() == Minecraft.getInstance().player.getItemStackFromSlot(EquipmentSlotType.HEAD) .getItem(); @@ -151,7 +154,7 @@ public class ItemDescription { if (hasStressCapacity) { List stressCapacityLevels = Lang.translatedOptions("tooltip.capacityProvided", "low", "medium", "high"); - double capacity = capacities.get(id) + double capacity = capacities.get(isHandle ? AllBlocks.HAND_CRANK.getId() : id) .get(); StressImpact impactId = capacity >= config.highCapacity.get() ? StressImpact.LOW : (capacity >= config.mediumCapacity.get() ? StressImpact.MEDIUM : StressImpact.HIGH);