mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2026-11-28 18:13:09 +00:00
Add some tests for new turtle tool functionality
- Normalise upgrade keys, to be "allowEnchantments" and "consumeDurability". We were previously inconsistent with allow/allows and consumes. - Add tests for durability and enchantments of pickaxes. - Fix a couple of issues with the original upgrade NBT being modified. - Now store the item's tag under a separate key rather than on the root. This makes syncing the NBT between the two much nicer.
This commit is contained in:
11 files changed
+548
-36
No files matched your search
+1
-1
@@ -11,7 +11,7 @@ import net.minecraft.world.item.ItemStack;
|
||||
/**
|
||||
* Indicates if an equipped turtle item will consume durability.
|
||||
*
|
||||
* @see TurtleUpgradeDataProvider.ToolBuilder#consumesDurability(TurtleToolDurability)
|
||||
* @see TurtleUpgradeDataProvider.ToolBuilder#consumeDurability(TurtleToolDurability)
|
||||
*/
|
||||
public enum TurtleToolDurability implements StringRepresentable {
|
||||
/**
|
||||
|
||||
+5
-5
@@ -64,7 +64,7 @@ public abstract class TurtleUpgradeDataProvider extends UpgradeDataProvider<ITur
|
||||
private @Nullable Float damageMultiplier = null;
|
||||
private @Nullable TagKey<Block> breakable;
|
||||
private boolean allowEnchantments = false;
|
||||
private TurtleToolDurability consumesDurability = TurtleToolDurability.NEVER;
|
||||
private TurtleToolDurability consumeDurability = TurtleToolDurability.NEVER;
|
||||
|
||||
ToolBuilder(ResourceLocation id, TurtleUpgradeSerialiser<?> serialiser, Item toolItem) {
|
||||
this.id = id;
|
||||
@@ -125,8 +125,8 @@ public abstract class TurtleUpgradeDataProvider extends UpgradeDataProvider<ITur
|
||||
* @param durability The durability predicate.
|
||||
* @return The tool builder, for further use.
|
||||
*/
|
||||
public ToolBuilder consumesDurability(TurtleToolDurability durability) {
|
||||
consumesDurability = durability;
|
||||
public ToolBuilder consumeDurability(TurtleToolDurability durability) {
|
||||
consumeDurability = durability;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -159,8 +159,8 @@ public abstract class TurtleUpgradeDataProvider extends UpgradeDataProvider<ITur
|
||||
if (damageMultiplier != null) s.addProperty("damageMultiplier", damageMultiplier);
|
||||
if (breakable != null) s.addProperty("breakable", breakable.location().toString());
|
||||
if (allowEnchantments) s.addProperty("allowEnchantments", true);
|
||||
if (consumesDurability != TurtleToolDurability.NEVER) {
|
||||
s.addProperty("consumesDurability", consumesDurability.getSerializedName());
|
||||
if (consumeDurability != TurtleToolDurability.NEVER) {
|
||||
s.addProperty("consumeDurability", consumeDurability.getSerializedName());
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user