This commit is contained in:
2026-05-21 23:44:21 -04:00
parent 463334f1c5
commit fde40e55e0
185 changed files with 11393 additions and 9061 deletions
@@ -489,6 +489,9 @@ public class ModBlocks {
public static final RegistrySupplier<Block> INCUBATED_BRACHIOSAURUS_EGG = registerBlock("incubated_brachiosaurus_egg",
() -> new IncubatedEggBlock(BlockBehaviour.Properties.of().strength(4f).requiresCorrectToolForDrops(), ModEntities.BRACHIOSAURUS));
public static final RegistrySupplier<Block> INCUBATED_CHICKENOSAURUS_EGG = registerBlock("incubated_chickenosaurus_egg",
() -> new IncubatedEggBlock(BlockBehaviour.Properties.of().strength(4f).requiresCorrectToolForDrops(), ModEntities.CHICKENOSAURUS));
public static final RegistrySupplier<Block> INCUBATED_BARYONYX_EGG = registerBlock("incubated_baryonyx_egg",
() -> new IncubatedEggBlock(BlockBehaviour.Properties.of().strength(4f).requiresCorrectToolForDrops(), ModEntities.BARYONYX));
@@ -501,6 +504,9 @@ public class ModBlocks {
public static final RegistrySupplier<Block> INCUBATED_DEINONYCHUS_EGG = registerBlock("incubated_deinonychus_egg",
() -> new IncubatedEggBlock(BlockBehaviour.Properties.of().strength(4f).requiresCorrectToolForDrops(), ModEntities.DEINONYCHUS));
public static final RegistrySupplier<Block> INCUBATED_FDUCK_EGG = registerBlock("incubated_fduck_egg",
() -> new IncubatedEggBlock(BlockBehaviour.Properties.of().strength(4f).requiresCorrectToolForDrops(), ModEntities.FDUCK));
public static final RegistrySupplier<Block> INCUBATED_EDMONTOSAURUS_EGG = registerBlock("incubated_edmontosaurus_egg",
() -> new IncubatedEggBlock(BlockBehaviour.Properties.of().strength(4f).requiresCorrectToolForDrops(), ModEntities.EDMONTOSAURUS));
@@ -13,6 +13,16 @@ public final class JRConfig {
*/
public boolean naturallySpawning = false;
/**
* Controls whether dinosaurs lose hunger over time.
*/
public boolean hungerConsumption = false;
/**
* Controls whether dinosaurs lose thirst/water over time.
*/
public boolean waterConsumption = false;
/**
* Energy pipe transfer rate in FE per second.
*/
@@ -32,6 +32,8 @@ public final class JRConfigManager {
loaded.requirePower = readBoolean(text, "requirePower", loaded.requirePower);
loaded.naturallySpawning = readBoolean(text, "naturallySpawning", loaded.naturallySpawning);
loaded.hungerConsumption = readBoolean(text, "hungerConsumption", loaded.hungerConsumption);
loaded.waterConsumption = readBoolean(text, "waterConsumption", loaded.waterConsumption);
loaded.fePerSecond = readPositiveInt(text, "fePerSecond", loaded.fePerSecond);
loaded.itemsPerSecond = readPositiveInt(text, "itemsPerSecond", loaded.itemsPerSecond);
loaded.milliBucketsPerSecond = readPositiveInt(text, "milliBucketsPerSecond", loaded.milliBucketsPerSecond);
@@ -51,6 +53,8 @@ public final class JRConfigManager {
String text = "{\n" +
" \"requirePower\": " + config.requirePower + ",\n" +
" \"naturallySpawning\": " + config.naturallySpawning + ",\n" +
" \"hungerConsumption\": " + config.hungerConsumption + ",\n" +
" \"waterConsumption\": " + config.waterConsumption + ",\n" +
" \"fePerSecond\": " + config.fePerSecond + ",\n" +
" \"itemsPerSecond\": " + config.itemsPerSecond + ",\n" +
" \"milliBucketsPerSecond\": " + config.milliBucketsPerSecond + "\n" +
@@ -355,7 +355,7 @@ public class ModRecipeProvider {
ModItems.GIGANOTOSAURUS_DNA.get());
helper.dnaHybridizing(ModItems.DISTORTUS_REX_DNA.get(), 1,
ModItems.TYRANNOSAURUS_REX_DNA.get(),
ModItems.BRACHIOSAURUS_DNA.get(),
ModItems.TITANOSAURUS_DNA.get(),
ModItems.VELOCIRAPTOR_DNA.get());
helper.dnaHybridizing(ModItems.INDORAPTOR_DNA.get(), 1,
ModItems.INDOMINUS_REX_DNA.get(),
@@ -1,5 +1,7 @@
package net.cmr.jurassicrevived.entity.ai;
import net.cmr.jurassicrevived.config.JRConfig;
import net.cmr.jurassicrevived.config.JRConfigManager;
import net.minecraft.core.BlockPos;
import net.minecraft.tags.FluidTags;
import net.minecraft.world.InteractionHand;
@@ -22,6 +24,9 @@ import java.util.List;
public class DinoAIController {
private static final float VITAL_DECAY_MULTIPLIER = 0.05f;
private static final double TERRITORIAL_ROAM_SPEED_MULTIPLIER = 2.0D;
private final DinoEntityBase dino;
private State currentState = State.IDLE;
@@ -131,8 +136,10 @@ public class DinoAIController {
// 2. Vitals Update
if (dino.dinoData != null) {
float hungerDecay = config.hungerDecay();
float thirstDecay = config.thirstDecay();
JRConfig jrConfig = JRConfigManager.get();
float hungerDecay = jrConfig.hungerConsumption ? config.hungerDecay() * VITAL_DECAY_MULTIPLIER : 0.0f;
float thirstDecay = jrConfig.waterConsumption ? config.thirstDecay() * VITAL_DECAY_MULTIPLIER : 0.0f;
if (currentState == State.SLEEPING) {
hungerDecay *= 0.5f;
@@ -142,9 +149,14 @@ public class DinoAIController {
}
}
if (hungerDecay > 0.0f) {
dino.dinoData.modifyHunger(-hungerDecay);
}
if (thirstDecay > 0.0f) {
float currentThirst = dino.dinoData.getThirst();
dino.dinoData.setThirst(Math.max(0, currentThirst - thirstDecay));
}
float hunger = dino.dinoData.getHunger();
float thirst = dino.dinoData.getThirst();
@@ -155,7 +167,6 @@ public class DinoAIController {
}
if (stateTimer % 20 == 0) {
dino.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 40, 1));
if (hunger <= 0) {
dino.hurt(dino.damageSources().starve(), 1.0f);
dino.dinoData.addCondition(IDinoData.Condition.STARVING);
@@ -230,13 +241,19 @@ public class DinoAIController {
// 5. Hunt check
if ((currentState == State.IDLE || currentState == State.ROAMING || currentState == State.TERRITORIAL_ROAMING) && dino.isCarnivore()) {
boolean hungry = dino.dinoData != null && dino.dinoData.getHunger() < 70;
boolean hungerConsumptionEnabled = JRConfigManager.get().hungerConsumption;
boolean territorial = dino.dinoData != null && dino.dinoData.getAggression() == IDinoData.Aggression.TERRITORIAL;
boolean shouldHunt;
if (hungry || (territorial && dino.dinoData.getHunger() < 90)) {
if (stateTimer % 10 == 0) {
findTarget();
if (hungerConsumptionEnabled) {
boolean hungry = dino.dinoData != null && dino.dinoData.getHunger() < 70;
shouldHunt = hungry || (territorial && dino.dinoData != null && dino.dinoData.getHunger() < 90);
} else {
shouldHunt = stateTimer % 100 == 0 && dino.getRandom().nextFloat() < (territorial ? 0.35f : 0.15f);
}
if (shouldHunt && stateTimer % 10 == 0) {
findTarget();
}
}
@@ -628,7 +645,12 @@ public class DinoAIController {
boolean resumed = false;
if (roamTarget != null) {
resumed = dino.getNavigation().moveTo(roamTarget.x, roamTarget.y, roamTarget.z, dino.getAIConfig().walkSpeed());
resumed = dino.getNavigation().moveTo(
roamTarget.x,
roamTarget.y,
roamTarget.z,
getTerritorialRoamSpeed()
);
}
if (!resumed) {
@@ -640,6 +662,10 @@ public class DinoAIController {
}
}
private double getTerritorialRoamSpeed() {
return dino.getAIConfig().walkSpeed() * TERRITORIAL_ROAM_SPEED_MULTIPLIER;
}
private void findAndSetTerritorialTarget() {
this.roamTarget = null;
Vec3 target = null;
@@ -655,7 +681,7 @@ public class DinoAIController {
}
if (candidate != null && dino.distanceToSqr(candidate) > 25.0) {
if (dino.getNavigation().moveTo(candidate.x, candidate.y, candidate.z, dino.getAIConfig().walkSpeed())) {
if (dino.getNavigation().moveTo(candidate.x, candidate.y, candidate.z, getTerritorialRoamSpeed())) {
this.roamTarget = candidate;
return;
}
@@ -664,7 +690,7 @@ public class DinoAIController {
Vec3 fallback = DefaultRandomPos.getPos(dino, 10, 5);
if (fallback != null) {
if (dino.getNavigation().moveTo(fallback.x, fallback.y, fallback.z, dino.getAIConfig().walkSpeed())) {
if (dino.getNavigation().moveTo(fallback.x, fallback.y, fallback.z, getTerritorialRoamSpeed())) {
this.roamTarget = fallback;
}
}
@@ -0,0 +1,291 @@
package net.cmr.jurassicrevived.entity.ai;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.network.syncher.SynchedEntityData;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
public class DinoData implements IDinoData {
private final float maxHunger;
private final float maxThirst;
private float hunger;
private float thirst;
private Mood mood;
private Aggression aggression;
private float territoriality;
private DietaryClassification diet;
private Type type;
private Group group;
private BirthType birthType;
private ActivityPattern activityPattern;
private final Set<Condition> conditions = EnumSet.noneOf(Condition.class);
private final List<UUID> whitelistedPlayers = new ArrayList<>();
public DinoData(
float maxHunger,
float maxThirst,
Mood mood,
Aggression aggression,
float territoriality,
DietaryClassification diet,
Type type,
Group group,
BirthType birthType,
ActivityPattern activityPattern
) {
this.maxHunger = maxHunger;
this.maxThirst = maxThirst;
this.hunger = maxHunger;
this.thirst = maxThirst;
this.mood = mood;
this.aggression = aggression;
this.territoriality = territoriality;
this.diet = diet;
this.type = type;
this.group = group;
this.birthType = birthType;
this.activityPattern = activityPattern;
}
@Override
public float getHunger() {
return hunger;
}
@Override
public void setHunger(float value) {
this.hunger = clamp(value, 0.0f, maxHunger);
}
@Override
public void modifyHunger(float change) {
setHunger(this.hunger + change);
}
@Override
public float getThirst() {
return thirst;
}
@Override
public void setThirst(float value) {
this.thirst = clamp(value, 0.0f, maxThirst);
}
@Override
public Mood getMood() {
return mood;
}
@Override
public void setMood(Mood mood) {
this.mood = mood;
}
@Override
public Aggression getAggression() {
return aggression;
}
@Override
public void setAggression(Aggression aggression) {
this.aggression = aggression;
}
@Override
public float getTerritoriality() {
return territoriality;
}
@Override
public void setTerritoriality(float value) {
this.territoriality = clamp(value, 0.0f, 1.0f);
}
@Override
public DietaryClassification getDiet() {
return diet;
}
@Override
public void setDiet(DietaryClassification diet) {
this.diet = diet;
}
@Override
public Type getType() {
return type;
}
@Override
public void setType(Type type) {
this.type = type;
}
@Override
public Group getGroup() {
return group;
}
@Override
public void setGroup(Group group) {
this.group = group;
}
@Override
public BirthType getBirthType() {
return birthType;
}
@Override
public void setBirthType(BirthType birthType) {
this.birthType = birthType;
}
@Override
public ActivityPattern getActivityPattern() {
return activityPattern;
}
@Override
public void setActivityPattern(ActivityPattern pattern) {
this.activityPattern = pattern;
}
@Override
public Set<Condition> getConditions() {
return conditions;
}
@Override
public void addCondition(Condition condition) {
this.conditions.add(condition);
}
@Override
public void removeCondition(Condition condition) {
this.conditions.remove(condition);
}
@Override
public boolean hasCondition(Condition condition) {
return this.conditions.contains(condition);
}
@Override
public void addWhitelistedPlayer(UUID playerUUID) {
if (!this.whitelistedPlayers.contains(playerUUID)) {
this.whitelistedPlayers.add(playerUUID);
}
}
@Override
public boolean isWhitelisted(UUID playerUUID) {
return this.whitelistedPlayers.contains(playerUUID);
}
@Override
public List<UUID> getWhitelistedPlayers() {
return this.whitelistedPlayers;
}
@Override
public void saveNBT(CompoundTag tag) {
CompoundTag dinoTag = new CompoundTag();
dinoTag.putFloat("Hunger", this.hunger);
dinoTag.putFloat("Thirst", this.thirst);
dinoTag.putString("Mood", this.mood.name());
dinoTag.putString("Aggression", this.aggression.name());
dinoTag.putFloat("Territoriality", this.territoriality);
dinoTag.putString("Diet", this.diet.name());
dinoTag.putString("Type", this.type.name());
dinoTag.putString("Group", this.group.name());
dinoTag.putString("BirthType", this.birthType.name());
dinoTag.putString("ActivityPattern", this.activityPattern.name());
int[] conditionIds = this.conditions.stream()
.mapToInt(Enum::ordinal)
.toArray();
dinoTag.putIntArray("Conditions", conditionIds);
ListTag whitelistTag = new ListTag();
for (UUID uuid : this.whitelistedPlayers) {
CompoundTag uuidTag = new CompoundTag();
uuidTag.putUUID("UUID", uuid);
whitelistTag.add(uuidTag);
}
dinoTag.put("WhitelistedPlayers", whitelistTag);
tag.put("DinoData", dinoTag);
}
@Override
public void loadNBT(CompoundTag tag) {
if (!tag.contains("DinoData")) {
return;
}
CompoundTag dinoTag = tag.getCompound("DinoData");
this.hunger = clamp(dinoTag.getFloat("Hunger"), 0.0f, maxHunger);
this.thirst = clamp(dinoTag.getFloat("Thirst"), 0.0f, maxThirst);
this.mood = readEnum(dinoTag, "Mood", Mood.class, this.mood);
this.aggression = readEnum(dinoTag, "Aggression", Aggression.class, this.aggression);
this.territoriality = clamp(dinoTag.getFloat("Territoriality"), 0.0f, 1.0f);
this.diet = readEnum(dinoTag, "Diet", DietaryClassification.class, this.diet);
this.type = readEnum(dinoTag, "Type", Type.class, this.type);
this.group = readEnum(dinoTag, "Group", Group.class, this.group);
this.birthType = readEnum(dinoTag, "BirthType", BirthType.class, this.birthType);
this.activityPattern = readEnum(dinoTag, "ActivityPattern", ActivityPattern.class, this.activityPattern);
this.conditions.clear();
int[] conditionIds = dinoTag.getIntArray("Conditions");
Condition[] conditionValues = Condition.values();
for (int conditionId : conditionIds) {
if (conditionId >= 0 && conditionId < conditionValues.length) {
this.conditions.add(conditionValues[conditionId]);
}
}
this.whitelistedPlayers.clear();
ListTag whitelistTag = dinoTag.getList("WhitelistedPlayers", 10);
for (int i = 0; i < whitelistTag.size(); i++) {
CompoundTag uuidTag = whitelistTag.getCompound(i);
if (uuidTag.hasUUID("UUID")) {
this.whitelistedPlayers.add(uuidTag.getUUID("UUID"));
}
}
}
@Override
public void tickSync(SynchedEntityData entityData) {
// No-op for now. Add EntityDataAccessors later if you want client-side GUI/model access.
}
private static float clamp(float value, float min, float max) {
return Math.max(min, Math.min(max, value));
}
private static <E extends Enum<E>> E readEnum(CompoundTag tag, String key, Class<E> enumClass, E fallback) {
if (!tag.contains(key)) {
return fallback;
}
try {
return Enum.valueOf(enumClass, tag.getString(key));
} catch (IllegalArgumentException ignored) {
return fallback;
}
}
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class AlbertosaurusRenderer extends GeoEntityRenderer<AlbertosaurusEntity> {
private final float animalScale = 1.5F;
private final float animalScale = 1.7F;
public AlbertosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new AlbertosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class AllosaurusRenderer extends GeoEntityRenderer<AllosaurusEntity> {
private final float animalScale = 1.65F;
private final float animalScale = 1.9F;
public AllosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new AllosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class AlvarezsaurusRenderer extends GeoEntityRenderer<AlvarezsaurusEntity> {
private final float animalScale = 0.5F;
private final float animalScale = 0.8F;
public AlvarezsaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new AlvarezsaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class ApatosaurusRenderer extends GeoEntityRenderer<ApatosaurusEntity> {
private final float animalScale = 1.75F;
private final float animalScale = 1.9F;
public ApatosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new ApatosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class ArambourgianiaRenderer extends GeoEntityRenderer<ArambourgianiaEntity> {
private final float animalScale = 1.75F;
private final float animalScale = 1.9F;
public ArambourgianiaRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new ArambourgianiaModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class BaryonyxRenderer extends GeoEntityRenderer<BaryonyxEntity> {
private final float animalScale = 1.5F;
private final float animalScale = 1.3F;
public BaryonyxRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new BaryonyxModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class BrachiosaurusRenderer extends GeoEntityRenderer<BrachiosaurusEntity> {
private final float animalScale = 1.6F;
private final float animalScale = 2.0F;
public BrachiosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new BrachiosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class CarcharodontosaurusRenderer extends GeoEntityRenderer<CarcharodontosaurusEntity> {
private final float animalScale = 2.25F;
private final float animalScale = 2.0F;
public CarcharodontosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new CarcharodontosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class CearadactylusRenderer extends GeoEntityRenderer<CearadactylusEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 0.9F;
public CearadactylusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new CearadactylusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class CeratosaurusRenderer extends GeoEntityRenderer<CeratosaurusEntity> {
private final float animalScale = 1.75F;
private final float animalScale = 2.1F;
public CeratosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new CeratosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class ChasmosaurusRenderer extends GeoEntityRenderer<ChasmosaurusEntity> {
private final float animalScale = 1.25F;
private final float animalScale = 1.3F;
public ChasmosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new ChasmosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class ChickenosaurusRenderer extends GeoEntityRenderer<ChickenosaurusEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 0.9F;
public ChickenosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new ChickenosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class CoelophysisRenderer extends GeoEntityRenderer<CoelophysisEntity> {
private final float animalScale = 0.9F;
private final float animalScale = 0.7F;
public CoelophysisRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new CoelophysisModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class CompsognathusRenderer extends GeoEntityRenderer<CompsognathusEntity> {
private final float animalScale = 0.35F;
private final float animalScale = 0.2F;
public CompsognathusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new CompsognathusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class ConcavenatorRenderer extends GeoEntityRenderer<ConcavenatorEntity> {
private final float animalScale = 1.2F;
private final float animalScale = 0.9F;
public ConcavenatorRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new ConcavenatorModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class CorythosaurusRenderer extends GeoEntityRenderer<CorythosaurusEntity> {
private final float animalScale = 1.25F;
private final float animalScale = 1.7F;
public CorythosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new CorythosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class DeinonychusRenderer extends GeoEntityRenderer<DeinonychusEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 0.9F;
public DeinonychusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new DeinonychusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class DilophosaurusRenderer extends GeoEntityRenderer<DilophosaurusEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 1.2F;
public DilophosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new DilophosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class DimorphodonRenderer extends GeoEntityRenderer<DimorphodonEntity> {
private final float animalScale = 0.4F;
private final float animalScale = 0.7F;
public DimorphodonRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new DimorphodonModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class DiplodocusRenderer extends GeoEntityRenderer<DiplodocusEntity> {
private final float animalScale = 2.5F;
private final float animalScale = 2.8F;
public DiplodocusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new DiplodocusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class DistortusRexRenderer extends GeoEntityRenderer<DistortusRexEntity> {
private final float animalScale = 2.75F;
private final float animalScale = 3.4F;
public DistortusRexRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new DistortusRexModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class DryosaurusRenderer extends GeoEntityRenderer<DryosaurusEntity> {
private final float animalScale = 0.35F;
private final float animalScale = 0.45F;
public DryosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new DryosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class EdmontosaurusRenderer extends GeoEntityRenderer<EdmontosaurusEntity> {
private final float animalScale = 1.5F;
private final float animalScale = 2.0F;
public EdmontosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new EdmontosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class FDuckRenderer extends GeoEntityRenderer<FDuckEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 1.4F;
public FDuckRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new FDuckModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class GallimimusRenderer extends GeoEntityRenderer<GallimimusEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 0.8F;
public GallimimusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new GallimimusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class GeosternbergiaRenderer extends GeoEntityRenderer<GeosternbergiaEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 1.4F;
public GeosternbergiaRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new GeosternbergiaModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class GiganotosaurusRenderer extends GeoEntityRenderer<GiganotosaurusEntity> {
private final float animalScale = 2.1F;
private final float animalScale = 2.2F;
public GiganotosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new GiganotosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class GuanlongRenderer extends GeoEntityRenderer<GuanlongEntity> {
private final float animalScale = 0.75F;
private final float animalScale = 0.6F;
public GuanlongRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new GuanlongModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class GuidracoRenderer extends GeoEntityRenderer<GuidracoEntity> {
private final float animalScale = 0.55F;
private final float animalScale = 0.8F;
public GuidracoRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new GuidracoModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class HadrosaurusRenderer extends GeoEntityRenderer<HadrosaurusEntity> {
private final float animalScale = 1.4F;
private final float animalScale = 1.5F;
public HadrosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new HadrosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class HerrerasaurusRenderer extends GeoEntityRenderer<HerrerasaurusEntity> {
private final float animalScale = 1.095F;
private final float animalScale = 1.3F;
public HerrerasaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new HerrerasaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class HypsilophodonRenderer extends GeoEntityRenderer<HypsilophodonEntity> {
private final float animalScale = 0.6F;
private final float animalScale = 0.5F;
public HypsilophodonRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new HypsilophodonModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class IndominusRexRenderer extends GeoEntityRenderer<IndominusRexEntity> {
private final float animalScale = 2.77F;
private final float animalScale = 3.0F;
public IndominusRexRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new IndominusRexModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class IndoraptorRenderer extends GeoEntityRenderer<IndoraptorEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 1.8F;
public IndoraptorRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new IndoraptorModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class InostranceviaRenderer extends GeoEntityRenderer<InostranceviaEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 1.1F;
public InostranceviaRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new InostranceviaModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class LambeosaurusRenderer extends GeoEntityRenderer<LambeosaurusEntity> {
private final float animalScale = 1.65F;
private final float animalScale = 1.8F;
public LambeosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new LambeosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class LudodactylusRenderer extends GeoEntityRenderer<LudodactylusEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 0.9F;
public LudodactylusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new LudodactylusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class MajungasaurusRenderer extends GeoEntityRenderer<MajungasaurusEntity> {
private final float animalScale = 1.57F;
private final float animalScale = 1.4F;
public MajungasaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new MajungasaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class MamenchisaurusRenderer extends GeoEntityRenderer<MamenchisaurusEntity> {
private final float animalScale = 1.85F;
private final float animalScale = 1.7F;
public MamenchisaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new MamenchisaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class MetriacanthosaurusRenderer extends GeoEntityRenderer<MetriacanthosaurusEntity> {
private final float animalScale = 1.75F;
private final float animalScale = 1.5F;
public MetriacanthosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new MetriacanthosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class MoganopterusRenderer extends GeoEntityRenderer<MoganopterusEntity> {
private final float animalScale = 0.75F;
private final float animalScale = 0.8F;
public MoganopterusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new MoganopterusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class NyctosaurusRenderer extends GeoEntityRenderer<NyctosaurusEntity> {
private final float animalScale = 0.45F;
private final float animalScale = 0.3F;
public NyctosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new NyctosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class OrnitholestesRenderer extends GeoEntityRenderer<OrnitholestesEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 0.6F;
public OrnitholestesRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new OrnitholestesModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class OrnithomimusRenderer extends GeoEntityRenderer<OrnithomimusEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 0.8F;
public OrnithomimusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new OrnithomimusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class OuranosaurusRenderer extends GeoEntityRenderer<OuranosaurusEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 1.2F;
public OuranosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new OuranosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class PachycephalosaurusRenderer extends GeoEntityRenderer<PachycephalosaurusEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 0.8F;
public PachycephalosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new PachycephalosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class ParasaurolophusRenderer extends GeoEntityRenderer<ParasaurolophusEntity> {
private final float animalScale = 1.5F;
private final float animalScale = 1.7F;
public ParasaurolophusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new ParasaurolophusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class ProceratosaurusRenderer extends GeoEntityRenderer<ProceratosaurusEntity> {
private final float animalScale = 0.65F;
private final float animalScale = 0.6F;
public ProceratosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new ProceratosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class ProcompsognathusRenderer extends GeoEntityRenderer<ProcompsognathusEntity> {
private final float animalScale = 0.44F;
private final float animalScale = 0.2F;
public ProcompsognathusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new ProcompsognathusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class ProtoceratopsRenderer extends GeoEntityRenderer<ProtoceratopsEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 1.2F;
public ProtoceratopsRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new ProtoceratopsModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class PteranodonRenderer extends GeoEntityRenderer<PteranodonEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 1.5F;
public PteranodonRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new PteranodonModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class PterodaustroRenderer extends GeoEntityRenderer<PterodaustroEntity> {
private final float animalScale = 0.65F;
private final float animalScale = 0.7F;
public PterodaustroRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new PterodaustroModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class RajasaurusRenderer extends GeoEntityRenderer<RajasaurusEntity> {
private final float animalScale = 1.45F;
private final float animalScale = 1.5F;
public RajasaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new RajasaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class RugopsRenderer extends GeoEntityRenderer<RugopsEntity> {
private final float animalScale = 1.2F;
private final float animalScale = 0.9F;
public RugopsRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new RugopsModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class SegisaurusRenderer extends GeoEntityRenderer<SegisaurusEntity> {
private final float animalScale = 0.55F;
private final float animalScale = 0.62F;
public SegisaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new SegisaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class ShantungosaurusRenderer extends GeoEntityRenderer<ShantungosaurusEntity> {
private final float animalScale = 1.67F;
private final float animalScale = 1.8F;
public ShantungosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new ShantungosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class SpinosaurusRenderer extends GeoEntityRenderer<SpinosaurusEntity> {
private final float animalScale = 2.77F;
private final float animalScale = 2.2F;
public SpinosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new SpinosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class StegosaurusRenderer extends GeoEntityRenderer<StegosaurusEntity> {
private final float animalScale = 1.62F;
private final float animalScale = 1.4F;
public StegosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new StegosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class StyracosaurusRenderer extends GeoEntityRenderer<StyracosaurusEntity> {
private final float animalScale = 1.28F;
private final float animalScale = 0.7F;
public StyracosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new StyracosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class TapejaraRenderer extends GeoEntityRenderer<TapejaraEntity> {
private final float animalScale = 0.45F;
private final float animalScale = 0.6F;
public TapejaraRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new TapejaraModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class TherizinosaurusRenderer extends GeoEntityRenderer<TherizinosaurusEntity> {
private final float animalScale = 2.5F;
private final float animalScale = 1.9F;
public TherizinosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new TherizinosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class TitanosaurusRenderer extends GeoEntityRenderer<TitanosaurusEntity> {
private final float animalScale = 2.1F;
private final float animalScale = 2.3F;
public TitanosaurusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new TitanosaurusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class TroodonRenderer extends GeoEntityRenderer<TroodonEntity> {
private final float animalScale = 0.5F;
private final float animalScale = 0.3F;
public TroodonRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new TroodonModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class TropeognathusRenderer extends GeoEntityRenderer<TropeognathusEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 1.4F;
public TropeognathusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new TropeognathusModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class TupuxuaraRenderer extends GeoEntityRenderer<TupuxuaraEntity> {
private final float animalScale = 0.8F;
private final float animalScale = 1.0F;
public TupuxuaraRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new TupuxuaraModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class UtahraptorRenderer extends GeoEntityRenderer<UtahraptorEntity> {
private final float animalScale = 1.0F;
private final float animalScale = 0.9F;
public UtahraptorRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new UtahraptorModel());
}
@@ -9,7 +9,7 @@ import software.bernie.geckolib.renderer.GeoEntityRenderer;
public class ZhenyuanopterusRenderer extends GeoEntityRenderer<ZhenyuanopterusEntity> {
private final float animalScale = 0.7F;
private final float animalScale = 1.1F;
public ZhenyuanopterusRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new ZhenyuanopterusModel());
}
@@ -1,8 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.client.AlbertosaurusVariant;
import net.cmr.jurassicrevived.sound.ModSounds;
import net.minecraft.Util;
@@ -12,25 +14,19 @@ import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.Mth;
import net.minecraft.world.Difficulty;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.attributes.DefaultAttributes;
import net.minecraft.world.entity.ai.goal.*;
import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal;
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -47,7 +43,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class AlbertosaurusEntity extends Animal implements GeoEntity {
public class AlbertosaurusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -62,38 +58,44 @@ public class AlbertosaurusEntity extends Animal implements GeoEntity {
public AlbertosaurusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.CARNIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.THEROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return AlbertosaurusEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return true;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1.2, 1));
this.goalSelector.addGoal(4, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(5, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(6, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(9, new FollowMobGoal(this, 1.2, (float) 20, (float) 10));
this.targetSelector.addGoal(10, new NearestAttackableTargetGoal<>(this, Monster.class, true));
this.targetSelector.addGoal(11, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> target.getType() != this.getType()));
this.targetSelector.addGoal(12, new NearestAttackableTargetGoal(this, TriceratopsEntity.class, false, false));
this.targetSelector.addGoal(13, new NearestAttackableTargetGoal(this, GallimimusEntity.class, false, false));
this.targetSelector.addGoal(14, new NearestAttackableTargetGoal(this, DilophosaurusEntity.class, false, false));
this.targetSelector.addGoal(15, new NearestAttackableTargetGoal(this, CeratosaurusEntity.class, false, false));
this.targetSelector.addGoal(16, new NearestAttackableTargetGoal(this, ParasaurolophusEntity.class, false, false));
this.targetSelector.addGoal(17, new NearestAttackableTargetGoal(this, VelociraptorEntity.class, false, false));
this.targetSelector.addGoal(18, new NearestAttackableTargetGoal(this, SpinosaurusEntity.class, false, false));
this.targetSelector.addGoal(19, new NearestAttackableTargetGoal(this, IndominusRexEntity.class, false, false));
this.targetSelector.addGoal(20, new NearestAttackableTargetGoal(this, Player.class, false, false));
this.goalSelector.addGoal(21, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_ALBERTOSAURUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -107,11 +109,6 @@ public class AlbertosaurusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 16D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.BEEF);
}
@Nullable
@Override
public AgeableMob getBreedOffspring(ServerLevel pLevel, AgeableMob pOtherParent) {
@@ -137,17 +134,17 @@ public class AlbertosaurusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(AlbertosaurusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.albertosaurus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.albertosaurus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.albertosaurus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.albertosaurus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.albertosaurus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -316,4 +313,9 @@ public class AlbertosaurusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.ALBERTOSAURUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.ALBERTOSAURUS_CALL.get();
}
}
@@ -1,8 +1,8 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.ai.*;
import net.cmr.jurassicrevived.entity.client.AllosaurusVariant;
import net.cmr.jurassicrevived.entity.client.AllosaurusVariant;
import net.cmr.jurassicrevived.sound.ModSounds;
@@ -29,6 +29,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -45,7 +46,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class AllosaurusEntity extends Animal implements GeoEntity {
public class AllosaurusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -60,38 +61,43 @@ public class AllosaurusEntity extends Animal implements GeoEntity {
public AllosaurusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.CARNIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.THEROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return AllosaurusEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return true;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(5, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(6, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.targetSelector.addGoal(9, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> target.getType() != this.getType()));
this.targetSelector.addGoal(10, new NearestAttackableTargetGoal(this, TriceratopsEntity.class, false, false));
this.targetSelector.addGoal(11, new NearestAttackableTargetGoal(this, GallimimusEntity.class, false, false));
this.targetSelector.addGoal(12, new NearestAttackableTargetGoal(this, DilophosaurusEntity.class, false, false));
this.targetSelector.addGoal(13, new NearestAttackableTargetGoal(this, CeratosaurusEntity.class, false, false));
this.targetSelector.addGoal(14, new NearestAttackableTargetGoal(this, ParasaurolophusEntity.class, false, false));
this.targetSelector.addGoal(15, new NearestAttackableTargetGoal(this, VelociraptorEntity.class, false, false));
this.targetSelector.addGoal(16, new NearestAttackableTargetGoal(this, TyrannosaurusRexEntity.class, false, false));
this.targetSelector.addGoal(17, new NearestAttackableTargetGoal(this, IndominusRexEntity.class, false, false));
this.targetSelector.addGoal(18, new NearestAttackableTargetGoal(this, Player.class, false, false));
this.goalSelector.addGoal(19, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_ALLOSAURUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -105,11 +111,6 @@ public class AllosaurusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 18D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.BEEF);
}
@Nullable
@Override
public AgeableMob getBreedOffspring(ServerLevel pLevel, AgeableMob pOtherParent) {
@@ -135,17 +136,17 @@ public class AllosaurusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(AllosaurusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.allosaurus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.allosaurus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.allosaurus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.allosaurus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.allosaurus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -313,4 +314,9 @@ public class AllosaurusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.ALLOSAURUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.ALBERTOSAURUS_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.AlvarezsaurusVariant;
@@ -29,6 +33,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -45,7 +50,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class AlvarezsaurusEntity extends Animal implements GeoEntity {
public class AlvarezsaurusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -60,37 +65,44 @@ public class AlvarezsaurusEntity extends Animal implements GeoEntity {
public AlvarezsaurusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.CARNIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.THEROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return AlvarezsaurusEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return true;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, SpinosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new AvoidEntityGoal<>(this, TyrannosaurusRexEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(5, new AvoidEntityGoal<>(this, VelociraptorEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(6, new AvoidEntityGoal<>(this, ParasaurolophusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(7, new AvoidEntityGoal<>(this, CeratosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(8, new AvoidEntityGoal<>(this, TriceratopsEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(9, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(10, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(11, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(12, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(13, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(14, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(15, new FollowMobGoal(this, 1, (float) 20, (float) 10));
this.targetSelector.addGoal(16, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> target.getType() != this.getType()));
this.targetSelector.addGoal(17, new NearestAttackableTargetGoal(this, GallimimusEntity.class, false, false));
this.targetSelector.addGoal(18, new NearestAttackableTargetGoal(this, Player.class, false, false));
this.targetSelector.addGoal(19, new NearestAttackableTargetGoal(this, CompsognathusEntity.class, false, false));
this.goalSelector.addGoal(20, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_ALVAREZSAURUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -104,10 +116,6 @@ public class AlvarezsaurusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 2D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.BEEF);
}
@Nullable
@Override
@@ -133,17 +141,17 @@ public class AlvarezsaurusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(AlvarezsaurusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.alvarezsaurus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.alvarezsaurus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.alvarezsaurus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.alvarezsaurus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.alvarezsaurus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -310,4 +318,9 @@ public class AlvarezsaurusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.ALVAREZSAURUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.ALVAREZSAURUS_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.AnkylosaurusVariant;
@@ -28,6 +32,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -44,7 +49,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class AnkylosaurusEntity extends Animal implements GeoEntity {
public class AnkylosaurusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -59,32 +64,44 @@ public class AnkylosaurusEntity extends Animal implements GeoEntity {
public AnkylosaurusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.HERBIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.THYREOPHORAN,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return AnkylosaurusEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return false;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, VelociraptorEntity.class, (float) 20, 0.8, 0.8));
this.goalSelector.addGoal(4, new AvoidEntityGoal<>(this, CeratosaurusEntity.class, (float) 20, 0.8, 0.8));
this.goalSelector.addGoal(5, new AvoidEntityGoal<>(this, DilophosaurusEntity.class, (float) 20, 0.8, 0.8));
this.goalSelector.addGoal(6, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(7, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(8, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(8, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(11, new FollowMobGoal(this, 0.8, (float) 20, (float) 10));
this.goalSelector.addGoal(12, new AvoidEntityGoal<>(this, SpinosaurusEntity.class, (float) 20, 0.8, 0.8));
this.goalSelector.addGoal(13, new AvoidEntityGoal<>(this, TyrannosaurusRexEntity.class, (float) 20, 0.8, 0.8));
this.goalSelector.addGoal(14, new AvoidEntityGoal<>(this, IndominusRexEntity.class, (float) 20, 0.8, 0.8));
this.goalSelector.addGoal(15, new EatBlockGoal(this));
this.goalSelector.addGoal(16, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_ANKYLOSAURUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -98,10 +115,6 @@ public class AnkylosaurusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 18D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.KELP);
}
@Nullable
@Override
@@ -127,17 +140,17 @@ public class AnkylosaurusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(AnkylosaurusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.ankylosaurus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.ankylosaurus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.ankylosaurus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.ankylosaurus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.ankylosaurus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -304,4 +317,9 @@ public class AnkylosaurusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.ANKYLOSAURUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.ANKYLOSAURUS_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.ApatosaurusVariant;
@@ -29,6 +33,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
@@ -46,7 +51,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class ApatosaurusEntity extends Animal implements GeoEntity {
public class ApatosaurusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -61,31 +66,44 @@ public class ApatosaurusEntity extends Animal implements GeoEntity {
public ApatosaurusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.HERBIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.SAUROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return ApatosaurusEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return false;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, DilophosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new AvoidEntityGoal<>(this, VelociraptorEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(5, new AvoidEntityGoal<>(this, CeratosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(6, new AvoidEntityGoal<>(this, SpinosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(7, new AvoidEntityGoal<>(this, TyrannosaurusRexEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(8, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(9, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(9, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(10, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(11, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(12, new FollowMobGoal(this, 1, (float) 20, (float) 10));
this.goalSelector.addGoal(13, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_APATOSAURUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -99,10 +117,6 @@ public class ApatosaurusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 15D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.KELP);
}
@Nullable
@Override
@@ -129,17 +143,17 @@ public class ApatosaurusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(ApatosaurusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.apatosaurus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.apatosaurus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.apatosaurus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.apatosaurus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.apatosaurus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -312,4 +326,9 @@ public class ApatosaurusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.APATOSAURUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.APATOSAURUS_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.ArambourgianiaVariant;
@@ -35,6 +39,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.phys.Vec3;
@@ -54,7 +59,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class ArambourgianiaEntity extends Animal implements GeoEntity, FlyingAnimal {
public class ArambourgianiaEntity extends DinoEntityBase implements GeoEntity, FlyingAnimal {
private final AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -70,94 +75,44 @@ public class ArambourgianiaEntity extends Animal implements GeoEntity, FlyingAni
public ArambourgianiaEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.moveControl = new FlyingMoveControl(this, 20, true);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.CARNIVORE,
IDinoData.Type.AVIAN,
IDinoData.Group.PTEROSAUR,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return ArambourgianiaEntity.this.isBaby() && super.canUse();
}
});
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(5, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(6, new FollowParentGoal(this, 1.25));
// Goal 7: Wander on ground (Walk) - Only when on ground
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0) {
@Override
public boolean canUse() {
return ArambourgianiaEntity.this.onGround() && super.canUse();
}
});
// Goal 8: Wander in air (Fly) - Handles takeoff, flying, and landing
this.goalSelector.addGoal(8, new WaterAvoidingRandomStrollGoal(this, 1.0, 20) {
@Override
public boolean canUse() {
boolean isFlying = !ArambourgianiaEntity.this.onGround();
// If flying, keep flying. If on ground, small chance (1/400 ticks) to take off.
return (isFlying || ArambourgianiaEntity.this.getRandom().nextInt(400) == 0) && super.canUse();
public boolean isCarnivore() {
return true;
}
@Override
protected Vec3 getPosition() {
Vec3 pos = ArambourgianiaEntity.this.position();
RandomSource random = ArambourgianiaEntity.this.getRandom();
double x = pos.x + (random.nextFloat() * 2 - 1) * 32;
double z = pos.z + (random.nextFloat() * 2 - 1) * 32;
// Get ground height at the random destination (returns Y of first air block)
int groundY = ArambourgianiaEntity.this.level().getHeight(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, (int)x, (int)z);
double y;
if (ArambourgianiaEntity.this.onGround()) {
// Takeoff: Target well above ground to ensure liftoff
y = pos.y + 15 + random.nextInt(10);
} else {
// Flying: 5% chance to land, otherwise stay airborne but capped height
if (random.nextFloat() < 0.05f) {
y = groundY; // Land
} else if (pos.y > groundY + 20) {
// Too high: Force descent
y = pos.y - 5 - random.nextInt(10);
} else {
// Just wander up or down a bit
y = pos.y + (random.nextFloat() * 2 - 1) * 10;
}
public boolean isMarine() {
return false;
}
// Don't target below the ground (blocks)
if (y < groundY) y = groundY;
return new Vec3(x, y, z);
@Override
public boolean isAmphibious() {
return false;
}
});
this.goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(10, new FollowMobGoal(this, 0.8, (float) 20, (float) 10));
this.targetSelector.addGoal(11, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> {
// 1. Don't eat your own species
if (target.getType() == this.getType()) return false;
// 2. Don't eat Flying Animals
if (target instanceof FlyingAnimal) return false;
// 3. SIZE CHECK: specific height and width limits
// Example: Height < 1.0 blocks AND Width < 1.0 blocks
boolean isSmallEnough = target.getBbHeight() <= 1.0F && target.getBbWidth() <= 1.0F;
return isSmallEnough;
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_ARAMBOURGIANIA_EGG.get();
}
)); this.targetSelector.addGoal(12, new NearestAttackableTargetGoal<>(this, Player.class, false, false));
this.targetSelector.addGoal(13, new HurtByTargetGoal(this));
this.goalSelector.addGoal(14, new RandomLookAroundGoal(this));
this.goalSelector.addGoal(15, new FloatGoal(this));
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -195,10 +150,6 @@ public class ArambourgianiaEntity extends Animal implements GeoEntity, FlyingAni
protected void checkFallDamage(double pY, boolean pOnGround, BlockState pState, BlockPos pPos) {
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.BEEF);
}
@Nullable
@Override
@@ -225,7 +176,7 @@ public class ArambourgianiaEntity extends Animal implements GeoEntity, FlyingAni
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (!ArambourgianiaEntity.this.onGround()) {
return state.setAndContinue(RawAnimation.begin().then("anim.arambourgiania.fly", Animation.LoopType.LOOP));
}
@@ -236,10 +187,10 @@ public class ArambourgianiaEntity extends Animal implements GeoEntity, FlyingAni
return state.setAndContinue(RawAnimation.begin().then("anim.arambourgiania.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.arambourgiania.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.arambourgiania.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -407,4 +358,9 @@ public class ArambourgianiaEntity extends Animal implements GeoEntity, FlyingAni
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.ARAMBOURGIANIA_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.ARAMBOURGIANIA_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.BaryonyxVariant;
@@ -29,6 +33,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -45,7 +50,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class BaryonyxEntity extends Animal implements GeoEntity {
public class BaryonyxEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -60,38 +65,44 @@ public class BaryonyxEntity extends Animal implements GeoEntity {
public BaryonyxEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.PISCIVORE,
IDinoData.Type.AMPHIBIOUS,
IDinoData.Group.THEROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return BaryonyxEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return true;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(5, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(6, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.targetSelector.addGoal(9, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> target.getType() != this.getType()));
this.targetSelector.addGoal(10, new NearestAttackableTargetGoal(this, TriceratopsEntity.class, false, false));
this.targetSelector.addGoal(11, new NearestAttackableTargetGoal(this, GallimimusEntity.class, false, false));
this.targetSelector.addGoal(12, new NearestAttackableTargetGoal(this, DilophosaurusEntity.class, false, false));
this.targetSelector.addGoal(13, new NearestAttackableTargetGoal(this, CeratosaurusEntity.class, false, false));
this.targetSelector.addGoal(14, new NearestAttackableTargetGoal(this, ParasaurolophusEntity.class, false, false));
this.targetSelector.addGoal(15, new NearestAttackableTargetGoal(this, VelociraptorEntity.class, false, false));
this.targetSelector.addGoal(16, new NearestAttackableTargetGoal(this, TyrannosaurusRexEntity.class, false, false));
this.targetSelector.addGoal(17, new NearestAttackableTargetGoal(this, IndominusRexEntity.class, false, false));
this.targetSelector.addGoal(18, new NearestAttackableTargetGoal(this, Player.class, false, false));
this.goalSelector.addGoal(19, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return true;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_BARYONYX_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -105,10 +116,6 @@ public class BaryonyxEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 15D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.BEEF);
}
@Nullable
@Override
@@ -135,17 +142,17 @@ public class BaryonyxEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(BaryonyxEntity.this.isSprinting() ? RawAnimation.begin().then("anim.baryonyx.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.baryonyx.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.baryonyx.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.baryonyx.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.baryonyx.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -313,4 +320,9 @@ public class BaryonyxEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.BARYONYX_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.BARYONYX_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.BrachiosaurusVariant;
@@ -29,6 +33,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
@@ -46,7 +51,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class BrachiosaurusEntity extends Animal implements GeoEntity {
public class BrachiosaurusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -61,31 +66,44 @@ public class BrachiosaurusEntity extends Animal implements GeoEntity {
public BrachiosaurusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.HERBIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.SAUROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return BrachiosaurusEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return false;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, DilophosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new AvoidEntityGoal<>(this, VelociraptorEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(5, new AvoidEntityGoal<>(this, CeratosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(6, new AvoidEntityGoal<>(this, SpinosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(7, new AvoidEntityGoal<>(this, TyrannosaurusRexEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(8, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(9, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(9, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(10, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(11, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(12, new FollowMobGoal(this, 1, (float) 20, (float) 10));
this.goalSelector.addGoal(13, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_BRACHIOSAURUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -99,10 +117,6 @@ public class BrachiosaurusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 20D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.KELP);
}
@Nullable
@Override
@@ -129,17 +143,17 @@ public class BrachiosaurusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(BrachiosaurusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.brachiosaurus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.brachiosaurus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.brachiosaurus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.brachiosaurus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.brachiosaurus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -312,4 +326,9 @@ public class BrachiosaurusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.BRACHIOSAURUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.BRACHIOSAURUS_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.CarcharodontosaurusVariant;
@@ -31,6 +35,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
@@ -48,7 +53,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class CarcharodontosaurusEntity extends Animal implements GeoEntity {
public class CarcharodontosaurusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -63,40 +68,44 @@ public class CarcharodontosaurusEntity extends Animal implements GeoEntity {
public CarcharodontosaurusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.CARNIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.THEROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return CarcharodontosaurusEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return true;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(5, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(6, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(9, new FollowMobGoal(this, 1.2, (float) 20, (float) 10));
this.targetSelector.addGoal(10, new NearestAttackableTargetGoal<>(this, Monster.class, true));
this.targetSelector.addGoal(11, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> target.getType() != this.getType()));
this.targetSelector.addGoal(12, new NearestAttackableTargetGoal(this, TriceratopsEntity.class, false, false));
this.targetSelector.addGoal(13, new NearestAttackableTargetGoal(this, GallimimusEntity.class, false, false));
this.targetSelector.addGoal(14, new NearestAttackableTargetGoal(this, DilophosaurusEntity.class, false, false));
this.targetSelector.addGoal(15, new NearestAttackableTargetGoal(this, CeratosaurusEntity.class, false, false));
this.targetSelector.addGoal(16, new NearestAttackableTargetGoal(this, ParasaurolophusEntity.class, false, false));
this.targetSelector.addGoal(17, new NearestAttackableTargetGoal(this, VelociraptorEntity.class, false, false));
this.targetSelector.addGoal(18, new NearestAttackableTargetGoal(this, SpinosaurusEntity.class, false, false));
this.targetSelector.addGoal(19, new NearestAttackableTargetGoal(this, IndominusRexEntity.class, false, false));
this.targetSelector.addGoal(20, new NearestAttackableTargetGoal(this, Player.class, false, false));
this.goalSelector.addGoal(21, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_CARCHARODONTOSAURUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -110,10 +119,6 @@ public class CarcharodontosaurusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 20D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.BEEF);
}
@Nullable
@Override
@@ -140,17 +145,17 @@ public class CarcharodontosaurusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(CarcharodontosaurusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.carcharodontosaurus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.carcharodontosaurus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.carcharodontosaurus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.carcharodontosaurus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.carcharodontosaurus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -322,4 +327,9 @@ public class CarcharodontosaurusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.CARCHARODONTOSAURUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.CARCHARODONTOSAURUS_CALL.get();
}
}
@@ -1,8 +1,8 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.ai.*;
import net.cmr.jurassicrevived.entity.client.CarnotaurusVariant;
import net.cmr.jurassicrevived.entity.client.CarnotaurusVariant;
import net.cmr.jurassicrevived.sound.ModSounds;
@@ -30,6 +30,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -46,7 +47,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class CarnotaurusEntity extends Animal implements GeoEntity {
public class CarnotaurusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -61,40 +62,44 @@ public class CarnotaurusEntity extends Animal implements GeoEntity {
public CarnotaurusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.CARNIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.THEROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return CarnotaurusEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return true;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(5, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(6, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(9, new FollowMobGoal(this, 1.2, (float) 20, (float) 10));
this.targetSelector.addGoal(10, new NearestAttackableTargetGoal<>(this, Monster.class, true));
this.targetSelector.addGoal(11, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> target.getType() != this.getType()));
this.targetSelector.addGoal(12, new NearestAttackableTargetGoal(this, TriceratopsEntity.class, false, false));
this.targetSelector.addGoal(13, new NearestAttackableTargetGoal(this, GallimimusEntity.class, false, false));
this.targetSelector.addGoal(14, new NearestAttackableTargetGoal(this, DilophosaurusEntity.class, false, false));
this.targetSelector.addGoal(15, new NearestAttackableTargetGoal(this, CeratosaurusEntity.class, false, false));
this.targetSelector.addGoal(16, new NearestAttackableTargetGoal(this, ParasaurolophusEntity.class, false, false));
this.targetSelector.addGoal(17, new NearestAttackableTargetGoal(this, VelociraptorEntity.class, false, false));
this.targetSelector.addGoal(18, new NearestAttackableTargetGoal(this, SpinosaurusEntity.class, false, false));
this.targetSelector.addGoal(19, new NearestAttackableTargetGoal(this, IndominusRexEntity.class, false, false));
this.targetSelector.addGoal(20, new NearestAttackableTargetGoal(this, Player.class, false, false));
this.goalSelector.addGoal(21, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_CARNOTAURUS_EGG.get();
}
@Override
public DinoEntityBase.DinoAIConfig getAIConfig() {
return new DinoEntityBase.DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -108,11 +113,6 @@ public class CarnotaurusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 16D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.BEEF);
}
@Nullable
@Override
public AgeableMob getBreedOffspring(ServerLevel pLevel, AgeableMob pOtherParent) {
@@ -138,17 +138,17 @@ public class CarnotaurusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(CarnotaurusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.carnotaurus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.carnotaurus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.carnotaurus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.carnotaurus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.carnotaurus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -315,4 +315,9 @@ public class CarnotaurusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.CARNOTAURUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.CARNOTAURUS_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.CearadactylusVariant;
@@ -35,6 +39,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.phys.Vec3;
@@ -54,7 +59,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class CearadactylusEntity extends Animal implements GeoEntity, FlyingAnimal {
public class CearadactylusEntity extends DinoEntityBase implements GeoEntity, FlyingAnimal {
private final AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -70,94 +75,44 @@ public class CearadactylusEntity extends Animal implements GeoEntity, FlyingAnim
public CearadactylusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.moveControl = new FlyingMoveControl(this, 20, true);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.PISCIVORE,
IDinoData.Type.AVIAN,
IDinoData.Group.PTEROSAUR,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return CearadactylusEntity.this.isBaby() && super.canUse();
}
});
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(5, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(6, new FollowParentGoal(this, 1.25));
// Goal 7: Wander on ground (Walk) - Only when on ground
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0) {
@Override
public boolean canUse() {
return CearadactylusEntity.this.onGround() && super.canUse();
}
});
// Goal 8: Wander in air (Fly) - Handles takeoff, flying, and landing
this.goalSelector.addGoal(8, new WaterAvoidingRandomStrollGoal(this, 1.0, 20) {
@Override
public boolean canUse() {
boolean isFlying = !CearadactylusEntity.this.onGround();
// If flying, keep flying. If on ground, small chance (1/400 ticks) to take off.
return (isFlying || CearadactylusEntity.this.getRandom().nextInt(400) == 0) && super.canUse();
public boolean isCarnivore() {
return true;
}
@Override
protected Vec3 getPosition() {
Vec3 pos = CearadactylusEntity.this.position();
RandomSource random = CearadactylusEntity.this.getRandom();
double x = pos.x + (random.nextFloat() * 2 - 1) * 32;
double z = pos.z + (random.nextFloat() * 2 - 1) * 32;
// Get ground height at the random destination (returns Y of first air block)
int groundY = CearadactylusEntity.this.level().getHeight(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, (int)x, (int)z);
double y;
if (CearadactylusEntity.this.onGround()) {
// Takeoff: Target well above ground to ensure liftoff
y = pos.y + 15 + random.nextInt(10);
} else {
// Flying: 5% chance to land, otherwise stay airborne but capped height
if (random.nextFloat() < 0.05f) {
y = groundY; // Land
} else if (pos.y > groundY + 20) {
// Too high: Force descent
y = pos.y - 5 - random.nextInt(10);
} else {
// Just wander up or down a bit
y = pos.y + (random.nextFloat() * 2 - 1) * 10;
}
public boolean isMarine() {
return false;
}
// Don't target below the ground (blocks)
if (y < groundY) y = groundY;
return new Vec3(x, y, z);
@Override
public boolean isAmphibious() {
return false;
}
});
this.goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(10, new FollowMobGoal(this, 0.8, (float) 20, (float) 10));
this.targetSelector.addGoal(11, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> {
// 1. Don't eat your own species
if (target.getType() == this.getType()) return false;
// 2. Don't eat Flying Animals
if (target instanceof FlyingAnimal) return false;
// 3. SIZE CHECK: specific height and width limits
// Example: Height < 1.0 blocks AND Width < 1.0 blocks
boolean isSmallEnough = target.getBbHeight() <= 1.0F && target.getBbWidth() <= 1.0F;
return isSmallEnough;
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_CEARADACTYLUS_EGG.get();
}
)); this.targetSelector.addGoal(12, new NearestAttackableTargetGoal<>(this, Player.class, false, false));
this.targetSelector.addGoal(13, new HurtByTargetGoal(this));
this.goalSelector.addGoal(14, new RandomLookAroundGoal(this));
this.goalSelector.addGoal(15, new FloatGoal(this));
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -195,10 +150,6 @@ public class CearadactylusEntity extends Animal implements GeoEntity, FlyingAnim
protected void checkFallDamage(double pY, boolean pOnGround, BlockState pState, BlockPos pPos) {
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.BEEF);
}
@Nullable
@Override
@@ -225,7 +176,7 @@ public class CearadactylusEntity extends Animal implements GeoEntity, FlyingAnim
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (!CearadactylusEntity.this.onGround()) {
return state.setAndContinue(RawAnimation.begin().then("anim.cearadactylus.fly", Animation.LoopType.LOOP));
}
@@ -236,10 +187,10 @@ public class CearadactylusEntity extends Animal implements GeoEntity, FlyingAnim
return state.setAndContinue(RawAnimation.begin().then("anim.cearadactylus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.cearadactylus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.cearadactylus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -407,4 +358,9 @@ public class CearadactylusEntity extends Animal implements GeoEntity, FlyingAnim
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.CEARADACTYLUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.CEARADACTYLUS_CALL.get();
}
}
@@ -1,8 +1,8 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.ai.*;
import net.cmr.jurassicrevived.entity.client.CeratosaurusVariant;
import net.cmr.jurassicrevived.entity.client.CeratosaurusVariant;
import net.cmr.jurassicrevived.sound.ModSounds;
@@ -29,6 +29,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -45,7 +46,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class CeratosaurusEntity extends Animal implements GeoEntity {
public class CeratosaurusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -60,37 +61,44 @@ public class CeratosaurusEntity extends Animal implements GeoEntity {
public CeratosaurusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.CARNIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.THEROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return CeratosaurusEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return true;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, TriceratopsEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new AvoidEntityGoal<>(this, SpinosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(5, new AvoidEntityGoal<>(this, TyrannosaurusRexEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(6, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(7, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(8, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(9, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(10, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(11, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(12, new FollowMobGoal(this, 1, (float) 20, (float) 10));
this.targetSelector.addGoal(13, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> target.getType() != this.getType()));
this.targetSelector.addGoal(14, new NearestAttackableTargetGoal(this, GallimimusEntity.class, false, false));
this.targetSelector.addGoal(15, new NearestAttackableTargetGoal(this, DilophosaurusEntity.class, false, false));
this.targetSelector.addGoal(16, new NearestAttackableTargetGoal(this, VelociraptorEntity.class, false, false));
this.targetSelector.addGoal(17, new NearestAttackableTargetGoal(this, ParasaurolophusEntity.class, false, false));
this.targetSelector.addGoal(18, new NearestAttackableTargetGoal(this, Player.class, false, false));
this.targetSelector.addGoal(19, new NearestAttackableTargetGoal(this, CompsognathusEntity.class, false, false));
this.goalSelector.addGoal(20, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_CERATOSAURUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -104,11 +112,6 @@ public class CeratosaurusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 16D );
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.BEEF);
}
@Nullable
@Override
public AgeableMob getBreedOffspring(ServerLevel pLevel, AgeableMob pOtherParent) {
@@ -134,17 +137,17 @@ public class CeratosaurusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(CeratosaurusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.ceratosaurus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.ceratosaurus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.ceratosaurus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.ceratosaurus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.ceratosaurus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -312,4 +315,9 @@ public class CeratosaurusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.CERATOSAURUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.CERATOSAURUS_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.ChasmosaurusVariant;
@@ -28,6 +32,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -44,7 +49,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class ChasmosaurusEntity extends Animal implements GeoEntity {
public class ChasmosaurusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -59,32 +64,44 @@ public class ChasmosaurusEntity extends Animal implements GeoEntity {
public ChasmosaurusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.HERBIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.CERAPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return ChasmosaurusEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return false;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, VelociraptorEntity.class, (float) 20, 0.8, 0.8));
this.goalSelector.addGoal(4, new AvoidEntityGoal<>(this, CeratosaurusEntity.class, (float) 20, 0.8, 0.8));
this.goalSelector.addGoal(5, new AvoidEntityGoal<>(this, DilophosaurusEntity.class, (float) 20, 0.8, 0.8));
this.goalSelector.addGoal(6, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(7, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(8, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(8, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(11, new FollowMobGoal(this, 0.8, (float) 20, (float) 10));
this.goalSelector.addGoal(12, new AvoidEntityGoal<>(this, SpinosaurusEntity.class, (float) 20, 0.8, 0.8));
this.goalSelector.addGoal(13, new AvoidEntityGoal<>(this, TyrannosaurusRexEntity.class, (float) 20, 0.8, 0.8));
this.goalSelector.addGoal(14, new AvoidEntityGoal<>(this, IndominusRexEntity.class, (float) 20, 0.8, 0.8));
this.goalSelector.addGoal(15, new EatBlockGoal(this));
this.goalSelector.addGoal(16, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_CHASMOSAURUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -98,10 +115,6 @@ public class ChasmosaurusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 14D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.KELP);
}
@Nullable
@Override
@@ -127,17 +140,17 @@ public class ChasmosaurusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(ChasmosaurusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.chasmosaurus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.chasmosaurus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.chasmosaurus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.chasmosaurus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.chasmosaurus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -304,4 +317,9 @@ public class ChasmosaurusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.CHASMOSAURUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.CHASMOSAURUS_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.ChickenosaurusVariant;
@@ -30,6 +34,7 @@ import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -46,7 +51,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class ChickenosaurusEntity extends Animal implements GeoEntity {
public class ChickenosaurusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -61,37 +66,44 @@ public class ChickenosaurusEntity extends Animal implements GeoEntity {
public ChickenosaurusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.NEUTRAL,
0.75f,
IDinoData.DietaryClassification.OMNIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.THEROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.DIURNAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return ChickenosaurusEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return false;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, SpinosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new AvoidEntityGoal<>(this, TyrannosaurusRexEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(5, new AvoidEntityGoal<>(this, VelociraptorEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(6, new AvoidEntityGoal<>(this, ParasaurolophusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(7, new AvoidEntityGoal<>(this, CeratosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(8, new AvoidEntityGoal<>(this, TriceratopsEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(9, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(10, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(11, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(12, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(13, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(14, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(15, new FollowMobGoal(this, 1, (float) 20, (float) 10));
this.targetSelector.addGoal(16, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> target.getType() != this.getType()));
this.targetSelector.addGoal(17, new NearestAttackableTargetGoal(this, GallimimusEntity.class, false, false));
this.targetSelector.addGoal(18, new NearestAttackableTargetGoal(this, Player.class, false, false));
this.targetSelector.addGoal(19, new NearestAttackableTargetGoal(this, CompsognathusEntity.class, false, false));
this.goalSelector.addGoal(20, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_CHICKENOSAURUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -105,10 +117,6 @@ public class ChickenosaurusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 8D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is((Item) ModItems.MAC_N_CHEESE);
}
@Nullable
@Override
@@ -134,17 +142,17 @@ public class ChickenosaurusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(ChickenosaurusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.chickenosaurus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.chickenosaurus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.chickenosaurus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.chickenosaurus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.chickenosaurus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -311,4 +319,9 @@ public class ChickenosaurusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.CHICKENOSAURUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.CHICKENOSAURUS_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.CoelophysisVariant;
@@ -29,6 +33,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -45,7 +50,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class CoelophysisEntity extends Animal implements GeoEntity {
public class CoelophysisEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -60,37 +65,44 @@ public class CoelophysisEntity extends Animal implements GeoEntity {
public CoelophysisEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.CARNIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.THEROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return CoelophysisEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return true;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, SpinosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new AvoidEntityGoal<>(this, TyrannosaurusRexEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(5, new AvoidEntityGoal<>(this, VelociraptorEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(6, new AvoidEntityGoal<>(this, ParasaurolophusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(7, new AvoidEntityGoal<>(this, CeratosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(8, new AvoidEntityGoal<>(this, TriceratopsEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(9, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(10, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(11, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(12, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(13, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(14, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(15, new FollowMobGoal(this, 1, (float) 20, (float) 10));
this.targetSelector.addGoal(16, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> target.getType() != this.getType()));
this.targetSelector.addGoal(17, new NearestAttackableTargetGoal(this, GallimimusEntity.class, false, false));
this.targetSelector.addGoal(18, new NearestAttackableTargetGoal(this, Player.class, false, false));
this.targetSelector.addGoal(19, new NearestAttackableTargetGoal(this, CompsognathusEntity.class, false, false));
this.goalSelector.addGoal(20, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_COELOPHYSIS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -104,10 +116,6 @@ public class CoelophysisEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 4D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.BEEF);
}
@Nullable
@Override
@@ -133,17 +141,17 @@ public class CoelophysisEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(CoelophysisEntity.this.isSprinting() ? RawAnimation.begin().then("anim.coelophysis.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.coelophysis.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.coelophysis.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.coelophysis.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.coelophysis.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -310,4 +318,9 @@ public class CoelophysisEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.COELOPHYSIS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.COELOPHYSIS_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.CoelurusVariant;
@@ -29,6 +33,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -45,7 +50,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class CoelurusEntity extends Animal implements GeoEntity {
public class CoelurusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -60,37 +65,44 @@ public class CoelurusEntity extends Animal implements GeoEntity {
public CoelurusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.CARNIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.THEROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return CoelurusEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return true;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, SpinosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new AvoidEntityGoal<>(this, TyrannosaurusRexEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(5, new AvoidEntityGoal<>(this, VelociraptorEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(6, new AvoidEntityGoal<>(this, ParasaurolophusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(7, new AvoidEntityGoal<>(this, CeratosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(8, new AvoidEntityGoal<>(this, TriceratopsEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(9, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(10, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(11, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(12, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(13, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(14, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(15, new FollowMobGoal(this, 1, (float) 20, (float) 10));
this.targetSelector.addGoal(16, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> target.getType() != this.getType()));
this.targetSelector.addGoal(17, new NearestAttackableTargetGoal(this, GallimimusEntity.class, false, false));
this.targetSelector.addGoal(18, new NearestAttackableTargetGoal(this, Player.class, false, false));
this.targetSelector.addGoal(19, new NearestAttackableTargetGoal(this, CompsognathusEntity.class, false, false));
this.goalSelector.addGoal(20, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_COELURUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -104,10 +116,6 @@ public class CoelurusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 4D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.BEEF);
}
@Nullable
@Override
@@ -133,17 +141,17 @@ public class CoelurusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(CoelurusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.coelurus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.coelurus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.coelurus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.coelurus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.coelurus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -310,4 +318,9 @@ public class CoelurusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.COELURUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.COELURUS_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.CompsognathusVariant;
@@ -28,6 +32,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -44,7 +49,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class CompsognathusEntity extends Animal implements GeoEntity {
public class CompsognathusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -59,25 +64,44 @@ public class CompsognathusEntity extends Animal implements GeoEntity {
public CompsognathusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.SCAVENGER,
0.75f,
IDinoData.DietaryClassification.CARNIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.THEROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return CompsognathusEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return true;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(4, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(5, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(6, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(7, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(8, new FollowMobGoal(this, 1, (float) 20, (float) 10));
this.goalSelector.addGoal(9, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_COMPSOGNATHUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -91,10 +115,6 @@ public class CompsognathusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_KNOCKBACK, 0D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.BEEF);
}
@Nullable
@Override
@@ -120,17 +140,17 @@ public class CompsognathusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(CompsognathusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.compsognathus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.compsognathus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.compsognathus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.compsognathus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.compsognathus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -297,4 +317,9 @@ public class CompsognathusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.COMPSOGNATHUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.COMPSOGNATHUS_CALL.get();
}
}
@@ -1,8 +1,8 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.ai.*;
import net.cmr.jurassicrevived.entity.client.ConcavenatorVariant;
import net.cmr.jurassicrevived.entity.client.ConcavenatorVariant;
import net.cmr.jurassicrevived.sound.ModSounds;
@@ -29,6 +29,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -45,7 +46,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class ConcavenatorEntity extends Animal implements GeoEntity {
public class ConcavenatorEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -60,38 +61,44 @@ public class ConcavenatorEntity extends Animal implements GeoEntity {
public ConcavenatorEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.CARNIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.THEROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return ConcavenatorEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return true;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, TriceratopsEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new AvoidEntityGoal<>(this, SpinosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(5, new AvoidEntityGoal<>(this, TyrannosaurusRexEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(6, new AvoidEntityGoal<>(this, IndominusRexEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(7, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(8, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(9, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(10, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(11, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(12, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(13, new FollowMobGoal(this, 1, (float) 20, (float) 10));
this.targetSelector.addGoal(14, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> target.getType() != this.getType()));
this.targetSelector.addGoal(15, new NearestAttackableTargetGoal(this, GallimimusEntity.class, false, false));
this.targetSelector.addGoal(16, new NearestAttackableTargetGoal(this, DilophosaurusEntity.class, false, false));
this.targetSelector.addGoal(17, new NearestAttackableTargetGoal(this, CeratosaurusEntity.class, false, false));
this.targetSelector.addGoal(18, new NearestAttackableTargetGoal(this, ParasaurolophusEntity.class, false, false));
this.targetSelector.addGoal(19, new NearestAttackableTargetGoal(this, Player.class, false, false));
this.targetSelector.addGoal(20, new NearestAttackableTargetGoal(this, CompsognathusEntity.class, false, false));
this.goalSelector.addGoal(21, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_CONCAVENATOR_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -105,11 +112,6 @@ public class ConcavenatorEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_KNOCKBACK, 0D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.BEEF);
}
@Nullable
@Override
public AgeableMob getBreedOffspring(ServerLevel pLevel, AgeableMob pOtherParent) {
@@ -135,17 +137,17 @@ public class ConcavenatorEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(ConcavenatorEntity.this.isSprinting() ? RawAnimation.begin().then("anim.concavenator.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.concavenator.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.concavenator.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.concavenator.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.concavenator.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -312,4 +314,9 @@ public class ConcavenatorEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.CONCAVENATOR_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.CONCAVENATOR_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.CorythosaurusVariant;
import net.cmr.jurassicrevived.entity.client.CorythosaurusVariant;
@@ -26,6 +30,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -42,7 +47,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class CorythosaurusEntity extends Animal implements GeoEntity {
public class CorythosaurusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -57,24 +62,44 @@ public class CorythosaurusEntity extends Animal implements GeoEntity {
public CorythosaurusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.HERBIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.ORNITHOPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15));
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(7, new FollowMobGoal(this, 1, (float) 20, (float) 10));
this.goalSelector.addGoal(8, new AvoidEntityGoal<>(this, DilophosaurusEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(9, new AvoidEntityGoal<>(this, VelociraptorEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(10, new AvoidEntityGoal<>(this, CeratosaurusEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(11, new AvoidEntityGoal<>(this, SpinosaurusEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(12, new AvoidEntityGoal<>(this, TyrannosaurusRexEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(13, new RandomLookAroundGoal(this));
public boolean isCarnivore() {
return false;
}
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_CORYTHOSAURUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -88,10 +113,6 @@ public class CorythosaurusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 12D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.KELP);
}
@Nullable
@Override
@@ -117,17 +138,17 @@ public class CorythosaurusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(CorythosaurusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.corythosaurus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.corythosaurus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.corythosaurus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.corythosaurus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.corythosaurus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -294,4 +315,9 @@ public class CorythosaurusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.CORYTHOSAURUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.CORYTHOSAURUS_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.DeinonychusVariant;
@@ -29,6 +33,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -45,7 +50,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class DeinonychusEntity extends Animal implements GeoEntity {
public class DeinonychusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -60,38 +65,44 @@ public class DeinonychusEntity extends Animal implements GeoEntity {
public DeinonychusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.CARNIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.THEROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return DeinonychusEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return true;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, TriceratopsEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new AvoidEntityGoal<>(this, SpinosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(5, new AvoidEntityGoal<>(this, TyrannosaurusRexEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(6, new AvoidEntityGoal<>(this, IndominusRexEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(7, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(8, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(9, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(10, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(11, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(12, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(13, new FollowMobGoal(this, 1, (float) 20, (float) 10));
this.targetSelector.addGoal(14, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> target.getType() != this.getType()));
this.targetSelector.addGoal(15, new NearestAttackableTargetGoal(this, GallimimusEntity.class, false, false));
this.targetSelector.addGoal(16, new NearestAttackableTargetGoal(this, DilophosaurusEntity.class, false, false));
this.targetSelector.addGoal(17, new NearestAttackableTargetGoal(this, CeratosaurusEntity.class, false, false));
this.targetSelector.addGoal(18, new NearestAttackableTargetGoal(this, ParasaurolophusEntity.class, false, false));
this.targetSelector.addGoal(19, new NearestAttackableTargetGoal(this, Player.class, false, false));
this.targetSelector.addGoal(20, new NearestAttackableTargetGoal(this, CompsognathusEntity.class, false, false));
this.goalSelector.addGoal(21, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_DEINONYCHUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -105,10 +116,6 @@ public class DeinonychusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_KNOCKBACK, 0D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.BEEF);
}
@Nullable
@Override
@@ -134,17 +141,17 @@ public class DeinonychusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(DeinonychusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.deinonychus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.deinonychus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.deinonychus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.deinonychus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.deinonychus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -311,4 +318,9 @@ public class DeinonychusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.DEINONYCHUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.DEINONYCHUS_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.DilophosaurusVariant;
@@ -29,6 +33,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -45,7 +50,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class DilophosaurusEntity extends Animal implements GeoEntity {
public class DilophosaurusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -60,37 +65,44 @@ public class DilophosaurusEntity extends Animal implements GeoEntity {
public DilophosaurusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.CARNIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.THEROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return DilophosaurusEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return true;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, SpinosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new AvoidEntityGoal<>(this, TyrannosaurusRexEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(5, new AvoidEntityGoal<>(this, VelociraptorEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(6, new AvoidEntityGoal<>(this, ParasaurolophusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(7, new AvoidEntityGoal<>(this, CeratosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(8, new AvoidEntityGoal<>(this, TriceratopsEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(9, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(10, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(11, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(12, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(13, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(14, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(15, new FollowMobGoal(this, 1, (float) 20, (float) 10));
this.targetSelector.addGoal(16, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> target.getType() != this.getType()));
this.targetSelector.addGoal(17, new NearestAttackableTargetGoal(this, GallimimusEntity.class, false, false));
this.targetSelector.addGoal(18, new NearestAttackableTargetGoal(this, Player.class, false, false));
this.targetSelector.addGoal(19, new NearestAttackableTargetGoal(this, CompsognathusEntity.class, false, false));
this.goalSelector.addGoal(20, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_DILOPHOSAURUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -104,10 +116,6 @@ public class DilophosaurusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 5D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.BEEF);
}
@Nullable
@Override
@@ -134,17 +142,17 @@ public class DilophosaurusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(DilophosaurusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.dilophosaurus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.dilophosaurus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.dilophosaurus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.dilophosaurus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.dilophosaurus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -311,4 +319,9 @@ public class DilophosaurusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.DILOPHOSAURUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.DILOPHOSAURUS_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.DimorphodonVariant;
@@ -35,6 +39,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.phys.Vec3;
@@ -54,7 +59,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class DimorphodonEntity extends Animal implements GeoEntity, FlyingAnimal {
public class DimorphodonEntity extends DinoEntityBase implements GeoEntity, FlyingAnimal {
private final AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -70,94 +75,44 @@ public class DimorphodonEntity extends Animal implements GeoEntity, FlyingAnimal
public DimorphodonEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.moveControl = new FlyingMoveControl(this, 20, true);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.CARNIVORE,
IDinoData.Type.AVIAN,
IDinoData.Group.PTEROSAUR,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return DimorphodonEntity.this.isBaby() && super.canUse();
}
});
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(5, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(6, new FollowParentGoal(this, 1.25));
// Goal 7: Wander on ground (Walk) - Only when on ground
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0) {
@Override
public boolean canUse() {
return DimorphodonEntity.this.onGround() && super.canUse();
}
});
// Goal 8: Wander in air (Fly) - Handles takeoff, flying, and landing
this.goalSelector.addGoal(8, new WaterAvoidingRandomStrollGoal(this, 1.0, 20) {
@Override
public boolean canUse() {
boolean isFlying = !DimorphodonEntity.this.onGround();
// If flying, keep flying. If on ground, small chance (1/400 ticks) to take off.
return (isFlying || DimorphodonEntity.this.getRandom().nextInt(400) == 0) && super.canUse();
public boolean isCarnivore() {
return true;
}
@Override
protected Vec3 getPosition() {
Vec3 pos = DimorphodonEntity.this.position();
RandomSource random = DimorphodonEntity.this.getRandom();
double x = pos.x + (random.nextFloat() * 2 - 1) * 32;
double z = pos.z + (random.nextFloat() * 2 - 1) * 32;
// Get ground height at the random destination (returns Y of first air block)
int groundY = DimorphodonEntity.this.level().getHeight(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, (int)x, (int)z);
double y;
if (DimorphodonEntity.this.onGround()) {
// Takeoff: Target well above ground to ensure liftoff
y = pos.y + 15 + random.nextInt(10);
} else {
// Flying: 5% chance to land, otherwise stay airborne but capped height
if (random.nextFloat() < 0.05f) {
y = groundY; // Land
} else if (pos.y > groundY + 20) {
// Too high: Force descent
y = pos.y - 5 - random.nextInt(10);
} else {
// Just wander up or down a bit
y = pos.y + (random.nextFloat() * 2 - 1) * 10;
}
public boolean isMarine() {
return false;
}
// Don't target below the ground (blocks)
if (y < groundY) y = groundY;
return new Vec3(x, y, z);
@Override
public boolean isAmphibious() {
return false;
}
});
this.goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(10, new FollowMobGoal(this, 0.8, (float) 20, (float) 10));
this.targetSelector.addGoal(11, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> {
// 1. Don't eat your own species
if (target.getType() == this.getType()) return false;
// 2. Don't eat Flying Animals
if (target instanceof FlyingAnimal) return false;
// 3. SIZE CHECK: specific height and width limits
// Example: Height < 1.0 blocks AND Width < 1.0 blocks
boolean isSmallEnough = target.getBbHeight() <= 1.0F && target.getBbWidth() <= 1.0F;
return isSmallEnough;
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_DIMORPHODON_EGG.get();
}
)); this.targetSelector.addGoal(12, new NearestAttackableTargetGoal<>(this, Player.class, false, false));
this.targetSelector.addGoal(13, new HurtByTargetGoal(this));
this.goalSelector.addGoal(14, new RandomLookAroundGoal(this));
this.goalSelector.addGoal(15, new FloatGoal(this));
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -195,10 +150,6 @@ public class DimorphodonEntity extends Animal implements GeoEntity, FlyingAnimal
protected void checkFallDamage(double pY, boolean pOnGround, BlockState pState, BlockPos pPos) {
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.BEEF);
}
@Nullable
@Override
@@ -225,7 +176,7 @@ public class DimorphodonEntity extends Animal implements GeoEntity, FlyingAnimal
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (!DimorphodonEntity.this.onGround()) {
return state.setAndContinue(RawAnimation.begin().then("anim.dimorphodon.fly", Animation.LoopType.LOOP));
}
@@ -236,10 +187,10 @@ public class DimorphodonEntity extends Animal implements GeoEntity, FlyingAnimal
return state.setAndContinue(RawAnimation.begin().then("anim.dimorphodon.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.dimorphodon.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.dimorphodon.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -407,4 +358,9 @@ public class DimorphodonEntity extends Animal implements GeoEntity, FlyingAnimal
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.DIMORPHODON_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.DIMORPHODON_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.DiplodocusVariant;
@@ -29,6 +33,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
@@ -46,7 +51,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class DiplodocusEntity extends Animal implements GeoEntity {
public class DiplodocusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -61,31 +66,44 @@ public class DiplodocusEntity extends Animal implements GeoEntity {
public DiplodocusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.HERBIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.SAUROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return DiplodocusEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return false;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, DilophosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new AvoidEntityGoal<>(this, VelociraptorEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(5, new AvoidEntityGoal<>(this, CeratosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(6, new AvoidEntityGoal<>(this, SpinosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(7, new AvoidEntityGoal<>(this, TyrannosaurusRexEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(8, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(9, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(9, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(10, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(11, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(12, new FollowMobGoal(this, 1, (float) 20, (float) 10));
this.goalSelector.addGoal(13, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_DIPLODOCUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -99,10 +117,6 @@ public class DiplodocusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 15D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.KELP);
}
@Nullable
@Override
@@ -129,17 +143,17 @@ public class DiplodocusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(DiplodocusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.diplodocus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.diplodocus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.diplodocus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.diplodocus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.diplodocus.call", Animation.LoopType.PLAY_ONCE)));
}
@@ -311,4 +325,9 @@ public class DiplodocusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.DIPLODOCUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.DIPLODOCUS_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.DistortusRexVariant;
@@ -31,6 +35,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
@@ -48,7 +53,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class DistortusRexEntity extends Animal implements GeoEntity {
public class DistortusRexEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -63,40 +68,44 @@ public class DistortusRexEntity extends Animal implements GeoEntity {
public DistortusRexEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.CARNIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.THEROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return DistortusRexEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return true;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(5, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(6, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(9, new FollowMobGoal(this, 1.2, (float) 20, (float) 10));
this.targetSelector.addGoal(10, new NearestAttackableTargetGoal<>(this, Monster.class, true));
this.targetSelector.addGoal(11, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> target.getType() != this.getType()));
this.targetSelector.addGoal(12, new NearestAttackableTargetGoal(this, TriceratopsEntity.class, false, false));
this.targetSelector.addGoal(13, new NearestAttackableTargetGoal(this, GallimimusEntity.class, false, false));
this.targetSelector.addGoal(14, new NearestAttackableTargetGoal(this, DilophosaurusEntity.class, false, false));
this.targetSelector.addGoal(15, new NearestAttackableTargetGoal(this, CeratosaurusEntity.class, false, false));
this.targetSelector.addGoal(16, new NearestAttackableTargetGoal(this, ParasaurolophusEntity.class, false, false));
this.targetSelector.addGoal(17, new NearestAttackableTargetGoal(this, VelociraptorEntity.class, false, false));
this.targetSelector.addGoal(18, new NearestAttackableTargetGoal(this, SpinosaurusEntity.class, false, false));
this.targetSelector.addGoal(19, new NearestAttackableTargetGoal(this, IndominusRexEntity.class, false, false));
this.targetSelector.addGoal(20, new NearestAttackableTargetGoal(this, Player.class, false, false));
this.goalSelector.addGoal(21, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_DISTORTUS_REX_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -110,10 +119,6 @@ public class DistortusRexEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 35D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.BEEF);
}
@Nullable
@Override
@@ -140,17 +145,17 @@ public class DistortusRexEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(DistortusRexEntity.this.isSprinting() ? RawAnimation.begin().then("anim.distortus_rex.walk", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.distortus_rex.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.distortus_rex.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.distortus_rex.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.distortus_rex.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -322,4 +327,9 @@ public class DistortusRexEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.DISTORTUS_REX_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.DISTORTUS_REX_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.DryosaurusVariant;
import net.cmr.jurassicrevived.entity.client.DryosaurusVariant;
@@ -26,6 +30,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -42,7 +47,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class DryosaurusEntity extends Animal implements GeoEntity {
public class DryosaurusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -57,26 +62,44 @@ public class DryosaurusEntity extends Animal implements GeoEntity {
public DryosaurusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.HERBIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.ORNITHOPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15));
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(7, new FollowMobGoal(this, 1, (float) 20, (float) 10));
this.goalSelector.addGoal(8, new AvoidEntityGoal<>(this, TriceratopsEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(9, new AvoidEntityGoal<>(this, DilophosaurusEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(10, new AvoidEntityGoal<>(this, VelociraptorEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(11, new AvoidEntityGoal<>(this, CeratosaurusEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(12, new AvoidEntityGoal<>(this, SpinosaurusEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(13, new AvoidEntityGoal<>(this, TyrannosaurusRexEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(14, new AvoidEntityGoal<>(this, IndominusRexEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(15, new RandomLookAroundGoal(this));
public boolean isCarnivore() {
return false;
}
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_DRYOSAURUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -90,10 +113,6 @@ public class DryosaurusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 0D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.KELP);
}
@Nullable
@Override
@@ -119,17 +138,17 @@ public class DryosaurusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(DryosaurusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.dryosaurus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.dryosaurus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.dryosaurus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.dryosaurus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.dryosaurus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -296,4 +315,9 @@ public class DryosaurusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.DRYOSAURUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.DRYOSAURUS_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.EdmontosaurusVariant;
import net.cmr.jurassicrevived.entity.client.EdmontosaurusVariant;
@@ -26,6 +30,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -42,7 +47,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class EdmontosaurusEntity extends Animal implements GeoEntity {
public class EdmontosaurusEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -57,24 +62,44 @@ public class EdmontosaurusEntity extends Animal implements GeoEntity {
public EdmontosaurusEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.TERRITORIAL,
0.75f,
IDinoData.DietaryClassification.HERBIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.ORNITHOPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.CATHEMERAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15));
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(7, new FollowMobGoal(this, 1, (float) 20, (float) 10));
this.goalSelector.addGoal(8, new AvoidEntityGoal<>(this, DilophosaurusEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(9, new AvoidEntityGoal<>(this, VelociraptorEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(10, new AvoidEntityGoal<>(this, CeratosaurusEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(11, new AvoidEntityGoal<>(this, SpinosaurusEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(12, new AvoidEntityGoal<>(this, TyrannosaurusRexEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(13, new RandomLookAroundGoal(this));
public boolean isCarnivore() {
return false;
}
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_EDMONTOSAURUS_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -88,10 +113,6 @@ public class EdmontosaurusEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 12D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is(Items.KELP);
}
@Nullable
@Override
@@ -117,17 +138,17 @@ public class EdmontosaurusEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(EdmontosaurusEntity.this.isSprinting() ? RawAnimation.begin().then("anim.edmontosaurus.run", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.edmontosaurus.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.edmontosaurus.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.edmontosaurus.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.edmontosaurus.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -294,4 +315,9 @@ public class EdmontosaurusEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.EDMONTOSAURUS_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.EDMONTOSAURUS_CALL.get();
}
}
@@ -1,6 +1,10 @@
package net.cmr.jurassicrevived.entity.custom;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.entity.ModEntities;
import net.cmr.jurassicrevived.entity.ai.DinoData;
import net.cmr.jurassicrevived.entity.ai.DinoEntityBase;
import net.cmr.jurassicrevived.entity.ai.IDinoData;
import net.cmr.jurassicrevived.entity.ai.SprintingMeleeAttackGoal;
import net.cmr.jurassicrevived.entity.ai.SprintingPanicGoal;
import net.cmr.jurassicrevived.entity.client.FDuckVariant;
@@ -30,6 +34,7 @@ import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import software.bernie.geckolib.animatable.GeoEntity;
/*? if <=1.20.1 {*/
@@ -46,7 +51,7 @@ import software.bernie.geckolib.animatable.instance.SingletonAnimatableInstanceC
import software.bernie.geckolib.animation.*;
*//*?}*/
public class FDuckEntity extends Animal implements GeoEntity {
public class FDuckEntity extends DinoEntityBase implements GeoEntity {
private AnimatableInstanceCache cache = new SingletonAnimatableInstanceCache(this);
private static final EntityDataAccessor<Integer> VARIANT =
@@ -61,37 +66,44 @@ public class FDuckEntity extends Animal implements GeoEntity {
public FDuckEntity(EntityType<? extends Animal> pEntityType, Level pLevel) {
super(pEntityType, pLevel);
this.dinoData = new DinoData(
getAIConfig().maxHunger(),
getAIConfig().maxThirst(),
IDinoData.Mood.NEUTRAL,
IDinoData.Aggression.NEUTRAL,
0.75f,
IDinoData.DietaryClassification.OMNIVORE,
IDinoData.Type.TERRESTRIAL,
IDinoData.Group.THEROPOD,
IDinoData.BirthType.EGG_LAYING,
IDinoData.ActivityPattern.DIURNAL
);
}
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new SprintingPanicGoal(this, 1.15) {
@Override
public boolean canUse() {
return FDuckEntity.this.isBaby() && super.canUse();
public boolean isCarnivore() {
return false;
}
});
this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
this.goalSelector.addGoal(2, new FloatGoal(this));
this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, SpinosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(4, new AvoidEntityGoal<>(this, TyrannosaurusRexEntity.class, (float) 20, 1.2, 1.2));
this.goalSelector.addGoal(5, new AvoidEntityGoal<>(this, VelociraptorEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(6, new AvoidEntityGoal<>(this, ParasaurolophusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(7, new AvoidEntityGoal<>(this, CeratosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(8, new AvoidEntityGoal<>(this, TriceratopsEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(9, new AvoidEntityGoal<>(this, BrachiosaurusEntity.class, (float) 20, 1, 1));
this.goalSelector.addGoal(10, new SprintingMeleeAttackGoal(this, 1.1, false));
this.goalSelector.addGoal(11, new BreedGoal(this, 1.0));
this.goalSelector.addGoal(12, new FollowParentGoal(this, 1.25));
this.goalSelector.addGoal(13, new WaterAvoidingRandomStrollGoal(this, 1.0));
this.goalSelector.addGoal(14, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(15, new FollowMobGoal(this, 1, (float) 20, (float) 10));
this.targetSelector.addGoal(16, new NearestAttackableTargetGoal<>(this, Animal.class, 10, false, false,
target -> target.getType() != this.getType()));
this.targetSelector.addGoal(17, new NearestAttackableTargetGoal(this, GallimimusEntity.class, false, false));
this.targetSelector.addGoal(18, new NearestAttackableTargetGoal(this, Player.class, false, false));
this.targetSelector.addGoal(19, new NearestAttackableTargetGoal(this, CompsognathusEntity.class, false, false));
this.goalSelector.addGoal(20, new RandomLookAroundGoal(this));
@Override
public boolean isMarine() {
return false;
}
@Override
public boolean isAmphibious() {
return false;
}
@Override
public Block getEggBlock() {
return ModBlocks.INCUBATED_FDUCK_EGG.get();
}
@Override
public DinoAIConfig getAIConfig() {
return new DinoAIConfig(0.3D, 1.1D, 1.5D, 100, 100, 0.05f, 0.1f, 20);
}
public static AttributeSupplier.Builder createAttributes() {
@@ -105,10 +117,6 @@ public class FDuckEntity extends Animal implements GeoEntity {
.add(Attributes.ATTACK_DAMAGE, 8D);
}
@Override
public boolean isFood(ItemStack pStack) {
return pStack.is((Item) ModItems.MAC_N_CHEESE);
}
@Nullable
@Override
@@ -134,17 +142,17 @@ public class FDuckEntity extends Animal implements GeoEntity {
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", state -> {
controllers.add(new AnimationController<>(this, "Walk/Run/Idle", 5, state -> {
if (state.isMoving())
return state.setAndContinue(FDuckEntity.this.isSprinting() ? RawAnimation.begin().then("anim.fduck.walk", Animation.LoopType.LOOP) : RawAnimation.begin().then("anim.fduck.walk", Animation.LoopType.LOOP));
return state.setAndContinue(RawAnimation.begin().then("anim.fduck.idle", Animation.LoopType.LOOP));
}));
controllers.add(new AnimationController<>(this, "attackController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "attackController", 5, state -> PlayState.STOP)
.triggerableAnim("attack", RawAnimation.begin().then("anim.fduck.attack", Animation.LoopType.PLAY_ONCE)));
controllers.add(new AnimationController<>(this, "mouthController", state -> PlayState.STOP)
controllers.add(new AnimationController<>(this, "mouthController", 5, state -> PlayState.STOP)
.triggerableAnim("mouth", RawAnimation.begin().then("anim.fduck.mouth", Animation.LoopType.PLAY_ONCE)));
}
@@ -311,4 +319,9 @@ public class FDuckEntity extends Animal implements GeoEntity {
protected @Nullable SoundEvent getDeathSound() {
return ModSounds.FDUCK_DEATH.get();
}
@Override
protected @Nullable SoundEvent getAmbientSound() {
return ModSounds.FDUCK_CALL.get();
}
}

Some files were not shown because too many files have changed in this diff Show More