Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change access on methods and add variable getters #13

Merged
merged 3 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 39 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1682616243
//version: 1685785062
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -69,8 +69,11 @@ plugins {
id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version
id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.7'
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.14'
}

print("You might want to check out './gradlew :faq' if your build fails.\n")

boolean settingsupdated = verifySettingsGradle()
settingsupdated = verifyGitAttributes() || settingsupdated
if (settingsupdated)
Expand Down Expand Up @@ -219,6 +222,8 @@ if (enableModernJavaSyntax.toBoolean()) {

dependencies {
annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0'
// workaround for https://github.com/bsideup/jabel/issues/174
annotationProcessor 'net.java.dev.jna:jna-platform:5.13.0'
compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') {
transitive = false // We only care about the 1 annotation class
}
Expand Down Expand Up @@ -564,9 +569,10 @@ repositories {

def mixinProviderGroup = "io.github.legacymoddingmc"
def mixinProviderModule = "unimixins"
def mixinProviderVersion = "0.1.6"
def mixinProviderVersion = "0.1.7.1"
def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
ext.mixinProviderSpec = mixinProviderSpec

dependencies {
if (usesMixins.toBoolean()) {
Expand Down Expand Up @@ -724,7 +730,7 @@ dependencies {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
}
if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.8')
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.13')
}

java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false}
Expand Down Expand Up @@ -817,6 +823,18 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
}
this.classpath(project.java17DependenciesCfg)
}

public void setup(Project project) {
super.setup(project)
if (project.usesMixins.toBoolean()) {
this.extraJvmArgs.addAll(project.provider(() -> {
def mixinCfg = project.configurations.detachedConfiguration(project.dependencies.create(project.mixinProviderSpec))
mixinCfg.canBeConsumed = false
mixinCfg.transitive = false
enableHotswap ? ["-javaagent:" + mixinCfg.singleFile.absolutePath] : []
}))
}
}
}

def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Distribution.CLIENT, "runClient")
Expand Down Expand Up @@ -1252,6 +1270,23 @@ if (!project.getGradle().startParameter.isOffline() && !Boolean.getBoolean('DISA
}
}

// If you want to add more cases to this task, implement them as arguments if total amount to print gets too large
tasks.register('faq') {
group = 'GTNH Buildscript'
description = 'Prints frequently asked questions about building a project'

doLast {
print("If your build fails to fetch dependencies, run './gradlew updateDependencies'. " +
"Or you can manually check if the versions are still on the distributing sites - " +
"the links can be found in repositories.gradle and build.gradle:repositories, " +
"but not build.gradle:buildscript.repositories - those ones are for gradle plugin metadata.\n\n" +
"If your build fails to recognize the syntax of new Java versions, enable Jabel in your " +
"gradle.properties. See how it's done in GTNH ExampleMod/gradle.properties. " +
"However, keep in mind that Jabel enables only syntax features, but not APIs that were introduced in " +
"Java 9 or later.")
}
}

static URL availableBuildScriptUrl() {
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/build.gradle")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import net.minecraft.entity.IEntityOwnable;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
Expand Down Expand Up @@ -420,8 +419,8 @@ public void processEntitySpawn(EntityLivingBase entity) {
}
}

private boolean isClassAllowed(EntityLivingBase entity) {
if (entity instanceof EntityMob || (entity instanceof IMob)) {
public boolean isClassAllowed(EntityLivingBase entity) {
if ((entity instanceof IMob)) {
if (entity instanceof IEntityOwnable) {
return false;
}
Expand Down Expand Up @@ -462,7 +461,7 @@ private boolean checkEntityClassAllowed(EntityLivingBase entity) {
return result;
}

private boolean checkEntityClassForced(EntityLivingBase entity) {
public boolean checkEntityClassForced(EntityLivingBase entity) {
String entName = useSimpleEntityClassNames ? entity.getClass().getSimpleName() : getEntityNameSafe(entity);
if (classesForcedMap.containsKey(entName)) {
return classesForcedMap.get(entName);
Expand Down Expand Up @@ -837,4 +836,83 @@ public HashMap<UUID, Long> getModifiedPlayerTimes() {
return modifiedPlayerTimes;
}

public ArrayList<Integer> getDimensionBlackList() {
return dimensionBlackList;
}

public ArrayList<ItemStack> getDropIdListElite() {
return dropIdListElite;
}

public ArrayList<ItemStack> getDropIdListUltra() {
return dropIdListUltra;
}

public ArrayList<ItemStack> getDropIdListInfernal() {
return dropIdListInfernal;
}

public HashMap<String, Boolean> getClassesAllowedMap() {
return classesAllowedMap;
}

public HashMap<String, Boolean> getClassesForcedMap() {
return classesForcedMap;
}

public HashMap<String, Float> getClassesHealthMap() {
return classesHealthMap;
}

public boolean isUseSimpleEntityClassNames() {
return useSimpleEntityClassNames;
}

public boolean isDisableHealthBar() {
return disableHealthBar;
}

public double getModHealthFactor() {
return modHealthFactor;
}

public ArrayList<ModifierLoader<?>> getModifierLoaders() {
return modifierLoaders;
}

public int getEliteRarity() {
return eliteRarity;
}

public int getUltraRarity() {
return ultraRarity;
}

public int getInfernoRarity() {
return infernoRarity;
}

public int getMinEliteModifiers() {
return minEliteModifiers;
}

public int getMaxEliteModifiers() {
return maxEliteModifiers;
}

public int getMinUltraModifiers() {
return minUltraModifiers;
}

public int getMaxUltraModifiers() {
return maxUltraModifiers;
}

public int getMinInfernoModifiers() {
return minInfernoModifiers;
}

public int getMaxInfernoModifiers() {
return maxInfernoModifiers;
}
}