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: *

@@ -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 pEntityType, Level pLevel) { + public DragonEntity(EntityType 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 pEntityType, Level pLevel) { + public RexEntity(EntityType 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. *

* @param pResourceLocation {@link ResourceLocation} - The {@link ResourceLocation} of the JSON resource. - * @param pResourceManager {@link ResourceManager} - The {@link ResourceManager} to load the resource. + * @param pResourceManager {@link IResourceManager} - The {@link IResourceManager} to load the resource. * @return The loaded {@link JsonObject}. * @throws CouldNotLoadJSON If the JSON could not be loaded. * @author MeAlam * @Co-author Dan * @since 1.0.0 */ - public JsonObject loadJson(ResourceLocation pResourceLocation, ResourceManager pResourceManager) throws CouldNotLoadJSON { + public JsonObject loadJson(ResourceLocation pResourceLocation, IResourceManager pResourceManager) throws CouldNotLoadJSON { try { - Optional resource = pResourceManager.getResource(pResourceLocation); + IResource resource = pResourceManager.getResource(pResourceLocation); - if (resource.isEmpty()) { - return new JsonObject(); - } - - try (InputStream inputStream = resource.get().open(); + try (InputStream inputStream = resource.getInputStream(); InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { return gson.fromJson(reader, JsonObject.class); } - } catch (IOException pException) { - throw new CouldNotLoadJSON("Failed to load JSON from resource: " + pResourceLocation + ". Error: " + pException.getMessage(), pResourceLocation.toString()); + } catch (IOException e) { + if (e instanceof FileNotFoundException) { + return new JsonObject(); // Return an empty JsonObject if the file is not found + } else { + throw new CouldNotLoadJSON("Failed to load JSON from resource: " + pResourceLocation + ". Error: " + e.getMessage(), pResourceLocation.toString()); + } + } catch (JsonSyntaxException e) { + throw new CouldNotLoadJSON("Malformed JSON at resource: " + pResourceLocation + ". Error: " + e.getMessage(), pResourceLocation.toString()); } } } diff --git a/Forge/src/main/java/software/bluelib/utils/ParameterUtils.java b/Forge/src/main/java/software/bluelib/utils/ParameterUtils.java index 3994cdf5..69e90b4d 100644 --- a/Forge/src/main/java/software/bluelib/utils/ParameterUtils.java +++ b/Forge/src/main/java/software/bluelib/utils/ParameterUtils.java @@ -2,8 +2,8 @@ package software.bluelib.utils; -import software.bluelib.entity.variant.VariantParameter; import software.bluelib.entity.variant.VariantLoader; +import software.bluelib.entity.variant.VariantParameter; import java.util.HashMap; import java.util.Map; diff --git a/NeoForge/.gitignore b/NeoForge/.gitignore deleted file mode 100644 index 31d25505..00000000 --- a/NeoForge/.gitignore +++ /dev/null @@ -1,26 +0,0 @@ -# eclipse -bin -*.launch -.settings -.metadata -.classpath -.project - -# idea -out -*.ipr -*.iws -*.iml -.idea - -# gradle -build -.gradle - -# other -eclipse -run -runs -run-data - -repo \ No newline at end of file diff --git a/NeoForge/build.gradle b/NeoForge/build.gradle deleted file mode 100644 index 9277256f..00000000 --- a/NeoForge/build.gradle +++ /dev/null @@ -1,114 +0,0 @@ - plugins { - id 'java-library' - id 'eclipse' - id 'idea' - id 'maven-publish' - id 'net.neoforged.gradle.userdev' version '7.0.97' -} - -version = mod_version -group = mod_group_id - -repositories { - maven { - url "https://cursemaven.com" - } - mavenCentral() - mavenLocal() -} - -base { - archivesName = "${mod_id}-neoforge-${minecraft_version}" -} - -java.toolchain.languageVersion = JavaLanguageVersion.of(17) - -//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg') -//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager - -runs { - configureEach { - systemProperty 'forge.logging.markers', 'REGISTRIES' - - // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels - systemProperty 'forge.logging.console.level', 'debug' - - modSource project.sourceSets.main - } - - client { - systemProperty 'forge.enabledGameTestNamespaces', project.mod_id - } - - server { - systemProperty 'forge.enabledGameTestNamespaces', project.mod_id - programArgument '--nogui' - } - - gameTestServer { - systemProperty 'forge.enabledGameTestNamespaces', project.mod_id - } - - data { - programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() - } -} - -sourceSets.main.resources { srcDir 'src/generated/resources' } - -configurations { - runtimeClasspath.extendsFrom localRuntime -} - -dependencies { - implementation "net.neoforged:neoforge:${neo_version}" - runtimeOnly "curse.maven:geckolib-388172:5188406" - compileOnly "curse.maven:geckolib-388172:5188406" -} - -jar { - manifest { - attributes([ - "Specification-Title" : mod_name, - "Specification-Vendor" : mod_authors, - "Specification-Version" : mod_version, - "Implementation-Title" : mod_name, - "Implementation-Version" : mod_version, - "Implementation-Vendor" : mod_authors, - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - ]) - } -} - -// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html -tasks.withType(ProcessResources).configureEach { - var replaceProperties = [ - minecraft_version : minecraft_version, - minecraft_version_range: minecraft_version_range, - neo_version : neo_version, - neo_version_range : neo_version_range, - loader_version_range : loader_version_range, - mod_id : mod_id, - mod_name : mod_name, - mod_license : mod_license, - mod_version : mod_version, - mod_authors : mod_authors, - mod_description : mod_description - ] - inputs.properties replaceProperties - - filesMatching(['META-INF/mods.toml']) { - expand replaceProperties - } -} - -tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' -} - -idea { - module { - downloadSources = true - downloadJavadoc = true - } -} diff --git a/NeoForge/changelog.txt b/NeoForge/changelog.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/NeoForge/gradle.properties b/NeoForge/gradle.properties deleted file mode 100644 index b6f428a5..00000000 --- a/NeoForge/gradle.properties +++ /dev/null @@ -1,22 +0,0 @@ -#org.gradle.jvmargs= -org.gradle.daemon=false -org.gradle.debug=false - -neogradle.subsystems.parchment.minecraftVersion=1.20.3 -neogradle.subsystems.parchment.mappingsVersion=2023.12.31 -minecraft_version=1.20.4 -minecraft_version_range=[1.20.4,1.21) -neo_version=20.4.237 -neo_version_range=[20.4,) -loader_version_range=[2,) -geckolib_version=4.4.4 - -## Mod Properties - -mod_id=bluelib -mod_name=BlueLib -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 diff --git a/NeoForge/gradle/wrapper/gradle-wrapper.jar b/NeoForge/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 2c352119..00000000 Binary files a/NeoForge/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/NeoForge/gradle/wrapper/gradle-wrapper.properties b/NeoForge/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 09523c0e..00000000 --- a/NeoForge/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,7 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip -networkTimeout=10000 -validateDistributionUrl=true -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/NeoForge/gradlew b/NeoForge/gradlew deleted file mode 100644 index f5feea6d..00000000 --- a/NeoForge/gradlew +++ /dev/null @@ -1,252 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s -' "$PWD" ) || exit - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - if ! command -v java >/dev/null 2>&1 - then - die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, -# and any embedded shellness will be escaped. -# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be -# treated as '${Hostname}' itself on the command line. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/NeoForge/gradlew.bat b/NeoForge/gradlew.bat deleted file mode 100644 index 9d21a218..00000000 --- a/NeoForge/gradlew.bat +++ /dev/null @@ -1,94 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem -@rem SPDX-License-Identifier: Apache-2.0 -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/NeoForge/settings.gradle b/NeoForge/settings.gradle deleted file mode 100644 index ada876e2..00000000 --- a/NeoForge/settings.gradle +++ /dev/null @@ -1,11 +0,0 @@ -pluginManagement { - repositories { - mavenLocal() - gradlePluginPortal() - maven { url = 'https://maven.neoforged.net/releases' } - } -} - -plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' -} diff --git a/NeoForge/src/main/java/software/bluelib/BlueLib.java b/NeoForge/src/main/java/software/bluelib/BlueLib.java deleted file mode 100644 index e73d1c98..00000000 --- a/NeoForge/src/main/java/software/bluelib/BlueLib.java +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) BlueLib. Licensed under the MIT License. - -package software.bluelib; - -import net.neoforged.bus.api.IEventBus; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.Mod; -import net.neoforged.fml.event.lifecycle.FMLLoadCompleteEvent; -import net.neoforged.fml.loading.FMLEnvironment; -import software.bluelib.example.event.ClientEvents; -import software.bluelib.example.init.ModEntities; - -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -/** - * The main class of the {@link BlueLib} mod. - *

- * 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} method that returns all parameters in the collection. - * - * @return A {@link Map} containing all parameters. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - protected Map getAllParameters() { - return new HashMap<>(parameters); - } - - /** - * A {@link Boolean} method that checks if a parameter exists by its key. - * - * @param pKey {@link String} - The key of the parameter to check. - * @return {@code true} if the parameter exists, {@code false} otherwise. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - protected boolean containsParameter(String pKey) { - return parameters.containsKey(pKey); - } - - /** - * A {@link Boolean} method that checks if the collection of parameters is empty. - * - * @return {@code true} if the collection is empty, {@code false} otherwise. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - protected boolean isEmpty() { - return parameters.isEmpty(); - } - - /** - * A {@code void} method that clears all parameters from the collection. - * - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - protected void clearParameters() { - parameters.clear(); - } - - /** - * An {@link Integer} method that returns the number of parameters in the collection. - * - * @return The number of parameters in the collection. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - protected int getParameterCount() { - return parameters.size(); - } - - /** - * A {@link Set} method that returns a set of all parameter keys. - * - * @return A {@link Set} containing all parameter keys. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - protected Set getParameterKeys() { - return parameters.keySet(); - } - - /** - * A {@link Collection} method that returns a collection of all parameter values. - * - * @return A {@link Collection} containing all parameter values. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - protected Collection getParameterValues() { - return parameters.values(); - } - - /** - * A {@code void} method that updates the value of an existing parameter. - * - * @param pKey {@link String} - The key of the parameter to update. - * @param pNewValue {@link Object} - The new value to set for the parameter. - * @throws IllegalArgumentException if the key does not exist. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - protected void updateParameter(String pKey, Object pNewValue) { - if (parameters.containsKey(pKey)) { - parameters.put(pKey, pNewValue); - } else { - throw new IllegalArgumentException("Key does not exist: " + pKey); - } - } -} diff --git a/NeoForge/src/main/java/software/bluelib/event/ReloadEventHandler.java b/NeoForge/src/main/java/software/bluelib/event/ReloadEventHandler.java deleted file mode 100644 index 9a095c52..00000000 --- a/NeoForge/src/main/java/software/bluelib/event/ReloadEventHandler.java +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) BlueLib. Licensed under the MIT License. - -package software.bluelib.event; - -import com.google.gson.JsonParseException; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.MinecraftServer; -import software.bluelib.entity.variant.VariantLoader; - -/** - * A {@code ReloadEventHandler} class responsible for handling events related to reloading entity variants. - *

- * This class includes methods for registering entity variants when the server starts. - *

- *

- * Key Features: - *

    - *
  • {@link #registerEntityVariants(MinecraftServer, String, String, String, String)} - Registers entity variants from specified locations.
  • - *
- *

- * @see VariantLoader - * @see MinecraftServer - * @see ResourceLocation - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ -public class ReloadEventHandler { - - /** - * A {@code void} method that registers entity variants from specified locations. - *

- * This method attempts to load variants from both mod and datapack locations, providing status information - * and handling any exceptions that occur during the loading process. - *

- *

- * Parameters: - *

    - *
  • {@code pServer} - The server instance of the current world.
  • - *
  • {@code pEntityName} - The entity name to load.
  • - *
  • {@code pModID} - The mod ID used to locate the entity variant resources. (Use your Mod's ID)
  • - *
  • {@code pModPathLocation} - The path location within the mod where variants are stored.
  • - *
  • {@code pDataPathLocation} - The path location within the resource pack where variants are stored.
  • - *
- *

- *

- * Exception Handling: - *

    - *
  • {@code JsonParseException} - Thrown when there is an error parsing the JSON files.
  • - *
  • {@code RuntimeException} - Thrown for unexpected errors during the registration process.
  • - *
- *

- * @param pServer {@link MinecraftServer} - The server instance of the current world. - * @param pEntityName {@link String} - The entity name to load. - * @param pModID {@link String} - The mod ID used to locate the entity variant resources. (Use your Mod's ID) - * @param pModPathLocation {@link String} - The path location within the mod where variants are stored. - * @param pDataPathLocation {@link String} - The path location within the datapack where variants are stored. - * @throws JsonParseException if there is an error parsing the JSON files. - * @throws RuntimeException if an unexpected error occurs during the registration process. - * @see MinecraftServer - * @see ResourceLocation - * @see VariantLoader - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - protected static void registerEntityVariants(MinecraftServer pServer, String pEntityName, String pModID, String pModPathLocation, String pDataPathLocation) { - ResourceLocation modLocation = new ResourceLocation(pModID, pModPathLocation); - ResourceLocation dataLocation = new ResourceLocation(pModID, pDataPathLocation); - try { - VariantLoader.loadVariants(modLocation, dataLocation, pServer, pEntityName); - } catch (JsonParseException pException) { - throw new RuntimeException("Failed to parse JSON(s) while registering entity variants for " + pEntityName + " from Mod with ModID: " + pModID, pException); - } catch (Exception pException) { - throw new RuntimeException("Unexpected error occurred while registering entity variants for " + pEntityName + " from Mod with ModID: " + pModID, pException); - } - } -} diff --git a/NeoForge/src/main/java/software/bluelib/example/entity/dragon/DragonEntity.java b/NeoForge/src/main/java/software/bluelib/example/entity/dragon/DragonEntity.java deleted file mode 100644 index 00e15560..00000000 --- a/NeoForge/src/main/java/software/bluelib/example/entity/dragon/DragonEntity.java +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) BlueLib. Licensed under the MIT License. - -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.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 software.bluelib.interfaces.variant.IVariantEntity; -import software.bluelib.utils.ParameterUtils; - -/** - * A {@code DragonEntity} class representing a dragon entity in the game, which extends {@link TamableAnimal} - * and implements {@link IVariantEntity} and {@link GeoEntity}. - *

- * This class manages the dragon's variant system, its data synchronization, and integrates with the GeckoLib - * animation system. - *

- * - *

- * 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 #setVariantName(String)} - Sets the variant name of the dragon.
  • - *
  • {@link #getVariantName()} - Retrieves the current variant name of the dragon.
  • - *
- *

- * - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ -public class DragonEntity extends TamableAnimal implements IVariantEntity, GeoEntity { - /** - * Entity data accessor for the variant of the dragon. - *

- * This is used to store and retrieve the variant data for synchronization between server and client. - *

- * @Co-author MeAlam, Dan - * @since 1.0.0 - */ - public static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(DragonEntity.class, EntityDataSerializers.STRING); - - /** - * The name of the entity. - * @Co-author MeAlam, Dan - * @since 1.0.0 - */ - protected final String entityName = "dragon"; - - /** - * 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. - * - * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ - public DragonEntity(EntityType pEntityType, Level 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. - *

- * - * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ - @Override - protected void defineSynchedData() { - super.defineSynchedData(); - this.entityData.define(VARIANT, "normal"); - } - - /** - * Adds custom data to the entity's NBT tag for saving. - *

- * 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. - * - * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ - @Override - public void addAdditionalSaveData(@NotNull CompoundTag pCompound) { - super.addAdditionalSaveData(pCompound); - pCompound.putString("Variant", getVariantName()); - } - - /** - * Reads custom data from the entity's NBT tag for loading. - *

- * 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. - * - * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ - @Override - public void readAdditionalSaveData(@NotNull CompoundTag pCompound) { - super.readAdditionalSaveData(pCompound); - this.setVariantName(pCompound.getString("Variant")); - } - - /** - * Finalizes the spawning of the dragon entity. - *

- * 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 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. - * - * @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) { - if (getVariantName() == null || getVariantName().isEmpty()) { - this.setVariantName(getRandomVariant(getEntityVariants(entityName), "normal")); - ParameterUtils.ParameterBuilder.forVariant(entityName,this.getVariantName()) - .withParameter("customParameter") - .withParameter("int") - .withParameter("bool") - .withParameter("array") - .connect(); - } - return super.finalizeSpawn(pLevel, pDifficulty, pReason, pSpawnData, pDataTag); - } - - /** - * Sets the variant name for the dragon entity. - * - * @param pName {@link String} - The name of the variant to set. - * - * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ - public void setVariantName(String pName) { - this.entityData.set(VARIANT, pName); - } - - /** - * Retrieves the current variant name of the dragon entity. - * - * @return {@link String} - The current variant name. - * - * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ - public String getVariantName() { - return this.entityData.get(VARIANT); - } - - /** - * All Code below this Fragment is not Library Related!!! - */ - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(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); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar pControllerRegistrar) { - } - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } - - @Nullable - @Override - public AgeableMob getBreedOffspring(@NotNull ServerLevel pLevel, @NotNull AgeableMob pOtherParent) { - return null; - } -} diff --git a/NeoForge/src/main/java/software/bluelib/example/entity/dragon/DragonModel.java b/NeoForge/src/main/java/software/bluelib/example/entity/dragon/DragonModel.java deleted file mode 100644 index 67091901..00000000 --- a/NeoForge/src/main/java/software/bluelib/example/entity/dragon/DragonModel.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) BlueLib. Licensed under the MIT License. - -package software.bluelib.example.entity.dragon; - -import net.minecraft.resources.ResourceLocation; -import software.bernie.geckolib.model.GeoModel; -import software.bluelib.BlueLib; - -public class DragonModel extends GeoModel { - - - // Get the Model Location - @Override - public ResourceLocation getModelResource(DragonEntity pObject) { - return new ResourceLocation(BlueLib.MODID, "geo/dragon.geo.json"); - } - - // Get the Texture Location - @Override - public ResourceLocation getTextureResource(DragonEntity pObject) { - return pObject.getTextureLocation(BlueLib.MODID, "textures/entity/" + pObject.entityName + "/" + pObject.getVariantName() + ".png"); - } - - // Get the Animation Location - @Override - public ResourceLocation getAnimationResource(DragonEntity pAnimatable) { - return new ResourceLocation(BlueLib.MODID, "animations/dragon.animation.json"); - } -} diff --git a/NeoForge/src/main/java/software/bluelib/example/entity/dragon/DragonRender.java b/NeoForge/src/main/java/software/bluelib/example/entity/dragon/DragonRender.java deleted file mode 100644 index c770ac48..00000000 --- a/NeoForge/src/main/java/software/bluelib/example/entity/dragon/DragonRender.java +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) BlueLib. Licensed under the MIT License. - -package software.bluelib.example.entity.dragon; - -import net.minecraft.client.renderer.entity.EntityRendererProvider; -import software.bernie.geckolib.renderer.GeoEntityRenderer; - -public class DragonRender extends GeoEntityRenderer { - - // Render the entity - public DragonRender(EntityRendererProvider.Context pRenderManager) { - super(pRenderManager, new DragonModel()); - } -} diff --git a/NeoForge/src/main/java/software/bluelib/example/entity/rex/RexEntity.java b/NeoForge/src/main/java/software/bluelib/example/entity/rex/RexEntity.java deleted file mode 100644 index fcb85a52..00000000 --- a/NeoForge/src/main/java/software/bluelib/example/entity/rex/RexEntity.java +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) BlueLib. Licensed under the MIT License. - -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.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 software.bluelib.interfaces.variant.IVariantEntity; -import software.bluelib.utils.ParameterUtils; - -/** - * A {@code RexEntity} class representing a Rex entity in the game, which extends {@link TamableAnimal} - * and implements {@link IVariantEntity} and {@link GeoEntity}. - *

- * This class manages the rex's variant system, its data synchronization, and integrates with the GeckoLib - * animation system. - *

- * - *

- * 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 #setVariantName(String)} - Sets the variant name of the rex.
  • - *
  • {@link #getVariantName()} - Retrieves the current variant name of the rex.
  • - *
- *

- * - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ -public class RexEntity extends TamableAnimal implements IVariantEntity, GeoEntity { - /** - * Entity data accessor for the variant of the rex. - *

- * This is used to store and retrieve the variant data for synchronization between server and client. - *

- * @Co-author MeAlam, Dan - * @since 1.0.0 - */ - public static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(RexEntity.class, EntityDataSerializers.STRING); - - /** - * The name of the entity. - * @Co-author MeAlam, Dan - * @since 1.0.0 - */ - protected final String entityName = "rex"; - - /** - * 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. - * - * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ - public RexEntity(EntityType pEntityType, Level 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. - *

- * - * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ - @Override - protected void defineSynchedData() { - super.defineSynchedData(); - this.entityData.define(VARIANT, "normal"); - } - - /** - * Adds custom data to the entity's NBT tag for saving. - *

- * 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. - * - * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ - @Override - public void addAdditionalSaveData(@NotNull CompoundTag pCompound) { - super.addAdditionalSaveData(pCompound); - pCompound.putString("Variant", getVariantName()); - } - - /** - * Reads custom data from the entity's NBT tag for loading. - *

- * 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. - * - * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ - @Override - public void readAdditionalSaveData(@NotNull CompoundTag pCompound) { - super.readAdditionalSaveData(pCompound); - this.setVariantName(pCompound.getString("Variant")); - } - - /** - * Finalizes the spawning of the rex entity. - *

- * 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 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. - * - * @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) { - if (getVariantName() == null || getVariantName().isEmpty()) { - this.setVariantName(getRandomVariant(getEntityVariants(entityName), "normal")); - ParameterUtils.ParameterBuilder.forVariant(entityName,this.getVariantName()) - .withParameter("customParameter") - .withParameter("int") - .withParameter("bool") - .withParameter("array") - .connect(); - } - return super.finalizeSpawn(pLevel, pDifficulty, pReason, pSpawnData, pDataTag); - } - - /** - * Sets the variant name for the rex entity. - * - * @param pName {@link String} - The name of the variant to set. - * - * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ - public void setVariantName(String pName) { - this.entityData.set(VARIANT, pName); - } - - /** - * Retrieves the current variant name of the rex entity. - * - * @return {@link String} - The current variant name. - * - * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ - public String getVariantName() { - return this.entityData.get(VARIANT); - } - - /** - * All Code below this Fragment is not Library Related!!! - */ - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(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); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar pControllerRegistrar) { - } - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } - - @Nullable - @Override - public AgeableMob getBreedOffspring(@NotNull ServerLevel pLevel, @NotNull AgeableMob pOtherParent) { - return null; - } -} diff --git a/NeoForge/src/main/java/software/bluelib/example/entity/rex/RexModel.java b/NeoForge/src/main/java/software/bluelib/example/entity/rex/RexModel.java deleted file mode 100644 index 6084892c..00000000 --- a/NeoForge/src/main/java/software/bluelib/example/entity/rex/RexModel.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) BlueLib. Licensed under the MIT License. - -package software.bluelib.example.entity.rex; - -import net.minecraft.resources.ResourceLocation; -import software.bernie.geckolib.model.GeoModel; -import software.bluelib.BlueLib; - -public class RexModel extends GeoModel { - - - // Get the Model Location - @Override - public ResourceLocation getModelResource(RexEntity pObject) { - return new ResourceLocation(BlueLib.MODID, "geo/rex.geo.json"); - } - - // Get the Texture Location - @Override - public ResourceLocation getTextureResource(RexEntity pObject) { - return pObject.getTextureLocation(BlueLib.MODID, "textures/entity/" + pObject.entityName + "/" + pObject.getVariantName() + ".png"); - } - - // Get the Animation Location - @Override - public ResourceLocation getAnimationResource(RexEntity pAnimatable) { - return new ResourceLocation(BlueLib.MODID, "animations/rex.animation.json"); - } -} diff --git a/NeoForge/src/main/java/software/bluelib/example/entity/rex/RexRender.java b/NeoForge/src/main/java/software/bluelib/example/entity/rex/RexRender.java deleted file mode 100644 index 776c5920..00000000 --- a/NeoForge/src/main/java/software/bluelib/example/entity/rex/RexRender.java +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) BlueLib. Licensed under the MIT License. - -package software.bluelib.example.entity.rex; - -import net.minecraft.client.renderer.entity.EntityRendererProvider; -import software.bernie.geckolib.renderer.GeoEntityRenderer; - -public class RexRender extends GeoEntityRenderer { - - // Render the entity - public RexRender(EntityRendererProvider.Context pRenderManager) { - super(pRenderManager, new RexModel()); - } -} diff --git a/NeoForge/src/main/java/software/bluelib/example/event/ClientEvents.java b/NeoForge/src/main/java/software/bluelib/example/event/ClientEvents.java deleted file mode 100644 index 8d3a63de..00000000 --- a/NeoForge/src/main/java/software/bluelib/example/event/ClientEvents.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) BlueLib. Licensed under the MIT License. - -package software.bluelib.example.event; - -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.neoforge.client.event.EntityRenderersEvent; -import net.neoforged.neoforge.event.entity.EntityAttributeCreationEvent; -import software.bluelib.example.entity.dragon.DragonEntity; -import software.bluelib.example.entity.dragon.DragonRender; -import software.bluelib.example.entity.rex.RexEntity; -import software.bluelib.example.entity.rex.RexRender; -import software.bluelib.example.init.ModEntities; - -public class ClientEvents { - @SubscribeEvent - public static void registerRenderers(final EntityRenderersEvent.RegisterRenderers pEvent) { - // Register the renderer for all the Entities - pEvent.registerEntityRenderer(ModEntities.DRAGON.get(), DragonRender::new); - pEvent.registerEntityRenderer(ModEntities.REX.get(), RexRender::new); - } - - // Register the Attributes - @SubscribeEvent - public static void registerAttributes(EntityAttributeCreationEvent pEvent) { - pEvent.put(ModEntities.DRAGON.get(), DragonEntity.createAttributes().build()); - pEvent.put(ModEntities.REX.get(), RexEntity.createAttributes().build()); - } -} diff --git a/NeoForge/src/main/java/software/bluelib/example/event/ReloadHandler.java b/NeoForge/src/main/java/software/bluelib/example/event/ReloadHandler.java deleted file mode 100644 index 5c6bacca..00000000 --- a/NeoForge/src/main/java/software/bluelib/example/event/ReloadHandler.java +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) BlueLib. Licensed under the MIT License. - -package software.bluelib.example.event; - -import net.minecraft.server.MinecraftServer; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.Mod; -import net.neoforged.neoforge.event.AddReloadListenerEvent; -import net.neoforged.neoforge.event.server.ServerStartingEvent; -import software.bluelib.BlueLib; -import software.bluelib.event.ReloadEventHandler; - -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -/** - * A {@code ReloadHandler} class that handles server start and reload events related to entity variants. - *

- * This class extends {@link ReloadEventHandler} and implements event handling for server starting and reloading, - * ensuring that entity variant data is properly loaded and refreshed. - *

- * - *

- * Key Methods: - *

    - *
  • {@link #onServerStart(ServerStartingEvent)} - 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.
  • - *
- *

- * - * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ -@Mod.EventBusSubscriber -public class ReloadHandler extends ReloadEventHandler { - - /** - * The {@link MinecraftServer} instance for the server handling the events. - *

- * This is initialized when the server starts and used to load entity variants. - *

- * - * @since 1.0.0 - * @Co-author MeAlam, Dan - */ - private static MinecraftServer server; - - /** - * 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. - * - * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ - @SubscribeEvent - public static void onServerStart(ServerStartingEvent pEvent) { - server = pEvent.getServer(); - ReloadHandler.LoadEntityVariants(server); - } - - /** - * The {@link ScheduledExecutorService} used to schedule tasks for reloading entity variants. - * - * @since 1.0.0 - * @Co-author MeAlam, Dan - */ - private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); - - /** - * Handles the reload event by scheduling a task to reload entity variants. - *

- * This method schedules the {@code LoadEntityVariants} method to run after a short delay. - *

- * - * @param pEvent {@link AddReloadListenerEvent} - The event triggered when a reload occurs. - * - * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ - @SubscribeEvent - public static void onReload(AddReloadListenerEvent pEvent) { - if (server != null) { - scheduler.schedule(() -> { - server.execute(() -> { - ReloadHandler.LoadEntityVariants(server); - }); - }, 1, TimeUnit.SECONDS); - } - } - - /** - * The base path for entity variant JSON files. - *

- * This path is used to locate the files that contain variant data for entities. - *

- * - * @since 1.0.0 - * @Co-author MeAlam, Dan - */ - private static final String basePath = "variant/entity/"; - - /** - * A {@link List} of entity names for which variants will be loaded. - *

- * This list defines which entities will have their variants loaded from JSON files. - *

- * - * @since 1.0.0 - * @Co-author MeAlam, Dan - */ - private static final List entityNames = Arrays.asList("dragon", "rex"); - - /** - * Loads entity variants from JSON files into the {@link MinecraftServer}. - *

- * This method iterates through the list of entity names, constructs file paths, and registers - * entity variants using the {@link ReloadEventHandler}. - *

- * - * @param pServer {@link MinecraftServer} - The server on which the entity variants will be loaded. - * - * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ - public static void LoadEntityVariants(MinecraftServer pServer) { - for (String entityName : entityNames) { - String modPath = basePath + entityName + ".json"; - String dataPath = basePath + entityName + "data.json"; - ReloadEventHandler.registerEntityVariants(pServer, entityName, BlueLib.MODID, modPath, dataPath); - } - } -} diff --git a/NeoForge/src/main/java/software/bluelib/example/init/ModEntities.java b/NeoForge/src/main/java/software/bluelib/example/init/ModEntities.java deleted file mode 100644 index a1e80d1d..00000000 --- a/NeoForge/src/main/java/software/bluelib/example/init/ModEntities.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) BlueLib. Licensed under the MIT License. - -package software.bluelib.example.init; - -import net.minecraft.core.registries.Registries; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.MobCategory; -import net.neoforged.neoforge.registries.DeferredHolder; -import net.neoforged.neoforge.registries.DeferredRegister; -import software.bluelib.BlueLib; -import software.bluelib.example.entity.dragon.DragonEntity; -import software.bluelib.example.entity.rex.RexEntity; - -public class ModEntities { - public static final DeferredRegister> REGISTRY = DeferredRegister.create(Registries.ENTITY_TYPE, BlueLib.MODID); - - // List of Entities - public static final DeferredHolder, EntityType> DRAGON = register( - "example_one", - EntityType.Builder.of(DragonEntity::new, MobCategory.AMBIENT) - .setShouldReceiveVelocityUpdates(true) - .setTrackingRange(64) - .setUpdateInterval(3) - .fireImmune() - .sized(0.6f, 1.8f)); - - public static final DeferredHolder, EntityType> REX = register( - "example_two", - EntityType.Builder.of(RexEntity::new, MobCategory.AMBIENT) - .setShouldReceiveVelocityUpdates(true) - .setTrackingRange(64) - .setUpdateInterval(3) - .fireImmune() - .sized(0.6f, 1.8f)); - - private static DeferredHolder, EntityType> register(String pRegistryName, EntityType.Builder pEntityTypeBuilder) { - return REGISTRY.register(pRegistryName, () -> pEntityTypeBuilder.build(pRegistryName)); - } -} diff --git a/NeoForge/src/main/java/software/bluelib/exception/CouldNotLoadJSON.java b/NeoForge/src/main/java/software/bluelib/exception/CouldNotLoadJSON.java deleted file mode 100644 index c93d1015..00000000 --- a/NeoForge/src/main/java/software/bluelib/exception/CouldNotLoadJSON.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) BlueLib. Licensed under the MIT License. - -package software.bluelib.exception; - -/** - * A {@code RuntimeException} that represents an error when a JSON file could not be loaded. - *

- * This exception provides additional context by including the {@link #getResourceId()} of the JSON file that failed to load. - *

- *

- * Key Features: - *

    - *
  • {@link #getResourceId()} - Retrieves the ID of the resource that could not be loaded.
  • - *
- *

- * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ -public class CouldNotLoadJSON extends RuntimeException { - - /** - * A {@link String} that represents the ID of the resource that could not be loaded. - *

- * This ID is used to provide additional context for the error. - *

- * @Co-author MeAlam, Dan - * @since 1.0.0 - */ - private final String resourceId; - - /** - * Constructs a new {@code CouldNotLoadJSON} exception with the specified detail message and resource ID. - *

- * The detail message provides information about the nature of the error, while the resource ID indicates - * which specific resource could not be loaded. - *

- * - * @param pMessage {@link String} - The detail message explaining the reason for the exception. - * @param pResourceId {@link String} - The ID of the resource that could not be loaded. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - public CouldNotLoadJSON(String pMessage, String pResourceId) { - super(pMessage); - this.resourceId = pResourceId; - } - - /** - * A {@link String} that retrieves the resource ID of the JSON file that could not be loaded. - *

- * This method provides access to the ID of the resource that caused the exception. - *

- * - * @return The resource ID as a {@link String}. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - public String getResourceId() { - return resourceId; - } -} diff --git a/NeoForge/src/main/java/software/bluelib/interfaces/variant/IVariantEntity.java b/NeoForge/src/main/java/software/bluelib/interfaces/variant/IVariantEntity.java deleted file mode 100644 index a9bf1919..00000000 --- a/NeoForge/src/main/java/software/bluelib/interfaces/variant/IVariantEntity.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) BlueLib. Licensed under the MIT License. - -package software.bluelib.interfaces.variant; - -import net.minecraft.util.RandomSource; -import software.bluelib.interfaces.variant.base.IVariantEntityBase; - -import java.util.List; - -/** - * An {@code Interface} representing an entity that supports multiple variants. - *

- * This interface extends {@link IVariantEntityBase} to include methods specific to handling entity variants, including - * random selection of variants. - *

- *

- * Key Methods: - *

    - *
  • {@link #getRandomVariant(List, String)} - Retrieves a random variant name from a provided list or defaults if the list is empty.
  • - *
- *

- * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ -public interface IVariantEntity extends IVariantEntityBase { - - /** - * A {@link RandomSource} instance used for generating random variants. - * @Co-author MeAlam, Dan - * @since 1.0.0 - */ - RandomSource random = RandomSource.create(); - - /** - * A {@link String} that selects a random variant name from the provided list of variant names. - *

- * This method uses the {@link RandomSource} to pick a random variant from the list. If the list is empty, the default - * variant name is returned. - *

- * - * @param pVariantNamesList {@link List} - A {@link List} of variant names available for the entity. - * @param pDefaultVariant {@link String} - The default variant name to return if {@code pVariantNamesList} is empty. - * @return A random variant name from the list, or the default variant if the list is empty. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - default String getRandomVariant(List pVariantNamesList, String pDefaultVariant) { - List spawnableVariants = pVariantNamesList.stream().toList(); - if (!spawnableVariants.isEmpty()) { - return spawnableVariants.get(this.random.nextInt(spawnableVariants.size())); - } - return pDefaultVariant; - } -} diff --git a/NeoForge/src/main/java/software/bluelib/interfaces/variant/base/IVariantEntityBase.java b/NeoForge/src/main/java/software/bluelib/interfaces/variant/base/IVariantEntityBase.java deleted file mode 100644 index 3b905d28..00000000 --- a/NeoForge/src/main/java/software/bluelib/interfaces/variant/base/IVariantEntityBase.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) BlueLib. Licensed under the MIT License. - -package software.bluelib.interfaces.variant.base; - -import net.minecraft.resources.ResourceLocation; -import software.bluelib.entity.variant.VariantLoader; -import software.bluelib.entity.variant.VariantParameter; - -import java.util.List; -import java.util.stream.Collectors; - -/** - * A {@code base Interface} providing fundamental methods for handling entity variants. - *

- * This interface defines methods for retrieving texture locations and variant names associated with entities. - *

- *

- * Key Methods: - *

    - *
  • {@link #getTextureLocation(String, String)} - Retrieves the {@link ResourceLocation} for the entity texture.
  • - *
  • {@link #getEntityVariants(String)} - Retrieves a {@link List} of variant names for a specified entity.
  • - *
- *

- * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ -public interface IVariantEntityBase { - - /** - * A {@link ResourceLocation} that points to the texture of an entity. - *

- * This method constructs a {@link ResourceLocation} using the provided mod ID and texture path. - *

- * - * @param pModId {@link String} - The mod ID used to locate the texture. - * @param pPath {@link String} - The path to the texture within the mod. - * @return A {@link ResourceLocation} pointing to the specified texture. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - default ResourceLocation getTextureLocation(String pModId, String pPath) { - return new ResourceLocation(pModId, pPath); - } - - /** - * A {@link List} of variant names associated with the specified entity. - *

- * This method retrieves the names of all variants for a given entity by querying the {@link VariantLoader}. - *

- * - * @param pEntityName {@link String} - The name of the entity whose variant names are to be retrieved. - * @return A {@link List} containing the names of variants associated with the specified entity. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - default List getEntityVariants(String pEntityName) { - List variants = VariantLoader.getVariantsFromEntity(pEntityName); - return variants.stream() - .map(VariantParameter::getVariantName) - .collect(Collectors.toList()); - } -} diff --git a/NeoForge/src/main/java/software/bluelib/json/JSONLoader.java b/NeoForge/src/main/java/software/bluelib/json/JSONLoader.java deleted file mode 100644 index f046903c..00000000 --- a/NeoForge/src/main/java/software/bluelib/json/JSONLoader.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) BlueLib. Licensed under the MIT License. - -package software.bluelib.json; - -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 software.bluelib.exception.CouldNotLoadJSON; - -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 - * resources defined by {@link ResourceLocation} within a Minecraft mod environment.
- * It uses the {@link Gson} library to convert JSON strings into {@link JsonObject} instances. - *

- * Key methods: - *

    - *
  • {@link #loadJson(ResourceLocation, ResourceManager)} - Loads a JSON resource.
  • - *
- * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ -public class JSONLoader { - - /** - * A {@link Gson} instance for parsing JSON data. - * @Co-author MeAlam, Dan - */ - private static final Gson gson = new Gson(); - - /** - * A {@link JsonObject} that loads JSON data from a {@link ResourceLocation}.
- * This method is typically used to load configuration files or other JSON-based resources - * in a Minecraft mod environment. - *

- * @param pResourceLocation {@link ResourceLocation} - The {@link ResourceLocation} of the JSON resource. - * @param pResourceManager {@link ResourceManager} - The {@link ResourceManager} to load the resource. - * @return The loaded {@link JsonObject}. - * @throws CouldNotLoadJSON If the JSON could not be loaded. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - public JsonObject loadJson(ResourceLocation pResourceLocation, ResourceManager pResourceManager) throws CouldNotLoadJSON { - try { - Optional resource = pResourceManager.getResource(pResourceLocation); - - if (resource.isEmpty()) { - return new JsonObject(); - } - - try (InputStream inputStream = resource.get().open(); - InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { - - return gson.fromJson(reader, JsonObject.class); - } - } catch (IOException pException) { - throw new CouldNotLoadJSON("Failed to load JSON from resource: " + pResourceLocation + ". Error: " + pException.getMessage(), pResourceLocation.toString()); - } - } -} diff --git a/NeoForge/src/main/java/software/bluelib/json/JSONMerger.java b/NeoForge/src/main/java/software/bluelib/json/JSONMerger.java deleted file mode 100644 index 918ed2cf..00000000 --- a/NeoForge/src/main/java/software/bluelib/json/JSONMerger.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) BlueLib. Licensed under the MIT License. - -package software.bluelib.json; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; - -import java.util.Map; - -/** - * A {@code Class} responsible for merging JSON data from a source {@link JsonObject} into a target {@link JsonObject}. - *

- * This class provides functionality to combine JSON data where overlapping keys result in merging arrays, - * and non-overlapping keys are simply added to the target. - *

- * - *

- * Key Methods: - *

    - *
  • {@link #mergeJsonObjects(JsonObject, JsonObject)} - Merges the data from the source JSON object into the target JSON object.
  • - *
- *

- * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ -public class JSONMerger { - - /** - * Merges data from a source {@link JsonObject} into a target {@link JsonObject}. - *

- * If the target JSON object already contains a key present in the source JSON object, the values are merged if they are arrays. - * Otherwise, the source value is added to the target JSON object. - *

- * - * @param pTarget {@link JsonObject} - The target {@link JsonObject} to merge data into. This object will be modified by adding or updating its values. - * @param pSource {@link JsonObject} - The source {@link JsonObject} to merge data from. This object is not modified by the operation. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - public void mergeJsonObjects(JsonObject pTarget, JsonObject pSource) { - for (Map.Entry entry : pSource.entrySet()) { - if (pTarget.has(entry.getKey())) { - JsonElement targetElement = pTarget.get(entry.getKey()); - JsonElement sourceElement = entry.getValue(); - - if (targetElement.isJsonArray() && sourceElement.isJsonArray()) { - JsonArray targetArray = targetElement.getAsJsonArray(); - JsonArray sourceArray = sourceElement.getAsJsonArray(); - - for (JsonElement element : sourceArray) { - targetArray.add(element); - } - } else { - pTarget.add(entry.getKey(), sourceElement); - } - } else { - pTarget.add(entry.getKey(), entry.getValue()); - } - } - } -} diff --git a/NeoForge/src/main/java/software/bluelib/utils/ParameterUtils.java b/NeoForge/src/main/java/software/bluelib/utils/ParameterUtils.java deleted file mode 100644 index 3994cdf5..00000000 --- a/NeoForge/src/main/java/software/bluelib/utils/ParameterUtils.java +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) BlueLib. Licensed under the MIT License. - -package software.bluelib.utils; - -import software.bluelib.entity.variant.VariantParameter; -import software.bluelib.entity.variant.VariantLoader; - -import java.util.HashMap; -import java.util.Map; -import java.util.NoSuchElementException; - -/** - * A {@code Class} for managing custom parameters associated with entity variants. - *

- * This class provides methods to retrieve custom parameters for variants and allows - * for building and connecting parameters to specific variants using the {@link ParameterBuilder}. - *

- *

- * Key Methods: - *

    - *
  • {@link #getParameter(String, String)} - Retrieves the value of a custom parameter for a specific variant.
  • - *
- *

- * Nested Classes: - *
    - *
  • {@link ParameterBuilder} - A builder class for creating and associating custom parameters with a specific variant.
  • - *
- *

- * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ -public class ParameterUtils { - - /** - * A {@link Map} holding custom parameters for each variant. - *

- * The outer map's key is the variant's name, and the inner map contains key-value pairs - * of custom parameters for that variant. - *

- * @Co-author MeAlam, Dan - * @since 1.0.0 - */ - private static final Map> variantParametersMap = new HashMap<>(); - - /** - * Retrieves the value of a custom parameter for a specific variant. - *

- * If the parameter is not found, "null" is returned. - *

- * - * @param pVariantName {@link String} - The name of the variant. - * @param pParameterKey {@link String} - The key of the parameter to retrieve. - * @return The value of the custom parameter for the specified variant. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - public static String getParameter(String pVariantName, String pParameterKey) { - return variantParametersMap.getOrDefault(pVariantName, new HashMap<>()).getOrDefault(pParameterKey, "null"); - } - - /** - * A {@code Builder} class for creating and associating custom parameters with a specific variant. - *

- * This class allows chaining methods to build and connect parameters to a variant. - *

- * - *

- * Key Methods: - *

    - *
  • {@link #forVariant(String, String)} - Creates a new instance of {@link ParameterBuilder} for the specified entity and variant.
  • - *
  • {@link #withParameter(String)} - Adds a parameter to the parameters map with a default value of "null".
  • - *
  • {@link #connect()} - Adds parameters to the variant and updates the static {@link VariantParameter} with these parameters.
  • - *
- *

- *

- * **Note:** The "null" value is used only if the parameter is not specified in the JSON files. - *

- * @since 1.0.0 - * @author MeAlam - * @Co-author Dan - */ - public static class ParameterBuilder { - /** - * The name of the variant for which parameters are being built. - * @Co-author MeAlam, Dan - * @since 1.0.0 - */ - private final String variantName; - - /** - * The name of the entity for which parameters are being built. - * @Co-author MeAlam, Dan - * @since 1.0.0 - */ - private final String entityName; - - /** - * A {@link Map} to store parameters for the variant. - *

- * Each key-value pair represents a parameter name and its default value. - *

- * @Co-author MeAlam, Dan - * @since 1.0.0 - */ - private final Map parameters = new HashMap<>(); - - /** - * Constructor to initialize the builder with a specific entity name and variant name. - * - * @param pEntityName {@link String} - The name of the entity. - * @param pVariantName {@link String} - The name of the variant. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - private ParameterBuilder(String pEntityName, String pVariantName) { - this.variantName = pVariantName; - this.entityName = pEntityName; - } - - /** - * Creates a new instance of {@link ParameterBuilder} for the specified entity and variant. - * - * @param pEntityName {@link String} - The name of the entity. - * @param pVariantName {@link String} - The name of the variant. - * @return A new instance of {@link ParameterBuilder}. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - public static ParameterBuilder forVariant(String pEntityName, String pVariantName) { - return new ParameterBuilder(pEntityName, pVariantName); - } - - /** - * Adds a parameter to the parameters map with a default value of "null".
- *

- * **Note:** The "null" value is used only if the parameter is not specified in the JSON files. - *

- * - * @param pParameter {@link String} - The key of the parameter to add. - * @return The current instance of {@link ParameterBuilder} for method chaining. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - public ParameterBuilder withParameter(String pParameter) { - parameters.put(pParameter, "null"); - return this; - } - - /** - * Adds a parameter to the parameters map with a specified default value. - *

- * Connects the parameters built with this builder to the specified variant. - * Updates the static {@link VariantParameter} with the parameters for the specified variant. - *

- * - * @return The current instance of {@link ParameterBuilder} for method chaining. - * @throws NoSuchElementException if the specified variant is not found for the entity. - * @author MeAlam - * @Co-author Dan - * @since 1.0.0 - */ - public ParameterBuilder connect() { - VariantParameter variant = VariantLoader.getVariantByName(entityName, variantName); - if (variant != null) { - Map updatedParameters = new HashMap<>(); - for (String key : parameters.keySet()) { - updatedParameters.put(key, variant.getParameter(key)); - } - variantParametersMap.put(variantName, updatedParameters); - } else { - throw new NoSuchElementException("Variant '" + variantName + "' not found for entity '" + entityName + "'"); - } - return this; - } - } -} diff --git a/NeoForge/src/main/resources/META-INF/mods.toml b/NeoForge/src/main/resources/META-INF/mods.toml deleted file mode 100644 index 61897870..00000000 --- a/NeoForge/src/main/resources/META-INF/mods.toml +++ /dev/null @@ -1,31 +0,0 @@ -modLoader="javafml" -loaderVersion="${loader_version_range}" -license="${mod_license}" -issueTrackerURL="https://github.com/MeAlam1/BlueLib/issues" -[[mods]] -modId="${mod_id}" -version="${mod_version}" -displayName="${mod_name}" - -# A URL to query for updates for this mod. See the JSON update specification https://docs.neoforged.net/docs/misc/updatechecker/ -#updateJSONURL="https://change.me.example.invalid/updates.json" #optional -displayURL="https://github.com/MeAlam1/BlueLib/wiki" -#logoFile="examplemod.png" -credits="Anyone who contributed to the Source Code of BlueLib!" -authors="${mod_authors}" - - -description='''${mod_description}''' -[[dependencies.${mod_id}]] - modId="neoforge" - type="required" - versionRange="${neo_version_range}" - ordering="NONE" - side="BOTH" - -[[dependencies.${mod_id}]] - modId="minecraft" - type="required" - versionRange="${minecraft_version_range}" - ordering="NONE" - side="BOTH" \ No newline at end of file diff --git a/NeoForge/src/main/resources/assets/bluelib/animations/dragon.animation.json b/NeoForge/src/main/resources/assets/bluelib/animations/dragon.animation.json deleted file mode 100644 index 0b02f765..00000000 --- a/NeoForge/src/main/resources/assets/bluelib/animations/dragon.animation.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "format_version": "1.8.0", - "animations": { - "test": { - "loop": true, - "bones": { - "Body": { - "rotation": { - "vector": [-20.44582, 11.73507, -4.3361], - "easing": "linear" - }, - "position": { - "vector": [0, -1, 0], - "easing": "linear" - } - }, - "leftleg": { - "rotation": { - "vector": [0, 22.5, 0], - "easing": "linear" - } - }, - "rightleg": { - "rotation": { - "vector": [0, -22.5, 0], - "easing": "linear" - } - }, - "rightwing1": { - "rotation": { - "vector": [0, 0, -20], - "easing": "linear" - } - }, - "leftwing": { - "rotation": { - "vector": [0, 0, -10], - "easing": "linear" - } - }, - "leftwing1": { - "rotation": { - "vector": [0, 0, 30], - "easing": "linear" - } - }, - "neck": { - "rotation": { - "vector": [-40, 0, 0], - "easing": "linear" - } - }, - "Head": { - "rotation": { - "vector": [72.5, 0, 0], - "easing": "linear" - } - } - } - } - }, - "geckolib_format_version": 2 -} \ No newline at end of file diff --git a/NeoForge/src/main/resources/assets/bluelib/animations/rex.animation.json b/NeoForge/src/main/resources/assets/bluelib/animations/rex.animation.json deleted file mode 100644 index 5d8891b4..00000000 --- a/NeoForge/src/main/resources/assets/bluelib/animations/rex.animation.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "format_version": "1.8.0", - "animations": { - "animation2": { - "loop": true, - "bones": { - "body": { - "rotation": { - "vector": [0, -15, 0] - } - }, - "tail2": { - "rotation": { - "vector": [0, 20, 0] - } - }, - "tail3": { - "rotation": { - "vector": [0, 20, 0] - } - }, - "tail4": { - "rotation": { - "vector": [0, 20, 0] - } - }, - "tail5": { - "rotation": { - "vector": [0, 20, 0] - } - }, - "tail6": { - "rotation": { - "vector": [0, 20, 0] - } - }, - "neck": { - "rotation": { - "vector": [0, -2.5, 0] - } - }, - "head": { - "rotation": { - "vector": [0, -20, 0] - } - } - } - } - }, - "geckolib_format_version": 2 -} \ No newline at end of file diff --git a/NeoForge/src/main/resources/assets/bluelib/geo/dragon.geo.json b/NeoForge/src/main/resources/assets/bluelib/geo/dragon.geo.json deleted file mode 100644 index 8f038886..00000000 --- a/NeoForge/src/main/resources/assets/bluelib/geo/dragon.geo.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "format_version": "1.12.0", - "minecraft:geometry": [ - { - "description": { - "identifier": "geometry.unknown", - "texture_width": 64, - "texture_height": 64, - "visible_bounds_width": 4, - "visible_bounds_height": 2.5, - "visible_bounds_offset": [0, 0.75, 0] - }, - "bones": [ - { - "name": "Body", - "pivot": [-0.16667, 5, -1], - "cubes": [ - {"origin": [-2, 4, 1], "size": [4, 2, 4], "uv": [17, 10]}, - {"origin": [-3, 4, -4], "size": [6, 2, 5], "uv": [0, 14]} - ] - }, - { - "name": "leftleg", - "parent": "Body", - "pivot": [1.5, 5, 5], - "cubes": [ - {"origin": [1.5, 3, 4.5], "size": [0, 4, 3], "pivot": [1.5, 5, 6], "rotation": [90, 0, 90], "uv": [0, 0]} - ] - }, - { - "name": "rightleg", - "parent": "Body", - "pivot": [-1.5, 5, 5], - "cubes": [ - {"origin": [-1.5, 3, 4.5], "size": [0, 4, 3], "pivot": [-1.5, 5, 6], "rotation": [90, 0, -90], "uv": [0, 0], "mirror": true} - ] - }, - { - "name": "rightwing", - "parent": "Body", - "pivot": [-2.5, 5, -3.5], - "cubes": [ - {"origin": [-10, 5, -5], "size": [7, 0, 7], "uv": [-7, 28], "mirror": true} - ] - }, - { - "name": "rightwing1", - "parent": "rightwing", - "pivot": [-9.5, 5, -1.5], - "cubes": [ - {"origin": [-17, 5, -5], "size": [7, 0, 7], "uv": [43, 0], "mirror": true} - ] - }, - { - "name": "leftwing", - "parent": "Body", - "pivot": [2.5, 5, -3.5], - "cubes": [ - {"origin": [3, 5, -5], "size": [7, 0, 7], "uv": [-7, 28]} - ] - }, - { - "name": "leftwing1", - "parent": "leftwing", - "pivot": [9.5, 5, -1.5], - "cubes": [ - {"origin": [10, 5, -5], "size": [7, 0, 7], "uv": [43, 0]} - ] - }, - { - "name": "neck", - "parent": "Body", - "pivot": [0, 5, -4], - "cubes": [ - {"origin": [-1, 4, -8], "size": [2, 2, 4], "uv": [10, 21]} - ] - }, - { - "name": "Head", - "parent": "neck", - "pivot": [0, 4.8, -7.5], - "cubes": [ - {"origin": [-1.5, 4, -12], "size": [3, 3, 4], "uv": [18, 17]}, - {"origin": [0, 6, -15], "size": [0, 3, 7], "uv": [0, 14]}, - {"origin": [-1, 4, -16], "size": [2, 2, 4], "uv": [21, 0]}, - {"origin": [-1, 3, -16], "size": [2, 1, 1], "uv": [29, 0]}, - {"origin": [0, 7, -8], "size": [0, 1, 3], "uv": [0, 23]} - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/NeoForge/src/main/resources/assets/bluelib/geo/rex.geo.json b/NeoForge/src/main/resources/assets/bluelib/geo/rex.geo.json deleted file mode 100644 index 3d18bac7..00000000 --- a/NeoForge/src/main/resources/assets/bluelib/geo/rex.geo.json +++ /dev/null @@ -1,390 +0,0 @@ -{ - "format_version": "1.12.0", - "minecraft:geometry": [ - { - "description": { - "identifier": "geometry.unknown", - "texture_width": 512, - "texture_height": 512, - "visible_bounds_width": 29, - "visible_bounds_height": 7.5, - "visible_bounds_offset": [0, 3.25, 0] - }, - "bones": [ - { - "name": "Tyrannosaurus", - "pivot": [0, 0, 0] - }, - { - "name": "body", - "parent": "Tyrannosaurus", - "pivot": [0, 72, 0], - "cubes": [ - {"origin": [-19, 47, -8], "size": [38, 45, 34], "uv": [124, 51]}, - {"origin": [-15.475, 51.23327, -14.01496], "size": [31, 45, 35], "pivot": [0.025, 74.40827, 4.38504], "rotation": [-12.75, 0, 0], "uv": [130, 50]}, - {"origin": [-16, 40, -22.525], "size": [32, 16, 40], "inflate": -0.05, "pivot": [0, 72, 0.275], "rotation": [17.5, 0, 0], "uv": [0, 160]}, - {"origin": [-16, 54, -54], "size": [32, 37, 46], "uv": [1, 1]}, - {"origin": [-16, 71.46448, -54.53145], "size": [32, 30, 48], "inflate": -0.25, "pivot": [0, 89.46448, 3.46855], "rotation": [8.75, 0, 0], "uv": [-1, -1]}, - {"origin": [-16, 28.37894, -42.36923], "size": [32, 21, 49], "inflate": -0.025, "pivot": [0, 73.37894, 12.63077], "rotation": [-24, 0, 0], "uv": [0, 85]} - ] - }, - { - "name": "arm2", - "parent": "body", - "pivot": [13.56731, 58.46159, -45.9607], - "rotation": [29.07337, 19.05681, -20.20848], - "cubes": [ - {"origin": [12.56731, 47.46159, -47.9607], "size": [3, 11, 5], "uv": [111, 0]} - ] - }, - { - "name": "bone2", - "parent": "arm2", - "pivot": [15.06274, 49.29312, -45.32771], - "rotation": [-27.154, -2.96386, 4.54476], - "cubes": [ - {"origin": [13.13695, 39.306, -44.80271], "size": [2, 6, 2], "inflate": -0.075, "pivot": [14.11195, 46.806, -45.02771], "rotation": [0, 0, 15], "uv": [0, 0]}, - {"origin": [14.86195, 37.306, -44.75271], "size": [0, 3, 2], "pivot": [14.11195, 46.806, -45.02771], "rotation": [0, 0, 15], "uv": [36, 26]}, - {"origin": [12.13695, 44.306, -47.52771], "size": [3, 5, 5], "inflate": -0.125, "pivot": [14.11195, 46.806, -45.02771], "rotation": [0, 0, 15], "uv": [165, 257]} - ] - }, - { - "name": "bone3", - "parent": "bone2", - "pivot": [13.25685, 45.11756, -46.37771], - "rotation": [-14.50257, -2.95519, -2.10666], - "cubes": [ - {"origin": [13.13695, 41.306, -47.37771], "size": [2, 4, 2], "inflate": -0.075, "pivot": [14.11195, 46.806, -45.02771], "rotation": [0, 0, 15], "uv": [0, 28]}, - {"origin": [14.86195, 39.306, -47.37771], "size": [0, 3, 2], "pivot": [14.11195, 46.806, -45.02771], "rotation": [0, 0, 15], "uv": [36, 29]} - ] - }, - { - "name": "arm3", - "parent": "body", - "pivot": [-13.56731, 58.46159, -45.9607], - "rotation": [29.07337, -19.05681, 20.20848], - "cubes": [ - {"origin": [-15.56731, 47.46159, -47.9607], "size": [3, 11, 5], "uv": [111, 0], "mirror": true} - ] - }, - { - "name": "bone4", - "parent": "arm3", - "pivot": [-15.06274, 49.29312, -45.32771], - "rotation": [-27.154, 2.96386, -4.54476], - "cubes": [ - {"origin": [-15.13695, 39.306, -44.80271], "size": [2, 6, 2], "inflate": -0.075, "pivot": [-14.11195, 46.806, -45.02771], "rotation": [0, 0, -15], "uv": [0, 0], "mirror": true}, - {"origin": [-14.86195, 37.306, -44.75271], "size": [0, 3, 2], "pivot": [-14.11195, 46.806, -45.02771], "rotation": [0, 0, -15], "uv": [36, 26], "mirror": true}, - {"origin": [-15.13695, 44.306, -47.52771], "size": [3, 5, 5], "inflate": -0.125, "pivot": [-14.11195, 46.806, -45.02771], "rotation": [0, 0, -15], "uv": [165, 257], "mirror": true} - ] - }, - { - "name": "bone5", - "parent": "bone4", - "pivot": [-13.25685, 45.11756, -46.37771], - "rotation": [-14.50257, 2.95519, 2.10666], - "cubes": [ - {"origin": [-15.13695, 41.306, -47.37771], "size": [2, 4, 2], "inflate": -0.075, "pivot": [-14.11195, 46.806, -45.02771], "rotation": [0, 0, -15], "uv": [0, 28], "mirror": true}, - {"origin": [-14.86195, 39.306, -47.37771], "size": [0, 3, 2], "pivot": [-14.11195, 46.806, -45.02771], "rotation": [0, 0, -15], "uv": [36, 29], "mirror": true} - ] - }, - { - "name": "tail1", - "parent": "body", - "pivot": [0, 82.97049, 21.3522], - "cubes": [ - {"origin": [-15, 55.74549, 21.0272], "size": [30, 30, 39], "uv": [123, 128]}, - {"origin": [-15, 71.63781, 17.37365], "size": [30, 28, 35], "inflate": -0.2, "pivot": [0, 60.21281, -16.55135], "rotation": [-10.75, 0, 0], "uv": [127, 132]}, - {"origin": [-15, 39.02049, 26.7772], "size": [30, 13, 37], "inflate": -0.025, "pivot": [0, 30.97049, 1.3522], "rotation": [16, 0, 0], "uv": [159, 1]} - ] - }, - { - "name": "tail2", - "parent": "tail1", - "pivot": [0, 82.97049, 56.3522], - "cubes": [ - {"origin": [-10, 62.97049, 56.3522], "size": [20, 21, 38], "uv": [106, 199]}, - {"origin": [-9, 41.02049, 63.3522], "size": [18, 14, 35], "inflate": -0.025, "pivot": [0, 30.97049, 1.3522], "rotation": [13, 0, 0], "uv": [173, 3]} - ] - }, - { - "name": "tail3", - "parent": "tail2", - "pivot": [0, 82.97049, 93.3522], - "cubes": [ - {"origin": [-7, 66.97049, 93.3522], "size": [14, 14, 37], "uv": [0, 216]}, - {"origin": [-7, 54.52049, 94.3522], "size": [14, 7, 38], "inflate": -0.025, "pivot": [0, 30.97049, 1.3522], "rotation": [5.5, 0, 0], "uv": [174, 0]} - ] - }, - { - "name": "tail4", - "parent": "tail3", - "pivot": [0, 82.97049, 129.3522], - "cubes": [ - {"origin": [-5, 69.97049, 129.3522], "size": [10, 9, 37], "uv": [255, 14]}, - {"origin": [-5, 64.82049, 132.6022], "size": [10, 4, 37], "inflate": -0.025, "pivot": [0, 30.97049, 109.3522], "rotation": [4.75, 0, 0], "uv": [255, 14]} - ] - }, - { - "name": "tail5", - "parent": "tail4", - "pivot": [0, 82.97049, 158.3522], - "cubes": [ - {"origin": [-3, 70.97049, 158.3522], "size": [6, 6, 37], "uv": [149, 257]}, - {"origin": [-3, 69.22961, 165.59014], "size": [6, 3, 30], "inflate": -0.1, "pivot": [0, 70.15461, 147.99014], "rotation": [0.5, 0, 0], "uv": [266, 21]} - ] - }, - { - "name": "tail6", - "parent": "tail5", - "pivot": [0, 82.97049, 182.3522], - "cubes": [ - {"origin": [-2, 71.97049, 182.3522], "size": [4, 4, 37], "uv": [0, 285]}, - {"origin": [-2, 66.99549, 197.7022], "size": [4, 4, 25], "inflate": -0.175, "pivot": [0, 30.97049, 162.3522], "rotation": [4.75, 0, 0], "uv": [12, 297]} - ] - }, - { - "name": "neck", - "parent": "body", - "pivot": [0, 74.22605, -48.50511], - "cubes": [ - {"origin": [-15, 55, -67], "size": [30, 31, 17], "uv": [251, 113]}, - {"origin": [-14.25, 80.39311, -64.98257], "size": [30, 11, 17], "inflate": -1, "pivot": [0.75, 82.39311, -53.98257], "rotation": [24.25, 0, 0], "uv": [251, 113]}, - {"origin": [-10, 66.05, -70.125], "size": [20, 34, 25], "inflate": -0.225, "pivot": [0, 87.575, -69.125], "rotation": [-39.25, 0, 0], "uv": [221, 200]}, - {"origin": [-10, 59.575, -78.125], "size": [20, 13, 25], "inflate": -1.325, "pivot": [0, 87.575, -69.125], "rotation": [-14.25, 0, 0], "uv": [235, 259]}, - {"origin": [-9, 71.2, -85.125], "size": [18, 19, 24], "inflate": -0.325, "pivot": [0, 85.2, -69.125], "rotation": [7.5, 0, 0], "uv": [268, 61]}, - {"origin": [-8, 83.89159, -88.09601], "size": [16, 12, 13], "inflate": -0.275, "pivot": [0, 89.89159, -79.09601], "rotation": [42.5, 0, 0], "uv": [198, 259]}, - {"origin": [-8, 86.39159, -80.39601], "size": [16, 11, 19], "inflate": -0.25, "pivot": [0, 89.89159, -68.09601], "rotation": [2.5, 0, 0], "uv": [111, 0]} - ] - }, - { - "name": "head", - "parent": "neck", - "pivot": [0, 83.05369, -83.57238], - "cubes": [ - {"origin": [-8.725, 71, -101], "size": [17, 19, 19], "uv": [286, 165]}, - {"origin": [-8.775, 84, -101], "size": [17, 2, 7], "inflate": 0.225, "uv": [104, 155]}, - {"origin": [-7, 93.5819, -99.5906], "size": [14, 5, 10], "inflate": -0.05, "pivot": [0, 90.5819, -77.5906], "rotation": [21.5, 0, 0], "uv": [0, 111]}, - {"origin": [-7, 81.46532, -93.49693], "size": [14, 5, 9], "inflate": -0.075, "pivot": [0, 78.46532, -74.49693], "rotation": [-25, 0, 0], "uv": [111, 30]}, - {"origin": [-7, 88.64032, -92.02193], "size": [14, 5, 4], "inflate": -0.125, "uv": [0, 191]}, - {"origin": [9, 86, -102], "size": [4, 3, 13], "inflate": -0.025, "pivot": [7, 80.5, -90.5], "rotation": [0, 0, -17.5], "uv": [149, 277]}, - {"origin": [4.59053, 84.6097, -93.1055], "size": [4, 3, 9], "inflate": -0.05, "pivot": [2.59053, 79.1097, -81.6055], "rotation": [0, -27.5, -17.5], "uv": [255, 23]}, - {"origin": [-8.59053, 84.6097, -93.1055], "size": [4, 3, 9], "inflate": -0.05, "pivot": [-2.59053, 79.1097, -81.6055], "rotation": [0, 27.5, 17.5], "uv": [184, 225]}, - {"origin": [12.62776, 90.52364, -107.52067], "size": [4, 3, 11], "inflate": -0.1, "pivot": [10.62776, 85.02364, -91.02067], "rotation": [27.87149, 36.42355, -5.95346], "uv": [0, 239]}, - {"origin": [-16.62776, 90.52364, -107.52067], "size": [4, 3, 11], "inflate": -0.1, "pivot": [-10.62776, 85.02364, -91.02067], "rotation": [27.87149, -36.42355, 5.95346], "uv": [162, 0]}, - {"origin": [-13, 86, -102], "size": [4, 3, 13], "inflate": -0.025, "pivot": [-7, 80.5, -90.5], "rotation": [0, 0, 17.5], "uv": [109, 216]}, - {"origin": [-7, 78.725, -121], "size": [14, 10, 16], "inflate": -0.05, "pivot": [0, 81.725, -99], "rotation": [27.5, 0, 0], "uv": [300, 243]}, - {"origin": [-7, 78.35, -106], "size": [14, 11, 11], "pivot": [0, 81.35, -99], "rotation": [33.5, 0, 0], "uv": [286, 203]}, - {"origin": [-7, 69.519, -125.21974], "size": [14, 11, 7.85], "inflate": -0.075, "pivot": [0, 72.519, -118.21974], "rotation": [90, 0, 0], "uv": [259, 165]}, - {"origin": [-6, 78.519, -128.21974], "size": [11, 0, 7.85], "pivot": [0, 72.519, -118.21974], "rotation": [90, 0, 0], "uv": [141, 30]}, - {"origin": [5, 61.519, -128.21974], "size": [0, 17, 6.85], "pivot": [-2, 72.519, -118.21974], "rotation": [90, 0, 0], "uv": [234, 45]}, - {"origin": [-5, 61.519, -128.21974], "size": [0, 17, 6.85], "pivot": [2, 72.519, -118.21974], "rotation": [90, 0, 0], "uv": [28, 154]}, - {"origin": [-7, 73.394, -115.21974], "size": [14, 10, 6.85], "inflate": -0.1, "pivot": [0, 74.394, -109.21974], "rotation": [110.5, 0, 0], "uv": [65, 237]}, - {"origin": [-7, 84.31148, -108.92962], "size": [14, 4, 6.85], "inflate": -0.15, "pivot": [0, 79.31148, -102.92962], "rotation": [128, 0, 0], "uv": [272, 0]}, - {"origin": [-7, 74.31148, -110.92962], "size": [14, 9, 8.85], "inflate": -0.175, "pivot": [0, 79.31148, -102.92962], "rotation": [88, 0, 0], "uv": [0, 28]}, - {"origin": [-7, 69.019, -122.66974], "size": [14, 10, 7], "inflate": -0.125, "pivot": [0, 72.019, -117.66974], "rotation": [47.5, 0, 0], "uv": [0, 267]} - ] - }, - { - "name": "jaw", - "parent": "head", - "pivot": [0, 73.374, -85.20224], - "cubes": [ - {"origin": [-9.125, 61.47673, -99.81697], "size": [18, 13, 12], "inflate": 0.025, "uv": [184, 200]}, - {"origin": [-9.15, 64.14383, -89.12484], "size": [18, 12, 7], "inflate": 0.075, "pivot": [-3, 73.14383, -68.12484], "rotation": [7.5, 0, 0], "uv": [312, 0]}, - {"origin": [7.8, 70.81044, -97.91351], "size": [1, 6, 9], "uv": [104, 179]}, - {"origin": [7.85, 63.60089, -93.15375], "size": [1, 6, 7], "pivot": [-2.975, 63.60089, -72.15375], "rotation": [-22.5, 0, 0], "uv": [65, 216]}, - {"origin": [-7.125, 72.47673, -98.81697], "size": [14, 14, 16], "inflate": 0.025, "uv": [219, 297]}, - {"origin": [6.375, 68.47673, -105.81697], "size": [0, 18, 14], "uv": [0, 159]}, - {"origin": [-6.625, 68.47673, -105.81697], "size": [0, 18, 14], "uv": [0, 141]}, - {"origin": [7.875, 65.38327, -112.3007], "size": [1, 8, 15], "inflate": -0.05, "pivot": [0, 73.88327, -104.8007], "rotation": [27.5, 0, 0], "uv": [255, 0]}, - {"origin": [-9.125, 65.38327, -112.3007], "size": [1, 8, 15], "inflate": -0.05, "pivot": [0, 73.88327, -104.8007], "rotation": [27.5, 0, 0], "uv": [0, 216]}, - {"origin": [-9.05, 70.81044, -97.91351], "size": [1, 6, 9], "uv": [104, 164]}, - {"origin": [-9.1, 63.60089, -93.15375], "size": [1, 6, 7], "pivot": [2.975, 63.60089, -72.15375], "rotation": [-22.5, 0, 0], "uv": [17, 216]}, - {"origin": [-9.125, 64.31864, -111.04094], "size": [18, 8, 15], "inflate": -0.025, "pivot": [0, 70.56864, -103.54094], "rotation": [17.5, 0, 0], "uv": [149, 300]}, - {"origin": [-6.125, 66.9078, -126.60427], "size": [12, 5, 15], "pivot": [0, 72.4078, -104.10427], "rotation": [15, 0, 0], "uv": [126, 257]}, - {"origin": [-6.125, 71.5078, -125.60427], "size": [12, 5, 0], "pivot": [0, 72.4078, -104.10427], "rotation": [15, 0, 0], "uv": [62, 155]}, - {"origin": [5.725, 71.5078, -125.60427], "size": [0, 5, 17], "pivot": [0, 72.4078, -104.10427], "rotation": [15, 0, 0], "uv": [28, 138]}, - {"origin": [-5.975, 71.5078, -125.60427], "size": [0, 5, 17], "pivot": [0, 72.4078, -104.10427], "rotation": [15, 0, 0], "uv": [0, 109]}, - {"origin": [-6.125, 60.70962, -124.43479], "size": [12, 5, 15], "inflate": -0.05, "pivot": [0, 63.78462, -115.43479], "rotation": [-3.5, 0, 0], "uv": [234, 61]}, - {"origin": [-7.125, 61.71743, -111.29498], "size": [14, 5, 16], "inflate": -0.025, "pivot": [0, 66.69243, -101.79498], "rotation": [9.25, 0, 0], "uv": [65, 216]} - ] - }, - { - "name": "leg_left", - "parent": "Tyrannosaurus", - "pivot": [20.42923, 70.7324, 8.85434], - "rotation": [-15.09173, -1.85092, -0.08398], - "cubes": [ - {"origin": [12.54366, 41.02086, -4.25109], "size": [12.875, 42.825, 23.725], "uv": [79, 257]} - ] - }, - { - "name": "leg_left2", - "parent": "leg_left", - "pivot": [21.99279, 43.52539, 1.69711], - "cubes": [ - {"origin": [12.844, 24.19389, 3.09297], "size": [12.4, 20.375, 15.95], "pivot": [21.944, 35.38139, 0.96797], "rotation": [34, 0, 0], "uv": [279, 297]} - ] - }, - { - "name": "leg_left3", - "parent": "leg_left2", - "pivot": [19.76532, 33.92692, 13.90262], - "rotation": [55, 0, 0], - "cubes": [ - {"origin": [14.22989, 14.97535, 9.92239], "size": [10, 19, 9], "inflate": -0.1, "uv": [0, 0]} - ] - }, - { - "name": "leg_left4", - "parent": "leg_left3", - "pivot": [19.76532, 14.92692, 13.90262], - "rotation": [-60, 0, 0], - "cubes": [ - {"origin": [14.22989, 2.41759, 7.14887], "size": [10, 17, 9], "inflate": 0.375, "uv": [0, 85]} - ] - }, - { - "name": "Claw5", - "parent": "leg_left4", - "pivot": [18.03922, 11.69239, 7.72125], - "rotation": [3.25353, -39.92899, -4.10228], - "cubes": [ - {"origin": [19.68942, 7.60244, 18.32118], "size": [2, 5, 6], "inflate": -0.2, "pivot": [20.68942, 10.90244, 16.32118], "rotation": [4, 5, 0], "uv": [19, 239]}, - {"origin": [15.96316, 8.07744, 15.28926], "size": [2, 3, 4], "inflate": 0.5, "pivot": [20.4918, 5.40696, 3.40745], "rotation": [2.31336, 4.43385, 27.58957], "uv": [29, 0]} - ] - }, - { - "name": "leg_left5", - "parent": "leg_left4", - "pivot": [19.76532, 2.72669, 9.58045], - "rotation": [32.5, 0, 0], - "cubes": [ - {"origin": [14.22989, -4.78265, 7.2517], "size": [10, 8, 8], "inflate": 0.35, "uv": [42, 267]} - ] - }, - { - "name": "Claw3", - "parent": "leg_left5", - "pivot": [14.03922, -1.93376, 9.83799], - "rotation": [-11.28559, 36.03256, -29.0792], - "cubes": [ - {"origin": [15.68942, -5.02371, -6.76194], "size": [2, 4, 9], "inflate": -0.2, "pivot": [16.68942, -2.72371, 1.23806], "rotation": [-4, -5, 0], "uv": [78, 267]}, - {"origin": [11.96316, -5.54871, -1.73002], "size": [2, 3, 12], "inflate": 0.5, "pivot": [16.4918, -8.21919, 14.15179], "rotation": [-2.31336, -4.43385, 27.58957], "uv": [45, 298]}, - {"origin": [13.86316, -1.04871, -0.45502], "size": [2, 3, 12], "inflate": 0.4, "pivot": [18.3918, -3.71919, 15.42679], "rotation": [14.70847, -5.40113, 27.33492], "uv": [263, 297]} - ] - }, - { - "name": "Claw2", - "parent": "leg_left5", - "pivot": [18.00128, -1.52657, 8.77203], - "rotation": [6.46283, 10.46681, -26.49382], - "cubes": [ - {"origin": [19.65148, -4.61652, -7.8279], "size": [2, 4, 9], "inflate": -0.2, "pivot": [20.65148, -2.31652, 0.1721], "rotation": [-8.25367, -3.37646, 28.00254], "uv": [259, 183]}, - {"origin": [15.92522, -5.14152, -2.79598], "size": [2, 3, 12], "inflate": 0.5, "pivot": [20.45386, -7.812, 13.08583], "rotation": [-2.31336, -4.43385, 27.58957], "uv": [0, 284]}, - {"origin": [17.82522, -0.64152, -1.52098], "size": [2, 3, 12], "inflate": 0.4, "pivot": [22.35386, -3.312, 14.36083], "rotation": [14.70847, -5.40113, 27.33492], "uv": [45, 283]} - ] - }, - { - "name": "Claw4", - "parent": "leg_left5", - "pivot": [25.00339, -1.78444, 9.60342], - "rotation": [-6.62428, -31.83686, 25.40349], - "cubes": [ - {"origin": [21.35319, -4.87439, -6.99651], "size": [2, 4, 9], "inflate": -0.2, "pivot": [22.35319, -2.57439, 1.00349], "rotation": [-4, 5, 0], "uv": [172, 21]}, - {"origin": [25.07945, -5.39939, -1.96459], "size": [2, 3, 12], "inflate": 0.5, "pivot": [22.55081, -8.06987, 13.91722], "rotation": [-2.31336, 4.43385, -27.58957], "uv": [222, 145]}, - {"origin": [23.17945, -0.89939, -0.68959], "size": [2, 3, 12], "inflate": 0.4, "pivot": [20.65081, -3.56987, 15.19222], "rotation": [14.70847, 5.40113, -27.33492], "uv": [222, 130]} - ] - }, - { - "name": "leg_right", - "parent": "Tyrannosaurus", - "pivot": [-20.42923, 70.7324, 8.85434], - "rotation": [-15.09173, 1.85092, 0.08398], - "cubes": [ - {"origin": [-25.41866, 41.02086, -4.25109], "size": [12.875, 42.825, 23.725], "uv": [79, 257], "mirror": true} - ] - }, - { - "name": "leg_right2", - "parent": "leg_right", - "pivot": [-21.99279, 43.52539, 1.69711], - "cubes": [ - {"origin": [-25.244, 24.19389, 3.09297], "size": [12.4, 20.375, 15.95], "pivot": [-21.944, 35.38139, 0.96797], "rotation": [34, 0, 0], "uv": [279, 297], "mirror": true} - ] - }, - { - "name": "leg_right3", - "parent": "leg_right2", - "pivot": [-19.76532, 33.92692, 13.90262], - "rotation": [55, 0, 0], - "cubes": [ - {"origin": [-24.22989, 14.97535, 9.92239], "size": [10, 19, 9], "inflate": -0.1, "uv": [0, 0], "mirror": true} - ] - }, - { - "name": "leg_right4", - "parent": "leg_right3", - "pivot": [-19.76532, 14.92692, 13.90262], - "rotation": [-60, 0, 0], - "cubes": [ - {"origin": [-24.22989, 2.41759, 7.14887], "size": [10, 17, 9], "inflate": 0.375, "uv": [0, 85], "mirror": true} - ] - }, - { - "name": "Claw6", - "parent": "leg_right4", - "pivot": [-18.03922, 11.69239, 7.72125], - "rotation": [3.25353, 39.92899, 4.10228], - "cubes": [ - {"origin": [-21.68942, 7.60244, 18.32118], "size": [2, 5, 6], "inflate": -0.2, "pivot": [-20.68942, 10.90244, 16.32118], "rotation": [4, -5, 0], "uv": [19, 239], "mirror": true}, - {"origin": [-17.96316, 8.07744, 15.28926], "size": [2, 3, 4], "inflate": 0.5, "pivot": [-20.4918, 5.40696, 3.40745], "rotation": [2.31336, -4.43385, -27.58957], "uv": [29, 0], "mirror": true} - ] - }, - { - "name": "leg_right5", - "parent": "leg_right4", - "pivot": [-19.76532, 2.72669, 9.58045], - "rotation": [32.5, 0, 0], - "cubes": [ - {"origin": [-24.22989, -4.78265, 7.2517], "size": [10, 8, 8], "inflate": 0.35, "uv": [42, 267], "mirror": true} - ] - }, - { - "name": "Claw7", - "parent": "leg_right5", - "pivot": [-14.03922, -1.93376, 9.83799], - "rotation": [-11.28559, -36.03256, 29.0792], - "cubes": [ - {"origin": [-17.68942, -5.02371, -6.76194], "size": [2, 4, 9], "inflate": -0.2, "pivot": [-16.68942, -2.72371, 1.23806], "rotation": [-4, 5, 0], "uv": [78, 267], "mirror": true}, - {"origin": [-13.96316, -5.54871, -1.73002], "size": [2, 3, 12], "inflate": 0.5, "pivot": [-16.4918, -8.21919, 14.15179], "rotation": [-2.31336, 4.43385, -27.58957], "uv": [45, 298], "mirror": true}, - {"origin": [-15.86316, -1.04871, -0.45502], "size": [2, 3, 12], "inflate": 0.4, "pivot": [-18.3918, -3.71919, 15.42679], "rotation": [14.70847, 5.40113, -27.33492], "uv": [263, 297], "mirror": true} - ] - }, - { - "name": "Claw8", - "parent": "leg_right5", - "pivot": [-18.00128, -1.52657, 8.77203], - "rotation": [6.46283, -10.46681, 26.49382], - "cubes": [ - {"origin": [-21.65148, -4.61652, -7.8279], "size": [2, 4, 9], "inflate": -0.2, "pivot": [-20.65148, -2.31652, 0.1721], "rotation": [-8.25367, 3.37646, -28.00254], "uv": [259, 183], "mirror": true}, - {"origin": [-17.92522, -5.14152, -2.79598], "size": [2, 3, 12], "inflate": 0.5, "pivot": [-20.45386, -7.812, 13.08583], "rotation": [-2.31336, 4.43385, -27.58957], "uv": [0, 284], "mirror": true}, - {"origin": [-19.82522, -0.64152, -1.52098], "size": [2, 3, 12], "inflate": 0.4, "pivot": [-22.35386, -3.312, 14.36083], "rotation": [14.70847, 5.40113, -27.33492], "uv": [45, 283], "mirror": true} - ] - }, - { - "name": "Claw9", - "parent": "leg_right5", - "pivot": [-25.00339, -1.78444, 9.60342], - "rotation": [-6.62428, 31.83686, -25.40349], - "cubes": [ - {"origin": [-23.35319, -4.87439, -6.99651], "size": [2, 4, 9], "inflate": -0.2, "pivot": [-22.35319, -2.57439, 1.00349], "rotation": [-4, -5, 0], "uv": [172, 21], "mirror": true}, - {"origin": [-27.07945, -5.39939, -1.96459], "size": [2, 3, 12], "inflate": 0.5, "pivot": [-22.55081, -8.06987, 13.91722], "rotation": [-2.31336, -4.43385, 27.58957], "uv": [222, 145], "mirror": true}, - {"origin": [-25.17945, -0.89939, -0.68959], "size": [2, 3, 12], "inflate": 0.4, "pivot": [-20.65081, -3.56987, 15.19222], "rotation": [14.70847, -5.40113, 27.33492], "uv": [222, 130], "mirror": true} - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/NeoForge/src/main/resources/assets/bluelib/lang/en_us.json b/NeoForge/src/main/resources/assets/bluelib/lang/en_us.json deleted file mode 100644 index 8371c823..00000000 --- a/NeoForge/src/main/resources/assets/bluelib/lang/en_us.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "entity.bluelib.example_one": "Example", - "entity.bluelib.example_two": "Example" -} \ No newline at end of file diff --git a/NeoForge/src/main/resources/assets/bluelib/textures/entity/dragon/bright.png b/NeoForge/src/main/resources/assets/bluelib/textures/entity/dragon/bright.png deleted file mode 100644 index e7ebe131..00000000 Binary files a/NeoForge/src/main/resources/assets/bluelib/textures/entity/dragon/bright.png and /dev/null differ diff --git a/NeoForge/src/main/resources/assets/bluelib/textures/entity/dragon/dark.png b/NeoForge/src/main/resources/assets/bluelib/textures/entity/dragon/dark.png deleted file mode 100644 index 56c9452f..00000000 Binary files a/NeoForge/src/main/resources/assets/bluelib/textures/entity/dragon/dark.png and /dev/null differ diff --git a/NeoForge/src/main/resources/assets/bluelib/textures/entity/rex/brown.png b/NeoForge/src/main/resources/assets/bluelib/textures/entity/rex/brown.png deleted file mode 100644 index f2956d05..00000000 Binary files a/NeoForge/src/main/resources/assets/bluelib/textures/entity/rex/brown.png and /dev/null differ diff --git a/NeoForge/src/main/resources/assets/bluelib/textures/entity/rex/green.png b/NeoForge/src/main/resources/assets/bluelib/textures/entity/rex/green.png deleted file mode 100644 index f1afa76a..00000000 Binary files a/NeoForge/src/main/resources/assets/bluelib/textures/entity/rex/green.png and /dev/null differ diff --git a/NeoForge/src/main/resources/data/bluelib/variant/entity/dragon.json b/NeoForge/src/main/resources/data/bluelib/variant/entity/dragon.json deleted file mode 100644 index f9e844e6..00000000 --- a/NeoForge/src/main/resources/data/bluelib/variant/entity/dragon.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "dragon": [ - { - "variantName": "dark", - "customParameter": "customValue1", - "int": 1, - "bool": true, - "array": [ - "boop", - "blep" - ] - }, - { - "variantName": "bright", - "customParameter": "customValue2", - "int": 2, - "bool": true, - "array": [ - "bleep", - "booop" - ] - } - ] -} \ No newline at end of file diff --git a/NeoForge/src/main/resources/data/bluelib/variant/entity/rex.json b/NeoForge/src/main/resources/data/bluelib/variant/entity/rex.json deleted file mode 100644 index d6b12dd0..00000000 --- a/NeoForge/src/main/resources/data/bluelib/variant/entity/rex.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "rex": [ - { - "variantName": "brown", - "customParameter": "customValue11", - "int": 1, - "bool": true, - "array": [ - "boop", - "blep" - ] - }, - { - "variantName": "green", - "customParameter": "customValue22", - "int": 1, - "bool": true, - "array": [ - "boop", - "blep" - ] - } - ] -} \ No newline at end of file diff --git a/NeoForge/src/main/resources/pack.mcmeta b/NeoForge/src/main/resources/pack.mcmeta deleted file mode 100644 index 325d954f..00000000 --- a/NeoForge/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "pack_format": 9, - "description": "bluelib" - } -} \ No newline at end of file