diff --git a/src/client/java/net/rotgruengelb/forestal/client/render/entity/GrizzlyBearEntityRenderer.java b/src/client/java/net/rotgruengelb/forestal/client/render/entity/GrizzlyBearEntityRenderer.java index af73983..c76acbf 100644 --- a/src/client/java/net/rotgruengelb/forestal/client/render/entity/GrizzlyBearEntityRenderer.java +++ b/src/client/java/net/rotgruengelb/forestal/client/render/entity/GrizzlyBearEntityRenderer.java @@ -16,15 +16,19 @@ public GrizzlyBearEntityRenderer(EntityRendererFactory.Context renderManager) { } @Override - public Identifier getTextureLocation(GrizzlyBearEntity animatable) { - return new Identifier(Forestal.MOD_ID, "textures/entity/grizzly_bear.png"); + public Identifier getTextureLocation(GrizzlyBearEntity grizzlyBear) { + if (grizzlyBear.isAsleep()) { + return new Identifier(Forestal.MOD_ID, "textures/entity/grizzly_bear/grizzly_bear_sleeping.png"); + } + return new Identifier(Forestal.MOD_ID, "textures/entity/grizzly_bear/grizzly_bear_normal.png"); } @Override - public void render(GrizzlyBearEntity entity, float entityYaw, float partialTick, MatrixStack poseStack, VertexConsumerProvider bufferSource, int packedLight) { - if (entity.isBaby()) { - poseStack.scale(0.4F, 0.4F, 0.4F); + public void render(GrizzlyBearEntity grizzlyBear, float entityYaw, float partialTick, + MatrixStack poseStack, VertexConsumerProvider bufferSource, int packedLight) { + if (grizzlyBear.isBaby()) { + poseStack.scale(0.6F, 0.6F, 0.6F); } - super.render(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); + super.render(grizzlyBear, entityYaw, partialTick, poseStack, bufferSource, packedLight); } } diff --git a/src/client/java/net/rotgruengelb/forestal/client/render/entity/model/GrizzlyBearEntityModel.java b/src/client/java/net/rotgruengelb/forestal/client/render/entity/model/GrizzlyBearEntityModel.java index 2a1aaf9..ad2a34e 100644 --- a/src/client/java/net/rotgruengelb/forestal/client/render/entity/model/GrizzlyBearEntityModel.java +++ b/src/client/java/net/rotgruengelb/forestal/client/render/entity/model/GrizzlyBearEntityModel.java @@ -17,8 +17,11 @@ public Identifier getModelResource(GrizzlyBearEntity animatable) { } @Override - public Identifier getTextureResource(GrizzlyBearEntity animatable) { - return new Identifier(Forestal.MOD_ID, "textures/entity/grizzly_bear.png"); + public Identifier getTextureResource(GrizzlyBearEntity grizzlyBear) { + if (grizzlyBear.isAsleep()) { + return new Identifier(Forestal.MOD_ID, "textures/entity/grizzly_bear/grizzly_bear_sleeping.png"); + } + return new Identifier(Forestal.MOD_ID, "textures/entity/grizzly_bear/grizzly_bear_normal.png"); } @Override diff --git a/src/main/java/net/rotgruengelb/forestal/entity/ForestalEntities.java b/src/main/java/net/rotgruengelb/forestal/entity/ForestalEntities.java index 7dc179f..6ccffaa 100644 --- a/src/main/java/net/rotgruengelb/forestal/entity/ForestalEntities.java +++ b/src/main/java/net/rotgruengelb/forestal/entity/ForestalEntities.java @@ -12,7 +12,7 @@ public class ForestalEntities { public static final EntityType GRIZZLY_BEAR = Registry.register(Registries.ENTITY_TYPE, new Identifier(Forestal.MOD_ID, "grizzly_bear"), FabricEntityTypeBuilder.create(SpawnGroup.CREATURE, GrizzlyBearEntity::new) - .dimensions(EntityDimensions.fixed(1.9f, 1.75f)).build()); + .dimensions(EntityDimensions.fixed(1.5f, 1.5f)).build()); public static void registerModEntities() { Forestal.LOGGER.debug("Registering ForestalEntities for " + Forestal.MOD_ID); diff --git a/src/main/java/net/rotgruengelb/forestal/entity/GrizzlyBearEntity.java b/src/main/java/net/rotgruengelb/forestal/entity/GrizzlyBearEntity.java index 786b3e3..c9009f8 100644 --- a/src/main/java/net/rotgruengelb/forestal/entity/GrizzlyBearEntity.java +++ b/src/main/java/net/rotgruengelb/forestal/entity/GrizzlyBearEntity.java @@ -10,6 +10,9 @@ import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.entity.passive.PassiveEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.recipe.Ingredient; import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundEvent; import net.minecraft.sound.SoundEvents; @@ -48,14 +51,20 @@ protected void playStepSound(BlockPos pos, BlockState state) { this.playSound(SoundEvents.ENTITY_POLAR_BEAR_STEP, 0.15f, 1.0f); } + public boolean isBreedingItem(ItemStack stack) { + return stack.isOf(Items.SWEET_BERRIES); + } + @Override public void initGoals() { super.initGoals(); this.goalSelector.add(0, new SwimGoal(this)); - this.goalSelector.add(4, new FollowParentGoal(this, 1.25)); - this.goalSelector.add(5, new WanderAroundGoal(this, 1.0)); - this.goalSelector.add(6, new LookAtEntityGoal(this, PlayerEntity.class, 6.0f)); - this.goalSelector.add(7, new LookAroundGoal(this)); + this.goalSelector.add(1, new EscapeDangerGoal(this, 1.4)); + this.goalSelector.add(2, new AnimalMateGoal(this, 1.1)); + this.goalSelector.add(3, new TemptGoal(this, 1.1, Ingredient.ofItems(Items.SWEET_BERRIES), false)); + this.goalSelector.add(4, new FollowParentGoal(this, 1.15)); + this.goalSelector.add(5, new LookAtEntityGoal(this, PlayerEntity.class, 6.0f)); + this.goalSelector.add(6, new LookAroundGoal(this)); } @Override @@ -71,11 +80,13 @@ protected SoundEvent getHurtSound(DamageSource source) { return SoundEvents.ENTITY_POLAR_BEAR_HURT; } - @Override - protected SoundEvent getDeathSound() { - return SoundEvents.ENTITY_POLAR_BEAR_DEATH; + public boolean isAsleep() { + return false; } + @Override + protected SoundEvent getDeathSound() { return SoundEvents.ENTITY_POLAR_BEAR_DEATH; } + @Override public void registerControllers(AnimatableManager.ControllerRegistrar controllers) { controllers.add(new AnimationController<>(this, "controller", 0, this::predicate)); @@ -94,7 +105,5 @@ private PlayState predicate(AnimationState animationState) { } @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; } } diff --git a/src/main/java/net/rotgruengelb/forestal/item/ForestalItems.java b/src/main/java/net/rotgruengelb/forestal/item/ForestalItems.java index ba6ea84..c06f45f 100644 --- a/src/main/java/net/rotgruengelb/forestal/item/ForestalItems.java +++ b/src/main/java/net/rotgruengelb/forestal/item/ForestalItems.java @@ -14,8 +14,7 @@ import net.rotgruengelb.forestal.entity.ForestalEntities; public class ForestalItems { - public static final Item GRIZZLY_BEAR_SPAWN_EGG = registerItem("grizzly_bear_spawn_egg", - new SpawnEggItem(ForestalEntities.GRIZZLY_BEAR, 0xD57E36, 0x1D0D00, new FabricItemSettings())); + public static final Item GRIZZLY_BEAR_SPAWN_EGG = registerItem("grizzly_bear_spawn_egg", new SpawnEggItem(ForestalEntities.GRIZZLY_BEAR, 0x966240, 0x553a28, new FabricItemSettings())); private static Item registerItem(String name, Item item) { return Registry.register(Registries.ITEM, new Identifier(Forestal.MOD_ID, name), item); diff --git a/src/main/resources/assets/forestal/textures/entity/grizzly_bear.png b/src/main/resources/assets/forestal/textures/entity/grizzly_bear.png deleted file mode 100644 index 9c9f3cc..0000000 Binary files a/src/main/resources/assets/forestal/textures/entity/grizzly_bear.png and /dev/null differ diff --git a/src/main/resources/assets/forestal/textures/entity/grizzly_bear/grizzly_bear_normal.png b/src/main/resources/assets/forestal/textures/entity/grizzly_bear/grizzly_bear_normal.png new file mode 100644 index 0000000..3d3c93d Binary files /dev/null and b/src/main/resources/assets/forestal/textures/entity/grizzly_bear/grizzly_bear_normal.png differ