Skip to content

Commit

Permalink
Fix Force Rod not being charge-able
Browse files Browse the repository at this point in the history
Fix 2nd force rod recipe
  • Loading branch information
Mrbysco committed Nov 16, 2023
1 parent 461aee2 commit e7df64e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
14 changes: 14 additions & 0 deletions src/main/java/com/mrbysco/forcecraft/items/tools/ForceRodItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,20 @@ public ActionResultType interactLivingEntity(ItemStack stack, PlayerEntity playe
return super.interactLivingEntity(stack, playerIn, target, handIn);
}

@Override
public void inventoryTick(ItemStack stack, World level, Entity entityIn, int itemSlot, boolean isSelected) {
super.inventoryTick(stack, level, entityIn, itemSlot, isSelected);
if (stack.getTag() != null && !stack.getTag().contains("ForceInfused")) {
initializeTag(stack);
}
}

private void initializeTag(ItemStack stack) {
CompoundNBT tag = stack.getOrCreateTag();
tag.putBoolean("ForceInfused", false);
stack.setTag(tag);
}

@Nullable
@Override
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) {
Expand Down
8 changes: 5 additions & 3 deletions src/main/resources/data/forcecraft/recipes/force_rod.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"pattern": [
" F",
" S ",
"N " ],
"N "
],
"key": {
"F": [
{
Expand All @@ -21,8 +22,9 @@
}
]
},

"result": {
"item": "forcecraft:force_rod"
"type": "forge:nbt",
"item": "forcecraft:force_rod",
"nbt": "{ForceInfused:1b}"
}
}
10 changes: 6 additions & 4 deletions src/main/resources/data/forcecraft/recipes/force_rod2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"pattern": [
" F",
" S ",
"N " ],
"N "
],
"key": {
"F": [
{
Expand All @@ -17,12 +18,13 @@
],
"S": [
{
"tag": "forge:rods/force"
"item": "minecraft:stick"
}
]
},

"result": {
"item": "forcecraft:force_rod"
"type": "forge:nbt",
"item": "forcecraft:force_rod",
"nbt": "{Damage:73,ForceInfused:1b}"
}
}

0 comments on commit e7df64e

Please sign in to comment.