RBMK outgasser column

This commit is contained in:
Bob 2021-06-02 00:17:54 +02:00
parent d23e442572
commit 2b5d95ea01
17 changed files with 439 additions and 10 deletions

View File

@ -908,12 +908,14 @@ public class ModBlocks {
public static Block rbmk_reflector;
public static Block rbmk_absorber;
public static Block rbmk_moderator;
public static Block rbmk_outgasser;
public static Block rbmk_console;
public static final int guiID_rbmk_rod = 113;
public static final int guiID_rbmk_boiler = 114;
public static final int guiID_rbmk_control = 115;
public static final int guiID_rbmk_control_auto = 116;
public static final int guiID_rbmk_console = 117;
public static final int guiID_rbmk_outgasser = 119;
public static Block rbmk_loader;
public static Block pribris;
public static Block pribris_burning;
@ -1700,6 +1702,7 @@ public class ModBlocks {
rbmk_reflector = new RBMKReflector().setBlockName("rbmk_reflector").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_reflector");
rbmk_absorber = new RBMKAbsorber().setBlockName("rbmk_absorber").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_absorber");
rbmk_moderator = new RBMKModerator().setBlockName("rbmk_moderator").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_moderator");
rbmk_outgasser = new RBMKOutgasser().setBlockName("rbmk_outgasser").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_outgasser");
rbmk_console = new RBMKConsole().setBlockName("rbmk_console").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_console");
rbmk_loader = new BlockGeneric(Material.iron).setBlockName("rbmk_loader").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(60.0F).setBlockTextureName(RefStrings.MODID + ":rbmk_loader");
pribris = new RBMKDebris().setBlockName("pribris").setCreativeTab(MainRegistry.machineTab).setHardness(50.0F).setResistance(600.0F).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_debris");
@ -2419,6 +2422,7 @@ public class ModBlocks {
GameRegistry.registerBlock(rbmk_reflector, rbmk_reflector.getUnlocalizedName());
GameRegistry.registerBlock(rbmk_absorber, rbmk_absorber.getUnlocalizedName());
GameRegistry.registerBlock(rbmk_moderator, rbmk_moderator.getUnlocalizedName());
GameRegistry.registerBlock(rbmk_outgasser, rbmk_outgasser.getUnlocalizedName());
GameRegistry.registerBlock(rbmk_console, rbmk_console.getUnlocalizedName());
GameRegistry.registerBlock(rbmk_loader, rbmk_loader.getUnlocalizedName());
GameRegistry.registerBlock(pribris, pribris.getUnlocalizedName());

View File

@ -0,0 +1,42 @@
package com.hbm.blocks.machine.rbmk;
import com.hbm.blocks.ModBlocks;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.rbmk.RBMKDials;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKOutgasser;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class RBMKOutgasser extends RBMKBase {
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= this.offset)
return new TileEntityRBMKOutgasser();
if(hasExtra(meta))
return new TileEntityProxyCombo(false, false, true);
return null;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
return openInv(world, x, y, z, player, ModBlocks.guiID_rbmk_outgasser);
}
@Override
public int getRenderType(){
return this.renderIDPassive;
}
@Override
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);
this.makeExtra(world, x, y + RBMKDials.getColumnHeight(world), z);
}
}

View File

@ -827,6 +827,13 @@ public class GUIHandler implements IGuiHandler {
}
return null;
}
case ModBlocks.guiID_rbmk_outgasser: {
if(entity instanceof TileEntityRBMKOutgasser) {
return new ContainerRBMKOutgasser(player.inventory, (TileEntityRBMKOutgasser) entity);
}
return null;
}
}
// NON-TE CONTAINERS
@ -1641,6 +1648,13 @@ public class GUIHandler implements IGuiHandler {
}
return null;
}
case ModBlocks.guiID_rbmk_outgasser: {
if(entity instanceof TileEntityRBMKOutgasser) {
return new GUIRBMKOutgasser(player.inventory, (TileEntityRBMKOutgasser) entity);
}
return null;
}
}
// ITEM GUIS

View File

