diff --git a/src/main/java/com/fouristhenumber/utilitiesinexcess/common/blocks/BlockDrum.java b/src/main/java/com/fouristhenumber/utilitiesinexcess/common/blocks/BlockDrum.java index d8e0aa8a..88f25470 100644 --- a/src/main/java/com/fouristhenumber/utilitiesinexcess/common/blocks/BlockDrum.java +++ b/src/main/java/com/fouristhenumber/utilitiesinexcess/common/blocks/BlockDrum.java @@ -57,45 +57,43 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p TileEntity te = world.getTileEntity(x, y, z); - // all the drum things in variables so i can just ref them later xd - if(!(te instanceof TileEntityDrum drum)) return false; + // all the drum things in variables so i can just ref them later xd + if (!(te instanceof TileEntityDrum drum)) return false; FluidTank drumTank = drum.tank; - FluidStack fluid = drumTank.getFluid(); + FluidStack fluid = drumTank.getFluid(); int capacity = drumTank.getCapacity(); ItemStack itemStack = player.getItemInUse(); Item item = itemStack.getItem(); - if(item == null){ + if (item == null) { return false; } - if(fluid == null){ - //empty drum cases - if(item instanceof IFluidContainerItem fluidTank){ + if (fluid == null) { + // empty drum cases + if (item instanceof IFluidContainerItem fluidTank) { FluidStack playerFluid = fluidTank.getFluid(itemStack); int playerCapacity = fluidTank.getCapacity(itemStack); - if( playerFluid== null){ - //both the tank and the drum are false + if (playerFluid == null) { + // both the tank and the drum are false return false; - }else{ - //either the capacity of the drum, or the amount in the player hand + } else { + // either the capacity of the drum, or the amount in the player hand int fillAmount = Math.min(capacity, playerCapacity); - //copy the fluid add hte amount and fill the drum and empty the hand + // copy the fluid add hte amount and fill the drum and empty the hand FluidStack fillFluid = playerFluid.copy(); fillFluid.amount = fillAmount; int filedAmount = drumTank.fill(fillFluid, true); fluidTank.drain(itemStack, filedAmount, true); - //todo: pull this to its own helper method? + // todo: pull this to its own helper method? if (!world.isRemote) { player.addChatComponentMessage( new ChatComponentTranslation( "message.drum.filled", filedAmount, - playerFluid.getLocalizedName() - ) - ); + playerFluid.getLocalizedName())); } world.markBlockForUpdate(x, y, z); @@ -103,32 +101,28 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p } } - //empty and full bucket, maybe can pull this out to a helper method as well? - else if(item instanceof ItemBucket){ + // empty and full bucket, maybe can pull this out to a helper method as well? + else if (item instanceof ItemBucket) { FluidStack bucketFluid = FluidContainerRegistry.getFluidForFilledItem(itemStack); - //this SHOULD be 1000 i THINK + // this SHOULD be 1000 i THINK int fillAmount = Math.min(capacity, bucketFluid.amount); FluidStack fillFluid = bucketFluid.copy(); fillFluid.amount = fillAmount; int filedAmount = drumTank.fill(fillFluid, true); - //if the drum works? - if (filedAmount > 0){ + // if the drum works? + if (filedAmount > 0) { - if(!world.isRemote) { - player.inventory.setInventorySlotContents( - player.inventory.currentItem, - new ItemStack(Items.bucket) - ); + if (!world.isRemote) { + player.inventory + .setInventorySlotContents(player.inventory.currentItem, new ItemStack(Items.bucket)); player.addChatComponentMessage( new ChatComponentTranslation( "message.drum.filled", fillAmount, - fillFluid.getLocalizedName() - ) - ); + fillFluid.getLocalizedName())); } world.markBlockForUpdate(x, y, z); return true; @@ -138,16 +132,13 @@ else if(item instanceof ItemBucket){ } } // if the drum is full - else{ + else { - return false; + return false; } return false; } - - - @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase placer, ItemStack stack) { super.onBlockPlacedBy(world, x, y, z, placer, stack);