mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-14 11:45:52 -07:00
Update for 1.6.6
This commit is contained in:
@@ -78,10 +78,12 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
this.sleepTicks = 100;
|
||||
}
|
||||
|
||||
if (!this.o()) {
|
||||
this.a(true, true, false);
|
||||
} else if (!this.world.isStatic && this.world.d()) {
|
||||
this.a(false, true, true);
|
||||
if (!this.world.isStatic) {
|
||||
if (!this.o()) {
|
||||
this.a(true, true, false);
|
||||
} else if (this.world.d()) {
|
||||
this.a(false, true, true);
|
||||
}
|
||||
}
|
||||
} else if (this.sleepTicks > 0) {
|
||||
++this.sleepTicks;
|
||||
@@ -375,7 +377,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
if (this.health <= 0) {
|
||||
return false;
|
||||
} else {
|
||||
if (this.isSleeping()) {
|
||||
if (this.isSleeping() && !this.world.isStatic) {
|
||||
this.a(true, true, false);
|
||||
}
|
||||
|
||||
@@ -568,72 +570,78 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
}
|
||||
|
||||
public EnumBedError a(int i, int j, int k) {
|
||||
if (!this.isSleeping() && this.S()) {
|
||||
if (!this.world.isStatic) {
|
||||
if (this.isSleeping() || !this.S()) {
|
||||
return EnumBedError.OTHER_PROBLEM;
|
||||
}
|
||||
|
||||
if (this.world.worldProvider.c) {
|
||||
return EnumBedError.NOT_POSSIBLE_HERE;
|
||||
} else if (this.world.d()) {
|
||||
}
|
||||
|
||||
if (this.world.d()) {
|
||||
return EnumBedError.NOT_POSSIBLE_NOW;
|
||||
} else if (Math.abs(this.locX - (double) i) <= 3.0D && Math.abs(this.locY - (double) j) <= 2.0D && Math.abs(this.locZ - (double) k) <= 3.0D) {
|
||||
// CraftBukkit start
|
||||
if (this.getBukkitEntity() instanceof Player) {
|
||||
Player player = (Player) this.getBukkitEntity();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
org.bukkit.block.Block bed = ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
||||
PlayerBedEnterEvent event = new PlayerBedEnterEvent(player, bed);
|
||||
server.getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return EnumBedError.OTHER_PROBLEM;
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.b(0.2F, 0.2F);
|
||||
this.height = 0.2F;
|
||||
if (this.world.isLoaded(i, j, k)) {
|
||||
int l = this.world.getData(i, j, k);
|
||||
int i1 = BlockBed.c(l);
|
||||
float f = 0.5F;
|
||||
float f1 = 0.5F;
|
||||
|
||||
switch (i1) {
|
||||
case 0:
|
||||
f1 = 0.9F;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
f = 0.1F;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
f1 = 0.1F;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
f = 0.9F;
|
||||
}
|
||||
|
||||
this.e(i1);
|
||||
this.setPosition((double) ((float) i + f), (double) ((float) j + 0.9375F), (double) ((float) k + f1));
|
||||
} else {
|
||||
this.setPosition((double) ((float) i + 0.5F), (double) ((float) j + 0.9375F), (double) ((float) k + 0.5F));
|
||||
}
|
||||
|
||||
this.sleeping = true;
|
||||
this.sleepTicks = 0;
|
||||
this.A = new ChunkCoordinates(i, j, k);
|
||||
this.motX = this.motZ = this.motY = 0.0D;
|
||||
if (!this.world.isStatic) {
|
||||
this.world.everyoneSleeping();
|
||||
}
|
||||
|
||||
return EnumBedError.OK;
|
||||
} else {
|
||||
if (Math.abs(this.locX - (double) i) > 3.0D || Math.abs(this.locY - (double) j) > 2.0D || Math.abs(this.locZ - (double) k) > 3.0D) {
|
||||
return EnumBedError.TOO_FAR_AWAY;
|
||||
}
|
||||
} else {
|
||||
return EnumBedError.OTHER_PROBLEM;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
if (this.getBukkitEntity() instanceof Player) {
|
||||
Player player = (Player) this.getBukkitEntity();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
org.bukkit.block.Block bed = ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
||||
PlayerBedEnterEvent event = new PlayerBedEnterEvent(player, bed);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return EnumBedError.OTHER_PROBLEM;
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.b(0.2F, 0.2F);
|
||||
this.height = 0.2F;
|
||||
if (this.world.isLoaded(i, j, k)) {
|
||||
int l = this.world.getData(i, j, k);
|
||||
int i1 = BlockBed.c(l);
|
||||
float f = 0.5F;
|
||||
float f1 = 0.5F;
|
||||
|
||||
switch (i1) {
|
||||
case 0:
|
||||
f1 = 0.9F;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
f = 0.1F;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
f1 = 0.1F;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
f = 0.9F;
|
||||
}
|
||||
|
||||
this.e(i1);
|
||||
this.setPosition((double) ((float) i + f), (double) ((float) j + 0.9375F), (double) ((float) k + f1));
|
||||
} else {
|
||||
this.setPosition((double) ((float) i + 0.5F), (double) ((float) j + 0.9375F), (double) ((float) k + 0.5F));
|
||||
}
|
||||
|
||||
this.sleeping = true;
|
||||
this.sleepTicks = 0;
|
||||
this.A = new ChunkCoordinates(i, j, k);
|
||||
this.motX = this.motZ = this.motY = 0.0D;
|
||||
if (!this.world.isStatic) {
|
||||
this.world.everyoneSleeping();
|
||||
}
|
||||
|
||||
return EnumBedError.OK;
|
||||
}
|
||||
|
||||
private void e(int i) {
|
||||
|
Reference in New Issue
Block a user