diff options
Diffstat (limited to 'src/Java/gtPlusPlus')
3 files changed, 166 insertions, 3 deletions
diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java index a46bd8c61d..b61af67566 100644 --- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java @@ -197,6 +197,20 @@ public class MathUtils { } return result; } + + + //Smooth Rounding Function + /** + * Returns a long. + * The returned number is d rounded to the nearest flat long. + * Supports Doubles as input. + * + * @param current Current value. + * @return long Rounded value. + */ + public static long roundToClosestLong(final double d) { + return (long) (Math.round(d * 2) / 2.0); + } /** diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java index b6fdbb4272..c9d0230514 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java @@ -21,7 +21,9 @@ 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 net.minecraft.item.EnumAction; +import net.minecraft.item.ItemStack; public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { public MetaGeneratedGregtechItems INSTANCE; @@ -178,11 +180,50 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { GregtechItemList.Pellet_RTG_SR90.set(this.addItem(42, StringUtils.superscript("90")+"Sr Pellet", "", new Object[]{getTcAspectStack(TC_Aspects.RADIO, 4L), getTcAspectStack(TC_Aspects.POTENTIA, 2L), getTcAspectStack(TC_Aspects.METALLUM, 2L)})); GregtechItemList.Pellet_RTG_PO210.set(this.addItem(43, StringUtils.superscript("210")+"Po Pellet", "", new Object[]{getTcAspectStack(TC_Aspects.RADIO, 4L), getTcAspectStack(TC_Aspects.POTENTIA, 2L), getTcAspectStack(TC_Aspects.METALLUM, 2L)})); GregtechItemList.Pellet_RTG_AM241.set(this.addItem(44, StringUtils.superscript("241")+"Am Pellet", "", new Object[]{getTcAspectStack(TC_Aspects.RADIO, 4L), getTcAspectStack(TC_Aspects.POTENTIA, 2L), getTcAspectStack(TC_Aspects.METALLUM, 2L)})); - + Recipe_GT.Gregtech_Recipe_Map.sRTGFuels.addRecipe( + true, + new ItemStack[]{GregtechItemList.Pellet_RTG_PU238.get(1)}, + new ItemStack[]{}, + null, + null, + null, + 0, + 0, + GregtechMetaTileEntity_RTG_Generator.convertDaysToTicks(87.7f)); + Recipe_GT.Gregtech_Recipe_Map.sRTGFuels.addRecipe( + true, + new ItemStack[]{GregtechItemList.Pellet_RTG_SR90.get(1)}, + new ItemStack[]{}, + null, + null, + null, + 0, + 0, + GregtechMetaTileEntity_RTG_Generator.convertDaysToTicks(28.8f)); + Recipe_GT.Gregtech_Recipe_Map.sRTGFuels.addRecipe( + true, + new ItemStack[]{GregtechItemList.Pellet_RTG_PO210.get(1)}, + new ItemStack[]{}, + null, + null, + null, + 0, + 0, + GregtechMetaTileEntity_RTG_Generator.convertDaysToTicks(0.4f)); + Recipe_GT.Gregtech_Recipe_Map.sRTGFuels.addRecipe( + true, + new ItemStack[]{GregtechItemList.Pellet_RTG_AM241.get(1)}, + new ItemStack[]{}, + null, + null, + null, + 0, + 0, + GregtechMetaTileEntity_RTG_Generator.convertDaysToTicks(432)); //Computer Cube GregtechItemList.Gregtech_Computer_Cube.set(this.addItem(tLastID = 55, "Gregtech Computer Cube", "Reusable", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 8L), getTcAspectStack(TC_Aspects.METALLUM, 8L), getTcAspectStack(TC_Aspects.POTENTIA, 8L)})); this.setElectricStats(32000 + tLastID, Integer.MAX_VALUE, GT_Values.V[5], 5L, -3L, true); - + //FOOOOOOOOOOOOOOD GregtechItemList.Food_Baked_Raisin_Bread.set(this.addItem(tLastID = 60, "Raisin Bread", "Extra Raisins, Just for ImQ009", new Object[]{new GT_FoodStat(5, 0.5F, EnumAction.eat, null, false, true, false, new int[0]), getTcAspectStack(TC_Aspects.CORPUS, 1L), getTcAspectStack(TC_Aspects.FAMES, 1L), getTcAspectStack(TC_Aspects.IGNIS, 1L)})); @@ -285,7 +326,7 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { GregtechItemList.Old_Circuit_Parts_Wiring_Elite.set(this.addItem(218, "Etched Extreme Voltage Wiring", "Part of Circuit Boards", new Object[0])); GregtechItemList.Old_Empty_Board_Basic.set(this.addItem(219, "Empty Circuit Board", "A Board Part", new Object[0])); GregtechItemList.Old_Empty_Board_Elite.set(this.addItem(220, "Empty Processor Board", "A Processor Board Part", new Object[0])); - + return true; } } 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 new file mode 100644 index 0000000000..cf7ad2f8f3 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG_Generator.java @@ -0,0 +1,108 @@ +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 |