Jump to content

olrustyeye

Members
  • Posts

    26
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by olrustyeye

  1. Perfect. Sounds like an ideal situation for me. I went to college and took HTML + CSS but mostly focused on Java and C++. I never quite got a niche anywhere with it and that wasn't my focus as far as degreewise. I now work for a technology company and I really really want to get much better at coding in general. Beyond arrays loops and methods. I think this is a good place to start for sure!
  2. Lol, I don't think you guys get what I'm saying. I'm literally just wanting to do this as an exercise to help me understand the more advanced features of java. Nothing more. In the process I simply was stating that it would be nice to have a reference guide similar to google does for their scripts. While i'm already going through the code I might as well do that. My question was is it actually going to teach me anything?
  3. I think you misunderstand. By dissect I mean go through the code and pull out the methods and how they work. Obviously anyone can see the code. I don't mean editting anything. Much like you'd diagram a sentence I want to do the same to the minecraft code.
  4. I modded minecraft back in 1.3 and 1.5. Fun fact I actually owned the One Stop Mod Shop way way long ago haha. Things have changed, but the syntax on the basic stuff like blocks are the same. Find what version the book is using and switch to that go through it and then all you'll need to do is update your syntax!
  5. I wish there was more documentation. Sadly it's severly lacking. Not for forge's lack of trying but things change so much and few people actually want to go through the code and find things. That being said there is some pretty useful stuff here. https://mcforge.readthedocs.io/en/latest/ Nothing like what you're looking for but it's a good resource for what is there.
  6. Welcome! A few important things. 1) It's best if you use the code quotations tool in the forum or use Pastebin to show us the code. 2) It's super helpful if you let us know what version you are running. It also does not work with me and the reason is there isn't a ChatComponentText in the Util's as far as I can see. Probably it was moved to a different name/function. My guess is that you'll need to find updated code for this particular portion. I see a "ChatAllowedCharacters" but thats it for chat under the Util's hierarchy. Sorry. Thats the best I can do for you :(. Hopefully someone smarter has a better idea!
  7. Hmm. I have ADHD and I hyperfocus, so unfortunately there is no stopping me. It's only prolonging the inevitable. My solution I think is to slam my head against my desk until I go into a coma. Then I wont have to deal with this... haha. No but seriously. I was afraid of that. Looks like a lot of hacking, which means I'll put it off for a while until I understand the biome/temperature/entire game mechanics a bit better. Also I never considered the impact a mod like this would have on the Nether and The End. Although it doesn't rain there or anything I edit in the overworld will be edited there and could cause issues later on. Why do I like coding again? Why can't I be into gardening or something?
  8. One thing I want to add in my mod is seasons. I remember a while back a seasons mod which actually had seperate season where you woke up out of bed and BAM it was winter. What I want to do is have a ease of transition and unpredictable. What I want to know is how hard is this going to be. I would say my java experience is about a 3/10. I've taken a few classes and made a text game, but I'm not experienced enough to really hard code something like a forge API. My initial thoughts on this project is to look at the temperature code already in the Biomes and begin there to run something every day which rerolls the temperature as it were. and depending on the biome it would fluctuate in a 28 day cycle of 4. The idea would be as it gets colder rain would become snow. Getting more advanced I'd like to turn the biome color brown in fall-spring then green in the spring-fall. So again my question is: Is this WAY above my head and should I spend more time coding other things for now while I learn? Or is this something that's pretty easy to code? I'd rather not post 100 topics on the modder support asking how to do this or that. Nor would I like to waste my time on a mod that I'm not ready to write. Thanks for the help!
  9. I'm very interested in dissecting the minecraft code for myself. I really want to learn more Java coding, and I figured going through the code and pulling out the methods and commenting how it works would be a great way to do this. I was just wondering about if this would be useful to others/the modding community? The obvious answer is yes of course, but I also don't know if someone has already done this, or if going through he code is even worth my time? I was wondering what people thought? Am I crazy and probably going to lose interest? Or is this something thats worth the effort?
  10. I'm currently working on a bit of code to access the drops for Granite, Diorite and Andesite. I little secret: I'm trying to make a geology type mod where theres a chance of dropping certain things while digging in the mines. Anyways. Here's my code right now. https://pastebin.com/GEV33S4j Here's what I've done for tests Created a new itemstack accessing the Granite by the metadata. It works applies to ALL stone rather then just granite. I've tried using the name Granite. Doesn't work either. I can't use idea because I believe (And I may be wrong) that the reason for meta data is many blocks under ONE id. I feel like the answer may be pretty simple. So I'm hoping someone can tell me I'm a noob and to use minecraftmagic.dowhatIwant(Granite);
  11. Holy crap... this is powerful stuff! It's funny how I'm not thinking in Java terms sometimes. I think I remember back in my college days (Now 4 years ago JEEZ) using lists. I totally forgot how easy they are. Thank you!!!! This is solved! For those wondering reading this in the future here is the key: if (event.getState().getBlock() == Blocks.BLOCK_YOU_WANT_TO_EDIT) { event.getDrops().add(new ItemStack(YourModItemOrBlock.Item_Or_Block, Number_Of_It)); //This adds the item or block you want to // You want to add to the block. ListIterator<ItemStack> drops = event.getDrops().listIterator(); //This Gets the drop and puts it into a list of ItemStacks while(drops.hasNext()) // Using a while loop so we don't get out of the bounds of the list { ItemStack element = drops.next(); //gets the next itemstack in the list if(element.getItem() == Block/Item.BLOCK_OR_ITEM_YOU_WANT_TO_EDIT) // Does the list Item also match the item you want gone? { drops.remove(); //remove it! } } } Now that is some pretty beautiful code. Thanks for the help everyone I learned a TON from this little exercise!
  12. Yes!!! I got it to work. I don't love the fact I'm casting "element" into an itemstack I feel like that can be refined. But I have another issue I encountered. This code does NOT work with redstone. It's only removing one of the redstone. It's interesting because it should be checking it over and over until it deletes all of them right? Everything else works like a charm! if (event.getState().getBlock() == Blocks.LIT_REDSTONE_ORE){ Utils.getLogger().info("IronBlock Accessed. This method is Working"); event.getDrops().add(new ItemStack(Blocks.DIAMOND_BLOCK, 1)); ListIterator drops = event.getDrops().listIterator(); while(drops.hasNext()){ Object element = drops.next(); Utils.getLogger().info(element); if(((ItemStack) element).getItem() == Items.REDSTONE){ event.getDrops().remove(element); Utils.getLogger().info("WE DID IT!"); } } } if (event.getState().getBlock() == Blocks.REDSTONE_ORE){ Utils.getLogger().info("IronBlock Accessed. This method is Working"); event.getDrops().add(new ItemStack(Blocks.DIAMOND_BLOCK, 1)); ListIterator drops = event.getDrops().listIterator(); while(drops.hasNext()){ Object element = drops.next(); Utils.getLogger().info(element); if(((ItemStack) element).getItem() == Items.REDSTONE){ event.getDrops().remove(element); Utils.getLogger().info("WE DID IT!"); } } } hehe well this isn't the ONLY issue actually. I"m also having an issue of trying to access the metadata of for dyes for lapis ore. I think I might be able to figure that one out, but if not I might be back.
  13. if (event.getState().getBlock() == Blocks.IRON_ORE){ Utils.getLogger().info("IronBlock Accessed. This method is Working"); event.getDrops().add(new ItemStack(Blocks.DIAMOND_BLOCK, 1)); ListIterator drops = event.getDrops().listIterator(); while(drops.hasNext()){ Object element = drops.next(); if(element == Item.getItemFromBlock(Blocks.IRON_ORE)){ event.getDrops().remove(element); Utils.getLogger().info("WE DID IT!"); } } } So I got the whileloop going now, my issue is I think I'm deleting the element rather then a block in the element. I'm not sure how to tell it to remove what I want it to at this point. Actually theres a problem with the If statement because it's not returning me...oh I think I might know what the issue might be. Element is an itemstack not an item... Still before I go test that. It's not returning true so theres an issue there.
  14. Yup, I was just thinking that. It's a band-aid not a solution. The iterator sounds much more reliable.
  15. I fixed it by changing the <= to < WOOHOO! Maybe I'm not a total noob haha. It works I get my diamond block and NOT my gold ore. You guys are seriously a freaking amazing community though.
  16. Ooooooooooooo if (event.getState().getBlock() == Blocks.GOLD_ORE){ Utils.getLogger().info("IronBlock Accessed. This method is Working"); event.getDrops().add(new ItemStack(Blocks.DIAMOND_BLOCK, 1)); for(int i=0; i<= event.getDrops().size(); i++){ if(event.getDrops().get(i).getItem() == Item.getItemFromBlock(Blocks.GOLD_ORE)){ event.getDrops().remove(i); Utils.getLogger().info("Was Gold Ore Removed?"); } } I'm still getting a error. I'm not sure what I am doing wrong now... The only thing I can think of is an issue in the for loop. Because removing the i means that the number that was 2 becomes 1 it has an issue when it goes to check for 2 and it's no longer there... So I did remove "Blocks.GOLD_ORE" and I still get an error. Seriously, thank you so much for helping me. It's no often a community helps a noob with out being a jerk to him. You guys are awesome, this must be cake walk for a lot of you! If it's any consolation I am learning a TON! One huge key here is that it says, IndexOutofBoundsException. I think it's removing the item and then checking for it again.
  17. @SubscribeEvent public void overrideBlocksDrops(HarvestDropsEvent event){ if (event.getState().getBlock() == Blocks.GOLD_ORE){ Utils.getLogger().info("IronBlock Accessed. This method is Working"); event.getDrops().add(new ItemStack(Blocks.DIAMOND_BLOCK, 1)); for(int i=0; i<= event.getDrops().size(); i++){ if(event.getDrops().get(i) == new ItemStack(Blocks.GOLD_ORE)){ event.getDrops().remove(i); Utils.getLogger().info("Was Gold Ore Removed?"); } } } I'm getting somewhere! Right now I got an error and I have some idea of why. I think there is a parsing error perhaps, or again I'm trying to create something new where something already exsists. Here my issue. Get is looking for an itemstack, so I'm trying to parse blocks into an item stack, but in order to do that I need new. Item.getblockfromitem wouldn't work because that makes it an item not a itemstack. I'm not sure where to go from here... This is my error but I feel that the problem is probably obvious to those more experienced. https://pastebin.com/Bd6KKTKK
  18. Hmm.. So I'm having an issue now where I can't REMOVE the block, but I can add. event.getDrops().remove(new ItemStack(Blocks.GOLD_ORE)); I think what I'm needing here is an addition check to check if the block dropped would be gold ore right? I'm just not sure where to go. I've told it to remove that drop but it wont. Looking at the other methods I'm not sure how to use remove if this isn't how one uses it?
  19. I've got one issue right now, This is my code: @Mod.EventBusSubscriber public class OverrideBlocksEvents{ @SubscribeEvent public static void overrideBlocksDrops(HarvestDropsEvent e){ if(!e.getWorld().isRemote) { if(e.getWorld().getBlockState(e.getPos()).getBlock() instanceof BlockOre) { e.getDrops().add(new ItemStack(Items.DIAMOND)); } } } I admittedly found this code from someone else, but from what I've read and understood. This should work. I'm checking what the block state is, and in the instance of a Ore Block it should add a diamond to the drops... right? Edit: I just used a code I personally had made and it now works because I hadn't initialized it before... jeez goes to show you someone else's code isn't always better. here it is for those wondering: @SubscribeEvent public void overrideBlocksDrops(HarvestDropsEvent event){ if (event.getState().getBlock() == Blocks.IRON_ORE){ Utils.getLogger().info("IronBlock Accessed. This method is Working"); event.getDrops().add(new ItemStack(Blocks.DIAMOND_BLOCK, 1)); } } Just as a sidenote I'd still like to know why the other code doesn't work?
  20. Ooooo I like that! I'll have to check it out and utilize it! Side note: I tested somethings further and just broke my IronOre. Buggy is an understatement. I'm thinking it has something to do with Cache/memory. I'm going to try a restart and see if that clears things up a bit. That being said I'll probably use the events for a cleaner code.
  21. To me it looks like there something it doesn't like about the model. I'm a bit confused as to how I can use events to achieve that effect. I don't know much about how to use events to be honest. Thanks for taking a look!
  22. I wanted to change the way the in game minerals work as far as how they drop. IE: I want gold_ore to drop a piece of gold ore rather then the whole block. I also want to add a slight chance of getting a gem like Diamond. Heres whats super bizzaroworld. Iron works, Diamond works, but Coal and Gold don't. I haven't tried redstone yet because that has issues of its own. Also interesting it's crashing at the initialization portion of the game. Anyone know whats wrong? Here my current code https://pastebin.com/W7tTNY8C And the error: https://pastebin.com/net807Nd As soon as I comment out substitute(Blocks.GOLD_ORE, new ModBlockOre2("oreGold")); everything magically works. (I've also tried commenting out everything BUT gold ore and it still doesn't work.)
  23. I have been trying to remove the ore generation from minecraft so I can minipulate the ores themselves. IE: let there be a small change of Iron dropping topaz or something. Any chance you could clue me in on how you turned off ore generation?
×
×
  • Create New...

Important Information

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