mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
Fix World Capabilities NPE when there are no attached capabilities.
This commit is contained in:
1 parent
bfddcfb4fc
commit
0e286f880e
4 files changed
+24
-20
No files matched your search
@@ -26,7 +26,7 @@ public class WorldCapabilityData extends WorldSavedData
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
this.capNBT = nbt;
|
||||
if(serializable != null)
|
||||
if (serializable != null)
|
||||
{
|
||||
serializable.deserializeNBT(this.capNBT);
|
||||
this.capNBT = null;
|
||||
@@ -36,7 +36,9 @@ public class WorldCapabilityData extends WorldSavedData
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
return nbt = serializable.serializeNBT();
|
||||
if (serializable != null)
|
||||
nbt = serializable.serializeNBT();
|
||||
return nbt;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,7 +50,7 @@ public class WorldCapabilityData extends WorldSavedData
|
||||
public void setCapabilities(WorldProvider provider, INBTSerializable<NBTTagCompound> capabilities)
|
||||
{
|
||||
this.serializable = capabilities;
|
||||
if(this.capNBT != null)
|
||||
if (this.capNBT != null)
|
||||
{
|
||||
serializable.deserializeNBT(this.capNBT);
|
||||
this.capNBT = null;
|
||||
|
||||
@@ -489,7 +489,7 @@ public class ForgeEventFactory
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new PotionBrewEvent.Post(brewingItemStacks));
|
||||
}
|
||||
|
||||
|
||||
public static void onPlayerBrewedPotion(EntityPlayer player, ItemStack stack)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerBrewedPotionEvent(player, stack));
|
||||
@@ -525,7 +525,8 @@ public class ForgeEventFactory
|
||||
return gatherCapabilities(new AttachCapabilitiesEvent.Item(item, stack), parent);
|
||||
}
|
||||
|
||||
public static CapabilityDispatcher gatherCapabilities(World world, ICapabilityProvider parent) {
|
||||
public static CapabilityDispatcher gatherCapabilities(World world, ICapabilityProvider parent)
|
||||
{
|
||||
return gatherCapabilities(new AttachCapabilitiesEvent.World(world), parent);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user