- 769
- 2
- 42
День добрый форумчане. Подскажите такую вещь: крашит почему-то, но понять не могу(возможно проблема с инициализацией).
Вот лог:
Вот тайл:
Вот лог:
Код:
---- Minecraft Crash Report ----
// Quite honestly, I wouldn't worry myself about that.
Time: 23.02.16 12:58
Description: Failed to start game
java.lang.NullPointerException
at fb.futurebuilder.spaceships.entity.FBRocketT2Entity.<init>(FBRocketT2Entity.java:66)
at fb.futurebuilder.spaceships.client.FBRocketsClientProxy.registerRenderInformation(FBRocketsClientProxy.java:58)
at fb.futurebuilder.spaceships.FBRockets.postLoad(FBRockets.java:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:494)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:192)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:172)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:103)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:696)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:213)
at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:448)
at net.minecraft.client.MinecraftAppletImpl.func_71384_a(SourceFile:56)
at net.minecraft.client.Minecraft.run(Minecraft.java:733)
at java.lang.Thread.run(Unknown Source)
Код:
package fb.futurebuilder.spaceships.entity;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import fb.futurebuilder.planets.client.FBPlanetsConfigManager;
import fb.futurebuilder.spaceships.items.FBRocketsItems;
import icbm.api.IMissile;
import icbm.api.IMissileLockable;
import icbm.api.RadarRegistry;
import micdoodle8.mods.galacticraft.API.ICargoEntity;
import micdoodle8.mods.galacticraft.API.IFuelDock;
import micdoodle8.mods.galacticraft.API.IGalacticraftWorldProvider;
import micdoodle8.mods.galacticraft.API.IRocketType;
import micdoodle8.mods.galacticraft.core.GCCoreConfigManager;
import micdoodle8.mods.galacticraft.core.GalacticraftCore;
import micdoodle8.mods.galacticraft.core.entities.EntitySpaceshipBase;
import micdoodle8.mods.galacticraft.core.entities.GCCorePlayerMP;
import micdoodle8.mods.galacticraft.core.items.GCCoreItems;
import micdoodle8.mods.galacticraft.core.tile.GCCoreTileEntityLandingPad;
import micdoodle8.mods.galacticraft.core.util.PacketUtil;
import micdoodle8.mods.galacticraft.core.util.PlayerUtil;
import micdoodle8.mods.galacticraft.moon.GCMoonConfigManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.liquids.LiquidDictionary;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.liquids.LiquidTank;
import universalelectricity.core.vector.Vector3;
public class FBRocketT2Entity extends EntitySpaceshipBase implements IInventory, IMissileLockable, IRocketType {
private final int tankCapacity;
public LiquidTank spaceshipFuelTank;
public int airTank;
public final int airTankMax;
protected ItemStack[] cargoItems;
public IUpdatePlayerListBox rocketSoundUpdater;
private IFuelDock landingPad;
public int canisterToTankRatio;
public double canisterToLiquidStackRatio;
public FBRocketT2Entity(World par1World) {
super(par1World);
this.tankCapacity = 4000;
LiquidTank var10001 = new LiquidTank(4000);
this.getClass();
this.spaceshipFuelTank = var10001;
this.airTank = 0;
this.airTankMax = 12000;
this.getClass();
this.canisterToTankRatio = 4000 / GCCoreItems.fuelCanister.getMaxDamage();
this.canisterToLiquidStackRatio = 2000.0D / (double)GCCoreItems.fuelCanister.getMaxDamage();
}
public int getScaledAirLevel(int i) {
return this.airTank * i / 12000;
}
public int getScaledFuelLevel(int i) {
double fuelLevel = this.spaceshipFuelTank.getLiquid() == null?0.0D:(double)this.spaceshipFuelTank.getLiquid().amount;
double var10000 = fuelLevel * (double)i;
this.getClass();
return (int)(var10000 / 4000.0D);
}
public FBRocketT2Entity(World par1World, double par2, double par4, double par6, EntitySpaceshipBase.EnumRocketType rocketType) {
super(par1World);
this.tankCapacity = 4000;
LiquidTank var10001 = new LiquidTank(4000);
this.getClass();
this.spaceshipFuelTank = var10001;
this.airTank = 0;
this.airTankMax = 12000;
this.getClass();
this.canisterToTankRatio = 4000 / GCCoreItems.fuelCanister.getMaxDamage();
this.canisterToLiquidStackRatio = 2000.0D / (double)GCCoreItems.fuelCanister.getMaxDamage();
this.setPosition(par2, par4 + (double)super.yOffset, par6);
super.motionX = 0.0D;
super.motionY = 0.0D;
super.motionZ = 0.0D;
super.prevPosX = par2;
super.prevPosY = par4;
super.prevPosZ = par6;
super.rocketType = rocketType;
this.cargoItems = new ItemStack[this.getSizeInventory()];
}
public FBRocketT2Entity(World par1World, double par2, double par4, double par6, boolean reversed, EntitySpaceshipBase.EnumRocketType rocketType, ItemStack[] inv) {
this(par1World, par2, par4, par6, rocketType);
this.cargoItems = inv;
}
public FBRocketT2Entity() {
super((World)null);
this.tankCapacity = 4000;
LiquidTank var10001 = new LiquidTank(4000);
this.getClass();
this.spaceshipFuelTank = var10001;
this.airTank = 0;
this.airTankMax = 12000;
this.getClass();
this.canisterToTankRatio = 4000 / GCCoreItems.fuelCanister.getMaxDamage();
this.canisterToLiquidStackRatio = 2000.0D / (double)GCCoreItems.fuelCanister.getMaxDamage();
}
protected void entityInit() {
super.entityInit();
RadarRegistry.register((Entity)this);
}
public void setDead() {
super.setDead();
RadarRegistry.unregister((Entity)this);
if(this.rocketSoundUpdater != null) {
this.rocketSoundUpdater.update();
}
}
public void onUpdate() {
super.onUpdate();
int i;
if(super.timeUntilLaunch >= 100) {
i = Math.abs(super.timeUntilLaunch / 100);
} else {
i = 1;
}
if((this.getLaunched() || super.launchPhase == EntitySpaceshipBase.EnumLaunchPhase.IGNITED.getPhase() && super.rand.nextInt(i) == 0) && !GCCoreConfigManager.disableSpaceshipParticles && this.hasValidFuel() && FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
this.spawnParticles();
}
if(this.rocketSoundUpdater != null && (super.launchPhase == EntitySpaceshipBase.EnumLaunchPhase.IGNITED.getPhase() || this.getLaunched())) {
this.rocketSoundUpdater.update();
}
if(super.launchPhase == EntitySpaceshipBase.EnumLaunchPhase.LAUNCHED.getPhase() && this.hasValidFuel()) {
double d = (double)(super.timeSinceLaunch / 200.0F);
d = Math.min(d, 1.0D);
if(d != 0.0D) {
super.motionY = -d * 1.5D * Math.cos((double)(super.rotationPitch - 180.0F) * 3.141592653589793D / 180.0D);
}
double multiplier = 1.0D;
if(super.worldObj.provider instanceof IGalacticraftWorldProvider) {
multiplier = ((IGalacticraftWorldProvider)super.worldObj.provider).getFuelUsageMultiplier();
if(multiplier <= 0.0D) {
multiplier = 1.0D;
}
}
if(super.timeSinceLaunch % (float)MathHelper.floor_double(3.0D * (1.0D / multiplier)) == 0.0F) {
this.removeFuel((LiquidStack)null, 1);
this.removeAir(8);
}
} else if(!this.hasValidFuel() && this.getLaunched() && Math.abs(Math.sin((double)(super.timeSinceLaunch / 1000.0F))) / 10.0D != 0.0D) {
super.motionY -= Math.abs(Math.sin((double)(super.timeSinceLaunch / 1000.0F))) / 4.0D;
}
}
public void readNetworkedData(ByteArrayDataInput dataStream) {
super.readNetworkedData(dataStream);
this.spaceshipFuelTank.setLiquid(new LiquidStack(GCCoreItems.fuel.itemID, dataStream.readInt(), 0));
this.airTank = dataStream.readInt();
if(this.cargoItems == null) {
this.cargoItems = new ItemStack[this.getSizeInventory()];
}
}
public ArrayList getNetworkedData(ArrayList list) {
super.getNetworkedData(list);
list.add(Integer.valueOf(this.spaceshipFuelTank.getLiquid() == null?0:this.spaceshipFuelTank.getLiquid().amount));
list.add(Integer.valueOf(this.airTank));
return list;
}
public boolean hasValidFuel() {
boolean valid = true;
if(this.spaceshipFuelTank.getLiquid() == null || this.spaceshipFuelTank.getLiquid().amount == 0) {
valid = false;
}
if(this.airTank == 0) {
valid = false;
}
return valid;
}
public void onLaunch() {}
public void onTeleport(EntityPlayerMP player) {
GCCorePlayerMP playerBase = PlayerUtil.getPlayerBaseServerFromPlayer(player);
player.playerNetServerHandler.sendPacketToPlayer(PacketUtil.createPacket("GalacticraftCore", 22, new Object[]{Integer.valueOf(0)}));
if(playerBase != null) {
if(this.cargoItems != null && this.cargoItems.length != 0) {
playerBase.rocketStacks = this.cargoItems;
} else {
playerBase.rocketStacks = new ItemStack[9];
}
playerBase.setFuelLevel(this.getFuel());
playerBase.setRocketType(super.rocketType.getIndex());
playerBase.setRocketItem(FBRocketsItems.rocketT2);
}
}
protected void spawnParticles() {
double x1 = 2.9D * Math.cos((double)super.rotationYaw * 3.141592653589793D / 180.0D) * Math.sin((double)super.rotationPitch * 3.141592653589793D / 180.0D);
double z1 = 2.9D * Math.sin((double)super.rotationYaw * 3.141592653589793D / 180.0D) * Math.sin((double)super.rotationPitch * 3.141592653589793D / 180.0D);
double y1 = 2.9D * Math.cos((double)(super.rotationPitch - 180.0F) * 3.141592653589793D / 180.0D);
double y = super.prevPosY + (super.posY - super.prevPosY);
if(!super.isDead) {
GalacticraftCore.proxy.spawnParticle(this.getLaunched()?"launchflame":"whitesmoke", super.posX + 0.4D - super.rand.nextDouble() / 10.0D + x1, y - 0.0D + y1, super.posZ + 0.4D - super.rand.nextDouble() / 10.0D + z1, x1, y1, z1, this.getLaunched());
GalacticraftCore.proxy.spawnParticle(this.getLaunched()?"launchflame":"whitesmoke", super.posX - 0.4D + super.rand.nextDouble() / 10.0D + x1, y - 0.0D + y1, super.posZ + 0.4D - super.rand.nextDouble() / 10.0D + z1, x1, y1, z1, this.getLaunched());
GalacticraftCore.proxy.spawnParticle(this.getLaunched()?"launchflame":"whitesmoke", super.posX - 0.4D + super.rand.nextDouble() / 10.0D + x1, y - 0.0D + y1, super.posZ - 0.4D + super.rand.nextDouble() / 10.0D + z1, x1, y1, z1, this.getLaunched());
GalacticraftCore.proxy.spawnParticle(this.getLaunched()?"launchflame":"whitesmoke", super.posX + 0.4D - super.rand.nextDouble() / 10.0D + x1, y - 0.0D + y1, super.posZ - 0.4D + super.rand.nextDouble() / 10.0D + z1, x1, y1, z1, this.getLaunched());
GalacticraftCore.proxy.spawnParticle(this.getLaunched()?"launchflame":"whitesmoke", super.posX + x1, y - 0.0D + y1, super.posZ + z1, x1, y1, z1, this.getLaunched());
GalacticraftCore.proxy.spawnParticle(this.getLaunched()?"launchflame":"whitesmoke", super.posX + 0.4D + x1, y - 0.0D + y1, super.posZ + z1, x1, y1, z1, this.getLaunched());
GalacticraftCore.proxy.spawnParticle(this.getLaunched()?"launchflame":"whitesmoke", super.posX - 0.4D + x1, y - 0.0D + y1, super.posZ + z1, x1, y1, z1, this.getLaunched());
GalacticraftCore.proxy.spawnParticle(this.getLaunched()?"launchflame":"whitesmoke", super.posX + x1, y - 0.0D + y1, super.posZ + 0.4D + z1, x1, y1, z1, this.getLaunched());
GalacticraftCore.proxy.spawnParticle(this.getLaunched()?"launchflame":"whitesmoke", super.posX + x1, y - 0.0D + y1, super.posZ - 0.4D + z1, x1, y1, z1, this.getLaunched());
GalacticraftCore.proxy.spawnParticle(this.getLaunched()?"blueflame":"whitesmoke", super.posX + x1 - 0.8D, y - 0.0D + y1, super.posZ + z1, x1, y1, z1, this.getLaunched());
GalacticraftCore.proxy.spawnParticle(this.getLaunched()?"blueflame":"whitesmoke", super.posX + x1 + 0.8D, y - 0.0D + y1, super.posZ + z1, x1, y1, z1, this.getLaunched());
GalacticraftCore.proxy.spawnParticle(this.getLaunched()?"blueflame":"whitesmoke", super.posX + x1, y - 0.0D + y1, super.posZ + z1 - 0.8D, x1, y1, z1, this.getLaunched());
GalacticraftCore.proxy.spawnParticle(this.getLaunched()?"blueflame":"whitesmoke", super.posX + x1, y - 0.0D + y1, super.posZ + z1 + 0.8D, x1, y1, z1, this.getLaunched());
}
}
public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) {
return super.isDead?false:par1EntityPlayer.getDistanceSqToEntity(this) <= 64.0D;
}
public int getSizeInventory() {
return super.rocketType.getInventorySpace();
}
protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {
super.writeEntityToNBT(par1NBTTagCompound);
if(this.getSizeInventory() > 0) {
NBTTagList var2 = new NBTTagList();
for(int var3 = 0; var3 < this.cargoItems.length; ++var3) {
if(this.cargoItems[var3] != null) {
NBTTagCompound var4 = new NBTTagCompound();
var4.setByte("Slot", (byte)var3);
this.cargoItems[var3].writeToNBT(var4);
var2.appendTag(var4);
}
}
par1NBTTagCompound.setTag("Items", var2);
}
if(this.spaceshipFuelTank.getLiquid() != null) {
par1NBTTagCompound.setTag("fuelTank", this.spaceshipFuelTank.writeToNBT(new NBTTagCompound()));
}
par1NBTTagCompound.setInteger("airTank", this.airTank);
}
protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
super.readEntityFromNBT(par1NBTTagCompound);
if(this.getSizeInventory() > 0) {
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
this.cargoItems = new ItemStack[this.getSizeInventory()];
for(int var3 = 0; var3 < var2.tagCount(); ++var3) {
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
int var5 = var4.getByte("Slot") & 255;
if(var5 >= 0 && var5 < this.cargoItems.length) {
this.cargoItems[var5] = ItemStack.loadItemStackFromNBT(var4);
}
}
}
if(par1NBTTagCompound.hasKey("fuelTank")) {
this.spaceshipFuelTank.readFromNBT(par1NBTTagCompound.getCompoundTag("fuelTank"));
}
if(par1NBTTagCompound.hasKey("airTank")) {
this.airTank = par1NBTTagCompound.getInteger("airTank");
}
}
public ItemStack getStackInSlot(int par1) {
return this.cargoItems[par1];
}
public ItemStack decrStackSize(int par1, int par2) {
if(this.cargoItems[par1] != null) {
ItemStack var3;
if(this.cargoItems[par1].stackSize <= par2) {
var3 = this.cargoItems[par1];
this.cargoItems[par1] = null;
return var3;
} else {
var3 = this.cargoItems[par1].splitStack(par2);
if(this.cargoItems[par1].stackSize == 0) {
this.cargoItems[par1] = null;
}
return var3;
}
} else {
return null;
}
}
public ItemStack getStackInSlotOnClosing(int par1) {
if(this.cargoItems[par1] != null) {
ItemStack var2 = this.cargoItems[par1];
this.cargoItems[par1] = null;
return var2;
} else {
return null;
}
}
public void setInventorySlotContents(int par1, ItemStack par2ItemStack) {
this.cargoItems[par1] = par2ItemStack;
if(par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) {
par2ItemStack.stackSize = this.getInventoryStackLimit();
}
}
public String getInvName() {
return "container.spaceship";
}
public int getInventoryStackLimit() {
return 64;
}
public void onInventoryChanged() {}
public void openChest() {}
public void closeChest() {}
public Entity[] getSpaceshipParts() {
return null;
}
public HashSet getPossiblePlanets() {
HashSet dimensions = new HashSet();
dimensions.add(Integer.valueOf(0));
dimensions.add(Integer.valueOf(GCMoonConfigManager.dimensionIDMoon));
dimensions.add(Integer.valueOf(FBPlanetsConfigManager.dimensionIDMars));
dimensions.add(Integer.valueOf(FBPlanetsConfigManager.dimensionIDVenus));
return dimensions;
}
public int getPreLaunchWait() {
return 400;
}
public List getItemsDropped() {
ArrayList items = new ArrayList();
items.add(new ItemStack(FBRocketsItems.rocketT2, 1, super.rocketType.getIndex()));
if(this.cargoItems != null) {
ItemStack[] arr$ = this.cargoItems;
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; ++i$) {
ItemStack item = arr$[i$];
if(item != null) {
items.add(item);
}
}
}
return items;
}
public boolean isInvNameLocalized() {
return false;
}
public boolean isStackValidForSlot(int i, ItemStack itemstack) {
return false;
}
public int getMaxFuel() {
return this.spaceshipFuelTank.getCapacity();
}
public boolean canLock(IMissile missile) {
return true;
}
public Vector3 getPredictedPosition(int ticks) {
return new Vector3(this);
}
public int addFuel(LiquidStack liquid, int amount, boolean doFill) {
LiquidStack liquidInTank = this.spaceshipFuelTank.getLiquid();
return liquid != null && LiquidDictionary.findLiquidName(liquid).equals("Fuel") && (liquidInTank == null || liquidInTank.amount + liquid.amount <= this.spaceshipFuelTank.getCapacity())?this.spaceshipFuelTank.fill(liquid, doFill):0;
}
public int addAir(int amount) {
this.getClass();
int space = 12000 - this.airTank;
if(amount <= space) {
this.airTank += amount;
return amount;
} else {
this.getClass();
this.airTank = 12000;
return space;
}
}
public void removeAir(int amount) {
int used = amount;
if(this.airTank < amount) {
used = this.airTank;
}
this.airTank -= used;
}
public LiquidStack removeFuel(LiquidStack liquid, int amount) {
return liquid == null?this.spaceshipFuelTank.drain(amount, true):null;
}
public ICargoEntity.EnumCargoLoadingState addCargo(ItemStack stack, boolean doAdd) {
if(super.rocketType.getInventorySpace() <= 3) {
return ICargoEntity.EnumCargoLoadingState.NOINVENTORY;
} else {
boolean count = false;
ItemStack stackAt;
int var5;
for(var5 = 0; var5 < this.cargoItems.length - 3; ++var5) {
stackAt = this.cargoItems[var5];
if(stackAt != null && stackAt.itemID == stack.itemID && stackAt.getItemDamage() == stack.getItemDamage() && stackAt.stackSize < stackAt.getMaxStackSize()) {
if(doAdd) {
this.cargoItems[var5].stackSize += stack.stackSize;
}
return ICargoEntity.EnumCargoLoadingState.SUCCESS;
}
}
for(var5 = 0; var5 < this.cargoItems.length - 3; ++var5) {
stackAt = this.cargoItems[var5];
if(stackAt == null) {
if(doAdd) {
this.cargoItems[var5] = stack;
}
return ICargoEntity.EnumCargoLoadingState.SUCCESS;
}
}
return ICargoEntity.EnumCargoLoadingState.FULL;
}
}
public ICargoEntity.RemovalResult removeCargo(boolean doRemove) {
for(int i = 0; i < this.cargoItems.length - 3; ++i) {
ItemStack stackAt = this.cargoItems[i];
if(stackAt != null) {
if(doRemove && --this.cargoItems[i].stackSize <= 0) {
this.cargoItems[i] = null;
}
return new ICargoEntity.RemovalResult(ICargoEntity.EnumCargoLoadingState.SUCCESS, new ItemStack(stackAt.itemID, 1, stackAt.getItemDamage()));
}
}
return new ICargoEntity.RemovalResult(ICargoEntity.EnumCargoLoadingState.EMPTY, (ItemStack)null);
}
public void onPadDestroyed() {
if(!super.isDead && super.launchPhase != EntitySpaceshipBase.EnumLaunchPhase.LAUNCHED.getPhase()) {
this.dropShipAsItem();
this.setDead();
}
}
public void setPad(IFuelDock pad) {
this.landingPad = pad;
}
public IFuelDock getLandingPad() {
return this.landingPad;
}
public boolean isDockValid(IFuelDock dock) {
return dock instanceof GCCoreTileEntityLandingPad;
}
public int getRocketTier() {
return 2;
}
public int getFuel() {
return this.spaceshipFuelTank.getLiquid() != null?this.spaceshipFuelTank.getLiquid().amount:0;
}
public int getAir() {
return this.airTank;
}
}