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

port to neoforge 1.21.3 #673

Open
wants to merge 2 commits into
base: 1.21_neo
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ plugins {
if (project.file('../gradletools.gradle').exists()) {
apply from: '../gradletools.gradle'
} else {
apply from: 'https://raw.githubusercontent.com/McJtyMods/MultiWorkspace/1.21_neo/gradletools.gradle'
apply from: 'gradletools.gradle'
// apply from: 'https://raw.githubusercontent.com/McJtyMods/MultiWorkspace/1.21_neo/gradletools.gradle'
}

group = "com.github.mcjty"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod_id=lostcities
mod_name=LostCities
version=1.21-8.2.5
version=1.21.3-8.2.5
curse_type=beta
projectId=269024
projectSlug=the-lost-cities
Expand Down
264 changes: 264 additions & 0 deletions gradletools.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
project.ext.set("mod_group_id", 'com.github.mcjty')
project.ext.set("mod_authors", 'McJty')
project.ext.set("minecraft_version", '1.21.3')
project.ext.set("minecraft_version_range", '[1.21,1.22)')
project.ext.set("parchment_version", '2024.07.28')
project.ext.set("parchment_minecraft_version", '1.21')
project.ext.set("neo_version", '21.3.58')
project.ext.set("neo_version_range", '[21.1,)')
project.ext.set("loader_version_range", '[4,)')
project.ext.set("jei_version", '19.9.1.125')
project.ext.set("patchouli_version", '1.21-87-NEOFORGE')
project.ext.set("top_version", '1.21_neo-12.0.3-5')
project.ext.set("mcjtylib_version", '1.21-9.0.5.8')
project.ext.set("rftoolsbase_version", '1.21-6.0.2-5')
project.ext.set("curios_version", '5.2.0-beta.3+1.20.1')
project.ext.set("lostcities_version", '1.21-8.2.2-6')
project.ext.set("bookshelf_version", '1.20.1:20.0.2')
project.ext.set("gamestages_version", '1.20.1:15.0.1')
project.ext.set("sereneseasons_version", '1.21-10.0.0.2')

ext.getChangelogText = {
def changelogFile = file('changelog.txt')
String str = ''
int lineCount = 0
boolean done = false
changelogFile.eachLine {
if (done || it == null) {
return
}
if (it.size() > 1) {
def temp = it
if (lineCount == 0) {
temp = "${mod_name} ${version}"
temp = "<h2>$temp</h2>"
} else if (it.startsWith('-')) {
temp = "&nbsp;&nbsp;&nbsp;$temp"
temp = temp.replaceAll("(\\S+\\/\\S+)#([0-9]+)\\b", "<a href=\"https://github.com/\$1/issues/\$2\">\$0</a>");
temp = temp.replaceAll("#([0-9]+)\\b(?!<\\/a>)", "<a href=\"https://github.com/$github_project/issues/\$1\">\$0</a>");
} else {
temp = "<h4>$temp</h4>"
}
str += "$temp<br/>"
lineCount++
return
} else {
done = true
}
}
return str
}

ext.repos = {
repositories {
mavenLocal()
maven { url "https://maven.blamejared.com" } // Patchouli, bookshelf, gamestages, JEI
//maven { url "https://dvs1.progwml6.com/files/maven" } // JEI
maven { url "https://maven.k-4u.nl" } // McJtyLib, TOP
maven { url 'https://maven.minecraftforge.net/' } // Serene Seasons
maven { url "https://maven.theillusivec4.top/" } // Curios
}
}

ext.parch = {
dependencies {
subsystems {
parchment {
minecraftVersion = ${parchment_minecraft_version}
mappingsVersion = ${parchment_version}
}
}
}
}

ext.mc = {
dependencies.implementation "net.neoforged:neoforge:${neo_version}"
}

ext.jei = {
dependencies.compileOnly "mezz.jei:jei-${minecraft_version}-common-api:${jei_version}"
dependencies.compileOnly "mezz.jei:jei-${minecraft_version}-neoforge-api:${jei_version}"
dependencies.runtimeOnly "mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}"
}

ext.patchouli = {
dependencies.implementation "vazkii.patchouli:Patchouli:${patchouli_version}"
}

ext.gamestages = {
dependencies.implementation "net.darkhax.bookshelf:Bookshelf-Forge-${bookshelf_version}"
dependencies.implementation "net.darkhax.gamestages:GameStages-Forge-${gamestages_version}"
}

ext.sereneseasons = {
dependencies.compileOnly "com.github.glitchfiend:SereneSeasons-neoforge:${sereneseasons_version}"
}

ext.top = {
if (findProject(':TheOneProbe') != null) {
dependencies.implementation project(':TheOneProbe')
} else {
dependencies.implementation "mcjty.theoneprobe:theoneprobe:${top_version}"
}
}

ext.mcjtylib = {
if (findProject(':McJtyLib') != null) {
dependencies.implementation project(':McJtyLib')
} else {
dependencies.implementation "com.github.mcjty:mcjtylib:${mcjtylib_version}"
}
}

ext.rftoolsbase = {
if (findProject(':RFToolsBase') != null) {
dependencies.implementation project(':RFToolsBase')
} else {
dependencies.implementation "com.github.mcjty:rftoolsbase:${rftoolsbase_version}"
}
}

ext.curios = {
dependencies.runtimeOnly "top.theillusivec4.curios:curios-forge:${curios_version}"
dependencies.compileOnly "top.theillusivec4.curios:curios-forge:${curios_version}:api"
}

ext.lostcities = {
if (findProject(':LostCities') != null) {
dependencies.implementation project(':LostCities')
} else {
dependencies.implementation "com.github.mcjty:lostcities:${lostcities_version}"
}
}

ext.modrinth = { opt, req, versions ->
tasks.modrinth.enabled = project.hasProperty('modrinth_token')
modrinth {
if (project.hasProperty('modrinth_token')) {
token = project.modrinth_token
}
projectId = project.projectSlug
versionType = project.curse_type
versionName = "${mod_name} - ${version}"
uploadFile = jar
gameVersions = [project.minecraft_version] + versions
changelog = System.getenv('CHANGELOG') == null || System.getenv('CHANGELOG').equals('none') ? getChangelogText() : System.getenv('CHANGELOG')
dependencies {
opt.each { lib ->
optional.project lib
}
req.each { lib ->
required.project lib
}
}
}
}

ext.cfdeps = { optional, required, versions ->
tasks.curseforge.enabled = project.hasProperty('curseforge_key')
curseforge {
if (project.hasProperty('curseforge_key')) {
apiKey = project.curseforge_key
}

project {
id = project.projectId
changelog = System.getenv('CHANGELOG') == null || System.getenv('CHANGELOG').equals('none') ? getChangelogText() : System.getenv('CHANGELOG')
changelogType = 'html'
releaseType = project.curse_type
addGameVersion project.minecraft_version
versions.each { v ->
addGameVersion v
}
mainArtifact(jar) {
displayName = "${mod_name} - ${version}"
}
if (optional.size() > 0 || required.size() > 0) {
relations {
optional.each { lib ->
optionalLibrary lib
}
required.each { lib ->
requiredDependency lib
}
}
}
}
}
}

ext.at = {
minecraft {
accessTransformers {
file('src/main/resources/META-INF/accesstransformer.cfg')
}
}
}

ext.runs = {
runs {
configureEach {
systemProperty 'forge.logging.markers', 'REGISTRIES'
systemProperty 'forge.logging.console.level', 'debug'
modSource project.sourceSets.main
}

client {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}

server {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
argument '--nogui'
}

gameTestServer {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}

data {
arguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
}
}

ext.jars = {
jar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
manifest {
attributes([
"Specification-Title" : project.mod_id,
"Specification-Vendor" : project.mod_authors,
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : project.jar.archiveVersion,
"Implementation-Vendor" : project.mod_authors,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
}

ext.publish = {
// Example configuration to allow publishing using the maven-publish task
// we define a custom artifact that is sourced from the reobfJar output task
// and then declare that to be published
// Note you'll need to add a repository here
def reobfFile = file("$buildDir/reobfJar/output.jar")
def reobfArtifact = artifacts.add('default', reobfFile) {
type 'jar'
builtBy 'reobfJar'
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact reobfArtifact
}
}
repositories {
maven {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public int run(CommandContext<CommandSourceStack> context) throws CommandSyntaxE
ChunkPos cp = new ChunkPos(bottom);

int height = bottom.getY();
for (int y = height ; y < level.getMaxBuildHeight() ; y++) {
for (int y = height ; y < level.getMaxY()+1; y++) {
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
level.setBlock(cp.getBlockAt(x, y, z), Blocks.AIR.defaultBlockState(), Block.UPDATE_CLIENTS);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/mcjty/lostcities/config/LostCityProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ public boolean isSpheres() {

public BlockState getLiquidBlock() {
if (liquidBlock == null) {
Block b = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(LIQUID_BLOCK));
Block b = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(LIQUID_BLOCK)).get().value();
if (b == null) {
ModSetup.getLogger().error("Bad liquid block: {}!", LIQUID_BLOCK);
liquidBlock = Blocks.WATER.defaultBlockState();
Expand All @@ -542,7 +542,7 @@ public BlockState getLiquidBlock() {

public BlockState getBaseBlock() {
if (baseBlock == null) {
Block b = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(BASE_BLOCK));
Block b = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(BASE_BLOCK)).get().value();
if (b == null) {
ModSetup.getLogger().error("Bad base block: {}!", BASE_BLOCK);
baseBlock = Blocks.STONE.defaultBlockState();
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/mcjty/lostcities/config/ProfileSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,15 @@ private static void initStandardProfiles() {
profile.BUILDING_MAXFLOORS_CHANCE = 7;
profile.BUILDING_CHANCE = .4f;
STANDARD_PROFILES.put(profile.getName(), profile);

profile = new LostCityProfile("safeandrare", true);
profile.setDescription("Safe mode: no spawners, lighting and rare");
profile.setIconFile("textures/gui/icon_safe.png");
profile.CITY_CHANCE = 0.005;
profile.GENERATE_SPAWNERS = false;
profile.GENERATE_LIGHTING = true;
STANDARD_PROFILES.put(profile.getName(), profile);

}

public static void setupProfiles() {
Expand Down Expand Up @@ -422,6 +431,7 @@ private static void readProfiles(Path profileDir) {
String[] split = name.split("\\.");
LostCityProfile profile = new LostCityProfile(split[0], json);
STANDARD_PROFILES.put(split[0], profile);
LostCities.getLogger().info("Profile "+split[0]+" from "+name);
} catch (IOException e) {
LostCities.getLogger().error("Couldn't read profile '{}'!", name);
return;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mcjty/lostcities/gui/NullDimensionInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public Holder<Biome> getBiome(BlockPos pos) {
case 'd' -> Biomes.DESERT;
default -> Biomes.PLAINS;
};
return biomeRegistry.getHolderOrThrow(biome);
return biomeRegistry.getOrThrow(biome);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.resources.ResourceLocation;
import net.neoforged.neoforge.client.event.ScreenEvent;
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
Expand Down Expand Up @@ -53,7 +54,7 @@ public void onGuiDraw(ScreenEvent.Render.Post event) {
if (event.getScreen() instanceof CreateWorldScreen screen && lostCitiesButton != null) {
lostCitiesButton.visible = screen.tabManager.getCurrentTab() instanceof CreateWorldScreen.MoreTab;
if (lostCitiesButton.visible) {
event.getGuiGraphics().blit(txt, screen.width - 100, 60, 70, 70, 256, 256, 256, 256, 256, 256);
event.getGuiGraphics().blit(RenderType::guiTextured, txt, screen.width - 100, 60, 70, 70, 256, 256, 256, 256, 256, 256);
}
}
}
Expand Down
Loading