Jump to content

Anonomys

Members
  • Posts

    150
  • Joined

  • Last visited

Everything posted by Anonomys

  1. Hello, I'm having trouble keeping player nbt data after death, this is my code currently: @SubscribeEvent public static void onPlayerCloned(PlayerEvent.Clone event) { if(event.isWasDeath()) { System.out.println("Player died"); System.out.println("Cloning wallet 0/2"); System.out.println(event.getOriginal().getDisplayName().getString()); System.out.println(event.getOriginal().getCapability(WalletProvider.WALLET_CAPABILITY).isPresent()); event.getOriginal().getCapability(WalletProvider.WALLET_CAPABILITY).ifPresent(oldStore -> { System.out.println("Cloning wallet 1/2"); event.getPlayer().getCapability(WalletProvider.WALLET_CAPABILITY).ifPresent(newStore -> { System.out.println("Cloning wallet 2/2"); newStore.copyFrom(oldStore); }); }); } } I have a /balance command, and when I give myself some money it displays the correct balance, but for some reason the capability is not present in the playerclone event, the System.out.println(event.getOriginal().getCapability(WalletProvider.WALLET_CAPABILITY).isPresent()); prints "false". I know that the capability is being attached properly and everything, this is my console: Attached wallet to player Player died Cloning wallet 0/2 Dev false Attached wallet to player Please anyone help
  2. I found where the error was, in the blockentity class the getCapability was returning the ATMCapability.INSTANCE instead of the ATMCapabilityImplementation. Sorry for taking your time
  3. Yes but its not being cast to that anywhere, ive looked through everything
  4. Hey, yeah i did that and made a blockentity and now im getting this error class ...atm.capability.ATMCapability cannot be cast to class ...atm.capability.ATMCapabilityInterface
  5. Yes, but I don't understand the AttachCapabilitiesEvent<Entity>, how does that attach it to the atm block, I tried subscribing and all of that, changing code i dont know what to do, can you please explain it?
  6. Hey I did all that, tbh i've been struggling the last hour trying to make the thing, I did everything but now I'm trying to add the capability to the block and then set it when it is placed down, this is the code: @NotNull @Override public <T> LazyOptional<T> getCapability(@NotNull Capability<T> cap, @Nullable Direction side) { return LazyOptional.of(ATMCapability::new).cast(); } @Override public void onPlace(BlockState state, Level world, BlockPos pos, BlockState blockState, boolean p_60570_) { world.getCapability(ATMCapability.INSTANCE).ifPresent((cap) -> { cap.setPrivateKey("test"); cap.setAtmId("test"); }); System.out.println("ATM created!"); System.out.println("Private key: " + world.getCapability(ATMCapability.INSTANCE).orElseThrow(NullPointerException::new).getPrivateKey()); System.out.println("ATM ID: " + world.getCapability(ATMCapability.INSTANCE).orElseThrow(NullPointerException::new).getAtmId()); } I have no idea if this is even correct, but i dont know what else to do, it keeps giving me the nullpointerexception which means that its not being saved
  7. Hello, I'm trying to store data in the block's nbt data, but i have no idea how to do this, apparently im supposed to use capabilities but there's so little documentation, and I have no idea how to do this, can someone please provide me some example code?
  8. Hey, so i fixed it somehow, I don't know what I did, I'm just glad i fixed it.
  9. Hello, I was just trying to make a custom (2 block height) model for my mod, and everything was fine and then i go into minecraft and just see this weird gradient appearing on sides/faces. Here's an image to show you what I'm talking about:
  10. Here's what I was talking about, this now shows at the start if you use cracked minecraft. The exit button just takes you to the main menu, if you don't want to login. But you will not be able to use the stuff the mod needs the api for. And this shows if the API is down.
  11. I know physics mod, the pro version asks you to enter your key when you launch the game. My mod just requires you to make a separate password for the mod if you are using cracked minecraft (the mod has separate accounts for cracked and premium users, premium users do not need to enter their password), so that people can't just access your stuff by using your username. I am not in any way doing it to make money. Okay, thank you, I'll try.
  12. Anyone? it doesn't have to be an input, but at least a warning (text that says something, and then a button to proceed to minecraft)
  13. Hey, I want to ask the user to input their key on game launch, I just don't know how to show the screen on start. Can someone help?
  14. That's fine, I guess I'll use the dimension event then.
  15. Thanks for that! But I also need to subscribe to the event when the player joins the server, what is the event called and how do I subscribe to it?
  16. Hello, sorry for bumping this but I still haven't found a way to do this.
  17. I need the IP so I can store per server player data and also access some external APIs.
  18. I'd like to get the server address of the server the player joined/is connected to, and to also check if the player is playing singleplayer if no server address is found. How would I do this?
  19. Forgot about that, heh. Thanks.
  20. Hey, so, I am trying to create a chest using my code from the 1.15 tutorial by TurtyWurty I've followed everything, but the problem is it gives me this error when i right click on the block: Failed to create screen for menu type: imod:bluestone_chest I have a github repo for my mod, here it is. Also dont mind the chest texture if you are looking at it, i will change it, as soon as i get this fixed.
  21. Okay doesnt matter, i just changed the mappings channel from the official to the latest snapshot (20210309-1.16.5). It works now how its supposed to.
  22. Hey, so I was taking a break from minecraft modding and then today i decided to go back and do some modding again. I saw that my latest version of my mod was 1.16.3, so i decided to update it to 1.16.5. Then I found out that they renamed basically everything, and now im stuck with this problem, the problem is that its not the same code as in the 1.16.3 because the voxel shapes and facing things dont work in this version. So i just deleted them, and now i dont know how to fix this. These blocks have no rotation and no boundary boxes, since i deleted them. I never liked working with them, for me they are annoying. And yeah as i said, the problem is that the custom block model makes the block underneath or beside it transparent. The code is basic, basically just a constructor in a class and some properties in the init class. Any help appreciated!
×
×
  • Create New...

Important Information

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