13
0
geforkt von Mirrors/Paper

Added CraftDispenser.dispense()

Dieser Commit ist enthalten in:
Dinnerbone 2011-02-01 23:16:25 +00:00
Ursprung d228e0c311
Commit e0416ca7fb
2 geänderte Dateien mit 59 neuen und 41 gelöschten Zeilen

Datei anzeigen

@ -84,7 +84,8 @@ public class BlockDispenser extends BlockContainer {
} }
} }
private void b(World world, int i, int j, int k, Random random) { // Craftbukkit - following method should be public
public void b(World world, int i, int j, int k, Random random) {
int l = world.getData(i, j, k); int l = world.getData(i, j, k);
float f = 0.0F; float f = 0.0F;
float f1 = 0.0F; float f1 = 0.0F;

Datei anzeigen

@ -1,6 +1,9 @@
package org.bukkit.craftbukkit.block; package org.bukkit.craftbukkit.block;
import java.util.Random;
import net.minecraft.server.BlockDispenser;
import net.minecraft.server.TileEntityDispenser; import net.minecraft.server.TileEntityDispenser;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.Dispenser; import org.bukkit.block.Dispenser;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
@ -27,6 +30,20 @@ public class CraftDispenser extends CraftBlockState implements Dispenser {
return new CraftInventory(dispenser); return new CraftInventory(dispenser);
} }
public boolean dispense() {
Block block = getBlock();
synchronized (block) {
if (block.getType() == Material.DISPENSER) {
BlockDispenser dispense = (BlockDispenser)net.minecraft.server.Block.DISPENSER;
dispense.b(world.getHandle(), getX(), getY(), getZ(), new Random());
return true;
} else {
return false;
}
}
}
@Override @Override
public boolean update(boolean force) { public boolean update(boolean force) {
boolean result = super.update(force); boolean result = super.update(force);