@ -9,10 +9,9 @@ public class SlotMachineOutput extends Slot {
public SlotMachineOutput(IInventory inventory, int i, int j, int k) {
super(inventory, i, j, k);
}
@Override
public boolean isItemValid(ItemStack p_75214_1_)
{
return false;
}
}
public boolean isItemValid(ItemStack p_75214_1_) {
return false;
}
}

View File

@ -0,0 +1,64 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotMachineOutput;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKOutgasser;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerRBMKOutgasser extends Container {
private TileEntityRBMKOutgasser rbmk;
public ContainerRBMKOutgasser(InventoryPlayer invPlayer, TileEntityRBMKOutgasser tedf) {
rbmk = tedf;
this.addSlotToContainer(new Slot(tedf, 0, 48, 45));
this.addSlotToContainer(new SlotMachineOutput(tedf, 1, 112, 69));
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 20));
}
}
for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 20));
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
ItemStack var3 = null;
Slot var4 = (Slot) this.inventorySlots.get(par2);
if(var4 != null && var4.getHasStack()) {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if(par2 == 0) {
if(!this.mergeItemStack(var5, rbmk.getSizeInventory(), this.inventorySlots.size(), true)) {
return null;
}
} else if(!this.mergeItemStack(var5, 0, rbmk.getSizeInventory(), false)) {
return null;
}
if(var5.stackSize == 0) {
var4.putStack((ItemStack) null);
} else {
var4.onSlotChanged();
}
}
return var3;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
}

View File

