killed mud tank, some math stuff
@ -108,7 +108,6 @@ public class SmeltingRecipes {
|
||||
GameRegistry.addSmelting(ModItems.powder_cadmium, new ItemStack(ModItems.ingot_cadmium), 1.0F);
|
||||
|
||||
GameRegistry.addSmelting(ModItems.combine_scrap, new ItemStack(ModItems.ingot_combine_steel), 1.0F);
|
||||
GameRegistry.addSmelting(ModItems.tank_waste, new ItemStack(ModItems.tank_waste), 0.0F);
|
||||
GameRegistry.addSmelting(ModItems.rag_damp, new ItemStack(ModItems.rag), 0.1F);
|
||||
GameRegistry.addSmelting(ModItems.rag_piss, new ItemStack(ModItems.rag), 0.1F);
|
||||
GameRegistry.addSmelting(DictFrame.fromOne(ModBlocks.plant_flower, EnumFlowerType.TOBACCO), DictFrame.fromOne(ModItems.plant_item, EnumPlantType.TOBACCO), 0.1F);
|
||||
|
||||
@ -53,7 +53,7 @@ public class HazmatRegistry {
|
||||
double t45 = 1D; // 90%
|
||||
double ajr = 1.3D; // 95%
|
||||
double bj = 1D; // 90%
|
||||
double hev = 1.3D; // 95%
|
||||
double hev = 2.3D; // 99.5%
|
||||
double rpa = 2D; // 99%
|
||||
double fau = 4D; // 99.99%
|
||||
double dns = 5D; // 99.999%
|
||||
|
||||
@ -7,6 +7,7 @@ import com.hbm.hazard.HazardEntry;
|
||||
import com.hbm.hazard.HazardRegistry;
|
||||
import com.hbm.hazard.HazardSystem;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@ -50,7 +51,7 @@ public class HazardTransformerRadiationContainer extends HazardTransformerBase {
|
||||
}
|
||||
}
|
||||
|
||||
radiation = (float) Math.sqrt(radiation + 1F / ((radiation + 2F) * (radiation + 2F))) - 1F / (radiation + 2F);
|
||||
radiation = (float) BobMathUtil.squirt(radiation);
|
||||
}
|
||||
|
||||
if(radiation > 0) {
|
||||
|
||||
@ -5,6 +5,7 @@ import java.util.List;
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.hazard.modifier.HazardModifier;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.ContaminationUtil;
|
||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
||||
import com.hbm.util.ContaminationUtil.HazardType;
|
||||
@ -36,7 +37,7 @@ public class HazardTypeRadiation extends HazardTypeBase {
|
||||
if(GeneralConfig.enable528 && reacher) {
|
||||
rad = (float) (rad / 49F); //More realistic function for 528: x / distance^2
|
||||
} else if(reacher) {
|
||||
rad = (float) Math.sqrt(rad + 1F / ((rad + 2F) * (rad + 2F))) - 1F / (rad + 2F); //Reworked radiation function: sqrt(x+1/(x+2)^2)-1/(x+2)
|
||||
rad = (float) BobMathUtil.squirt(rad); //Reworked radiation function: sqrt(x+1/(x+2)^2)-1/(x+2)
|
||||
}
|
||||
|
||||
ContaminationUtil.contaminate(target, HazardType.RADIATION, ContaminationType.CREATIVE, rad);
|
||||
|
||||
@ -46,15 +46,6 @@ public class FluidContainerRegistry {
|
||||
|
||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.rod_zirnox_tritium), new ItemStack(ModItems.rod_zirnox_empty), Fluids.TRITIUM, 2000));
|
||||
|
||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.tank_waste, 1, 1), new ItemStack(ModItems.tank_waste, 1, 0), Fluids.WATZ, 8000));
|
||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.tank_waste, 1, 2), new ItemStack(ModItems.tank_waste, 1, 1), Fluids.WATZ, 8000));
|
||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.tank_waste, 1, 3), new ItemStack(ModItems.tank_waste, 1, 2), Fluids.WATZ, 8000));
|
||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.tank_waste, 1, 4), new ItemStack(ModItems.tank_waste, 1, 3), Fluids.WATZ, 8000));
|
||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.tank_waste, 1, 5), new ItemStack(ModItems.tank_waste, 1, 4), Fluids.WATZ, 8000));
|
||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.tank_waste, 1, 6), new ItemStack(ModItems.tank_waste, 1, 5), Fluids.WATZ, 8000));
|
||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.tank_waste, 1, 7), new ItemStack(ModItems.tank_waste, 1, 6), Fluids.WATZ, 8000));
|
||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.tank_waste, 1, 8), new ItemStack(ModItems.tank_waste, 1, 7), Fluids.WATZ, 8000));
|
||||
|
||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.particle_hydrogen), new ItemStack(ModItems.particle_empty), Fluids.HYDROGEN, 1000));
|
||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.particle_amat), new ItemStack(ModItems.particle_empty), Fluids.AMAT, 1000));
|
||||
FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.particle_aschrab), new ItemStack(ModItems.particle_empty), Fluids.ASCHRAB, 1000));
|
||||
|
||||
@ -44,6 +44,7 @@ public class ItemEnumMulti extends Item {
|
||||
|
||||
protected IIcon[] icons;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister reg) {
|
||||
|
||||
@ -60,6 +61,7 @@ public class ItemEnumMulti extends Item {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
|
||||
|
||||
@ -1160,6 +1160,8 @@ public class ModItems {
|
||||
public static ItemRBMKPellet rbmk_pellet_zfb_am_mix;
|
||||
public static ItemRBMKPellet rbmk_pellet_drx;
|
||||
|
||||
public static Item watz_pellet;
|
||||
|
||||
public static Item scrap_plastic;
|
||||
public static Item scrap;
|
||||
public static Item scrap_oil;
|
||||
@ -1803,18 +1805,7 @@ public class ModItems {
|
||||
public static Item arc_electrode;
|
||||
public static Item arc_electrode_burnt;
|
||||
public static Item arc_electrode_desh;
|
||||
/*public static Item dynosphere_base;
|
||||
public static Item dynosphere_desh;
|
||||
public static Item dynosphere_desh_charged;
|
||||
public static Item dynosphere_schrabidium;
|
||||
public static Item dynosphere_schrabidium_charged;
|
||||
public static Item dynosphere_euphemium;
|
||||
public static Item dynosphere_euphemium_charged;
|
||||
public static Item dynosphere_dineutronium;
|
||||
public static Item dynosphere_dineutronium_charged;*/
|
||||
|
||||
public static Item tank_waste;
|
||||
|
||||
/*public static Item factory_core_titanium;
|
||||
public static Item factory_core_advanced;*/
|
||||
|
||||
@ -3256,8 +3247,6 @@ public class ModItems {
|
||||
gas_empty = new Item().setUnlocalizedName("gas_empty").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":gas_empty");
|
||||
gas_full = new ItemGasTank().setUnlocalizedName("gas_full").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.gas_empty).setTextureName(RefStrings.MODID + ":gas_empty");
|
||||
|
||||
tank_waste = new ItemTankWaste().setUnlocalizedName("tank_waste").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab);
|
||||
|
||||
syringe_empty = new Item().setUnlocalizedName("syringe_empty").setFull3D().setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":syringe_empty");
|
||||
syringe_antidote = new ItemSyringe().setUnlocalizedName("syringe_antidote").setFull3D().setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":syringe_antidote");
|
||||
syringe_poison = new ItemSyringe().setUnlocalizedName("syringe_poison").setFull3D().setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":syringe_poison");
|
||||
@ -3825,6 +3814,8 @@ public class ModItems {
|
||||
.setMeltingPoint(100000)
|
||||
.setUnlocalizedName("rbmk_fuel_test").setTextureName(RefStrings.MODID + ":rbmk_fuel_test");
|
||||
|
||||
watz_pellet = new ItemWatzPellet().setUnlocalizedName("watz_pellet").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":watz_pellet");
|
||||
|
||||
trinitite = new ItemNuclearWaste().setUnlocalizedName("trinitite").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":trinitite_new");
|
||||
nuclear_waste_long = new ItemWasteLong().setUnlocalizedName("nuclear_waste_long").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":nuclear_waste_long");
|
||||
nuclear_waste_long_tiny = new ItemWasteLong().setUnlocalizedName("nuclear_waste_long_tiny").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":nuclear_waste_long_tiny");
|
||||
@ -4847,11 +4838,11 @@ public class ModItems {
|
||||
|
||||
ArmorMaterial aMatHEV = EnumHelper.addArmorMaterial("HBM_HEV", 150, new int[] { 3, 8, 6, 3 }, 100);
|
||||
aMatHEV.customCraftingMaterial = ModItems.plate_armor_hev;
|
||||
hev_helmet = new ArmorHEV(aMatHEV, 0, RefStrings.MODID + ":textures/armor/starmetal_1.png", 1000000, 10000, 2500, 0).setMod(0.25F).setCap(4.0F).setThreshold(2.0F)
|
||||
hev_helmet = new ArmorHEV(aMatHEV, 0, RefStrings.MODID + ":textures/armor/starmetal_1.png", 1000000, 10000, 2500, 0).setMod(0.20F).setCap(4.0F).setThreshold(2.0F)
|
||||
.addEffect(new PotionEffect(Potion.moveSpeed.id, 20, 1))
|
||||
.addEffect(new PotionEffect(Potion.jump.id, 20, 0))
|
||||
.setBlastProtection(0.25F)
|
||||
.setMod(0.2F)
|
||||
.setProtectionLevel(500F)
|
||||
.setHasGeigerSound(true)
|
||||
.setHasCustomGeiger(true)
|
||||
.addResistance("fall", 0.5F)
|
||||
@ -6269,9 +6260,6 @@ public class ModItems {
|
||||
GameRegistry.registerItem(inf_water, inf_water.getUnlocalizedName());
|
||||
GameRegistry.registerItem(inf_water_mk2, inf_water_mk2.getUnlocalizedName());
|
||||
|
||||
//Large Tanks
|
||||
GameRegistry.registerItem(tank_waste, tank_waste.getUnlocalizedName());
|
||||
|
||||
//Canisters
|
||||
GameRegistry.registerItem(antiknock, antiknock.getUnlocalizedName());
|
||||
GameRegistry.registerItem(canister_empty, canister_empty.getUnlocalizedName());
|
||||
@ -6667,6 +6655,8 @@ public class ModItems {
|
||||
GameRegistry.registerItem(rbmk_pellet_zfb_am_mix, rbmk_pellet_zfb_am_mix.getUnlocalizedName());
|
||||
GameRegistry.registerItem(rbmk_pellet_drx, rbmk_pellet_drx.getUnlocalizedName());
|
||||
|
||||
GameRegistry.registerItem(watz_pellet, watz_pellet.getUnlocalizedName());
|
||||
|
||||
GameRegistry.registerItem(debris_graphite, debris_graphite.getUnlocalizedName());
|
||||
GameRegistry.registerItem(debris_metal, debris_metal.getUnlocalizedName());
|
||||
GameRegistry.registerItem(debris_fuel, debris_fuel.getUnlocalizedName());
|
||||
|
||||
@ -499,4 +499,9 @@ public class ItemRBMKRod extends Item {
|
||||
setCoreHeat(stack, 20.0D);
|
||||
setHullHeat(stack, 20.0D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated(ItemStack stack, World world, EntityPlayer player) {
|
||||
setNBTDefaults(stack); //minimize the window where NBT screwups can happen
|
||||
}
|
||||
}
|
||||
|
||||
106
src/main/java/com/hbm/items/machine/ItemWatzPellet.java
Normal file
@ -0,0 +1,106 @@
|
||||
package com.hbm.items.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.items.ItemEnumMulti;
|
||||
import com.hbm.render.icon.RGBMutatorInterpolatedComponentRemap;
|
||||
import com.hbm.render.icon.TextureAtlasSpriteMutatable;
|
||||
import com.hbm.util.EnumUtil;
|
||||
import com.hbm.util.function.Function;
|
||||
import com.hbm.util.function.Function.*;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
/*
|
||||
* Watz Isotropic Fuel, Oxidized
|
||||
*/
|
||||
public class ItemWatzPellet extends ItemEnumMulti {
|
||||
|
||||
public ItemWatzPellet() {
|
||||
super(EnumWatzType.class, true, true);
|
||||
}
|
||||
|
||||
public static enum EnumWatzType {
|
||||
|
||||
//TODO: durability
|
||||
SCHRABIDIUM( 0x32FFFF, 0x005C5C, 200, 1D, new FunctionLogarithmic(10), null, null),
|
||||
HES( 0xffffff, 0x000000, 0, 0, null, null, null),
|
||||
LES( 0xffffff, 0x000000, 0, 0, null, null, null),
|
||||
MES( 0xffffff, 0x000000, 0, 0, null, null, null),
|
||||
NP( 0xffffff, 0x000000, 0, 0, null, null, null),
|
||||
MEU( 0xffffff, 0x000000, 0, 0, null, null, null),
|
||||
MEP( 0xffffff, 0x000000, 0, 0, null, null, null),
|
||||
LEAD( 0xA6A6B2, 0x03030F, 0, 0, null, null, new FunctionSqrt(10)), //standard absorber, negative coefficient
|
||||
DU( 0xC1C7BD, 0x2B3227, 0, 0, null, null, new FunctionQuadratic(1D, 1D).withDiv(100)); //absorber with positive coefficient
|
||||
|
||||
public int colorLight;
|
||||
public int colorDark;
|
||||
public double passive; //base flux emission
|
||||
public double heatEmission; //reactivity(1) to heat (heat per outgoing flux)
|
||||
public Function burnFunc; //flux to reactivity(0) (classic reactivity)
|
||||
public Function heatMult; //reactivity(0) to reactivity(1) based on heat (temperature coefficient)
|
||||
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) {
|
||||
this.colorLight = colorLight;
|
||||
this.colorDark = colorDark;
|
||||
this.passive = passive;
|
||||
this.heatEmission = heatEmission;
|
||||
this.burnFunc = burnFunction;
|
||||
this.heatMult = heatMultiplier;
|
||||
this.absorbFunc = absorbFunction;
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister reg) {
|
||||
|
||||
Enum[] enums = theEnum.getEnumConstants();
|
||||
this.icons = new IIcon[enums.length];
|
||||
|
||||
if(reg instanceof TextureMap) {
|
||||
TextureMap map = (TextureMap) reg;
|
||||
|
||||
for(int i = 0; i < EnumWatzType.values().length; i++) {
|
||||
EnumWatzType mat = EnumWatzType.values()[i];
|
||||
String placeholderName = this.getIconString() + "-" + mat.name();
|
||||
TextureAtlasSpriteMutatable mutableIcon = new TextureAtlasSpriteMutatable(placeholderName, new RGBMutatorInterpolatedComponentRemap(0xD2D2D2, 0x333333, mat.colorLight, mat.colorDark));
|
||||
map.setTextureEntry(placeholderName, mutableIcon);
|
||||
icons[i] = mutableIcon;
|
||||
}
|
||||
}
|
||||
|
||||
this.itemIcon = reg.registerIcon(this.getIconString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
IIcon icon = super.getIconFromDamage(meta);
|
||||
return icon == null ? this.itemIcon : icon; //fallback if TextureMap fails during register
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
|
||||
EnumWatzType num = EnumUtil.grabEnumSafely(EnumWatzType.class, stack.getItemDamage());
|
||||
|
||||
String color = EnumChatFormatting.GOLD + "";
|
||||
String reset = EnumChatFormatting.RESET + "";
|
||||
|
||||
if(num.passive > 0) list.add(color + "Base fission rate: " + reset + num.passive);
|
||||
if(num.heatEmission > 0) list.add(color + "Heat per flux: " + reset + num.heatEmission + " TU");
|
||||
if(num.burnFunc != null) {
|
||||
list.add(color + "Reacton function: " + reset + num.burnFunc.getLabelForFuel());
|
||||
list.add(color + "Fuel type: " + reset + num.burnFunc.getDangerFromFuel());
|
||||
}
|
||||
if(num.heatMult != null) list.add(color + "Thermal coefficient: " + reset + num.heatMult.getLabelForFuel());
|
||||
if(num.absorbFunc != null) list.add(color + "Flux capture: " + reset + num.absorbFunc.getLabelForFuel());
|
||||
}
|
||||
}
|
||||
@ -1,60 +0,0 @@
|
||||
package com.hbm.items.special;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class ItemTankWaste extends Item {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] field_150920_d;
|
||||
|
||||
public ItemTankWaste() {
|
||||
this.hasSubtypes = true;
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int p_77617_1_)
|
||||
{
|
||||
int j = MathHelper.clamp_int(p_77617_1_, 0, 8);
|
||||
return this.field_150920_d[j];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister p_94581_1_)
|
||||
{
|
||||
this.field_150920_d = new IIcon[9];
|
||||
|
||||
for (int i = 0; i < field_150920_d.length; ++i)
|
||||
{
|
||||
this.field_150920_d[i] = p_94581_1_.registerIcon(RefStrings.MODID + ":tank_waste_" + i);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List p_150895_3_)
|
||||
{
|
||||
for (int i = 0; i < 9; ++i)
|
||||
{
|
||||
p_150895_3_.add(new ItemStack(p_150895_1_, 1, i));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack p_77667_1_)
|
||||
{
|
||||
int i = MathHelper.clamp_int(p_77667_1_.getItemDamage(), 0, 9);
|
||||
return super.getUnlocalizedName() + "_" + i;
|
||||
}
|
||||
}
|
||||
@ -561,7 +561,6 @@ public class CraftingManager {
|
||||
addRecipeAuto(new ItemStack(ModItems.battery_sc_americium), new Object[] { "NBN", "PCP", "NBN", 'N', TA.nugget(), 'B', AM241.billet(), 'P', ANY_PLASTIC.ingot(), 'C', ModItems.battery_sc_lead });
|
||||
|
||||
addRecipeAuto(new ItemStack(ModItems.wiring_red_copper, 1), new Object[] { "PPP", "PIP", "PPP", 'P', STEEL.plate(), 'I', STEEL.ingot() });
|
||||
addRecipeAuto(new ItemStack(ModItems.tank_waste, 1), new Object[] { "PTP", "PTP", "PTP", 'T', ModItems.tank_steel, 'P', STEEL.plate() });
|
||||
|
||||
addRecipeAuto(new ItemStack(ModItems.jetpack_tank, 1), new Object[] { " S ", "BKB", " S ", 'S', STEEL.plate(), 'B', ModItems.bolt_tungsten, 'K', Fluids.KEROSENE.getDict(1000) });
|
||||
addRecipeAuto(new ItemStack(ModItems.gun_kit_1, 4), new Object[] { "I ", "LB", "P ", 'I', ModItems.plate_polymer, 'L', Fluids.LUBRICANT.getDict(1000), 'B', ModItems.bolt_tungsten, 'P', IRON.plate() });
|
||||
|
||||
@ -1078,6 +1078,7 @@ public class MainRegistry {
|
||||
ignoreMappings.add("hbm:item.gun_mp_ammo");
|
||||
ignoreMappings.add("hbm:item.gun_revolver_lead_ammo");
|
||||
ignoreMappings.add("hbm:item.gun_revolver_schrabidium_ammo");
|
||||
ignoreMappings.add("hbm:item.tank_waste");
|
||||
|
||||
/// REMAP ///
|
||||
remapItems.put("hbm:item.gadget_explosive8", ModItems.early_explosive_lenses);
|
||||
|
||||
@ -20,6 +20,12 @@ import net.minecraft.client.resources.data.TextureMetadataSection;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
* TODO: using this with a missing texture for some reason crashes the game
|
||||
* TexMan's mip map levels seem to be -1 for some reason, run debugger
|
||||
*
|
||||
* @author hbm
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class TextureAtlasSpriteMutatable extends TextureAtlasSprite {
|
||||
|
||||
|
||||
@ -130,7 +130,7 @@ public class TileEntityMachineCMBFactory extends TileEntityLoadedBase implements
|
||||
return true;
|
||||
break;
|
||||
case 2:
|
||||
if(stack.getItem() == ModItems.bucket_mud || (stack.getItem() == ModItems.tank_waste && stack.getItemDamage() > 0))
|
||||
if(stack.getItem() == ModItems.bucket_mud)
|
||||
return true;
|
||||
break;
|
||||
case 3:
|
||||
@ -225,7 +225,7 @@ public class TileEntityMachineCMBFactory extends TileEntityLoadedBase implements
|
||||
if (itemStack.getItem() instanceof IBatteryItem && ((IBatteryItem)itemStack.getItem()).getCharge(itemStack) == 0)
|
||||
return true;
|
||||
if(i == 2)
|
||||
if(itemStack.getItem() == Items.bucket || (itemStack.getItem() == ModItems.tank_waste && itemStack.getItemDamage() <= 0))
|
||||
if(itemStack.getItem() == Items.bucket)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
@ -178,4 +178,19 @@ public class BobMathUtil {
|
||||
|
||||
return Long.toString(l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusted sqrt, approaches standard sqrt but sqrt(x) is never bigger than x
|
||||
*
|
||||
* ____________
|
||||
* / 1 | 1
|
||||
* _ / x + ―――――――― - ―――――
|
||||
* \/ (x + 2)² x + 2
|
||||
*
|
||||
* @param x
|
||||
* @return
|
||||
*/
|
||||
public static double squirt(double x) {
|
||||
return Math.sqrt(x + 1D / ((x + 2D) * (x + 2D))) - 1D / (x + 2D);
|
||||
}
|
||||
}
|
||||
|
||||
81
src/main/java/com/hbm/util/function/Function.java
Normal file
@ -0,0 +1,81 @@
|
||||
package com.hbm.util.function;
|
||||
|
||||
import com.hbm.util.BobMathUtil;
|
||||
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
/**
|
||||
* A simple class for defining function types (linear, log, sqrt, etc.) for things like fuel reactivity.
|
||||
* Unlike current RBMK functions, constants used in the calculations have been removed
|
||||
*
|
||||
* @author hbm
|
||||
*/
|
||||
public abstract class Function {
|
||||
|
||||
protected double div = 1D;
|
||||
protected double off = 0;
|
||||
|
||||
public abstract double effonix(double x);
|
||||
public abstract String getLabelForFuel();
|
||||
public abstract String getDangerFromFuel();
|
||||
|
||||
public Function withDiv(double div) { this.div = div; return this; };
|
||||
public Function withOff(double off) { this.off = off; return this; };
|
||||
|
||||
public double getX(double x) { return x / div + off; }
|
||||
public String getXName() { return getXName(true); }
|
||||
public String getXName(boolean brackets) {
|
||||
String x = "x";
|
||||
boolean mod = false;
|
||||
if(div != 1D) x += " / " + div;
|
||||
if(off != 0D) x += " + " + off;
|
||||
if(mod && brackets) x = "(" + x + ")";
|
||||
return x;
|
||||
}
|
||||
|
||||
public static abstract class FunctionSingleArg extends Function {
|
||||
protected double level;
|
||||
public FunctionSingleArg(double level) { this.level = level; }
|
||||
}
|
||||
|
||||
public static abstract class FunctionDoubleArg extends Function {
|
||||
protected double level, vOff;
|
||||
public FunctionDoubleArg(double level, double vOff) { this.level = level; this.vOff = vOff; }
|
||||
}
|
||||
|
||||
public static class FunctionLogarithmic extends FunctionSingleArg {
|
||||
public FunctionLogarithmic(double level) { super(level); this.withOff(1D); }
|
||||
@Override public double effonix(double x) { return Math.log10(getX(x)) * level; }
|
||||
@Override public String getLabelForFuel() { return "log10(" + getXName(false) + ") * " + level; }
|
||||
@Override public String getDangerFromFuel() { return EnumChatFormatting.YELLOW + "MEDIUM / LOGARITHMIC"; }
|
||||
}
|
||||
|
||||
public static class FunctionPassive extends FunctionSingleArg {
|
||||
public FunctionPassive(double level) { super(level); }
|
||||
@Override public double effonix(double x) { return this.level; }
|
||||
@Override public String getLabelForFuel() { return "" + level; }
|
||||
@Override public String getDangerFromFuel() { return EnumChatFormatting.DARK_GREEN + "SAFE / PASSIVE"; }
|
||||
}
|
||||
|
||||
public static class FunctionSqrt extends FunctionSingleArg {
|
||||
public FunctionSqrt(double level) { super(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 getDangerFromFuel() { return EnumChatFormatting.YELLOW + "MEDIUM / SQUARE ROOT"; }
|
||||
}
|
||||
|
||||
public static class FunctionLinear extends FunctionSingleArg {
|
||||
public FunctionLinear(double level) { super(level); }
|
||||
@Override public double effonix(double x) { return getX(x) * this.level; }
|
||||
@Override public String getLabelForFuel() { return getXName(true) + " * " + this.level; }
|
||||
@Override public String getDangerFromFuel() { return EnumChatFormatting.RED + "DANGEROUS / LINEAR"; }
|
||||
}
|
||||
|
||||
public static class FunctionQuadratic extends FunctionDoubleArg {
|
||||
public FunctionQuadratic(double level) { super(level, 0D); }
|
||||
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 String getLabelForFuel() { return getXName(true) + "² * " + this.level + (vOff != 0 ? (" + " + vOff) : ""); }
|
||||
@Override public String getDangerFromFuel() { return EnumChatFormatting.RED + "DANGEROUS / QUADRATIC"; }
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 260 B |
|
Before Width: | Height: | Size: 273 B |
|
Before Width: | Height: | Size: 289 B |
|
Before Width: | Height: | Size: 300 B |
|
Before Width: | Height: | Size: 305 B |
|
Before Width: | Height: | Size: 311 B |
|
Before Width: | Height: | Size: 320 B |
|
Before Width: | Height: | Size: 328 B |
|
Before Width: | Height: | Size: 331 B |
|
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |