Jump to content

T.S.White

Members
  • Posts

    16
  • Joined

  • Last visited

Everything posted by T.S.White

  1. Cool. I have no idea why it works then.
  2. huh. I was messing with it and changed it to @SubscribeEvent(priority=EventPriority.HIGHEST) which completely fixed the problem... Probably Wrong: I'm guessing that the priority treats Minecraft Itself as it would a Mod, so if it fires at HIGHEST priority Minecraft fires somewhere after and does something that updates the blocks on the server. Thanks for all your help, btw. Every time you answer a question I seem to learn about something I hadn't even considered.
  3. Gotcha. Let's make it easier then and not do the crazy side-switcheroo dance. I can also (probably) fix it by using a different way to check if the entity is moving (which also means I can get other entities to do this! yay!), but I need to get my priorities straight. Because all the other ways I came up with to figure out if something is moving got changed in methods that got called before mine. That's why I was so excited to hear that you could make them execute first... /ramble So, I have a LivingUpdateEvent, and I need to attach the thing that says "go first". Which is START vs END? Is it also the same as this? And how does that fit into the code?
  4. I think I'm getting this better now. Since I'm calling the "doSomething" code inside of a ClientEvent, it has Nothing to do with the server. So I'm going to have to run the If on the client side and return a boolean, which I can then use on the server side to setBlockState. I think. Does that make any kind of sense? (I really wish I knew Java better. Most of my experience is with Agent Based Modeling, and everything in Java, and minecraft, seems SOOO backwards and top-down compared to the way I would do it with agents.)
  5. True, but it's not super critical to have All entities do this. Priority is to get the player working. I was laughing just before you posted because of this. Already fixed with abs. Oooh. That was interesting. This doesn't solve the problem if I use PlayerEvent, but it does fix it if I use LivingUpdateEvent. Which tells us several things: 1. It is indeed a client vs. server issue, and 2. PlayerEvent = Client Side, LivingUpdateEvent = Server Side, and Player-Specific Motion (the motionXYZ is player specific) = Client Side. Aaaaand that means I need to figure out how to tell the server that the client changed the block and it should do the same. I set up client and common proxies. And the ClientProxy extends the CommonProxy, and something goes in one or both of those. Right? I'm pretty sure that's the bit that's missing. (I understand the Client/Server/Common concepts pretty well. It's using them that's the issue.)
  6. EDIT: nm. I know what that is. XP Since it is apparently not my first guess and I am already (apparently) updating the world, I have to ask about the theory that seemed fundamentally wrong: BlockStates are ALL the block info, right? So I'm updating the actual block and all its state info. It couldn't be tripping over something about updating the State and not the Block, right? Thanks for the tip about PlayerUpdateEvent. That makes way more sense since it's currently just the player doing this thing. And the !world.isRemote check too. Phases when the UpdateEvent gets called? Like, you can make the ForgeEvent go before or after the original minecraft code that forge is hijacking? If I'm understanding right, that could be incredibly useful.
  7. So I wrote a mod to make paths as you walk. (It's already up here.) It does what it's supposed to, which is amazing. Except that when you quit, all your paths are gone when you start the world again. I'm guessing I have to tell the program to commit the changes to the world somewhere... and I'm a n00b so I have no idea where/how to do that. Something about client/common classes and stuff probably...... Anyone have a good tutorial that explains how and why? Current Code:
  8. YAY! Thank you so much! I totally get it now. I had some other mistakes to fix, but for those interested here's some working(ish) code that makes grass turn to dirt when you walk on it:
  9. How/Where do I use these? (It seems like all of my questions when learning new languages are about where I put things... I feel like a little kid playing with one of those put-the-shape-in-the-cutout toys... at least I'm having fun? ) Thanks for helping! current, relevant, probably bad code:
  10. Thanks! Looking at the Type Hierarchy was really good advice. I'm still new to Java and didn't even know that existed. And no, it doesn't look like onEntityWalk or anything similar is pre-packaged and ready to go. If I knew the language better I think I see a way I could copy and extend the Forge Hooks to use onEntityWalk, and that would probably be lighter and more elegant since it already gets called whenever you move... For now though, it looks like I'll be using the ham-fisted approach of LivingUpdateEvent, check if it's the player (wish it was all the entities but that's a lot for this approach), and then check what the block under their feet is. So, next question, how do I get from a BlockPos to knowing if that block is dirt? From (really old) tutorials, it seems like I need to go through IBlockStates? Or something? Still reading tutorials (including the one you wrote for 1.8) and documentation, but if there's a quicker or more up to date answer I'd be super happy. Thanks again! -T
  11. SOLVED For anyone else who has questions like these, here's my working code: Hey guys, I'm back at this trying to figure it all out. Aaaand I'm sure the info I want is posted. somewhere. out there. on the wide interwebz. But I can't find it. I need an event that's triggered when an entity walks, with different effects for different types of vanilla blocks. ie. Redstone Ore lights up when you walk on it via onEntityWalk. Forge doesn't seem to have a hook for this, or any event that gets called from the blocks themselves, which I guess is understandable given the entity/tile/don't call things from blocks issues. So I guess I need a custom event - either one that utilizes the pretty simple, already-there onEntityWalk, or one that checks if an entity has moved, and then checks what block it's standing on. And I cannot, for the life of me, find a current tutorial on how to do that. There are allusions to it, but any solid information I've found is from many versions ago and no longer accurate. Links? Help? Please? Thanks! -T PS. If I just missed the Forge Event for this, please point it out to me and feel free to call me an idiot.
  12. You don't need to add any mods at all if you don't want to. You can also run different games with different versions, different sets of mods, anything you like. Whether you're running one mod, ten mods or zero mods, it's an easy way. I'm glad you got it all running. Maybe this will still be helpful when you update, or if it corrupts again.
  13. If you're only trying to install and run mods, I'd highly recommend the Twitch App. This is what I use when I actually want to PLAY minecraft, not break it. "Create Custom Profile" is the button to click if all the mods you want aren't already a modpack. When you install mods from the provided ones, it handles all the forge installation, dependencies, etc., and you can always add mods that Twitch/Curse doesn't offer to the mods folder that Twitch creates (on mac it's in Documents/Curse/Minecraft/Instances...).
  14. I'm a n00b, and these might be really stupid suggestions. Tell me so, please, because I'd like to learn why these wouldn't work. (Also, Java is not my native programming language, so forgive my logo-ish pseudo-code.) 1.a. You wouldn't have to check every inventory at every tick. You only need to check when you open that inventory. You'd need to keep track of what tick the inventory was last opened at and subtract it from the current tick to figure out how likely the food inside is to be rotten. You could also choose whether or not to run the more specific "is it rotten?" check at all, based on how long it's been. 1.b. Even more specifically (and may be overkill/over complication), you don't have to add an inventory to the list of "needs food-rot-checking" if you don't put any food in a particular chest. When you add food to a chest, add the chest to the list; when you open a chest, check it against that list. When you close the chest, check if it should still be on that list (which should return false if there is no fresh food). 2. Each food item doesn't need to keep track of its own ticks. Just give it a probability to run for each tick (or bunch of ticks) since the last time it was checked. ie: set (days_variable) ((time since last check) / 24000) if days_variable >= 1 ( repeat * (days_variable) ( if random 100 < 33 (set food_freshness (rotten)) )) 3. Whittling down the things you need to check even more, you only need to check if food has gone rotten if its last known state was fresh. You probably don't need to go so far as making this it's own sub-list, but maybe you do. (Thanks, Schrodinger.)
  15. Hey guys, I'm new and this might be a dumb question. Can I read the code for other people's mods? How? Where? I'm just starting, and I think it would be helpful to open up and look at how other people did things, rather than re-inventing the wheel, and it would also be helpful in making sure whatever mod(s) I create are going to play well with other mods. My intent is not to copy and paste someone else's code and call it my own. If the mods I want existed, I probably wouldn't be getting into all this. I just want to know the hows, wheres, and whys of what other people have done. Thanks in advance! -T.S.White P.S. If there's an answer to this somewhere already, my apologies. I'd be very grateful if you'd point me to it.
×
×
  • Create New...

Important Information

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