Merge master

This commit is contained in:
Vincent Lee committed 2019-01-16 14:46:30 -06:00
commit eaaa55fdb0
254 files changed
+8593 -1893

No files matched your search

@@ -13,11 +13,13 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.registries.IRegistryDelegate;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.brew.Brew;
import vazkii.botania.api.brew.IBrewItem;
import vazkii.botania.api.mana.BurstProperties;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.BlockCamo;
@@ -152,8 +154,8 @@ public final class ColorHandler {
return Minecraft.getMinecraft().getItemColors().colorMultiplier(lens, t);
if(t == 2) {
EntityManaBurst burst = ((ItemManaGun) s.getItem()).getBurst(Minecraft.getMinecraft().player, s, false);
Color color = new Color(burst == null ? 0x20FF20 : burst.getColor());
BurstProperties props = ((ItemManaGun) s.getItem()).getBurstProps(Minecraft.getMinecraft().player, s, false, EnumHand.MAIN_HAND);
Color color = new Color(props.color);
float mul = (float) (Math.sin((double) ClientTickHandler.ticksInGame / 5) * 0.15F);
int c = (int) (255 * mul);
@@ -0,0 +1,82 @@
/**
* This class was created by <Hubry>. 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
* <p>
* File Created @ [July 04, 2018, 19:16:14 (GMT)]
*/
package vazkii.botania.client.core.handler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import org.lwjgl.input.Keyboard;
import vazkii.botania.api.corporea.CorporeaHelper;
import vazkii.botania.client.core.proxy.ClientProxy;
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
import vazkii.botania.common.lib.LibMisc;
import java.util.function.Predicate;
import java.util.function.Supplier;
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID, value = Side.CLIENT)
public class CorporeaInputHandler {
/** Replaced in JEIBotaniaPlugin when JEI's loaded to provide stacks from the JEI item panel. */
public static Supplier<ItemStack> jeiPanelSupplier = () -> ItemStack.EMPTY;
/** Filter for usable guis to handle requests. Added to in JEIBotaniaPlugin */
public static Predicate<GuiScreen> supportedGuiFilter = gui -> gui instanceof GuiContainer;
@SubscribeEvent
public static void buttonPressed(KeyboardInputEvent.Post event) {
Minecraft mc = Minecraft.getMinecraft();
if(mc.world == null || !supportedGuiFilter.test(mc.currentScreen)
|| Keyboard.getEventKey() != ClientProxy.CORPOREA_REQUEST.getKeyCode()
|| !Keyboard.getEventKeyState()
|| Keyboard.isRepeatEvent()
|| TileCorporeaIndex.InputHandler.getNearbyIndexes(mc.player).isEmpty())
return;
ItemStack stack = getStackUnderMouse();
if(stack != null && !stack.isEmpty()) {
int count = 1;
int max = stack.getMaxStackSize();
if(GuiScreen.isShiftKeyDown()) {
count = max;
if(GuiScreen.isCtrlKeyDown())
count /= 4;
} else if(GuiScreen.isCtrlKeyDown())
count = max / 2;
if(count > 0) {
String name = CorporeaHelper.stripControlCodes(stack.getDisplayName());
String full = count + " " + name;
mc.ingameGUI.getChatGUI().addToSentMessages(full);
mc.player.sendChatMessage(full);
event.setCanceled(true);
}
}
}
private static ItemStack getStackUnderMouse() {
GuiScreen screen = Minecraft.getMinecraft().currentScreen;
if(screen instanceof GuiContainer) {
Slot slotUnderMouse = ((GuiContainer) screen).getSlotUnderMouse();
if(slotUnderMouse != null)
return slotUnderMouse.getStack();
}
return jeiPanelSupplier.get();
}
}
@@ -18,7 +18,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
@@ -35,7 +34,6 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
@@ -71,7 +69,6 @@ import vazkii.botania.common.item.equipment.bauble.ItemDodgeRing;
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
import vazkii.botania.common.item.equipment.bauble.ItemMonocle;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.lib.LibObfuscation;
import java.awt.Color;
import java.util.List;
@@ -88,7 +85,7 @@ public final class HUDHandler {
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void onDrawScreenPre(RenderGameOverlayEvent.Pre event) {
Minecraft mc = Minecraft.getMinecraft();
Profiler profiler = mc.mcProfiler;
Profiler profiler = mc.profiler;
if(event.getType() == ElementType.HEALTH) {
profiler.startSection("botania-hud");
@@ -120,7 +117,7 @@ public final class HUDHandler {
@SubscribeEvent
public static void onDrawScreenPost(RenderGameOverlayEvent.Post event) {
Minecraft mc = Minecraft.getMinecraft();
Profiler profiler = mc.mcProfiler;
Profiler profiler = mc.profiler;
ItemStack main = mc.player.getHeldItemMainhand();
ItemStack offhand = mc.player.getHeldItemOffhand();
@@ -265,7 +262,7 @@ public final class HUDHandler {
private static void renderWandModeDisplay(ItemStack stack, ScaledResolution res) {
Minecraft mc = Minecraft.getMinecraft();
Profiler profiler = mc.mcProfiler;
Profiler profiler = mc.profiler;
profiler.startSection("wandMode");
int ticks = mc.ingameGUI.remainingHighlightTicks;
@@ -317,7 +314,7 @@ public final class HUDHandler {
private static void renderPoolRecipeHUD(ScaledResolution res, TilePool tile, ItemStack stack) {
Minecraft mc = Minecraft.getMinecraft();
Profiler profiler = mc.mcProfiler;
Profiler profiler = mc.profiler;
profiler.startSection("poolRecipe");
RecipeManaInfusion recipe = TilePool.getMatchingRecipe(stack, tile.getWorld().getBlockState(tile.getPos().down()));
@@ -349,7 +346,7 @@ public final class HUDHandler {
private static void renderCrystalCubeHUD(ScaledResolution res, TileCorporeaCrystalCube tile) {
Minecraft mc = Minecraft.getMinecraft();
Profiler profiler = mc.mcProfiler;
Profiler profiler = mc.profiler;
profiler.startSection("crystalCube");
ItemStack target = tile.getRequestTarget();
@@ -376,7 +373,7 @@ public final class HUDHandler {
private static void drawLexiconHUD(ItemStack stack, IBlockState state, RayTraceResult pos, ScaledResolution res) {
Minecraft mc = Minecraft.getMinecraft();
Block block = state.getBlock();
Profiler profiler = mc.mcProfiler;
Profiler profiler = mc.profiler;
profiler.startSection("lexicon");
FontRenderer font = mc.fontRenderer;
@@ -401,7 +398,7 @@ public final class HUDHandler {
}
}
if(!draw && pos.entityHit == null) {
if(!ConfigHandler.lexicaOfflineMode && !draw && pos.entityHit == null) {
profiler.startSection("wikiLookup");
if(!block.isAir(state, mc.world, pos.getBlockPos()) && !(block instanceof BlockLiquid)) {
IWikiProvider provider = WikiHooks.getWikiFor(block);
@@ -111,7 +111,7 @@ public final class ItemsRemainingRenderHandler {
int count = 0;
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack stack = player.inventory.getStackInSlot(i);
if(!stack.isEmpty() && pattern.matcher(stack.getUnlocalizedName()).find())
if(!stack.isEmpty() && pattern.matcher(stack.getTranslationKey()).find())
count += stack.getCount();
}
@@ -43,7 +43,7 @@ public class LightningHandler {
@SubscribeEvent
public static void onRenderWorldLast(RenderWorldLastEvent event) {
Profiler profiler = Minecraft.getMinecraft().mcProfiler;
Profiler profiler = Minecraft.getMinecraft().profiler;
profiler.startSection("botania-particles");
ParticleRenderDispatcher.dispatch();
@@ -14,14 +14,19 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.apache.commons.lang3.text.WordUtils;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.client.model.FloatingFlowerModel;
import vazkii.botania.client.model.GunModel;
import vazkii.botania.client.model.LexiconModel;
import vazkii.botania.client.model.PlatformModel;
import vazkii.botania.common.integration.buildcraft.TriggerManaLevel;
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
import vazkii.botania.common.item.relic.ItemKingKey;
import java.util.EnumMap;
import java.util.Map;
public class MiscellaneousIcons {
public static final MiscellaneousIcons INSTANCE = new MiscellaneousIcons();
@@ -48,7 +53,7 @@ public class MiscellaneousIcons {
public TextureAtlasSprite[] sparkUpgradeIcons;
public TextureAtlasSprite[] kingKeyWeaponIcons;
// todo buildcraft public final Map<TriggerManaLevel.State, TextureAtlasSprite> manaLevelTriggerIcons = Maps.newEnumMap(TriggerManaLevel.State.class);
public final Map<TriggerManaLevel.State, TextureAtlasSprite> manaLevelTriggerIcons = new EnumMap<>(TriggerManaLevel.State.class);
public TextureAtlasSprite[] tiaraWingIcons;
public TextureAtlasSprite[] thirdEyeLayers;
@@ -146,9 +151,9 @@ public class MiscellaneousIcons {
manaDetectorIcon = IconHelper.forName(evt.getMap(), "triggers/manaDetector", "items");
runeAltarTriggerIcon = IconHelper.forName(evt.getMap(), "triggers/runeAltarCanCraft", "items");
/*for (TriggerManaLevel.State s : TriggerManaLevel.State.values()) { todo buildcraft
for (TriggerManaLevel.State s : TriggerManaLevel.State.values()) {
manaLevelTriggerIcons.put(s, IconHelper.forName(evt.getMap(), "triggers/mana" + WordUtils.capitalizeFully(s.name()), "items"));
}*/
}
tiaraWingIcons = new TextureAtlasSprite[ItemFlightTiara.WING_TYPES];
for (int i = 0; i < tiaraWingIcons.length; i++) {
@@ -135,7 +135,7 @@ public final class ModelHandler {
}
public static void registerItemAllMeta(Item item, int range) {
registerItemMetas(item, range, i -> item.getRegistryName().getResourcePath());
registerItemMetas(item, range, i -> item.getRegistryName().getPath());
}
public static void registerItemAppendMeta(Item item, int maxExclusive, String loc) {
@@ -106,9 +106,9 @@ public final class RedStringRenderer {
double freq = 20;
double ampl = (0.15 * (Math.sin(l * 2F) * 0.5 + 0.5) + 0.1) * sizeAlpha;
double randMul = 0.05;
double x = xpos + Math.sin(l * freq) * ampl * Math.abs(Math.abs(dir.getFrontOffsetX()) - 1) + rand * randMul;
double y = ypos + Math.cos(l * freq) * ampl * Math.abs(Math.abs(dir.getFrontOffsetY()) - 1) + rand * randMul;
double z = zpos + (dir.getFrontOffsetY() == 0 ? Math.sin(l * freq) : Math.cos(l * freq)) * ampl * Math.abs(Math.abs(dir.getFrontOffsetZ()) - 1) + rand * randMul;
double x = xpos + Math.sin(l * freq) * ampl * Math.abs(Math.abs(dir.getXOffset()) - 1) + rand * randMul;
double y = ypos + Math.cos(l * freq) * ampl * Math.abs(Math.abs(dir.getYOffset()) - 1) + rand * randMul;
double z = zpos + (dir.getYOffset() == 0 ? Math.sin(l * freq) : Math.cos(l * freq)) * ampl * Math.abs(Math.abs(dir.getZOffset()) - 1) + rand * randMul;
tess.getBuffer().pos(x, y, z).endVertex();
}
@@ -64,7 +64,7 @@ public final class TooltipAdditionDisplayHandler {
drawManaBar(stack, (IManaTooltipDisplay) stack.getItem(), tooltipX, tooltipY, width, height);
EntryData data = LexiconRecipeMappings.getDataForStack(stack);
if(data != null) {
if(mc.player != null && data != null) {
int lexSlot = -1;
ItemStack lexiconStack = ItemStack.EMPTY;
@@ -18,6 +18,7 @@ import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -26,6 +27,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.client.model.animation.AnimationTESR;
import net.minecraftforge.client.settings.KeyConflictContext;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
@@ -34,6 +36,7 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.relauncher.Side;
import org.lwjgl.input.Keyboard;
import vazkii.botania.api.boss.IBotaniaBoss;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.multiblock.IMultiblockRenderHook;
@@ -102,6 +105,7 @@ import vazkii.botania.common.item.ItemSextant.MultiblockSextant;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.bauble.ItemMonocle;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
import java.awt.Desktop;
import java.io.File;
@@ -132,9 +136,11 @@ public class ClientProxy implements IProxy {
EMPTY_MODEL.setVisible(false);
}
public static final KeyBinding CORPOREA_REQUEST = new KeyBinding("nei.options.keys.gui.botania_corporea_request", KeyConflictContext.GUI, Keyboard.KEY_C, LibMisc.MOD_NAME);
@Override
public void preInit(FMLPreInitializationEvent event) {
PersistentVariableHelper.setCacheFile(new File(Minecraft.getMinecraft().mcDataDir, "BotaniaVars.dat"));
PersistentVariableHelper.setCacheFile(new File(Minecraft.getMinecraft().gameDir, "BotaniaVars.dat"));
try {
PersistentVariableHelper.load();
PersistentVariableHelper.save();
@@ -170,6 +176,8 @@ public class ClientProxy implements IProxy {
}
TileEntityItemStackRenderer.instance = new RenderTilePylon.ForwardingTEISR(TileEntityItemStackRenderer.instance);
ClientRegistry.registerKeyBinding(ClientProxy.CORPOREA_REQUEST);
}
@Override
@@ -277,6 +285,8 @@ public class ClientProxy implements IProxy {
@Override
public boolean openWikiPage(World world, Block block, RayTraceResult pos) {
if(ConfigHandler.lexicaOfflineMode)
return false;
IWikiProvider wiki = WikiHooks.getWikiFor(block);
String url = wiki.getWikiURL(world, pos, Minecraft.getMinecraft().player);
if(url != null && !url.isEmpty()) {
@@ -30,7 +30,7 @@ public final class ParticleRenderDispatcher {
public static void dispatch() {
Tessellator tessellator = Tessellator.getInstance();
Profiler profiler = Minecraft.getMinecraft().mcProfiler;
Profiler profiler = Minecraft.getMinecraft().profiler;
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
GlStateManager.depthMask(false);
@@ -8,14 +8,20 @@
*/
package vazkii.botania.client.integration.jei;
import mezz.jei.api.IJeiRuntime;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.IModRegistry;
import mezz.jei.api.IRecipesGui;
import mezz.jei.api.ISubtypeRegistry;
import mezz.jei.api.JEIPlugin;
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipeBrew;
import vazkii.botania.api.recipe.RecipeElvenTrade;
@@ -23,6 +29,7 @@ import vazkii.botania.api.recipe.RecipeManaInfusion;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.api.recipe.RecipePureDaisy;
import vazkii.botania.api.recipe.RecipeRuneAltar;
import vazkii.botania.client.core.handler.CorporeaInputHandler;
import vazkii.botania.client.gui.crafting.ContainerCraftingHalo;
import vazkii.botania.client.integration.jei.brewery.BreweryRecipeCategory;
import vazkii.botania.client.integration.jei.brewery.BreweryRecipeWrapper;
@@ -31,6 +38,10 @@ import vazkii.botania.client.integration.jei.elventrade.ElvenTradeRecipeCategory
import vazkii.botania.client.integration.jei.elventrade.ElvenTradeRecipeWrapper;
import vazkii.botania.client.integration.jei.manapool.ManaPoolRecipeCategory;
import vazkii.botania.client.integration.jei.manapool.ManaPoolRecipeWrapper;
import vazkii.botania.client.integration.jei.orechid.OrechidIgnemRecipeCategory;
import vazkii.botania.client.integration.jei.orechid.OrechidIgnemRecipeWrapper;
import vazkii.botania.client.integration.jei.orechid.OrechidRecipeCategory;
import vazkii.botania.client.integration.jei.orechid.OrechidRecipeWrapper;
import vazkii.botania.client.integration.jei.petalapothecary.PetalApothecaryRecipeCategory;
import vazkii.botania.client.integration.jei.petalapothecary.PetalApothecaryRecipeWrapper;
import vazkii.botania.client.integration.jei.puredaisy.PureDaisyRecipeCategory;
@@ -42,8 +53,14 @@ import vazkii.botania.common.crafting.recipe.SpecialFloatingFlowerRecipe;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.item.brew.ItemBrewBase;
import javax.annotation.Nonnull;
import java.util.stream.Collectors;
import static vazkii.botania.common.lib.LibBlockNames.SUBTILE_ORECHID;
import static vazkii.botania.common.lib.LibBlockNames.SUBTILE_ORECHID_IGNEM;
import static vazkii.botania.common.lib.LibBlockNames.SUBTILE_PUREDAISY;
@JEIPlugin
public class JEIBotaniaPlugin implements IModPlugin {
@@ -52,6 +69,10 @@ public class JEIBotaniaPlugin implements IModPlugin {
public void registerItemSubtypes(@Nonnull ISubtypeRegistry subtypeRegistry) {
subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(ModBlocks.specialFlower), stack -> ItemBlockSpecialFlower.getType(stack).toString());
subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(ModBlocks.floatingSpecialFlower), stack -> ItemBlockSpecialFlower.getType(stack).toString());
subtypeRegistry.registerSubtypeInterpreter(ModItems.brewVial, ItemBrewBase::getSubtype);
subtypeRegistry.registerSubtypeInterpreter(ModItems.brewFlask, ItemBrewBase::getSubtype);
subtypeRegistry.registerSubtypeInterpreter(ModItems.incenseStick, ItemBrewBase::getSubtype);
subtypeRegistry.registerSubtypeInterpreter(ModItems.bloodPendant, ItemBrewBase::getSubtype);
}
@Override
@@ -62,8 +83,16 @@ public class JEIBotaniaPlugin implements IModPlugin {
new RunicAltarRecipeCategory(registry.getJeiHelpers().getGuiHelper()), // Runic must come before petals. See williewillus/Botania#172
new PetalApothecaryRecipeCategory(registry.getJeiHelpers().getGuiHelper()),
new ElvenTradeRecipeCategory(registry.getJeiHelpers().getGuiHelper()),
new ManaPoolRecipeCategory(registry.getJeiHelpers().getGuiHelper())
);
new ManaPoolRecipeCategory(registry.getJeiHelpers().getGuiHelper()),
new OrechidRecipeCategory(registry.getJeiHelpers().getGuiHelper()),
new OrechidIgnemRecipeCategory(registry.getJeiHelpers().getGuiHelper())
);
}
public static boolean doesOreExist(String key) {
return OreDictionary.doesOreNameExist(key)
&& OreDictionary.getOres(key).stream()
.anyMatch(s -> s.getItem() instanceof ItemBlock);
}
@Override
@@ -83,6 +112,23 @@ public class JEIBotaniaPlugin implements IModPlugin {
registry.addRecipes(BotaniaAPI.runeAltarRecipes, RunicAltarRecipeCategory.UID);
registry.addRecipes(BotaniaAPI.manaInfusionRecipes, ManaPoolRecipeCategory.UID);
registry.addRecipes(
BotaniaAPI.oreWeights.entrySet().stream()
.filter(e -> doesOreExist(e.getKey()))
.map(OrechidRecipeWrapper::new)
.sorted()
.collect(Collectors.toList()),
OrechidRecipeCategory.UID);
registry.addRecipes(
BotaniaAPI.oreWeightsNether.entrySet().stream()
.filter(e -> doesOreExist(e.getKey()))
.map(OrechidIgnemRecipeWrapper::new)
.sorted()
.collect(Collectors.toList()),
OrechidIgnemRecipeCategory.UID);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.brewery), BreweryRecipeCategory.UID);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.alfPortal), ElvenTradeRecipeCategory.UID);
@@ -102,8 +148,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(LibBlockNames.SUBTILE_PUREDAISY), PureDaisyRecipeCategory.UID);
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), LibBlockNames.SUBTILE_PUREDAISY), PureDaisyRecipeCategory.UID);
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(SUBTILE_ORECHID), OrechidRecipeCategory.UID);
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), SUBTILE_ORECHID), OrechidRecipeCategory.UID);
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(SUBTILE_ORECHID_IGNEM), OrechidIgnemRecipeCategory.UID);
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), SUBTILE_ORECHID_IGNEM), OrechidIgnemRecipeCategory.UID);
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(SUBTILE_PUREDAISY), PureDaisyRecipeCategory.UID);
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), SUBTILE_PUREDAISY), PureDaisyRecipeCategory.UID);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.runeAltar), RunicAltarRecipeCategory.UID);
@@ -113,4 +163,20 @@ public class JEIBotaniaPlugin implements IModPlugin {
registry.getRecipeTransferRegistry().addRecipeTransferHandler(ContainerCraftingHalo.class, VanillaRecipeCategoryUid.CRAFTING, 1, 9, 10, 36);
}
@Override
public void onRuntimeAvailable(IJeiRuntime jeiRuntime) {
CorporeaInputHandler.jeiPanelSupplier = () -> {
Object o = jeiRuntime.getIngredientListOverlay().getIngredientUnderMouse();
if(o == null && Minecraft.getMinecraft().currentScreen == jeiRuntime.getRecipesGui())
o = jeiRuntime.getRecipesGui().getIngredientUnderMouse();
if(o instanceof ItemStack)
return (ItemStack) o;
return ItemStack.EMPTY;
};
CorporeaInputHandler.supportedGuiFilter = gui -> gui instanceof GuiContainer || gui instanceof IRecipesGui;
}
}
@@ -13,17 +13,16 @@ import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IDrawableStatic;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IFocus;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class BreweryRecipeCategory implements IRecipeCategory {
@@ -68,9 +67,11 @@ public class BreweryRecipeCategory implements IRecipeCategory {
return;
List<List<ItemStack>> inputs = ingredients.getInputs(ItemStack.class);
List<List<ItemStack>> outputs = ingredients.getOutputs(ItemStack.class);
IFocus<?> focus = recipeLayout.getFocus();
recipeLayout.getItemStacks().init(0, true, 39, 41);
recipeLayout.getItemStacks().set(0, inputs.get(0));
recipeLayout.getItemStacks().set(0, getItemMatchingFocus(focus, IFocus.Mode.OUTPUT, outputs.get(0), inputs.get(0)));
int index = 1, posX = 60;
for(int i = 1; i < inputs.size(); i++) {
@@ -82,6 +83,19 @@ public class BreweryRecipeCategory implements IRecipeCategory {
}
recipeLayout.getItemStacks().init(7, false, 87, 41);
recipeLayout.getItemStacks().set(7, ingredients.getOutputs(ItemStack.class).get(0));
recipeLayout.getItemStacks().set(7, getItemMatchingFocus(focus, IFocus.Mode.INPUT, inputs.get(0), outputs.get(0)));
}
/**
* If an item in this recipe is focused, returns the corresponding item instead of all the containers/results.
*/
private List<ItemStack> getItemMatchingFocus(IFocus<?> focus, IFocus.Mode mode, List<ItemStack> focused, List<ItemStack> other) {
if(focus != null && focus.getMode() == mode) {
ItemStack focusStack = (ItemStack) focus.getValue();
for(int i = 0; i < focused.size(); i++)
if(focusStack.isItemEqual(focused.get(i)))
return Collections.singletonList(other.get(i));
}
return other;
}
}
@@ -11,35 +11,48 @@ package vazkii.botania.client.integration.jei.brewery;
import com.google.common.collect.ImmutableList;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import vazkii.botania.api.recipe.RecipeBrew;
import vazkii.botania.common.item.ModItems;
import javax.annotation.Nonnull;
import java.util.Arrays;
import java.util.List;
public class BreweryRecipeWrapper implements IRecipeWrapper {
private final List<List<ItemStack>> input;
private final List<ItemStack> output;
private static final List<ItemStack> inputs = Arrays.asList(new ItemStack(ModItems.vial),
new ItemStack(ModItems.flask), new ItemStack(ModItems.incenseStick), new ItemStack(ModItems.bloodPendant));
@SuppressWarnings("unchecked")
public BreweryRecipeWrapper(RecipeBrew recipeBrew) {
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
builder.add(ImmutableList.of(new ItemStack(ModItems.vial), new ItemStack(ModItems.flask)));
ImmutableList.Builder<List<ItemStack>> inputBuilder = ImmutableList.builder();
ImmutableList.Builder<ItemStack> outputBuilder = ImmutableList.builder();
ImmutableList.Builder<ItemStack> containers = ImmutableList.builder();
for(ItemStack stack : inputs) {
ItemStack brewed = recipeBrew.getOutput(stack);
if(!brewed.isEmpty()) {
containers.add(stack);
outputBuilder.add(brewed);
}
}
inputBuilder.add(containers.build());
for(Object o : recipeBrew.getInputs()) {
if(o instanceof ItemStack) {
builder.add(ImmutableList.of((ItemStack) o));
inputBuilder.add(ImmutableList.of((ItemStack) o));
}
if(o instanceof String) {
builder.add(OreDictionary.getOres((String) o));
inputBuilder.add(OreDictionary.getOres((String) o));
}
}
input = builder.build();
output = ImmutableList.of(recipeBrew.getOutput(new ItemStack(ModItems.vial)).copy(), recipeBrew.getOutput(new ItemStack(ModItems.flask)).copy());
input = inputBuilder.build();
output = outputBuilder.build();
}
@Override
@@ -0,0 +1,92 @@
/**
* This class was created by <codewarrior0>. 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.integration.jei.orechid;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IDrawableStatic;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
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.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
public class OrechidIgnemRecipeCategory implements IRecipeCategory {
public static final String UID = "botania.orechid_ignem";
private final IDrawableStatic background;
private final String localizedName;
private final IDrawableStatic overlay;
public OrechidIgnemRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(168, 64);
localizedName = I18n.format("botania.nei.orechidIgnem");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
0, 0, 64, 46);
}
@Nonnull
@Override
public String getUid() {
return UID;
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
final IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 40, 12);
itemStacks.set(0, ingredients.getInputs(ItemStack.class).get(0));
itemStacks.init(1, true, 70, 12);
itemStacks.set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID_IGNEM));
itemStacks.init(2, true, 99, 12);
itemStacks.set(2, ingredients.getOutputs(ItemStack.class).get(0));
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft, 48, 0);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Nonnull
@Override
public String getModName() {
return LibMisc.MOD_NAME;
}
}
@@ -0,0 +1,32 @@
/**
* This class was created by <codewarrior0>. 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.integration.jei.orechid;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.BotaniaAPI;
import java.util.Map;
public class OrechidIgnemRecipeWrapper extends OrechidRecipeWrapper {
public OrechidIgnemRecipeWrapper(Map.Entry<String, Integer> entry) {
super(entry);
}
@Override
protected ItemStack getInputStack() {
return new ItemStack(Blocks.NETHERRACK, 64);
}
public Map<String, Integer> getOreWeights() {
return BotaniaAPI.oreWeightsNether;
}
}
@@ -0,0 +1,92 @@
/**
* This class was created by <codewarrior0>. 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.integration.jei.orechid;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IDrawableStatic;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
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.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
public class OrechidRecipeCategory implements IRecipeCategory {
public static final String UID = "botania.orechid";
private final IDrawableStatic background;
private final String localizedName;
private final IDrawableStatic overlay;
public OrechidRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(168, 64);
localizedName = I18n.format("botania.nei.orechid");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
0, 0, 64, 46);
}
@Nonnull
@Override
public String getUid() {
return UID;
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
final IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 40, 12);
itemStacks.set(0, ingredients.getInputs(ItemStack.class).get(0));
itemStacks.init(1, true, 70, 12);
itemStacks.set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID));
itemStacks.init(2, true, 99, 12);
itemStacks.set(2, ingredients.getOutputs(ItemStack.class).get(0));
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft, 48, 0);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Nonnull
@Override
public String getModName() {
return LibMisc.MOD_NAME;
}
}
@@ -0,0 +1,74 @@
/**
* This class was created by <codewarrior0>. 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.integration.jei.orechid;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.VanillaTypes;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import vazkii.botania.api.BotaniaAPI;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static vazkii.botania.client.integration.jei.JEIBotaniaPlugin.doesOreExist;
public class OrechidRecipeWrapper implements IRecipeWrapper, Comparable<OrechidRecipeWrapper> {
private final int weight;
private final List<List<ItemStack>> outputStacks;
protected ItemStack getInputStack() {
return new ItemStack(Blocks.STONE, 64);
}
public OrechidRecipeWrapper(Map.Entry<String, Integer> entry) {
this.weight = entry.getValue();
final int amount = Math.max(1, Math.round((float) weight * 64 / getTotalOreWeight()));
// Shouldn't ever return an empty list since the ore weight
// list is filtered to only have ores with ItemBlocks
List<ItemStack> stackList = OreDictionary.getOres(entry.getKey()).stream()
.filter(s -> s.getItem() instanceof ItemBlock)
.map(ItemStack::copy)
.collect(Collectors.toList());
stackList.forEach(s -> s.setCount(amount));
outputStacks = Collections.singletonList(stackList);
}
public Map<String, Integer> getOreWeights() {
return BotaniaAPI.oreWeights;
}
private float getTotalOreWeight() {
return (getOreWeights().entrySet().stream()
.filter(e -> doesOreExist(e.getKey()))
.map(Map.Entry::getValue)
.reduce(Integer::sum)).orElse(weight * 64 * 64);
}
@Override
public void getIngredients(IIngredients ingredients) {
ingredients.setInput(VanillaTypes.ITEM, getInputStack());
ingredients.setOutputLists(VanillaTypes.ITEM, outputStacks);
}
@Override
public int compareTo(OrechidRecipeWrapper o) {
return Integer.compare(o.weight, weight);
}
}
@@ -46,9 +46,8 @@ public class PlatformModel implements IBakedModel {
@Nonnull
@Override
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
// rendering the item form
if(state == null)
return original.getQuads(state, side, rand);
return ImmutableList.of();
if(!(state.getBlock() instanceof BlockPlatform))
return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel().getQuads(state, side, rand);
@@ -135,10 +135,10 @@ public class SpecialFlowerModel implements IModel {
@Override
public boolean accepts(ResourceLocation modelLocation) {
return modelLocation.getResourceDomain().equals("botania_special") && (
modelLocation.getResourcePath().equals("specialflower") ||
modelLocation.getResourcePath().equals("models/block/specialflower") ||
modelLocation.getResourcePath().equals("models/item/specialflower"));
return modelLocation.getNamespace().equals("botania_special") && (
modelLocation.getPath().equals("specialflower") ||
modelLocation.getPath().equals("models/block/specialflower") ||
modelLocation.getPath().equals("models/item/specialflower"));
}
@Override
@@ -37,7 +37,7 @@ public class RenderTileGaiaHead extends TileEntitySkullRenderer {
// Null-safe copy of super
renderSkull((float)x, (float)y, (float)z,
skull == null ? EnumFacing.NORTH : EnumFacing.getFront(skull.getBlockMetadata() & 7),
skull == null ? EnumFacing.NORTH : EnumFacing.byIndex(skull.getBlockMetadata() & 7),
skull == null ? 0 : skull.getSkullRotation() * 360 / 16.0F,
3, null, digProgress, partialTicks);
@@ -41,6 +41,7 @@ import vazkii.botania.client.model.ModelTinyPotato;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.TileTinyPotato;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.block.ItemBlockTinyPotato;
import vazkii.botania.common.item.equipment.bauble.ItemBaubleCosmetic;
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
@@ -172,44 +173,61 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
}
boolean block = stack.getItem() instanceof ItemBlock;
boolean mySon = stack.getItem() instanceof ItemBlockTinyPotato;
switch(side) {
case UP:
if(block)
if(mySon)
GlStateManager.translate(0F, 0.6F, 0.5F);
else if(block)
GlStateManager.translate(0F, 0.3F, 0.5F);
GlStateManager.translate(0F, -0.5F, -0.4F);
break;
case DOWN:
GlStateManager.translate(0, -2.3, -0.88);
if(block)
if(mySon)
GlStateManager.translate(0, .65, 0.6);
else if(block)
GlStateManager.translate(0, 1, 0.6);
break;
case NORTH:
GlStateManager.translate(0, -1.9, 0.02);
if(block)
if(mySon)
GlStateManager.translate(0, 1, 0.6);
else if(block)
GlStateManager.translate(0, 1, 0.6);
break;
case SOUTH:
GlStateManager.translate(0, -1.6, -0.89);
if(block)
GlStateManager.translate(0, 1, 0.6);
if(mySon)
GlStateManager.translate(0, 1.4, 0.5);
else if(block)
GlStateManager.translate(0, 1.0, 0.5);
break;
case EAST:
if(block)
if(mySon)
GlStateManager.translate(-0.4F, 0.65F, 0F);
else if(block)
GlStateManager.translate(-0.4F, 0.8F, 0F);
else GlStateManager.rotate(-90F, 0F, 1F, 0F);
GlStateManager.translate(-0.3F, -1.9F, 0.04F);
break;
case WEST:
if(block)
if(mySon)
GlStateManager.translate(1F, 0.65F, 1F);
else if(block)
GlStateManager.translate(1F, 0.8F, 1F);
else GlStateManager.rotate(-90F, 0F, 1F, 0F);
GlStateManager.translate(-0.3F, -1.9F, -0.92F);
break;
}
if(block)
if (mySon)
GlStateManager.scale(1.1, 1.1, 1.1);
else if(block)
GlStateManager.scale(0.5, 0.5, 0.5);
if(block && side != EnumFacing.NORTH)
GlStateManager.rotate(180F, 0, 1, 0);
renderItem(stack);
GlStateManager.popMatrix();
}