Не спавнится entity

Версия Minecraft
1.7.10
126
6
33
Такое дело, нацарапал немного кода для создания GC ракеты. Вроде бы всё запускается удачно, но не тут-то было. При попытке установить ракету на площадку ничего не происходит... Вот такие дела.


Код:
public class EntityShip1 extends EntityTieredRocket
{

    public EntityShip1(World par1World)
    {
        super(par1World);
        this.setSize(1.2F, 3.5F);
        this.yOffset = 1.5F;
    }

    public EntityShip1(World par1World, double par2, double par4, double par6, EnumRocketType rocketType)
    {
        super(par1World, par2, par4, par6);
        this.rocketType = rocketType;
        this.cargoItems = new ItemStack[this.getSizeInventory()];
        this.setSize(1.2F, 3.5F);
        this.yOffset = 1.5F;
    }

    @Override
    public float getRotateOffset()
    {
        return -1.5F;
    }

    @Override
    public ItemStack getPickedResult(MovingObjectPosition target)
    {
        return new ItemStack(AtisotItems.ship1, 1, this.rocketType.getIndex());
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    @Override
    public void onUpdate()
    {
        super.onUpdate();

        int i;

        if (this.timeUntilLaunch >= 100)
        {
            i = Math.abs(this.timeUntilLaunch / 100);
        }
        else
        {
            i = 1;
        }

        if ((this.getLaunched() || this.launchPhase == EnumLaunchPhase.IGNITED.ordinal() && this.rand.nextInt(i) == 0) && !ConfigManagerCore.disableSpaceshipParticles && this.hasValidFuel())
        {
            if (this.worldObj.isRemote)
            {
                //this.spawnParticles(this.getLaunched());
            }
        }

        if (this.launchPhase == EnumLaunchPhase.LAUNCHED.ordinal() && this.hasValidFuel())
        {
            if (!this.landing)
            {
                double d = this.timeSinceLaunch / 150;

                if (this.worldObj.provider instanceof WorldProviderSpace && !((WorldProviderSpace) this.worldObj.provider).hasAtmosphere())
                {
                    d = Math.min(d * 1.2, 1.6);
                }
                else
                {
                    d = Math.min(d, 1);
                }

                if (d != 0.0)
                {
                    this.motionY = -d * Math.cos((this.rotationPitch - 180) * Math.PI / 180.0D);
                }
            }
            else
            {
                this.motionY -= 0.008D;
            }

            double multiplier = 1.0D;

            if (this.worldObj.provider instanceof IGalacticraftWorldProvider)
            {
                multiplier = ((IGalacticraftWorldProvider) this.worldObj.provider).getFuelUsageMultiplier();

                if (multiplier <= 0)
                {
                    multiplier = 1;
                }
            }

            if (this.timeSinceLaunch % MathHelper.floor_double(3 * (1 / multiplier)) == 0)
            {
                this.removeFuel(1);
                if (!this.hasValidFuel())
                    this.stopRocketSound();
            }
        }
        else if (!this.hasValidFuel() && this.getLaunched() && !this.worldObj.isRemote)
        {
            if (Math.abs(Math.sin(this.timeSinceLaunch / 1000)) / 10 != 0.0)
            {
                this.motionY -= Math.abs(Math.sin(this.timeSinceLaunch / 1000)) / 20;
            }
        }
    }

    @Override
    public void onTeleport(EntityPlayerMP player)
    {
        final EntityPlayerMP playerBase = PlayerUtil.getPlayerBaseServerFromPlayer(player, false);

        if (playerBase != null)
        {
            GCPlayerStats stats = GCPlayerStats.get(player);

            if (this.cargoItems == null || this.cargoItems.length == 0)
            {
                stats.rocketStacks = new ItemStack[2];
            }
            else
            {
                stats.rocketStacks = this.cargoItems;
            }

            stats.rocketType = this.rocketType.getIndex();
            stats.rocketItem = AtisotItems.ship1;
            stats.fuelLevel = this.fuelTank.getFluidAmount();
        }
    }

    @Override
    public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer)
    {
        return !this.isDead && par1EntityPlayer.getDistanceSqToEntity(this) <= 64.0D;
    }

