Search in sources :

Example 11 with EntityArmorStand

use of net.minecraft.entity.item.EntityArmorStand in project Bewitchment by Um-Mitternacht.

the class ModelArmor method setRotationAngles.

@Override
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entity) {
    super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entity);
    if (entity instanceof EntityArmorStand) {
        EntityArmorStand entityarmorstand = (EntityArmorStand) entity;
        this.bipedHead.rotateAngleX = 0.017453292F * entityarmorstand.getHeadRotation().getX();
        this.bipedHead.rotateAngleY = 0.017453292F * entityarmorstand.getHeadRotation().getY();
        this.bipedHead.rotateAngleZ = 0.017453292F * entityarmorstand.getHeadRotation().getZ();
        this.bipedHead.setRotationPoint(0.0F, 1.0F, 0.0F);
        this.bipedBody.rotateAngleX = 0.017453292F * entityarmorstand.getBodyRotation().getX();
        this.bipedBody.rotateAngleY = 0.017453292F * entityarmorstand.getBodyRotation().getY();
        this.bipedBody.rotateAngleZ = 0.017453292F * entityarmorstand.getBodyRotation().getZ();
        this.bipedLeftArm.rotateAngleX = 0.017453292F * entityarmorstand.getLeftArmRotation().getX();
        this.bipedLeftArm.rotateAngleY = 0.017453292F * entityarmorstand.getLeftArmRotation().getY();
        this.bipedLeftArm.rotateAngleZ = 0.017453292F * entityarmorstand.getLeftArmRotation().getZ();
        this.bipedRightArm.rotateAngleX = 0.017453292F * entityarmorstand.getRightArmRotation().getX();
        this.bipedRightArm.rotateAngleY = 0.017453292F * entityarmorstand.getRightArmRotation().getY();
        this.bipedRightArm.rotateAngleZ = 0.017453292F * entityarmorstand.getRightArmRotation().getZ();
        this.bipedLeftLeg.rotateAngleX = 0.017453292F * entityarmorstand.getLeftLegRotation().getX();
        this.bipedLeftLeg.rotateAngleY = 0.017453292F * entityarmorstand.getLeftLegRotation().getY();
        this.bipedLeftLeg.rotateAngleZ = 0.017453292F * entityarmorstand.getLeftLegRotation().getZ();
        this.bipedLeftLeg.setRotationPoint(1.9F, 11.0F, 0.0F);
        this.bipedRightLeg.rotateAngleX = 0.017453292F * entityarmorstand.getRightLegRotation().getX();
        this.bipedRightLeg.rotateAngleY = 0.017453292F * entityarmorstand.getRightLegRotation().getY();
        this.bipedRightLeg.rotateAngleZ = 0.017453292F * entityarmorstand.getRightLegRotation().getZ();
        this.bipedRightLeg.setRotationPoint(-1.9F, 11.0F, 0.0F);
        copyModelAngles(this.bipedHead, this.bipedHeadwear);
    }
}
Also used : EntityArmorStand(net.minecraft.entity.item.EntityArmorStand)

Example 12 with EntityArmorStand

use of net.minecraft.entity.item.EntityArmorStand in project SkyblockAddons by BiscuitDevelopment.

the class RenderManagerHook method shouldRender.

public static void shouldRender(Entity entityIn, ReturnValue<Boolean> returnValue) {
    Minecraft mc = Minecraft.getMinecraft();
    SkyblockAddons main = SkyblockAddons.getInstance();
    if (main.getUtils().isOnSkyblock()) {
        Location currentLocation = main.getUtils().getLocation();
        if (main.getConfigValues().isEnabled(Feature.HIDE_BONES)) {
            ItemStack helmet = Minecraft.getMinecraft().thePlayer.getCurrentArmor(3);
            if (helmet != null && Objects.equals(ItemUtils.getSkyBlockItemID(helmet), "SKELETON_HELMET")) {
                if (entityIn instanceof EntityItem && entityIn.ridingEntity instanceof EntityArmorStand && entityIn.ridingEntity.isInvisible()) {
                    EntityItem entityItem = (EntityItem) entityIn;
                    if (entityItem.getEntityItem().getItem().equals(Items.bone)) {
                        returnValue.cancel();
                    }
                }
            }
        }
        if (main.getConfigValues().isEnabled(Feature.HIDE_PLAYERS_NEAR_NPCS) && mc.theWorld != null) {
            if (entityIn instanceof EntityOtherPlayerMP && !NPCUtils.isNPC(entityIn) && NPCUtils.isNearNPC(entityIn)) {
                returnValue.cancel();
            }
        }
        if (main.getConfigValues().isEnabled(Feature.HIDE_PLAYERS_IN_LOBBY)) {
            if (currentLocation == Location.VILLAGE || currentLocation == Location.AUCTION_HOUSE || currentLocation == Location.BANK) {
                if ((entityIn instanceof EntityOtherPlayerMP || entityIn instanceof EntityFX || entityIn instanceof EntityItemFrame) && !NPCUtils.isNPC(entityIn) && entityIn.getDistanceSqToEntity(mc.thePlayer) > HIDE_RADIUS_SQUARED) {
                    returnValue.cancel();
                }
            }
        }
    }
}
Also used : EntityOtherPlayerMP(net.minecraft.client.entity.EntityOtherPlayerMP) EntityItemFrame(net.minecraft.entity.item.EntityItemFrame) EntityArmorStand(net.minecraft.entity.item.EntityArmorStand) EntityFX(net.minecraft.client.particle.EntityFX) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft) SkyblockAddons(codes.biscuit.skyblockaddons.SkyblockAddons) EntityItem(net.minecraft.entity.item.EntityItem) Location(codes.biscuit.skyblockaddons.core.Location)

