mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-11 09:23:42 +01:00
fixed build issues, code cleanup
This commit is contained in:
parent
d226e551ae
commit
31eef6e001
5 changed files with 32 additions and 42 deletions
|
@ -102,7 +102,7 @@ public class BlockDispenser extends BlockContainer {
|
|||
itemstack = tileentitydispenser.getContents()[dispenseSlot];
|
||||
|
||||
// Copy item stack, because we want it to have 1 item
|
||||
itemstack = new ItemStack(itemstack.id, 1, itemstack.damage);
|
||||
itemstack = new ItemStack(itemstack.id, 1, itemstack.getData());
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
|
|
|
@ -1,44 +1,34 @@
|
|||
package net.minecraft.server;
|
||||
// CraftBukkit start - the whole file!
|
||||
|
||||
public class ItemMobSpawner extends ItemLog {
|
||||
public class ItemMobSpawner extends ItemLog { // Actually not ItemLog but 'ItemUsingMetadata' orso.
|
||||
|
||||
public ItemMobSpawner(int i) {
|
||||
super(i, Block.MOB_SPAWNER);
|
||||
public ItemMobSpawner(int id) {
|
||||
super(id, Block.MOB_SPAWNER);
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
||||
if(!super.a(itemstack, entityhuman, world, i, j, k, l)) return false;
|
||||
System.out.println("Placed the spawner, checking it's entity");
|
||||
if (l == 0) {
|
||||
--j;
|
||||
}
|
||||
// interact
|
||||
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int x, int y, int z, int face) {
|
||||
|
||||
if (l == 1) {
|
||||
++j;
|
||||
}
|
||||
// super.interact (for ItemBlock this normally attempts to place it)
|
||||
if (!super.a(itemstack, entityhuman, world, x, y, z, face)) return false;
|
||||
|
||||
if (l == 2) {
|
||||
--k;
|
||||
}
|
||||
// Adjust the coords for the face clicked.
|
||||
if (face == 0) { y--; }
|
||||
else if (face == 1) { y++; }
|
||||
else if (face == 2) { z--; }
|
||||
else if (face == 3) { z++; }
|
||||
else if (face == 4) { x--; }
|
||||
else if (face == 5) { x++; }
|
||||
|
||||
if (l == 3) {
|
||||
++k;
|
||||
}
|
||||
|
||||
if (l == 4) {
|
||||
--i;
|
||||
}
|
||||
|
||||
if (l == 5) {
|
||||
++i;
|
||||
}
|
||||
TileEntity entity = world.getTileEntity(i, j, k);
|
||||
System.out.println(entity);
|
||||
// Set the remembered datavalue for the spawner
|
||||
TileEntity entity = world.getTileEntity(x, y, z);
|
||||
if (entity instanceof TileEntityMobSpawner) {
|
||||
System.out.println("Got a valid spawner, attempt to set its type");
|
||||
((TileEntityMobSpawner)entity).setId(itemstack.getData());
|
||||
((TileEntityMobSpawner) entity).setId(itemstack.getData());
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// CraftBukkit end - the whole file!
|
|
@ -35,7 +35,7 @@ public final class ItemStack {
|
|||
this.count = 0;
|
||||
this.id = i;
|
||||
this.count = j;
|
||||
b(k); // CraftBukkit
|
||||
this.b(k); // CraftBukkit
|
||||
}
|
||||
|
||||
public static ItemStack a(NBTTagCompound nbttagcompound) {
|
||||
|
@ -122,7 +122,7 @@ public final class ItemStack {
|
|||
}
|
||||
|
||||
public void b(int i) {
|
||||
this.damage = (id > 0) && (id < 256) ? Item.byId[id].filterData(i) : i; // CraftBukkit
|
||||
this.damage = (this.id > 0) && (this.id < 256) ? Item.byId[this.id].filterData(i) : i; // CraftBukkit
|
||||
}
|
||||
|
||||
public int i() {
|
||||
|
|
|
@ -219,7 +219,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
|||
this.items[2] = itemstack.cloneItemStack();
|
||||
} else if (this.items[2].id == itemstack.id) {
|
||||
// CraftBukkit - compare damage too
|
||||
if (this.items[2].damage == itemstack.damage) {
|
||||
if (this.items[2].getData() == itemstack.getData()) {
|
||||
this.items[2].count += itemstack.count;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
|
|
@ -60,29 +60,29 @@ public class TileEntityMobSpawner extends TileEntity {
|
|||
|
||||
for (int i = 0; i < b0; ++i) {
|
||||
// CraftBukkit start
|
||||
Entity entity = EntityTypes.a(this.mobName, this.world);
|
||||
Entity entityliving = EntityTypes.a(this.mobName, this.world);
|
||||
|
||||
if (entity == null) {
|
||||
if (entityliving == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int j = this.world.a(entity.getClass(), AxisAlignedBB.b((double) this.x, (double) this.y, (double) this.z, (double) (this.x + 1), (double) (this.y + 1), (double) (this.z + 1)).b(8.0D, 4.0D, 8.0D)).size();
|
||||
int j = this.world.a(entityliving.getClass(), AxisAlignedBB.b((double) this.x, (double) this.y, (double) this.z, (double) (this.x + 1), (double) (this.y + 1), (double) (this.z + 1)).b(8.0D, 4.0D, 8.0D)).size();
|
||||
|
||||
if (j >= 6) {
|
||||
this.c();
|
||||
return;
|
||||
}
|
||||
|
||||
if (entity != null) {
|
||||
if (entityliving != null) {
|
||||
double d3 = (double) this.x + (this.world.random.nextDouble() - this.world.random.nextDouble()) * 4.0D;
|
||||
double d4 = (double) (this.y + this.world.random.nextInt(3) - 1);
|
||||
double d5 = (double) this.z + (this.world.random.nextDouble() - this.world.random.nextDouble()) * 4.0D;
|
||||
|
||||
entity.setPositionRotation(d3, d4, d5, this.world.random.nextFloat() * 360.0F, 0.0F);
|
||||
if (entity.world.containsEntity(entity.boundingBox) && entity.world.getEntities(entity, entity.boundingBox).size() == 0 && !entity.world.c(entity.boundingBox)) {
|
||||
entityliving.setPositionRotation(d3, d4, d5, this.world.random.nextFloat() * 360.0F, 0.0F);
|
||||
if (entityliving.world.containsEntity(entityliving.boundingBox) && entityliving.world.getEntities(entityliving, entityliving.boundingBox).size() == 0 && !entityliving.world.c(entityliving.boundingBox)) {
|
||||
// CraftBukkit end
|
||||
// CraftBukkit - added a reason for spawning this creature
|
||||
this.world.addEntity(entity, SpawnReason.SPAWNER);
|
||||
this.world.addEntity(entityliving, SpawnReason.SPAWNER);
|
||||
|
||||
for (int k = 0; k < 20; ++k) {
|
||||
d0 = (double) this.x + 0.5D + ((double) this.world.random.nextFloat() - 0.5D) * 2.0D;
|
||||
|
|
Loading…
Reference in a new issue