Fix a bunch of te's dropping contents on state change

This commit is contained in:
Vincent Lee committed 2019-11-11 13:06:45 -06:00
1 parent 0898173bb2
commit 9c0b4ceac9
10 files changed
+57 -56

No files matched your search

@@ -207,11 +207,11 @@ public class BlockAltar extends BlockMod {
@Override
public void onReplaced(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState newState, boolean isMoving) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.onReplaced(state, world, pos, newState, isMoving);
if (state.getBlock() != newState.getBlock()) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.onReplaced(state, world, pos, newState, isMoving);
}
}
@Override
@@ -117,11 +117,11 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
@Override
public void onReplaced(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState newState, boolean isMoving) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.onReplaced(state, world, pos, newState, isMoving);
if (state.getBlock() != newState.getBlock()) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.onReplaced(state, world, pos, newState, isMoving);
}
}
@Nonnull
@@ -88,11 +88,11 @@ public class BlockSparkChanger extends BlockMod {
@Override
public void onReplaced(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState newState, boolean isMoving) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.onReplaced(state, world, pos, newState, isMoving);
if (state.getBlock() != newState.getBlock()) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.onReplaced(state, world, pos, newState, isMoving);
}
}
@Override
@@ -28,11 +28,11 @@ public abstract class BlockCorporeaBase extends BlockMod {
@Override
public void onReplaced(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState newState, boolean isMoving) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.onReplaced(state, world, pos, newState, isMoving);
if (state.getBlock() != newState.getBlock()) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.onReplaced(state, world, pos, newState, isMoving);
}
}
@Override
@@ -54,11 +54,11 @@ public class BlockTinyPotato extends BlockMod {
@Override
public void onReplaced(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState newState, boolean isMoving) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.onReplaced(state, world, pos, newState, isMoving);
if (state.getBlock() != newState.getBlock()) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.onReplaced(state, world, pos, newState, isMoving);
}
}
@Nonnull
@@ -77,11 +77,9 @@ public class BlockBrewery extends BlockMod implements IWandHUD {
public void onReplaced(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState newState, boolean isMoving) {
if(state.getBlock() != newState.getBlock()) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.onReplaced(state, world, pos, newState, isMoving);
}
super.onReplaced(state, world, pos, newState, isMoving);
}
@Override
@@ -91,15 +91,16 @@ public class BlockEnchanter extends BlockMod implements IWandable, IWandHUD {
@Override
public void onReplaced(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState newState, boolean isMoving) {
TileEnchanter enchanter = (TileEnchanter) world.getTileEntity(pos);
if (state.getBlock() != newState.getBlock()) {
TileEnchanter enchanter = (TileEnchanter) world.getTileEntity(pos);
if(!enchanter.itemToEnchant.isEmpty()) {
world.addEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), enchanter.itemToEnchant));
if(!enchanter.itemToEnchant.isEmpty()) {
world.addEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), enchanter.itemToEnchant));
}
world.updateComparatorOutputLevel(pos, state.getBlock());
super.onReplaced(state, world, pos, newState, isMoving);
}
world.updateComparatorOutputLevel(pos, state.getBlock());
super.onReplaced(state, world, pos, newState, isMoving);
}
@Override
@@ -106,11 +106,11 @@ public class BlockPrism extends BlockMod implements IManaTrigger, IManaCollision
@Override
public void onReplaced(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState newState, boolean isMoving) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.onReplaced(state, world, pos, newState, isMoving);
if (state.getBlock() != newState.getBlock()) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.onReplaced(state, world, pos, newState, isMoving);
}
}
@Override
@@ -79,11 +79,11 @@ public class BlockRuneAltar extends BlockMod implements IWandable {
@Override
public void onReplaced(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState newState, boolean isMoving) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.onReplaced(state, world, pos, newState, isMoving);
if (state.getBlock() != newState.getBlock()) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.onReplaced(state, world, pos, newState, isMoving);
}
}
@Override
@@ -143,20 +143,22 @@ public class BlockSpreader extends BlockMod implements IWandable, IWandHUD, IWir
@Override
public void onReplaced(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState newState, boolean isMoving) {
TileEntity tile = world.getTileEntity(pos);
if(!(tile instanceof TileSpreader))
return;
if (state.getBlock() != newState.getBlock()) {
TileEntity tile = world.getTileEntity(pos);
if(!(tile instanceof TileSpreader))
return;
TileSpreader inv = (TileSpreader) tile;
TileSpreader inv = (TileSpreader) tile;
if(inv.paddingColor != null) {
ItemStack padding = new ItemStack(ColorHelper.WOOL_MAP.get(inv.paddingColor));
world.addEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), padding));
if(inv.paddingColor != null) {
ItemStack padding = new ItemStack(ColorHelper.WOOL_MAP.get(inv.paddingColor));
world.addEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), padding));
}
InventoryHelper.dropInventory(inv, world, state, pos);
super.onReplaced(state, world, pos, newState, isMoving);
}
InventoryHelper.dropInventory(inv, world, state, pos);
super.onReplaced(state, world, pos, newState, isMoving);
}
@Override