Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

turbodiesel4598

Members
  • Joined

  • Last visited

Everything posted by turbodiesel4598

  1. Hey there, I am trying to make an RF-producing Fusion Reactor. The model is a 3*2*3 structure (height of 2 and square with length 3). The main block is placed down, and around and above it, 17 dummy blocks are placed to make the structure of the model solid (http://i.imgur.com/kXeqxyx.png). I have managed to allow right-clicking on any of the dummy blocks to access the main block's inventory (In the dummy block's Block class). I have also managed to allow RF to be taken out of any of the dummy blocks (in the main Fusion Reactor block's Tile Entity class) (http://i.imgur.com/yy78jwg.png). However, I am totally stuck trying to work out how to allow items to be taken out and put into the main block's inventory by accessing the dummy blocks with hoppers, pipes etc (http://i.imgur.com/6pZQ47o.png). I am not sure which classes I should give to you or look at since I have made no progress since trying to add this feature - it is quite important as currently there is only one side available to access, which is the bottom of the main block. Any help would be appreciated, and thanks in advance
  2. Hey there, I am having trouble allowing the ores from Thermal Foundation to work in my machines - I think I have added the correct ores to the ore dictionary, as ores from other mods like IC2 work. How can I allow TF ores, items etc. to be processed too? Secondly, is it possible to allow my ores to be processed in other mods' machines? For example I add Lithium and Boron Ore and was wondering if I could allow TE and IC2 to be able to process them. Thanks in advance
  3. Hey there, I've been making a mod for the past month or so, and have recently, with a friend, been going through previous code to clean it up, prevent unnecessary lag etc. However, I have 2 small but annoying problems with a nuclear fission reactor which takes a fuel cell, runs a cycle until the fuel runs out, then leaves behind the depleted cell. The first problem is that the fuel level seems to flicker when I put fuel in, (an updating issue I guess), and the other problem is that a 'ghost' image of the depleted fuel cell appears straight after I put the original fuel cell in (clicking on the depleted cell or re-entering the GUI gets rid of it). Tile Entity class: package com.nr.mod.blocks.tileentities; import net.minecraft.block.Block; 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.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import cofh.api.energy.EnergyStorage; import cofh.api.energy.IEnergyConnection; import cofh.api.energy.IEnergyHandler; import cofh.api.energy.IEnergyReceiver; import cofh.lib.util.helpers.BlockHelper; import cofh.lib.util.helpers.EnergyHelper; import com.nr.mod.NuclearRelativistics; import com.nr.mod.blocks.NRBlocks; import com.nr.mod.handlers.BombType; import com.nr.mod.handlers.EntityBomb; import com.nr.mod.handlers.NRExplosion; import com.nr.mod.items.NRItems; public class TileEntityFissionReactorGraphite extends TileEntityInventory implements IEnergyHandler, IEnergyConnection, ISidedInventory, IEnergyReceiver { public EnergyStorage storage = new EnergyStorage(1000000, 1000000); public int rawR = 1; public int R = rawR; public int D = R*2 + 1; public int SR = R-1; public int SD = SR*2 + 1; public boolean flag; public boolean flag1 = false; public int E; public int H; public int energy; public int fueltime; public int fueltype; public int power = NuclearRelativistics.fissionRF/25; public int heat; public String typeoffuel = "No Fuel"; public int fuelmult; public int MBNumber; public String problem = "Casing Incomplete"; public int maxTransfer = 500000; public String direction; private static final int[] slotsTop = new int[] {0}; private static final int[] slotsSides = new int[] {1}; public TileEntityFissionReactorGraphite() { super.slots = new ItemStack[3]; super.localizedName = "Fission Reactor"; } public void updateEntity() { super.updateEntity(); product(); fuel(); upgrade(); energy(); overheat(worldObj, this.xCoord, this.yCoord, this.zCoord, 25F, BombType.BOMB_STANDARD); typeoffuelx(); addEnergy(); if (flag != flag1) { flag1 = flag; BlockFissionReactorGraphite.updateFissionReactorGraphiteBlockState(flag, this.worldObj, this.xCoord, this.yCoord, this.zCoord); } markDirty(); } public void overheat(World world, double x, double y, double z, float radius, BombType type) { if (this.heat >= 500000) { if (this.MBNumber == 3) { NRExplosion.createExplosion(new EntityBomb(world).setType(type), world, (double)this.xCoord, (double)this.yCoord + R, (double)this.zCoord - R, 25 + 4*R, 1000F, true); } else if (this.MBNumber == 4) { NRExplosion.createExplosion(new EntityBomb(world).setType(type), world, (double)this.xCoord + R, (double)this.yCoord + R, (double)this.zCoord, 25 + 4*R, 1000F, true); } else if (this.MBNumber == 2) { NRExplosion.createExplosion(new EntityBomb(world).setType(type), world, (double)this.xCoord, (double)this.yCoord + R, (double)this.zCoord + R, 25 + 4*R, 1000F, true); } else if (this.MBNumber == 5) { NRExplosion.createExplosion(new EntityBomb(world).setType(type), world, (double)this.xCoord - R, (double)this.yCoord + R, (double)this.zCoord, 25 + 4*R, 1000F, true); } } } public void typeoffuelx() { if (this.fueltype == 1) { typeoffuel = "LEU"; fuelmult = 2; } else if (this.fueltype == 2) { typeoffuel = "HEU"; fuelmult = 4; } else if (this.fueltype == 3) { typeoffuel = "LEP"; fuelmult = 4; } else if (this.fueltype == 4) { typeoffuel = "HEP"; fuelmult = 8; } else if (this.fueltype == 5) { typeoffuel = "MOX"; fuelmult = 4; } else if (this.fueltype == 6) { typeoffuel = "TBU"; fuelmult = 1; } else if (this.fueltype == 7) { typeoffuel = "LEU"; fuelmult = 2; } else if (this.fueltype == { typeoffuel = "HEU"; fuelmult = 4; } else if (this.fueltype == 9) { typeoffuel = "LEP"; fuelmult = 4; } else if (this.fueltype == 10) { typeoffuel = "HEP"; fuelmult = 8; } else if (this.fueltype == 11) { typeoffuel = "MOX"; fuelmult = 4; } else if (this.fueltype == 0) { typeoffuel = "No Fuel"; fuelmult = 0; } else { typeoffuel = "No Fuel"; fuelmult = 0; } } private void energy() { int prevE = this.storage.getEnergyStored(); int newE; int prevH = this.heat*2; int newH; ForgeDirection forward = ForgeDirection.getOrientation( this.getBlockMetadata()).getOpposite(); int x = xCoord + R * forward.offsetX; int y = yCoord; int z = zCoord + R * forward.offsetZ; if (this.getStackInSlot(1) == null && worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord) && this.fueltime > 0 && this.fueltype != 0 && this.multiblock(this.worldObj, this.xCoord, this.yCoord, this.zCoord)) { flag = true; //LEU if (this.fueltype == 1) { this.storage.receiveEnergy(30*this.power*R, false); this.fueltime -= 300*(100/NuclearRelativistics.fissionEfficiency); this.heat += 7*2*R; } //HEU if (this.fueltype == 2) { this.storage.receiveEnergy(135*this.power*R, false); this.fueltime -= 300*(100/NuclearRelativistics.fissionEfficiency); this.heat += 70*2*R; } //LEP if (this.fueltype == 3) { this.storage.receiveEnergy(60*this.power*R, false); this.fueltime -= 576*(100/NuclearRelativistics.fissionEfficiency); this.heat += 21*2*R; } //HEP if (this.fueltype == 4) { this.storage.receiveEnergy(270*this.power*R, false); this.fueltime -= 576*(100/NuclearRelativistics.fissionEfficiency); this.heat += 210*2*R; } //MOX if (this.fueltype == 5) { this.storage.receiveEnergy(45*this.power*R, false); this.fueltime -= 400*(100/NuclearRelativistics.fissionEfficiency); this.heat += 15*2*R; } //TBU if (this.fueltype == 6) { this.storage.receiveEnergy(8*this.power*R, false); this.fueltime -= 75*(100/NuclearRelativistics.fissionEfficiency); this.heat += 1*2*R; } //LEU if (this.fueltype == 7) { this.storage.receiveEnergy(30*this.power*R, false); this.fueltime -= 300*(100/NuclearRelativistics.fissionEfficiency); this.heat += 7*2*R; } //HEU if (this.fueltype == { this.storage.receiveEnergy(135*this.power*R, false); this.fueltime -= 300*(100/NuclearRelativistics.fissionEfficiency); this.heat += 70*2*R; } //LEP if (this.fueltype == 9) { this.storage.receiveEnergy(60*this.power*R, false); this.fueltime -= 576*(100/NuclearRelativistics.fissionEfficiency); this.heat += 21*2*R; } //HEP if (this.fueltype == 10) { this.storage.receiveEnergy(270*this.power*R, false); this.fueltime -= 576*(100/NuclearRelativistics.fissionEfficiency); this.heat += 210*2*R; } //MOX if (this.fueltype == 11) { this.storage.receiveEnergy(45*this.power*R, false); this.fueltime -= 400*(100/NuclearRelativistics.fissionEfficiency); this.heat += 15*2*R; } for (int Z4 = -SR; Z4 <= SR; Z4++) { for (int X4 = -SR; X4 <= SR; X4++) { for (int Y4 = 1; Y4 <= SD; Y4++) { if(this.worldObj.getBlock(x + X4, y + Y4, z + Z4)==NRBlocks.graphiteBlock){ this.storage.receiveEnergy((this.power*fuelmult)/2, false); this.heat += 2*fuelmult*R; } if(this.worldObj.getBlock(x + X4, y + Y4, z + Z4)==Blocks.lava){ this.storage.receiveEnergy((this.power*fuelmult)/10, false); this.heat += 4*fuelmult*R; } }}} } else { flag = false; } if (this.multiblock(this.worldObj, this.xCoord, this.yCoord, this.zCoord)) { for (int Z4 = -SR; Z4 <= SR; Z4++) { for (int X4 = -SR; X4 <= SR; X4++) { for (int Y4 = 1; Y4 <= SD; Y4++) { if(this.worldObj.getBlock(x + X4, y + Y4, z + Z4)==NRBlocks.coolerBlock){ if (this.heat > 16-1) { this.heat -= 16; } else { this.heat = 0; } } if(this.worldObj.getBlock(x + X4, y + Y4, z + Z4)==Blocks.water){ if (this.heat > 4-1) { this.heat -= 4; } else { this.heat = 0; } } }}}} newE = this.storage.getEnergyStored(); E = newE-prevE; prevE = newE; newH = this.heat*2; H = newH-prevH; prevH = newH; } public boolean multiblock(World world, int x, int y, int z) { Block block = this.blockType; @SuppressWarnings("unused") BlockFissionReactorGraphite reactorGraphite = (BlockFissionReactorGraphite)block; if (checkReactor()) { return true; } return false; } public boolean multiblockstring() { if (multiblock(getWorldObj(), this.xCoord, this.yCoord, this.zCoord)) { return true; } return false; } private void addEnergy() { TileEntity down = BlockHelper.getAdjacentTileEntity(this, ForgeDirection.DOWN); TileEntity up = BlockHelper.getAdjacentTileEntity(this, ForgeDirection.UP); TileEntity north = BlockHelper.getAdjacentTileEntity(this, ForgeDirection.NORTH); TileEntity south = BlockHelper.getAdjacentTileEntity(this, ForgeDirection.SOUTH); TileEntity east = BlockHelper.getAdjacentTileEntity(this, ForgeDirection.EAST); TileEntity west = BlockHelper.getAdjacentTileEntity(this, ForgeDirection.WEST); if (EnergyHelper.isEnergyReceiverFromSide(down, ForgeDirection.DOWN)) { this.storage.extractEnergy(((IEnergyHandler)down).receiveEnergy(ForgeDirection.UP, this.storage.extractEnergy(this.maxTransfer, true), false), false); } else if (EnergyHelper.isEnergyReceiverFromSide(up, ForgeDirection.UP)) { this.storage.extractEnergy(((IEnergyHandler)up).receiveEnergy(ForgeDirection.DOWN, this.storage.extractEnergy(this.maxTransfer, true), false), false); } else if (EnergyHelper.isEnergyReceiverFromSide(west, ForgeDirection.WEST)) { this.storage.extractEnergy(((IEnergyHandler)west).receiveEnergy(ForgeDirection.EAST, this.storage.extractEnergy(this.maxTransfer, true), false), false); } else if (EnergyHelper.isEnergyReceiverFromSide(east, ForgeDirection.EAST)) { this.storage.extractEnergy(((IEnergyHandler)east).receiveEnergy(ForgeDirection.WEST, this.storage.extractEnergy(this.maxTransfer, true), false), false); } else if (EnergyHelper.isEnergyReceiverFromSide(north, ForgeDirection.NORTH)) { this.storage.extractEnergy(((IEnergyHandler)north).receiveEnergy(ForgeDirection.SOUTH, this.storage.extractEnergy(this.maxTransfer, true), false), false); } else if (EnergyHelper.isEnergyReceiverFromSide(south, ForgeDirection.SOUTH)) { this.storage.extractEnergy(((IEnergyHandler)south).receiveEnergy(ForgeDirection.NORTH, this.storage.extractEnergy(this.maxTransfer, true), false), false); } } @SuppressWarnings("unused") private boolean canAddEnergy() { return this.storage.getEnergyStored() == 0 ? false : this.direction != "none"; } public void updateHandlers() { String d = this.getHandlers(); if (d == null) { this.direction = "none"; } else { this.direction = d; } } public String getInvName() { return this.isInvNameLocalized() ? this.localizedName : "Fission Reactor"; } public boolean isInvNameLocalized() { return this.localizedName != null && this.localizedName.length() > 0; } public String getHandlers() { TileEntity down = this.worldObj.getTileEntity(this.xCoord, this.yCoord - 1, this.zCoord); TileEntity up = this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord); TileEntity north = this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord - 1); TileEntity south = this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord + 1); TileEntity east = this.worldObj.getTileEntity(this.xCoord + 1, this.yCoord, this.zCoord); TileEntity west = this.worldObj.getTileEntity(this.xCoord - 1, this.yCoord, this.zCoord); return EnergyHelper.isEnergyReceiverFromSide(down, ForgeDirection.DOWN) ? "down" : (EnergyHelper.isEnergyReceiverFromSide(up, ForgeDirection.UP) ? "up" : (EnergyHelper.isEnergyReceiverFromSide(west, ForgeDirection.WEST) ? "west" : (EnergyHelper.isEnergyReceiverFromSide(east, ForgeDirection.EAST) ? "east" : (EnergyHelper.isEnergyReceiverFromSide(north, ForgeDirection.NORTH) ? "north" : (EnergyHelper.isEnergyReceiverFromSide(south, ForgeDirection.SOUTH) ? "south" : "none"))))); } private void fuel() { ItemStack stack = this.getStackInSlot(0); ItemStack pstack = this.getStackInSlot(1); if (stack != null && pstack == null && isFuel(stack) && this.fueltime == 0 && this.fueltype == 0) { this.addFuel(fuelValue(stack)); this.fueltype = TileEntityFissionReactorGraphite.setfueltype(stack); --this.slots[0].stackSize; if (this.slots[0].stackSize <= 0) { this.slots[0] = null; } } } private void upgrade() { ItemStack stack = this.getStackInSlot(2); if (stack != null && isUpgrade(stack)) { R = (int) (rawR + stack.stackSize); D = R*2 + 1; SR = R-1; SD = SR*2 + 1; if (R != rawR) { } if (this.slots[2].stackSize <= 0) { R = rawR; D = R*2 + 1; SR = R-1; SD = SR*2 + 1; this.slots[2] = null; } } else { R = rawR; D = R*2 + 1; SR = R-1; SD = SR*2 + 1; } } private void product() { if (this.slots[1] == null && this.fueltime == 0 && this.fueltype != 0) { if (this.fueltype == 1) { this.slots[1] = new ItemStack(NRItems.fuel, 1, 22); this.fueltype = 0; } else if (this.fueltype == 2) { this.slots[1] = new ItemStack(NRItems.fuel, 1, 23); this.fueltype = 0; } else if (this.fueltype == 3) { this.slots[1] = new ItemStack(NRItems.fuel, 1, 24); this.fueltype = 0; } else if (this.fueltype == 4) { this.slots[1] = new ItemStack(NRItems.fuel, 1, 25); this.fueltype = 0; } else if (this.fueltype == 5) { this.slots[1] = new ItemStack(NRItems.fuel, 1, 26); this.fueltype = 0; } else if (this.fueltype == 6) { this.slots[1] = new ItemStack(NRItems.fuel, 1, 27); this.fueltype = 0; } else if (this.fueltype == 7) { this.slots[1] = new ItemStack(NRItems.fuel, 1, 28); this.fueltype = 0; } else if (this.fueltype == { this.slots[1] = new ItemStack(NRItems.fuel, 1, 29); this.fueltype = 0; } else if (this.fueltype == 9) { this.slots[1] = new ItemStack(NRItems.fuel, 1, 30); this.fueltype = 0; } else if (this.fueltype == 10) { this.slots[1] = new ItemStack(NRItems.fuel, 1, 31); this.fueltype = 0; } else if (this.fueltype == 11) { this.slots[1] = new ItemStack(NRItems.fuel, 1, 32); this.fueltype = 0; } else {} } } public static boolean isFuel(ItemStack stack) { return fuelValue(stack) > 0 && setfueltype(stack) != 0; } public static boolean isUpgrade(ItemStack stack) { return stack.getItem() == NRItems.upgrade; } public static int fuelValue(ItemStack stack) { if (stack == null) { return 0; } else { Item item = stack.getItem(); if(item == new ItemStack (NRItems.fuel, 1, 11).getItem() && item.getDamage(stack) == 11) { return 7200000; } else if(item == new ItemStack (NRItems.fuel, 1, 12).getItem() && item.getDamage(stack) == 12) { return 7200000; } else if(item == new ItemStack (NRItems.fuel, 1, 13).getItem() && item.getDamage(stack) == 13) { return 7200000; } else if(item == new ItemStack (NRItems.fuel, 1, 14).getItem() && item.getDamage(stack) == 14) { return 7200000; } else if(item == new ItemStack (NRItems.fuel, 1, 15).getItem() && item.getDamage(stack) == 15) { return 7200000; } else if(item == new ItemStack (NRItems.fuel, 1, 16).getItem() && item.getDamage(stack) == 16) { return 7200000; } else if(item == new ItemStack (NRItems.fuel, 1, 17).getItem() && item.getDamage(stack) == 17) { return 7200000; } else if(item == new ItemStack (NRItems.fuel, 1, 18).getItem() && item.getDamage(stack) == 18) { return 7200000; } else if(item == new ItemStack (NRItems.fuel, 1, 19).getItem() && item.getDamage(stack) == 19) { return 7200000; } else if(item == new ItemStack (NRItems.fuel, 1, 20).getItem() && item.getDamage(stack) == 20) { return 7200000; } else if(item == new ItemStack (NRItems.fuel, 1, 21).getItem() && item.getDamage(stack) == 21) { return 7200000; } return 0; } } public static int setfueltype(ItemStack stack) { if (stack == null) { return 0; } else { Item item = stack.getItem(); if(item == new ItemStack (NRItems.fuel, 1, 11).getItem() && item.getDamage(stack) == 11) { return 1; } else if(item == new ItemStack (NRItems.fuel, 1, 12).getItem() && item.getDamage(stack) == 12) { return 2; } else if(item == new ItemStack (NRItems.fuel, 1, 13).getItem() && item.getDamage(stack) == 13) { return 3; } else if(item == new ItemStack (NRItems.fuel, 1, 14).getItem() && item.getDamage(stack) == 14) { return 4; } else if(item == new ItemStack (NRItems.fuel, 1, 15).getItem() && item.getDamage(stack) == 15) { return 5; } else if(item == new ItemStack (NRItems.fuel, 1, 16).getItem() && item.getDamage(stack) == 16) { return 6; } else if(item == new ItemStack (NRItems.fuel, 1, 17).getItem() && item.getDamage(stack) == 17) { return 7; } else if(item == new ItemStack (NRItems.fuel, 1, 18).getItem() && item.getDamage(stack) == 18) { return 8; } else if(item == new ItemStack (NRItems.fuel, 1, 19).getItem() && item.getDamage(stack) == 19) { return 9; } else if(item == new ItemStack (NRItems.fuel, 1, 20).getItem() && item.getDamage(stack) == 20) { return 10; } else if(item == new ItemStack (NRItems.fuel, 1, 21).getItem() && item.getDamage(stack) == 21) { return 11; } return 0; } } public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); if (nbt.hasKey("storage")) { this.storage.readFromNBT(nbt.getCompoundTag("storage")); } this.typeoffuel = nbt.getString("Typeoffuel"); this.problem = nbt.getString("problem"); this.fueltime = nbt.getInteger("Fueltime"); this.fueltype = nbt.getInteger("Fueltype"); this.rawR = nbt.getInteger("rawR"); this.R = nbt.getInteger("R"); this.SR = nbt.getInteger("SR"); this.D = nbt.getInteger("D"); this.SD = nbt.getInteger("SD"); this.E = nbt.getInteger("E"); this.H = nbt.getInteger("H"); this.flag = nbt.getBoolean("flag"); this.flag1 = nbt.getBoolean("flag1"); this.fuelmult = nbt.getInteger("Fuelmult"); this.MBNumber = nbt.getInteger("MBN"); this.heat = nbt.getInteger("Heat"); this.power = nbt.getInteger("Power"); NBTTagList list = nbt.getTagList("Items", 10); this.slots = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < list.tagCount(); ++i) { NBTTagCompound compound = list.getCompoundTagAt(i); byte b = compound.getByte("Slot"); if (b >= 0 && b < this.slots.length) { this.slots[b] = ItemStack.loadItemStackFromNBT(compound); } } } public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); NBTTagCompound energyTag = new NBTTagCompound(); this.storage.writeToNBT(energyTag); nbt.setTag("storage", energyTag); nbt.setInteger("Fueltime", this.fueltime); nbt.setInteger("Fueltype", this.fueltype); nbt.setInteger("rawR", this.rawR); nbt.setInteger("R", this.R); nbt.setInteger("SR", this.SR); nbt.setInteger("D", this.D); nbt.setInteger("SD", this.SD); nbt.setInteger("E", this.E); nbt.setInteger("H", this.H); nbt.setBoolean("flag", this.flag); nbt.setBoolean("flag1", this.flag1); nbt.setInteger("Fuelmult", this.fuelmult); nbt.setInteger("MBN", this.MBNumber); nbt.setInteger("Heat", this.heat); nbt.setInteger("Power", this.power); nbt.setString("Typeoffuel", this.typeoffuel); nbt.setString("problem", this.problem); NBTTagList list = new NBTTagList(); for (int i = 0; i < this.slots.length; ++i) { if (this.slots[i] != null) { NBTTagCompound compound = new NBTTagCompound(); compound.setByte("Slot", (byte)i); this.slots[i].writeToNBT(compound); list.appendTag(compound); } } nbt.setTag("Items", list); if(this.isInvNameLocalized()) { nbt.setString("CustomName", this.localizedName); } } /** * Overriden in a sign to provide the text. */ public Packet getDescriptionPacket() { NBTTagCompound nbtTag = new NBTTagCompound(); nbtTag.setInteger("Energy", this.storage.getEnergyStored()); this.energy = nbtTag.getInteger("Energy"); this.writeToNBT(nbtTag); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbtTag); } public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { super.onDataPacket(net, packet); this.readFromNBT(packet.func_148857_g()); } public void addHeat(int add) { this.heat += add; } public void addFuel(int add) { this.fueltime += add; } public void removeHeat(int remove) { this.heat -= remove; } public void removeFuel(int remove) { this.fueltime -= remove; } public boolean canConnectEnergy(ForgeDirection from) { return true; } public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { return 0; } public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) { return 0; } public int getEnergyStored(ForgeDirection paramForgeDirection) { return this.storage.getEnergyStored(); } public int getMaxEnergyStored(ForgeDirection paramForgeDirection) { return this.storage.getMaxEnergyStored(); } /** * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. */ public boolean isItemValidForSlot(int slot, ItemStack stack) { if (slot == 0) { return isFuel(stack); } else { return false; } } /** * Returns an array containing the indices of the slots that can be accessed by automation on the given side of this * block. */ public int[] getAccessibleSlotsFromSide(int slot) { return slot == 0 ? slotsSides : slotsTop; } /** * Returns true if automation can insert the given item in the given slot from the given side. Args: Slot, item, * side */ public boolean canInsertItem(int slot, ItemStack stack, int par) { return this.isItemValidForSlot(slot, stack); } /** * Returns true if automation can extract the given item in the given slot from the given side. Args: Slot, item, * side */ public boolean canExtractItem(int slot, ItemStack stack, int slots) { return slot == 1; } public int getInventoryStackLimit() { return 8; } private boolean checkReactor() { ForgeDirection forward = ForgeDirection.getOrientation( this.getBlockMetadata()).getOpposite(); int x = xCoord + R * forward.offsetX; int y = yCoord; int z = zCoord + R * forward.offsetZ; for (int Z4 = -R; Z4 <= R; Z4++) { for (int X4 = -R; X4 <= R; X4++) { for (int Y4 = 0; Y4 <= 2*R; Y4++) { if(this.worldObj.getBlock(x + X4, y + Y4, z + Z4)==NRBlocks.fissionReactorGraphiteIdle || this.worldObj.getBlock(x + X4, y + Y4, z + Z4)==NRBlocks.fissionReactorGraphiteActive){ if (x + X4 == this.xCoord && y + Y4 == this.yCoord && z + Z4 == this.zCoord) {} else { this.problem = "Multiple Controllers"; return false; }}}}} for (int Z1 = -SR; Z1 <= SR; Z1++) { for (int X1 = -SR; X1 <= SR; X1++) { if(this.worldObj.getBlock(x + X1, y, z + Z1)!=NRBlocks.reactorBlock){ this.problem = "Casing Incomplete"; return false; } if(this.worldObj.getBlock(x + X1, y+D-1, z + Z1)!=NRBlocks.reactorBlock){ this.problem = "Casing Incomplete"; return false; }}} for (int Y2 = 1; Y2 <= SD; Y2++) { for (int XZ = -SR; XZ <= SR; XZ++) { if(this.worldObj.getBlock(x-R, y+Y2, z+XZ)!=NRBlocks.reactorBlock){ this.problem = "Casing Incomplete"; return false; } if(this.worldObj.getBlock(x+R, y+Y2, z+XZ)!=NRBlocks.reactorBlock){ this.problem = "Casing Incomplete"; return false; } if(x!=R&&x!=-R){ if(this.worldObj.getBlock(x+XZ, y+Y2, z+R)!=NRBlocks.reactorBlock){ this.problem = "Casing Incomplete"; return false; } if(this.worldObj.getBlock(x+XZ, y+Y2, z-R)!=NRBlocks.reactorBlock){ this.problem = "Casing Incomplete"; return false; } if(this.worldObj.getBlock(x, y+Y2, z)!=NRBlocks.cellBlock){ this.problem = "Fuel Rod Incomplete"; return false; }}}} for (int Z3 = -SR; Z3 <= SR; Z3++) { for (int X3 = -SR; X3 <= SR; X3++) { for (int Y3 = 1; Y3 <= SD; Y3++) { if(this.worldObj.getBlock(x + X3, y + Y3, z + Z3)==NRBlocks.reactorBlock){ this.problem = "Casing in Interior"; return false; }}}} this.MBNumber = this.getBlockMetadata(); //this.problem = "No Problem"; return true; } } Thanks in advance for any help
  4. You're a great guy Thanks a bunch for the help.
  5. Does anyone know how to make this work?
  6. Ah yes - true, thank you I understand why that doesn't work now, but I am still a little confused about where to put the for loops How would I allow the method to run through all the blocks before making a decision?
  7. Hey there, I'm not too experienced with modding, but have been making a mod for the past month or so, and have certainly improved. However, I'm attempting to make my currently extremely crude code more compact and simplified by using for loops to detect whether all of the blocks needed for the multiblock structure are there. However, I am clearly doing something wrong: the block is only caring about 6 of the blocks out of the 150 of the structure, and only searches in those places - here is the block class, where everything important is, and the multiblock detection method is at the bottom, with the commented out section at the beginning of the method being the old system. package com.nr.mod.blocks.tileentities; import java.util.Random; 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.command.ICommandSender; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IChatComponent; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import com.nr.mod.NuclearRelativistics; import com.nr.mod.blocks.NRBlocks; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockFissionReactorGraphite extends BlockContainer { private Random rand = new Random(); private final boolean isActive; public static int MBNumber; @SideOnly(Side.CLIENT) private IIcon iconFront; private static boolean keepInventory; public BlockFissionReactorGraphite(boolean isActive) { super(Material.iron); this.isActive = isActive; } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("nr:" + "reactorBlock"); this.iconFront = iconRegister.registerIcon("nr:" + "fissionReactorGraphite" + "Front" + (this.isActive ? "Active" : "Idle")); } public Item getItemDropped(int par1, Random random, int par3) { return Item.getItemFromBlock(NRBlocks.fissionReactorGraphiteIdle); } public void onBlockAdded(World world, int x, int y, int z) { super.onBlockAdded(world, x, y, z); this.setDefaultDirection(world, x, y, z); } private void setDefaultDirection(World world, int x, int y, int z) { if (!world.isRemote) { Block block = world.getBlock(x, y, z - 1); Block block1 = world.getBlock(x, y, z + 1); Block block2 = world.getBlock(x - 1, y, z); Block block3 = world.getBlock(x + 1, y, z); byte b0 = 3; if (block.func_149730_j() && !block1.func_149730_j()) { b0 = 3; } if (block1.func_149730_j() && !block.func_149730_j()) { b0 = 2; } if (block2.func_149730_j() && !block3.func_149730_j()) { b0 = 5; } if (block3.func_149730_j() && !block2.func_149730_j()) { b0 = 4; } world.setBlockMetadataWithNotify(x, y, z, b0, 2); } } @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon); } 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 { FMLNetworkHandler.openGui(player, NuclearRelativistics.instance, NuclearRelativistics.guiIdFissionReactorGraphite, world, x, y, z); } return true; } public TileEntity createNewTileEntity(World world, int par1) { return new TileEntityFissionReactorGraphite(); } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLivingBase, ItemStack itemstack) { int l = MathHelper.floor_double((double)(entityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if (l == 0) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } if (l == 1) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } if (l == 2) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } if (l == 3) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } if (itemstack.hasDisplayName()) { ((TileEntityFissionReactorGraphite)world.getTileEntity(x, y, z)).setGuiDisplayName(itemstack.getDisplayName()); } //itemstack = new ItemStack(NRItems.book, 1); //player.inventory.addItemStackToInventory(itemstack); IChatComponent localIChatComponent; localIChatComponent = IChatComponent.Serializer.func_150699_a("[{text:\"Click here to see how to build the multiblock reactor\",color:aqua,italic:false,clickEvent:{action:open_url,value:\"https://www.dropbox.com/s/vy7ld0dgd71utxu/fission%20reactor%20setup.bmp?dl=0\"}}]"); ((ICommandSender) entityLivingBase).addChatMessage(localIChatComponent); } public static void updateFissionReactorGraphiteBlockState(boolean active, World worldObj, int xCoord, int yCoord, int zCoord) { int i = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); TileEntity tileentity = worldObj.getTileEntity(xCoord, yCoord, zCoord); keepInventory = true; if(active) { worldObj.setBlock(xCoord, yCoord, zCoord, NRBlocks.fissionReactorGraphiteActive); } else { worldObj.setBlock(xCoord, yCoord, zCoord, NRBlocks.fissionReactorGraphiteIdle); } keepInventory = false; worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, i, 2); if(tileentity != null) { tileentity.validate(); worldObj.setTileEntity(xCoord, yCoord, zCoord, tileentity); } } public void breakBlock(World world, int x, int y, int z, Block oldBlockID, int oldMetadata) { if(!keepInventory) { TileEntityFissionReactorGraphite tileentity = (TileEntityFissionReactorGraphite) world.getTileEntity(x, y, z); if(tileentity != null) { for(int i = 0; i < tileentity.getSizeInventory(); i++) { ItemStack itemstack = tileentity.getStackInSlot(i); if(itemstack != null) { float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; while(itemstack.stackSize > 0) { int j = this.rand.nextInt(21) + 10; if(j > itemstack.stackSize) { j = itemstack.stackSize; } itemstack.stackSize -= j; EntityItem item = new EntityItem(world, (double) ((float) x + f), ((float) y + f1), ((float) z + f2), new ItemStack (itemstack.getItem(), j, itemstack.getItemDamage())); if(itemstack.hasTagCompound()) { item.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); } float f3 = 0.05F; item.motionX = (double)((float) this.rand.nextGaussian() * f3); item.motionY = (double)((float) this.rand.nextGaussian() * f3 + 0.2F); item.motionZ = (double)((float) this.rand.nextGaussian() * f3); world.spawnEntityInWorld(item); } } } world.func_147453_f(x, y, z, oldBlockID); } } super.breakBlock(world, x, y, z, oldBlockID, oldMetadata); } public boolean hasComparatorInputOverride() { return true; } public int getComparatorInputOverride(World world, int x, int y, int z, int i) { return Container.calcRedstoneFromInventory((IInventory)world.getTileEntity(x, y, z)); } public Block idPicked(World world, int x, int y, int z) { return NRBlocks.fissionReactorGraphiteIdle; } public static boolean isMultiBlock(World world, int x, int y, int z) { /*if (world.getBlock(x-2, y, z-1) == NRBlocks.reactorBlock && world.getBlock(x-1, y, z-1) == NRBlocks.reactorBlock && world.getBlock(x, y, z-1) == NRBlocks.reactorBlock && world.getBlock(x+1, y, z-1) == NRBlocks.reactorBlock && world.getBlock(x+2, y, z-1) == NRBlocks.reactorBlock && world.getBlock(x-2, y, z-2) == NRBlocks.reactorBlock && world.getBlock(x-1, y, z-2) == NRBlocks.reactorBlock && world.getBlock(x, y, z-2) == NRBlocks.reactorBlock && world.getBlock(x+1, y, z-2) == NRBlocks.reactorBlock && world.getBlock(x+2, y, z-2) == NRBlocks.reactorBlock && world.getBlock(x-2, y, z-3) == NRBlocks.reactorBlock && world.getBlock(x-1, y, z-3) == NRBlocks.reactorBlock && world.getBlock(x, y, z-3) == NRBlocks.reactorBlock && world.getBlock(x+1, y, z-3) == NRBlocks.reactorBlock && world.getBlock(x+2, y, z-3) == NRBlocks.reactorBlock && world.getBlock(x-2, y, z-4) == NRBlocks.reactorBlock && world.getBlock(x-1, y, z-4) == NRBlocks.reactorBlock && world.getBlock(x, y, z-4) == NRBlocks.reactorBlock && world.getBlock(x+1, y, z-4) == NRBlocks.reactorBlock && world.getBlock(x+2, y, z-4) == NRBlocks.reactorBlock && world.getBlock(x-2, y, z-5) == NRBlocks.reactorBlock && world.getBlock(x-1, y, z-5) == NRBlocks.reactorBlock && world.getBlock(x, y, z-5) == NRBlocks.reactorBlock && world.getBlock(x+1, y, z-5) == NRBlocks.reactorBlock && world.getBlock(x+2, y, z-5) == NRBlocks.reactorBlock && world.getBlock(x-2, y+6, z-1) == NRBlocks.reactorBlock && world.getBlock(x-1, y+6, z-1) == NRBlocks.reactorBlock && world.getBlock(x, y+6, z-1) == NRBlocks.reactorBlock && world.getBlock(x+1, y+6, z-1) == NRBlocks.reactorBlock && world.getBlock(x+2, y+6, z-1) == NRBlocks.reactorBlock && world.getBlock(x-2, y+6, z-2) == NRBlocks.reactorBlock && world.getBlock(x-1, y+6, z-2) == NRBlocks.reactorBlock && world.getBlock(x, y+6, z-2) == NRBlocks.reactorBlock && world.getBlock(x+1, y+6, z-2) == NRBlocks.reactorBlock && world.getBlock(x+2, y+6, z-2) == NRBlocks.reactorBlock && world.getBlock(x-2, y+6, z-3) == NRBlocks.reactorBlock && world.getBlock(x-1, y+6, z-3) == NRBlocks.reactorBlock && world.getBlock(x, y+6, z-3) == NRBlocks.reactorBlock && world.getBlock(x+1, y+6, z-3) == NRBlocks.reactorBlock && world.getBlock(x+2, y+6, z-3) == NRBlocks.reactorBlock && world.getBlock(x-2, y+6, z-4) == NRBlocks.reactorBlock && world.getBlock(x-1, y+6, z-4) == NRBlocks.reactorBlock && world.getBlock(x, y+6, z-4) == NRBlocks.reactorBlock && world.getBlock(x+1, y+6, z-4) == NRBlocks.reactorBlock && world.getBlock(x+2, y+6, z-4) == NRBlocks.reactorBlock && world.getBlock(x-2, y+6, z-5) == NRBlocks.reactorBlock && world.getBlock(x-1, y+6, z-5) == NRBlocks.reactorBlock && world.getBlock(x, y+6, z-5) == NRBlocks.reactorBlock && world.getBlock(x+1, y+6, z-5) == NRBlocks.reactorBlock && world.getBlock(x+2, y+6, z-5) == NRBlocks.reactorBlock && world.getBlock(x-3, y+1, z-1) == NRBlocks.reactorBlock && world.getBlock(x-3, y+1, z-2) == NRBlocks.reactorBlock && world.getBlock(x-3, y+1, z-3) == NRBlocks.reactorBlock && world.getBlock(x-3, y+1, z-4) == NRBlocks.reactorBlock && world.getBlock(x-3, y+1, z-5) == NRBlocks.reactorBlock && world.getBlock(x-3, y+2, z-1) == NRBlocks.reactorBlock && world.getBlock(x-3, y+2, z-2) == NRBlocks.reactorBlock && world.getBlock(x-3, y+2, z-3) == NRBlocks.reactorBlock && world.getBlock(x-3, y+2, z-4) == NRBlocks.reactorBlock && world.getBlock(x-3, y+2, z-5) == NRBlocks.reactorBlock && world.getBlock(x-3, y+3, z-1) == NRBlocks.reactorBlock && world.getBlock(x-3, y+3, z-2) == NRBlocks.reactorBlock && world.getBlock(x-3, y+3, z-3) == NRBlocks.reactorBlock && world.getBlock(x-3, y+3, z-4) == NRBlocks.reactorBlock && world.getBlock(x-3, y+3, z-5) == NRBlocks.reactorBlock && world.getBlock(x-3, y+4, z-1) == NRBlocks.reactorBlock && world.getBlock(x-3, y+4, z-2) == NRBlocks.reactorBlock && world.getBlock(x-3, y+4, z-3) == NRBlocks.reactorBlock && world.getBlock(x-3, y+4, z-4) == NRBlocks.reactorBlock && world.getBlock(x-3, y+4, z-5) == NRBlocks.reactorBlock && world.getBlock(x-3, y+5, z-1) == NRBlocks.reactorBlock && world.getBlock(x-3, y+5, z-2) == NRBlocks.reactorBlock && world.getBlock(x-3, y+5, z-3) == NRBlocks.reactorBlock && world.getBlock(x-3, y+5, z-4) == NRBlocks.reactorBlock && world.getBlock(x-3, y+5, z-5) == NRBlocks.reactorBlock && world.getBlock(x+3, y+1, z-1) == NRBlocks.reactorBlock && world.getBlock(x+3, y+1, z-2) == NRBlocks.reactorBlock && world.getBlock(x+3, y+1, z-3) == NRBlocks.reactorBlock && world.getBlock(x+3, y+1, z-4) == NRBlocks.reactorBlock && world.getBlock(x+3, y+1, z-5) == NRBlocks.reactorBlock && world.getBlock(x+3, y+2, z-1) == NRBlocks.reactorBlock && world.getBlock(x+3, y+2, z-2) == NRBlocks.reactorBlock && world.getBlock(x+3, y+2, z-3) == NRBlocks.reactorBlock && world.getBlock(x+3, y+2, z-4) == NRBlocks.reactorBlock && world.getBlock(x+3, y+2, z-5) == NRBlocks.reactorBlock && world.getBlock(x+3, y+3, z-1) == NRBlocks.reactorBlock && world.getBlock(x+3, y+3, z-2) == NRBlocks.reactorBlock && world.getBlock(x+3, y+3, z-3) == NRBlocks.reactorBlock && world.getBlock(x+3, y+3, z-4) == NRBlocks.reactorBlock && world.getBlock(x+3, y+3, z-5) == NRBlocks.reactorBlock && world.getBlock(x+3, y+4, z-1) == NRBlocks.reactorBlock && world.getBlock(x+3, y+4, z-2) == NRBlocks.reactorBlock && world.getBlock(x+3, y+4, z-3) == NRBlocks.reactorBlock && world.getBlock(x+3, y+4, z-4) == NRBlocks.reactorBlock && world.getBlock(x+3, y+4, z-5) == NRBlocks.reactorBlock && world.getBlock(x+3, y+5, z-1) == NRBlocks.reactorBlock && world.getBlock(x+3, y+5, z-2) == NRBlocks.reactorBlock && world.getBlock(x+3, y+5, z-3) == NRBlocks.reactorBlock && world.getBlock(x+3, y+5, z-4) == NRBlocks.reactorBlock && world.getBlock(x+3, y+5, z-5) == NRBlocks.reactorBlock && world.getBlock(x-2, y+1, z) == NRBlocks.reactorBlock && world.getBlock(x-1, y+1, z) == NRBlocks.reactorBlock && world.getBlock(x, y+1, z) == NRBlocks.reactorBlock && world.getBlock(x+1, y+1, z) == NRBlocks.reactorBlock && world.getBlock(x+2, y+1, z) == NRBlocks.reactorBlock && world.getBlock(x-2, y+2, z) == NRBlocks.reactorBlock && world.getBlock(x-1, y+2, z) == NRBlocks.reactorBlock && world.getBlock(x, y+2, z) == NRBlocks.reactorBlock && world.getBlock(x+1, y+2, z) == NRBlocks.reactorBlock && world.getBlock(x+2, y+2, z) == NRBlocks.reactorBlock && world.getBlock(x-2, y+3, z) == NRBlocks.reactorBlock && world.getBlock(x-1, y+3, z) == NRBlocks.reactorBlock && world.getBlock(x, y+3, z) == NRBlocks.reactorBlock && world.getBlock(x+1, y+3, z) == NRBlocks.reactorBlock && world.getBlock(x+2, y+3, z) == NRBlocks.reactorBlock && world.getBlock(x-2, y+4, z) == NRBlocks.reactorBlock && world.getBlock(x-1, y+4, z) == NRBlocks.reactorBlock && world.getBlock(x, y+4, z) == NRBlocks.reactorBlock && world.getBlock(x+1, y+4, z) == NRBlocks.reactorBlock && world.getBlock(x+2, y+4, z) == NRBlocks.reactorBlock && world.getBlock(x-2, y+5, z) == NRBlocks.reactorBlock && world.getBlock(x-1, y+5, z) == NRBlocks.reactorBlock && world.getBlock(x, y+5, z) == NRBlocks.reactorBlock && world.getBlock(x+1, y+5, z) == NRBlocks.reactorBlock && world.getBlock(x+2, y+5, z) == NRBlocks.reactorBlock && world.getBlock(x-2, y+1, z-6) == NRBlocks.reactorBlock && world.getBlock(x-1, y+1, z-6) == NRBlocks.reactorBlock && world.getBlock(x, y+1, z-6) == NRBlocks.reactorBlock && world.getBlock(x+1, y+1, z-6) == NRBlocks.reactorBlock && world.getBlock(x+2, y+1, z-6) == NRBlocks.reactorBlock && world.getBlock(x-2, y+2, z-6) == NRBlocks.reactorBlock && world.getBlock(x-1, y+2, z-6) == NRBlocks.reactorBlock && world.getBlock(x, y+2, z-6) == NRBlocks.reactorBlock && world.getBlock(x+1, y+2, z-6) == NRBlocks.reactorBlock && world.getBlock(x+2, y+2, z-6) == NRBlocks.reactorBlock && world.getBlock(x-2, y+3, z-6) == NRBlocks.reactorBlock && world.getBlock(x-1, y+3, z-6) == NRBlocks.reactorBlock && world.getBlock(x, y+3, z-6) == NRBlocks.reactorBlock && world.getBlock(x+1, y+3, z-6) == NRBlocks.reactorBlock && world.getBlock(x+2, y+3, z-6) == NRBlocks.reactorBlock && world.getBlock(x-2, y+4, z-6) == NRBlocks.reactorBlock && world.getBlock(x-1, y+4, z-6) == NRBlocks.reactorBlock && world.getBlock(x, y+4, z-6) == NRBlocks.reactorBlock && world.getBlock(x+1, y+4, z-6) == NRBlocks.reactorBlock && world.getBlock(x+2, y+4, z-6) == NRBlocks.reactorBlock && world.getBlock(x-2, y+5, z-6) == NRBlocks.reactorBlock && world.getBlock(x-1, y+5, z-6) == NRBlocks.reactorBlock && world.getBlock(x, y+5, z-6) == NRBlocks.reactorBlock && world.getBlock(x+1, y+5, z-6) == NRBlocks.reactorBlock && world.getBlock(x+2, y+5, z-6) == NRBlocks.reactorBlock && world.getBlock(x-3, y, z-1) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x-3, y, z-2) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x-3, y, z-3) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x-3, y, z-4) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x-3, y, z-5) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x+3, y, z-1) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x+3, y, z-2) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x+3, y, z-3) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x+3, y, z-4) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x+3, y, z-5) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x-2, y, z) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x-1, y, z) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x+1, y, z) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x+2, y, z) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x-2, y, z-6) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x-1, y, z-6) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x, y, z-6) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x+1, y, z-6) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x+2, y, z-6) != NRBlocks.fissionReactorGraphiteIdle && world.getBlock(x-3, y, z-1) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x-3, y, z-2) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x-3, y, z-3) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x-3, y, z-4) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x-3, y, z-5) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x+3, y, z-1) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x+3, y, z-2) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x+3, y, z-3) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x+3, y, z-4) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x+3, y, z-5) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x-2, y, z) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x-1, y, z) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x+1, y, z) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x+2, y, z) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x-2, y, z-6) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x-1, y, z-6) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x, y, z-6) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x+1, y, z-6) != NRBlocks.fissionReactorGraphiteActive && world.getBlock(x+2, y, z-6) != NRBlocks.fissionReactorGraphiteActive )*/ for (int i1 = 0; i1 < 5; i1++) { for (int i2 = 0; i2 < 5; i2++) { if (world.getBlock(x-2+i1, y, z-1-i2) == NRBlocks.reactorBlock && world.getBlock(x-2+i1, y+6, z-1-i2) == NRBlocks.reactorBlock && world.getBlock(x-3, y+1+i1, z-1-i2) == NRBlocks.reactorBlock && world.getBlock(x+3, y+1+i1, z-1-i2) == NRBlocks.reactorBlock && world.getBlock(x-2+i1, y+1+i2, z) == NRBlocks.reactorBlock && world.getBlock(x-2+i1, y+1+i2, z-6) == NRBlocks.reactorBlock) { MBNumber = 1; return true; } /*else if (world.getBlock(x-1, y, z-1) == NRBlocks.reactorBlock && world.getBlock(x-1, y, z-1) == NRBlocks.reactorBlock) { MBNumber = 2; return true; } else if (world.getBlock(x+2, y, z-6) != NRBlocks.fissionReactorGraphiteActive) { MBNumber = 3; return true; } else if (world.getBlock(x+2, y, z-6) != NRBlocks.fissionReactorGraphiteActive) { MBNumber = 4; return true; }*/ } } MBNumber = 0; return false; } } Thanks in advance for anyone better at this than me for noticing why this won't work
  8. What's wrong with 1057? I'm not saying you're wrong, I'm just not not aware of these problems. Is it really bad?
  9. If this helps, I based my fluids code very much on Tinkers Construct's way of doing things - I found that, since that mod adds many liquids, that would be the best way to go.
  10. Also - these fluids render fine in the Tinkers Construct seared tanks and glass, just not BuildCraft tanks...
  11. Hey, I am using the Forge 1057 src for 1.7.2 (the latest version) to write my mod - I am quite new to modding, so it may be something simple I have missed - I have my fluids working fine in the world, but in BuildCraft tanks, they render as the missing texture, the purple and black squares - in the world, when they're placed in the world, they work fine. Also, when I apply things like luminosity, density etc. , they don't work at all. Here are the classes I have made, sorry if it is messy: Main Class - ChemicalWarfare.java package com.chemwarfare; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialLiquid; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = ChemicalWarfare.MODID, version = ChemicalWarfare.VERSION) public class ChemicalWarfare { public static final String MODID = "chemicalwarfare"; public static final String VERSION = "172.0.0.0.1"; public static CreativeTabs tabChemicalWarfare = new TabChemicalWarfare("ChemicalWarfare"); public static final Material gas = new MaterialLiquid(MapColor.airColor); public static final Logger logger = LogManager.getLogger("ChemicalWarfare"); public static Block BlockFluoriteOre; public static Block BlockUraniumOre; public static Block BlockSalt; public static Block BlockFluidArgon; public static Block BlockFluidCalcium; public static Block BlockFluidCarbonDioxide; public static Block BlockFluidCarbonMonoxide; public static Block BlockFluidChlorine; public static Block BlockFluidFluorine; public static Block BlockFluidFluorite; public static Block BlockFluidHelium; public static Block BlockFluidHydrogen; public static Block BlockFluidKrypton; public static Block BlockFluidMethane; public static Block BlockFluidNeon; public static Block BlockFluidNitrogen; public static Block BlockFluidOxygen; public static Block BlockFluidRadon; public static Block BlockFluidSalt; public static Block BlockFluidSodiumHydroxide; public static Block BlockFluidUranium; public static Block BlockFluidXenon; public static Item ItemFluoriteCrystal; public static Item ItemSalt; public static Item ItemUraniumIngot; public static Item ItemCalciumIngot; public static Fluid FluidArgon; public static Fluid FluidCalcium; public static Fluid FluidCarbonDioxide; public static Fluid FluidCarbonMonoxide; public static Fluid FluidChlorine; public static Fluid FluidFluorine; public static Fluid FluidFluorite; public static Fluid FluidHelium; public static Fluid FluidHydrogen; public static Fluid FluidKrypton; public static Fluid FluidMethane; public static Fluid FluidNeon; public static Fluid FluidNitrogen; public static Fluid FluidOxygen; public static Fluid FluidRadon; public static Fluid FluidSalt; public static Fluid FluidSodiumHydroxide; public static Fluid FluidUranium; public static Fluid FluidXenon; public static Fluid[] Fluids = new Fluid[27]; public static Block[] FluidBlocks = new Block[26]; @EventHandler public void preInit(FMLPreInitializationEvent event) { BlockFluoriteOre = new BlockFluoriteOre().setBlockName("BlockFluoriteOre"); GameRegistry.registerBlock(BlockFluoriteOre, BlockFluoriteOre.getUnlocalizedName().substring(5)).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeStone); BlockUraniumOre = new BlockUraniumOre().setBlockName("BlockUraniumOre"); GameRegistry.registerBlock(BlockUraniumOre, BlockUraniumOre.getUnlocalizedName().substring(5)).setHardness(5.0F).setResistance(8.0F).setStepSound(Block.soundTypeStone); BlockSalt = new BlockSalt().setBlockName("BlockSalt"); GameRegistry.registerBlock(BlockSalt, BlockSalt.getUnlocalizedName().substring(5)).setHardness(0.4F).setResistance(1.0F).setStepSound(Block.soundTypeGravel); FluidArgon = new Fluid("Argon"); FluidRegistry.registerFluid(FluidArgon); BlockFluidArgon = new BlockFluid(FluidArgon, gas, "FluidArgon").setBlockName("BlockFluidArgon"); GameRegistry.registerBlock(BlockFluidArgon, "BlockFluidArgon"); FluidArgon.setBlock(BlockFluidArgon).setDensity(1); FluidCalcium = new Fluid("Calcium"); FluidRegistry.registerFluid(FluidCalcium); BlockFluidCalcium = new BlockFluid(FluidCalcium, Material.lava, "FluidCalcium").setBlockName("BlockFluidCalcium"); GameRegistry.registerBlock(BlockFluidCalcium, "BlockFluidCalcium"); FluidCalcium.setBlock(BlockFluidCalcium).setLuminosity(15).setDensity(3000).setViscosity(6000).setTemperature(1500); FluidCarbonDioxide = new Fluid("CarbonDioxide"); FluidRegistry.registerFluid(FluidCarbonDioxide); BlockFluidCarbonDioxide = new BlockFluid(FluidCarbonDioxide, gas, "FluidCarbonDioxide").setBlockName("BlockFluidCarbonDioxide"); GameRegistry.registerBlock(BlockFluidCarbonDioxide, "BlockFluidCarbonDioxide"); FluidCarbonDioxide.setBlock(BlockFluidCarbonDioxide).setDensity(1); FluidCarbonMonoxide = new Fluid("CarbonMonoxide"); FluidRegistry.registerFluid(FluidCarbonMonoxide); BlockFluidCarbonMonoxide = new BlockFluid(FluidCarbonMonoxide, gas, "FluidCarbonMonoxide").setBlockName("BlockFluidCarbonMonoxide"); GameRegistry.registerBlock(BlockFluidCarbonMonoxide, "BlockFluidCarbonMonoxide"); FluidCarbonMonoxide.setBlock(BlockFluidCarbonMonoxide).setDensity(1); FluidChlorine = new Fluid("Chlorine"); FluidRegistry.registerFluid(FluidChlorine); BlockFluidChlorine = new BlockFluid(FluidChlorine, gas, "FluidChlorine").setBlockName("BlockFluidChlorine"); GameRegistry.registerBlock(BlockFluidChlorine, "BlockFluidChlorine"); FluidChlorine.setBlock(BlockFluidChlorine).setDensity(1); FluidFluorine = new Fluid("Fluorine"); FluidRegistry.registerFluid(FluidFluorine); BlockFluidFluorine = new BlockFluid(FluidFluorine, gas, "FluidFluorine").setBlockName("BlockFluidFluorine"); GameRegistry.registerBlock(BlockFluidFluorine, "BlockFluidFluorine"); FluidFluorine.setBlock(BlockFluidFluorine).setDensity(1); FluidFluorite = new Fluid("Fluorite"); FluidRegistry.registerFluid(FluidFluorite); BlockFluidFluorite = new BlockFluid(FluidFluorite, Material.lava, "FluidFluorite").setBlockName("BlockFluidFluorite"); GameRegistry.registerBlock(BlockFluidFluorite, "BlockFluidFluorite"); FluidFluorite.setBlock(BlockFluidFluorite).setLuminosity(15).setDensity(3000).setViscosity(6000).setTemperature(1500); FluidHelium = new Fluid("Helium"); FluidRegistry.registerFluid(FluidHelium); BlockFluidHelium = new BlockFluid(FluidHelium, gas, "FluidHelium").setBlockName("BlockFluidHelium"); GameRegistry.registerBlock(BlockFluidHelium, "BlockFluidHelium"); FluidHelium.setBlock(BlockFluidHelium).setDensity(1); FluidHydrogen = new Fluid("Hydrogen"); FluidRegistry.registerFluid(FluidHydrogen); BlockFluidHydrogen = new BlockFluid(FluidHydrogen, gas, "FluidHydrogen").setBlockName("BlockFluidHydrogen"); GameRegistry.registerBlock(BlockFluidHydrogen, "BlockFluidHydrogen"); FluidHydrogen.setBlock(BlockFluidHydrogen).setDensity(1); FluidKrypton = new Fluid("Krypton"); FluidRegistry.registerFluid(FluidKrypton); BlockFluidKrypton = new BlockFluid(FluidKrypton, gas, "FluidKrypton").setBlockName("BlockFluidKrypton"); GameRegistry.registerBlock(BlockFluidKrypton, "BlockFluidKrypton"); FluidKrypton.setBlock(BlockFluidKrypton).setDensity(1); FluidMethane = new Fluid("Methane"); FluidRegistry.registerFluid(FluidMethane); BlockFluidMethane = new BlockFluid(FluidMethane, gas, "FluidMethane").setBlockName("BlockFluidMethane"); GameRegistry.registerBlock(BlockFluidMethane, "BlockFluidMethane"); FluidMethane.setBlock(BlockFluidMethane).setDensity(1); FluidNeon = new Fluid("Neon"); FluidRegistry.registerFluid(FluidNeon); BlockFluidNeon = new BlockFluid(FluidNeon, gas, "FluidNeon").setBlockName("BlockFluidNeon"); GameRegistry.registerBlock(BlockFluidNeon, "BlockFluidNeon"); FluidNeon.setBlock(BlockFluidNeon).setDensity(1); FluidNitrogen = new Fluid("Nitrogen"); FluidRegistry.registerFluid(FluidNitrogen); BlockFluidNitrogen = new BlockFluid(FluidNitrogen, gas, "FluidNitrogen").setBlockName("BlockFluidNitrogen"); GameRegistry.registerBlock(BlockFluidNitrogen, "BlockFluidNitrogen"); FluidNitrogen.setBlock(BlockFluidNitrogen).setDensity(1); FluidOxygen = new Fluid("Oxygen"); FluidRegistry.registerFluid(FluidOxygen); BlockFluidOxygen = new BlockFluid(FluidOxygen, gas, "FluidOxygen").setBlockName("BlockFluidOxygen"); GameRegistry.registerBlock(BlockFluidOxygen, "BlockFluidOxygen"); FluidOxygen.setBlock(BlockFluidOxygen).setDensity(1); FluidRadon = new Fluid("Radon"); FluidRegistry.registerFluid(FluidRadon); BlockFluidRadon = new BlockFluid(FluidRadon, gas, "FluidRadon").setBlockName("BlockFluidRadon"); GameRegistry.registerBlock(BlockFluidRadon, "BlockFluidRadon"); FluidRadon.setBlock(BlockFluidRadon).setDensity(1); FluidSalt = new Fluid("Salt"); FluidRegistry.registerFluid(FluidSalt); BlockFluidSalt = new BlockFluid(FluidSalt, Material.water, "FluidSalt").setBlockName("BlockFluidSalt"); GameRegistry.registerBlock(BlockFluidSalt, "BlockFluidSalt"); FluidSalt.setBlock(BlockFluidSalt); FluidSodiumHydroxide = new Fluid("SodiumHydroxide"); FluidRegistry.registerFluid(FluidSodiumHydroxide); BlockFluidSodiumHydroxide = new BlockFluid(FluidSodiumHydroxide, Material.water, "FluidSodiumHydroxide").setBlockName("BlockFluidSodiumHydroxide"); GameRegistry.registerBlock(BlockFluidSodiumHydroxide, "BlockFluidSodiumHydroxide"); FluidSodiumHydroxide.setBlock(BlockFluidSodiumHydroxide); FluidUranium = new Fluid("Uranium"); FluidRegistry.registerFluid(FluidUranium); BlockFluidUranium = new BlockFluid(FluidUranium, Material.lava, "FluidUranium").setBlockName("BlockFluidUranium"); GameRegistry.registerBlock(BlockFluidUranium, "BlockFluidUranium"); FluidUranium.setBlock(BlockFluidUranium).setLuminosity(15).setDensity(3000).setViscosity(6000).setTemperature(1500); FluidXenon = new Fluid("Xenon"); FluidRegistry.registerFluid(FluidXenon); BlockFluidXenon = new BlockFluid(FluidXenon, gas, "FluidXenon").setBlockName("BlockFluidXenon"); GameRegistry.registerBlock(BlockFluidXenon, "BlockFluidXenon"); FluidXenon.setBlock(BlockFluidXenon).setDensity(1); ItemFluoriteCrystal = new ItemFluoriteCrystal().setUnlocalizedName("ItemFluoriteCrystal").setTextureName(ChemicalWarfare.MODID + ":" + "ItemFluoriteCrystal"); GameRegistry.registerItem(ItemFluoriteCrystal, ItemFluoriteCrystal.getUnlocalizedName().substring(5)); ItemSalt = new ItemSalt().setUnlocalizedName("ItemSalt").setTextureName(ChemicalWarfare.MODID + ":" + "ItemSalt"); GameRegistry.registerItem(ItemSalt, ItemSalt.getUnlocalizedName().substring(5)); ItemUraniumIngot = new ItemUraniumIngot().setUnlocalizedName("ItemUraniumIngot").setTextureName(ChemicalWarfare.MODID + ":" + "ItemUraniumIngot"); GameRegistry.registerItem(ItemUraniumIngot, ItemUraniumIngot.getUnlocalizedName().substring(5)); ItemCalciumIngot = new ItemCalciumIngot().setUnlocalizedName("ItemCalciumIngot").setTextureName(ChemicalWarfare.MODID + ":" + "ItemCalciumIngot"); GameRegistry.registerItem(ItemCalciumIngot, ItemCalciumIngot.getUnlocalizedName().substring(5)); ItemStack SaltStack = new ItemStack(ItemSalt); GameRegistry.addShapelessRecipe(new ItemStack(BlockSalt), SaltStack, SaltStack, SaltStack, SaltStack, SaltStack, SaltStack, SaltStack, SaltStack, SaltStack); GameRegistry.addSmelting(BlockUraniumOre, new ItemStack(ItemUraniumIngot), 0.8f); Fluids = new Fluid[] { FluidArgon, FluidCalcium, FluidCarbonDioxide, FluidCarbonMonoxide, FluidChlorine, FluidFluorine, FluidFluorite, FluidHelium, FluidHydrogen, FluidKrypton, FluidMethane, FluidNeon, FluidNitrogen, FluidOxygen, FluidRadon, FluidSalt, FluidSodiumHydroxide, FluidUranium, FluidXenon }; FluidBlocks = new Block[] { BlockFluidArgon, BlockFluidCalcium, BlockFluidCarbonDioxide, BlockFluidCarbonMonoxide, BlockFluidChlorine, BlockFluidFluorine, BlockFluidFluorite, BlockFluidHelium, BlockFluidHydrogen, BlockFluidKrypton, BlockFluidMethane, BlockFluidNeon, BlockFluidNitrogen, BlockFluidOxygen, BlockFluidRadon, BlockFluidSalt, BlockFluidSodiumHydroxide, BlockFluidUranium, BlockFluidXenon }; } } BlockFluid.java package com.chemwarfare; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; public class BlockFluid extends BlockFluidClassic { String texture; boolean alpha; public IIcon stillIcon; public IIcon flowingIcon; public BlockFluid(Fluid fluid, Material material, String texture) { super(fluid, material); this.texture = texture; this.setCreativeTab(ChemicalWarfare.tabChemicalWarfare); } public BlockFluid(Fluid fluid, Material material, String texture, boolean alpha) { this(fluid, material, texture); this.alpha = alpha; } @Override public int getRenderBlockPass () { return alpha ? 1 : 0; } @Override public void registerBlockIcons (IIconRegister iconRegister) { stillIcon = iconRegister.registerIcon("chemicalwarfare:" + texture); flowingIcon = iconRegister.registerIcon("chemicalwarfare:" + texture + "Flow"); } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { if (side == 0 || side == 1) return stillIcon; return flowingIcon; } } Any help would be appreciated - thanks in advance. Again, I may just be missing something stupid...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.