You can decompose the fluid storage disk with count < 0, #520

This commit is contained in:
Raoul Van den Berge
2016-11-04 14:24:02 +01:00
parent 284f4ed653
commit 3c05738584
4 changed files with 4 additions and 4 deletions

View File

@@ -42,7 +42,7 @@ public class ItemBlockFluidStorage extends ItemBlockBase {
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) { public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
EnumFluidStorageType type = EnumFluidStorageType.getById(stack.getMetadata()); EnumFluidStorageType type = EnumFluidStorageType.getById(stack.getMetadata());
if (type != null && stack.stackSize == 1 && isValid(stack) && FluidStorageNBT.getStoredFromNBT(stack.getTagCompound().getCompoundTag(TileFluidStorage.NBT_STORAGE)) == 0 && stack.getMetadata() != ItemFluidStorageDisk.TYPE_CREATIVE && !world.isRemote && player.isSneaking()) { if (type != null && stack.stackSize == 1 && isValid(stack) && FluidStorageNBT.getStoredFromNBT(stack.getTagCompound().getCompoundTag(TileFluidStorage.NBT_STORAGE)) <= 0 && stack.getMetadata() != ItemFluidStorageDisk.TYPE_CREATIVE && !world.isRemote && player.isSneaking()) {
ItemStack storagePart = new ItemStack(RSItems.FLUID_STORAGE_PART, 1, stack.getMetadata()); ItemStack storagePart = new ItemStack(RSItems.FLUID_STORAGE_PART, 1, stack.getMetadata());
if (!player.inventory.addItemStackToInventory(storagePart.copy())) { if (!player.inventory.addItemStackToInventory(storagePart.copy())) {

View File

@@ -42,7 +42,7 @@ public class ItemBlockStorage extends ItemBlockBase {
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) { public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
EnumItemStorageType type = EnumItemStorageType.getById(stack.getMetadata()); EnumItemStorageType type = EnumItemStorageType.getById(stack.getMetadata());
if (type != null && stack.stackSize == 1 && isValid(stack) && ItemStorageNBT.getStoredFromNBT(stack.getTagCompound().getCompoundTag(TileStorage.NBT_STORAGE)) == 0 && stack.getMetadata() != ItemStorageDisk.TYPE_CREATIVE && !world.isRemote && player.isSneaking()) { if (type != null && stack.stackSize == 1 && isValid(stack) && ItemStorageNBT.getStoredFromNBT(stack.getTagCompound().getCompoundTag(TileStorage.NBT_STORAGE)) <= 0 && stack.getMetadata() != ItemStorageDisk.TYPE_CREATIVE && !world.isRemote && player.isSneaking()) {
ItemStack storagePart = new ItemStack(RSItems.STORAGE_PART, 1, stack.getMetadata()); ItemStack storagePart = new ItemStack(RSItems.STORAGE_PART, 1, stack.getMetadata());
if (!player.inventory.addItemStackToInventory(storagePart.copy())) { if (!player.inventory.addItemStackToInventory(storagePart.copy())) {

View File

@@ -82,7 +82,7 @@ public class ItemFluidStorageDisk extends ItemBase {
@Override @Override
public ActionResult<ItemStack> onItemRightClick(ItemStack disk, World world, EntityPlayer player, EnumHand hand) { public ActionResult<ItemStack> onItemRightClick(ItemStack disk, World world, EntityPlayer player, EnumHand hand) {
if (!world.isRemote && player.isSneaking() && FluidStorageNBT.isValid(disk) && FluidStorageNBT.getStoredFromNBT(disk.getTagCompound()) == 0 && disk.getMetadata() != TYPE_CREATIVE) { if (!world.isRemote && player.isSneaking() && FluidStorageNBT.isValid(disk) && FluidStorageNBT.getStoredFromNBT(disk.getTagCompound()) <= 0 && disk.getMetadata() != TYPE_CREATIVE) {
ItemStack storagePart = new ItemStack(RSItems.FLUID_STORAGE_PART, 1, disk.getMetadata()); ItemStack storagePart = new ItemStack(RSItems.FLUID_STORAGE_PART, 1, disk.getMetadata());
if (!player.inventory.addItemStackToInventory(storagePart.copy())) { if (!player.inventory.addItemStackToInventory(storagePart.copy())) {

View File

@@ -106,7 +106,7 @@ public class ItemStorageDisk extends ItemBase {
@Override @Override
public ActionResult<ItemStack> onItemRightClick(ItemStack disk, World world, EntityPlayer player, EnumHand hand) { public ActionResult<ItemStack> onItemRightClick(ItemStack disk, World world, EntityPlayer player, EnumHand hand) {
if (!world.isRemote && player.isSneaking() && ItemStorageNBT.isValid(disk) && ItemStorageNBT.getStoredFromNBT(disk.getTagCompound()) == 0 && disk.getMetadata() != TYPE_CREATIVE) { if (!world.isRemote && player.isSneaking() && ItemStorageNBT.isValid(disk) && ItemStorageNBT.getStoredFromNBT(disk.getTagCompound()) <= 0 && disk.getMetadata() != TYPE_CREATIVE) {
ItemStack storagePart = new ItemStack(RSItems.STORAGE_PART, 1, disk.getMetadata()); ItemStack storagePart = new ItemStack(RSItems.STORAGE_PART, 1, disk.getMetadata());
if (!player.inventory.addItemStackToInventory(storagePart.copy())) { if (!player.inventory.addItemStackToInventory(storagePart.copy())) {