mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
small fixes, watz heat/flux functionality
This commit is contained in:
parent
1901eb317a
commit
4d1e902981
@ -19,4 +19,8 @@ public class OreNames {
|
||||
public static final String BLOCK = "block";
|
||||
public static final String ORE = "ore";
|
||||
public static final String ORENETHER = "oreNether";
|
||||
|
||||
public static final String[] prefixes = new String[] {
|
||||
ANY, NUGGET, TINY, INGOT, DUSTTINY, DUST, GEM, CRYSTAL, PLATE, PLATECAST, BILLET, BLOCK, ORE, ORENETHER
|
||||
};
|
||||
}
|
||||
|
||||
@ -81,7 +81,9 @@ public class MatDistribution extends SerializableRecipe {
|
||||
|
||||
registerOre(OreDictManager.HEMATITE.ore(), MAT_HEMATITE, INGOT.q(4));
|
||||
registerOre(OreDictManager.MALACHITE.ore(), MAT_MALACHITE, INGOT.q(4));
|
||||
|
||||
registerEntry(DictFrame.fromOne(ModBlocks.stone_resource, EnumStoneType.LIMESTONE), MAT_FLUX, DUST.q(10));
|
||||
registerEntry(ModItems.powder_flux, MAT_FLUX, DUST.q(1));
|
||||
}
|
||||
|
||||
public static void registerEntry(Object key, Object... matDef) {
|
||||
|
||||
@ -201,7 +201,6 @@ public class ShredderRecipes extends SerializableRecipe {
|
||||
ShredderRecipes.setRecipe(Items.reeds, new ItemStack(Items.sugar, 3));
|
||||
ShredderRecipes.setRecipe(Items.apple, new ItemStack(Items.sugar, 1));
|
||||
ShredderRecipes.setRecipe(Items.carrot, new ItemStack(Items.sugar, 1));
|
||||
ShredderRecipes.setRecipe(DictFrame.fromOne(ModBlocks.stone_resource, EnumStoneType.LIMESTONE), new ItemStack(ModItems.powder_calcium, 4));
|
||||
|
||||
List<ItemStack> logs = OreDictionary.getOres("logWood");
|
||||
List<ItemStack> planks = OreDictionary.getOres("plankWood");
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.inventory.recipes.anvil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.inventory.OreNames;
|
||||
import com.hbm.inventory.RecipesCommon.AStack;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.RecipesCommon.OreDictStack;
|
||||
@ -33,8 +34,10 @@ public class AnvilSmithingMold extends AnvilSmithingRecipe {
|
||||
|
||||
for(String name : names) {
|
||||
|
||||
if(matchesPrefix.name.equals("plate") && name.startsWith("plateTriple")) { //fuck me
|
||||
return false;
|
||||
for(String otherPrefix : OreNames.prefixes) {
|
||||
if(otherPrefix.length() > matchesPrefix.name.length() && name.startsWith(otherPrefix)) {
|
||||
continue; //ignore if there's a longer prefix that matches (i.e. a more accurate match)
|
||||
}
|
||||
}
|
||||
|
||||
if(name.startsWith(matchesPrefix.name)) {
|
||||
|
||||
@ -90,7 +90,6 @@ public class ItemEnumMulti extends Item {
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
|
||||
if(multiName) {
|
||||
|
||||
Enum num = EnumUtil.grabEnumSafely(theEnum, stack.getItemDamage());
|
||||
return super.getUnlocalizedName() + "." + num.name().toLowerCase();
|
||||
} else {
|
||||
|
||||
@ -1,11 +1,19 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.inventory.container.ContainerWatz;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIWatz;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemWatzPellet.EnumWatzType;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.Compat;
|
||||
import com.hbm.util.EnumUtil;
|
||||
import com.hbm.util.function.Function;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -13,6 +21,8 @@ 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.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -20,7 +30,8 @@ public class TileEntityWatz extends TileEntityMachineBase implements IGUIProvide
|
||||
|
||||
public FluidTank[] tanks;
|
||||
public int heat;
|
||||
public int flux;
|
||||
public double fluxLastReaction; //stores the flux created by the reaction, excludes passive emission
|
||||
public double fluxDisplay;
|
||||
|
||||
/* lock types for item IO */
|
||||
public boolean isLocked = false;
|
||||
@ -42,10 +53,93 @@ public class TileEntityWatz extends TileEntityMachineBase implements IGUIProvide
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
if(!worldObj.isRemote && !updateLock()) {
|
||||
|
||||
//TODO: figure out how to make fluid transport instant instead of sloshy,
|
||||
//perhaps an initial count that combines all tanks into one large virtual one?
|
||||
|
||||
updateManual(true);
|
||||
}
|
||||
}
|
||||
|
||||
/** enforces strict top to bottom update order (instead of semi-random based on placement) */
|
||||
public void updateManual(boolean topMost) {
|
||||
|
||||
//TODO: do heat to coolant first
|
||||
|
||||
List<ItemStack> pellets = new ArrayList();
|
||||
|
||||
for(int i = 0; i < 24; i++) {
|
||||
ItemStack stack = slots[i];
|
||||
if(stack != null && stack.getItem() == ModItems.watz_pellet) {
|
||||
pellets.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
double baseFlux = 0D;
|
||||
|
||||
/* init base flux */
|
||||
for(ItemStack stack : pellets) {
|
||||
EnumWatzType type = EnumUtil.grabEnumSafely(EnumWatzType.class, stack.getItemDamage());
|
||||
baseFlux += type.passive;
|
||||
}
|
||||
|
||||
double inputFlux = baseFlux + fluxLastReaction;
|
||||
double addedFlux = 0D;
|
||||
double addedHeat = 0D;
|
||||
|
||||
for(ItemStack stack : pellets) {
|
||||
EnumWatzType type = EnumUtil.grabEnumSafely(EnumWatzType.class, stack.getItemDamage());
|
||||
Function burnFunc = type.burnFunc;
|
||||
Function heatMod = type.heatMult;
|
||||
|
||||
if(burnFunc != null) {
|
||||
double mod = heatMod != null ? heatMod.effonix(heat) : 1D;
|
||||
double burn = burnFunc.effonix(inputFlux) * mod;
|
||||
addedFlux += burn;
|
||||
addedHeat += type.heatEmission * burn;
|
||||
}
|
||||
}
|
||||
|
||||
for(ItemStack stack : pellets) {
|
||||
EnumWatzType type = EnumUtil.grabEnumSafely(EnumWatzType.class, stack.getItemDamage());
|
||||
Function absorbFunc = type.absorbFunc;
|
||||
|
||||
if(absorbFunc != null) {
|
||||
addedHeat += absorbFunc.effonix(baseFlux + fluxLastReaction);
|
||||
}
|
||||
}
|
||||
|
||||
this.heat += addedHeat;
|
||||
this.fluxLastReaction = addedFlux;
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("heat", this.heat);
|
||||
data.setDouble("flux", this.fluxLastReaction + baseFlux);
|
||||
for(int i = 0; i < tanks.length; i++) {
|
||||
tanks[i].writeToNBT(data, "t" + i);
|
||||
}
|
||||
this.networkPack(data, 25);
|
||||
|
||||
TileEntity below = Compat.getTileStandard(worldObj, xCoord, yCoord - 3, zCoord);
|
||||
if(below instanceof TileEntityWatz) {
|
||||
TileEntityWatz watz = (TileEntityWatz) below;
|
||||
//TODO: move down fluids and exchange pellets
|
||||
watz.updateManual(false);
|
||||
}
|
||||
}
|
||||
|
||||
/** Prevent manual updates when another segment is above this one */
|
||||
public boolean updateLock() {
|
||||
return Compat.getTileStandard(worldObj, xCoord, yCoord + 3, zCoord) instanceof TileEntityWatz;
|
||||
}
|
||||
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.heat = nbt.getInteger("heat");
|
||||
this.fluxDisplay = nbt.getDouble("flux");
|
||||
for(int i = 0; i < tanks.length; i++) {
|
||||
tanks[i].readFromNBT(nbt, "t" + i);
|
||||
}
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@ -4,6 +4,7 @@ import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.BlockBedrockOreTE.TileEntityBedrockOre;
|
||||
import com.hbm.inventory.FluidStack;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
@ -15,17 +16,20 @@ public class BedrockOre {
|
||||
for(int ix = x - 1; ix <= x + 1; ix++) {
|
||||
for(int iz = z - 1; iz <= z + 1; iz++) {
|
||||
|
||||
if((ix == x && iz == z) || world.rand.nextBoolean()) {
|
||||
|
||||
world.setBlock(ix, 0, iz, ModBlocks.ore_bedrock);
|
||||
TileEntityBedrockOre ore = (TileEntityBedrockOre) world.getTileEntity(ix, 0, iz);
|
||||
ore.resource = stack;
|
||||
ore.color = color;
|
||||
ore.shape = world.rand.nextInt(10);
|
||||
ore.acidRequirement = acid;
|
||||
ore.tier = tier;
|
||||
world.markBlockForUpdate(ix, 0, iz);
|
||||
world.markTileEntityChunkModified(ix, 0, iz, ore);
|
||||
Block b = world.getBlock(ix, 0, iz);
|
||||
if(b.isReplaceableOreGen(world, ix, 0, iz, Blocks.bedrock)) {
|
||||
if((ix == x && iz == z) || world.rand.nextBoolean()) {
|
||||
|
||||
world.setBlock(ix, 0, iz, ModBlocks.ore_bedrock);
|
||||
TileEntityBedrockOre ore = (TileEntityBedrockOre) world.getTileEntity(ix, 0, iz);
|
||||
ore.resource = stack;
|
||||
ore.color = color;
|
||||
ore.shape = world.rand.nextInt(10);
|
||||
ore.acidRequirement = acid;
|
||||
ore.tier = tier;
|
||||
world.markBlockForUpdate(ix, 0, iz);
|
||||
world.markTileEntityChunkModified(ix, 0, iz, ore);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -35,7 +39,11 @@ public class BedrockOre {
|
||||
|
||||
for(int iy = 1; iy < 7; iy++) {
|
||||
if(iy < 3 || world.getBlock(ix, iy, iz) == Blocks.bedrock) {
|
||||
world.setBlock(ix, iy, iz, ModBlocks.stone_depth);
|
||||
|
||||
Block b = world.getBlock(ix, iy, iz);
|
||||
if(b.isReplaceableOreGen(world, ix, iy, iz, Blocks.stone) || b.isReplaceableOreGen(world, ix, iy, iz, Blocks.bedrock)) {
|
||||
world.setBlock(ix, iy, iz, ModBlocks.stone_depth);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
src/main/resources/assets/hbm/textures/misc/charset.png
Normal file
BIN
src/main/resources/assets/hbm/textures/misc/charset.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
BIN
src/main/resources/assets/hbm/textures/misc/charset_ascii.png
Normal file
BIN
src/main/resources/assets/hbm/textures/misc/charset_ascii.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Loading…
x
Reference in New Issue
Block a user