Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Rohzek

Forge Modder
  • Posts

    81
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Rohzek

  1. So I can get the world time into the NBT on creation with getWorldTime()... Then later get the world time again and say if the new world time is x amount larger than the original... then decay.. That would work for overall decay but what if I wanted to expand/delay the amount of time it takes to decay if it's in a particular container.. or is that just beyond what I can do with Minecraft?
  2. I don't know if this is easily possible, but... Is there anyway to check an item's lifespan while it's in a container, and or get the container it's in assuming the container is in a loaded chunk? The idea would be to make food items that go stale and moldy over a period of time.. and not "age" while in a safe container (like a custom chest... fridge) or in a container with another item (such as ice). Basically: I know I can get the age based on amount of time it spends in a player's inventory and save it to the item's NBT, but is there something similar for general time or time spent in container?
  3. To be honest I probably don't want to remove the Firework recipes.. Too many combos to play with just trying to make it harder.. But it's interesting to know how, thanks. As for the dyes, I made a stupid mistake I wasn't actually USING that method, I was iterating through an itemstack of the dyes and checking each metadata value directly against the itemstack. And similar with the blocks with a for loop and checking each for a recipe which was just fizzling. Just passing the item itself totally works as intended. [03:03:17] [Client thread/INFO] [ANCTECH]: Removed 28 recipes for dyePowder [03:03:17] [Client thread/INFO] [ANCTECH]: Removed 16 recipes for tile.clayHardenedStained.name Thanks again for that too. No telling how long I would have wasted not figuring out that.
  4. Ironically just a few weeks ago now I answered a similar question with the extent of my knowledge on it... However I seem to have a few holes in my method. In a quest to toughen up vanilla recipes I'm using the following method to find and remove crafting recipes so that I can replace them: which works fine for 99.99% of recipes... However it doesn't seem to remove Fireworks, Dyes, or Stained Clay blocks. These seem to just.. not be there. Checking the specific Recipes classes don't seem to help much. Dyes seem to be added to A crafting manager normally... but not the list in CraftingManager I guess... Fireworks don't.. I don't even know where the recipe for stained clay is? Not sure how to find and remove these.
  5. I see. I was wondering how wood handled it's rotation... that makes sense. Thanks
  6. Okay, I'm.. stumped.. I'm making a set of logs to go a long with the vanilla logs which are basically the vanilla logs without bark.. So I've tried extending BlockLog and BlockNewLog.. both of which work the same way.. and overridden the methods and passed in my custom textures and such.. and am being held back by a problem. Oak, Spruce, Birch, and Jungle logs work perfectly but Acacia and Dark Oak aren't working correctly. They're named correctly but the textures are loading from my Oak and Spruce textures, not my acacia and dark oak ones. Going through and printing whats loading in my ItemBlockWithMetadata class and in the registerBlockIcons method both print out the correct things... it's just not working. Do I really have to split logs into two classes like the vanilla code has done? Or am I missing something basic?
  7. You'll want to pull the next ItemStack the remover is looking at out of the recipe list to check, and then check to see if it matches the item you want to remove. ItemStack itemstack = remover.next().getRecipeOutput(); if(itemstack != null && itemstack.getItem() == Items.whatever this item is) { remover.remove(); } You could then expand with more else ifs in the list checking for more items or alternatively you could check for blocks with Item.getItemFromBlock(Blocks.the block to remove). Personally I have it more modularized with: public static void removeCraftingRecipe(Item item) { List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList(); Iterator<IRecipe> remover = recipes.iterator(); while(remover.hasNext()) { ItemStack itemstack = remover.next().getRecipeOutput(); if(itemstack != null && itemstack.getItem() == item) { remover.remove(); } } } So I can just call it per item I want to remove instead of expanding the if statements to include new items
  8. Fair enough mate. I can't actually help you on the config part of things because I haven't played with it, hopefully someone else will come along for that. However if you want to straight up remove recipes you could get an instance of the recipe list from the CraftingManager class and iterate through removing the items you don't want from the list.. Something like this: public static void removeRecipe() { List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList(); Iterator<IRecipe> remover = recipes.iterator(); while(remover.hasNext()) { ItemStack itemStack = remover.next().getRecipeOutput(); // check for items and remove them } }
  9. I don't recommend you disable items completely since another mod may require an item for it's recipe and you would in effect, ruin that mod. But you could do something similar to what IguanaTweaks (or is it base Tinkers Construct?) and make the vanilla tools useless by removing their ability to mine blocks. I'm not entirely sure how it's implemented but you could perhaps subscribe to the ItemCraftedEvent which fires right before an item is created and remove it's damage if it's a vanilla tool.
  10. That is absolutely right. With the loss of item IDs (and the fact that the Item.class docs mention placing blocks with the item) it went invisible and it slipped my mind but.. Thing's like wool and dye are the same item with different textures based on metadata aren't they? That would work beautifully for not only my current issue but any further items with a similar idea. Thank you so much
  11. Apologies for a double post, but I'm not sure anyone would have checked if I just edited the last one, but I wonder.. assuming I found a way to keep the mode change out of the class and only passed it between functions in the ItemStack NBT... Is there any way I could use the number from the ItemStack NBT to change the texture drawn on a specific ItemStack? While damage states would solve my problem this time... I'm thinking if I had something like a pick that I wanted to change texture on right click and didn't have the damage states available.. How would that be done?
  12. This.... is true. And infact the way the class is currently set up it... it just changes all guns in the world at the same time... I... think I have to base the mode off damage states to make it work anyway... Yeah.. Thanks for pointing me in the right direction.
  13. That's what I thought. Shame there isn't anywhere else. So I've gotten something working by doing exactly what I mentioned in my first post: passing the NBT Compound to the ItemStack and checking for it in onUpdate which seems to start running well before visuals load in so it effectively does exactly what I need (setting textures on load). I can't help but feel though tying this into the onUpdate function seems a little much checking the boolean for loading every frame for the rest of time you hold the item... But I don't guess it would slow anything down. Is there a major downside to this? If this isn't a horrible atrocity I'll toss in a null check to make sure it doesn't try to load before there's data there and call it done? If this is seriously bad I guess I'll have to try to set it to damage states which I imagine get saved with the item.
  14. Hello. I am trying to come up with a way to have an item that supports mode changing. While the mode changing itself is fine, I want a way to save what mode it was in the last time the player used it. I tried sticking it in an NBTTagCompound which.. there doesn't seem to be a way to save in the standard Item based class so it only saves until Minecraft is restarted. I see some kind of saving method by passing that compound into itemStack.TagCompound(); but am unsure how to use that exactly. Outside of specific functions I don't seem to have access to the ItemStack... Would storing it there and pulling it out on load with the onUpdate function work? I assume all overridden functions get the same ItemStack passed into it? Or is there a better way of doing this or somewhere else to store my NBT Compound? (I original thought of trying to store this value in damage values?) My class as it is now: http://pastebin.com/jdbjFiwF
  15. I will try to pretend that didn't come off as quite rude... Yes I know what static does/is, it was the first thing we learned in the first class in uni. Something slightly more useful would be helpful.. Like "There is only one instance of that class in the game, not one per person" That might actually explain something.
  16. Everytime a change happens to the mana amount it runs the sync() function, which has the packet send if it's on a server. https://github.com/Rohzek/SpiralPowerMod/blob/master/main/java/com/Rohzek/player/SPExtendedPlayerStats.java
  17. I... Feel so stupid right now. I thought about it for a minute after posting and realized "Shouldn't that be somewhere else too?" I checked in the client proxy and found this: somehow commented out. Uncommenting it makes it work... sorta... EDIT: Not working as intended exactly... NOW the packet gets sent but only one random player on the server gets their mana drawn from... It's not working individually...
  18. That it does.. but I don't understand why? Packets seem to be quite a bit above me. The two lines it refers to of mine in the error is 111 and 119.. 119 is a definition of AbstractClientPacket which seems to be sending to client from server as I understand the comments on the tutorial I got it from... 111 is a call to process() which needs a side specified... which it gets from MessageContext... I'm not sure how it gets that... The message itself is sent with sendTo which is sent from server to client right? I'm not sure where things got flipped.
  19. ! I completely forgot about the FML log! It definitely has the problem in it.. but I don't quite understand it... it seems I've messed up the packet somehow, it seems to be of type PlayClient and is trying to cast to PlayServer. Error in log:
  20. Ah, I see what you meant after checking the link you posted. Is there any real difference for doing in the main file versus in it's own class? I've been trying to keep the main file as clean as possible. There is an internal server but isn't the difference between EntityPlayer and EntityPlayerMP still there? Or am I perhaps checking the fall itself incorrectly? As of right now if I don't check to see if it's an instance of EntityPlayer I get errors with bats... I may be going about checking the fall damage wrong?
  21. No crash report is being generated as neither the server, or the client actually crash. It's only booting me from the server back to the server selection screen.. to which I can click connect again and do it all over again. Packet Pipeline is a bad name. It actually houses a simple network wrapper instance, I'm not using Netty. Perhaps PacketDispatcher or something would have been a more appropriate name. By server side only, should I only be checking for isRemote / just handling singleplayer and multiplayer separately then? Yes, it's being called in the PreInitializationEvent in the Main class file.
  22. Sure thing. The link in the first post is the custom packet itself. Here's everything else that could be relevant? If anything else would help, I can post that too.
  23. So after several days of being stumped, It's time to ask I guess: I'm not quite sure how to handle packets. I have a Gui Overlay that draws from data in my custom IExtendedEntityProperties, and never updates when connected to a server. I gathered from googling that the server and client has it's own instance of that or something, so I need to send packets to update the client's. I followed the tutorial I found here on the forums to setup SimpleNetworkWrapper, and made a message to send the NBT data (http://pastebin.com/sMMePZ7P) but now... I don't know where to send it from? I tried putting it in the extended player stats class and running it when values change using: Which just.. sorta crashes. It prints out the number of mana remaining, and prints that it's sending the packet... and then disconnects. The server doesn't close, and the client doesn't close but it kicks you from the server with a fatal error.. no more information just "A fatal error has occured, connection is terminated", the server just says player disconnected.. so I don't really know where to go from here or how to fix it.
  24. Okay. So I implemented IExtendedEntityProperties, and changed the spawn code to check if the entity calling the event already had the item with a boolean. If it doesn't it runs the random chance spawn coding, if it does it does nothing. Tested through the IDE... built a version and tested in both single player and on my server. I don't have anyone else to pop in and test if it for multiple players but it works fine for me on every save/ server generation I tested. Has the downside of resetting that value every time the player dies.. and thus failing the check and spawning another item I need to find a way to make it persist.. but this has solved my initial problem, once again thank you so much mate.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.