Starter Tools

Started by FreddyFoxGam3r on

Topic category: Help with modding (Java Edition)

Last seen on 15:45, 10. Apr 2024
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Starter Tools

I want to know how to make it so when you first begin your world you start off with a starter bag. I ammaking a od andwhen you make a world, it give you tools. I know a few ways but they would be easily exploited.

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
public static void…
Sun, 06/07/2020 - 17:23
    public static void PlayerJoinedWorld(EntityJoinWorldEvent event)
    {
        PlayerEntity player = (PlayerEntity) event.getEntity();
        LazyOptional<IPlayerHandler> playerc = player.getCapability(PlayerProvider.CAPABILITY_PLAYER, null);
        IPlayerHandler player_cap = playerc.orElse(new PlayerCapability());

        if (!player_cap.joinWorld())	{

            player_cap.setjoinWorld(true);
            player.addItemStackToInventory(new ItemStack(ItemInit.KUNAI.get()));

            Biome biome = player.getEntityWorld().getBiome(player.getPosition());
            String biomename = biome.getDisplayName().getString();
            player.sendMessage(new StringTextComponent("You were left at this " + biomename + " as a baby."));
        }
    }

The above is a snippet from my own mod, that being said I was using capabilities. 

 

I simplified the above to below;

    public static void PlayerJoinedWorld(EntityJoinWorldEvent event)
    {

        if (!player.joinWorld())	{

            player.setjoinWorld(true);
            player.addItemStackToInventory(new ItemStack(ItemInit.KUNAI.get()));
        }
    }

The variable "player" must retain over game sessions, and preferably worlds (capabilities does both). With that being said, I think @ShockingArtist has great procedures for you to have a look at.

Last seen on 15:45, 10. Apr 2024
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok. Thank you.
Mon, 06/08/2020 - 06:33

Ok. Thank you.

Last seen on 03:10, 19. Feb 2022
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you could just use…
Mon, 06/08/2020 - 06:35

you could just use procedures and nbt tags...

Last seen on 15:45, 10. Apr 2024
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok. That will help in LOAB…
Mon, 06/08/2020 - 06:36

Ok. That will help in LOAB. I didn't know how to do it so I just made crates generate with random items.