Search in sources :

Example 16 with ArmorStandEntity

use of net.minecraft.entity.decoration.ArmorStandEntity in project EmissiveMod by Traben-0.

the class MixinBedBlockEntityRenderer method etf$getChestTexture.

@Inject(method = "render(Lnet/minecraft/block/entity/BedBlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;II)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/entity/BedBlockEntity;getWorld()Lnet/minecraft/world/World;", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILSOFT)
private void etf$getChestTexture(BedBlockEntity bedBlockEntity, float f, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j, CallbackInfo ci, SpriteIdentifier spriteIdentifier) {
    // hopefully works in modded scenarios, assumes the mod dev uses the actual vanilla code process and texture pathing rules
    String nameSpace = spriteIdentifier.getTextureId().getNamespace();
    String texturePath = "textures/" + spriteIdentifier.getTextureId().getPath() + ".png";
    etf$textureOfThis = new Identifier(nameSpace, texturePath);
    etf$vertexConsumerProviderOfThis = vertexConsumerProvider;
    if (ETFConfigData.enableCustomTextures) {
        etf$bedStandInDummy = new ArmorStandEntity(EntityType.ARMOR_STAND, MinecraftClient.getInstance().world);
        // System.out.println(MinecraftClient.getInstance().world.getBlockState(bedBlockEntity.getPos().down()).toString());
        etf$bedStandInDummy.setPos(bedBlockEntity.getPos().getX(), bedBlockEntity.getPos().getY(), bedBlockEntity.getPos().getZ());
        // chests don't have uuid so set UUID from something repeatable I chose from block pos
        etf$bedStandInDummy.setUuid(UUID.nameUUIDFromBytes(bedBlockEntity.getPos().toString().getBytes()));
    }
}
Also used : SpriteIdentifier(net.minecraft.client.util.SpriteIdentifier) Identifier(net.minecraft.util.Identifier) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 17 with ArmorStandEntity

use of net.minecraft.entity.decoration.ArmorStandEntity in project MCDoom by AzureDoom.

the class MaykrDoomArmor method predicate.

private <P extends IAnimatable> PlayState predicate(AnimationEvent<P> event) {
    LivingEntity livingEntity = event.getExtraDataOfType(LivingEntity.class).get(0);
    if (livingEntity instanceof ArmorStandEntity) {
        return PlayState.STOP;
    }
    event.getController().setAnimation(new AnimationBuilder().addAnimation("idle", true));
    return PlayState.CONTINUE;
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) AnimationBuilder(software.bernie.geckolib3.core.builder.AnimationBuilder) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity)

Example 18 with ArmorStandEntity

use of net.minecraft.entity.decoration.ArmorStandEntity in project MCDoom by AzureDoom.

the class CultistDoomArmor method predicate.

private <P extends IAnimatable> PlayState predicate(AnimationEvent<P> event) {
    LivingEntity livingEntity = event.getExtraDataOfType(LivingEntity.class).get(0);
    if (livingEntity instanceof ArmorStandEntity) {
        return PlayState.STOP;
    }
    event.getController().setAnimation(new AnimationBuilder().addAnimation("idle", true));
    return PlayState.CONTINUE;
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) AnimationBuilder(software.bernie.geckolib3.core.builder.AnimationBuilder) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity)

Example 19 with ArmorStandEntity

use of net.minecraft.entity.decoration.ArmorStandEntity in project More-Weaponry by DakotaPride.

the class SickenedArmorItem method predicate.

// Predicate runs every frame
private <P extends IAnimatable> PlayState predicate(AnimationEvent<P> event) {
    // This is all the extradata this event carries. The livingentity is the entity
    // that's wearing the armor. The itemstack and equipmentslottype are self
    // explanatory.
    LivingEntity livingEntity = event.getExtraDataOfType(LivingEntity.class).get(0);
    // Always loop the animation but later on in this method we'll decide whether or
    // not to actually play it
    event.getController().setAnimation(new AnimationBuilder().addAnimation("idle", true));
    // If the living entity is an armorstand just play the animation nonstop
    if (livingEntity instanceof ArmorStandEntity) {
        return PlayState.CONTINUE;
    } else // full set of armor
    if (livingEntity instanceof PlayerEntity) {
        PlayerEntity player = (PlayerEntity) livingEntity;
        // Get all the equipment, aka the armor, currently held item, and offhand item
        List<Item> equipmentList = new ArrayList<>();
        player.getItemsEquipped().forEach((x) -> equipmentList.add(x.getItem()));
        // elements 2 to 6 are the armor so we take the sublist. Armorlist now only
        // contains the 4 armor slots
        List<Item> armorList = equipmentList.subList(2, 6);
        // Make sure the player is wearing all the armor. If they are, continue playing
        // the animation, otherwise stop
        boolean isWearingAll = armorList.containsAll(Arrays.asList(MoreWeaponryItems.SICKENED_HELMET, MoreWeaponryItems.SICKENED_CHESTPLATE));
        return isWearingAll ? PlayState.CONTINUE : PlayState.STOP;
    }
    return PlayState.STOP;
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) ArmorMaterial(net.minecraft.item.ArmorMaterial) AnimationBuilder(software.bernie.geckolib3.core.builder.AnimationBuilder) Arrays(java.util.Arrays) PlayerEntity(net.minecraft.entity.player.PlayerEntity) IAnimatable(software.bernie.geckolib3.core.IAnimatable) AnimationController(software.bernie.geckolib3.core.controller.AnimationController) LivingEntity(net.minecraft.entity.LivingEntity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) Item(net.minecraft.item.Item) MoreWeaponryItems(net.DakotaPride.moreweaponry.item.MoreWeaponryItems) AnimationFactory(software.bernie.geckolib3.core.manager.AnimationFactory) ArrayList(java.util.ArrayList) List(java.util.List) AnimationData(software.bernie.geckolib3.core.manager.AnimationData) EquipmentSlot(net.minecraft.entity.EquipmentSlot) AnimationEvent(software.bernie.geckolib3.core.event.predicate.AnimationEvent) ArmorItem(net.minecraft.item.ArmorItem) PlayState(software.bernie.geckolib3.core.PlayState) ArrayList(java.util.ArrayList) List(java.util.List) AnimationBuilder(software.bernie.geckolib3.core.builder.AnimationBuilder) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Example 20 with ArmorStandEntity

