Рендер EntityThrowable

Версия Minecraft
1.12.2
192
2
9
Подскажите, пожалуйста, знатоки, как рендерить EntityThrowable? По типу снежка
 
3,005
192
592
192
2
9
Берешь такой, открываешь рендер снежка...
А дальше копипастишь код и используешь в своих нуждах.
Мне всё больше и больше нравятся такие "умники"...
Я бы наверное не задавал вопроса, если бы меня устроило всё там или если бы я нашел то, что мне необходимо в том снежке, не?
 
1,417
44
594
Я делал для предмета ентити, и вот как-то так:
(1.7.10, на других пока не пишу)

Java:
public class EntityThrowingRock extends EntityThrowable
{
    public EntityThrowingRock(World world) {
        super(world);
    }

    public EntityThrowingRock(World world, EntityLivingBase entity) {
        super(world, entity);
    }

    public EntityThrowingRock(World world, double par2, double par4, double par6) {
        super(world, par2, par4, par6);
    }
    
    @Override
    protected float getGravityVelocity() {
        return inGround ? 0.0F : super.getGravityVelocity();
    }

    @Override
    protected void onImpact(MovingObjectPosition mop)
    {
        if (!inGround) {
            for (int l = 0; l < 4; ++l) {
                worldObj.spawnParticle("crit", posX, posY, posZ, 0.0D, 0.0D, 0.0D);
            }
        }
        
        if (mop.entityHit != null && !inGround) {
            mop.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, getThrower()), 2.0F);
        } else {
            this.motionX = (double)((float)(mop.hitVec.xCoord - this.posX));
            this.motionY = (double)((float)(mop.hitVec.yCoord - this.posY));
            this.motionZ = (double)((float)(mop.hitVec.zCoord - this.posZ));
            float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
            this.posX -= this.motionX / (double) f2 * 0.05000000074505806D;
            this.posY -= this.motionY / (double) f2 * 0.05000000074505806D;
            this.posZ -= this.motionZ / (double) f2 * 0.05000000074505806D;
            inGround = true;
        }
        
        if (!worldObj.isRemote) {
            //setDead();
        }
    }
    
    @Override
    public void onCollideWithPlayer(EntityPlayer player) {
        if (inGround && !worldObj.isRemote) {
            System.out.println("[ROCK] Picking up rock.");
            player.inventory.addItemStackToInventory(new ItemStack(/*Гл. класс + как зареган предмет*/Core.throwingRock));
            setDead();
        }
    }
 
1,007
36
206
Тебя рендер просили показать, а не энтити(Найс кодер)
Java:
@SideOnly(Side.CLIENT)
    public void initClient(){
      
        RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new RenderSnowball(Твойитем));
      
    }
Таким образом, энтити возьмёт текстуру твоего предмета
v. 1.7.10
 
192
2
9
Тебя рендер просили показать, а не энтити(Найс кодер)
Java:
@SideOnly(Side.CLIENT)
    public void initClient(){
     
        RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new RenderSnowball(Твойитем));
     
    }
Таким образом, энтити возьмёт текстуру твоего предмета
v. 1.7.10

Спасибо, попробуем.
 
192
2
9
Я делал для предмета ентити, и вот как-то так:
(1.7.10, на других пока не пишу)

Java:
public class EntityThrowingRock extends EntityThrowable
{
    public EntityThrowingRock(World world) {
        super(world);
    }

    public EntityThrowingRock(World world, EntityLivingBase entity) {
        super(world, entity);
    }

    public EntityThrowingRock(World world, double par2, double par4, double par6) {
        super(world, par2, par4, par6);
    }
   
    @Override
    protected float getGravityVelocity() {
        return inGround ? 0.0F : super.getGravityVelocity();
    }

    @Override
    protected void onImpact(MovingObjectPosition mop)
    {
        if (!inGround) {
            for (int l = 0; l < 4; ++l) {
                worldObj.spawnParticle("crit", posX, posY, posZ, 0.0D, 0.0D, 0.0D);
            }
        }
       
        if (mop.entityHit != null && !inGround) {
            mop.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, getThrower()), 2.0F);
        } else {
            this.motionX = (double)((float)(mop.hitVec.xCoord - this.posX));
            this.motionY = (double)((float)(mop.hitVec.yCoord - this.posY));
            this.motionZ = (double)((float)(mop.hitVec.zCoord - this.posZ));
            float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
            this.posX -= this.motionX / (double) f2 * 0.05000000074505806D;
            this.posY -= this.motionY / (double) f2 * 0.05000000074505806D;
            this.posZ -= this.motionZ / (double) f2 * 0.05000000074505806D;
            inGround = true;
        }
       
        if (!worldObj.isRemote) {
            //setDead();
        }
    }
   
    @Override
    public void onCollideWithPlayer(EntityPlayer player) {
        if (inGround && !worldObj.isRemote) {
            System.out.println("[ROCK] Picking up rock.");
            player.inventory.addItemStackToInventory(new ItemStack(/*Гл. класс + как зареган предмет*/Core.throwingRock));
            setDead();
        }
    }

Возможно тоже пригодится) Благодарю
 
Сверху