#1100: Add methods to get sounds from entities
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
@@ -253,7 +253,28 @@
|
||||
if (this.onGround) {
|
||||
block.stepOn(this.level, blockposition, iblockdata, this);
|
||||
}
|
||||
@@ -1290,6 +1466,7 @@
|
||||
@@ -938,6 +1114,20 @@
|
||||
return SoundEffects.GENERIC_SPLASH;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Add delegate methods
|
||||
+ public SoundEffect getSwimSound0() {
|
||||
+ return getSwimSound();
|
||||
+ }
|
||||
+
|
||||
+ public SoundEffect getSwimSplashSound0() {
|
||||
+ return getSwimSplashSound();
|
||||
+ }
|
||||
+
|
||||
+ public SoundEffect getSwimHighSpeedSplashSound0() {
|
||||
+ return getSwimHighSpeedSplashSound();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
protected void checkInsideBlocks() {
|
||||
AxisAlignedBB axisalignedbb = this.getBoundingBox();
|
||||
BlockPosition blockposition = new BlockPosition(axisalignedbb.minX + 0.001D, axisalignedbb.minY + 0.001D, axisalignedbb.minZ + 0.001D);
|
||||
@@ -1290,6 +1480,7 @@
|
||||
this.yo = d1;
|
||||
this.zo = d4;
|
||||
this.setPos(d3, d1, d4);
|
||||
@@ -261,7 +282,7 @@
|
||||
}
|
||||
|
||||
public void moveTo(Vec3D vec3d) {
|
||||
@@ -1480,6 +1657,12 @@
|
||||
@@ -1480,6 +1671,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -274,7 +295,7 @@
|
||||
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
|
||||
@@ -1513,7 +1696,7 @@
|
||||
@@ -1513,7 +1710,7 @@
|
||||
} else {
|
||||
String s = this.getEncodeId();
|
||||
|
||||
@@ -283,7 +304,7 @@
|
||||
return false;
|
||||
} else {
|
||||
nbttagcompound.putString("id", s);
|
||||
@@ -1538,6 +1721,18 @@
|
||||
@@ -1538,6 +1735,18 @@
|
||||
Vec3D vec3d = this.getDeltaMovement();
|
||||
|
||||
nbttagcompound.put("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z));
|
||||
@@ -302,7 +323,7 @@
|
||||
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
|
||||
nbttagcompound.putFloat("FallDistance", this.fallDistance);
|
||||
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
|
||||
@@ -1546,6 +1741,22 @@
|
||||
@@ -1546,6 +1755,22 @@
|
||||
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
|
||||
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
|
||||
nbttagcompound.putUUID("UUID", this.getUUID());
|
||||
@@ -325,7 +346,7 @@
|
||||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||
|
||||
if (ichatbasecomponent != null) {
|
||||
@@ -1613,6 +1824,11 @@
|
||||
@@ -1613,6 +1838,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +358,7 @@
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -1696,6 +1912,44 @@
|
||||
@@ -1696,6 +1926,44 @@
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
}
|
||||
@@ -382,7 +403,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||
@@ -1771,9 +2025,22 @@
|
||||
@@ -1771,9 +2039,22 @@
|
||||
} else if (this.level.isClientSide) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -405,7 +426,7 @@
|
||||
this.level.addFreshEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -1867,7 +2134,7 @@
|
||||
@@ -1867,7 +2148,7 @@
|
||||
|
||||
this.setPose(EntityPose.STANDING);
|
||||
this.vehicle = entity;
|
||||
@@ -414,7 +435,7 @@
|
||||
entity.getIndirectPassengersStream().filter((entity2) -> {
|
||||
return entity2 instanceof EntityPlayer;
|
||||
}).forEach((entity2) -> {
|
||||
@@ -1898,7 +2165,7 @@
|
||||
@@ -1898,7 +2179,7 @@
|
||||
Entity entity = this.vehicle;
|
||||
|
||||
this.vehicle = null;
|
||||
@@ -423,7 +444,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1907,10 +2174,31 @@
|
||||
@@ -1907,10 +2188,31 @@
|
||||
this.removeVehicle();
|
||||
}
|
||||
|
||||
@@ -456,7 +477,7 @@
|
||||
if (this.passengers.isEmpty()) {
|
||||
this.passengers = ImmutableList.of(entity);
|
||||
} else {
|
||||
@@ -1926,12 +2214,32 @@
|
||||
@@ -1926,12 +2228,32 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -490,7 +511,7 @@
|
||||
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
|
||||
this.passengers = ImmutableList.of();
|
||||
} else {
|
||||
@@ -1942,6 +2250,7 @@
|
||||
@@ -1942,6 +2264,7 @@
|
||||
|
||||
entity.boardingCooldown = 60;
|
||||
}
|
||||
@@ -498,7 +519,7 @@
|
||||
}
|
||||
|
||||
protected boolean canAddPassenger(Entity entity) {
|
||||
@@ -2004,14 +2313,20 @@
|
||||
@@ -2004,14 +2327,20 @@
|
||||
|
||||
if (this.isInsidePortal) {
|
||||
MinecraftServer minecraftserver = worldserver.getServer();
|
||||
@@ -522,7 +543,7 @@
|
||||
this.level.getProfiler().pop();
|
||||
}
|
||||
|
||||
@@ -2129,6 +2444,13 @@
|
||||
@@ -2129,6 +2458,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean flag) {
|
||||
@@ -536,7 +557,7 @@
|
||||
this.setSharedFlag(4, flag);
|
||||
}
|
||||
|
||||
@@ -2174,8 +2496,12 @@
|
||||
@@ -2174,8 +2510,12 @@
|
||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
|
||||
}
|
||||
|
||||
@@ -550,7 +571,7 @@
|
||||
}
|
||||
|
||||
public boolean getSharedFlag(int i) {
|
||||
@@ -2194,7 +2520,7 @@
|
||||
@@ -2194,7 +2534,7 @@
|
||||
}
|
||||
|
||||
public int getMaxAirSupply() {
|
||||
@@ -559,7 +580,7 @@
|
||||
}
|
||||
|
||||
public int getAirSupply() {
|
||||
@@ -2202,7 +2528,18 @@
|
||||
@@ -2202,7 +2542,18 @@
|
||||
}
|
||||
|
||||
public void setAirSupply(int i) {
|
||||
@@ -579,7 +600,7 @@
|
||||
}
|
||||
|
||||
public int getTicksFrozen() {
|
||||
@@ -2229,11 +2566,41 @@
|
||||
@@ -2229,11 +2580,41 @@
|
||||
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||
@@ -598,8 +619,9 @@
|
||||
+ this.setSecondsOnFire(entityCombustEvent.getDuration(), false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
- this.hurt(DamageSource.LIGHTNING_BOLT, 5.0F);
|
||||
+ // CraftBukkit start
|
||||
+ if (thisBukkitEntity instanceof Hanging) {
|
||||
+ HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity);
|
||||
@@ -608,9 +630,8 @@
|
||||
+ if (hangingEvent.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
|
||||
- this.hurt(DamageSource.LIGHTNING_BOLT, 5.0F);
|
||||
+ }
|
||||
+
|
||||
+ if (this.fireImmune()) {
|
||||
+ return;
|
||||
+ }
|
||||
@@ -623,7 +644,7 @@
|
||||
}
|
||||
|
||||
public void onAboveBubbleCol(boolean flag) {
|
||||
@@ -2391,15 +2758,38 @@
|
||||
@@ -2391,15 +2772,38 @@
|
||||
|
||||
@Nullable
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
@@ -664,7 +685,7 @@
|
||||
this.level.getProfiler().popPush("reloading");
|
||||
Entity entity = this.getType().create(worldserver);
|
||||
|
||||
@@ -2408,9 +2798,17 @@
|
||||
@@ -2408,9 +2812,17 @@
|
||||
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
|
||||
entity.setDeltaMovement(shapedetectorshape.speed);
|
||||
worldserver.addDuringTeleport(entity);
|
||||
@@ -672,19 +693,19 @@
|
||||
- WorldServer.makeObsidianPlatform(worldserver);
|
||||
+ if (worldserver.getTypeKey() == WorldDimension.END) { // CraftBukkit
|
||||
+ WorldServer.makeObsidianPlatform(worldserver, this); // CraftBukkit
|
||||
+ }
|
||||
}
|
||||
+ // CraftBukkit start - Forward the CraftEntity to the new entity
|
||||
+ this.getBukkitEntity().setHandle(entity);
|
||||
+ entity.bukkitEntity = this.getBukkitEntity();
|
||||
+
|
||||
+ if (this instanceof EntityInsentient) {
|
||||
+ ((EntityInsentient) this).dropLeash(true, false); // Unleash to prevent duping of leads.
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.removeAfterChangingDimensions();
|
||||
@@ -2431,20 +2829,34 @@
|
||||
@@ -2431,20 +2843,34 @@
|
||||
|
||||
@Nullable
|
||||
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
|
||||
@@ -724,7 +745,7 @@
|
||||
IBlockData iblockdata = this.level.getBlockState(this.portalEntrancePos);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis;
|
||||
Vec3D vec3d;
|
||||
@@ -2461,8 +2873,8 @@
|
||||
@@ -2461,8 +2887,8 @@
|
||||
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
@@ -735,7 +756,7 @@
|
||||
}
|
||||
} else {
|
||||
BlockPosition blockposition1;
|
||||
@@ -2472,8 +2884,14 @@
|
||||
@@ -2472,8 +2898,14 @@
|
||||
} else {
|
||||
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
|
||||
}
|
||||
@@ -751,7 +772,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2481,8 +2899,23 @@
|
||||
@@ -2481,8 +2913,23 @@
|
||||
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
|
||||
}
|
||||
|
||||
@@ -777,7 +798,7 @@
|
||||
}
|
||||
|
||||
public boolean canChangeDimensions() {
|
||||
@@ -2691,7 +3124,26 @@
|
||||
@@ -2691,7 +3138,26 @@
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
|
||||
@@ -805,7 +826,7 @@
|
||||
}
|
||||
|
||||
protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) {
|
||||
@@ -2979,6 +3431,11 @@
|
||||
@@ -2979,6 +3445,11 @@
|
||||
vec3d = vec3d.add(vec3d1);
|
||||
++k1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user