mirror of
https://github.com/GTMEGA/EndlessIDs.git
synced 2026-11-25 11:04:32 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f03b1dbdb8 | ||
|
|
c51228b1fd | ||
|
|
a0c8fe49a3 | ||
|
|
00688eb30d | ||
|
|
d02ca48a0e | ||
|
|
3c38d3e184 | ||
|
|
e06a4d329b | ||
|
|
5dc630fca9 |
No files matched your search
@@ -37,6 +37,14 @@ register placeholder biomes at these offsets to avoid conflicts.
|
|||||||
This system has been disabled by default as it was causing weird biome registration problems, so if you want to use this
|
This system has been disabled by default as it was causing weird biome registration problems, so if you want to use this
|
||||||
mod, we HIGHLY recommend also installing `AntiIDConflict`.
|
mod, we HIGHLY recommend also installing `AntiIDConflict`.
|
||||||
|
|
||||||
|
## Implementing extended metadatas
|
||||||
|
|
||||||
|
The block/item ID extension module also extends block metadatas. This allows you to use 16-bit metadata, however, you MUST
|
||||||
|
avoid the value of `32767`/`0x7FFF`/`0b0111_1111_1111_1111` for blocks that can be picked up as items, because forge treats
|
||||||
|
metadata `32767` as the OreDictionary wildcard value.
|
||||||
|
|
||||||
|
Using this specific metadata value in the world is fine if you convert it into item NBT or similar when the block is broken for pick-up.
|
||||||
|
|
||||||
## Mod compat
|
## Mod compat
|
||||||
|
|
||||||
This mod also contains patches for the following mods:
|
This mod also contains patches for the following mods:
|
||||||
|
|||||||
+5
-2
@@ -64,9 +64,9 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// region Our deps
|
// region Our deps
|
||||||
implementationSplit("com.falsepattern:falsepatternlib-mc1.7.10:1.5.5")
|
implementationSplit("com.falsepattern:falsepatternlib-mc1.7.10:1.7.0")
|
||||||
implementation("it.unimi.dsi:fastutil:8.5.15")
|
implementation("it.unimi.dsi:fastutil:8.5.15")
|
||||||
implementationSplit("com.falsepattern:chunkapi-mc1.7.10:0.6.0")
|
implementationSplit("com.falsepattern:chunkapi-mc1.7.10:0.6.3")
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region maintained mods
|
// region maintained mods
|
||||||
@@ -205,6 +205,9 @@ dependencies {
|
|||||||
//Restructured 1.0.4.2
|
//Restructured 1.0.4.2
|
||||||
compileOnly(deobfCurse("restructured-230570:2276784"))
|
compileOnly(deobfCurse("restructured-230570:2276784"))
|
||||||
|
|
||||||
|
//TARDIS Mod 0.995
|
||||||
|
compileOnly(deobfCurse("tardismod-230170:2305503"))
|
||||||
|
|
||||||
//Thaumcraft 4.2.3.5
|
//Thaumcraft 4.2.3.5
|
||||||
compileOnly(deobfCurse("thaumcraft-223628:2227552"))
|
compileOnly(deobfCurse("thaumcraft-223628:2227552"))
|
||||||
|
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|||||||
version = Tags.VERSION,
|
version = Tags.VERSION,
|
||||||
name = Tags.MODNAME,
|
name = Tags.MODNAME,
|
||||||
acceptedMinecraftVersions = "[1.7.10]",
|
acceptedMinecraftVersions = "[1.7.10]",
|
||||||
dependencies = "required-after:chunkapi@[0.6.0,);" +
|
dependencies = "required-after:chunkapi@[0.6.3,);" +
|
||||||
"required-after:falsepatternlib@[1.5.5,);" +
|
"required-after:falsepatternlib@[1.7.0,);" +
|
||||||
"after:antiidconflict")
|
"after:antiidconflict")
|
||||||
public class EndlessIDs {
|
public class EndlessIDs {
|
||||||
public static final byte[] ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER = new byte[0];
|
public static final byte[] ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER = new byte[0];
|
||||||
|
|||||||
@@ -48,6 +48,12 @@ public class EndlessIDsCore implements IFMLLoadingPlugin {
|
|||||||
public static boolean deobfuscated;
|
public static boolean deobfuscated;
|
||||||
public EndlessIDsCore() {
|
public EndlessIDsCore() {
|
||||||
super();
|
super();
|
||||||
|
try {
|
||||||
|
if (Launch.classLoader.getClassBytes("ru.fewizz.neid.asm.Plugin") != null ||
|
||||||
|
Launch.classLoader.getClassBytes("com.gtnewhorizons.neid.asm.NEIDTransformer") != null) {
|
||||||
|
loudCrash("EndlessIDs replaces NotEnoughIDs! Please uninstall NotEnoughIDs!");
|
||||||
|
}
|
||||||
|
} catch (Exception ignored) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@@ -68,6 +74,15 @@ public class EndlessIDsCore implements IFMLLoadingPlugin {
|
|||||||
return new String[]{EndlessIDsTransformer.class.getName()};
|
return new String[]{EndlessIDsTransformer.class.getName()};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void loudCrash(String message) {
|
||||||
|
for (int i = 0; i < 100; i++) {
|
||||||
|
EndlessIDsTransformer.logger.fatal(message);
|
||||||
|
}
|
||||||
|
val err = new Error(message);
|
||||||
|
err.setStackTrace(new StackTraceElement[0]);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
public String getModContainerClass() {
|
public String getModContainerClass() {
|
||||||
if (GeneralConfig.extendBiome) {
|
if (GeneralConfig.extendBiome) {
|
||||||
FMLInjectionData.containers.add(Tags.GROUPNAME + ".containers.BiomeContainer");
|
FMLInjectionData.containers.add(Tags.GROUPNAME + ".containers.BiomeContainer");
|
||||||
|
|||||||
@@ -93,14 +93,14 @@ public class GeneralConfig {
|
|||||||
"Minecraft contains some internal code that uses a HUGE amount of RAM with too many block IDs available.",
|
"Minecraft contains some internal code that uses a HUGE amount of RAM with too many block IDs available.",
|
||||||
"Notice: This does not affect ITEM IDs.",
|
"Notice: This does not affect ITEM IDs.",
|
||||||
"The vanilla default is 4k block IDs, while the maximum is 16 million.",
|
"The vanilla default is 4k block IDs, while the maximum is 16 million.",
|
||||||
"The default setting sets it to 8k (2x vanilla).",
|
"The default setting sets it to 32k (8x vanilla).",
|
||||||
"increase if necessary (when running out of BLOCK IDs in your modpack)",
|
"increase if necessary (when running out of BLOCK IDs in your modpack)",
|
||||||
"Only effective if extendBlockItem is enabled.",
|
"Only effective if extendBlockItem is enabled.",
|
||||||
"Effective values: (0: 4k, 1: 8k, 2: 16k, 3: 32k, 4: 64k, 5: 128k, 6: 256k, 7: 512k, 8: 1M, 9: 2M, 10: 4M, 11: 8M, 12: 16M)",
|
"Effective values: (0: 4k, 1: 8k, 2: 16k, 3: 32k, 4: 64k, 5: 128k, 6: 256k, 7: 512k, 8: 1M, 9: 2M, 10: 4M, 11: 8M, 12: 16M)",
|
||||||
"The effective value of this variable must always be smaller or equal to the effective value of extraItemIDBits"})
|
"The effective value of this variable must always be smaller or equal to the effective value of extraItemIDBits"})
|
||||||
@Config.RangeInt(min = 0,
|
@Config.RangeInt(min = 0,
|
||||||
max = 12)
|
max = 12)
|
||||||
@Config.DefaultInt(1)
|
@Config.DefaultInt(3)
|
||||||
public static int extraBlockIDBits;
|
public static int extraBlockIDBits;
|
||||||
|
|
||||||
@Config.Comment({"Use this to tune the amount of available item IDs.",
|
@Config.Comment({"Use this to tune the amount of available item IDs.",
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public class ExtendedConstants {
|
|||||||
public static final int bitsPerBiome = 16;
|
public static final int bitsPerBiome = 16;
|
||||||
|
|
||||||
public static final int maximumPotionIDs = 65536;
|
public static final int maximumPotionIDs = 65536;
|
||||||
|
public static final int potionIDMask = 0xFFFF;
|
||||||
public static final int maximumEnchantmentIDs = 32768;
|
public static final int maximumEnchantmentIDs = 32768;
|
||||||
|
|
||||||
public static final int blocksPerSubChunk = 16 * 16 * 16;
|
public static final int blocksPerSubChunk = 16 * 16 * 16;
|
||||||
|
|||||||
@@ -29,16 +29,20 @@ import net.minecraft.world.chunk.Chunk;
|
|||||||
|
|
||||||
import java.util.function.IntFunction;
|
import java.util.function.IntFunction;
|
||||||
|
|
||||||
|
import static com.falsepattern.endlessids.EndlessIDs.FAKE_BIOME_ARRAY_PLACEHOLDER;
|
||||||
import static com.falsepattern.endlessids.EndlessIDs.ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
|
import static com.falsepattern.endlessids.EndlessIDs.ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
|
||||||
|
|
||||||
public class BiomePatchHelper {
|
public class BiomePatchHelper {
|
||||||
public static byte[] getBiomeArrayTweaked(Chunk chunk, IntFunction<BiomeGenBase> biomesForGeneration) {
|
public static byte[] getBiomeArrayTweaked(Chunk chunk, IntFunction<BiomeGenBase> biomesForGeneration) {
|
||||||
|
return getBiomeArrayTweaked(chunk, false, biomesForGeneration);
|
||||||
|
}
|
||||||
|
public static byte[] getBiomeArrayTweaked(Chunk chunk, boolean fake, IntFunction<BiomeGenBase> biomesForGeneration) {
|
||||||
val chunkBiomes = ((ChunkBiomeHook) chunk).getBiomeShortArray();
|
val chunkBiomes = ((ChunkBiomeHook) chunk).getBiomeShortArray();
|
||||||
|
|
||||||
for (int i = 0; i < chunkBiomes.length; ++i) {
|
for (int i = 0; i < chunkBiomes.length; ++i) {
|
||||||
chunkBiomes[i] = (short) biomesForGeneration.apply(i).biomeID;
|
chunkBiomes[i] = (short) biomesForGeneration.apply(i).biomeID;
|
||||||
}
|
}
|
||||||
return ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
|
return fake ? FAKE_BIOME_ARRAY_PLACEHOLDER : ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] getBiomeArrayTweaked(Chunk chunk, BiomeGenBase[] biomesForGeneration) {
|
public static byte[] getBiomeArrayTweaked(Chunk chunk, BiomeGenBase[] biomesForGeneration) {
|
||||||
|
|||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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.stubpackage.com.emoniph.witchery.brewing.action.effect;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
public class BrewActionBiomeChange$ChunkCoord {
|
||||||
|
public BrewActionBiomeChange$ChunkCoord(int x, int z) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Chunk getChunk(World world) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
+16
@@ -25,12 +25,28 @@ package com.falsepattern.endlessids.mixin.mixins.common.biome.rtg;
|
|||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
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.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import rtg.world.biome.WorldChunkManagerRTG;
|
import rtg.world.biome.WorldChunkManagerRTG;
|
||||||
|
|
||||||
@Mixin(WorldChunkManagerRTG.class)
|
@Mixin(WorldChunkManagerRTG.class)
|
||||||
public abstract class WorldChunkManagerRTGMixin {
|
public abstract class WorldChunkManagerRTGMixin {
|
||||||
|
|
||||||
|
@Shadow(remap = false)
|
||||||
|
private float[] borderNoise;
|
||||||
|
|
||||||
|
@Inject(method = "<init>()V",
|
||||||
|
at = @At(value = "RETURN"),
|
||||||
|
require = 1,
|
||||||
|
remap = false)
|
||||||
|
private void extendBorderNoise(CallbackInfo ci) {
|
||||||
|
this.borderNoise = new float[ExtendedConstants.biomeIDCount];
|
||||||
|
}
|
||||||
|
|
||||||
@ModifyConstant(method = "getRainfall",
|
@ModifyConstant(method = "getRainfall",
|
||||||
constant = @Constant(intValue = VanillaConstants.biomeIDMask),
|
constant = @Constant(intValue = VanillaConstants.biomeIDMask),
|
||||||
require = 2)
|
require = 2)
|
||||||
|
|||||||
+45
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* 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.tardismod;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
import tardis.common.dimension.TardisChunkProvider;
|
||||||
|
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
//Also fixes a bug in TARDISMod where only the first block of each chunk is set to sky, the rest is Ocean due to a wrong
|
||||||
|
// array index variable.
|
||||||
|
@Mixin(TardisChunkProvider.class)
|
||||||
|
public class TardisChunkProviderMixin {
|
||||||
|
@Redirect(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B"),
|
||||||
|
require = 1)
|
||||||
|
private byte[] setBiomesTweaked(Chunk instance) {
|
||||||
|
return BiomePatchHelper.getBiomeArrayTweaked(instance, true, i -> BiomeGenBase.sky);
|
||||||
|
}
|
||||||
|
}
|
||||||
+96
@@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
* 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.witchery;
|
||||||
|
|
||||||
|
import com.emoniph.witchery.brewing.action.effect.BrewActionBiomeChange;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.stubpackage.com.emoniph.witchery.brewing.action.effect.BrewActionBiomeChange$ChunkCoord;
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||||
|
import com.llamalad7.mixinextras.sugar.Share;
|
||||||
|
import com.llamalad7.mixinextras.sugar.ref.LocalRef;
|
||||||
|
import lombok.val;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Mixin(BrewActionBiomeChange.class)
|
||||||
|
public abstract class BrewActionBiomeChangeMixin {
|
||||||
|
@WrapOperation(method = "changeBiome",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Ljava/util/Map$Entry;getValue()Ljava/lang/Object;"),
|
||||||
|
remap = false,
|
||||||
|
require = 1)
|
||||||
|
private Object removeByteArrayGet(Map.Entry instance, Operation<Object> original,
|
||||||
|
@Share("biomeArray") LocalRef<short[]> biome) {
|
||||||
|
biome.set((short[]) original.call(instance));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "changeBiome",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;setBiomeArray([B)V"),
|
||||||
|
remap = false,
|
||||||
|
require = 1)
|
||||||
|
private void extendedSetBiomeArray(Chunk instance, byte[] ignored, @Share("biomeArray") LocalRef<short[]> biome) {
|
||||||
|
((ChunkBiomeHook)instance).setBiomeShortArray(biome.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FalsePattern
|
||||||
|
* @reason Doing this with normal mixins would be extremely tedious because of the local variable shuffling.
|
||||||
|
* Nobody else's patches should be landing here anyway.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
|
@Overwrite(remap = false)
|
||||||
|
private void drawLine(World world, int x1, int x2, int z, HashMap chunkMap, BiomeGenBase biome) {
|
||||||
|
for(int x = x1; x <= x2; ++x) {
|
||||||
|
BrewActionBiomeChange$ChunkCoord coord = new BrewActionBiomeChange$ChunkCoord(x >> 4, z >> 4);
|
||||||
|
short[] map = (short[])chunkMap.get(coord);
|
||||||
|
if (map == null) {
|
||||||
|
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
||||||
|
val sarr = ((ChunkBiomeHook) chunk).getBiomeShortArray();
|
||||||
|
map = Arrays.copyOf(sarr, sarr.length);
|
||||||
|
chunkMap.put(coord, map);
|
||||||
|
}
|
||||||
|
|
||||||
|
map[(z & 15) << 4 | x & 15] = (short) biome.biomeID;
|
||||||
|
if (biome.rainfall == 0.0F) {
|
||||||
|
int y = world.getTopSolidOrLiquidBlock(x, z);
|
||||||
|
if (world.getBlock(x, y, z) == Blocks.snow_layer) {
|
||||||
|
world.setBlockToAir(x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
-2
@@ -22,19 +22,48 @@
|
|||||||
|
|
||||||
package com.falsepattern.endlessids.mixin.mixins.common.potion.vanilla;
|
package com.falsepattern.endlessids.mixin.mixins.common.potion.vanilla;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.EndlessIDs;
|
||||||
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
|
import lombok.var;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.potion.Potion;
|
import net.minecraft.potion.Potion;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
|
||||||
@Mixin(value = PotionEffect.class)
|
@Mixin(value = PotionEffect.class,
|
||||||
|
priority = 2000 ) //Hodgepodge fixPotionLimit compat (inject-head into overwrite in readCustomPotionEffectFromNBT)
|
||||||
public abstract class PotionEffectMixin {
|
public abstract class PotionEffectMixin {
|
||||||
|
@Inject(method = "<init>(IIIZ)V",
|
||||||
|
at = @At("RETURN"),
|
||||||
|
require = 1)
|
||||||
|
private void fixOutOfBoundsID(int p_i1576_1_, int p_i1576_2_, int p_i1576_3_, boolean p_i1576_4_, CallbackInfo ci) {
|
||||||
|
var id = p_i1576_1_ & ExtendedConstants.potionIDMask;
|
||||||
|
recovery:
|
||||||
|
if (id != p_i1576_1_ && Potion.potionTypes[id] == null) {
|
||||||
|
//Maybe vanilla code?
|
||||||
|
id = id & 0xFF;
|
||||||
|
}
|
||||||
|
if (Potion.potionTypes[id] == null) {
|
||||||
|
EndlessIDs.LOG.error("Encountered invalid potion ID: {}. See the following stacktrace for more info.", p_i1576_1_);
|
||||||
|
EndlessIDs.LOG.error("Stacktrace:", new Throwable());
|
||||||
|
EndlessIDs.LOG.error("Recovering to a valid potion ID (usually movement speed)");
|
||||||
|
for (int i = 0; i < Potion.potionTypes.length; i++) {
|
||||||
|
if (Potion.potionTypes[i] != null) {
|
||||||
|
id = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.potionID = id;
|
||||||
|
}
|
||||||
|
|
||||||
@Inject(method = "readCustomPotionEffectFromNBT",
|
@Inject(method = "readCustomPotionEffectFromNBT",
|
||||||
at = @At(value = "HEAD"),
|
at = @At(value = "HEAD"),
|
||||||
cancellable = true,
|
cancellable = true,
|
||||||
@@ -44,7 +73,7 @@ public abstract class PotionEffectMixin {
|
|||||||
if (nbt.hasKey("IdExtended")) {
|
if (nbt.hasKey("IdExtended")) {
|
||||||
id = nbt.getInteger("IdExtended");
|
id = nbt.getInteger("IdExtended");
|
||||||
} else {
|
} else {
|
||||||
id = nbt.getByte("Id");
|
id = nbt.getByte("Id") & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id >= 0 && id < Potion.potionTypes.length && Potion.potionTypes[id] != null) {
|
if (id >= 0 && id < Potion.potionTypes.length && Potion.potionTypes[id] != null) {
|
||||||
@@ -69,6 +98,8 @@ public abstract class PotionEffectMixin {
|
|||||||
@Shadow
|
@Shadow
|
||||||
public abstract boolean getIsAmbient();
|
public abstract boolean getIsAmbient();
|
||||||
|
|
||||||
|
@Shadow private int potionID;
|
||||||
|
|
||||||
@Inject(method = "writeCustomPotionEffectToNBT",
|
@Inject(method = "writeCustomPotionEffectToNBT",
|
||||||
at = @At(value = "HEAD"),
|
at = @At(value = "HEAD"),
|
||||||
cancellable = true,
|
cancellable = true,
|
||||||
|
|||||||
@@ -209,6 +209,9 @@ public enum Mixin implements IMixin {
|
|||||||
RWGRealisticBiomeBaseMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.RWG)), "biome.rwg.RealisticBiomeBaseMixin"),
|
RWGRealisticBiomeBaseMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.RWG)), "biome.rwg.RealisticBiomeBaseMixin"),
|
||||||
RWGVillageMaterialsMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.RWG)), "biome.rwg.VillageMaterialsMixin"),
|
RWGVillageMaterialsMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.RWG)), "biome.rwg.VillageMaterialsMixin"),
|
||||||
//endregion RWG
|
//endregion RWG
|
||||||
|
//region TARDIS Mod
|
||||||
|
TardisChunkProviderMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.TARDIS)), "biome.tardismod.TardisChunkProviderMixin"),
|
||||||
|
//endregion
|
||||||
//region Thaumcraft
|
//region Thaumcraft
|
||||||
ThaumcraftUtilsMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.THAUMCRAFT)), "biome.thaumcraft.UtilsMixin"),
|
ThaumcraftUtilsMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.THAUMCRAFT)), "biome.thaumcraft.UtilsMixin"),
|
||||||
//endregion Thaumcraft
|
//endregion Thaumcraft
|
||||||
@@ -226,6 +229,7 @@ public enum Mixin implements IMixin {
|
|||||||
//endregion TwilightForest
|
//endregion TwilightForest
|
||||||
//region Witchery
|
//region Witchery
|
||||||
WitcheryWorldChunkManagerMirrorMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.WITCHERY)), "biome.witchery.WorldChunkManagerMirrorMixin"),
|
WitcheryWorldChunkManagerMirrorMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.WITCHERY)), "biome.witchery.WorldChunkManagerMirrorMixin"),
|
||||||
|
WitcheryBrewActionBiomeChangeMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.WITCHERY)), "biome.witchery.BrewActionBiomeChangeMixin"),
|
||||||
//endregion Witchery
|
//endregion Witchery
|
||||||
//endregion biome
|
//endregion biome
|
||||||
//region blockitem
|
//region blockitem
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ public enum TargetedMod implements ITargetedMod {
|
|||||||
RESTRUCTURED("Restructured", false, contains("restructured-")),
|
RESTRUCTURED("Restructured", false, contains("restructured-")),
|
||||||
RTG("Realistic Terrain Generation", false, contains("rtg-")),
|
RTG("Realistic Terrain Generation", false, contains("rtg-")),
|
||||||
RWG("Realistic World Gen", false, contains("rwg-")),
|
RWG("Realistic World Gen", false, contains("rwg-")),
|
||||||
|
TARDIS("TARDIS Mod", false, contains("tardismod-")),
|
||||||
THAUMCRAFT("Thaumcraft", false, contains("thaumcraft")),
|
THAUMCRAFT("Thaumcraft", false, contains("thaumcraft")),
|
||||||
THUTCORE("ThutCore", false, contains("thutcore-").or(contains("thutmods-"))),
|
THUTCORE("ThutCore", false, contains("thutcore-").or(contains("thutmods-"))),
|
||||||
TMOR("The Mists Of RioV", false, contains("the mists of riov-").or(contains("the-mists-of-riov-"))),
|
TMOR("The Mists Of RioV", false, contains("the mists of riov-").or(contains("the-mists-of-riov-"))),
|
||||||
|
|||||||
Reference in new issue
Block a user