most of the cyclotron work and some other crunchy garbage

This commit is contained in:
Bob 2020-09-18 23:33:38 +02:00
parent 9624eb9fa7
commit d13385f2db
22 changed files with 3357 additions and 772 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -0,0 +1,5 @@
{
"animation": {
"frametime": 3
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -0,0 +1,45 @@
{
"animation": {
"frametime": 2,
"frames": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
18,
17,
16,
15,
14,
13,
12,
11,
10,
9,
8,
7,
6,
5,
4,
3,
2,
1
]
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -1820,7 +1820,7 @@ public class ModBlocks {
GameRegistry.registerBlock(machine_generator, machine_generator.getUnlocalizedName());
GameRegistry.registerBlock(machine_controller, machine_controller.getUnlocalizedName());
GameRegistry.registerBlock(machine_reactor_small, machine_reactor_small.getUnlocalizedName());
GameRegistry.registerBlock(machine_industrial_generator, machine_industrial_generator.getUnlocalizedName());
//GameRegistry.registerBlock(machine_industrial_generator, machine_industrial_generator.getUnlocalizedName());
GameRegistry.registerBlock(machine_radgen, machine_radgen.getUnlocalizedName());
GameRegistry.registerBlock(machine_cyclotron, machine_cyclotron.getUnlocalizedName());
GameRegistry.registerBlock(machine_rtg_grey, machine_rtg_grey.getUnlocalizedName());

View File

@ -1,43 +1,49 @@
package com.hbm.blocks.machine;
import java.util.Random;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks;
import com.hbm.handler.MultiblockHandler;
import com.hbm.interfaces.IMultiblock;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.machine.TileEntityDummy;
import com.hbm.tileentity.machine.TileEntityMachineCyclotron;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
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.world.World;
public class MachineCyclotron extends BlockContainer implements IMultiblock {
public class MachineCyclotron extends BlockDummyable {
private final Random field_149933_a = new Random();
private Random rand;
private static boolean keepInventory;
public MachineCyclotron(Material mat) {
super(mat);
}
public MachineCyclotron(Material p_i45386_1_) {
super(p_i45386_1_);
rand = new Random();
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= 12)
return new TileEntityMachineCyclotron();
return null;
}
@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
{
return Item.getItemFromBlock(ModBlocks.machine_cyclotron);
}
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())
{
int[] pos = this.findCore(world, x, y, z);
if(pos == null)
return false;
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_cyclotron, world, pos[0], pos[1], pos[2]);
return true;
} else {
return false;
}
}
@Override
public int getRenderType() {
@ -53,124 +59,14 @@ public class MachineCyclotron extends BlockContainer implements IMultiblock {
public boolean renderAsNormalBlock() {
return false;
}
@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())
{
TileEntityMachineCyclotron entity = (TileEntityMachineCyclotron) world.getTileEntity(x, y, z);
if(entity != null)
{
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_cyclotron, world, x, y, z);
}
return true;
} else {
return false;
}
public int[] getDimensions() {
return new int[] {2, 0, 2, 2, 2, 2};
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileEntityMachineCyclotron();
}
@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)
{
TileEntityMachineCyclotron tileentityfurnace = (TileEntityMachineCyclotron)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_);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
if(MultiblockHandler.checkSpace(world, x, y, z, MultiblockHandler.cyclDimension)) {
MultiblockHandler.fillUp(world, x, y, z, MultiblockHandler.cyclDimension, ModBlocks.dummy_block_cyclotron);
DummyBlockCyclotron.safeBreak = true;
world.setBlock(x, y, z + 1, ModBlocks.dummy_port_cyclotron);
TileEntity te = world.getTileEntity(x, y, z + 1);
if(te instanceof TileEntityDummy) {
TileEntityDummy dummy = (TileEntityDummy)te;
dummy.targetX = x;
dummy.targetY = y;
dummy.targetZ = z;
}
world.setBlock(x, y, z - 1, ModBlocks.dummy_port_cyclotron);
TileEntity te2 = world.getTileEntity(x, y, z - 1);
if(te instanceof TileEntityDummy) {
TileEntityDummy dummy = (TileEntityDummy)te2;
dummy.targetX = x;
dummy.targetY = y;
dummy.targetZ = z;
}
world.setBlock(x + 1, y, z, ModBlocks.dummy_port_cyclotron);
TileEntity te3 = world.getTileEntity(x + 1, y, z);
if(te3 instanceof TileEntityDummy) {
TileEntityDummy dummy = (TileEntityDummy)te3;
dummy.targetX = x;
dummy.targetY = y;
dummy.targetZ = z;
}
world.setBlock(x - 1, y, z, ModBlocks.dummy_port_cyclotron);
TileEntity te4 = world.getTileEntity(x - 1, y, z);
if(te4 instanceof TileEntityDummy) {
TileEntityDummy dummy = (TileEntityDummy)te4;
dummy.targetX = x;
dummy.targetY = y;
dummy.targetZ = z;
}
DummyBlockCyclotron.safeBreak = false;
} else
world.func_147480_a(x, y, z, true);
public int getOffset() {
return 2;
}
}

View File

@ -501,6 +501,11 @@ public class AssemblerRecipes {
private static void makeRecipe(ComparableStack out, AStack[] in, int duration) {
if(out == null || Item.itemRegistry.getNameForObject(out.item) == null) {
MainRegistry.logger.error("Canceling assembler registration, item was null!");
return;
}
recipes.put(out, in);
time.put(out, duration);
}

View File

@ -0,0 +1,108 @@
package com.hbm.inventory;
import java.util.HashMap;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.RecipesCommon.OreDictStack;
import com.hbm.items.ModItems;
import net.minecraft.item.ItemStack;
public class CyclotronRecipes {
private static HashMap<Object, ItemStack> lithium = new HashMap();
private static HashMap<Object, ItemStack> beryllium = new HashMap();
private static HashMap<Object, ItemStack> carbon = new HashMap();
private static HashMap<Object, ItemStack> copper = new HashMap();
private static HashMap<Object, ItemStack> plutonium = new HashMap();
public static void register() {
/// LITHIUM START ///
lithium.put("dustNetherQuartz", new ItemStack(ModItems.powder_fire));
lithium.put("dustPhosphorus", new ItemStack(ModItems.sulfur));
lithium.put("dustIron", new ItemStack(ModItems.powder_cobalt));
lithium.put("dustGold", new ItemStack(ModItems.nugget_mercury));
lithium.put("dustPolonium", new ItemStack(ModItems.powder_astatine));
lithium.put("dustLanthanium", new ItemStack(ModItems.powder_cerium));
lithium.put("dustActinium", new ItemStack(ModItems.powder_thorium));
lithium.put("dustUranium", new ItemStack(ModItems.powder_neptunium));
lithium.put("dustNeptunium", new ItemStack(ModItems.powder_plutonium));
/// LITHIUM END ///
/// BERYLLIUM START ///
beryllium.put("dustNetherQuartz", new ItemStack(ModItems.sulfur));
beryllium.put(new ComparableStack(ModItems.powder_strontium), new ItemStack(ModItems.powder_niobium));
beryllium.put(new ComparableStack(ModItems.powder_cerium), new ItemStack(ModItems.powder_neodymium));
beryllium.put("dustThorium", new ItemStack(ModItems.powder_uranium));
/// BERYLLIUM END ///
/// CARBON START ///
carbon.put("dustSulfur", new ItemStack(ModItems.powder_titanium));
carbon.put("dustTitanium", new ItemStack(ModItems.powder_iron));
carbon.put(new ComparableStack(ModItems.powder_caesium), new ItemStack(ModItems.powder_lanthanium));
carbon.put(new ComparableStack(ModItems.powder_neodymium), new ItemStack(ModItems.powder_gold));
carbon.put(new ComparableStack(ModItems.nugget_mercury), new ItemStack(ModItems.powder_polonium));
carbon.put(new ComparableStack(ModItems.powder_astatine), new ItemStack(ModItems.powder_actinium));
/// CARBON END ///
/// COPPER START ///
copper.put("dustBeryllium", new ItemStack(ModItems.powder_quartz));
copper.put("dustCoal", new ItemStack(ModItems.powder_bromine));
copper.put("dustTitanium", new ItemStack(ModItems.powder_strontium));
copper.put("dustIron", new ItemStack(ModItems.powder_niobium));
copper.put(new ComparableStack(ModItems.powder_bromine), new ItemStack(ModItems.powder_iodine));
copper.put(new ComparableStack(ModItems.powder_strontium), new ItemStack(ModItems.powder_neodymium));
copper.put(new ComparableStack(ModItems.powder_niobium), new ItemStack(ModItems.powder_caesium));
copper.put(new ComparableStack(ModItems.powder_iodine), new ItemStack(ModItems.powder_polonium));
copper.put(new ComparableStack(ModItems.powder_caesium), new ItemStack(ModItems.powder_actinium));
copper.put("dustGold", new ItemStack(ModItems.powder_uranium));
/// COPPER END ///
/// PLUTONIUM START ///
plutonium.put("dustPhosphorus", new ItemStack(ModItems.powder_tennessine));
plutonium.put("dustPlutonium", new ItemStack(ModItems.powder_tennessine));
/// PLUTONIUM END ///
///TODO: fictional elements
}
public static ItemStack getOutput(ItemStack stack, ItemStack box) {
if(stack == null || stack.getItem() == null || box == null)
return null;
HashMap<Object, ItemStack> pool = null;
if(box.getItem() == ModItems.part_lithium) {
pool = lithium;
} else if(box.getItem() == ModItems.part_beryllium) {
pool = beryllium;
} else if(box.getItem() == ModItems.part_carbon) {
pool = carbon;
} else if(box.getItem() == ModItems.part_copper) {
pool = copper;
} else if(box.getItem() == ModItems.part_plutonium) {
pool = plutonium;
}
if(pool == null)
return null;
ComparableStack comp = new ComparableStack(stack.getItem(), 1, stack.getItemDamage());
if(pool.containsKey(comp))
return pool.get(comp).copy();
String[] dictKeys = comp.getDictKeys();
for(String key : dictKeys) {
if(pool.containsKey(key))
return pool.get(key).copy();
}
return null;
}
}

View File

@ -60,8 +60,9 @@ public class OreDictManager {
OreDictionary.registerOre("ingotDineutronium", ModItems.ingot_dineutronium);
OreDictionary.registerOre("ingotStarmetal", ModItems.ingot_starmetal);
OreDictionary.registerOre("ingotAsbestos", ModItems.ingot_asbestos);
OreDictionary.registerOre("nuggetLead", ModItems.nugget_lead);
OreDictionary.registerOre("nuggetBeryllium", ModItems.nugget_beryllium);
OreDictionary.registerOre("nuggetUranium", ModItems.nugget_uranium);
OreDictionary.registerOre("nuggetUranium233", ModItems.nugget_u233);
OreDictionary.registerOre("nuggetUranium235", ModItems.nugget_u235);
@ -141,6 +142,7 @@ public class OreDictManager {
OreDictionary.registerOre("dustNeptunium", ModItems.powder_neptunium);
OreDictionary.registerOre("dustPolonium", ModItems.powder_polonium);
OreDictionary.registerOre("dustAsbestos", ModItems.powder_asbestos);
OreDictionary.registerOre("dustPhosphorus", ModItems.powder_fire);
OreDictionary.registerOre("dustNeptunium", ModItems.powder_neptunium);
OreDictionary.registerOre("dustIodine", ModItems.powder_iodine);

View File

@ -6,42 +6,42 @@ import com.hbm.tileentity.machine.TileEntityMachineCyclotron;
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 ContainerMachineCyclotron extends Container {
private TileEntityMachineCyclotron testNuke;
private int progress;
private TileEntityMachineCyclotron cyclotron;
public ContainerMachineCyclotron(InventoryPlayer invPlayer, TileEntityMachineCyclotron tedf) {
progress = 0;
public ContainerMachineCyclotron(InventoryPlayer invPlayer, TileEntityMachineCyclotron tile) {
testNuke = tedf;
cyclotron = tile;
//Input
this.addSlotToContainer(new Slot(tedf, 0, 8, 18));
this.addSlotToContainer(new Slot(tedf, 1, 8, 36));
this.addSlotToContainer(new Slot(tedf, 2, 8, 54));
this.addSlotToContainer(new Slot(tile, 0, 17, 18));
this.addSlotToContainer(new Slot(tile, 1, 17, 36));
this.addSlotToContainer(new Slot(tile, 2, 17, 54));
//Targets
this.addSlotToContainer(new Slot(tedf, 3, 80, 72));
this.addSlotToContainer(new Slot(tedf, 4, 98, 72));
this.addSlotToContainer(new Slot(tedf, 5, 116, 72));
//Tech
this.addSlotToContainer(new Slot(tedf, 6, 8, 81));
this.addSlotToContainer(new Slot(tedf, 7, 26, 81));
this.addSlotToContainer(new Slot(tedf, 8, 44, 81));
//Battery
this.addSlotToContainer(new Slot(tedf, 9, 152, 108));
//Cell
this.addSlotToContainer(new Slot(tedf, 10, 8, 108));
this.addSlotToContainer(new Slot(tile, 3, 107, 18));
this.addSlotToContainer(new Slot(tile, 4, 107, 36));
this.addSlotToContainer(new Slot(tile, 5, 107, 54));
//Output
this.addSlotToContainer(new SlotMachineOutput(tedf, 11, 44, 108));
this.addSlotToContainer(new SlotMachineOutput(tedf, 12, 62, 108));
this.addSlotToContainer(new SlotMachineOutput(tedf, 13, 80, 108));
this.addSlotToContainer(new SlotMachineOutput(tedf, 14, 98, 108));
this.addSlotToContainer(new SlotMachineOutput(tedf, 15, 116, 108));
this.addSlotToContainer(new SlotMachineOutput(tile, 6, 143, 18));
this.addSlotToContainer(new SlotMachineOutput(tile, 7, 143, 36));
this.addSlotToContainer(new SlotMachineOutput(tile, 8, 143, 54));
//AMAT In
this.addSlotToContainer(new Slot(tile, 9, 143, 90));
//AMAT Out
this.addSlotToContainer(new SlotMachineOutput(tile, 10, 143, 108));
//Coolant In
this.addSlotToContainer(new Slot(tile, 11, 62, 72));
//Coolant Out
this.addSlotToContainer(new SlotMachineOutput(tile, 12, 62, 90));
//Battery
this.addSlotToContainer(new Slot(tile, 13, 62, 108));
//Upgrades
this.addSlotToContainer(new Slot(tile, 14, 17, 90));
this.addSlotToContainer(new Slot(tile, 15, 17, 108));
for(int i = 0; i < 3; i++)
{
@ -57,16 +57,10 @@ public class ContainerMachineCyclotron extends Container {
}
}
@Override
public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting);
crafting.sendProgressBarUpdate(this, 0, this.testNuke.progress);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
{
ItemStack var3 = null;
/*ItemStack var3 = null;
Slot var4 = (Slot) this.inventorySlots.get(par2);
if (var4 != null && var4.getHasStack())
@ -95,36 +89,13 @@ public class ContainerMachineCyclotron extends Container {
}
}
return var3;
return var3;*/
return null;
}
@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.progress != this.testNuke.progress)
{
par1.sendProgressBarUpdate(this, 0, this.testNuke.progress);
}
}
this.progress = this.testNuke.progress;
}
@Override
public void updateProgressBar(int i, int j) {
if(i == 0)
{
testNuke.progress = j;
}
return cyclotron.isUseableByPlayer(player);
}
}

View File

@ -4,21 +4,24 @@ import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerMachineCyclotron;
import com.hbm.lib.RefStrings;
import com.hbm.packet.AuxButtonPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.machine.TileEntityMachineCyclotron;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUIMachineCyclotron extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_cyclotron.png");
private TileEntityMachineCyclotron diFurnace;
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/machine/gui_cyclotron.png");
private TileEntityMachineCyclotron cyclotron;
public GUIMachineCyclotron(InventoryPlayer invPlayer, TileEntityMachineCyclotron tedf) {
super(new ContainerMachineCyclotron(invPlayer, tedf));
diFurnace = tedf;
public GUIMachineCyclotron(InventoryPlayer invPlayer, TileEntityMachineCyclotron tile) {
super(new ContainerMachineCyclotron(invPlayer, tile));
cyclotron = tile;
this.xSize = 176;
this.ySize = 222;
@ -28,27 +31,41 @@ public class GUIMachineCyclotron extends GuiInfoContainer {
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 106 - 88, 16, 88, diFurnace.power, diFurnace.maxPower);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 106 - 88, 16, 88, cyclotron.power, cyclotron.maxPower);
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
String name = this.cyclotron.hasCustomInventoryName() ? this.cyclotron.getInventoryName() : I18n.format(this.cyclotron.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 mouseClicked(int x, int y, int i) {
super.mouseClicked(x, y, i);
if(guiLeft + 97 <= x && guiLeft + 97 + 18 > x && guiTop + 107 < y && guiTop + 107 + 18 >= y) {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(cyclotron.xCoord, cyclotron.yCoord, cyclotron.zCoord, 0, 0));
}
}
@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);
int k = (int)diFurnace.getPowerScaled(88);
drawTexturedModalRect(guiLeft + 152, guiTop + 106 - k, 212, 88 - k, 16, k);
int k = (int)cyclotron.getPowerScaled(52);
drawTexturedModalRect(guiLeft + 80, guiTop + 124 - k, 212, 52 - k, 7, k);
int l = diFurnace.getProgressScaled(36);
drawTexturedModalRect(guiLeft + 61, guiTop + 26, 176, 0, l, 36);
int l = cyclotron.getProgressScaled(36);
drawTexturedModalRect(guiLeft + 52, guiTop + 26, 176, 0, l, 36);
if(cyclotron.isOn)
drawTexturedModalRect(guiLeft + 97, guiTop + 107, 219, 0, 18, 18);
}
}

