diff --git a/src/main/java/de/ellpeck/naturesaura/NaturesAura.java b/src/main/java/de/ellpeck/naturesaura/NaturesAura.java index 55b168d3..bfad6fbe 100644 --- a/src/main/java/de/ellpeck/naturesaura/NaturesAura.java +++ b/src/main/java/de/ellpeck/naturesaura/NaturesAura.java @@ -37,7 +37,7 @@ public final class NaturesAura { public static final String PROXY_LOCATION = "de.ellpeck." + MOD_ID + ".proxy."; public static final String MOD_NAME = "Nature's Aura"; public static final String VERSION = "@VERSION@"; - public static final String DEPS = "required:patchouli;"; + public static final String DEPS = "required-after:patchouli;"; public static final Logger LOGGER = LogManager.getLogger(MOD_NAME); diff --git a/src/main/java/de/ellpeck/naturesaura/compat/Compat.java b/src/main/java/de/ellpeck/naturesaura/compat/Compat.java index e9fc92e7..42d5c9a3 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/Compat.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/Compat.java @@ -6,7 +6,6 @@ import net.minecraftforge.fml.common.Loader; public final class Compat { - public static boolean patchouli; public static boolean baubles; public static void init() { @@ -14,10 +13,9 @@ public final class Compat { if (baubles) { MinecraftForge.EVENT_BUS.register(new BaublesCompat()); } + } - patchouli = Loader.isModLoaded("patchouli"); - if (patchouli) { - PatchouliCompat.init(); - } + public static void initClient(){ + PatchouliCompat.initClient(); } } diff --git a/src/main/java/de/ellpeck/naturesaura/compat/patchouli/PatchouliCompat.java b/src/main/java/de/ellpeck/naturesaura/compat/patchouli/PatchouliCompat.java index b2822e78..c8c2ee16 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/patchouli/PatchouliCompat.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/patchouli/PatchouliCompat.java @@ -1,17 +1,22 @@ package de.ellpeck.naturesaura.compat.patchouli; import de.ellpeck.naturesaura.NaturesAura; +import net.minecraft.client.renderer.block.model.ModelBakery; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.ResourceLocation; import vazkii.patchouli.client.book.BookPage; import vazkii.patchouli.client.book.ClientBookRegistry; +import vazkii.patchouli.common.item.PatchouliItems; public final class PatchouliCompat { public static final ResourceLocation GUI_ELEMENTS = new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/patchouli/elements.png"); - public static void init() { + public static void initClient() { addPatchouliPage("altar", PageAltar.class); addPatchouliPage("tree_ritual", PageTreeRitual.class); + + ModelBakery.registerItemVariants(PatchouliItems.book, new ModelResourceLocation(NaturesAura.MOD_ID + ":book", "inventory")); } private static void addPatchouliPage(String name, Class page) { diff --git a/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java b/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java index 7bd52d5a..b8db7435 100644 --- a/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java +++ b/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java @@ -4,12 +4,13 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar; import de.ellpeck.naturesaura.blocks.tiles.TileEntityWoodStand; import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar; import de.ellpeck.naturesaura.blocks.tiles.render.RenderWoodStand; -import de.ellpeck.naturesaura.renderers.PlayerLayerTrinkets; +import de.ellpeck.naturesaura.compat.Compat; import de.ellpeck.naturesaura.events.ClientEvents; import de.ellpeck.naturesaura.particles.ParticleHandler; import de.ellpeck.naturesaura.particles.ParticleMagic; import de.ellpeck.naturesaura.reg.IColorProvidingBlock; import de.ellpeck.naturesaura.reg.IColorProvidingItem; +import de.ellpeck.naturesaura.renderers.PlayerLayerTrinkets; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -18,7 +19,6 @@ import net.minecraft.client.renderer.color.ItemColors; import net.minecraft.client.renderer.entity.RenderPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.MinecraftForge; @@ -34,6 +34,7 @@ public class ClientProxy implements IProxy { @Override public void preInit(FMLPreInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new ClientEvents()); + Compat.initClient(); } @Override @@ -53,8 +54,8 @@ public class ClientProxy implements IProxy { } @Override - public void registerRenderer(ItemStack stack, ResourceLocation location, String variant) { - ModelLoader.setCustomModelResourceLocation(stack.getItem(), stack.getItemDamage(), new ModelResourceLocation(location, variant)); + public void registerRenderer(ItemStack stack, ModelResourceLocation location) { + ModelLoader.setCustomModelResourceLocation(stack.getItem(), stack.getItemDamage(), location); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/proxy/IProxy.java b/src/main/java/de/ellpeck/naturesaura/proxy/IProxy.java index ca0e9474..80a5d8f5 100644 --- a/src/main/java/de/ellpeck/naturesaura/proxy/IProxy.java +++ b/src/main/java/de/ellpeck/naturesaura/proxy/IProxy.java @@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.proxy; import de.ellpeck.naturesaura.reg.IColorProvidingBlock; import de.ellpeck.naturesaura.reg.IColorProvidingItem; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; @@ -16,7 +17,7 @@ public interface IProxy { void postInit(FMLPostInitializationEvent event); - void registerRenderer(ItemStack stack, ResourceLocation location, String variant); + void registerRenderer(ItemStack stack, ModelResourceLocation location); void addColorProvidingItem(IColorProvidingItem item); diff --git a/src/main/java/de/ellpeck/naturesaura/proxy/ServerProxy.java b/src/main/java/de/ellpeck/naturesaura/proxy/ServerProxy.java index 38e2f652..0e8d5086 100644 --- a/src/main/java/de/ellpeck/naturesaura/proxy/ServerProxy.java +++ b/src/main/java/de/ellpeck/naturesaura/proxy/ServerProxy.java @@ -2,8 +2,8 @@ package de.ellpeck.naturesaura.proxy; import de.ellpeck.naturesaura.reg.IColorProvidingBlock; import de.ellpeck.naturesaura.reg.IColorProvidingItem; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; @@ -28,7 +28,7 @@ public class ServerProxy implements IProxy { } @Override - public void registerRenderer(ItemStack stack, ResourceLocation location, String variant) { + public void registerRenderer(ItemStack stack, ModelResourceLocation location) { } diff --git a/src/main/java/de/ellpeck/naturesaura/reg/IModelProvider.java b/src/main/java/de/ellpeck/naturesaura/reg/IModelProvider.java index ce434118..1e202408 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/IModelProvider.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/IModelProvider.java @@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.reg; import de.ellpeck.naturesaura.NaturesAura; import net.minecraft.block.Block; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -11,20 +12,9 @@ import java.util.Map; public interface IModelProvider { - default Map getModelLocations() { + default Map getModelLocations() { ItemStack stack = this instanceof Item ? new ItemStack((Item) this) : new ItemStack((Block) this); String name = ((IModItem) this).getBaseName(); - return Collections.singletonMap(stack, new ModelVariant(new ResourceLocation(NaturesAura.MOD_ID, name), "inventory")); - } - - class ModelVariant { - - public final ResourceLocation location; - public final String variant; - - public ModelVariant(ResourceLocation location, String variant) { - this.location = location; - this.variant = variant; - } + return Collections.singletonMap(stack, new ModelResourceLocation(new ResourceLocation(NaturesAura.MOD_ID, name), "inventory")); } } diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java b/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java index a4b7b6b3..8e627265 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java @@ -1,8 +1,8 @@ package de.ellpeck.naturesaura.reg; import de.ellpeck.naturesaura.NaturesAura; -import de.ellpeck.naturesaura.reg.IModelProvider.ModelVariant; import net.minecraft.block.Block; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -70,11 +70,10 @@ public final class ModRegistry { } if (item instanceof IModelProvider) { - Map models = ((IModelProvider) item).getModelLocations(); + Map models = ((IModelProvider) item).getModelLocations(); for (ItemStack stack : models.keySet()) { - ModelVariant variant = models.get(stack); - NaturesAura.proxy.registerRenderer(stack, variant.location, variant.variant); + NaturesAura.proxy.registerRenderer(stack, models.get(stack)); } } diff --git a/src/main/resources/assets/naturesaura/models/item/book.json b/src/main/resources/assets/naturesaura/models/item/book.json new file mode 100644 index 00000000..ab85a0da --- /dev/null +++ b/src/main/resources/assets/naturesaura/models/item/book.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "naturesaura:items/book" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/patchouli_books/book/book.json b/src/main/resources/assets/naturesaura/patchouli_books/book/book.json index cbe5a1bb..b869b824 100644 --- a/src/main/resources/assets/naturesaura/patchouli_books/book/book.json +++ b/src/main/resources/assets/naturesaura/patchouli_books/book/book.json @@ -6,7 +6,7 @@ ], "creative_tab": "naturesaura", "advancements_tab": "naturesaura", - "book_texture": "patchouli:textures/gui/book_green", - "model": "patchouli:book_green", + "book_texture": "naturesaura:textures/gui/book", + "model": "naturesaura:book", "subtitle": "Haha yes" } \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/textures/gui/book.png b/src/main/resources/assets/naturesaura/textures/gui/book.png new file mode 100644 index 00000000..a5b7f591 Binary files /dev/null and b/src/main/resources/assets/naturesaura/textures/gui/book.png differ diff --git a/src/main/resources/assets/naturesaura/textures/items/book.png b/src/main/resources/assets/naturesaura/textures/items/book.png new file mode 100644 index 00000000..9e7a1f4f Binary files /dev/null and b/src/main/resources/assets/naturesaura/textures/items/book.png differ