feat, fix: few changes and fixes to mobs

This commit is contained in:
TheClashFruit 2023-12-29 20:36:37 +01:00
parent 54207eebd9
commit e9592f8300
Signed by: TheClashFruit
GPG key ID: 09BB24C34C2F3204
9 changed files with 113 additions and 26 deletions

View file

@ -36,6 +36,9 @@ dependencies {
// Development Runtime Mods.
modLocalRuntime("maven.modrinth:modmenu:${project.modmenu_version}")
modLocalRuntime("maven.modrinth:wthit:fabric-10.0.1")
modLocalRuntime("maven.modrinth:badpackets:fabric-0.5.4")
}
processResources {

File diff suppressed because one or more lines are too long

View file

@ -2,7 +2,9 @@ package me.theclashfruit.arctic.client.entity.seal;
import me.theclashfruit.arctic.entity.penguin.BabyEmperorEntity;
import me.theclashfruit.arctic.entity.seal.SealEntity;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
@ -17,4 +19,13 @@ public class SealRenderer extends GeoEntityRenderer<SealEntity> {
public Identifier getTextureLocation(SealEntity animatable) {
return new Identifier(MOD_ID, "textures/entity/seal/seal.png");
}
@Override
public void render(SealEntity entity, float entityYaw, float partialTick, MatrixStack poseStack, VertexConsumerProvider bufferSource, int packedLight) {
if(entity.isBaby()) {
poseStack.scale(0.5f, 0.5f, 0.5f);
}
super.render(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight);
}
}

View file

@ -1,14 +1,26 @@
package me.theclashfruit.arctic.entity.penguin;
import me.theclashfruit.arctic.entity.seal.SealEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.ai.goal.*;
import net.minecraft.entity.attribute.DefaultAttributeContainer;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.passive.PassiveEntity;
import net.minecraft.entity.passive.PolarBearEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Items;
import net.minecraft.recipe.Ingredient;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.registry.tag.BiomeTags;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.biome.Biome;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
import software.bernie.geckolib.core.animatable.GeoAnimatable;
@ -42,17 +54,31 @@ public class BabyEmperorEntity extends AnimalEntity implements GeoEntity {
@Override
protected void initGoals() {
this.goalSelector.add(0, new SwimGoal(this));
this.goalSelector.add(0, new EscapeDangerGoal(this, 0.65D));
this.goalSelector.add(1, new LookAroundGoal(this));
this.goalSelector.add(1, new WanderAroundGoal(this, 0.55D));
this.goalSelector.add(2, new LookAtEntityGoal(this, PlayerEntity.class, 6.0F));
this.goalSelector.add(1, new EscapeDangerGoal(this, 1.0));
// this.goalSelector.add(3, new AnimalMateGoal(this, 0.85));
// this.goalSelector.add(4, new TemptGoal(this, 1.2, Ingredient.ofItems(Items.SALMON), false));
// this.goalSelector.add(5, new FollowParentGoal(this, 1.1));
this.goalSelector.add(6, new WanderAroundGoal(this, 0.85));
this.goalSelector.add(7, new LookAtEntityGoal(this, PlayerEntity.class, 6.0f));
this.goalSelector.add(8, new LookAroundGoal(this));
}
public static boolean canSpawn(EntityType<BabyEmperorEntity> type, WorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random) {
RegistryEntry<Biome> registryEntry = world.getBiome(pos);
if (registryEntry.isIn(BiomeTags.POLAR_BEARS_SPAWN_ON_ALTERNATE_BLOCKS))
return BabyEmperorEntity.isLightLevelValidForNaturalSpawn(world, pos) && world.getBlockState(pos.down()).isIn(BlockTags.POLAR_BEARS_SPAWNABLE_ON_ALTERNATE);
return BabyEmperorEntity.isValidNaturalSpawn(type, world, spawnReason, pos, random);
}
protected <E extends BabyEmperorEntity> PlayState predicate(final AnimationState<E> event) {
if(event.isMoving())
return event.setAndContinue(
RawAnimation.begin().thenLoop("animation.baby_emperor.walk")
);
// if(event.isMoving())
// return event.setAndContinue(
// RawAnimation.begin().thenLoop("animation.baby_emperor.walk")
// );
return PlayState.STOP;
}

View file

@ -27,7 +27,7 @@ public class CardboardEntity extends AnimalEntity implements GeoEntity {
public static DefaultAttributeContainer.Builder createCardboardAttributes() {
return AnimalEntity.createMobAttributes()
.add(EntityAttributes.GENERIC_MAX_HEALTH, 10)
.add(EntityAttributes.GENERIC_MAX_HEALTH, 20)
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0);
}

View file

@ -1,15 +1,28 @@
package me.theclashfruit.arctic.entity.seal;
import me.theclashfruit.arctic.entity.ArcticEntities;
import me.theclashfruit.arctic.entity.penguin.BabyEmperorEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.ai.goal.*;
import net.minecraft.entity.attribute.DefaultAttributeContainer;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.passive.PassiveEntity;
import net.minecraft.entity.passive.PolarBearEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.recipe.Ingredient;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.registry.tag.BiomeTags;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.biome.Biome;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
@ -37,23 +50,40 @@ public class SealEntity extends AnimalEntity implements GeoEntity {
@Nullable
@Override
public PassiveEntity createChild(ServerWorld world, PassiveEntity entity) {
return null;
return ArcticEntities.SEAL.create(world);
}
@Override
public boolean isBreedingItem(ItemStack stack) {
return stack.getItem() == Items.SALMON;
}
@Override
protected void initGoals() {
this.goalSelector.add(0, new SwimGoal(this));
this.goalSelector.add(0, new EscapeDangerGoal(this, 0.65D));
this.goalSelector.add(1, new LookAroundGoal(this));
this.goalSelector.add(1, new WanderAroundGoal(this, 0.55D));
this.goalSelector.add(2, new LookAtEntityGoal(this, PlayerEntity.class, 6.0F));
this.goalSelector.add(1, new EscapeDangerGoal(this, 1.0));
this.goalSelector.add(3, new AnimalMateGoal(this, 0.85));
this.goalSelector.add(4, new TemptGoal(this, 1.2, Ingredient.ofItems(Items.SALMON), false));
this.goalSelector.add(5, new FollowParentGoal(this, 1.1));
this.goalSelector.add(6, new WanderAroundGoal(this, 0.85));
this.goalSelector.add(7, new LookAtEntityGoal(this, PlayerEntity.class, 6.0f));
this.goalSelector.add(8, new LookAroundGoal(this));
}
public static boolean canSpawn(EntityType<SealEntity> type, WorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random) {
RegistryEntry<Biome> registryEntry = world.getBiome(pos);
if (registryEntry.isIn(BiomeTags.POLAR_BEARS_SPAWN_ON_ALTERNATE_BLOCKS))
return SealEntity.isLightLevelValidForNaturalSpawn(world, pos) && world.getBlockState(pos.down()).isIn(BlockTags.POLAR_BEARS_SPAWNABLE_ON_ALTERNATE);
return SealEntity.isValidNaturalSpawn(type, world, spawnReason, pos, random);
}
protected <E extends SealEntity> PlayState predicate(final AnimationState<E> event) {
if(event.isMoving())
return event.setAndContinue(
RawAnimation.begin().thenLoop("animation.seal.walk")
);
// if(event.isMoving())
// return event.setAndContinue(
// RawAnimation.begin().thenLoop("animation.seal.walk")
// );
return PlayState.STOP;
}

View file

@ -1,12 +1,25 @@
package me.theclashfruit.arctic.world;
import me.theclashfruit.arctic.entity.ArcticEntities;
import me.theclashfruit.arctic.entity.penguin.BabyEmperorEntity;
import me.theclashfruit.arctic.entity.seal.SealEntity;
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.SpawnRestriction;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.entity.passive.PolarBearEntity;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.registry.tag.BiomeTags;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.Heightmap;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
public class ArcticEntityGeneration {
@ -39,16 +52,16 @@ public class ArcticEntityGeneration {
SpawnRestriction.register(
ArcticEntities.BABY_EMPEROR,
SpawnRestriction.Location.NO_RESTRICTIONS,
Heightmap.Type.MOTION_BLOCKING_NO_LEAVES,
AnimalEntity::isValidNaturalSpawn
SpawnRestriction.Location.ON_GROUND,
Heightmap.Type.WORLD_SURFACE,
BabyEmperorEntity::canSpawn
);
SpawnRestriction.register(
ArcticEntities.SEAL,
SpawnRestriction.Location.NO_RESTRICTIONS,
Heightmap.Type.MOTION_BLOCKING_NO_LEAVES,
AnimalEntity::isValidNaturalSpawn
SpawnRestriction.Location.ON_GROUND,
Heightmap.Type.WORLD_SURFACE,
SealEntity::canSpawn
);
}
}

View file

@ -3,5 +3,9 @@
"modmenu.descriptionTranslation.arctic": "A mini overhaul of cold biomes.",
"item.arctic.baby_emperor_spawn_egg": "Baby Emperor Spawn Egg",
"item.arctic.seal_spawn_egg": "Seal Spawn Egg"
"item.arctic.seal_spawn_egg": "Seal Spawn Egg",
"entity.arctic.baby_emperor": "Baby Emperor",
"entity.arctic.seal": "Seal",
"entity.arctic.cardboard": "Hululu Cardboard"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 4 KiB