use of net.minecraft.entity.item.ArmorStandEntity in project minecolonies by Minecolonies.
the class ItemStackUtils method getListOfStackForEntity.
/**
* Adds entities to the builder building if he needs it.
*
* @param entity the entity object.
* @param placer the entity placer.
* @return a list of stacks.
*/
public static List<ItemStorage> getListOfStackForEntity(final Entity entity, final Entity placer) {
if (entity != null) {
final List<ItemStorage> request = new ArrayList<>();
if (entity instanceof ItemFrameEntity) {
final ItemStack stack = ((ItemFrameEntity) entity).getItem();
if (!ItemStackUtils.isEmpty(stack)) {
ItemStackUtils.setSize(stack, 1);
request.add(new ItemStorage(stack));
}
request.add(new ItemStorage(new ItemStack(Items.ITEM_FRAME, 1)));
} else if (entity instanceof ArmorStandEntity) {
request.add(new ItemStorage(entity.getPickedResult(new EntityRayTraceResult(placer))));
entity.getArmorSlots().forEach(item -> request.add(new ItemStorage(item)));
entity.getHandSlots().forEach(item -> request.add(new ItemStorage(item)));
}
return request.stream().filter(stack -> !stack.getItemStack().isEmpty()).collect(Collectors.toList());
}
return Collections.emptyList();
}
use of net.minecraft.entity.item.ArmorStandEntity in project ChocolateQuestRepoured by TeamChocoQuest.
the class RoomDecorArmorStand method createEntityDecoration.
@Override
protected void createEntityDecoration(World world, BlockPos pos, BlockStateGenArray genArray, Direction side) {
// Need to add 0.5 to each position amount so it spawns in the middle of the tile
ArmorStandEntity stand = new ArmorStandEntity(world);
float rotation = side.getHorizontalAngle();
stand.setPosition((pos.getX() + 0.5), (pos.getY() + 0.5), (pos.getZ() + 0.5));
stand.rotationYaw = rotation;
genArray.addEntity(BlockPos.ORIGIN, stand);
}
use of net.minecraft.entity.item.ArmorStandEntity in project ChocolateQuestRepoured by TeamChocoQuest.
the class ModelCustomArmorBase method setupAnim.
@Override
public void setupAnim(T pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) {
super.setupAnim(pEntity, pLimbSwing, pLimbSwingAmount, pAgeInTicks, pNetHeadYaw, pHeadPitch);
if (pEntity instanceof ArmorStandEntity) {
ArmorStandEntity entityarmorstand = (ArmorStandEntity) pEntity;
this.head.xRot = 0.017453292F * entityarmorstand.getHeadPose().getX();
this.head.yRot = 0.017453292F * entityarmorstand.getHeadPose().getY();
this.head.zRot = 0.017453292F * entityarmorstand.getHeadPose().getZ();
this.head.setPos(0.0F, 1.0F, 0.0F);
this.body.xRot = 0.017453292F * entityarmorstand.getBodyPose().getX();
this.body.yRot = 0.017453292F * entityarmorstand.getBodyPose().getY();
this.body.zRot = 0.017453292F * entityarmorstand.getBodyPose().getZ();
this.leftArm.xRot = 0.017453292F * entityarmorstand.getLeftArmPose().getX();
this.leftArm.yRot = 0.017453292F * entityarmorstand.getLeftArmPose().getY();
this.leftArm.zRot = 0.017453292F * entityarmorstand.getLeftArmPose().getZ();
this.rightArm.xRot = 0.017453292F * entityarmorstand.getRightArmPose().getX();
this.rightArm.yRot = 0.017453292F * entityarmorstand.getRightArmPose().getY();
this.rightArm.zRot = 0.017453292F * entityarmorstand.getRightArmPose().getZ();
this.leftLeg.xRot = 0.017453292F * entityarmorstand.getLeftLegPose().getX();
this.leftLeg.yRot = 0.017453292F * entityarmorstand.getLeftLegPose().getY();
this.leftLeg.zRot = 0.017453292F * entityarmorstand.getLeftLegPose().getZ();
this.leftLeg.setPos(1.9F, 11.0F, 0.0F);
this.rightLeg.xRot = 0.017453292F * entityarmorstand.getRightLegPose().getX();
this.rightLeg.yRot = 0.017453292F * entityarmorstand.getRightLegPose().getY();
this.rightLeg.zRot = 0.017453292F * entityarmorstand.getRightLegPose().getZ();
this.rightLeg.setPos(-1.9F, 11.0F, 0.0F);
this.rightArm.copyFrom(this.head);
}
}
use of net.minecraft.entity.item.ArmorStandEntity in project Mekanism by mekanism.
the class ClientTickHandler method setModelVisibility.
private static void setModelVisibility(LivingEntity entity, BipedModel<?> entityModel, boolean showModel) {
if (entity.getItemBySlot(EquipmentSlotType.HEAD).getItem() instanceof ItemMekaSuitArmor) {
entityModel.head.visible = showModel;
entityModel.hat.visible = showModel;
if (entityModel instanceof PlayerModel) {
PlayerModel<?> playerModel = (PlayerModel<?>) entityModel;
playerModel.ear.visible = showModel;
}
}
ItemStack chest = entity.getItemBySlot(EquipmentSlotType.CHEST);
if (chest.getItem() instanceof ItemMekaSuitArmor) {
entityModel.body.visible = showModel;
if (!(entity instanceof ArmorStandEntity)) {
// Don't adjust arms for armor stands as the model will end up changing them anyway and then we may incorrectly activate them
entityModel.leftArm.visible = showModel;
entityModel.rightArm.visible = showModel;
}
if (entityModel instanceof PlayerModel) {
PlayerModel<?> playerModel = (PlayerModel<?>) entityModel;
playerModel.cloak.visible = showModel;
playerModel.jacket.visible = showModel;
playerModel.leftSleeve.visible = showModel;
playerModel.rightSleeve.visible = showModel;
} else if (entityModel instanceof ArmorStandModel) {
ArmorStandModel armorStandModel = (ArmorStandModel) entityModel;
armorStandModel.bodyStick1.visible = showModel;
armorStandModel.bodyStick2.visible = showModel;
armorStandModel.shoulderStick.visible = showModel;
}
} else if (chest.getItem() instanceof ItemHDPEElytra && entityModel instanceof PlayerModel) {
// Hide the player's cape if they have an HDPE elytra as it will be part of the elytra's layer and shouldn't be rendered
PlayerModel<?> playerModel = (PlayerModel<?>) entityModel;
playerModel.cloak.visible = showModel;
}
if (entity.getItemBySlot(EquipmentSlotType.LEGS).getItem() instanceof ItemMekaSuitArmor) {
entityModel.leftLeg.visible = showModel;
entityModel.rightLeg.visible = showModel;
if (entityModel instanceof PlayerModel) {
PlayerModel<?> playerModel = (PlayerModel<?>) entityModel;
playerModel.leftPants.visible = showModel;
playerModel.rightPants.visible = showModel;
}
}
}
use of net.minecraft.entity.item.ArmorStandEntity in project minecolonies by ldtteam.
the class ItemStackUtils method getListOfStackForEntity.
/**
* Adds entities to the builder building if he needs it.
*
* @param entity the entity object.
* @param placer the entity placer.
* @return a list of stacks.
*/
public static List<ItemStorage> getListOfStackForEntity(final Entity entity, final Entity placer) {
if (entity != null) {
final List<ItemStorage> request = new ArrayList<>();
if (entity instanceof ItemFrameEntity) {
final ItemStack stack = ((ItemFrameEntity) entity).getItem();
if (!ItemStackUtils.isEmpty(stack)) {
ItemStackUtils.setSize(stack, 1);
request.add(new ItemStorage(stack));
}
request.add(new ItemStorage(new ItemStack(Items.ITEM_FRAME, 1)));
} else if (entity instanceof ArmorStandEntity) {
request.add(new ItemStorage(entity.getPickedResult(new EntityRayTraceResult(placer))));
entity.getArmorSlots().forEach(item -> request.add(new ItemStorage(item)));
entity.getHandSlots().forEach(item -> request.add(new ItemStorage(item)));
}
return request.stream().filter(stack -> !stack.getItemStack().isEmpty()).collect(Collectors.toList());
}
return Collections.emptyList();
}
Aggregations