aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/github/technus/tectech/TecTech.java103
-rw-r--r--src/main/java/com/github/technus/tectech/loader/TecTechConfig.java4
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java7
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/chunkData/ChunkDataHandler.java13
-rw-r--r--src/main/java/com/github/technus/tectech/proxy/ClientProxy.java18
5 files changed, 133 insertions, 12 deletions
diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java
index 337f493801..5383b9cf62 100644
--- a/src/main/java/com/github/technus/tectech/TecTech.java
+++ b/src/main/java/com/github/technus/tectech/TecTech.java
@@ -4,6 +4,7 @@ import com.github.technus.tectech.loader.MainLoader;
import com.github.technus.tectech.loader.TecTechConfig;
import com.github.technus.tectech.mechanics.ConvertFloat;
import com.github.technus.tectech.mechanics.ConvertInteger;
+import com.github.technus.tectech.mechanics.anomaly.AnomalyHandler;
import com.github.technus.tectech.mechanics.chunkData.ChunkDataHandler;
import com.github.technus.tectech.mechanics.elementalMatter.core.commands.GiveEM;
import com.github.technus.tectech.mechanics.elementalMatter.core.commands.ListEM;
@@ -17,6 +18,13 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import eu.usrv.yamcore.auxiliary.IngameErrorLog;
import eu.usrv.yamcore.auxiliary.LogHelper;
+import gregtech.GT_Mod;
+import gregtech.common.GT_Proxy;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.Collection;
+import java.util.Iterator;
import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE;
@@ -35,7 +43,8 @@ public class TecTech {
private static IngameErrorLog moduleAdminErrorLogs;
public static TecTechConfig configTecTech;
- public static ChunkDataHandler chunkDataHandler=new ChunkDataHandler();
+ public static ChunkDataHandler chunkDataHandler;
+ public static AnomalyHandler anomalyHandler;
/**
* For Loader.isModLoaded checks during the runtime
@@ -78,6 +87,96 @@ public class TecTech {
public void Load(FMLInitializationEvent event) {
hasCOFH = Loader.isModLoaded(Reference.COFHCORE);
+
+ if(configTecTech.DISABLE_MATERIAL_LOADING_FFS){
+ try {
+ Field field= GT_Proxy.class.getDeclaredField("mEvents");
+ field.setAccessible(true);
+ Field modifiersField = Field.class.getDeclaredField( "modifiers" );
+ modifiersField.setAccessible( true );
+ modifiersField.setInt( field, field.getModifiers() & ~Modifier.FINAL );
+ field.set(GT_Mod.gregtechproxy, new Collection() {
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return true;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator iterator() {
+ return new Iterator() {
+ @Override
+ public boolean hasNext() {
+ return false;
+ }
+
+ @Override
+ public Object next() {
+ return null;
+ }
+ };
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public boolean add(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection c) {
+ return false;
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public boolean retainAll(Collection c) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection c) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection c) {
+ return false;
+ }
+
+ @Override
+ public Object[] toArray(Object[] a) {
+ return new Object[0];
+ }
+ });
+ } catch (NoSuchFieldException | IllegalAccessException e) {
+ LOGGER.error(Reference.MODID + " could not disable material loading!");
+ }
+
+ }
+
MainLoader.load();
MainLoader.addAfterGregTechPostLoadRunner();
}
@@ -85,6 +184,8 @@ public class TecTech {
@Mod.EventHandler
public void PostLoad(FMLPostInitializationEvent PostEvent) {
MainLoader.postLoad();
+ chunkDataHandler=new ChunkDataHandler();
+ chunkDataHandler.registerChunkMetaDataHandler(anomalyHandler=new AnomalyHandler());
}
@Mod.EventHandler
diff --git a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java
index 468a0c909a..e7eb0c0945 100644
--- a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java
+++ b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java
@@ -17,6 +17,7 @@ public class TecTechConfig extends ConfigManager {
public boolean EASY_SCAN;
public boolean NERF_FUSION;
public boolean ENABLE_TURRET_EXPLOSIONS;
+ public boolean DISABLE_MATERIAL_LOADING_FFS;
public float TURRET_DAMAGE_FACTOR;
public float TURRET_EXPLOSION_FACTOR;
@@ -30,6 +31,7 @@ public class TecTechConfig extends ConfigManager {
BOOM_ENABLE = true;
NERF_FUSION = false;
ENABLE_TURRET_EXPLOSIONS = true;
+ DISABLE_MATERIAL_LOADING_FFS=false;
TURRET_DAMAGE_FACTOR = 10;
TURRET_EXPLOSION_FACTOR = 1;
}
@@ -56,6 +58,8 @@ public class TecTechConfig extends ConfigManager {
"Damage is multiplied by this number");
TURRET_EXPLOSION_FACTOR = _mainConfig.getFloat("TurretExplosionFactor", "Features", TURRET_EXPLOSION_FACTOR, 0, Short.MAX_VALUE,
"Explosion strength is multiplied by this number");
+ DISABLE_MATERIAL_LOADING_FFS = _mainConfig.getBoolean("DisableMaterialLoading", "Debug", DISABLE_MATERIAL_LOADING_FFS,
+ "Set to true to disable gregtech material processing");
}
/**
diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java
index f0669431a9..29d3ff663a 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java
@@ -8,16 +8,17 @@ import net.minecraft.nbt.NBTTagCompound;
import java.util.HashMap;
public class AnomalyHandler implements ChunkMetaDataHandler {
+ private static final String INTENSITY="intensity";
@Override
public String getTagName() {
- return "Anomaly";
+ return "anomaly";
}
@Override
public void mergeData(NBTTagCompound target, NBTTagCompound loadedData) {
- target.setInteger("intensity",
- target.getInteger("intensity")+loadedData.getInteger("intensity"));
+ int intensity=target.getInteger(INTENSITY)+loadedData.getInteger(INTENSITY);
+ target.setInteger(INTENSITY,intensity);
}
@Override
diff --git a/src/main/java/com/github/technus/tectech/mechanics/chunkData/ChunkDataHandler.java b/src/main/java/com/github/technus/tectech/mechanics/chunkData/ChunkDataHandler.java
index 50a92d6178..8dc60248ef 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/chunkData/ChunkDataHandler.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/chunkData/ChunkDataHandler.java
@@ -31,15 +31,12 @@ public class ChunkDataHandler {
if(loadedTag.hasNoTags()){
return;
}
-
int dimId=event.world.provider.dimensionId;
HashMap<ChunkCoordIntPair, NBTChunk> dimensionMemory=
dimensionWiseChunkData.computeIfAbsent(dimId, this::createDimensionData);
-
ChunkCoordIntPair chunkCoordIntPair=event.getChunk().getChunkCoordIntPair();
- NBTChunk chunkMemory =dimensionMemory.get(chunkCoordIntPair);
Set<String> loadedKeys=loadedTag.func_150296_c();
-
+ NBTChunk chunkMemory =dimensionMemory.get(chunkCoordIntPair);
if(chunkMemory==null) {
chunkMemory=new NBTChunk(loadedTag,true);
dimensionMemory.put(chunkCoordIntPair,chunkMemory);
@@ -78,7 +75,7 @@ public class ChunkDataHandler {
public void onServerStarting() {
dimensionWiseChunkData.clear();
- dimensionWiseMetaChunkData.clear();
+ dimensionWiseMetaChunkData.forEach((k,v)->v.clear());
}
public void registerChunkMetaDataHandler(ChunkMetaDataHandler handler){
@@ -123,7 +120,7 @@ public class ChunkDataHandler {
return map;
}
- public static class ChunkHashMap implements Map<ChunkCoordIntPair,NBTTagCompound>{
+ public static final class ChunkHashMap implements Map<ChunkCoordIntPair,NBTTagCompound>{
private final HashMap<ChunkCoordIntPair,NBTChunk> storage;
private final HashMap<ChunkCoordIntPair,NBTTagCompound> storageMeta=new HashMap<>(1024);
private final String meta;
@@ -180,7 +177,7 @@ public class ChunkDataHandler {
@Override
public void clear() {
- entrySet().forEach(this::remove);
+ storageMeta.entrySet().forEach(this::remove);
}
@Override
@@ -214,7 +211,7 @@ public class ChunkDataHandler {
}
}
- private static class NBTChunk {
+ private static final class NBTChunk {
private final NBTTagCompound data;
private boolean isLoaded;
diff --git a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java
index 255cf56e96..8299f815e0 100644
--- a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java
+++ b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java
@@ -11,6 +11,8 @@ import com.github.technus.tectech.thing.block.QuantumStuffRender;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import cpw.mods.fml.common.gameevent.TickEvent;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@@ -23,6 +25,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.event.world.ChunkDataEvent;
import org.lwjgl.opengl.GL11;
public class ClientProxy extends CommonProxy {
@@ -138,4 +141,19 @@ public class ClientProxy extends CommonProxy {
public void renderAABB(AxisAlignedBB box) {
renderAABB(Minecraft.getMinecraft().theWorld,box);
}
+
+ @SubscribeEvent
+ public void handleChunkSaveEvent(ChunkDataEvent.Save event) {
+ super.handleChunkSaveEvent(event);
+ }
+
+ @SubscribeEvent
+ public void handleChunkLoadEvent(ChunkDataEvent.Load event) {
+ super.handleChunkLoadEvent(event);
+ }
+
+ @SubscribeEvent
+ public void onServerTickEvent(TickEvent.ServerTickEvent aEvent) {
+ super.onServerTickEvent(aEvent);
+ }
}