mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-25 14:34:36 +00:00
Beginning of work to flatten all special flowers. not compiling yet
more work. almost done. Compiling and launching worlds Fix models and other bugs Cleanup ,fix flower langs and tooltips remove old specialflower blockstate json
This commit is contained in:
1 parent
bd095808b7
commit
bf6dccfcd2
335 files changed
+4240
-4364
No files matched your search
@@ -14,6 +14,7 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.ModSubtiles;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
@@ -37,7 +38,7 @@ public final class ModChallenges {
|
||||
addChallenge(EnumChallengeLevel.EASY, "recordFarm", new ItemStack(Items.MUSIC_DISC_13));
|
||||
addChallenge(EnumChallengeLevel.EASY, "reedFarm", new ItemStack(Blocks.SUGAR_CANE));
|
||||
addChallenge(EnumChallengeLevel.EASY, "cobbleGen", new ItemStack(Blocks.COBBLESTONE));
|
||||
addChallenge(EnumChallengeLevel.EASY, "pureDaisy", ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY));
|
||||
addChallenge(EnumChallengeLevel.EASY, "pureDaisy", new ItemStack(ModSubtiles.pureDaisy));
|
||||
addChallenge(EnumChallengeLevel.EASY, "battery", new ItemStack(ModBlocks.manaPool));
|
||||
|
||||
addChallenge(EnumChallengeLevel.NORMAL, "apothecaryRefill", new ItemStack(ModBlocks.defaultAltar));
|
||||
@@ -45,15 +46,15 @@ public final class ModChallenges {
|
||||
addChallenge(EnumChallengeLevel.NORMAL, "fullCropFarm", new ItemStack(Items.WHEAT_SEEDS));
|
||||
addChallenge(EnumChallengeLevel.NORMAL, "animalFarm", new ItemStack(Items.LEATHER));
|
||||
addChallenge(EnumChallengeLevel.NORMAL, "boneMealFarm", new ItemStack(Items.BONE_MEAL));
|
||||
addChallenge(EnumChallengeLevel.NORMAL, "orechid", ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID));
|
||||
addChallenge(EnumChallengeLevel.NORMAL, "orechid", new ItemStack(ModSubtiles.orechid));
|
||||
|
||||
addChallenge(EnumChallengeLevel.HARD, "mobTower", new ItemStack(Items.BONE));
|
||||
addChallenge(EnumChallengeLevel.HARD, "entropinnyumSetup", ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ENTROPINNYUM));
|
||||
addChallenge(EnumChallengeLevel.HARD, "spectrolusSetup", ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_SPECTROLUS));
|
||||
addChallenge(EnumChallengeLevel.HARD, "shulkMeNotSetup", ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_SHULK_ME_NOT));
|
||||
addChallenge(EnumChallengeLevel.HARD, "entropinnyumSetup", new ItemStack(ModSubtiles.entropinnyum));
|
||||
addChallenge(EnumChallengeLevel.HARD, "spectrolusSetup", new ItemStack(ModSubtiles.spectrolus));
|
||||
addChallenge(EnumChallengeLevel.HARD, "shulkMeNotSetup", new ItemStack(ModSubtiles.shulkMeNot));
|
||||
addChallenge(EnumChallengeLevel.HARD, "potionBrewer", new ItemStack(ModBlocks.brewery));
|
||||
|
||||
addChallenge(EnumChallengeLevel.LUNATIC, "kekimurusSetup", ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_KEKIMURUS));
|
||||
addChallenge(EnumChallengeLevel.LUNATIC, "kekimurusSetup", new ItemStack(ModSubtiles.kekimurus));
|
||||
addChallenge(EnumChallengeLevel.LUNATIC, "autoQuarry", new ItemStack(Items.DIAMOND_PICKAXE));
|
||||
addChallenge(EnumChallengeLevel.LUNATIC, "runeCrafter", new ItemStack(ModItems.runeWater));
|
||||
}
|
||||
|
||||
@@ -25,9 +25,8 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.subtile.ISubTileContainer;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.api.subtile.TileEntitySpecialFlower;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.entity.EntityMagicLandmine;
|
||||
@@ -66,10 +65,9 @@ public final class BlockHighlightRenderHandler {
|
||||
}
|
||||
|
||||
TileEntity tile = mc.world.getTileEntity(bPos);
|
||||
if(tile == null || !(tile instanceof ISubTileContainer))
|
||||
if(tile == null || !(tile instanceof TileEntitySpecialFlower))
|
||||
break boundTile;
|
||||
ISubTileContainer container = (ISubTileContainer) tile;
|
||||
SubTileEntity subtile = container.getSubTile();
|
||||
TileEntitySpecialFlower subtile = (TileEntitySpecialFlower) tile;
|
||||
if(subtile == null)
|
||||
break boundTile;
|
||||
RadiusDescriptor descriptor = subtile.getRadius();
|
||||
|
||||
@@ -20,14 +20,14 @@ import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EnumPlayerModelParts;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import vazkii.botania.api.item.IBaubleRender.Helper;
|
||||
import vazkii.botania.api.subtile.SubTileType;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.BotaniaRegistries;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.core.version.VersionChecker;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
@@ -95,8 +95,8 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
|
||||
flowerMap.put(key, new ItemStack(ModBlocks.getFlower(EnumDyeColor.byId(i))));
|
||||
} catch(NumberFormatException e) {
|
||||
// todo 1.13 backward compat for camelCase names
|
||||
SubTileType type = BotaniaRegistries.SUBTILES.getValue(new ResourceLocation(LibMisc.MOD_ID, value));
|
||||
flowerMap.put(key, ItemBlockSpecialFlower.ofType(type));
|
||||
Item item = ForgeRegistries.ITEMS.getValue(new ResourceLocation(LibMisc.MOD_ID, value));
|
||||
flowerMap.put(key, new ItemStack(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,29 +8,20 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.RenderSprite;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.client.model.animation.TileEntityRendererAnimation;
|
||||
import net.minecraftforge.client.model.obj.OBJLoader;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.registries.IRegistryDelegate;
|
||||
import vazkii.botania.api.BotaniaAPIClient;
|
||||
import vazkii.botania.api.item.IFloatingFlower;
|
||||
import vazkii.botania.api.lexicon.multiblock.IMultiblockRenderHook;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.client.model.SpecialFlowerModel;
|
||||
import vazkii.botania.client.render.entity.RenderBabylonWeapon;
|
||||
import vazkii.botania.client.render.entity.RenderCorporeaSpark;
|
||||
import vazkii.botania.client.render.entity.RenderDoppleganger;
|
||||
@@ -42,22 +33,6 @@ import vazkii.botania.client.render.entity.RenderSnowballStack;
|
||||
import vazkii.botania.client.render.entity.RenderSpark;
|
||||
import vazkii.botania.client.render.tile.*;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.subtile.SubTileManastar;
|
||||
import vazkii.botania.common.block.subtile.SubTilePureDaisy;
|
||||
import vazkii.botania.common.block.subtile.functional.*;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileArcaneRose;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileDandelifeon;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileEndoflame;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileEntropinnyum;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileGourmaryllis;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileHydroangeas;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileKekimurus;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileMunchdew;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileNarslimmus;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileRafflowsia;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileShulkMeNot;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileSpectrolus;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileThermalily;
|
||||
import vazkii.botania.common.block.tile.*;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaCrystalCube;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
|
||||
@@ -79,15 +54,12 @@ import vazkii.botania.common.entity.EntitySpark;
|
||||
import vazkii.botania.common.entity.EntityThornChakram;
|
||||
import vazkii.botania.common.entity.EntityVineBall;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID)
|
||||
public final class ModelHandler {
|
||||
@SubscribeEvent
|
||||
public static void registerModels(ModelRegistryEvent evt) {
|
||||
ModelLoaderRegistry.registerLoader(SpecialFlowerModel.Loader.INSTANCE);
|
||||
|
||||
registerSubtiles();
|
||||
|
||||
RenderTileFloatingFlower renderTileFloatingFlower = new RenderTileFloatingFlower();
|
||||
@@ -100,7 +72,6 @@ public final class ModelHandler {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEnchanter.class, new RenderTileEnchanter());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileAlfPortal.class, new RenderTileAlfPortal());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileFloatingFlower.class, renderTileFloatingFlower);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileFloatingSpecialFlower.class, renderTileFloatingFlower);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTinyPotato.class, new RenderTileTinyPotato());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileStarfield.class, new RenderTileStarfield());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBrewery.class, new RenderTileBrewery());
|
||||
@@ -151,60 +122,6 @@ public final class ModelHandler {
|
||||
BotaniaAPIClient.registerIslandTypeModel(IFloatingFlower.IslandType.SCORCHED, new ModelResourceLocation("botania:mini_island", "variant=scorched"));
|
||||
BotaniaAPIClient.registerIslandTypeModel(IFloatingFlower.IslandType.INFUSED, new ModelResourceLocation("botania:mini_island", "variant=infused"));
|
||||
BotaniaAPIClient.registerIslandTypeModel(IFloatingFlower.IslandType.MUTATED, new ModelResourceLocation("botania:mini_island", "variant=mutated"));
|
||||
|
||||
/* todo 1.13
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileManastar.class, new ModelResourceLocation(LibBlockNames.SUBTILE_MANASTAR.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTilePureDaisy.class, new ModelResourceLocation(LibBlockNames.SUBTILE_PUREDAISY.toString()));
|
||||
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileEndoflame.class, new ModelResourceLocation(LibBlockNames.SUBTILE_ENDOFLAME.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileHydroangeas.class, new ModelResourceLocation(LibBlockNames.SUBTILE_HYDROANGEAS.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileThermalily.class, new ModelResourceLocation(LibBlockNames.SUBTILE_THERMALILY.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileArcaneRose.class, new ModelResourceLocation(LibBlockNames.SUBTILE_ARCANE_ROSE.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileMunchdew.class, new ModelResourceLocation(LibBlockNames.SUBTILE_MUNCHDEW.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileEntropinnyum.class, new ModelResourceLocation(LibBlockNames.SUBTILE_ENTROPINNYUM.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileKekimurus.class, new ModelResourceLocation(LibBlockNames.SUBTILE_KEKIMURUS.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileGourmaryllis.class, new ModelResourceLocation(LibBlockNames.SUBTILE_GOURMARYLLIS.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileNarslimmus.class, new ModelResourceLocation(LibBlockNames.SUBTILE_NARSLIMMUS.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileSpectrolus.class, new ModelResourceLocation(LibBlockNames.SUBTILE_SPECTROLUS.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileDandelifeon.class, new ModelResourceLocation(LibBlockNames.SUBTILE_DANDELIFEON.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileRafflowsia.class, new ModelResourceLocation(LibBlockNames.SUBTILE_RAFFLOWSIA.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileShulkMeNot.class, new ModelResourceLocation(LibBlockNames.SUBTILE_SHULK_ME_NOT.toString()));
|
||||
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileBellethorn.class, new ModelResourceLocation(LibBlockNames.SUBTILE_BELLETHORN.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileBellethorn.Mini.class, new ModelResourceLocation(LibBlockNames.SUBTILE_BELLETHORN + "_chibi"));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileDreadthorn.class, new ModelResourceLocation(LibBlockNames.SUBTILE_DREADTHORN.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileHeiseiDream.class, new ModelResourceLocation(LibBlockNames.SUBTILE_HEISEI_DREAM.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileTigerseye.class, new ModelResourceLocation(LibBlockNames.SUBTILE_TIGERSEYE.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileJadedAmaranthus.class, new ModelResourceLocation(LibBlockNames.SUBTILE_JADED_AMARANTHUS.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileOrechid.class, new ModelResourceLocation(LibBlockNames.SUBTILE_ORECHID.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileOrechidIgnem.class, new ModelResourceLocation(LibBlockNames.SUBTILE_ORECHID_IGNEM.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileFallenKanade.class, new ModelResourceLocation(LibBlockNames.SUBTILE_FALLEN_KANADE.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileExoflame.class, new ModelResourceLocation(LibBlockNames.SUBTILE_EXOFLAME.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileAgricarnation.class, new ModelResourceLocation(LibBlockNames.SUBTILE_AGRICARNATION.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileAgricarnation.Mini.class, new ModelResourceLocation(LibBlockNames.SUBTILE_AGRICARNATION + "_chibi"));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileHopperhock.class, new ModelResourceLocation(LibBlockNames.SUBTILE_HOPPERHOCK.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileHopperhock.Mini.class, new ModelResourceLocation(LibBlockNames.SUBTILE_HOPPERHOCK + "_chibi"));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileTangleberrie.class, new ModelResourceLocation(LibBlockNames.SUBTILE_TANGLEBERRIE.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileJiyuulia.class, new ModelResourceLocation(LibBlockNames.SUBTILE_JIYUULIA.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileRannuncarpus.class, new ModelResourceLocation(LibBlockNames.SUBTILE_RANNUNCARPUS.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileRannuncarpus.Mini.class, new ModelResourceLocation(LibBlockNames.SUBTILE_RANNUNCARPUS + "_chibi"));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileHyacidus.class, new ModelResourceLocation(LibBlockNames.SUBTILE_HYACIDUS.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTilePollidisiac.class, new ModelResourceLocation(LibBlockNames.SUBTILE_POLLIDISIAC.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileClayconia.class, new ModelResourceLocation(LibBlockNames.SUBTILE_CLAYCONIA.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileClayconia.Mini.class, new ModelResourceLocation(LibBlockNames.SUBTILE_CLAYCONIA + "_chibi"));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileLoonuim.class, new ModelResourceLocation(LibBlockNames.SUBTILE_LOONIUM.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileDaffomill.class, new ModelResourceLocation(LibBlockNames.SUBTILE_DAFFOMILL.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileVinculotus.class, new ModelResourceLocation(LibBlockNames.SUBTILE_VINCULOTUS.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileSpectranthemum.class, new ModelResourceLocation(LibBlockNames.SUBTILE_SPECTRANTHEMUM.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileMedumone.class, new ModelResourceLocation(LibBlockNames.SUBTILE_MEDUMONE.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileMarimorphosis.class, new ModelResourceLocation(LibBlockNames.SUBTILE_MARIMORPHOSIS.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileMarimorphosis.Mini.class, new ModelResourceLocation(LibBlockNames.SUBTILE_MARIMORPHOSIS + "_chibi"));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileBubbell.class, new ModelResourceLocation(LibBlockNames.SUBTILE_BUBBELL.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileBubbell.Mini.class, new ModelResourceLocation(LibBlockNames.SUBTILE_BUBBELL + "_chibi"));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileSolegnolia.class, new ModelResourceLocation(LibBlockNames.SUBTILE_SOLEGNOLIA.toString()));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileSolegnolia.Mini.class, new ModelResourceLocation(LibBlockNames.SUBTILE_SOLEGNOLIA + "_chibi"));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileBergamute.class, new ModelResourceLocation(LibBlockNames.SUBTILE_BERGAMUTE.toString()));
|
||||
*/
|
||||
}
|
||||
|
||||
private ModelHandler() {}
|
||||
|
||||
@@ -22,7 +22,6 @@ import mezz.jei.api.runtime.IJeiRuntime;
|
||||
import mezz.jei.api.runtime.IRecipesGui;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
@@ -34,7 +33,6 @@ import vazkii.botania.client.gui.crafting.ContainerCraftingHalo;
|
||||
import vazkii.botania.client.integration.jei.brewery.BreweryRecipeCategory;
|
||||
import vazkii.botania.client.integration.jei.crafting.AncientWillRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.crafting.CompositeLensRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.crafting.SpecialFloatingFlowerWrapper;
|
||||
import vazkii.botania.client.integration.jei.crafting.TerraPickTippingRecipeWrapper;
|
||||
import vazkii.botania.client.integration.jei.elventrade.ElvenTradeRecipeCategory;
|
||||
import vazkii.botania.client.integration.jei.manapool.ManaPoolRecipeCategory;
|
||||
@@ -49,7 +47,6 @@ import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.ModSubtiles;
|
||||
import vazkii.botania.common.crafting.recipe.AncientWillRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.CompositeLensRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.SpecialFloatingFlowerRecipe;
|
||||
import vazkii.botania.common.crafting.recipe.TerraPickTippingRecipe;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
@@ -70,8 +67,6 @@ public class JEIBotaniaPlugin implements IModPlugin {
|
||||
|
||||
@Override
|
||||
public void registerItemSubtypes(@Nonnull ISubtypeRegistration subtypeRegistry) {
|
||||
subtypeRegistry.registerSubtypeInterpreter(ModBlocks.specialFlower.asItem(), stack -> ItemBlockSpecialFlower.getType(stack).toString());
|
||||
subtypeRegistry.registerSubtypeInterpreter(ModBlocks.floatingSpecialFlower.asItem(), stack -> ItemBlockSpecialFlower.getType(stack).toString());
|
||||
subtypeRegistry.registerSubtypeInterpreter(ModItems.brewVial, ItemBrewBase::getSubtype);
|
||||
subtypeRegistry.registerSubtypeInterpreter(ModItems.brewFlask, ItemBrewBase::getSubtype);
|
||||
subtypeRegistry.registerSubtypeInterpreter(ModItems.incenseStick, ItemBrewBase::getSubtype);
|
||||
@@ -98,7 +93,6 @@ public class JEIBotaniaPlugin implements IModPlugin {
|
||||
|
||||
@Override
|
||||
public void registerVanillaCategoryExtensions(IVanillaCategoryExtensionRegistration registration) {
|
||||
registration.getCraftingCategory().addCategoryExtension(SpecialFloatingFlowerRecipe.class, SpecialFloatingFlowerWrapper::new);
|
||||
registration.getCraftingCategory().addCategoryExtension(AncientWillRecipe.class, AncientWillRecipeWrapper::new);
|
||||
registration.getCraftingCategory().addCategoryExtension(TerraPickTippingRecipe.class, TerraPickTippingRecipeWrapper::new);
|
||||
registration.getCraftingCategory().addCategoryExtension(CompositeLensRecipe.class, CompositeLensRecipeWrapper::new);
|
||||
@@ -157,12 +151,12 @@ public class JEIBotaniaPlugin implements IModPlugin {
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.mesaAltar), PetalApothecaryRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.mossyAltar), PetalApothecaryRecipeCategory.UID);
|
||||
|
||||
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(SUBTILE_ORECHID), OrechidRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), ModSubtiles.orechid), OrechidRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(SUBTILE_ORECHID_IGNEM), OrechidIgnemRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), ModSubtiles.orechidIgnem), OrechidIgnemRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(SUBTILE_PUREDAISY), PureDaisyRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), ModSubtiles.pureDaisy), PureDaisyRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(ModSubtiles.orechid, OrechidRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(ModSubtiles.orechidFloating, OrechidRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(ModSubtiles.orechidIgnem, OrechidIgnemRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(ModSubtiles.orechidIgnemFloating, OrechidIgnemRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(ModSubtiles.pureDaisy, PureDaisyRecipeCategory.UID);
|
||||
registry.addRecipeCatalyst(ModSubtiles.pureDaisyFloating, PureDaisyRecipeCategory.UID);
|
||||
|
||||
|
||||
registry.addRecipeCatalyst(new ItemStack(ModBlocks.runeAltar), RunicAltarRecipeCategory.UID);
|
||||
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
package vazkii.botania.client.integration.jei.crafting;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import mezz.jei.api.constants.VanillaTypes;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.category.extensions.vanilla.crafting.ICraftingCategoryExtension;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.crafting.recipe.SpecialFloatingFlowerRecipe;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SpecialFloatingFlowerWrapper implements ICraftingCategoryExtension {
|
||||
private final List<List<ItemStack>> inputs = new ArrayList<>();
|
||||
private final ItemStack output;
|
||||
private final ResourceLocation name;
|
||||
|
||||
public SpecialFloatingFlowerWrapper(SpecialFloatingFlowerRecipe recipe) {
|
||||
name = recipe.getId();
|
||||
inputs.add(ImmutableList.of(ItemBlockSpecialFlower.ofType(recipe.flowerType)));
|
||||
List<ItemStack> normalFloaters = new ArrayList<>();
|
||||
for(EnumDyeColor color : EnumDyeColor.values()) {
|
||||
normalFloaters.add(new ItemStack(ModBlocks.getFloatingFlower(color)));
|
||||
}
|
||||
inputs.add(normalFloaters);
|
||||
output = ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), recipe.flowerType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputLists(VanillaTypes.ITEM, inputs);
|
||||
ingredients.setOutput(VanillaTypes.ITEM, output);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getRegistryName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -18,6 +18,7 @@ import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.common.block.ModSubtiles;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
@@ -39,7 +40,7 @@ public class OrechidIgnemRecipeCategory implements IRecipeCategory<OrechidIgnemR
|
||||
localizedName = I18n.format("botania.nei.orechidIgnem");
|
||||
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pure_daisy_overlay.png"),
|
||||
0, 0, 64, 46);
|
||||
icon = guiHelper.createDrawableIngredient(ItemBlockSpecialFlower.ofType(ModSubtiles.orechidIgnem));
|
||||
icon = guiHelper.createDrawableIngredient(new ItemStack(ModSubtiles.orechidIgnem));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -86,7 +87,7 @@ public class OrechidIgnemRecipeCategory implements IRecipeCategory<OrechidIgnemR
|
||||
itemStacks.set(0, ingredients.getInputs(VanillaTypes.ITEM).get(0));
|
||||
|
||||
itemStacks.init(1, true, 70, 12);
|
||||
itemStacks.set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID_IGNEM));
|
||||
itemStacks.set(1, new ItemStack(ModSubtiles.orechidIgnem));
|
||||
|
||||
itemStacks.init(2, true, 99, 12);
|
||||
itemStacks.set(2, ingredients.getOutputs(VanillaTypes.ITEM).get(0));
|
||||
|
||||
+2
-2
@@ -50,7 +50,7 @@ public class OrechidRecipeCategory implements IRecipeCategory<OrechidRecipeWrapp
|
||||
localizedName = I18n.format("botania.nei.orechid");
|
||||
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pure_daisy_overlay.png"),
|
||||
0, 0, 64, 46);
|
||||
icon = guiHelper.createDrawableIngredient(ItemBlockSpecialFlower.ofType(ModSubtiles.orechid));
|
||||
icon = guiHelper.createDrawableIngredient(new ItemStack(ModSubtiles.orechid));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -118,7 +118,7 @@ public class OrechidRecipeCategory implements IRecipeCategory<OrechidRecipeWrapp
|
||||
itemStacks.set(0, ingredients.getInputs(VanillaTypes.ITEM).get(0));
|
||||
|
||||
itemStacks.init(1, true, 70, 12);
|
||||
itemStacks.set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID));
|
||||
itemStacks.set(1, new ItemStack(ModSubtiles.orechid));
|
||||
|
||||
itemStacks.init(2, true, 99, 12);
|
||||
itemStacks.set(2, ingredients.getOutputs(VanillaTypes.ITEM).get(0));
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ public class PureDaisyRecipeCategory implements IRecipeCategory<RecipePureDaisy>
|
||||
localizedName = I18n.format("botania.nei.pureDaisy");
|
||||
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pure_daisy_overlay.png"),
|
||||
0, 0, 64, 46);
|
||||
icon = guiHelper.createDrawableIngredient(ItemBlockSpecialFlower.ofType(ModSubtiles.pureDaisy));
|
||||
icon = guiHelper.createDrawableIngredient(new ItemStack(ModSubtiles.pureDaisy));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -131,7 +131,7 @@ public class PureDaisyRecipeCategory implements IRecipeCategory<RecipePureDaisy>
|
||||
}
|
||||
|
||||
recipeLayout.getItemStacks().init(1, true, 70, 12);
|
||||
recipeLayout.getItemStacks().set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY));
|
||||
recipeLayout.getItemStacks().set(1, new ItemStack(ModSubtiles.pureDaisy));
|
||||
|
||||
if(outputFluid) {
|
||||
recipeLayout.getFluidStacks().init(2, false, 99, 12, 16, 16, 1000, false, null);
|
||||
|
||||
@@ -41,7 +41,6 @@ import vazkii.botania.api.BotaniaAPIClient;
|
||||
import vazkii.botania.api.item.IFloatingFlower;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.BotaniaRegistries;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.decor.BlockFloatingFlower;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
@@ -92,23 +91,13 @@ public class FloatingFlowerModel implements IBakedModel {
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing face, @Nonnull Random rand) {
|
||||
if(state.getBlock() != ModBlocks.floatingSpecialFlower && !(state.getBlock() instanceof BlockFloatingFlower))
|
||||
if(!(state.getBlock() instanceof BlockFloatingFlower))
|
||||
return Minecraft.getInstance().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel().getQuads(state, face, rand);
|
||||
if(true) // todo 1.13
|
||||
return ImmutableList.of();
|
||||
IExtendedBlockState realState = (IExtendedBlockState) state;
|
||||
IFloatingFlower.IslandType islandType = realState.getValue(BotaniaStateProps.ISLAND_TYPE);
|
||||
ResourceLocation identifier;
|
||||
|
||||
if(state.getBlock() == ModBlocks.floatingSpecialFlower) {
|
||||
// Magic flower
|
||||
identifier = realState.getValue(BotaniaStateProps.SUBTILE_ID);
|
||||
} else {
|
||||
// Mundane flower
|
||||
identifier = state.getBlock().getRegistryName();
|
||||
}
|
||||
|
||||
return getModel(islandType, identifier).getQuads(state, face, rand);
|
||||
return getModel(islandType, state.getBlock().getRegistryName()).getQuads(state, face, rand);
|
||||
}
|
||||
|
||||
// Get the model for this islandtype + flower type combination. If it's not cached already, generate it.
|
||||
@@ -131,17 +120,15 @@ public class FloatingFlowerModel implements IBakedModel {
|
||||
islandModel = modelManager.getMissingModel();
|
||||
}
|
||||
|
||||
IBakedModel flowerModel;
|
||||
Item item;
|
||||
|
||||
if(identifier.getPath().endsWith(LibBlockNames.FLOATING_FLOWER_SUFFIX)) {
|
||||
ResourceLocation shinyId = new ResourceLocation(identifier.getNamespace(), identifier.getPath().replaceAll(LibBlockNames.FLOATING_FLOWER_SUFFIX, LibBlockNames.SHINY_FLOWER_SUFFIX));
|
||||
Item shinyFlower = ForgeRegistries.ITEMS.getValue(shinyId);
|
||||
flowerModel = Minecraft.getInstance().getItemRenderer().getItemModelMesher().getItemModel(new ItemStack(shinyFlower));
|
||||
item = ForgeRegistries.ITEMS.getValue(shinyId);
|
||||
} else {
|
||||
ItemStack stack = ItemBlockSpecialFlower.ofType(BotaniaRegistries.SUBTILES.getValue(identifier));
|
||||
IBakedModel specialFlowerModel = Minecraft.getInstance().getItemRenderer().getItemModelMesher().getItemModel(stack);
|
||||
flowerModel = specialFlowerModel.getOverrides().getModelWithOverrides(specialFlowerModel, stack, null, null);
|
||||
item = ForgeRegistries.ITEMS.getValue(identifier);
|
||||
}
|
||||
IBakedModel flowerModel = Minecraft.getInstance().getItemRenderer().getItemModelMesher().getItemModel(new ItemStack(item));
|
||||
|
||||
// Enhance!
|
||||
CompositeBakedModel model = new CompositeBakedModel(flowerModel, islandModel);
|
||||
@@ -232,17 +219,7 @@ public class FloatingFlowerModel implements IBakedModel {
|
||||
public IBakedModel getModelWithOverrides(IBakedModel model, ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
|
||||
// Items always have GRASS island
|
||||
IFloatingFlower.IslandType islandType = IFloatingFlower.IslandType.GRASS;
|
||||
ResourceLocation identifier;
|
||||
|
||||
if(Block.getBlockFromItem(stack.getItem()) == ModBlocks.floatingSpecialFlower) {
|
||||
// Magic flower
|
||||
identifier = ItemBlockSpecialFlower.getType(stack).getRegistryName();
|
||||
} else {
|
||||
// Mundane flower
|
||||
identifier = stack.getItem().getRegistryName();
|
||||
}
|
||||
|
||||
return FloatingFlowerModel.this.getModel(islandType, identifier);
|
||||
return FloatingFlowerModel.this.getModel(islandType, stack.getItem().getRegistryName());
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,240 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ICustomModelLoader;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.client.model.PerspectiveMapWrapper;
|
||||
import net.minecraftforge.client.model.SimpleModelState;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.BotaniaAPIClient;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.vecmath.Matrix4f;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class SpecialFlowerModel implements IUnbakedModel {
|
||||
private static final ModelResourceLocation MISSING = new ModelResourceLocation("builtin/missing", "missing");
|
||||
private final ModelResourceLocation baseModel;
|
||||
private final ImmutableMap<ResourceLocation, ModelResourceLocation> blockModels;
|
||||
private final ImmutableMap<ResourceLocation, ModelResourceLocation> itemModels;
|
||||
|
||||
private SpecialFlowerModel(ModelResourceLocation baseModel,
|
||||
ImmutableMap<ResourceLocation, ModelResourceLocation> blockModels,
|
||||
ImmutableMap<ResourceLocation, ModelResourceLocation> itemModels) {
|
||||
this.baseModel = baseModel;
|
||||
this.blockModels = blockModels;
|
||||
this.itemModels = itemModels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getDependencies() {
|
||||
ImmutableSet.Builder<ResourceLocation> builder = ImmutableSet.builder();
|
||||
if(!MISSING.equals(baseModel))
|
||||
builder.add(baseModel);
|
||||
builder.addAll(blockModels.values());
|
||||
builder.addAll(itemModels.values());
|
||||
|
||||
// Force island models to be loaded and baked. See FloatingFlowerModel.
|
||||
builder.addAll(BotaniaAPIClient.getRegisteredIslandTypeModels().values());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<String> errors) {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> spriteGetter, IModelState state, boolean uvlock, VertexFormat format) {
|
||||
ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms = PerspectiveMapWrapper.getTransforms(state);
|
||||
IModelState transformState = new SimpleModelState(transforms);
|
||||
|
||||
IBakedModel baseModelBaked = ModelLoaderRegistry.getModelOrMissing(baseModel)
|
||||
.bake(modelGetter, spriteGetter, state, uvlock, format);
|
||||
|
||||
ImmutableMap.Builder<ResourceLocation, IBakedModel> bakedBlockBuilder = ImmutableMap.builder();
|
||||
for(Map.Entry<ResourceLocation, ModelResourceLocation> e : blockModels.entrySet()) {
|
||||
IModel model = ModelLoaderRegistry.getModelOrMissing(e.getValue());
|
||||
if(model != ModelLoaderRegistry.getMissingModel())
|
||||
bakedBlockBuilder.put(e.getKey(), model.bake(modelGetter, spriteGetter, state, uvlock, format));
|
||||
}
|
||||
|
||||
ImmutableMap.Builder<ResourceLocation, IBakedModel> bakedItemBuilder = ImmutableMap.builder();
|
||||
for(Map.Entry<ResourceLocation, ModelResourceLocation> e : itemModels.entrySet()) {
|
||||
IModel model = ModelLoaderRegistry.getModelOrMissing(e.getValue());
|
||||
if(model != ModelLoaderRegistry.getMissingModel())
|
||||
bakedItemBuilder.put(e.getKey(), model.bake(modelGetter, spriteGetter, state, uvlock, format));
|
||||
}
|
||||
|
||||
return new SpecialFlowerBakedModel(baseModelBaked, bakedBlockBuilder.build(), bakedItemBuilder.build(), transforms);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModelState getDefaultState() {
|
||||
return TRSRTransformation.identity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IUnbakedModel process(ImmutableMap<String, String> customData) {
|
||||
// Load the base variant from blockstate json, and also add all the model paths we received from external API
|
||||
|
||||
ModelResourceLocation base = baseModel;
|
||||
if(customData.containsKey("base"))
|
||||
// Forge blockstate gives custom data in json form, have to drop the quotes
|
||||
base = new ModelResourceLocation(customData.get("base").substring(1, customData.get("base").length() - 1));
|
||||
|
||||
ImmutableMap<ResourceLocation, ModelResourceLocation> blockModels = ImmutableMap.copyOf(BotaniaAPIClient.getRegisteredSubtileBlockModels());
|
||||
ImmutableMap<ResourceLocation, ModelResourceLocation> itemModels = ImmutableMap.copyOf(BotaniaAPIClient.getRegisteredSubtileItemModels());
|
||||
return new SpecialFlowerModel(base, blockModels, itemModels);
|
||||
}
|
||||
|
||||
public enum Loader implements ICustomModelLoader {
|
||||
INSTANCE {
|
||||
@Override
|
||||
public void onResourceManagerReload(@Nonnull IResourceManager resourceManager) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accepts(ResourceLocation modelLocation) {
|
||||
return modelLocation.getNamespace().equals("botania_special") && (
|
||||
modelLocation.getPath().equals("specialflower") ||
|
||||
modelLocation.getPath().equals("models/block/specialflower") ||
|
||||
modelLocation.getPath().equals("models/item/specialflower"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IUnbakedModel loadModel(ResourceLocation modelLocation) {
|
||||
// Load a dummy model for now, all actual blockModels added in process().
|
||||
return new SpecialFlowerModel(new ModelResourceLocation("builtin/missing", "missing"), ImmutableMap.of(), ImmutableMap.of());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class SpecialFlowerBakedModel implements IBakedModel {
|
||||
private final IBakedModel baseModel;
|
||||
private final ImmutableMap<ResourceLocation, IBakedModel> bakedBlockModels;
|
||||
private final ImmutableMap<ResourceLocation, IBakedModel> bakedItemModels;
|
||||
private final ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms;
|
||||
|
||||
SpecialFlowerBakedModel(IBakedModel baseModel,
|
||||
ImmutableMap<ResourceLocation, IBakedModel> bakedBlockModels,
|
||||
ImmutableMap<ResourceLocation, IBakedModel> bakedItemModels,
|
||||
ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> cameraTransforms) {
|
||||
this.baseModel = baseModel;
|
||||
this.bakedBlockModels = bakedBlockModels;
|
||||
this.bakedItemModels = bakedItemModels;
|
||||
this.transforms = cameraTransforms;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing face, Random rand) {
|
||||
IExtendedBlockState extendedState = (IExtendedBlockState) state;
|
||||
ResourceLocation subtileId = extendedState.getValue(BotaniaStateProps.SUBTILE_ID);
|
||||
|
||||
IBakedModel model = bakedBlockModels.get(subtileId == null ? BotaniaAPI.DUMMY_SUBTILE_NAME : subtileId);
|
||||
if(model == null)
|
||||
model = Minecraft.getInstance().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
|
||||
|
||||
return model.getQuads(state, face, rand);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemOverrideList getOverrides() {
|
||||
return itemHandler;
|
||||
}
|
||||
|
||||
private final ItemStack roseFallback = new ItemStack(Blocks.POPPY);
|
||||
|
||||
private final ItemOverrideList itemHandler = new ItemOverrideList() {
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBakedModel getModelWithOverrides(@Nonnull IBakedModel original, ItemStack stack, World world, EntityLivingBase living) {
|
||||
IBakedModel model = bakedItemModels.get(ItemBlockSpecialFlower.getType(stack));
|
||||
|
||||
if(model == null)
|
||||
model = bakedBlockModels.get(ItemBlockSpecialFlower.getType(stack));
|
||||
if(model == null)
|
||||
model = Minecraft.getInstance().getItemRenderer().getItemModelMesher().getItemModel(roseFallback);
|
||||
|
||||
return model;
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion() {
|
||||
return baseModel.isAmbientOcclusion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGui3d() {
|
||||
return baseModel.isGui3d();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltInRenderer() {
|
||||
return baseModel.isBuiltInRenderer();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
return baseModel.getParticleTexture();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemCameraTransforms getItemCameraTransforms() {
|
||||
return baseModel.getItemCameraTransforms();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
|
||||
return PerspectiveMapWrapper.handlePerspective(this, transforms, cameraTransformType);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,6 +19,9 @@ import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.item.IFloatingFlower;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
|
||||
@@ -29,14 +32,11 @@ public class RenderTileFloatingFlower extends TileEntityRenderer {
|
||||
|
||||
@Override
|
||||
public void render(@Nonnull TileEntity tile, double d0, double d1, double d2, float t, int digProgress) {
|
||||
if(ConfigHandler.CLIENT.staticFloaters.get())
|
||||
LazyOptional<IFloatingFlower> floatingOpt = tile.getCapability(BotaniaAPI.FLOATING_FLOWER_CAP);
|
||||
if(!floatingOpt.isPresent())
|
||||
return;
|
||||
|
||||
if (tile != null)
|
||||
if (!tile.getWorld().isBlockLoaded(tile.getPos(), false))
|
||||
return;
|
||||
|
||||
|
||||
IFloatingFlower floatingData = floatingOpt.orElseThrow(NullPointerException::new);
|
||||
BlockRendererDispatcher brd = Minecraft.getInstance().getBlockRendererDispatcher();
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
@@ -54,10 +54,12 @@ public class RenderTileFloatingFlower extends TileEntityRenderer {
|
||||
|
||||
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
|
||||
/* todo 1.13
|
||||
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
|
||||
state = state.getBlock().getExtendedState(state, tile.getWorld(), tile.getPos());
|
||||
IBakedModel model = brd.getBlockModelShapes().getModelManager().getModel(new ModelResourceLocation("botania:floating_special_flower", "inventory"));
|
||||
brd.getBlockModelRenderer().renderModelBrightness(model, state, 1.0F, true);
|
||||
*/
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
|
||||
Reference in new issue
Block a user