Updated version to 1.2.5-R0.1-SNAPSHOT

This commit is contained in:
Dinnerbone (Laptop) 2012-03-30 23:33:51 +02:00
parent e0c01154b0
commit 1fa4d8430e
15 changed files with 100 additions and 166 deletions

View File

@ -4,7 +4,7 @@
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<packaging>jar</packaging>
<version>1.2.4-R1.1-SNAPSHOT</version>
<version>1.2.5-R0.1-SNAPSHOT</version>
<name>CraftBukkit</name>
<url>http://www.bukkit.org</url>
@ -51,14 +51,14 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.2.4-R1.1-SNAPSHOT</version>
<version>1.2.5-R0.1-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>minecraft-server</artifactId>
<version>1.2.4</version>
<version>1.2.5</version>
<type>jar</type>
<scope>compile</scope>
</dependency>

View File

@ -54,15 +54,17 @@ public class BlockTNT extends Block {
}
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
if (entityhuman.U() != null && entityhuman.U().id == Item.FLINT_AND_STEEL.id) {
world.setRawData(i, j, k, 1);
}
super.attack(world, i, j, k, entityhuman);
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
return super.interact(world, i, j, k, entityhuman);
if (entityhuman.U() != null && entityhuman.U().id == Item.FLINT_AND_STEEL.id) {
this.postBreak(world, i, j, k, 1);
world.setTypeId(i, j, k, 0);
return true;
} else {
return super.interact(world, i, j, k, entityhuman);
}
}
protected ItemStack a_(int i) {

View File

@ -96,12 +96,20 @@ public class ContainerFurnace extends Container {
}
slot.a(itemstack1, itemstack);
} else if (i >= 3 && i < 30) {
if (!this.a(itemstack1, 30, 39, false)) {
return null;
}
} else if (i >= 30 && i < 39) {
if (!this.a(itemstack1, 3, 30, false)) {
} else if (i != 1 && i != 0) {
if (FurnaceRecipes.getInstance().getResult(itemstack1.getItem().id) != null) {
if (!this.a(itemstack1, 0, 1, false)) {
return null;
}
} else if (TileEntityFurnace.isFuel(itemstack1)) {
if (!this.a(itemstack1, 1, 2, false)) {
return null;
}
} else if (i >= 3 && i < 30) {
if (!this.a(itemstack1, 30, 39, false)) {
return null;
}
} else if (i >= 30 && i < 39 && !this.a(itemstack1, 3, 30, false)) {
return null;
}
} else if (!this.a(itemstack1, 3, 39, false)) {

View File

@ -12,9 +12,18 @@ public class EntityMushroomCow extends EntityCow {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.BOWL.id && this.getAge() >= 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, new ItemStack(Item.MUSHROOM_SOUP));
return true;
} else if (itemstack != null && itemstack.id == Item.SHEARS.id && this.getAge() >= 0) {
if (itemstack.count == 1) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, new ItemStack(Item.MUSHROOM_SOUP));
return true;
}
if (entityhuman.inventory.pickup(new ItemStack(Item.MUSHROOM_SOUP)) && !entityhuman.abilities.canInstantlyBuild) {
entityhuman.inventory.splitStack(entityhuman.inventory.itemInHandIndex, 1);
return true;
}
}
if (itemstack != null && itemstack.id == Item.SHEARS.id && this.getAge() >= 0) {
// CraftBukkit start
org.bukkit.event.player.PlayerShearEntityEvent event = new org.bukkit.event.player.PlayerShearEntityEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), this.getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(event);

View File

