more exposure chamber crap

This commit is contained in:
Bob 2023-12-03 20:23:51 +01:00
parent f8e9cff64b
commit 1157e691d7
9 changed files with 159 additions and 14 deletions

View File

@ -23,7 +23,8 @@
* Non-custom missiles have been slightly buffed
* Explosions are now slightly larger and they use the new cross-detection entity damage code which still affects entities behind small hills that would otherwise be shielded
* Explosions now have a 2x larger entity damage radius
* Updated the digiminer recipe for mekanism cocmpat
* Updated the digiminer recipe for mekanism compat
* Added config options to the ground water pumps
## Fixed
* Fixed ancient bug where custom missiles launched using the launch table would not use the accuracy calculation and always be pin-point accurate

View File

@ -63,7 +63,7 @@ public class ContainerMachineExposureChamber extends Container {
return null;
}
} else {
if(!this.mergeItemStack(var5, 0, 2, false)) {
if(!this.mergeItemStack(var5, 0, 3, false)) {
return null;
}
}

View File

@ -28,7 +28,9 @@ public class GUIMachineExposureChamber extends GuiInfoContainer {
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 52, chamber.power, chamber.maxPower);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 34, chamber.power, chamber.maxPower);
drawCustomInfoStat(mouseX, mouseY, guiLeft + 26, guiTop + 36, 9, 16, mouseX, mouseY, chamber.savedParticles + " / " + chamber.maxParticles);
}
@Override
@ -43,5 +45,18 @@ public class GUIMachineExposureChamber extends GuiInfoContainer {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int p = chamber.progress * 42 / (chamber.processTime + 1);
drawTexturedModalRect(guiLeft + 36, guiTop + 39, 192, 0, p, 10);
int c = chamber.savedParticles * 16 / chamber.maxParticles;
drawTexturedModalRect(guiLeft + 26, guiTop + 52 - c, 192, 26 - c, 9, c);
int e = (int) (chamber.power * 34 / chamber.maxPower);
drawTexturedModalRect(guiLeft + 152, guiTop + 52 - e, 176, 34 - e, 16, e);
if(chamber.consumption <= chamber.power) {
drawTexturedModalRect(guiLeft + 156, guiTop + 4, 176, 34, 9, 12);
}
}
}

View File

