Optional Patchouli dependency
This commit is contained in:
parent
067a6c73a0
commit
03b2f912b6
6 changed files with 52 additions and 30 deletions
|
@ -57,7 +57,6 @@ def useApi(String dep) {
|
||||||
exclude group: "me.shedaniel"
|
exclude group: "me.shedaniel"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies.include(dep)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import ru.betterend.api.BetterEndPlugin;
|
||||||
import ru.betterend.config.MainConfig;
|
import ru.betterend.config.MainConfig;
|
||||||
import ru.betterend.effects.EndEnchantments;
|
import ru.betterend.effects.EndEnchantments;
|
||||||
import ru.betterend.effects.EndPotions;
|
import ru.betterend.effects.EndPotions;
|
||||||
|
import ru.betterend.item.GuideBook;
|
||||||
import ru.betterend.recipe.AlloyingRecipes;
|
import ru.betterend.recipe.AlloyingRecipes;
|
||||||
import ru.betterend.recipe.CraftingRecipes;
|
import ru.betterend.recipe.CraftingRecipes;
|
||||||
import ru.betterend.recipe.FurnaceRecipes;
|
import ru.betterend.recipe.FurnaceRecipes;
|
||||||
|
@ -49,10 +50,18 @@ public class BetterEnd implements ModInitializer {
|
||||||
InfusionRecipes.register();
|
InfusionRecipes.register();
|
||||||
EndStructures.register();
|
EndStructures.register();
|
||||||
|
|
||||||
|
if (hasGuideBook()) {
|
||||||
|
GuideBook.register();
|
||||||
|
}
|
||||||
|
|
||||||
FabricLoader.getInstance().getEntrypoints("betterend", BetterEndPlugin.class).forEach(BetterEndPlugin::register);
|
FabricLoader.getInstance().getEntrypoints("betterend", BetterEndPlugin.class).forEach(BetterEndPlugin::register);
|
||||||
MainConfig.saveConfig();
|
MainConfig.saveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean hasGuideBook() {
|
||||||
|
return FabricLoader.getInstance().isModLoaded("patchouli");
|
||||||
|
}
|
||||||
|
|
||||||
public static Identifier makeID(String path) {
|
public static Identifier makeID(String path) {
|
||||||
return new Identifier(MOD_ID, path);
|
return new Identifier(MOD_ID, path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.item.TooltipContext;
|
import net.minecraft.client.item.TooltipContext;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
@ -15,11 +16,15 @@ import net.minecraft.world.World;
|
||||||
import ru.betterend.BetterEnd;
|
import ru.betterend.BetterEnd;
|
||||||
import ru.betterend.registry.EndItems;
|
import ru.betterend.registry.EndItems;
|
||||||
import ru.betterend.util.LangUtil;
|
import ru.betterend.util.LangUtil;
|
||||||
|
|
||||||
import vazkii.patchouli.api.PatchouliAPI;
|
import vazkii.patchouli.api.PatchouliAPI;
|
||||||
|
|
||||||
public class GuideBook extends PatternedItem {
|
public class GuideBook extends PatternedItem {
|
||||||
|
|
||||||
public final static Identifier BOOK_ID = BetterEnd.makeID("guidebook");
|
public final static Identifier BOOK_ID = BetterEnd.makeID("guidebook");
|
||||||
|
public static final Item GUIDE_BOOK = EndItems.registerItem(BOOK_ID, new GuideBook());
|
||||||
|
|
||||||
|
public static void register() {}
|
||||||
|
|
||||||
public GuideBook() {
|
public GuideBook() {
|
||||||
super(EndItems.makeItemSettings().maxCount(1));
|
super(EndItems.makeItemSettings().maxCount(1));
|
||||||
|
|
|
@ -7,6 +7,8 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.potion.PotionUtil;
|
import net.minecraft.potion.PotionUtil;
|
||||||
import net.minecraft.potion.Potions;
|
import net.minecraft.potion.Potions;
|
||||||
|
import ru.betterend.BetterEnd;
|
||||||
|
import ru.betterend.item.GuideBook;
|
||||||
import ru.betterend.recipe.builders.GridRecipe;
|
import ru.betterend.recipe.builders.GridRecipe;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.registry.EndItems;
|
import ru.betterend.registry.EndItems;
|
||||||
|
@ -15,7 +17,7 @@ public class CraftingRecipes {
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
GridRecipe.make("ender_pearl_to_block", EndBlocks.ENDER_BLOCK)
|
GridRecipe.make("ender_pearl_to_block", EndBlocks.ENDER_BLOCK)
|
||||||
.setShape(new String[] { "OO", "OO" })
|
.setShape("OO", "OO")
|
||||||
.addMaterial('O', Items.ENDER_PEARL)
|
.addMaterial('O', Items.ENDER_PEARL)
|
||||||
.build();
|
.build();
|
||||||
GridRecipe.make("ender_block_to_pearl", Items.ENDER_PEARL)
|
GridRecipe.make("ender_block_to_pearl", Items.ENDER_PEARL)
|
||||||
|
@ -25,7 +27,7 @@ public class CraftingRecipes {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
GridRecipe.make("end_stone_smelter", EndBlocks.END_STONE_SMELTER)
|
GridRecipe.make("end_stone_smelter", EndBlocks.END_STONE_SMELTER)
|
||||||
.setShape(new String[] { "###", "V V", "###" })
|
.setShape("###", "V V", "###")
|
||||||
.addMaterial('#', Blocks.END_STONE_BRICKS)
|
.addMaterial('#', Blocks.END_STONE_BRICKS)
|
||||||
.addMaterial('V', Items.BUCKET)
|
.addMaterial('V', Items.BUCKET)
|
||||||
.build();
|
.build();
|
||||||
|
@ -37,7 +39,7 @@ public class CraftingRecipes {
|
||||||
registerPedestal("purpur_pedestal", EndBlocks.PURPUR_PEDESTAL, Blocks.PURPUR_SLAB, Blocks.PURPUR_PILLAR);
|
registerPedestal("purpur_pedestal", EndBlocks.PURPUR_PEDESTAL, Blocks.PURPUR_SLAB, Blocks.PURPUR_PILLAR);
|
||||||
|
|
||||||
GridRecipe.make("infusion_pedestal", EndBlocks.INFUSION_PEDESTAL)
|
GridRecipe.make("infusion_pedestal", EndBlocks.INFUSION_PEDESTAL)
|
||||||
.setShape(new String[] { " Y ", "O#O", " # " })
|
.setShape(" Y ", "O#O", " # ")
|
||||||
.addMaterial('O', Items.ENDER_PEARL)
|
.addMaterial('O', Items.ENDER_PEARL)
|
||||||
.addMaterial('Y', Items.ENDER_EYE)
|
.addMaterial('Y', Items.ENDER_EYE)
|
||||||
.addMaterial('#', Blocks.OBSIDIAN)
|
.addMaterial('#', Blocks.OBSIDIAN)
|
||||||
|
@ -45,7 +47,7 @@ public class CraftingRecipes {
|
||||||
|
|
||||||
String material = "terminite";
|
String material = "terminite";
|
||||||
GridRecipe.make(material + "_block", EndBlocks.TERMINITE_BLOCK)
|
GridRecipe.make(material + "_block", EndBlocks.TERMINITE_BLOCK)
|
||||||
.setShape(new String[] { "III", "III", "III" })
|
.setShape("III", "III", "III")
|
||||||
.addMaterial('I', EndItems.TERMINITE_INGOT)
|
.addMaterial('I', EndItems.TERMINITE_INGOT)
|
||||||
.build();
|
.build();
|
||||||
GridRecipe.make(material + "_block_to_ingot", EndItems.TERMINITE_INGOT)
|
GridRecipe.make(material + "_block_to_ingot", EndItems.TERMINITE_INGOT)
|
||||||
|
@ -67,7 +69,7 @@ public class CraftingRecipes {
|
||||||
|
|
||||||
material = "aeternium";
|
material = "aeternium";
|
||||||
GridRecipe.make(material + "_block", EndBlocks.AETERNIUM_BLOCK)
|
GridRecipe.make(material + "_block", EndBlocks.AETERNIUM_BLOCK)
|
||||||
.setShape(new String[] { "III", "III", "III" })
|
.setShape("III", "III", "III")
|
||||||
.addMaterial('I', EndItems.AETERNIUM_INGOT)
|
.addMaterial('I', EndItems.AETERNIUM_INGOT)
|
||||||
.build();
|
.build();
|
||||||
GridRecipe.make(material + "_block_to_ingot", EndItems.AETERNIUM_INGOT)
|
GridRecipe.make(material + "_block_to_ingot", EndItems.AETERNIUM_INGOT)
|
||||||
|
@ -124,18 +126,27 @@ public class CraftingRecipes {
|
||||||
GridRecipe.make("petal_white_dye", Items.WHITE_DYE).setList("#").addMaterial('#', EndItems.HYDRALUX_PETAL).build();
|
GridRecipe.make("petal_white_dye", Items.WHITE_DYE).setList("#").addMaterial('#', EndItems.HYDRALUX_PETAL).build();
|
||||||
|
|
||||||
GridRecipe.make("sweet_berry_jelly", EndItems.SWEET_BERRY_JELLY)
|
GridRecipe.make("sweet_berry_jelly", EndItems.SWEET_BERRY_JELLY)
|
||||||
.setList("JWSB")
|
.setList("JWSB")
|
||||||
.addMaterial('J', EndItems.GELATINE)
|
.addMaterial('J', EndItems.GELATINE)
|
||||||
.addMaterial('W', PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER))
|
.addMaterial('W', PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER))
|
||||||
.addMaterial('S', Items.SUGAR).addMaterial('B', Items.SWEET_BERRIES)
|
.addMaterial('S', Items.SUGAR).addMaterial('B', Items.SWEET_BERRIES)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
GridRecipe.make("shadow_berry_jelly", EndItems.SHADOW_BERRY_JELLY)
|
GridRecipe.make("shadow_berry_jelly", EndItems.SHADOW_BERRY_JELLY)
|
||||||
.setList("JWSB").addMaterial('J', EndItems.GELATINE)
|
.setList("JWSB").addMaterial('J', EndItems.GELATINE)
|
||||||
.addMaterial('W', PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER))
|
.addMaterial('W', PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER))
|
||||||
.addMaterial('S', Items.SUGAR)
|
.addMaterial('S', Items.SUGAR)
|
||||||
.addMaterial('B', EndItems.SHADOW_BERRY_COOKED)
|
.addMaterial('B', EndItems.SHADOW_BERRY_COOKED)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
if (BetterEnd.hasGuideBook()) {
|
||||||
|
GridRecipe.make("guide_book", GuideBook.GUIDE_BOOK)
|
||||||
|
.setShape("D", "B", "C")
|
||||||
|
.addMaterial('D', EndItems.ENDER_DUST)
|
||||||
|
.addMaterial('B', Items.BOOK)
|
||||||
|
.addMaterial('C', EndItems.CRYSTAL_SHARDS)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerLantern(String name, Block lantern, Block slab) {
|
private static void registerLantern(String name, Block lantern, Block slab) {
|
||||||
|
@ -149,7 +160,7 @@ public class CraftingRecipes {
|
||||||
|
|
||||||
public static void registerPedestal(String name, Block pedestal, Block slab, Block pillar) {
|
public static void registerPedestal(String name, Block pedestal, Block slab, Block pillar) {
|
||||||
GridRecipe.make(name, pedestal)
|
GridRecipe.make(name, pedestal)
|
||||||
.setShape(new String[] { "S", "#", "S" })
|
.setShape("S", "#", "S")
|
||||||
.addMaterial('S', slab)
|
.addMaterial('S', slab)
|
||||||
.addMaterial('#', pillar)
|
.addMaterial('#', pillar)
|
||||||
.setOutputCount(2)
|
.setOutputCount(2)
|
||||||
|
@ -158,35 +169,35 @@ public class CraftingRecipes {
|
||||||
|
|
||||||
private static void registerHelmet(String name, Item material, Item result) {
|
private static void registerHelmet(String name, Item material, Item result) {
|
||||||
GridRecipe.make(name + "_helmet", result)
|
GridRecipe.make(name + "_helmet", result)
|
||||||
.setShape(new String[] { "III", "I I" })
|
.setShape("III", "I I")
|
||||||
.addMaterial('I', material)
|
.addMaterial('I', material)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerChestplate(String name, Item material, Item result) {
|
private static void registerChestplate(String name, Item material, Item result) {
|
||||||
GridRecipe.make(name + "_chestplate", result)
|
GridRecipe.make(name + "_chestplate", result)
|
||||||
.setShape(new String[] { "I I", "III", "III" })
|
.setShape("I I", "III", "III")
|
||||||
.addMaterial('I', material)
|
.addMaterial('I', material)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerLeggings(String name, Item material, Item result) {
|
private static void registerLeggings(String name, Item material, Item result) {
|
||||||
GridRecipe.make(name + "_leggings", result)
|
GridRecipe.make(name + "_leggings", result)
|
||||||
.setShape(new String[] { "III", "I I", "I I" })
|
.setShape("III", "I I", "I I")
|
||||||
.addMaterial('I', material)
|
.addMaterial('I', material)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerBoots(String name, Item material, Item result) {
|
private static void registerBoots(String name, Item material, Item result) {
|
||||||
GridRecipe.make(name + "_boots", result)
|
GridRecipe.make(name + "_boots", result)
|
||||||
.setShape(new String[] { "I I", "I I" })
|
.setShape("I I", "I I")
|
||||||
.addMaterial('I', material)
|
.addMaterial('I', material)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerShovel(String name, Item material, Item result) {
|
private static void registerShovel(String name, Item material, Item result) {
|
||||||
GridRecipe.make(name + "_shovel", result)
|
GridRecipe.make(name + "_shovel", result)
|
||||||
.setShape(new String[] { "I", "#", "#" })
|
.setShape("I", "#", "#")
|
||||||
.addMaterial('I', material)
|
.addMaterial('I', material)
|
||||||
.addMaterial('#', Items.STICK)
|
.addMaterial('#', Items.STICK)
|
||||||
.build();
|
.build();
|
||||||
|
@ -202,7 +213,7 @@ public class CraftingRecipes {
|
||||||
|
|
||||||
private static void registerPickaxe(String name, Item material, Item result) {
|
private static void registerPickaxe(String name, Item material, Item result) {
|
||||||
GridRecipe.make(name + "_pickaxe", result)
|
GridRecipe.make(name + "_pickaxe", result)
|
||||||
.setShape(new String[] { "III", " # ", " # " })
|
.setShape("III", " # ", " # ")
|
||||||
.addMaterial('I', material)
|
.addMaterial('I', material)
|
||||||
.addMaterial('#', Items.STICK)
|
.addMaterial('#', Items.STICK)
|
||||||
.build();
|
.build();
|
||||||
|
@ -210,7 +221,7 @@ public class CraftingRecipes {
|
||||||
|
|
||||||
private static void registerAxe(String name, Item material, Item result) {
|
private static void registerAxe(String name, Item material, Item result) {
|
||||||
GridRecipe.make(name + "_axe", result)
|
GridRecipe.make(name + "_axe", result)
|
||||||
.setShape(new String[] { "II", "#I", "# " })
|
.setShape("II", "#I", "# ")
|
||||||
.addMaterial('I', material)
|
.addMaterial('I', material)
|
||||||
.addMaterial('#', Items.STICK)
|
.addMaterial('#', Items.STICK)
|
||||||
.build();
|
.build();
|
||||||
|
@ -218,7 +229,7 @@ public class CraftingRecipes {
|
||||||
|
|
||||||
private static void registerHoe(String name, Item material, Item result) {
|
private static void registerHoe(String name, Item material, Item result) {
|
||||||
GridRecipe.make(name + "_hoe", result)
|
GridRecipe.make(name + "_hoe", result)
|
||||||
.setShape(new String[] { "II", "# ", "# " })
|
.setShape("II", "# ", "# ")
|
||||||
.addMaterial('I', material)
|
.addMaterial('I', material)
|
||||||
.addMaterial('#', Items.STICK)
|
.addMaterial('#', Items.STICK)
|
||||||
.build();
|
.build();
|
||||||
|
@ -226,7 +237,7 @@ public class CraftingRecipes {
|
||||||
|
|
||||||
private static void registerHammer(String name, Item material, Item result) {
|
private static void registerHammer(String name, Item material, Item result) {
|
||||||
GridRecipe.make(name + "_hammer", result)
|
GridRecipe.make(name + "_hammer", result)
|
||||||
.setShape(new String[] { "I I", "I#I", " # " })
|
.setShape("I I", "I#I", " # ")
|
||||||
.addMaterial('I', material)
|
.addMaterial('I', material)
|
||||||
.addMaterial('#', Items.STICK)
|
.addMaterial('#', Items.STICK)
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class GridRecipe {
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridRecipe setList(String shape) {
|
public GridRecipe setList(String shape) {
|
||||||
this.shape = new String[] {shape};
|
this.shape = new String[] { shape };
|
||||||
this.shaped = false;
|
this.shaped = false;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPointer;
|
import net.minecraft.util.math.BlockPointer;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
import ru.betterend.BetterEnd;
|
import ru.betterend.BetterEnd;
|
||||||
import ru.betterend.config.ItemConfig;
|
import ru.betterend.config.ItemConfig;
|
||||||
import ru.betterend.config.MainConfig;
|
import ru.betterend.config.MainConfig;
|
||||||
|
@ -42,7 +43,6 @@ import ru.betterend.item.EndHoe;
|
||||||
import ru.betterend.item.EndPickaxe;
|
import ru.betterend.item.EndPickaxe;
|
||||||
import ru.betterend.item.EndToolMaterial;
|
import ru.betterend.item.EndToolMaterial;
|
||||||
import ru.betterend.item.EternalCrystal;
|
import ru.betterend.item.EternalCrystal;
|
||||||
import ru.betterend.item.GuideBook;
|
|
||||||
import ru.betterend.item.ItemSpawnEgg;
|
import ru.betterend.item.ItemSpawnEgg;
|
||||||
import ru.betterend.item.PatternedItem;
|
import ru.betterend.item.PatternedItem;
|
||||||
import ru.betterend.tab.CreativeTabs;
|
import ru.betterend.tab.CreativeTabs;
|
||||||
|
@ -112,8 +112,6 @@ public class EndItems {
|
||||||
|
|
||||||
// Other //
|
// Other //
|
||||||
public static final Item ETERNAL_CRYSTAL = registerItem("eternal_crystal", new EternalCrystal());
|
public static final Item ETERNAL_CRYSTAL = registerItem("eternal_crystal", new EternalCrystal());
|
||||||
public static final Item GUIDE_BOOK = EndItems.registerItem(GuideBook.BOOK_ID, new GuideBook());
|
|
||||||
|
|
||||||
|
|
||||||
protected static Item registerItem(String name) {
|
protected static Item registerItem(String name) {
|
||||||
return registerItem(BetterEnd.makeID(name), new PatternedItem(makeItemSettings()));
|
return registerItem(BetterEnd.makeID(name), new PatternedItem(makeItemSettings()));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue