mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Added pills and RT Generator
This commit is contained in:
parent
095cd07f17
commit
bb0474a7e0
@ -747,6 +747,8 @@ item.syringe_metal_empty.name=Metallspritze
|
||||
item.syringe_metal_stimpak.name=Stimpak
|
||||
item.syringe_metal_medx.name=Med-X
|
||||
item.syringe_metal_psycho.name=Psycho
|
||||
item.pill_iodine.name=Iodpille
|
||||
item.plan_c.name=Plan C
|
||||
|
||||
item.stealth_boy.name=Mobile Tarnkappe
|
||||
|
||||
|
||||
@ -747,6 +747,8 @@ item.syringe_metal_empty.name=Metal Syringe
|
||||
item.syringe_metal_stimpak.name=Stimpak
|
||||
item.syringe_metal_medx.name=Med-X
|
||||
item.syringe_metal_psycho.name=Psycho
|
||||
item.pill_iodine.name=Iodine Pill
|
||||
item.plan_c.name=Plan C
|
||||
|
||||
item.stealth_boy.name=Stealth Device
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.1 KiB |
@ -399,6 +399,7 @@ public class ModBlocks {
|
||||
public static final int guiID_machine_reix_mainframe = 38;
|
||||
|
||||
public static Block machine_rtg_grey;
|
||||
public static final int guiID_machine_rtg = 40;
|
||||
//public static Block machine_rtg_red;
|
||||
//public static Block machine_rtg_orange;
|
||||
//public static Block machine_rtg_yellow;
|
||||
|
||||
@ -4,16 +4,29 @@ import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityMachineRTG;
|
||||
import com.hbm.tileentity.TileEntityRtgFurnace;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachineRTG extends Block {
|
||||
public class MachineRTG extends BlockContainer {
|
||||
|
||||
private static boolean keepInventory;
|
||||
private final Random field_149933_a = new Random();
|
||||
private Random rand;
|
||||
|
||||
@ -61,4 +74,85 @@ public class MachineRTG extends Block {
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return side == 1 ? this.iconTop : (side == 0 ? this.iconBottom : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
if(this == ModBlocks.machine_rtg_grey)
|
||||
return new TileEntityMachineRTG();
|
||||
if(this == ModBlocks.machine_rtg_cyan)
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote)
|
||||
{
|
||||
return true;
|
||||
} else if(!player.isSneaking())
|
||||
{
|
||||
if(this == ModBlocks.machine_rtg_grey) {
|
||||
TileEntityMachineRTG entity = (TileEntityMachineRTG) world.getTileEntity(x, y, z);
|
||||
if(entity != null)
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_rtg, world, x, y, z);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
|
||||
{
|
||||
if (!keepInventory)
|
||||
{
|
||||
if (this == ModBlocks.machine_rtg_grey) {
|
||||
TileEntityMachineRTG tileentityfurnace = (TileEntityMachineRTG) p_149749_1_.getTileEntity(p_149749_2_,
|
||||
p_149749_3_, p_149749_4_);
|
||||
|
||||
if (tileentityfurnace != null) {
|
||||
for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) {
|
||||
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0) {
|
||||
int j1 = this.field_149933_a.nextInt(21) + 10;
|
||||
|
||||
if (j1 > itemstack.stackSize) {
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1,
|
||||
p_149749_4_ + f2,
|
||||
new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound()) {
|
||||
entityitem.getEntityItem()
|
||||
.setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float) this.field_149933_a.nextGaussian() * f3;
|
||||
entityitem.motionY = (float) this.field_149933_a.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float) this.field_149933_a.nextGaussian() * f3;
|
||||
p_149749_1_.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
}
|
||||
}
|
||||
|
||||
136
com/hbm/gui/container/ContainerMachineRTG.java
Normal file
136
com/hbm/gui/container/ContainerMachineRTG.java
Normal file
@ -0,0 +1,136 @@
|
||||
package com.hbm.gui.container;
|
||||
|
||||
import com.hbm.gui.SlotDiFurnace;
|
||||
import com.hbm.tileentity.TileEntityMachineRTG;
|
||||
import com.hbm.tileentity.TileEntityMachineUF6Tank;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerMachineRTG extends Container {
|
||||
|
||||
private TileEntityMachineRTG testNuke;
|
||||
private int heat;
|
||||
private int power;
|
||||
|
||||
public ContainerMachineRTG(InventoryPlayer invPlayer, TileEntityMachineRTG tedf) {
|
||||
heat = 0;
|
||||
power = 0;
|
||||
|
||||
testNuke = tedf;
|
||||
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 26, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 44, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 62, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 80, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 4, 98, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 5, 26, 35));
|
||||
this.addSlotToContainer(new Slot(tedf, 6, 44, 35));
|
||||
this.addSlotToContainer(new Slot(tedf, 7, 62, 35));
|
||||
this.addSlotToContainer(new Slot(tedf, 8, 80, 35));
|
||||
this.addSlotToContainer(new Slot(tedf, 9, 98, 35));
|
||||
this.addSlotToContainer(new Slot(tedf, 10, 26, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 11, 44, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 12, 62, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 13, 80, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 14, 98, 53));
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 0, this.testNuke.heat);
|
||||
crafting.sendProgressBarUpdate(this, 1, this.testNuke.power);
|
||||
}
|
||||
|
||||
@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 <= 14) {
|
||||
if (!this.mergeItemStack(var5, 15, this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(var5, 0, 16, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
{
|
||||
var4.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return testNuke.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
for(int i = 0; i < this.crafters.size(); i++)
|
||||
{
|
||||
ICrafting par1 = (ICrafting)this.crafters.get(i);
|
||||
|
||||
if(this.heat != this.testNuke.heat)
|
||||
{
|
||||
par1.sendProgressBarUpdate(this, 0, this.testNuke.heat);
|
||||
}
|
||||
if(this.power != this.testNuke.power)
|
||||
{
|
||||
par1.sendProgressBarUpdate(this, 1, this.testNuke.power);
|
||||
}
|
||||
}
|
||||
|
||||
this.heat = this.testNuke.heat;
|
||||
this.power = this.testNuke.power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int i, int j) {
|
||||
if(i == 0)
|
||||
{
|
||||
testNuke.heat = j;
|
||||
}
|
||||
if(i == 1)
|
||||
{
|
||||
testNuke.power = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
55
com/hbm/gui/gui/GUIMachineRTG.java
Normal file
55
com/hbm/gui/gui/GUIMachineRTG.java
Normal file
@ -0,0 +1,55 @@
|
||||
package com.hbm.gui.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.gui.container.ContainerMachineRTG;
|
||||
import com.hbm.gui.container.ContainerUF6Tank;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.TileEntityMachineRTG;
|
||||
import com.hbm.tileentity.TileEntityMachineUF6Tank;
|
||||
|
||||
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 GUIMachineRTG extends GuiContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_rtg.png");
|
||||
private TileEntityMachineRTG rtg;
|
||||
|
||||
public GUIMachineRTG(InventoryPlayer invPlayer, TileEntityMachineRTG tedf) {
|
||||
super(new ContainerMachineRTG(invPlayer, tedf));
|
||||
rtg = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( int i, int j) {
|
||||
String name = this.rtg.hasCustomInventoryName() ? this.rtg.getInventoryName() : I18n.format(this.rtg.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);
|
||||
|
||||
if(rtg.hasHeat())
|
||||
{
|
||||
int i = rtg.getHeatScaled(52);
|
||||
drawTexturedModalRect(guiLeft + 134, guiTop + 69 - i, 176, 52 - i, 16, i);
|
||||
}
|
||||
if(rtg.hasPower())
|
||||
{
|
||||
int i = rtg.getPowerScaled(52);
|
||||
drawTexturedModalRect(guiLeft + 152, guiTop + 69 - i, 192, 52 - i, 16, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -19,6 +19,7 @@ import com.hbm.gui.container.ContainerMachineCMBFactory;
|
||||
import com.hbm.gui.container.ContainerMachineCoal;
|
||||
import com.hbm.gui.container.ContainerMachineDeuterium;
|
||||
import com.hbm.gui.container.ContainerMachineDiesel;
|
||||
import com.hbm.gui.container.ContainerMachineRTG;
|
||||
import com.hbm.gui.container.ContainerMachineSchrabidiumTransmutator;
|
||||
import com.hbm.gui.container.ContainerMachineShredder;
|
||||
import com.hbm.gui.container.ContainerMachineTeleporter;
|
||||
@ -57,6 +58,7 @@ import com.hbm.gui.gui.GUIMachineDiesel;
|
||||
import com.hbm.gui.gui.GUIMachineElectricFurnace;
|
||||
import com.hbm.gui.gui.GUIMachineGenerator;
|
||||
import com.hbm.gui.gui.GUIMachinePuF6Tank;
|
||||
import com.hbm.gui.gui.GUIMachineRTG;
|
||||
import com.hbm.gui.gui.GUIMachineReactor;
|
||||
import com.hbm.gui.gui.GUIMachineSchrabidiumTransmutator;
|
||||
import com.hbm.gui.gui.GUIMachineShredder;
|
||||
@ -96,6 +98,7 @@ import com.hbm.tileentity.TileEntityMachineDiesel;
|
||||
import com.hbm.tileentity.TileEntityMachineElectricFurnace;
|
||||
import com.hbm.tileentity.TileEntityMachineGenerator;
|
||||
import com.hbm.tileentity.TileEntityMachinePuF6Tank;
|
||||
import com.hbm.tileentity.TileEntityMachineRTG;
|
||||
import com.hbm.tileentity.TileEntityMachineReactor;
|
||||
import com.hbm.tileentity.TileEntityMachineSchrabidiumTransmutator;
|
||||
import com.hbm.tileentity.TileEntityMachineShredder;
|
||||
@ -433,6 +436,14 @@ public class GUIHandler implements IGuiHandler {
|
||||
return new ContainerIGenerator(player.inventory, (TileEntityIGenerator) entity);
|
||||
}
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_machine_rtg:
|
||||
{
|
||||
if(entity instanceof TileEntityMachineRTG)
|
||||
{
|
||||
return new ContainerMachineRTG(player.inventory, (TileEntityMachineRTG) entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -749,6 +760,14 @@ public class GUIHandler implements IGuiHandler {
|
||||
return new GUIIGenerator(player.inventory, (TileEntityIGenerator) entity);
|
||||
}
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_machine_rtg:
|
||||
{
|
||||
if(entity instanceof TileEntityMachineRTG)
|
||||
{
|
||||
return new GUIMachineRTG(player.inventory, (TileEntityMachineRTG) entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@ -15,6 +15,7 @@ import com.hbm.items.food.ItemCottonCandy;
|
||||
import com.hbm.items.food.ItemEnergy;
|
||||
import com.hbm.items.food.ItemLemon;
|
||||
import com.hbm.items.food.ItemNugget;
|
||||
import com.hbm.items.food.ItemPill;
|
||||
import com.hbm.items.food.ItemSchnitzelVegan;
|
||||
import com.hbm.items.food.ItemTemFlakes;
|
||||
import com.hbm.items.food.ItemWaffle;
|
||||
@ -357,6 +358,7 @@ public class ModItems {
|
||||
public static Item limiter;
|
||||
|
||||
public static Item pellet_rtg;
|
||||
public static Item pellet_rtg_weak;
|
||||
public static Item tritium_deuterium_cake;
|
||||
|
||||
public static Item pellet_schrabidium;
|
||||
@ -405,6 +407,8 @@ public class ModItems {
|
||||
public static Item syringe_metal_stimpak;
|
||||
public static Item syringe_metal_medx;
|
||||
public static Item syringe_metal_psycho;
|
||||
public static Item pill_iodine;
|
||||
public static Item plan_c;
|
||||
public static Item stealth_boy;
|
||||
|
||||
public static Item can_empty;
|
||||
@ -1159,6 +1163,7 @@ public class ModItems {
|
||||
circuit_schrabidium = new ItemCustomLore().setUnlocalizedName("circuit_schrabidium").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":circuit_schrabidium");
|
||||
|
||||
pellet_rtg = new ItemCustomLore().setUnlocalizedName("pellet_rtg").setCreativeTab(MainRegistry.tabParts).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":pellet_rtg");
|
||||
pellet_rtg_weak = new ItemCustomLore().setUnlocalizedName("pellet_rtg_weak").setCreativeTab(MainRegistry.tabParts).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":pellet_rtg_weak");
|
||||
tritium_deuterium_cake = new ItemCustomLore().setUnlocalizedName("tritium_deuterium_cake").setCreativeTab(MainRegistry.tabParts).setMaxStackSize(1).setTextureName(RefStrings.MODID + ":tritium_deuterium_cake");
|
||||
|
||||
cell_empty = new ItemCell().setUnlocalizedName("cell_empty").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":cell_empty");
|
||||
@ -1212,6 +1217,8 @@ public class ModItems {
|
||||
syringe_metal_stimpak = new ItemSyringe().setUnlocalizedName("syringe_metal_stimpak").setFull3D().setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":syringe_metal_stimpak");
|
||||
syringe_metal_medx = new ItemSyringe().setUnlocalizedName("syringe_metal_medx").setFull3D().setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":syringe_metal_medx");
|
||||
syringe_metal_psycho = new ItemSyringe().setUnlocalizedName("syringe_metal_psycho").setFull3D().setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":syringe_metal_psycho");
|
||||
pill_iodine = new ItemPill(0).setUnlocalizedName("pill_iodine").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":pill_iodine");
|
||||
plan_c = new ItemPill(0).setUnlocalizedName("plan_c").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":plan_c");
|
||||
stealth_boy = new ItemStarterKit().setUnlocalizedName("stealth_boy").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":stealth_boy");
|
||||
|
||||
can_empty = new Item().setUnlocalizedName("can_empty").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":can_empty");
|
||||
@ -1990,6 +1997,7 @@ public class ModItems {
|
||||
|
||||
//Pellets
|
||||
GameRegistry.registerItem(pellet_rtg, pellet_rtg.getUnlocalizedName());
|
||||
GameRegistry.registerItem(pellet_rtg_weak, pellet_rtg_weak.getUnlocalizedName());
|
||||
GameRegistry.registerItem(tritium_deuterium_cake, tritium_deuterium_cake.getUnlocalizedName());
|
||||
GameRegistry.registerItem(pellet_cluster, pellet_cluster.getUnlocalizedName());
|
||||
GameRegistry.registerItem(pellet_buckshot, pellet_buckshot.getUnlocalizedName());
|
||||
@ -2374,7 +2382,7 @@ public class ModItems {
|
||||
GameRegistry.registerItem(multitool_joule, multitool_joule.getUnlocalizedName());
|
||||
GameRegistry.registerItem(multitool_decon, multitool_decon.getUnlocalizedName());
|
||||
|
||||
//Syringes
|
||||
//Syringes & Pills
|
||||
GameRegistry.registerItem(syringe_empty, syringe_empty.getUnlocalizedName());
|
||||
GameRegistry.registerItem(syringe_antidote, syringe_antidote.getUnlocalizedName());
|
||||
GameRegistry.registerItem(syringe_poison, syringe_poison.getUnlocalizedName());
|
||||
@ -2383,6 +2391,8 @@ public class ModItems {
|
||||
GameRegistry.registerItem(syringe_metal_stimpak, syringe_metal_stimpak.getUnlocalizedName());
|
||||
GameRegistry.registerItem(syringe_metal_medx, syringe_metal_medx.getUnlocalizedName());
|
||||
GameRegistry.registerItem(syringe_metal_psycho, syringe_metal_psycho.getUnlocalizedName());
|
||||
GameRegistry.registerItem(pill_iodine, pill_iodine.getUnlocalizedName());
|
||||
GameRegistry.registerItem(plan_c, plan_c.getUnlocalizedName());
|
||||
GameRegistry.registerItem(stealth_boy, stealth_boy.getUnlocalizedName());
|
||||
|
||||
//Food
|
||||
|
||||
46
com/hbm/items/food/ItemPill.java
Normal file
46
com/hbm/items/food/ItemPill.java
Normal file
@ -0,0 +1,46 @@
|
||||
package com.hbm.items.food;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemPill extends ItemFood {
|
||||
|
||||
public ItemPill(int hunger) {
|
||||
super(hunger, false);
|
||||
this.setAlwaysEdible();
|
||||
}
|
||||
|
||||
Random rand = new Random();
|
||||
|
||||
@Override
|
||||
protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if(this == ModItems.pill_iodine) {
|
||||
player.removePotionEffect(Potion.blindness.id);
|
||||
player.removePotionEffect(Potion.confusion.id);
|
||||
player.removePotionEffect(Potion.digSlowdown.id);
|
||||
player.removePotionEffect(Potion.hunger.id);
|
||||
player.removePotionEffect(Potion.moveSlowdown.id);
|
||||
player.removePotionEffect(Potion.poison.id);
|
||||
player.removePotionEffect(Potion.weakness.id);
|
||||
player.removePotionEffect(Potion.wither.id);
|
||||
}
|
||||
|
||||
if(this == ModItems.plan_c) {
|
||||
player.attackEntityFrom(rand.nextBoolean() ? ModDamageSource.euthanizedSelf : ModDamageSource.euthanizedSelf2, Float.POSITIVE_INFINITY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -131,7 +131,8 @@ public class ItemRadioactive extends Item {
|
||||
this == ModItems.nugget_plutonium ||
|
||||
this == ModItems.rod_neptunium ||
|
||||
this == ModItems.rod_pu238 ||
|
||||
this == ModItems.rod_plutonium) {
|
||||
this == ModItems.rod_plutonium ||
|
||||
this == ModItems.pellet_rtg_weak) {
|
||||
living.addPotionEffect(new PotionEffect(Potion.poison.id, 15 * 20, 2));
|
||||
}
|
||||
|
||||
@ -183,7 +184,6 @@ public class ItemRadioactive extends Item {
|
||||
this == ModItems.ingot_les ||
|
||||
this == ModItems.cell_sas3 ||
|
||||
this == ModItems.fleija_propellant ||
|
||||
this == ModItems.gun_revolver_schrabidium_ammo ||
|
||||
this == ModItems.rod_schrabidium ||
|
||||
this == ModItems.rod_dual_schrabidium ||
|
||||
this == ModItems.rod_quad_schrabidium ||
|
||||
|
||||
@ -254,6 +254,8 @@ public class TileEntityIGenerator extends TileEntity implements ISidedInventory,
|
||||
|
||||
heat += (7 * this.canLocateRTG());
|
||||
|
||||
heat += (3 * this.canLocateWeakRTG());
|
||||
|
||||
for(int i = 0; i < this.canLocateThermalElement(); i++) {
|
||||
if(heat >= 10) {
|
||||
heat -= 10;
|
||||
@ -510,6 +512,18 @@ public class TileEntityIGenerator extends TileEntity implements ISidedInventory,
|
||||
return rtg;
|
||||
}
|
||||
|
||||
public int canLocateWeakRTG() {
|
||||
|
||||
int rtg = 0;
|
||||
|
||||
for(int i = 0; i < slots.length; i++) {
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.pellet_rtg_weak)
|
||||
rtg ++;
|
||||
}
|
||||
|
||||
return rtg;
|
||||
}
|
||||
|
||||
public boolean hasLimiter() {
|
||||
|
||||
for(int i = 0; i < slots.length; i++) {
|
||||
|
||||
371
com/hbm/tileentity/TileEntityMachineRTG.java
Normal file
371
com/hbm/tileentity/TileEntityMachineRTG.java
Normal file
@ -0,0 +1,371 @@
|
||||
package com.hbm.tileentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.MachineGenerator;
|
||||
import com.hbm.calc.UnionOfTileEntitiesAndBooleans;
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import com.hbm.interfaces.IConductor;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.special.ItemBattery;
|
||||
import com.hbm.items.special.ItemFuelRod;
|
||||
import com.hbm.lib.Library;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityMachineRTG extends TileEntity implements ISidedInventory, ISource {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
public int heat;
|
||||
public final int heatMax = 75;
|
||||
public int power;
|
||||
public final int powerMax = 90000;
|
||||
public int age = 0;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
|
||||
private static final int[] slots_top = new int[] { 0 };
|
||||
private static final int[] slots_bottom = new int[] { 0 };
|
||||
private static final int[] slots_side = new int[] { 0 };
|
||||
|
||||
private String customName;
|
||||
|
||||
public TileEntityMachineRTG() {
|
||||
slots = new ItemStack[15];
|
||||
}
|
||||
|
||||
@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 : "container.rtg";
|
||||
}
|
||||
|
||||
@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) <=64;
|
||||
}
|
||||
}
|
||||
|
||||
//You scrubs aren't needed for anything (right now)
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
@Override
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||
|
||||
if(itemStack.getItem() != null && (itemStack.getItem() == ModItems.pellet_rtg || itemStack.getItem() == ModItems.pellet_rtg_weak))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if(slots[i] != null)
|
||||
{
|
||||
if(slots[i].stackSize <= j)
|
||||
{
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
}
|
||||
ItemStack itemStack1 = slots[i].splitStack(j);
|
||||
if (slots[i].stackSize == 0)
|
||||
{
|
||||
slots[i] = null;
|
||||
}
|
||||
|
||||
return itemStack1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
NBTTagList list = nbt.getTagList("items", 10);
|
||||
|
||||
power = nbt.getInteger("power");
|
||||
heat = nbt.getInteger("heat");
|
||||
slots = new ItemStack[getSizeInventory()];
|
||||
|
||||
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);
|
||||
nbt.setInteger("power", (short) (power));
|
||||
nbt.setInteger("heat", (short) (heat));
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int p_94128_1_)
|
||||
{
|
||||
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
public int getPowerScaled(int i) {
|
||||
return (power * i) / powerMax;
|
||||
}
|
||||
|
||||
public int getHeatScaled(int i) {
|
||||
return (heat * i) / heatMax;
|
||||
}
|
||||
|
||||
public boolean hasPower() {
|
||||
return power > 0;
|
||||
}
|
||||
|
||||
public boolean hasHeat() {
|
||||
return heat > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
age++;
|
||||
if(age >= 20)
|
||||
{
|
||||
age = 0;
|
||||
}
|
||||
|
||||
if(age == 9 || age == 19)
|
||||
ffgeuaInit();
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
heat = 0;
|
||||
|
||||
for(int i = 0; i < slots.length; i++) {
|
||||
if(slots[i] != null) {
|
||||
if(slots[i].getItem() == ModItems.pellet_rtg)
|
||||
heat += 5;
|
||||
if(slots[i].getItem() == ModItems.pellet_rtg_weak)
|
||||
heat += 3;
|
||||
}
|
||||
}
|
||||
|
||||
power += heat;
|
||||
if(power > powerMax)
|
||||
power = powerMax;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
Block block = this.worldObj.getBlock(x, y, z);
|
||||
TileEntity tileentity = this.worldObj.getTileEntity(x, y, z);
|
||||
|
||||
if(block == ModBlocks.factory_titanium_conductor && this.worldObj.getBlock(x, y + 1, z) == ModBlocks.factory_titanium_core)
|
||||
{
|
||||
tileentity = this.worldObj.getTileEntity(x, y + 1, z);
|
||||
}
|
||||
if(block == ModBlocks.factory_titanium_conductor && this.worldObj.getBlock(x, y - 1, z) == ModBlocks.factory_titanium_core)
|
||||
{
|
||||
tileentity = this.worldObj.getTileEntity(x, y - 1, z);
|
||||
}
|
||||
if(block == ModBlocks.factory_advanced_conductor && this.worldObj.getBlock(x, y + 1, z) == ModBlocks.factory_advanced_core)
|
||||
{
|
||||
tileentity = this.worldObj.getTileEntity(x, y + 1, z);
|
||||
}
|
||||
if(block == ModBlocks.factory_advanced_conductor && this.worldObj.getBlock(x, y - 1, z) == ModBlocks.factory_advanced_core)
|
||||
{
|
||||
tileentity = this.worldObj.getTileEntity(x, y - 1, z);
|
||||
}
|
||||
|
||||
if(tileentity instanceof IConductor)
|
||||
{
|
||||
if(tileentity instanceof TileEntityCable)
|
||||
{
|
||||
if(Library.checkUnionList(((TileEntityCable)tileentity).uoteab, this))
|
||||
{
|
||||
for(int i = 0; i < ((TileEntityCable)tileentity).uoteab.size(); i++)
|
||||
{
|
||||
if(((TileEntityCable)tileentity).uoteab.get(i).source == this)
|
||||
{
|
||||
if(((TileEntityCable)tileentity).uoteab.get(i).ticked != newTact)
|
||||
{
|
||||
((TileEntityCable)tileentity).uoteab.get(i).ticked = newTact;
|
||||
ffgeua(x, y + 1, z, getTact());
|
||||
ffgeua(x, y - 1, z, getTact());
|
||||
ffgeua(x - 1, y, z, getTact());
|
||||
ffgeua(x + 1, y, z, getTact());
|
||||
ffgeua(x, y, z - 1, getTact());
|
||||
ffgeua(x, y, z + 1, getTact());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
((TileEntityCable)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleans(this, newTact));
|
||||
}
|
||||
}
|
||||
if(tileentity instanceof TileEntityWireCoated)
|
||||
{
|
||||
if(Library.checkUnionList(((TileEntityWireCoated)tileentity).uoteab, this))
|
||||
{
|
||||
for(int i = 0; i < ((TileEntityWireCoated)tileentity).uoteab.size(); i++)
|
||||
{
|
||||
if(((TileEntityWireCoated)tileentity).uoteab.get(i).source == this)
|
||||
{
|
||||
if(((TileEntityWireCoated)tileentity).uoteab.get(i).ticked != newTact)
|
||||
{
|
||||
((TileEntityWireCoated)tileentity).uoteab.get(i).ticked = newTact;
|
||||
ffgeua(x, y + 1, z, getTact());
|
||||
ffgeua(x, y - 1, z, getTact());
|
||||
ffgeua(x - 1, y, z, getTact());
|
||||
ffgeua(x + 1, y, z, getTact());
|
||||
ffgeua(x, y, z - 1, getTact());
|
||||
ffgeua(x, y, z + 1, getTact());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
((TileEntityWireCoated)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleans(this, newTact));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(tileentity instanceof IConsumer && newTact && !(tileentity instanceof TileEntityMachineBattery && ((TileEntityMachineBattery)tileentity).conducts))
|
||||
{
|
||||
list.add((IConsumer)tileentity);
|
||||
}
|
||||
|
||||
if(!newTact)
|
||||
{
|
||||
int size = list.size();
|
||||
if(size > 0)
|
||||
{
|
||||
int part = this.power / size;
|
||||
for(IConsumer consume : list)
|
||||
{
|
||||
if(consume.getPower() < consume.getMaxPower())
|
||||
{
|
||||
if(consume.getMaxPower() - consume.getPower() >= part)
|
||||
{
|
||||
this.power -= part;
|
||||
consume.setPower(consume.getPower() + part);
|
||||
} else {
|
||||
this.power -= consume.getMaxPower() - consume.getPower();
|
||||
consume.setPower(consume.getMaxPower());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord, this.yCoord + 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord - 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord - 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord + 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord - 1, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord + 1, getTact());
|
||||
}
|
||||
|
||||
public boolean getTact() {
|
||||
if(age >= 0 && age < 10)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user