Jump to content

DestinySpork

Members
  • Posts

    66
  • Joined

  • Last visited

Everything posted by DestinySpork

  1. Yes I need the values in the GUI, to draw the fuel status thingy
  2. So I have a TileEntity which I have based off the furnace tile entity. However, the updateEntity() is only called on the server, and so when I call getBurnTimeRemainingScaled() on the Client it always returns 0. How can I fix this, as running updateEntity() on the Client is weird and glitchy, and the numbers do not correspond to the Server. @Override public void updateEntity(){ if(!this.worldObj.isRemote){ //this only runs on the server, the client does not get these variables. if(!this.isBurning){ ItemStack stack = this.getStackInSlot(0); if(this.isItemFuel(stack)){ this.fuelBurnTime = getItemBurnTime(stack); this.generatorBurnTime = 0; this.decrStackSize(0, 1); this.markDirty(); this.setBurning(); } } if(this.isBurning){ this.generatorBurnTime += 4; if(this.generatorBurnTime > this.fuelBurnTime){ this.generatorBurnTime = 0; this.fuelBurnTime = 0; this.isBurning = false; } if(this.isBurning){} //this.receieveEnergy(null, 8, false); //side, amount, simulate } } } public int getBurnTimeRemainingScaled(int i){ if(this.fuelBurnTime != 0){ System.out.println("progress: "+ this.generatorBurnTime * i / this.fuelBurnTime); return this.generatorBurnTime * i / this.fuelBurnTime; } System.out.println("returned 0"); return 0; } I know the Furnace tileentity has @SideOnly annotations, I left them out because I didn't know if they were the issue. getBurnTimeRemainingScaled() is called from GuiGenerator on the Client side, and cannot access the server side information.
  3. Ok, but what do I put above this to make it actually get called? It's not @SubscribeEvent as that crashes public class Login { public void PlayerLoggedInEvent(EntityPlayer player){ player.addChatComponentMessage(new ChatComponentText("You joined")); } }
  4. So, I have a mod that sets player attributes stored in NBT blah, blah blah. Currently the NBT is updated every tick, but this seems like an incredible waste of resources. So, I want to just load it when the player logs in. I have registered an onClientConnection event, but it fires before the player is created. How do I change this? In the code below it wall always print to console, which I don't want it to do. public class Login { @SubscribeEvent public void onClientConnection(ClientConnectedToServerEvent event) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; if(player != null) player.addChatComponentMessage(new ChatComponentText("Hello!")); else System.out.println("The player hasn't been created yet."); } }
  5. Isn't the point of an API so you don't have to update it? So that you update the api and not the mod using the api
  6. I want to add powered items/blocks to my mod and I want to use RF from Cofh. How do I implement the api? I know how to do it for a jar file, but the api comes as a zip file with stuff in. I'm using Eclipse if that helps. The api is here: https://github.com/CoFH/RedstoneFlux-API
  7. Thank you very much. It needed to be in lower case.
  8. registering GuiHandler: NetworkRegistry.INSTANCE.registerGuiHandler(this, new SporksGuiHandler()); in my main class in the FMLPreInitializationEvent I register my SporksStuff instance like this: @Instance("SporksStuff") public static SporksStuff instance = new SporksStuff(); //I tried just public static SporksStuff instance; - didn't work And I run openGui like so: player.openGui(SporksStuff.instance, SporksGuiHandler.FEEDER_GUI_ID, world, x, y, z); Is this right? If not where did I go wrong?
  9. So I have been trying to get a GUI to work for ages, but it won't. The game launches and runs fine, but it crashes when I try to open it it crashes. Using Forge 1.7.10 Crash log: http://pastebin.com/0Vq0zhZP Container: http://pastebin.com/1f02amVJ GuiHandler http://pastebin.com/ypX4t0We TileEntity http://pastebin.com/BHVN0yUT Gui(2) http://pastebin.com/EBrKgdfq I have been following _BedrockMiner_'s tutorials for this.
×
×
  • Create New...

Important Information

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