Jump to content

Novârch

Members
  • Posts

    422
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Novârch

  1. 18 hours ago, Slastic said:

    globally

    Just make either a static list or a HashMap. What's your use case, knowing it will help.

     

    18 hours ago, Slastic said:

    String name

    DO NOT do this, vanilla did this with Ender pearls up to 1.13 and it lead to major exploits, what if a player changes their name?

    Instead use the player's UUID (PlayerEntitygetUniqueId).

     

    Edit: Use a HashMap, just used one for my own mod, here's a link to the class where I use it, in my case I'm storing a PlayerEntity as the key and a DimensionType as the value, then I'm using the values to teleport each player to their corresponding dimension.

  2. 7 hours ago, Umpaz said:

    I'm trying to learn more about coding and to get some bases down I downloaded some mods from curseforge. When I try to load them into eclipse and view anything but assets it gives me the error source not found. Is there some kind of decompile I have to do to view the code?

    First you'll have to use a deobfuscator like BON2, because mods' source code gets obfuscated when building it, then use a decompiler, like FernFlower to convert the class files from the jar to Java files.

  3. 4 minutes ago, 65_7a said:

    I want to make it so when you click on water or a cauldron with a glass bottle, you have a 25% chance of getting an item other than the water bottle. (in my case, a "Salty Water Bottle".) If this is possible, I would like to know how to do this.

    Take a look at PlayerInteractEvent.RightClickBlock.

  4. On 5/20/2020 at 9:23 AM, diesieben07 said:

    You should be able to abuse a fact of the capability system here.

    Subscribe to AttachCapabilitiesEvent<Entity>. If the entity is one you want to track (presumably it's a living entity) then use AttachCapabilitiesEvent#addLIstener. The listener will be called when the entity is completely removed from the world. You'll also have to check if the entity actually died by some logic (this also fires when the entity despawns), so you might want to check it's health.

    This method is probably not perfect, you can do some experimentation.

    Maybe this'll help, thought of it immediately after seeing this.

    • Like 1
  5. 7 hours ago, TBroski said:

    I am just really having issues with this capability system. To get to the point, my capabilities are resetting after unloading and loading the game. I have included images on prints I have set up, but basically I log in the game (variable at 0, because it reset lol) get 5 "points" (seen in image 2). Then I unload the world and log back in (image 3), and the variables are back to 0. Those are my observations. I have seen other posts on forums although they are outdated. I have looked at some other mods source code, however it is hard to find where they use this. But even when/if I find where they serialize the data I am lost between the complexity of all of the methods. All code obtaining to this problem is in the pastebin exept for when I register it in the Main class using;

    
    	private void onCommonSetup(FMLCommonSetupEvent e)
    	{
    		CapabilityManager.INSTANCE.register(IPlayerHandler.class, new PlayerCapability.Storage(), PlayerCapability::new);
    	}

    I don't know what else you need, but will give/do anything to solve this. If I haven't said before, I am thankful for your time in this troubling time. Thanks

    https://imgur.com/a/FwjGLyb

    https://pastebin.com/RXLXdSHd

    First of all, the way you're making keybinds is horriblehere's an example of how I make keybinds in my mod.

    Your problem seems to be that you aren't SYNCING your capability to the CLIENT. Capabilities are stored only on the server by default, check out this example of how I sync capabilities in my mod (you also have to sync on the player logging in, changing dimensiom, leaving the end and respawning). Also, why do you have a public static class in you CapabilityHandler class, it serves no purpose at all, just remove it.

  6. 1 hour ago, QuantumSoul said:

    I pushed to github so you can see the problem:

    https://github.com/BinaryQuantumSoul/BinaryMod

     

    Take bitcoins in your inventory

    Open a Computer, put a Dark Net and click load

    Buy any item

     

    Now drop the just bought item, and take it back, buy another one and mess around,

    You'll see what I mean

    I fixed it, I've made a pull request on GitHub if you're interested. I did exactly as I said you should (made a static transaction list and resolved it in ServerTickEvent). A comprehensive explanation of what you did wrong can be found in the pull request.

    • Thanks 1
  7. 7 minutes ago, QuantumSoul said:

    Well there's a list of items, I click on it and it used bitcoins in the inventory to buy it. It add the item to the inventory as well as the remaining money

    I would personally keep a static list of transactions and resolve the transactions in an event (likeServerTickEvent).

  8. 15 minutes ago, flyingturret208 said:

    So uh... I passed 256 biomes, I'm fairly certain that I pulled it off by a staggering amount whilst making a modpack for some friends and myself. Is there some way to extend this in 1.12.2?

    Please don't necro old threads, make your own. By the way, 1.12 is no longer supported on this forum.

    • Sad 1
  9. 43 minutes ago, BigWordsScareMe said:

    Trying to figure out how to make a portal, that may work

    Please look at NetherPortalBlock, it has everything you want.

     

    Edit: EndPortalBlock is even more concise, take a look it it too.

  10. 2 minutes ago, RaulAlonso said:

    i have no idea how to check if the item is actually an ore

    Check if it's an instance of OreBlock.

    3 minutes ago, RaulAlonso said:

    I want it to be compatible with other modded ore

    Not going to happen, from what I've seen a lot of modders don't extend OreBlock for custom ores.

×
×
  • Create New...

Important Information

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