Fix 1.12.2 bugs, fill mcmod.info
This commit is contained in:
@@ -6,6 +6,7 @@ import org.apache.tools.zip.ZipOutputStream
|
||||
import javax.annotation.Nonnull
|
||||
import java.util.function.Function
|
||||
import java.util.function.Predicate
|
||||
import groovy.json.JsonSlurper
|
||||
|
||||
// Convention plugin for all MC-facing subprojects (common + loaders).
|
||||
// Common uses this directly; loaders use it via unimined-fabric/forge/neoforge.
|
||||
@@ -469,6 +470,7 @@ if (isNotCommonProject) {
|
||||
def resourceTargets = [
|
||||
"build_info.json",
|
||||
"fabric.mod.json",
|
||||
"mcmod.info",
|
||||
"quilt.mod.json",
|
||||
"META-INF/mods.toml",
|
||||
"META-INF/neoforge.mods.toml",
|
||||
@@ -479,6 +481,7 @@ if (isNotCommonProject) {
|
||||
// Quilt contributors
|
||||
def quilt_contributors = []
|
||||
def mod_author_list = rootProject.mod_authors.replaceAll("\"", "").replace("[", "").replace("]", "").split(",")
|
||||
def cleanroom_author_list = rootProject.mod_authors.replace('[', '').replace(']', '').split(',').collect { it.trim().replace('"', '') }.join('", "')
|
||||
for (dev in mod_author_list) {
|
||||
quilt_contributors.push("\"${dev.strip()}\": \"Developer\"")
|
||||
}
|
||||
@@ -496,9 +499,11 @@ if (isNotCommonProject) {
|
||||
|
||||
def replaceProperties = [
|
||||
version : rootProject.mod_version,
|
||||
mod_id : rootProject.mod_id,
|
||||
mod_name : rootProject.mod_readable_name,
|
||||
group : rootProject.maven_group,
|
||||
authors : rootProject.mod_authors,
|
||||
cleanroom_authors : cleanroom_author_list,
|
||||
description : rootProject.mod_description,
|
||||
homepage : rootProject.mod_homepage,
|
||||
source : rootProject.mod_source,
|
||||
@@ -516,6 +521,7 @@ if (isNotCommonProject) {
|
||||
fabric_incompatibility_list : rootProject.fabric_incompatibility_list,
|
||||
fabric_recommend_list : rootProject.fabric_recommend_list,
|
||||
neoforge_version_range : rootProject.neoforge_version_range,
|
||||
logo_path : "assets/distanthorizons/icon.png"
|
||||
]
|
||||
|
||||
inputs.properties replaceProperties
|
||||
@@ -546,6 +552,24 @@ if (isNotCommonProject) {
|
||||
from fileTree(project(":core").file("src/main/resources"))
|
||||
into project.file("build/resources/main")
|
||||
}
|
||||
|
||||
tasks.register("convertJsonToLang") {
|
||||
dependsOn(copyCoreResources)
|
||||
|
||||
File input = project.file("build/resources/main/assets/distanthorizons/lang/en_us.json")
|
||||
File output = project.file("build/resources/main/assets/distanthorizons/lang/en_us.lang")
|
||||
inputs.file(input)
|
||||
outputs.file(output)
|
||||
doLast {
|
||||
output.withWriter("UTF-8") { writer ->
|
||||
new JsonSlurper()
|
||||
.parse(input)
|
||||
.each { key, value ->
|
||||
writer.writeLine("${key}=${value.toString().replace("%", "%%").replace("\n", "\\n")}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ==================== JVMDowngrader ====================
|
||||
|
||||
@@ -29,6 +29,7 @@ task deleteResources(type: Delete) {
|
||||
processResources {
|
||||
rename '(.+_at.cfg)', 'META-INF/$1'
|
||||
dependsOn(copyCoreResources)
|
||||
dependsOn(convertJsonToLang)
|
||||
// dependsOn(copyCommonLoaderResources)
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,6 @@ public class CleanroomServerProxy implements AbstractModInitializer.IEventProxy
|
||||
{
|
||||
if (GetEventLevel(event) instanceof WorldServer)
|
||||
{
|
||||
InternalServerGenerator.DH_SERVER_GEN_TICKET_MAP.put(event.getWorld(), ForgeChunkManager.requestTicket(instance, event.getWorld(), ForgeChunkManager.Type.NORMAL));
|
||||
this.serverApi.serverLevelLoadEvent(getServerLevelWrapper((WorldServer) GetEventLevel(event)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
[{
|
||||
"modid": "${mod_id}",
|
||||
"name": "${mod_name}",
|
||||
"version": "${mod_version}",
|
||||
"version": "${version}",
|
||||
"mcversion": "1.12.2",
|
||||
"description": "${mod_description}",
|
||||
"authorList": ["${mod_authors}"],
|
||||
"credits": "${mod_credits}",
|
||||
"url": "${mod_url}",
|
||||
"updateJSON": "${mod_update_json}",
|
||||
"logoFile": "${mod_logo_path}"
|
||||
"description": "${description}",
|
||||
"authorList": ["${cleanroom_authors}"],
|
||||
"credits": "",
|
||||
"url": "",
|
||||
"updateJSON": "",
|
||||
"logoFile": "${logo_path}"
|
||||
}]
|
||||
+16
@@ -35,6 +35,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.*;
|
||||
@@ -252,6 +253,21 @@ public class ClientBlockStateColorCache
|
||||
{
|
||||
// getQuads() isn't thread safe so we need to put this logic in a lock
|
||||
RESOLVE_LOCK.lock();
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
if (this.blockState.getRenderType() == EnumBlockRenderType.ENTITYBLOCK_ANIMATED)
|
||||
{
|
||||
this.needPostTinting = false;
|
||||
this.tintIndex = 0;
|
||||
this.baseColor = ColorUtil.argbToInt(255,
|
||||
this.blockStateWrapper.getMapColor().getRed(),
|
||||
this.blockStateWrapper.getMapColor().getGreen(),
|
||||
this.blockStateWrapper.getMapColor().getBlue());
|
||||
this.isColorResolved = true;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
if (!this.blockState.getMaterial().isLiquid())
|
||||
#else
|
||||
|
||||
+1
-5
@@ -792,11 +792,7 @@ public final class BatchGenerationEnvironment implements IBatchGeneratorEnvironm
|
||||
}
|
||||
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
WorldServer worldServer = (WorldServer) this.dhServerLevel.getServerLevelWrapper().getWrappedMcObject();
|
||||
InternalServerGenerator.DH_SERVER_GEN_TICKET_MAP.remove(worldServer);
|
||||
ForgeChunkManager.releaseTicket(InternalServerGenerator.DH_SERVER_GEN_TICKET_MAP.get(worldServer));
|
||||
#else
|
||||
#if MC_VER > MC_1_12_2
|
||||
this.chunkFileReader.close();
|
||||
#endif
|
||||
}
|
||||
|
||||
+36
-30
@@ -15,6 +15,7 @@ import com.seibel.distanthorizons.core.generation.DhLightingEngine;
|
||||
import com.seibel.distanthorizons.core.level.IDhServerLevel;
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.util.ExceptionUtil;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import com.seibel.distanthorizons.core.util.TimerUtil;
|
||||
@@ -74,8 +75,6 @@ public class InternalServerGenerator
|
||||
private static final int MS_TO_IGNORE_CHUNK_AFTER_COMPLETION = 5_000;
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
public static Map<World, ForgeChunkManager.Ticket> DH_SERVER_GEN_TICKET_MAP = new HashMap<>();
|
||||
private final ForgeChunkManager.Ticket DH_SERVER_GEN_TICKET;
|
||||
#elif MC_VER < MC_1_21_5
|
||||
private static final TicketType<ChunkPos> DH_SERVER_GEN_TICKET = TicketType.create("dh_server_gen_ticket", Comparator.comparingLong(ChunkPos::toLong));
|
||||
#elif MC_VER < MC_1_21_9
|
||||
@@ -103,13 +102,6 @@ public class InternalServerGenerator
|
||||
{
|
||||
this.params = params;
|
||||
this.dhServerLevel = dhServerLevel;
|
||||
#if MC_VER <= MC_1_12_2
|
||||
this.DH_SERVER_GEN_TICKET = DH_SERVER_GEN_TICKET_MAP.get((WorldServer) this.dhServerLevel.getServerLevelWrapper().getWrappedMcObject());
|
||||
if (this.DH_SERVER_GEN_TICKET == null)
|
||||
{
|
||||
LOGGER.error("DH_SERVER_GEN_TICKET is null for level: " + dhServerLevel.getServerLevelWrapper().getDimensionName());
|
||||
}
|
||||
#endif
|
||||
this.updateManager = WorldChunkUpdateManager.INSTANCE.getByLevelWrapper(this.dhServerLevel.getServerLevelWrapper());
|
||||
}
|
||||
|
||||
@@ -269,41 +261,35 @@ public class InternalServerGenerator
|
||||
#if MC_VER <= MC_1_12_2
|
||||
WorldServer level = this.params.mcServerLevel;
|
||||
|
||||
// ignore chunk update events for this position
|
||||
if (this.updateManager != null)
|
||||
{
|
||||
this.updateManager.addPosToIgnore(McObjectConverter.Convert(chunkPos));
|
||||
}
|
||||
|
||||
|
||||
CompletableFuture<Chunk> future = new CompletableFuture<>();
|
||||
level.getMinecraftServer().addScheduledTask(() ->
|
||||
{
|
||||
try
|
||||
ChunkProviderServer provider = level.getChunkProvider();
|
||||
|
||||
// load neighbours first so the target chunk can fully populate
|
||||
for (int i = -1; i <= 1; i++)
|
||||
{
|
||||
ChunkProviderServer provider = (ChunkProviderServer) level.getChunkProvider();
|
||||
|
||||
// load neighbours first so the target chunk can fully populate
|
||||
for (int i = -1; i <= 1; i++)
|
||||
for (int j = -1; j <= 1; j++)
|
||||
{
|
||||
for (int j = -1; j <= 1; j++)
|
||||
if (i != 0 || j != 0)
|
||||
{
|
||||
if (i != 0 || j != 0)
|
||||
if (this.updateManager != null)
|
||||
{
|
||||
if (!provider.isChunkGeneratedAt(chunkPos.x + i, chunkPos.z + j))
|
||||
{
|
||||
provider.loadChunk(chunkPos.x + i, chunkPos.z + j);
|
||||
}
|
||||
this.updateManager.addPosToIgnore(new DhChunkPos(chunkPos.x + i, chunkPos.z + j));
|
||||
}
|
||||
provider.provideChunk(chunkPos.x + i, chunkPos.z + j);
|
||||
}
|
||||
}
|
||||
|
||||
ForgeChunkManager.forceChunk(DH_SERVER_GEN_TICKET, chunkPos);
|
||||
Chunk chunk = provider.provideChunk(chunkPos.x, chunkPos.z);
|
||||
future.complete(chunk);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
future.completeExceptionally(e);
|
||||
}
|
||||
|
||||
Chunk chunk = provider.provideChunk(chunkPos.x, chunkPos.z);
|
||||
future.complete(chunk);
|
||||
});
|
||||
return future;
|
||||
#else
|
||||
@@ -367,7 +353,27 @@ public class InternalServerGenerator
|
||||
try
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
ForgeChunkManager.unforceChunk(DH_SERVER_GEN_TICKET, chunkPos);
|
||||
for (int i = -1; i <= 1; i++)
|
||||
{
|
||||
for (int j = -1; j <= 1; j++)
|
||||
{
|
||||
if (i != 0 || j != 0)
|
||||
{
|
||||
final int di = i, dj = j;
|
||||
this.chunkSaveIgnoreTimer.schedule(new TimerTask()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (InternalServerGenerator.this.updateManager != null)
|
||||
{
|
||||
InternalServerGenerator.this.updateManager.removePosToIgnore(new DhChunkPos(chunkPos.x + di, chunkPos.z + dj));
|
||||
}
|
||||
}
|
||||
}, MS_TO_IGNORE_CHUNK_AFTER_COMPLETION);
|
||||
}
|
||||
}
|
||||
}
|
||||
#elif MC_VER < MC_1_21_5
|
||||
int chunkLevel = 33; // 33 is equivalent to FULL Chunk
|
||||
level.getChunkSource().distanceManager.removeTicket(DH_SERVER_GEN_TICKET, chunkPos, chunkLevel, chunkPos);
|
||||
|
||||
Reference in New Issue
Block a user