mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-12-22 22:59:23 +01:00
added custom book model and also shuffled around some settings
This commit is contained in:
parent
a4b90bfbc8
commit
6544505b11
12 changed files with 33 additions and 33 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<? extends BookPage> page) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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<ItemStack, ModelVariant> getModelLocations() {
|
||||
default Map<ItemStack, ModelResourceLocation> 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"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<ItemStack, ModelVariant> models = ((IModelProvider) item).getModelLocations();
|
||||
Map<ItemStack, ModelResourceLocation> 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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "naturesaura:items/book"
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
}
|
BIN
src/main/resources/assets/naturesaura/textures/gui/book.png
Normal file
BIN
src/main/resources/assets/naturesaura/textures/gui/book.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
BIN
src/main/resources/assets/naturesaura/textures/items/book.png
Normal file
BIN
src/main/resources/assets/naturesaura/textures/items/book.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 448 B |
Loading…
Reference in a new issue