You can decompose the fluid storage disk with count < 0, #520
This commit is contained in:
@@ -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())) {
|
||||||
|
|||||||
@@ -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())) {
|
||||||
|
|||||||
@@ -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())) {
|
||||||
|
|||||||
@@ -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())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user