geforkt von Mirrors/Paper
fixed build issues, code cleanup
Dieser Commit ist enthalten in:
Ursprung
d226e551ae
Commit
31eef6e001
@ -102,7 +102,7 @@ public class BlockDispenser extends BlockContainer {
|
|||||||
itemstack = tileentitydispenser.getContents()[dispenseSlot];
|
itemstack = tileentitydispenser.getContents()[dispenseSlot];
|
||||||
|
|
||||||
// Copy item stack, because we want it to have 1 item
|
// 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
|
// CraftBukkit end
|
||||||
|
|
||||||
|
@ -1,44 +1,34 @@
|
|||||||
package net.minecraft.server;
|
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) {
|
public ItemMobSpawner(int id) {
|
||||||
super(i, Block.MOB_SPAWNER);
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (l == 1) {
|
// interact
|
||||||
++j;
|
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int x, int y, int z, int face) {
|
||||||
}
|
|
||||||
|
|
||||||
if (l == 2) {
|
// super.interact (for ItemBlock this normally attempts to place it)
|
||||||
--k;
|
if (!super.a(itemstack, entityhuman, world, x, y, z, face)) return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (l == 3) {
|
// Adjust the coords for the face clicked.
|
||||||
++k;
|
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 == 4) {
|
// Set the remembered datavalue for the spawner
|
||||||
--i;
|
TileEntity entity = world.getTileEntity(x, y, z);
|
||||||
}
|
|
||||||
|
|
||||||
if (l == 5) {
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
TileEntity entity = world.getTileEntity(i, j, k);
|
|
||||||
System.out.println(entity);
|
|
||||||
if (entity instanceof TileEntityMobSpawner) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
else return false;
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// CraftBukkit end - the whole file!
|
@ -35,7 +35,7 @@ public final class ItemStack {
|
|||||||
this.count = 0;
|
this.count = 0;
|
||||||
this.id = i;
|
this.id = i;
|
||||||
this.count = j;
|
this.count = j;
|
||||||
b(k); // CraftBukkit
|
this.b(k); // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack a(NBTTagCompound nbttagcompound) {
|
public static ItemStack a(NBTTagCompound nbttagcompound) {
|
||||||
@ -122,7 +122,7 @@ public final class ItemStack {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void b(int i) {
|
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() {
|
public int i() {
|
||||||
|
@ -219,7 +219,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
|||||||
this.items[2] = itemstack.cloneItemStack();
|
this.items[2] = itemstack.cloneItemStack();
|
||||||
} else if (this.items[2].id == itemstack.id) {
|
} else if (this.items[2].id == itemstack.id) {
|
||||||
// CraftBukkit - compare damage too
|
// CraftBukkit - compare damage too
|
||||||
if (this.items[2].damage == itemstack.damage) {
|
if (this.items[2].getData() == itemstack.getData()) {
|
||||||
this.items[2].count += itemstack.count;
|
this.items[2].count += itemstack.count;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -60,29 +60,29 @@ public class TileEntityMobSpawner extends TileEntity {
|
|||||||
|
|
||||||
for (int i = 0; i < b0; ++i) {
|
for (int i = 0; i < b0; ++i) {
|
||||||
// CraftBukkit start
|
// 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;
|
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) {
|
if (j >= 6) {
|
||||||
this.c();
|
this.c();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity != null) {
|
if (entityliving != null) {
|
||||||
double d3 = (double) this.x + (this.world.random.nextDouble() - this.world.random.nextDouble()) * 4.0D;
|
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 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;
|
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);
|
entityliving.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)) {
|
if (entityliving.world.containsEntity(entityliving.boundingBox) && entityliving.world.getEntities(entityliving, entityliving.boundingBox).size() == 0 && !entityliving.world.c(entityliving.boundingBox)) {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
// CraftBukkit - added a reason for spawning this creature
|
// 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) {
|
for (int k = 0; k < 20; ++k) {
|
||||||
d0 = (double) this.x + 0.5D + ((double) this.world.random.nextFloat() - 0.5D) * 2.0D;
|
d0 = (double) this.x + 0.5D + ((double) this.world.random.nextFloat() - 0.5D) * 2.0D;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren