Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -3248,6 +3249,7 @@ public void load(FMLInitializationEvent event) {
public void postInit(FMLPostInitializationEvent event) {
proxy.registerPostSideObjects();
isGregTechLoaded = Loader.isModLoaded("gregtech");
isEndlessIdsLoaded = Loader.isModLoaded("endlessids");
// TODO Thaumcraft Integration
if (Loader.isModLoaded("Thaumcraft")) {
isThaumcraftLoaded = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
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;
Expand Down Expand Up @@ -283,13 +285,23 @@ private static class GaiaBiomeChangeMessageHandler extends SimpleChannelInboundH
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);
}
}
}
Expand Down Expand Up @@ -432,7 +444,7 @@ public static class GaiaBiomeChangeMessage extends BMMessage {

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;
Expand Down Expand Up @@ -629,7 +641,7 @@ public void encodeInto(ChannelHandlerContext ctx, BMMessage msg, ByteBuf target)
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);
}
Expand Down Expand Up @@ -812,7 +824,7 @@ public void decodeInto(ChannelHandlerContext ctx, ByteBuf dat, BMMessage msg) {
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);
Expand Down Expand Up @@ -989,7 +1001,7 @@ public static Packet getKeyboardPressPacket(byte bt) {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
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;
Expand Down Expand Up @@ -217,8 +219,10 @@ public void performEffect(IMasterRitualStone ritualStone) {
}
}

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;

Expand All @@ -229,8 +233,13 @@ public void performEffect(IMasterRitualStone ritualStone) {
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;
}
}
Expand All @@ -239,10 +248,13 @@ public void performEffect(IMasterRitualStone ritualStone) {
}

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);
}
}
Expand Down
Loading