Removed the recipe for the Looting anointment "Plunderer's Glint" because Minecraft just has to "private".

This commit is contained in:
WayofTime 2021-01-23 14:19:19 -05:00
parent 3dfb8e5f55
commit 948f0933e4
3 changed files with 59 additions and 36 deletions

View file

@ -50,7 +50,7 @@ public class AlchemyTableRecipeProvider implements ISubRecipeProvider
AlchemyTableRecipeBuilder.alchemyTable(new ItemStack(BloodMagicItems.HOLY_WATER_ANOINTMENT.get()), 500, 100, 1).addIngredient(Ingredient.fromItems(BloodMagicItems.SLATE_VIAL.get())).addIngredient(Ingredient.fromTag(Tags.Items.CROPS_NETHER_WART)).addIngredient(Ingredient.fromItems(Items.GLISTERING_MELON_SLICE)).addIngredient(Ingredient.fromTag(Tags.Items.GEMS_QUARTZ)).build(consumer, BloodMagic.rl(basePath + "holy_water_anointment")); AlchemyTableRecipeBuilder.alchemyTable(new ItemStack(BloodMagicItems.HOLY_WATER_ANOINTMENT.get()), 500, 100, 1).addIngredient(Ingredient.fromItems(BloodMagicItems.SLATE_VIAL.get())).addIngredient(Ingredient.fromTag(Tags.Items.CROPS_NETHER_WART)).addIngredient(Ingredient.fromItems(Items.GLISTERING_MELON_SLICE)).addIngredient(Ingredient.fromTag(Tags.Items.GEMS_QUARTZ)).build(consumer, BloodMagic.rl(basePath + "holy_water_anointment"));
AlchemyTableRecipeBuilder.alchemyTable(new ItemStack(BloodMagicItems.HIDDEN_KNOWLEDGE_ANOINTMENT.get()), 500, 100, 1).addIngredient(Ingredient.fromItems(BloodMagicItems.SLATE_VIAL.get())).addIngredient(Ingredient.fromTag(Tags.Items.CROPS_NETHER_WART)).addIngredient(Ingredient.fromItems(Items.GLASS_BOTTLE)).addIngredient(Ingredient.fromItems(Items.ENCHANTED_BOOK)).build(consumer, BloodMagic.rl(basePath + "hidden_knowledge_anointment")); AlchemyTableRecipeBuilder.alchemyTable(new ItemStack(BloodMagicItems.HIDDEN_KNOWLEDGE_ANOINTMENT.get()), 500, 100, 1).addIngredient(Ingredient.fromItems(BloodMagicItems.SLATE_VIAL.get())).addIngredient(Ingredient.fromTag(Tags.Items.CROPS_NETHER_WART)).addIngredient(Ingredient.fromItems(Items.GLASS_BOTTLE)).addIngredient(Ingredient.fromItems(Items.ENCHANTED_BOOK)).build(consumer, BloodMagic.rl(basePath + "hidden_knowledge_anointment"));
AlchemyTableRecipeBuilder.alchemyTable(new ItemStack(BloodMagicItems.QUICK_DRAW_ANOINTMENT.get()), 500, 100, 1).addIngredient(Ingredient.fromItems(BloodMagicItems.SLATE_VIAL.get())).addIngredient(Ingredient.fromTag(Tags.Items.CROPS_NETHER_WART)).addIngredient(Ingredient.fromTag(Tags.Items.STRING)).addIngredient(Ingredient.fromItems(Items.SPECTRAL_ARROW)).build(consumer, BloodMagic.rl(basePath + "quick_draw_anointment")); AlchemyTableRecipeBuilder.alchemyTable(new ItemStack(BloodMagicItems.QUICK_DRAW_ANOINTMENT.get()), 500, 100, 1).addIngredient(Ingredient.fromItems(BloodMagicItems.SLATE_VIAL.get())).addIngredient(Ingredient.fromTag(Tags.Items.CROPS_NETHER_WART)).addIngredient(Ingredient.fromTag(Tags.Items.STRING)).addIngredient(Ingredient.fromItems(Items.SPECTRAL_ARROW)).build(consumer, BloodMagic.rl(basePath + "quick_draw_anointment"));
AlchemyTableRecipeBuilder.alchemyTable(new ItemStack(BloodMagicItems.LOOTING_ANOINTMENT.get()), 500, 100, 1).addIngredient(Ingredient.fromItems(BloodMagicItems.SLATE_VIAL.get())).addIngredient(Ingredient.fromTag(Tags.Items.CROPS_NETHER_WART)).addIngredient(Ingredient.fromTag(Tags.Items.GEMS_LAPIS)).addIngredient(Ingredient.fromTag(Tags.Items.BONES)).build(consumer, BloodMagic.rl(basePath + "looting_anointment")); // AlchemyTableRecipeBuilder.alchemyTable(new ItemStack(BloodMagicItems.LOOTING_ANOINTMENT.get()), 500, 100, 1).addIngredient(Ingredient.fromItems(BloodMagicItems.SLATE_VIAL.get())).addIngredient(Ingredient.fromTag(Tags.Items.CROPS_NETHER_WART)).addIngredient(Ingredient.fromTag(Tags.Items.GEMS_LAPIS)).addIngredient(Ingredient.fromTag(Tags.Items.BONES)).build(consumer, BloodMagic.rl(basePath + "looting_anointment"));
AlchemyTableRecipeBuilder.alchemyTable(new ItemStack(BloodMagicItems.BOW_POWER_ANOINTMENT.get()), 500, 100, 1).addIngredient(Ingredient.fromItems(BloodMagicItems.SLATE_VIAL.get())).addIngredient(Ingredient.fromTag(Tags.Items.CROPS_NETHER_WART)).addIngredient(Ingredient.fromTag(Tags.Items.INGOTS_IRON)).addIngredient(Ingredient.fromItems(Items.BOW)).build(consumer, BloodMagic.rl(basePath + "bow_power_anointment")); AlchemyTableRecipeBuilder.alchemyTable(new ItemStack(BloodMagicItems.BOW_POWER_ANOINTMENT.get()), 500, 100, 1).addIngredient(Ingredient.fromItems(BloodMagicItems.SLATE_VIAL.get())).addIngredient(Ingredient.fromTag(Tags.Items.CROPS_NETHER_WART)).addIngredient(Ingredient.fromTag(Tags.Items.INGOTS_IRON)).addIngredient(Ingredient.fromItems(Items.BOW)).build(consumer, BloodMagic.rl(basePath + "bow_power_anointment"));
AlchemyTableRecipeBuilder.alchemyTable(new ItemStack(BloodMagicItems.SMELTING_ANOINTMENT.get()), 500, 100, 1).addIngredient(Ingredient.fromItems(BloodMagicItems.SLATE_VIAL.get())).addIngredient(Ingredient.fromTag(Tags.Items.CROPS_NETHER_WART)).addIngredient(Ingredient.fromItems(Items.FURNACE)).addIngredient(Ingredient.fromItems(Items.CHARCOAL, Items.COAL)).build(consumer, BloodMagic.rl(basePath + "smelting_anointment")); AlchemyTableRecipeBuilder.alchemyTable(new ItemStack(BloodMagicItems.SMELTING_ANOINTMENT.get()), 500, 100, 1).addIngredient(Ingredient.fromItems(BloodMagicItems.SLATE_VIAL.get())).addIngredient(Ingredient.fromTag(Tags.Items.CROPS_NETHER_WART)).addIngredient(Ingredient.fromItems(Items.FURNACE)).addIngredient(Ingredient.fromItems(Items.CHARCOAL, Items.COAL)).build(consumer, BloodMagic.rl(basePath + "smelting_anointment"));

