diff options
Diffstat (limited to 'src/main/java')
7 files changed, 249 insertions, 123 deletions
diff --git a/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java b/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java index 8c4324d70d..355f082a02 100644 --- a/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java +++ b/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java @@ -35,7 +35,6 @@ public class EyeOfHarmonyRecipe { @Override public boolean equals(ItemStack item1, ItemStack item2) { - // todo investigate isItemEqual instead. return item1.getUnlocalizedName().equals(item2.getUnlocalizedName()); } }; diff --git a/src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java b/src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java index 6676b920f3..38bf4e1530 100644 --- a/src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java +++ b/src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java @@ -20,10 +20,12 @@ public class RenderEyeOfHarmony extends TileEntitySpecialRenderer { private static final ResourceLocation starLayer0 = new ResourceLocation(MODID, "models/StarLayer0.png"); private static final ResourceLocation starLayer1 = new ResourceLocation(MODID, "models/StarLayer1.png"); private static final ResourceLocation starLayer2 = new ResourceLocation(MODID, "models/StarLayer2.png"); - public static IModelCustom modelCustom; + private static IModelCustom starModel; + private static IModelCustom spaceModel; public RenderEyeOfHarmony() { - modelCustom = AdvancedModelLoader.loadModel(new ResourceLocation(MODID, "models/Star.obj")); + starModel = AdvancedModelLoader.loadModel(new ResourceLocation(MODID, "models/Star.obj")); + spaceModel = AdvancedModelLoader.loadModel(new ResourceLocation(MODID, "models/Space.obj")); } @Override @@ -32,29 +34,84 @@ public class RenderEyeOfHarmony extends TileEntitySpecialRenderer { TileEyeOfHarmony EOHRenderTile = (TileEyeOfHarmony) tile; + // Render outer space layer. + { GL11.glPushMatrix(); GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); + renderOuterSpaceShell(); - if (EOHRenderTile.getOrbitingBody() != null) { - // Render orbiting body. - GL11.glPushMatrix(); - GL11.glRotatef((0.1f * EOHRenderTile.angle) % 360.0f, 0F, 1F, 0F); - GL11.glTranslated(-1 - EOHRenderTile.getSize() * pow(1.05f, 2), 0, 0); - GL11.glRotatef((0.1f * EOHRenderTile.angle) % 360.0f, 0F, 1F, 0F); - renderBlockInWorld(EOHRenderTile.getOrbitingBody(), 0, 0.7f); - GL11.glPopMatrix(); - } + renderOrbitObjects(EOHRenderTile); // Render star stuff. renderStarLayer(EOHRenderTile, 0, starLayer0, 1.0f); renderStarLayer(EOHRenderTile, 1, starLayer1, 0.4f); renderStarLayer(EOHRenderTile, 2, starLayer2, 0.2f); + GL11.glPopMatrix(); } } - void renderStarLayer(TileEyeOfHarmony EOHRenderTile, int layer, ResourceLocation texture, float alpha) { + private void renderOrbitObjects(final TileEyeOfHarmony EOHRenderTile) { + + if (EOHRenderTile.getOrbitingObjects() != null) { + + if (EOHRenderTile.getOrbitingObjects().size() == 0) { + EOHRenderTile.generateImportantInfo(); + } + + for (TileEyeOfHarmony.OrbitingObject t : EOHRenderTile.getOrbitingObjects()) { + renderOrbit(EOHRenderTile, t); + } + } + } + + void renderOrbit(final TileEyeOfHarmony EOHRenderTile, final TileEyeOfHarmony.OrbitingObject orbitingObject) { + // Render orbiting body. + GL11.glPushMatrix(); + GL11.glRotatef(orbitingObject.zAngle, 0, 0, 1); + GL11.glRotatef(orbitingObject.xAngle, 1, 0, 0); + GL11.glRotatef((orbitingObject.rotationSpeed * 0.1f * EOHRenderTile.angle) % 360.0f, 0F, 1F, 0F); + GL11.glTranslated(- 0.2 - orbitingObject.distance - starRescale * EOHRenderTile.getSize(), 0,0); + GL11.glRotatef((orbitingObject.orbitSpeed * 0.1f * EOHRenderTile.angle) % 360.0f, 0F, 1F, 0F); + renderBlockInWorld(orbitingObject.block, 0, orbitingObject.scale); + GL11.glPopMatrix(); + } + + private static void renderOuterSpaceShell() { + + // Begin animation. + GL11.glPushMatrix(); + + // OpenGL settings, not sure exactly what these do. + + // Disables lighting, so star is always lit (I think). + GL11.glDisable(GL11.GL_LIGHTING); + // Merges colours of the various layers of the star? + GL11.glEnable(GL11.GL_BLEND); + + // Bind animation to layer of star. + FMLClientHandler.instance().getClient().getTextureManager().bindTexture(new ResourceLocation(MODID, "models/spaceLayer.png")); + + final float scale = 0.01f*17.5f; + // Scale the star up in the x, y and z directions. + GL11.glScalef(scale, scale, scale); + + GL11.glColor4f(1, 1, 1, 1); + + spaceModel.renderAll(); + GL11.glDisable(GL11.GL_BLEND); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_LIGHTING); + + // Finish animation. + GL11.glPopMatrix(); + } + + + private static final float starRescale = 0.2f; + + private void renderStarLayer(TileEyeOfHarmony EOHRenderTile, int layer, ResourceLocation texture, float alpha) { // Begin animation. GL11.glPushMatrix(); @@ -75,17 +132,17 @@ public class RenderEyeOfHarmony extends TileEntitySpecialRenderer { // 0.01f magic number to shrink sphere obj down. // Size obtained from the multis current recipe. - float scale = 0.01f * EOHRenderTile.getSize(); + float scale = 0.01f * starRescale * EOHRenderTile.getSize(); // Put each subsequent layer further out. - scale *= pow(1.05f, layer); + scale *= pow(1.04f, layer); // Scale the star up in the x, y and z directions. GL11.glScalef(scale, scale, scale); switch (layer) { case 0: - GL11.glRotatef(194, 0F, 1F, 1F); + GL11.glRotatef(130, 0F, 1F, 1F); break; case 1: GL11.glRotatef(-49, 1F, 1F, 0F); @@ -101,7 +158,7 @@ public class RenderEyeOfHarmony extends TileEntitySpecialRenderer { // Spin the star around according to the multi time dilation tier. GL11.glRotatef((0.03f * EOHRenderTile.angle * EOHRenderTile.getRotationSpeed()) % 360.0f, 0F, 0F, 1F); - modelCustom.renderAll(); + starModel.renderAll(); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_LIGHTING); @@ -110,7 +167,7 @@ public class RenderEyeOfHarmony extends TileEntitySpecialRenderer { GL11.glPopMatrix(); } - public void renderBlockInWorld(Block block, int meta, float blockSize) { + private void renderBlockInWorld(Block block, int meta, float blockSize) { Tessellator tes = Tessellator.instance; this.bindTexture(TextureMap.locationBlocksTexture); diff --git a/src/main/java/com/github/technus/tectech/thing/block/TileEyeOfHarmony.java b/src/main/java/com/github/technus/tectech/thing/block/TileEyeOfHarmony.java index 31dfc9f170..9ffdd45486 100644 --- a/src/main/java/com/github/technus/tectech/thing/block/TileEyeOfHarmony.java +++ b/src/main/java/com/github/technus/tectech/thing/block/TileEyeOfHarmony.java @@ -7,6 +7,12 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import pers.gwyog.gtneioreplugin.plugin.block.ModBlocks; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Random; +import java.util.stream.IntStream; public class TileEyeOfHarmony extends TileEntity { @@ -27,16 +33,24 @@ public class TileEyeOfHarmony extends TileEntity { private float size = 1; private float rotationSpeed = 0; - public Block getOrbitingBody() { - return orbitingBody; + // Fun fact, these methods were entirely written by ChatGPT3... Take that as you will. + public static <T> ArrayList<T> selectNRandomElements(Collection<T> inputList, long n) { + ArrayList<T> randomElements = new ArrayList<>((int) n); + ArrayList<T> inputArray = new ArrayList<>(inputList); + Random rand = new Random(); + IntStream.range(0, (int) n).forEach(i -> { + int randomIndex = rand.nextInt(inputArray.size()); + randomElements.add(inputArray.get(randomIndex)); + inputArray.remove(randomIndex); + }); + return randomElements; } - public void setOrbitingBody(Block orbitingBody) { - this.orbitingBody = orbitingBody; + public static float generateRandomFloat(float a, float b) { + Random rand = new Random(); + return rand.nextFloat() * (b - a) + a; } - private Block orbitingBody; - public long getTier() { return tier; } @@ -68,15 +82,56 @@ public class TileEyeOfHarmony extends TileEntity { angle += 10.0f; } - public float angle; + public static class OrbitingObject { + public OrbitingObject(Block block, float distance, float rotationSpeed, float orbitSpeed, float xAngle, float zAngle, float scale) { + this.block = block; + this.distance = distance; + this.rotationSpeed = rotationSpeed; + this.orbitSpeed = orbitSpeed; + this.xAngle = xAngle; + this.zAngle = zAngle; + this.scale = scale; + } + + public final Block block; + public final float distance; + public final float rotationSpeed; + public final float orbitSpeed; + public final float xAngle; + public final float zAngle; + public final float scale; + } + + public ArrayList<OrbitingObject> getOrbitingObjects() { + return orbitingObjects; + } + + private final ArrayList<OrbitingObject> orbitingObjects = new ArrayList<>(); + + private final static float maxAngle = 30; + + // This must be set last. + public void generateImportantInfo() { + int index = 0; + for (Block block : selectNRandomElements(ModBlocks.blocks.values(), tier+1)) { + + float xAngle = generateRandomFloat(-maxAngle, maxAngle); + float zAngle = generateRandomFloat(-maxAngle ,maxAngle); + index += 1.0; + float distance = index + generateRandomFloat(-0.2f, 0.2f); + float scale = generateRandomFloat(0.2f, 0.9f); + float rotationSpeed = generateRandomFloat(0.5f, 1.5f); + float orbitSpeed = generateRandomFloat(0.5f, 1.5f); + orbitingObjects.add(new OrbitingObject(block, distance, rotationSpeed, orbitSpeed, xAngle, zAngle, scale)); + } + + } + + public float angle; private static final String EOHNBTTag = "EOH:"; private static final String rotationSpeedNBTTag = EOHNBTTag + "rotationSpeed"; private static final String sizeNBTTag = EOHNBTTag + "size"; - private static final String sizeRedNBTTag = EOHNBTTag + "red"; - private static final String sizeGreenNBTTag = EOHNBTTag + "green"; - private static final String sizeBlueNBTTag = EOHNBTTag + "blue"; - private static final String orbitingBodyIDNBTTag = EOHNBTTag + "orbitingBodyID"; private static final String tierNBTTag = EOHNBTTag + "tier"; @Override @@ -87,11 +142,6 @@ public class TileEyeOfHarmony extends TileEntity { compound.setFloat(rotationSpeedNBTTag, rotationSpeed); compound.setFloat(sizeNBTTag, size); compound.setLong(tierNBTTag, tier); - - if (orbitingBody != null) { - int blockID = Block.getIdFromBlock(orbitingBody); - compound.setInteger(orbitingBodyIDNBTTag, blockID); - } } @Override @@ -102,11 +152,6 @@ public class TileEyeOfHarmony extends TileEntity { rotationSpeed = compound.getFloat(rotationSpeedNBTTag); size = compound.getFloat(sizeNBTTag); tier = compound.getLong(tierNBTTag); - - if (compound.hasKey(orbitingBodyIDNBTTag)) { - int blockID = compound.getInteger(orbitingBodyIDNBTTag); - orbitingBody = Block.getBlockById(blockID); - } } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/casing/SpacetimeCompressionFieldCasing.java b/src/main/java/com/github/technus/tectech/thing/casing/SpacetimeCompressionFieldCasing.java index f95c382790..ad877b340b 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/SpacetimeCompressionFieldCasing.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/SpacetimeCompressionFieldCasing.java @@ -2,6 +2,7 @@ package com.github.technus.tectech.thing.casing; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.util.CommonValues.EOH_TIER_FANCY_NAMES; +import static net.minecraft.util.EnumChatFormatting.GRAY; import static net.minecraft.util.EnumChatFormatting.RESET; import com.github.technus.tectech.thing.CustomItemList; @@ -23,6 +24,14 @@ import net.minecraft.world.IBlockAccess; @SuppressWarnings("SpellCheckingInspection") public class SpacetimeCompressionFieldCasing extends GT_Block_Casings_Abstract { private static IIcon textureTier0; + private static IIcon textureTier1; + private static IIcon textureTier2; + private static IIcon textureTier3; + private static IIcon textureTier4; + private static IIcon textureTier5; + private static IIcon textureTier6; + private static IIcon textureTier7; + private static IIcon textureTier8; private static final int maxBlockTier = 9; private static final byte START_INDEX = 16; @@ -40,7 +49,7 @@ public class SpacetimeCompressionFieldCasing extends GT_Block_Casings_Abstract { for (int i = 0; i < maxBlockTier; i++) { GT_LanguageManager.addStringLocalization( getUnlocalizedName() + "." + i + ".name", - EOH_TIER_FANCY_NAMES[i] + RESET + " Spacetime Compression Field Generator"); + GRAY + EOH_TIER_FANCY_NAMES[i] + RESET + " Spacetime Compression Field Generator"); } CustomItemList.SpacetimeCompressionFieldGeneratorTier0.set(new ItemStack(this, 1, 0)); @@ -56,7 +65,15 @@ public class SpacetimeCompressionFieldCasing extends GT_Block_Casings_Abstract { @Override public void registerBlockIcons(IIconRegister aIconRegister) { - textureTier0 = aIconRegister.registerIcon("gregtech:iconsets/EM_DIM"); + textureTier0 = aIconRegister.registerIcon("gregtech:iconsets/EM_DIM_0"); + textureTier1 = aIconRegister.registerIcon("gregtech:iconsets/EM_DIM_1"); + textureTier2 = aIconRegister.registerIcon("gregtech:iconsets/EM_DIM_2"); + textureTier3 = aIconRegister.registerIcon("gregtech:iconsets/EM_DIM_3"); + textureTier4 = aIconRegister.registerIcon("gregtech:iconsets/EM_DIM_4"); + textureTier5 = aIconRegister.registerIcon("gregtech:iconsets/EM_DIM_5"); + textureTier6 = aIconRegister.registerIcon("gregtech:iconsets/EM_DIM_6"); + textureTier7 = aIconRegister.registerIcon("gregtech:iconsets/EM_DIM_7"); + textureTier8 = aIconRegister.registerIcon("gregtech:iconsets/EM_DIM_8"); } @Override @@ -65,21 +82,21 @@ public class SpacetimeCompressionFieldCasing extends GT_Block_Casings_Abstract { case 0: return textureTier0; case 1: - return textureTier0; + return textureTier1; case 2: - return textureTier0; + return textureTier2; case 3: - return textureTier0; + return textureTier3; case 4: - return textureTier0; + return textureTier4; case 5: - return textureTier0; + return textureTier5; case 6: - return textureTier0; + return textureTier6; case 7: - return textureTier0; + return textureTier7; case 8: - return textureTier0; + return textureTier8; default: return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); } diff --git a/src/main/java/com/github/technus/tectech/thing/casing/StabilisationFieldCasing.java b/src/main/java/com/github/technus/tectech/thing/casing/StabilisationFieldCasing.java index dcc8bcb867..328209830d 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/StabilisationFieldCasing.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/StabilisationFieldCasing.java @@ -2,6 +2,8 @@ package com.github.technus.tectech.thing.casing; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.util.CommonValues.EOH_TIER_FANCY_NAMES; +import static net.minecraft.util.EnumChatFormatting.GRAY; +import static net.minecraft.util.EnumChatFormatting.RESET; import com.github.technus.tectech.thing.CustomItemList; import cpw.mods.fml.relauncher.Side; @@ -23,6 +25,14 @@ import net.minecraft.world.IBlockAccess; @SuppressWarnings("SpellCheckingInspection") public class StabilisationFieldCasing extends GT_Block_Casings_Abstract { private static IIcon textureTier0; + private static IIcon textureTier1; + private static IIcon textureTier2; + private static IIcon textureTier3; + private static IIcon textureTier4; + private static IIcon textureTier5; + private static IIcon textureTier6; + private static IIcon textureTier7; + private static IIcon textureTier8; private static final int maxBlockTier = 9; private static final byte START_INDEX = 16; @@ -37,7 +47,7 @@ public class StabilisationFieldCasing extends GT_Block_Casings_Abstract { for (int i = 0; i < maxBlockTier; i++) { GT_LanguageManager.addStringLocalization( getUnlocalizedName() + "." + i + ".name", - EOH_TIER_FANCY_NAMES[i] + EnumChatFormatting.RESET + " Stabilisation Field Generator"); + GRAY + EOH_TIER_FANCY_NAMES[i] + RESET + " Stabilisation Field Generator"); } CustomItemList.StabilisationFieldGeneratorTier0.set(new ItemStack(this, 1, 0)); @@ -53,7 +63,15 @@ public class StabilisationFieldCasing extends GT_Block_Casings_Abstract { @Override public void registerBlockIcons(IIconRegister aIconRegister) { - textureTier0 = aIconRegister.registerIcon("gregtech:iconsets/EM_TIMESPACE"); + textureTier0 = aIconRegister.registerIcon("gregtech:iconsets/STABILITY_CASING_0"); + textureTier1 = aIconRegister.registerIcon("gregtech:iconsets/STABILITY_CASING_1"); + textureTier2 = aIconRegister.registerIcon("gregtech:iconsets/STABILITY_CASING_2"); + textureTier3 = aIconRegister.registerIcon("gregtech:iconsets/STABILITY_CASING_3"); + textureTier4 = aIconRegister.registerIcon("gregtech:iconsets/STABILITY_CASING_4"); + textureTier5 = aIconRegister.registerIcon("gregtech:iconsets/STABILITY_CASING_5"); + textureTier6 = aIconRegister.registerIcon("gregtech:iconsets/STABILITY_CASING_6"); + textureTier7 = aIconRegister.registerIcon("gregtech:iconsets/STABILITY_CASING_7"); + textureTier8 = aIconRegister.registerIcon("gregtech:iconsets/STABILITY_CASING_8"); } @Override @@ -62,21 +80,21 @@ public class StabilisationFieldCasing extends GT_Block_Casings_Abstract { case 0: return textureTier0; case 1: - return textureTier0; + return textureTier1; case 2: - return textureTier0; + return textureTier2; case 3: - return textureTier0; + return textureTier3; case 4: - return textureTier0; + return textureTier4; case 5: - return textureTier0; + return textureTier5; case 6: - return textureTier0; + return textureTier6; case 7: - return textureTier0; + return textureTier7; case 8: - return textureTier0; + return textureTier8; default: return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); } diff --git a/src/main/java/com/github/technus/tectech/thing/casing/TimeAccelerationFieldCasing.java b/src/main/java/com/github/technus/tectech/thing/casing/TimeAccelerationFieldCasing.java index bb26f73228..7ab71453c0 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/TimeAccelerationFieldCasing.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/TimeAccelerationFieldCasing.java @@ -2,6 +2,8 @@ package com.github.technus.tectech.thing.casing; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.util.CommonValues.EOH_TIER_FANCY_NAMES; +import static net.minecraft.util.EnumChatFormatting.GRAY; +import static net.minecraft.util.EnumChatFormatting.RESET; import com.github.technus.tectech.thing.CustomItemList; import cpw.mods.fml.relauncher.Side; @@ -23,6 +25,14 @@ import net.minecraft.world.IBlockAccess; @SuppressWarnings("SpellCheckingInspection") public class TimeAccelerationFieldCasing extends GT_Block_Casings_Abstract { private static IIcon textureTier0; + private static IIcon textureTier1; + private static IIcon textureTier2; + private static IIcon textureTier3; + private static IIcon textureTier4; + private static IIcon textureTier5; + private static IIcon textureTier6; + private static IIcon textureTier7; + private static IIcon textureTier8; private static final int maxBlockTier = 9; private static final byte START_INDEX = 16; @@ -40,7 +50,7 @@ public class TimeAccelerationFieldCasing extends GT_Block_Casings_Abstract { for (int i = 0; i < maxBlockTier; i++) { GT_LanguageManager.addStringLocalization( getUnlocalizedName() + "." + i + ".name", - EOH_TIER_FANCY_NAMES[i] + EnumChatFormatting.RESET + " Time Dilation Field Generator"); + GRAY + EOH_TIER_FANCY_NAMES[i] + RESET + " Time Dilation Field Generator"); } CustomItemList.TimeAccelerationFieldGeneratorTier0.set(new ItemStack(this, 1, 0)); @@ -51,12 +61,20 @@ public class TimeAccelerationFieldCasing extends GT_Block_Casings_Abstract { CustomItemList.TimeAccelerationFieldGeneratorTier5.set(new ItemStack(this, 1, 5)); CustomItemList.TimeAccelerationFieldGeneratorTier6.set(new ItemStack(this, 1, 6)); CustomItemList.TimeAccelerationFieldGeneratorTier7.set(new ItemStack(this, 1, 7)); - CustomItemList.TimeAccelerationFieldGeneratorTier7.set(new ItemStack(this, 1, 8)); + CustomItemList.TimeAccelerationFieldGeneratorTier8.set(new ItemStack(this, 1, 8)); } @Override public void registerBlockIcons(IIconRegister aIconRegister) { - textureTier0 = aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD"); + textureTier0 = aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD_0"); + textureTier1 = aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD_1"); + textureTier2 = aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD_2"); + textureTier3 = aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD_3"); + textureTier4 = aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD_4"); + textureTier5 = aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD_5"); + textureTier6 = aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD_6"); + textureTier7 = aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD_7"); + textureTier8 = aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD_8"); } @Override @@ -65,21 +83,21 @@ public class TimeAccelerationFieldCasing extends GT_Block_Casings_Abstract { case 0: return textureTier0; case 1: - return textureTier0; + return textureTier1; case 2: - return textureTier0; + return textureTier2; case 3: - return textureTier0; + return textureTier3; case 4: - return textureTier0; + return textureTier4; case 5: - return textureTier0; + return textureTier5; case 6: - return textureTier0; + return textureTier6; case 7: - return textureTier0; + return textureTier7; case 8: - return textureTier0; + return textureTier8; default: return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java index bbc7de8d6c..8b3ef8dd1a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_EyeOfHarmony.java @@ -55,6 +55,9 @@ import org.spongepowered.libraries.com.google.common.math.LongMath; @SuppressWarnings("SpellCheckingInspection") public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable, IGlobalWirelessEnergy { + + private static final boolean debugMode = false; + // Region variables. private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; @@ -69,8 +72,6 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl private String userName = ""; private long euOutput = 0; - private final Stack<Long> computationStack = new Stack<>(); - // Multiblock structure. private static final IStructureDefinition<GT_MetaTileEntity_EM_EyeOfHarmony> STRUCTURE_DEFINITION = IStructureDefinition.<GT_MetaTileEntity_EM_EyeOfHarmony>builder() @@ -1379,12 +1380,7 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl private double hydrogenOverflowProbabilityAdjustment; private double heliumOverflowProbabilityAdjustment; - - // Maximum additional chance of recipe success that can be obtained from adding computation. - private static final double maxPercentageChanceGainFromComputationPerSecond = 0.3; - - // todo: make higher on final release. - private static final long ticksBetweenHatchDrain = 20; + private static final long ticksBetweenHatchDrain = debugMode ? 20 : 200; private List<ItemStackLong> outputItems = new ArrayList<>(); @@ -1402,12 +1398,11 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl } private double recipeChanceCalculator() { - double chance = (currentRecipe.getBaseRecipeSuccessChance() + double chance = currentRecipe.getBaseRecipeSuccessChance() - timeAccelerationFieldMetadata * 0.1 + stabilisationFieldMetadata * 0.05 - hydrogenOverflowProbabilityAdjustment - - heliumOverflowProbabilityAdjustment - + maxPercentageChanceGainFromComputationPerSecond * (1 - exp(-10e-5 * getComputation()))); + - heliumOverflowProbabilityAdjustment; return clamp(chance, 0.0, 1.0); } @@ -1437,7 +1432,7 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl long spacetimeCasingDifference = (recipeSpacetimeCasingRequired - spacetimeCompressionFieldMetadata); double recipeTimeDiscounted = recipeTime - * pow(2.0, -timeAccelerationFieldMetadata) + * pow(2.0, - timeAccelerationFieldMetadata) * pow(1 - spacetimeCasingDifferenceDiscountPercentage, spacetimeCasingDifference); return (int) Math.max(recipeTimeDiscounted, 1.0); } @@ -1548,12 +1543,6 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl + " per tier (additive).") .addInfo(" Decreases the yield of a recipe by " + RED + "5%" + GRAY + " per tier (additive). ") .addInfo(GOLD + "--------------------------------------------------------------------------------") - .addInfo("Computation/s provided to the multiblock can increase the chance by up to " + RED - + formatNumbers(maxPercentageChanceGainFromComputationPerSecond * 100) + GRAY - + "%.") - .addInfo("The associated formula is " + GREEN - + "additional_chance = 0.3 * exp(10^(-5) * computation_per_second)" + GRAY + ".") - .addInfo(GOLD + "--------------------------------------------------------------------------------") .addInfo("Going over a recipe requirement on hydrogen or helium has a penalty on yield and recipe") .addInfo( "chance. All stored hydrogen and helium is consumed during a craft. The associated formulas are:") @@ -1695,14 +1684,15 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl public boolean processRecipe(EyeOfHarmonyRecipe recipeObject) { - // if ((getHydrogenStored() < currentRecipe.getHydrogenRequirement()) - // || (getHeliumStored() < currentRecipe.getHeliumRequirement())) { - // return false; - // } - - // todo: DEBUG, DELETE THIS: - if ((getHydrogenStored() < 100) || (getHeliumStored() < 100)) { - return false; + // Debug mode, overwrites the required fluids to initiate the recipe to 100L of each. + if (debugMode) { + if ((getHydrogenStored() < 100) || (getHeliumStored() < 100)) { + return false; + } + } else { + if ((getHydrogenStored() < currentRecipe.getHydrogenRequirement()) || (getHeliumStored() < currentRecipe.getHeliumRequirement())) { + return false; + } } // Check tier of spacetime compression blocks is high enough. @@ -1721,24 +1711,24 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl calculateHydrogenHeliumInputExcessValues( recipeObject.getHydrogenRequirement(), recipeObject.getHeliumRequirement()); - // todo: DEBUG ! DELETE THESE TWO LINES: - hydrogenOverflowProbabilityAdjustment = 0; - heliumOverflowProbabilityAdjustment = 0; + if (debugMode) { + hydrogenOverflowProbabilityAdjustment = 0; + heliumOverflowProbabilityAdjustment = 0; + } successChance = recipeChanceCalculator(); // Determine EU recipe output. euOutput = recipeObject.getEUOutput(); - // Set expected recipe computation. - eRequiredData = getComputation(); - // Reduce internal storage by hydrogen and helium quantity required for recipe. validFluidMap.put(Materials.Hydrogen.getGas(1), 0L); validFluidMap.put(Materials.Helium.getGas(1), 0L); double yield = recipeYieldCalculator(); - successChance = 1; // todo debug, remove. + if (debugMode) { + successChance = 1; // Debug recipes, sets them to 100% output chance. + } // Return copies of the output objects. mOutputFluids = recipeObject.getOutputFluids(); @@ -1786,6 +1776,8 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl this.getBaseMetaTileEntity().getWorld().getTileEntity((int) (x + xOffset), (int) (y + yOffset), (int) (z + zOffset)); + rendererTileEntity.setTier(currentRecipe.getRocketTier()); + int recipeSpacetimeTier = (int) currentRecipe.getSpacetimeCasingTierRequired(); // Star is a larger size depending on the spacetime tier of the recipe. @@ -1794,11 +1786,6 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl // Star rotates faster the higher tier time dilation you use in the multi. // Lower value = faster rotation speed. rendererTileEntity.setRotationSpeed((1 + timeAccelerationFieldMetadata) / 2.0f); - - // Set recipe spacetime tier for usage elsewhere. - rendererTileEntity.setTier(currentRecipe.getRocketTier()); - rendererTileEntity.setOrbitingBody( - Block.getBlockFromItem(currentRecipe.getRecipeTriggerItem().getItem())); } private double successChance; @@ -1859,14 +1846,6 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl super.outputAfterRecipe_EM(); } - // todo probably remove me. - private void pushComputation() { - if (computationStack.size() == computationTickCacheSize) { - computationStack.remove(0); - } - computationStack.push(eAvailableData); - } - @Override public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPreTick(aBaseMetaTileEntity, aTick); @@ -1877,9 +1856,6 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl strongCheckOrAddUser(userUUID, userName); } - // Add computation to stack. Prevents small interruptions causing issues. - pushComputation(); - if (!recipeRunning) { if ((aTick % ticksBetweenHatchDrain) == 0) { drainFluidFromHatchesAndStoreInternally(); @@ -1888,11 +1864,7 @@ public class GT_MetaTileEntity_EM_EyeOfHarmony extends GT_MetaTileEntity_Multibl } private boolean recipeRunning = false; - private static final int computationTickCacheSize = 5; - private long getComputation() { - return Collections.max(computationStack); - } // Will void if AE network is full. private void outputItemToAENetwork(ItemStack item, long amount) { |