Add wrench to wrench tag

- Fix stress capacity tooltip
This commit is contained in:
PepperCode1 2022-05-27 17:58:56 -07:00
parent 799ebb9fa0
commit 97da6be27f
7 changed files with 31 additions and 21 deletions

View file

@ -5258,6 +5258,7 @@ dc96331cded39b2d2f24853f4dd6c1f6f3863115 data/forge/tags/items/raw_materials/zin
ff1900963bc4cd8ceffa78d58ef1952ceacb2fb7 data/forge/tags/items/storage_blocks/brass.json ff1900963bc4cd8ceffa78d58ef1952ceacb2fb7 data/forge/tags/items/storage_blocks/brass.json
823d05187626797205381d4620a84abda3bc8f89 data/forge/tags/items/storage_blocks/raw_zinc.json 823d05187626797205381d4620a84abda3bc8f89 data/forge/tags/items/storage_blocks/raw_zinc.json
7f71a774800111e50b42de0e6159ed2d2a807d32 data/forge/tags/items/storage_blocks/zinc.json 7f71a774800111e50b42de0e6159ed2d2a807d32 data/forge/tags/items/storage_blocks/zinc.json
e002dfedc5e8762de0f97ea1f3fa546e92e748ae data/forge/tags/items/tools/wrench.json
2db7759fe036160c14c6ed19a68604ca16f4de60 data/minecraft/tags/blocks/azalea_root_replaceable.json 2db7759fe036160c14c6ed19a68604ca16f4de60 data/minecraft/tags/blocks/azalea_root_replaceable.json
9f7a428085b1aac66da32a43e9d51c7efc1f0d81 data/minecraft/tags/blocks/beacon_base_blocks.json 9f7a428085b1aac66da32a43e9d51c7efc1f0d81 data/minecraft/tags/blocks/beacon_base_blocks.json
2db7759fe036160c14c6ed19a68604ca16f4de60 data/minecraft/tags/blocks/dripstone_replaceable_blocks.json 2db7759fe036160c14c6ed19a68604ca16f4de60 data/minecraft/tags/blocks/dripstone_replaceable_blocks.json

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"create:wrench"
]
}

View file