View file

@ -166,43 +166,57 @@ public class GlobalLootModifier
public List<ItemStack> doApply(List<ItemStack> generatedLoot, LootContext context) public List<ItemStack> doApply(List<ItemStack> generatedLoot, LootContext context)
{ {
// System.out.println("Checking for looting"); // System.out.println("Checking for looting");
ItemStack ctxTool = context.get(LootParameters.TOOL); // Entity killerEntity = context.get(LootParameters.KILLER_ENTITY);
// return early if silk-touch is already applied (otherwise we'll get stuck in // if (!(killerEntity instanceof PlayerEntity))
// an infinite loop). // {
if (ctxTool.getTag() != null && ctxTool.getTag().getBoolean("bloodmagic:checked_looting")) return generatedLoot;
{ // }
return generatedLoot; // Entity killedEntity = context.get(LootParameters.THIS_ENTITY);
} // if (!(killedEntity instanceof LivingEntity))
if (EnchantmentHelper.getEnchantments(ctxTool).containsKey(Enchantments.SILK_TOUCH))
return generatedLoot;
AnointmentHolder holder = AnointmentHolder.fromItemStack(ctxTool);
if (holder == null)
{
return generatedLoot;
}
int additionalLooting = holder.getAnointmentLevel(AnointmentRegistrar.ANOINTMENT_LOOTING.get());
if (additionalLooting <= 0)
{
return generatedLoot;
}
// if (holder.getAnointmentLevel(AnointmentRegistrar.ANOINTMENT_SILK_TOUCH.get()) > 0)
// { // {
// return generatedLoot; // return generatedLoot;
// } // }
// ItemStack ctxTool = ((PlayerEntity) killerEntity).getHeldItemMainhand();
ItemStack fakeTool = ctxTool.copy(); // // return early if silk-touch is already applied (otherwise we'll get stuck in
fakeTool.getOrCreateTag().putBoolean("bloodmagic:checked_looting", true); // // an infinite loop).
int baseLootingLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.LOOTING, ctxTool); //
// System.out.println("Checking looting. ItemStack context: ");
fakeTool.addEnchantment(Enchantments.LOOTING, baseLootingLevel + additionalLooting); //// EndermanEntity d;
LootContext.Builder builder = new LootContext.Builder(context); // if (ctxTool.getTag() != null && ctxTool.getTag().getBoolean("bloodmagic:checked_looting"))
builder.withParameter(LootParameters.TOOL, fakeTool); // {
LootContext ctx = builder.build(LootParameterSets.BLOCK); // return generatedLoot;
LootTable loottable = context.getWorld().getServer().getLootTableManager().getLootTableFromLocation(context.get(LootParameters.BLOCK_STATE).getBlock().getLootTable()); // }
return loottable.generate(ctx); //
// if (EnchantmentHelper.getEnchantments(ctxTool).containsKey(Enchantments.SILK_TOUCH))
// return generatedLoot;
// AnointmentHolder holder = AnointmentHolder.fromItemStack(ctxTool);
// if (holder == null)
// {
// return generatedLoot;
// }
//
// int additionalLooting = holder.getAnointmentLevel(AnointmentRegistrar.ANOINTMENT_LOOTING.get()) * 20;
// if (additionalLooting <= 0)
// {
// return generatedLoot;
// }
//
//// if (holder.getAnointmentLevel(AnointmentRegistrar.ANOINTMENT_SILK_TOUCH.get()) > 0)
//// {
//// return generatedLoot;
//// }
//
// ItemStack fakeTool = ctxTool.copy();
// fakeTool.getOrCreateTag().putBoolean("bloodmagic:checked_looting", true);
// int baseLootingLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.LOOTING, ctxTool);
//
// fakeTool.addEnchantment(Enchantments.LOOTING, baseLootingLevel + additionalLooting);
// LootContext.Builder builder = new LootContext.Builder(context);
// builder.withParameter(LootParameters.TOOL, fakeTool);
// LootContext ctx = builder.build(LootParameterSets.ENTITY);
// ResourceLocation resource = ((LivingEntity) killedEntity).getLootTableResourceLocation();
// LootTable loottable = context.getWorld().getServer().getLootTableManager().getLootTableFromLocation(resource);
// return loottable.generate(ctx);
} }
private static class Serializer extends GlobalLootModifierSerializer<LootingModifier> private static class Serializer extends GlobalLootModifierSerializer<LootingModifier>
@ -219,6 +233,14 @@ public class GlobalLootModifier
return makeConditions(instance.conditions); return makeConditions(instance.conditions);
} }
} }
// private static class ExtendedLootContext extends LootContext
// {
// public ExtendedLootContext()
// {
//
// }
// }
} }
private static class SmeltingModifier extends LootModifier private static class SmeltingModifier extends LootModifier

View file

@ -2,7 +2,8 @@
"type": "bloodmagic:looting", "type": "bloodmagic:looting",
"conditions": [ "conditions": [
{ {
"condition": "minecraft:entity", "condition": "minecraft:entity_properties",
"entity": "this",
"predicate": { "predicate": {
} }