Starter Tools

Started by FreddyFoxGam3r on

Topic category: Help with Minecraft modding (Java Edition)

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.

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.

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.