Posted April 23, 20169 yr I have been creating a powering system and its not working below are the classes if I forgot anything or you need to see another part of the code just ask. solar genny http://pastebin.com/M1z2LPEt energy duct http://pastebin.com/XhLRutMk energy duct base http://pastebin.com/wr1PPTA2 blockAC http://pastebin.com/peXAkz1v
April 23, 20169 yr First things first, why are you still on 1.7.10 Next, if a class implements an interface, its subclasses will already be implementing that interface, you don't need to declare it again: BlockAC extends Block implements IAc BlockEnergyDuctBase extends BlockAC implements IAc Third, define "not working." Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
April 23, 20169 yr Author not working as in it isn't sending power to a block that's set to consume it
April 23, 20169 yr Author http://pastebin.com/S51PdEaf that's a block I made just to test if its working and if its working it should light up but its not lighting up so...
April 23, 20169 yr Line 105 of that paste has a method that calls itself. Also, setLightLevel is not how you get a block to emit light on a per-instance basis. That will cause all copies of the block to start emitting light. You also never reset the light value. That block also never calls EnergyDraw in order to determine how much energy it should take from anywhere. Similarly, EnergyIn isn't called from anywhere and similarly does nothing. Then in your EnergyDuct block your EnergyStored method returns 0, meaning it would be incapable of sending energy anywhere. But if we look at this a little more closely: where would this block store energy? If we create a field for it, all of our Duct blocks would share that variable! Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
April 24, 20169 yr Author I removed the setLightLevel bit, energyDraw was set at 1 on the test block also what do you mean here "where would this block store energy? If we create a field for it, all of our Duct blocks would share that variable!"? and the duct has this for its stored int tick = tickRate(Minecraft.getMinecraft().theWorld); int energyStored = tick * EnergyGenerating(); return energyStored;" Line 105 of that paste has a method that calls itself. Also, setLightLevel is not how you get a block to emit light on a per-instance basis. That will cause all copies of the block to start emitting light. You also never reset the light value. That block also never calls EnergyDraw in order to determine how much energy it should take from anywhere. Similarly, EnergyIn isn't called from anywhere and similarly does nothing. Then in your EnergyDuct block your EnergyStored method returns 0, meaning it would be incapable of sending energy anywhere. But if we look at this a little more closely: where would this block store energy? If we create a field for it, all of our Duct blocks would share that variable!
April 24, 20169 yr I removed the setLightLevel bit, energyDraw was set at 1 on the test block also what do you mean here "where would this block store energy? If we create a field for it, all of our Duct blocks would share that variable!"? and the duct has this for its stored Cough. BlockDuct line 114: @Override public int EnergyStored() { // TODO Auto-generated method stub return 0; } How do you plan on implementing that method? Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
April 24, 20169 yr Author I may have changed something after I pasted it here they are again EnergyDuct http://pastebin.com/yPmfzn5f energyDuctBase http://pastebin.com/C9unk14v
April 24, 20169 yr Still a stub. @Override public int EnergyStored() { // TODO Auto-generated method stub return 0; } And even in your EnergyDuctBase that method will return 0 as well, because it multiplies its tick rate by the result of EnergyGenerating() which returns 0: //done @Override public int EnergyGenerating() { return 0; } You will almost certainly not be able to get this to work without using TileEntities. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
April 24, 20169 yr Author I replaced the generating one this this hint it still will not work int tick = tickRate(Minecraft.getMinecraft().theWorld); int energyStored = EnergyIn(access, x, y, z, world); return (energyStored * tick); I also don't know where you see this method @Override public int EnergyStored() { // TODO Auto-generated method stub return 0; }
April 24, 20169 yr I also don't know where you see this method @Override public int EnergyStored() { // TODO Auto-generated method stub return 0; } BlockDuct.java line 114 Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
April 24, 20169 yr Author I'm changing to tileentitys now but why would the game care if its a regular block or TileEntity
April 24, 20169 yr Author I understand and also I update all the blocks to TileEntitys but the system still doesn't work so here are the class again(some stuff changed) BlockDuct.java http://pastebin.com/EK4GTDYC BlockEnergyDuctBase.java http://pastebin.com/F4GsHtvx IAc.java(interface) http://pastebin.com/9f2MaawR BlockSolarGenny.java http://pastebin.com/1WSPeBe8 BlockAc.java package neg2013.acsension.infrastructure; import neg2013.acsension.interfaces.IAc; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockAC extends Block implements IAc{ protected BlockAC(Material material) { super(material); this.blockHardness = 2f; } //done @Override public int MaxEnergyStored() { int maxEnergyStored = MaxEnergyStored(); return 0; } //done @Override public int EnergyStored(IBlockAccess access, int x, int y, int z, World world) { int tick = tickRate(Minecraft.getMinecraft().theWorld); int energyStored = tick * EnergyGenerating() - EnergyConsuming(); return energyStored; } //done @Override public int EnergyGenerating() { int energyGenerating = EnergyGenerating(); return energyGenerating; } //done @Override public boolean CanGenerateEnergy(int x, int y, int z) { boolean canGenerateEnergy = CanGenerateEnergy(x, y, z); return canGenerateEnergy; } //done @Override public boolean CanConsumeEnergy() { boolean canConsumeEnergy = CanConsumeEnergy(); return canConsumeEnergy; } //done @Override public boolean canAcceptEnergy() { boolean canacceptEnergy = canAcceptEnergy(); return canacceptEnergy; } //done @Override public boolean canConnectToAc() { boolean canconnectToAc = canConnectToAc(); canconnectToAc = true; return canconnectToAc; } //done @Override public int EnergyIn(IBlockAccess access, int x, int y, int z, World world) { int energyIn = EnergyIn(access, x, y, z, world); energyIn = EnergyDraw(access, x, y, z, world); return energyIn; } //done @Override public int EnergyOut(IBlockAccess access, int x, int y, int z, World world) { int energyOut = EnergyOut(access, x, y, z, world); energyOut = EnergyPush(access, x, energyOut, z, world); return energyOut; } //done @Override public int EnergyDraw(IBlockAccess access, int x, int y, int z, World world) { int energyDraw = EnergyDraw(access, x, y, z, world); return energyDraw; } //done @Override public int EnergyPush(IBlockAccess access, int x, int y, int z, World world) { int energyPush = EnergyPush(access, x, y, z, world); return energyPush; } //done @Override public int NeighborDraw(IBlockAccess access, int x, int y, int z, World world) { int neighborDraw = NeighborDraw(access, x, y, z, world); return neighborDraw; } //done @Override public int NeighborPush(IBlockAccess access, int x, int y, int z, World world) { int neighborPush = NeighborPush(access, x, y, z, world); return neighborPush; } //done @Override public int EnergyConsuming() { int energyConsuming = EnergyConsuming(); return energyConsuming; } @Override public boolean IsPowered(IBlockAccess access, int x, int y, int z, World world) { if(NeighborPush(access, x, y, z, world) >=1 ){ return true; } return false; } } BlockRedstoneConverter.java package neg2013.acsension.infrastructure; import neg2013.acsension.Acsension; import neg2013.acsension.interfaces.IAc; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockRedstoneConverter extends BlockAC implements ITileEntityProvider{ public BlockRedstoneConverter(Material material) { super(material); } @Override public int MaxEnergyStored() { // TODO Auto-generated method stub return 2; } @Override public boolean CanGenerateEnergy(int x, int y, int z) { // TODO Auto-generated method stub return false; } @Override public boolean CanConsumeEnergy() { // TODO Auto-generated method stub return true; } @Override public boolean canAcceptEnergy() { // TODO Auto-generated method stub return true; } //done @Override public boolean canConnectToAc() { return true; } //done @Override public int EnergyOut(IBlockAccess access, int x, int y, int z, World world) { return 0; } //done @Override public int EnergyDraw(IBlockAccess access, int x, int y, int z, World world) { return 1; } //done @Override public int EnergyPush(IBlockAccess access, int x, int y, int z, World world) { return 0; } public int EnergyIn (IBlockAccess access, int x, int y, int z, World world) { return super.EnergyIn(access, x, y, z, world); } @Override public int EnergyConsuming() { return 1; } @Override public int EnergyStored(IBlockAccess access, int x, int y, int z, World world) { int energyStored = EnergyStored( access, x, y, z, world); return super.EnergyStored( access, x, y, z, world); } @Override public boolean IsPowered(IBlockAccess access, int x, int y, int z, World world) { if(IsPowered(access, x, y, z, world)){ this.setLightLevel(15f); } return super.IsPowered(access, x, y, z, world); } @Override public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) { return true; } public boolean canProvidePower() { return true; } @Override public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { // TODO Auto-generated method stub return null; } } BlockCreativeArray.java package neg2013.acsension.infrastructure; import neg2013.acsension.interfaces.IAc; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockCreativeArray extends Block implements IAc , ITileEntityProvider{ public BlockCreativeArray(Material material) { super(material); } @Override public int MaxEnergyStored() { return 1000000000; } @Override public int EnergyStored(IBlockAccess access, int x, int y, int z, World world) { return 1000000000; } @Override public int EnergyGenerating() { // TODO Auto-generated method stub return 1000000000; } @Override public int EnergyConsuming() { // TODO Auto-generated method stub return 0; } @Override public boolean CanGenerateEnergy(int x, int y, int z) { // TODO Auto-generated method stub return true; } @Override public boolean CanConsumeEnergy() { // TODO Auto-generated method stub return false; } @Override public boolean canAcceptEnergy() { // TODO Auto-generated method stub return false; } @Override public boolean canConnectToAc() { // TODO Auto-generated method stub return true; } @Override public int EnergyIn(IBlockAccess access, int x, int y, int z, World world) { // TODO Auto-generated method stub return 1000000000; } @Override public int EnergyOut(IBlockAccess access, int x, int y, int z, World world) { // TODO Auto-generated method stub return 1000000000; } @Override public int EnergyDraw(IBlockAccess access, int x, int y, int z, World world) { // TODO Auto-generated method stub return 0; } @Override public int EnergyPush(IBlockAccess access, int x, int y, int z, World world) { // TODO Auto-generated method stub return 1000000000; } @Override public int NeighborDraw(IBlockAccess access, int x, int y, int z, World world) { // TODO Auto-generated method stub return 0; } @Override public int NeighborPush(IBlockAccess access, int x, int y, int z, World world) { // TODO Auto-generated method stub return 0; } @Override public boolean IsPowered(IBlockAccess access, int x, int y, int z, World world) { // TODO Auto-generated method stub return false; } @Override public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { // TODO Auto-generated method stub return null; } }
April 24, 20169 yr Author frankly I wrote every one of those jack-shit method and ive notice that they nothing (that's the problem) thatnks for the help (sarcasm)
April 25, 20169 yr Oh my god, so much wrong with this thread... If you want TileEntities you have to actually create TileEntities. And the TEs should be the ones implementing all of this power API interfaces, not the block. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.