use of net.minecraft.entity.passive.FoxEntity in project WK by witches-kitchen.
the class PhasingStatusEffect method applyUpdateEffect.
@Override
public void applyUpdateEffect(LivingEntity entity, int amplifier) {
World world = entity.getEntityWorld();
if (!world.isClient) {
double d = entity.getX();
double e = entity.getY();
double f = entity.getZ();
for (int i = 0; i < 16; ++i) {
double g = entity.getX() + (entity.getRandom().nextDouble() - 0.5D) * 16.0D;
double h = MathHelper.clamp(entity.getY() + (double) (entity.getRandom().nextInt(16) - 8), world.getBottomY(), world.getBottomY() + ((ServerWorld) world).getLogicalHeight() - 1);
double j = entity.getZ() + (entity.getRandom().nextDouble() - 0.5D) * 16.0D;
if (entity.hasVehicle()) {
entity.stopRiding();
}
if (entity.teleport(g, h, j, true)) {
SoundEvent soundEvent = entity instanceof FoxEntity ? SoundEvents.ENTITY_FOX_TELEPORT : SoundEvents.ITEM_CHORUS_FRUIT_TELEPORT;
world.playSound(null, d, e, f, soundEvent, SoundCategory.PLAYERS, 1.0F, 1.0F);
entity.playSound(soundEvent, 1.0F, 1.0F);
break;
}
}
}
}
use of net.minecraft.entity.passive.FoxEntity in project Arclight by IzzelAliz.
the class FoxEntity_MateGoalMixin method spawnBaby.
/**
* @author IzzekAkuz
* @reason
*/
@Overwrite
protected void spawnBaby() {
FoxEntity foxentity = (FoxEntity) this.animal.createChild(this.targetMate);
if (foxentity != null) {
ServerPlayerEntity serverplayerentity = this.animal.getLoveCause();
ServerPlayerEntity serverplayerentity1 = this.targetMate.getLoveCause();
ServerPlayerEntity serverplayerentity2 = serverplayerentity;
if (serverplayerentity != null) {
((FoxEntityBridge) foxentity).bridge$addTrustedUUID(serverplayerentity.getUniqueID());
} else {
serverplayerentity2 = serverplayerentity1;
}
if (serverplayerentity1 != null && serverplayerentity != serverplayerentity1) {
((FoxEntityBridge) foxentity).bridge$addTrustedUUID(serverplayerentity1.getUniqueID());
}
int experience = this.animal.getRNG().nextInt(7) + 1;
final EntityBreedEvent entityBreedEvent = CraftEventFactory.callEntityBreedEvent(foxentity, this.animal, this.targetMate, serverplayerentity, ((AnimalEntityBridge) this.animal).bridge$getBreedItem(), experience);
if (entityBreedEvent.isCancelled()) {
return;
}
experience = entityBreedEvent.getExperience();
if (serverplayerentity2 != null) {
serverplayerentity2.addStat(Stats.ANIMALS_BRED);
CriteriaTriggers.BRED_ANIMALS.trigger(serverplayerentity2, this.animal, this.targetMate, foxentity);
}
int i = 6000;
this.animal.setGrowingAge(6000);
this.targetMate.setGrowingAge(6000);
this.animal.resetInLove();
this.targetMate.resetInLove();
foxentity.setGrowingAge(-24000);
foxentity.setLocationAndAngles(this.animal.posX, this.animal.posY, this.animal.posZ, 0.0F, 0.0F);
((WorldBridge) this.world).bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.BREEDING);
this.world.addEntity(foxentity);
this.world.setEntityState(this.animal, (byte) 18);
if (this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
if (experience > 0) {
this.world.addEntity(new ExperienceOrbEntity(this.world, this.animal.posX, this.animal.posY, this.animal.posZ, experience));
}
}
}
}
use of net.minecraft.entity.passive.FoxEntity in project BleachHack by BleachDrinker420.
the class Nametags method onWorldRender.
@BleachSubscribe
public void onWorldRender(EventWorldRender.Post event) {
for (Entity entity : mc.world.getEntities()) {
if (entity == mc.player || entity.hasPassenger(mc.player) || mc.player.hasPassenger(entity)) {
continue;
}
Vec3d rPos = entity.getPos().subtract(Renderer.getInterpolationOffset(entity)).add(0, entity.getHeight() + 0.25, 0);
if (entity instanceof PlayerEntity && getSetting(1).asToggle().getState()) {
double scale = Math.max(getSetting(1).asToggle().getChild(0).asSlider().getValue() * (mc.cameraEntity.distanceTo(entity) / 20), 1);
List<Text> lines = getPlayerLines((PlayerEntity) entity);
drawLines(rPos.x, rPos.y, rPos.z, scale, lines);
if (getSetting(1).asToggle().getChild(1).asToggle().getState()) {
drawItems(rPos.x, rPos.y + (lines.size() + 1) * 0.25 * scale, rPos.z, scale, getMainEquipment(entity));
}
} else if (EntityUtils.isAnimal(entity) && getSetting(2).asToggle().getState()) {
double scale = Math.max(getSetting(2).asToggle().getChild(0).asSlider().getValue() * (mc.cameraEntity.distanceTo(entity) / 20), 1);
List<Text> lines = getAnimalLines((LivingEntity) entity);
drawLines(rPos.x, rPos.y, rPos.z, scale, lines);
if (getSetting(2).asToggle().getChild(1).asToggle().getState() && entity instanceof FoxEntity) {
drawItems(rPos.x, rPos.y + (lines.size() + 1) * 0.25 * scale, rPos.z, scale, List.of(((FoxEntity) entity).getMainHandStack()));
}
} else if (entity instanceof Monster && getSetting(3).asToggle().getState()) {
double scale = Math.max(getSetting(3).asToggle().getChild(0).asSlider().getValue() * (mc.cameraEntity.distanceTo(entity) / 20), 1);
List<Text> lines = getMobLines((LivingEntity) entity);
drawLines(rPos.x, rPos.y, rPos.z, scale, lines);
if (getSetting(3).asToggle().getChild(1).asToggle().getState()) {
drawItems(rPos.x, rPos.y + (lines.size() + 1) * 0.25 * scale, rPos.z, scale, getMainEquipment(entity));
}
} else if (entity instanceof ItemEntity && getSetting(4).asToggle().getState()) {
double scale = Math.max(getSetting(4).asToggle().getChild(0).asSlider().getValue() * (mc.cameraEntity.distanceTo(entity) / 20), 1);
List<Text> lines = getItemLines((ItemEntity) entity);
drawLines(rPos.x, rPos.y, rPos.z, scale, lines);
} else if (entity instanceof ArmorStandEntity && getSetting(5).asToggle().getState()) {
double scale = Math.max(getSetting(5).asToggle().getChild(0).asSlider().getValue() * (mc.cameraEntity.distanceTo(entity) / 20), 1);
drawItems(rPos.x, rPos.y + 0.25 * scale, rPos.z, scale, getMainEquipment(entity));
}
}
}
use of net.minecraft.entity.passive.FoxEntity in project ChaosAwakens by ChaosAwakens.
the class RandomTeleportBlock method stepOn.
@Override
public void stepOn(World worldIn, BlockPos pos, Entity entityIn) {
if (!worldIn.isClientSide && entityIn instanceof LivingEntity) {
double d0 = entityIn.getX();
double d1 = entityIn.getY();
double d2 = entityIn.getZ();
for (int i = 0; i < 16; ++i) {
double d3 = entityIn.getX() + (getRNG().nextDouble() - 0.5D) * 16.0D;
double d4 = MathHelper.clamp(entityIn.getY() + (double) (getRNG().nextInt(16) - 8), 0.0D, (worldIn.getHeight() - 1));
double d5 = entityIn.getZ() + (getRNG().nextDouble() - 0.5D) * 16.0D;
if (entityIn.isPassenger())
entityIn.stopRiding();
LivingEntity livingEntityIn = (LivingEntity) entityIn;
EntityTeleportEvent.ChorusFruit event = ForgeEventFactory.onChorusFruitTeleport(livingEntityIn, d3, d4, d5);
if (livingEntityIn.randomTeleport(event.getTargetX(), event.getTargetY(), event.getTargetZ(), true)) {
SoundEvent soundevent = entityIn instanceof FoxEntity ? SoundEvents.FOX_TELEPORT : SoundEvents.CHORUS_FRUIT_TELEPORT;
worldIn.playSound(null, d0, d1, d2, soundevent, SoundCategory.PLAYERS, 1.0F, 1.0F);
entityIn.playSound(soundevent, 1.0F, 1.0F);
break;
}
}
}
}
Aggregations