Search in sources :

Example 6 with EntityArmorStand

use of net.minecraft.entity.item.EntityArmorStand in project MorePlanets by SteveKunG.

the class ModelBipedTranslucent method setRotationAngles.

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

Example 7 with EntityArmorStand

use of net.minecraft.entity.item.EntityArmorStand in project Tropicraft by Tropicraft.

the class RenderArmorMask method render.

/*
     * Arguments f0 to f5 are explained at:
     * http://schwarzeszeux.tumblr.com/post/14176343101/minecraft-modeling-animation-part-2-of-x
     */
@Override
public void render(Entity entity, float f0, float f1, float f2, float f3, float f4, float f5) {
    EntityLivingBase livingEntity = (EntityLivingBase) entity;
    // livingEntity.rotationYawHead - livingEntity.rotationYaw;
    float rotationYaw = f3;
    if (livingEntity instanceof EntityArmorStand) {
        rotationYaw = livingEntity.rotationYawHead;
    }
    /*
			Don't call super class' render method, let the renderMask function handle it!
			SetRotationAngles might me necessary, but I'm not sure.
		 */
    this.setRotationAngles(f0, f1, f2, rotationYaw, f4, f5, entity);
    GlStateManager.pushMatrix();
    if (entity.isSneaking()) {
        GlStateManager.translate(0, 0.25f, 0);
    }
    // Set head rotation to mask
    GlStateManager.rotate(rotationYaw, 0, 1, 0);
    GlStateManager.rotate(f4, 1, 0, 0);
    // Flip mask to face away from the player
    GlStateManager.rotate(180, 0, 1, 0);
    // put it in the middle in front of the face, eyeholes at (Steve's) eye height
    GlStateManager.translate(-0.025F, 0.1F, 0.3F);
    /*
    		renderMask handles the rendering of the mask model, but it doesn't set the texture.
    		Setting the texture is handled in the item class.
    	 */
    mask.renderMask(this.maskType);
    GlStateManager.popMatrix();
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityArmorStand(net.minecraft.entity.item.EntityArmorStand)

Example 8 with EntityArmorStand

use of net.minecraft.entity.item.EntityArmorStand in project Hyperium by HyperiumClient.

the class MixinRendererLivingEntity method doRender.

@Inject(method = "doRender", at = @At("HEAD"), cancellable = true)
private void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) {
    if (Settings.DISABLE_ARMORSTANDS && entity instanceof EntityArmorStand)
        ci.cancel();
    final EntityRenderEvent event = new EntityRenderEvent(entity, (float) x, (float) y, (float) z, entity.rotationPitch, entityYaw, 1.0F);
    EventBus.INSTANCE.post(event);
    if (event.isCancelled()) {
        ci.cancel();
    }
}
Also used : EntityRenderEvent(cc.hyperium.event.render.EntityRenderEvent) EntityArmorStand(net.minecraft.entity.item.EntityArmorStand) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 9 with EntityArmorStand

use of net.minecraft.entity.item.EntityArmorStand in project minecolonies by Minecolonies.

the class AbstractEntityAIStructure method spawnEntity.

/**
 * Iterates through all entities and spawns them
 * Suppressing Sonar Rule Squid:S3047
 * The rule thinks we can merge the two forge loops iterating over resources
 * But in this case the rule does not apply because that would destroy the logic.
 */
