Compare commits

..
3 Commits
Author SHA1 Message Date
Martin Robertz 66e040d9b3 update 2025-11-04 22:44:09 +01:00
Worive 7f8c7ca5bc Rename attribute for more clarity 2025-11-04 18:26:07 +01:00
Worive e4daa5a796 Improve NetworkedInventory robustness
Replaced the hardcoded inventory re-check logic with a universal TileEntity validity check. By caching the TileEntity and using isInvalid(), conduits can now automatically detect when a connected block is broken or replaced, allowing them to reconnect seamlessly.
2025-11-02 10:50:55 +01:00
14 changed files with 78 additions and 74 deletions

No files matched your search

+14 -14
View File
@@ -2,23 +2,23 @@
dependencies {
api('com.github.GTNewHorizons:EnderCore:0.5.0:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.17:dev')
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.8.19-GTNH:dev')
api("com.github.GTNewHorizons:GTNHLib:0.7.0:dev")
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.2:dev')
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.8.26-GTNH:dev')
api("com.github.GTNewHorizons:GTNHLib:0.7.7:dev")
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.45:dev')
api('curse.maven:cofh-lib-220333:2388748') // https://www.curseforge.com/minecraft/mc-mods/cofh-lib/files/2388748
shadowImplementation('cglib:cglib-nodep:3.3.0')
api("com.github.GTNewHorizons:TinkersConstruct:1.14.6-GTNH:dev")
compileOnly('com.github.GTNewHorizons:waila:1.9.2:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-717-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.1-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.52.60:dev') {transitive = false}
compileOnly("com.github.GTNewHorizons:ModularUI2:2.3.4-1.7.10:dev") {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.0:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.0-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Chisel:2.17.0-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.2-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:waila:1.9.7:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-729-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.2-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.52.95:dev') {transitive = false}
compileOnly("com.github.GTNewHorizons:ModularUI2:2.3.5-1.7.10:dev") {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.4:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.1-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Chisel:2.17.3-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.4-GTNH:api') {transitive = false}
compileOnly('curse.maven:minefactory-reloaded-66672:2366150') // https://www.curseforge.com/minecraft/mc-mods/minefactory-reloaded/files/2366150
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('curse.maven:ee3-65509:2305023') // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
@@ -26,6 +26,6 @@ dependencies {
compileOnly(rfg.deobf('curse.maven:mekanism-268560:2475797')) // https://www.curseforge.com/minecraft/mc-mods/mekanism/files/2475797
compileOnly(rfg.deobf('maven.modrinth:immibis-microblocks:59.1.2')) // https://modrinth.com/mod/immibis-microblocks/version/59.1.2
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta62:api') {transitive = false}
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.3:dev")
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta64:api') {transitive = false}
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.9:dev")
}
+9 -1
View File
@@ -96,7 +96,9 @@ usesMixinDebug = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
# Specify the package that contains all of your Mixins. The package must exist or
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
# it must match with this or the build will fail.
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
@@ -172,6 +174,12 @@ curseForgeRelations =
# projects. New projects should not use this parameter.
# customArchiveBaseName =
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
# runClientWorkingDirectory = run/client
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
# runServerWorkingDirectory = run/server
# Optional parameter to have the build automatically fail if an illegal version is used.
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
# The check is ONLY performed if the version is a git tag.
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+2 -2
View File
@@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
@@ -213,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
Vendored
+2 -2
View File
@@ -70,11 +70,11 @@ goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.44'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.48'
}
@@ -9,18 +9,12 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
import crazypants.enderio.conduit.ConduitNetworkTickHandler;
import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.machine.hypercube.HyperCubeRegister;
import crazypants.enderio.machine.transceiver.ServerChannelRegister;
public class CommonProxy {
@@ -29,7 +23,6 @@ public class CommonProxy {
protected long serverTickCount = 0;
protected long clientTickCount = 0;
protected final TickTimer tickTimer = new TickTimer();
public ConduitNetworkTickHandler conduitNetworkTickHandler = null;
public CommonProxy() {}
@@ -51,7 +44,7 @@ public class CommonProxy {
}
public void loadIcons() {
;
}
public void load() {
@@ -83,22 +76,6 @@ public class CommonProxy {
return new ResourceLocation(EnderIO.DOMAIN + TEXTURE_PATH + name + TEXTURE_EXT);
}
public void onServerAboutToStart(FMLServerAboutToStartEvent event) {
conduitNetworkTickHandler = new ConduitNetworkTickHandler();
FMLCommonHandler.instance().bus().register(conduitNetworkTickHandler);
}
public void onServerStarted(FMLServerStartedEvent event) {
HyperCubeRegister.load();
ServerChannelRegister.load();
}
public void onServerStopped(FMLServerStoppedEvent event) {
HyperCubeRegister.unload();
FMLCommonHandler.instance().bus().unregister(conduitNetworkTickHandler);
conduitNetworkTickHandler = null;
}
public final class TickTimer {
@SubscribeEvent
+14 -18
View File
@@ -38,7 +38,6 @@ import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -112,6 +111,7 @@ import crazypants.enderio.machine.generator.zombie.BlockZombieGenerator.BlockEnd
import crazypants.enderio.machine.generator.zombie.BlockZombieGenerator.BlockFrankenZombieGenerator;
import crazypants.enderio.machine.generator.zombie.PacketNutrientTank;
import crazypants.enderio.machine.hypercube.BlockHyperCube;
import crazypants.enderio.machine.hypercube.HyperCubeRegister;
import crazypants.enderio.machine.invpanel.BlockInventoryPanel;
import crazypants.enderio.machine.killera.BlockKillerJoe;
import crazypants.enderio.machine.light.BlockElectricLight;
@@ -894,18 +894,22 @@ public class EnderIO {
}
@EventHandler
public void onServerAboutToStart(FMLServerAboutToStartEvent event) {
proxy.onServerAboutToStart(event);
public void serverStarted(FMLServerStartedEvent event) {
HyperCubeRegister.load();
ServerChannelRegister.load();
}
@SubscribeEvent
public void worldSaved(WorldEvent.Save event) {
// Only save together with the overworld, because this gets called for every dimension separately
if (event.world.provider != null && event.world.provider.dimensionId == 0) {
ServerChannelRegister.store();
}
}
@EventHandler
public void onServerStarted(FMLServerStartedEvent event) {
proxy.onServerStarted(event);
}
@EventHandler
public void onServerStopped(FMLServerStoppedEvent event) {
proxy.onServerStopped(event);
public void serverStopped(FMLServerStoppedEvent event) {
HyperCubeRegister.unload();
}
@EventHandler
@@ -917,12 +921,4 @@ public class EnderIO {
}
}
}
@SubscribeEvent
public void worldSaved(WorldEvent.Save event) {
// Only save together with the overworld, because this gets called for every dimension separately
if (event.world.provider != null && event.world.provider.dimensionId == 0) {
ServerChannelRegister.store();
}
}
}
@@ -7,8 +7,6 @@ import java.util.List;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import crazypants.enderio.EnderIO;
// I=base type, I is the base class of the implementations accepted by the network
public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
@@ -66,7 +64,7 @@ public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
public void addConduit(I con) {
if (!conduits.contains(con)) {
if (conduits.isEmpty()) {
EnderIO.proxy.conduitNetworkTickHandler.registerNetwork(this);
ConduitNetworkTickHandler.instance.registerNetwork(this);
}
conduits.add(con);
}
@@ -77,7 +75,7 @@ public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
con.setNetwork(null);
}
conduits.clear();
EnderIO.proxy.conduitNetworkTickHandler.unregisterNetwork(this);
ConduitNetworkTickHandler.instance.unregisterNetwork(this);
}
public List<I> getConduits() {
@@ -32,6 +32,7 @@ import com.enderio.core.client.render.BoundingBox;
import com.enderio.core.common.util.BlockCoord;
import com.enderio.core.common.util.Util;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -92,6 +93,9 @@ public class BlockConduitBundle extends BlockEio
public static BlockConduitBundle create() {
MinecraftForge.EVENT_BUS.register(ConduitNetworkTickHandler.instance);
FMLCommonHandler.instance().bus().register(ConduitNetworkTickHandler.instance);
PacketHandler.INSTANCE
.registerMessage(PacketFluidLevel.class, PacketFluidLevel.class, PacketHandler.nextID(), Side.CLIENT);
PacketHandler.INSTANCE
@@ -10,15 +10,18 @@ import cpw.mods.fml.common.gameevent.TickEvent.Phase;
public class ConduitNetworkTickHandler {
public interface TickListener {
public static final ConduitNetworkTickHandler instance = new ConduitNetworkTickHandler();
void tickStart(TickEvent.ServerTickEvent evt);
public static interface TickListener {
void tickEnd(TickEvent.ServerTickEvent evt);
public void tickStart(TickEvent.ServerTickEvent evt);
public void tickEnd(TickEvent.ServerTickEvent evt);
}
private final List<TickListener> listeners = new ArrayList<>();
private final IdentityHashMap<AbstractConduitNetwork<?, ?>, Boolean> networks = new IdentityHashMap<>();
private final List<TickListener> listeners = new ArrayList<TickListener>();
private final IdentityHashMap<AbstractConduitNetwork<?, ?>, Boolean> networks = new IdentityHashMap<AbstractConduitNetwork<?, ?>, Boolean>();
public void addListener(TickListener listener) {
listeners.add(listener);
@@ -16,7 +16,7 @@ import com.enderio.core.common.util.RoundRobinIterator;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
import crazypants.enderio.EnderIO;
import crazypants.enderio.conduit.ConduitNetworkTickHandler;
import crazypants.enderio.conduit.ConduitNetworkTickHandler.TickListener;
import crazypants.enderio.conduit.ConnectionMode;
import crazypants.enderio.conduit.power.IPowerConduit;
@@ -212,7 +212,7 @@ public class CapBankNetwork implements ICapBankNetwork {
long curTime = world.getTotalWorldTime();
if (curTime != timeAtLastApply) {
timeAtLastApply = curTime;
EnderIO.proxy.conduitNetworkTickHandler.addListener(tickListener);
ConduitNetworkTickHandler.instance.addListener(tickListener);
}
}
@@ -20,6 +20,7 @@ import crazypants.enderio.material.FrankenSkull;
import crazypants.enderio.material.Material;
import crazypants.enderio.power.Capacitors;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.ThaumcraftApiHelper;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
@@ -152,6 +153,19 @@ public class ThaumcraftCompat {
ThaumcraftApi.registerObjectTag(
new ItemStack(EnderIO.blockFusedQuartz, 1, BlockFusedQuartz.Type.ENLIGHTENED_GLASS.ordinal()),
new AspectList().add(Aspect.CRYSTAL, 2).add(Aspect.LIGHT, 8).add(Aspect.SENSES, 2));
// This is a horrible hack due to the fact that I am assembling my aspects after TC does recipe parsing
// Therefore I redo all EIO items
for (Object o : Item.itemRegistry.getKeys()) {
if (o instanceof String) {
String ownermod = ((String) o).substring(0, ((String) o).indexOf(':'));
if (EnderIO.MODID.equals(ownermod)) {
for (int idx = 0; idx < 16; idx++) {
addAspectsFromRecipes((Item) Item.itemRegistry.getObject((String) o), idx);
}
}
}
}
}
private static AspectList getAspects(Block block) {
@@ -171,6 +185,10 @@ public class ThaumcraftCompat {
return new AspectList(item);
}
private static void addAspectsFromRecipes(Item item, int meta) {
ThaumcraftApi.registerObjectTag(new ItemStack(item, 1, meta), ThaumcraftApiHelper.generateTags(item, meta));
}
public static void loadUpgrades(List<IDarkSteelUpgrade> upgrades) {
upgrades.add(GogglesOfRevealingUpgrade.INSTANCE);
}