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"
|
||||
}
|
||||
}
|
||||
dependencies.include(dep)
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
|
|
@ -7,6 +7,7 @@ import ru.betterend.api.BetterEndPlugin;
|
|||
import ru.betterend.config.MainConfig;
|
||||
import ru.betterend.effects.EndEnchantments;
|
||||
import ru.betterend.effects.EndPotions;
|
||||
import ru.betterend.item.GuideBook;
|
||||
import ru.betterend.recipe.AlloyingRecipes;
|
||||
import ru.betterend.recipe.CraftingRecipes;
|
||||
import ru.betterend.recipe.FurnaceRecipes;
|
||||
|
@ -49,10 +50,18 @@ public class BetterEnd implements ModInitializer {
|
|||
InfusionRecipes.register();
|
||||
EndStructures.register();
|
||||
|
||||
if (hasGuideBook()) {
|
||||
GuideBook.register();
|
||||
}
|
||||
|
||||
FabricLoader.getInstance().getEntrypoints("betterend", BetterEndPlugin.class).forEach(BetterEndPlugin::register);
|
||||
MainConfig.saveConfig();
|
||||
}
|
||||
|
||||
public static boolean hasGuideBook() {
|
||||
return FabricLoader.getInstance().isModLoaded("patchouli");
|
||||
}
|
||||
|
||||
public static Identifier makeID(String path) {
|
||||
return new Identifier(MOD_ID, path);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
|
||||
import net.minecraft.client.item.TooltipContext;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.text.Text;
|
||||
|
@ -15,11 +16,15 @@ import net.minecraft.world.World;
|
|||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.registry.EndItems;
|
||||
import ru.betterend.util.LangUtil;
|
||||
|
||||
import vazkii.patchouli.api.PatchouliAPI;
|
||||
|
||||
public class GuideBook extends PatternedItem {
|
||||
|
||||
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() {
|
||||
super(EndItems.makeItemSettings().maxCount(1));
|
||||
|
|
|
@ -7,6 +7,8 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.item.Items;
|
||||
import net.minecraft.potion.PotionUtil;
|
||||
import net.minecraft.potion.Potions;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.item.GuideBook;
|
||||
import ru.betterend.recipe.builders.GridRecipe;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndItems;
|
||||
|
@ -15,7 +17,7 @@ public class CraftingRecipes {
|
|||
|
||||
public static void register() {
|
||||
GridRecipe.make("ender_pearl_to_block", EndBlocks.ENDER_BLOCK)
|
||||
.setShape(new String[] { "OO", "OO" })
|
||||
.setShape("OO", "OO")
|
||||
.addMaterial('O', Items.ENDER_PEARL)
|
||||
.build();
|
||||
GridRecipe.make("ender_block_to_pearl", Items.ENDER_PEARL)
|
||||
|
@ -25,7 +27,7 @@ public class CraftingRecipes {
|
|||
.build();
|
||||
|
||||
GridRecipe.make("end_stone_smelter", EndBlocks.END_STONE_SMELTER)
|
||||
.setShape(new String[] { "###", "V V", "###" })
|
||||
.setShape("###", "V V", "###")
|
||||
.addMaterial('#', Blocks.END_STONE_BRICKS)
|
||||
.addMaterial('V', Items.BUCKET)
|
||||
.build();
|
||||
|
@ -37,7 +39,7 @@ public class CraftingRecipes {
|
|||
registerPedestal("purpur_pedestal", EndBlocks.PURPUR_PEDESTAL, Blocks.PURPUR_SLAB, Blocks.PURPUR_PILLAR);
|
||||
|
||||
GridRecipe.make("infusion_pedestal", EndBlocks.INFUSION_PEDESTAL)
|
||||
.setShape(new String[] { " Y ", "O#O", " # " })
|
||||
.setShape(" Y ", "O#O", " # ")
|
||||
.addMaterial('O', Items.ENDER_PEARL)
|
||||
.addMaterial('Y', Items.ENDER_EYE)
|
||||
.addMaterial('#', Blocks.OBSIDIAN)
|
||||
|
@ -45,7 +47,7 @@ public class CraftingRecipes {
|
|||
|
||||
String material = "terminite";
|
||||
GridRecipe.make(material + "_block", EndBlocks.TERMINITE_BLOCK)
|
||||
.setShape(new String[] { "III", "III", "III" })
|
||||
.setShape("III", "III", "III")
|
||||
.addMaterial('I', EndItems.TERMINITE_INGOT)
|
||||
.build();
|
||||
GridRecipe.make(material + "_block_to_ingot", EndItems.TERMINITE_INGOT)
|
||||
|
@ -67,7 +69,7 @@ public class CraftingRecipes {
|
|||
|
||||
material = "aeternium";
|
||||
GridRecipe.make(material + "_block", EndBlocks.AETERNIUM_BLOCK)
|
||||
.setShape(new String[] { "III", "III", "III" })
|
||||
.setShape("III", "III", "III")
|
||||
.addMaterial('I', EndItems.AETERNIUM_INGOT)
|
||||
.build();
|
||||
GridRecipe.make(material + "_block_to_ingot", EndItems.AETERNIUM_INGOT)
|
||||
|
@ -136,6 +138,15 @@ public class CraftingRecipes {
|
|||
.addMaterial('S', Items.SUGAR)
|
||||
.addMaterial('B', EndItems.SHADOW_BERRY_COOKED)
|
||||
.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) {
|
||||
|
@ -149,7 +160,7 @@ public class CraftingRecipes {
|
|||
|
||||
public static void registerPedestal(String name, Block pedestal, Block slab, Block pillar) {
|
||||
GridRecipe.make(name, pedestal)
|
||||
.setShape(new String[] { "S", "#", "S" })
|
||||
.setShape("S", "#", "S")
|
||||
.addMaterial('S', slab)
|
||||
.addMaterial('#', pillar)
|
||||
.setOutputCount(2)
|
||||
|
@ -158,35 +169,35 @@ public class CraftingRecipes {
|
|||
|
||||
private static void registerHelmet(String name, Item material, Item result) {
|
||||
GridRecipe.make(name + "_helmet", result)
|
||||
.setShape(new String[] { "III", "I I" })
|
||||
.setShape("III", "I I")
|
||||
.addMaterial('I', material)
|
||||
.build();
|
||||
}
|
||||
|
||||
private static void registerChestplate(String name, Item material, Item result) {
|
||||
GridRecipe.make(name + "_chestplate", result)
|
||||
.setShape(new String[] { "I I", "III", "III" })
|
||||
.setShape("I I", "III", "III")
|
||||
.addMaterial('I', material)
|
||||
.build();
|
||||
}
|
||||
|
||||
private static void registerLeggings(String name, Item material, Item result) {
|
||||
GridRecipe.make(name + "_leggings", result)
|
||||
.setShape(new String[] { "III", "I I", "I I" })
|
||||
.setShape("III", "I I", "I I")
|
||||
.addMaterial('I', material)
|
||||
.build();
|
||||
}
|
||||
|
||||
private static void registerBoots(String name, Item material, Item result) {
|
||||
GridRecipe.make(name + "_boots", result)
|
||||
.setShape(new String[] { "I I", "I I" })
|
||||
.setShape("I I", "I I")
|
||||
.addMaterial('I', material)
|
||||
.build();
|
||||
}
|
||||
|
||||
private static void registerShovel(String name, Item material, Item result) {
|
||||
GridRecipe.make(name + "_shovel", result)
|
||||
.setShape(new String[] { "I", "#", "#" })
|
||||
.setShape("I", "#", "#")
|
||||
.addMaterial('I', material)
|
||||
.addMaterial('#', Items.STICK)
|
||||
.build();
|
||||
|
@ -202,7 +213,7 @@ public class CraftingRecipes {
|
|||
|
||||
private static void registerPickaxe(String name, Item material, Item result) {
|
||||
GridRecipe.make(name + "_pickaxe", result)
|
||||
.setShape(new String[] { "III", " # ", " # " })
|
||||
.setShape("III", " # ", " # ")
|
||||
.addMaterial('I', material)
|
||||
.addMaterial('#', Items.STICK)
|
||||
.build();
|
||||
|
@ -210,7 +221,7 @@ public class CraftingRecipes {
|
|||
|
||||
private static void registerAxe(String name, Item material, Item result) {
|
||||
GridRecipe.make(name + "_axe", result)
|
||||
.setShape(new String[] { "II", "#I", "# " })
|
||||
.setShape("II", "#I", "# ")
|
||||
.addMaterial('I', material)
|
||||
.addMaterial('#', Items.STICK)
|
||||
.build();
|
||||
|
@ -218,7 +229,7 @@ public class CraftingRecipes {
|
|||
|
||||
private static void registerHoe(String name, Item material, Item result) {
|
||||
GridRecipe.make(name + "_hoe", result)
|
||||
.setShape(new String[] { "II", "# ", "# " })
|
||||
.setShape("II", "# ", "# ")
|
||||
.addMaterial('I', material)
|
||||
.addMaterial('#', Items.STICK)
|
||||
.build();
|
||||
|
@ -226,7 +237,7 @@ public class CraftingRecipes {
|
|||
|
||||
private static void registerHammer(String name, Item material, Item result) {
|
||||
GridRecipe.make(name + "_hammer", result)
|
||||
.setShape(new String[] { "I I", "I#I", " # " })
|
||||
.setShape("I I", "I#I", " # ")
|
||||
.addMaterial('I', material)
|
||||
.addMaterial('#', Items.STICK)
|
||||
.build();
|
||||
|
|
|
@ -63,7 +63,7 @@ public class GridRecipe {
|
|||
}
|
||||
|
||||
public GridRecipe setList(String shape) {
|
||||
this.shape = new String[] {shape};
|
||||
this.shape = new String[] { shape };
|
||||
this.shaped = false;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import net.minecraft.util.Identifier;
|
|||
import net.minecraft.util.math.BlockPointer;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.config.ItemConfig;
|
||||
import ru.betterend.config.MainConfig;
|
||||
|
@ -42,7 +43,6 @@ import ru.betterend.item.EndHoe;
|
|||
import ru.betterend.item.EndPickaxe;
|
||||
import ru.betterend.item.EndToolMaterial;
|
||||
import ru.betterend.item.EternalCrystal;
|
||||
import ru.betterend.item.GuideBook;
|
||||
import ru.betterend.item.ItemSpawnEgg;
|
||||
import ru.betterend.item.PatternedItem;
|
||||
import ru.betterend.tab.CreativeTabs;
|
||||
|
@ -112,8 +112,6 @@ public class EndItems {
|
|||
|
||||
// Other //
|
||||
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) {
|
||||
return registerItem(BetterEnd.makeID(name), new PatternedItem(makeItemSettings()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue