Posted January 11, 201411 yr So, when I'm trying to add "power" to the overall power, the code just skips the adding part and just does as it pleases. BlockPowerProducer public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer player, int par6, float par7, float par8, float par9) { if(this.ownerNeedSet) { this.playerOwner = player.username; PlayerPower prop = PlayerPower.get(player); prop.addPower(power); this.ownerNeedSet = false; } if(player.username.equals(this.playerOwner)) if(!world.isRemote) { TileEntityPP pp = (TileEntityPP) world.getBlockTileEntity(par2, par3, par4); pp.outputPower(player, world); } player.addChatMessage("Owner is: " + this.playerOwner); return true; } The problem in here is that the owner is set but the "power" is never added. PlayerPower.class implements IExtendedEntityProperties public void addPower(long power) { this.currentPower = this.currentPower + power; } http://www.slothygaming.com/img/ota.png[/img] If your grammar is shit and you blatantly don't know what you're doing, I will not help you.
January 11, 201411 yr Author It's not location specific. This isn't like BC or IC. Different power system. Decentralized. The "power" variable starts at 0 and changes based on structures that need power or produce power. http://www.slothygaming.com/img/ota.png[/img] If your grammar is shit and you blatantly don't know what you're doing, I will not help you.
January 11, 201411 yr Author Extensive testing shows that the code does get called but the power never gets added even though power can be removed and without putting prop.addPower(int) in the if statement in the BlockPowerProducer lets power be generated. The question seems to be is why doesn't the power work when used in the if statement? http://www.slothygaming.com/img/ota.png[/img] If your grammar is shit and you blatantly don't know what you're doing, I will not help you.
January 11, 201411 yr Probably the "power" value is always 0. All the power variables things shouldn't be in a block class.
January 11, 201411 yr this.currentPower = this.currentPower + power; More efficient code: this.currentPower += power; Before you even think about modding, please learn basic Java.
January 11, 201411 yr this.currentPower = this.currentPower + power; More efficient code: this.currentPower += power; Usually the two compile to the same thing. += is faster to type though. 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.