use of com.cinchapi.concourse.server.storage.format.StorageFormatV2.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 com.cinchapi.concourse.server.storage.format.StorageFormatV2.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 com.cinchapi.concourse.server.storage.format.StorageFormatV2.Block in project Citizens2 by CitizensDev.
the class PlayerNavigation method a.
private boolean a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
int i = paramInt1 - paramInt4 / 2;
int j = paramInt3 - paramInt6 / 2;
if (!b(i, paramInt2, j, paramInt4, paramInt5, paramInt6, paramVec3D, paramDouble1, paramDouble2)) {
return false;
}
for (int k = i; k < i + paramInt4; k++) {
for (int m = j; m < j + paramInt6; m++) {
double d1 = k + 0.5D - paramVec3D.a;
double d2 = m + 0.5D - paramVec3D.c;
if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
Block localBlock = this.c.getType(new BlockPosition(k, paramInt2 - 1, m)).getBlock();
Material localMaterial = localBlock.getMaterial();
if (localMaterial == Material.AIR) {
return false;
}
if ((localMaterial == Material.WATER) && (!this.b.V())) {
return false;
}
if (localMaterial == Material.LAVA) {
return false;
}
}
}
}
return true;
}
use of com.cinchapi.concourse.server.storage.format.StorageFormatV2.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 com.cinchapi.concourse.server.storage.format.StorageFormatV2.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();
}
});
}
Aggregations