[change] change some settings for Pinguin/Rooster/Firefly

This commit is contained in:
2026-09-24 20:37:40 +02:00
parent 256313e32f
commit f6e1c46ebe
8 changed files with 149 additions and 195 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ parchment_mappings_version=2025.12.21-nightly-SNAPSHOT
# Must match the String constant located in the main mod class annotated with @Mod.
mod_id=masterwild
# The human-readable display name for the mod.
mod_name=MasterWIld
mod_name=MasterWild
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
@@ -22,12 +22,12 @@ public class ModEntities {
.sized(0.75f, 0.85f).build("pinguin"));
public static final Supplier<EntityType<FireflyEntity>> FIREFLY =
ENTITY_TYPES.register("firefly", () -> EntityType.Builder.of(FireflyEntity::new, MobCategory.CREATURE)
ENTITY_TYPES.register("firefly", () -> EntityType.Builder.of(FireflyEntity::new, MobCategory.AMBIENT)
.sized(0.35f, 0.5f).build("firefly"));
public static final Supplier<EntityType<RoosterEntity>> ROOSTER =
ENTITY_TYPES.register("rooster", () -> EntityType.Builder.of(RoosterEntity::new, MobCategory.CREATURE)
.sized(0.5f, 0.75f).build("rooster"));
.sized(0.7f, 1.0f).build("rooster"));
public static final Supplier<EntityType<SharkEntity>> SHARK =
ENTITY_TYPES.register("shark", () -> EntityType.Builder.of(SharkEntity::new, MobCategory.WATER_CREATURE)
@@ -3,7 +3,6 @@ package ovh.glitchlabs.masterwild.entity.client.Pinguin;
import com.google.common.collect.Maps;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.Util;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.resources.ResourceLocation;
@@ -14,6 +13,8 @@ import ovh.glitchlabs.masterwild.entity.custom.PinguinEntity;
import java.util.Map;
public class PinguinRenderer extends MobRenderer<PinguinEntity, PinguinModel<PinguinEntity>> {
private static final float SHADOW = 0.25f;
private static final float BABY_SCALE = 0.45f;
public static final Map<PinguinVariants, ResourceLocation> LOCATION_BY_VARIANT =
Util.make(Maps.newEnumMap(PinguinVariants.class), map -> {
@@ -24,22 +25,21 @@ public class PinguinRenderer extends MobRenderer<PinguinEntity, PinguinModel<Pin
});
public PinguinRenderer(EntityRendererProvider.Context context) {
super(context, new PinguinModel<>(context.bakeLayer(PinguinModel.LAYER_LOCATION)), 0.25f);
super(context, new PinguinModel<>(context.bakeLayer(PinguinModel.LAYER_LOCATION)), SHADOW);
}
@Override
public ResourceLocation getTextureLocation(PinguinEntity entity) {
return ResourceLocation.fromNamespaceAndPath(Masterwild.MODID, "textures/entity/pinguin.png");
return LOCATION_BY_VARIANT.get(entity.getVariant());
}
@Override
public void render(PinguinEntity entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) {
if(entity.isBaby()) {
poseStack.scale(0.45f, 0.45f, 0.45f);
protected void scale(PinguinEntity entity, PoseStack poseStack, float partialTick) {
if (entity.isBaby()) {
poseStack.scale(BABY_SCALE, BABY_SCALE, BABY_SCALE);
this.shadowRadius = SHADOW * BABY_SCALE;
} else {
poseStack.scale(1f, 1f, 1f);
this.shadowRadius = SHADOW;
}
super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight);
}
}
}
@@ -1,7 +1,6 @@
package ovh.glitchlabs.masterwild.entity.client.Rooster;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.resources.ResourceLocation;
@@ -9,24 +8,25 @@ import ovh.glitchlabs.masterwild.Masterwild;
import ovh.glitchlabs.masterwild.entity.custom.RoosterEntity;
public class RoosterRenderer extends MobRenderer<RoosterEntity, RoosterModel<RoosterEntity>> {
private static final ResourceLocation TEXTURE =
ResourceLocation.fromNamespaceAndPath(Masterwild.MODID, "textures/entity/rooster.png");
private static final float ADULT_SCALE = 1.5f;
private static final float BABY_SCALE = 0.45f;
private static final float SHADOW = 0.25f;
public RoosterRenderer(EntityRendererProvider.Context context) {
super(context, new RoosterModel<>(context.bakeLayer(RoosterModel.LAYER_LOCATION)), 0.25f);
super(context, new RoosterModel<>(context.bakeLayer(RoosterModel.LAYER_LOCATION)), SHADOW);
}
@Override
public ResourceLocation getTextureLocation(RoosterEntity entity) {
return ResourceLocation.fromNamespaceAndPath(Masterwild.MODID, "textures/entity/rooster.png");
return TEXTURE;
}
@Override
public void render(RoosterEntity entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) {
if(entity.isBaby()) {
poseStack.scale(0.45f, 0.45f, 0.45f);
} else {
poseStack.scale(1.5f, 1.5f, 1.5f);
}
super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight);
protected void scale(RoosterEntity entity, PoseStack poseStack, float partialTick) {
float scale = entity.isBaby() ? BABY_SCALE : ADULT_SCALE;
poseStack.scale(scale, scale, scale);
this.shadowRadius = SHADOW * scale;
}
}
}
@@ -1,7 +1,5 @@
package ovh.glitchlabs.masterwild.entity.client.firefly;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.resources.ResourceLocation;
@@ -9,20 +7,16 @@ import ovh.glitchlabs.masterwild.Masterwild;
import ovh.glitchlabs.masterwild.entity.custom.FireflyEntity;
public class FireflyRenderer extends MobRenderer<FireflyEntity, FireflyModel<FireflyEntity>> {
private static final ResourceLocation TEXTURE =
ResourceLocation.fromNamespaceAndPath(Masterwild.MODID, "textures/entity/firefly.png");
public FireflyRenderer(EntityRendererProvider.Context context) {
super(context, new FireflyModel<>(context.bakeLayer(FireflyModel.LAYER_LOCATION)), 0.50f);
super(context, new FireflyModel<>(context.bakeLayer(FireflyModel.LAYER_LOCATION)), 0.1f);
this.addLayer(new FireflyGlowLayer(this));
}
@Override
public ResourceLocation getTextureLocation(FireflyEntity entity) {
return ResourceLocation.fromNamespaceAndPath(Masterwild.MODID, "textures/entity/firefly.png");
return TEXTURE;
}
@Override
public void render(FireflyEntity entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) {
poseStack.scale(1f, 1f, 1f);
super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight);
}
}
}
@@ -1,38 +1,40 @@
package ovh.glitchlabs.masterwild.entity.custom;
import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.AgeableMob;
import net.minecraft.world.entity.AnimationState;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.control.FlyingMoveControl;
import net.minecraft.world.entity.ai.goal.*;
import net.minecraft.world.entity.ai.navigation.FlyingPathNavigation;
import net.minecraft.world.entity.ai.navigation.PathNavigation;
import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.Nullable;
import ovh.glitchlabs.masterwild.entity.PinguinVariants;
public class FireflyEntity extends Animal {
public static final AnimationState idleAnimationState = new AnimationState();
public final AnimationState idleAnimationState = new AnimationState();
private BlockPos targetPosition;
public FireflyEntity(EntityType<? extends Animal> entityType, Level level) {
super(entityType, level);
xpReward = 0;
setNoAi(false);
}
public static AttributeSupplier.Builder createAttributes() {
return Mob.createMobAttributes()
.add(Attributes.MOVEMENT_SPEED, 0.4)
.add(Attributes.MAX_HEALTH, 4)
.add(Attributes.ARMOR, 0)
.add(Attributes.ATTACK_DAMAGE, 0)
.add(Attributes.FOLLOW_RANGE, 4)
.add(Attributes.FLYING_SPEED, 0.3);
}
@Override
@@ -64,9 +66,27 @@ public class FireflyEntity extends Animal {
this.setDeltaMovement(newMotion);
float targetYaw = (float) (Mth.atan2(newMotion.z, newMotion.x) * 180.0 / Math.PI) - 90.0F;
float yawDiff = Mth.wrapDegrees(targetYaw - this.getYRot());
this.zza = 0.5F;
this.setYRot(this.getYRot() + yawDiff);
this.setYRot(this.getYRot() + Mth.wrapDegrees(targetYaw - this.getYRot()));
}
@Override
public boolean isNoGravity() {
return true;
}
@Override
public boolean isPushable() {
return false;
}
@Override
public boolean causeFallDamage(float fallDistance, float multiplier, DamageSource source) {
return false;
}
@Override
protected void checkFallDamage(double y, boolean onGround, BlockState state, BlockPos pos) {
}
@Override
@@ -80,67 +100,20 @@ public class FireflyEntity extends Animal {
}
@Override
public boolean isPushable() {
public boolean isFood(ItemStack stack) {
return false;
}
@Override
protected PathNavigation createNavigation(Level world) {
return new FlyingPathNavigation(this, world);
}
@Override
public boolean isFood(ItemStack itemStack) {
return false;
}
@Override
public @Nullable AgeableMob getBreedOffspring(ServerLevel serverLevel, AgeableMob ageableMob) {
public @Nullable AgeableMob getBreedOffspring(ServerLevel level, AgeableMob partner) {
return null;
}
@Override
public void aiStep() {
super.aiStep();
this.setNoGravity(true);
}
@Override
public void setNoGravity(boolean ignored) {
super.setNoGravity(true);
}
@Override
public boolean causeFallDamage(float l, float d, DamageSource source) {
return false;
}
@Override
protected void checkFallDamage(double y, boolean onGroundIn, BlockState state, BlockPos pos) {
}
public static AttributeSupplier.Builder createAttributes() {
AttributeSupplier.Builder builder = Mob.createMobAttributes();
builder = builder.add(Attributes.MOVEMENT_SPEED, 0.4);
builder = builder.add(Attributes.MAX_HEALTH, 4);
builder = builder.add(Attributes.ARMOR, 0);
builder = builder.add(Attributes.ATTACK_DAMAGE, 0);
builder = builder.add(Attributes.FOLLOW_RANGE, 4);
builder = builder.add(Attributes.STEP_HEIGHT, 0.6);
builder = builder.add(Attributes.FLYING_SPEED, 0.3);
return builder;
}
private void setupAnimationStates() {
this.idleAnimationState.startIfStopped(this.tickCount);
}
@Override
public void tick() {
super.tick();
if(this.level().isClientSide()) {
this.setupAnimationStates();
if (this.level().isClientSide()) {
this.idleAnimationState.startIfStopped(this.tickCount);
}
}
}
}
@@ -1,6 +1,5 @@
package ovh.glitchlabs.masterwild.entity.custom;
import net.minecraft.Util;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
@@ -8,98 +7,90 @@ import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.AgeableMob;
import net.minecraft.world.entity.AnimationState;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.entity.SpawnGroupData;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.goal.*;
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.entity.animal.Cod;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import org.jetbrains.annotations.Nullable;
import ovh.glitchlabs.masterwild.entity.ModEntities;
import ovh.glitchlabs.masterwild.entity.PinguinVariants;
import javax.annotation.Nullable;
public class PinguinEntity extends Animal {
public static final AnimationState idleAnimationState = new AnimationState();
private int idleAnimationTimeout = 0;
private static final Ingredient FOOD = Ingredient.of(Items.COD, Items.SALMON);
private static final float RARE_CHANCE = 0.1f;
private static final EntityDataAccessor<Integer> VARIANT =
SynchedEntityData.defineId(PinguinEntity.class, EntityDataSerializers.INT);
public final AnimationState idleAnimationState = new AnimationState();
public PinguinEntity(EntityType<? extends Animal> entityType, Level level) {
super(entityType, level);
xpReward = 0;
setNoAi(false);
}
public static AttributeSupplier.Builder createAttributes() {
AttributeSupplier.Builder builder = Mob.createMobAttributes();
builder = builder.add(Attributes.MOVEMENT_SPEED, 0.3);
builder = builder.add(Attributes.MAX_HEALTH, 6);
builder = builder.add(Attributes.ARMOR, 0);
builder = builder.add(Attributes.ATTACK_DAMAGE, 3);
builder = builder.add(Attributes.FOLLOW_RANGE, 4);
builder = builder.add(Attributes.STEP_HEIGHT, 0.6);
return builder;
return Mob.createMobAttributes()
.add(Attributes.MOVEMENT_SPEED, 0.3)
.add(Attributes.MAX_HEALTH, 6)
.add(Attributes.ARMOR, 0)
.add(Attributes.ATTACK_DAMAGE, 3)
.add(Attributes.FOLLOW_RANGE, 4)
.add(Attributes.STEP_HEIGHT, 0.6);
}
@Override
public boolean isFood(ItemStack stack) {
return Ingredient.of(new ItemStack(Items.COD)).test(stack);
return FOOD.test(stack);
}
@Override
protected void registerGoals() {
super.registerGoals();
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1, false) {
@Override
protected boolean canPerformAttack(LivingEntity entity) {
return this.isTimeToAttack() && this.mob.distanceToSqr(entity) < (this.mob.getBbWidth() * this.mob.getBbWidth() + entity.getBbWidth()) && this.mob.getSensing().hasLineOfSight(entity);
}
});
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal(this, Cod.class, true, true));
this.goalSelector.addGoal(3, new WaterAvoidingRandomStrollGoal(this, 0.8));
this.goalSelector.addGoal(4, new PanicGoal(this, 1));
this.goalSelector.addGoal(5, new FollowParentGoal(this, 0.8));
this.goalSelector.addGoal(6, new BreedGoal(this, 1));
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(1, new PanicGoal(this, 1.0));
this.goalSelector.addGoal(2, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(3, new TemptGoal(this, 1.0, FOOD, false));
this.goalSelector.addGoal(4, new FollowParentGoal(this, 0.8));
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 0.8));
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(7, new RandomLookAroundGoal(this));
this.goalSelector.addGoal(8, new FloatGoal(this));
this.goalSelector.addGoal(10, new TemptGoal(this, 1, (Ingredient.of(Items.COD, Items.SALMON)), false));
}
protected void dropCustomDeathLoot(ServerLevel serverLevel, DamageSource source, boolean recentlyHitIn) {
super.dropCustomDeathLoot(serverLevel, source, recentlyHitIn);
this.spawnAtLocation(new ItemStack(Items.COD));
}
@Override
public AgeableMob getBreedOffspring(ServerLevel serverWorld, AgeableMob ageable) {
PinguinEntity retval = ModEntities.PINGUIN.get().create(serverWorld);
retval.finalizeSpawn(serverWorld, serverWorld.getCurrentDifficultyAt(retval.blockPosition()), MobSpawnType.BREEDING, null);
return retval;
protected void dropCustomDeathLoot(ServerLevel serverLevel, DamageSource source, boolean recentlyHit) {
super.dropCustomDeathLoot(serverLevel, source, recentlyHit);
this.spawnAtLocation(new ItemStack(Items.COD));
}
private void setupAnimationStates() {
if(this.idleAnimationTimeout <= 0) {
this.idleAnimationTimeout = 5;
this.idleAnimationState.start(this.tickCount);
} else {
--this.idleAnimationTimeout;
@Nullable
@Override
public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob partner) {
PinguinEntity baby = ModEntities.PINGUIN.get().create(level);
if (baby != null) {
baby.finalizeSpawn(level, level.getCurrentDifficultyAt(baby.blockPosition()), MobSpawnType.BREEDING, null);
PinguinEntity other = partner instanceof PinguinEntity p ? p : this;
baby.setVariant(this.random.nextBoolean() ? this.getVariant() : other.getVariant());
}
return baby;
}
@Override
public void tick() {
super.tick();
if(this.level().isClientSide()) {
this.setupAnimationStates();
if (this.level().isClientSide()) {
this.idleAnimationState.startIfStopped(this.tickCount);
}
}
@@ -136,9 +127,7 @@ public class PinguinEntity extends Animal {
@Override
public SpawnGroupData finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty,
MobSpawnType spawnType, @Nullable SpawnGroupData spawnGroupData) {
PinguinVariants variants = Util.getRandom(PinguinVariants.values(), this.random);
this.setVariant(variants);
this.setVariant(this.random.nextFloat() < RARE_CHANCE ? PinguinVariants.RARE : PinguinVariants.NORMAL);
return super.finalizeSpawn(level, difficulty, spawnType, spawnGroupData);
}
}
}
@@ -1,11 +1,9 @@
package ovh.glitchlabs.masterwild.entity.custom;
import net.minecraft.core.BlockPos;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.AgeableMob;
@@ -18,36 +16,31 @@ import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.pathfinder.PathType;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.neoforge.event.EventHooks;
import org.jetbrains.annotations.Nullable;
import ovh.glitchlabs.masterwild.Sounds.ModSounds;
import ovh.glitchlabs.masterwild.entity.ModEntities;
public class RoosterEntity extends Animal {
boolean newDay = false;
private long lastDay;
// -1 = noch kein Tag erfasst -> beim Laden/Betreten der Welt wird nicht gekräht
private long lastDay = -1;
private int crowDelay = -1;
public RoosterEntity(EntityType<? extends Animal> entityType, Level level) {
super(entityType, level);
xpReward = 10;
setNoAi(false);
this.setPathfindingMalus(PathType.WATER, 0.0F);
}
public static AttributeSupplier.Builder createAttributes() {
AttributeSupplier.Builder builder = Mob.createMobAttributes();
builder = builder.add(Attributes.MOVEMENT_SPEED, 0.3);
builder = builder.add(Attributes.MAX_HEALTH, 5);
builder = builder.add(Attributes.ARMOR, 0);
builder = builder.add(Attributes.ATTACK_DAMAGE, 0);
builder = builder.add(Attributes.FOLLOW_RANGE, 16);
builder = builder.add(Attributes.STEP_HEIGHT, 0.6);
return builder;
return Mob.createMobAttributes()
.add(Attributes.MOVEMENT_SPEED, 0.3)
.add(Attributes.MAX_HEALTH, 5)
.add(Attributes.ARMOR, 0)
.add(Attributes.ATTACK_DAMAGE, 0)
.add(Attributes.FOLLOW_RANGE, 16)
.add(Attributes.STEP_HEIGHT, 0.6);
}
@Override
@@ -55,7 +48,7 @@ public class RoosterEntity extends Animal {
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(1, new PanicGoal(this, 1.4));
this.goalSelector.addGoal(2, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(3, new TemptGoal(this, 1.0, p_335679_ -> p_335679_.is(ItemTags.CHICKEN_FOOD), false));
this.goalSelector.addGoal(3, new TemptGoal(this, 1.0, stack -> stack.is(ItemTags.CHICKEN_FOOD), false));
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.1));
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
@@ -84,37 +77,42 @@ public class RoosterEntity extends Animal {
@Override
public boolean isFood(ItemStack stack) {
return Ingredient.of(new ItemStack(Items.WHEAT_SEEDS)).test(stack);
return stack.is(ItemTags.CHICKEN_FOOD);
}
@Nullable
@Override
public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob partner) {
return ModEntities.ROOSTER.get().create(level);
}
@Override
public @Nullable AgeableMob getBreedOffspring(ServerLevel serverLevel, AgeableMob ageableMob) {
return null;
}
protected void dropCustomDeathLoot(ServerLevel serverLevel, DamageSource source, boolean recentlyHitIn) {
super.dropCustomDeathLoot(serverLevel, source, recentlyHitIn);
protected void dropCustomDeathLoot(ServerLevel serverLevel, DamageSource source, boolean recentlyHit) {
super.dropCustomDeathLoot(serverLevel, source, recentlyHit);
this.spawnAtLocation(new ItemStack(Items.CHICKEN));
}
@Override
public void tick() {
super.tick();
if (!this.level().isClientSide() && !level().isRaining() && !level().isThundering()) {
long day = this.level().getDayTime() / 24000L;
long lastDay = -1;
if (this.lastDay != -1 && day != this.lastDay) {
this.onNewDay();
}
this.lastDay = day;
if (this.level().isClientSide()) {
return;
}
long day = this.level().getDayTime() / 24000L;
if (this.lastDay != -1 && day != this.lastDay && !this.isBaby()) {
this.crowDelay = this.random.nextInt(60);
}
this.lastDay = day;
if (this.crowDelay >= 0 && --this.crowDelay < 0) {
if (this.isAlive() && !this.level().isRaining() && !this.level().isThundering()) {
this.crow();
}
}
}
private void onNewDay() {
private void crow() {
this.playSound(ModSounds.ROOSTER_CROW.get(), 2.0f, 0.8f + this.random.nextFloat() * 0.4f);
}
}
}