Skip to content

Instantly share code, notes, and snippets.

@TheXFactor117
Created July 7, 2017 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheXFactor117/0061b53bb05b1fd3c37e8382585210ae to your computer and use it in GitHub Desktop.
Save TheXFactor117/0061b53bb05b1fd3c37e8382585210ae to your computer and use it in GitHub Desktop.
@SubscribeEvent
public void onPlayerTick(PlayerTickEvent event)
{
if (!event.player.getEntityWorld().isRemote)
{
if (event.phase == Phase.START)
{
for (ItemStack stack : event.player.inventory.mainInventory)
{
if (stack != null && stack.getItem() instanceof ItemSword)
{
NBTTagCompound nbt = NBTHelper.loadStackNBT(stack);
if (nbt != null && !nbt.hasKey("Level"));
{
ItemGenerator.createWeapon(stack, event.player);
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment