Jump to content

Daeruin

Members
  • Posts

    424
  • Joined

  • Last visited

Everything posted by Daeruin

  1. In your quote, there is a direct link to the documentation for capabilities. Unfortunately, the documentation is awful (for beginners) and I don't recommend spending much time on it. Look at some of the example mods people have created, like Choonster's TestMod3 or Cadiboo's Example Mod.
  2. The closest thing I have found is this: http://jabelarminecraft.blogspot.com/p/minecraft-forge-1721710-gui-and-input.html
  3. And...? Which part of that do you need help with? Share your code.
  4. I'm glad to hear that! It's not very often that I am able to help other modders, haha.
  5. I'm with you. I have really struggled to make that jump from using tutorials to do basic stuff to combing through code from Minecraft, Forge, and other mods to try and understand their examples and come up with something that's kinda similar but unique. Every inch I've gained has been tough. You implement ICapabilityProvider to "serve up" your inventory (an ItemStackHandler instance) when it's being asked for. You can probably copy my BasketInventoryProvider almost exactly, except replacing the ItemStackHandlerBasket with Forge's built-in ItemStackHandler. As you can see in my notes on that class, I ended up having to implement ICapabilitySerializable in order to get my inventory to persist in various situations. ICapabilitySerializable is an extension of ICapabilityProvider that, in addition to providing the inventory when asked for, also writes and reads the inventory itself into your ItemStack's NBT. At that point you just return an instance of your ICapabilityProvider (or ICapabilitySerializable) from your Item's initCapabilities method, and you're off to the races. It doesn't have to be registered with Forge in any special way beyond simply returning it from initCapabilities (I think initCapabilities is a method that was injected into the Item class by Forge for the very purpose of attaching capabilities to items—initCapabilities is called from the ItemStack constructor when your item is being instantiated in an inventory). If you want to have a GUI on your item, there's more to it. For that you need the GUI itself plus a GuiProvider. There are examples of those in my mod, as well. I used my item's onItemRightClick method to call up the GUI.
  6. Ah, I missed that you wanted it to be an item. I did this last year sometime but don't remember it well enough to explain in detail. But maybe my source code will help you as an example. The link I just gave is for a custom ItemBlock I made. You could probably do something very similar in your custom item class. As Cadiboo mentioned, you override initCapabilities in your Item class and return an instance of ICapabilityProvider. I made a custom implementation of this but Forge may have something built in. In the ICapabilityProvider implementation, you would use hasCapability and getCapability to check for and return an instance of IItemHandler (of which Forge does have a basic built-in version). Not sure I'm explaining it correctly, but maybe that will help you get started.
  7. You could also check out Shadowfacts tutorials. They are a few years old now, but the basic ideas are the same.
  8. Have you looked at how Animania does it? Looks like they just check the time every tick during the crow's onLivingUpdate method.
  9. It's not a big strain. It's a very basic math operation.
  10. You need to explain what you are trying to achieve. Do you want the value to follow the player from world to world? When do you want the value go up and down? Is this a characteristic of the player, or the world?
  11. For learning Java, I used Codecademy, but there are literally hundreds of places you can go to learn, not least of which is Oracle's docs.
  12. Most of the best resources are listed on Cadiboo's page. Some more resources: MinecraftByExample Shadowfacts Tutorials (for 1.10.2 but largely applicable to 1.12.2) Jabelar's Tutorials
  13. If that doesn't work out for you, you might consider making your own EntityFallingBlock. You can swap out the vanilla falling block for yours in the EntityJoinWorld event, I think.
  14. https://wiki.mcjty.eu/modding/index.php?title=Dimensions-1.12 http://jabelarminecraft.blogspot.com/p/minecraft-forge-1721710-biome-quick-tips.html
  15. @MosquitoFRA there are hundreds of resources to help you learn basic Java online. I started with Codecademy. Please run through some basic Java tutorials or courses before you keep trying to make mods. You are setting yourself up for constant frustration and failure until you learn more Java.
  16. Search is your friend. I ran into this same roadblock a while back.
  17. You can also use println statements to see what is going on during runtime. Just print out the list of entities to the console to check whether your axe is in the list. Perhaps not as fancy as using the debugger, but it often gets the job done. You should still take the time to learn how to use the debugger. There are times when it's super helpful, particularly when you need to see the details of what vanilla code is doing. You can make mods perfectly fine without knowing what Java 8 streams are or how to use them. You do, however, need to know Java basics well. I've heard this a few times, but never with any reason given. What's so horrific about using static initializers?
  18. You might want to comment out all blocks except this one for a while, to make it easier to hone in on the errors.
  19. The method is likely being called once on the server and once on the client. Add a println statement and check if world.isRemote is true or false. True means it's the client, false means it's the server. My guess is you probably need it to run on both sides, so there's no problem.
  20. Please mark your topic as solved. FYI, there is a tutorial here on the forums, as well as in the Forge documentation, that would have told you how to import your project into IntelliJ.
  21. For those looking this up later, I did end up making an IRecipe implementation. It's working well.
  22. You could probably do something to prevent a specific slot from taking items whenever the toggle is on. You'd have to implement EntityItemPickupEvent to prevent items from going from the ground into that slot. It would be trickier to prevent the player from manually putting anything in that slot, or from shift-clicking things into it. That might take a PlayerTickEvent that continually checks for changes to the slot and reverses them.
  23. Thanks, everyone, for all the advice. Registering axes to the OreDictionary does not work, because then only undamaged axes will work in the recipes. Damaged axes don't work even when using the wildcard value. I guess it's because it doesn't make much sense to specify a data value for an ore dictionary ingredient, when the ore dictionary entry could be any arbitrary list of items. Sweet, now I know that compound ingredients and constants are a thing, and have figured out how to use them. It works great. However, now that it's finally working, it made me realize that I hadn't thought the implementation all the way through. I want the axe to stay in the crafting grid and the log to be transformed into a stripped log (I made custom stripped logs before they were a thing in 1.13). I think I read somewhere that this would require an IRecipe implementation that overrides getRemainingItems.
  24. I have heard over and over not to register recipes in code but instead to use json. I still tried it but can't seem to get it to work (and there are apparently no examples out there). Pretty sure I could have brute forced it about 10 times over by now. Haha.
  25. Huh. Unless you feel like showing me how it will be drastically faster or easier than creating several dozen recipe files, I don't think I'll bother. It won't take that long to create the recipes. It's just annoying to copy/paste the axe type so many times. I'm aware of the ore dictionary. As I said, I don't need the logs to be variable. The type of log determines the type of output, so it wouldn't make sense to make the log variable--how would you know what output to give? (But even if I did need the logs to be variable, ore dictionary has not been working for my mod's logs, I think because they are "flat"--not using metadata for the type of wood. Anyway, I did a minor necro on an old post with that question, which nobody commented on.)
×
×
  • Create New...

Important Information

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