mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Revert all that gradle bullshit and do reflection instead
This commit is contained in:
parent
f2b7ce48dc
commit
441a46f24f
11
build.gradle
11
build.gradle
@ -32,7 +32,6 @@ if(!mod_build_number.isEmpty()) {
|
|||||||
group = "com.hbm" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
group = "com.hbm" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
archivesBaseName = "HBM-NTM"
|
archivesBaseName = "HBM-NTM"
|
||||||
compileJava.options.encoding = 'UTF-8'
|
compileJava.options.encoding = 'UTF-8'
|
||||||
compileJava.options.compilerArgs += '-proc:none'
|
|
||||||
|
|
||||||
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
|
||||||
|
|
||||||
@ -76,14 +75,6 @@ repositories {
|
|||||||
name = "gt"
|
name = "gt"
|
||||||
url = "https://gregtech.mechaenetia.com/"
|
url = "https://gregtech.mechaenetia.com/"
|
||||||
}
|
}
|
||||||
maven {
|
|
||||||
name = 'FalsePattern'
|
|
||||||
url = "https://mvn.falsepattern.com/releases/"
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name = "GitHub"
|
|
||||||
url = "https://jitpack.io"
|
|
||||||
}
|
|
||||||
//maven {
|
//maven {
|
||||||
// name = "CurseForge"
|
// name = "CurseForge"
|
||||||
// url = "https://minecraft.curseforge.com/api/maven/"
|
// url = "https://minecraft.curseforge.com/api/maven/"
|
||||||
@ -103,8 +94,6 @@ dependencies {
|
|||||||
compileOnly "inventorytweaks:InventoryTweaks:1.59-dev:deobf"
|
compileOnly "inventorytweaks:InventoryTweaks:1.59-dev:deobf"
|
||||||
|
|
||||||
implementation "li.cil.oc:OpenComputers:MC1.7.10-1.5.+:api"
|
implementation "li.cil.oc:OpenComputers:MC1.7.10-1.5.+:api"
|
||||||
|
|
||||||
compileOnly 'com.falsepattern:endlessids-mc1.7.10:1.5.4:dev'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
package com.hbm.packet.toclient;
|
package com.hbm.packet.toclient;
|
||||||
|
|
||||||
import cpw.mods.fml.common.Loader;
|
import cpw.mods.fml.common.Loader;
|
||||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
|
||||||
import com.hbm.util.Compat;
|
import com.hbm.util.Compat;
|
||||||
|
import com.hbm.world.WorldUtil;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
@ -104,24 +104,24 @@ public class BiomeSyncPacket implements IMessage {
|
|||||||
chunk.isModified = true;
|
chunk.isModified = true;
|
||||||
|
|
||||||
if(Loader.isModLoaded(Compat.MOD_EIDS)) {
|
if(Loader.isModLoaded(Compat.MOD_EIDS)) {
|
||||||
if (m.biomeArray == null) {
|
short[] target = WorldUtil.getBiomeShortArray(chunk);
|
||||||
ChunkBiomeHook hook = (ChunkBiomeHook) chunk;
|
if(m.biomeArray == null) {
|
||||||
hook.getBiomeShortArray()[(m.blockZ & 15) << 4 | m.blockX & 15] = m.biome;
|
target[(m.blockZ & 15) << 4 | m.blockX & 15] = m.biome;
|
||||||
world.markBlockRangeForRenderUpdate(m.chunkX << 4, 0, m.chunkZ << 4, m.chunkX << 4, 255, m.chunkZ << 4);
|
world.markBlockRangeForRenderUpdate(m.chunkX << 4, 0, m.chunkZ << 4, m.chunkX << 4, 255, m.chunkZ << 4);
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < 255; ++i) {
|
for(int i = 0; i < 255; ++i) {
|
||||||
ChunkBiomeHook hook = (ChunkBiomeHook) chunk;
|
target[i] = m.biomeArray[i];
|
||||||
hook.getBiomeShortArray()[i] = m.biomeArray[i];
|
|
||||||
world.markBlockRangeForRenderUpdate(m.chunkX << 4, 0, m.chunkZ << 4, (m.chunkX << 4) + 15, 255, (m.chunkZ << 4) + 15);
|
world.markBlockRangeForRenderUpdate(m.chunkX << 4, 0, m.chunkZ << 4, (m.chunkX << 4) + 15, 255, (m.chunkZ << 4) + 15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
byte[] target = chunk.getBiomeArray();
|
||||||
if(m.biomeArray == null) {
|
if(m.biomeArray == null) {
|
||||||
chunk.getBiomeArray()[(m.blockZ & 15) << 4 | (m.blockX & 15)] = (byte) m.biome;
|
target[(m.blockZ & 15) << 4 | (m.blockX & 15)] = (byte) m.biome;
|
||||||
world.markBlockRangeForRenderUpdate(m.chunkX << 4, 0, m.chunkZ << 4, m.chunkX << 4, 255, m.chunkZ << 4);
|
world.markBlockRangeForRenderUpdate(m.chunkX << 4, 0, m.chunkZ << 4, m.chunkX << 4, 255, m.chunkZ << 4);
|
||||||
} else {
|
} else {
|
||||||
for(int i = 0; i < 256; i++) {
|
for(int i = 0; i < 256; i++) {
|
||||||
chunk.getBiomeArray()[i] = (byte) m.biomeArray[i];
|
target[i] = (byte) m.biomeArray[i];
|
||||||
world.markBlockRangeForRenderUpdate(m.chunkX << 4, 0, m.chunkZ << 4, (m.chunkX << 4) + 15, 255, (m.chunkZ << 4) + 15);
|
world.markBlockRangeForRenderUpdate(m.chunkX << 4, 0, m.chunkZ << 4, (m.chunkX << 4) + 15, 255, (m.chunkZ << 4) + 15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,11 @@ package com.hbm.world;
|
|||||||
import com.hbm.packet.PacketDispatcher;
|
import com.hbm.packet.PacketDispatcher;
|
||||||
import com.hbm.packet.toclient.BiomeSyncPacket;
|
import com.hbm.packet.toclient.BiomeSyncPacket;
|
||||||
import com.hbm.util.Compat;
|
import com.hbm.util.Compat;
|
||||||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
|
|
||||||
|
import java.lang.invoke.MethodHandle;
|
||||||
|
import java.lang.invoke.MethodHandles;
|
||||||
|
import java.lang.invoke.MethodType;
|
||||||
|
|
||||||
import cpw.mods.fml.common.Loader;
|
import cpw.mods.fml.common.Loader;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
@ -21,10 +25,26 @@ import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
|||||||
|
|
||||||
public class WorldUtil {
|
public class WorldUtil {
|
||||||
|
|
||||||
|
private static final MethodHandle getBiomeShortHandle;
|
||||||
|
|
||||||
|
static {
|
||||||
|
if(Loader.isModLoaded(Compat.MOD_EIDS)) {
|
||||||
|
try {
|
||||||
|
MethodHandles.Lookup lookup = MethodHandles.publicLookup();
|
||||||
|
MethodType methodType = MethodType.methodType(short[].class);
|
||||||
|
getBiomeShortHandle = lookup.findVirtual(Chunk.class, "getBiomeShortArray", methodType);
|
||||||
|
} catch(Exception e) {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
getBiomeShortHandle = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void setBiome(World world, int x, int z, BiomeGenBase biome) {
|
public static void setBiome(World world, int x, int z, BiomeGenBase biome) {
|
||||||
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
||||||
if(Loader.isModLoaded(Compat.MOD_EIDS)) {
|
if(Loader.isModLoaded(Compat.MOD_EIDS)) {
|
||||||
short[] array = ((ChunkBiomeHook) chunk).getBiomeShortArray();
|
short[] array = getBiomeShortArray(chunk);
|
||||||
array[(z & 15) << 4 | x & 15] = (short) biome.biomeID;
|
array[(z & 15) << 4 | x & 15] = (short) biome.biomeID;
|
||||||
} else {
|
} else {
|
||||||
chunk.getBiomeArray()[(z & 15) << 4 | (x & 15)] = (byte)(biome.biomeID & 255);
|
chunk.getBiomeArray()[(z & 15) << 4 | (x & 15)] = (byte)(biome.biomeID & 255);
|
||||||
@ -35,7 +55,7 @@ public class WorldUtil {
|
|||||||
public static void syncBiomeChange(World world, int x, int z) {
|
public static void syncBiomeChange(World world, int x, int z) {
|
||||||
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
||||||
if(Loader.isModLoaded(Compat.MOD_EIDS)) {
|
if(Loader.isModLoaded(Compat.MOD_EIDS)) {
|
||||||
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(x >> 4, z >> 4, ((ChunkBiomeHook) chunk).getBiomeShortArray()), new TargetPoint(world.provider.dimensionId, x, 128, z, 1024D));
|
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(x >> 4, z >> 4, getBiomeShortArray(chunk)), new TargetPoint(world.provider.dimensionId, x, 128, z, 1024D));
|
||||||
} else {
|
} else {
|
||||||
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(x >> 4, z >> 4, chunk.getBiomeArray()), new TargetPoint(world.provider.dimensionId, x, 128, z, 1024D));
|
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(x >> 4, z >> 4, chunk.getBiomeArray()), new TargetPoint(world.provider.dimensionId, x, 128, z, 1024D));
|
||||||
}
|
}
|
||||||
@ -44,7 +64,7 @@ public class WorldUtil {
|
|||||||
public static void syncBiomeChangeBlock(World world, int x, int z) {
|
public static void syncBiomeChangeBlock(World world, int x, int z) {
|
||||||
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
||||||
if(Loader.isModLoaded(Compat.MOD_EIDS)) {
|
if(Loader.isModLoaded(Compat.MOD_EIDS)) {
|
||||||
short biome = ((ChunkBiomeHook) chunk).getBiomeShortArray()[(z & 15) << 4 | (x & 15)];
|
short biome = getBiomeShortArray(chunk)[(z & 15) << 4 | (x & 15)];
|
||||||
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(x, z, biome), new TargetPoint(world.provider.dimensionId, x, 128, z, 1024D));
|
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(x, z, biome), new TargetPoint(world.provider.dimensionId, x, 128, z, 1024D));
|
||||||
} else {
|
} else {
|
||||||
byte biome = chunk.getBiomeArray()[(z & 15) << 4 | (x & 15)];
|
byte biome = chunk.getBiomeArray()[(z & 15) << 4 | (x & 15)];
|
||||||
@ -65,12 +85,20 @@ public class WorldUtil {
|
|||||||
/* this sucks ass */
|
/* this sucks ass */
|
||||||
ChunkCoordIntPair coord = chunk.getChunkCoordIntPair();
|
ChunkCoordIntPair coord = chunk.getChunkCoordIntPair();
|
||||||
if(Loader.isModLoaded(Compat.MOD_EIDS)) {
|
if(Loader.isModLoaded(Compat.MOD_EIDS)) {
|
||||||
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(coord.chunkXPos, coord.chunkZPos, ((ChunkBiomeHook) chunk).getBiomeShortArray()), new TargetPoint(world.provider.dimensionId, coord.getCenterXPos(), 128, coord.getCenterZPosition() /* who named you? */, 1024D));
|
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(coord.chunkXPos, coord.chunkZPos, getBiomeShortArray(chunk)), new TargetPoint(world.provider.dimensionId, coord.getCenterXPos(), 128, coord.getCenterZPosition() /* who named you? */, 1024D));
|
||||||
} else {
|
} else {
|
||||||
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(coord.chunkXPos, coord.chunkZPos, chunk.getBiomeArray()), new TargetPoint(world.provider.dimensionId, coord.getCenterXPos(), 128, coord.getCenterZPosition() /* who named you? */, 1024D));
|
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(coord.chunkXPos, coord.chunkZPos, chunk.getBiomeArray()), new TargetPoint(world.provider.dimensionId, coord.getCenterXPos(), 128, coord.getCenterZPosition() /* who named you? */, 1024D));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static short[] getBiomeShortArray(Chunk chunk) {
|
||||||
|
try {
|
||||||
|
return (short[]) getBiomeShortHandle.invokeExact(chunk);
|
||||||
|
} catch(Throwable ex) {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**Chunkloads the chunk the entity is going to spawn in and then spawns it
|
/**Chunkloads the chunk the entity is going to spawn in and then spawns it
|
||||||
* @param entity The entity to be spawned**/
|
* @param entity The entity to be spawned**/
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user