Skip to content

Commit

Permalink
Fixed Neptunium Knife not working in fish fillet recipes. Closes #156
Browse files Browse the repository at this point in the history
  • Loading branch information
GirafiStudios committed Nov 5, 2020
1 parent e278aaa commit 1d3b7e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
@@ -1,7 +1,7 @@
minecraft_version=1.15.2
forge_version=31.2.45
mappings=20200621-1.15.1
mod_version=2.0.22
mod_version=2.0.23
jei_version=6.0.2.6

org.gradle.jvmargs=-Xmx4G
Expand Down
Expand Up @@ -52,7 +52,7 @@ public boolean matches(@Nonnull CraftingInventory craftingInventory, @Nonnull Wo
}
stack = slotStack;
} else {
if (!(slotStack.getItem().isIn(AquacultureAPI.Tags.FILLET_KNIFE) && slotStack.isDamageable() && slotStack.getItem() instanceof TieredItem)) {
if (!(slotStack.getItem().isIn(AquacultureAPI.Tags.FILLET_KNIFE) && (slotStack.isDamageable() || isKnifeNeptunium(slotStack.getItem())) && slotStack.getItem() instanceof TieredItem)) {
return false;
}
list.add(slotStack);
Expand Down Expand Up @@ -90,7 +90,7 @@ public ItemStack getCraftingResult(@Nonnull CraftingInventory craftingInventory)
if (AquaConfig.BASIC_OPTIONS.randomWeight.get() && fish.getTag() != null && fish.getTag().contains("fishWeight")) {
filletAmount = FishWeightHandler.getFilletAmountFromWeight(fish.getTag().getDouble("fishWeight"));
}
if (knife instanceof TieredItem && ((TieredItem) knife).getTier() == AquacultureAPI.MATS.NEPTUNIUM) {
if (isKnifeNeptunium(knife)) {
filletAmount += filletAmount * (25.0F / 100.0F);
}
return new ItemStack(AquaItems.FISH_FILLET, filletAmount);
Expand All @@ -107,7 +107,7 @@ public NonNullList<ItemStack> getRemainingItems(CraftingInventory craftingInvent
ItemStack stack = craftingInventory.getStackInSlot(i);
if (stack.getItem().isIn(AquacultureAPI.Tags.FILLET_KNIFE)) {
ItemStack knife = stack.copy();
if (!(knife.getItem() instanceof TieredItem && ((TieredItem) knife.getItem()).getTier() == AquacultureAPI.MATS.NEPTUNIUM)) {
if (!isKnifeNeptunium(knife.getItem())) {
if (knife.attemptDamageItem(1, new Random(), null)) {
knife.shrink(1);
}
Expand All @@ -118,6 +118,10 @@ public NonNullList<ItemStack> getRemainingItems(CraftingInventory craftingInvent
return list;
}

public static boolean isKnifeNeptunium(@Nonnull Item knife) {
return knife instanceof TieredItem && ((TieredItem) knife).getTier() == AquacultureAPI.MATS.NEPTUNIUM;
}

@Override
@Nonnull
public IRecipeSerializer<?> getSerializer() {
Expand Down

0 comments on commit 1d3b7e6

Please sign in to comment.