Compare commits

...
6 Commits
Author SHA1 Message Date
FalsePattern a43f85b18c Entity ID extension fixes 2025-08-27 18:57:15 +02:00
FalsePattern 986a614028 update gradle and buildscript 2025-08-27 18:56:57 +02:00
FalsePattern c620a87819 fix bad remap rules 2025-08-06 22:16:42 +02:00
FalsePattern 0a1895370b bump deps 2025-08-06 22:15:14 +02:00
FalsePattern 7220faae24 update buildscript and gradle 2025-08-06 22:11:42 +02:00
FalsePattern 36cb1b4b32 fixed crash when trying to set biomes with worldedit 2025-08-06 22:10:55 +02:00
13 changed files with 159 additions and 12 deletions

No files matched your search

+4 -4
View File
@@ -1,5 +1,5 @@
plugins {
id("com.falsepattern.fpgradle-mc") version ("0.17.1")
id("com.falsepattern.fpgradle-mc") version ("1.1.4")
}
group = "com.falsepattern"
@@ -64,9 +64,9 @@ repositories {
dependencies {
// region Our deps
implementationSplit("com.falsepattern:falsepatternlib-mc1.7.10:1.7.0")
implementation("it.unimi.dsi:fastutil:8.5.15")
implementationSplit("com.falsepattern:chunkapi-mc1.7.10:0.6.3")
implementationSplit("com.falsepattern:falsepatternlib-mc1.7.10:1.8.1")
compileOnly("it.unimi.dsi:fastutil:8.5.16")
implementationSplit("com.falsepattern:chunkapi-mc1.7.10:0.6.4")
// endregion
// region maintained mods
+2
View File
@@ -0,0 +1,2 @@
org.gradle.configuration-cache=true
org.gradle.caching=true
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015 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.
+1 -1
View File
@@ -1,5 +1,5 @@
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version("0.9.0")
id("org.gradle.toolchains.foojay-resolver-convention") version("1.0.0")
}
rootProject.name = "EndlessIDs"
@@ -42,8 +42,8 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
version = Tags.VERSION,
name = Tags.MODNAME,
acceptedMinecraftVersions = "[1.7.10]",
dependencies = "required-after:chunkapi@[0.6.3,);" +
"required-after:falsepatternlib@[1.7.0,);" +
dependencies = "required-after:chunkapi@[0.6.4,);" +
"required-after:falsepatternlib@[1.8.1,);" +
"after:antiidconflict")
public class EndlessIDs {
public static final byte[] ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER = new byte[0];
@@ -0,0 +1,29 @@
/*
* EndlessIDs
*
* Copyright (C) 2022-2025 FalsePattern, The MEGA Team
* All Rights Reserved
*
* The above copyright notice, this permission notice and the word "MEGA"
* shall be included in all copies or substantial portions of the Software.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, only version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.endlessids.mixin.helpers;
import java.util.BitSet;
public interface EntityRegistryAccessor {
BitSet eids$availableIndicies();
}
@@ -0,0 +1,59 @@
/*
* EndlessIDs
*
* Copyright (C) 2022-2025 FalsePattern, The MEGA Team
* All Rights Reserved
*
* The above copyright notice, this permission notice and the word "MEGA"
* shall be included in all copies or substantial portions of the Software.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, only version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.endlessids.mixin.mixins.common.biome.worldedit;
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
import com.sk89q.worldedit.Vector2D;
import com.sk89q.worldedit.forge.ForgeWorld;
import com.sk89q.worldedit.world.biome.BaseBiome;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import static com.google.common.base.Preconditions.checkNotNull;
@Mixin(ForgeWorld.class)
public abstract class ForgeWorldMixin {
@Shadow(remap = false) public abstract World getWorld();
/**
* @author FalsePattern
* @reason ID Extension
*/
@Overwrite(remap = false)
public boolean setBiome(Vector2D position, BaseBiome biome) {
checkNotNull(position);
checkNotNull(biome);
Chunk chunk = getWorld().getChunkFromBlockCoords(position.getBlockX(), position.getBlockZ());
if ((chunk != null) && (chunk.isChunkLoaded)) {
((ChunkBiomeHook)chunk).getBiomeShortArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (short) biome.getId();
return true;
}
return false;
}
}
@@ -24,18 +24,51 @@ package com.falsepattern.endlessids.mixin.mixins.common.entity.vanilla;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import com.falsepattern.endlessids.constants.VanillaConstants;
import com.falsepattern.endlessids.mixin.helpers.EntityRegistryAccessor;
import lombok.val;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import cpw.mods.fml.common.registry.EntityRegistry;
import java.util.HashMap;
import java.util.Map;
@Mixin(EntityList.class)
public abstract class EntityListMixin {
@Shadow
public static Map<Integer, Class<? extends Entity>> IDtoClassMapping;
@Inject(method = "<clinit>",
at = @At(value = "RETURN"),
require = 1)
private static void hijackMap(CallbackInfo ci) {
IDtoClassMapping = new HashMap<Integer, Class<? extends Entity>>(IDtoClassMapping) {
@Override
public Class<? extends Entity> put(Integer key, Class<? extends Entity> value) {
val availableIndicies = ((EntityRegistryAccessor) EntityRegistry.instance()).eids$availableIndicies();
availableIndicies.clear(key);
return super.put(key, value);
}
@Override
public void putAll(Map<? extends Integer, ? extends Class<? extends Entity>> m) {
val availableIndicies = ((EntityRegistryAccessor) EntityRegistry.instance()).eids$availableIndicies();
for (val entry : m.entrySet()) {
availableIndicies.clear(entry.getKey());
}
super.putAll(m);
}
};
}
@ModifyConstant(method = "addMapping(Ljava/lang/Class;Ljava/lang/String;I)V",
constant = @Constant(intValue = VanillaConstants.maxEntityID),
@@ -43,4 +76,14 @@ public abstract class EntityListMixin {
private static int extendRange(int constant) {
return ExtendedConstants.maxEntityID;
}
@Inject(method = "addMapping(Ljava/lang/Class;Ljava/lang/String;I)V",
at = @At(value = "INVOKE",
target = "Ljava/util/Map;put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
ordinal = 0),
require = 1)
private static void updateForgeIDMap(Class<? extends Entity> entityClass, String entityName, int id, CallbackInfo ci) {
val availableIndicies = ((EntityRegistryAccessor) EntityRegistry.instance()).eids$availableIndicies();
availableIndicies.clear(id);
}
}
@@ -24,6 +24,8 @@ package com.falsepattern.endlessids.mixin.mixins.common.entity.vanilla;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import com.falsepattern.endlessids.constants.VanillaConstants;
import com.falsepattern.endlessids.mixin.helpers.EntityRegistryAccessor;
import lombok.val;
import org.apache.logging.log4j.Level;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@@ -31,6 +33,7 @@ import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import net.minecraft.entity.EntityList;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.EntityRegistry;
@@ -39,9 +42,14 @@ import java.util.BitSet;
@Mixin(value = EntityRegistry.class,
remap = false)
public abstract class EntityRegistryMixin {
public abstract class EntityRegistryMixin implements EntityRegistryAccessor {
@Shadow private BitSet availableIndicies;
@Override
public BitSet eids$availableIndicies() {
return availableIndicies;
}
@ModifyConstant(method = "<init>",
constant = @Constant(intValue = VanillaConstants.entityIDCount),
require = 1)
@@ -62,6 +70,10 @@ public abstract class EntityRegistryMixin {
*/
@Overwrite
private int validateAndClaimId(int id) {
//Refresh available indices
for (val key: EntityList.IDtoClassMapping.keySet()) {
availableIndicies.clear(key);
}
//Keeping the legacy sub-0 id workaround here...
// workaround for broken ML
@@ -251,6 +251,8 @@ public class Mixin {
biome_witchery_WorldChunkManagerMirrorMixin(EXT_BIOME, require(WITCHERY)),
biome_witchery_BrewActionBiomeChangeMixin(EXT_BIOME, require(WITCHERY)),
biome_worldedit_ForgeWorldMixin(EXT_BIOME, require(WORLDEDIT)),
//endregion
//region blockitem
+1 -1
View File
@@ -6,7 +6,7 @@
"dependencies": {
"always": {
"common": [
"it.unimi.dsi:fastutil:8.5.15"
"it.unimi.dsi:fastutil:8.5.16"
],
"client": [],
"server": []