Search in sources :

Example 1 with AbstractSkeletonEntity

use of net.minecraft.entity.monster.AbstractSkeletonEntity in project BudschieMorphMod by Budschie.

the class RenderHandler method onMorphInit.

@SubscribeEvent
public static void onMorphInit(InitializeMorphEntityEvent event) {
    if (event.getPlayer() == Minecraft.getInstance().player)
        event.getMorphEntity().setCustomNameVisible(false);
    if (event.getMorphEntity() instanceof AbstractClientPlayerEntity) {
        AbstractClientPlayerEntity entity = (AbstractClientPlayerEntity) event.getMorphEntity();
        // WTF?!?
        entity.setPrimaryHand(event.getPlayer().getPrimaryHand() == HandSide.LEFT ? HandSide.RIGHT : HandSide.LEFT);
    }
    if (event.getMorphEntity() instanceof AdvancedAbstractClientPlayerEntity) {
        AdvancedAbstractClientPlayerEntity advanced = (AdvancedAbstractClientPlayerEntity) event.getMorphEntity();
        // I LOVE lambdas!
        advanced.setIsWearing(part -> event.getPlayer().isWearing(part));
    }
    if (event.getMorphEntity() instanceof MobEntity) {
        if (event.getMorphEntity() instanceof AbstractSkeletonEntity)
            ((MobEntity) event.getMorphEntity()).setLeftHanded(event.getPlayer().getPrimaryHand() == HandSide.RIGHT);
        else
            ((MobEntity) event.getMorphEntity()).setLeftHanded(event.getPlayer().getPrimaryHand() == HandSide.LEFT);
    }
}
Also used : AdvancedAbstractClientPlayerEntity(de.budschie.bmorph.morph.player.AdvancedAbstractClientPlayerEntity) AbstractClientPlayerEntity(net.minecraft.client.entity.player.AbstractClientPlayerEntity) AdvancedAbstractClientPlayerEntity(de.budschie.bmorph.morph.player.AdvancedAbstractClientPlayerEntity) AbstractSkeletonEntity(net.minecraft.entity.monster.AbstractSkeletonEntity) MobEntity(net.minecraft.entity.MobEntity) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 2 with AbstractSkeletonEntity

use of net.minecraft.entity.monster.AbstractSkeletonEntity in project WarDance by Jackiecrazy.

the class GeneralUtils method dropSkull.

/**
 * drops a skull of the given type. For players it will retrieve their skin
 */