    @Override
    protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
    {
        super.writeEntityToNBT(par1NBTTagCompound);
    }

    @Override
    protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
    {
        super.readEntityFromNBT(par1NBTTagCompound);
    }

    @Override
    public List<ItemStack> getItemsDropped(List<ItemStack> droppedItems)
    {
        super.getItemsDropped(droppedItems);
        ItemStack rocket = new ItemStack(AtisotItems.ship1, 1, this.rocketType.getIndex());
        rocket.setTagCompound(new NBTTagCompound());
        rocket.getTagCompound().setInteger("RocketFuel", this.fuelTank.getFluidAmount());
        droppedItems.add(rocket);
        return droppedItems;
    }

    @Override
    public boolean hasCustomInventoryName()
    {
        return false;
    }

    @Override
    public boolean isItemValidForSlot(int i, ItemStack itemstack)
    {
        return false;
    }



    @Override
    public void onPadDestroyed()
    {
        if (!this.isDead && this.launchPhase != EnumLaunchPhase.LAUNCHED.ordinal())
        {
            this.dropShipAsItem();
            this.setDead();
        }
    }

    @Override
    public boolean isDockValid(IFuelDock dock)
    {
        return dock instanceof TileEntityLandingPad;
    }

    @Override
    public int getFuelTankCapacity() {
        return 10000;
    }

    @Override
    public int getPreLaunchWait() {
        return 5;
    }


    @Override
    public float getCameraZoom() {
        return 25.0F;
    }

    @Override
    public boolean defaultThirdPerson() {
        return false;
    }

    @Override
    public int getRocketTier() {
        return 10;
    }
}


Код:
public class ItemShip1 extends Item implements IHoldableItem
{
    public ItemShip1(String assetName)
    {
        super();
        this.setMaxDamage(0);
        this.setHasSubtypes(true);
        this.setMaxStackSize(1);
        this.setTextureName("arrow");
        this.setUnlocalizedName(assetName);
    }


    @Override
    public CreativeTabs getCreativeTab()
    {
        return GalacticraftCore.galacticraftItemsTab;
    }

