fix a crash on startup with energy items

This commit is contained in:
Ellpeck 2016-11-26 19:02:59 +01:00
parent b9a84481d1
commit a70468ff72

View file

@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.data.PlayerData; import de.ellpeck.actuallyadditions.mod.data.PlayerData;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.compat.ItemTeslaWrapper; import de.ellpeck.actuallyadditions.mod.util.compat.ItemTeslaWrapper;
import de.ellpeck.actuallyadditions.mod.util.compat.TeslaUtil;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -196,10 +197,12 @@ public abstract class ItemEnergy extends ItemEnergyContainer{
return (T)this.forgeUnitsWrapper; return (T)this.forgeUnitsWrapper;
} }
else if(ActuallyAdditions.teslaLoaded){ else if(ActuallyAdditions.teslaLoaded){
if(this.teslaWrapper == null){ if(capability == TeslaUtil.teslaConsumer || capability == TeslaUtil.teslaProducer || capability == TeslaUtil.teslaHolder){
this.teslaWrapper = new ItemTeslaWrapper(this.stack, this.item); if(this.teslaWrapper == null){
this.teslaWrapper = new ItemTeslaWrapper(this.stack, this.item);
}
return (T)this.teslaWrapper;
} }
return (T)this.teslaWrapper;
} }
return null; return null;
} }