Skip to content

Commit 58ecb4b

Browse files
committed
Fix NBT null crash
1 parent 562e2fd commit 58ecb4b

4 files changed

Lines changed: 12 additions & 2 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ btw_version = 3.1.0
66
yarn_mappings = 1.6.4+build.420
77
loader_version = 0.14.19
88

9-
mod_version = 1.0.0
9+
mod_version = 1.0.0-beta
1010
maven_group = net.dravigen
1111
archives_base_name = bu_toolkit
1212

src/main/java/net/dravigen/bu_toolkit/items/BuildingWand.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public BuildingWand(int iITemID, EnumToolMaterial material, int durability, int
5050

5151
@Override
5252
public void onCreated(ItemStack stack, World world, EntityPlayer player) {
53+
stack.setTagCompound(new NBTTagCompound());
5354
this.setMode(stack, 0);
5455
}
5556

src/main/java/net/dravigen/bu_toolkit/items/Trowel.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ public Trowel(int id, EnumToolMaterial material, int durability, int maxSize, St
2929
this.setItemRightClickCooldown(5);
3030
}
3131

32+
@Override
33+
public void onCreated(ItemStack stack, World world, EntityPlayer player) {
34+
super.onCreated(stack, world, player);
35+
36+
stack.setTagCompound(new NBTTagCompound());
37+
}
38+
3239
@Override
3340
public void onUpdate(ItemStack stack, World world, EntityPlayer player, int iInventorySlot,
3441
boolean bIsHandHeldItem) {

src/main/java/net/dravigen/bu_toolkit/mixin/client/EntityClientPlayerMPMx.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ private void entityTick(CallbackInfo ci) {
3333
Minecraft mc = this.mc;
3434

3535
if (stack != null && stack.getItem() instanceof CustomItemWithModes) {
36-
stack.getTagCompound().setInteger("modeChange", stack.getTagCompound().getInteger("modeChange") - 1);
36+
if (stack.getTagCompound() != null) {
37+
stack.getTagCompound().setInteger("modeChange", stack.getTagCompound().getInteger("modeChange") - 1);
38+
}
3739

3840
if (BU_Toolkit.modeSwitch.isPressed()) {
3941
if (!isPressed) {

0 commit comments

Comments
 (0)