mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
zox rod changes
untested
This commit is contained in:
parent
7a4cad0923
commit
0cfcbf1a97
@ -1,11 +1,8 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotMachineOutput;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemFluidIdentifier;
|
||||
import com.hbm.items.machine.ItemZirnoxRodDeprecated;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineTurbineGas;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
@ -13,7 +10,6 @@ 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.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerMachineTurbineGas extends Container {
|
||||
|
||||
@ -3,7 +3,7 @@ package com.hbm.inventory.container;
|
||||
import com.hbm.inventory.FluidContainerRegistry;
|
||||
import com.hbm.inventory.SlotMachineOutput;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.items.machine.ItemZirnoxRodDeprecated;
|
||||
import com.hbm.items.machine.ItemZirnoxRod;
|
||||
import com.hbm.tileentity.machine.TileEntityReactorZirnox;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -88,7 +88,7 @@ public class ContainerReactorZirnox extends Container {
|
||||
|
||||
} else {
|
||||
|
||||
if(stack.getItem() instanceof ItemZirnoxRodDeprecated) {
|
||||
if(stack.getItem() instanceof ItemZirnoxRod) {
|
||||
|
||||
if(!this.mergeItemStack(stack, 0, 24, true))
|
||||
return null;
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
package com.hbm.items.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class ItemZirnoxBreedingRod extends ItemZirnoxRodDeprecated {
|
||||
|
||||
public ItemZirnoxBreedingRod(int life, int heat) {
|
||||
super(life, heat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
|
||||
|
||||
String[] descLocs = I18nUtil.resolveKeyArray("desc.item.zirnoxBreedingRod", BobMathUtil.getShortNumber(lifeTime));
|
||||
|
||||
for(String loc : descLocs) {
|
||||
list.add(loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,16 @@
|
||||
package com.hbm.items.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.items.ItemEnumMulti;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.EnumUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
@ -15,6 +20,17 @@ public class ItemZirnoxRod extends ItemEnumMulti {
|
||||
public ItemZirnoxRod() {
|
||||
super(EnumZirnoxType.class, true, true);
|
||||
this.setMaxStackSize(1);
|
||||
this.canRepair = false;
|
||||
}
|
||||
|
||||
public static void incrementLifeTime(ItemStack stack) {
|
||||
|
||||
if(!stack.hasTagCompound())
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
|
||||
int time = stack.stackTagCompound.getInteger("life");
|
||||
|
||||
stack.stackTagCompound.setInteger("life", time + 1);
|
||||
}
|
||||
|
||||
public static void setLifeTime(ItemStack stack, int time) {
|
||||
@ -43,6 +59,16 @@ public class ItemZirnoxRod extends ItemEnumMulti {
|
||||
EnumZirnoxType num = EnumUtil.grabEnumSafely(theEnum, stack.getItemDamage());
|
||||
return (double)getLifeTime(stack) / (double)num.maxLife;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
|
||||
EnumZirnoxType num = EnumUtil.grabEnumSafely(theEnum, stack.getItemDamage());
|
||||
String[] loc = I18nUtil.resolveKeyArray("desc.item.zirnox" + (num.breeding ? "BreedingRod" : "Rod"), BobMathUtil.getShortNumber(num.maxLife));
|
||||
|
||||
for(String s : loc) {
|
||||
list.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@ -65,22 +91,30 @@ public class ItemZirnoxRod extends ItemEnumMulti {
|
||||
public static enum EnumZirnoxType {
|
||||
NATURAL_URANIUM_FUEL(250_000, 30),
|
||||
URANIUM_FUEL(200_000, 50),
|
||||
TH232(20_000, 0),
|
||||
TH232(20_000, 0, true),
|
||||
THORIUM_FUEL(200_000, 40),
|
||||
MOX_FUEL(165_000, 75),
|
||||
PLUTONIUM_FUEL(175_000, 65),
|
||||
U233_FUEL(150_000, 100),
|
||||
U235_FUEL(165_000, 85),
|
||||
LES_FUEL(150_000, 150),
|
||||
LITHIUM(20_000, 0),
|
||||
LITHIUM(20_000, 0, true),
|
||||
ZFB_MOX(50_000, 35);
|
||||
|
||||
public int maxLife;
|
||||
public int heat;
|
||||
public final int maxLife;
|
||||
public final int heat;
|
||||
public final boolean breeding;
|
||||
|
||||
private EnumZirnoxType(int life, int heat, boolean breeding) {
|
||||
this.maxLife = life;
|
||||
this.heat = heat;
|
||||
this.breeding = breeding;
|
||||
}
|
||||
|
||||
private EnumZirnoxType(int life, int heat) {
|
||||
this.maxLife = life;
|
||||
this.heat = heat;
|
||||
this.breeding = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
package com.hbm.items.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class ItemZirnoxRodDeprecated extends ItemFuelRod {
|
||||
|
||||
public int heat;
|
||||
|
||||
public ItemZirnoxRodDeprecated(int life, int heat) {
|
||||
super(life);
|
||||
this.heat = heat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
|
||||
|
||||
String[] descLocs = I18nUtil.resolveKeyArray("desc.item.zirnoxRod", heat, BobMathUtil.getShortNumber(lifeTime));
|
||||
|
||||
for(String loc : descLocs) {
|
||||
list.add(loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -20,17 +20,22 @@ import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemZirnoxBreedingRod;
|
||||
import com.hbm.items.machine.ItemZirnoxRodDeprecated;
|
||||
import com.hbm.items.machine.ItemZirnoxRod;
|
||||
import com.hbm.items.machine.ItemZirnoxRod.EnumZirnoxType;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.EnumUtil;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.SimpleComponent;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@ -38,12 +43,6 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.SimpleComponent;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityReactorZirnox extends TileEntityMachineBase implements IFluidContainer, IFluidAcceptor, IFluidSource, IControlReceiver, IFluidStandardTransceiver, SimpleComponent {
|
||||
|
||||
@ -96,12 +95,12 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||
return i < 24 && stack.getItem() instanceof ItemZirnoxRodDeprecated;
|
||||
return i < 24 && stack.getItem() instanceof ItemZirnoxRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack stack, int j) {
|
||||
return i < 24 && !(stack.getItem() instanceof ItemZirnoxRodDeprecated);
|
||||
return i < 24 && !(stack.getItem() instanceof ItemZirnoxRod);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -202,7 +201,7 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF
|
||||
for(int i = 0; i < 24; i++) {
|
||||
|
||||
if(slots[i] != null) {
|
||||
if(slots[i].getItem() instanceof ItemZirnoxRodDeprecated)
|
||||
if(slots[i].getItem() instanceof ItemZirnoxRod)
|
||||
decay(i);
|
||||
else if(slots[i].getItem() == ModItems.meteorite_sword_bred)
|
||||
slots[i] = new ItemStack(ModItems.meteorite_sword_irradiated);
|
||||
@ -263,8 +262,9 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF
|
||||
|
||||
private boolean hasFuelRod(int id) {
|
||||
if(slots[id] != null) {
|
||||
if(!(slots[id].getItem() instanceof ItemZirnoxBreedingRod)) {
|
||||
return slots[id].getItem() instanceof ItemZirnoxRodDeprecated;
|
||||
if(slots[id].getItem() instanceof ItemZirnoxRod) {
|
||||
final EnumZirnoxType num = EnumUtil.grabEnumSafely(EnumZirnoxType.class, slots[id].getItemDamage());
|
||||
return !num.breeding;
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,17 +291,16 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF
|
||||
// itemstack in slots[id] has to contain ItemZirnoxRod
|
||||
private void decay(int id) {
|
||||
int decay = getNeighbourCount(id);
|
||||
final EnumZirnoxType num = EnumUtil.grabEnumSafely(EnumZirnoxType.class, slots[id].getItemDamage());
|
||||
|
||||
if(!(slots[id].getItem() instanceof ItemZirnoxBreedingRod)) {
|
||||
if(!num.breeding)
|
||||
decay++;
|
||||
}
|
||||
|
||||
for(int i = 0; i < decay; i++) {
|
||||
ItemZirnoxRodDeprecated rod = ((ItemZirnoxRodDeprecated) slots[id].getItem());
|
||||
this.heat += rod.heat;
|
||||
ItemZirnoxRodDeprecated.setLifeTime(slots[id], ItemZirnoxRodDeprecated.getLifeTime(slots[id]) + 1);
|
||||
this.heat += num.heat;
|
||||
ItemZirnoxRod.incrementLifeTime(slots[id]);;
|
||||
|
||||
if(ItemZirnoxRodDeprecated.getLifeTime(slots[id]) > rod.lifeTime) {
|
||||
if(ItemZirnoxRod.getLifeTime(slots[id]) > num.maxLife) {
|
||||
slots[id] = fuelMap.get(new ComparableStack(getStackInSlot(id))).copy();
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user