mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-14 22:43:56 +01:00
Bug Fixes
- Snownee's basin render fix - Fixed milk fluid exchange between vanilla items and the create fluid infrastructure
This commit is contained in:
parent
493cad13d0
commit
68e7d3c34c
@ -23,6 +23,8 @@ public class GenericItemFilling {
|
|||||||
public static boolean canItemBeFilled(World world, ItemStack stack) {
|
public static boolean canItemBeFilled(World world, ItemStack stack) {
|
||||||
if (stack.getItem() == Items.GLASS_BOTTLE)
|
if (stack.getItem() == Items.GLASS_BOTTLE)
|
||||||
return true;
|
return true;
|
||||||
|
if (stack.getItem() == Items.MILK_BUCKET)
|
||||||
|
return false;
|
||||||
|
|
||||||
LazyOptional<IFluidHandlerItem> capability =
|
LazyOptional<IFluidHandlerItem> capability =
|
||||||
stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_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) {
|
public static int getRequiredAmountForItem(World world, ItemStack stack, FluidStack availableFluid) {
|
||||||
if (stack.getItem() == Items.GLASS_BOTTLE && canFillGlassBottleInternally(availableFluid))
|
if (stack.getItem() == Items.GLASS_BOTTLE && canFillGlassBottleInternally(availableFluid))
|
||||||
return PotionFluidHandler.getRequiredAmountForFilledBottle(stack, availableFluid);
|
return PotionFluidHandler.getRequiredAmountForFilledBottle(stack, availableFluid);
|
||||||
|
if (stack.getItem() == Items.BUCKET && canFillBucketInternally(availableFluid))
|
||||||
|
return 1000;
|
||||||
|
|
||||||
LazyOptional<IFluidHandlerItem> capability =
|
LazyOptional<IFluidHandlerItem> capability =
|
||||||
stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY);
|
stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY);
|
||||||
@ -51,6 +55,9 @@ public class GenericItemFilling {
|
|||||||
.getFilledBucket();
|
.getFilledBucket();
|
||||||
if (filledBucket == null || filledBucket == Items.AIR)
|
if (filledBucket == null || filledBucket == Items.AIR)
|
||||||
return -1;
|
return -1;
|
||||||
|
if (!((FluidBucketWrapper) tank).getFluid()
|
||||||
|
.isEmpty())
|
||||||
|
return -1;
|
||||||
return 1000;
|
return 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,6 +72,11 @@ public class GenericItemFilling {
|
|||||||
.isEquivalentTo(AllFluids.POTION.get());
|
.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) {
|
public static ItemStack fillItem(World world, int requiredAmount, ItemStack stack, FluidStack availableFluid) {
|
||||||
FluidStack toFill = availableFluid.copy();
|
FluidStack toFill = availableFluid.copy();
|
||||||
toFill.setAmount(requiredAmount);
|
toFill.setAmount(requiredAmount);
|
||||||
@ -80,6 +92,12 @@ public class GenericItemFilling {
|
|||||||
return fillBottle;
|
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();
|
ItemStack split = stack.copy();
|
||||||
split.setCount(1);
|
split.setCount(1);
|
||||||
LazyOptional<IFluidHandlerItem> capability =
|
LazyOptional<IFluidHandlerItem> capability =
|
||||||
|
@ -63,7 +63,7 @@ public class BasinFluidParticle extends FluidStackParticle {
|
|||||||
|
|
||||||
TileEntity tileEntity = world.getTileEntity(basinPos);
|
TileEntity tileEntity = world.getTileEntity(basinPos);
|
||||||
if (tileEntity instanceof BasinTileEntity) {
|
if (tileEntity instanceof BasinTileEntity) {
|
||||||
float totalUnits = ((BasinTileEntity) tileEntity).getTotalFluidUnits();
|
float totalUnits = ((BasinTileEntity) tileEntity).getTotalFluidUnits(0);
|
||||||
if (totalUnits < 1)
|
if (totalUnits < 1)
|
||||||
totalUnits = 0;
|
totalUnits = 0;
|
||||||
float fluidLevel = MathHelper.clamp(totalUnits / 2000, 0, 1);
|
float fluidLevel = MathHelper.clamp(totalUnits / 2000, 0, 1);
|
||||||
|
@ -141,7 +141,7 @@ public class BasinRenderer extends SmartTileEntityRenderer<BasinTileEntity> {
|
|||||||
SmartFluidTankBehaviour inputFluids = basin.getBehaviour(SmartFluidTankBehaviour.INPUT);
|
SmartFluidTankBehaviour inputFluids = basin.getBehaviour(SmartFluidTankBehaviour.INPUT);
|
||||||
SmartFluidTankBehaviour outputFluids = basin.getBehaviour(SmartFluidTankBehaviour.OUTPUT);
|
SmartFluidTankBehaviour outputFluids = basin.getBehaviour(SmartFluidTankBehaviour.OUTPUT);
|
||||||
SmartFluidTankBehaviour[] tanks = { inputFluids, outputFluids };
|
SmartFluidTankBehaviour[] tanks = { inputFluids, outputFluids };
|
||||||
float totalUnits = basin.getTotalFluidUnits();
|
float totalUnits = basin.getTotalFluidUnits(partialTicks);
|
||||||
if (totalUnits < 1)
|
if (totalUnits < 1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@ import net.minecraft.nbt.CompoundNBT;
|
|||||||
import net.minecraft.nbt.ListNBT;
|
import net.minecraft.nbt.ListNBT;
|
||||||
import net.minecraft.nbt.StringNBT;
|
import net.minecraft.nbt.StringNBT;
|
||||||
import net.minecraft.particles.IParticleData;
|
import net.minecraft.particles.IParticleData;
|
||||||
import net.minecraft.tileentity.ITickableTileEntity;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
@ -62,7 +61,7 @@ import net.minecraftforge.items.IItemHandlerModifiable;
|
|||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
||||||
|
|
||||||
public class BasinTileEntity extends SmartTileEntity implements ITickableTileEntity {
|
public class BasinTileEntity extends SmartTileEntity {
|
||||||
|
|
||||||
private boolean areFluidsMoving;
|
private boolean areFluidsMoving;
|
||||||
LerpedFloat ingredientRotationSpeed;
|
LerpedFloat ingredientRotationSpeed;
|
||||||
@ -285,7 +284,7 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getTotalFluidUnits() {
|
public float getTotalFluidUnits(float partialTicks) {
|
||||||
int renderedFluids = 0;
|
int renderedFluids = 0;
|
||||||
float totalUnits = 0;
|
float totalUnits = 0;
|
||||||
|
|
||||||
@ -296,7 +295,7 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
|
|||||||
if (tankSegment.getRenderedFluid()
|
if (tankSegment.getRenderedFluid()
|
||||||
.isEmpty())
|
.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
float units = tankSegment.getTotalUnits(0);
|
float units = tankSegment.getTotalUnits(partialTicks);
|
||||||
if (units < 1)
|
if (units < 1)
|
||||||
continue;
|
continue;
|
||||||
totalUnits += units;
|
totalUnits += units;
|
||||||
@ -454,7 +453,7 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
|
|||||||
if (segments < 2)
|
if (segments < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float totalUnits = getTotalFluidUnits();
|
float totalUnits = getTotalFluidUnits(0);
|
||||||
if (totalUnits == 0)
|
if (totalUnits == 0)
|
||||||
return;
|
return;
|
||||||
float fluidLevel = MathHelper.clamp(totalUnits / 2000, 0, 1);
|
float fluidLevel = MathHelper.clamp(totalUnits / 2000, 0, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user