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
823d05187626797205381d4620a84abda3bc8f89 data/forge/tags/items/storage_blocks/raw_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
9f7a428085b1aac66da32a43e9d51c7efc1f0d81 data/minecraft/tags/blocks/beacon_base_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)
.properties(p -> p.stacksTo(1))
.model(AssetLookup.itemModelWithPartials())
.tag(AllItemTags.WRENCH.tag)
.register();
public static final ItemEntry<MinecartContraptionItem> MINECART_CONTRAPTION =

View file

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

View file

@ -201,7 +201,8 @@ public class AllTags {
VALVE_HANDLES,
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.Vector;
import com.simibubi.create.AllKeys;
import org.lwjgl.glfw.GLFW;
import com.mojang.blaze3d.platform.InputConstants;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllKeys;
import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.item.TooltipHelper;
@ -118,10 +117,12 @@ public class LinkedControllerClientHandler {
}
protected static boolean isActuallyPressed(KeyMapping kb) {
if(kb.matchesMouse(kb.getKey().getValue()))
return AllKeys.isMouseButtonDown(kb.getKey().getValue());
else
return AllKeys.isKeyDown(kb.getKey().getValue());
InputConstants.Key key = kb.getKey();
if (key.getType() == InputConstants.Type.MOUSE) {
return AllKeys.isMouseButtonDown(key.getValue());
} else {
return AllKeys.isKeyDown(key.getValue());
}
}
public static void tick() {

View file

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