View File

@ -877,7 +877,7 @@ public class CraftingManager {
GameRegistry.addRecipe(new ItemStack(ModItems.ammo_5mm_explosive, 8), new Object[] { "BBB", "BAB", "BBB", 'B', ModItems.ammo_5mm, 'A', ModItems.ingot_semtex });
GameRegistry.addRecipe(new ItemStack(ModItems.ammo_5mm_du, 8), new Object[] { "BBB", "BAB", "BBB", 'B', ModItems.ammo_5mm, 'A', ModItems.ingot_u238 });
GameRegistry.addRecipe(new ItemStack(ModItems.ammo_5mm_star, 4), new Object[] { " B ", "BAB", " B ", 'B', ModItems.ammo_5mm_du, 'A', ModItems.ingot_starmetal });
GameRegistry.addRecipe(new ItemStack(ModItems.ammo_5mm_chlorophyte, 4), new Object[] { "BBB", "BAB", "BBB", 'B', ModItems.ammo_5mm_du, 'A', ModItems.pellet_chlorophyte });
GameRegistry.addRecipe(new ItemStack(ModItems.ammo_5mm_chlorophyte, 4), new Object[] { "BBB", "BAB", "BBB", 'B', ModItems.ammo_5mm, 'A', ModItems.pellet_chlorophyte });
GameRegistry.addRecipe(new ItemStack(ModItems.ammo_9mm_ap, 8), new Object[] { "BBB", "BAB", "BBB", 'B', ModItems.ammo_9mm, 'A', ModItems.ingot_dura_steel });
GameRegistry.addRecipe(new ItemStack(ModItems.ammo_9mm_du, 8), new Object[] { "BBB", "BAB", "BBB", 'B', ModItems.ammo_9mm, 'A', ModItems.ingot_u238 });
GameRegistry.addRecipe(new ItemStack(ModItems.ammo_9mm_chlorophyte, 8), new Object[] { "BBB", "BAB", "BBB", 'B', ModItems.ammo_9mm, 'A', ModItems.pellet_chlorophyte });
@ -894,7 +894,7 @@ public class CraftingManager {
GameRegistry.addRecipe(new ItemStack(ModItems.ammo_50ae_ap, 8), new Object[] { "BBB", "BAB", "BBB", 'B', ModItems.ammo_50ae, 'A', ModItems.ingot_dura_steel });
GameRegistry.addRecipe(new ItemStack(ModItems.ammo_50ae_du, 8), new Object[] { "BBB", "BAB", "BBB", 'B', ModItems.ammo_50ae, 'A', ModItems.ingot_u238 });
GameRegistry.addRecipe(new ItemStack(ModItems.ammo_50ae_star, 4), new Object[] { " B ", "BAB", " B ", 'B', ModItems.ammo_50ae_du, 'A', ModItems.ingot_starmetal });
GameRegistry.addRecipe(new ItemStack(ModItems.ammo_50ae_chlorophyte, 8), new Object[] { "BBB", "BAB", "BBB", 'B', ModItems.ammo_50ae_du, 'A', ModItems.pellet_chlorophyte });
GameRegistry.addRecipe(new ItemStack(ModItems.ammo_50ae_chlorophyte, 8), new Object[] { "BBB", "BAB", "BBB", 'B', ModItems.ammo_50ae, 'A', ModItems.pellet_chlorophyte });
GameRegistry.addRecipe(new ItemStack(ModItems.ammo_556_phosphorus, 8), new Object[] { "BBB", "BAB", "BBB", 'B', ModItems.ammo_556, 'A', ModItems.ingot_phosphorus });
GameRegistry.addRecipe(new ItemStack(ModItems.ammo_556_ap, 8), new Object[] { "BBB", "BAB", "BBB", 'B', ModItems.ammo_556, 'A', ModItems.ingot_dura_steel });
GameRegistry.addRecipe(new ItemStack(ModItems.ammo_556_du, 8), new Object[] { "BBB", "BAB", "BBB", 'B', ModItems.ammo_556, 'A', ModItems.ingot_u238 });

View File

@ -918,6 +918,7 @@ public class MainRegistry {
BreederRecipes.registerFuels();
BreederRecipes.registerRecipes();
AssemblerRecipes.loadRecipes();
CyclotronRecipes.register();
MagicRecipes.register();
TileEntityNukeCustom.registerBombItems();

View File

@ -301,21 +301,7 @@ public class ModEventHandlerClient {
public void onRenderWorldLastEvent(RenderWorldLastEvent event) {
/*
* what a fucking moron can't even say sorry to some internet retard and has to resort to spending
* hours with modeling a fucking orbital module so he can attach a message to it which is rendered
* in the world at an unreachable space as if anyone's going to read that
*
* the 1.12 port def doesn't need any of this, no idea what to do now that i have the oribtal module <=== correction: the floaty orbital module is kinda fun to have, the attached message is obsolete though
* modeled and textured or with render-in-world technology. i'm 90% sure it was a huge waste of time
* (as is almost everything i do, why have nice things when you can mope and dick around ad infinitum)
* but at least i can p r e t e n d that i was productive in the last couple of days. cyclotron
* overhaul? new turrets? the new silo hatch i promised? nah, i gotta waste time like the retard
* that i am. thinking about it, leaving this note here will make me look like an even bigger
* dumbass, but at this point, why care?
*
* and the retard that i am, i realized 5 hours in that i forgot to add the small cupola window to the
* orbital module, and adding that would mean i'd have to expand the texture and in term redo the UV,
* but who has time for that considering this model is basically useless anyway?
* my ass is heavy
*/
GL11.glPushMatrix();
@ -355,7 +341,7 @@ public class ModEventHandlerClient {
GL11.glRotated(System.currentTimeMillis() * 0.025 % 360, 0, -1, 0);
String msg = "nosta pls am sorry the server is going to hell";
String msg = "your ad here";
GL11.glTranslated(0, 3.75, 0);
GL11.glRotated(180, 1, 0, 0);

View File

@ -81,6 +81,9 @@ public class ResourceManager {
//Crystallizer
public static final IModelCustom crystallizer = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/crystallizer.obj"));
//Cyclotron
public static final IModelCustom cyclotron = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/cyclotron.obj"));
//RTG
public static final IModelCustom rtg = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/rtg.obj"));
@ -259,6 +262,17 @@ public class ResourceManager {
public static final ResourceLocation crystallizer_spinner_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/crystallizer_spinner.png");
public static final ResourceLocation crystallizer_window_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/crystallizer_window.png");
//Cyclotron
public static final ResourceLocation cyclotron_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cyclotron.png");
public static final ResourceLocation cyclotron_ashes = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cyclotron_ashes.png");
public static final ResourceLocation cyclotron_ashes_filled = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cyclotron_ashes_filled.png");
public static final ResourceLocation cyclotron_book = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cyclotron_book.png");
public static final ResourceLocation cyclotron_book_filled = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cyclotron_book_filled.png");
public static final ResourceLocation cyclotron_gavel = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cyclotron_gavel.png");
public static final ResourceLocation cyclotron_gavel_filled = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cyclotron_gavel_filled.png");
public static final ResourceLocation cyclotron_coin = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cyclotron_coin.png");
public static final ResourceLocation cyclotron_coin_filled = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cyclotron_coin_filled.png");
//RTG
public static final ResourceLocation rtg_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/rtg.png");
public static final ResourceLocation rtg_cell_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/rtg_cell.png");

View File

@ -2,38 +2,38 @@ package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
public class RenderCyclotron extends TileEntitySpecialRenderer {
private static final ResourceLocation body = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/cyclotron.obj");
private IModelCustom genModel;
private ResourceLocation genTexture;
public RenderCyclotron()
{
genModel = AdvancedModelLoader.loadModel(body);
genTexture = new ResourceLocation(RefStrings.MODID, "textures/models/cyclotronTexture.png");
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
{
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glRotatef(180, 0F, 1F, 0F);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(genTexture);
bindTexture(ResourceManager.cyclotron_tex);
ResourceManager.cyclotron.renderPart("Body");
genModel.renderAll();
GL11.glShadeModel(GL11.GL_FLAT);
bindTexture(ResourceManager.cyclotron_ashes_filled);
ResourceManager.cyclotron.renderPart("B1");
bindTexture(ResourceManager.cyclotron_book_filled);
ResourceManager.cyclotron.renderPart("B2");
bindTexture(ResourceManager.cyclotron_gavel_filled);
ResourceManager.cyclotron.renderPart("B3");
bindTexture(ResourceManager.cyclotron_coin_filled);
ResourceManager.cyclotron.renderPart("B4");
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
}

View File

@ -22,6 +22,8 @@ public class RenderFENSU extends TileEntitySpecialRenderer {
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glShadeModel(GL11.GL_SMOOTH);
switch(te.getBlockMetadata() - BlockDummyable.offset) {
case 2: GL11.glRotatef(90, 0F, 1F, 0F); break;
case 4: GL11.glRotatef(180, 0F, 1F, 0F); break;

View File

@ -1,211 +1,56 @@
package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import com.hbm.config.BombConfig;
import com.hbm.entity.effect.EntityBlackHole;
import com.hbm.entity.effect.EntityCloudFleija;
import com.hbm.entity.logic.EntityNukeExplosionMK3;
import com.hbm.entity.logic.EntityNukeExplosionMK4;
import com.hbm.explosion.ExplosionChaos;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.ExplosionParticleB;
import com.hbm.explosion.ExplosionThermo;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.ISource;
import com.hbm.inventory.MachineRecipes;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidSource;
import com.hbm.inventory.CyclotronRecipes;
import com.hbm.inventory.FluidTank;
import com.hbm.items.ModItems;
import com.hbm.lib.Library;
import com.hbm.packet.AuxElectricityPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.TileEntityMachineBase;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
public class TileEntityMachineCyclotron extends TileEntity implements ISidedInventory, ISource {
private ItemStack slots[];
public class TileEntityMachineCyclotron extends TileEntityMachineBase implements IFluidSource, IFluidAcceptor {
public long power;
public static final long maxPower = 100000000;
public int consumption = 1000000;
public boolean isOn;
private int age;
public int progress;
public int soundCycle = 0;
public static final long maxPower = 10000000;
public static final int processTime = 690;
public boolean isOn = false;
public int age = 0;
public List<IConsumer> list = new ArrayList();
Random rand = new Random();
private static final int[] slots_top = new int[] { 0 };
private static final int[] slots_bottom = new int[] { 0, 0 };
private static final int[] slots_side = new int[] { 0 };
private String customName;
public static final int duration = 690;
public FluidTank coolant;
public FluidTank amat;
public List<IFluidAcceptor> list = new ArrayList();
public TileEntityMachineCyclotron() {
slots = new ItemStack[16];
super(16);
coolant = new FluidTank(FluidType.COOLANT, 32000, 0);
amat = new FluidTank(FluidType.AMAT, 8000, 1);
}
@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.cyclotron";
}
@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 stack) {
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);
this.power = nbt.getLong("power");
this.progress = nbt.getInteger("progress");
this.isOn = nbt.getBoolean("isOn");
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.setLong("power", power);
nbt.setInteger("progress", progress);
nbt.setBoolean("isOn", isOn);
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 String getName() {
return "container.machineCyclotron";
}
@Override
public void updateEntity() {
if (!worldObj.isRemote) {
if(!worldObj.isRemote) {
age++;
if(age >= 20)
{
@ -213,390 +58,236 @@ public class TileEntityMachineCyclotron extends TileEntity implements ISidedInve
}
if(age == 9 || age == 19)
ffgeuaInit();
fillFluidInit(amat.getTankType());
if(!isOn && hasFuse() && getHeatLevel() != 4 && hasEnergy() && (isPart(slots[0]) || isPart(slots[1]) || isPart(slots[2]))) {
isOn = true;
slots[6] = null;
}
if(isOn && (!hasFuse() || (!isPart(slots[0]) && !isPart(slots[1]) && !isPart(slots[2])))) {
isOn = false;
}
this.power = Library.chargeTEFromItems(slots, 13, power, maxPower);
this.coolant.loadTank(11, 12, slots);
this.amat.unloadTank(9, 10, slots);
if(isOn) {
this.power += getPower(slots[0]);
this.power += getPower(slots[1]);
this.power += getPower(slots[2]);
if(this.power > maxPower)
power = maxPower;
if(progress < processTime) {
if(canProcess()) {
progress++;
power -= consumption;
if(progress >= duration) {
process();
progress = 0;
this.markDirty();
}
if(coolant.getFill() > 0) {
if(worldObj.rand.nextInt(3) == 0)
coolant.setFill(coolant.getFill() - 1);
} else {
worldObj.newExplosion(null, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, 25, true, true);
}
} else {
progress = 0;
process();
}
if(slots[7] != null) {
slots[7].setItemDamage(slots[7].getItemDamage() + 1);
if(slots[7].getItemDamage() >= slots[7].getMaxDamage())
slots[7] = null;
}
if(getCoolantTicksLeft() == 100) {
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.shutdown", 10.0F, 1.0F);
}
if(getHeatLevel() == 1) {
ExplosionChaos.flameDeath(worldObj, this.xCoord, this.yCoord, zCoord, 15);
}
if(getHeatLevel() == 2) {
ExplosionChaos.flameDeath(worldObj, this.xCoord, this.yCoord, zCoord, 25);
ExplosionChaos.burn(worldObj, this.xCoord, this.yCoord, zCoord, 7);
ExplosionThermo.setEntitiesOnFire(worldObj, this.xCoord, this.yCoord, zCoord, 7);
}
if(getHeatLevel() == 3) {
ExplosionChaos.flameDeath(worldObj, this.xCoord, this.yCoord, zCoord, 35);
ExplosionChaos.burn(worldObj, this.xCoord, this.yCoord, zCoord, 15);
ExplosionThermo.setEntitiesOnFire(worldObj, this.xCoord, this.yCoord, zCoord, 25);
ExplosionThermo.scorchLight(worldObj, this.xCoord, this.yCoord, zCoord, 5);
if(rand.nextInt(50) == 0)
ExplosionLarge.spawnTracers(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, 3);
}
if(getHeatLevel() == 4) {
int i = rand.nextInt(4);
worldObj.setBlock(xCoord, yCoord, zCoord, Blocks.air);
if(i == 0) {
ExplosionLarge.explodeFire(worldObj, xCoord, yCoord, zCoord, 35 + rand.nextInt(21), true, true, true);
}
if(i == 1) {
worldObj.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(worldObj, (int)(BombConfig.fatmanRadius * 1.5), xCoord, yCoord, zCoord));
ExplosionParticleB.spawnMush(worldObj, xCoord, yCoord - 3, zCoord);
}
if(i == 2) {
EntityNukeExplosionMK3 entity = new EntityNukeExplosionMK3(worldObj);
entity.posX = this.xCoord;
entity.posY = this.yCoord;
entity.posZ = this.zCoord;
int j = 15 + rand.nextInt(21);
entity.destructionRange = j;
entity.speed = 25;
entity.coefficient = 1.0F;
entity.waste = false;
worldObj.spawnEntityInWorld(entity);
EntityCloudFleija cloud = new EntityCloudFleija(worldObj, j);
cloud.posX = xCoord;
cloud.posY = yCoord;
cloud.posZ = zCoord;
worldObj.spawnEntityInWorld(cloud);
}
if(i == 3) {
EntityBlackHole bl = new EntityBlackHole(worldObj, 1.5F + rand.nextFloat());
bl.posX = xCoord + 0.5F;
bl.posY = yCoord + 3.5F;
bl.posZ = zCoord + 0.5F;
worldObj.spawnEntityInWorld(bl);
}
}
} else {
progress = 0;
}
power = Library.chargeItemsFromTE(slots, 9, power, maxPower);
PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
NBTTagCompound data = new NBTTagCompound();
data.setLong("power", power);
data.setInteger("progress", progress);
data.setBoolean("isOn", isOn);
this.networkPack(data, 25);
this.coolant.updateTank(xCoord, yCoord, zCoord, this.worldObj.provider.dimensionId);
this.amat.updateTank(xCoord, yCoord, zCoord, this.worldObj.provider.dimensionId);
}
}
public void networkUnpack(NBTTagCompound data) {
this.isOn = data.getBoolean("isOn");
this.power = data.getLong("power");
this.progress = data.getInteger("progress");
}
public void handleButtonPacket(int value, int meta) {
System.out.println("Before: " + isOn);
if(this.isOn)
this.isOn = false;
else
this.isOn = true;
System.out.println("After: " + isOn);
}
public boolean canProcess() {
if(power < consumption)
return false;
for(int i = 0; i < 3; i++) {
ItemStack out = CyclotronRecipes.getOutput(slots[i + 3], slots[i]);
if(out == null)
continue;
if(slots[i + 6] == null)
return true;
if(slots[i + 6].getItem() == out.getItem() && slots[i + 6].getItemDamage() == out.getItemDamage() && slots[i + 6].stackSize < out.getMaxStackSize())
return true;
}
return false;
}
public void process() {
ItemStack stack1 = MachineRecipes.getCyclotronOutput(slots[0], slots[3]);
ItemStack stack2 = MachineRecipes.getCyclotronOutput(slots[1], slots[4]);
ItemStack stack3 = MachineRecipes.getCyclotronOutput(slots[2], slots[5]);
if(stack1 != null && hasSpaceForItem(stack1.getItem())) {
addItemPlox(stack1.getItem());
slots[0].stackSize--;
slots[3].stackSize--;
if(slots[0].stackSize <= 0)
slots[0] = null;
if(slots[3].stackSize <= 0)
slots[3] = null;
}
if(stack2 != null && hasSpaceForItem(stack2.getItem())) {
addItemPlox(stack2.getItem());
slots[1].stackSize--;
slots[4].stackSize--;
if(slots[1].stackSize <= 0)
slots[1] = null;
if(slots[4].stackSize <= 0)
slots[4] = null;
}
if(stack3 != null && hasSpaceForItem(stack3.getItem())) {
addItemPlox(stack3.getItem());
slots[2].stackSize--;
slots[5].stackSize--;
if(slots[2].stackSize <= 0)
slots[2] = null;
if(slots[5].stackSize <= 0)
slots[5] = null;
}
int amat = 0;
if(slots[0] != null && stack1 == null) {
if(rand.nextInt(100) < getAmatChance(slots[0]))
if(hasSpaceForItem(ModItems.cell_antimatter) && useCell())
addItemPlox(ModItems.cell_antimatter);
slots[0].stackSize--;
if(slots[0].stackSize <= 0)
slots[0] = null;
}
if(slots[1] != null && stack1 == null) {
if(rand.nextInt(100) < getAmatChance(slots[1]))
if(hasSpaceForItem(ModItems.cell_antimatter) && useCell())
addItemPlox(ModItems.cell_antimatter);
for(int i = 0; i < 3; i++) {
slots[1].stackSize--;
if(slots[1].stackSize <= 0)
slots[1] = null;
ItemStack out = CyclotronRecipes.getOutput(slots[i + 3], slots[i]);
if(out == null)
continue;
if(slots[i + 6] == null) {
amat += this.getAmat(slots[i]);
this.decrStackSize(i, 1);
this.decrStackSize(i + 3, 1);
slots[i + 6] = out;
continue;
}
if(slots[i + 6].getItem() == out.getItem() && slots[i + 6].getItemDamage() == out.getItemDamage() && slots[i + 6].stackSize < out.getMaxStackSize()) {
amat += this.getAmat(slots[i]);
this.decrStackSize(i, 1);
this.decrStackSize(i + 3, 1);
slots[i + 6].stackSize++;
}
}
if(slots[2] != null && stack1 == null) {
if(rand.nextInt(100) < getAmatChance(slots[2]))
if(hasSpaceForItem(ModItems.cell_antimatter) && useCell())
addItemPlox(ModItems.cell_antimatter);
this.amat.setFill(this.amat.getFill() + amat);
if(this.amat.getFill() > this.amat.getMaxFill())
this.amat.setFill(this.amat.getMaxFill());
}
public int getAmat(ItemStack stack) {
//TODO: move to cyclotron recipe handler and register it on a per-recipe basis
if(stack == null)
return 0;
if(stack.getItem() == ModItems.part_lithium)
return 50;
if(stack.getItem() == ModItems.part_beryllium)
return 25;
if(stack.getItem() == ModItems.part_carbon)
return 10;
if(stack.getItem() == ModItems.part_copper)
return 15;
if(stack.getItem() == ModItems.part_plutonium)
return 100;
return 0;
}
slots[2].stackSize--;
if(slots[2].stackSize <= 0)
slots[2] = null;
}
}
public boolean hasSpaceForItem(Item item) {
if(slots[11] == null || slots[12] == null || slots[13] == null || slots[14] == null || slots[15] == null)
return true;
if(slots[11] != null && slots[11].getItem() == item && slots[11].stackSize < slots[11].getMaxStackSize())
return true;
if(slots[12] != null && slots[12].getItem() == item && slots[12].stackSize < slots[12].getMaxStackSize())
return true;
if(slots[13] != null && slots[13].getItem() == item && slots[13].stackSize < slots[13].getMaxStackSize())
return true;
if(slots[14] != null && slots[14].getItem() == item && slots[14].stackSize < slots[14].getMaxStackSize())
return true;
if(slots[15] != null && slots[15].getItem() == item && slots[15].stackSize < slots[15].getMaxStackSize())
return true;
return false;
}
public boolean useCell() {
if(slots[10] != null && slots[10].getItem() == ModItems.cell_empty) {
slots[10].stackSize--;
if(slots[10].stackSize <= 0)
slots[10] = null;
return true;
}
return false;
}
public void addItemPlox(Item item) {
if(slots[11] != null && slots[11].getItem() == item && slots[11].stackSize < slots[11].getMaxStackSize()) {
slots[11].stackSize++;
return;
}
if(slots[12] != null && slots[12].getItem() == item && slots[12].stackSize < slots[12].getMaxStackSize()) {
slots[12].stackSize++;
return;
}
if(slots[13] != null && slots[13].getItem() == item && slots[13].stackSize < slots[13].getMaxStackSize()) {
slots[13].stackSize++;
return;
}
if(slots[14] != null && slots[14].getItem() == item && slots[14].stackSize < slots[14].getMaxStackSize()) {
slots[14].stackSize++;
return;
}
if(slots[15] != null && slots[15].getItem() == item && slots[15].stackSize < slots[15].getMaxStackSize()) {
slots[15].stackSize++;
return;
}
if(slots[11] == null) {
slots[11] = new ItemStack(item, 1);
return;
}
if(slots[12] == null) {
slots[12] = new ItemStack(item, 1);
return;
}
if(slots[13] == null) {
slots[13] = new ItemStack(item, 1);
return;
}
if(slots[14] == null) {
slots[14] = new ItemStack(item, 1);
return;
}
if(slots[15] == null) {
slots[15] = new ItemStack(item, 1);
return;
}
}
public boolean hasFuse() {
return slots[8] != null && (slots[8].getItem() == ModItems.fuse || slots[8].getItem() == ModItems.screwdriver);
}
public boolean hasEnergy() {
return slots[6] != null && slots[6].getItem() == ModItems.crystal_energy;
}
public int getHeatLevel() {
if(slots[7] != null && slots[7].getItem() == ModItems.pellet_coolant) {
int i = (slots[7].getItemDamage() * 100) / slots[7].getMaxDamage();
if(i < 75)
return 0;
if(i < 85)
return 1;
if(i < 95)
return 2;
return 3;
}
return 4;
}
public int getCoolantTicksLeft() {
if(slots[7] != null && slots[7].getItem() == ModItems.pellet_coolant) {
int i = slots[7].getMaxDamage() - slots[7].getItemDamage();
return i;
}
return 0;
}
public boolean isPart(ItemStack stack) {
if(stack != null) {
if(stack.getItem() == ModItems.part_lithium)
return true;
if(stack.getItem() == ModItems.part_beryllium)
return true;
if(stack.getItem() == ModItems.part_carbon)
return true;
if(stack.getItem() == ModItems.part_copper)
return true;
if(stack.getItem() == ModItems.part_plutonium)
return true;
}
return false;
}
public int getPower(ItemStack stack) {
if(stack != null) {
if(stack.getItem() == ModItems.part_lithium)
return 250;
if(stack.getItem() == ModItems.part_beryllium)
return 350;
if(stack.getItem() == ModItems.part_carbon)
return 600;
if(stack.getItem() == ModItems.part_copper)
return 750;
if(stack.getItem() == ModItems.part_plutonium)
return 1000;
}
return 0;
}
public int getAmatChance(ItemStack stack) {
if(stack != null) {
if(stack.getItem() == ModItems.part_lithium)
return 2;
if(stack.getItem() == ModItems.part_beryllium)
return 3;
if(stack.getItem() == ModItems.part_carbon)
return 6;
if(stack.getItem() == ModItems.part_copper)
return 29;
if(stack.getItem() == ModItems.part_plutonium)
return 94;
}
return 0;
}
public long getPowerScaled(long i) {
return (power * i) / maxPower;
}
public int getProgressScaled(int i) {
return (progress * i) / processTime;
return (progress * i) / duration;
}
@Override
public void ffgeua(int x, int y, int z, boolean newTact) {
public void setFillstate(int fill, int index) {
if(index == 0)
coolant.setFill(fill);
else if(index == 1)
amat.setFill(fill);
}
@Override
public void setFluidFill(int fill, FluidType type) {
if(type == FluidType.COOLANT)
coolant.setFill(fill);
else if(type == FluidType.AMAT)
amat.setFill(fill);
}
@Override
public void setType(FluidType type, int index) {
if(index == 0)
coolant.setTankType(type);
else if(index == 1)
coolant.setTankType(type);
}
@Override
public List<FluidTank> getTanks() {
return Arrays.asList(new FluidTank[] {coolant, amat});
}
@Override
public int getFluidFill(FluidType type) {
if(type == FluidType.COOLANT)
return coolant.getFill();
else if(type == FluidType.AMAT)
return amat.getFill();
Library.ffgeua(x, y, z, newTact, this, worldObj);
return 0;
}
@Override
public void ffgeuaInit() {
ffgeua(this.xCoord + 2, this.yCoord, this.zCoord, getTact());
ffgeua(this.xCoord - 2, this.yCoord, this.zCoord, getTact());
ffgeua(this.xCoord, this.yCoord, this.zCoord + 2, getTact());
ffgeua(this.xCoord, this.yCoord, this.zCoord - 2, getTact());
public void fillFluidInit(FluidType type) {
fillFluid(xCoord + 3, yCoord, zCoord + 1, getTact(), type);
fillFluid(xCoord + 3, yCoord, zCoord - 1, getTact(), type);
fillFluid(xCoord - 3, yCoord, zCoord + 1, getTact(), type);
fillFluid(xCoord - 3, yCoord, zCoord - 1, getTact(), type);
fillFluid(xCoord + 1, yCoord, zCoord + 3, getTact(), type);
fillFluid(xCoord - 1, yCoord, zCoord + 3, getTact(), type);
fillFluid(xCoord + 1, yCoord, zCoord - 3, getTact(), type);
fillFluid(xCoord - 1, yCoord, zCoord - 3, 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
public boolean getTact() {
if (age >= 0 && age < 10) {
return true;
}
return false;
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return TileEntity.INFINITE_EXTENT_AABB;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared()
{
return 65536.0D;
return age >= 0 && age < 10;
}
@Override
public long getSPower() {
return power;
}
@Override
public void setSPower(long i) {
this.power = i;
}
@Override
public List<IConsumer> getList() {
public List<IFluidAcceptor> getFluidList(FluidType type) {
return list;
}
@Override
public void clearList() {
this.list.clear();
public void clearFluidList(FluidType type) {
list.clear();
}
@Override
public int getMaxFluidFill(FluidType type) {
if(type == FluidType.COOLANT)
return coolant.getMaxFill();
return 0;
}
}