Example 13 with EntityArmorStand

use of net.minecraft.entity.item.EntityArmorStand in project UtilityClient2 by Utility-Client.

the class ModelArmorStand method setRotationAngles.

/**
 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
 * "far" arms and legs can swing at most.
 */
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) {
    super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn);
    if (entityIn instanceof EntityArmorStand) {
        EntityArmorStand entityarmorstand = (EntityArmorStand) entityIn;
        this.bipedLeftArm.showModel = entityarmorstand.getShowArms();
        this.bipedRightArm.showModel = entityarmorstand.getShowArms();
        this.standBase.showModel = !entityarmorstand.hasNoBasePlate();
        this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F, 0.0F);
        this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F, 0.0F);
        this.standRightSide.rotateAngleX = 0.017453292F * entityarmorstand.getBodyRotation().getX();
        this.standRightSide.rotateAngleY = 0.017453292F * entityarmorstand.getBodyRotation().getY();
        this.standRightSide.rotateAngleZ = 0.017453292F * entityarmorstand.getBodyRotation().getZ();
        this.standLeftSide.rotateAngleX = 0.017453292F * entityarmorstand.getBodyRotation().getX();
        this.standLeftSide.rotateAngleY = 0.017453292F * entityarmorstand.getBodyRotation().getY();
        this.standLeftSide.rotateAngleZ = 0.017453292F * entityarmorstand.getBodyRotation().getZ();
        this.standWaist.rotateAngleX = 0.017453292F * entityarmorstand.getBodyRotation().getX();
        this.standWaist.rotateAngleY = 0.017453292F * entityarmorstand.getBodyRotation().getY();
        this.standWaist.rotateAngleZ = 0.017453292F * entityarmorstand.getBodyRotation().getZ();
        float f = (entityarmorstand.getLeftLegRotation().getX() + entityarmorstand.getRightLegRotation().getX()) / 2.0F;
        float f1 = (entityarmorstand.getLeftLegRotation().getY() + entityarmorstand.getRightLegRotation().getY()) / 2.0F;
        float f2 = (entityarmorstand.getLeftLegRotation().getZ() + entityarmorstand.getRightLegRotation().getZ()) / 2.0F;
        this.standBase.rotateAngleX = 0.0F;
        this.standBase.rotateAngleY = 0.017453292F * -entityIn.rotationYaw;
        this.standBase.rotateAngleZ = 0.0F;
    }
}
Also used : EntityArmorStand(net.minecraft.entity.item.EntityArmorStand)

Example 14 with EntityArmorStand

use of net.minecraft.entity.item.EntityArmorStand in project UtilityClient2 by Utility-Client.

the class ItemArmorStand method onItemUse.

/**
 * Called when a Block is right-clicked with this Item
 */
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
    if (side == EnumFacing.DOWN) {
        return false;
    } else {
        boolean flag = worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos);
        BlockPos blockpos = flag ? pos : pos.offset(side);
        if (!playerIn.canPlayerEdit(blockpos, side, stack)) {
            return false;
        } else {
            BlockPos blockpos1 = blockpos.up();
            boolean flag1 = !worldIn.isAirBlock(blockpos) && !worldIn.getBlockState(blockpos).getBlock().isReplaceable(worldIn, blockpos);
            flag1 = flag1 | (!worldIn.isAirBlock(blockpos1) && !worldIn.getBlockState(blockpos1).getBlock().isReplaceable(worldIn, blockpos1));
            if (flag1) {
                return false;
            } else {
                double d0 = (double) blockpos.getX();
                double d1 = (double) blockpos.getY();
                double d2 = (double) blockpos.getZ();
                List<Entity> list = worldIn.getEntitiesWithinAABBExcludingEntity((Entity) null, AxisAlignedBB.fromBounds(d0, d1, d2, d0 + 1.0D, d1 + 2.0D, d2 + 1.0D));
                if (list.size() > 0) {
                    return false;
                } else {
                    if (!worldIn.isRemote) {
                        worldIn.setBlockToAir(blockpos);
                        worldIn.setBlockToAir(blockpos1);
                        EntityArmorStand entityarmorstand = new EntityArmorStand(worldIn, d0 + 0.5D, d1, d2 + 0.5D);
                        float f = (float) MathHelper.floor_float((MathHelper.wrapAngleTo180_float(playerIn.rotationYaw - 180.0F) + 22.5F) / 45.0F) * 45.0F;
                        entityarmorstand.setLocationAndAngles(d0 + 0.5D, d1, d2 + 0.5D, f, 0.0F);
                        this.applyRandomRotations(entityarmorstand, worldIn.rand);
                        NBTTagCompound nbttagcompound = stack.getTagCompound();
                        if (nbttagcompound != null && nbttagcompound.hasKey("EntityTag", 10)) {
                            NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                            entityarmorstand.writeToNBTOptional(nbttagcompound1);
                            nbttagcompound1.merge(nbttagcompound.getCompoundTag("EntityTag"));
                            entityarmorstand.readFromNBT(nbttagcompound1);
                        }
                        worldIn.spawnEntityInWorld(entityarmorstand);
                    }
                    --stack.stackSize;
                    return true;
                }
            }
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) EntityArmorStand(net.minecraft.entity.item.EntityArmorStand)

