use of net.minecraft.server.v1_14_R1 in project Atlas by funkemunky.
the class BlockBox1_14_R1 method getCollisionBox.
@Override
public CollisionBox getCollisionBox(Block block) {
final net.minecraft.server.v1_14_R1.World world = ((org.bukkit.craftbukkit.v1_14_R1.CraftWorld) block.getWorld()).getHandle();
final int x = block.getX(), y = block.getY(), z = block.getZ();
net.minecraft.server.v1_14_R1.IBlockData iblockData = ((CraftBlock) block).getNMS();
net.minecraft.server.v1_14_R1.Block vblock = iblockData.getBlock();
BlockPosition blockPos = new BlockPosition(x, y, z);
VoxelShape shape = vblock.a(iblockData, world, blockPos, VoxelShapeCollision.a());
List<AxisAlignedBB> boxes = shape.d();
if (boxes.size() == 0) {
return BlockData.getData(block.getType()).getBox(block, ProtocolVersion.getGameVersion());
} else if (boxes.size() == 1) {
AxisAlignedBB box = boxes.get(0);
return new SimpleCollisionBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ);
} else {
ComplexCollisionBox complexBox = new ComplexCollisionBox();
for (AxisAlignedBB box : boxes) {
complexBox.add(new SimpleCollisionBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ));
}
return complexBox;
}
}
use of net.minecraft.server.v1_14_R1 in project SimplePets by brainsynder-Dev.
the class EntityControllerPet method repeatTask.
@Override
public void repeatTask() {
super.repeatTask();
if (!this.isInvisible())
this.setInvisible(true);
if (!isSilent())
this.setSilent(true);
if (getPet() != null)
if (isBaby())
setBaby((getPet().getPetType() instanceof ShulkerDefault));
Player p = getPet().getOwner();
if (this.displayEntity != null) {
if (this.displayEntity.isValid()) {
net.minecraft.server.v1_14_R1.Entity entity = ((CraftEntity) displayEntity).getHandle();
if (!displayEntity.getPassengers().isEmpty()) {
if (displayRider == null)
displayRider = displayEntity.getPassengers().get(0);
entity = ((CraftEntity) displayRider).getHandle();
}
updateName(entity);
reloadLocation();
if (!canIgnoreVanish()) {
if (((CraftPlayer) p).getHandle().isInvisible() != entity.isInvisible())
entity.setInvisible(!entity.isInvisible());
}
}
}
PetDefault type = getVisibleEntity().getPet().getPetType();
double current = getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue();
double rideSpeed = type.getRideSpeed();
double walkSpeed = type.getSpeed();
if (isOwnerRiding()) {
if (current != rideSpeed)
getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(rideSpeed);
} else {
if (current != walkSpeed)
getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(walkSpeed);
}
}
use of net.minecraft.server.v1_14_R1 in project SilkSpawners by timbru31.
the class NMSHandler method getVanillaEggNBTEntityID.
@Override
public String getVanillaEggNBTEntityID(final ItemStack item) {
net.minecraft.server.v1_14_R1.ItemStack itemStack = null;
final CraftItemStack craftStack = CraftItemStack.asCraftCopy(item);
itemStack = CraftItemStack.asNMSCopy(craftStack);
NBTTagCompound tag = itemStack.getTag();
if (tag == null || !tag.hasKey("EntityTag")) {
final MinecraftKey vanillaKey = IRegistry.ITEM.getKey(itemStack.getItem());
if (vanillaKey != null) {
return vanillaKey.getKey().replace("minecraft:", "").replace("_spawn_egg", "");
}
} else {
tag = tag.getCompound("EntityTag");
if (tag.hasKey("id")) {
return tag.getString("id").replace("minecraft:", "");
}
}
return null;
}
Aggregations