aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/interfaces
diff options
context:
space:
mode:
authorTechnus <daniel112092@gmail.com>2020-04-15 19:01:06 +0200
committerTechnus <daniel112092@gmail.com>2020-04-15 19:09:15 +0200
commit9bef8b3a8a8270db9c289c05c998e71273ca20fc (patch)
treed7fe3a40384a96eca093ada09bc133eef03c53ad /src/main/java/gregtech/api/interfaces
parent9b05c6573762117ab1b60ef195e8be321b6e2bb8 (diff)
downloadGT5-Unofficial-9bef8b3a8a8270db9c289c05c998e71273ca20fc.tar.gz
GT5-Unofficial-9bef8b3a8a8270db9c289c05c998e71273ca20fc.tar.bz2
GT5-Unofficial-9bef8b3a8a8270db9c289c05c998e71273ca20fc.zip
Refactor to fixed thread pool executor
Use actually something made for this task...
Diffstat (limited to 'src/main/java/gregtech/api/interfaces')
-rw-r--r--src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java26
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java21
-rw-r--r--src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java7
3 files changed, 48 insertions, 6 deletions
diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java
index a518b3baaf..f0ca426616 100644
--- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java
+++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java
@@ -5,6 +5,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGearEnergyTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.GT_Config;
import net.minecraft.block.Block;
@@ -31,7 +32,7 @@ import java.util.List;
* <p/>
* Don't implement this yourself and expect it to work. Extend @MetaTileEntity itself.
*/
-public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHandler, IGearEnergyTileEntity {
+public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHandler, IGearEnergyTileEntity, IMachineBlockUpdateable {
/**
* This determines the BaseMetaTileEntity belonging to this MetaTileEntity by using the Meta ID of the Block itself.
* <p/>
@@ -234,11 +235,6 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand
boolean isAccessAllowed(EntityPlayer aPlayer);
/**
- * When a Machine Update occurs
- */
- void onMachineBlockUpdate();
-
- /**
* a Player rightclicks the Machine
* Sneaky rightclicks are not getting passed to this!
*
@@ -408,4 +404,22 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand
String getAlternativeModeText();
boolean shouldJoinIc2Enet();
+
+ /**
+ * The Machine Update, which is called when the Machine needs an Update of its Parts.
+ * I suggest to wait 1-5 seconds before actually checking the Machine Parts.
+ * RP-Frames could for example cause Problems when you instacheck the Machine Parts.
+ *
+ * just do stuff since we are already in meta tile...
+ */
+ @Override
+ void onMachineBlockUpdate();
+
+ /**
+ * just return in should recurse since we are already in meta tile...
+ */
+ @Override
+ default boolean isMachineBlockUpdateRecursive(){
+ return true;
+ }
}
diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java
index af9ead9543..8e135fbc85 100644
--- a/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IGregTechTileEntity.java
@@ -135,4 +135,25 @@ public interface IGregTechTileEntity extends ITexturedTileEntity, IGearEnergyTil
AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ);
void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider);
+
+ /**
+ * Checks validity of meta tile and delegates to it
+ */
+ @Override
+ default void onMachineBlockUpdate(){
+ if(!isDead() && getMetaTileEntity()!=null &&
+ getMetaTileEntity().getBaseMetaTileEntity()==this){
+ getMetaTileEntity().onMachineBlockUpdate();
+ }
+ }
+
+ /**
+ * Checks validity of meta tile and delegates to it
+ */
+ @Override
+ default boolean isMachineBlockUpdateRecursive() {
+ return !isDead() && getMetaTileEntity()!=null &&
+ getMetaTileEntity().getBaseMetaTileEntity()==this &&
+ getMetaTileEntity().isMachineBlockUpdateRecursive();
+ }
} \ No newline at end of file
diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java b/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java
index c7f6fe5f23..31590f3d57 100644
--- a/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java
+++ b/src/main/java/gregtech/api/interfaces/tileentity/IMachineBlockUpdateable.java
@@ -13,4 +13,11 @@ public interface IMachineBlockUpdateable {
* RP-Frames could for example cause Problems when you instacheck the Machine Parts.
*/
void onMachineBlockUpdate();
+
+ /**
+ * Should recurse?
+ */
+ default boolean isMachineBlockUpdateRecursive(){
+ return true;
+ }
}