Skip to content

Commit

Permalink
fix: loom was hungry for compile errors and just swallowed them whole (
Browse files Browse the repository at this point in the history
  • Loading branch information
mikerooni authored Jan 6, 2024
1 parent 50b9414 commit f3a1eb1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.google.gson.*;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.Registry;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.TagParser;
import net.minecraft.resources.ResourceLocation;
Expand All @@ -20,7 +20,7 @@ public class RecipeHelpers {
public static Item getItem(String itemName, boolean disallowsAirInRecipe) {
Item item = tryGetItem(itemName, disallowsAirInRecipe);
if (item == null) {
if (!BuiltInRegistries.ITEM.containsKey(new ResourceLocation(itemName)))
if (!Registry.ITEM.containsKey(new ResourceLocation(itemName)))
throw new JsonSyntaxException("Unknown item '" + itemName + "'");
if (disallowsAirInRecipe && (item == Items.AIR || item == null))
throw new JsonSyntaxException("Invalid item: " + itemName);
Expand All @@ -31,10 +31,10 @@ public static Item getItem(String itemName, boolean disallowsAirInRecipe) {
@Nullable
public static Item tryGetItem(String itemName, boolean disallowsAirInRecipe) {
ResourceLocation itemKey = new ResourceLocation(itemName);
if (!BuiltInRegistries.ITEM.containsKey(itemKey))
if (!Registry.ITEM.containsKey(itemKey))
return null;

Item item = BuiltInRegistries.ITEM.get(itemKey);
Item item = Registry.ITEM.get(itemKey);
if (disallowsAirInRecipe && item == Items.AIR)
return null;
return item;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class LootTableMixin {
Vec3 pos = context.getParam(LootContextParams.ORIGIN);
BlockPos blockPos = new BlockPos(Mth.floor(pos.x), Mth.floor(pos.y), Mth.floor(pos.z));
ItemStack tool = context.getParam(LootContextParams.TOOL);
boolean isSilktouch = EnchantmentHelper.hasSilkTouch(tool);
boolean isSilktouch = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0;
int fortuneLevel = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.BLOCK_FORTUNE, tool);
cir.setReturnValue(ToolEventHandlers.onHarvestDrops(player, context.getParam(LootContextParams.TOOL), context.getLevel(), blockPos, context.getParam(LootContextParams.BLOCK_STATE), isSilktouch, fortuneLevel, cir.getReturnValue(), 1));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private ToolLootModifier() {/**/}
Vec3 pos = context.getParam(LootContextParams.ORIGIN);
BlockPos blockPos = new BlockPos(Mth.floor(pos.x), Mth.floor(pos.y), Mth.floor(pos.z));
ItemStack tool = context.getParam(LootContextParams.TOOL);
boolean isSilktouch = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 1;
boolean isSilktouch = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0;
int fortuneLevel = tool.getEnchantmentLevel(Enchantments.BLOCK_FORTUNE);
return ToolEventHandlers.onHarvestDrops(player, context.getParam(LootContextParams.TOOL), context.getLevel(), blockPos, context.getParam(LootContextParams.BLOCK_STATE), isSilktouch, fortuneLevel, objectArrayList, 1);
} else {
Expand Down

0 comments on commit f3a1eb1

Please sign in to comment.