Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Immersive Deuterium #94

Merged
merged 7 commits into from
Feb 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/main/java/mekanism/api/MekanismConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ public static class general
public static double heatPerFuelTick = 4;
public static boolean allowTransmitterAlloyUpgrade;
public static boolean allowProtection = true;
public static boolean accurateHeavyWaterCapture = true;
public static int heavyWaterChance = 4;

public static boolean EnableQuartzCompat;
public static boolean EnableDiamondCompat;
public static boolean EnablePoorOresCompat;
Expand Down Expand Up @@ -136,9 +139,9 @@ public static class usage
public static double pressurizedReactionBaseUsage;
public static double fluidicPlenisherUsage;
public static double laserUsage;
public static double gasCentrifugeUsage;
public static double heavyWaterElectrolysisUsage;
public static double formulaicAssemblicatorUsage;
public static double gasCentrifugeUsage;
}

public static class generators
Expand Down
34 changes: 30 additions & 4 deletions src/main/java/mekanism/api/gas/GasifyableItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import net.minecraft.item.ItemStack;

import java.util.ArrayList;
import java.util.Collection;

import java.util.HashMap;
import java.util.List;

Expand All @@ -13,13 +13,33 @@ public class GasifyableItems {
static HashMap<String, GasStack> gasifyableItems = new HashMap<String, GasStack>();
static List<Gas> validGases = new ArrayList<>();

public static void registerGasifyables(String oredict, Gas gas, Integer quantity) {
GasStack gasifyEntry = new GasStack(gas, quantity);
/**
* Registers a new item to gas conversion at a Chemical Injection Chamber.
* @param oredict - oredicted item to add
* @param gas gas output from oredict item
* @param amount amount to create
*/
public static void registerGasifyables(String oredict, Gas gas, Integer amount) {
GasStack gasifyEntry = new GasStack(gas, amount);

if (oredict != null)
gasifyableItems.put(oredict, gasifyEntry);
validGases.add(gas);
}

gasifyableItems.put(oredict, gasifyEntry);
/**
* Registers a new gas to be used at the Chemical Injection Chamber.
* @param gas gases that can be used and accepted
*/
public static void registerGasifyables(Gas gas) {
validGases.add(gas);
}

/**
* Returns gas associated to that item's oredict.
* @param itemstack to be converted to gas
* @return Gas output
*/
public static GasStack getGasFromItem(ItemStack itemstack) {

List<String> oredict = MekanismUtils.getOreDictName(itemstack);
Expand All @@ -31,6 +51,12 @@ public static GasStack getGasFromItem(ItemStack itemstack) {
return null;
}


/**
* defines which gases the Chemical Injection Chamber can accept.
* @param gas type of gas to check validity
* @return if block accepts gas
*/
public static boolean isGasValidGasifyable(Gas gas) {
return validGases.contains(gas);
}
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/mekanism/client/gui/GuiElectrolyticSeparator.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ public FluidTank getTank()
return tileEntity.fluidTank;
}
}, GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 5, 10));
if (tileEntity.hasFilter())
guiElements.add(new GuiFluidGauge(new IFluidInfoHandler() {
@Override
public FluidTank getTank()
{
return tileEntity.extraTank;
}
}, GuiGauge.Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 142, 18));
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
@Override
public GasTank getTank()
Expand All @@ -88,7 +96,7 @@ public GasTank getTank()
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 25, 34));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 58, 51));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 100, 51));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 142, 34).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 142, tileEntity.hasFilter() ? 51 : 34).with(SlotOverlay.POWER));

guiElements.add(new GuiProgress(new IProgressInfoHandler()
{
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/mekanism/common/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,10 @@ public void loadConfiguration()
general.heatPerFuelTick = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "HeatPerFuelTick", 4D).getDouble();
general.allowTransmitterAlloyUpgrade = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AllowTransmitterAlloyUpgrade", true).getBoolean();
general.allowProtection = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AllowProtection", true).getBoolean();

general.accurateHeavyWaterCapture = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AccurateHeavyWater", false).getBoolean();
general.heavyWaterChance = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AccurateHeavyWaterGen", 5).getInt();


general.blacklistIC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistIC2Power", false).getBoolean();
general.blacklistRF = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistRFPower", false).getBoolean();

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/mekanism/common/Mekanism.java
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,8 @@ public void preInit(FMLPreInitializationEvent event)
GasifyableItems.registerGasifyables("dustSugar", GasRegistry.getGas("molasse"), 90);
GasifyableItems.registerGasifyables("listAllSugar", GasRegistry.getGas("molasse"), 90);

GasifyableItems.registerGasifyables(GasRegistry.getGas("water"));

Mekanism.proxy.preInit();

//Register blocks and items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public ContainerElectrolyticSeparator(InventoryPlayer inventory, TileEntityElect
addSlotToContainer(new Slot(tentity, 0, 26, 35));
addSlotToContainer(new SlotStorageTank(tentity, 1, 59, 52));
addSlotToContainer(new SlotStorageTank(tentity, 2, 101, 52));
addSlotToContainer(new SlotDischarge(tentity, 3, 143, 35));
addSlotToContainer(new SlotDischarge(tentity, 3, 143, tileEntity.hasFilter() ? 51 : 34));

int slotY;

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/mekanism/common/network/PacketConfigSync.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public void toBytes(ByteBuf dataStream)
dataStream.writeDouble(general.heatPerFuelTick);
dataStream.writeBoolean(general.allowTransmitterAlloyUpgrade);
dataStream.writeBoolean(general.allowProtection);
dataStream.writeBoolean(general.accurateHeavyWaterCapture);
dataStream.writeInt(general.heavyWaterChance);
dataStream.writeBoolean(general.EnableQuartzCompat);
dataStream.writeBoolean(general.EnableDiamondCompat);
dataStream.writeBoolean(general.EnablePoorOresCompat);
Expand Down Expand Up @@ -268,6 +270,8 @@ public void fromBytes(ByteBuf dataStream)
general.heatPerFuelTick = dataStream.readDouble();
general.allowTransmitterAlloyUpgrade = dataStream.readBoolean();
general.allowProtection = dataStream.readBoolean();
general.accurateHeavyWaterCapture = dataStream.readBoolean();
general.heavyWaterChance = dataStream.readInt();
general.EnableQuartzCompat = dataStream.readBoolean();
general.EnableDiamondCompat = dataStream.readBoolean();
general.EnablePoorOresCompat = dataStream.readBoolean();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ public boolean canTubeConnect(ForgeDirection side)
@Override
public boolean isValidGas(Gas gas)
{
return (gas == GasRegistry.getGas("water") || GasifyableItems.isGasValidGasifyable(gas));

return GasifyableItems.isGasValidGasifyable(gas);

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ public TileEntityElectricPump()
{
super("ElectricPump", 10000);
inventory = new ItemStack[4];

upgradeComponent.setSupported(Upgrade.FILTER);

if (!general.accurateHeavyWaterCapture)
upgradeComponent.setSupported(Upgrade.FILTER);
}

@Override
Expand Down Expand Up @@ -160,7 +161,9 @@ else if(FluidContainerRegistry.isEmptyContainer(inventory[0]))

public boolean hasFilter()
{
return upgradeComponent.getInstalledTypes().contains(Upgrade.FILTER);
if (!general.accurateHeavyWaterCapture)
return upgradeComponent.getInstalledTypes().contains(Upgrade.FILTER);
return false;
}

public boolean suck(boolean take)
Expand Down