Initial commit (Forge 1291).
This commit is contained in:
@ -0,0 +1,78 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityCreeper.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityCreeper.java
|
||||
@@ -23,6 +23,11 @@
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityCreeper extends EntityMob
|
||||
{
|
||||
private int lastActiveTime;
|
||||
@@ -207,9 +212,35 @@
|
||||
public void onStruckByLightning(EntityLightningBolt p_70077_1_)
|
||||
{
|
||||
super.onStruckByLightning(p_70077_1_);
|
||||
- this.dataWatcher.updateObject(17, Byte.valueOf((byte)1));
|
||||
+
|
||||
+ // Cauldron start
|
||||
+ if (p_70077_1_ != null)
|
||||
+ {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callCreeperPowerEvent(this, p_70077_1_, org.bukkit.event.entity.CreeperPowerEvent.PowerCause.LIGHTNING).isCancelled())
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // Cauldron end
|
||||
+
|
||||
+ this.setPowered(true);
|
||||
}
|
||||
|
||||
+ public void setPowered(boolean powered)
|
||||
+ {
|
||||
+ if (!powered)
|
||||
+ {
|
||||
+ this.dataWatcher.updateObject(17, Byte.valueOf((byte) 0));
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ this.dataWatcher.updateObject(17, Byte.valueOf((byte) 1));
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+
|
||||
protected boolean interact(EntityPlayer p_70085_1_)
|
||||
{
|
||||
ItemStack itemstack = p_70085_1_.inventory.getCurrentItem();
|
||||
@@ -235,17 +266,22 @@
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
boolean flag = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing");
|
||||
+ // CraftBukkit start
|
||||
+ float radius = this.getPowered() ? 6.0F : 3.0F;
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false);
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
- if (this.getPowered())
|
||||
+ if (!event.isCancelled())
|
||||
{
|
||||
- this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)(this.explosionRadius * 2), flag);
|
||||
+ this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, event.getRadius(), event.getFire(), flag);
|
||||
+ this.setDead();
|
||||
}
|
||||
else
|
||||
{
|
||||
- this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)this.explosionRadius, flag);
|
||||
+ this.timeSinceIgnited = 0;
|
||||
}
|
||||
|
||||
- this.setDead();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityEnderman.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityEnderman.java
|
||||
@@ -24,6 +24,12 @@
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityEnderman extends EntityMob
|
||||
{
|
||||
private static final UUID attackingSpeedBoostModifierUUID = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0");
|
||||
@@ -161,9 +167,15 @@
|
||||
|
||||
if (EntityEnderman.getCarriable(block))
|
||||
{
|
||||
- this.func_146081_a(block);
|
||||
- this.setCarryingData(this.worldObj.getBlockMetadata(k, i, j));
|
||||
- this.worldObj.setBlock(k, i, j, Blocks.air);
|
||||
+ // CraftBukkit start - Pickup event
|
||||
+ if (this.worldObj.getWorld() == null || !CraftEventFactory.callEntityChangeBlockEvent(this, this.worldObj.getWorld().getBlockAt(i, j, k), org.bukkit.Material.AIR).isCancelled()) // Cauldron
|
||||
+ {
|
||||
+ this.func_146081_a(block);
|
||||
+ this.setCarryingData(this.worldObj.getBlockMetadata(i, j, k));
|
||||
+ this.worldObj.setBlock(i, j, k, Blocks.air);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,8 +189,14 @@
|
||||
|
||||
if (block.getMaterial() == Material.air && block1.getMaterial() != Material.air && block1.renderAsNormalBlock())
|
||||
{
|
||||
- this.worldObj.setBlock(k, i, j, this.func_146080_bZ(), this.getCarryingData(), 3);
|
||||
- this.func_146081_a(Blocks.air);
|
||||
+ // CraftBukkit start - Place event
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, this.func_146080_bZ(), this.getCarryingData()).isCancelled())
|
||||
+ {
|
||||
+ this.worldObj.setBlock(i, j, k, this.func_146080_bZ(), this.getCarryingData(), 3);
|
||||
+ this.func_146081_a(Blocks.air);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -306,8 +324,19 @@
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
- this.setPosition(this.posX, this.posY, this.posZ);
|
||||
+ // CraftBukkit start - Teleport event
|
||||
+ EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.worldObj.getWorld(), d3, d4, d5), new Location(this.worldObj.getWorld(), this.posX, this.posY, this.posZ));
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(teleport);
|
||||
|
||||
+ if (teleport.isCancelled())
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ Location to = teleport.getTo();
|
||||
+ this.setPosition(to.getX(), to.getY(), to.getZ());
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox))
|
||||
{
|
||||
flag = true;
|
77
patches/net/minecraft/entity/monster/EntityGhast.java.patch
Normal file
77
patches/net/minecraft/entity/monster/EntityGhast.java.patch
Normal file
@ -0,0 +1,77 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityGhast.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityGhast.java
|
||||
@@ -18,6 +18,11 @@
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
+import org.bukkit.event.entity.EntityTargetEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityGhast extends EntityFlying implements IMob
|
||||
{
|
||||
public int courseChangeCooldown;
|
||||
@@ -117,13 +122,50 @@
|
||||
|
||||
if (this.targetedEntity != null && this.targetedEntity.isDead)
|
||||
{
|
||||
- this.targetedEntity = null;
|
||||
+ // CraftBukkit start
|
||||
+ EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED);
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ if (event.getTarget() == null)
|
||||
+ {
|
||||
+ this.targetedEntity = null;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ this.targetedEntity = ((CraftEntity) event.getTarget()).getHandle();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
if (this.targetedEntity == null || this.aggroCooldown-- <= 0)
|
||||
{
|
||||
- this.targetedEntity = this.worldObj.getClosestVulnerablePlayerToEntity(this, 100.0D);
|
||||
+ // CraftBukkit start
|
||||
+ Entity target = this.worldObj.getClosestVulnerablePlayerToEntity(this, 100.0D);
|
||||
|
||||
+ if (target != null)
|
||||
+ {
|
||||
+ EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER);
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ if (event.getTarget() == null)
|
||||
+ {
|
||||
+ this.targetedEntity = null;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ this.targetedEntity = ((CraftEntity) event.getTarget()).getHandle();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.targetedEntity != null)
|
||||
{
|
||||
this.aggroCooldown = 20;
|
||||
@@ -152,7 +194,8 @@
|
||||
{
|
||||
this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1008, (int)this.posX, (int)this.posY, (int)this.posZ, 0);
|
||||
EntityLargeFireball entitylargefireball = new EntityLargeFireball(this.worldObj, this, d5, d6, d7);
|
||||
- entitylargefireball.field_92057_e = this.explosionStrength;
|
||||
+ // CraftBukkit - set bukkitYield when setting explosionpower
|
||||
+ entitylargefireball.bukkitYield = entitylargefireball.field_92057_e = this.explosionStrength;
|
||||
double d8 = 4.0D;
|
||||
Vec3 vec3 = this.getLook(1.0F);
|
||||
entitylargefireball.posX = this.posX + vec3.xCoord * d8;
|
40
patches/net/minecraft/entity/monster/EntityMob.java.patch
Normal file
40
patches/net/minecraft/entity/monster/EntityMob.java.patch
Normal file
@ -0,0 +1,40 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityMob.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityMob.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.entity.monster;
|
||||
|
||||
+import org.bukkit.event.entity.EntityTargetEvent; // CraftBukkit
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
@@ -75,7 +76,29 @@
|
||||
{
|
||||
if (entity != this)
|
||||
{
|
||||
- this.entityToAttack = entity;
|
||||
+ // CraftBukkit start - We still need to call events for entities without goals
|
||||
+ if (entity != this.entityToAttack && (this instanceof EntityBlaze || this instanceof EntityEnderman || this instanceof EntitySpider || this instanceof EntityGiantZombie || this instanceof EntitySilverfish))
|
||||
+ {
|
||||
+ EntityTargetEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(this, entity, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ if (event.getTarget() == null)
|
||||
+ {
|
||||
+ this.entityToAttack = null;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ this.entityToAttack = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ this.entityToAttack = entity;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
return true;
|
@ -0,0 +1,42 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityPigZombie.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityPigZombie.java
|
||||
@@ -15,11 +15,13 @@
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.event.entity.EntityTargetEvent; // CraftBukkit
|
||||
+
|
||||
public class EntityPigZombie extends EntityZombie
|
||||
{
|
||||
private static final UUID field_110189_bq = UUID.fromString("49455A49-7EC5-45BA-B886-3B90B23A1718");
|
||||
private static final AttributeModifier field_110190_br = (new AttributeModifier(field_110189_bq, "Attacking speed boost", 0.45D, 0)).setSaved(false);
|
||||
- private int angerLevel;
|
||||
+ public int angerLevel; // CraftBukkit - private -> public
|
||||
private int randomSoundDelay;
|
||||
private Entity field_110191_bu;
|
||||
private static final String __OBFID = "CL_00001693";
|
||||
@@ -122,6 +124,24 @@
|
||||
|
||||
private void becomeAngryAt(Entity p_70835_1_)
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.entity.Entity bukkitTarget = p_70835_1_ == null ? null : p_70835_1_.getBukkitEntity();
|
||||
+ EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.PIG_ZOMBIE_TARGET);
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled())
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (event.getTarget() == null)
|
||||
+ {
|
||||
+ this.entityToAttack = null;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ p_70835_1_ = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle();
|
||||
+ // CraftBukkit end
|
||||
this.entityToAttack = p_70835_1_;
|
||||
this.angerLevel = 400 + this.rand.nextInt(400);
|
||||
this.randomSoundDelay = this.rand.nextInt(40);
|
@ -0,0 +1,39 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySilverfish.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySilverfish.java
|
||||
@@ -15,6 +15,8 @@
|
||||
import net.minecraft.world.World;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public class EntitySilverfish extends EntityMob
|
||||
{
|
||||
private int allySummonCooldown;
|
||||
@@ -132,6 +134,13 @@
|
||||
{
|
||||
if (this.worldObj.getBlock(i + i1, j + l, k + j1) == Blocks.monster_egg)
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, i + i1, j + l, k + j1, Blocks.air, 0).isCancelled())
|
||||
+ {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
if (!this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"))
|
||||
{
|
||||
int k1 = this.worldObj.getBlockMetadata(i + i1, j + l, k + j1);
|
||||
@@ -168,6 +177,13 @@
|
||||
|
||||
if (BlockSilverfish.func_150196_a(block))
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, i + Facing.offsetsXForSide[l1], j + Facing.offsetsYForSide[l1], k + Facing.offsetsZForSide[l1], Blocks.monster_egg, Block.getIdFromBlock(BlockSilverfish.getBlockById(i1))).isCancelled())
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
this.worldObj.setBlock(i + Facing.offsetsXForSide[l1], j + Facing.offsetsYForSide[l1], k + Facing.offsetsZForSide[l1], Blocks.monster_egg, BlockSilverfish.func_150195_a(block, i1), 3);
|
||||
this.spawnExplosionParticle();
|
||||
this.setDead();
|
@ -0,0 +1,54 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySkeleton.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySkeleton.java
|
||||
@@ -36,6 +36,8 @@
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProviderHell;
|
||||
|
||||
+import org.bukkit.event.entity.EntityCombustEvent; // CraftBukkit
|
||||
+
|
||||
public class EntitySkeleton extends EntityMob implements IRangedAttackMob
|
||||
{
|
||||
private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F);
|
||||
@@ -148,7 +150,16 @@
|
||||
|
||||
if (flag)
|
||||
{
|
||||
- this.setFire(8);
|
||||
+ // CraftBukkit start
|
||||
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ this.setFire(event.getDuration());
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -312,8 +323,23 @@
|
||||
entityarrow.setFire(100);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getHeldItem(), entityarrow, 0.8F);
|
||||
+
|
||||
+ if (event.isCancelled())
|
||||
+ {
|
||||
+ event.getProjectile().remove();
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (event.getProjectile() == entityarrow.getBukkitEntity())
|
||||
+ {
|
||||
+ worldObj.spawnEntityInWorld(entityarrow);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
|
||||
- this.worldObj.spawnEntityInWorld(entityarrow);
|
||||
+ // this.worldObj.spawnEntityInWorld(entityarrow); // CraftBukkit - moved up
|
||||
}
|
||||
|
||||
public int getSkeletonType()
|
94
patches/net/minecraft/entity/monster/EntitySlime.java.patch
Normal file
94
patches/net/minecraft/entity/monster/EntitySlime.java.patch
Normal file
@ -0,0 +1,94 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java
|
||||
@@ -14,12 +14,21 @@
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.EntityTargetEvent;
|
||||
+import org.bukkit.event.entity.SlimeSplitEvent;
|
||||
+import net.minecraft.entity.Entity;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntitySlime extends EntityLiving implements IMob
|
||||
{
|
||||
public float squishAmount;
|
||||
public float squishFactor;
|
||||
public float prevSquishFactor;
|
||||
private int slimeJumpDelay;
|
||||
+ private Entity lastTarget; // CraftBukkit
|
||||
private static final String __OBFID = "CL_00001698";
|
||||
|
||||
public EntitySlime(World p_i1742_1_)
|
||||
@@ -37,7 +46,7 @@
|
||||
this.dataWatcher.addObject(16, new Byte((byte)1));
|
||||
}
|
||||
|
||||
- protected void setSlimeSize(int p_70799_1_)
|
||||
+ public void setSlimeSize(int p_70799_1_) // CraftBukkit - protected -> public
|
||||
{
|
||||
this.dataWatcher.updateObject(16, new Byte((byte)p_70799_1_));
|
||||
this.setSize(0.6F * (float)p_70799_1_, 0.6F * (float)p_70799_1_);
|
||||
@@ -131,8 +140,27 @@
|
||||
protected void updateEntityActionState()
|
||||
{
|
||||
this.despawnEntity();
|
||||
- EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
|
||||
+ // CraftBukkit start
|
||||
+ Entity entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D); // EntityPlayer -> Entity
|
||||
+ EntityTargetEvent event = null;
|
||||
|
||||
+ if (entityplayer != null && !entityplayer.equals(lastTarget))
|
||||
+ {
|
||||
+ event = CraftEventFactory.callEntityTargetEvent(this, entityplayer, EntityTargetEvent.TargetReason.CLOSEST_PLAYER);
|
||||
+ }
|
||||
+ else if (lastTarget != null && entityplayer == null)
|
||||
+ {
|
||||
+ event = CraftEventFactory.callEntityTargetEvent(this, entityplayer, EntityTargetEvent.TargetReason.FORGOT_TARGET);
|
||||
+ }
|
||||
+
|
||||
+ if (event != null && !event.isCancelled())
|
||||
+ {
|
||||
+ entityplayer = event.getTarget() == null ? null : ((CraftEntity) event.getTarget()).getHandle();
|
||||
+ }
|
||||
+
|
||||
+ this.lastTarget = entityplayer;
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (entityplayer != null)
|
||||
{
|
||||
this.faceEntity(entityplayer, 10.0F, 20.0F);
|
||||
@@ -190,7 +218,22 @@
|
||||
if (!this.worldObj.isRemote && i > 1 && this.getHealth() <= 0.0F)
|
||||
{
|
||||
int j = 2 + this.rand.nextInt(3);
|
||||
+ // CraftBukkit start
|
||||
+ SlimeSplitEvent event = new SlimeSplitEvent((org.bukkit.entity.Slime) this.getBukkitEntity(), j);
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
+ if (!event.isCancelled() && event.getCount() > 0)
|
||||
+ {
|
||||
+ j = event.getCount();
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ super.setDead();
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
for (int k = 0; k < j; ++k)
|
||||
{
|
||||
float f = ((float)(k % 2) - 0.5F) * (float)i / 4.0F;
|
||||
@@ -198,7 +241,7 @@
|
||||
EntitySlime entityslime = this.createInstance();
|
||||
entityslime.setSlimeSize(i / 2);
|
||||
entityslime.setLocationAndAngles(this.posX + (double)f, this.posY + 0.5D, this.posZ + (double)f1, this.rand.nextFloat() * 360.0F, 0.0F);
|
||||
- this.worldObj.spawnEntityInWorld(entityslime);
|
||||
+ this.worldObj.addEntity(entityslime, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySnowman.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySnowman.java
|
||||
@@ -19,6 +19,12 @@
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
+import org.bukkit.event.block.EntityBlockFormEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntitySnowman extends EntityGolem implements IRangedAttackMob
|
||||
{
|
||||
private static final String __OBFID = "CL_00001650";
|
||||
@@ -61,7 +67,7 @@
|
||||
|
||||
if (this.worldObj.getBiomeGenForCoords(i, k).getFloatTemperature(i, j, k) > 1.0F)
|
||||
{
|
||||
- this.attackEntityFrom(DamageSource.onFire, 1.0F);
|
||||
+ this.attackEntityFrom(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
|
||||
}
|
||||
|
||||
for (int l = 0; l < 4; ++l)
|
||||
@@ -72,7 +78,18 @@
|
||||
|
||||
if (this.worldObj.getBlock(i, j, k).getMaterial() == Material.air && this.worldObj.getBiomeGenForCoords(i, k).getFloatTemperature(i, j, k) < 0.8F && Blocks.snow_layer.canPlaceBlockAt(this.worldObj, i, j, k))
|
||||
{
|
||||
- this.worldObj.setBlock(i, j, k, Blocks.snow_layer);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.BlockState blockState = this.worldObj.getWorld().getBlockAt(i, j, k).getState();
|
||||
+ blockState.setType(CraftMagicNumbers.getMaterial(Blocks.snow_layer));
|
||||
+ EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ blockState.update(true);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
38
patches/net/minecraft/entity/monster/EntitySpider.java.patch
Normal file
38
patches/net/minecraft/entity/monster/EntitySpider.java.patch
Normal file
@ -0,0 +1,38 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySpider.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySpider.java
|
||||
@@ -14,6 +14,8 @@
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.event.entity.EntityTargetEvent; // CraftBukkit
|
||||
+
|
||||
public class EntitySpider extends EntityMob
|
||||
{
|
||||
private static final String __OBFID = "CL_00001699";
|
||||
@@ -88,7 +90,25 @@
|
||||
|
||||
if (f1 > 0.5F && this.rand.nextInt(100) == 0)
|
||||
{
|
||||
- this.entityToAttack = null;
|
||||
+ // CraftBukkit start
|
||||
+ EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.FORGOT_TARGET);
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ if (event.getTarget() == null)
|
||||
+ {
|
||||
+ this.entityToAttack = null;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ this.entityToAttack = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle();
|
||||
+ }
|
||||
+
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
else
|
||||
{
|
109
patches/net/minecraft/entity/monster/EntityZombie.java.patch
Normal file
109
patches/net/minecraft/entity/monster/EntityZombie.java.patch
Normal file
@ -0,0 +1,109 @@
|
||||
--- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java
|
||||
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java
|
||||
@@ -46,6 +46,13 @@
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent;
|
||||
|
||||
+//CraftBukkit start
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||
+import org.bukkit.event.entity.EntityCombustEvent;
|
||||
+//CraftBukkit end
|
||||
+
|
||||
public class EntityZombie extends EntityMob
|
||||
{
|
||||
protected static final IAttribute field_110186_bp = (new RangedAttribute("zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).setDescription("Spawn Reinforcements Chance");
|
||||
@@ -56,6 +63,7 @@
|
||||
private boolean field_146076_bu = false;
|
||||
private float field_146074_bv = -1.0F;
|
||||
private float field_146073_bw;
|
||||
+ private int lastTick = MinecraftServer.currentTick; // CraftBukkit
|
||||
private static final String __OBFID = "CL_00001702";
|
||||
|
||||
public EntityZombie(World p_i1745_1_)
|
||||
@@ -64,7 +72,12 @@
|
||||
this.getNavigator().setBreakDoors(true);
|
||||
this.tasks.addTask(0, new EntityAISwimming(this));
|
||||
this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
|
||||
- this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityVillager.class, 1.0D, true));
|
||||
+
|
||||
+ if (p_i1745_1_.getSpigotConfig().zombieAggressiveTowardsVillager) // Cauldron
|
||||
+ {
|
||||
+ this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityVillager.class, 1.0D, true)); // Spigot
|
||||
+ }
|
||||
+
|
||||
this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D));
|
||||
this.tasks.addTask(6, new EntityAIMoveThroughVillage(this, 1.0D, false));
|
||||
this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
|
||||
@@ -72,7 +85,12 @@
|
||||
this.tasks.addTask(8, new EntityAILookIdle(this));
|
||||
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
|
||||
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
|
||||
- this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, 0, false));
|
||||
+
|
||||
+ if (p_i1745_1_.getSpigotConfig().zombieAggressiveTowardsVillager) // Cauldron
|
||||
+ {
|
||||
+ this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, 0, false)); // Spigot
|
||||
+ }
|
||||
+
|
||||
this.setSize(0.6F, 1.8F);
|
||||
}
|
||||
|
||||
@@ -204,7 +222,16 @@
|
||||
|
||||
if (flag)
|
||||
{
|
||||
- this.setFire(8);
|
||||
+ // CraftBukkit start
|
||||
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ this.setFire(event.getDuration());
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -272,7 +299,7 @@
|
||||
|
||||
if (this.worldObj.checkNoEntityCollision(entityzombie.boundingBox) && this.worldObj.getCollidingBoundingBoxes(entityzombie, entityzombie.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.boundingBox))
|
||||
{
|
||||
- this.worldObj.spawnEntityInWorld(entityzombie);
|
||||
+ this.worldObj.addEntity(entityzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
|
||||
if (entitylivingbase != null) entityzombie.setAttackTarget(entitylivingbase);
|
||||
entityzombie.onSpawnWithEgg((IEntityLivingData)null);
|
||||
this.getEntityAttribute(field_110186_bp).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0));
|
||||
@@ -292,6 +319,11 @@
|
||||
if (!this.worldObj.isRemote && this.isConverting())
|
||||
{
|
||||
int i = this.getConversionTimeBoost();
|
||||
+ // CraftBukkit start - Use wall time instead of ticks for villager conversion
|
||||
+ int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
|
||||
+ this.lastTick = MinecraftServer.currentTick;
|
||||
+ i *= elapsedTicks;
|
||||
+ // CraftBukkit end
|
||||
this.conversionTime -= i;
|
||||
|
||||
if (this.conversionTime <= 0)
|
||||
@@ -313,7 +345,16 @@
|
||||
|
||||
if (this.getHeldItem() == null && this.isBurning() && this.rand.nextFloat() < (float)i * 0.3F)
|
||||
{
|
||||
- p_70652_1_.setFire(2 * i);
|
||||
+ // CraftBukkit start
|
||||
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), p_70652_1_.getBukkitEntity(), 2 * i);
|
||||
+ this.worldObj.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ p_70652_1_.setFire(event.getDuration());
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user