13
0
geforkt von Mirrors/Paper
Paper/src/main/java/net/minecraft/server/ItemMobSpawner.java

34 Zeilen
1.1 KiB
Java

2011-09-26 09:07:06 +02:00
package net.minecraft.server;
2011-09-26 09:59:03 +02:00
// CraftBukkit start - the whole file!
2011-09-26 09:07:06 +02:00
2011-09-26 09:59:03 +02:00
public class ItemMobSpawner extends ItemLog { // Actually not ItemLog but 'ItemUsingMetadata' orso.
2011-09-26 09:07:06 +02:00
2011-09-26 09:59:03 +02:00
public ItemMobSpawner(int id) {
super(id, Block.MOB_SPAWNER);
2011-09-26 09:07:06 +02:00
}
2011-09-26 09:59:03 +02:00
// interact
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int x, int y, int z, int face) {
2011-09-26 09:07:06 +02:00
2011-09-26 09:59:03 +02:00
// super.interact (for ItemBlock this normally attempts to place it)
if (!super.a(itemstack, entityhuman, world, x, y, z, face)) return false;
2011-09-26 09:07:06 +02:00
2011-09-26 09:59:03 +02:00
// 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++; }
2011-09-26 09:07:06 +02:00
2011-09-26 09:59:03 +02:00
// Set the remembered datavalue for the spawner
TileEntity entity = world.getTileEntity(x, y, z);
2011-09-26 09:07:06 +02:00
if (entity instanceof TileEntityMobSpawner) {
2011-09-26 09:59:03 +02:00
((TileEntityMobSpawner) entity).setId(itemstack.getData());
2011-09-26 09:07:06 +02:00
return true;
}
2011-09-26 09:59:03 +02:00
return false;
2011-09-26 09:07:06 +02:00
}
}
2011-09-26 09:59:03 +02:00
// CraftBukkit end - the whole file!