mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge remote-tracking branch 'HbmMods/master'
# Conflicts: # changelog
This commit is contained in:
commit
5c9f78f8a2
45
changelog
45
changelog
@ -1,4 +1,47 @@
|
||||
## Added
|
||||
* Glpyhids
|
||||
* Hives will spawn randomly in the world
|
||||
* Hives will constantly spawn new glyphids
|
||||
* If explosed to soot, hives will create glyphid scouts, which when far enough from another hive will explode and generate a new hive
|
||||
* Higher soot levels create stronger glyphids
|
||||
* Glyphids possess armor which has a chance of breaking off and fully abrosrbing damage
|
||||
* Each glyphid has five armor plates
|
||||
* Glyphid types include multiple tiers of melee glyphids as well as a few ranged ones, the scout, and a nuclear variant
|
||||
* Compressor
|
||||
* Can compress fluids, turning them into higher pressure variants
|
||||
* Can also turn steam into higher pressure types
|
||||
* A new rocket artillery ammo type that creates volcanic lava on impact
|
||||
* BDCL
|
||||
* A type of lubricant that is easy to make and can be used in hydraulic piston and electric press recipes instead of regular lubricant
|
||||
* FBI drones
|
||||
* A configurable amount of drones can now spawn during FBI raids
|
||||
* They will hover over players, dropping bombs
|
||||
* Sliding Blast Door from 1.12.2
|
||||
* Night Vision Goggles armor upgrade
|
||||
* Grenade of Cats
|
||||
* Grenade of Cats
|
||||
|
||||
## Changed
|
||||
* Updated russian localization
|
||||
* Fluid traits can now be configured, any fluid can now have any fluid with variable stats assigned to them
|
||||
* Large explosions now load the central chunk they are in, this can be disabled in the config
|
||||
* Burning leaded fuels now releases poisonous heavy metals into the atmosphere
|
||||
* The pollution detector now displays rounded values
|
||||
* More machines and especially destroyed ones now release soot
|
||||
* The iGen has been rebalanced again, delete your machine config file for the changes to take effect
|
||||
* The lubrican power multiplier has been increased from 1.1 to 1.5
|
||||
* The fluid divisor has been lowered from 5,000 to 1,000, meaning the iGen now burns flammable liquids at full efficiency
|
||||
* Removed the config for having an additional keybind for dashing, the keybind is now always active since it no longer conflicts with crouching
|
||||
* Crucible recipes no longer use foundry scraps to visualize the recipes, instead they use a lava-like texture
|
||||
* Fusion reactors are now made from welded magnets which are created by weling a cast steel plate onto a magnet
|
||||
* Due to the cost of the cast plates, fusion reactor magnets are now cheaper to compensate
|
||||
* Consequently, particle accelerators are now also cheaper due to being made from mostly fusion reactor magnets
|
||||
* The blowtorch now consumes only 250mB per operation, allowing for up to 16 things to be welded with a single fill
|
||||
* The page and notebook items have been replaced with more dynamic book items that get their data from NBT
|
||||
* C4 can now be made by irradiating PVC
|
||||
* Play stupid games, win stupid prizes
|
||||
|
||||
## Fixed
|
||||
* Fixed potential crash or logspam regarding the pollution handler
|
||||
* Fixed missiles leaving behind a 3x3 grid of loaded chunks after being destroyed
|
||||
* Fixed coal ore yielding coal in the crucible instead of making carbon
|
||||
* Fixed a potential issue where BuildCraft generators can't supply the RF to HE converter
|
||||
@ -26,7 +26,7 @@ public interface IFluidStandardTransceiver extends IFluidUser {
|
||||
public default long getTotalFluidForSend(FluidType type, int pressure) {
|
||||
|
||||
for(FluidTank tank : getSendingTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
if(tank.getTankType() == type && tank.getPressure() == pressure) {
|
||||
return tank.getFill();
|
||||
}
|
||||
}
|
||||
@ -38,7 +38,7 @@ public interface IFluidStandardTransceiver extends IFluidUser {
|
||||
public default void removeFluidForTransfer(FluidType type, int pressure, long amount) {
|
||||
|
||||
for(FluidTank tank : getSendingTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
if(tank.getTankType() == type && tank.getPressure() == pressure) {
|
||||
tank.setFill(tank.getFill() - (int) amount);
|
||||
return;
|
||||
}
|
||||
@ -49,7 +49,7 @@ public interface IFluidStandardTransceiver extends IFluidUser {
|
||||
public default long getDemand(FluidType type, int pressure) {
|
||||
|
||||
for(FluidTank tank : getReceivingTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
if(tank.getTankType() == type && tank.getPressure() == pressure) {
|
||||
return tank.getMaxFill() - tank.getFill();
|
||||
}
|
||||
}
|
||||
@ -61,7 +61,7 @@ public interface IFluidStandardTransceiver extends IFluidUser {
|
||||
public default long transferFluid(FluidType type, int pressure, long amount) {
|
||||
|
||||
for(FluidTank tank : getReceivingTanks()) {
|
||||
if(tank.getTankType() == type) {
|
||||
if(tank.getTankType() == type && tank.getPressure() == pressure) {
|
||||
tank.setFill(tank.getFill() + (int) amount);
|
||||
|
||||
if(tank.getFill() > tank.getMaxFill()) {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCompressor;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@ -18,6 +20,7 @@ public class MachineCompressor extends BlockDummyable {
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityMachineCompressor();
|
||||
if(meta >= extra) return new TileEntityProxyCombo().fluid().power();
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -39,11 +42,25 @@ public class MachineCompressor extends BlockDummyable {
|
||||
|
||||
@Override
|
||||
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
return super.checkRequirement(world, x, y, z, dir, o);
|
||||
return super.checkRequirement(world, x, y, z, dir, o) &&
|
||||
MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, -3, 1, 1, 1, 1}, x, y, z, dir) &&
|
||||
MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {8, -4, 0, 0, 1, 1}, x, y, z, dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
|
||||
super.fillSpace(world, x, y, z, dir, o);
|
||||
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, -3, 1, 1, 1, 1}, this, dir);
|
||||
MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {8, -4, 0, 0, 1, 1}, this, dir);
|
||||
|
||||
x += dir.offsetX * o;
|
||||
z += dir.offsetZ * o;
|
||||
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
this.makeExtra(world, x - dir.offsetX, y, z - dir.offsetZ);
|
||||
this.makeExtra(world, x + rot.offsetX, y, z + rot.offsetZ);
|
||||
this.makeExtra(world, x - rot.offsetX, y, z - rot.offsetZ);
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,6 +44,9 @@ public class FluidTank {
|
||||
}
|
||||
|
||||
public FluidTank withPressure(int pressure) {
|
||||
|
||||
if(this.pressure != pressure) this.setFill(0);
|
||||
|
||||
this.pressure = pressure;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -4,21 +4,25 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerCompressor;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.NBTControlPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCompressor;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUICompressor extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_compressor.png");
|
||||
private TileEntityMachineCompressor solidifier;
|
||||
private TileEntityMachineCompressor compressor;
|
||||
|
||||
public GUICompressor(InventoryPlayer invPlayer, TileEntityMachineCompressor tedf) {
|
||||
super(new ContainerCompressor(invPlayer, tedf));
|
||||
solidifier = tedf;
|
||||
compressor = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 204;
|
||||
@ -28,14 +32,31 @@ public class GUICompressor extends GuiInfoContainer {
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
//solidifier.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 35, guiTop + 36, 16, 52);
|
||||
//this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 18, 16, 52, solidifier.power, solidifier.maxPower);
|
||||
compressor.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 17, guiTop + 18, 16, 52);
|
||||
compressor.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 107, guiTop + 18, 16, 52);
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 52, compressor.power, compressor.maxPower);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
for(int j = 0; j < 5; j++) {
|
||||
|
||||
if(guiLeft + 43 + j * 11 <= x && guiLeft + 43 + 8 + j * 11 > x && guiTop + 46 < y && guiTop + 46 + 14 >= y) {
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("compression", j);
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, compressor.xCoord, compressor.yCoord, compressor.zCoord));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
|
||||
String name = this.solidifier.hasCustomInventoryName() ? this.solidifier.getInventoryName() : I18n.format(this.solidifier.getInventoryName());
|
||||
String name = this.compressor.hasCustomInventoryName() ? this.compressor.getInventoryName() : I18n.format(this.compressor.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, 70 - this.fontRendererObj.getStringWidth(name) / 2, 6, 0xC7C1A3);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
@ -46,5 +67,17 @@ public class GUICompressor extends GuiInfoContainer {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
if(compressor.power >= 1_000) {
|
||||
drawTexturedModalRect(guiLeft + 156, guiTop + 4, 176, 52, 9, 12);
|
||||
}
|
||||
|
||||
drawTexturedModalRect(guiLeft + 43 + compressor.tanks[0].getPressure() * 11, guiTop + 46, 193, 18, 8, 124);
|
||||
|
||||
int i = compressor.progress * 55 / compressor.processTime;
|
||||
drawTexturedModalRect(guiLeft + 42, guiTop + 26, 192, 0, i, 17);
|
||||
|
||||
compressor.tanks[0].renderTank(guiLeft + 17, guiTop + 70, this.zLevel, 16, 52);
|
||||
compressor.tanks[1].renderTank(guiLeft + 107, guiTop + 70, this.zLevel, 16, 52);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,11 +2,14 @@ package com.hbm.inventory.recipes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.recipes.loader.SerializableRecipe;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
|
||||
@ -16,7 +19,9 @@ public class CompressorRecipes extends SerializableRecipe {
|
||||
|
||||
@Override
|
||||
public void registerDefaults() {
|
||||
|
||||
recipes.put(new Pair(Fluids.STEAM, 0), new CompressorRecipe(1_000, new FluidStack(Fluids.HOTSTEAM, 100)));
|
||||
recipes.put(new Pair(Fluids.HOTSTEAM, 0), new CompressorRecipe(1_000, new FluidStack(Fluids.SUPERHOTSTEAM, 100)));
|
||||
recipes.put(new Pair(Fluids.SUPERHOTSTEAM, 0), new CompressorRecipe(1_000, new FluidStack(Fluids.ULTRAHOTSTEAM, 100)));
|
||||
}
|
||||
|
||||
public static class CompressorRecipe {
|
||||
@ -47,11 +52,21 @@ public class CompressorRecipes extends SerializableRecipe {
|
||||
|
||||
@Override
|
||||
public void readRecipe(JsonElement recipe) {
|
||||
JsonObject obj = recipe.getAsJsonObject();
|
||||
|
||||
FluidStack input = this.readFluidStack(obj.get("input").getAsJsonArray());
|
||||
FluidStack output = this.readFluidStack(obj.get("output").getAsJsonArray());
|
||||
|
||||
recipes.put(new Pair(input.type, input.pressure), new CompressorRecipe(input.fill, output));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRecipe(Object recipe, JsonWriter writer) throws IOException {
|
||||
Entry<Pair<FluidType, Integer>, CompressorRecipe> entry = (Entry) recipe;
|
||||
|
||||
writer.name("input");
|
||||
this.writeFluidStack(new FluidStack(entry.getKey().getKey(), entry.getValue().inputAmount, entry.getKey().getValue()), writer);
|
||||
writer.name("output");
|
||||
this.writeFluidStack(entry.getValue().output, writer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,6 +56,8 @@ public class OutgasserRecipes extends SerializableRecipe {
|
||||
recipes.put(new OreDictStack(COAL.gem()), new Pair(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.COAL, 1), new FluidStack(Fluids.SYNGAS, 50)));
|
||||
recipes.put(new OreDictStack(COAL.dust()), new Pair(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.COAL, 1), new FluidStack(Fluids.SYNGAS, 50)));
|
||||
recipes.put(new OreDictStack(COAL.block()), new Pair(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.COAL, 9), new FluidStack(Fluids.SYNGAS, 500)));
|
||||
|
||||
recipes.put(new OreDictStack(PVC.ingot()), new Pair(new ItemStack(ModItems.ingot_c4), new FluidStack(Fluids.COLLOID, 250)));
|
||||
|
||||
recipes.put(new ComparableStack(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.COAL)), new Pair(null, new FluidStack(Fluids.COALOIL, 100)));
|
||||
recipes.put(new ComparableStack(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.WAX)), new Pair(null, new FluidStack(Fluids.RADIOSOLVENT, 100)));
|
||||
|
||||
@ -1,177 +0,0 @@
|
||||
package com.hbm.inventory.recipes.loader;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.inventory.RecipesCommon.AStack;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.RecipesCommon.OreDictStack;
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
@Deprecated
|
||||
public abstract class JSONLoaderBase {
|
||||
|
||||
public File config;
|
||||
public File template;
|
||||
private final Gson gson = new Gson();
|
||||
|
||||
public JSONLoaderBase() {
|
||||
|
||||
}
|
||||
|
||||
public void loadRecipes() {
|
||||
registerDefaults();
|
||||
//saveTemplateJSON(template);
|
||||
|
||||
if(config != null) {
|
||||
loadJSONRecipes();
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void registerDefaults();
|
||||
|
||||
protected void loadJSONRecipes() {
|
||||
|
||||
try {
|
||||
JsonObject json = gson.fromJson(new FileReader(config), JsonObject.class);
|
||||
JsonElement recipes = json.get("recipes");
|
||||
|
||||
if(recipes instanceof JsonArray) {
|
||||
|
||||
JsonArray recArray = recipes.getAsJsonArray();
|
||||
for(JsonElement recipe : recArray) {
|
||||
|
||||
if(recipe.isJsonObject()) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) { }
|
||||
}
|
||||
|
||||
protected static AStack aStackFromArray(JsonArray array) {
|
||||
|
||||
boolean dict = false;
|
||||
String item = "";
|
||||
int stacksize = 1;
|
||||
int meta = 0;
|
||||
|
||||
if(array.size() < 2)
|
||||
return null;
|
||||
|
||||
/*
|
||||
* EVAL "dict" OR "item"
|
||||
*/
|
||||
if(array.get(0).isJsonPrimitive()) {
|
||||
|
||||
if(array.get(0).getAsString().equals("item")) {
|
||||
dict = false;
|
||||
} else if(array.get(0).getAsString().equals("dict")) {
|
||||
dict = true;
|
||||
} else {
|
||||
MainRegistry.logger.error("Error reading recipe, stack array does not have 'item' or 'dict' label!");
|
||||
return null;
|
||||
}
|
||||
|
||||
} else {
|
||||
MainRegistry.logger.error("Error reading recipe, label is not a valid data type!");
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* EVAL NAME
|
||||
*/
|
||||
if(array.get(1).isJsonPrimitive()) {
|
||||
item = array.get(1).getAsString();
|
||||
} else {
|
||||
MainRegistry.logger.error("Error reading recipe, item string is not a valid data type!");
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* EVAL STACKSIZE
|
||||
*/
|
||||
if(array.size() > 2 && array.get(2).isJsonPrimitive()) {
|
||||
if(array.get(2).getAsJsonPrimitive().isNumber()) {
|
||||
stacksize = Math.max(1, array.get(2).getAsJsonPrimitive().getAsNumber().intValue());
|
||||
} else {
|
||||
MainRegistry.logger.error("Error reading recipe, stack size is not a valid data type!");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* RESOLVE OREDICT
|
||||
*/
|
||||
if(dict) {
|
||||
|
||||
if(OreDictionary.doesOreNameExist(item)) {
|
||||
return new OreDictStack(item, stacksize);
|
||||
} else {
|
||||
|
||||
MainRegistry.logger.error("Error reading recipe, ore dict name does not exist!");
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* RESOLVE COMPARABLE
|
||||
*/
|
||||
} else {
|
||||
|
||||
/*
|
||||
* EVAL META
|
||||
*/
|
||||
if(array.size() > 3 && array.get(3).isJsonPrimitive()) {
|
||||
if(array.get(3).getAsJsonPrimitive().isNumber()) {
|
||||
meta = Math.max(0, array.get(3).getAsJsonPrimitive().getAsNumber().intValue());
|
||||
} else {
|
||||
MainRegistry.logger.error("Error reading recipe, metadata is not a valid data type!");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Item it = (Item)Item.itemRegistry.getObject(item);
|
||||
if(it == null) {
|
||||
MainRegistry.logger.error("Item could not be found!");
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ComparableStack(it, stacksize, meta);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void writeAStack(AStack astack, JsonWriter writer) throws IOException {
|
||||
|
||||
writer.beginArray();
|
||||
writer.setIndent("");
|
||||
|
||||
if(astack instanceof ComparableStack) {
|
||||
ComparableStack comp = (ComparableStack) astack;
|
||||
|
||||
writer.value("item"); //ITEM identifier
|
||||
writer.value(Item.itemRegistry.getNameForObject(comp.toStack().getItem())); //item name
|
||||
if(comp.stacksize != 1) writer.value(comp.stacksize); //stack size
|
||||
if(comp.meta > 0) writer.value(comp.meta); //metadata
|
||||
}
|
||||
|
||||
if(astack instanceof OreDictStack) {
|
||||
OreDictStack ore = (OreDictStack) astack;
|
||||
|
||||
writer.value("dict"); //DICT identifier
|
||||
writer.value(ore.name); //dict name
|
||||
writer.value(ore.stacksize); //stacksize
|
||||
}
|
||||
|
||||
writer.endArray();
|
||||
writer.setIndent(" ");
|
||||
}
|
||||
}
|
||||
@ -60,6 +60,7 @@ public abstract class SerializableRecipe {
|
||||
recipeHandlers.add(new FuelPoolRecipes());
|
||||
recipeHandlers.add(new MixerRecipes());
|
||||
recipeHandlers.add(new OutgasserRecipes());
|
||||
recipeHandlers.add(new CompressorRecipes());
|
||||
recipeHandlers.add(new MatDistribution());
|
||||
}
|
||||
|
||||
@ -266,7 +267,8 @@ public abstract class SerializableRecipe {
|
||||
try {
|
||||
FluidType type = Fluids.fromName(array.get(0).getAsString());
|
||||
int fill = array.get(1).getAsInt();
|
||||
return new FluidStack(type, fill);
|
||||
int pressure = array.size() < 3 ? 0 : array.get(2).getAsInt();
|
||||
return new FluidStack(type, fill, pressure);
|
||||
} catch(Exception ex) { }
|
||||
MainRegistry.logger.error("Error reading fluid array " + array.toString());
|
||||
return new FluidStack(Fluids.NONE, 0);
|
||||
@ -287,6 +289,7 @@ public abstract class SerializableRecipe {
|
||||
writer.setIndent("");
|
||||
writer.value(stack.type.getName()); //fluid type
|
||||
writer.value(stack.fill); //amount in mB
|
||||
if(stack.pressure != 0) writer.value(stack.pressure);
|
||||
writer.endArray();
|
||||
writer.setIndent(" ");
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ public class ItemBlowtorch extends Item implements IFillableItem {
|
||||
if(!world.isRemote) {
|
||||
|
||||
if(this == ModItems.blowtorch) {
|
||||
this.setFill(stack, Fluids.GAS, this.getFill(stack, Fluids.GAS) - 1000);
|
||||
this.setFill(stack, Fluids.GAS, this.getFill(stack, Fluids.GAS) - 250);
|
||||
}
|
||||
|
||||
if(this == ModItems.acetylene_torch) {
|
||||
|
||||
@ -4,6 +4,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCompressor;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@ -28,18 +29,18 @@ public class RenderCompressor extends TileEntitySpecialRenderer {
|
||||
bindTexture(ResourceManager.compressor_tex);
|
||||
ResourceManager.compressor.renderPart("Compressor");
|
||||
|
||||
double h = (System.currentTimeMillis() * 0.005) % 6D;
|
||||
|
||||
if(h > 3) h = 6 - h;
|
||||
TileEntityMachineCompressor compressor = (TileEntityMachineCompressor) tile;
|
||||
float lift = compressor.prevPiston + (compressor.piston - compressor.prevPiston) * interp;
|
||||
float fan = compressor.prevFanSpin + (compressor.fanSpin - compressor.prevFanSpin) * interp;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, h - 3, 0);
|
||||
GL11.glTranslatef(0, lift * 3 - 3, 0);
|
||||
ResourceManager.compressor.renderPart("Pump");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, 1.5, 0);
|
||||
GL11.glRotated((System.currentTimeMillis() * -0.5) % 360, 1, 0, 0);
|
||||
GL11.glRotatef(fan, 1, 0, 0);
|
||||
GL11.glTranslated(0, -1.5, 0);
|
||||
ResourceManager.compressor.renderPart("Fan");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
@ -1,21 +1,52 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.container.ContainerCompressor;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUICompressor;
|
||||
import com.hbm.inventory.recipes.CompressorRecipes;
|
||||
import com.hbm.inventory.recipes.CompressorRecipes.CompressorRecipe;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineCompressor extends TileEntityMachineBase implements IGUIProvider {
|
||||
public class TileEntityMachineCompressor extends TileEntityMachineBase implements IGUIProvider, IControlReceiver, IEnergyUser, IFluidStandardTransceiver {
|
||||
|
||||
public FluidTank[] tanks;
|
||||
public long power;
|
||||
public static final long maxPower = 1_000_000;
|
||||
public boolean isOn;
|
||||
public int progress;
|
||||
public int processTime = 100;
|
||||
|
||||
public float fanSpin;
|
||||
public float prevFanSpin;
|
||||
public float piston;
|
||||
public float prevPiston;
|
||||
public boolean pistonDir;
|
||||
|
||||
public TileEntityMachineCompressor() {
|
||||
super(2);
|
||||
this.tanks = new FluidTank[2];
|
||||
this.tanks[0] = new FluidTank(Fluids.NONE, 16_000);
|
||||
this.tanks[1] = new FluidTank(Fluids.NONE, 16_000).withPressure(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -28,8 +59,148 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
this.updateConnections();
|
||||
}
|
||||
|
||||
this.power = Library.chargeTEFromItems(slots, 1, power, maxPower);
|
||||
this.tanks[0].setType(0, slots);
|
||||
this.setupTanks();
|
||||
|
||||
if(canProcess()) {
|
||||
this.progress++;
|
||||
this.isOn = true;
|
||||
this.power -= 1_000;
|
||||
|
||||
if(progress >= this.processTime) {
|
||||
progress = 0;
|
||||
this.process();
|
||||
this.markChanged();
|
||||
}
|
||||
|
||||
} else {
|
||||
this.progress = 0;
|
||||
this.isOn = false;
|
||||
}
|
||||
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("progress", progress);
|
||||
data.setLong("power", power);
|
||||
tanks[0].writeToNBT(data, "0");
|
||||
tanks[1].writeToNBT(data, "1");
|
||||
data.setBoolean("isOn", isOn);
|
||||
this.networkPack(data, 100);
|
||||
|
||||
} else {
|
||||
|
||||
this.prevFanSpin = this.fanSpin;
|
||||
this.prevPiston = this.piston;
|
||||
|
||||
if(this.isOn) {
|
||||
this.fanSpin += 15;
|
||||
|
||||
if(this.fanSpin >= 360) {
|
||||
this.prevFanSpin -= 360;
|
||||
this.fanSpin -= 360;
|
||||
}
|
||||
|
||||
if(this.pistonDir) {
|
||||
this.piston -= 0.1F;
|
||||
if(this.piston <= 0) this.pistonDir = !this.pistonDir;
|
||||
} else {
|
||||
this.piston += 0.05F;
|
||||
if(this.piston >= 1) this.pistonDir = !this.pistonDir;
|
||||
}
|
||||
|
||||
this.piston = MathHelper.clamp_float(this.piston, 0F, 1F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.progress = nbt.getInteger("progress");
|
||||
this.power = nbt.getLong("power");
|
||||
tanks[0].readFromNBT(nbt, "0");
|
||||
tanks[1].readFromNBT(nbt, "1");
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
|
||||
public DirPos[] getConPos() {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
|
||||
return new DirPos[] {
|
||||
new DirPos(xCoord + rot.offsetX * 2, yCoord, zCoord + rot.offsetZ * 2, rot),
|
||||
new DirPos(xCoord - rot.offsetX * 2, yCoord, zCoord - rot.offsetZ * 2, rot.getOpposite()),
|
||||
new DirPos(xCoord + dir.offsetX * 2, yCoord, zCoord + dir.offsetZ * 2, dir),
|
||||
};
|
||||
}
|
||||
|
||||
public boolean canProcess() {
|
||||
|
||||
if(this.power <= 1_000) return false;
|
||||
|
||||
CompressorRecipe recipe = CompressorRecipes.recipes.get(new Pair(tanks[0].getTankType(), tanks[0].getPressure()));
|
||||
|
||||
if(recipe == null) {
|
||||
return tanks[0].getFill() >= 1000 && tanks[1].getFill() + 1000 <= tanks[1].getMaxFill();
|
||||
}
|
||||
|
||||
return tanks[0].getFill() > recipe.inputAmount && tanks[1].getFill() + recipe.output.fill <= tanks[1].getMaxFill();
|
||||
}
|
||||
|
||||
public void process() {
|
||||
|
||||
CompressorRecipe recipe = CompressorRecipes.recipes.get(new Pair(tanks[0].getTankType(), tanks[0].getPressure()));
|
||||
|
||||
if(recipe == null) {
|
||||
tanks[0].setFill(tanks[0].getFill() - 1_000);
|
||||
tanks[1].setFill(tanks[1].getFill() + 1_000);
|
||||
} else {
|
||||
tanks[0].setFill(tanks[0].getFill() - recipe.inputAmount);
|
||||
tanks[1].setFill(tanks[1].getFill() + recipe.output.fill);
|
||||
}
|
||||
}
|
||||
|
||||
protected void setupTanks() {
|
||||
|
||||
CompressorRecipe recipe = CompressorRecipes.recipes.get(new Pair(tanks[0].getTankType(), tanks[0].getPressure()));
|
||||
|
||||
if(recipe == null) {
|
||||
tanks[1].withPressure(tanks[0].getPressure() + 1).setTankType(tanks[0].getTankType());
|
||||
} else {
|
||||
tanks[1].withPressure(recipe.output.pressure).setTankType(recipe.output.type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
power = nbt.getLong("power");
|
||||
progress = nbt.getInteger("progress");
|
||||
tanks[0].readFromNBT(nbt, "0");
|
||||
tanks[1].readFromNBT(nbt, "1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setLong("power", power);
|
||||
nbt.setInteger("progress", progress);
|
||||
tanks[0].writeToNBT(nbt, "0");
|
||||
tanks[1].writeToNBT(nbt, "1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
@ -42,4 +213,82 @@ public class TileEntityMachineCompressor extends TileEntityMachineBase implement
|
||||
return new GUICompressor(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(EntityPlayer player) {
|
||||
return this.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveControl(NBTTagCompound data) {
|
||||
int compression = data.getInteger("compression");
|
||||
|
||||
if(compression != tanks[0].getPressure()) {
|
||||
tanks[0].withPressure(compression);
|
||||
|
||||
CompressorRecipe recipe = CompressorRecipes.recipes.get(new Pair(tanks[0].getTankType(), compression));
|
||||
|
||||
if(recipe == null) {
|
||||
tanks[1].withPressure(compression + 1);
|
||||
} else {
|
||||
tanks[1].withPressure(recipe.output.pressure).setTankType(recipe.output.type);
|
||||
}
|
||||
|
||||
this.markChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long power) {
|
||||
this.power = power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return tanks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getSendingTanks() {
|
||||
return new FluidTank[] {tanks[1]};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] {tanks[0]};
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
|
||||
if(bb == null) {
|
||||
bb = AxisAlignedBB.getBoundingBox(
|
||||
xCoord - 2,
|
||||
yCoord,
|
||||
zCoord - 2,
|
||||
xCoord + 3,
|
||||
yCoord + 9,
|
||||
zCoord + 3
|
||||
);
|
||||
}
|
||||
|
||||
return bb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 5.2 KiB |
Loading…
x
Reference in New Issue
Block a user