Берешь такой, открываешь рендер снежка...По типу снежка
Мне всё больше и больше нравятся такие "умники"...Берешь такой, открываешь рендер снежка...
А дальше копипастишь код и используешь в своих нуждах.
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();
}
}
@SideOnly(Side.CLIENT)
public void initClient(){
RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new RenderSnowball(Твойитем));
}
Тебя рендер просили показать, а не энтити(Найс кодер)
Таким образом, энтити возьмёт текстуру твоего предметаJava:@SideOnly(Side.CLIENT) public void initClient(){ RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new RenderSnowball(Твойитем)); }
v. 1.7.10
Я делал для предмета ентити, и вот как-то так:
(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.12 RenderSnowball(RenderManager manager, Item item, RenderItem render);Рад стараться))
Возможно. Говорю же. Код для 1.7.10. На других не пишу)На 1.12 RenderSnowball(RenderManager manager, Item item, RenderItem render);