Jump to content

Anonomys

Members
  • Posts

    150
  • Joined

  • Last visited

Posts 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. 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

  3. 3 minutes ago, warjort said:

    I don't know. I can't think of a single mod that does anything like that.

    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.

     

    3 minutes ago, warjort said:

    Having said that, you could try listening on ScreenEvent.Render.Pre

    Okay, thank you, I'll try.

  4. 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.

  5. 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.