the blombus

This commit is contained in:
Boblet 2025-01-27 16:55:41 +01:00
parent 64f5bbe4bb
commit 841864e368
7 changed files with 143 additions and 7 deletions

View File

@ -4,6 +4,9 @@
* Can be cooled into cold perflyoromethyl using two compressors to be used as coolant for particle accelerators * Can be cooled into cold perflyoromethyl using two compressors to be used as coolant for particle accelerators
* Also required for soldering all control units * Also required for soldering all control units
* Standard coolant will be removed soon in favor of perfloromethyl, however for now it continues to function just the same * Standard coolant will be removed soon in favor of perfloromethyl, however for now it continues to function just the same
# Particle accelerator
* A new and improved version of the old one
* Instead of being assembled block by block with weird rules, the new PA is assembled from six different machine parts, similar to how RBMKs work
## Changed ## Changed
* The bedrock ore processor now has an NEI handler * The bedrock ore processor now has an NEI handler
@ -25,10 +28,11 @@
* Removed compression recipes for steam, because why would you ever use those? * Removed compression recipes for steam, because why would you ever use those?
* Fluid tanks that use pressurized fluids now say "pressurized, use compressor!" to avoid confusion over what "1PU" means * Fluid tanks that use pressurized fluids now say "pressurized, use compressor!" to avoid confusion over what "1PU" means
* Damage should no longer register at all when the damage resistance is 100%, similar to how damage is completely nullified by DT (i.e. not even knockback is applied) * Damage should no longer register at all when the damage resistance is 100%, similar to how damage is completely nullified by DT (i.e. not even knockback is applied)
* Anvil construction recipes are now configurable via `hbmAnvil.json`
## Fixed ## Fixed
* Fixed incorrect tooltip in the automatic control rod's GUI * Fixed incorrect tooltip in the automatic control rod's GUI
* Fixed recipe autogen creating recipes for nonexistant thorium bedrock ore * Fixed recipe autogen creating recipes for nonexistant thorium nether ore
* Fixed FBI agents spawning both the old and new bullet entities when firing * Fixed FBI agents spawning both the old and new bullet entities when firing
* Fixed dupe concerning one of the weapon abilities * Fixed dupe concerning one of the weapon abilities
* Fixed crates not sending a block update when the contents change, breaking redstone comparator functionality * Fixed crates not sending a block update when the contents change, breaking redstone comparator functionality
@ -37,5 +41,7 @@
* Gun damage now also does 0 points of vanilla damage, ensuring that certain entity events trigger, e.g. neutral mobs targeting the player * Gun damage now also does 0 points of vanilla damage, ensuring that certain entity events trigger, e.g. neutral mobs targeting the player
* Fixed items being deleted by the crucible when using hotbar shortcuts by disabling hotkey shortcuts entirely * Fixed items being deleted by the crucible when using hotbar shortcuts by disabling hotkey shortcuts entirely
* How about you shift-click like a normal person * How about you shift-click like a normal person
* Hotkey shortcuts may return, but this requires a substantial rewrite of the container base code because vanilla's implementation is atrocious
* Fixed legendary crafting causing disconnects on servers * Fixed legendary crafting causing disconnects on servers
* Fixed a dupe caused by shift clicking * Fixed a dupe caused by shift clicking
* Added more safeguards and range checks to ReaSim water calculation which might fix the issue of ReaSim water breaking completely

View File