@SuppressWarnings(MULTIPLE_LOOPS_OVER_THE_SAME_SET_SHOULD_BE_COMBINED)
private Boolean spawnEntity(@NotNull final Structure.StructureBlock currentBlock) {
    final Template.EntityInfo entityInfo = currentBlock.entity;
    if (entityInfo == null) {
        return true;
    }
    worker.setLatestStatus(new TextComponentTranslation("com.minecolonies.coremod.status.spawning"));
    final Entity entity = ItemStackUtils.getEntityFromEntityInfoOrNull(entityInfo, world);
    if (entity != null && !isEntityAtPosition(entity, world)) {
        final List<ItemStack> request = new ArrayList<>();
        if (entity instanceof EntityItemFrame) {
            final ItemStack stack = ((EntityItemFrame) entity).getDisplayedItem();
            if (!ItemStackUtils.isEmpty(stack)) {
                ItemStackUtils.changeSize(stack, 1);
                request.add(stack);
            }
            request.add(new ItemStack(Items.ITEM_FRAME, 1));
        } else if (entity instanceof EntityArmorStand) {
            request.add(entity.getPickedResult(new RayTraceResult(worker)));
            entity.getArmorInventoryList().forEach(request::add);
            entity.getHeldEquipment().forEach(request::add);
        } else {
            request.add(entity.getPickedResult(new RayTraceResult(worker)));
        }
        if (!Configurations.gameplay.builderInfiniteResources) {
            if (PlacementHandlers.checkForListInInvAndRequest(this, new ArrayList<>(request))) {
                return false;
            }
            // Surpress
            for (final ItemStack stack : request) {
                if (ItemStackUtils.isEmpty(stack)) {
                    continue;
                }
                final int slot = worker.findFirstSlotInInventoryWith(stack.getItem(), stack.getItemDamage());
                if (slot != -1) {
                    new InvWrapper(getInventory()).extractItem(slot, 1, false);
                    reduceNeededResources(stack);
                }
            }
        }
        entity.setUniqueId(UUID.randomUUID());
        entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
        if (!world.spawnEntity(entity)) {
            Log.getLogger().info("Failed to spawn entity");
        }
    }
    return true;
}
Also used : Entity(net.minecraft.entity.Entity) TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) EntityItemFrame(net.minecraft.entity.item.EntityItemFrame) ArrayList(java.util.ArrayList) RayTraceResult(net.minecraft.util.math.RayTraceResult) EntityArmorStand(net.minecraft.entity.item.EntityArmorStand) Template(net.minecraft.world.gen.structure.template.Template) InvWrapper(net.minecraftforge.items.wrapper.InvWrapper) ItemStack(net.minecraft.item.ItemStack)

Example 10 with EntityArmorStand

use of net.minecraft.entity.item.EntityArmorStand in project minecolonies by Minecolonies.

the class ItemStackUtils method getListOfStackForEntity.

/**
 * Adds entities to the builder building if he needs it.
 * @param entityInfo the entity info object.
 * @param world the world.
 * @param placer the entity placer.
 * @return a list of stacks.
 */
public static List<ItemStack> getListOfStackForEntity(final Template.EntityInfo entityInfo, final World world, final Entity placer) {
    if (entityInfo != null) {
        final Entity entity = getEntityFromEntityInfoOrNull(entityInfo, world);
        if (entity != null) {
            final List<ItemStack> request = new ArrayList<>();
            if (entity instanceof EntityItemFrame) {
                final ItemStack stack = ((EntityItemFrame) entity).getDisplayedItem();
                if (!ItemStackUtils.isEmpty(stack)) {
                    ItemStackUtils.setSize(stack, 1);
                    request.add(stack);
                }
                request.add(new ItemStack(Items.ITEM_FRAME, 1));
            } else if (entity instanceof EntityArmorStand) {
                request.add(entity.getPickedResult(new RayTraceResult(placer)));
                entity.getArmorInventoryList().forEach(request::add);
                entity.getHeldEquipment().forEach(request::add);
            } else if (!(entity instanceof EntityMob)) {
                request.add(entity.getPickedResult(new RayTraceResult(placer)));
            }
            return request;
        }
    }
    return Collections.emptyList();
}
Also used : EntityMob(net.minecraft.entity.monster.EntityMob) Entity(net.minecraft.entity.Entity) TileEntity(net.minecraft.tileentity.TileEntity) EntityItemFrame(net.minecraft.entity.item.EntityItemFrame) ArrayList(java.util.ArrayList) RayTraceResult(net.minecraft.util.math.RayTraceResult) EntityArmorStand(net.minecraft.entity.item.EntityArmorStand)

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