use of net.minecraft.server.v1_15_R1 in project solinia3-core by mixxit.
the class EntityUtils method DistanceOverAggroLimit.
public static double DistanceOverAggroLimit(LivingEntity attacker, LivingEntity aggroCheckEntity) {
double distance = attacker.getLocation().distance(aggroCheckEntity.getLocation());
if (distance > 100D)
return 100D - distance;
net.minecraft.server.v1_15_R1.EntityLiving entity = ((org.bukkit.craftbukkit.v1_15_R1.entity.CraftLivingEntity) aggroCheckEntity).getHandle();
if (entity == null)
return 0D;
if (entity.getAttributeInstance(GenericAttributes.FOLLOW_RANGE) == null)
return 0D;
double distanceLimit = entity.getAttributeInstance(GenericAttributes.FOLLOW_RANGE).getValue();
if (distance > distanceLimit)
return distance - distanceLimit;
return 0D;
}
use of net.minecraft.server.v1_15_R1 in project solinia3-core by mixxit.
the class SpecialEffectUtils method playLightningStrike.
public static void playLightningStrike(Entity entity) {
try {
Location loc = entity.getLocation();
net.minecraft.server.v1_15_R1.WorldServer world = ((CraftWorld) loc.getWorld()).getHandle();
EntityLightning lightning = new EntityLightning(world, loc.getX(), loc.getY(), loc.getZ(), true, true);
world.strikeLightning(lightning);
new CraftLightningStrike(world.getServer(), lightning);
return;
} catch (Exception e) {
e.printStackTrace();
}
}
use of net.minecraft.server.v1_15_R1 in project solinia3-core by mixxit.
the class ItemStackUtils method IsDisplayItem.
public static boolean IsDisplayItem(ItemStack itemStack) {
// Also check nbttag
if (itemStack == null)
return false;
boolean isDisplayItem = itemStack.getItemMeta().getDisplayName().startsWith("Display Item: ");
if (isDisplayItem)
return isDisplayItem;
// Classic method
net.minecraft.server.v1_15_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
String isMerchant = compound.getString("merchant");
return Boolean.parseBoolean(isMerchant);
}
use of net.minecraft.server.v1_15_R1 in project InteractionVisualizer by LOOHP.
the class V1_15 method getBoundingBoxes.
public List<BoundingBox> getBoundingBoxes(BlockPosition pos) {
net.minecraft.server.v1_15_R1.BlockPosition blockpos = new net.minecraft.server.v1_15_R1.BlockPosition(pos.getX(), pos.getY(), pos.getZ());
WorldServer world = ((CraftWorld) pos.getWorld()).getHandle();
VoxelShape shape = world.getType(blockpos).getShape(world, blockpos);
return shape.d().stream().map(each -> new BoundingBox(each.minX + pos.getX(), each.minY + pos.getY(), each.minZ + pos.getZ(), each.maxX + pos.getX(), each.maxY + pos.getY(), each.maxZ + pos.getZ())).collect(Collectors.toList());
}
use of net.minecraft.server.v1_15_R1 in project Atlas by funkemunky.
the class BlockBox1_15_R1 method getCollisionBox.
@Override
public CollisionBox getCollisionBox(org.bukkit.block.Block block) {
final net.minecraft.server.v1_15_R1.World world = ((org.bukkit.craftbukkit.v1_15_R1.CraftWorld) block.getWorld()).getHandle();
final int x = block.getX(), y = block.getY(), z = block.getZ();
net.minecraft.server.v1_15_R1.IBlockData iblockData = ((CraftBlock) block).getNMS();
net.minecraft.server.v1_15_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;
}
}
Aggregations