ReyMagos
Тег-бомбастер
- 412
- 7
- 121
Java:
public class EntityBullet extends EntityThrowable {
public EntityBullet(World world) {
super(world);
}
public EntityBullet(World world, EntityLivingBase thrower) {
super(world, thrower);
}
public EntityBullet(World world, double x, double y, double z) {
super(world, x, y, z);
}
@Override
@SideOnly(Side.CLIENT)
public void handleStatusUpdate(byte id) {
if (id == 3) {
for (int i = 0; i < 8; ++i) {
// this.world.spawnParticle(EnumParticleTypes.getParticleFromId(Block.getIdFromBlock(world.getBlockState(this.getPosition()).getBlock())), this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
this.world.spawnParticle(EnumParticleTypes.CRIT_MAGIC, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
}
}
}
@Override
protected void onImpact(RayTraceResult result) {
if (result.entityHit != null) {
int damage = 6;
result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float) damage);
}
if (!this.world.isRemote) {
this.world.setEntityState(this, (byte) 3);
this.setDead();
}
}
}
Java:
public class CommonProxy {
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
ItemsRegister.register();
BlocksRegister.register();
EntityRegistry.registerModEntity(new ResourceLocation("redmod", "bullet"), EntityBullet.class, "redmod:bullet", 0, RedModMain.instance, 64, 20, true);
//MinecraftForge.EVENT_BUS.register(new test.redmod.blocks.EventHandler());
}
@EventHandler
public void init(FMLInitializationEvent event) {
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
}
}