Skip to content

Commit

Permalink
Electric Wirecutter (#2404)
Browse files Browse the repository at this point in the history
(cherry picked from commit 4e47ef8)
  • Loading branch information
serenibyss authored and ALongStringOfNumbers committed Apr 24, 2024
1 parent 29abb94 commit bfe55f0
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/main/java/gregtech/common/items/ToolItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public final class ToolItems {
public static IGTTool BUZZSAW;
public static IGTTool SCREWDRIVER_LV;
public static IGTTool PLUNGER;
public static IGTTool WIRECUTTER_LV;
public static IGTTool WIRECUTTER_HV;
public static IGTTool WIRECUTTER_IV;

private ToolItems() {/**/}

Expand Down Expand Up @@ -319,6 +322,36 @@ public static void init() {
.oreDict(ToolOreDict.toolPlunger)
.toolClasses(ToolClasses.PLUNGER)
.markerItem(() -> ToolHelper.getAndSetToolData(PLUNGER, Materials.Rubber, 255, 1, 4F, 0F)));
WIRECUTTER_LV = register(ItemGTTool.Builder.of(GTValues.MODID, "wire_cutter_lv")
.toolStats(b -> b.blockBreaking().crafting().damagePerCraftingAction(4)
.efficiencyMultiplier(2.0F)
.attackDamage(-1.0F).attackSpeed(-2.4F)
.brokenStack(ToolHelper.SUPPLY_POWER_UNIT_LV))
.sound(GTSoundEvents.WIRECUTTER_TOOL, true)
.oreDict(ToolOreDict.toolWireCutter)
.secondaryOreDicts("craftingToolWireCutter")
.toolClasses(ToolClasses.WIRE_CUTTER)
.electric(GTValues.LV));
WIRECUTTER_HV = register(ItemGTTool.Builder.of(GTValues.MODID, "wire_cutter_hv")
.toolStats(b -> b.blockBreaking().crafting().damagePerCraftingAction(4)
.efficiencyMultiplier(3.0F)
.attackDamage(-1.0F).attackSpeed(-2.4F)
.brokenStack(ToolHelper.SUPPLY_POWER_UNIT_LV))
.sound(GTSoundEvents.WIRECUTTER_TOOL, true)
.oreDict(ToolOreDict.toolWireCutter)
.secondaryOreDicts("craftingToolWireCutter")
.toolClasses(ToolClasses.WIRE_CUTTER)
.electric(GTValues.HV));
WIRECUTTER_IV = register(ItemGTTool.Builder.of(GTValues.MODID, "wire_cutter_iv")
.toolStats(b -> b.blockBreaking().crafting().damagePerCraftingAction(4)
.efficiencyMultiplier(4.0F)
.attackDamage(-1.0F).attackSpeed(-2.4F)
.brokenStack(ToolHelper.SUPPLY_POWER_UNIT_LV))
.sound(GTSoundEvents.WIRECUTTER_TOOL, true)
.oreDict(ToolOreDict.toolWireCutter)
.secondaryOreDicts("craftingToolWireCutter")
.toolClasses(ToolClasses.WIRE_CUTTER)
.electric(GTValues.IV));
}

public static IGTTool register(@NotNull ToolBuilder<?> builder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ private static void processElectricTool(OrePrefix prefix, Material material, Too
.EUt(8 * voltageMultiplier)
.buildAndRegister();
}

// wirecutter
addElectricWirecutterRecipe(material,
new IGTTool[] { ToolItems.WIRECUTTER_LV, ToolItems.WIRECUTTER_HV, ToolItems.WIRECUTTER_IV });
}

// screwdriver
Expand Down Expand Up @@ -316,6 +320,21 @@ public static void addElectricToolRecipe(OrePrefix toolHead, Material material,
}
}

public static void addElectricWirecutterRecipe(Material material, IGTTool[] toolItems) {
for (IGTTool toolItem : toolItems) {
int tier = toolItem.getElectricTier();
ItemStack powerUnitStack = powerUnitItems.get(tier).getStackForm();
IElectricItem powerUnit = powerUnitStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
ItemStack tool = toolItem.get(material, 0, powerUnit.getMaxCharge());
ModHandler.addShapedEnergyTransferRecipe(String.format("%s_%s", toolItem.getToolId(), material), tool,
Ingredient.fromStacks(powerUnitStack), true, true,
"PfP", "hPd", "RUR",
'P', new UnificationEntry(OrePrefix.plate, material),
'U', powerUnitStack,
'R', new UnificationEntry(OrePrefix.stick, material));
}
}

public static void addToolRecipe(@NotNull Material material, @NotNull IGTTool tool, boolean mirrored,
Object... recipe) {
if (mirrored) {
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/assets/gregtech/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,9 @@ item.gt.tool.screwdriver_lv.name=%s Screwdriver (LV)
item.gt.tool.screwdriver_lv.tooltip=§8Adjusts Covers and Machines
item.gt.tool.plunger.name=%s Plunger
item.gt.tool.plunger.tooltip=§8Removes Fluids from Machines
item.gt.tool.wire_cutter_lv.name=%s Wire Cutter (LV)
item.gt.tool.wire_cutter_hv.name=%s Wire Cutter (HV)
item.gt.tool.wire_cutter_iv.name=%s Wire Cutter (IV)


item.gt.tool.tooltip.crafting_uses=§a%s Crafting Uses
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "gregtech:items/material_sets/dull/tool_head_wire_cutter"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "item/handheld",
"textures": {
"layer0": "gregtech:items/tools/handle_electric_wire_cutter_hv",
"layer1": "gregtech:items/tools/wire_cutter_electric"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "item/handheld",
"textures": {
"layer0": "gregtech:items/tools/handle_electric_wire_cutter_iv",
"layer1": "gregtech:items/tools/wire_cutter_electric"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "item/handheld",
"textures": {
"layer0": "gregtech:items/tools/handle_electric_wire_cutter_lv",
"layer1": "gregtech:items/tools/wire_cutter_electric"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bfe55f0

Please sign in to comment.