Skip to content

Commit

Permalink
Changed 1.16.X to use cursemaven as well (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan6335 authored Sep 4, 2024
1 parent 433b8a7 commit ee289d9
Show file tree
Hide file tree
Showing 62 changed files with 194 additions and 3,310 deletions.
16 changes: 11 additions & 5 deletions Forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
}*/
18 changes: 10 additions & 8 deletions Forge/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
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.
4 changes: 2 additions & 2 deletions Forge/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
16 changes: 8 additions & 8 deletions Forge/src/main/java/software/bluelib/BlueLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
* <p>
* This class manages the dragon's variant system, its data synchronization, and integrates with the GeckoLib
* animation system.
Expand All @@ -34,9 +38,9 @@
* Key Methods:
* <ul>
* <li>{@link #defineSynchedData()} - Defines the synchronized data for the dragon entity, including its variant.</li>
* <li>{@link #addAdditionalSaveData(CompoundTag)} - Adds custom data to the entity's NBT for saving.</li>
* <li>{@link #readAdditionalSaveData(CompoundTag)} - Reads custom data from the entity's NBT for loading.</li>
* <li>{@link #finalizeSpawn(ServerLevelAccessor, DifficultyInstance, MobSpawnType, SpawnGroupData, CompoundTag)} - Finalizes the spawning process and sets up parameters.</li>
* <li>{@link #addAdditionalSaveData(CompoundNBT)} - Adds custom data to the entity's NBT for saving.</li>
* <li>{@link #readAdditionalSaveData(CompoundNBT)} - Reads custom data from the entity's NBT for loading.</li>
* <li>{@link #finalizeSpawn(IServerWorld, DifficultyInstance, SpawnReason, ILivingEntityData, CompoundNBT)} - Finalizes the spawning process and sets up parameters.</li>
* <li>{@link #setVariantName(String)} - Sets the variant name of the dragon.</li>
* <li>{@link #getVariantName()} - Retrieves the current variant name of the dragon.</li>
* </ul>
Expand All @@ -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.
* <p>
Expand All @@ -55,7 +59,7 @@ public class DragonEntity extends TamableAnimal implements IVariantEntity, GeoEn
* @Co-author MeAlam, Dan
* @since 1.0.0
*/
public static final EntityDataAccessor<String> VARIANT = SynchedEntityData.defineId(DragonEntity.class, EntityDataSerializers.STRING);
public static final DataParameter<String> VARIANT = EntityDataManager.defineId(DragonEntity.class, DataSerializers.STRING);

/**
* The name of the entity.
Expand All @@ -68,20 +72,20 @@ public class DragonEntity extends TamableAnimal implements IVariantEntity, GeoEn
* Constructs a new {@link DragonEntity} instance with the specified entity type and level.
*
* @param pEntityType {@link EntityType} - The type of the entity.
* @param pLevel {@link Level} - The level in which the entity is created.
* @param pLevel {@link World} - The level in which the entity is created.
*
* @since 1.0.0
* @author MeAlam
* @Co-author Dan
*/
public DragonEntity(EntityType<? extends TamableAnimal> pEntityType, Level pLevel) {
public DragonEntity(EntityType<? extends TameableEntity> pEntityType, World pLevel) {
super(pEntityType, pLevel);
}

/**
* Defines the synchronized data for this dragon entity, including the variant.
* <p>
* This method initializes the {@link EntityDataAccessor} to handle the variant data.
* This method initializes the {@link DataParameter} to handle the variant data.
* </p>
*
* @since 1.0.0
Expand All @@ -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.
* </p>
*
* @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());
}
Expand All @@ -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.
* </p>
*
* @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"));
}
Expand All @@ -136,19 +140,19 @@ public void readAdditionalSaveData(@NotNull CompoundTag pCompound) {
* This method sets up the variant for the entity and connects parameters if needed.
* </p>
*
* @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())
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<DragonEntity> {
public class DragonModel extends AnimatedGeoModel<DragonEntity> {


// 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");
}
}
Loading

0 comments on commit ee289d9

Please sign in to comment.