Search in sources :

Example 1 with EntityPigtificate

use of nex.entity.passive.EntityPigtificate in project NetherEx by LogicTechCorp.

the class WorldGenUtil method addEntitiesToWorld.

private static void addEntitiesToWorld(World world, BlockPos pos, PlacementSettings placementSettings, List<Template.EntityInfo> entities, StructureBoundingBox boundingBox) {
    for (Template.EntityInfo entityInfo : entities) {
        BlockPos blockPos = Template.transformedBlockPos(placementSettings, entityInfo.blockPos).add(pos);
        if (boundingBox == null || boundingBox.isVecInside(blockPos)) {
            NBTTagCompound compound = entityInfo.entityData;
            Vec3d vec3d = transformedVec3d(entityInfo.pos, placementSettings.getMirror(), placementSettings.getRotation());
            Vec3d vec3d1 = vec3d.addVector((double) pos.getX(), (double) pos.getY(), (double) pos.getZ());
            NBTTagList tagList = new NBTTagList();
            tagList.appendTag(new NBTTagDouble(vec3d1.xCoord));
            tagList.appendTag(new NBTTagDouble(vec3d1.yCoord));
            tagList.appendTag(new NBTTagDouble(vec3d1.zCoord));
            compound.setTag("Pos", tagList);
            compound.setUniqueId("UUID", UUID.randomUUID());
            Entity entity;
            try {
                entity = EntityList.createEntityFromNBT(compound, world);
            } catch (Exception var15) {
                entity = null;
            }
            if (entity != null) {
                if (entity instanceof EntityPigtificateLeader) {
                    entity = new EntityPigtificateLeader(world);
                } else if (entity instanceof EntityPigtificate) {
                    entity = new EntityPigtificate(world);
                }
                float f = entity.getMirroredYaw(placementSettings.getMirror());
                f = f + (entity.rotationYaw - entity.getRotatedYaw(placementSettings.getRotation()));
                entity.setLocationAndAngles(vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, f, entity.rotationPitch);
                world.spawnEntity(entity);
            }
        }
    }
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) Entity(net.minecraft.entity.Entity) TileEntity(net.minecraft.tileentity.TileEntity) EntityPigtificateLeader(nex.entity.passive.EntityPigtificateLeader) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) EntityPigtificate(nex.entity.passive.EntityPigtificate) BlockPos(net.minecraft.util.math.BlockPos) Vec3d(net.minecraft.util.math.Vec3d) Template(net.minecraft.world.gen.structure.template.Template) NBTTagDouble(net.minecraft.nbt.NBTTagDouble)

Example 2 with EntityPigtificate

use of nex.entity.passive.EntityPigtificate in project NetherEx by LogicTechCorp.

the class PigtificateVillage method updateNumPigtificates.

private void updateNumPigtificates() {
    List<EntityPigtificate> list = world.getEntitiesWithinAABB(EntityPigtificate.class, new AxisAlignedBB((double) (center.getX() - villageRadius), (double) (center.getY() - 4), (double) (center.getZ() - villageRadius), (double) (center.getX() + villageRadius), (double) (center.getY() + 4), (double) (center.getZ() + villageRadius)));
    numPigtificates = list.size();
    if (numPigtificates == 0) {
        playerReputation.clear();
    }
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EntityPigtificate(nex.entity.passive.EntityPigtificate)

Aggregations

EntityPigtificate (nex.entity.passive.EntityPigtificate)2 Entity (net.minecraft.entity.Entity)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 NBTTagDouble (net.minecraft.nbt.NBTTagDouble)1 NBTTagList (net.minecraft.nbt.NBTTagList)1 TileEntity (net.minecraft.tileentity.TileEntity)1 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 BlockPos (net.minecraft.util.math.BlockPos)1 Vec3d (net.minecraft.util.math.Vec3d)1 Template (net.minecraft.world.gen.structure.template.Template)1 EntityPigtificateLeader (nex.entity.passive.EntityPigtificateLeader)1