@ -27,6 +27,11 @@ public class ExposureChamberRecipes extends SerializableRecipe {
recipes.add(new ExposureChamberRecipe(new ComparableStack(ModItems.particle_dark), new OreDictStack(PU.ingot()), new ItemStack(ModItems.ingot_euphemium)));
recipes.add(new ExposureChamberRecipe(new ComparableStack(ModItems.particle_sparkticle), new OreDictStack(SBD.ingot()), new ItemStack(ModItems.ingot_dineutronium)));
}
public static ExposureChamberRecipe getRecipe(ItemStack particle, ItemStack input) {
for(ExposureChamberRecipe recipe : recipes) if(recipe.particle.matchesRecipe(particle, true) && recipe.ingredient.matchesRecipe(input, true)) return recipe;
return null;
}
@Override
public String getFileName() {

View File

@ -328,9 +328,8 @@ public abstract class DoorDecl {
@Override
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open) {
if(open) {
if(y == 0)
return AxisAlignedBB.getBoundingBox(0, 0, 1 - 0.25, 1, 0.125, 1);
return super.getBlockBound(x, y, z, open);
if(y == 0) return AxisAlignedBB.getBoundingBox(0, 0, 1 - 0.25, 1, 0, 1);
return AxisAlignedBB.getBoundingBox(0, 0.9375, 1 - 0.25, 1, 1, 1);
} else {
return AxisAlignedBB.getBoundingBox(0, 0, 1 - 0.25, 1, 1, 1);
}

View File

@ -1,7 +1,12 @@
package com.hbm.tileentity.machine;
import com.hbm.inventory.UpgradeManager;
import com.hbm.inventory.container.ContainerMachineExposureChamber;
import com.hbm.inventory.gui.GUIMachineExposureChamber;
import com.hbm.inventory.recipes.ExposureChamberRecipes;
import com.hbm.inventory.recipes.ExposureChamberRecipes.ExposureChamberRecipe;
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
import com.hbm.lib.Library;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
@ -11,6 +16,7 @@ import io.netty.buffer.ByteBuf;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
@ -22,6 +28,10 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl
public int progress;
public static final int processTimeBase = 200;
public int processTime = processTimeBase;
public static final int consumptionBase = 10_000;
public int consumption = consumptionBase;
public int savedParticles;
public static final int maxParticles = 8;
public boolean isOn = false;
public float rotation;
public float prevRotation;
@ -50,6 +60,81 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl
if(!worldObj.isRemote) {
this.isOn = false;
this.power = Library.chargeTEFromItems(slots, 5, power, maxPower);
UpgradeManager.eval(slots, 6, 7);
int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
int overdriveLevel = Math.min(UpgradeManager.getLevel(UpgradeType.OVERDRIVE), 3);
this.consumption = this.consumptionBase;
this.processTime = this.processTimeBase - this.processTimeBase / 4 * speedLevel;
this.consumption *= (speedLevel / 2 + 1);
this.processTime *= (powerLevel / 2 + 1);
this.consumption /= (powerLevel + 1);
this.processTime /= (overdriveLevel + 1);
this.consumption *= (overdriveLevel * 2 + 1);
if(slots[1] == null && slots[0] != null && slots[3] != null && this.savedParticles <= 0) {
ExposureChamberRecipe recipe = this.getRecipe(slots[0], slots[3]);
if(recipe != null) {
ItemStack container = slots[0].getItem().getContainerItem(slots[0]);
boolean canStore = false;
if(container == null) {
canStore = true;
} else if(slots[2] == null) {
slots[2] = container.copy();
canStore = true;
} else if(slots[2].getItem() == container.getItem() && slots[2].getItemDamage() == container.getItemDamage() && slots[2].stackSize < slots[2].getMaxStackSize()) {
slots[2].stackSize++;
canStore = true;
}
if(canStore) {
slots[1] = slots[0].copy();
slots[1].stackSize = 0;
this.decrStackSize(0, 1);
this.savedParticles = this.maxParticles;
}
}
}
if(slots[1] != null && this.savedParticles > 0 && this.power >= this.consumption) {
ExposureChamberRecipe recipe = this.getRecipe(slots[1], slots[3]);
if(recipe != null && (slots[4] == null || (slots[4].getItem() == recipe.output.getItem() && slots[4].getItemDamage() == recipe.output.getItemDamage() && slots[4].stackSize + recipe.output.stackSize <= slots[4].getMaxStackSize()))) {
this.progress++;
this.power -= this.consumption;
this.isOn = true;
if(this.progress >= this.processTime) {
this.progress = 0;
this.savedParticles--;
this.decrStackSize(3, 1);
if(slots[4] == null) {
slots[4] = recipe.output.copy();
} else {
slots[4].stackSize += recipe.output.stackSize;
}
}
} else {
this.progress = 0;
}
} else {
this.progress = 0;
}
if(this.savedParticles <= 0) {
slots[1] = null;
}
this.networkPackNT(50);
} else {
@ -66,12 +151,19 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl
}
}
}
public ExposureChamberRecipe getRecipe(ItemStack particle, ItemStack ingredient) {
return ExposureChamberRecipes.getRecipe(particle, ingredient);
}
@Override
public void serialize(ByteBuf buf) {
buf.writeBoolean(this.isOn);
buf.writeInt(this.progress);
buf.writeInt(this.processTime);
buf.writeInt(this.consumption);
buf.writeLong(this.power);
buf.writeByte((byte) this.savedParticles);
}
@Override
@ -79,6 +171,9 @@ public class TileEntityMachineExposureChamber extends TileEntityMachineBase impl
this.isOn = buf.readBoolean();
this.progress = buf.readInt();
this.processTime = buf.readInt();
this.consumption = buf.readInt();
this.power = buf.readLong();
this.savedParticles = buf.readByte();
}
AxisAlignedBB bb = null;

View File

