mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-02-21 21:42:28 +00:00
Retain names for storage crates
This commit is contained in:
parent
7ef016ccce
commit
169f1666e7
@ -157,19 +157,26 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT
|
|||||||
|
|
||||||
if(!nbt.hasNoTags()) {
|
if(!nbt.hasNoTags()) {
|
||||||
drop.stackTagCompound = nbt;
|
drop.stackTagCompound = nbt;
|
||||||
|
|
||||||
try {
|
|
||||||
byte[] abyte = CompressedStreamTools.compress(nbt);
|
|
||||||
|
|
||||||
if(abyte.length > 6000) {
|
|
||||||
player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "Warning: Container NBT exceeds 6kB, contents will be ejected!"));
|
|
||||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(this)));
|
|
||||||
return world.setBlockToAir(x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch(IOException e) { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(inv instanceof TileEntityCrateBase) {
|
||||||
|
TileEntityCrateBase crate = (TileEntityCrateBase) inv;
|
||||||
|
if (crate.hasCustomInventoryName()) {
|
||||||
|
drop.setStackDisplayName(crate.getInventoryName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
byte[] abyte = CompressedStreamTools.compress(drop.stackTagCompound);
|
||||||
|
|
||||||
|
if(abyte.length > 6000) {
|
||||||
|
player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "Warning: Container NBT exceeds 6kB, contents will be ejected!"));
|
||||||
|
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(this)));
|
||||||
|
return world.setBlockToAir(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch(IOException e) { }
|
||||||
|
|
||||||
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, drop));
|
world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, drop));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,8 +227,14 @@ public class BlockStorageCrate extends BlockContainer implements IBlockMulti, IT
|
|||||||
lockable.lock();
|
lockable.lock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(inv instanceof TileEntityCrateBase) {
|
if(inv instanceof TileEntityCrateBase) {
|
||||||
((TileEntityCrateBase) inv).hasSpiders = stack.stackTagCompound.getBoolean("spiders");
|
TileEntityCrateBase crate = (TileEntityCrateBase) inv;
|
||||||
|
crate.hasSpiders = stack.stackTagCompound.getBoolean("spiders");
|
||||||
|
|
||||||
|
if (stack.hasDisplayName()) {
|
||||||
|
crate.setCustomName(stack.getDisplayName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user