Skip to content
Merged

Mace #37

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private void renderItem(float offset, MatrixStack matrices, VertexConsumerProvid
}
}
if (!bl) {
final int i = ConfigHandler.getToolOrientation(this.mainStack.getItem());
final float i = ConfigHandler.getToolOrientation(this.mainStack.getItem());
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(i));
}
if (ConfigHandler.isBeltTool(this.mainStack.getItem())) {
Expand Down Expand Up @@ -107,7 +107,7 @@ private void renderItem(float offset, MatrixStack matrices, VertexConsumerProvid
}
}
if (!isShield) {
final int i = ConfigHandler.getToolOrientation(this.mainStack.getItem());
final float i = ConfigHandler.getToolOrientation(this.mainStack.getItem());
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(i));
}
if (age > 0) {
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/com/daniking/backtools/BackToolsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ public class BackToolsConfig implements ConfigData {
@Comment(value = "Disabled tools, by their resource name. Eg: minecraft:diamond_hoe")
public List<String> disabledTools = new ArrayList<>();
@Comment(value = "Tool orientation, by class file and degrees. Separate with \":\" . See defaults for examples.")
public List<String> toolOrientation = Arrays.asList("net.minecraft.item.ToolItem" + ":0", "net.minecraft.item.HoeItem" + ":0", "net.minecraft.item.FishingRodItem" + ":0", "net.minecraft.item.TridentItem" + ":0", "net.minecraft.item.RangedWeaponItem" + ":90");
public List<String> toolOrientation = Arrays.asList(
"net.minecraft.item.MiningToolItem" + ":0",
"net.minecraft.item.HoeItem" + ":0",
"net.minecraft.item.FishingRodItem" + ":0",
"net.minecraft.item.TridentItem" + ":0",
"net.minecraft.item.MaceItem" + ":-22.5",
"net.minecraft.item.RangedWeaponItem" + ":90");
@Comment(value = "Get in swimming position and your tools go \"Weeee\"")
public boolean helicopterMode = false;
@Comment(value = "If true, tools render with capes")
Expand Down
19 changes: 14 additions & 5 deletions src/main/java/com/daniking/backtools/ConfigHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@

@Environment(EnvType.CLIENT)
public class ConfigHandler {
private static final HashMap<Class<?>, Integer> TOOL_ORIENTATIONS = new HashMap<>();
private static final HashMap<Class<?>, Float> TOOL_ORIENTATIONS = new HashMap<>();
private static final HashSet<Identifier> ENABLED_TOOLS = new HashSet<>();
private static final Set<Identifier> DISABLED_TOOLS = new HashSet<>();
private static boolean HELICOPTER_MODE = false;
private static boolean RENDER_WITH_CAPES = true;
public static final HashSet<Identifier> BELT_TOOLS = new HashSet<>();

public static int getToolOrientation(@NotNull Item item) {
public static float getToolOrientation(@NotNull Item item) {
return getToolOrientation(item.getClass());
}

public static int getToolOrientation(@NotNull Class<?> object) {
public static float getToolOrientation(@NotNull Class<?> object) {
if (object.equals(Item.class)) {
return 0;
}
Expand All @@ -47,7 +47,16 @@ public static boolean isItemEnabled(final Item item) {
return false;
}
//else allow default items
return item instanceof MiningToolItem || item instanceof SwordItem || item instanceof ShieldItem || item instanceof TridentItem || item instanceof BowItem || item instanceof ShearsItem || item instanceof CrossbowItem || item instanceof FishingRodItem;
return item instanceof SwordItem ||
item instanceof TridentItem ||
item instanceof BowItem ||
item instanceof CrossbowItem ||
item instanceof MaceItem ||
item instanceof ShieldItem ||
item instanceof MiningToolItem ||
item instanceof ShearsItem ||
item instanceof FishingRodItem;

}

public static boolean isBeltTool(final Item item) {
Expand Down Expand Up @@ -101,7 +110,7 @@ private static void parseOrientation() {
if (path != null) {
try {
if (Item.class.isAssignableFrom(path)) {
TOOL_ORIENTATIONS.put(path, Integer.parseInt(split[1]));
TOOL_ORIENTATIONS.put(path, Float.parseFloat(split[1]));
} else {
BackTools.LOGGER.error("[CONFIG_FILE]: Invalid Tool class file: {}", split[0]);
}
Expand Down
Loading