Global ID -> Id rename

Dieser Commit ist enthalten in:
Erik Broes 2011-01-15 20:53:20 +01:00
Ursprung e4a31ce206
Commit dea72d6623
11 geänderte Dateien mit 87 neuen und 71 gelöschten Zeilen

Datei anzeigen

@ -209,6 +209,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
public void a(int i, int j, int k) { public void a(int i, int j, int k) {
U(); U();
System.out.println("OPEN_WINDOW for WorkBench");
a.b(((Packet) (new Packet100(bG, 1, "Crafting", 9)))); a.b(((Packet) (new Packet100(bG, 1, "Crafting", 9))));
ap = ((CraftingInventoryCB) (new CraftingInventoryWorkbenchCB(an, l, i, j, k))); ap = ((CraftingInventoryCB) (new CraftingInventoryWorkbenchCB(an, l, i, j, k)));
ap.f = bG; ap.f = bG;
@ -217,6 +218,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
public void a(IInventory iinventory) { public void a(IInventory iinventory) {
U(); U();
System.out.println("OPEN_WINDOW for Chest");
a.b(((Packet) (new Packet100(bG, 0, iinventory.b(), iinventory.h_())))); a.b(((Packet) (new Packet100(bG, 0, iinventory.b(), iinventory.h_()))));
ap = ((CraftingInventoryCB) (new CraftingInventoryChestCB(((IInventory) (an)), iinventory))); ap = ((CraftingInventoryCB) (new CraftingInventoryChestCB(((IInventory) (an)), iinventory)));
ap.f = bG; ap.f = bG;
@ -225,6 +227,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
public void a(TileEntityFurnace tileentityfurnace) { public void a(TileEntityFurnace tileentityfurnace) {
U(); U();
System.out.println("OPEN_WINDOW for Furnace");
a.b(((Packet) (new Packet100(bG, 2, tileentityfurnace.b(), tileentityfurnace.h_())))); a.b(((Packet) (new Packet100(bG, 2, tileentityfurnace.b(), tileentityfurnace.h_()))));
ap = ((CraftingInventoryCB) (new CraftingInventoryFurnaceCB(((IInventory) (an)), tileentityfurnace))); ap = ((CraftingInventoryCB) (new CraftingInventoryFurnaceCB(((IInventory) (an)), tileentityfurnace)));
ap.f = bG; ap.f = bG;
@ -233,6 +236,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
public void a(TileEntityDispenser tileentitydispenser) { public void a(TileEntityDispenser tileentitydispenser) {
U(); U();
System.out.println("OPEN_WINDOW for Dispenser");
a.b(((Packet) (new Packet100(bG, 3, tileentitydispenser.b(), tileentitydispenser.h_())))); a.b(((Packet) (new Packet100(bG, 3, tileentitydispenser.b(), tileentitydispenser.h_()))));
ap = ((CraftingInventoryCB) (new CraftingInventoryDispenserCB(((IInventory) (an)), tileentitydispenser))); ap = ((CraftingInventoryCB) (new CraftingInventoryDispenserCB(((IInventory) (an)), tileentitydispenser)));
ap.f = bG; ap.f = bG;
@ -243,20 +247,26 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
if (craftinginventorycb.a(i) instanceof SlotCrafting) { if (craftinginventorycb.a(i) instanceof SlotCrafting) {
return; return;
} }
System.out.print("SET_SLOT for window: "+craftinginventorycb.f+" index: "+i+"and stack: "+itemstack);
if (am) { if (am) {
System.out.println(" -- NOT SEND!");
return; return;
} else { } else {
System.out.println(" -- SEND!");
a.b(((Packet) (new Packet103(craftinginventorycb.f, i, itemstack)))); a.b(((Packet) (new Packet103(craftinginventorycb.f, i, itemstack))));
return; return;
} }
} }
public void a(CraftingInventoryCB craftinginventorycb, List list) { public void a(CraftingInventoryCB craftinginventorycb, List list) {
System.out.println("WINDOW_SLOTS for window: "+craftinginventorycb.f );
a.b(((Packet) (new Packet104(craftinginventorycb.f, list)))); a.b(((Packet) (new Packet104(craftinginventorycb.f, list))));
System.out.println("SET_SLOT for item in hand: "+i+"and stack: "+an.i());
a.b(((Packet) (new Packet103(-1, -1, an.i())))); a.b(((Packet) (new Packet103(-1, -1, an.i()))));
} }
public void a(CraftingInventoryCB craftinginventorycb, int i, int j) { public void a(CraftingInventoryCB craftinginventorycb, int i, int j) {
System.out.println(String.format("UPDATE_PROGRESS_BAR for window: %d [%d;%d]", craftinginventorycb.f, i, j));
a.b(((Packet) (new Packet105(craftinginventorycb.f, i, j)))); a.b(((Packet) (new Packet105(craftinginventorycb.f, i, j))));
} }

Datei anzeigen

@ -282,15 +282,15 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit start // CraftBukkit start
CraftBlock block = (CraftBlock) player.getWorld().getBlockAt(l, i1, j1); CraftBlock block = (CraftBlock) player.getWorld().getBlockAt(l, i1, j1);
int blockID = block.getTypeID(); int blockId = block.getTypeId();
float damage = 0; float damage = 0;
if(Block.m[blockID] != null) { if(Block.m[blockId] != null) {
damage = Block.m[blockID].a(player.getHandle()); //Get amount of damage going to block damage = Block.m[blockId].a(player.getHandle()); //Get amount of damage going to block
} }
if (packet14blockdig.e == 0) { if (packet14blockdig.e == 0) {
if (i2 > 16 || flag) { if (i2 > 16 || flag) {
if(blockID > 0) { if(blockId > 0) {
BlockDamagedEvent event; BlockDamagedEvent event;
// If the amount of damage that the player is going to do to the block // If the amount of damage that the player is going to do to the block
// is >= 1, then the block is going to break (eg, flowers, torches) // is >= 1, then the block is going to break (eg, flowers, torches)

Datei anzeigen

@ -110,16 +110,16 @@ public class CraftBlock implements Block {
* @param type Material to change this block to * @param type Material to change this block to
*/ */
public void setType(final Material type) { public void setType(final Material type) {
setTypeID(type.getID()); setTypeId(type.getId());
} }
/** /**
* Sets the type-ID of this block * Sets the type-id of this block
* *
* @param type Type-ID to change this block to * @param type Type-Id to change this block to
* @return whether the block was changed * @return whether the block was changed
*/ */
public boolean setTypeID(final int type) { public boolean setTypeId(final int type) {
this.type = type; this.type = type;
return world.getHandle().e(x, y, z, type); return world.getHandle().e(x, y, z, type);
} }
@ -130,15 +130,15 @@ public class CraftBlock implements Block {
* @return block type * @return block type
*/ */
public Material getType() { public Material getType() {
return Material.getMaterial(getTypeID()); return Material.getMaterial(getTypeId());
} }
/** /**
* Gets the type-ID of this block * Gets the type-id of this block
* *
* @return block type-ID * @return block type-id
*/ */
public int getTypeID() { public int getTypeId() {
return type; return type;
} }

Datei anzeigen

@ -41,7 +41,7 @@ public abstract class CraftEntity implements org.bukkit.Entity {
teleportTo(destination.getLocation()); teleportTo(destination.getLocation());
} }
public int getEntityID() { public int getEntityId() {
return entity.g; return entity.g;
} }
@ -81,6 +81,6 @@ public abstract class CraftEntity implements org.bukkit.Entity {
@Override @Override
public String toString() { public String toString() {
return "CraftEntity{" + "id=" + getEntityID() + '}'; return "CraftEntity{" + "id=" + getEntityId() + '}';
} }
} }

Datei anzeigen

@ -40,6 +40,6 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override @Override
public String toString() { public String toString() {
return "CraftHumanEntity{" + "id=" + getEntityID() + "name=" + getName() + '}'; return "CraftHumanEntity{" + "id=" + getEntityId() + "name=" + getName() + '}';
} }
} }

Datei anzeigen

@ -42,12 +42,12 @@ public class CraftInventory implements org.bukkit.Inventory {
} }
public void setItem(int index, ItemStack item) { public void setItem(int index, ItemStack item) {
getInventory().a( index, new net.minecraft.server.ItemStack( item.getTypeID(), item.getAmount(), 0)); getInventory().a( index, new net.minecraft.server.ItemStack( item.getTypeId(), item.getAmount(), 0));
} }
public boolean contains(int materialId) { public boolean contains(int materialId) {
for (ItemStack item: getContents()) { for (ItemStack item: getContents()) {
if (item.getTypeID() == materialId) { if (item.getTypeId() == materialId) {
return true; return true;
} }
} }
@ -55,7 +55,7 @@ public class CraftInventory implements org.bukkit.Inventory {
} }
public boolean contains(Material material) { public boolean contains(Material material) {
return contains(material.getID()); return contains(material.getId());
} }
public boolean contains(ItemStack item) { public boolean contains(ItemStack item) {
@ -73,7 +73,7 @@ public class CraftInventory implements org.bukkit.Inventory {
ItemStack[] inventory = getContents(); ItemStack[] inventory = getContents();
for (int i = 0; i < inventory.length; i++) { for (int i = 0; i < inventory.length; i++) {
ItemStack item = inventory[i]; ItemStack item = inventory[i];
if (item.getTypeID() == materialId) { if (item.getTypeId() == materialId) {
slots.put( i, item ); slots.put( i, item );
} }
} }
@ -81,7 +81,7 @@ public class CraftInventory implements org.bukkit.Inventory {
} }
public HashMap<Integer, ItemStack> all(Material material) { public HashMap<Integer, ItemStack> all(Material material) {
return all(material.getID()); return all(material.getId());
} }
public HashMap<Integer, ItemStack> all(ItemStack item) { public HashMap<Integer, ItemStack> all(ItemStack item) {
@ -99,7 +99,7 @@ public class CraftInventory implements org.bukkit.Inventory {
public int first(int materialId) { public int first(int materialId) {
ItemStack[] inventory = getContents(); ItemStack[] inventory = getContents();
for (int i = 0; i < inventory.length; i++) { for (int i = 0; i < inventory.length; i++) {
if (inventory[i].getTypeID() == materialId) { if (inventory[i].getTypeId() == materialId) {
return i; return i;
} }
} }
@ -107,7 +107,7 @@ public class CraftInventory implements org.bukkit.Inventory {
} }
public int first(Material material) { public int first(Material material) {
return first(material.getID()); return first(material.getId());
} }
public int first(ItemStack item) { public int first(ItemStack item) {
@ -128,7 +128,7 @@ public class CraftInventory implements org.bukkit.Inventory {
ItemStack[] inventory = getContents(); ItemStack[] inventory = getContents();
for (int i = 0; i < inventory.length; i++) { for (int i = 0; i < inventory.length; i++) {
ItemStack item = inventory[i]; ItemStack item = inventory[i];
if (item != null && item.getTypeID() == materialId && item.getAmount() < item.getMaxStackSize()) { if (item != null && item.getTypeId() == materialId && item.getAmount() < item.getMaxStackSize()) {
return i; return i;
} }
} }
@ -136,11 +136,11 @@ public class CraftInventory implements org.bukkit.Inventory {
} }
public int firstPartial(Material material) { public int firstPartial(Material material) {
return firstPartial(material.getID()); return firstPartial(material.getId());
} }
public int firstPartial(ItemStack item) { public int firstPartial(ItemStack item) {
return firstPartial(item.getTypeID()); return firstPartial(item.getTypeId());
} }
public HashMap<Integer, ItemStack> addItem(ItemStack... items) { public HashMap<Integer, ItemStack> addItem(ItemStack... items) {
@ -156,7 +156,7 @@ public class CraftInventory implements org.bukkit.Inventory {
ItemStack item = items[i]; ItemStack item = items[i];
while (true) { while (true) {
// Do we already have a stack of it? // Do we already have a stack of it?
int firstPartial = firstPartial( item.getTypeID() ); int firstPartial = firstPartial( item.getTypeId() );
// Drat! no partial stack // Drat! no partial stack
if (firstPartial == -1) { if (firstPartial == -1) {
@ -170,7 +170,7 @@ public class CraftInventory implements org.bukkit.Inventory {
} else { } else {
// More than a single stack! // More than a single stack!
if (item.getAmount() > getMaxItemStack()) { if (item.getAmount() > getMaxItemStack()) {
setItem( firstFree, new ItemStack(item.getTypeID(), getMaxItemStack())); setItem( firstFree, new ItemStack(item.getTypeId(), getMaxItemStack()));
item.setAmount(item.getAmount() - getMaxItemStack()); item.setAmount(item.getAmount() - getMaxItemStack());
} else { } else {
// Just store it // Just store it

Datei anzeigen

@ -18,20 +18,20 @@ public class CraftItemStack extends ItemStack {
@Override @Override
public Material getType() { public Material getType() {
super.setTypeID(item != null ? item.c : 0); // sync, needed? super.setTypeId(item != null ? item.c : 0); // sync, needed?
return super.getType(); return super.getType();
} }
@Override @Override
public int getTypeID() { public int getTypeId() {
super.setTypeID(item != null ? item.c : 0); // sync, needed? super.setTypeId(item != null ? item.c : 0); // sync, needed?
return item != null ? item.c : 0; return item != null ? item.c : 0;
} }
@Override @Override
public void setTypeID(int type) { public void setTypeId(int type) {
if (type == 0) { if (type == 0) {
super.setTypeID(0); super.setTypeId(0);
super.setAmount(0); super.setAmount(0);
item = null; item = null;
} else { } else {
@ -40,7 +40,7 @@ public class CraftItemStack extends ItemStack {
super.setAmount(1); super.setAmount(1);
} else { } else {
item.c = type; item.c = type;
super.setTypeID(item.c); super.setTypeId(item.c);
} }
} }
} }
@ -54,7 +54,7 @@ public class CraftItemStack extends ItemStack {
@Override @Override
public void setAmount(int amount) { public void setAmount(int amount) {
if (amount == 0) { if (amount == 0) {
super.setTypeID(0); super.setTypeId(0);
super.setAmount(0); super.setAmount(0);
item = null; item = null;
} else { } else {

Datei anzeigen

@ -45,7 +45,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override @Override
public String toString() { public String toString() {
return "CraftLivingEntity{" + "id=" + getEntityID() + '}'; return "CraftLivingEntity{" + "id=" + getEntityId() + '}';
} }
public Egg throwEgg() { public Egg throwEgg() {

Datei anzeigen

@ -10,7 +10,7 @@ import org.bukkit.Minecart;
*/ */
public class CraftMinecart extends CraftVehicle implements Minecart { public class CraftMinecart extends CraftVehicle implements Minecart {
/** /**
* Stores the minecart type ID, which is used by Minecraft to differentiate * Stores the minecart type id, which is used by Minecraft to differentiate
* minecart types. Here we use subclasses. * minecart types. Here we use subclasses.
*/ */
public enum Type { public enum Type {
@ -24,7 +24,7 @@ public class CraftMinecart extends CraftVehicle implements Minecart {
this.id = id; this.id = id;
} }
public int getID() { public int getId() {
return id; return id;
} }
} }
@ -54,9 +54,9 @@ public class CraftMinecart extends CraftVehicle implements Minecart {
*/ */
public static CraftMinecart getCraftMinecart(CraftServer server, public static CraftMinecart getCraftMinecart(CraftServer server,
EntityMinecart minecart) { EntityMinecart minecart) {
if (minecart.d == Type.StorageMinecart.getID()) { if (minecart.d == Type.StorageMinecart.getId()) {
return new CraftStorageMinecart(server, minecart); return new CraftStorageMinecart(server, minecart);
} else if (minecart.d == Type.PoweredMinecart.getID()) { } else if (minecart.d == Type.PoweredMinecart.getId()) {
return new CraftPoweredMinecart(server, minecart); return new CraftPoweredMinecart(server, minecart);
} else { } else {
return new CraftMinecart(server, minecart); return new CraftMinecart(server, minecart);

Datei anzeigen

@ -114,11 +114,12 @@ public class CraftWorld implements World {
} }
public ItemDrop dropItem(Location loc, ItemStack item) { public ItemDrop dropItem(Location loc, ItemStack item) {
net.minecraft.server.ItemStack stack = net.minecraft.server.ItemStack stack = new net.minecraft.server.ItemStack(
new net.minecraft.server.ItemStack( item.getTypeId(),
item.getTypeID(), item.getAmount(), item.getDamage()); item.getAmount(),
EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), item.getDamage()
loc.getZ(), stack); );
EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), stack);
entity.c = 10; entity.c = 10;
world.a(entity); world.a(entity);
return new CraftItemDrop(world.getServer(), entity); return new CraftItemDrop(world.getServer(), entity);
@ -135,8 +136,7 @@ public class CraftWorld implements World {
return dropItem(loc, item); return dropItem(loc, item);
} }
public Arrow spawnArrow(Location loc, Vector velocity, float speed, public Arrow spawnArrow(Location loc, Vector velocity, float speed, float spread) {
float spread) {
EntityArrow arrow = new EntityArrow(world); EntityArrow arrow = new EntityArrow(world);
arrow.c(loc.getX(), loc.getY(), loc.getZ(), 0, 0); arrow.c(loc.getX(), loc.getY(), loc.getZ(), 0, 0);
world.a(arrow); world.a(arrow);
@ -147,8 +147,11 @@ public class CraftWorld implements World {
public Minecart spawnMinecart(Location loc) { public Minecart spawnMinecart(Location loc) {
EntityMinecart minecart = new EntityMinecart( EntityMinecart minecart = new EntityMinecart(
world, world,
loc.getX(), loc.getY(), loc.getZ(), loc.getX(),
CraftMinecart.Type.Minecart.getID()); loc.getY(),
loc.getZ(),
CraftMinecart.Type.Minecart.getId()
);
world.a(minecart); world.a(minecart);
return new CraftMinecart(world.getServer(), minecart); return new CraftMinecart(world.getServer(), minecart);
} }
@ -156,8 +159,11 @@ public class CraftWorld implements World {
public StorageMinecart spawnStorageMinecart(Location loc) { public StorageMinecart spawnStorageMinecart(Location loc) {
EntityMinecart minecart = new EntityMinecart( EntityMinecart minecart = new EntityMinecart(
world, world,
loc.getX(), loc.getY(), loc.getZ(), loc.getX(),
CraftMinecart.Type.StorageMinecart.getID()); loc.getY(),
loc.getZ(),
CraftMinecart.Type.StorageMinecart.getId()
);
world.a(minecart); world.a(minecart);
return new CraftStorageMinecart(world.getServer(), minecart); return new CraftStorageMinecart(world.getServer(), minecart);
} }
@ -165,29 +171,29 @@ public class CraftWorld implements World {
public PoweredMinecart spawnPoweredMinecart(Location loc) { public PoweredMinecart spawnPoweredMinecart(Location loc) {
EntityMinecart minecart = new EntityMinecart( EntityMinecart minecart = new EntityMinecart(
world, world,
loc.getX(), loc.getY(), loc.getZ(), loc.getX(),
CraftMinecart.Type.PoweredMinecart.getID()); loc.getY(),
loc.getZ(),
CraftMinecart.Type.PoweredMinecart.getId()
);
world.a(minecart); world.a(minecart);
return new CraftPoweredMinecart(world.getServer(), minecart); return new CraftPoweredMinecart(world.getServer(), minecart);
} }
public Boat spawnBoat(Location loc) { public Boat spawnBoat(Location loc) {
EntityBoat boat = EntityBoat boat = new EntityBoat(world, loc.getX(), loc.getY(), loc.getZ());
new EntityBoat(world, loc.getX(), loc.getY(), loc.getZ());
world.a(boat); world.a(boat);
return new CraftBoat(world.getServer(), boat); return new CraftBoat(world.getServer(), boat);
} }
public boolean generateTree(Location loc) { public boolean generateTree(Location loc) {
WorldGenTrees treeGen = new WorldGenTrees(); WorldGenTrees treeGen = new WorldGenTrees();
return treeGen.a(world, rand, return treeGen.a(world, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
} }
public boolean generateBigTree(Location loc) { public boolean generateBigTree(Location loc) {
WorldGenBigTree treeGen = new WorldGenBigTree(); WorldGenBigTree treeGen = new WorldGenBigTree();
return treeGen.a(world, rand, return treeGen.a(world, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
} }
public CraftEntity toCraftEntity(net.minecraft.server.Entity entity) { public CraftEntity toCraftEntity(net.minecraft.server.Entity entity) {

Datei anzeigen

@ -25,7 +25,7 @@ public class CraftBlockState implements BlockState {
this.x = block.getX(); this.x = block.getX();
this.y = block.getY(); this.y = block.getY();
this.z = block.getZ(); this.z = block.getZ();
this.type = block.getTypeID(); this.type = block.getTypeId();
this.light = block.getLightLevel(); this.light = block.getLightLevel();
this.chunk = (CraftChunk)block.getChunk(); this.chunk = (CraftChunk)block.getChunk();
@ -114,15 +114,15 @@ public class CraftBlockState implements BlockState {
* @param type Material to change this block to * @param type Material to change this block to
*/ */
public void setType(final Material type) { public void setType(final Material type) {
setTypeID(type.getID()); setTypeId(type.getId());
} }
/** /**
* Sets the type-ID of this block * Sets the type-id of this block
* *
* @param type Type-ID to change this block to * @param type Type-Id to change this block to
*/ */
public void setTypeID(final int type) { public void setTypeId(final int type) {
this.type = type; this.type = type;
world.getHandle().e(x, y, z, type); world.getHandle().e(x, y, z, type);
@ -135,15 +135,15 @@ public class CraftBlockState implements BlockState {
* @return block type * @return block type
*/ */
public Material getType() { public Material getType() {
return Material.getMaterial(getTypeID()); return Material.getMaterial(getTypeId());
} }
/** /**
* Gets the type-ID of this block * Gets the type-id of this block
* *
* @return block type-ID * @return block type-id
*/ */
public int getTypeID() { public int getTypeId() {
return type; return type;
} }
@ -170,7 +170,7 @@ public class CraftBlockState implements BlockState {
synchronized (block) { synchronized (block) {
if (block.getType() != this.getType()) { if (block.getType() != this.getType()) {
if (force) { if (force) {
block.setTypeID(this.getTypeID()); block.setTypeId(this.getTypeId());
} else { } else {
return false; return false;
} }