aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r--src/main/java/gregtech/api/GregTech_API.java6
-rw-r--r--src/main/java/gregtech/api/enums/ItemList.java9
-rw-r--r--src/main/java/gregtech/api/enums/Textures.java10
-rw-r--r--src/main/java/gregtech/api/gui/GT_GUIScreen.java2
-rw-r--r--src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java6
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java2
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java2
-rw-r--r--src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java19
-rw-r--r--src/main/java/gregtech/api/multitileentity/base/BaseMultiTileEntity.java2
-rw-r--r--src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java28
-rw-r--r--src/main/java/gregtech/api/util/GT_Utility.java24
11 files changed, 108 insertions, 2 deletions
diff --git a/src/main/java/gregtech/api/GregTech_API.java b/src/main/java/gregtech/api/GregTech_API.java
index 7a52021eea..9b039409dc 100644
--- a/src/main/java/gregtech/api/GregTech_API.java
+++ b/src/main/java/gregtech/api/GregTech_API.java
@@ -173,6 +173,12 @@ public class GregTech_API {
*/
public static final Map<Integer, Byte> sWirelessRedstone = new ConcurrentHashMap<>();
/**
+ * The Advanced Redstone Frequencies
+ */
+ public static final Map<String, Map<Integer, Map<Long, Byte>>> sAdvancedWirelessRedstone =
+ new ConcurrentHashMap<>();
+
+ /**
* The IDSU Frequencies
*/
public static final Map<Integer, Integer> sIDSUList = new ConcurrentHashMap<>();
diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java
index 279233d101..a6d93af7a3 100644
--- a/src/main/java/gregtech/api/enums/ItemList.java
+++ b/src/main/java/gregtech/api/enums/ItemList.java
@@ -1529,6 +1529,15 @@ public enum ItemList implements IItemContainer {
Hatch_Output_Bus_ME,
NULL,
+ Cover_AdvancedRedstoneTransmitterExternal,
+ Cover_AdvancedRedstoneTransmitterInternal,
+ Cover_AdvancedRedstoneReceiverExternal,
+ Cover_AdvancedRedstoneReceiverInternal,
+
+ Cover_WirelessFluidDetector,
+ Cover_WirelessItemDetector,
+ Cover_WirelessNeedsMaintainance,
+
Cover_RedstoneTransmitterExternal,
Cover_RedstoneTransmitterInternal,
Cover_RedstoneReceiverExternal,
diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java
index ee335c749e..77e28482ce 100644
--- a/src/main/java/gregtech/api/enums/Textures.java
+++ b/src/main/java/gregtech/api/enums/Textures.java
@@ -491,6 +491,16 @@ public class Textures {
OVERLAY_FLUIDDETECTOR,
OVERLAY_ITEMDETECTOR,
+ OVERLAY_REDSTONE_TRANSMITTER,
+ OVERLAY_REDSTONE_RECEIVER,
+ OVERLAY_MAINTENANCE_DETECTOR,
+
+ OVERLAY_ADVANCED_REDSTONE_TRANSMITTER,
+ OVERLAY_ADVANCED_REDSTONE_RECEIVER,
+ OVERLAY_WIRELESS_ITEM_DETECTOR,
+ OVERLAY_WIRELESS_FLUID_DETECTOR,
+ OVERLAY_WIRELESS_MAINTENANCE_DETECTOR,
+
OVERLAY_FLUID_STORAGE_MONITOR0,
OVERLAY_FLUID_STORAGE_MONITOR1,
OVERLAY_FLUID_STORAGE_MONITOR2,
diff --git a/src/main/java/gregtech/api/gui/GT_GUIScreen.java b/src/main/java/gregtech/api/gui/GT_GUIScreen.java
index 281be1e55d..d39a6b738e 100644
--- a/src/main/java/gregtech/api/gui/GT_GUIScreen.java
+++ b/src/main/java/gregtech/api/gui/GT_GUIScreen.java
@@ -28,8 +28,8 @@ public abstract class GT_GUIScreen extends GuiScreen implements GT_IToolTipRende
protected int gui_height = 107;
protected int guiTop, guiLeft;
protected boolean drawButtons = true;
+ protected ResourceLocation mGUIbackgroundLocation;
- private ResourceLocation mGUIbackgroundLocation;
private GuiButton selectedButton;
private GT_GUIColorOverride colorOverride;
private final int textColor;
diff --git a/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java b/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java
index 37e1a6d960..43fbe0711c 100644
--- a/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java
+++ b/src/main/java/gregtech/api/gui/widgets/GT_GuiIcon.java
@@ -30,6 +30,12 @@ public enum GT_GuiIcon implements IGuiIcon {
GREEN_ARROW_DOWN(0, 32 * 5, 32 * 2),
CYCLIC(0, 32 * 6, 32 * 2),
+ AND_GATE(0, 0, 32 * 3),
+ NAND_GATE(0, 32, 32 * 3),
+ OR_GATE(0, 32 * 2, 32 * 3),
+ NOR_GATE(0, 32 * 3, 32 * 3),
+ ANALOG_MODE(0, 32 * 4, 32 * 3),
+
SLOT_DARKGRAY(1, 176, 0, 18, 18),
SLOT_GRAY(1, 176, 18, 18, 18),
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
index 0fdaa90c1a..7c75bb97d4 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
@@ -776,6 +776,8 @@ public class BaseMetaPipeEntity extends CommonMetaTileEntity
if (hasCover) tNBT.setIntArray("mCoverSides", mCoverSides);
if (hasValidMetaTileEntity()) mMetaTileEntity.setItemNBT(tNBT);
if (!tNBT.hasNoTags()) rStack.setTagCompound(tNBT);
+
+ onBaseTEDestroyed();
return new ArrayList<>(Collections.singletonList(rStack));
}
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
index cdc81220e6..08ead9a946 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
@@ -1423,6 +1423,8 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity
if (hasValidMetaTileEntity()) mMetaTileEntity.setItemNBT(tNBT);
if (!tNBT.hasNoTags()) rStack.setTagCompound(tNBT);
+
+ onBaseTEDestroyed();
return new ArrayList<>(Collections.singletonList(rStack));
}
diff --git a/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java b/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java
index caf3c1b15f..9df38b2725 100644
--- a/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/CoverableTileEntity.java
@@ -320,6 +320,14 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
return false;
}
+ protected void onBaseTEDestroyed() {
+ for (byte side = 0; side < 6; ++side) {
+ GT_CoverBehaviorBase<?> behavior = getCoverBehaviorAtSideNew(side);
+ if (behavior != GregTech_API.sNoBehavior)
+ behavior.onBaseTEDestroyed(side, getCoverIDAtSide(side), mCoverData[side], this);
+ }
+ }
+
@Override
public void setOutputRedstoneSignal(byte aSide, byte aStrength) {
aStrength = (byte) Math.min(Math.max(0, aStrength), 15);
@@ -414,10 +422,19 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
public void receiveCoverData(
byte aCoverSide, int aCoverID, ISerializableObject aCoverData, EntityPlayerMP aPlayer) {
if ((aCoverSide >= 0 && aCoverSide < 6)) {
+ GT_CoverBehaviorBase<?> behaviorBase = getCoverBehaviorAtSideNew(aCoverSide);
+ behaviorBase.preDataChanged(
+ aCoverSide,
+ getCoverIDAtSide(aCoverSide),
+ aCoverID,
+ getComplexCoverDataAtSide(aCoverSide),
+ aCoverData,
+ this);
+
setCoverIDAtSideNoUpdate(aCoverSide, aCoverID);
setCoverDataAtSide(aCoverSide, aCoverData);
if (isClientSide()) {
- getCoverBehaviorAtSideNew(aCoverSide).onDataChanged(aCoverSide, aCoverID, aCoverData, this);
+ behaviorBase.onDataChanged(aCoverSide, aCoverID, aCoverData, this);
}
}
}
diff --git a/src/main/java/gregtech/api/multitileentity/base/BaseMultiTileEntity.java b/src/main/java/gregtech/api/multitileentity/base/BaseMultiTileEntity.java
index 18dc310bb7..385ae310f1 100644
--- a/src/main/java/gregtech/api/multitileentity/base/BaseMultiTileEntity.java
+++ b/src/main/java/gregtech/api/multitileentity/base/BaseMultiTileEntity.java
@@ -906,6 +906,8 @@ public abstract class BaseMultiTileEntity extends CoverableTileEntity
final ArrayList<ItemStack> rList = new ArrayList<>();
final MultiTileEntityRegistry tRegistry = MultiTileEntityRegistry.getRegistry(getMultiTileEntityRegistryID());
if (tRegistry != null) rList.add(tRegistry.getItem(getMultiTileEntityID(), writeItemNBT(new NBTTagCompound())));
+
+ onBaseTEDestroyed();
return rList;
}
diff --git a/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java b/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
index efbff79957..1092a24307 100644
--- a/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
+++ b/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
@@ -131,6 +131,20 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> {
}
/**
+ * Called before receiving data from network. Use {@link ICoverable#isClientSide()} to determine the side.
+ */
+ public final void preDataChanged(
+ byte aSide,
+ int aCoverID,
+ int aNewCoverId,
+ ISerializableObject aCoverVariable,
+ ISerializableObject aNewCoverVariable,
+ ICoverable aTileEntity) {
+ preDataChangedImpl(
+ aSide, aCoverID, aNewCoverId, forceCast(aCoverVariable), forceCast(aNewCoverVariable), aTileEntity);
+ }
+
+ /**
* Called upon cover being removed. Called on both server and client.
*/
public final void onDropped(byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) {
@@ -222,6 +236,15 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> {
}
/**
+ * Called upon Base TE being destroyed (once getDrops is called),
+ * thus getting called only when destroyed in survival.
+ */
+ public final void onBaseTEDestroyed(
+ byte aSide, int aCoverID, ISerializableObject aCoverVariable, ICoverable aTileEntity) {
+ onBaseTEDestroyedImpl(aSide, aCoverID, forceCast(aCoverVariable), aTileEntity);
+ }
+
+ /**
* Gives a small Text for the status of the Cover.
*/
public final String getDescription(
@@ -410,8 +433,13 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> {
protected void onDataChangedImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {}
+ protected void preDataChangedImpl(
+ byte aSide, int aCoverID, int aNewCoverId, T aCoverVariable, T aNewCoverVariable, ICoverable aTileEntity) {}
+
protected void onDroppedImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {}
+ protected void onBaseTEDestroyedImpl(byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity) {}
+
protected boolean isRedstoneSensitiveImpl(
byte aSide, int aCoverID, T aCoverVariable, ICoverable aTileEntity, long aTimer) {
return true;
diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java
index 270619363f..c9aa55d291 100644
--- a/src/main/java/gregtech/api/util/GT_Utility.java
+++ b/src/main/java/gregtech/api/util/GT_Utility.java
@@ -4276,6 +4276,30 @@ public class GT_Utility {
for (int i = 0; i < 25; i++) if (itemStack.isItemEqual(GT_Utility.getIntegratedCircuit(i))) return true;
return false;
}
+public static byte convertRatioToRedstone(long used, long max, int threshold, boolean inverted) {
+ byte signal;
+ if (used <= 0) { // Empty
+ signal = 0;
+ } else if (used >= max) { // Full
+ signal = 15;
+ } else { // Range 1-14
+ signal = (byte) (1 + (14 * used) / max);
+ }
+
+ if (inverted) {
+ signal = (byte) (15 - signal);
+ }
+
+ if (threshold > 0) {
+ if (inverted && used >= threshold) {
+ return 0;
+ } else if (!inverted && used < threshold) {
+ return 0;
+ }
+ }
+
+ return signal;
+ }
@AutoValue
public abstract static class ItemId {