@ -217,7 +217,7 @@ public class GUIRBMKConsole extends GuiInfoContainer {
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if(az5Lid) {
drawTexturedModalRect(guiLeft + 30, guiTop + 138, 90, 172, 28, 28);
drawTexturedModalRect(guiLeft + 30, guiTop + 138, 110, 172, 28, 28);
}
int bX = 86;

View File

@ -0,0 +1,42 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerRBMKOutgasser;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKOutgasser;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUIRBMKOutgasser extends GuiContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/reactors/gui_rbmk_outgasser.png");
private TileEntityRBMKOutgasser rod;
public GUIRBMKOutgasser(InventoryPlayer invPlayer, TileEntityRBMKOutgasser tedf) {
super(new ContainerRBMKOutgasser(invPlayer, tedf));
rod = tedf;
this.xSize = 176;
this.ySize = 186;
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.rod.hasCustomInventoryName() ? this.rod.getInventoryName() : I18n.format(this.rod.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}
}

View File

@ -49,6 +49,14 @@ public class ItemFluidIcon extends Item {
return stack.copy();
}
public static int getQuantity(ItemStack stack) {
if(!stack.hasTagCompound())
return 0;
return stack.getTagCompound().getInteger("fill");
}
public String getItemStackDisplayName(ItemStack stack)
{

View File

@ -467,6 +467,7 @@ public class MainRegistry {
GameRegistry.registerTileEntity(TileEntityFEL.class, "tileentity_fel");
GameRegistry.registerTileEntity(TileEntityDemonLamp.class, "tileentity_demonlamp");
GameRegistry.registerTileEntity(TileEntityStorageDrum.class, "tileentity_waste_storage_drum");
GameRegistry.registerTileEntity(TileEntityDeaerator.class, "tileentity_deaerator");
GameRegistry.registerTileEntity(TileEntityRBMKRod.class, "tileentity_rbmk_rod");
GameRegistry.registerTileEntity(TileEntityRBMKControlManual.class, "tileentity_rbmk_control");
@ -476,6 +477,7 @@ public class MainRegistry {
GameRegistry.registerTileEntity(TileEntityRBMKReflector.class, "tileentity_rbmk_reflector");
GameRegistry.registerTileEntity(TileEntityRBMKAbsorber.class, "tileentity_rbmk_absorber");
GameRegistry.registerTileEntity(TileEntityRBMKModerator.class, "tileentity_rbmk_moderator");
GameRegistry.registerTileEntity(TileEntityRBMKOutgasser.class, "tileentity_rbmk_outgasser");
GameRegistry.registerTileEntity(TileEntityRBMKConsole.class, "tileentity_rbmk_console");
EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true);

View File

@ -189,7 +189,9 @@ public class TileEntityRBMKConsole extends TileEntityMachineBase implements ICon
BOILER(40),
MODERATOR(50),
ABSORBER(60),
REFLECTOR(70);
REFLECTOR(70),
OUTGASSER(80),
BREEDER(90);
public int offset;

View File

@ -0,0 +1,247 @@
package com.hbm.tileentity.machine.rbmk;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidSource;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.RecipesCommon;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.SILEXRecipes.SILEXRecipe;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemFluidIcon;
import com.hbm.lib.Library;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implements IRBMKFluxReceiver, IFluidSource {
public List<IFluidAcceptor> list = new ArrayList();
public FluidTank gas;
public double progress;
public static final int duration = 10000;
public TileEntityRBMKOutgasser() {
super(2);
gas = new FluidTank(FluidType.TRITIUM, 64000, 0);
}
@Override
public String getName() {
return "container.rbmkOutgasser";
}
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
gas.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
if(worldObj.getTotalWorldTime() % 10 == 0)
fillFluidInit(gas.getTankType());
}
}
@Override
public void receiveFlux(NType type, double flux) {
if(canProcess()) {
if(type == NType.FAST)
flux *= 0.2D;
progress += flux;
if(progress > duration) {
process();
this.markDirty();
}
}
}
private static HashMap<Object, ItemStack> recipes = new HashMap();
static {
recipes.put("ingotLithium", ItemFluidIcon.addQuantity(new ItemStack(ModItems.fluid_icon, 1, FluidType.TRITIUM.ordinal()), 1000));
recipes.put("dustLithium", ItemFluidIcon.addQuantity(new ItemStack(ModItems.fluid_icon, 1, FluidType.TRITIUM.ordinal()), 1000));
recipes.put(new ComparableStack(ModItems.powder_lithium_tiny), ItemFluidIcon.addQuantity(new ItemStack(ModItems.fluid_icon, 1, FluidType.TRITIUM.ordinal()), 100));
recipes.put("ingotGold", new ItemStack(ModItems.ingot_au198));
recipes.put("nuggetGold", new ItemStack(ModItems.nugget_au198));
recipes.put("dustGold", new ItemStack(ModItems.powder_au198));
}
private boolean canProcess() {
if(slots[0] == null)
return false;
ItemStack output = getOutput(slots[0]);
if(output == null)
return false;
if(output.getItem() == ModItems.fluid_icon) {
return output.getItemDamage() == gas.getTankType().ordinal() && gas.getFill() + ItemFluidIcon.getQuantity(output) <= gas.getMaxFill();
}
if(slots[1] == null)
return true;
return slots[1].getItem() == output.getItem() && slots[1].getItemDamage() == output.getItemDamage() && slots[1].stackSize + output.stackSize <= slots[1].getMaxStackSize();
}
public static ItemStack getOutput(ItemStack stack) {
if(stack == null || stack.getItem() == null)
return null;
ComparableStack comp = new ComparableStack(stack);
if(recipes.containsKey(comp))
return recipes.get(comp);
String[] dictKeys = comp.getDictKeys();
for(String key : dictKeys) {
if(recipes.containsKey(key))
return recipes.get(key);
}
return null;
}
private void process() {
ItemStack output = getOutput(slots[0]);
if(output.getItem() == ModItems.fluid_icon) {
gas.setFill(gas.getFill() + ItemFluidIcon.getQuantity(output));
return;
}
if(slots[1] == null) {
slots[1] = output.copy();
} else {
slots[1].stackSize += output.stackSize;
}
}
@Override
public void fillFluidInit(FluidType type) {
fillFluid(this.xCoord, this.yCoord + RBMKDials.getColumnHeight(worldObj) + 1, this.zCoord, getTact(), type);
if(worldObj.getBlock(xCoord, yCoord - 1, zCoord) == ModBlocks.rbmk_loader) {
fillFluid(this.xCoord + 1, this.yCoord - 1, this.zCoord, getTact(), type);
fillFluid(this.xCoord - 1, this.yCoord - 1, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord - 1, this.zCoord + 1, getTact(), type);
fillFluid(this.xCoord, this.yCoord - 1, this.zCoord - 1, getTact(), type);
fillFluid(this.xCoord, this.yCoord - 2, this.zCoord, getTact(), type);
}
if(worldObj.getBlock(xCoord, yCoord - 2, zCoord) == ModBlocks.rbmk_loader) {
fillFluid(this.xCoord + 1, this.yCoord - 2, this.zCoord, getTact(), type);
fillFluid(this.xCoord - 1, this.yCoord - 2, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord - 2, this.zCoord + 1, getTact(), type);
fillFluid(this.xCoord, this.yCoord - 2, this.zCoord - 1, getTact(), type);
fillFluid(this.xCoord, this.yCoord - 1, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord - 3, this.zCoord, getTact(), type);
}
}
@Override
public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) {
Library.transmitFluid(x, y, z, newTact, this, worldObj, type);
}
@Override
@Deprecated //why are we still doing this?
public boolean getTact() { return worldObj.getTotalWorldTime() % 20 < 10; }
@Override
public void setFillstate(int fill, int index) {
if(index == 0)
gas.setFill(fill);
}
@Override
public void setFluidFill(int fill, FluidType type) {
if(type == gas.getTankType())
gas.setFill(fill);
}
@Override
public void setType(FluidType type, int index) {
if(index == 0)
gas.setTankType(type);
}
@Override
public List<FluidTank> getTanks() {
return new ArrayList() {{ add(gas); }};
}
@Override
public int getFluidFill(FluidType type) {
if(type == gas.getTankType())
return gas.getFill();
return 0;
}
@Override
public List<IFluidAcceptor> getFluidList(FluidType type) {
return list;
}
@Override
public void clearFluidList(FluidType type) {
list.clear();
}
@Override
public ColumnType getConsoleType() {
return ColumnType.OUTGASSER;
}
@Override
public NBTTagCompound getNBTForConsole() {
NBTTagCompound data = new NBTTagCompound();
data.setInteger("gas", this.gas.getFill());
data.setInteger("maxGas", this.gas.getMaxFill());
data.setShort("type", (short)this.gas.getTankType().ordinal());
data.setDouble("progress", this.progress);
return data;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.heat = nbt.getDouble("progress");
this.gas.readFromNBT(nbt, "gas");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setDouble("progress", this.progress);
this.gas.writeToNBT(nbt, "gas");
}
}

