mirror of
https://github.com/GTMEGA/EndlessIDs.git
synced 2026-11-27 02:43:02 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2acbb60547 | ||
|
|
098254dc82 | ||
|
|
0f810afe90 | ||
|
|
fa66c21a8a | ||
|
|
2b90b7688b | ||
|
|
ca5f27dffc | ||
|
|
6eeafe5a23 | ||
|
|
22d269eda5 |
No files matched your search
@@ -10,7 +10,7 @@ new limits.
|
|||||||
- [UniMixins](https://github.com/LegacyModdingMC/UniMixins)
|
- [UniMixins](https://github.com/LegacyModdingMC/UniMixins)
|
||||||
- [ChunkAPI](https://github.com/FalsePattern/ChunkAPI)
|
- [ChunkAPI](https://github.com/FalsePattern/ChunkAPI)
|
||||||
|
|
||||||
## NotEnoughIDs
|
## NotEnoughIDs world compatibility
|
||||||
EndlessIDs can open and upgrade worlds created with NotEnoughIDs without any problems (both the original and the Unofficial version).
|
EndlessIDs can open and upgrade worlds created with NotEnoughIDs without any problems (both the original and the Unofficial version).
|
||||||
If you notice any problems when opening NEID worlds with EndlessIDs, please open an issue!
|
If you notice any problems when opening NEID worlds with EndlessIDs, please open an issue!
|
||||||
|
|
||||||
@@ -32,6 +32,9 @@ If you notice any problems when opening NEID worlds with EndlessIDs, please open
|
|||||||
|
|
||||||
This mod also contains patches for the following mods:
|
This mod also contains patches for the following mods:
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Mod list</summary>
|
||||||
|
|
||||||
- AbyssalCraft
|
- AbyssalCraft
|
||||||
- Advanced Rocketry
|
- Advanced Rocketry
|
||||||
- Alternate Terrain Generation
|
- Alternate Terrain Generation
|
||||||
@@ -59,22 +62,29 @@ This mod also contains patches for the following mods:
|
|||||||
- Highlands
|
- Highlands
|
||||||
- Immersive Cavegen
|
- Immersive Cavegen
|
||||||
- Industrial Revolution by Redstone Rebooted
|
- Industrial Revolution by Redstone Rebooted
|
||||||
|
- Matter Overdrive
|
||||||
- More Fun Quicksand Mod
|
- More Fun Quicksand Mod
|
||||||
- Nature's Compass
|
- Nature's Compass
|
||||||
- Netherlicious
|
- Netherlicious
|
||||||
- Nomadic Tents
|
- Nomadic Tents
|
||||||
|
- Nostalgic World Generation
|
||||||
|
- Old World Gen
|
||||||
- Random Things
|
- Random Things
|
||||||
- Restructured
|
- Restructured
|
||||||
- Realistic Terrain Generation
|
- Realistic Terrain Generation
|
||||||
- Realistic World Generation
|
- Realistic World Generation
|
||||||
- Thaumcraft
|
- Thaumcraft
|
||||||
- The Lord of the Rings Mod: Legacy
|
- The Lord of the Rings Mod: Legacy
|
||||||
|
- ThutCore/ThutMods
|
||||||
- Tropicraft
|
- Tropicraft
|
||||||
- Twilight Forest
|
- Twilight Forest
|
||||||
- Underground Biomes Constructs
|
- Underground Biomes Constructs
|
||||||
- Witchery
|
- Witchery
|
||||||
- WorldEdit
|
- WorldEdit
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
Mods not listed here may or may not work.
|
Mods not listed here may or may not work.
|
||||||
|
|
||||||
- For item/block IDs:
|
- For item/block IDs:
|
||||||
|
|||||||
+11
-1
@@ -119,7 +119,10 @@ dependencies {
|
|||||||
compileOnly(deobfCurse("industrialrevolutionbyredstonerebooted-241812:2538035"))
|
compileOnly(deobfCurse("industrialrevolutionbyredstonerebooted-241812:2538035"))
|
||||||
|
|
||||||
//LOTR Mod 36.15
|
//LOTR Mod 36.15
|
||||||
implementation(deobfCurse("lotrmod-423748:4091561"))
|
compileOnly(deobfCurse("lotrmod-423748:4091561"))
|
||||||
|
|
||||||
|
//Matter Overdrive 0.4.2-hotfix1
|
||||||
|
compileOnly(deobfCurse("matteroverdrive-229694:2331162"))
|
||||||
|
|
||||||
//More Fun Quicksands Mod 1.0.8.8-fixed
|
//More Fun Quicksands Mod 1.0.8.8-fixed
|
||||||
compileOnly(deobfCurse("more-fun-quicksand-mod-321960:2717318"))
|
compileOnly(deobfCurse("more-fun-quicksand-mod-321960:2717318"))
|
||||||
@@ -133,6 +136,9 @@ dependencies {
|
|||||||
//Nomadic Tents 1.12.1
|
//Nomadic Tents 1.12.1
|
||||||
compileOnly(deobfCurse("nomadictents-238794:2679476"))
|
compileOnly(deobfCurse("nomadictents-238794:2679476"))
|
||||||
|
|
||||||
|
//Nostalgic World Generation 1.0.0
|
||||||
|
compileOnly(deobfCurse("nostalgiagenerator-927053:4816167"))
|
||||||
|
|
||||||
//RandomThings 2.2.4
|
//RandomThings 2.2.4
|
||||||
compileOnly(deobfCurse("randomthings-59816:2225310"))
|
compileOnly(deobfCurse("randomthings-59816:2225310"))
|
||||||
|
|
||||||
@@ -145,6 +151,10 @@ dependencies {
|
|||||||
//Thaumcraft 4.2.3.5
|
//Thaumcraft 4.2.3.5
|
||||||
compileOnly(deobfCurse("thaumcraft-223628:2227552"))
|
compileOnly(deobfCurse("thaumcraft-223628:2227552"))
|
||||||
|
|
||||||
|
//ThutCore 2.0
|
||||||
|
//Only available on dropbox
|
||||||
|
compileOnly(deobf("https://mvn.falsepattern.com/releases/mirror/mirror/thutcore-2.0.jar"))
|
||||||
|
|
||||||
//Tropicraft 6.0.5
|
//Tropicraft 6.0.5
|
||||||
//This is from a mirror file, because the file on curseforge is a zip containing other files too.
|
//This is from a mirror file, because the file on curseforge is a zip containing other files too.
|
||||||
//Source: https://www.curseforge.com/minecraft/mc-mods/tropicraft/files/2353906
|
//Source: https://www.curseforge.com/minecraft/mc-mods/tropicraft/files/2353906
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import net.minecraft.world.chunk.Chunk;
|
|||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
|
//NOTE: Also change the save logic in MapWriter mod if changing this
|
||||||
public class BiomeManager implements DataManager.PacketDataManager, DataManager.ChunkDataManager {
|
public class BiomeManager implements DataManager.PacketDataManager, DataManager.ChunkDataManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import java.nio.ByteBuffer;
|
|||||||
import static com.falsepattern.endlessids.constants.ExtendedConstants.blocksPerSubChunk;
|
import static com.falsepattern.endlessids.constants.ExtendedConstants.blocksPerSubChunk;
|
||||||
import static com.falsepattern.endlessids.util.DataUtil.*;
|
import static com.falsepattern.endlessids.util.DataUtil.*;
|
||||||
|
|
||||||
|
//NOTE: Also change the save logic in MapWriter mod if changing this
|
||||||
public class BlockIDManager implements DataManager.PacketDataManager, DataManager.SubChunkDataManager {
|
public class BlockIDManager implements DataManager.PacketDataManager, DataManager.SubChunkDataManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import java.nio.ByteBuffer;
|
|||||||
|
|
||||||
import static com.falsepattern.endlessids.constants.ExtendedConstants.blocksPerSubChunk;
|
import static com.falsepattern.endlessids.constants.ExtendedConstants.blocksPerSubChunk;
|
||||||
|
|
||||||
|
//NOTE: Also change the save logic in MapWriter mod if changing this
|
||||||
public class BlockMetaManager implements DataManager.PacketDataManager, DataManager.SubChunkDataManager {
|
public class BlockMetaManager implements DataManager.PacketDataManager, DataManager.SubChunkDataManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+74
@@ -0,0 +1,74 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.owg;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import owg.generator.ChunkGeneratorBeta;
|
||||||
|
import owg.map.MapGenOLD;
|
||||||
|
import owg.world.ManagerOWG;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraft.world.chunk.IChunkProvider;
|
||||||
|
import net.minecraft.world.gen.structure.MapGenMineshaft;
|
||||||
|
import net.minecraft.world.gen.structure.MapGenStronghold;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@Mixin(ChunkGeneratorBeta.class)
|
||||||
|
public abstract class ChunkGeneratorBetaMixin implements IChunkProvider {
|
||||||
|
@Shadow private Random rand;
|
||||||
|
|
||||||
|
@Shadow private BiomeGenBase[] biomesForGeneration;
|
||||||
|
|
||||||
|
@Shadow private World worldObj;
|
||||||
|
|
||||||
|
@Shadow public abstract void generateTerrain(int i, int j, Block[] blocks, BiomeGenBase[] abiomegenbase, double[] ad);
|
||||||
|
|
||||||
|
@Shadow public abstract void replaceBlocksForBiome(int i, int j, Block[] blocks, byte[] metadata, BiomeGenBase[] abiomegenbase);
|
||||||
|
|
||||||
|
@Shadow private MapGenOLD field_902_u;
|
||||||
|
|
||||||
|
@Shadow @Final private boolean mapFeaturesEnabled;
|
||||||
|
|
||||||
|
@Shadow private MapGenStronghold strongholdGenerator;
|
||||||
|
|
||||||
|
@Shadow private MapGenMineshaft mineshaftGenerator;
|
||||||
|
|
||||||
|
@Shadow private int biomeSettings;
|
||||||
|
|
||||||
|
public Chunk provideChunk(int i, int j) {
|
||||||
|
this.rand.setSeed((long)i * 341873128712L + (long)j * 132897987541L);
|
||||||
|
Block[] blocks = new Block[128 * 16 * 16];
|
||||||
|
byte[] metadata = new byte[128 * 16 * 16];
|
||||||
|
this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, i * 16, j * 16, 16, 16);
|
||||||
|
double[] ad = ManagerOWG.temperature;
|
||||||
|
this.generateTerrain(i, j, blocks, this.biomesForGeneration, ad);
|
||||||
|
this.replaceBlocksForBiome(i, j, blocks, metadata, this.biomesForGeneration);
|
||||||
|
this.field_902_u.generate(this, this.worldObj, i, j, blocks);
|
||||||
|
if (this.mapFeaturesEnabled) {
|
||||||
|
this.strongholdGenerator.func_151539_a(this, this.worldObj, i, j, blocks);
|
||||||
|
this.mineshaftGenerator.func_151539_a(this, this.worldObj, i, j, blocks);
|
||||||
|
}
|
||||||
|
|
||||||
|
Chunk chunk = new Chunk(this.worldObj, blocks, metadata, i, j);
|
||||||
|
short[] abyte1 = ((ChunkBiomeHook)chunk).getBiomeShortArray();
|
||||||
|
int k;
|
||||||
|
if (this.biomeSettings == 0) {
|
||||||
|
for(k = 0; k < abyte1.length; ++k) {
|
||||||
|
abyte1[k] = (short)this.biomesForGeneration[k].biomeID;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(k = 0; k < abyte1.length; ++k) {
|
||||||
|
abyte1[k] = (short)this.biomesForGeneration[(k * 16 & 255) + k / 16].biomeID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
chunk.generateSkylightMap();
|
||||||
|
return chunk;
|
||||||
|
}
|
||||||
|
}
|
||||||
+44
@@ -0,0 +1,44 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.thut;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||||
|
import lombok.val;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import thut.api.maths.Vector3;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
@Mixin(value = Vector3.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class Vector3Mixin {
|
||||||
|
|
||||||
|
@Shadow public abstract int intX();
|
||||||
|
|
||||||
|
@Shadow public abstract int intZ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FalsePattern
|
||||||
|
* @reason ID Extension
|
||||||
|
*/
|
||||||
|
@Overwrite
|
||||||
|
public void setBiome(BiomeGenBase biome, World worldObj) {
|
||||||
|
int x = this.intX();
|
||||||
|
int z = this.intZ();
|
||||||
|
Chunk chunk = worldObj.getChunkFromBlockCoords(x, z);
|
||||||
|
val chunkHook = (ChunkBiomeHook) chunk;
|
||||||
|
short[] biomes = chunkHook.getBiomeShortArray();
|
||||||
|
short newBiome = (short)biome.biomeID;
|
||||||
|
int chunkX = Math.abs(x & 15);
|
||||||
|
int chunkZ = Math.abs(z & 15);
|
||||||
|
int point = chunkX + 16 * chunkZ;
|
||||||
|
if (biomes[point] != newBiome) {
|
||||||
|
biomes[point] = newBiome;
|
||||||
|
chunkHook.setBiomeShortArray(biomes);
|
||||||
|
chunk.setChunkModified();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+13
-10
@@ -9,6 +9,7 @@ import org.spongepowered.asm.mixin.Final;
|
|||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
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.CallbackInfo;
|
||||||
@@ -34,18 +35,20 @@ public abstract class ChunkMixin implements ChunkBiomeHook {
|
|||||||
public World worldObj;
|
public World worldObj;
|
||||||
@Shadow
|
@Shadow
|
||||||
private byte[] blockBiomeArray;
|
private byte[] blockBiomeArray;
|
||||||
private short[] blockBiomeShortArray;
|
@Unique
|
||||||
|
private short[] eid$blockBiomeShortArray;
|
||||||
|
|
||||||
@Inject(method = "<init>(Lnet/minecraft/world/World;II)V",
|
@Inject(method = "<init>(Lnet/minecraft/world/World;II)V",
|
||||||
at = @At(value = "RETURN"),
|
at = @At(value = "RETURN"),
|
||||||
require = 1)
|
require = 1)
|
||||||
private void initShortArray(World p_i1995_1_, int p_i1995_2_, int p_i1995_3_, CallbackInfo ci) {
|
private void initShortArray(World p_i1995_1_, int p_i1995_2_, int p_i1995_3_, CallbackInfo ci) {
|
||||||
blockBiomeArray = null;
|
blockBiomeArray = null;
|
||||||
blockBiomeShortArray = new short[16 * 16];
|
eid$blockBiomeShortArray = new short[16 * 16];
|
||||||
Arrays.fill(blockBiomeShortArray, (short) -1);
|
Arrays.fill(eid$blockBiomeShortArray, (short) -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void emergencyCrash() {
|
@Unique
|
||||||
|
private void eid$emergencyCrash() {
|
||||||
val crashMSG = "A mod that is incompatible with " + Tags.MODNAME + " has tried to access the biome array of a" +
|
val crashMSG = "A mod that is incompatible with " + Tags.MODNAME + " has tried to access the biome array of a" +
|
||||||
" chunk like in vanilla! Crashing in fear of potential world corruption!\n" +
|
" chunk like in vanilla! Crashing in fear of potential world corruption!\n" +
|
||||||
"Please report this issue on https://github.com/FalsePattern/EndlessIDs ASAP!";
|
"Please report this issue on https://github.com/FalsePattern/EndlessIDs ASAP!";
|
||||||
@@ -57,14 +60,14 @@ public abstract class ChunkMixin implements ChunkBiomeHook {
|
|||||||
at = @At(value = "HEAD"),
|
at = @At(value = "HEAD"),
|
||||||
require = 1)
|
require = 1)
|
||||||
private void crashSetBiomeArray(byte[] p_76616_1_, CallbackInfo ci) {
|
private void crashSetBiomeArray(byte[] p_76616_1_, CallbackInfo ci) {
|
||||||
emergencyCrash();
|
eid$emergencyCrash();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "getBiomeArray",
|
@Inject(method = "getBiomeArray",
|
||||||
at = @At(value = "HEAD"),
|
at = @At(value = "HEAD"),
|
||||||
require = 1)
|
require = 1)
|
||||||
private void crashGetBiomeArray(CallbackInfoReturnable<byte[]> cir) {
|
private void crashGetBiomeArray(CallbackInfoReturnable<byte[]> cir) {
|
||||||
emergencyCrash();
|
eid$emergencyCrash();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,7 +76,7 @@ public abstract class ChunkMixin implements ChunkBiomeHook {
|
|||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public BiomeGenBase getBiomeGenForWorldCoords(int x, int z, WorldChunkManager manager) {
|
public BiomeGenBase getBiomeGenForWorldCoords(int x, int z, WorldChunkManager manager) {
|
||||||
int id = this.blockBiomeShortArray[z << 4 | x] & ExtendedConstants.biomeIDMask;
|
int id = this.eid$blockBiomeShortArray[z << 4 | x] & ExtendedConstants.biomeIDMask;
|
||||||
if (id == ExtendedConstants.biomeIDNull) {
|
if (id == ExtendedConstants.biomeIDNull) {
|
||||||
//Source: https://github.com/embeddedt/ArchaicFix/blob/3d1392f4db5a7221534a6f9b00c0c36a49d9be59/src/main/java/org/embeddedt/archaicfix/mixins/common/core/MixinChunk.java#L52
|
//Source: https://github.com/embeddedt/ArchaicFix/blob/3d1392f4db5a7221534a6f9b00c0c36a49d9be59/src/main/java/org/embeddedt/archaicfix/mixins/common/core/MixinChunk.java#L52
|
||||||
if (this.worldObj.isRemote) {
|
if (this.worldObj.isRemote) {
|
||||||
@@ -81,7 +84,7 @@ public abstract class ChunkMixin implements ChunkBiomeHook {
|
|||||||
}
|
}
|
||||||
BiomeGenBase gen = manager.getBiomeGenAt((this.xPosition << 4) + x, (this.zPosition << 4) + z);
|
BiomeGenBase gen = manager.getBiomeGenAt((this.xPosition << 4) + x, (this.zPosition << 4) + z);
|
||||||
id = gen.biomeID;
|
id = gen.biomeID;
|
||||||
this.blockBiomeShortArray[z << 4 | x] = (short) (id & ExtendedConstants.biomeIDMask);
|
this.eid$blockBiomeShortArray[z << 4 | x] = (short) (id & ExtendedConstants.biomeIDMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
return BiomeGenBase.getBiome(id) == null ? BiomeGenBase.plains : BiomeGenBase.getBiome(id);
|
return BiomeGenBase.getBiome(id) == null ? BiomeGenBase.plains : BiomeGenBase.getBiome(id);
|
||||||
@@ -89,11 +92,11 @@ public abstract class ChunkMixin implements ChunkBiomeHook {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short[] getBiomeShortArray() {
|
public short[] getBiomeShortArray() {
|
||||||
return blockBiomeShortArray;
|
return eid$blockBiomeShortArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBiomeShortArray(short[] data) {
|
public void setBiomeShortArray(short[] data) {
|
||||||
blockBiomeShortArray = data;
|
eid$blockBiomeShortArray = data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.blockitem.matteroverdrive;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.util.DataUtil;
|
||||||
|
import matteroverdrive.data.Inventory;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
@Mixin(Inventory.class)
|
||||||
|
public abstract class InventoryMixin {
|
||||||
|
@Redirect(method = "readFromNBT",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/nbt/NBTTagCompound;hasKey(Ljava/lang/String;I)Z"),
|
||||||
|
require = 1)
|
||||||
|
private boolean fixHasKey(NBTTagCompound instance, String p_150297_1_, int p_150297_2_) {
|
||||||
|
return DataUtil.nbtHasID(instance);
|
||||||
|
}
|
||||||
|
}
|
||||||
+70
@@ -0,0 +1,70 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.blockitem.matteroverdrive;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import matteroverdrive.data.ItemPattern;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraftforge.common.util.Constants;
|
||||||
|
|
||||||
|
@Mixin(value = ItemPattern.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class ItemPatternMixin {
|
||||||
|
@Shadow private int itemID;
|
||||||
|
|
||||||
|
@Shadow private int progress;
|
||||||
|
|
||||||
|
@Shadow private int damage;
|
||||||
|
|
||||||
|
@Shadow private int count;
|
||||||
|
|
||||||
|
@Inject(method = "writeToNBT",
|
||||||
|
at = @At("RETURN"),
|
||||||
|
require = 1)
|
||||||
|
private void writeToNBT$writeInt(NBTTagCompound nbtTagCompound, CallbackInfo ci) {
|
||||||
|
int id = this.itemID;
|
||||||
|
if (id > VanillaConstants.maxItemID) {
|
||||||
|
nbtTagCompound.setShort("id", (short) 0);
|
||||||
|
}
|
||||||
|
nbtTagCompound.setInteger("idExt", id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "readFromNBT",
|
||||||
|
at = @At("RETURN"),
|
||||||
|
require = 1)
|
||||||
|
private void readFromNBT$readInt(NBTTagCompound nbtTagCompound, CallbackInfo ci) {
|
||||||
|
if (nbtTagCompound.hasKey("idExt", Constants.NBT.TAG_INT))
|
||||||
|
this.itemID = nbtTagCompound.getInteger("idExt");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FalsePattern
|
||||||
|
* @reason Extend IDs
|
||||||
|
*/
|
||||||
|
@Overwrite
|
||||||
|
public void writeToBuffer(ByteBuf byteBuf) {
|
||||||
|
byteBuf.writeInt(this.itemID);
|
||||||
|
byteBuf.writeByte(this.progress);
|
||||||
|
byteBuf.writeShort(this.damage);
|
||||||
|
byteBuf.writeByte(this.count);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FalsePattern
|
||||||
|
* @reason Extend IDs
|
||||||
|
*/
|
||||||
|
@Overwrite
|
||||||
|
public void readFromBuffer(ByteBuf byteBuf) {
|
||||||
|
this.itemID = byteBuf.readInt();
|
||||||
|
this.progress = byteBuf.readByte();
|
||||||
|
this.damage = byteBuf.readShort();
|
||||||
|
this.count = byteBuf.readByte();
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
-2
@@ -1,5 +1,7 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.blockitem.vanilla;
|
package com.falsepattern.endlessids.mixin.mixins.common.blockitem.vanilla;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
|
import com.falsepattern.endlessids.util.DataUtil;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
@@ -29,7 +31,7 @@ public abstract class ItemStackMixin {
|
|||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
||||||
nbt.setInteger("id", Item.getIdFromItem(this.field_151002_e));
|
DataUtil.writeIDToNBT(nbt, Item.getIdFromItem(this.field_151002_e));
|
||||||
nbt.setByte("Count", (byte) this.stackSize);
|
nbt.setByte("Count", (byte) this.stackSize);
|
||||||
nbt.setShort("Damage", (short) this.itemDamage);
|
nbt.setShort("Damage", (short) this.itemDamage);
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ public abstract class ItemStackMixin {
|
|||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public void readFromNBT(NBTTagCompound nbt) {
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
func_150996_a(Item.getItemById(nbt.getInteger("id")));
|
func_150996_a(Item.getItemById(DataUtil.readIDFromNBT(nbt)));
|
||||||
this.stackSize = nbt.getByte("Count");
|
this.stackSize = nbt.getByte("Count");
|
||||||
this.itemDamage = nbt.getShort("Damage");
|
this.itemDamage = nbt.getShort("Damage");
|
||||||
|
|
||||||
|
|||||||
+27
-13
@@ -25,11 +25,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Mixin(DataWatcher.class)
|
@Mixin(value = DataWatcher.class,
|
||||||
|
priority = 1001)
|
||||||
public abstract class DataWatcherMixin {
|
public abstract class DataWatcherMixin {
|
||||||
|
|
||||||
@Shadow @Final private Map watchedObjects;
|
|
||||||
|
|
||||||
@ModifyConstant(method = {"addObject", "func_151509_a"},
|
@ModifyConstant(method = {"addObject", "func_151509_a"},
|
||||||
constant = @Constant(intValue = VanillaConstants.maxWatchableID),
|
constant = @Constant(intValue = VanillaConstants.maxWatchableID),
|
||||||
require = 2)
|
require = 2)
|
||||||
@@ -71,16 +69,21 @@ public abstract class DataWatcherMixin {
|
|||||||
watchable = new DataWatcher.WatchableObject(type, id, packet.readFloat());
|
watchable = new DataWatcher.WatchableObject(type, id, packet.readFloat());
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
watchable = new DataWatcher.WatchableObject(type, id, packet.readStringFromBuffer(32767));
|
boolean present = packet.readBoolean();
|
||||||
|
watchable = new DataWatcher.WatchableObject(type, id, present ? packet.readStringFromBuffer(32767) : null);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
watchable = new DataWatcher.WatchableObject(type, id, packet.readItemStackFromBuffer());
|
watchable = new DataWatcher.WatchableObject(type, id, packet.readItemStackFromBuffer());
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
int x = packet.readInt();
|
ChunkCoordinates coords = null;
|
||||||
int y = packet.readInt();
|
if (packet.readBoolean()) {
|
||||||
int z = packet.readInt();
|
int x = packet.readInt();
|
||||||
watchable = new DataWatcher.WatchableObject(type, id, new ChunkCoordinates(x, y, z));
|
int y = packet.readInt();
|
||||||
|
int z = packet.readInt();
|
||||||
|
coords = new ChunkCoordinates(x, y, z);
|
||||||
|
}
|
||||||
|
watchable = new DataWatcher.WatchableObject(type, id, coords);
|
||||||
}
|
}
|
||||||
|
|
||||||
watchables.add(watchable);
|
watchables.add(watchable);
|
||||||
@@ -126,7 +129,13 @@ public abstract class DataWatcherMixin {
|
|||||||
buf.writeFloat((float) watcher.getObject());
|
buf.writeFloat((float) watcher.getObject());
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
buf.writeStringToBuffer((String) watcher.getObject());
|
val obj = (String) watcher.getObject();
|
||||||
|
if (obj == null) {
|
||||||
|
buf.writeBoolean(false);
|
||||||
|
} else {
|
||||||
|
buf.writeBoolean(true);
|
||||||
|
buf.writeStringToBuffer(obj);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
ItemStack itemstack = (ItemStack) watcher.getObject();
|
ItemStack itemstack = (ItemStack) watcher.getObject();
|
||||||
@@ -134,9 +143,14 @@ public abstract class DataWatcherMixin {
|
|||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
ChunkCoordinates chunkcoordinates = (ChunkCoordinates) watcher.getObject();
|
ChunkCoordinates chunkcoordinates = (ChunkCoordinates) watcher.getObject();
|
||||||
buf.writeInt(chunkcoordinates.posX);
|
if (chunkcoordinates == null) {
|
||||||
buf.writeInt(chunkcoordinates.posY);
|
buf.writeBoolean(false);
|
||||||
buf.writeInt(chunkcoordinates.posZ);
|
} else {
|
||||||
|
buf.writeBoolean(true);
|
||||||
|
buf.writeInt(chunkcoordinates.posX);
|
||||||
|
buf.writeInt(chunkcoordinates.posY);
|
||||||
|
buf.writeInt(chunkcoordinates.posZ);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,6 +137,9 @@ public enum Mixin implements IMixin {
|
|||||||
//region NomadicTents
|
//region NomadicTents
|
||||||
NomadicTentsTentChunkProviderMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.NOMADICTENTS)), "biome.nomadictents.TentChunkProviderMixin"),
|
NomadicTentsTentChunkProviderMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.NOMADICTENTS)), "biome.nomadictents.TentChunkProviderMixin"),
|
||||||
//endregion NomadicTents
|
//endregion NomadicTents
|
||||||
|
//region OWG
|
||||||
|
OWGChunkGeneratorBetaMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.OWG)), "biome.owg.ChunkGeneratorBetaMixin"),
|
||||||
|
//endregion OWG
|
||||||
//region RandomThings
|
//region RandomThings
|
||||||
ItemBiomePainterMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.RANDOMTHINGS)), "biome.randomthings.ItemBiomePainterMixin"),
|
ItemBiomePainterMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.RANDOMTHINGS)), "biome.randomthings.ItemBiomePainterMixin"),
|
||||||
MessagePaintBiomeMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.RANDOMTHINGS)), "biome.randomthings.MessagePaintBiomeMixin"),
|
MessagePaintBiomeMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.RANDOMTHINGS)), "biome.randomthings.MessagePaintBiomeMixin"),
|
||||||
@@ -156,6 +159,9 @@ public enum Mixin implements IMixin {
|
|||||||
//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
|
||||||
|
//region ThutCore
|
||||||
|
ThutVector3Mixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.THUTCORE)), "biome.thut.Vector3Mixin"),
|
||||||
|
//endregion ThutCore
|
||||||
//region Tropicraft
|
//region Tropicraft
|
||||||
GenLayerTropiVoronoiZoomMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.TROPICRAFT)), "biome.tropicraft.GenLayerTropiVoronoiZoomMixin"),
|
GenLayerTropiVoronoiZoomMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.TROPICRAFT)), "biome.tropicraft.GenLayerTropiVoronoiZoomMixin"),
|
||||||
//endregion Tropicraft
|
//endregion Tropicraft
|
||||||
@@ -186,6 +192,10 @@ public enum Mixin implements IMixin {
|
|||||||
DragonAPIBlockPropertiesMixin(Side.COMMON, condition(() -> GeneralConfig.extendBlockItem).and(require(TargetedMod.DRAGONAPI)), "blockitem.dragonapi.BlockPropertiesMixin"),
|
DragonAPIBlockPropertiesMixin(Side.COMMON, condition(() -> GeneralConfig.extendBlockItem).and(require(TargetedMod.DRAGONAPI)), "blockitem.dragonapi.BlockPropertiesMixin"),
|
||||||
DragonAPIBlockItemIDTypeMixin(Side.COMMON, condition(() -> GeneralConfig.extendBlockItem).and(require(TargetedMod.DRAGONAPI)), "blockitem.dragonapi.IDTypeMixin"),
|
DragonAPIBlockItemIDTypeMixin(Side.COMMON, condition(() -> GeneralConfig.extendBlockItem).and(require(TargetedMod.DRAGONAPI)), "blockitem.dragonapi.IDTypeMixin"),
|
||||||
//endregion DragonAPI
|
//endregion DragonAPI
|
||||||
|
//region Matter Overdrive
|
||||||
|
MOInventoryMixin(Side.COMMON, condition(() -> GeneralConfig.extendBlockItem).and(require(TargetedMod.MATTEROVERDRIVE)), "blockitem.matteroverdrive.InventoryMixin"),
|
||||||
|
MOItemPatternMixin(Side.COMMON, condition(() -> GeneralConfig.extendBlockItem).and(require(TargetedMod.MATTEROVERDRIVE)), "blockitem.matteroverdrive.ItemPatternMixin"),
|
||||||
|
//endregion Matter Overdrive
|
||||||
//region MFQM
|
//region MFQM
|
||||||
MFQMMixin(Side.COMMON, condition(() -> GeneralConfig.extendBlockItem).and(require(TargetedMod.MFQM)), "blockitem.mfqm.MFQMMixin"),
|
MFQMMixin(Side.COMMON, condition(() -> GeneralConfig.extendBlockItem).and(require(TargetedMod.MFQM)), "blockitem.mfqm.MFQMMixin"),
|
||||||
//endregion MFQM
|
//endregion MFQM
|
||||||
|
|||||||
@@ -37,15 +37,18 @@ public enum TargetedMod implements ITargetedMod {
|
|||||||
ICG("Immersive Cavegen", false, startsWith("immersivecavegen")),
|
ICG("Immersive Cavegen", false, startsWith("immersivecavegen")),
|
||||||
IR3("Industrial Revolution by Redstone Rebooted", false, startsWith("industrialrevolutionbyredstonerebooted-")),
|
IR3("Industrial Revolution by Redstone Rebooted", false, startsWith("industrialrevolutionbyredstonerebooted-")),
|
||||||
LOTR("LOTR Mod", false, startsWith("lotrmod")),
|
LOTR("LOTR Mod", false, startsWith("lotrmod")),
|
||||||
|
MATTEROVERDRIVE("Matter Overdrive", false, startsWith("matteroverdrive-")),
|
||||||
MFQM("More Fun Quicksand Mod", false, startsWith("morefunquicksandmod-")),
|
MFQM("More Fun Quicksand Mod", false, startsWith("morefunquicksandmod-")),
|
||||||
NATURESCOMPASS("Nature's Compass", false, startsWith("naturescompass")),
|
NATURESCOMPASS("Nature's Compass", false, startsWith("naturescompass")),
|
||||||
NETHERLICIOUS("Netherlicious", false, startsWith("netherlicious-")),
|
NETHERLICIOUS("Netherlicious", false, startsWith("netherlicious-")),
|
||||||
NOMADICTENTS("Nomadic Tents", false, startsWith("nomadictents")),
|
NOMADICTENTS("Nomadic Tents", false, startsWith("nomadictents")),
|
||||||
|
OWG("Nostalgic world generation", false, startsWith("owg-").or(startsWith("nostalgiagenerator-"))),
|
||||||
RANDOMTHINGS("Random Things", false, startsWith("randomthings-")),
|
RANDOMTHINGS("Random Things", false, startsWith("randomthings-")),
|
||||||
RESTRUCTURED("Restructured", false, startsWith("restructured-")),
|
RESTRUCTURED("Restructured", false, startsWith("restructured-")),
|
||||||
RTG("Realistic Terrain Generation", false, startsWith("rtg-")),
|
RTG("Realistic Terrain Generation", false, startsWith("rtg-")),
|
||||||
RWG("Realistic World Gen", false, startsWith("rwg-")),
|
RWG("Realistic World Gen", false, startsWith("rwg-")),
|
||||||
THAUMCRAFT("Thaumcraft", false, startsWith("thaumcraft")),
|
THAUMCRAFT("Thaumcraft", false, startsWith("thaumcraft")),
|
||||||
|
THUTCORE("ThutCore", false, startsWith("thutcore-").or(startsWith("thutmods-"))),
|
||||||
TROPICRAFT("Tropicraft", false, startsWith("tropicraft-")),
|
TROPICRAFT("Tropicraft", false, startsWith("tropicraft-")),
|
||||||
TWILIGHTFOREST("Twilight Forest", false, startsWith("twilightforest")),
|
TWILIGHTFOREST("Twilight Forest", false, startsWith("twilightforest")),
|
||||||
UBC("Underground Biomes Constructs", false, startsWith("undergroundbiomesconstructs-")),
|
UBC("Underground Biomes Constructs", false, startsWith("undergroundbiomesconstructs-")),
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
package com.falsepattern.endlessids.util;
|
package com.falsepattern.endlessids.util;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.chunk.NibbleArray;
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.util.Constants;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import static com.falsepattern.endlessids.constants.ExtendedConstants.blocksPerSubChunk;
|
import static com.falsepattern.endlessids.constants.ExtendedConstants.blocksPerSubChunk;
|
||||||
|
import static net.minecraftforge.common.util.Constants.NBT.TAG_INT;
|
||||||
|
import static net.minecraftforge.common.util.Constants.NBT.TAG_SHORT;
|
||||||
|
|
||||||
public class DataUtil {
|
public class DataUtil {
|
||||||
public static byte[] ensureSubChunkByteArray(byte[] arr) {
|
public static byte[] ensureSubChunkByteArray(byte[] arr) {
|
||||||
@@ -14,4 +21,28 @@ public class DataUtil {
|
|||||||
public static NibbleArray ensureSubChunkNibbleArray(byte[] data) {
|
public static NibbleArray ensureSubChunkNibbleArray(byte[] data) {
|
||||||
return data == null ? null : new NibbleArray(data.length == (blocksPerSubChunk >>> 1) ? data : Arrays.copyOf(data, (blocksPerSubChunk >>> 1)), 4);
|
return data == null ? null : new NibbleArray(data.length == (blocksPerSubChunk >>> 1) ? data : Arrays.copyOf(data, (blocksPerSubChunk >>> 1)), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int readIDFromNBT(NBTTagCompound nbt) {
|
||||||
|
if (nbt.hasKey("idExt", TAG_INT))
|
||||||
|
return nbt.getInteger("idExt");
|
||||||
|
else if (nbt.hasKey("id", TAG_INT))
|
||||||
|
return nbt.getInteger("id");
|
||||||
|
else if (nbt.hasKey("id", TAG_SHORT))
|
||||||
|
return nbt.getShort("id");
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void writeIDToNBT(NBTTagCompound nbt, int id) {
|
||||||
|
if (id > VanillaConstants.maxItemID) {
|
||||||
|
nbt.setShort("id", (short)0);
|
||||||
|
nbt.setInteger("idExt", id);
|
||||||
|
} else {
|
||||||
|
nbt.setShort("id", (short) id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean nbtHasID(NBTTagCompound nbt) {
|
||||||
|
return nbt.hasKey("id", TAG_INT) || nbt.hasKey("idExt", TAG_INT) || nbt.hasKey("id", TAG_SHORT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user