Jump to content

drceph

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by drceph

  1. Hey guys, I'm new to modding with forge and I have a duping bug that I want to try and get an understanding of why it happens and how these sort of things are combatted. Below is a code fragment from the updateEntity() method of my TileEntity sub-class: if (this.inventory[0] != null && this.inventory[0].getItem().equals(Item.coal)) { if (timer == 0) { --this.inventory[0].stackSize; if (this.inventory[0].stackSize == 0) { this.inventory[0] = null; onInventoryChanged(); } timer = 5; } else { timer--; } This tile entity is attached to a BlockContainer with a single inventory slot. When coal is in the slot it will decrease the coal stack by one every 5 ticks (this is fuel for an IC crossover mod, and coal is a placeholder). What I find is that if I click the stack of coal as it is decreasing it will (often) pick up the stack but a phantom stack will stay in the container slot and continue to decrease. If I put my picked up stack in my inventory and try to pick up the phantom stack, it disappears. My theory is that this is due to the lazy syncing between the server and client (in 1.4.2 so even SSP is client/server, if I understand it correctly). I'm guessing that on a particular tick that if I take the stack that it stops decreasing it on client side, but for some reason the server side has decreased it. This creates a discrepancy between the two and the server-side state overrides the client-side state. I see the solution being a situation where some sort of syncing message is sent to the server telling it that the stack is going to be modified and to trust the client-state. I'm sure there is a solution that exists and I hear terms such as Proxies and Packets being thrown around and while I'm sure they are components of the solution, I'm not sure exactly how to approach it. I know I have some CommonProxy and ClientProxy classes set up for the GUI aspects, but these I took from a tutorial and don't yet grok them 100%. Any insights, tips and assistance that improve my understanding would be greatly appreciated - even if it is simply a pointer towards to correct classes and/or documentation. Cheers, C. EDIT: The onInventoryChanged() call in there was my feeble attempt at hoping there was some sort of built-in method for notification/synchronisation - please let me know if I'm wrong
  2. Hey there, I'm just getting into making my first mod using Forge. I have everything set up as per the various tutorials and have been able to make my own recipes, basic blocks, etc. The project I am actually working on however involved the IndustrialCraft and BuildCraft mods and their associated APIs. I was following the (method 2) instructions at http://www.minecraftforge.net/wiki/How_to_install_Forge_%26_an_external_API for the buildcraft API that I got from the Buildcraft Github site as well as the IC2 API that is available on the IC2 wiki. Running updatemd5 I get an errror about net.minecraftforge.liquids not existing. Looking at a very very recent github commit on forge it seems that the liquid system from BC3 is being moved over to the forge API. This is awesome, but perhaps I've come in to do this mod at terrible timing - the latest recommended forge API I downloaded doesn't know about it. To make it stickier the mod will involved fuel and oil, which easily fall under the BC liquid category! I guess I am after a suggestion. Would it be wiser for me to: a) Get a slightly older version of the BC3 API that will work with my current version of forge with the assumption that "nothing could possibly go wrong" and the change will be invisible to me? b) or should I assume that the interfaces are going to change in the BC3 and/or Forge APIs, and get the latest master build from the Forge repo to work with my cutting edge BC3 API. c) Is there another suggestion or avenue I've not thought about? Cheers, C.
×
×
  • Create New...

Important Information

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