CraftTweaker

CraftTweaker

151M Downloads

How to give a player an item on death

Th3OneAndOnly opened this issue ยท 2 comments

commented

Issue Description: My script is not working.

Note: If this bug occurs in a modpack, please report this to the modpack author. Otherwise, delete this line and add your description here. If you are using an unnofficial version of Minetweaker or Crafttweaker please report it to the person who gave you the version. Also please look at the other issues to make sure that you are not creating a duplicate.

What happens: I get an error in chat.

What you expected to happen: To get an item upon death in singleplayer.

Script used (Please Pastebin or gist your script, posting an unpasted or ungist'd script will automatically close this issue): https://pastebin.com/UpnJHWXN

crafttweaker.log file (Please Pastebin or gist your file, posting an unpasted or ungist'd file will automatically close this issue):

https://pastebin.com/UmqKeyb1


Affected Versions (Do not use "latest"):

  • Minecraft: 1.12.2
  • Forge: 14.23.5.2838
  • Crafttweaker: 1.12-4.1.19
  • Using a server: no

Thanks!

commented

Firstly, it is

event.player

Secondly that will only work if the player is an OP

We have a method in IPlayer for giving them an item

player.give(item);

So use that instead

commented

Thanks that was the quickest response ever!