Fix #877 TileStairs NullPointerException

This commit is contained in:
mezz committed 2015-10-08 18:06:23 -07:00
1 parent 141a1493a8
commit 4708ba94a8
2 files changed
+8 -8

No files matched your search

@@ -122,7 +122,7 @@ public class BlockArbStairs extends BlockStairs {
TileStairs stairs = getStairTile(world, x, y, z);
NBTTagCompound nbttagcompound = new NBTTagCompound();
if (stairs == null || stairs.getWoodType() == null) {
if (stairs == null) {
return nbttagcompound;
}
@@ -141,7 +141,7 @@ public class BlockArbStairs extends BlockStairs {
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
TileStairs stairs = getStairTile(world, x, y, z);
if (stairs != null && stairs.getWoodType() != null) {
if (stairs != null) {
return stairs.getWoodType().getPlankIcon();
} else {
return WoodType.LARCH.getPlankIcon();
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.arboriculture.gadgets;
import javax.annotation.Nonnull;
import java.io.IOException;
import net.minecraft.nbt.NBTTagCompound;
@@ -25,13 +26,15 @@ import forestry.core.proxy.Proxies;
public class TileStairs extends TileEntity implements IStreamable {
private WoodType woodType;
@Nonnull
private WoodType woodType = WoodType.LARCH;
@Nonnull
public WoodType getWoodType() {
return this.woodType;
}
public void setWoodType(WoodType woodType) {
public void setWoodType(@Nonnull WoodType woodType) {
this.woodType = woodType;
sendNetworkUpdate();
}
@@ -49,10 +52,7 @@ public class TileStairs extends TileEntity implements IStreamable {
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
if (woodType != null) {
nbttagcompound.setShort("WT", (short) woodType.ordinal());
}
nbttagcompound.setShort("WT", (short) woodType.ordinal());
}
/* UPDATING */