Example 15 with EntityArmorStand

use of net.minecraft.entity.item.EntityArmorStand in project HyblockRngAnalyzer by doej1367.

the class HypixelEntityExtractor method extractStackedArmorStands.

public static ArrayList<StackedArmorStand> extractStackedArmorStands(Vec3 position, double d, boolean horizontalDistance) {
    // EntityItem, EntityArmorStand
    try {
        // step 1: filter for armor stands at and around given position
        List<Entity> entities = Minecraft.getMinecraft().theWorld.getLoadedEntityList();
        ArrayList<StackedArmorStand> drops = new ArrayList<StackedArmorStand>();
        for (Entity e : entities) {
            if (e instanceof EntityArmorStand) {
                Vec3 v = e.getPositionVector();
                if (position != null && (horizontalDistance ? HorizontalPlane.distanceBetween(position, v) > d : (position.distanceTo(v) > d)))
                    continue;
                String displayName = ((EntityArmorStand) e).getDisplayName().getUnformattedText();
                if (displayName.equalsIgnoreCase("Armor Stand"))
                    displayName = "";
                ArrayList<ItemStack> inventoryContents = new ArrayList<ItemStack>();
                ItemStack[] inv = ((EntityArmorStand) e).getInventory();
                for (ItemStack i : inv) if (i != null)
                    inventoryContents.add(i);
                drops.add(new StackedArmorStand(displayName, v, inventoryContents));
            }
        }
        Collections.sort(drops);
        // step 2: group together multiple armor stands belonging to the same drop
        ArrayList<StackedArmorStand> mergedDrops = new ArrayList<StackedArmorStand>();
        StackedArmorStand d0 = null, d1, created = null;
        for (int i = 0; i < drops.size() - 1; i++) {
            d0 = (created == null) ? drops.get(i) : created;
            created = null;
            d1 = drops.get(i + 1);
            if (d0.compareTo(d1) == 0) {
                ArrayList tmp = new ArrayList(d0.getInv());
                tmp.addAll(d1.getInv());
                created = new StackedArmorStand((d0.getName() + " " + d1.getName()).trim(), d0.getPos(), tmp);
            } else {
                mergedDrops.add(d0);
            }
        }
        if (drops.size() > 0)
            mergedDrops.add((created == null) ? drops.get(drops.size() - 1) : created);
        return mergedDrops;
    } catch (ConcurrentModificationException e) {
        return new ArrayList<StackedArmorStand>();
    }
}
Also used : Entity(net.minecraft.entity.Entity) ConcurrentModificationException(java.util.ConcurrentModificationException) ArrayList(java.util.ArrayList) EntityArmorStand(net.minecraft.entity.item.EntityArmorStand) Vec3(net.minecraft.util.Vec3) ItemStack(net.minecraft.item.ItemStack)

Aggregations

EntityArmorStand (net.minecraft.entity.item.EntityArmorStand)36 Entity (net.minecraft.entity.Entity)13 BlockPos (net.minecraft.util.math.BlockPos)8 ArrayList (java.util.ArrayList)7 EntityItemFrame (net.minecraft.entity.item.EntityItemFrame)7 ItemStack (net.minecraft.item.ItemStack)7 EntityFallingBlock (net.minecraft.entity.item.EntityFallingBlock)6 EntityLivingBase (net.minecraft.entity.EntityLivingBase)5 EntityBoat (net.minecraft.entity.item.EntityBoat)5 EntityPig (net.minecraft.entity.passive.EntityPig)5 TileEntity (net.minecraft.tileentity.TileEntity)5 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)5 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 Location (com.wynntils.core.utils.objects.Location)3 Matcher (java.util.regex.Matcher)3 EntityLightningBolt (net.minecraft.entity.effect.EntityLightningBolt)3 EntityEnderPearl (net.minecraft.entity.item.EntityEnderPearl)3 EntityItem (net.minecraft.entity.item.EntityItem)3 RayTraceResult (net.minecraft.util.math.RayTraceResult)3 Iterator (java.util.Iterator)2