public static ItemStack dropSkull(LivingEntity elb) {
    ItemStack ret = null;
    if (elb instanceof AbstractSkeletonEntity) {
        if (elb instanceof WitherSkeletonEntity)
            ret = new ItemStack(Items.WITHER_SKELETON_SKULL);
        else
            ret = new ItemStack(Items.SKELETON_SKULL);
    } else if (elb instanceof ZombieEntity)
        ret = new ItemStack(Items.ZOMBIE_HEAD);
    else if (elb instanceof CreeperEntity)
        ret = new ItemStack(Items.CREEPER_HEAD);
    else if (elb instanceof EnderDragonEntity)
        ret = new ItemStack(Items.DRAGON_HEAD);
    else if (elb instanceof PlayerEntity) {
        PlayerEntity p = (PlayerEntity) elb;
        ret = new ItemStack(Items.PLAYER_HEAD);
        ret.setTag(new CompoundNBT());
        ret.getTag().putString("SkullOwner", p.getName().getString());
    }
    return ret;
}
Also used : ZombieEntity(net.minecraft.entity.monster.ZombieEntity) CompoundNBT(net.minecraft.nbt.CompoundNBT) EnderDragonEntity(net.minecraft.entity.boss.dragon.EnderDragonEntity) CreeperEntity(net.minecraft.entity.monster.CreeperEntity) ItemStack(net.minecraft.item.ItemStack) AbstractSkeletonEntity(net.minecraft.entity.monster.AbstractSkeletonEntity) WitherSkeletonEntity(net.minecraft.entity.monster.WitherSkeletonEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Example 3 with AbstractSkeletonEntity

use of net.minecraft.entity.monster.AbstractSkeletonEntity in project BudschieMorphMod by Budschie.

the class LivingEntitySynchronzier method applyToMorphEntity.

@Override
public void applyToMorphEntity(Entity morphEntity, PlayerEntity player) {
    LivingEntity entity = (LivingEntity) morphEntity;
    entity.distanceWalkedModified = player.distanceWalkedModified;
    entity.prevDistanceWalkedModified = player.prevDistanceWalkedModified;
    entity.limbSwing = player.limbSwing;
    entity.limbSwingAmount = player.limbSwingAmount;
    entity.prevLimbSwingAmount = player.prevLimbSwingAmount;
    entity.deathTime = player.deathTime;
    entity.hurtTime = player.hurtTime;
    entity.velocityChanged = player.velocityChanged;
    entity.isSwingInProgress = player.isSwingInProgress;
    entity.swingProgressInt = player.swingProgressInt;
    entity.swingProgress = player.swingProgress;
    entity.prevSwingProgress = player.prevSwingProgress;
    entity.setInvisible(player.isInvisible());
    entity.preventEntitySpawning = player.preventEntitySpawning;
    entity.renderYawOffset = player.prevRenderYawOffset;
    entity.renderYawOffset = player.renderYawOffset;
    entity.prevRenderYawOffset = player.prevRenderYawOffset;
    entity.rotationYawHead = player.rotationYawHead;
    entity.prevRotationYawHead = player.prevRotationYawHead;
    if (player.getBedPosition().isPresent())
        entity.setBedPosition(player.getBedPosition().get());
    if (entity instanceof AbstractSkeletonEntity || entity instanceof PlayerEntity) {
        entity.setHeldItem(Hand.OFF_HAND, player.getHeldItem(Hand.MAIN_HAND));
        entity.setHeldItem(Hand.MAIN_HAND, player.getHeldItem(Hand.OFF_HAND));
    } else {
        entity.setHeldItem(Hand.MAIN_HAND, player.getHeldItem(Hand.MAIN_HAND));
        entity.setHeldItem(Hand.OFF_HAND, player.getHeldItem(Hand.OFF_HAND));
    }
    // entity.setItemStackToSlot(entity.getPrimaryHand() == HandSide.LEFT ? EquipmentSlotType.OFFHAND : EquipmentSlotType.MAINHAND, player.getItemStackFromSlot(EquipmentSlotType.MAINHAND));
    // entity.setItemStackToSlot(entity.getPrimaryHand() == HandSide.LEFT ? EquipmentSlotType.MAINHAND : EquipmentSlotType.OFFHAND, player.getItemStackFromSlot(EquipmentSlotType.OFFHAND));
    entity.setItemStackToSlot(EquipmentSlotType.FEET, player.getItemStackFromSlot(EquipmentSlotType.FEET));
    entity.setItemStackToSlot(EquipmentSlotType.LEGS, player.getItemStackFromSlot(EquipmentSlotType.LEGS));
    entity.setItemStackToSlot(EquipmentSlotType.CHEST, player.getItemStackFromSlot(EquipmentSlotType.CHEST));
    entity.setItemStackToSlot(EquipmentSlotType.HEAD, player.getItemStackFromSlot(EquipmentSlotType.HEAD));
    entity.ticksElytraFlying = player.getTicksElytraFlying();
    entity.setPose(player.getPose());
    entity.setSwimming(player.isSwimming());
    entity.setMotion(player.getMotion());
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) AbstractSkeletonEntity(net.minecraft.entity.monster.AbstractSkeletonEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Aggregations

AbstractSkeletonEntity (net.minecraft.entity.monster.AbstractSkeletonEntity)3 PlayerEntity (net.minecraft.entity.player.PlayerEntity)2 AdvancedAbstractClientPlayerEntity (de.budschie.bmorph.morph.player.AdvancedAbstractClientPlayerEntity)1 AbstractClientPlayerEntity (net.minecraft.client.entity.player.AbstractClientPlayerEntity)1 LivingEntity (net.minecraft.entity.LivingEntity)1 MobEntity (net.minecraft.entity.MobEntity)1 EnderDragonEntity (net.minecraft.entity.boss.dragon.EnderDragonEntity)1 CreeperEntity (net.minecraft.entity.monster.CreeperEntity)1 WitherSkeletonEntity (net.minecraft.entity.monster.WitherSkeletonEntity)1 ZombieEntity (net.minecraft.entity.monster.ZombieEntity)1 ItemStack (net.minecraft.item.ItemStack)1 CompoundNBT (net.minecraft.nbt.CompoundNBT)1 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)1