feat, fix: few changes and fixes to mobs
This commit is contained in:
parent
54207eebd9
commit
e9592f8300
|
@ -36,6 +36,9 @@ dependencies {
|
||||||
|
|
||||||
// Development Runtime Mods.
|
// Development Runtime Mods.
|
||||||
modLocalRuntime("maven.modrinth:modmenu:${project.modmenu_version}")
|
modLocalRuntime("maven.modrinth:modmenu:${project.modmenu_version}")
|
||||||
|
|
||||||
|
modLocalRuntime("maven.modrinth:wthit:fabric-10.0.1")
|
||||||
|
modLocalRuntime("maven.modrinth:badpackets:fabric-0.5.4")
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2,7 +2,9 @@ package me.theclashfruit.arctic.client.entity.seal;
|
||||||
|
|
||||||
import me.theclashfruit.arctic.entity.penguin.BabyEmperorEntity;
|
import me.theclashfruit.arctic.entity.penguin.BabyEmperorEntity;
|
||||||
import me.theclashfruit.arctic.entity.seal.SealEntity;
|
import me.theclashfruit.arctic.entity.seal.SealEntity;
|
||||||
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import software.bernie.geckolib.renderer.GeoEntityRenderer;
|
import software.bernie.geckolib.renderer.GeoEntityRenderer;
|
||||||
|
|
||||||
|
@ -17,4 +19,13 @@ public class SealRenderer extends GeoEntityRenderer<SealEntity> {
|
||||||
public Identifier getTextureLocation(SealEntity animatable) {
|
public Identifier getTextureLocation(SealEntity animatable) {
|
||||||
return new Identifier(MOD_ID, "textures/entity/seal/seal.png");
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,26 @@
|
||||||
package me.theclashfruit.arctic.entity.penguin;
|
package me.theclashfruit.arctic.entity.penguin;
|
||||||
|
|
||||||
|
import me.theclashfruit.arctic.entity.seal.SealEntity;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.entity.SpawnReason;
|
||||||
import net.minecraft.entity.ai.goal.*;
|
import net.minecraft.entity.ai.goal.*;
|
||||||
import net.minecraft.entity.attribute.DefaultAttributeContainer;
|
import net.minecraft.entity.attribute.DefaultAttributeContainer;
|
||||||
import net.minecraft.entity.attribute.EntityAttributes;
|
import net.minecraft.entity.attribute.EntityAttributes;
|
||||||
import net.minecraft.entity.passive.AnimalEntity;
|
import net.minecraft.entity.passive.AnimalEntity;
|
||||||
import net.minecraft.entity.passive.PassiveEntity;
|
import net.minecraft.entity.passive.PassiveEntity;
|
||||||
|
import net.minecraft.entity.passive.PolarBearEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
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.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.World;
|
||||||
|
import net.minecraft.world.WorldAccess;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import software.bernie.geckolib.animatable.GeoEntity;
|
import software.bernie.geckolib.animatable.GeoEntity;
|
||||||
import software.bernie.geckolib.core.animatable.GeoAnimatable;
|
import software.bernie.geckolib.core.animatable.GeoAnimatable;
|
||||||
|
@ -42,17 +54,31 @@ public class BabyEmperorEntity extends AnimalEntity implements GeoEntity {
|
||||||
@Override
|
@Override
|
||||||
protected void initGoals() {
|
protected void initGoals() {
|
||||||
this.goalSelector.add(0, new SwimGoal(this));
|
this.goalSelector.add(0, new SwimGoal(this));
|
||||||
this.goalSelector.add(0, new EscapeDangerGoal(this, 0.65D));
|
this.goalSelector.add(1, new EscapeDangerGoal(this, 1.0));
|
||||||
this.goalSelector.add(1, new LookAroundGoal(this));
|
|
||||||
this.goalSelector.add(1, new WanderAroundGoal(this, 0.55D));
|
// this.goalSelector.add(3, new AnimalMateGoal(this, 0.85));
|
||||||
this.goalSelector.add(2, new LookAtEntityGoal(this, PlayerEntity.class, 6.0F));
|
// 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) {
|
protected <E extends BabyEmperorEntity> PlayState predicate(final AnimationState<E> event) {
|
||||||
if(event.isMoving())
|
// if(event.isMoving())
|
||||||
return event.setAndContinue(
|
// return event.setAndContinue(
|
||||||
RawAnimation.begin().thenLoop("animation.baby_emperor.walk")
|
// RawAnimation.begin().thenLoop("animation.baby_emperor.walk")
|
||||||
);
|
// );
|
||||||
|
|
||||||
return PlayState.STOP;
|
return PlayState.STOP;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class CardboardEntity extends AnimalEntity implements GeoEntity {
|
||||||
|
|
||||||
public static DefaultAttributeContainer.Builder createCardboardAttributes() {
|
public static DefaultAttributeContainer.Builder createCardboardAttributes() {
|
||||||
return AnimalEntity.createMobAttributes()
|
return AnimalEntity.createMobAttributes()
|
||||||
.add(EntityAttributes.GENERIC_MAX_HEALTH, 10)
|
.add(EntityAttributes.GENERIC_MAX_HEALTH, 20)
|
||||||
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0);
|
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,28 @@
|
||||||
package me.theclashfruit.arctic.entity.seal;
|
package me.theclashfruit.arctic.entity.seal;
|
||||||
|
|
||||||
|
import me.theclashfruit.arctic.entity.ArcticEntities;
|
||||||
import me.theclashfruit.arctic.entity.penguin.BabyEmperorEntity;
|
import me.theclashfruit.arctic.entity.penguin.BabyEmperorEntity;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.entity.SpawnReason;
|
||||||
import net.minecraft.entity.ai.goal.*;
|
import net.minecraft.entity.ai.goal.*;
|
||||||
import net.minecraft.entity.attribute.DefaultAttributeContainer;
|
import net.minecraft.entity.attribute.DefaultAttributeContainer;
|
||||||
import net.minecraft.entity.attribute.EntityAttributes;
|
import net.minecraft.entity.attribute.EntityAttributes;
|
||||||
import net.minecraft.entity.passive.AnimalEntity;
|
import net.minecraft.entity.passive.AnimalEntity;
|
||||||
import net.minecraft.entity.passive.PassiveEntity;
|
import net.minecraft.entity.passive.PassiveEntity;
|
||||||
|
import net.minecraft.entity.passive.PolarBearEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
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.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.World;
|
||||||
|
import net.minecraft.world.WorldAccess;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import software.bernie.geckolib.animatable.GeoEntity;
|
import software.bernie.geckolib.animatable.GeoEntity;
|
||||||
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
|
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
|
||||||
|
@ -37,23 +50,40 @@ public class SealEntity extends AnimalEntity implements GeoEntity {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public PassiveEntity createChild(ServerWorld world, PassiveEntity entity) {
|
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
|
@Override
|
||||||
protected void initGoals() {
|
protected void initGoals() {
|
||||||
this.goalSelector.add(0, new SwimGoal(this));
|
this.goalSelector.add(0, new SwimGoal(this));
|
||||||
this.goalSelector.add(0, new EscapeDangerGoal(this, 0.65D));
|
this.goalSelector.add(1, new EscapeDangerGoal(this, 1.0));
|
||||||
this.goalSelector.add(1, new LookAroundGoal(this));
|
this.goalSelector.add(3, new AnimalMateGoal(this, 0.85));
|
||||||
this.goalSelector.add(1, new WanderAroundGoal(this, 0.55D));
|
this.goalSelector.add(4, new TemptGoal(this, 1.2, Ingredient.ofItems(Items.SALMON), false));
|
||||||
this.goalSelector.add(2, new LookAtEntityGoal(this, PlayerEntity.class, 6.0F));
|
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) {
|
protected <E extends SealEntity> PlayState predicate(final AnimationState<E> event) {
|
||||||
if(event.isMoving())
|
// if(event.isMoving())
|
||||||
return event.setAndContinue(
|
// return event.setAndContinue(
|
||||||
RawAnimation.begin().thenLoop("animation.seal.walk")
|
// RawAnimation.begin().thenLoop("animation.seal.walk")
|
||||||
);
|
// );
|
||||||
|
|
||||||
return PlayState.STOP;
|
return PlayState.STOP;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,25 @@
|
||||||
package me.theclashfruit.arctic.world;
|
package me.theclashfruit.arctic.world;
|
||||||
|
|
||||||
import me.theclashfruit.arctic.entity.ArcticEntities;
|
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.BiomeModifications;
|
||||||
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
|
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
|
||||||
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.SpawnGroup;
|
import net.minecraft.entity.SpawnGroup;
|
||||||
|
import net.minecraft.entity.SpawnReason;
|
||||||
import net.minecraft.entity.SpawnRestriction;
|
import net.minecraft.entity.SpawnRestriction;
|
||||||
import net.minecraft.entity.passive.AnimalEntity;
|
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.Heightmap;
|
||||||
|
import net.minecraft.world.WorldAccess;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraft.world.biome.BiomeKeys;
|
import net.minecraft.world.biome.BiomeKeys;
|
||||||
|
|
||||||
public class ArcticEntityGeneration {
|
public class ArcticEntityGeneration {
|
||||||
|
@ -39,16 +52,16 @@ public class ArcticEntityGeneration {
|
||||||
|
|
||||||
SpawnRestriction.register(
|
SpawnRestriction.register(
|
||||||
ArcticEntities.BABY_EMPEROR,
|
ArcticEntities.BABY_EMPEROR,
|
||||||
SpawnRestriction.Location.NO_RESTRICTIONS,
|
SpawnRestriction.Location.ON_GROUND,
|
||||||
Heightmap.Type.MOTION_BLOCKING_NO_LEAVES,
|
Heightmap.Type.WORLD_SURFACE,
|
||||||
AnimalEntity::isValidNaturalSpawn
|
BabyEmperorEntity::canSpawn
|
||||||
);
|
);
|
||||||
|
|
||||||
SpawnRestriction.register(
|
SpawnRestriction.register(
|
||||||
ArcticEntities.SEAL,
|
ArcticEntities.SEAL,
|
||||||
SpawnRestriction.Location.NO_RESTRICTIONS,
|
SpawnRestriction.Location.ON_GROUND,
|
||||||
Heightmap.Type.MOTION_BLOCKING_NO_LEAVES,
|
Heightmap.Type.WORLD_SURFACE,
|
||||||
AnimalEntity::isValidNaturalSpawn
|
SealEntity::canSpawn
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,9 @@
|
||||||
"modmenu.descriptionTranslation.arctic": "A mini overhaul of cold biomes.",
|
"modmenu.descriptionTranslation.arctic": "A mini overhaul of cold biomes.",
|
||||||
|
|
||||||
"item.arctic.baby_emperor_spawn_egg": "Baby Emperor Spawn Egg",
|
"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 |
Loading…
Reference in a new issue