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);
}
}
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;
}
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());
}
Aggregations