it's everyone's favorite

This commit is contained in:
Boblet 2023-03-01 16:43:43 +01:00
parent a22c8284ee
commit fc531e1c60
16 changed files with 158 additions and 53 deletions

View File

@ -8,6 +8,7 @@ import java.util.List;
import com.hbm.util.fauxpointtwelve.BlockPos;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.ChunkCoordIntPair;
@ -103,13 +104,15 @@ public class ExplosionNukeRayBatched {
double fac = 100 - ((double) i) / ((double) length) * 100;
fac *= 0.07D;
Block block = world.getBlock(iX, iY, iZ);
if(!world.getBlock(iX, iY, iZ).getMaterial().isLiquid())
res -= Math.pow(world.getBlock(iX, iY, iZ).getExplosionResistance(null), 7.5D - fac);
if(!block.getMaterial().isLiquid())
res -= Math.pow(block.getExplosionResistance(null), 7.5D - fac);
//else
// res -= Math.pow(Blocks.air.getExplosionResistance(null), 7.5D - fac); // air is 0, might want to raise that is necessary
if(res > 0 && world.getBlock(iX, iY, iZ) != Blocks.air) {
if(res > 0 && block != Blocks.air) {
lastPos = new FloatTriplet(x0, y0, z0);
//all-air chunks don't need to be buffered at all
ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(iX >> 4, iZ >> 4);

View File

@ -103,6 +103,7 @@ public class Fluids {
public static FluidType SYNGAS;
public static FluidType OXYHYDROGEN;
public static FluidType RADIOSOLVENT;
public static FluidType CHLORINE; //everone's favorite!
private static final HashMap<Integer, FluidType> idMapping = new HashMap();
private static final HashMap<String, FluidType> nameMapping = new HashMap();
@ -221,7 +222,8 @@ public class Fluids {
BLOOD_HOT = new FluidType("BLOOD_HOT", 0xF22419, 3, 0, 0, EnumSymbol.NONE).addTraits(LIQUID).setTemp(666); //it's funny because it's the satan number
SYNGAS = new FluidType("SYNGAS", 0x131313, 1, 4, 2, EnumSymbol.NONE).addTraits(GASEOUS);
OXYHYDROGEN = new FluidType("OXYHYDROGEN", 0x483FC1, 0, 4, 2, EnumSymbol.NONE).addTraits(GASEOUS);
RADIOSOLVENT = new FluidType(88, "RADIOSOLVENT", 0xA4D7DD, 3, 3, 0, EnumSymbol.NONE).addTraits(LIQUID, LEADCON, new FT_Corrosive(50), new FT_VentRadiation(0.01F));
RADIOSOLVENT = new FluidType("RADIOSOLVENT", 0xA4D7DD, 3, 3, 0, EnumSymbol.NONE).addTraits(LIQUID, LEADCON, new FT_Corrosive(50), new FT_VentRadiation(0.01F));
CHLORINE = new FluidType(89, "CHLORINE", 0xBAB572, 4, 0, 0, EnumSymbol.OXIDIZER).addTraits(GASEOUS, new FT_Corrosive(25), new FT_Poison(true, 1));
// ^ ^ ^ ^ ^ ^ ^ ^
@ -257,6 +259,7 @@ public class Fluids {
metaOrder.add(HELIUM3);
metaOrder.add(OXYGEN);
metaOrder.add(XENON);
metaOrder.add(CHLORINE);
metaOrder.add(MERCURY);
//oils, fuels
metaOrder.add(OIL);

View File

@ -0,0 +1,45 @@
package com.hbm.inventory.fluid.tank;
import java.util.Random;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.items.machine.ItemInfiniteFluid;
import net.minecraft.item.ItemStack;
public class FluidLoaderInfinite extends FluidLoadingHandler {
private static Random rand = new Random();
@Override
public boolean fillItem(ItemStack[] slots, int in, int out, FluidTank tank) {
if(slots[in] == null || !(slots[in].getItem() instanceof ItemInfiniteFluid) || tank.getTankType() == Fluids.NONE) return false;
ItemInfiniteFluid item = (ItemInfiniteFluid) slots[in].getItem();
if(item.getType() != null && tank.type != item.getType()) return false;
if(item.getChance() <= 1 || rand.nextInt(item.getChance()) == 0) {
tank.setFill(Math.min(tank.getFill() + item.getAmount(), tank.getMaxFill()));
}
return true;
}
@Override
public boolean emptyItem(ItemStack[] slots, int in, int out, FluidTank tank) {
if(slots[in] == null || !(slots[in].getItem() instanceof ItemInfiniteFluid)) return false;
ItemInfiniteFluid item = (ItemInfiniteFluid) slots[in].getItem();
if(item.getType() != null && tank.type != item.getType()) return false;
if(item.getChance() <= 1 || rand.nextInt(item.getChance()) == 0) {
tank.setFill(Math.max(tank.getFill() - item.getAmount(), 0));
}
return true;
}
}

View File

@ -8,7 +8,6 @@ import org.lwjgl.opengl.GL11;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.gui.GuiInfoContainer;
import com.hbm.items.ModItems;
import com.hbm.items.machine.IItemFluidIdentifier;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.TEFluidPacket;
@ -28,6 +27,7 @@ public class FluidTank {
static {
loadingHandlers.add(new FluidLoaderStandard());
loadingHandlers.add(new FluidLoaderFillableItem());
loadingHandlers.add(new FluidLoaderInfinite());
}
FluidType type;
@ -104,25 +104,6 @@ public class FluidTank {
if(slots[in] == null)
return false;
if(slots[in].getItem() == ModItems.fluid_barrel_infinite && type != Fluids.NONE) {
this.fluid = this.maxFluid;
return true;
}
if(slots[in].getItem() == ModItems.inf_water && this.type == Fluids.WATER) {
this.fluid += 50;
if(this.fluid > this.maxFluid)
this.fluid = this.maxFluid;
return true;
}
if(slots[in].getItem() == ModItems.inf_water_mk2 && this.type == Fluids.WATER) {
this.fluid += 500;
if(this.fluid > this.maxFluid)
this.fluid = this.maxFluid;
return true;
}
int prev = this.getFill();
for(FluidLoadingHandler handler : loadingHandlers) {
@ -140,25 +121,6 @@ public class FluidTank {
if(slots[in] == null)
return false;
if(slots[in].getItem() == ModItems.fluid_barrel_infinite) {
this.fluid = 0;
return true;
}
if(slots[in].getItem() == ModItems.inf_water && type == Fluids.WATER) {
this.fluid -= 50;
if(this.fluid < 0)
this.fluid = 0;
return true;
}
if(slots[in].getItem() == ModItems.inf_water_mk2 && type == Fluids.WATER) {
this.fluid -= 500;
if(this.fluid < 0)
this.fluid = 0;
return true;
}
int prev = this.getFill();
for(FluidLoadingHandler handler : loadingHandlers) {

View File

@ -1,8 +1,11 @@
package com.hbm.inventory.fluid.trait;
import java.util.List;
import com.hbm.handler.radiation.ChunkRadiationManager;
import com.hbm.inventory.fluid.tank.FluidTank;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
public class FT_VentRadiation extends FluidTrait {
@ -21,4 +24,9 @@ public class FT_VentRadiation extends FluidTrait {
public void onFluidRelease(World world, int x, int y, int z, FluidTank tank, int overflowAmount) {
ChunkRadiationManager.proxy.incrementRad(world, x, y, z, overflowAmount * radPerMB);
}
@Override
public void addInfo(List<String> info) {
info.add(EnumChatFormatting.YELLOW + "[Radioactive]");
}
}

View File

@ -35,6 +35,7 @@ public class CombinationRecipes {
recipes.put(new ComparableStack(DictFrame.fromOne(ModItems.briquette, EnumBriquetteType.LIGNITE)), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.LIGNITE), new FluidStack(Fluids.COALCREOSOTE, 100)));
recipes.put(CINNABAR.crystal(), new Pair(new ItemStack(ModItems.sulfur), new FluidStack(Fluids.MERCURY, 100)));
recipes.put(new ComparableStack(Items.glowstone_dust), new Pair(new ItemStack(ModItems.sulfur), new FluidStack(Fluids.CHLORINE, 50)));
recipes.put(KEY_LOG, new Pair(new ItemStack(Items.coal, 1 ,1), new FluidStack(Fluids.WOODOIL, 250)));
recipes.put(KEY_SAPLING, new Pair(null, new FluidStack(Fluids.WOODOIL, 50)));
@ -44,7 +45,7 @@ public class CombinationRecipes {
recipes.put(new ComparableStack(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRACK)), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.PETROLEUM), null));
recipes.put(new ComparableStack(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.COAL)), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.COAL), null));
recipes.put(new ComparableStack(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.WOOD)), new Pair(DictFrame.fromOne(ModItems.coke, EnumCokeType.COAL), null));
recipes.put(new ComparableStack(Items.reeds), new Pair(new ItemStack(Items.sugar, 2), new FluidStack(Fluids.ETHANOL, 50)));
}

View File

@ -120,8 +120,8 @@ public class CrystallizerRecipes {
registerRecipe(CU.dust(), new CrystallizerRecipe(DictFrame.fromOne(ModItems.chemical_dye, EnumChemDye.GREEN, 4), 20), woodOil);
registerRecipe(CO.dust(), new CrystallizerRecipe(DictFrame.fromOne(ModItems.chemical_dye, EnumChemDye.BLUE, 4), 20), woodOil);
registerRecipe(new ComparableStack(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRUDE)), new CrystallizerRecipe(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.WAX), 20), new FluidStack(Fluids.AROMATICS, 250));
registerRecipe(new ComparableStack(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRACK)), new CrystallizerRecipe(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.WAX), 20), new FluidStack(Fluids.AROMATICS, 100));
registerRecipe(new ComparableStack(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRUDE)), new CrystallizerRecipe(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.WAX), 20), new FluidStack(Fluids.CHLORINE, 250));
registerRecipe(new ComparableStack(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRACK)), new CrystallizerRecipe(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.WAX), 20), new FluidStack(Fluids.CHLORINE, 100));
List<ItemStack> quartz = OreDictionary.getOres("crystalCertusQuartz");