    @Override
    public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
    {
        boolean padFound = false;
        TileEntity tile = null;

        if (par3World.isRemote && par2EntityPlayer instanceof EntityPlayerSP)
        {
            ClientProxyCore.playerClientHandler.onBuild(8, (EntityPlayerSP) par2EntityPlayer);
            return false;
        }
        else
        {
            float centerX = -1;
            float centerY = -1;
            float centerZ = -1;

            for (int i = -1; i < 2; i++)
            {
                for (int j = -1; j < 2; j++)
                {
                    final Block id = par3World.getBlock(par4 + i, par5, par6 + j);
                    int meta = par3World.getBlockMetadata(par4 + i, par5, par6 + j);

                    if (id == GCBlocks.landingPadFull && meta == 0)
                    {
                        padFound = true;
                        tile = par3World.getTileEntity(par4 + i, par5, par6 + j);

                        centerX = par4 + i + 0.5F;
                        centerY = par5 + 0.4F;
                        centerZ = par6 + j + 0.5F;

                        break;
                    }
                }

                if (padFound) break;
            }

            if (padFound)
            {
                //Check whether there is already a rocket on the pad
                if (tile instanceof TileEntityLandingPad)
                {
                    if (((TileEntityLandingPad)tile).getDockedEntity() != null)
                        return false;
                }
                else
                {
                    return false;
                }

                final EntityShip1 spaceship = new EntityShip1(par3World, centerX, centerY, centerZ, IRocketType.EnumRocketType.values()[par1ItemStack.getItemDamage()]);

                spaceship.setPosition(spaceship.posX, spaceship.posY + spaceship.getOnPadYOffset(), spaceship.posZ);
                par3World.spawnEntityInWorld(spaceship);

                if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().hasKey("RocketFuel"))
                {
                    spaceship.fuelTank.fill(new FluidStack(GalacticraftCore.fluidFuel, par1ItemStack.getTagCompound().getInteger("RocketFuel")), true);
                }

                if (!par2EntityPlayer.capabilities.isCreativeMode)
                {
                    par1ItemStack.stackSize--;

                    if (par1ItemStack.stackSize <= 0)
                    {
                        par1ItemStack = null;
                    }
                }

                if (spaceship.rocketType.getPreFueled())
                {
                    spaceship.fuelTank.fill(new FluidStack(GalacticraftCore.fluidFuel, spaceship.getMaxFuel()), true);
                }
            }
            else
            {
                return false;
            }
        }
        return true;
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    @Override
    public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List)
    {
        for (int i = 0; i < IRocketType.EnumRocketType.values().length; i++)
        {
            par3List.add(new ItemStack(par1, 1, i));
        }
    }

    @Override
    @SideOnly(Side.CLIENT)
    public EnumRarity getRarity(ItemStack par1ItemStack)
    {
        return ClientProxyCore.galacticraftItem;
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    @Override
    @SideOnly(Side.CLIENT)
    public void addInformation(ItemStack par1ItemStack, EntityPlayer player, List par2List, boolean b)
    {
        IRocketType.EnumRocketType type = IRocketType.EnumRocketType.values()[par1ItemStack.getItemDamage()];

        if (!type.getTooltip().isEmpty())
        {
            par2List.add(type.getTooltip());
        }

        if (type.getPreFueled())
        {
            par2List.add(EnumColor.RED + "\u00a7o" + GCCoreUtil.translate("gui.creativeOnly.desc"));
        }

        if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().hasKey("RocketFuel"))
        {
            EntityTier1Rocket rocket = new EntityTier1Rocket(FMLClientHandler.instance().getWorldClient(), 0, 0, 0, IRocketType.EnumRocketType.values()[par1ItemStack.getItemDamage()]);
            par2List.add(GCCoreUtil.translate("gui.message.fuel.name") + ": " + par1ItemStack.getTagCompound().getInteger("RocketFuel") + " / " + rocket.fuelTank.getCapacity());
        }
    }

    @Override
    public boolean shouldHoldLeftHandUp(EntityPlayer player)
    {
        return true;
    }

    @Override
    public boolean shouldHoldRightHandUp(EntityPlayer player)
    {
        return true;
    }

    @Override
    public boolean shouldCrouch(EntityPlayer player)
    {
        return true;
    }
}
Код:
public class ClientProxy extends CommonProxy
{
    public void preInit()
    {
        super.preInit();
    }

    public void init()
    {
        super.init();
    }

    public void postInit()
    {
        super.postInit();
    }

    @Override
    public void registerRenderers()
    {
        RenderingRegistry.registerEntityRenderingHandler(EntityShip1.class, new RenderShip1());
    }
}
Код:
@SideOnly(Side.CLIENT)
public class RenderShip1 extends Render {
    public static final ResourceLocation Ship1Texture = new ResourceLocation( constants.MODID, "textures/items/tier5rocket.png");
    IModelCustom modelShip1 = AdvancedModelLoader.loadModel(new ResourceLocation("atisoteff:obj/tier4rocket1.obj"));

    protected ResourceLocation func_110779_a(EntityShip1 entity) {
        return RenderShip1.Ship1Texture;
    }

    @Override
    protected ResourceLocation getEntityTexture(Entity entity) {
        return this.func_110779_a((EntityShip1) entity);
    }

    public void doRenderEntityShip1(EntityShip1 entity, double x, double y, double z, float yaw, float pitch) {

        GL11.glPushMatrix();
        GL11.glScaled(0.07, 0.07, 0.07);
        GL11.glTranslatef(0.5F, 0.0F, 0.5F);
        Minecraft.getMinecraft().renderEngine.bindTexture(Ship1Texture);
        modelShip1.renderAll();
        GL11.glPopMatrix();

    }

    @Override
    public void doRender(Entity entity, double x, double y, double z, float yaw, float pitch) {
        this.doRenderEntityShip1((EntityShip1) entity, x, y, z, yaw, pitch);
    }

}
 
а ты зарегал в главном классе сам Entity ?!
 
1,417
44
594
Sasha68 написал(а):
Всё, зарегал, благодарю, но...
Я чуток с рендером накосячил XD

Держи, еще методы, на всякий) (основные)
GL11.glRotatef(float, float, float, float);
GL11.glScalef(float, float, float); 
GL11.glTranslatef(float, float, float);
 
Сверху