Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PowPowBombEntity extends ProjectileItemEntity
- {
- public int explosionPower = 2;
- public PowPowBombEntity(EntityType<PowPowBombEntity> type, World worldIn) {
- super(type,worldIn);
- }
- public PowPowBombEntity(LivingEntity entity, World worldIn){
- super(EntityList.POWPOW_BOMB.get(), entity, worldIn);
- }
- public PowPowBombEntity(double x, double y, double z, World worldIn){
- super(EntityList.POWPOW_BOMB.get(), x, y, z, worldIn);
- }
- @Override
- protected Item getDefaultItem() {
- return ItemList.POWPOW_BOMB.get().asItem();
- }
- @Override
- public IPacket<?> createSpawnPacket() {
- return NetworkHooks.getEntitySpawningPacket(this);
- }
- @Override
- protected void onImpact(RayTraceResult result) {
- if(!world.isRemote)
- {
- boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this.func_234616_v_());
- this.world.createExplosion((Entity)null, this.getPosX(), this.getPosY(), this.getPosZ(), (float)this.explosionPower, false, flag ? Explosion.Mode.NONE : Explosion.Mode.NONE);
- this.remove();
- }
- }
- @Override
- public void onAddedToWorld() {
- if(!world.isRemote)
- this.world.playSound((PlayerEntity)null, this.getPosX(), this.getPosY(), this.getPosZ(), SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.NEUTRAL, 1.0F, 1.0F);
- }
- @Override
- public void onRemovedFromWorld()
- {
- int k = 2 + this.rand.nextInt(3);
- if(!world.isRemote && this.isEntityEqual(this.getEntity()))
- {
- for(int l = 0; l < k; ++l) {
- PowPowBombEntity powpow1 = new PowPowBombEntity(EntityList.POWPOW_BOMB.get(), world);
- float f1 = ((float)(l % 2) - 0.5F) * 4.0F;
- float f2 = ((float)(l / 2) - 0.5F) * 4.0F;
- powpow1.setLocationAndAngles(this.getPosX() + (double)f1, this.getPosY() + 0.5D, this.getPosZ() + (double)f2, this.rand.nextFloat() * 360.0F, 0.0F);
- world.addEntity(powpow1);
- }
- }
- }
- public void tick()
- {
- super.tick();
- if (this.world.isRemote) {
- this.world.addParticle(ParticleTypes.SMOKE, this.getPosX(), this.getPosY() - 0.3D, this.getPosZ(), this.rand.nextGaussian() * 0.05D, -this.getMotion().y * 0.5D, this.rand.nextGaussian() * 0.05D);
- }
- if(!this.world.isRemote && this.ticksExisted == 45) {
- boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this.func_234616_v_());
- this.world.createExplosion((Entity)null, this.getPosX(), this.getPosY(), this.getPosZ(), (float)this.explosionPower, false, flag ? Explosion.Mode.NONE : Explosion.Mode.NONE);
- this.remove();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment