Repatch missed hasTileEntity redirects. And cleanup related patches. Closes #5369

This commit is contained in:
LexManos committed 2019-01-25 13:11:06 -08:00
1 parent d04df43b27
commit 7a651b8c1f
16 files changed
+307 -761

No files matched your search

@@ -190,6 +190,7 @@ public interface IForgeBlock
* @param state State of the current block
* @return True if block has a tile entity, false otherwise
*/
@SuppressWarnings("deprecation")
default boolean hasTileEntity(IBlockState state)
{
return this instanceof ITileEntityProvider;
@@ -204,6 +205,7 @@ public interface IForgeBlock
* @param world The world to create the TE in
* @return A instance of a class extending TileEntity
*/
@SuppressWarnings("deprecation")
@Nullable
default TileEntity createTileEntity(IBlockState state, IBlockReader world)
{
@@ -51,7 +51,7 @@ public class VanillaInventoryCodeHooks
return getItemHandler(dest, EnumFacing.UP)
.map(itemHandlerResult -> {
IItemHandler handler = itemHandlerResult.getKey();
for (int i = 0; i < handler.getSlots(); i++)
{
ItemStack extractItem = handler.extractItem(i, 1, true);
@@ -76,7 +76,7 @@ public class VanillaInventoryCodeHooks
}
}
}
return false;
})
.orElse(null); // TODO bad null
@@ -95,7 +95,7 @@ public class VanillaInventoryCodeHooks
Object destination = destinationResult.getValue();
ItemStack dispensedStack = stack.copy().split(1);
ItemStack remainder = putStackInInventoryAllSlots(dropper, destination, itemHandler, dispensedStack);
if (remainder.isEmpty())
{
remainder = stack.copy();
@@ -105,7 +105,7 @@ public class VanillaInventoryCodeHooks
{
remainder = stack.copy();
}
dropper.setInventorySlotContents(slot, remainder);
return false;
})
@@ -135,16 +135,16 @@ public class VanillaInventoryCodeHooks
ItemStack originalSlotContents = hopper.getStackInSlot(i).copy();
ItemStack insertStack = hopper.decrStackSize(i, 1);
ItemStack remainder = putStackInInventoryAllSlots(hopper, destination, itemHandler, insertStack);
if (remainder.isEmpty())
{
return true;
}
hopper.setInventorySlotContents(i, originalSlotContents);
}
}
return false;
}
})
@@ -253,9 +253,8 @@ public class VanillaInventoryCodeHooks
int k = MathHelper.floor(z);
BlockPos blockpos = new BlockPos(i, j, k);
net.minecraft.block.state.IBlockState state = worldIn.getBlockState(blockpos);
Block block = state.getBlock();
if (block.hasTileEntity(/* TODO Block patches // state */))
if (state.hasTileEntity())
{
TileEntity tileentity = worldIn.getTileEntity(blockpos);
if (tileentity != null)