@ -13,8 +13,8 @@ public class EntityOcelot extends EntityTameableAnimal {
this.goalSelector.a(2, this.a);
this.goalSelector.a(3, this.b = new PathfinderGoalTempt(this, 0.18F, Item.RAW_FISH.id, true));
this.goalSelector.a(4, new PathfinderGoalAvoidPlayer(this, EntityHuman.class, 16.0F, 0.23F, 0.4F));
this.goalSelector.a(5, new PathfinderGoalJumpOnBlock(this, 0.4F));
this.goalSelector.a(6, new PathfinderGoalFollowOwner(this, 0.3F, 10.0F, 5.0F));
this.goalSelector.a(5, new PathfinderGoalFollowOwner(this, 0.3F, 10.0F, 5.0F));
this.goalSelector.a(6, new PathfinderGoalJumpOnBlock(this, 0.4F));
this.goalSelector.a(7, new PathfinderGoalLeapAtTarget(this, 0.3F));
this.goalSelector.a(8, new PathfinderGoalOzelotAttack(this));
this.goalSelector.a(9, new PathfinderGoalBreed(this, 0.23F));

View File

@ -180,7 +180,10 @@ public class EntityWolf extends EntityTameableAnimal {
if (!this.isTamed()) {
if (itemstack != null && itemstack.id == Item.BONE.id && !this.isAngry()) {
--itemstack.count;
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
}
if (itemstack.count <= 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
}
@ -209,8 +212,11 @@ public class EntityWolf extends EntityTameableAnimal {
ItemFood itemfood = (ItemFood) Item.byId[itemstack.id];
if (itemfood.q() && this.datawatcher.getInt(18) < 20) {
--itemstack.count;
this.heal(itemfood.getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
}
this.heal(itemfood.getNutrition());
if (itemstack.count <= 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
}

View File

@ -112,7 +112,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true));
// CraftBukkit end
log.info("Starting minecraft server version 1.2.4");
log.info("Starting minecraft server version 1.2.5");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
log.warning("**** NOT ENOUGH RAM!");
log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
@ -185,13 +185,10 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
this.propertyManager.a("max-build-height", Integer.valueOf(this.t));
log.info("Preparing level \"" + s + "\"");
this.a(new WorldLoaderServer(server.getWorldContainer()), s, j, worldtype); // CraftBukkit - world container
long l = System.nanoTime() - i;
String s3 = String.format("%.3fs", new Object[] { Double.valueOf((double) l / 1.0E9D)});
// CraftBukkit start - display seconds for the completion time
long elapsed = System.nanoTime() - i;
String time = String.format("%.3fs", elapsed / 1000000000.0D);
log.info("Done (" + time + ")! For help, type \"help\" or \"?\"");
// CraftBukkit end
log.info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
if (this.propertyManager.getBoolean("enable-query", false)) {
log.info("Starting GS4 status listener");
this.I = new RemoteStatusListener(this);
@ -685,7 +682,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
}
public String getVersion() {
return "1.2.4";
return "1.2.5";
}
public int getPlayerCount() {
@ -766,6 +763,10 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
public String[] r() {
return (String[]) this.serverConfigurationManager.getBannedPlayers().toArray(new String[0]);
}
public String getServerModName() {
return "craftbukkit";
}
public static boolean isRunning(MinecraftServer minecraftserver) {
return minecraftserver.isRunning;

View File

@ -35,7 +35,7 @@ class NetworkAcceptThread extends Thread {
// CraftBukkit end
// CraftBukkit
if (NetworkListenThread.getRecentConnectionAttempts(this.listenThread).containsKey(inetaddress) && System.currentTimeMillis() - ((Long) NetworkListenThread.getRecentConnectionAttempts(this.listenThread).get(inetaddress)).longValue() < connectionThrottle) {
if (NetworkListenThread.getRecentConnectionAttempts(this.listenThread).containsKey(inetaddress) && !"127.0.0.1".equals(inetaddress.getHostAddress()) && System.currentTimeMillis() - ((Long) NetworkListenThread.getRecentConnectionAttempts(this.listenThread).get(inetaddress)).longValue() < connectionThrottle) {
NetworkListenThread.getRecentConnectionAttempts(this.listenThread).put(inetaddress, Long.valueOf(System.currentTimeMillis()));
socket.close();
continue;

View File

@ -1,124 +0,0 @@
package net.minecraft.server;
public class OldChunkLoader {
public OldChunkLoader() {}
public static OldChunk a(NBTTagCompound nbttagcompound) {
int i = nbttagcompound.getInt("xPos");
int j = nbttagcompound.getInt("zPos");
OldChunk oldchunk = new OldChunk(i, j);
oldchunk.g = nbttagcompound.getByteArray("Blocks");
oldchunk.f = new OldNibbleArray(nbttagcompound.getByteArray("Data"), 7);
oldchunk.e = new OldNibbleArray(nbttagcompound.getByteArray("SkyLight"), 7);
oldchunk.d = new OldNibbleArray(nbttagcompound.getByteArray("BlockLight"), 7);
oldchunk.c = nbttagcompound.getByteArray("HeightMap");
oldchunk.b = nbttagcompound.getBoolean("TerrainPopulated");
oldchunk.h = nbttagcompound.getList("Entities");
oldchunk.i = nbttagcompound.getList("TileEntities");
oldchunk.j = nbttagcompound.getList("TileTicks");
// CraftBukkit start
try {
oldchunk.a = nbttagcompound.getLong("LastUpdate");
} catch (ClassCastException ex) {
oldchunk.a = nbttagcompound.getInt("LastUpdate");
}
// CraftBukkit end
return oldchunk;
}
public static void a(OldChunk oldchunk, NBTTagCompound nbttagcompound, WorldChunkManager worldchunkmanager) {
nbttagcompound.setInt("xPos", oldchunk.k);
nbttagcompound.setInt("zPos", oldchunk.l);
nbttagcompound.setLong("LastUpdate", oldchunk.a);
int[] aint = new int[oldchunk.c.length];
for (int i = 0; i < oldchunk.c.length; ++i) {
aint[i] = oldchunk.c[i];
}
nbttagcompound.setIntArray("HeightMap", aint);
nbttagcompound.setBoolean("TerrainPopulated", oldchunk.b);
NBTTagList nbttaglist = new NBTTagList("Sections");
int j;
for (int k = 0; k < 8; ++k) {
boolean flag = true;
for (j = 0; j < 16 && flag; ++j) {
int l = 0;
while (l < 16 && flag) {
int i1 = 0;
while (true) {
if (i1 < 16) {
int j1 = j << 11 | i1 << 7 | l + (k << 4);
byte b0 = oldchunk.g[j1];
if (b0 == 0) {
++i1;
continue;
}
flag = false;
}
++l;
break;
}
}
}
if (!flag) {
byte[] abyte = new byte[4096];
NibbleArray nibblearray = new NibbleArray(abyte.length, 4);
NibbleArray nibblearray1 = new NibbleArray(abyte.length, 4);
NibbleArray nibblearray2 = new NibbleArray(abyte.length, 4);
for (int k1 = 0; k1 < 16; ++k1) {
for (int l1 = 0; l1 < 16; ++l1) {
for (int i2 = 0; i2 < 16; ++i2) {
int j2 = k1 << 11 | i2 << 7 | l1 + (k << 4);
byte b1 = oldchunk.g[j2];
abyte[l1 << 8 | i2 << 4 | k1] = (byte) (b1 & 255);
nibblearray.a(k1, l1, i2, oldchunk.f.a(k1, l1 + (k << 4), i2));
nibblearray1.a(k1, l1, i2, oldchunk.e.a(k1, l1 + (k << 4), i2));
nibblearray2.a(k1, l1, i2, oldchunk.d.a(k1, l1 + (k << 4), i2));
}
}
}
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setByte("Y", (byte) (k & 255));
nbttagcompound1.setByteArray("Blocks", abyte);
nbttagcompound1.setByteArray("Data", nibblearray.a);
nbttagcompound1.setByteArray("SkyLight", nibblearray1.a);
nbttagcompound1.setByteArray("BlockLight", nibblearray2.a);
nbttaglist.add(nbttagcompound1);
}
}
nbttagcompound.set("Sections", nbttaglist);
byte[] abyte1 = new byte[256];
for (int k2 = 0; k2 < 16; ++k2) {
for (j = 0; j < 16; ++j) {
abyte1[j << 4 | k2] = (byte) (worldchunkmanager.getBiome(oldchunk.k << 4 | k2, oldchunk.l << 4 | j).id & 255);
}
}
nbttagcompound.setByteArray("Biomes", abyte1);
nbttagcompound.set("Entities", oldchunk.h);
nbttagcompound.set("TileEntities", oldchunk.i);
if (oldchunk.j != null) {
nbttagcompound.set("TileTicks", oldchunk.j);
}
}
}

View File

@ -7,14 +7,15 @@ import java.io.IOException; // CraftBukkit
public class Packet3Chat extends Packet {
public static int b = 119;
public String message;
public Packet3Chat() {}
public Packet3Chat(String s) {
/* CraftBukkit start - handle this later
if (s.length() > 119) {
s = s.substring(0, 119);
if (s.length() > b) {
s = s.substring(0, b);
}
// CraftBukkit end */
@ -22,7 +23,7 @@ public class Packet3Chat extends Packet {
}
public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit
this.message = a(datainputstream, 119);
this.message = a(datainputstream, b);
}
public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit

View File

@ -141,6 +141,7 @@ public class ServerConfigurationManager {
worldserver.addEntity(entityplayer);
this.getPlayerManager(entityplayer.dimension).addPlayer(entityplayer);
this.u();
// CraftBukkit start - sendAll above replaced with this loop
Packet201PlayerInfo packet = new Packet201PlayerInfo(entityplayer.listName, true, 1000);
@ -762,4 +763,28 @@ public class ServerConfigurationManager {
public int getMaxPlayers() {
return this.maxPlayers;
}
public String[] getSeenPlayers() {
return this.server.worlds.get(0).getDataManager().getPlayerFileData().getSeenPlayers(); // CraftBukkit
}
private void u() {
MojangStatisticsGenerator mojangstatisticsgenerator = new MojangStatisticsGenerator("server");
mojangstatisticsgenerator.a("version", this.server.getVersion());
mojangstatisticsgenerator.a("os_name", System.getProperty("os.name"));
mojangstatisticsgenerator.a("os_version", System.getProperty("os.version"));
mojangstatisticsgenerator.a("os_architecture", System.getProperty("os.arch"));
mojangstatisticsgenerator.a("memory_total", Long.valueOf(Runtime.getRuntime().totalMemory()));
mojangstatisticsgenerator.a("memory_max", Long.valueOf(Runtime.getRuntime().maxMemory()));
mojangstatisticsgenerator.a("memory_free", Long.valueOf(Runtime.getRuntime().freeMemory()));
mojangstatisticsgenerator.a("java_version", System.getProperty("java.version"));
mojangstatisticsgenerator.a("cpu_cores", Integer.valueOf(Runtime.getRuntime().availableProcessors()));
mojangstatisticsgenerator.a("players_current", Integer.valueOf(this.getPlayerCount()));
mojangstatisticsgenerator.a("players_max", Integer.valueOf(this.getMaxPlayers()));
mojangstatisticsgenerator.a("players_seen", Integer.valueOf(this.getSeenPlayers().length));
mojangstatisticsgenerator.a("uses_auth", Boolean.valueOf(this.server.onlineMode));
mojangstatisticsgenerator.a("server_brand", this.server.getServerModName());
mojangstatisticsgenerator.a();
}
}

View File

@ -6,11 +6,9 @@ import java.util.List;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.FurnaceBurnEvent;
import org.bukkit.event.inventory.FurnaceSmeltEvent;
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
import org.bukkit.craftbukkit.entity.CraftPlayer;
// CraftBukkit end
public class TileEntityFurnace extends TileEntity implements IInventory {
@ -116,7 +114,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
this.burnTime = nbttagcompound.getShort("BurnTime");
this.cookTime = nbttagcompound.getShort("CookTime");
this.ticksForCurrentFuel = this.fuelTime(this.items[1]);
this.ticksForCurrentFuel = fuelTime(this.items[1]);
}
public void b(NBTTagCompound nbttagcompound) {
@ -177,7 +175,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
if (this.burnTime <= 0 && this.canBurn() && this.items[1] != null) { // CraftBukkit - == to <=
CraftItemStack fuel = new CraftItemStack(this.items[1]);
FurnaceBurnEvent furnaceBurnEvent = new FurnaceBurnEvent(this.world.getWorld().getBlockAt(this.x, this.y, this.z), fuel, this.fuelTime(this.items[1]));
FurnaceBurnEvent furnaceBurnEvent = new FurnaceBurnEvent(this.world.getWorld().getBlockAt(this.x, this.y, this.z), fuel, fuelTime(this.items[1]));
this.world.getServer().getPluginManager().callEvent(furnaceBurnEvent);
if (furnaceBurnEvent.isCancelled()) {
@ -267,7 +265,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
}
}
private int fuelTime(ItemStack itemstack) {
public static int fuelTime(ItemStack itemstack) {
if (itemstack == null) {
return 0;
} else {
@ -277,6 +275,10 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
}
}
public static boolean isFuel(ItemStack itemstack) {
return fuelTime(itemstack) > 0;
}
public boolean a(EntityHuman entityhuman) {
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
}

View File

@ -293,7 +293,7 @@ public class Village {
villagedoor = (VillageDoor) iterator.next();
}
this.size = Math.max(32, (int) Math.sqrt((double) j));
this.size = Math.max(32, (int) Math.sqrt((double) j) + 1);
}
}
}

View File

@ -29,9 +29,9 @@ public abstract class WorldGenerator {
protected void setTypeAndData(BlockChangeDelegate world, int i, int j, int k, int l, int i1) {
if (this.a) {
world.setTypeIdAndData(i, j, k, l, i1);
} else if (world instanceof World && ((World)world).getChunkAtWorldCoords(i, k).seenByPlayer) { // CraftBukkit - remove in next update
} else if (world instanceof World && ((World)world).getChunkAtWorldCoords(i, k).seenByPlayer) { // CraftBukkit
if (world.setRawTypeIdAndData(i, j, k, l, i1)) {
((World)world).notify(i, j, k);
((World)world).notify(i, j, k); // CraftBukkit - casty
}
} else {
world.setRawTypeIdAndData(i, j, k, l, i1);

View File

@ -219,6 +219,10 @@ public class WorldNBTStorage implements PlayerFileData, IDataManager {
return this;
}
public String[] getSeenPlayers() {
return this.playerDir.list();
}
public void e() {}
public File getDataFile(String s) {