RBMK fuel because the RBMK needs fuel

This commit is contained in:
Bob 2021-04-05 17:18:49 +02:00
parent d1cc4ce941
commit 5f4e3e2d28
15 changed files with 325 additions and 3 deletions

View File

@ -877,6 +877,18 @@ public class ModItems {
public static Item rod_dual_coolant;
public static Item rod_quad_coolant;
public static Item rbmk_fuel_empty;
public static Item rbmk_fuel_meu;
public static Item rbmk_fuel_thmeu;
public static Item rbmk_fuel_lep;
public static Item rbmk_fuel_mep;
public static Item rbmk_fuel_mox;
public static Item rbmk_fuel_les;
public static Item rbmk_fuel_mes;
public static Item rbmk_fuel_hes;
public static Item rbmk_fuel_po210be;
public static Item rbmk_fuel_pu238be;
public static Item scrap;
public static Item trinitite;
public static Item nuclear_waste_long;
@ -3069,6 +3081,19 @@ public class ModItems {
rod_dual_tritium = new ItemHazard(1F).setUnlocalizedName("rod_dual_tritium").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_dual_empty).setTextureName(RefStrings.MODID + ":rod_dual_tritium");
rod_quad_tritium = new ItemHazard(2F).setUnlocalizedName("rod_quad_tritium").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.rod_quad_empty).setTextureName(RefStrings.MODID + ":rod_quad_tritium");
rbmk_fuel_empty = new Item().setUnlocalizedName("rbmk_fuel_empty").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":rbmk_fuel_empty");
//todo: make one item and handle all of this trash with metadata
rbmk_fuel_meu = new ItemRBMKRod("Medium Enriched Uranium").setUnlocalizedName("rbmk_fuel_meu").setTextureName(RefStrings.MODID + ":rbmk_fuel_meu");
rbmk_fuel_thmeu = new ItemRBMKRod("Thorium with MEU Driver Fuel").setUnlocalizedName("rbmk_fuel_thmeu").setTextureName(RefStrings.MODID + ":rbmk_fuel_thmeu");
rbmk_fuel_lep = new ItemRBMKRod("Low Enriched Plutonium").setUnlocalizedName("rbmk_fuel_lep").setTextureName(RefStrings.MODID + ":rbmk_fuel_lep");
rbmk_fuel_mep = new ItemRBMKRod("Medium Enriched Plutonium").setUnlocalizedName("rbmk_fuel_mep").setTextureName(RefStrings.MODID + ":rbmk_fuel_mep");
rbmk_fuel_mox = new ItemRBMKRod("Mixed LEU & LEP Oxide").setUnlocalizedName("rbmk_fuel_mox").setTextureName(RefStrings.MODID + ":rbmk_fuel_mox");
rbmk_fuel_les = new ItemRBMKRod("Low Enriched Schrabidium").setUnlocalizedName("rbmk_fuel_les").setTextureName(RefStrings.MODID + ":rbmk_fuel_les");
rbmk_fuel_mes = new ItemRBMKRod("Medium Enriched Schrabidium").setUnlocalizedName("rbmk_fuel_mes").setTextureName(RefStrings.MODID + ":rbmk_fuel_mes");
rbmk_fuel_hes = new ItemRBMKRod("Highly Enriched Schrabidium").setUnlocalizedName("rbmk_fuel_hes").setTextureName(RefStrings.MODID + ":rbmk_fuel_hes");
rbmk_fuel_po210be = new ItemRBMKRod("Polonium-210 & Beryllium Neutron Source").setUnlocalizedName("rbmk_fuel_po210be").setTextureName(RefStrings.MODID + ":rbmk_fuel_po210be");
rbmk_fuel_pu238be = new ItemRBMKRod("Plutonium-238 & Beryllium Neutron Source").setUnlocalizedName("rbmk_fuel_pu238be").setTextureName(RefStrings.MODID + ":rbmk_fuel_pu238be");
trinitite = new ItemHazard().addRadiation(ItemHazard.trn * ItemHazard.ingot).toItem().setUnlocalizedName("trinitite").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":trinitite_new");
nuclear_waste_long = new ItemHazard(5F).setUnlocalizedName("nuclear_waste_long").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":nuclear_waste_long");
nuclear_waste_long_tiny = new ItemHazard(0.5F).setUnlocalizedName("nuclear_waste_long_tiny").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":nuclear_waste_long_tiny");
@ -5680,6 +5705,18 @@ public class ModItems {
GameRegistry.registerItem(rod_waste, rod_waste.getUnlocalizedName());
GameRegistry.registerItem(rod_dual_waste, rod_dual_waste.getUnlocalizedName());
GameRegistry.registerItem(rod_quad_waste, rod_quad_waste.getUnlocalizedName());
GameRegistry.registerItem(rbmk_fuel_empty, rbmk_fuel_empty.getUnlocalizedName());
GameRegistry.registerItem(rbmk_fuel_meu, rbmk_fuel_meu.getUnlocalizedName());
GameRegistry.registerItem(rbmk_fuel_thmeu, rbmk_fuel_thmeu.getUnlocalizedName());
GameRegistry.registerItem(rbmk_fuel_lep, rbmk_fuel_lep.getUnlocalizedName());
GameRegistry.registerItem(rbmk_fuel_mep, rbmk_fuel_mep.getUnlocalizedName());
GameRegistry.registerItem(rbmk_fuel_mox, rbmk_fuel_mox.getUnlocalizedName());
GameRegistry.registerItem(rbmk_fuel_les, rbmk_fuel_les.getUnlocalizedName());
GameRegistry.registerItem(rbmk_fuel_mes, rbmk_fuel_mes.getUnlocalizedName());
GameRegistry.registerItem(rbmk_fuel_hes, rbmk_fuel_hes.getUnlocalizedName());
GameRegistry.registerItem(rbmk_fuel_po210be, rbmk_fuel_po210be.getUnlocalizedName());
GameRegistry.registerItem(rbmk_fuel_pu238be, rbmk_fuel_pu238be.getUnlocalizedName());
GameRegistry.registerItem(scrap, scrap.getUnlocalizedName());
GameRegistry.registerItem(waste_uranium_hot, waste_uranium_hot.getUnlocalizedName());

View File

@ -0,0 +1,32 @@
package com.hbm.items.machine;
import java.util.List;
import com.hbm.items.ModItems;
import com.hbm.items.special.ItemHazard;
import com.hbm.main.MainRegistry;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
public class ItemRBMKRod extends ItemHazard {
String fullName = "";
public ItemRBMKRod(String fullName) {
this.fullName = fullName;
this.setContainerItem(ModItems.rbmk_fuel_empty);
this.setMaxStackSize(1);
this.setCreativeTab(MainRegistry.controlTab);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
list.add(EnumChatFormatting.ITALIC + this.fullName);
super.addInformation(stack, player, list, bool);
}
}

View File

@ -16,7 +16,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidTank;
@Spaghetti("Not spaghetti in itself, but for the love of god please use this base class for all machines")
public abstract class TileEntityMachineBase extends TileEntity implements ISidedInventory {
public ItemStack slots[];

View File

@ -0,0 +1,6 @@
package com.hbm.tileentity.machine.rbmk;
public interface IRBMKFluxReceiver {
public void receiveFlux(float flux);
}

View File

@ -0,0 +1,11 @@
package com.hbm.tileentity.machine.rbmk;
/**
* Base class for all RBMK components that have a GUI
* @author hbm
*
*/
public abstract class TileEntityRBMKActiveBase extends TileEntityRBMKBase {
public abstract String getName();
}

View File

@ -2,9 +2,38 @@ package com.hbm.tileentity.machine.rbmk;
import net.minecraft.tileentity.TileEntity;
public class TileEntityRBMKBase extends TileEntity {
/**
* Base class for all RBMK components, active or passive. Handles heat and the explosion sequence
* @author hbm
*
*/
public abstract class TileEntityRBMKBase extends TileEntity {
public float heat;
public boolean hasLid() {
return false;
}
public float maxHeat() {
return 1500;
}
public float passiveCooling() {
return 5;
}
//necessary checks to figure out whether players are close enough to ensure that the reactor can be safely used
public boolean shouldUpdate() {
return true;
}
@Override
public void updateEntity() {
moveHeat();
}
private void moveHeat() {
}
}

View File

@ -1,5 +1,21 @@
package com.hbm.tileentity.machine.rbmk;
public class TileEntityRBMKRod extends TileEntityRBMKBase {
public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBMKFluxReceiver {
//amount of "neutron energy" buffered for the next tick to use for the reaction
private float flux;
public TileEntityRBMKRod() {
super(1);
}
@Override
public String getName() {
return "container.rbmkRod";
}
@Override
public void receiveFlux(float flux) {
this.flux += flux;
}
}

View File

@ -0,0 +1,181 @@
package com.hbm.tileentity.machine.rbmk;
import com.hbm.packet.NBTPacket;
import com.hbm.packet.PacketDispatcher;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.fluids.FluidTank;
/**
* Base class for RBMK components that have GUI slots and thus have to handle
* those things Yes it's a copy pasted MachineBase class, thank the lack of
* multiple inheritance for that
*
* @author hbm
*
*/
public abstract class TileEntityRBMKSlottedBase extends TileEntityRBMKActiveBase implements ISidedInventory {
public ItemStack slots[];
private String customName;
public TileEntityRBMKSlottedBase(int scount) {
slots = new ItemStack[scount];
}
@Override
public int getSizeInventory() {
return slots.length;
}
@Override
public ItemStack getStackInSlot(int i) {
return slots[i];
}
@Override
public ItemStack getStackInSlotOnClosing(int i) {
if(slots[i] != null) {
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
} else {
return null;
}
}
@Override
public void setInventorySlotContents(int i, ItemStack itemStack) {
slots[i] = itemStack;
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit()) {
itemStack.stackSize = getInventoryStackLimit();
}
}
@Override
public String getInventoryName() {
return this.hasCustomInventoryName() ? this.customName : getName();
}
@Override
public boolean hasCustomInventoryName() {
return this.customName != null && this.customName.length() > 0;
}
public void setCustomName(String name) {
this.customName = name;
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) {
return false;
} else {
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 128;
}
}
@Override
public void openInventory() {
}
@Override
public void closeInventory() {
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
return false;
}
@Override
public ItemStack decrStackSize(int slot, int amount) {
if(slots[slot] != null) {
if(slots[slot].stackSize <= amount) {
ItemStack itemStack = slots[slot];
slots[slot] = null;
return itemStack;
}
ItemStack itemStack1 = slots[slot].splitStack(amount);
if(slots[slot].stackSize == 0) {
slots[slot] = null;
}
return itemStack1;
} else {
return null;
}
}
@Override
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
return this.isItemValidForSlot(i, itemStack);
}
@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return false;
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
return new int[] {};
}
public int getGaugeScaled(int i, FluidTank tank) {
return tank.getFluidAmount() * i / tank.getCapacity();
}
public void networkPack(NBTTagCompound nbt, int range) {
if(!worldObj.isRemote)
PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(nbt, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
}
public void networkUnpack(NBTTagCompound nbt) {
}
public void handleButtonPacket(int value, int meta) {
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
NBTTagList list = nbt.getTagList("items", 10);
for(int i = 0; i < list.tagCount(); i++) {
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
byte b0 = nbt1.getByte("slot");
if(b0 >= 0 && b0 < slots.length) {
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
}
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
NBTTagList list = new NBTTagList();
for(int i = 0; i < slots.length; i++) {
if(slots[i] != null) {
NBTTagCompound nbt1 = new NBTTagCompound();
nbt1.setByte("slot", (byte) i);
slots[i].writeToNBT(nbt1);
list.appendTag(nbt1);
}
}
nbt.setTag("items", list);
}
}

View File

@ -1887,6 +1887,17 @@ item.radaway.name=RadAway
item.radaway_flush.name=Elite RadAway
item.radaway_strong.name=Strong RadAway
item.radx.name=Rad-X
item.rbmk_fuel_empty.name=Empty RBMK Fuel Rod
item.rbmk_fuel_hes.name=HES RBMK Fuel Rod
item.rbmk_fuel_lep.name=LEP RBMK Fuel Rod
item.rbmk_fuel_les.name=LES RBMK Fuel Rod
item.rbmk_fuel_mep.name=MEP RBMK Fuel Rod
item.rbmk_fuel_mes.name=MES RBMK Fuel Rod
item.rbmk_fuel_meu.name=MEU RBMK Fuel Rod
item.rbmk_fuel_mox.name=MOX RBMK Fuel Rod
item.rbmk_fuel_po210be.name=Po210Be RBMK Neutron Source
item.rbmk_fuel_pu238be.name=Pu238Be RBMK Neutron Source
item.rbmk_fuel_thmeu.name=ThMEU RBMK Fuel Rod
item.reactor_core.name=Breeding Reactor Core
item.reactor_sensor.name=Reactor Remote Sensor
item.record.glass.desc=? ? ?

View File

Before

Width:  |  Height:  |  Size: 553 B

After

Width:  |  Height:  |  Size: 553 B

View File

Before

Width:  |  Height:  |  Size: 556 B

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

View File

Before

Width:  |  Height:  |  Size: 559 B

After

Width:  |  Height:  |  Size: 559 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 611 B