aboutsummaryrefslogtreecommitdiff
path: root/src/Java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java')
-rw-r--r--src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java1
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java169
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG_Generator.java108
5 files changed, 174 insertions, 111 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
index 769d3f26e9..18ba3ad097 100644
--- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
+++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
@@ -71,6 +71,7 @@ public class COMPAT_HANDLER {
GregtechIndustrialTreeFarm.run();
GregtechIndustrialSifter.run();
GregtechSimpleWasher.run();
+ GregtechRTG.run();
//New Horizons Content
NewHorizonsAccelerator.run();
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
index ad2406fead..fc081c6f51 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
@@ -191,10 +191,11 @@ public enum GregtechItemList implements GregtechItemContainer {
AcceleratorIV, AcceleratorLuV, AcceleratorZPM, AcceleratorUV,
//GT RTG
+ RTG,
Pellet_RTG_PU238, Pellet_RTG_SR90, Pellet_RTG_PO210, Pellet_RTG_AM241,
//Computer Cube
- Gregtech_Computer_Cube
+ Gregtech_Computer_Cube,
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java
index a372ea217c..f51d7f0efc 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java
@@ -22,7 +22,7 @@ import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials;
import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_X32;
-import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntity_RTG_Generator;
+import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntity_RTG;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
@@ -210,7 +210,7 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 {
null,
0,
512,
- MathUtils.roundToClosestInt(0.4f));
+ MathUtils.roundToClosestInt(0.6f));
Recipe_GT.Gregtech_Recipe_Map.sRTGFuels.addRecipe(
true,
new ItemStack[]{GregtechItemList.Pellet_RTG_AM241.get(1)},
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java
new file mode 100644
index 0000000000..7b7e48864b
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java
@@ -0,0 +1,169 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.Recipe_GT;
+import gregtech.common.GT_Pollution;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.ChunkPosition;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_RTG extends GT_MetaTileEntity_BasicGenerator {
+ public int mEfficiency;
+ private int mDays;
+ private long mTicksToBurnFor;
+
+ //Generates fuel value based on MC days
+ public static int convertDaysToTicks(float days){
+ int value = 0;
+ value = MathUtils.roundToClosestInt(20*86400*days);
+ return value;
+ }
+
+
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if ((aBaseMetaTileEntity.isServerSide()) && (aBaseMetaTileEntity.isAllowedToWork()) && (aTick % 10L == 0L)) {
+ long tProducedEU = 0L;
+ if (this.mFluid == null) {
+ if (aBaseMetaTileEntity.getUniversalEnergyStored() < maxEUOutput() + getMinimumStoredEU()) {
+ this.mInventory[getStackDisplaySlot()] = null;
+ } else {
+ if (this.mInventory[getStackDisplaySlot()] == null)
+ this.mInventory[getStackDisplaySlot()] = GregtechItemList.Pellet_RTG_AM241.get(1);
+ this.mInventory[getStackDisplaySlot()].setStackDisplayName("Generating: "
+ + (aBaseMetaTileEntity.getUniversalEnergyStored() - getMinimumStoredEU()) + " EU");
+ }
+ } else {
+ int tFuelValue = getFuelValue(this.mFluid);
+ int tConsumed = consumedFluidPerOperation(this.mFluid);
+ if ((tFuelValue > 0) && (tConsumed > 0) && (this.mFluid.amount > tConsumed)) {
+ long tFluidAmountToUse = Math.min(this.mFluid.amount / tConsumed,
+ (maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue);
+ if ((tFluidAmountToUse > 0L)
+ && (aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true))) {
+ tProducedEU = tFluidAmountToUse * tFuelValue;
+ FluidStack tmp260_257 = this.mFluid;
+ tmp260_257.amount = (int) (tmp260_257.amount - (tFluidAmountToUse * tConsumed));
+ }
+ }
+ }
+ if ((this.mInventory[getInputSlot()] != null)
+ && (aBaseMetaTileEntity.getUniversalEnergyStored() < maxEUOutput() * 20L + getMinimumStoredEU())
+ && (GT_Utility.getFluidForFilledItem(this.mInventory[getInputSlot()], true) == null)) {
+ int tFuelValue = getFuelValue(this.mInventory[getInputSlot()]);
+ if (tFuelValue > 0) {
+ ItemStack tEmptyContainer = getEmptyContainer(this.mInventory[getInputSlot()]);
+ if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tEmptyContainer)) {
+ aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true);
+ aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1);
+ tProducedEU = tFuelValue;
+ }
+ }
+ }
+ if ((tProducedEU > 0L) && (getPollution() > 0)) {
+ GT_Pollution.addPollution(getBaseMetaTileEntity().getWorld(),
+ new ChunkPosition(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getYCoord(),
+ getBaseMetaTileEntity().getZCoord()),
+ (int) (tProducedEU * getPollution() / 500 * this.mTier + 1L));
+ }
+ }
+
+ if (aBaseMetaTileEntity.isServerSide())
+ aBaseMetaTileEntity.setActive((aBaseMetaTileEntity.isAllowedToWork())
+ && (aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()));
+ }
+
+
+ public GregtechMetaTileEntity_RTG(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, "Requires RTG Pellets", new ITexture[0]);
+ }
+
+ public GregtechMetaTileEntity_RTG(String aName, int aTier, String aDescription,
+ ITexture[][][] aTextures) {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ public boolean isOutputFacing(byte aSide) {
+ return ((aSide > 1) && (aSide != getBaseMetaTileEntity().getFrontFacing())
+ && (aSide != getBaseMetaTileEntity().getBackFacing()));
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_RTG(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipes() {
+ return Recipe_GT.Gregtech_Recipe_Map.sRTGFuels;
+ }
+
+ public int getCapacity() {
+ return 0;
+ }
+
+ public int getEfficiency() {
+ return this.mEfficiency = 100;
+ }
+
+ public ITexture[] getFront(byte aColor) {
+ return new ITexture[] { super.getFront(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_FRONT) };
+ }
+
+ public ITexture[] getBack(byte aColor) {
+ return new ITexture[] { super.getBack(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_BACK) };
+ }
+
+ public ITexture[] getBottom(byte aColor) {
+ return new ITexture[] { super.getBottom(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_BOTTOM) };
+ }
+
+ public ITexture[] getTop(byte aColor) {
+ return new ITexture[] { super.getTop(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP) };
+ }
+
+ public ITexture[] getSides(byte aColor) {
+ return new ITexture[] { super.getSides(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_SIDE) };
+ }
+
+ public ITexture[] getFrontActive(byte aColor) {
+ return new ITexture[] { super.getFrontActive(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_FRONT_ACTIVE) };
+ }
+
+ public ITexture[] getBackActive(byte aColor) {
+ return new ITexture[] { super.getBackActive(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_BACK_ACTIVE) };
+ }
+
+ public ITexture[] getBottomActive(byte aColor) {
+ return new ITexture[] { super.getBottomActive(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_BOTTOM_ACTIVE) };
+ }
+
+ public ITexture[] getTopActive(byte aColor) {
+ return new ITexture[] { super.getTopActive(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE) };
+ }
+
+ public ITexture[] getSidesActive(byte aColor) {
+ return new ITexture[] { super.getSidesActive(aColor)[0],
+ new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_SIDE_ACTIVE) };
+ }
+
+ public int getPollution() {
+ return 0;
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG_Generator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG_Generator.java
deleted file mode 100644
index cf7ad2f8f3..0000000000
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG_Generator.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package gtPlusPlus.xmod.gregtech.common.tileentities.generators;
-
-import gregtech.api.enums.Textures;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.MetaTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator;
-import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.Recipe_GT;
-import gtPlusPlus.core.util.math.MathUtils;
-import net.minecraft.item.ItemStack;
-
-public class GregtechMetaTileEntity_RTG_Generator extends GT_MetaTileEntity_BasicGenerator {
- public int mEfficiency;
-
- //Generates fuel value based on MC days
- public static int convertDaysToTicks(float days){
- int value = 0;
- value = MathUtils.roundToClosestInt(20*86400*days);
- return value;
- }
-
-
- public GregtechMetaTileEntity_RTG_Generator(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, "Requires RTG Pellets", new ITexture[0]);
- }
-
- public GregtechMetaTileEntity_RTG_Generator(String aName, int aTier, String aDescription,
- ITexture[][][] aTextures) {
- super(aName, aTier, aDescription, aTextures);
- }
-
- public boolean isOutputFacing(byte aSide) {
- return ((aSide > 1) && (aSide != getBaseMetaTileEntity().getFrontFacing())
- && (aSide != getBaseMetaTileEntity().getBackFacing()));
- }
-
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GregtechMetaTileEntity_RTG_Generator(this.mName, this.mTier, this.mDescription, this.mTextures);
- }
-
- public GT_Recipe.GT_Recipe_Map getRecipes() {
- return Recipe_GT.Gregtech_Recipe_Map.sRTGFuels;
- }
-
- public int getCapacity() {
- return 0;
- }
-
- public int getEfficiency() {
- return this.mEfficiency = 100;
- }
-
- public ITexture[] getFront(byte aColor) {
- return new ITexture[] { super.getFront(aColor)[0],
- new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_FRONT) };
- }
-
- public ITexture[] getBack(byte aColor) {
- return new ITexture[] { super.getBack(aColor)[0],
- new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_BACK) };
- }
-
- public ITexture[] getBottom(byte aColor) {
- return new ITexture[] { super.getBottom(aColor)[0],
- new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_BOTTOM) };
- }
-
- public ITexture[] getTop(byte aColor) {
- return new ITexture[] { super.getTop(aColor)[0],
- new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP) };
- }
-
- public ITexture[] getSides(byte aColor) {
- return new ITexture[] { super.getSides(aColor)[0],
- new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_SIDE) };
- }
-
- public ITexture[] getFrontActive(byte aColor) {
- return new ITexture[] { super.getFrontActive(aColor)[0],
- new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_FRONT_ACTIVE) };
- }
-
- public ITexture[] getBackActive(byte aColor) {
- return new ITexture[] { super.getBackActive(aColor)[0],
- new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_BACK_ACTIVE) };
- }
-
- public ITexture[] getBottomActive(byte aColor) {
- return new ITexture[] { super.getBottomActive(aColor)[0],
- new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_BOTTOM_ACTIVE) };
- }
-
- public ITexture[] getTopActive(byte aColor) {
- return new ITexture[] { super.getTopActive(aColor)[0],
- new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE) };
- }
-
- public ITexture[] getSidesActive(byte aColor) {
- return new ITexture[] { super.getSidesActive(aColor)[0],
- new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_SIDE_ACTIVE) };
- }
-
- public int getPollution() {
- return 0;
- }
-} \ No newline at end of file