-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrated soft tools using the new ExtraToolProperty
- Loading branch information
1 parent
b180442
commit 05e56fc
Showing
4 changed files
with
95 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/gregtech/api/unification/material/materials/SoftToolAddition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package gregtech.api.unification.material.materials; | ||
|
||
import gregtech.api.items.toolitem.ToolClasses; | ||
import gregtech.api.recipes.ModHandler; | ||
import gregtech.api.unification.material.properties.ExtraToolProperty; | ||
import gregtech.api.unification.material.properties.PropertyKey; | ||
|
||
import gregtech.api.unification.material.Material; | ||
import gregtech.api.unification.material.Materials; | ||
|
||
public class SoftToolAddition { | ||
|
||
public static final Material[] softMaterials = new Material[] { | ||
Materials.Wood, Materials.Rubber, Materials.Polyethylene, | ||
Materials.Polytetrafluoroethylene, Materials.Polybenzimidazole | ||
}; | ||
|
||
private static ExtraToolProperty ensureExtraToolProperty(Material material) { | ||
if (material.getProperty(PropertyKey.EXTRATOOL) == null) | ||
material.setProperty(PropertyKey.EXTRATOOL, new ExtraToolProperty()); | ||
return material.getProperty(PropertyKey.EXTRATOOL); | ||
} | ||
|
||
|
||
public static void register() { | ||
for (int i = 0; i < softMaterials.length; i++) { | ||
|
||
Material material = softMaterials[i]; | ||
|
||
if (ModHandler.isMaterialWood(material)) { | ||
ensureExtraToolProperty(material).setOverrideProperty(ToolClasses.SOFT_MALLET, | ||
ExtraToolProperty.Builder.of(4F, 1F, 48, 1).build()); | ||
} else { | ||
ExtraToolProperty extraToolProperty = ensureExtraToolProperty(material); | ||
extraToolProperty.setOverrideProperty(ToolClasses.SOFT_MALLET, | ||
ExtraToolProperty.Builder.of(4F, 1F, 128 * (1 << i), 1).build()); | ||
extraToolProperty.setOverrideProperty(ToolClasses.PLUNGER, | ||
ExtraToolProperty.Builder.of(4F, 0F, 128 * (1 << i), 1).build()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters