use of net.minecraft.server.v1_13_R1.IBlockData in project MechanicsMain by WeaponMechanics.
the class Block_1_15_R1 method getMultiBlockMaskPacket.
@Override
@NotNull
public List<Object> getMultiBlockMaskPacket(@NotNull List<Block> blocks, @Nullable Material mask, byte data) {
if (blocks == null || blocks.isEmpty()) {
throw new IllegalArgumentException("No blocks are being changed!");
}
Map<org.bukkit.Chunk, List<Block>> sortedBlocks = new HashMap<>();
for (Block block : blocks) {
List<Block> list = sortedBlocks.computeIfAbsent(block.getChunk(), chunk -> new ArrayList<>());
list.add(block);
}
List<Object> packets = new ArrayList<>(sortedBlocks.size());
IBlockData theMask = mask == null ? null : ((CraftBlockData) mask.createBlockData()).getState();
for (List<Block> entry : sortedBlocks.values()) {
packets.add(getMultiBlockMaskPacket(entry, theMask));
}
return packets;
}
use of net.minecraft.server.v1_13_R1.IBlockData in project MechanicsMain by WeaponMechanics.
the class Block_1_9_R2 method getMultiBlockMaskPacket.
@SuppressWarnings("deprecation")
@Override
@NotNull
public List<Object> getMultiBlockMaskPacket(@NotNull List<Block> blocks, @Nullable Material mask, byte data) {
if (blocks == null || blocks.isEmpty()) {
throw new IllegalArgumentException("No blocks are being changed!");
}
Map<Chunk, List<Block>> sortedBlocks = new HashMap<>();
for (Block block : blocks) {
List<Block> list = sortedBlocks.computeIfAbsent(block.getChunk(), chunk -> new ArrayList<>());
list.add(block);
}
List<Object> packets = new ArrayList<>(sortedBlocks.size());
IBlockData theMask = mask == null ? null : net.minecraft.server.v1_9_R2.Block.getByCombinedId(mask.getId() | data << 12);
for (List<Block> entry : sortedBlocks.values()) {
packets.add(getMultiBlockMaskPacket(entry, theMask));
}
return packets;
}
use of net.minecraft.server.v1_13_R1.IBlockData in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method getPathTypeBase.
public PathType getPathTypeBase(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) {
BlockPosition localBlockPosition = new BlockPosition(paramInt1, paramInt2, paramInt3);
IBlockData localIBlockData = paramIBlockAccess.getType(localBlockPosition);
Block localBlock1 = localIBlockData.getBlock();
Material localMaterial = localIBlockData.getMaterial();
PathType localPathType1 = PathType.BLOCKED;
if ((localBlock1 == Blocks.TRAPDOOR) || (localBlock1 == Blocks.IRON_TRAPDOOR) || (localBlock1 == Blocks.WATERLILY)) {
return PathType.TRAPDOOR;
}
if (localBlock1 == Blocks.FIRE) {
return PathType.DAMAGE_FIRE;
}
if (localBlock1 == Blocks.CACTUS) {
return PathType.DAMAGE_CACTUS;
}
if (((localBlock1 instanceof BlockDoor)) && (localMaterial == Material.WOOD) && (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
return PathType.DOOR_WOOD_CLOSED;
}
if (((localBlock1 instanceof BlockDoor)) && (localMaterial == Material.ORE) && (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
return PathType.DOOR_IRON_CLOSED;
}
if (((localBlock1 instanceof BlockDoor)) && (localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
return PathType.DOOR_OPEN;
}
if ((localBlock1 instanceof BlockMinecartTrackAbstract)) {
return PathType.RAIL;
}
if (((localBlock1 instanceof BlockFence)) || ((localBlock1 instanceof BlockCobbleWall)) || (((localBlock1 instanceof BlockFenceGate)) && (!localIBlockData.get(BlockFenceGate.OPEN).booleanValue()))) {
return PathType.FENCE;
}
if (localMaterial == Material.AIR) {
localPathType1 = PathType.OPEN;
} else {
if (localMaterial == Material.WATER) {
return PathType.WATER;
}
if (localMaterial == Material.LAVA) {
return PathType.LAVA;
}
}
if ((localBlock1.b(paramIBlockAccess, localBlockPosition)) && (localPathType1 == PathType.BLOCKED)) {
localPathType1 = PathType.OPEN;
}
return localPathType1;
}
use of net.minecraft.server.v1_13_R1.IBlockData in project Citizens2 by CitizensDev.
the class PlayerNavigation method d.
@Override
protected void d() {
super.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 (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;
}
}
}
}
use of net.minecraft.server.v1_13_R1.IBlockData in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method b.
@Override
public PathPoint b() {
BlockPosition.MutableBlockPosition var1 = new BlockPosition.MutableBlockPosition();
int var0 = MathHelper.floor(this.b.locY());
IBlockData var2 = this.a.getType(var1.c(this.b.locX(), var0, this.b.locZ()));
if (this.b.a(var2.getFluid().getType())) {
while (this.b.a(var2.getFluid().getType())) {
var0++;
var2 = this.a.getType(var1.c(this.b.locX(), var0, this.b.locZ()));
}
var0--;
} else if (e() && this.b.isInWater()) {
while (var2.getBlock() == Blocks.WATER || var2.getFluid() == FluidTypes.WATER.a(false)) {
var0++;
var2 = this.a.getType(var1.c(this.b.locX(), var0, this.b.locZ()));
}
var0--;
} else if (this.b.isOnGround()) {
var0 = MathHelper.floor(this.b.locY() + 0.5D);
} else {
BlockPosition blockPosition = this.b.getChunkCoordinates();
while ((this.a.getType(blockPosition).isAir() || this.a.getType(blockPosition).a(this.a, blockPosition, PathMode.LAND)) && blockPosition.getY() > 0) blockPosition = blockPosition.down();
var0 = blockPosition.up().getY();
}
BlockPosition var3 = this.b.getChunkCoordinates();
PathType var4 = a(this.b, var3.getX(), var0, var3.getZ());
if (this.b.a(var4) < 0.0F) {
AxisAlignedBB axisAlignedBB = this.b.getBoundingBox();
if (b(var1.c(axisAlignedBB.minX, var0, axisAlignedBB.minZ)) || b(var1.c(axisAlignedBB.minX, var0, axisAlignedBB.maxZ)) || b(var1.c(axisAlignedBB.maxX, var0, axisAlignedBB.minZ)) || b(var1.c(axisAlignedBB.maxX, var0, axisAlignedBB.maxZ))) {
PathPoint var6 = a(var1);
var6.l = a(this.b, var6.a());
var6.k = this.b.a(var6.l);
return var6;
}
}
PathPoint var5 = a(var3.getX(), var0, var3.getZ());
var5.l = a(this.b, var5.a());
var5.k = this.b.a(var5.l);
return var5;
}
Aggregations