net.minecraft.entity.mob.WitherSkeletonEntity Java Examples

The following examples show how to use net.minecraft.entity.mob.WitherSkeletonEntity. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SkeletonEntityMixin.java    From carpet-extra with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void onStruckByLightning(LightningEntity lightning)
{
    if (!this.world.isClient && !this.removed && CarpetExtraSettings.renewableWitherSkeletons)
    {
        WitherSkeletonEntity witherSkelly = new WitherSkeletonEntity(EntityType.WITHER_SKELETON, this.world);
        witherSkelly.refreshPositionAndAngles(this.getX(), this.getY(), this.getZ(), this.yaw, this.pitch);
        witherSkelly.initialize(this.world, this.world.getLocalDifficulty(new BlockPos(witherSkelly)), SpawnType.CONVERSION, (EntityData) null, (CompoundTag) null);
        witherSkelly.setAiDisabled(this.isAiDisabled());
        
        if (this.hasCustomName())
        {
            witherSkelly.setCustomName(this.getCustomName());
            witherSkelly.setCustomNameVisible(this.isCustomNameVisible());
        }
        
        this.world.spawnEntity(witherSkelly);
        this.remove();
    }
    else
    {
        super.onStruckByLightning(lightning);
    }
}
 
Example #2
Source File: WitchWaterBlock.java    From the-hallow with MIT License 5 votes vote down vote up
@Override
public void onEntityCollision(BlockState blockState, World world, BlockPos pos, Entity entity) {
	if(!world.isClient) {
		if (entity instanceof LivingEntity) {
			LivingEntity livingEntity = (LivingEntity) entity;
			if (!livingEntity.isUndead() && !(livingEntity instanceof PumpcownEntity) && !(livingEntity instanceof WitchEntity)) {
				livingEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.POISON, 100));
				livingEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 100));
				livingEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.BLINDNESS, 100));
			}
			if (pos.equals(entity.getBlockPos())) {
				if (entity.getType() == EntityType.SKELETON) {
					WitherSkeletonEntity witherSkeletonEntity = new WitherSkeletonEntity(EntityType.WITHER_SKELETON, world);
					witherSkeletonEntity.copyPositionAndRotation(entity);
					entity.remove();

					world.spawnEntity(witherSkeletonEntity);
				} else if (entity.getType() == EntityType.SPIDER) {
					CaveSpiderEntity caveSpiderEntity = new CaveSpiderEntity(EntityType.CAVE_SPIDER, world);
					caveSpiderEntity.copyPositionAndRotation(entity);
					entity.remove();

					world.spawnEntity(caveSpiderEntity);
				} else if (entity.getType() == EntityType.COW) {
					PumpcownEntity pumpcownEntity = new PumpcownEntity(HallowedEntities.PUMPCOWN, world);
					pumpcownEntity.copyPositionAndRotation(entity);
					entity.remove();

					world.spawnEntity(pumpcownEntity);
				} else if (entity.getType() == EntityType.VILLAGER && world.getDifficulty() != Difficulty.PEACEFUL) {
					WitchEntity witchEntity = new WitchEntity(EntityType.WITCH, world);
					witchEntity.copyPositionAndRotation(entity);
					entity.remove();

					world.spawnEntity(witchEntity);
				}
			}
		}
	}

	super.onEntityCollision(blockState, world, pos, entity);
}
 
Example #3
Source File: SkeleponyModel.java    From MineLittlePony with MIT License 5 votes vote down vote up
@Override
public void animateModel(T entity, float move, float swing, float ticks) {
    isUnicorn = entity.getUuid().getLeastSignificantBits() % 3 != 0;
    isWithered = entity instanceof WitherSkeletonEntity;
    attributes.visualHeight = isWithered ? 2.5F : 2;

    rightArmPose = ArmPose.EMPTY;
    leftArmPose = ArmPose.EMPTY;

    ItemStack mainHand = entity.getStackInHand(Hand.MAIN_HAND);
    ItemStack offHand = entity.getStackInHand(Hand.OFF_HAND);

    boolean right = entity.getMainArm() == Arm.RIGHT;

    if (!offHand.isEmpty()) {
        if (right) {
            leftArmPose = ArmPose.ITEM;
        } else {
            rightArmPose = ArmPose.ITEM;
        }
    }

    if (!mainHand.isEmpty()) {
        ArmPose pose = mainHand.getItem() == Items.BOW && entity.isAttacking() ? ArmPose.BOW_AND_ARROW : ArmPose.ITEM;

        if (right) {
            rightArmPose = pose;
        } else {
            leftArmPose = pose;
        }
    }
}
 
Example #4
Source File: SkeleponyRenderer.java    From MineLittlePony with MIT License 4 votes vote down vote up
@Override
public Identifier findTexture(WitherSkeletonEntity entity) {
    return WITHER;
}
 
Example #5
Source File: SkeleponyRenderer.java    From MineLittlePony with MIT License 4 votes vote down vote up
@Override
public void scale(WitherSkeletonEntity skeleton, MatrixStack stack, float ticks) {
    super.scale(skeleton, stack, ticks);
    stack.scale(1.2F, 1.2F, 1.2F);
}