@ -17,7 +17,7 @@ import net.minecraft.item.ItemStack;
public class ParticleAcceleratorRecipes extends SerializableRecipe { public class ParticleAcceleratorRecipes extends SerializableRecipe {
private static final List<ParticleAcceleratorRecipe> recipes = new ArrayList(); public static final List<ParticleAcceleratorRecipe> recipes = new ArrayList();
@Override @Override
public void registerDefaults() { public void registerDefaults() {

View File

@ -1,8 +1,12 @@
package com.hbm.inventory.recipes.anvil; package com.hbm.inventory.recipes.anvil;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.stream.JsonWriter;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.config.GeneralConfig; import com.hbm.config.GeneralConfig;
import com.hbm.inventory.OreDictManager; import com.hbm.inventory.OreDictManager;
@ -18,10 +22,12 @@ import com.hbm.inventory.material.Mats;
import com.hbm.inventory.material.NTMMaterial; import com.hbm.inventory.material.NTMMaterial;
import com.hbm.inventory.recipes.AssemblerRecipes; import com.hbm.inventory.recipes.AssemblerRecipes;
import com.hbm.inventory.recipes.AssemblerRecipes.AssemblerRecipe; import com.hbm.inventory.recipes.AssemblerRecipes.AssemblerRecipe;
import com.hbm.inventory.recipes.loader.SerializableRecipe;
import com.hbm.items.ItemEnums.EnumChunkType; import com.hbm.items.ItemEnums.EnumChunkType;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.food.ItemFlask.EnumInfusion; import com.hbm.items.food.ItemFlask.EnumInfusion;
import com.hbm.items.machine.ItemCircuit.EnumCircuitType; import com.hbm.items.machine.ItemCircuit.EnumCircuitType;
import com.hbm.util.Tuple.Pair;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
@ -30,7 +36,7 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
public class AnvilRecipes { public class AnvilRecipes extends SerializableRecipe {
private static List<AnvilSmithingRecipe> smithingRecipes = new ArrayList(); private static List<AnvilSmithingRecipe> smithingRecipes = new ArrayList();
private static List<AnvilConstructionRecipe> constructionRecipes = new ArrayList(); private static List<AnvilConstructionRecipe> constructionRecipes = new ArrayList();
@ -39,6 +45,11 @@ public class AnvilRecipes {
registerSmithing(); registerSmithing();
registerConstruction(); registerConstruction();
} }
@Override public String getFileName() { return "hbmAnvil.json"; }
@Override public Object getRecipeObject() { return constructionRecipes; }
@Override public void deleteRecipes() { constructionRecipes.clear(); }
@Override public void registerDefaults() { registerConstruction(); }
/* /*
* ////// // // // ////// // // // // // ////// * ////// // // // ////// // // // // // //////
@ -1064,6 +1075,12 @@ public class AnvilRecipes {
this.setOverlay(OverlayType.NONE); //no preferred overlay for many:many conversions this.setOverlay(OverlayType.NONE); //no preferred overlay for many:many conversions
} }
public AnvilConstructionRecipe(AStack[] input, Pair<ItemStack, Float>[] output) {
for(AStack stack : input) this.input.add(stack);
for(Pair<ItemStack, Float> out : output) this.output.add(new AnvilOutput(out.getKey(), out.getValue()));
this.setOverlay(OverlayType.NONE); //no preferred overlay for many:many conversions
}
public AnvilConstructionRecipe setTier(int tier) { public AnvilConstructionRecipe setTier(int tier) {
this.tierLower = tier; this.tierLower = tier;
if(GeneralConfig.enableLBSM && GeneralConfig.enableLBSMUnlockAnvil) this.tierLower = 1; if(GeneralConfig.enableLBSM && GeneralConfig.enableLBSMUnlockAnvil) this.tierLower = 1;
@ -1130,4 +1147,42 @@ public class AnvilRecipes {
RECYCLING, RECYCLING,
SMITHING; SMITHING;
} }
@Override
public void readRecipe(JsonElement recipe) {
JsonObject obj = (JsonObject) recipe;
AStack[] inputs = this.readAStackArray(obj.get("inputs").getAsJsonArray());
Pair<ItemStack, Float>[] outputs = this.readItemStackArrayChance(obj.get("outputs").getAsJsonArray());
int tierLower = obj.get("tierLower").getAsInt();
int tierUpper = obj.has("tierUpper") ? obj.get("tierUpper").getAsInt() : -1;
OverlayType overlay = OverlayType.NONE;
if(obj.has("overlay")) {
String overlayName = obj.get("overlay").getAsString();
overlay = OverlayType.valueOf(overlayName);
if(overlay == null) overlay = OverlayType.NONE;
}
this.constructionRecipes.add(new AnvilConstructionRecipe(inputs, outputs).setTierRange(tierLower, tierUpper).setOverlay(overlay));
}
@Override
public void writeRecipe(Object recipe, JsonWriter writer) throws IOException {
AnvilConstructionRecipe rec = (AnvilConstructionRecipe) recipe;
writer.name("inputs").beginArray();
for(AStack stack : rec.input) this.writeAStack(stack, writer);
writer.endArray();
writer.name("outputs").beginArray();
for(AnvilOutput stack : rec.output) this.writeItemStackChance(new Pair(stack.stack, stack.chance), writer);
writer.endArray();
writer.name("tierLower").value(rec.tierLower);
writer.name("tierUpper").value(rec.tierUpper);
writer.name("overlay").value(rec.overlay.name());
}
} }

View File

@ -24,6 +24,7 @@ import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.material.MatDistribution; import com.hbm.inventory.material.MatDistribution;
import com.hbm.inventory.recipes.*; import com.hbm.inventory.recipes.*;
import com.hbm.inventory.recipes.anvil.AnvilRecipes;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.util.Tuple.Pair; import com.hbm.util.Tuple.Pair;
@ -75,6 +76,8 @@ public abstract class SerializableRecipe {
recipeHandlers.add(new ExposureChamberRecipes()); recipeHandlers.add(new ExposureChamberRecipes());
recipeHandlers.add(new AmmoPressRecipes()); recipeHandlers.add(new AmmoPressRecipes());
recipeHandlers.add(new AssemblerRecipes()); recipeHandlers.add(new AssemblerRecipes());
//AFTER Assembler
recipeHandlers.add(new AnvilRecipes());
recipeHandlers.add(new PedestalRecipes()); recipeHandlers.add(new PedestalRecipes());
recipeHandlers.add(new MatDistribution()); recipeHandlers.add(new MatDistribution());

View File

@ -2,18 +2,23 @@ package com.hbm.tileentity.machine.albion;
import com.hbm.inventory.container.ContainerPADetector; import com.hbm.inventory.container.ContainerPADetector;
import com.hbm.inventory.gui.GUIPADetector; import com.hbm.inventory.gui.GUIPADetector;
import com.hbm.inventory.recipes.ParticleAcceleratorRecipes;
import com.hbm.inventory.recipes.ParticleAcceleratorRecipes.ParticleAcceleratorRecipe;
import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.machine.albion.TileEntityPASource.Particle;
import com.hbm.util.fauxpointtwelve.BlockPos;
import com.hbm.util.fauxpointtwelve.DirPos; import com.hbm.util.fauxpointtwelve.DirPos;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityPADetector extends TileEntityCooledBase implements IGUIProvider { public class TileEntityPADetector extends TileEntityCooledBase implements IGUIProvider, IParticleUser {
public TileEntityPADetector() { public TileEntityPADetector() {
super(5); super(5);
@ -76,4 +81,68 @@ public class TileEntityPADetector extends TileEntityCooledBase implements IGUIPr
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUIPADetector(player.inventory, this); return new GUIPADetector(player.inventory, this);
} }
@Override
public boolean canParticleEnter(Particle particle, ForgeDirection dir, int x, int y, int z) {
ForgeDirection detectorDir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10).getRotation(ForgeDirection.DOWN);
BlockPos input = new BlockPos(xCoord, yCoord, zCoord).offset(detectorDir, -4);
return input.compare(x, y, z) && detectorDir == dir;
}
@Override
public void onEnter(Particle particle, ForgeDirection dir) {
particle.invalid = true;
//particle will crash if not perfectly focused
if(particle.defocus > 0) return;
for(ParticleAcceleratorRecipe recipe : ParticleAcceleratorRecipes.recipes) {
if(particle.momentum >= recipe.momentum &&
((recipe.input1.matchesRecipe(particle.input1, true) && recipe.input2.matchesRecipe(particle.input2, true)) ||
(recipe.input1.matchesRecipe(particle.input2, true) && recipe.input2.matchesRecipe(particle.input1, true)))) {
if(canAccept(recipe)) {
if(recipe.output1.getItem().hasContainerItem(recipe.output1)) this.decrStackSize(1, 1);
if(recipe.output2.getItem().hasContainerItem(recipe.output2)) this.decrStackSize(2, 1);
if(slots[3] == null) {
slots[3] = recipe.output1.copy();
} else {
slots[3].stackSize += recipe.output1.stackSize;
}
if(slots[4] == null) {
slots[4] = recipe.output2.copy();
} else {
slots[4].stackSize += recipe.output2.stackSize;
}
}
return;
}
}
}
public boolean canAccept(ParticleAcceleratorRecipe recipe) {
return checkSlot(recipe.output1, 1, 3) && checkSlot(recipe.output2, 2, 4);
}
public boolean checkSlot(ItemStack output, int containerSlot, int outputSlot) {
if(output != null) {
if(slots[outputSlot] != null) {
//cancel if: output item does not match, meta does not match, resulting stacksize exceeds stack limit
if(slots[outputSlot].getItem() != output.getItem() || slots[outputSlot].getItemDamage() != output.getItemDamage() || slots[outputSlot].stackSize + output.stackSize > output.getMaxStackSize()) return false;
}
if(slots[outputSlot].getItem().hasContainerItem(slots[outputSlot])) {
ItemStack container = slots[outputSlot].getItem().getContainerItem(slots[outputSlot]);
//cancel if: container slot is empty, container item does not match, meta does not match
if(slots[containerSlot] == null || slots[containerSlot].getItem() != container.getItem() || slots[containerSlot].getItemDamage() != container.getItemDamage()) return false;
}
}
return true;
}
@Override
public BlockPos getExitPos(Particle particle) {
return null;
}
} }

View File

@ -79,7 +79,7 @@ public class TileEntityPASource extends TileEntityCooledBase implements IGUIProv
if(pa.canParticleEnter(particle, particle.dir, particle.x, particle.y, particle.z)) { if(pa.canParticleEnter(particle, particle.dir, particle.x, particle.y, particle.z)) {
pa.onEnter(particle, particle.dir); pa.onEnter(particle, particle.dir);
BlockPos exit = pa.getExitPos(particle); BlockPos exit = pa.getExitPos(particle);
particle.move(exit); if(exit != null) particle.move(exit);
} else { particle.crash(); worldObj.createExplosion(null, particle.x + 0.5, particle.y + 0.5, particle.z + 0.5, 5, false); return; } } else { particle.crash(); worldObj.createExplosion(null, particle.x + 0.5, particle.y + 0.5, particle.z + 0.5, 5, false); return; }
} else { } else {
System.out.println("derailed!"); System.out.println("derailed!");

View File

@ -18,6 +18,7 @@ import com.hbm.tileentity.IBufPacketReceiver;
import com.hbm.tileentity.IOverpressurable; import com.hbm.tileentity.IOverpressurable;
import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.tileentity.TileEntityLoadedBase;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
import com.hbm.util.BobMathUtil;
import com.hbm.util.Compat; import com.hbm.util.Compat;
import com.hbm.util.I18nUtil; import com.hbm.util.I18nUtil;
import com.hbm.util.fauxpointtwelve.BlockPos; import com.hbm.util.fauxpointtwelve.BlockPos;
@ -134,8 +135,10 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements
double availableWater = this.water; double availableWater = this.water;
double availableSpace = this.maxSteam - this.steam; double availableSpace = this.maxSteam - this.steam;
int processedWater = (int) Math.floor(Math.min(availableHeat, Math.min(availableWater, availableSpace)) * RBMKDials.getReaSimBoilerSpeed(worldObj)); int processedWater = (int) Math.floor(BobMathUtil.min(availableHeat, availableWater, availableSpace) * MathHelper.clamp_double(RBMKDials.getReaSimBoilerSpeed(worldObj), 0D, 1D));
if(processedWater <= 0) return;
this.water -= processedWater; this.water -= processedWater;
this.steam += processedWater; this.steam += processedWater;
this.heat -= processedWater * heatConsumption; this.heat -= processedWater * heatConsumption;