Skip to content

Commit

Permalink
remove bugged PlacedItem tile entities properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexdoru committed Oct 24, 2024
1 parent d829c2f commit e7f9fad
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.brandon3055.draconicevolution.common.tileentities;

import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
Expand All @@ -9,6 +10,7 @@
import net.minecraft.util.Vec3;

import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.utills.LogHelper;

/**
* Created by Brandon on 14/08/2014.
Expand Down Expand Up @@ -67,10 +69,14 @@ public void readFromNBT(NBTTagCompound compound) {
tag[0] = compound.getCompoundTag("Item" + 0);
stack = ItemStack.loadItemStackFromNBT(tag[0]);
if (stack == null) {
throw new NullPointerException(
// the stack can be null if the placed item was
// an item that got removed in between mod updates
stack = new ItemStack(Blocks.stone);
this.invalidate();
LogHelper.error(
"Cannot load the Placed Item at location "
+ Vec3.createVectorHelper(this.xCoord, this.yCoord, this.zCoord)
+ " because the associated item is null!");
+ " because the associated item is null, it will be removed.");
}
rotation = compound.getFloat("Rotation");
}
Expand Down

0 comments on commit e7f9fad

Please sign in to comment.