Skip to content

Commit

Permalink
Grizzly Bear adjustments:
Browse files Browse the repository at this point in the history
- Bounding box
- Baby Mod scale
- texture fixes
- Spawn Egg recoloring
...
  • Loading branch information
rotgruengelb committed Apr 14, 2024
1 parent c34f1a4 commit 70a6533
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class ForestalEntities {

public static final EntityType<GrizzlyBearEntity> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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));
Expand All @@ -94,7 +105,5 @@ private PlayState predicate(AnimationState<GrizzlyBearEntity> animationState) {
}

@Override
public AnimatableInstanceCache getAnimatableInstanceCache() {
return cache;
}
public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 70a6533

Please sign in to comment.