mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
watz pellet depletion
This commit is contained in:
parent
a85b564211
commit
f0fe4119f5
@ -6,7 +6,6 @@ import com.hbm.tileentity.machine.TileEntityWatz;
|
|||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ChatComponentText;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class Watz extends BlockDummyable {
|
public class Watz extends BlockDummyable {
|
||||||
@ -26,9 +25,7 @@ public class Watz extends BlockDummyable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if(!world.isRemote) player.addChatComponentMessage(new ChatComponentText("Oh gee, I wonder if the nameless uncraftable thing that isn't even in the changelog works yet, maybe if I click often enough it will work!!"));
|
return super.standardOpenBehavior(world, x, y, z, player, 0);
|
||||||
return true;
|
|
||||||
//return super.standardOpenBehavior(world, x, y, z, player, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -6659,8 +6659,8 @@ public class ModItems {
|
|||||||
GameRegistry.registerItem(rbmk_pellet_zfb_am_mix, rbmk_pellet_zfb_am_mix.getUnlocalizedName());
|
GameRegistry.registerItem(rbmk_pellet_zfb_am_mix, rbmk_pellet_zfb_am_mix.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(rbmk_pellet_drx, rbmk_pellet_drx.getUnlocalizedName());
|
GameRegistry.registerItem(rbmk_pellet_drx, rbmk_pellet_drx.getUnlocalizedName());
|
||||||
|
|
||||||
//GameRegistry.registerItem(watz_pellet, watz_pellet.getUnlocalizedName());
|
GameRegistry.registerItem(watz_pellet, watz_pellet.getUnlocalizedName());
|
||||||
//GameRegistry.registerItem(watz_pellet_depleted, watz_pellet_depleted.getUnlocalizedName());
|
GameRegistry.registerItem(watz_pellet_depleted, watz_pellet_depleted.getUnlocalizedName());
|
||||||
|
|
||||||
GameRegistry.registerItem(debris_graphite, debris_graphite.getUnlocalizedName());
|
GameRegistry.registerItem(debris_graphite, debris_graphite.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(debris_metal, debris_metal.getUnlocalizedName());
|
GameRegistry.registerItem(debris_metal, debris_metal.getUnlocalizedName());
|
||||||
|
|||||||
@ -17,8 +17,10 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
|||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Watz Isotropic Fuel, Oxidized
|
* Watz Isotropic Fuel, Oxidized
|
||||||
@ -34,18 +36,20 @@ public class ItemWatzPellet extends ItemEnumMulti {
|
|||||||
public static enum EnumWatzType {
|
public static enum EnumWatzType {
|
||||||
|
|
||||||
//TODO: durability
|
//TODO: durability
|
||||||
SCHRABIDIUM( 0x32FFFF, 0x005C5C, 200, 1D, new FunctionLogarithmic(10), null, null),
|
SCHRABIDIUM( 0x32FFFF, 0x005C5C, 2_000, 10D, new FunctionLogarithmic(10), null, null),
|
||||||
HES( 0xffffff, 0x000000, 0, 0, null, null, null),
|
HES( 0x66DCD6, 0x023933, 1_500, 10D, null, null, null),
|
||||||
LES( 0xffffff, 0x000000, 0, 0, null, null, null),
|
LES( 0xABB4A8, 0x0C1105, 500, 10D, null, null, null),
|
||||||
MES( 0xffffff, 0x000000, 0, 0, null, null, null),
|
MES( 0xCBEADF, 0x28473C, 1_000, 10D, null, null, null),
|
||||||
NP( 0xffffff, 0x000000, 0, 0, null, null, null),
|
NP( 0xA6B2A6, 0x030F03, 0, 10D, null, null, null),
|
||||||
MEU( 0xffffff, 0x000000, 0, 0, null, null, null),
|
MEU( 0xC1C7BD, 0x2B3227, 0, 10D, null, null, null),
|
||||||
MEP( 0xffffff, 0x000000, 0, 0, null, null, null),
|
MEP( 0x9AA3A0, 0x111A17, 0, 10D, null, null, null),
|
||||||
LEAD( 0xA6A6B2, 0x03030F, 0, 0, null, null, new FunctionSqrt(10)), //standard absorber, negative coefficient
|
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
|
DU( 0xC1C7BD, 0x2B3227, 0, 0, null, null, new FunctionQuadratic(1D, 1D).withDiv(100)); //absorber with positive coefficient
|
||||||
|
|
||||||
|
public double yield = 1_000_000_000;
|
||||||
public int colorLight;
|
public int colorLight;
|
||||||
public int colorDark;
|
public int colorDark;
|
||||||
|
public double mudContent; //how much mud per reaction flux should be produced
|
||||||
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)
|
||||||
@ -129,4 +133,47 @@ public class ItemWatzPellet extends ItemEnumMulti {
|
|||||||
if(num.heatMult != null) list.add(color + "Thermal coefficient: " + reset + num.heatMult.getLabelForFuel());
|
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());
|
if(num.absorbFunc != null) list.add(color + "Flux capture: " + reset + num.absorbFunc.getLabelForFuel());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean showDurabilityBar(ItemStack stack) {
|
||||||
|
return getDurabilityForDisplay(stack) > 0D;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getDurabilityForDisplay(ItemStack stack) {
|
||||||
|
return 1D - getEnrichment(stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getEnrichment(ItemStack stack) {
|
||||||
|
return getYield(stack) / ((ItemRBMKRod) stack.getItem()).yield;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getYield(ItemStack stack) {
|
||||||
|
return getDouble(stack, "yield");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setYield(ItemStack stack, double yield) {
|
||||||
|
setDouble(stack, "yield", yield);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDouble(ItemStack stack, String key, double yield) {
|
||||||
|
if(!stack.hasTagCompound()) setNBTDefaults(stack);
|
||||||
|
stack.stackTagCompound.setDouble(key, yield);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getDouble(ItemStack stack, String key) {
|
||||||
|
if(!stack.hasTagCompound()) setNBTDefaults(stack);
|
||||||
|
return stack.stackTagCompound.getDouble(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setNBTDefaults(ItemStack stack) {
|
||||||
|
EnumWatzType num = EnumUtil.grabEnumSafely(EnumWatzType.class, stack.getItemDamage());
|
||||||
|
stack.stackTagCompound = new NBTTagCompound();
|
||||||
|
setYield(stack, num.yield);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreated(ItemStack stack, World world, EntityPlayer player) {
|
||||||
|
setNBTDefaults(stack); //minimize the window where NBT screwups can happen
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import com.hbm.inventory.fluid.trait.FT_Heatable;
|
|||||||
import com.hbm.inventory.fluid.trait.FT_Heatable.HeatingStep;
|
import com.hbm.inventory.fluid.trait.FT_Heatable.HeatingStep;
|
||||||
import com.hbm.inventory.gui.GUIWatz;
|
import com.hbm.inventory.gui.GUIWatz;
|
||||||
import com.hbm.items.ModItems;
|
import com.hbm.items.ModItems;
|
||||||
|
import com.hbm.items.machine.ItemWatzPellet;
|
||||||
import com.hbm.items.machine.ItemWatzPellet.EnumWatzType;
|
import com.hbm.items.machine.ItemWatzPellet.EnumWatzType;
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
@ -101,8 +102,6 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand
|
|||||||
segment.updateReaction(above, sharedTanks);
|
segment.updateReaction(above, sharedTanks);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: call fluidSend on the bottom-most segment
|
|
||||||
|
|
||||||
/* re-distribute fluid from shared tanks back into actual tanks, bottom to top */
|
/* re-distribute fluid from shared tanks back into actual tanks, bottom to top */
|
||||||
for(int i = segments.size() - 1; i >= 0; i--) {
|
for(int i = segments.size() - 1; i >= 0; i--) {
|
||||||
TileEntityWatz segment = segments.get(i);
|
TileEntityWatz segment = segments.get(i);
|
||||||
@ -183,8 +182,10 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand
|
|||||||
if(burnFunc != null) {
|
if(burnFunc != null) {
|
||||||
double mod = heatMod != null ? heatMod.effonix(heat) : 1D;
|
double mod = heatMod != null ? heatMod.effonix(heat) : 1D;
|
||||||
double burn = burnFunc.effonix(inputFlux) * mod;
|
double burn = burnFunc.effonix(inputFlux) * mod;
|
||||||
|
ItemWatzPellet.setYield(stack, ItemWatzPellet.getYield(stack) - burn);
|
||||||
addedFlux += burn;
|
addedFlux += burn;
|
||||||
addedHeat += type.heatEmission * burn;
|
addedHeat += type.heatEmission * burn;
|
||||||
|
tanks[2].setFill(tanks[2].getFill() + (int) Math.round(type.mudContent * burn));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,6 +207,12 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand
|
|||||||
ItemStack stackBottom = slots[i];
|
ItemStack stackBottom = slots[i];
|
||||||
ItemStack stackTop = above.slots[i];
|
ItemStack stackTop = above.slots[i];
|
||||||
|
|
||||||
|
/* deplete */
|
||||||
|
if(stackBottom != null && stackBottom.getItem() == ModItems.watz_pellet && ItemWatzPellet.getYield(stackBottom) <= 0) {
|
||||||
|
slots[i] = new ItemStack(ModItems.watz_pellet_depleted, 1, stackBottom.getItemDamage());
|
||||||
|
continue; // depleted pellets may persist for one tick
|
||||||
|
}
|
||||||
|
|
||||||
/* items fall down if the bottom slot is empty */
|
/* items fall down if the bottom slot is empty */
|
||||||
if(stackBottom == null && stackTop != null) {
|
if(stackBottom == null && stackTop != null) {
|
||||||
slots[i] = stackTop.copy();
|
slots[i] = stackTop.copy();
|
||||||
|
|||||||
@ -36,7 +36,7 @@ public class StatHelper {
|
|||||||
*/
|
*/
|
||||||
public static void resetStatShitFuck() {
|
public static void resetStatShitFuck() {
|
||||||
|
|
||||||
publicReferenceToOneshotStatListPleaseAllPointAndLaugh = ReflectionHelper.getPrivateValue(StatList.class, null, "field_75942_a", "oneShotStats"); //TODO: not fuck up the mapping here
|
publicReferenceToOneshotStatListPleaseAllPointAndLaugh = ReflectionHelper.getPrivateValue(StatList.class, null, "field_75942_a", "oneShotStats");
|
||||||
|
|
||||||
for(int i = 0; i < StatList.objectCraftStats.length; i++) StatList.objectCraftStats[i] = null;
|
for(int i = 0; i < StatList.objectCraftStats.length; i++) StatList.objectCraftStats[i] = null;
|
||||||
for(int i = 0; i < StatList.mineBlockStatArray.length; i++) StatList.mineBlockStatArray[i] = null;
|
for(int i = 0; i < StatList.mineBlockStatArray.length; i++) StatList.mineBlockStatArray[i] = null;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user