-
Why is the capability not present on playerclone event if it is present before the player dies?
Thank you so much!
-
Why is the capability not present on playerclone event if it is present before the player dies?
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
-
How do I store a string in the block's nbt data?
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
-
How do I store a string in the block's nbt data?
Yes but its not being cast to that anywhere, ive looked through everything
-
How do I store a string in the block's nbt data?
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
-
How do I store a string in the block's nbt data?
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?
-
How do I store a string in the block's nbt data?
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
-
How do I store a string in the block's nbt data?
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?
-
[FIXED] Custom block model has weird gradient on it's faces
Hey, so i fixed it somehow, I don't know what I did, I'm just glad i fixed it.
-
[FIXED] Custom block model has weird gradient on it's faces
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:
-
How do I show an input screen on game load?
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.
-
How do I show an input screen on game load?
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.
-
How do I show an input screen on game load?
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)
-
How do I show an input screen on game load?
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?
-
[1.18.2] How to get the server address of the server the player is connected to?
That's fine, I guess I'll use the dimension event then.
IPS spam blocked by CleanTalk.