Jump to content

Anonomys

Members
  • Posts

    150
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Personal Text
    I'm minecraft modder and im trying to make mods for people to have fun! But sometimes i don't know some things so i try to find them on forums! Thanks!

Recent Profile Visitors

17192 profile views

Anonomys's Achievements

Creeper Killer

Creeper Killer (4/8)

2

Reputation

  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.
×
×
  • Create New...

Important Information

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