mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-20 04:09:40 +00:00
NEI restructure and corporea requesting
This commit is contained in:
1 parent
620e7be528
commit
30457d37b5
12 files changed
+121
-10
No files matched your search
@@ -1,11 +1,24 @@
|
||||
package vazkii.botania.client.integration.nei;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import vazkii.botania.client.integration.nei.recipe.RecipeHandlerBrewery;
|
||||
import vazkii.botania.client.integration.nei.recipe.RecipeHandlerElvenTrade;
|
||||
import vazkii.botania.client.integration.nei.recipe.RecipeHandlerFloatingFlowers;
|
||||
import vazkii.botania.client.integration.nei.recipe.RecipeHandlerLexicaBotania;
|
||||
import vazkii.botania.client.integration.nei.recipe.RecipeHandlerManaPool;
|
||||
import vazkii.botania.client.integration.nei.recipe.RecipeHandlerPetalApothecary;
|
||||
import vazkii.botania.client.integration.nei.recipe.RecipeHandlerPureDaisy;
|
||||
import vazkii.botania.client.integration.nei.recipe.RecipeHandlerRunicAltar;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
|
||||
public class NEIBotaniaConfig implements IConfigureNEI {
|
||||
|
||||
public static final String CORPOREA_KEY = "gui.botania_corporea_request";
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return LibMisc.MOD_NAME;
|
||||
@@ -41,6 +54,9 @@ public class NEIBotaniaConfig implements IConfigureNEI {
|
||||
|
||||
API.registerRecipeHandler(new RecipeHandlerLexicaBotania());
|
||||
API.registerUsageHandler(new RecipeHandlerLexicaBotania());
|
||||
|
||||
API.addKeyBind(CORPOREA_KEY, Keyboard.KEY_C);
|
||||
GuiContainerManager.addInputHandler(new NEIInputHandler());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [25/12/2015, 02:22:32 (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.integration.nei;
|
||||
|
||||
import vazkii.botania.api.corporea.CorporeaHelper;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerInputHandler;
|
||||
|
||||
public class NEIInputHandler implements IContainerInputHandler {
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(GuiContainer gui, char c, int i) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(TileCorporeaIndex.InputHandler.getNearbyIndexes(mc.thePlayer).isEmpty())
|
||||
return false;
|
||||
|
||||
int bind = NEIClientConfig.getKeyBinding(NEIBotaniaConfig.CORPOREA_KEY);
|
||||
|
||||
if(i == bind) {
|
||||
LayoutManager layoutManager = LayoutManager.instance();
|
||||
if(layoutManager != null && LayoutManager.itemPanel != null && !NEIClientConfig.isHidden()) {
|
||||
ItemStack stack = GuiContainerManager.getStackMouseOver(gui);
|
||||
if(stack != null && stack.getItem() != null) {
|
||||
int count = NEIClientConfig.getItemQuantity();
|
||||
if(count > 0) {
|
||||
String name = CorporeaHelper.stripControlCodes(stack.getDisplayName());
|
||||
String full = count + " " + name;
|
||||
|
||||
mc.ingameGUI.getChatGUI().addToSentMessages(full);
|
||||
mc.thePlayer.sendChatMessage(full);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean lastKeyTyped(GuiContainer arg0, char arg1, int arg2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(GuiContainer arg0, int arg1, int arg2, int arg3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(GuiContainer arg0, int arg1, int arg2, int arg3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyTyped(GuiContainer arg0, char arg1, int arg2) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClicked(GuiContainer arg0, int arg1, int arg2, int arg3) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseDragged(GuiContainer arg0, int arg1, int arg2, int arg3, long arg4) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseScrolled(GuiContainer arg0, int arg1, int arg2, int arg3) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseUp(GuiContainer arg0, int arg1, int arg2, int arg3) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package vazkii.botania.client.integration.nei;
|
||||
package vazkii.botania.client.integration.nei.recipe;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package vazkii.botania.client.integration.nei;
|
||||
package vazkii.botania.client.integration.nei.recipe;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package vazkii.botania.client.integration.nei;
|
||||
package vazkii.botania.client.integration.nei.recipe;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
+2
-2
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* File Created @ [12/12/2015, 23:25:47 (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.integration.nei;
|
||||
package vazkii.botania.client.integration.nei.recipe;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
@@ -32,7 +32,7 @@ import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.client.core.handler.HUDHandler;
|
||||
import vazkii.botania.client.integration.nei.RecipeHandlerManaPool.CachedManaPoolRecipe;
|
||||
import vazkii.botania.client.integration.nei.recipe.RecipeHandlerManaPool.CachedManaPoolRecipe;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.client.render.tile.RenderTilePool;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package vazkii.botania.client.integration.nei;
|
||||
package vazkii.botania.client.integration.nei.recipe;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package vazkii.botania.client.integration.nei;
|
||||
package vazkii.botania.client.integration.nei.recipe;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package vazkii.botania.client.integration.nei;
|
||||
package vazkii.botania.client.integration.nei.recipe;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package vazkii.botania.client.integration.nei;
|
||||
package vazkii.botania.client.integration.nei.recipe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -285,7 +285,7 @@ public class TileCorporeaIndex extends TileCorporeaBase implements ICorporeaRequ
|
||||
}
|
||||
}
|
||||
|
||||
public List<TileCorporeaIndex> getNearbyIndexes(EntityPlayer player) {
|
||||
public static List<TileCorporeaIndex> getNearbyIndexes(EntityPlayer player) {
|
||||
List<TileCorporeaIndex> indexList = new ArrayList();
|
||||
for(TileCorporeaIndex index : indexes)
|
||||
if(isInRangeOfIndex(player, index) && index.worldObj.isRemote == player.worldObj.isRemote)
|
||||
|
||||
Reference in new issue
Block a user