View File

@ -115,8 +115,11 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
//burn baby burn
if(te instanceof TileEntityRBMKRod) {
TileEntityRBMKRod rod = (TileEntityRBMKRod)te;
rod.receiveFlux(stream, flux);
break;
if(rod.getStackInSlot(0) != null && rod.getStackInSlot(0).getItem() instanceof ItemRBMKRod) {
rod.receiveFlux(stream, flux);
break;
}
}
//set neutrons to slow

View File

@ -2932,6 +2932,7 @@ tile.rbmk_control.name=RBMK Steuerstäbe
tile.rbmk_control_auto.name=RBMK Automatische Steuerstäbe
tile.rbmk_loader.name=RBMK-Dampfadapter
tile.rbmk_moderator.name=RBMK Graphitmoderator
tile.rbmk_outgasser.name=RBMK Bestrahlungskanal
tile.rbmk_reflector.name=RBMK Wolframcarbid-Moderator
tile.rbmk_rod.name=RBMK Brennstäbe
tile.reactor_computer.name=Reaktorsteuerung

View File

@ -3016,6 +3016,7 @@ tile.rbmk_control.name=RBMK Control Rods
tile.rbmk_control_auto.name=RBMK Automatic Control Rods
tile.rbmk_loader.name=RBMK Steam Connector
tile.rbmk_moderator.name=RBMK Graphite Moderator
tile.rbmk_outgasser.name=RBMK Irradiation Channel
tile.rbmk_reflector.name=RBMK Tungsten Carbide Neutron Reflector
tile.rbmk_rod.name=RBMK Fuel Rod
tile.reactor_computer.name=Reactor Control

Binary file not shown.

After

Width:  |  Height:  |  Size: 882 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB