use of org.apache.tapestry5.Block in project Citizens2 by CitizensDev.
the class FallingBlockController method createEntity.
@Override
protected Entity createEntity(Location at, NPC npc) {
WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
Block id = Blocks.STONE;
int data = npc.data().get(NPC.ITEM_DATA_METADATA, npc.data().get("falling-block-data", 0));
if (npc.data().has("falling-block-id") || npc.data().has(NPC.ITEM_ID_METADATA)) {
id = CraftMagicNumbers.getBlock(Material.getMaterial(npc.data().<String>get(NPC.ITEM_ID_METADATA, npc.data().<String>get("falling-block-id"))));
}
final EntityFallingBlockNPC handle = new EntityFallingBlockNPC(ws, npc, at.getX(), at.getY(), at.getZ(), id.fromLegacyData(data));
return handle.getBukkitEntity();
}
use of org.apache.tapestry5.Block in project concourse by cinchapi.
the class Upgrade0_11_0_1 method doTask.
@Override
protected void doTask() {
Environments.iterator(GlobalState.BUFFER_DIRECTORY, GlobalState.DATABASE_DIRECTORY).forEachRemaining(environment -> {
logInfoMessage("Upgrading Storage Format v2 data files to Storage Format v3 in environment {}", environment);
Path directory = Paths.get(GlobalState.DATABASE_DIRECTORY).resolve(environment);
Database db = new Database(directory);
db.start();
try {
Path cpb = directory.resolve("cpb");
Iterable<Block<Identifier, Text, Value>> blocks = StorageFormatV2.load(cpb, TableRevision.class);
for (Block<Identifier, Text, Value> block : blocks) {
for (Revision<Identifier, Text, Value> revision : block) {
Write write = Reflection.newInstance(Write.class, revision.getType(), revision.getKey(), revision.getValue(), revision.getLocator(), // (authorized)
revision.getVersion());
db.accept(write);
}
db.sync();
logInfoMessage("Finished transferring v2 data Block {} to v3 Segment format", block.getId());
}
} finally {
db.stop();
}
});
}
use of org.apache.tapestry5.Block in project SSB-OneBlock by BG-Software-LLC.
the class NMSAdapter_v1_12_R1 method setBlock.
@Override
public void setBlock(Location location, Material type, byte data, String nbt) {
assert location.getWorld() != null;
World worldServer = ((CraftWorld) location.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
worldServer.s(blockPosition);
org.bukkit.block.Block bukkitBlock = location.getBlock();
bukkitBlock.setType(type);
if (data > 0)
// noinspection deprecation
bukkitBlock.setData(data);
if (nbt != null) {
try {
Block block = worldServer.getType(blockPosition).getBlock();
IBlockData blockData = CommandAbstract.a(block, nbt);
worldServer.setTypeAndData(blockPosition, blockData, 2);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
use of org.apache.tapestry5.Block in project SSB-OneBlock by BG-Software-LLC.
the class NMSAdapter_v1_8_R3 method setBlock.
@Override
public void setBlock(Location location, Material type, byte data, String nbt) {
assert location.getWorld() != null;
World worldServer = ((CraftWorld) location.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
worldServer.t(blockPosition);
org.bukkit.block.Block bukkitBlock = location.getBlock();
bukkitBlock.setType(type);
if (data > 0)
// noinspection deprecation
bukkitBlock.setData(data);
if (nbt != null) {
try {
Block block = worldServer.getType(blockPosition).getBlock();
IBlockData blockData = block.fromLegacyData(CommandAbstract.a(nbt, 0, 15));
worldServer.setTypeAndData(blockPosition, blockData, 2);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
use of org.apache.tapestry5.Block in project Denizen by DenizenScript.
the class BlockHelperImpl method ringBell.
@Override
public void ringBell(Bell block) {
org.bukkit.block.data.type.Bell bellData = (org.bukkit.block.data.type.Bell) block.getBlockData();
Direction face = Direction.byName(bellData.getFacing().name());
Direction dir = Direction.NORTH;
switch(bellData.getAttachment()) {
case DOUBLE_WALL:
case SINGLE_WALL:
switch(face) {
case NORTH:
case SOUTH:
dir = Direction.EAST;
break;
}
break;
case FLOOR:
dir = face;
break;
}
CraftBlock craftBlock = (CraftBlock) block.getBlock();
((BellBlock) Blocks.BELL).attemptToRing(craftBlock.getCraftWorld().getHandle(), craftBlock.getPosition(), dir);
}
Aggregations