use of net.minecraft.server.v1_11_R1.IBlockData in project acidisland by tastybento.
the class NMSHandler method setBlockSuperFast.
@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
net.minecraft.server.v1_12_R1.World w = ((CraftWorld) b.getWorld()).getHandle();
net.minecraft.server.v1_12_R1.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
int combined = blockId + (data << 12);
IBlockData ibd = net.minecraft.server.v1_12_R1.Block.getByCombinedId(combined);
if (applyPhysics) {
w.setTypeAndData(bp, ibd, 3);
} else {
w.setTypeAndData(bp, ibd, 2);
}
chunk.a(bp, ibd);
}
use of net.minecraft.server.v1_11_R1.IBlockData in project acidisland by tastybento.
the class NMSHandler method setBlockSuperFast.
@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
net.minecraft.server.v1_8_R1.World w = ((CraftWorld) b.getWorld()).getHandle();
net.minecraft.server.v1_8_R1.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
int combined = blockId + (data << 12);
IBlockData ibd = net.minecraft.server.v1_8_R1.Block.getByCombinedId(combined);
chunk.a(bp, ibd);
if (applyPhysics) {
net.minecraft.server.v1_8_R1.Block block = chunk.getType(bp);
w.update(bp, block);
}
}
use of net.minecraft.server.v1_11_R1.IBlockData in project acidisland by tastybento.
the class NMSHandler method setBlockSuperFast.
@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
net.minecraft.server.v1_9_R1.World w = ((CraftWorld) b.getWorld()).getHandle();
net.minecraft.server.v1_9_R1.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
int combined = blockId + (data << 12);
IBlockData ibd = net.minecraft.server.v1_9_R1.Block.getByCombinedId(combined);
if (applyPhysics) {
w.setTypeAndData(bp, ibd, 3);
} else {
w.setTypeAndData(bp, ibd, 2);
}
chunk.a(bp, ibd);
}
use of net.minecraft.server.v1_11_R1.IBlockData in project Citizens2 by CitizensDev.
the class CitizensBlockBreaker method run.
@Override
public BehaviorStatus run() {
if (entity.dead) {
return BehaviorStatus.FAILURE;
}
if (!isDigging) {
return BehaviorStatus.SUCCESS;
}
// CraftBukkit
currentTick = (int) (System.currentTimeMillis() / 50);
if (configuration.radiusSquared() > 0 && distanceSquared() >= configuration.radiusSquared()) {
startDigTick = currentTick;
if (entity instanceof NPCHolder) {
NPC npc = ((NPCHolder) entity).getNPC();
if (npc != null && !npc.getNavigator().isNavigating()) {
npc.getNavigator().setTarget(entity.world.getWorld().getBlockAt(x, y, z).getLocation().add(0, 1, 0));
}
}
return BehaviorStatus.RUNNING;
}
Util.faceLocation(entity.getBukkitEntity(), location);
if (entity instanceof EntityPlayer) {
PlayerAnimation.ARM_SWING.play((Player) entity.getBukkitEntity());
}
IBlockData block = entity.world.getType(new BlockPosition(x, y, z));
if (block == null || block == Blocks.AIR) {
return BehaviorStatus.SUCCESS;
} else {
int tickDifference = currentTick - startDigTick;
float damage = getStrength(block.getBlock()) * (tickDifference + 1) * configuration.blockStrengthModifier();
if (damage >= 1F) {
entity.world.getWorld().getBlockAt(x, y, z).breakNaturally(CraftItemStack.asCraftMirror(getCurrentItem()));
return BehaviorStatus.SUCCESS;
}
int modifiedDamage = (int) (damage * 10.0F);
if (modifiedDamage != currentDamage) {
setBlockDamage(modifiedDamage);
currentDamage = modifiedDamage;
}
}
return BehaviorStatus.RUNNING;
}
use of net.minecraft.server.v1_11_R1.IBlockData in project Citizens2 by CitizensDev.
the class PlayerNavigation method d.
@Override
protected void d() {
PathPoint localPathPoint;
for (int i = 0; i < this.c.d(); i++) {
localPathPoint = this.c.a(i);
Object localObject = i + 1 < this.c.d() ? this.c.a(i + 1) : null;
IBlockData localIBlockData = this.b.getType(new BlockPosition(localPathPoint.a, localPathPoint.b, localPathPoint.c));
Block localBlock = localIBlockData.getBlock();
if (localBlock == Blocks.cauldron) {
this.c.a(i, localPathPoint.a(localPathPoint.a, localPathPoint.b + 1, localPathPoint.c));
if ((localObject != null) && (localPathPoint.b >= ((PathPoint) localObject).b)) {
this.c.a(i + 1, ((PathPoint) localObject).a(((PathPoint) localObject).a, localPathPoint.b + 1, ((PathPoint) localObject).c));
}
}
}
if (this.f2) {
if (this.b.h(new BlockPosition(MathHelper.floor(this.a.locX), (int) (this.a.getBoundingBox().b + 0.5D), MathHelper.floor(this.a.locZ)))) {
return;
}
for (int i = 0; i < this.c.d(); i++) {
localPathPoint = this.c.a(i);
if (this.b.h(new BlockPosition(localPathPoint.a, localPathPoint.b, localPathPoint.c))) {
this.c.b(i - 1);
return;
}
}
}
}
Aggregations