diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/GenericItemFilling.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/GenericItemFilling.java index 4f6ebb553..427c5e2c5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/GenericItemFilling.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/GenericItemFilling.java @@ -23,6 +23,8 @@ public class GenericItemFilling { public static boolean canItemBeFilled(World world, ItemStack stack) { if (stack.getItem() == Items.GLASS_BOTTLE) return true; + if (stack.getItem() == Items.MILK_BUCKET) + return false; LazyOptional capability = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY); @@ -40,6 +42,8 @@ public class GenericItemFilling { public static int getRequiredAmountForItem(World world, ItemStack stack, FluidStack availableFluid) { if (stack.getItem() == Items.GLASS_BOTTLE && canFillGlassBottleInternally(availableFluid)) return PotionFluidHandler.getRequiredAmountForFilledBottle(stack, availableFluid); + if (stack.getItem() == Items.BUCKET && canFillBucketInternally(availableFluid)) + return 1000; LazyOptional capability = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY); @@ -51,6 +55,9 @@ public class GenericItemFilling { .getFilledBucket(); if (filledBucket == null || filledBucket == Items.AIR) return -1; + if (!((FluidBucketWrapper) tank).getFluid() + .isEmpty()) + return -1; return 1000; } @@ -65,6 +72,11 @@ public class GenericItemFilling { .isEquivalentTo(AllFluids.POTION.get()); } + private static boolean canFillBucketInternally(FluidStack availableFluid) { + return availableFluid.getFluid() + .isEquivalentTo(AllFluids.MILK.get().getFlowingFluid()); + } + public static ItemStack fillItem(World world, int requiredAmount, ItemStack stack, FluidStack availableFluid) { FluidStack toFill = availableFluid.copy(); toFill.setAmount(requiredAmount); @@ -79,7 +91,13 @@ public class GenericItemFilling { stack.shrink(1); return fillBottle; } - + + if (stack.getItem() == Items.BUCKET && canFillBucketInternally(toFill)) { + ItemStack filledBucket = new ItemStack(Items.MILK_BUCKET); + stack.shrink(1); + return filledBucket; + } + ItemStack split = stack.copy(); split.setCount(1); LazyOptional capability = diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/particle/BasinFluidParticle.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/particle/BasinFluidParticle.java index 302976de8..64f392743 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/particle/BasinFluidParticle.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/particle/BasinFluidParticle.java @@ -63,7 +63,7 @@ public class BasinFluidParticle extends FluidStackParticle { TileEntity tileEntity = world.getTileEntity(basinPos); if (tileEntity instanceof BasinTileEntity) { - float totalUnits = ((BasinTileEntity) tileEntity).getTotalFluidUnits(); + float totalUnits = ((BasinTileEntity) tileEntity).getTotalFluidUnits(0); if (totalUnits < 1) totalUnits = 0; float fluidLevel = MathHelper.clamp(totalUnits / 2000, 0, 1); diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinRenderer.java index bad1d5564..fa7531b6f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinRenderer.java @@ -143,7 +143,7 @@ public class BasinRenderer extends SmartTileEntityRenderer { SmartFluidTankBehaviour inputFluids = basin.getBehaviour(SmartFluidTankBehaviour.INPUT); SmartFluidTankBehaviour outputFluids = basin.getBehaviour(SmartFluidTankBehaviour.OUTPUT); SmartFluidTankBehaviour[] tanks = { inputFluids, outputFluids }; - float totalUnits = basin.getTotalFluidUnits(); + float totalUnits = basin.getTotalFluidUnits(partialTicks); if (totalUnits < 1) return 0; diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java index 90e0c640a..31826c321 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java @@ -40,7 +40,6 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.StringNBT; import net.minecraft.particles.IParticleData; -import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; @@ -63,7 +62,7 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.wrapper.CombinedInvWrapper; -public class BasinTileEntity extends SmartTileEntity implements ITickableTileEntity { +public class BasinTileEntity extends SmartTileEntity { private boolean areFluidsMoving; LerpedFloat ingredientRotationSpeed; @@ -286,7 +285,7 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt } } - public float getTotalFluidUnits() { + public float getTotalFluidUnits(float partialTicks) { int renderedFluids = 0; float totalUnits = 0; @@ -297,7 +296,7 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt if (tankSegment.getRenderedFluid() .isEmpty()) continue; - float units = tankSegment.getTotalUnits(0); + float units = tankSegment.getTotalUnits(partialTicks); if (units < 1) continue; totalUnits += units; @@ -455,7 +454,7 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt if (segments < 2) return; - float totalUnits = getTotalFluidUnits(); + float totalUnits = getTotalFluidUnits(0); if (totalUnits == 0) return; float fluidLevel = MathHelper.clamp(totalUnits / 2000, 0, 1); diff --git a/src/main/resources/assets/create/textures/block/brass_storage_block.png b/src/main/resources/assets/create/textures/block/brass_storage_block.png index 7cc2fff4c..502c69f66 100644 Binary files a/src/main/resources/assets/create/textures/block/brass_storage_block.png and b/src/main/resources/assets/create/textures/block/brass_storage_block.png differ diff --git a/src/main/resources/assets/create/textures/block/brass_tiles.png b/src/main/resources/assets/create/textures/block/brass_tiles.png new file mode 100644 index 000000000..86e4bb3a6 Binary files /dev/null and b/src/main/resources/assets/create/textures/block/brass_tiles.png differ