@ -274,6 +274,7 @@ public class AllItems {
public static final ItemEntry<WrenchItem> WRENCH = REGISTRATE.item("wrench", WrenchItem::new) public static final ItemEntry<WrenchItem> WRENCH = REGISTRATE.item("wrench", WrenchItem::new)
.properties(p -> p.stacksTo(1)) .properties(p -> p.stacksTo(1))
.model(AssetLookup.itemModelWithPartials()) .model(AssetLookup.itemModelWithPartials())
.tag(AllItemTags.WRENCH.tag)
.register(); .register();
public static final ItemEntry<MinecartContraptionItem> MINECART_CONTRAPTION = public static final ItemEntry<MinecartContraptionItem> MINECART_CONTRAPTION =

View file

@ -2,6 +2,8 @@ package com.simibubi.create;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
import com.mojang.blaze3d.platform.InputConstants;
import net.minecraft.client.KeyMapping; import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.Screen;
@ -58,15 +60,15 @@ public enum AllKeys {
} }
public static boolean isKeyDown(int key) { public static boolean isKeyDown(int key) {
return GLFW.glfwGetKey(Minecraft.getInstance() return InputConstants.isKeyDown(Minecraft.getInstance()
.getWindow() .getWindow()
.getWindow(), key) != 0; .getWindow(), key);
} }
public static boolean isMouseButtonDown(int button){ public static boolean isMouseButtonDown(int button) {
return GLFW.glfwGetMouseButton(Minecraft.getInstance() return GLFW.glfwGetMouseButton(Minecraft.getInstance()
.getWindow() .getWindow()
.getWindow(), button) != 0; .getWindow(), button) == 1;
} }
public static boolean ctrlDown() { public static boolean ctrlDown() {

View file

@ -201,7 +201,8 @@ public class AllTags {
VALVE_HANDLES, VALVE_HANDLES,
BEACON_PAYMENT(FORGE), BEACON_PAYMENT(FORGE),
PLATES(FORGE) PLATES(FORGE),
WRENCH(FORGE, "tools/wrench")
; ;

View file

@ -6,14 +6,13 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
import com.simibubi.create.AllKeys;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
import com.mojang.blaze3d.platform.InputConstants; import com.mojang.blaze3d.platform.InputConstants;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.AllKeys;
import com.simibubi.create.AllSoundEvents; import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.CreateClient; import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.item.TooltipHelper;
@ -118,10 +117,12 @@ public class LinkedControllerClientHandler {
} }
protected static boolean isActuallyPressed(KeyMapping kb) { protected static boolean isActuallyPressed(KeyMapping kb) {
if(kb.matchesMouse(kb.getKey().getValue())) InputConstants.Key key = kb.getKey();
return AllKeys.isMouseButtonDown(kb.getKey().getValue()); if (key.getType() == InputConstants.Type.MOUSE) {
else return AllKeys.isMouseButtonDown(key.getValue());
return AllKeys.isKeyDown(kb.getKey().getValue()); } else {
return AllKeys.isKeyDown(key.getValue());
}
} }
public static void tick() { public static void tick() {

View file

@ -107,9 +107,8 @@ public class ItemDescription {
boolean hasStressCapacity = StressImpact.isEnabled() && BlockStressValues.hasCapacity(block); boolean hasStressCapacity = StressImpact.isEnabled() && BlockStressValues.hasCapacity(block);
if (hasSpeedRequirement) { if (hasSpeedRequirement) {
int index = minimumRequiredSpeedLevel.ordinal();
MutableComponent level = MutableComponent level =
new TextComponent(makeProgressBar(3, index)).withStyle(minimumRequiredSpeedLevel.getTextColor()); new TextComponent(makeProgressBar(3, minimumRequiredSpeedLevel.ordinal())).withStyle(minimumRequiredSpeedLevel.getTextColor());
if (hasGoggles) if (hasGoggles)
level.append(String.valueOf(minimumRequiredSpeedLevel.getSpeedValue())) level.append(String.valueOf(minimumRequiredSpeedLevel.getSpeedValue()))
@ -127,9 +126,8 @@ public class ItemDescription {
double impact = BlockStressValues.getImpact(block); double impact = BlockStressValues.getImpact(block);
StressImpact impactId = impact >= config.highStressImpact.get() ? StressImpact.HIGH StressImpact impactId = impact >= config.highStressImpact.get() ? StressImpact.HIGH
: (impact >= config.mediumStressImpact.get() ? StressImpact.MEDIUM : StressImpact.LOW); : (impact >= config.mediumStressImpact.get() ? StressImpact.MEDIUM : StressImpact.LOW);
int index = impactId.ordinal();
MutableComponent level = MutableComponent level =
new TextComponent(makeProgressBar(3, index + 1)).withStyle(impactId.getAbsoluteColor()); new TextComponent(makeProgressBar(3, impactId.ordinal() + 1)).withStyle(impactId.getAbsoluteColor());
if (hasGoggles) if (hasGoggles)
level.append(impact + "x ") level.append(impact + "x ")
@ -144,17 +142,17 @@ public class ItemDescription {
if (hasStressCapacity) { if (hasStressCapacity) {
double capacity = BlockStressValues.getCapacity(block); double capacity = BlockStressValues.getCapacity(block);
StressImpact impactId = capacity >= config.highCapacity.get() ? StressImpact.LOW StressImpact impactId = capacity >= config.highCapacity.get() ? StressImpact.HIGH
: (capacity >= config.mediumCapacity.get() ? StressImpact.MEDIUM : StressImpact.HIGH); : (capacity >= config.mediumCapacity.get() ? StressImpact.MEDIUM : StressImpact.LOW);
int index = StressImpact.values().length - 2 - impactId.ordinal(); StressImpact opposite = StressImpact.values()[StressImpact.values().length - 2 - impactId.ordinal()];
MutableComponent level = MutableComponent level =
new TextComponent(makeProgressBar(3, index + 1)).withStyle(impactId.getAbsoluteColor()); new TextComponent(makeProgressBar(3, impactId.ordinal() + 1)).withStyle(opposite.getAbsoluteColor());
if (hasGoggles) if (hasGoggles)
level.append(capacity + "x ") level.append(capacity + "x ")
.append(rpmUnit); .append(rpmUnit);
else else
level.append(Lang.translate("tooltip.capacityProvided." + Lang.asId(impactId.name()))); level.append(Lang.translate("tooltip.capacityProvided." + Lang.asId(opposite.name())));
// if (!isEngine && ((IRotate) block).showCapacityWithAnnotation()) // if (!isEngine && ((IRotate) block).showCapacityWithAnnotation())
// level += // level +=