mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Fixed a couple of things.
Hopefully all works now. >_>
This commit is contained in:
parent
4144f03d14
commit
e9fa9bca92
4 changed files with 30 additions and 9 deletions
|
@ -76,7 +76,10 @@ public class BlockGiantChest extends BlockContainerBase{
|
|||
ItemStack[] slots = ((TileEntityGiantChest)tile).slots;
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++){
|
||||
slots[i] = ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i));
|
||||
NBTTagCompound compound = list.getCompoundTagAt(i);
|
||||
if(compound != null && compound.hasKey("id")){
|
||||
slots[i] = ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,10 +48,16 @@ public class WorldData{
|
|||
int dim = world.provider.getDimension();
|
||||
WorldData data = worldData.get(dim);
|
||||
|
||||
if(data == null && world.isRemote){
|
||||
if(data == null){
|
||||
data = new WorldData(null, dim);
|
||||
worldData.put(dim, data);
|
||||
ModUtil.LOGGER.info("Creating temporary WorldData for world "+dim+" on the client!");
|
||||
|
||||
if(world.isRemote){
|
||||
worldData.put(dim, data);
|
||||
ModUtil.LOGGER.info("Creating temporary WorldData for world "+dim+" on the client!");
|
||||
}
|
||||
else{
|
||||
ModUtil.LOGGER.warn("Trying to get WorldData from world "+dim+" that doesn't have any data!? This shouldn't happen!");
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
|
|
|
@ -59,9 +59,11 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
|||
NBTTagList tagList = compound.getTagList("Items", 10);
|
||||
for(int i = 0; i < tagList.tagCount(); i++){
|
||||
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
|
||||
byte slotIndex = tagCompound.getByte("Slot");
|
||||
if(slotIndex >= 0 && slotIndex < slots.length){
|
||||
slots[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound);
|
||||
if(tagCompound != null && tagCompound.hasKey("id")){
|
||||
byte slotIndex = tagCompound.getByte("Slot");
|
||||
if(slotIndex >= 0 && slotIndex < slots.length){
|
||||
slots[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -340,8 +340,16 @@ public class WorldUtil{
|
|||
* @return If the Block could be harvested normally (so that it drops an item)
|
||||
*/
|
||||
public static boolean playerHarvestBlock(World world, BlockPos pos, EntityPlayer player){
|
||||
Block block = PosUtil.getBlock(pos, world);
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
if(state == null){
|
||||
return false;
|
||||
}
|
||||
|
||||
Block block = state.getBlock();
|
||||
if(block == null){
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
|
||||
|
@ -351,7 +359,8 @@ public class WorldUtil{
|
|||
//Send Block Breaking Event
|
||||
int xp = -1;
|
||||
if(player instanceof EntityPlayerMP){
|
||||
xp = ForgeHooks.onBlockBreakEvent(world, ((EntityPlayerMP)player).interactionManager.getGameType(), (EntityPlayerMP)player, pos);
|
||||
EntityPlayerMP playerMP = (EntityPlayerMP)player;
|
||||
xp = ForgeHooks.onBlockBreakEvent(world, playerMP.interactionManager.getGameType(), playerMP, pos);
|
||||
if(xp == -1){
|
||||
return false;
|
||||
}
|
||||
|
@ -397,6 +406,7 @@ public class WorldUtil{
|
|||
//Check the Server if a Block that changed on the Client really changed, if not, revert the change
|
||||
Minecraft.getMinecraft().getConnection().sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.STOP_DESTROY_BLOCK, pos, Minecraft.getMinecraft().objectMouseOver.sideHit));
|
||||
}
|
||||
|
||||
return removed;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue