watz fuel stats, more construction recipes

This commit is contained in:
Bob 2023-04-22 16:00:07 +02:00
parent 8ec678564f
commit 43c43eb14f
8 changed files with 87 additions and 35 deletions

View File

@ -95,9 +95,10 @@ public class BlockToolConversion extends BlockMulti implements IToolable, ILookO
if(list == null || list.isEmpty() || InventoryUtil.doesPlayerHaveAStacks(player, list, true)) { if(list == null || list.isEmpty() || InventoryUtil.doesPlayerHaveAStacks(player, list, true)) {
world.setBlock(x, y, z, result.value.block, result.value.meta, 3); world.setBlock(x, y, z, result.value.block, result.value.meta, 3);
return true;
} }
return true; return false;
} }
@Override @Override

View File

@ -4,8 +4,10 @@ import java.util.HashMap;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.util.ItemStackUtil;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
public class ConstructionHandler extends NEIUniversalHandler { public class ConstructionHandler extends NEIUniversalHandler {
@ -42,11 +44,11 @@ public class ConstructionHandler extends NEIUniversalHandler {
/* ITER */ /* ITER */
ItemStack[] iter = new ItemStack[] { ItemStack[] iter = new ItemStack[] {
new ItemStack(ModBlocks.fusion_conductor, 64),
new ItemStack(ModBlocks.fusion_conductor, 64),
new ItemStack(ModBlocks.fusion_conductor, 64),
new ItemStack(ModBlocks.fusion_conductor, 64),
new ItemStack(ModBlocks.fusion_conductor, 36), new ItemStack(ModBlocks.fusion_conductor, 36),
new ItemStack(ModBlocks.fusion_conductor, 64),
new ItemStack(ModBlocks.fusion_conductor, 64),
new ItemStack(ModBlocks.fusion_conductor, 64),
new ItemStack(ModBlocks.fusion_conductor, 64),
new ItemStack(ModBlocks.fusion_center, 64), new ItemStack(ModBlocks.fusion_center, 64),
new ItemStack(ModBlocks.fusion_motor, 4), new ItemStack(ModBlocks.fusion_motor, 4),
new ItemStack(ModBlocks.reinforced_glass, 8)}; new ItemStack(ModBlocks.reinforced_glass, 8)};
@ -54,6 +56,42 @@ public class ConstructionHandler extends NEIUniversalHandler {
bufferedRecipes.put(iter, new ItemStack(ModBlocks.iter)); bufferedRecipes.put(iter, new ItemStack(ModBlocks.iter));
bufferedTools.put(iter, new ItemStack(ModBlocks.struct_iter_core)); bufferedTools.put(iter, new ItemStack(ModBlocks.struct_iter_core));
/* PLASMA HEATER */
ItemStack[] heater = new ItemStack[] {
new ItemStack(ModBlocks.fusion_heater, 7),
new ItemStack(ModBlocks.fusion_heater, 64),
new ItemStack(ModBlocks.fusion_heater, 64) };
bufferedRecipes.put(heater, new ItemStack(ModBlocks.plasma_heater));
bufferedTools.put(heater, new ItemStack(ModBlocks.struct_plasma_core));
/* COMPACT LAUNCHER */
ItemStack[] launcher = new ItemStack[] { new ItemStack(ModBlocks.struct_launcher, 8) };
bufferedRecipes.put(launcher, new ItemStack(ModBlocks.compact_launcher));
bufferedTools.put(launcher, new ItemStack(ModBlocks.struct_launcher_core));
/* LAUNCH TABLE */
ItemStack[] table = new ItemStack[] {
new ItemStack(ModBlocks.struct_launcher, 16),
new ItemStack(ModBlocks.struct_launcher, 64),
new ItemStack(ModBlocks.struct_scaffold, 11)};
bufferedRecipes.put(table, new ItemStack(ModBlocks.launch_table));
bufferedTools.put(table, new ItemStack(ModBlocks.struct_launcher_core_large));
/* SOYUZ LAUNCHER */
ItemStack[] soysauce = new ItemStack[] {
new ItemStack(ModBlocks.struct_launcher, 60),
ItemStackUtil.addTooltipToStack(new ItemStack(ModBlocks.struct_launcher, 320), EnumChatFormatting.RED + "5x64"),
new ItemStack(ModBlocks.struct_scaffold, 53),
ItemStackUtil.addTooltipToStack(new ItemStack(ModBlocks.struct_scaffold, 384), EnumChatFormatting.RED + "6x64"),
new ItemStack(ModBlocks.concrete_smooth, 8),
ItemStackUtil.addTooltipToStack(new ItemStack(ModBlocks.concrete_smooth, 320), EnumChatFormatting.RED + "5x64"),};
bufferedRecipes.put(soysauce, new ItemStack(ModBlocks.soyuz_launcher));
bufferedTools.put(soysauce, new ItemStack(ModBlocks.struct_soyuz_core));
return recipes ? bufferedRecipes : bufferedTools; return recipes ? bufferedRecipes : bufferedTools;
} }
} }

View File

@ -36,18 +36,18 @@ public class ItemWatzPellet extends ItemEnumMulti {
public static enum EnumWatzType { public static enum EnumWatzType {
SCHRABIDIUM( 0x32FFFF, 0x005C5C, 2_000, 10D, new FunctionLogarithmic(10), null, null), SCHRABIDIUM( 0x32FFFF, 0x005C5C, 2_000, 20D, 0.02D, new FunctionLinear(1.5D), new FunctionSqrt(1D/20D).withOff(20D * 20D), null),
HES( 0x66DCD6, 0x023933, 1_500, 10D, null, null, null), HES( 0x66DCD6, 0x023933, 1_750, 20D, 0.01D, new FunctionLinear(1.25D), new FunctionSqrt(1/15D).withOff(15D*15D), null),
MES( 0xCBEADF, 0x28473C, 1_000, 10D, null, null, null), MES( 0xCBEADF, 0x28473C, 1_500, 15D, 0.005D, new FunctionLinear(1.15D), new FunctionSqrt(1/15D).withOff(15D*15D), null),
LES( 0xABB4A8, 0x0C1105, 500, 10D, null, null, null), LES( 0xABB4A8, 0x0C1105, 1_250, 15D, 0.0025D, new FunctionLinear(1D), new FunctionSqrt(1/10D).withOff(10D*10D), null),
HEN( 0xA6B2A6, 0x030F03, 0, 10D, null, null, null), HEN( 0xA6B2A6, 0x030F03, 0, 10D, 0.001D, new FunctionSqrt(100), null, null),
MEU( 0xC1C7BD, 0x2B3227, 0, 10D, null, null, null), MEU( 0xC1C7BD, 0x2B3227, 0, 10D, 0.001D, new FunctionSqrt(75), null, null),
MEP( 0x9AA3A0, 0x111A17, 0, 10D, null, null, null), MEP( 0x9AA3A0, 0x111A17, 0, 15D, 0.001D, new FunctionSqrt(150), new FunctionSqrt(1D/20D).withOff(20D * 20D), null),
LEAD( 0xA6A6B2, 0x03030F, 0, 0, null, null, new FunctionSqrt(10)), //standard absorber, negative coefficient LEAD( 0xA6A6B2, 0x03030F, 0, 0, 0.005D, null, null, new FunctionSqrt(10)), //standard absorber, negative coefficient
BORON( 0xBDC8D2, 0x29343E, 0, 0, null, null, new FunctionLinear(10)), //improved absorber, linear BORON( 0xBDC8D2, 0x29343E, 0, 0, 0.005D, null, null, new FunctionLinear(10)), //improved absorber, linear
DU( 0xC1C7BD, 0x2B3227, 0, 0, null, null, new FunctionQuadratic(1D, 1D).withDiv(100)), //absorber with positive coefficient DU( 0xC1C7BD, 0x2B3227, 0, 0, 0.005D, null, null, new FunctionQuadratic(1D, 1D).withDiv(100)), //absorber with positive coefficient
NQD( 0x4B4B4B, 0x121212, 0, 0, null, null, null), NQD( 0x4B4B4B, 0x121212, 2_000, 20, 0.02D, new FunctionLinear(2D), new FunctionSqrt(1D/25D).withOff(25D * 25D), null),
NQR( 0x2D2D2D, 0x0B0B0B, 0, 0, null, null, null); NQR( 0x2D2D2D, 0x0B0B0B, 2_500, 30, 0.02D, new FunctionLinear(1.5D), new FunctionSqrt(1D/25D).withOff(25D * 25D), null);
public double yield = 1_000_000_000; public double yield = 1_000_000_000;
public int colorLight; public int colorLight;
@ -56,16 +56,17 @@ public class ItemWatzPellet extends ItemEnumMulti {
public double passive; //base flux emission public double passive; //base flux emission
public double heatEmission; //reactivity(1) to heat (heat per outgoing flux) public double heatEmission; //reactivity(1) to heat (heat per outgoing flux)
public Function burnFunc; //flux to reactivity(0) (classic reactivity) public Function burnFunc; //flux to reactivity(0) (classic reactivity)
public Function heatMult; //reactivity(0) to reactivity(1) based on heat (temperature coefficient) public Function heatDiv; //reactivity(0) to reactivity(1) based on heat (temperature coefficient)
public Function absorbFunc; //flux to heat (flux absobtion for non-active component) public Function absorbFunc; //flux to heat (flux absobtion for non-active component)
private EnumWatzType(int colorLight, int colorDark, double passive, double heatEmission, Function burnFunction, Function heatMultiplier, Function absorbFunction) { private EnumWatzType(int colorLight, int colorDark, double passive, double heatEmission, double mudContent, Function burnFunction, Function heatDivisor, Function absorbFunction) {
this.colorLight = colorLight; this.colorLight = colorLight;
this.colorDark = colorDark; this.colorDark = colorDark;
this.passive = passive; this.passive = passive;
this.heatEmission = heatEmission; this.heatEmission = heatEmission;
this.mudContent = mudContent;
this.burnFunc = burnFunction; this.burnFunc = burnFunction;
this.heatMult = heatMultiplier; this.heatDiv = heatDivisor;
this.absorbFunc = absorbFunction; this.absorbFunc = absorbFunction;
} }
} }
@ -129,13 +130,16 @@ public class ItemWatzPellet extends ItemEnumMulti {
String color = EnumChatFormatting.GOLD + ""; String color = EnumChatFormatting.GOLD + "";
String reset = EnumChatFormatting.RESET + ""; String reset = EnumChatFormatting.RESET + "";
if(num.passive > 0) list.add(color + "Base fission rate: " + reset + num.passive); if(num.passive > 0){
list.add(color + "Base fission rate: " + reset + num.passive);
list.add(EnumChatFormatting.RED + "Self-ingiting!");
}
if(num.heatEmission > 0) list.add(color + "Heat per flux: " + reset + num.heatEmission + " TU"); if(num.heatEmission > 0) list.add(color + "Heat per flux: " + reset + num.heatEmission + " TU");
if(num.burnFunc != null) { if(num.burnFunc != null) {
list.add(color + "Reacton function: " + reset + num.burnFunc.getLabelForFuel()); list.add(color + "Reacton function: " + reset + num.burnFunc.getLabelForFuel());
list.add(color + "Fuel type: " + reset + num.burnFunc.getDangerFromFuel()); list.add(color + "Fuel type: " + reset + num.burnFunc.getDangerFromFuel());
} }
if(num.heatMult != null) list.add(color + "Thermal coefficient: " + reset + num.heatMult.getLabelForFuel()); if(num.heatDiv != null) list.add(color + "Thermal multiplier: " + reset + num.heatDiv.getLabelForFuel() + " TU⁻¹");
if(num.absorbFunc != null) list.add(color + "Flux capture: " + reset + num.absorbFunc.getLabelForFuel()); if(num.absorbFunc != null) list.add(color + "Flux capture: " + reset + num.absorbFunc.getLabelForFuel());
} }

View File

@ -10,6 +10,7 @@ import com.hbm.packet.PacketDispatcher;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationKeyframe; import com.hbm.render.anim.BusAnimationKeyframe;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.util.EntityDamageUtil;
import api.hbm.block.IToolable; import api.hbm.block.IToolable;
import api.hbm.block.IToolable.ToolType; import api.hbm.block.IToolable.ToolType;
@ -58,9 +59,10 @@ public class ItemBoltgun extends Item implements IAnimatedItem {
if(slot != null) { if(slot != null) {
if(slot.getItem() == item) { if(slot.getItem() == item) {
if(!world.isRemote) { if(!world.isRemote) {
world.playSoundAtEntity(entity, "hbm:item.boltgun", 1.0F, 1.0F);
player.inventory.decrStackSize(i, 1); player.inventory.decrStackSize(i, 1);
player.inventoryContainer.detectAndSendChanges(); player.inventoryContainer.detectAndSendChanges();
entity.attackEntityFrom(DamageSource.causePlayerDamage(player).setDamageBypassesArmor(), 10F); EntityDamageUtil.attackEntityFromIgnoreIFrame(entity, DamageSource.causePlayerDamage(player).setDamageBypassesArmor(), 10F);
NBTTagCompound data = new NBTTagCompound(); NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaExt"); data.setString("type", "vanillaExt");
@ -92,7 +94,8 @@ public class ItemBoltgun extends Item implements IAnimatedItem {
if(b instanceof IToolable && ((IToolable)b).onScrew(world, player, x, y, z, side, fX, fY, fZ, ToolType.BOLT)) { if(b instanceof IToolable && ((IToolable)b).onScrew(world, player, x, y, z, side, fX, fY, fZ, ToolType.BOLT)) {
if(!world.isRemote) { if(!world.isRemote) {
world.playSoundAtEntity(player, "hbm:item.boltgun", 1.0F, 1.0F);
player.inventoryContainer.detectAndSendChanges(); player.inventoryContainer.detectAndSendChanges();
ForgeDirection dir = ForgeDirection.getOrientation(side); ForgeDirection dir = ForgeDirection.getOrientation(side);
double off = 0.25; double off = 0.25;

View File

@ -181,11 +181,11 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand
for(ItemStack stack : pellets) { for(ItemStack stack : pellets) {
EnumWatzType type = EnumUtil.grabEnumSafely(EnumWatzType.class, stack.getItemDamage()); EnumWatzType type = EnumUtil.grabEnumSafely(EnumWatzType.class, stack.getItemDamage());
Function burnFunc = type.burnFunc; Function burnFunc = type.burnFunc;
Function heatMod = type.heatMult; Function heatDiv = type.heatDiv;
if(burnFunc != null) { if(burnFunc != null) {
double mod = heatMod != null ? heatMod.effonix(heat) : 1D; double div = heatDiv != null ? heatDiv.effonix(heat) : 1D;
double burn = burnFunc.effonix(inputFlux) * mod; double burn = burnFunc.effonix(inputFlux) / div;
ItemWatzPellet.setYield(stack, ItemWatzPellet.getYield(stack) - burn); ItemWatzPellet.setYield(stack, ItemWatzPellet.getYield(stack) - burn);
addedFlux += burn; addedFlux += burn;
addedHeat += type.heatEmission * burn; addedHeat += type.heatEmission * burn;
@ -198,7 +198,10 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand
Function absorbFunc = type.absorbFunc; Function absorbFunc = type.absorbFunc;
if(absorbFunc != null) { if(absorbFunc != null) {
addedHeat += absorbFunc.effonix(baseFlux + fluxLastReaction); double absorb = absorbFunc.effonix(baseFlux + fluxLastReaction);
addedHeat += absorb;
ItemWatzPellet.setYield(stack, ItemWatzPellet.getYield(stack) - absorb);
tanks[2].setFill(tanks[2].getFill() + (int) Math.round(type.mudContent * absorb));
} }
} }
@ -309,6 +312,7 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand
} }
for(int i = 0; i < tanks.length; i++) tanks[i].readFromNBT(nbt, "t" + i); for(int i = 0; i < tanks.length; i++) tanks[i].readFromNBT(nbt, "t" + i);
this.heat = nbt.getInteger("heat");
this.fluxLastBase = nbt.getDouble("lastFluxB"); this.fluxLastBase = nbt.getDouble("lastFluxB");
this.fluxLastReaction = nbt.getDouble("lastFluxR"); this.fluxLastReaction = nbt.getDouble("lastFluxR");
@ -332,6 +336,7 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand
nbt.setTag("locks", list); nbt.setTag("locks", list);
for(int i = 0; i < tanks.length; i++) tanks[i].writeToNBT(nbt, "t" + i); for(int i = 0; i < tanks.length; i++) tanks[i].writeToNBT(nbt, "t" + i);
nbt.setInteger("heat", this.heat);
nbt.setDouble("lastFluxB", fluxLastBase); nbt.setDouble("lastFluxB", fluxLastBase);
nbt.setDouble("lastFluxR", fluxLastReaction); nbt.setDouble("lastFluxR", fluxLastReaction);

View File

@ -27,8 +27,8 @@ public abstract class Function {
public String getXName(boolean brackets) { public String getXName(boolean brackets) {
String x = "x"; String x = "x";
boolean mod = false; boolean mod = false;
if(div != 1D) x += " / " + div; if(div != 1D) x += " / " + String.format("%,.1f", div);
if(off != 0D) x += " + " + off; if(off != 0D) x += " + " + String.format("%,.1f", off);
if(mod && brackets) x = "(" + x + ")"; if(mod && brackets) x = "(" + x + ")";
return x; return x;
} }
@ -46,28 +46,28 @@ public abstract class Function {
public static class FunctionLogarithmic extends FunctionSingleArg { public static class FunctionLogarithmic extends FunctionSingleArg {
public FunctionLogarithmic(double level) { super(level); this.withOff(1D); } public FunctionLogarithmic(double level) { super(level); this.withOff(1D); }
@Override public double effonix(double x) { return Math.log10(getX(x)) * level; } @Override public double effonix(double x) { return Math.log10(getX(x)) * level; }
@Override public String getLabelForFuel() { return "log10(" + getXName(false) + ") * " + level; } @Override public String getLabelForFuel() { return "log10(" + getXName(false) + ") * " + String.format("%,.1f", this.level); }
@Override public String getDangerFromFuel() { return EnumChatFormatting.YELLOW + "MEDIUM / LOGARITHMIC"; } @Override public String getDangerFromFuel() { return EnumChatFormatting.YELLOW + "MEDIUM / LOGARITHMIC"; }
} }
public static class FunctionPassive extends FunctionSingleArg { public static class FunctionPassive extends FunctionSingleArg {
public FunctionPassive(double level) { super(level); } public FunctionPassive(double level) { super(level); }
@Override public double effonix(double x) { return this.level; } @Override public double effonix(double x) { return this.level; }
@Override public String getLabelForFuel() { return "" + level; } @Override public String getLabelForFuel() { return "" + String.format("%,.1f", this.level); }
@Override public String getDangerFromFuel() { return EnumChatFormatting.DARK_GREEN + "SAFE / PASSIVE"; } @Override public String getDangerFromFuel() { return EnumChatFormatting.DARK_GREEN + "SAFE / PASSIVE"; }
} }
public static class FunctionSqrt extends FunctionSingleArg { public static class FunctionSqrt extends FunctionSingleArg {
public FunctionSqrt(double level) { super(level); } public FunctionSqrt(double level) { super(level); }
@Override public double effonix(double x) { return BobMathUtil.squirt(getX(x)) * this.level; } @Override public double effonix(double x) { return BobMathUtil.squirt(getX(x)) * this.level; }
@Override public String getLabelForFuel() { return "sqrt(" + getXName(false) + ") * " + this.level; } //not entirely correct but good enough @Override public String getLabelForFuel() { return "sqrt(" + getXName(false) + ") * " + String.format("%,.3f", this.level); } //not entirely correct but good enough
@Override public String getDangerFromFuel() { return EnumChatFormatting.YELLOW + "MEDIUM / SQUARE ROOT"; } @Override public String getDangerFromFuel() { return EnumChatFormatting.YELLOW + "MEDIUM / SQUARE ROOT"; }
} }
public static class FunctionLinear extends FunctionSingleArg { public static class FunctionLinear extends FunctionSingleArg {
public FunctionLinear(double level) { super(level); } public FunctionLinear(double level) { super(level); }
@Override public double effonix(double x) { return getX(x) * this.level; } @Override public double effonix(double x) { return getX(x) * this.level; }
@Override public String getLabelForFuel() { return getXName(true) + " * " + this.level; } @Override public String getLabelForFuel() { return getXName(true) + " * " + String.format("%,.1f", this.level); }
@Override public String getDangerFromFuel() { return EnumChatFormatting.RED + "DANGEROUS / LINEAR"; } @Override public String getDangerFromFuel() { return EnumChatFormatting.RED + "DANGEROUS / LINEAR"; }
} }
@ -75,7 +75,7 @@ public abstract class Function {
public FunctionQuadratic(double level) { super(level, 0D); } public FunctionQuadratic(double level) { super(level, 0D); }
public FunctionQuadratic(double level, double vOff) { super(level, vOff); } public FunctionQuadratic(double level, double vOff) { super(level, vOff); }
@Override public double effonix(double x) { return getX(x) * getX(x) * this.level + this.vOff; } @Override public double effonix(double x) { return getX(x) * getX(x) * this.level + this.vOff; }
@Override public String getLabelForFuel() { return getXName(true) + "² * " + this.level + (vOff != 0 ? (" + " + vOff) : ""); } @Override public String getLabelForFuel() { return getXName(true) + "² * " + String.format("%,.1f", this.level) + (vOff != 0 ? (" + " + String.format("%,.1f", vOff)) : ""); }
@Override public String getDangerFromFuel() { return EnumChatFormatting.RED + "DANGEROUS / QUADRATIC"; } @Override public String getDangerFromFuel() { return EnumChatFormatting.RED + "DANGEROUS / QUADRATIC"; }
} }
} }

View File

@ -78,6 +78,7 @@
"item.vice": {"category": "player", "sounds": [{"name": "tool/vice", "stream": false}]}, "item.vice": {"category": "player", "sounds": [{"name": "tool/vice", "stream": false}]},
"item.upgradePlug": {"category": "player", "sounds": [{"name": "tool/upgradePlug", "stream": false}]}, "item.upgradePlug": {"category": "player", "sounds": [{"name": "tool/upgradePlug", "stream": false}]},
"item.battery": {"category": "player", "sounds": [{"name": "tool/battery", "stream": false}]}, "item.battery": {"category": "player", "sounds": [{"name": "tool/battery", "stream": false}]},
"item.boltgun": {"category": "player", "sounds": [{"name": "tool/boltgun", "stream": false}]},
"music.recordLambdaCore": {"category": "record", "sounds": [{"name": "music/recordLambdaCore", "stream": true}]}, "music.recordLambdaCore": {"category": "record", "sounds": [{"name": "music/recordLambdaCore", "stream": true}]},
"music.recordSectorSweep": {"category": "record", "sounds": [{"name": "music/recordSectorSweep", "stream": true}]}, "music.recordSectorSweep": {"category": "record", "sounds": [{"name": "music/recordSectorSweep", "stream": true}]},

Binary file not shown.