mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 11:29:15 +00:00
Optionally add a milk fluid to the vanilla bucket (#7294)
Fixes the previous broken code that was supposed to make mod registered milk returned by the vanilla bucket by allowing mods to enable a milk fluid.
This commit is contained in:
1 parent
f173bde812
commit
19f8d2a793
13 files changed
+189
-8
No files matched your search
@@ -643,10 +643,6 @@ public class FluidUtil
|
||||
{
|
||||
return new ItemStack(Items.LAVA_BUCKET);
|
||||
}
|
||||
else if (fluid.getRegistryName().equals(new ResourceLocation("milk")))
|
||||
{
|
||||
return new ItemStack(Items.MILK_BUCKET);
|
||||
}
|
||||
}
|
||||
|
||||
return fluid.getAttributes().getBucket(fluidStack);
|
||||
|
||||
@@ -26,6 +26,7 @@ import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
@@ -60,7 +61,7 @@ public class FluidBucketWrapper implements IFluidHandlerItem, ICapabilityProvide
|
||||
|
||||
public boolean canFillFluidType(FluidStack fluid)
|
||||
{
|
||||
if (fluid.getFluid() == Fluids.WATER || fluid.getFluid() == Fluids.LAVA || fluid.getFluid().getRegistryName().equals(new ResourceLocation("milk")))
|
||||
if (fluid.getFluid() == Fluids.WATER || fluid.getFluid() == Fluids.LAVA)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -75,6 +76,10 @@ public class FluidBucketWrapper implements IFluidHandlerItem, ICapabilityProvide
|
||||
{
|
||||
return new FluidStack(((BucketItem)item).getFluid(), FluidAttributes.BUCKET_VOLUME);
|
||||
}
|
||||
else if (item instanceof MilkBucketItem && ForgeMod.MILK.isPresent())
|
||||
{
|
||||
return new FluidStack(ForgeMod.MILK.get(), FluidAttributes.BUCKET_VOLUME);
|
||||
}
|
||||
else
|
||||
{
|
||||
return FluidStack.EMPTY;
|
||||
|
||||
Reference in new issue
Block a user