mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-10-25 20:22:32 +00:00
EID Compat (#133)
This commit is contained in:
1 parent
22d703da79
commit
9430a0a6dd
4 files changed
+42
-16
No files matched your search
+1
-1
@@ -39,6 +39,6 @@ dependencies {
|
||||
|
||||
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {transitive = false }
|
||||
compileOnly("curse.maven:guide-api-228832:2287185") {transitive = false }
|
||||
|
||||
compileOnly("curse.maven:endlessids-665730:7585931") {transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:StructureLib:1.4.34:dev")
|
||||
}
|
||||
@@ -487,6 +487,7 @@ public class AlchemicalWizardry {
|
||||
public static boolean isChiselLoaded;
|
||||
public static boolean isFMPLoaded;
|
||||
public static boolean isPneumaticCraftLoaded;
|
||||
public static boolean isEndlessIdsLoaded;
|
||||
|
||||
public static boolean wimpySettings;
|
||||
public static boolean respawnWithDebuff;
|
||||
@@ -3248,6 +3249,7 @@ public class AlchemicalWizardry {
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
proxy.registerPostSideObjects();
|
||||
isGregTechLoaded = Loader.isModLoaded("gregtech");
|
||||
isEndlessIdsLoaded = Loader.isModLoaded("endlessids");
|
||||
// TODO Thaumcraft Integration
|
||||
if (Loader.isModLoaded("Thaumcraft")) {
|
||||
isThaumcraftLoaded = true;
|
||||
|
||||
@@ -17,6 +17,8 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.ColourAndCoords;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
||||
@@ -283,13 +285,23 @@ public enum NewPacketHandler {
|
||||
protected void channelRead0(ChannelHandlerContext ctx, GaiaBiomeChangeMessage msg) {
|
||||
Chunk chunk = AlchemicalWizardry.proxy.getClientWorld().getChunkFromChunkCoords(msg.chunkX, msg.chunkZ);
|
||||
if (chunk != null) {
|
||||
byte[] biomeArray = chunk.getBiomeArray();
|
||||
for (int i = 0; i < 16 * 16; ++i) {
|
||||
if (msg.mask.get(i)) {
|
||||
biomeArray[i] = msg.biome;
|
||||
if (AlchemicalWizardry.isEndlessIdsLoaded) {
|
||||
short[] biomeArray = ((ChunkBiomeHook) chunk).getBiomeShortArray();
|
||||
for (int i = 0; i < 16 * 16; ++i) {
|
||||
if (msg.mask.get(i)) {
|
||||
biomeArray[i] = (short) msg.biome;
|
||||
}
|
||||
}
|
||||
((ChunkBiomeHook) chunk).setBiomeShortArray(biomeArray);
|
||||
} else {
|
||||
byte[] biomeArray = chunk.getBiomeArray();
|
||||
for (int i = 0; i < 16 * 16; ++i) {
|
||||
if (msg.mask.get(i)) {
|
||||
biomeArray[i] = (byte) msg.biome;
|
||||
}
|
||||
}
|
||||
chunk.setBiomeArray(biomeArray);
|
||||
}
|
||||
chunk.setBiomeArray(biomeArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -432,7 +444,7 @@ public enum NewPacketHandler {
|
||||
|
||||
int chunkX;
|
||||
int chunkZ;
|
||||
byte biome;
|
||||
int biome;
|
||||
BitSet mask;
|
||||
// One bit per coordinate in a chunk, 16*16 bits = 32 bytes
|
||||
public static final int maskByteCount = 32;
|
||||
@@ -629,7 +641,7 @@ public enum NewPacketHandler {
|
||||
GaiaBiomeChangeMessage m = (GaiaBiomeChangeMessage) msg;
|
||||
target.writeInt(m.chunkX);
|
||||
target.writeInt(m.chunkZ);
|
||||
target.writeByte(m.biome);
|
||||
target.writeInt(m.biome);
|
||||
byte[] arr = Arrays.copyOf(m.mask.toByteArray(), GaiaBiomeChangeMessage.maskByteCount);
|
||||
target.writeBytes(arr);
|
||||
}
|
||||
@@ -812,7 +824,7 @@ public enum NewPacketHandler {
|
||||
GaiaBiomeChangeMessage m = (GaiaBiomeChangeMessage) msg;
|
||||
m.chunkX = dat.readInt();
|
||||
m.chunkZ = dat.readInt();
|
||||
m.biome = dat.readByte();
|
||||
m.biome = dat.readInt();
|
||||
|
||||
byte[] buffer = new byte[GaiaBiomeChangeMessage.maskByteCount];
|
||||
dat.readBytes(buffer);
|
||||
@@ -989,7 +1001,7 @@ public enum NewPacketHandler {
|
||||
return INSTANCE.channels.get(Side.CLIENT).generatePacketFrom(msg);
|
||||
}
|
||||
|
||||
public static Packet getGaiaBiomeChangePacket(int x, int z, byte biome, BitSet mask) {
|
||||
public static Packet getGaiaBiomeChangePacket(int x, int z, int biome, BitSet mask) {
|
||||
GaiaBiomeChangeMessage msg = new GaiaBiomeChangeMessage();
|
||||
msg.index = 15;
|
||||
msg.chunkX = x;
|
||||
|
||||
+18
-6
@@ -19,6 +19,8 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
@@ -217,8 +219,10 @@ public class RitualEffectBiomeChanger extends RitualEffect {
|
||||
}
|
||||
}
|
||||
|
||||
boolean eidLoaded = AlchemicalWizardry.isEndlessIdsLoaded;
|
||||
for (Chunk chunk : chunkList) {
|
||||
byte[] byteArray = chunk.getBiomeArray();
|
||||
byte[] byteArray = eidLoaded ? null : chunk.getBiomeArray();
|
||||
short[] shortArray = eidLoaded ? ((ChunkBiomeHook) chunk).getBiomeShortArray() : null;
|
||||
BitSet mask = new BitSet();
|
||||
boolean changed = false;
|
||||
|
||||
@@ -229,8 +233,13 @@ public class RitualEffectBiomeChanger extends RitualEffect {
|
||||
int offsetX = (chunk.xPosition << 4 | cX) - (x - range);
|
||||
if (0 <= offsetX && offsetX < 2 * range + 1) {
|
||||
if (boolList[offsetX][offsetZ]) {
|
||||
mask.set(cZ << 4 | cX, true);
|
||||
byteArray[cZ << 4 | cX] = (byte) biomeID;
|
||||
int index = cZ << 4 | cX;
|
||||
mask.set(index, true);
|
||||
if (eidLoaded) {
|
||||
shortArray[index] = (short) biomeID;
|
||||
} else {
|
||||
byteArray[index] = (byte) biomeID;
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
@@ -239,10 +248,13 @@ public class RitualEffectBiomeChanger extends RitualEffect {
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
chunk.setBiomeArray(byteArray);
|
||||
if (eidLoaded) {
|
||||
((ChunkBiomeHook) chunk).setBiomeShortArray(shortArray);
|
||||
} else {
|
||||
chunk.setBiomeArray(byteArray);
|
||||
}
|
||||
NewPacketHandler.INSTANCE.sendToDimension(
|
||||
NewPacketHandler
|
||||
.getGaiaBiomeChangePacket(chunk.xPosition, chunk.zPosition, (byte) biomeID, mask),
|
||||
NewPacketHandler.getGaiaBiomeChangePacket(chunk.xPosition, chunk.zPosition, biomeID, mask),
|
||||
world.provider.dimensionId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user