Jump to content

jabelar

Members
  • Posts

    3266
  • Joined

  • Last visited

  • Days Won

    39

Everything posted by jabelar

  1. Yes, that code looks correct if you want to add basicEssence to every table and add scryingOrb only to the simple dungeon chest. Well, to figure that sort of thing out you should look at the source code. I did and found that it is a multiplier on the luck that is used to adjust the "weight" of the loot entry. You can see for yourself if you look at the implementation of the getEffectiveWeight() method in the LootEntry class.
  2. I don't think entity models have changed much since forever, so 1.8 or whatever should mostly still work. Anyway, tutorials should be more about teaching you the idea not about copying and pasting code. How complicated of a model are you making and what kind of animation is required?
  3. I'm not familiar that mod's source code. But it depends on how the value of that method is used. This ring is supposed to provide regeneration, right? So you can just replicate the effect by making a tick event handler and checking if the player is wearing the ring and then regenerate. It also gives some immunity effects, right? Then maybe you can figure out which events could be handled to create a similar effect. Basically, just look at wherever the method is called and then see if there is an event which could be used to provide an equivalent effect. You might not be able to get it exactly like the original, but you could probably get pretty close.
  4. The event is going to be called for each separate loot table. The event doesn't fire just once, it fires for every single JSON. So you don't need to "get all". You just need to add your loot to the table that is currently being handled and that will automatically get them all.
  5. Describe the picture a bit more. So this is the inside of a train or bus? Is the windows part of an entity or a structure? In your picture I can't tell if something is disappearing, but instead it looks like the opposite -- some of the animals should be hidden by the floor and the frame of the windows but are rendering on top of it.
  6. Cool, yeah I got it to work. I was able to tint an area under the players that gets updated as they move around. I found the most trustworthy way was to replace a block in place (basically set to air and back again). The other set block and set notify all had not as good behavior -- some complained about concurrent modification, some updated but not entirely smoothly/consistently.
  7. Okay, that makes sense and is consistent with what I'm seeing. But what triggers a chunk re-render? Playing around I see that placing a block will trigger it (makes sense), but I also see occasional changes triggered by other things. Maybe it is blocks that random tick? Or some other lighting updates? Also it seems (again makes sense) that it recolors every time you load the saved world since the colors are not persistent across saves. I guess I'm mainly looking for a solid way to force the update. I could do something like replacing a block, but wondering if there is a more direct way. Looking at the call hierarchy there is a rebuildChunk() in the ChunkRenderer. It is a bit hard to fully trace after that because it then has a Runnable for a render thread (I guess). It is also called though by RenderGlobal.updateChunks() as well as RenderGlobal.setupTerrrain() which are both called by EntityRenderer.renderWorld(). There is a check for RenderChunk.needsImmediateUpdate() so I'll see if I can force that probably with forcing a notify block update.
  8. I'm playing around with block tinting and have it working well -- and to test it I had a custom terrain block which I could randomly color. (It's actually pretty trippy). However, with a random color being returned by my getColorMultiplier() override I'm wondering how often it is called -- since I have random value returned, will it get called again (like maybe when loading a chunk, or when checking for neighbor block state changes or something). What's weird is the call hierarchy for getColorMultiplier() shows it is called by the BlockModelRenderer in several places like render quads methods. But the colors are staying steady so it is obviously only being called once rather than recalculated every render refresh. So when is the tint actually being set (reset)? And conversely if I wanted it to be recalculated what would I call?
  9. Oh, actually I guess your getDefaultInstance() is a static method? In that case it would work.
  10. I don't think it would work that way. Isn't getAll() returning a Set? How would the getName() of the event (which returns a ResourceLocation) ever equal a set of loot entries? If you want to check against all, you will have to iterate (loop) through the set and check the resource location of each entry against the resource location for the event. However I'm not sure that you need to do that either because I think the event is called for every loot table. So I think you would just go ahead and add your loot without any checking for equal.
  11. It depends on exactly what you mean by disappears. Do you mean a portion disappears (i.e. a blending issue), or the whole thing doesn't get rendered (a culling issue)? in other words do you think the entity behind is still trying to render but just isn't visible, or is not rendering because it believes it is behind something and doesn't need to be rendered?
  12. You assigned your field to null and then immediately try to run a method on it. That can't work since null means it basically doesn't exist as an object and so you'll get code crash with a NullPointerException.
  13. Yeah so you need to trace it. Check if it is null. If it is null work backwards and look at the getEntityByID() method call and check what ID is being passed? If the ID is not valid then work backwards and find out what is inside the packet passed in. If that doesn't have the right thing work backwards and look at where the packet is constructed. Just keep going backwards and it will become clear where the problem is starting.
  14. Actually the sort method looks suspicious generally. It is sorting an array of KeyBinding which are cast to Object and I don't think KeyBinding class has a comparator interface to help the sorting. So I don't think the sort would be meaningful in terms of the keybinding unless the default Object sort is based on toString() and even then seems a bit sketchy. Basically when the loop starts you need to see whether the two entries with the same category are right after each other. If not then the loop will probably fail. Or just monitor the s and s1 values during the loop. There is definitely potential for something wrong there I think.
  15. Then you should trace through the constructor of the GuiKeyBindingList because it has a loop where it checks whether each category is unique before adding a category entry to listEntries. Now that I look at it though, I think it is actually a bug. Because the way the loop works is that it has a "previous category" field called s and "current category" field called s1 and checks if they are equal. Basically it is checking if the category of the entry in this iteration of the loop is the same as the previous. However, that requires the categories to be sorted. There is a sort on the list, but I think maybe it is wrong because I think it is sorting the actual key bindings not necessarily just the categories. Check if that is the problem. So I think it might be a bug. You might be able to work around it by naming your keybinds so that the ones in the same category sort together, or something else that makes sure that the categories are processed consecutively. Alternatively, you can override the whole gui by copying the class and fixing the bug and then handling the gui open event to put up your gui instead.
  16. Okay but did you trace the execution for that error message. If you search the Java source you'd see that the "Received passengers for unknown entity" message is displayed in the NetHandlerPlayClient#handleSetPassengers() method whenever the getEntityByID() for the packet returns null. So you need to trace that. What is in that packet, what is the entity ID in the packet, and is it a valid ID according to the existing entities.
  17. Okay, if I look at the KeyBinding.KEYBIND_SET (which contains the categories) it turns out there is an add(category) called on that every time a key binding is constructed. Now technically a Java Set should not allow duplicates. The category is a string, but the Java set properly uses the equals() method for comparison according to the "contract" of the method definition. So basically the category set will get the add() called every time, but it should not actually create any duplicates. When tracing you should look at the contents of the KEYBIND_SET to see if there is actually an (apparent) duplicate added.
  18. Well, when it is lagging there is something happening that is taking the computer's processing time. There are really three common categories of lag that modders can create: 1) cascading as discussed 2) inefficient loops. Like if you're searching an area for something over and over again. 3) improper use of wait loops or other code that halts continued execution of the thread. Are you making custom trees? What is your full code for generation? Anyway, you just need to observe what is taking the time. You can do this by either setting breakpoints and using debug mode in Eclipse to figure out what is executing or you can add judicious console or logger print statements to trace the execution. By looking at the timestamps you can figure out what is taking the time and narrow it down. Like if you put a print statement at the beginning and end of your methods you can see how long each is taking, or maybe see that they are being called much more times than you expect.
  19. Also, just use standard debug techniques. Set a breakpoint and step through the code execution. It should become immediately clear when/why the index is going out of bounds.
  20. The "problem" (reason you're making people irritated) is that you seem to know enough about modding and Java to attempt to do fairly complex stuff but you don't seem to have proper terminology or the the debugging skills that usually come along with that level of programming. But don't worry. I think you really just need to develop your debugging skills to help yourself. The most important thing for debugging is "tracing" the execution to see if the execution follows your expectation. There are common ways to do this -- (1) you can use the breakpoints and debugging mode in Eclipse (or whatever IDE you're using) to step through your code execution, (2) you can add console or logger print statements at all the critical points in your code. I use debugger for things that happen occasionally and use print statements for things that happen continuously (like you don't want to use breakpoints for rendering problems usually). In your case you're working with spawning so breakpoints are probably great. One you start stepping through the code it almost always becomes immediately clear what is going wrong. Like maybe you'll find that something isn't being called, or an if statement isn't working as expected, or the NBT isn't being tagged properly, and so on. In other words, when you're doing something advanced it is expected you have the advanced skills to crawl through the problem yourself. Once you have very targeted observation on what is going wrong, if for some reason you still can't figure it out, come back and post a very clear explanation of what you're observing and then people will be able to provide help.
  21. You might be causing "cascading" during generation. This is where during the generation of a chunk you place a block (or call a function such as looking at neighbor blocks) that causes adjacent chunks to have to load and generate. Learn more about it here:
  22. I don't really think the GamePreIntializationEvent is an extention of FMLPreInitializationEvent because the source for GamePreIntializationEvent shows that it extends GameEvent which extends Event (and this Event class is a Sponge-specific one). I'm guessing that somehow this event is posted before the proxy annotation is processed, because otherwise the value of proxy should have been properly injected. Or do you get any warning in your console log like a class not found related to the proxy?
  23. How did you build your mod jar?
  24. Yes, basically your suspicion about run-time class loading is correct. The Minecraft class is not loaded on the server side, but your PackeOpenGUI class is loaded on both sides. What you need to do is use your proxy. You create a method called something like openGui() in your proxy but in the server proxy class you have it do nothing and in the client proxy class you have it call the Minecraft.getMinecraft.displayGuiScreen(). Basically you need to collect all your code that is affected by sided loading into the proxy.
  25. Why are you accessing the fields in your class in such a weird way with your getFields() method? Why aren't you just registering your fields directly? You wrote more lines of code to loop through than you actually had key bindings... I'm not sure if your weird way of registering the fields is causing the issue, but I would try making that more simple first. After that, if there is still an issue, you'll notice that the error occurs where the listEntries array is going out of bounds. The size of that array is set based on the number of keybindings in the GameSettings plus the number of categories in KeyBinding together. So it may be an issue with the fact that you're creating new keybinding categories. I have done keybinding before but frankly I always used existing categories, but maybe there is some trick or maybe even bug. I would trace through the execution in debug mode in Eclipse by setting a breakpoint in that loop and watching how the index is advancing.
×
×
  • Create New...

Important Information

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