Jump to content

Cerandior

Members
  • Posts

    385
  • Joined

  • Last visited

Everything posted by Cerandior

  1. I would assume it is not so different from any other java/gradle project. In the mods.toml add your main "library" mod as a dependency in your other two mods. Then simply import the library mod package into your two other mods and use whatever you want from it. Because the library mod is listed as a dependency in both your other mods, then you can be sure the user will have the library mod installed as well, because if they don't, Forge will notify them before the game is initialized.
  2. Okay then, will try to move everything over to 1.16 Is there any comprehensive post that lists all the major changes? Or some sort of official documentation about the 1.16 version. I will probably be met with a list of errors when I open the same project on the new version so It would be nice to have a general idea on where to start.
  3. I am going to give this one bump and if there's no solution, I will try to upgrade to the latest version.
  4. I have a somewhat old project lying around and I was planning on working a bit with it again. I opened the build.gradle file with intelliJ however I ran into some issues. For starters, compileJava failed with the following log: https://gist.github.com/arjolpanci/b5a09e9a7165670a5efd880fb0fa8e1d It's just throwing a bunch of FileAlreadyExistsException. Perhaps the related files are already on the project folder (Don't know why it even executes this step if that were the case). The other problem is that intelliJ cannot find the forge version at the url specified under "repositories" on the build.gradle file: https://gist.github.com/arjolpanci/6a1c4f01795578124635960503f57f9e Are these errors fixable, or am I forced to upgrade to one of the more recent versions? Thank you in advance.
  5. I think clouds are disabled on "Fast" Graphics settings. Maybe you can pull something out of that.
  6. If you want to apply it to a model, just set the UV coordinates of each part of your model to point to the same texture coordinates.
  7. Wait, so the mod you are trying to update was made for Minecraft 1.5? That is so ancient that there is no chance in hell that you can update the existing code for the current version. Not faster than rewriting the whole thing anyways. As Alpvax and Draco have already suggested, you will be far better off re-doing the whole thing yourself. Being a mod from 1.5 it shouldn't be very difficult (depending on the content of course) to recreate its functionality for 1.14-15 considering the tool-set Forge offers now is more extensive than it was back then.
  8. Before you give us a look to your code, I am guessing that you might have forgotten to add the IProperty to the state container of the block via fillStateContainer
  9. Oof, yeah it seems I forgot to change that for the entity. For the packets I switched to using for loops. It's kind of the same thing happening in the packet too, so I am just copying it from there. Thank you for everything.
  10. Yes, I was working with that right now after I posted this. Just said that I am keeping the packet for the button for the reason I mentioned. Is everything else fine now?
  11. Okay, I re-did the whole thing again. It's the same stuff I was doing before but everything it's on the slots and the container now. Also I kept the packets for the buttons, because if I don't do that the player would have to update the contents of the gold slot when he changes to another trade to get the new trade item. I want it to check for the input when the trade is changed as well so the new Item can be displayed immediately. Container Slot Screen Entity Thank you for your help and your patience.
  12. So do I just pass in the container and the player to the Slot and do the checking there?
  13. 1) That is actually quite stupid now that I am looking at it again. I was doing this very late in the night yesterday. The screen was saving the previous selection and when I reopened the GUI I wanted to reset. And since I was working with packets for a while, the first solution that I thought of was sending a packet. Absolute genius. 2) Well, if I don't send a packet to the client, the offerlist of the container is empty for some reason. Or perhaps you are not questioning why I am sending the packet rather why I am sending it to all players. If that is the case, this is the reason: This is the problem. You are right, I am not sure how to handle this interaction. The slots were sending stuff to the server, because I can get the Player who send it by doing that, and from the player I can get the container and so on. I am kind of doing the same thing as before, but now I am checking for stuff in the packet instead of before notifying the server. Which maybe is kind of the same thing since I am still telling the server to update slot contents based on what was changed in the client. I am not sure what I am supposed to do though. The only input I have from the player is two slots and some buttons. The buttons are only used to change the selected trade, so not much to handle there, so all I am left with are the slots. What should I be telling the server except that the player changed the contents of some slot and took some item from another. There is no other information that I can think of that should be sent to the server. So with the onSlotChanged() I notified the server that the contents of the slot were changed, so then I check in the packet if the right container is opened by the sender. If he actually can use that container, and if the new contents of the slot he changed are in range of some specific values. If yes, I put the selected trade item in the other slot so he can take it. Then with the onTake() I check again for the previous conditions and decrease the stack size of the gold based on the price of the item. That's what I had in mind when doing all of this. Which part of that chain is wrong? (Assuming I am not entirely wrong)
  14. When a class/object is a child of another (it extends from it), it also has its fields and methods (only public and protected fields can be accessed directly). If you want to have a different implementation of any of the parent methods, you override them. For example, if you have a base class which describes all GeometricShapes and in it you have a method getArea(). You can override this method in the class triangles and rectangles which extend from GeometricShapes and you can make them return the respective areas.
  15. Okay, once again, thank you for your help. I reworked everything and I would really appreciate it if someone can have another look and tell me if there is still something wrong with the way I am handling things. All my packets can be found here: https://github.com/arjolpanci/VanillaExtended/tree/master/src/main/java/teabx/vanillaextended/network And my packets are used by: My GUI Buttons My Custom Slot My Entity Also, when I am sending packets to the Client, I am sending it to all clients at the moment. That is because I am not familiar with the java Supplier and I am not quite sure what I am supposed to pass as an argument to PacketDistributor.PLAYER.with() since it asks for a Supplier.
  16. As far as I am understanding, I am still going to work with the input of the GUI, but I must send detailed packets to the server for each action of the player to check whether that action is legit or not?
  17. Firstly. Thank you for telling me about the tick method. Didn't know about it. Now about the Slot handling which is actually the most important thing. I was experimenting with stuff to see how could I achieve the trade interaction and when I changed slot contents from the GUI (clientside) a bug which actually turned out to be a desirable effect occurred. Basically because I am adding items to an inventory from the client, the server doesn't know about that item, so when you try to pick it up, you can't. And because I was adding the item from the render() method, that would replace the item every frame if the player tried to take it. So I used that to make a "display" Slot, which never gets updated to the server. Its purpose is only for the player to check out the item he is about to purchase. Then when the player is actually paying enough gold for the item, I send a packet to the server to update that Slot content so the player can take it. It seems like I shouldn't be doing this sort of thing though, so maybe I have to find another way to make that display Slot work the same way. Also, when you say that I should be handling slot modification server side, how exactly am I supposed to do that when I am working with the input of the player within a GUI, which is only run on the client. Thank you for your time.
  18. I am making a villager-type entity who sells the player cool tools in exchange for gold. I got pretty much the whole thing handled right now, however I am doing a lot of the things in the .render() method of the GUI Screen that I feel don't belong there. I didn't know where else to put them so I just stuck with it, but I don't think it's ideal. I am guessing the render() method is called once per frame and that's why it was helpful to check for stuff the player is doing in the GUI, but it probably isn't the best idea to do other stuff besides rendering there. Can anyone help me "relocate" some of the stuff I am doing at the render() method right now? So what am I doing currently that I think doesn't belong there: 1) Handling the visibility of the buttons of the trades based on the number of trades the entity has. 2) Checking which trade the player has selected based on an index which takes a value from a button click and based on that selected trade I change the contents of a slot of the container. 3) Checking whether the player has input the right amount of gold in one of the container slots to display the requested trade item in another slot. 4) Checking when he takes this gold out in order to take the trade item out as well so the player doesn't take stuff for free. 5) Checking if there is no quantity available for a given trade to disable the button responsible for selecting that trade. In case I missed anything you could also look at the Screen class here: https://github.com/arjolpanci/VanillaExtended/blob/master/src/main/java/teabx/vanillaextended/client/gui/WanderingAssassinScreen.java Thank you for your help.
  19. Can't help you will the problem you are having but it's pretty easy to setup git. First download git and install it. Then go to github, create new repository and copy the link you get (you'll need this in a bit) Now go to your project directory, shift right-click and open powershell and execute this command. git init This sets up a local repository at your project directory. Now to link it up with your github repo execute the command: git remote add origin "paste link you got from github" Now everytime you make a change to any of the files in the folder your created your repo (except the ones that are specified in .gitignore) git will keep track of it. You can see which files have been changed by typing: git status In powershell. Since you just created the repo, everything will be unstaged. To add files to the next commit you use the command. git add * This adds every file and typically you want everything to be staged when you want to make a commit, but you can add individual files as well. Then to actually commit the changes execute: git commit -m "Commit message here" Then to push the changes to the remote repo (github) you use: git push origin master And that's all there is to it. Now everytime you add something to your project go and open the powershell and add the files to the staging area, commit them and then push them.
  20. I know you are supposed to make your own threads, but it feels kind of pointless since I am only asking one thing. Because OP didn't specify the version in which he is working with, I am assuming he is working with the latest version. Should I be using ItemStackHandler instead of IInventory too in 1.14 ?
  21. Reading the official forge docs can be quite helpful. It doesn't cover absolutely everything, but it covers most stuff you need and for the most part it's detailed info. As for tutorials, Cadiboo probably has the most in-depth tutorials so I recommend following that. As far as I am aware his github repo has more stuff than what is covered in the website, so check that out too.
  22. I am mostly worried about that warning. It's nog popping up any errors right now, but I want to make sure I got the thing setup correctly.
  23. Alright, so I fixed rendering stuff now although I am still getting that warning in the console (I did remove the static initializer). I tried to send a packet to the client at the render function just to test something, passing in the container.wandererAssassin to the packet. Doing that however, just keeps spamming the console with that warning and the items are not rendered anymore. Also, I don't quite understand the change that I made to get the rendering to work. If you look in the sample that I provided above, I am looping through the container.wandererAssassin.getOfferList() , which should return a list of the offers of that entity. All I did to make it work is to loop through container.getOfferList() instead. I am confused though, because getOfferList() returns an ArrayList (which is called offerList) and that ArrayList is assigned the value of wandererAssassin.getOfferList() in the constructor of the container. And container.wandererAssassin also gets the value of the wandererAsssassin which is the instance of the entity that is sent to the constructor when I request to open the GUI. Aren't the two things that I was doing essentially the same thing? So why wasn't it working before
  24. Apart from seeing at the docs, no. not really. I am going to change that now.
  25. Thank you, the client does have the right information right now, however it seems like I am still unable to render the items in the GUI. Have I done something wrong at the Screen render() : public void render(int p_render_1_, int p_render_2_, float p_render_3_) { this.renderBackground(); super.render(p_render_1_, p_render_2_, p_render_3_); int cnt=0; for(AssassinOffer ao : container.wanderingAssassin.getOfferList()){ ItemStack gold = new ItemStack(Items.GOLD_INGOT); gold.setCount(ao.getPrice()); ItemStack item = ao.getItem(); this.itemRenderer.renderItemAndEffectIntoGUI(gold, guiLeft + 5 + 22, guiTop + 18 + 4 + (cnt*20)); this.itemRenderer.renderItemOverlayIntoGUI(this.font, gold, guiLeft + 5 + 22, guiTop + 18 + 4 + (cnt*20), (String)null); this.itemRenderer.renderItemAndEffectIntoGUI(item, guiLeft + 5 + 66, guiTop + 18 + 4 + (cnt*20)); this.itemRenderer.renderItemOverlayIntoGUI(this.font, item, guiLeft + 5 + 66, guiTop + 18 + 4 + (cnt*20), (String)null); cnt++; } this.renderHoveredToolTip(p_render_1_, p_render_2_); } Also, I am getting this warning in the console :
×
×
  • Create New...

Important Information

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