Bunchafixes which may or may not have any end result

This commit is contained in:
Dinnerbone 2011-09-16 20:10:11 +01:00
parent 94d1338feb
commit 900c541246
9 changed files with 69 additions and 88 deletions

View File

@ -51,18 +51,20 @@ public class BlockMushroom extends BlockFlower {
k1 = k + random.nextInt(3) - 1;
}
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
blockState.setTypeId(this.id);
if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
blockState.setTypeId(this.id);
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
world.getServer().getPluginManager().callEvent(event);
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
blockState.update(true);
if (!event.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
}
// CraftBukkit end
}
}

View File

@ -265,43 +265,6 @@ public class BlockPiston extends Block {
int k1 = k + PistonBlockTextures.d[l];
int l1 = 0;
while (true) {
if (l1 < 13) {
if (j1 <= 0 || j1 >= 127) {
return -1; // CraftBukkit
}
int i2 = world.getTypeId(i1, j1, k1);
if (i2 != 0) {
if (!a(i2, world, i1, j1, k1, true)) {
return -1; // CraftBukkit
}
if (Block.byId[i2].e() != 1) {
if (l1 == 12) {
return -1; // CraftBukkit
}
i1 += PistonBlockTextures.b[l];
j1 += PistonBlockTextures.c[l];
k1 += PistonBlockTextures.d[l];
++l1;
continue;
}
}
}
return l1; // CraftBukkit
}
}
private static int H(World world, int i, int j, int k, int l) {
int i1 = i + PistonBlockTextures.b[l];
int j1 = j + PistonBlockTextures.c[l];
int k1 = k + PistonBlockTextures.d[l];
int l1 = 0;
while (true) {
if (l1 < 13) {
if (j1 > 0) {
@ -348,30 +311,36 @@ public class BlockPiston extends Block {
int i2;
if (l1 < 13) {
if (j1 <= 0 || j1 >= 127) {
return false;
}
label63: {
if (j1 > 0) {
world.getClass();
if (j1 < 128 - 1) {
i2 = world.getTypeId(i1, j1, k1);
if (i2 != 0) {
if (!a(i2, world, i1, j1, k1, true)) {
return false;
}
i2 = world.getTypeId(i1, j1, k1);
if (i2 != 0) {
if (!a(i2, world, i1, j1, k1, true)) {
return false;
}
if (Block.byId[i2].e() != 1) {
if (l1 == 12) {
return false;
}
if (Block.byId[i2].e() != 1) {
if (l1 == 12) {
return false;
i1 += PistonBlockTextures.b[l];
j1 += PistonBlockTextures.c[l];
k1 += PistonBlockTextures.d[l];
++l1;
continue;
}
Block.byId[i2].g(world, i1, j1, k1, world.getData(i1, j1, k1));
world.setTypeId(i1, j1, k1, 0);
}
break label63;
}
i1 += PistonBlockTextures.b[l];
j1 += PistonBlockTextures.c[l];
k1 += PistonBlockTextures.d[l];
++l1;
continue;
}
Block.byId[i2].g(world, i1, j1, k1, world.getData(i1, j1, k1));
world.setTypeId(i1, j1, k1, 0);
return false;
}
}

View File

@ -31,7 +31,11 @@ public class ChunkProviderServer implements IChunkProvider {
// CraftBukkit end
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) {
this.emptyChunk = new EmptyChunk(worldserver, new byte['\u8000'], 0, 0);
worldserver.getClass();
EmptyChunk emptychunk = new EmptyChunk(worldserver, new byte[256 * 128], 0, 0);
this.emptyChunk = emptychunk;
this.world = worldserver;
this.e = ichunkloader;
this.chunkProvider = ichunkprovider;

View File

@ -203,6 +203,10 @@ public class EntityArrow extends Entity {
}
if (stick) {
// CraftBukkit end
if (movingobjectposition.entity instanceof EntityLiving) {
++((EntityLiving) movingobjectposition.entity).aD;
}
this.world.makeSound(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
this.die();
} else {

View File

@ -117,7 +117,7 @@ public class EntityWeatherStorm extends EntityWeather {
entity.a(this);
}
this.world.n = 2;
this.world.s = 2;
}
}

View File

@ -384,8 +384,7 @@ public class EntityWolf extends EntityAnimal {
if (itemfood.m() && this.datawatcher.b(18) < 20) {
--itemstack.count;
this.c(((ItemFood) Item.PORK).k(), RegainReason.EATING); // Craftbukkit
this.c(itemfood.k(), RegainReason.EATING); // Craftbukkit
if (itemstack.count <= 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
}

View File

@ -80,8 +80,11 @@ public class ItemReed extends Item {
world.update(i, j, k, this.id); // <-- world.setTypeId does this on success (tell the world)
// CraftBukkit end
Block.byId[this.id].postPlace(world, i, j, k, l);
Block.byId[this.id].postPlace(world, i, j, k, entityhuman);
if (world.getTypeId(i, j, k) == this.id) {
Block.byId[this.id].postPlace(world, i, j, k, l);
Block.byId[this.id].postPlace(world, i, j, k, entityhuman);
}
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getName(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
--itemstack.count;
}

View File

@ -238,34 +238,34 @@ public class MinecraftServer implements Runnable, ICommandListener {
// CraftBukkit end
short short1 = 196;
long k = System.currentTimeMillis();
long l = System.currentTimeMillis();
// CraftBukkit start
for (int l = 0; l < this.worlds.size(); ++l) {
// if (l == 0 || this.propertyManager.getBoolean("allow-nether", true)) {
WorldServer worldserver = this.worlds.get(l);
log.info("Preparing start region for level " + l + " (Seed: " + worldserver.getSeed() + ")");
for (int i1 = 0; i1 < this.worlds.size(); ++i1) {
// if (i1 == 0 || this.propertyManager.getBoolean("allow-nether", true)) {
WorldServer worldserver = this.worlds.get(i1);
log.info("Preparing start region for level " + i1 + " (Seed: " + worldserver.getSeed() + ")");
if (worldserver.getWorld().getKeepSpawnInMemory()) {
// CraftBukkit end
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
for (int i1 = -short1; i1 <= short1 && this.isRunning; i1 += 16) {
for (int j1 = -short1; j1 <= short1 && this.isRunning; j1 += 16) {
long k1 = System.currentTimeMillis();
for (int j1 = -short1; j1 <= short1 && this.isRunning; j1 += 16) {
for (int k1 = -short1; k1 <= short1 && this.isRunning; k1 += 16) {
long l1 = System.currentTimeMillis();
if (k1 < k) {
k = k1;
if (l1 < l) {
l = l1;
}
if (k1 > k + 1000L) {
int l1 = (short1 * 2 + 1) * (short1 * 2 + 1);
int i2 = (i1 + short1) * (short1 * 2 + 1) + j1 + 1;
if (l1 > l + 1000L) {
int i2 = (short1 * 2 + 1) * (short1 * 2 + 1);
int j2 = (j1 + short1) * (short1 * 2 + 1) + k1 + 1;
this.a("Preparing spawn area", i2 * 100 / l1);
k = k1;
this.a("Preparing spawn area", j2 * 100 / i2);
l = l1;
}
worldserver.chunkProviderServer.getChunkAt(chunkcoordinates.x + i1 >> 4, chunkcoordinates.z + j1 >> 4);
worldserver.chunkProviderServer.getChunkAt(chunkcoordinates.x + j1 >> 4, chunkcoordinates.z + k1 >> 4);
while (worldserver.v() && this.isRunning) {
;

View File

@ -768,7 +768,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
a.info(s);
this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat(s));
} else if (s.toLowerCase().startsWith("/kill")) {
this.player.damageEntity(DamageSource.j, 1000);
this.player.damageEntity(DamageSource.GENERIC, 1000);
} else if (s.toLowerCase().startsWith("/tell ")) {
String[] astring = s.split(" ");