use of net.minecraft.entity.decoration.ArmorStandEntity in project More-Weaponry by DakotaPride.

the class WandererArmorItem method predicate.

// Predicate runs every frame
private <P extends IAnimatable> PlayState predicate(AnimationEvent<P> event) {
    // This is all the extradata this event carries. The livingentity is the entity
    // that's wearing the armor. The itemstack and equipmentslottype are self
    // explanatory.
    LivingEntity livingEntity = event.getExtraDataOfType(LivingEntity.class).get(0);
    // Always loop the animation but later on in this method we'll decide whether or
    // not to actually play it
    event.getController().setAnimation(new AnimationBuilder().addAnimation("idle", true));
    // If the living entity is an armorstand just play the animation nonstop
    if (livingEntity instanceof ArmorStandEntity) {
        return PlayState.CONTINUE;
    } else // full set of armor
    if (livingEntity instanceof PlayerEntity) {
        PlayerEntity player = (PlayerEntity) livingEntity;
        // Get all the equipment, aka the armor, currently held item, and offhand item
        List<Item> equipmentList = new ArrayList<>();
        player.getItemsEquipped().forEach((x) -> equipmentList.add(x.getItem()));
        // elements 2 to 6 are the armor so we take the sublist. Armorlist now only
        // contains the 4 armor slots
        List<Item> armorList = equipmentList.subList(2, 6);
        // Make sure the player is wearing all the armor. If they are, continue playing
        // the animation, otherwise stop
        boolean isWearingAll = armorList.containsAll(Arrays.asList(MoreWeaponryItems.WANDERER_HELMET, MoreWeaponryItems.WANDERER_CHESTPLATE));
        return isWearingAll ? PlayState.CONTINUE : PlayState.STOP;
    }
    return PlayState.STOP;
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) ArmorMaterial(net.minecraft.item.ArmorMaterial) AnimationBuilder(software.bernie.geckolib3.core.builder.AnimationBuilder) Arrays(java.util.Arrays) PlayerEntity(net.minecraft.entity.player.PlayerEntity) IAnimatable(software.bernie.geckolib3.core.IAnimatable) AnimationController(software.bernie.geckolib3.core.controller.AnimationController) LivingEntity(net.minecraft.entity.LivingEntity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) Item(net.minecraft.item.Item) MoreWeaponryItems(net.DakotaPride.moreweaponry.item.MoreWeaponryItems) AnimationFactory(software.bernie.geckolib3.core.manager.AnimationFactory) ArrayList(java.util.ArrayList) List(java.util.List) AnimationData(software.bernie.geckolib3.core.manager.AnimationData) EquipmentSlot(net.minecraft.entity.EquipmentSlot) AnimationEvent(software.bernie.geckolib3.core.event.predicate.AnimationEvent) ArmorItem(net.minecraft.item.ArmorItem) PlayState(software.bernie.geckolib3.core.PlayState) ArrayList(java.util.ArrayList) List(java.util.List) AnimationBuilder(software.bernie.geckolib3.core.builder.AnimationBuilder) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Aggregations

ArmorStandEntity (net.minecraft.entity.decoration.ArmorStandEntity)32 LivingEntity (net.minecraft.entity.LivingEntity)26 PlayerEntity (net.minecraft.entity.player.PlayerEntity)22 Entity (net.minecraft.entity.Entity)15 ArrayList (java.util.ArrayList)12 Monster (net.minecraft.entity.mob.Monster)11 Box (net.minecraft.util.math.Box)11 HorseBaseEntity (net.minecraft.entity.passive.HorseBaseEntity)10 TameableEntity (net.minecraft.entity.passive.TameableEntity)10 AnimationBuilder (software.bernie.geckolib3.core.builder.AnimationBuilder)10 Stream (java.util.stream.Stream)9 AmbientEntity (net.minecraft.entity.mob.AmbientEntity)9 EndermanEntity (net.minecraft.entity.mob.EndermanEntity)9 WaterCreatureEntity (net.minecraft.entity.mob.WaterCreatureEntity)9 ZombifiedPiglinEntity (net.minecraft.entity.mob.ZombifiedPiglinEntity)9 AnimalEntity (net.minecraft.entity.passive.AnimalEntity)9 GolemEntity (net.minecraft.entity.passive.GolemEntity)9 MerchantEntity (net.minecraft.entity.passive.MerchantEntity)9 PassiveEntity (net.minecraft.entity.passive.PassiveEntity)9 Hand (net.minecraft.util.Hand)9