@ -1,11 +1,15 @@
package com.hbm.tileentity.machine;
import java.io.IOException;
import java.util.HashSet;
import com.google.gson.JsonObject;
import com.google.gson.stream.JsonWriter;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.IConfigurableMachine;
import com.hbm.tileentity.INBTPacketReceiver;
import com.hbm.tileentity.TileEntityLoadedBase;
import com.hbm.util.fauxpointtwelve.DirPos;
@ -18,8 +22,8 @@ import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase implements IFluidStandardTransceiver, INBTPacketReceiver {
public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase implements IFluidStandardTransceiver, INBTPacketReceiver, IConfigurableMachine {
public static final HashSet<Block> validBlocks = new HashSet();
static {
@ -41,6 +45,32 @@ public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase imp
public float lastRotor;
public boolean onGround = false;
public int groundCheckDelay = 0;
public static int groundHeight = 70;
public static int groundDepth = 4;
public static int steamSpeed = 1_000;
public static int electricSpeed = 10_000;
@Override
public String getConfigName() {
return "waterpump";
}
@Override
public void readIfPresent(JsonObject obj) {
groundHeight = IConfigurableMachine.grab(obj, "I:groundHeight", groundHeight);
groundDepth = IConfigurableMachine.grab(obj, "I:groundDepth", groundDepth);
steamSpeed = IConfigurableMachine.grab(obj, "I:steamSpeed", steamSpeed);
electricSpeed = IConfigurableMachine.grab(obj, "I:electricSpeed", electricSpeed);
}
@Override
public void writeConfig(JsonWriter writer) throws IOException {
writer.name("I:groundHeight").value(groundHeight);
writer.name("I:groundDepth").value(groundDepth);
writer.name("I:steamSpeed").value(steamSpeed);
writer.name("I:electricSpeed").value(electricSpeed);
}
public void updateEntity() {
@ -57,7 +87,7 @@ public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase imp
}
this.isOn = false;
if(this.canOperate() && yCoord <= 70 && onGround) {
if(this.canOperate() && yCoord <= groundHeight && onGround) {
this.isOn = true;
this.operate();
}
@ -88,7 +118,7 @@ public abstract class TileEntityMachinePumpBase extends TileEntityLoadedBase imp
int invalidBlocks = 0;
for(int x = -1; x <= 1; x++) {
for(int y = -1; y >= -4; y--) {
for(int y = -1; y >= -groundDepth; y--) {
for(int z = -1; z <= 1; z++) {
Block b = worldObj.getBlock(xCoord + x, yCoord + y, zCoord + z);

View File

@ -14,7 +14,7 @@ public class TileEntityMachinePumpElectric extends TileEntityMachinePumpBase imp
public TileEntityMachinePumpElectric() {
super();
water = new FluidTank(Fluids.WATER, 1_000_000);
water = new FluidTank(Fluids.WATER, electricSpeed * 100);
}
public void updateEntity() {
@ -49,7 +49,7 @@ public class TileEntityMachinePumpElectric extends TileEntityMachinePumpBase imp
@Override
protected void operate() {
this.power -= 1_000;
water.setFill(Math.min(water.getFill() + 10_000, water.getMaxFill()));
water.setFill(Math.min(water.getFill() + electricSpeed, water.getMaxFill()));
}
@Override

View File

@ -13,7 +13,7 @@ public class TileEntityMachinePumpSteam extends TileEntityMachinePumpBase {
public TileEntityMachinePumpSteam() {
super();
water = new FluidTank(Fluids.WATER, 100_000);
water = new FluidTank(Fluids.WATER, steamSpeed * 100);
steam = new FluidTank(Fluids.STEAM, 1_000);
lps = new FluidTank(Fluids.SPENTSTEAM, 10);
}
@ -71,6 +71,6 @@ public class TileEntityMachinePumpSteam extends TileEntityMachinePumpBase {
protected void operate() {
steam.setFill(steam.getFill() - 100);
lps.setFill(lps.getFill() + 1);
water.setFill(Math.min(water.getFill() + 1000, water.getMaxFill()));
water.setFill(Math.min(water.getFill() + steamSpeed, water.getMaxFill()));
}
}