diff --git a/Forge/build.gradle b/Forge/build.gradle
index cecdadaf..d0a32d46 100644
--- a/Forge/build.gradle
+++ b/Forge/build.gradle
@@ -26,7 +26,7 @@ base {
archivesName = "${mod_id}-forge-${minecraft_version}"
}
-java.toolchain.languageVersion = JavaLanguageVersion.of(17)
+java.toolchain.languageVersion = JavaLanguageVersion.of(java_version)
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft {
@@ -73,8 +73,10 @@ sourceSets.main.resources { srcDir 'src/generated/resources' }
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
- compileOnly fg.deobf("software.bernie.geckolib:geckolib-forge-${minecraft_version}:${geckolib_version}")
- runtimeOnly fg.deobf("software.bernie.geckolib:geckolib-forge-${minecraft_version}:${geckolib_version}")
+ //compileOnly fg.deobf("software.bernie.geckolib:geckolib-forge-${geckolib_version}")
+ //runtimeOnly fg.deobf("software.bernie.geckolib:geckolib-forge-${geckolib_version}")
+ runtimeOnly "curse.maven:geckolib-388172:${geckolib_file}"
+ compileOnly "curse.maven:geckolib-388172:${geckolib_file}"
}
tasks.named('processResources', ProcessResources).configure {
@@ -121,8 +123,12 @@ eclipse {
synchronizationTasks 'genEclipseRuns'
}
-sourceSets.each {
+sourceSets.main.resources {
+ srcDir 'src/generated/resources'
+}
+
+/*sourceSets.each {
def dir = layout.buildDirectory.dir("sourcesSets/$it.name")
it.output.resourcesDir = dir
it.java.destinationDirectory = dir
-}
\ No newline at end of file
+}*/
diff --git a/Forge/gradle.properties b/Forge/gradle.properties
index 32738787..d1a5d749 100644
--- a/Forge/gradle.properties
+++ b/Forge/gradle.properties
@@ -3,14 +3,16 @@ org.gradle.daemon=false
## Environment Properties
-minecraft_version=1.20.4
-minecraft_version_range=[1.20.4,1.21)
-forge_version=49.1.4
-forge_version_range=[0,)
-loader_version_range=[0,)
+minecraft_version=1.16.5
+minecraft_version_range=[1.16,1.22)
+forge_version=36.2.34
+forge_version_range=[36,)
+loader_version_range=[36,)
mapping_channel=official
-mapping_version=1.20.4
-geckolib_version=4.4.4
+mapping_version=1.16.5
+geckolib_version=1.16.5:3.0.106
+geckolib_file=4182600
+java_version=8
## Mod Properties
@@ -20,4 +22,4 @@ mod_license=MIT License
mod_version=1.0.0
mod_group_id=software.bluelib
mod_authors=Dan, Aram
-mod_description=BlueLib is an All round Minecraft mod library that offers data-driven features, allowing users to implement and customize its features with full freedom. \nIt supports both Resource and Datapacks, ensuring seamless integration and flexibility.
\ No newline at end of file
+mod_description=BlueLib is an All round Minecraft mod library that offers data-driven features, allowing users to implement and customize its features with full freedom. \nIt supports both Resource and Datapacks, ensuring seamless integration and flexibility.
diff --git a/Forge/gradle/wrapper/gradle-wrapper.properties b/Forge/gradle/wrapper/gradle-wrapper.properties
index 309b4e18..54f3c9ac 100644
--- a/Forge/gradle/wrapper/gradle-wrapper.properties
+++ b/Forge/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
+#Tue Sep 03 15:47:51 SAST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
-networkTimeout=10000
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/Forge/src/main/java/software/bluelib/BlueLib.java b/Forge/src/main/java/software/bluelib/BlueLib.java
index 1b47ff5e..a90941ed 100644
--- a/Forge/src/main/java/software/bluelib/BlueLib.java
+++ b/Forge/src/main/java/software/bluelib/BlueLib.java
@@ -110,15 +110,15 @@ private void setupComplete(final FMLLoadCompleteEvent event) {
public void onLoadComplete(FMLLoadCompleteEvent pEvent) {
if (isDeveloperMode()) {
scheduler.schedule(() -> {
- System.out.println("""
+ System.out.println(
+ "**************************************************\n" +
+ "* *\n" +
+ "* Thank you for using BlueLib! *\n" +
+ "* We appreciate your support. *\n" +
+ "* *\n" +
+ "**************************************************"
+ );
- **************************************************
- * *
- * Thank you for using BlueLib! *
- * We appreciate your support. *
- * *
- **************************************************
- """);
scheduler.shutdown();
}, 3, TimeUnit.SECONDS);
}
diff --git a/Forge/src/main/java/software/bluelib/entity/variant/VariantLoader.java b/Forge/src/main/java/software/bluelib/entity/variant/VariantLoader.java
index 3dc0034b..01be1ee2 100644
--- a/Forge/src/main/java/software/bluelib/entity/variant/VariantLoader.java
+++ b/Forge/src/main/java/software/bluelib/entity/variant/VariantLoader.java
@@ -5,9 +5,9 @@
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-import net.minecraft.resources.ResourceLocation;
+import net.minecraft.resources.IResourceManager;
import net.minecraft.server.MinecraftServer;
-import net.minecraft.server.packs.resources.ResourceManager;
+import net.minecraft.util.ResourceLocation;
import software.bluelib.interfaces.variant.base.IVariantEntityBase;
import software.bluelib.json.JSONLoader;
import software.bluelib.json.JSONMerger;
@@ -67,7 +67,7 @@ public class VariantLoader implements IVariantEntityBase {
*/
public static void loadVariants(ResourceLocation pJSONLocationMod, ResourceLocation pJSONLocationData, MinecraftServer pServer, String pEntityName) {
clearVariantsForEntity(pEntityName);
- ResourceManager resourceManager = pServer.getResourceManager();
+ IResourceManager resourceManager = pServer.getResourceManager();
JsonObject mergedJsonObject = new JsonObject();
JsonObject modJson = jsonLoader.loadJson(pJSONLocationMod, resourceManager);
diff --git a/Forge/src/main/java/software/bluelib/entity/variant/VariantParameter.java b/Forge/src/main/java/software/bluelib/entity/variant/VariantParameter.java
index db3d3319..d0584e28 100644
--- a/Forge/src/main/java/software/bluelib/entity/variant/VariantParameter.java
+++ b/Forge/src/main/java/software/bluelib/entity/variant/VariantParameter.java
@@ -70,7 +70,7 @@ public VariantParameter(String pJsonKey, JsonObject pJsonObject) {
} else if (element.isJsonArray()) {
StringBuilder arrayValues = new StringBuilder();
element.getAsJsonArray().forEach(e -> arrayValues.append(e.getAsString()).append(","));
- if (!arrayValues.isEmpty()) {
+ if (arrayValues.length() > 0) {
arrayValues.setLength(arrayValues.length() - 1);
}
addParameter(entry.getKey(), arrayValues.toString());
diff --git a/Forge/src/main/java/software/bluelib/event/ReloadEventHandler.java b/Forge/src/main/java/software/bluelib/event/ReloadEventHandler.java
index 9a095c52..f76135fc 100644
--- a/Forge/src/main/java/software/bluelib/event/ReloadEventHandler.java
+++ b/Forge/src/main/java/software/bluelib/event/ReloadEventHandler.java
@@ -3,8 +3,8 @@
package software.bluelib.event;
import com.google.gson.JsonParseException;
-import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.util.ResourceLocation;
import software.bluelib.entity.variant.VariantLoader;
/**
diff --git a/Forge/src/main/java/software/bluelib/example/entity/dragon/DragonEntity.java b/Forge/src/main/java/software/bluelib/example/entity/dragon/DragonEntity.java
index 00e15560..a7be228d 100644
--- a/Forge/src/main/java/software/bluelib/example/entity/dragon/DragonEntity.java
+++ b/Forge/src/main/java/software/bluelib/example/entity/dragon/DragonEntity.java
@@ -2,29 +2,33 @@
package software.bluelib.example.entity.dragon;
-import net.minecraft.nbt.CompoundTag;
-import net.minecraft.network.syncher.EntityDataAccessor;
-import net.minecraft.network.syncher.EntityDataSerializers;
-import net.minecraft.network.syncher.SynchedEntityData;
-import net.minecraft.server.level.ServerLevel;
+import net.minecraft.entity.AgeableEntity;
+import net.minecraft.entity.EntityType;
+import net.minecraft.entity.ILivingEntityData;
+import net.minecraft.entity.SpawnReason;
+import net.minecraft.entity.ai.attributes.AttributeModifierMap;
+import net.minecraft.entity.ai.attributes.Attributes;
+import net.minecraft.entity.passive.TameableEntity;
+import net.minecraft.nbt.CompoundNBT;
+import net.minecraft.network.datasync.DataParameter;
+import net.minecraft.network.datasync.DataSerializers;
+import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.world.DifficultyInstance;
-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.level.Level;
-import net.minecraft.world.level.ServerLevelAccessor;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import software.bernie.geckolib.animatable.GeoEntity;
-import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
-import software.bernie.geckolib.core.animation.AnimatableManager;
-import software.bernie.geckolib.util.GeckoLibUtil;
+import net.minecraft.world.IServerWorld;
+import net.minecraft.world.World;
+import net.minecraft.world.server.ServerWorld;
+import software.bernie.geckolib3.core.IAnimatable;
+import software.bernie.geckolib3.core.manager.AnimationData;
+import software.bernie.geckolib3.core.manager.AnimationFactory;
+import software.bernie.geckolib3.util.GeckoLibUtil;
import software.bluelib.interfaces.variant.IVariantEntity;
import software.bluelib.utils.ParameterUtils;
+import javax.annotation.Nullable;
+
/**
- * A {@code DragonEntity} class representing a dragon entity in the game, which extends {@link TamableAnimal}
- * and implements {@link IVariantEntity} and {@link GeoEntity}.
+ * A {@code DragonEntity} class representing a dragon entity in the game, which extends {@link TameableEntity}
+ * and implements {@link IVariantEntity} and {@link IAnimatable}.
*
* This class manages the dragon's variant system, its data synchronization, and integrates with the GeckoLib
* animation system.
@@ -34,9 +38,9 @@
* Key Methods:
*
*
{@link #defineSynchedData()} - Defines the synchronized data for the dragon entity, including its variant.
- *
{@link #addAdditionalSaveData(CompoundTag)} - Adds custom data to the entity's NBT for saving.
- *
{@link #readAdditionalSaveData(CompoundTag)} - Reads custom data from the entity's NBT for loading.
- *
{@link #finalizeSpawn(ServerLevelAccessor, DifficultyInstance, MobSpawnType, SpawnGroupData, CompoundTag)} - Finalizes the spawning process and sets up parameters.
+ *
{@link #addAdditionalSaveData(CompoundNBT)} - Adds custom data to the entity's NBT for saving.
+ *
{@link #readAdditionalSaveData(CompoundNBT)} - Reads custom data from the entity's NBT for loading.
+ *
{@link #finalizeSpawn(IServerWorld, DifficultyInstance, SpawnReason, ILivingEntityData, CompoundNBT)} - Finalizes the spawning process and sets up parameters.
*
{@link #setVariantName(String)} - Sets the variant name of the dragon.
*
{@link #getVariantName()} - Retrieves the current variant name of the dragon.
*
@@ -46,7 +50,7 @@
* @Co-author Dan
* @since 1.0.0
*/
-public class DragonEntity extends TamableAnimal implements IVariantEntity, GeoEntity {
+public class DragonEntity extends TameableEntity implements IVariantEntity, IAnimatable {
/**
* Entity data accessor for the variant of the dragon.
*
@@ -55,7 +59,7 @@ public class DragonEntity extends TamableAnimal implements IVariantEntity, GeoEn
* @Co-author MeAlam, Dan
* @since 1.0.0
*/
- public static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(DragonEntity.class, EntityDataSerializers.STRING);
+ public static final DataParameter VARIANT = EntityDataManager.defineId(DragonEntity.class, DataSerializers.STRING);
/**
* The name of the entity.
@@ -68,20 +72,20 @@ public class DragonEntity extends TamableAnimal implements IVariantEntity, GeoEn
* Constructs a new {@link DragonEntity} instance with the specified entity type and level.
*
* @param pEntityType {@link EntityType} - The type of the entity.
- * @param pLevel {@link Level} - The level in which the entity is created.
+ * @param pLevel {@link World} - The level in which the entity is created.
*
* @since 1.0.0
* @author MeAlam
* @Co-author Dan
*/
- public DragonEntity(EntityType extends TamableAnimal> pEntityType, Level pLevel) {
+ public DragonEntity(EntityType extends TameableEntity> pEntityType, World pLevel) {
super(pEntityType, pLevel);
}
/**
* Defines the synchronized data for this dragon entity, including the variant.
*
- * This method initializes the {@link EntityDataAccessor} to handle the variant data.
+ * This method initializes the {@link DataParameter} to handle the variant data.
*
*
* @since 1.0.0
@@ -100,14 +104,14 @@ protected void defineSynchedData() {
* This method stores the variant name in the NBT data so it can be restored when loading the entity.
*
*
- * @param pCompound {@link CompoundTag} - The NBT tag to which data should be added.
+ * @param pCompound {@link CompoundNBT} - The NBT tag to which data should be added.
*
* @since 1.0.0
* @author MeAlam
* @Co-author Dan
*/
@Override
- public void addAdditionalSaveData(@NotNull CompoundTag pCompound) {
+ public void addAdditionalSaveData(CompoundNBT pCompound) {
super.addAdditionalSaveData(pCompound);
pCompound.putString("Variant", getVariantName());
}
@@ -118,14 +122,14 @@ public void addAdditionalSaveData(@NotNull CompoundTag pCompound) {
* This method retrieves the variant name from the NBT data and sets it for the entity.
*
*
- * @param pCompound {@link CompoundTag} - The NBT tag from which data should be read.
+ * @param pCompound {@link CompoundNBT} - The NBT tag from which data should be read.
*
* @since 1.0.0
* @author MeAlam
* @Co-author Dan
*/
@Override
- public void readAdditionalSaveData(@NotNull CompoundTag pCompound) {
+ public void readAdditionalSaveData(CompoundNBT pCompound) {
super.readAdditionalSaveData(pCompound);
this.setVariantName(pCompound.getString("Variant"));
}
@@ -136,19 +140,19 @@ public void readAdditionalSaveData(@NotNull CompoundTag pCompound) {
* This method sets up the variant for the entity and connects parameters if needed.
*
*
- * @param pLevel {@link ServerLevelAccessor} - The level in which the entity is spawned.
+ * @param pLevel {@link IServerWorld} - The level in which the entity is spawned.
* @param pDifficulty {@link DifficultyInstance} - The difficulty instance for spawning.
- * @param pReason {@link MobSpawnType} - The reason for spawning the entity.
- * @param pSpawnData {@link SpawnGroupData} - Data related to the spawn.
- * @param pDataTag {@link CompoundTag} - Additional data for spawning.
- * @return {@link SpawnGroupData} - Updated spawn data.
+ * @param pReason {@link SpawnReason} - The reason for spawning the entity.
+ * @param pSpawnData {@link ILivingEntityData} - Data related to the spawn.
+ * @param pDataTag {@link CompoundNBT} - Additional data for spawning.
+ * @return {@link ILivingEntityData} - Updated spawn data.
*
* @since 1.0.0
* @author MeAlam
* @Co-author Dan
*/
@Override
- public SpawnGroupData finalizeSpawn(@NotNull ServerLevelAccessor pLevel, @NotNull DifficultyInstance pDifficulty, @NotNull MobSpawnType pReason, @Nullable SpawnGroupData pSpawnData, @Nullable CompoundTag pDataTag) {
+ public ILivingEntityData finalizeSpawn(IServerWorld pLevel, DifficultyInstance pDifficulty, SpawnReason pReason, @Nullable ILivingEntityData pSpawnData, @Nullable CompoundNBT pDataTag) {
if (getVariantName() == null || getVariantName().isEmpty()) {
this.setVariantName(getRandomVariant(getEntityVariants(entityName), "normal"));
ParameterUtils.ParameterBuilder.forVariant(entityName,this.getVariantName())
@@ -191,30 +195,27 @@ public String getVariantName() {
* All Code below this Fragment is not Library Related!!!
*/
- private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
+ public AnimationFactory factory = GeckoLibUtil.createFactory(this);
- public static AttributeSupplier.Builder createAttributes() {
- return Mob.createMobAttributes()
- .add(Attributes.MOVEMENT_SPEED, 0.3)
- .add(Attributes.MAX_HEALTH, 10)
- .add(Attributes.ARMOR, 0)
- .add(Attributes.ATTACK_DAMAGE, 3)
- .add(Attributes.FOLLOW_RANGE, 16)
- .add(Attributes.FLYING_SPEED, 0.3);
+ public static AttributeModifierMap.MutableAttribute createAttributes() {
+ return TameableEntity.createMobAttributes()
+ .add(Attributes.MAX_HEALTH, 10.0D)
+ .add(Attributes.MOVEMENT_SPEED, 0.3D)
+ .add(Attributes.FLYING_SPEED, 0.3D)
+ .add(Attributes.FOLLOW_RANGE, 16.0D);
}
+ @Nullable
@Override
- public void registerControllers(AnimatableManager.ControllerRegistrar pControllerRegistrar) {
+ public AgeableEntity getBreedOffspring(ServerWorld serverWorld, AgeableEntity ageableEntity) {
+ return null;
}
@Override
- public AnimatableInstanceCache getAnimatableInstanceCache() {
- return cache;
- }
+ public void registerControllers(AnimationData data) {}
- @Nullable
@Override
- public AgeableMob getBreedOffspring(@NotNull ServerLevel pLevel, @NotNull AgeableMob pOtherParent) {
- return null;
+ public AnimationFactory getFactory() {
+ return factory;
}
}
diff --git a/Forge/src/main/java/software/bluelib/example/entity/dragon/DragonModel.java b/Forge/src/main/java/software/bluelib/example/entity/dragon/DragonModel.java
index 67091901..2bfba12f 100644
--- a/Forge/src/main/java/software/bluelib/example/entity/dragon/DragonModel.java
+++ b/Forge/src/main/java/software/bluelib/example/entity/dragon/DragonModel.java
@@ -2,28 +2,28 @@
package software.bluelib.example.entity.dragon;
-import net.minecraft.resources.ResourceLocation;
-import software.bernie.geckolib.model.GeoModel;
+import net.minecraft.util.ResourceLocation;
+import software.bernie.geckolib3.model.AnimatedGeoModel;
import software.bluelib.BlueLib;
-public class DragonModel extends GeoModel {
+public class DragonModel extends AnimatedGeoModel {
// Get the Model Location
@Override
- public ResourceLocation getModelResource(DragonEntity pObject) {
+ public ResourceLocation getModelLocation(DragonEntity pObject) {
return new ResourceLocation(BlueLib.MODID, "geo/dragon.geo.json");
}
// Get the Texture Location
@Override
- public ResourceLocation getTextureResource(DragonEntity pObject) {
+ public ResourceLocation getTextureLocation(DragonEntity pObject) {
return pObject.getTextureLocation(BlueLib.MODID, "textures/entity/" + pObject.entityName + "/" + pObject.getVariantName() + ".png");
}
// Get the Animation Location
@Override
- public ResourceLocation getAnimationResource(DragonEntity pAnimatable) {
+ public ResourceLocation getAnimationFileLocation(DragonEntity pAnimatable) {
return new ResourceLocation(BlueLib.MODID, "animations/dragon.animation.json");
}
}
diff --git a/Forge/src/main/java/software/bluelib/example/entity/dragon/DragonRender.java b/Forge/src/main/java/software/bluelib/example/entity/dragon/DragonRender.java
index c770ac48..05be2d19 100644
--- a/Forge/src/main/java/software/bluelib/example/entity/dragon/DragonRender.java
+++ b/Forge/src/main/java/software/bluelib/example/entity/dragon/DragonRender.java
@@ -2,13 +2,13 @@
package software.bluelib.example.entity.dragon;
-import net.minecraft.client.renderer.entity.EntityRendererProvider;
-import software.bernie.geckolib.renderer.GeoEntityRenderer;
+import net.minecraft.client.renderer.entity.EntityRendererManager;
+import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer;
public class DragonRender extends GeoEntityRenderer {
// Render the entity
- public DragonRender(EntityRendererProvider.Context pRenderManager) {
+ public DragonRender(EntityRendererManager pRenderManager) {
super(pRenderManager, new DragonModel());
}
}
diff --git a/Forge/src/main/java/software/bluelib/example/entity/rex/RexEntity.java b/Forge/src/main/java/software/bluelib/example/entity/rex/RexEntity.java
index fcb85a52..cbdc9d07 100644
--- a/Forge/src/main/java/software/bluelib/example/entity/rex/RexEntity.java
+++ b/Forge/src/main/java/software/bluelib/example/entity/rex/RexEntity.java
@@ -2,29 +2,33 @@
package software.bluelib.example.entity.rex;
-import net.minecraft.nbt.CompoundTag;
-import net.minecraft.network.syncher.EntityDataAccessor;
-import net.minecraft.network.syncher.EntityDataSerializers;
-import net.minecraft.network.syncher.SynchedEntityData;
-import net.minecraft.server.level.ServerLevel;
+import net.minecraft.entity.AgeableEntity;
+import net.minecraft.entity.EntityType;
+import net.minecraft.entity.ILivingEntityData;
+import net.minecraft.entity.SpawnReason;
+import net.minecraft.entity.ai.attributes.AttributeModifierMap;
+import net.minecraft.entity.ai.attributes.Attributes;
+import net.minecraft.entity.passive.TameableEntity;
+import net.minecraft.nbt.CompoundNBT;
+import net.minecraft.network.datasync.DataParameter;
+import net.minecraft.network.datasync.DataSerializers;
+import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.world.DifficultyInstance;
-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.level.Level;
-import net.minecraft.world.level.ServerLevelAccessor;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import software.bernie.geckolib.animatable.GeoEntity;
-import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
-import software.bernie.geckolib.core.animation.AnimatableManager;
-import software.bernie.geckolib.util.GeckoLibUtil;
+import net.minecraft.world.IServerWorld;
+import net.minecraft.world.World;
+import net.minecraft.world.server.ServerWorld;
+import software.bernie.geckolib3.core.IAnimatable;
+import software.bernie.geckolib3.core.manager.AnimationData;
+import software.bernie.geckolib3.core.manager.AnimationFactory;
+import software.bernie.geckolib3.util.GeckoLibUtil;
import software.bluelib.interfaces.variant.IVariantEntity;
import software.bluelib.utils.ParameterUtils;
+import javax.annotation.Nullable;
+
/**
- * A {@code RexEntity} class representing a Rex entity in the game, which extends {@link TamableAnimal}
- * and implements {@link IVariantEntity} and {@link GeoEntity}.
+ * A {@code RexEntity} class representing a Rex entity in the game, which extends {@link TameableEntity}
+ * and implements {@link IVariantEntity} and {@link IAnimatable}.
*
* This class manages the rex's variant system, its data synchronization, and integrates with the GeckoLib
* animation system.
@@ -34,9 +38,9 @@
* Key Methods:
*
*
{@link #defineSynchedData()} - Defines the synchronized data for the rex entity, including its variant.
- *
{@link #addAdditionalSaveData(CompoundTag)} - Adds custom data to the entity's NBT for saving.
- *
{@link #readAdditionalSaveData(CompoundTag)} - Reads custom data from the entity's NBT for loading.
- *
{@link #finalizeSpawn(ServerLevelAccessor, DifficultyInstance, MobSpawnType, SpawnGroupData, CompoundTag)} - Finalizes the spawning process and sets up parameters.
+ *
{@link #addAdditionalSaveData(CompoundNBT)} - Adds custom data to the entity's NBT for saving.
+ *
{@link #readAdditionalSaveData(CompoundNBT)} - Reads custom data from the entity's NBT for loading.
+ *
{@link #finalizeSpawn(IServerWorld, DifficultyInstance, SpawnReason, ILivingEntityData, CompoundNBT)} - Finalizes the spawning process and sets up parameters.
*
{@link #setVariantName(String)} - Sets the variant name of the rex.
*
{@link #getVariantName()} - Retrieves the current variant name of the rex.
*
@@ -46,7 +50,7 @@
* @Co-author Dan
* @since 1.0.0
*/
-public class RexEntity extends TamableAnimal implements IVariantEntity, GeoEntity {
+public class RexEntity extends TameableEntity implements IVariantEntity, IAnimatable {
/**
* Entity data accessor for the variant of the rex.
*
@@ -55,7 +59,7 @@ public class RexEntity extends TamableAnimal implements IVariantEntity, GeoEntit
* @Co-author MeAlam, Dan
* @since 1.0.0
*/
- public static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(RexEntity.class, EntityDataSerializers.STRING);
+ public static final DataParameter VARIANT = EntityDataManager.defineId(RexEntity.class, DataSerializers.STRING);
/**
* The name of the entity.
@@ -68,20 +72,20 @@ public class RexEntity extends TamableAnimal implements IVariantEntity, GeoEntit
* Constructs a new {@link RexEntity} instance with the specified entity type and level.
*
* @param pEntityType {@link EntityType} - The type of the entity.
- * @param pLevel {@link Level} - The level in which the entity is created.
+ * @param pLevel {@link World} - The level in which the entity is created.
*
* @since 1.0.0
* @author MeAlam
* @Co-author Dan
*/
- public RexEntity(EntityType extends TamableAnimal> pEntityType, Level pLevel) {
+ public RexEntity(EntityType extends TameableEntity> pEntityType, World pLevel) {
super(pEntityType, pLevel);
}
/**
* Defines the synchronized data for this rex entity, including the variant.
*
- * This method initializes the {@link EntityDataAccessor} to handle the variant data.
+ * This method initializes the {@link DataParameter} to handle the variant data.
*
*
* @since 1.0.0
@@ -100,14 +104,14 @@ protected void defineSynchedData() {
* This method stores the variant name in the NBT data so it can be restored when loading the entity.
*
*
- * @param pCompound {@link CompoundTag} - The NBT tag to which data should be added.
+ * @param pCompound {@link CompoundNBT} - The NBT tag to which data should be added.
*
* @since 1.0.0
* @author MeAlam
* @Co-author Dan
*/
@Override
- public void addAdditionalSaveData(@NotNull CompoundTag pCompound) {
+ public void addAdditionalSaveData(CompoundNBT pCompound) {
super.addAdditionalSaveData(pCompound);
pCompound.putString("Variant", getVariantName());
}
@@ -118,14 +122,14 @@ public void addAdditionalSaveData(@NotNull CompoundTag pCompound) {
* This method retrieves the variant name from the NBT data and sets it for the entity.
*
*
- * @param pCompound {@link CompoundTag} - The NBT tag from which data should be read.
+ * @param pCompound {@link CompoundNBT} - The NBT tag from which data should be read.
*
* @since 1.0.0
* @author MeAlam
* @Co-author Dan
*/
@Override
- public void readAdditionalSaveData(@NotNull CompoundTag pCompound) {
+ public void readAdditionalSaveData(CompoundNBT pCompound) {
super.readAdditionalSaveData(pCompound);
this.setVariantName(pCompound.getString("Variant"));
}
@@ -136,19 +140,19 @@ public void readAdditionalSaveData(@NotNull CompoundTag pCompound) {
* This method sets up the variant for the entity and connects parameters if needed.
*
*
- * @param pLevel {@link ServerLevelAccessor} - The level in which the entity is spawned.
+ * @param pLevel {@link IServerWorld} - The level in which the entity is spawned.
* @param pDifficulty {@link DifficultyInstance} - The difficulty instance for spawning.
- * @param pReason {@link MobSpawnType} - The reason for spawning the entity.
- * @param pSpawnData {@link SpawnGroupData} - Data related to the spawn.
- * @param pDataTag {@link CompoundTag} - Additional data for spawning.
- * @return {@link SpawnGroupData} - Updated spawn data.
+ * @param pReason {@link SpawnReason} - The reason for spawning the entity.
+ * @param pSpawnData {@link ILivingEntityData} - Data related to the spawn.
+ * @param pDataTag {@link CompoundNBT} - Additional data for spawning.
+ * @return {@link ILivingEntityData} - Updated spawn data.
*
* @since 1.0.0
* @author MeAlam
* @Co-author Dan
*/
@Override
- public SpawnGroupData finalizeSpawn(@NotNull ServerLevelAccessor pLevel, @NotNull DifficultyInstance pDifficulty, @NotNull MobSpawnType pReason, @Nullable SpawnGroupData pSpawnData, @Nullable CompoundTag pDataTag) {
+ public ILivingEntityData finalizeSpawn(IServerWorld pLevel, DifficultyInstance pDifficulty, SpawnReason pReason, @Nullable ILivingEntityData pSpawnData, @Nullable CompoundNBT pDataTag) {
if (getVariantName() == null || getVariantName().isEmpty()) {
this.setVariantName(getRandomVariant(getEntityVariants(entityName), "normal"));
ParameterUtils.ParameterBuilder.forVariant(entityName,this.getVariantName())
@@ -191,10 +195,10 @@ public String getVariantName() {
* All Code below this Fragment is not Library Related!!!
*/
- private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
+ public AnimationFactory factory = GeckoLibUtil.createFactory(this);
- public static AttributeSupplier.Builder createAttributes() {
- return Mob.createMobAttributes()
+ public static AttributeModifierMap.MutableAttribute createAttributes() {
+ return TameableEntity.createMobAttributes()
.add(Attributes.MOVEMENT_SPEED, 0.3)
.add(Attributes.MAX_HEALTH, 10)
.add(Attributes.ARMOR, 0)
@@ -204,17 +208,16 @@ public static AttributeSupplier.Builder createAttributes() {
}
@Override
- public void registerControllers(AnimatableManager.ControllerRegistrar pControllerRegistrar) {
- }
+ public void registerControllers(AnimationData data) {}
@Override
- public AnimatableInstanceCache getAnimatableInstanceCache() {
- return cache;
+ public AnimationFactory getFactory() {
+ return factory;
}
@Nullable
@Override
- public AgeableMob getBreedOffspring(@NotNull ServerLevel pLevel, @NotNull AgeableMob pOtherParent) {
+ public AgeableEntity getBreedOffspring(ServerWorld serverWorld, AgeableEntity ageableEntity) {
return null;
}
}
diff --git a/Forge/src/main/java/software/bluelib/example/entity/rex/RexModel.java b/Forge/src/main/java/software/bluelib/example/entity/rex/RexModel.java
index 6084892c..c65b1e38 100644
--- a/Forge/src/main/java/software/bluelib/example/entity/rex/RexModel.java
+++ b/Forge/src/main/java/software/bluelib/example/entity/rex/RexModel.java
@@ -2,28 +2,28 @@
package software.bluelib.example.entity.rex;
-import net.minecraft.resources.ResourceLocation;
-import software.bernie.geckolib.model.GeoModel;
+import net.minecraft.util.ResourceLocation;
+import software.bernie.geckolib3.model.AnimatedGeoModel;
import software.bluelib.BlueLib;
-public class RexModel extends GeoModel {
+public class RexModel extends AnimatedGeoModel {
// Get the Model Location
@Override
- public ResourceLocation getModelResource(RexEntity pObject) {
+ public ResourceLocation getModelLocation(RexEntity pObject) {
return new ResourceLocation(BlueLib.MODID, "geo/rex.geo.json");
}
// Get the Texture Location
@Override
- public ResourceLocation getTextureResource(RexEntity pObject) {
+ public ResourceLocation getTextureLocation(RexEntity pObject) {
return pObject.getTextureLocation(BlueLib.MODID, "textures/entity/" + pObject.entityName + "/" + pObject.getVariantName() + ".png");
}
// Get the Animation Location
@Override
- public ResourceLocation getAnimationResource(RexEntity pAnimatable) {
+ public ResourceLocation getAnimationFileLocation(RexEntity pAnimatable) {
return new ResourceLocation(BlueLib.MODID, "animations/rex.animation.json");
}
}
diff --git a/Forge/src/main/java/software/bluelib/example/entity/rex/RexRender.java b/Forge/src/main/java/software/bluelib/example/entity/rex/RexRender.java
index 776c5920..8220b4cb 100644
--- a/Forge/src/main/java/software/bluelib/example/entity/rex/RexRender.java
+++ b/Forge/src/main/java/software/bluelib/example/entity/rex/RexRender.java
@@ -2,13 +2,12 @@
package software.bluelib.example.entity.rex;
-import net.minecraft.client.renderer.entity.EntityRendererProvider;
-import software.bernie.geckolib.renderer.GeoEntityRenderer;
+import net.minecraft.client.renderer.entity.EntityRendererManager;
+import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer;
public class RexRender extends GeoEntityRenderer {
-
// Render the entity
- public RexRender(EntityRendererProvider.Context pRenderManager) {
+ public RexRender(EntityRendererManager pRenderManager) {
super(pRenderManager, new RexModel());
}
}
diff --git a/Forge/src/main/java/software/bluelib/example/event/ClientEvents.java b/Forge/src/main/java/software/bluelib/example/event/ClientEvents.java
index 187fc9ab..ac48aa2f 100644
--- a/Forge/src/main/java/software/bluelib/example/event/ClientEvents.java
+++ b/Forge/src/main/java/software/bluelib/example/event/ClientEvents.java
@@ -2,8 +2,8 @@
package software.bluelib.example.event;
-import net.minecraft.client.renderer.entity.EntityRenderers;
import net.minecraftforge.api.distmarker.Dist;
+import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Mod;
import software.bluelib.BlueLib;
import software.bluelib.example.entity.dragon.DragonRender;
@@ -15,7 +15,7 @@ public class ClientEvents {
public static void registerRenderers() {
// Register the renderer for all the Entities
- EntityRenderers.register(ModEntities.DRAGON.get(), DragonRender::new);
- EntityRenderers.register(ModEntities.REX.get(), RexRender::new);
+ RenderingRegistry.registerEntityRenderingHandler(ModEntities.DRAGON.get(), DragonRender::new);
+ RenderingRegistry.registerEntityRenderingHandler(ModEntities.REX.get(), RexRender::new);
}
}
diff --git a/Forge/src/main/java/software/bluelib/example/event/ReloadHandler.java b/Forge/src/main/java/software/bluelib/example/event/ReloadHandler.java
index 24ed12b0..257878ce 100644
--- a/Forge/src/main/java/software/bluelib/example/event/ReloadHandler.java
+++ b/Forge/src/main/java/software/bluelib/example/event/ReloadHandler.java
@@ -4,9 +4,8 @@
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.event.AddReloadListenerEvent;
-import net.minecraftforge.event.server.ServerStartingEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
-import net.minecraftforge.fml.common.Mod;
+import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import software.bluelib.BlueLib;
import software.bluelib.event.ReloadEventHandler;
@@ -26,7 +25,7 @@
*
* Key Methods:
*
- *
{@link #onServerStart(ServerStartingEvent)} - Handles server starting events to initialize entity variants.
+ *
{@link #onServerStart(FMLServerStartingEvent)} - Handles server starting events to initialize entity variants.
*
{@link #onReload(AddReloadListenerEvent)} - Handles reload events to refresh entity variants.
*
{@link #LoadEntityVariants(MinecraftServer)} - Loads entity variants from JSON files into the server.
*
@@ -53,14 +52,14 @@ public class ReloadHandler extends ReloadEventHandler {
* Handles the server starting event to initialize the {@link MinecraftServer} instance
* and load entity variants.
*
- * @param pEvent {@link ServerStartingEvent} - The event triggered when the server starts.
+ * @param pEvent {@link FMLServerStartingEvent} - The event triggered when the server starts.
*
* @since 1.0.0
* @author MeAlam
* @Co-author Dan
*/
@SubscribeEvent
- public static void onServerStart(ServerStartingEvent pEvent) {
+ public static void onServerStart(FMLServerStartingEvent pEvent) {
server = pEvent.getServer();
ReloadHandler.LoadEntityVariants(server);
}
diff --git a/Forge/src/main/java/software/bluelib/example/init/ModEntities.java b/Forge/src/main/java/software/bluelib/example/init/ModEntities.java
index 2825e2fe..8ee739dc 100644
--- a/Forge/src/main/java/software/bluelib/example/init/ModEntities.java
+++ b/Forge/src/main/java/software/bluelib/example/init/ModEntities.java
@@ -2,41 +2,35 @@
package software.bluelib.example.init;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.world.entity.EntityType;
-import net.minecraft.world.entity.MobCategory;
+import net.minecraft.entity.EntityClassification;
+import net.minecraft.entity.EntityType;
+import net.minecraft.util.ResourceLocation;
import net.minecraftforge.eventbus.api.IEventBus;
+import net.minecraftforge.fml.RegistryObject;
+import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
-import net.minecraftforge.registries.RegistryObject;
import software.bluelib.BlueLib;
import software.bluelib.example.entity.dragon.DragonEntity;
import software.bluelib.example.entity.rex.RexEntity;
+@Mod.EventBusSubscriber(modid = BlueLib.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ModEntities {
public static final DeferredRegister> REGISTER =
- DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, BlueLib.MODID);
+ DeferredRegister.create(ForgeRegistries.ENTITIES, BlueLib.MODID);
// List of Entities
public static final RegistryObject> DRAGON =
- REGISTER.register("example_one", () -> EntityType.Builder.of(DragonEntity::new, MobCategory.AMBIENT)
- .setShouldReceiveVelocityUpdates(true)
- .setTrackingRange(64)
- .setUpdateInterval(3)
- .fireImmune()
+ REGISTER.register("dragon", () -> EntityType.Builder.of(DragonEntity::new, EntityClassification.CREATURE)
.sized(0.6f, 1.8f)
.build(new ResourceLocation(BlueLib.MODID, "dragon").toString()));
public static final RegistryObject> REX =
- REGISTER.register("example_two", () -> EntityType.Builder.of(RexEntity::new, MobCategory.AMBIENT)
- .setShouldReceiveVelocityUpdates(true)
- .setTrackingRange(64)
- .setUpdateInterval(3)
- .fireImmune()
+ REGISTER.register("rex", () -> EntityType.Builder.of(RexEntity::new, EntityClassification.CREATURE)
.sized(0.6f, 1.8f)
.build(new ResourceLocation(BlueLib.MODID, "rex").toString()));
public static void register(IEventBus eventBus) {
REGISTER.register(eventBus);
}
-}
+}
\ No newline at end of file
diff --git a/Forge/src/main/java/software/bluelib/interfaces/variant/IVariantEntity.java b/Forge/src/main/java/software/bluelib/interfaces/variant/IVariantEntity.java
index 5273ec4e..e62ae544 100644
--- a/Forge/src/main/java/software/bluelib/interfaces/variant/IVariantEntity.java
+++ b/Forge/src/main/java/software/bluelib/interfaces/variant/IVariantEntity.java
@@ -4,6 +4,8 @@
import software.bluelib.interfaces.variant.base.IVariantEntityBase;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Random;
@@ -47,7 +49,7 @@ public interface IVariantEntity extends IVariantEntityBase {
* @since 1.0.0
*/
default String getRandomVariant(List pVariantNamesList, String pDefaultVariant) {
- List spawnableVariants = List.copyOf(pVariantNamesList);
+ List spawnableVariants = Collections.unmodifiableList(new ArrayList<>(pVariantNamesList));
if (!spawnableVariants.isEmpty()) {
return spawnableVariants.get(random.nextInt(spawnableVariants.size()));
}
diff --git a/Forge/src/main/java/software/bluelib/interfaces/variant/base/IVariantEntityBase.java b/Forge/src/main/java/software/bluelib/interfaces/variant/base/IVariantEntityBase.java
index 3b905d28..b3b31e69 100644
--- a/Forge/src/main/java/software/bluelib/interfaces/variant/base/IVariantEntityBase.java
+++ b/Forge/src/main/java/software/bluelib/interfaces/variant/base/IVariantEntityBase.java
@@ -2,7 +2,7 @@
package software.bluelib.interfaces.variant.base;
-import net.minecraft.resources.ResourceLocation;
+import net.minecraft.util.ResourceLocation;
import software.bluelib.entity.variant.VariantLoader;
import software.bluelib.entity.variant.VariantParameter;
diff --git a/Forge/src/main/java/software/bluelib/json/JSONLoader.java b/Forge/src/main/java/software/bluelib/json/JSONLoader.java
index f046903c..41dbfee7 100644
--- a/Forge/src/main/java/software/bluelib/json/JSONLoader.java
+++ b/Forge/src/main/java/software/bluelib/json/JSONLoader.java
@@ -4,16 +4,17 @@
import com.google.gson.Gson;
import com.google.gson.JsonObject;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.server.packs.resources.Resource;
-import net.minecraft.server.packs.resources.ResourceManager;
+import com.google.gson.JsonSyntaxException;
+import net.minecraft.resources.IResource;
+import net.minecraft.resources.IResourceManager;
+import net.minecraft.util.ResourceLocation;
import software.bluelib.exception.CouldNotLoadJSON;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
-import java.util.Optional;
/**
* The {@code JSONLoader} class is responsible for loading and parsing JSON data from
@@ -22,7 +23,7 @@
*
* Key methods:
*
- *
{@link #loadJson(ResourceLocation, ResourceManager)} - Loads a JSON resource.
+ *
{@link #loadJson(ResourceLocation, IResourceManager)} - Loads a JSON resource.
*
* @author MeAlam
* @Co-author Dan
@@ -42,28 +43,30 @@ public class JSONLoader {
* in a Minecraft mod environment.
*
- * This class serves as the entry point for the {@link BlueLib} mod, handling initialization by registering event handlers
- * and setting up necessary configurations. For more details, refer to the BlueLib Wiki.
- *
- *
- *
- * Key Methods:
- *
- *
{@link #BlueLib(IEventBus)} - Constructs the {@link BlueLib} instance and registers the mod event bus.
- *
{@link #onLoadComplete(FMLLoadCompleteEvent)} - Handles the event when the mod loading is complete and prints a thank-you message if in developer mode.
- *
{@link #isDeveloperMode()} - Determines if the mod is running in developer mode.
- *
- *
- *
- * @see BlueLib Wiki
- * @author MeAlam, Dan
- * @Co-author All Contributors of BlueLib!
- * @since 1.0.0
- */
-@Mod(BlueLib.MODID)
-public class BlueLib {
-
- /**
- * A {@link ScheduledExecutorService} used for scheduling tasks, such as printing messages after a delay.
- *
- * This is initialized with a single-threaded pool to handle delayed tasks in a separate thread.
- *
- * @Co-author MeAlam, Dan
- * @since 1.0.0
- */
- private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
-
- /**
- * The Mod ID for {@link BlueLib}. This serves as a unique identifier for the mod.
- * @Co-author MeAlam, Dan
- * @since 1.0.0
- */
- public static final String MODID = "bluelib";
-
- // public static final Logger LOGGER = LogUtils.getLogger();
-
- /**
- * Constructs a new {@link BlueLib} instance and registers the mod event bus.
- *
- * @param pModEventBus {@link IEventBus} - The event bus to which the mod will register its event handlers.
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
- public BlueLib(IEventBus pModEventBus) {
- pModEventBus.register(this);
- if (isDeveloperMode()) {
- ModEntities.REGISTRY.register(pModEventBus);
-
- pModEventBus.addListener(ClientEvents::registerAttributes);
- pModEventBus.addListener(ClientEvents::registerRenderers);
- }
- }
-
- /**
- * Handles the {@link FMLLoadCompleteEvent}, which is triggered when the mod loading process is complete.
- *
- * If the mod is running in developer mode, it schedules a task to print a thank-you message to the console after a short delay.
- *
- *
- * @param pEvent {@link FMLLoadCompleteEvent} - The event triggered upon the completion of the mod loading process.
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
- @SubscribeEvent
- public void onLoadComplete(FMLLoadCompleteEvent pEvent) {
- if (isDeveloperMode()) {
- scheduler.schedule(() -> {
- System.out.println("""
-
- **************************************************
- * *
- * Thank you for using BlueLib! *
- * We appreciate your support. *
- * *
- **************************************************
- """);
- scheduler.shutdown();
- }, 3, TimeUnit.SECONDS);
- }
- }
-
- /**
- * Checks if the mod is running in developer mode.
- *
- * Developer mode is determined by checking if the mod is not running in a production environment.
- *
- *
- * @return {@code true} if the mod is running in developer mode, {@code false} otherwise.
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
- static boolean isDeveloperMode() {
- return !FMLEnvironment.production;
- }
-}
diff --git a/NeoForge/src/main/java/software/bluelib/entity/variant/VariantLoader.java b/NeoForge/src/main/java/software/bluelib/entity/variant/VariantLoader.java
deleted file mode 100644
index 3dc0034b..00000000
--- a/NeoForge/src/main/java/software/bluelib/entity/variant/VariantLoader.java
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright (c) BlueLib. Licensed under the MIT License.
-
-package software.bluelib.entity.variant;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.server.packs.resources.ResourceManager;
-import software.bluelib.interfaces.variant.base.IVariantEntityBase;
-import software.bluelib.json.JSONLoader;
-import software.bluelib.json.JSONMerger;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * A {@link VariantLoader} class that loads and manages {@link VariantParameter} for entities by merging JSON data from multiple sources.
- *
- * Key Methods:
- *
- *
{@link #loadVariants(ResourceLocation, ResourceLocation, MinecraftServer, String)} - Loads and merges variant data from both the main mod and the latest datapack.
- *
{@link #getVariantsFromEntity(String)} - Retrieves the list of loaded {@link VariantParameter} for a specific entity.
- *
{@link #getVariantByName(String, String)} - Retrieves a specific {@link VariantParameter} by its name for a given entity.
- *
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
-public class VariantLoader implements IVariantEntityBase {
-
- /**
- * A {@link Map} to store loaded {@link VariantParameter} for each entity type.
- * @Co-author MeAlam, Dan
- * @since 1.0.0
- */
- private static final Map> entityVariantsMap = new HashMap<>();
-
- /**
- * A {@link JSONLoader} instance to load JSON data.
- * @Co-author MeAlam, Dan
- * @since 1.0.0
- */
- private static final JSONLoader jsonLoader = new JSONLoader();
-
- /**
- * A {@link JSONMerger} instance to merge JSON data.
- * @Co-author MeAlam, Dan
- * @since 1.0.0
- */
- private static final JSONMerger jsonMerger = new JSONMerger();
-
- /**
- * A {@code void} method that loads and merges variant data from both the Main Mod and the Latest Datapack.
- * Parses the merged data into {@link VariantParameter}.
- *
- * @param pJSONLocationMod {@link ResourceLocation} - The {@link ResourceLocation} of the Mod's JSON data.
- * @param pJSONLocationData {@link ResourceLocation} - The {@link ResourceLocation} of the Latest DataPack's JSON data.
- * @param pServer {@link MinecraftServer} - The {@link MinecraftServer} instance.
- * @param pEntityName {@link String} - The name of the entity whose variants should be cleared before loading new ones.
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
- public static void loadVariants(ResourceLocation pJSONLocationMod, ResourceLocation pJSONLocationData, MinecraftServer pServer, String pEntityName) {
- clearVariantsForEntity(pEntityName);
- ResourceManager resourceManager = pServer.getResourceManager();
- JsonObject mergedJsonObject = new JsonObject();
-
- JsonObject modJson = jsonLoader.loadJson(pJSONLocationMod, resourceManager);
- JsonObject dataJson = jsonLoader.loadJson(pJSONLocationData, resourceManager);
-
- jsonMerger.mergeJsonObjects(mergedJsonObject, modJson);
- jsonMerger.mergeJsonObjects(mergedJsonObject, dataJson);
-
- parseVariants(mergedJsonObject);
- }
-
- /**
- * A {@code void} method that clears variants for a specific entity type from the map.
- *
- * @param pEntityName {@link String} - The name of the entity whose variants should be cleared.
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
- private static void clearVariantsForEntity(String pEntityName) {
- entityVariantsMap.remove(pEntityName);
- }
-
- /**
- * A {@code void} method that parses the merged JSON data and converts it into {@link VariantParameter} instances.
- *
- * @param pJsonObject {@link JsonObject} - The merged {@link JsonObject} containing variant data.
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
- private static void parseVariants(JsonObject pJsonObject) {
- for (Map.Entry entry : pJsonObject.entrySet()) {
- String entityName = entry.getKey();
- JsonArray textureArray = entry.getValue().getAsJsonArray();
-
- List variantList = entityVariantsMap.computeIfAbsent(entityName, k -> new ArrayList<>());
-
- for (JsonElement variant : textureArray) {
- VariantParameter newVariant = getEntityVariant(entityName, variant.getAsJsonObject());
-
- boolean variantExists = variantList.stream()
- .anyMatch(v -> v.equals(newVariant));
-
- if (!variantExists) {
- variantList.add(newVariant);
- }
- }
- }
- }
-
- /**
- * A {@link VariantParameter} method that creates a new {@link VariantParameter} instance from a JSON object.
- *
- * @param pJsonKey {@link String} - The key associated with this variant.
- * @param pJsonObject {@link JsonObject} - The {@link JsonObject} containing the variant data.
- * @return A {@link VariantParameter} instance.
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
- private static VariantParameter getEntityVariant(String pJsonKey, JsonObject pJsonObject) {
- return new VariantParameter(pJsonKey, pJsonObject);
- }
-
- /**
- * A {@link List} method that retrieves the {@link List} of loaded {@link VariantParameter}
- * for a specific entity.
- *
- * @param pEntityName {@link String} - The name of the entity to retrieve variants for.
- * @return A {@link List} of {@link VariantParameter} instances for the specified entity.
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
- public static List getVariantsFromEntity(String pEntityName) {
- return entityVariantsMap.getOrDefault(pEntityName, new ArrayList<>());
- }
-
- /**
- * A {@link VariantParameter} method that retrieves a {@link VariantParameter} by its name for a specific entity.
- *
- * @param pEntityName {@link String} - The name of the entity to retrieve variants for.
- * @param pVariantName {@link String} - The name of the variant to retrieve.
- * @return The {@link VariantParameter} with the specified name, or {@code null} if not found.
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
- public static VariantParameter getVariantByName(String pEntityName, String pVariantName) {
- List variants = getVariantsFromEntity(pEntityName);
- for (VariantParameter variant : variants) {
- if (variant.getVariantName().equals(pVariantName)) {
- return variant;
- }
- }
- return null;
- }
-}
diff --git a/NeoForge/src/main/java/software/bluelib/entity/variant/VariantParameter.java b/NeoForge/src/main/java/software/bluelib/entity/variant/VariantParameter.java
deleted file mode 100644
index db3d3319..00000000
--- a/NeoForge/src/main/java/software/bluelib/entity/variant/VariantParameter.java
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright (c) BlueLib. Licensed under the MIT License.
-
-package software.bluelib.entity.variant;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import software.bluelib.entity.variant.base.ParameterBase;
-
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A {@code VariantParameter} class that represents the parameters associated with a specific variant of an entity.
- *
- * This class extends {@link ParameterBase} to store and manage variant-specific parameters parsed from a JSON object.
- *
- * The class is designed to handle various JSON element types, including {@code JsonPrimitive}, {@code JsonArray}, and {@code JsonObject}.
- *
- * Key Methods:
- *
- *
{@link #getJsonKey()} - Retrieves the key of the JSON object that identifies this entity.
- *
{@link #getVariantName()} - Retrieves the name of the variant.
- *
{@link #getParameter(String)} - Retrieves the value of a specific parameter by its key.
- *
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
-public class VariantParameter extends ParameterBase {
-
- /**
- * A {@link String} that represents the key of the JSON object that identifies this entity.
- *
- * This key is used to map the entity to its corresponding parameters within a {@link JsonObject}.
- *
- * @Co-author MeAlam, Dan
- * @since 1.0.0
- */
- private final String jsonKey;
-
- /**
- * Constructs a new {@code VariantParameter} instance by extracting parameters from a given JSON object.
- *
- * This constructor processes different types of {@link JsonElement} values:
- *
- *
{@code JsonPrimitive}: Stored directly as a string.
- *
{@code JsonArray}: Converts array elements into a single comma-separated string.
- *
{@code JsonObject}: Converts the nested JSON object to a string representation.
- *
{@code Other Types}: Stores "null" for unhandled JSON types.
- *
- *
- * @param pJsonKey {@link String} - The key that identifies this entity within the {@link JsonObject}.
- * @param pJsonObject {@link JsonObject} - The {@link JsonObject} containing the variant parameters.
- * @throws IllegalArgumentException if {@code pJsonKey} or {@code pJsonObject} is null.
- * @see ParameterBase
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
- public VariantParameter(String pJsonKey, JsonObject pJsonObject) {
- if (pJsonKey == null || pJsonObject == null) {
- throw new IllegalArgumentException("JSON key and object must not be null");
- }
- this.jsonKey = pJsonKey;
- Set> entryMap = pJsonObject.entrySet();
- for (Map.Entry entry : entryMap) {
- JsonElement element = entry.getValue();
- if (element.isJsonPrimitive()) {
- addParameter(entry.getKey(), element.getAsString());
- } else if (element.isJsonArray()) {
- StringBuilder arrayValues = new StringBuilder();
- element.getAsJsonArray().forEach(e -> arrayValues.append(e.getAsString()).append(","));
- if (!arrayValues.isEmpty()) {
- arrayValues.setLength(arrayValues.length() - 1);
- }
- addParameter(entry.getKey(), arrayValues.toString());
- } else if (element.isJsonObject()) {
- addParameter(entry.getKey(), element.toString());
- } else {
- addParameter(entry.getKey(), "null");
- }
- }
- }
-
- /**
- * A {@link String} method that returns the key of the {@link JsonObject} that identifies this entity.
- *
- * This key is typically used to retrieve or map the entity within a broader data structure.
- *
- * @return The key of the JSON object representing this entity.
- * @throws IllegalStateException if the key is unexpectedly null.
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
- public String getJsonKey() {
- if (this.jsonKey == null) {
- throw new IllegalStateException("JSON key should not be null");
- }
- return this.jsonKey;
- }
-
- /**
- * A {@link String} method that retrieves the name of the variant.
- *
- * The variant name is expected to be stored under the key {@code "variantName"} in the parameters/JSON Files.
- *
- * @return The name of the variant, or {@code null} if the variant name is not found.
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
- public String getVariantName() {
- return getParameter("variantName");
- }
-
- /**
- * A {@link String} method that retrieves the value of a specific parameter by its key.
- *
- * This method looks up the parameter's value within the internal data structure.
- *
- * @param pKey {@link String} - The key of the parameter to retrieve.
- * @return The value of the parameter, or {@code null} if the key does not exist.
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
- public String getParameter(String pKey) {
- return (String) super.getParameter(pKey);
- }
-}
diff --git a/NeoForge/src/main/java/software/bluelib/entity/variant/base/ParameterBase.java b/NeoForge/src/main/java/software/bluelib/entity/variant/base/ParameterBase.java
deleted file mode 100644
index 2f1af3a1..00000000
--- a/NeoForge/src/main/java/software/bluelib/entity/variant/base/ParameterBase.java
+++ /dev/null
@@ -1,179 +0,0 @@
-// Copyright (c) BlueLib. Licensed under the MIT License.
-
-package software.bluelib.entity.variant.base;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * An {@code Abstract base class} for managing a collection of parameters.
- *
- * Key Methods:
- *
- *
{@link #addParameter(String, Object)} - Adds a parameter to the collection.
- *
{@link #getParameter(String)} - Retrieves a parameter from the collection.
- *
{@link #removeParameter(String)} - Removes a parameter from the collection.
- *
{@link #getAllParameters()} - Returns all parameters in the collection.
- *
{@link #containsParameter(String)} - Checks if a parameter exists by its key.
- *
{@link #isEmpty()} - Checks if the collection of parameters is empty.
- *
{@link #clearParameters()} - Clears all parameters from the collection.
- *
{@link #getParameterCount()} - Returns the number of parameters in the collection.
- *
{@link #getParameterKeys()} - Returns a set of all parameter keys.
- *
{@link #getParameterValues()} - Returns a collection of all parameter values.
- *
{@link #updateParameter(String, Object)} - Updates the value of an existing parameter.
- *
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
-public abstract class ParameterBase {
-
- /**
- * A {@link Map} to store parameters as key-value pairs.
- * @Co-author MeAlam, Dan
- * @since 1.0.0
- */
- private final Map parameters = new HashMap<>();
-
- /**
- * A {@code void} method to add a parameter to the collection.
- *
- * @param pKey {@link String} - The key under which the parameter is stored.
- * @param pValue {@link Object} - The value of the parameter.
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
- protected void addParameter(String pKey, Object pValue) {
- parameters.put(pKey, pValue);
- }
-
- /**
- * An {@link Object} method to retrieve a parameter from the collection by its key.
- *
- * @param pKey {@link String} - The key of the parameter to retrieve.
- * @return The value associated with the key, or {@code null} if the key does not exist.
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
- protected Object getParameter(String pKey) {
- return parameters.get(pKey);
- }
-
- /**
- * A {@code Void} that removes a parameter from the collection by its key.
- *
- * @param pKey {@link String} - The key of the parameter to remove.
- * @author MeAlam
- * @Co-author Dan
- * @since 1.0.0
- */
- protected void removeParameter(String pKey) {
- parameters.remove(pKey);
- }
-
- /**
- * A {@link Map