Fix legacy handling for ItemBucket subclasses and non-universal buckets (#3038)

This commit is contained in:
mezz 2016-06-26 12:18:26 -07:00 committed by LexManos
parent 1871cf1b02
commit 1a8ad6bbee

View file

@ -9,13 +9,27 @@
if (raytraceresult == null) if (raytraceresult == null)
{ {
@@ -175,4 +177,9 @@ @@ -175,4 +177,23 @@
} }
} }
} }
+ +
+ @Override + @Override
+ public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities(ItemStack stack, net.minecraft.nbt.NBTTagCompound nbt) { + public net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities(ItemStack stack, net.minecraft.nbt.NBTTagCompound nbt) {
+ return new net.minecraftforge.fluids.capability.wrappers.FluidBucketWrapper(stack); + if (this.getClass() == ItemBucket.class)
+ {
+ if (net.minecraftforge.fluids.FluidRegistry.isUniversalBucketEnabled())
+ {
+ return new net.minecraftforge.fluids.capability.wrappers.FluidBucketWrapper(stack);
+ }
+ else
+ {
+ return new net.minecraftforge.fluids.capability.wrappers.FluidContainerRegistryWrapper(stack); // when fluid container registry is gone, just use FluidBucketWrapper
+ }
+ }
+ else
+ {
+ return super.initCapabilities(stack, nbt);
+ }
+ } + }
} }