aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common
diff options
context:
space:
mode:
authorMary <33456283+FourIsTheNumber@users.noreply.github.com>2024-09-07 09:16:14 -0400
committerGitHub <noreply@github.com>2024-09-07 13:16:14 +0000
commitf2c0a4fc6b65749871b60580a6f65374f589b994 (patch)
tree47d7ffeb0f74eb49fb707b6dfd001c6052c4ebeb /src/main/java/gregtech/common
parent67607edb5343c892e46767db782da3b7da0f4c5a (diff)
downloadGT5-Unofficial-f2c0a4fc6b65749871b60580a6f65374f589b994.tar.gz
GT5-Unofficial-f2c0a4fc6b65749871b60580a6f65374f589b994.tar.bz2
GT5-Unofficial-f2c0a4fc6b65749871b60580a6f65374f589b994.zip
Finishing touches on black hole compressor (#3060)
Co-authored-by: Martin Robertz <dream-master@gmx.net> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: BucketBrigade <138534411+CookieBrigade@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gregtech/common')
-rw-r--r--src/main/java/gregtech/common/GTClient.java2
-rw-r--r--src/main/java/gregtech/common/blocks/BlockBlackholeRenderer.java74
-rw-r--r--src/main/java/gregtech/common/items/MetaGeneratedItem01.java4
-rw-r--r--src/main/java/gregtech/common/render/BlackholeRenderer.java222
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java382
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEHIPCompressor.java15
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEHeatSensor.java4
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEIndustrialCompressor.java17
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTENeutroniumCompressor.java16
-rw-r--r--src/main/java/gregtech/common/tileentities/render/TileEntityBlackhole.java99
10 files changed, 701 insertions, 134 deletions
diff --git a/src/main/java/gregtech/common/GTClient.java b/src/main/java/gregtech/common/GTClient.java
index 127c801b40..276bc7a78a 100644
--- a/src/main/java/gregtech/common/GTClient.java
+++ b/src/main/java/gregtech/common/GTClient.java
@@ -91,6 +91,7 @@ import gregtech.api.util.WorldSpawnedEventBuilder;
import gregtech.client.SeekingOggCodec;
import gregtech.common.blocks.BlockFrameBox;
import gregtech.common.blocks.ItemMachines;
+import gregtech.common.render.BlackholeRenderer;
import gregtech.common.render.DroneRender;
import gregtech.common.render.FlaskRenderer;
import gregtech.common.render.FluidDisplayStackRenderer;
@@ -631,6 +632,7 @@ public class GTClient extends GTProxy implements Runnable {
new DroneRender();
new LaserRenderer();
new WormholeRenderer();
+ new BlackholeRenderer();
metaGeneratedItemRenderer = new MetaGeneratedItemRenderer();
for (MetaGeneratedItem item : MetaGeneratedItem.sInstances.values()) {
diff --git a/src/main/java/gregtech/common/blocks/BlockBlackholeRenderer.java b/src/main/java/gregtech/common/blocks/BlockBlackholeRenderer.java
new file mode 100644
index 0000000000..84d61172c3
--- /dev/null
+++ b/src/main/java/gregtech/common/blocks/BlockBlackholeRenderer.java
@@ -0,0 +1,74 @@
+package gregtech.common.blocks;
+
+import java.util.ArrayList;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.common.tileentities.render.TileEntityBlackhole;
+
+public class BlockBlackholeRenderer extends Block {
+
+ public BlockBlackholeRenderer() {
+ super(Material.iron);
+ this.setResistance(20f);
+ this.setHardness(-1.0f);
+ this.setBlockName("BlackHoleRenderer");
+ this.setLightLevel(100.0f);
+ GameRegistry.registerBlock(this, getUnlocalizedName());
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister iconRegister) {
+ blockIcon = iconRegister.registerIcon("gregtech:iconsets/TRANSPARENT");
+ }
+
+ @Override
+ public String getUnlocalizedName() {
+ return "gt.blackholerenderer";
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public boolean canRenderInPass(int a) {
+ return true;
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ @Override
+ public boolean hasTileEntity(int metadata) {
+ return true;
+ }
+
+ @Override
+ public TileEntity createTileEntity(World world, int metadata) {
+ return new TileEntityBlackhole();
+ }
+
+ @Override
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune) {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public boolean isCollidable() {
+ return true;
+ }
+
+}
diff --git a/src/main/java/gregtech/common/items/MetaGeneratedItem01.java b/src/main/java/gregtech/common/items/MetaGeneratedItem01.java
index ab9917435c..5fcb02b657 100644
--- a/src/main/java/gregtech/common/items/MetaGeneratedItem01.java
+++ b/src/main/java/gregtech/common/items/MetaGeneratedItem01.java
@@ -3203,14 +3203,14 @@ public class MetaGeneratedItem01 extends MetaGeneratedItemX32 {
ItemList.Black_Hole_Opener.set(
addItem(
Black_Hole_Opener.ID,
- "Black Hole Activation Catalyst",
+ "Black Hole Seed",
"Opens a semi-stable black hole",
new TCAspects.TC_AspectStack(TCAspects.ALIENIS, 32),
new TCAspects.TC_AspectStack(TCAspects.ORDO, 64)));
ItemList.Black_Hole_Closer.set(
addItem(
Black_Hole_Closer.ID,
- "Black Hole Deactivation Catalyst",
+ "Black Hole Collapser",
"Safely closes a semi-stable black hole",
new TCAspects.TC_AspectStack(TCAspects.ALIENIS, 32),
new TCAspects.TC_AspectStack(TCAspects.PERDITIO, 64)));
diff --git a/src/main/java/gregtech/common/render/BlackholeRenderer.java b/src/main/java/gregtech/common/render/BlackholeRenderer.java
new file mode 100644
index 0000000000..733bd3aa9e
--- /dev/null
+++ b/src/main/java/gregtech/common/render/BlackholeRenderer.java
@@ -0,0 +1,222 @@
+package gregtech.common.render;
+
+import static gregtech.api.enums.Mods.GregTech;
+
+import java.nio.FloatBuffer;
+
+import net.minecraft.client.renderer.ActiveRenderInfo;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.client.model.AdvancedModelLoader;
+
+import org.joml.Matrix4fStack;
+import org.joml.Vector4f;
+import org.lwjgl.BufferUtils;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL20;
+
+import com.gtnewhorizon.gtnhlib.client.renderer.CapturingTessellator;
+import com.gtnewhorizon.gtnhlib.client.renderer.TessellatorManager;
+import com.gtnewhorizon.gtnhlib.client.renderer.shader.ShaderProgram;
+import com.gtnewhorizon.gtnhlib.client.renderer.vbo.IModelCustomExt;
+import com.gtnewhorizon.gtnhlib.client.renderer.vbo.VertexBuffer;
+import com.gtnewhorizon.gtnhlib.client.renderer.vertex.DefaultVertexFormat;
+
+import cpw.mods.fml.client.registry.ClientRegistry;
+import gregtech.common.tileentities.render.TileEntityBlackhole;
+
+public class BlackholeRenderer extends TileEntitySpecialRenderer {
+
+ private boolean initialized = false;
+
+ private ShaderProgram blackholeProgram;
+ private static int u_CameraPosition = -1, u_Scale = -1, u_Time = -1, u_Stability = -1;
+ private static final Matrix4fStack modelMatrixStack = new Matrix4fStack(4);
+
+ private static IModelCustomExt blackholeModel;
+ private static ResourceLocation blackholeTexture;
+ private static float modelScale = .5f;
+
+ private ShaderProgram laserProgram;
+ private static int u_LaserCameraPosition = -1, u_LaserColor = -1, u_LaserModelMatrix = -1;
+ private static VertexBuffer laserVBO;
+ private static ResourceLocation laserTexture;
+
+ private static final Matrix4fStack modelMatrix = new Matrix4fStack(2);
+
+ private static final float WIDTH = .1f;
+ private static final float EXCLUSION = 1f;
+
+ public BlackholeRenderer() {
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBlackhole.class, this);
+ }
+
+ private void init() {
+ try {
+ blackholeProgram = new ShaderProgram(
+ GregTech.resourceDomain,
+ "shaders/blackhole.vert.glsl",
+ "shaders/blackhole.frag.glsl");
+
+ u_CameraPosition = blackholeProgram.getUniformLocation("u_CameraPosition");
+
+ u_Scale = blackholeProgram.getUniformLocation("u_Scale");
+ u_Time = blackholeProgram.getUniformLocation("u_Time");
+ u_Stability = blackholeProgram.getUniformLocation("u_Stability");
+
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ return;
+ }
+
+ blackholeModel = (IModelCustomExt) AdvancedModelLoader
+ .loadModel(new ResourceLocation(GregTech.resourceDomain, "textures/model/blackhole.obj"));
+ blackholeTexture = new ResourceLocation(GregTech.resourceDomain, "textures/model/blackhole.png");
+
+ blackholeProgram.use();
+ GL20.glUniform1f(u_Scale, modelScale);
+ GL20.glUniform1f(u_Stability, .1f);
+ ShaderProgram.clear();
+
+ try {
+ laserProgram = new ShaderProgram(
+ GregTech.resourceDomain,
+ "shaders/laser.vert.glsl",
+ "shaders/laser.frag.glsl");
+ u_LaserCameraPosition = laserProgram.getUniformLocation("u_CameraPosition");
+ u_LaserColor = laserProgram.getUniformLocation("u_Color");
+ u_LaserModelMatrix = laserProgram.getUniformLocation("u_ModelMatrix");
+
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ return;
+ }
+
+ laserTexture = new ResourceLocation(GregTech.resourceDomain, "textures/model/laser.png");
+
+ TessellatorManager.startCapturing();
+ CapturingTessellator tess = (CapturingTessellator) TessellatorManager.get();
+
+ tess.startDrawingQuads();
+
+ tess.addVertexWithUV(.5 + 8, 0, -WIDTH, 0, 0);
+ tess.addVertexWithUV(.5 + 8, 0, WIDTH, 0, 1);
+ tess.addVertexWithUV(EXCLUSION, 0, WIDTH / 5, 1, 1);
+ tess.addVertexWithUV(EXCLUSION, 0, -WIDTH / 5, 1, 0);
+
+ tess.addVertexWithUV(-.5 - 8, 0, -WIDTH, 0, 0);
+ tess.addVertexWithUV(-.5 - 8, 0, WIDTH, 0, 1);
+ tess.addVertexWithUV(-EXCLUSION, 0, WIDTH / 5, 1, 1);
+ tess.addVertexWithUV(-EXCLUSION, 0, -WIDTH / 5, 1, 0);
+
+ tess.draw();
+
+ laserVBO = TessellatorManager.stopCapturingToVBO(DefaultVertexFormat.POSITION_TEXTURE_NORMAL);
+
+ initialized = true;
+ }
+
+ private void renderBlackHole(TileEntityBlackhole tile, double x, double y, double z, float timer) {
+
+ blackholeProgram.use();
+ bindTexture(blackholeTexture);
+ GL20.glUniform1f(u_Stability, tile.getStability());
+ modelMatrixStack.clear();
+
+ float xLocal = ((float) x + .5f);
+ float yLocal = ((float) y + .5f);
+ float zLocal = ((float) z + .5f);
+ GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
+ GL11.glPushMatrix();
+ GL20.glUniform3f(
+ u_CameraPosition,
+ ActiveRenderInfo.objectX - xLocal,
+ ActiveRenderInfo.objectY - yLocal,
+ ActiveRenderInfo.objectZ - zLocal);
+
+ GL20.glUniform1f(u_Time, timer);
+ GL11.glTranslated(x + .5f, y + .5f, z + .5f);
+ blackholeModel.renderAllVBO();
+
+ GL11.glPopMatrix();
+ GL11.glPopAttrib();
+ ShaderProgram.clear();
+ }
+
+ private void renderLasers(TileEntityBlackhole tile, double x, double y, double z, float timer) {
+ laserProgram.use();
+ bindTexture(laserTexture);
+
+ float cx = ((float) x + .5f);
+ float cy = ((float) y + .5f);
+ float cz = ((float) z + .5f);
+ GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
+ GL11.glDisable(GL11.GL_CULL_FACE);
+ GL11.glPushMatrix();
+ GL20.glUniform3f(u_LaserColor, tile.getLaserR(), tile.getLaserG(), tile.getLaserB());
+
+ modelMatrix.clear();
+ modelMatrix.translate(cx, cy, cz);
+
+ // First set
+ FloatBuffer matrixBuffer = BufferUtils.createFloatBuffer(16);
+ GL20.glUniformMatrix4(u_LaserModelMatrix, false, modelMatrix.get(matrixBuffer));
+ modelMatrix.pushMatrix();
+ modelMatrix.invert();
+ Vector4f cameraPosition = new Vector4f(
+ ActiveRenderInfo.objectX,
+ ActiveRenderInfo.objectY,
+ ActiveRenderInfo.objectZ,
+ 1);
+ cameraPosition = modelMatrix.transform(cameraPosition);
+ GL20.glUniform3f(u_LaserCameraPosition, cameraPosition.x, cameraPosition.y, cameraPosition.z);
+ laserVBO.render();
+
+ // Second set
+
+ modelMatrix.popMatrix();
+ matrixBuffer.clear();
+ modelMatrix.rotate((float) Math.PI / 2, 0, 1, 0);
+
+ GL20.glUniformMatrix4(u_LaserModelMatrix, false, modelMatrix.get(matrixBuffer));
+
+ modelMatrix.invert();
+ cameraPosition.set(ActiveRenderInfo.objectX, ActiveRenderInfo.objectY, ActiveRenderInfo.objectZ, 1);
+ cameraPosition = modelMatrix.transform(cameraPosition);
+ GL20.glUniform3f(u_LaserCameraPosition, cameraPosition.x, cameraPosition.y, cameraPosition.z);
+ laserVBO.render();
+
+ GL11.glPopMatrix();
+ GL11.glPopAttrib();
+ ShaderProgram.clear();
+ }
+
+ public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) {
+ if (!(tile instanceof TileEntityBlackhole blackhole)) return;
+
+ if (!initialized) {
+ init();
+ if (!initialized) return;
+ }
+ if (((TileEntityBlackhole) tile).getLaserRender()) {
+ renderLasers(
+ blackhole,
+ x,
+ y,
+ z,
+ tile.getWorldObj()
+ .getWorldTime() + timeSinceLastTick);
+ }
+
+ renderBlackHole(
+ blackhole,
+ x,
+ y,
+ z,
+ tile.getWorldObj()
+ .getWorldTime() + timeSinceLastTick);
+
+ }
+
+}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java
index ba893e045d..367b529bc3 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java
@@ -1,16 +1,20 @@
package gregtech.common.tileentities.machines.multi.compressor;
+import static bartworks.util.BWTooltipReference.TT;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static gregtech.api.enums.GTValues.AuthorFourIsTheNumber;
import static gregtech.api.enums.GTValues.Ollie;
import static gregtech.api.enums.HatchElement.*;
-import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_COMPRESSOR;
-import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_COMPRESSOR_ACTIVE;
-import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_COMPRESSOR_ACTIVE_GLOW;
-import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_COMPRESSOR_GLOW;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_MULTI_BLACKHOLE;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_MULTI_BLACKHOLE_ACTIVE;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_MULTI_BLACKHOLE_ACTIVE_GLOW;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_MULTI_BLACKHOLE_GLOW;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_MULTI_BLACKHOLE_UNSTABLE;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_MULTI_BLACKHOLE_UNSTABLE_GLOW;
import static gregtech.api.util.GTStructureUtility.buildHatchAdder;
import static gregtech.api.util.GTStructureUtility.ofFrame;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -20,6 +24,7 @@ import javax.annotation.Nonnull;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@@ -42,11 +47,13 @@ import gregtech.api.enums.Materials;
import gregtech.api.enums.MaterialsUEVplus;
import gregtech.api.enums.Textures;
import gregtech.api.gui.modularui.GTUITextures;
+import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.logic.ProcessingLogic;
import gregtech.api.metatileentity.implementations.MTEExtendedPowerMultiBlockBase;
+import gregtech.api.metatileentity.implementations.MTEHatchEnergy;
import gregtech.api.metatileentity.implementations.MTEHatchInput;
import gregtech.api.recipe.RecipeMap;
import gregtech.api.recipe.RecipeMaps;
@@ -57,8 +64,10 @@ import gregtech.api.render.TextureFactory;
import gregtech.api.util.GTRecipe;
import gregtech.api.util.GTUtility;
import gregtech.api.util.MultiblockTooltipBuilder;
+import gregtech.api.util.OverclockCalculator;
import gregtech.common.blocks.BlockCasings10;
import gregtech.common.items.MetaGeneratedItem01;
+import gregtech.common.tileentities.render.TileEntityBlackhole;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -111,7 +120,8 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
.addElement('A', ofBlock(GregTechAPI.sBlockGlass1, 4))
.addElement(
'B',
- buildHatchAdder(MTEBlackHoleCompressor.class).atLeast(Maintenance, Energy)
+ buildHatchAdder(MTEBlackHoleCompressor.class)
+ .atLeast(Energy.or(ExoticEnergy), InputBus, OutputBus, InputHatch)
.casingIndex(((BlockCasings10) GregTechAPI.sBlockCasings10).getTextureIndex(12))
.dot(2)
.buildAndChain(
@@ -120,17 +130,23 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
.addElement('D', ofFrame(Materials.NaquadahAlloy))
.addElement(
'E',
- buildHatchAdder(MTEBlackHoleCompressor.class).atLeast(InputBus, OutputBus, InputHatch)
+ buildHatchAdder(MTEBlackHoleCompressor.class).atLeast(InputHatch)
+ .adder(MTEBlackHoleCompressor::addSpacetimeInput)
.casingIndex(((BlockCasings10) GregTechAPI.sBlockCasings10).getTextureIndex(11))
.dot(1)
- .buildAndChain(
- onElementPass(MTEBlackHoleCompressor::onCasingAdded, ofBlock(GregTechAPI.sBlockCasings10, 11))))
-
+ .buildAndChain(ofBlock(GregTechAPI.sBlockCasings10, 11)))
.build();
- private boolean blackholeOn = false;
private int catalyzingCounter = 0;
private float blackHoleStability = 100;
+ private final ArrayList<MTEHatchInput> spacetimeHatches = new ArrayList<>();
+
+ /**
+ * 1: Off
+ * 2: On, stable
+ * 3: On, unstable
+ */
+ private byte blackHoleStatus = 1;
private final FluidStack blackholeCatalyzingCost = (MaterialsUEVplus.SpaceTime).getMolten(1);
private int catalyzingCostModifier = 1;
@@ -143,6 +159,22 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
super(aName);
}
+ private boolean addSpacetimeInput(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity != null) {
+ if (aTileEntity.getMetaTileEntity() instanceof MTEHatchInput hatch) {
+ hatch.updateTexture(aBaseCasingIndex);
+ spacetimeHatches.add(hatch);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected boolean filtersFluid() {
+ return false;
+ }
+
@Override
public IStructureDefinition<MTEBlackHoleCompressor> getStructureDefinition() {
return STRUCTURE_DEFINITION;
@@ -171,15 +203,39 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
@Override
public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- setMachineMode(nextMachineMode());
- PlayerUtils.messagePlayer(
- aPlayer,
- String.format(StatCollector.translateToLocal("GT5U.MULTI_MACHINE_CHANGE"), getMachineModeName()));
+ if (aPlayer.isSneaking()) {
+ shouldRender = !shouldRender;
+ if (!shouldRender) {
+ PlayerUtils.messagePlayer(aPlayer, "Rendering off");
+ rendererTileEntity = null;
+ destroyRenderBlock();
+ } else {
+ if (blackHoleStatus != 1) createRenderBlock();
+ PlayerUtils.messagePlayer(aPlayer, "Rendering on");
+ }
+ } else {
+ setMachineMode(nextMachineMode());
+ PlayerUtils.messagePlayer(
+ aPlayer,
+ String.format(StatCollector.translateToLocal("GT5U.MULTI_MACHINE_CHANGE"), getMachineModeName()));
+ }
}
@Override
public String getMachineModeName() {
- return StatCollector.translateToLocal("GT5U.COMPRESSION_TIER.mode." + machineMode);
+ return StatCollector.translateToLocal("GT5U.BLACKHOLE.mode." + machineMode);
+ }
+
+ @Override
+ public void onValueUpdate(byte aValue) {
+ byte oBlackHoleStatus = blackHoleStatus;
+ blackHoleStatus = aValue;
+ if (oBlackHoleStatus != blackHoleStatus) getBaseMetaTileEntity().issueTextureUpdate();
+ }
+
+ @Override
+ public byte getUpdateData() {
+ return blackHoleStatus;
}
@Override
@@ -187,33 +243,36 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
int colorIndex, boolean aActive, boolean redstoneLevel) {
ITexture[] rTexture;
if (side == aFacing) {
- if (aActive) {
- rTexture = new ITexture[] {
- Textures.BlockIcons
- .getCasingTextureForId(GTUtility.getCasingTextureIndex(GregTechAPI.sBlockCasings10, 11)),
- TextureFactory.builder()
- .addIcon(OVERLAY_FRONT_MULTI_COMPRESSOR_ACTIVE)
- .extFacing()
- .build(),
- TextureFactory.builder()
- .addIcon(OVERLAY_FRONT_MULTI_COMPRESSOR_ACTIVE_GLOW)
- .extFacing()
- .glow()
- .build() };
- } else {
- rTexture = new ITexture[] {
- Textures.BlockIcons
- .getCasingTextureForId(GTUtility.getCasingTextureIndex(GregTechAPI.sBlockCasings10, 11)),
- TextureFactory.builder()
- .addIcon(OVERLAY_FRONT_MULTI_COMPRESSOR)
- .extFacing()
- .build(),
- TextureFactory.builder()
- .addIcon(OVERLAY_FRONT_MULTI_COMPRESSOR_GLOW)
- .extFacing()
- .glow()
- .build() };
+ IIconContainer MAIN_OVERLAY;
+ IIconContainer GLOW_OVERLAY;
+ switch (blackHoleStatus) {
+ default -> {
+ MAIN_OVERLAY = OVERLAY_MULTI_BLACKHOLE;
+ GLOW_OVERLAY = OVERLAY_MULTI_BLACKHOLE_GLOW;
+ }
+ case 2 -> {
+ MAIN_OVERLAY = OVERLAY_MULTI_BLACKHOLE_ACTIVE;
+ GLOW_OVERLAY = OVERLAY_MULTI_BLACKHOLE_ACTIVE_GLOW;
+ }
+ case 3 -> {
+ MAIN_OVERLAY = OVERLAY_MULTI_BLACKHOLE_UNSTABLE;
+ GLOW_OVERLAY = OVERLAY_MULTI_BLACKHOLE_UNSTABLE_GLOW;
+ }
}
+
+ rTexture = new ITexture[] {
+ Textures.BlockIcons
+ .getCasingTextureForId(GTUtility.getCasingTextureIndex(GregTechAPI.sBlockCasings10, 11)),
+ TextureFactory.builder()
+ .addIcon(MAIN_OVERLAY)
+ .extFacing()
+ .build(),
+ TextureFactory.builder()
+ .addIcon(GLOW_OVERLAY)
+ .extFacing()
+ .glow()
+ .build() };
+
} else {
rTexture = new ITexture[] { Textures.BlockIcons
.getCasingTextureForId(GTUtility.getCasingTextureIndex(GregTechAPI.sBlockCasings10, 11)) };
@@ -227,78 +286,78 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
tt.addMachineType("Compressor/Advanced Neutronium Compressor")
.addInfo("Controller Block for the Semi-Stable Black Hole Containment Field")
.addInfo(EnumChatFormatting.LIGHT_PURPLE + "Uses the immense power of the event horizon to compress things")
- .addInfo("No longer requires heat management to perform perfect compression")
+ .addInfo("No longer requires heat management to perform superdense compression")
.addInfo("Can create advanced singularities!")
.addSeparator()
.addInfo(
"Insert a " + EnumChatFormatting.WHITE
- + "Black Hole Activation Catalyst"
+ + "Black Hole Seed"
+ EnumChatFormatting.GRAY
+ " to open a black hole")
.addInfo(
"The black hole will begin its life at " + EnumChatFormatting.RED
- + "100%"
+ + "100"
+ EnumChatFormatting.GRAY
+ " stability and slowly decay")
+ .addInfo(
+ "Stability decays by " + EnumChatFormatting.RED
+ + "1/s"
+ + EnumChatFormatting.GRAY
+ + " until it reaches 0")
+ .addInfo("At 0 stability, the black hole is " + EnumChatFormatting.DARK_RED + "UNSTABLE")
+ .addInfo("Once the black hole becomes unstable, it will void all inputs for recipes which require it")
.addSeparator()
- .addInfo("Natural decay takes " + EnumChatFormatting.RED + "100" + EnumChatFormatting.GRAY + " seconds")
- .addInfo("Running recipes in the machine will slow the decay by " + EnumChatFormatting.RED + "25%")
+ .addInfo("Running recipes in the machine will slow the decay rate by " + EnumChatFormatting.RED + "25%")
.addInfo(
"The decay can be " + EnumChatFormatting.BOLD
+ "halted"
+ EnumChatFormatting.RESET
+ EnumChatFormatting.GRAY
- + " by inserting spacetime")
+ + " by inserting 1 L/s of spacetime")
.addInfo(
"Every " + EnumChatFormatting.RED
+ "30"
+ EnumChatFormatting.GRAY
- + " seconds saved by spacetime insertion will "
+ + " total seconds saved by spacetime insertion will "
+ EnumChatFormatting.RED
+ "double"
+ EnumChatFormatting.GRAY
+ " the cost per second!")
- .addInfo("Once the black hole becomes unstable, it will void all inputs for recipes which require it")
.addInfo(
"Insert a " + EnumChatFormatting.WHITE
- + "Black Hole Deactivation Catalyst"
+ + "Black Hole Collapser"
+ EnumChatFormatting.GRAY
+ " to close the black hole")
+ .addInfo("To restore stability and reset spacetime costs, close the black hole and open a new one")
.addSeparator()
.addInfo(
"Recipes not utilizing the black hole have their lengths " + EnumChatFormatting.RED
+ "doubled"
+ EnumChatFormatting.GRAY
+ " if it becomes unstable")
- .addInfo("400% faster than singleblock machines of the same voltage when black hole is open")
- .addInfo("Only uses 70% of the EU/t normally required")
+ .addInfo("400% faster than singleblock machines of the same voltage")
+ .addInfo("Only uses 70% of the EU/t normally required - does not overclock above energy hatch tier")
.addInfo("Gains 8 parallels per voltage tier")
.addInfo(
- "Parallels are " + EnumChatFormatting.RED
- + "doubled"
+ EnumChatFormatting.RED + "2x/4x"
+ EnumChatFormatting.GRAY
- + " when stability is BELOW "
+ + " parallels when stability is BELOW "
+ EnumChatFormatting.RED
- + "50%")
- .addInfo(
- "Parallels are " + EnumChatFormatting.RED
- + "quadrupled"
- + EnumChatFormatting.GRAY
- + " when stability is BELOW "
- + EnumChatFormatting.RED
- + "20%")
+ + "50/20")
+ .addInfo("Accepts one " + TT + " energy hatch")
.addInfo(AuthorFourIsTheNumber + EnumChatFormatting.RESET + " & " + Ollie)
+ .addInfo("Rendering by: " + EnumChatFormatting.WHITE + "BucketBrigade")
.addSeparator()
.beginStructureBlock(35, 33, 35, false)
- .addCasingInfoMin("Background Radiation Absorbent Casing", 985, false)
+ .addCasingInfoMin("Background Radiation Absorbent Casing", 950, false)
.addCasingInfoExactly("Extreme Density Space-Bending Casing", 3667, false)
.addCasingInfoExactly("Hawking Radiation Realignment Focus", 64, false)
.addCasingInfoExactly("Naquadah Alloy Frame Box", 144, false)
- .addInputBus("Behind Laser", 1)
- .addOutputBus("Behind Laser", 1)
- .addInputHatch("Behind Laser", 1)
- .addEnergyHatch("Any Radiation Absorbent Casing", 2)
- .addMaintenanceHatch("Any Radiation Absorbent Casing", 2)
+ .addInputHatch("Spacetime Insertion, Behind Laser", 2)
+ .addInputBus("Any Radiation Absorbent Casing", 1)
+ .addOutputBus("Any Radiation Absorbent Casing", 1)
+ .addInputHatch("Any Radiation Absorbent Casing", 1)
+ .addEnergyHatch("Any Radiation Absorbent Casing", 1)
.toolTipFinisher("GregTech");
return tt;
}
@@ -324,9 +383,20 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
mCasingAmount = 0;
mEnergyHatches.clear();
+ mExoticEnergyHatches.clear();
+ spacetimeHatches.clear();
if (!checkPiece(STRUCTURE_PIECE_MAIN, 17, 27, 10)) return false;
- if (mCasingAmount < 0) return false;
+ if (mCasingAmount < 950) return false;
+
+ if (!mExoticEnergyHatches.isEmpty()) {
+ if (mExoticEnergyHatches.size() > 1) return false;
+ energyHatchTier = mExoticEnergyHatches.get(0).mTier;
+ } else if (!mEnergyHatches.isEmpty()) {
+ byte tier = mEnergyHatches.get(0).mTier;
+ for (MTEHatchEnergy hatch : mEnergyHatches) if (hatch.mTier < tier) tier = hatch.mTier;
+ energyHatchTier = tier;
+ }
return true;
}
@@ -334,19 +404,21 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
- aNBT.setInteger("catalyzingCostModifier", catalyzingCostModifier);
- aNBT.setInteger("catalyzingCounter", catalyzingCounter);
- aNBT.setBoolean("blackholeOn", blackholeOn);
- aNBT.setFloat("blackholeStability", blackHoleStability);
+ if (aNBT.hasKey("catalyzingCounter")) catalyzingCounter = aNBT.getInteger("catalyzingCounter");
+ if (aNBT.hasKey("catalyzingCostModifier")) catalyzingCostModifier = aNBT.getInteger("catalyzingCostModifier");
+ if (aNBT.hasKey("blackHoleStatus")) blackHoleStatus = aNBT.getByte("blackHoleStatus");
+ if (aNBT.hasKey("blackHoleStability")) blackHoleStability = aNBT.getFloat("blackHoleStability");
+ if (aNBT.hasKey("shouldRender")) shouldRender = aNBT.getBoolean("shouldRender");
}
@Override
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
- if (aNBT.hasKey("catalyzingCounter")) catalyzingCostModifier = aNBT.getInteger("catalyzingCounter");
- if (aNBT.hasKey("catalyzingCostModifier")) catalyzingCostModifier = aNBT.getInteger("catalyzingCostModifier");
- if (aNBT.hasKey("blackholeOn")) blackholeOn = aNBT.getBoolean("blackholeOn");
- if (aNBT.hasKey("blackholeStability")) blackHoleStability = aNBT.getFloat("blackholeStability");
+ aNBT.setInteger("catalyzingCounter", catalyzingCounter);
+ aNBT.setInteger("catalyzingCostModifier", catalyzingCostModifier);
+ aNBT.setByte("blackHoleStatus", blackHoleStatus);
+ aNBT.setFloat("blackHoleStability", blackHoleStability);
+ aNBT.setBoolean("shouldRender", shouldRender);
}
@Override
@@ -359,7 +431,7 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y,
int z) {
super.getWailaNBTData(player, tile, tag, world, x, y, z);
- tag.setBoolean("blackholeOn", blackholeOn);
+ tag.setByte("blackHoleStatus", blackHoleStatus);
tag.setFloat("blackHoleStability", blackHoleStability);
}
@@ -368,7 +440,7 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
IWailaConfigHandler config) {
super.getWailaBody(itemStack, currentTip, accessor, config);
final NBTTagCompound tag = accessor.getNBTData();
- if (tag.getBoolean("blackholeOn")) {
+ if (tag.getByte("blackHoleStatus") != 1) {
if (tag.getFloat("blackHoleStability") > 0) {
currentTip.add(EnumChatFormatting.DARK_PURPLE + "Black Hole Active");
currentTip.add(
@@ -382,6 +454,8 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
} else currentTip.add(EnumChatFormatting.DARK_PURPLE + "Black Hole Offline");
}
+ byte energyHatchTier = 0;
+
@Override
protected ProcessingLogic createProcessingLogic() {
return new ProcessingLogic() {
@@ -394,15 +468,18 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
// Deactivation resets stability to 100 and catalyzing cost to 1
for (ItemStack inputItem : inputItems) {
if (inputItem.getItem() instanceof MetaGeneratedItem01) {
- if (inputItem.getItemDamage() == 32418 && !blackholeOn) {