View File

@ -3130,7 +3130,7 @@ public class ModItems {
pellet_coal = new Item().setUnlocalizedName("pellet_coal").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":pellet_coal");
component_limiter = new Item().setUnlocalizedName("component_limiter").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":component_limiter");
component_emitter = new Item().setUnlocalizedName("component_emitter").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":component_emitter");
chlorine_pinwheel = new Item().setUnlocalizedName("chlorine_pinwheel").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":chlorine_pinwheel");
chlorine_pinwheel = new ItemInfiniteFluid(Fluids.CHLORINE, 1, 2).setUnlocalizedName("chlorine_pinwheel").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":chlorine_pinwheel");
ring_starmetal = new Item().setUnlocalizedName("ring_starmetal").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ring_starmetal");
flywheel_beryllium = new Item().setUnlocalizedName("flywheel_beryllium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":flywheel_beryllium");
deuterium_filter = new Item().setUnlocalizedName("deuterium_filter").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":deuterium_filter");
@ -3149,7 +3149,7 @@ public class ModItems {
fins_big_steel = new Item().setUnlocalizedName("fins_big_steel").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":fins_big_steel");
fins_tri_steel = new Item().setUnlocalizedName("fins_tri_steel").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":fins_tri_steel");
fins_quad_titanium = new Item().setUnlocalizedName("fins_quad_titanium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":fins_quad_titanium");
sphere_steel = new Item().setUnlocalizedName("sphere_steel").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":sphere_steel");
sphere_steel = new Item().setUnlocalizedName("sphere_steel").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":sphere_steel");
pedestal_steel = new Item().setUnlocalizedName("pedestal_steel").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":pedestal_steel");
dysfunctional_reactor = new Item().setUnlocalizedName("dysfunctional_reactor").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":dysfunctional_reactor");
rotor_steel = new Item().setUnlocalizedName("rotor_steel").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":rotor_steel");
@ -3366,8 +3366,8 @@ public class ModItems {
singularity_spark = new ItemDrop().setUnlocalizedName("singularity_spark").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.nuclear_waste).setTextureName(RefStrings.MODID + ":singularity_spark_alt");
pellet_antimatter = new ItemDrop().setUnlocalizedName("pellet_antimatter").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.cell_empty).setTextureName(RefStrings.MODID + ":pellet_antimatter");
crystal_xen = new ItemDrop().setUnlocalizedName("crystal_xen").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":crystal_xen");
inf_water = new Item().setUnlocalizedName("inf_water").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":inf_water");
inf_water_mk2 = new Item().setUnlocalizedName("inf_water_mk2").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":inf_water_mk2");
inf_water = new ItemInfiniteFluid(Fluids.WATER, 50).setUnlocalizedName("inf_water").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":inf_water");
inf_water_mk2 = new ItemInfiniteFluid(Fluids.WATER, 500).setUnlocalizedName("inf_water_mk2").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":inf_water_mk2");
stamp_stone_flat = new ItemStamp(10, StampType.FLAT).setUnlocalizedName("stamp_stone_flat").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":stamp_stone_flat");
stamp_stone_plate = new ItemStamp(10, StampType.PLATE).setUnlocalizedName("stamp_stone_plate").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":stamp_stone_plate");
@ -4970,7 +4970,7 @@ public class ModItems {
fluid_tank_lead_full = new ItemFluidTank().setUnlocalizedName("fluid_tank_lead_full").setContainerItem(ModItems.fluid_tank_lead_empty).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fluid_tank_lead");
fluid_barrel_full = new ItemFluidTank().setUnlocalizedName("fluid_barrel_full").setContainerItem(ModItems.fluid_barrel_empty).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fluid_barrel");
fluid_barrel_empty = new Item().setUnlocalizedName("fluid_barrel_empty").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fluid_barrel");
fluid_barrel_infinite = new Item().setUnlocalizedName("fluid_barrel_infinite").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fluid_barrel_infinite");
fluid_barrel_infinite = new ItemInfiniteFluid(null, 1_000_000_000).setUnlocalizedName("fluid_barrel_infinite").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fluid_barrel_infinite");
siren_track = new ItemCassette().setUnlocalizedName("siren_track").setMaxStackSize(1).setCreativeTab(MainRegistry.templateTab).setTextureName(RefStrings.MODID + ":cassette");
fluid_duct = new ItemFluidDuct().setUnlocalizedName("fluid_duct").setCreativeTab(MainRegistry.templateTab).setTextureName(RefStrings.MODID + ":duct");

View File

@ -0,0 +1,26 @@
package com.hbm.items.machine;
import com.hbm.inventory.fluid.FluidType;
import net.minecraft.item.Item;
public class ItemInfiniteFluid extends Item {
private FluidType type;
private int amount;
private int chance;
public ItemInfiniteFluid(FluidType type, int amount) {
this(type, amount, 1);
}
public ItemInfiniteFluid(FluidType type, int amount, int chance) {
this.type = type;
this.amount = amount;
this.chance = chance;
}
public FluidType getType() { return this.type; }
public int getAmount() { return this.amount; }
public int getChance() { return this.chance; }
}

View File

@ -19,6 +19,10 @@ import net.minecraft.world.World;
public class ItemLeadBox extends Item implements IGUIProvider {
public ItemLeadBox() {
this.setMaxStackSize(1);
}
@Override
public int getMaxItemUseDuration(ItemStack stack) {
return 1;

View File

@ -0,0 +1,51 @@
package com.hbm.util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import com.hbm.util.Tuple.Pair;
/** A more lightweight, punctual version of the dreadfully slow vanilla profiler. */
public class TimeAnalyzer {
/* instead of writing to the hashmap outright, we write it to a list since during analysis using a hashmap would add unnecessary load */
private static List<Pair<String, Long>> deltas = new ArrayList();
private static String currentSection = "";
private static long sectionStartTime = 0;
public static void startCount(String section) {
currentSection = section;
sectionStartTime = System.nanoTime();
}
public static void endCount() {
long delta = System.nanoTime() - sectionStartTime;
deltas.add(new Pair(currentSection, delta));
}
public static void startEndCount(String section) {
endCount();
startCount(section);
}
public static void dump() {
HashMap<String, Long> milliTime = new HashMap();
for(Pair<String, Long> delta : deltas) {
Long total = milliTime.get(delta.getKey());
if(total == null) total = new Long(0);
total += delta.getValue();
milliTime.put(delta.getKey(), total);
}
for(Entry<String, Long> entry : milliTime.entrySet()) {
System.out.println(entry.getKey() + ": " + entry.getValue() + "ns");
}
currentSection = "";
sectionStartTime = 0;
deltas.clear();
}
}

View File

@ -590,6 +590,7 @@ hbmfluid.bitumen=Bitumen
hbmfluid.blood=Blut
hbmfluid.blood_hot=Heißes Blut
hbmfluid.carbondioxide=Kohlenstoffdioxid
hbmfluid.chlorine=Chlorgas
hbmfluid.coalcreosote=Kohleteer-Kreosot
hbmfluid.coalgas=Kohlebenzin
hbmfluid.coalgas_leaded=Bleikohlebenzin
@ -2400,7 +2401,7 @@ item.oil_tar.coal.name=Kohleteer
item.oil_tar.name=Ölteer
item.oil_tar.crude.name=Erdölteer
item.oil_tar.crack.name=Crackölteer
item.oil_tar.wax.name=Petroleumwachs
item.oil_tar.wax.name=Chloriertes Petroleumwachs
item.oil_tar.wood.name=Holzteer
item.ore.asbestos=Asbest
item.ore.borax=Borax

View File

@ -1147,6 +1147,7 @@ hbmfluid.bitumen=Bitumen
hbmfluid.blood=Blood
hbmfluid.blood_hot=Hot Blood
hbmfluid.carbondioxide=Carbon Dioxide
hbmfluid.chlorine=Chlorine Gas
hbmfluid.coalcreosote=Coal Tar Creosote
hbmfluid.coalgas=Coal Gasoline
hbmfluid.coalgas_leaded=Leaded Coal Gasoline
@ -3066,7 +3067,7 @@ item.oil_detector.noOil=No oil detected.
item.oil_tar.coal.name=Coal Tar
item.oil_tar.crude.name=Oil Tar
item.oil_tar.crack.name=Crack Oil Tar
item.oil_tar.wax.name=Petroleum Wax
item.oil_tar.wax.name=Chlorinated Petroleum Wax
item.oil_tar.wood.name=Wood Tar
item.ore.asbestos=Asbestos
item.ore.borax=Borax

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 973 B

After

Width:  |  Height:  |  Size: 1.3 KiB