Skip to content

Commit b407da6

Browse files
committed
Update itemstack.yaml
1 parent 09d603c commit b407da6

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/main/resources/forge-1.12.2/variables/itemstack.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ scopes:
3131
read: instance.${var.getName()} = new ItemStack(nbt.getCompoundTag("${var.getName()}"));
3232
write: nbt.setTag("${var.getName()}", instance.${var.getName()}.writeToNBT(new NBTTagCompound()));
3333
get: |
34-
/*@ItemStack*/((${entity}.getCapability(${JavaModName}Variables.PLAYER_VARIABLES_CAPABILITY, null)
35-
.orElse(new ${JavaModName}Variables.PlayerVariables())).${name})
34+
/*@ItemStack*/((Objects.requireNonNullElseGet(${entity}.getCapability(${JavaModName}Variables.PLAYER_VARIABLES_CAPABILITY, null), PlayerVariables::new).${name})
3635
set: |
3736
<#include "mcitems.ftl">
3837
{
@@ -47,8 +46,7 @@ scopes:
4746
read: instance.${var.getName()} = new ItemStack(nbt.getCompoundTag("${var.getName()}"));
4847
write: nbt.setTag("${var.getName()}", instance.${var.getName()}.writeToNBT(new NBTTagCompound()));
4948
get: |
50-
/*@ItemStack*/((${entity}.getCapability(${JavaModName}Variables.PLAYER_VARIABLES_CAPABILITY, null)
51-
.orElse(new ${JavaModName}Variables.PlayerVariables())).${name})
49+
/*@ItemStack*/((Objects.requireNonNullElseGet(${entity}.getCapability(${JavaModName}Variables.PLAYER_VARIABLES_CAPABILITY, null), PlayerVariables::new).${name})
5250
set: |
5351
<#include "mcitems.ftl">
5452
{

0 commit comments

Comments
 (0)