aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech/common
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2022-01-20 17:17:04 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2022-01-20 17:17:04 +0000
commitbfbd1eb3123fefeb5dc66f29eb3b8ae18af6bb88 (patch)
tree76bf3e2f76be046a1f2a52f23111af73aab3ff91 /src/main/java/gtPlusPlus/xmod/gregtech/common
parent185f91e25a64c3832f8287cf70a3c3a01a1dd90c (diff)
downloadGT5-Unofficial-bfbd1eb3123fefeb5dc66f29eb3b8ae18af6bb88.tar.gz
GT5-Unofficial-bfbd1eb3123fefeb5dc66f29eb3b8ae18af6bb88.tar.bz2
GT5-Unofficial-bfbd1eb3123fefeb5dc66f29eb3b8ae18af6bb88.zip
Fixed Industrial Forge Hammer structure check.
Fixed Creative Energy Buffer some more. Fixed Redstone Circuit Block output. Did a little work on breaker boxes.
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common')
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java8
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java20
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java43
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java48
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java2
6 files changed, 95 insertions, 28 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
index 091ee734e6..fe0be2f126 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
@@ -90,8 +90,8 @@ public class Meta_GT_Proxy {
GT_Log.out.println("GT++ Mod: Testing BaseMetaTileEntity.");
if (tBaseMetaTileEntity == null || tBaseMetaTileEntity2 == null) {
- GT_Log.out.println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft.");
- throw new RuntimeException("");
+ GT_Log.err.println("GT++ Mod: Fatal Error ocurred while initializing custom BaseMetaTileEntities, crashing Minecraft.");
+ CORE.crash("GT++ Mod: Fatal Error ocurred while initializing custom BaseMetaTileEntities, crashing Minecraft.");
}
//Gotta set it here so that we don't try call gregtech too early.
@@ -104,7 +104,7 @@ public class Meta_GT_Proxy {
StaticFields59.mGT6StylePipes = false;
}
- GT_Log.out.println("GT++ Mod: Registering the BaseMetaTileEntity.");
+ GT_Log.out.println("GT++ Mod: Registering custom BaseMetaTileEntities.");
GameRegistry.registerTileEntity(tBaseMetaTileEntity.getClass(), "BaseMetaTileEntity_GTPP");
GameRegistry.registerTileEntity(tBaseMetaTileEntity2.getClass(), "BaseMetaTileEntity_GTPP2");
CoverManager.generateCustomCovers();
@@ -361,6 +361,7 @@ public class Meta_GT_Proxy {
GT_Log.err
.println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft.");
e.printStackTrace(GT_Log.err);
+ CORE.crash("GT++ Mod: Fatal Error ocurred while initializing custom BaseMetaTileEntities, crashing Minecraft.");
throw new RuntimeException(e);
}
}
@@ -396,6 +397,7 @@ public class Meta_GT_Proxy {
GT_Log.err
.println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft.");
e.printStackTrace(GT_Log.err);
+ CORE.crash("GT++ Mod: Fatal Error ocurred while initializing custom BaseMetaTileEntities, crashing Minecraft.");
throw new RuntimeException(e);
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java
index 2e4e1ce7dd..087da7465d 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java
@@ -11,6 +11,7 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.math.MathUtils;
@@ -25,6 +26,7 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@@ -59,13 +61,13 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer {
CustomIcon h = TexturesGtBlock.Casing_Material_RedSteel;
CustomIcon g = TexturesGtBlock.Casing_Material_Grisium;
CustomIcon k;
- boolean j = MathUtils.isNumberEven(this.mTier);
+ boolean j = MathUtils.isNumberEven(this.mVoltageTier);
final ITexture[][][] rTextures = new ITexture[2][17][];
k = j ? g : h;
for (byte i = -1; i < 16; i++) {
rTextures[0][i + 1] = new ITexture[]{new GT_RenderedTexture(k)};
rTextures[1][i
- + 1] = new ITexture[]{new GT_RenderedTexture(k), this.mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]};
+ + 1] = new ITexture[]{new GT_RenderedTexture(k), this.mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mVoltageTier] : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mVoltageTier]};
}
return rTextures;
}
@@ -76,6 +78,16 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer {
}
@Override
+ protected void showEnergy(final World worldIn, final EntityPlayer playerIn){
+ final long tempStorage = this.getBaseMetaTileEntity().getStoredEU();
+ final double c = ((double) tempStorage / this.maxEUStore()) * 100;
+ final double roundOff = Math.round(c * 100.00) / 100.00;
+ PlayerUtils.messagePlayer(playerIn, "Energy: " + GT_Utility.formatNumbers(tempStorage) + " EU at "+V[this.mVoltageTier]+"v ("+roundOff+"%)");
+ PlayerUtils.messagePlayer(playerIn, "Amperage: " + GT_Utility.formatNumbers(maxAmperesOut())+"A");
+
+ }
+
+ @Override
public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
return new GregtechMetaCreativeEnergyBuffer(this.mName, this.mTier, this.mDescription, this.mTextures, this.mInventory.length);
}
@@ -153,7 +165,7 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer {
@Override
public String[] getInfoData() {
String[] infoData = super.getInfoData();
- return new String[]{infoData[0], "THIS IS A CREATIVE ITEM - FOR TESTING | Tier: " + this.mTier, infoData[1], infoData[2]};
+ return new String[]{infoData[0], "THIS IS A CREATIVE ITEM - FOR TESTING | Tier: " + this.mVoltageTier, infoData[1], infoData[2]};
}
@Override
@@ -214,7 +226,7 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer {
t.printStackTrace();
Logger.REFLECTION("Bad mTextures setter.");
}
- PlayerUtils.messagePlayer(aPlayer, "Now running at " + GT_Values.VOLTAGE_NAMES[this.mTier] + ".");
+ PlayerUtils.messagePlayer(aPlayer, "Now running at " + GT_Values.VOLTAGE_NAMES[this.mVoltageTier] + ".");
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java
index b354d55a83..2b0345af78 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java
@@ -3,7 +3,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
-import java.util.ArrayList;
+import java.util.*;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
@@ -44,6 +44,7 @@ public class GregtechMetaTileEntity_IndustrialForgeHammer extends GregtechMeta_M
@Override
public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ setAnvilBlocks();
return new GregtechMetaTileEntity_IndustrialForgeHammer(this.mName);
}
@@ -85,7 +86,19 @@ public class GregtechMetaTileEntity_IndustrialForgeHammer extends GregtechMeta_M
@Override
public IStructureDefinition<GregtechMetaTileEntity_IndustrialForgeHammer> getStructureDefinition() {
- if (STRUCTURE_DEFINITION == null) {
+ if (STRUCTURE_DEFINITION == null) {
+ Map<Block, Integer> aBlockMap = new HashMap<Block, Integer>();
+ aBlockMap.put(sAnvil, 0);
+ if (LoadedMods.Railcraft) {
+ aBlockMap.put(sSteelAnvil, 0);
+ }
+ if (LoadedMods.EnderIO) {
+ aBlockMap.put(sDarkSteelAnvil, 0);
+ }
+ if (LoadedMods.ThaumicBases) {
+ aBlockMap.put(sThaumiumAnvil, 0);
+ aBlockMap.put(sVoidAnvil, 0);
+ }
STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialForgeHammer>builder()
.addShape(mName, transpose(new String[][]{
{"CCC", "CCC", "CCC"},
@@ -93,21 +106,12 @@ public class GregtechMetaTileEntity_IndustrialForgeHammer extends GregtechMeta_M
{"CCC", "CCC", "CCC"},
}))
.addElement('C', ofChain(
- ofHatchAdder(GregtechMetaTileEntity_IndustrialForgeHammer::addIndustrialForgeHammerList, TAE.getIndexFromPage(1, 11), 1 ),
- onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings5Misc, 6)
- )
+ ofHatchAdder(GregtechMetaTileEntity_IndustrialForgeHammer::addIndustrialForgeHammerList, TAE.getIndexFromPage(1, 11), 1 ),
+ onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings5Misc, 6)
)
)
- .addElement('A', ofChain(
- onElementPass(x -> ++x.mAnvil, ofBlock(sAnvil, 1)),
- onElementPass(x -> ++x.mAnvil, ofBlock(sSteelAnvil, 1)),
- onElementPass(x -> ++x.mAnvil, ofBlock(sDarkSteelAnvil, 1)),
- onElementPass(x -> ++x.mAnvil, ofBlock(sThaumiumAnvil, 1)),
- onElementPass(x -> ++x.mAnvil, ofBlock(sVoidAnvil, 1))
)
- )
- //.addElement('A', ofBlockAdder(GregtechMetaTileEntity_IndustrialForgeHammer::isBlockAnvil, Blocks.anvil, 1))
-
+ .addElement('A', onElementPass(x -> ++x.mAnvil, ofBlocksFlat(aBlockMap, sAnvil, 0)))
.build();
}
return STRUCTURE_DEFINITION;
@@ -115,11 +119,13 @@ public class GregtechMetaTileEntity_IndustrialForgeHammer extends GregtechMeta_M
@Override
public void construct(ItemStack stackSize, boolean hintsOnly) {
+ setAnvilBlocks();
buildPiece(mName , stackSize, hintsOnly, 1, 1, 0);
}
@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ setAnvilBlocks();
mCasing = 0;
return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch();
}
@@ -137,7 +143,8 @@ public class GregtechMetaTileEntity_IndustrialForgeHammer extends GregtechMeta_M
return addToMachineList(aTileEntity, aBaseCasingIndex);
} else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
- } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ }
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
return addToMachineList(aTileEntity, aBaseCasingIndex);
}
}
@@ -303,4 +310,10 @@ public class GregtechMetaTileEntity_IndustrialForgeHammer extends GregtechMeta_M
return 0;
}
+ @Override
+ public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
+ setAnvilBlocks();
+ super.onFirstTick(aBaseMetaTileEntity);
+ }
+
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java
index e15b0b6426..9bb2443683 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java
@@ -88,7 +88,7 @@ public abstract class GT_MetaTileEntity_RedstoneBase extends GT_MetaTileEntity_T
mOpenerCount--;
}
- public final boolean hasRedstoneSignal() {
+ public boolean hasRedstoneSignal() {
if (getBaseMetaTileEntity().getStrongestRedstone() > 0) {
return true;
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java
index 180091b2eb..379345ec6a 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java
@@ -4,6 +4,8 @@ import java.util.*;
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures;
+import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.interfaces.IRedstoneCircuitBlock;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.ICoverable;
@@ -67,7 +69,7 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re
@Override
public boolean isInputFacing(byte aSide) {
- return true;
+ return !this.isOutputFacing(aSide);
}
@Override
@@ -87,7 +89,7 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re
@Override
public boolean isOutputFacing(byte aSide) {
- return true;
+ return aSide == this.getOutputFacing();
}
@Override
@@ -286,6 +288,36 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re
}
}
}
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ //Only Calc server-side
+ if (!this.getBaseMetaTileEntity().isServerSide()) {
+ return;
+ }
+ //Emit Redstone
+ for (byte i=0;i<6;i++) {
+ byte aRedstone = getBaseMetaTileEntity().getOutputRedstoneSignal(i);
+ this.getBaseMetaTileEntity().setInternalOutputRedstoneSignal(i, aRedstone);
+ }
+
+ }
+
+ @Override
+ public final boolean hasRedstoneSignal() {
+ for (byte i=0;i<6;i++) {
+ if (getBaseMetaTileEntity().getOutputRedstoneSignal(i) > 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean allowGeneralRedstoneOutput() {
+ return true;
+ }
/** The Item List for Covers */
public static final Map<Integer, ItemStack> sCoversItems = new HashMap<Integer, ItemStack>();
@@ -408,12 +440,12 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re
final ITexture[][][] rTextures = new ITexture[10][17][];
for (byte i = -1; i < 16; i++) {
rTextures[0][i + 1] = this.getSides(i);
- rTextures[1][i + 1] = this.getSides(i);
+ rTextures[1][i + 1] = this.getBack(i);
rTextures[2][i + 1] = this.getBottom(i);
rTextures[3][i + 1] = this.getTop(i);
rTextures[4][i + 1] = this.getSides(i);
rTextures[5][i + 1] = this.getSidesActive(i);
- rTextures[6][i + 1] = this.getSidesActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
rTextures[7][i + 1] = this.getBottomActive(i);
rTextures[8][i + 1] = this.getTopActive(i);
rTextures[9][i + 1] = this.getSidesActive(i);
@@ -438,6 +470,14 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re
public ITexture[] getTopActive(final byte aColor) {
return new ITexture[]{getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Top_On)};
}
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[] {getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Side_Off), new GT_RenderedTexture(TexturesGtBlock.Casing_InventoryManagaer_Red)};
+ }
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[] {getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Side_On), new GT_RenderedTexture(TexturesGtBlock.Casing_InventoryManagaer_Red_Redstone)};
+ }
public ITexture[] getBottom(final byte aColor) {
return new ITexture[]{getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Bottom_Off)};
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java
index 5c7cfed334..e18f5d4bfc 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java
@@ -250,7 +250,7 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity {
return true;
}
- private void showEnergy(final World worldIn, final EntityPlayer playerIn){
+ protected void showEnergy(final World worldIn, final EntityPlayer playerIn){
final long tempStorage = this.getBaseMetaTileEntity().getStoredEU();
final double c = ((double) tempStorage / this.maxEUStore()) * 100;
final double roundOff = Math.round(c * 100.00) / 100.00;