This commit is contained in:
Vincent Lee committed 2016-04-03 21:23:04 -05:00
1 parent f8157f1222
commit 08550cc442
31 files changed
+88 -1425

No files matched your search

@@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -25,8 +26,8 @@ import vazkii.botania.common.lib.LibBlockNames;
public final class ModChallenges {
public static final EnumMap<EnumChallengeLevel, List<Challenge>> challenges = new EnumMap<>(EnumChallengeLevel.class);
public static final HashMap<String, Challenge> challengeLookup = new HashMap<>();
public static final Map<EnumChallengeLevel, List<Challenge>> challenges = new EnumMap<>(EnumChallengeLevel.class);
public static final Map<String, Challenge> challengeLookup = new HashMap<>();
public static void init() {
for(EnumChallengeLevel level : EnumChallengeLevel.class.getEnumConstants())
@@ -56,7 +57,7 @@ public final class ModChallenges {
addChallenge(EnumChallengeLevel.LUNATIC, "runeCrafter", new ItemStack(ModItems.rune));
}
public static void addChallenge(EnumChallengeLevel level, String name, ItemStack icon) {
private static void addChallenge(EnumChallengeLevel level, String name, ItemStack icon) {
Challenge c = new Challenge("botania.challenge." + name, icon, level);
challenges.get(level).add(c);
challengeLookup.put(c.unlocalizedName, c);
@@ -33,7 +33,7 @@ import vazkii.botania.common.core.helper.MathHelper;
public final class BossBarHandler {
public static final ResourceLocation defaultBossBar = new ResourceLocation(LibResources.GUI_BOSS_BAR);
static IBotaniaBoss currentBoss;
private static IBotaniaBoss currentBoss;
private static final BarCallback barUniformCallback = new BarCallback();
@@ -73,7 +73,7 @@ public final class BossBarHandler {
currentBoss = null;
}
public static void drawBar(int x, int y, int u, int v, int w, int h, boolean bg) {
private static void drawBar(int x, int y, int u, int v, int w, int h, boolean bg) {
boolean useShader = currentBoss instanceof IBotaniaBossWithShader;
if(useShader) {
IBotaniaBossWithShader shader = (IBotaniaBossWithShader) currentBoss;
@@ -90,7 +90,7 @@ public final class BossBarHandler {
ShaderHelper.releaseShader();
}
static class BarCallback implements ShaderCallback {
private static class BarCallback implements ShaderCallback {
int x, y;
ShaderCallback callback;
@@ -22,11 +22,16 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
@@ -61,18 +66,12 @@ public final class BoundTileRenderer {
renderBlockOutlineAt(coords, color);
}
IInventory mainInv = player.inventory;
IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player);
IItemHandlerModifiable mainInv = ((IItemHandlerModifiable) player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP));
IItemHandlerModifiable baublesInv = BotaniaAPI.internalHandler.getBaublesInventoryWrapped(player);
IItemHandler joined = baublesInv != null ? new CombinedInvWrapper(mainInv, baublesInv) : mainInv;
int invSize = mainInv.getSizeInventory();
int size = invSize;
if(baublesInv != null)
size += baublesInv.getSizeInventory();
for(int i = 0; i < size; i++) {
boolean useBaubles = i >= invSize;
IInventory inv = useBaubles ? baublesInv : mainInv;
ItemStack stackInSlot = inv.getStackInSlot(i - (useBaubles ? invSize : 0));
for(int i = 0; i < joined.getSlots(); i++) {
ItemStack stackInSlot = joined.getStackInSlot(i);
if(stackInSlot != null && stackInSlot.getItem() instanceof IWireframeCoordinateListProvider) {
IWireframeCoordinateListProvider provider = (IWireframeCoordinateListProvider) stackInSlot.getItem();
@@ -42,7 +42,7 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
public volatile static Map<String, ItemStack> flowerMap = null;
private volatile static boolean startedLoading = false;
private static boolean phi = true;
private static final boolean phi = true;
@Override
public void doRenderLayer(EntityPlayer player, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
@@ -185,7 +185,7 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
GlStateManager.popMatrix();
}
public static class ThreadContributorListLoader extends Thread {
private static class ThreadContributorListLoader extends Thread {
public ThreadContributorListLoader() {
setName("Botania Contributor Fanciness Thread");
@@ -36,10 +36,10 @@ import net.minecraftforge.fml.relauncher.ReflectionHelper;
public class CorporeaAutoCompleteHandler {
boolean isAutoCompleted = false;
String originalString = "";
List<CompletionData> completions = new ArrayList<>();
int position;
private boolean isAutoCompleted = false;
private String originalString = "";
private List<CompletionData> completions = new ArrayList<>();
private int position;
static TreeSet<String> itemNames = new TreeSet<>(String::compareToIgnoreCase);
@@ -49,10 +49,6 @@ public class LightningHandler {
private static final ResourceLocation outsideResource = new ResourceLocation(LibResources.MISC_WISP_LARGE);
private static final ResourceLocation insideResource = new ResourceLocation(LibResources.MISC_WISP_SMALL);
static double interpPosX;
static double interpPosY;
static double interpPosZ;
private static Vector3 getRelativeViewVector(Vector3 pos) {
Entity renderEntity = Minecraft.getMinecraft().getRenderViewEntity();
return new Vector3((float) renderEntity.posX - pos.x, (float) renderEntity.posY + renderEntity.getEyeHeight() - pos.y, (float) renderEntity.posZ - pos.z);
@@ -72,9 +68,9 @@ public class LightningHandler {
Entity entity = Minecraft.getMinecraft().thePlayer;
TextureManager render = Minecraft.getMinecraft().renderEngine;
interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * frame;
interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * frame;
interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * frame;
double interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * frame;
double interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * frame;
double interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * frame;
GlStateManager.pushMatrix();
GlStateManager.translate(-interpPosX, -interpPosY, -interpPosZ);
@@ -222,23 +218,14 @@ public class LightningHandler {
Vector3 offsetvec;
}
public class SegmentSorter implements Comparator<Segment> {
private static final Comparator<Segment> SEGMENT_SORTER = (o1, o2) -> {
int comp = Integer.valueOf(o1.splitno).compareTo(o2.splitno);
if(comp == 0)
return Integer.valueOf(o1.segmentno).compareTo(o2.segmentno);
else return comp;
};
@Override
public int compare(Segment o1, Segment o2) {
int comp = Integer.valueOf(o1.splitno).compareTo(o2.splitno);
if(comp == 0)
return Integer.valueOf(o1.segmentno).compareTo(o2.segmentno);
else return comp;
}
}
public class SegmentLightSorter implements Comparator<Segment> {
@Override
public int compare(Segment o1, Segment o2) {
return Float.compare(o2.light, o1.light);
}
}
private static final Comparator<Segment> SEGMENT_LIGHT_SORTER = (o1, o2) -> Float.compare(o2.light, o1.light);
public class Segment {
public Segment(BoltPoint start, BoltPoint end, float light, int segmentnumber, int splitnumber) {
@@ -433,7 +420,7 @@ public class LightningHandler {
private void calculateCollisionAndDiffs() {
HashMap<Integer, Integer> lastactivesegment = new HashMap<>();
Collections.sort(segments, new SegmentSorter());
Collections.sort(segments, SEGMENT_SORTER);
int lastsplitcalc = 0;
int lastactiveseg = 0;// unterminated
@@ -477,7 +464,7 @@ public class LightningHandler {
calculateCollisionAndDiffs();
Collections.sort(segments, new SegmentLightSorter());
Collections.sort(segments, SEGMENT_LIGHT_SORTER);
boltlist.add(this);
}
@@ -27,10 +27,10 @@ import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
*/
public class MultiblockBlockAccess implements IBlockAccess {
protected IBlockAccess originalBlockAccess;
protected boolean hasBlockAccess = false;
private IBlockAccess originalBlockAccess;
private boolean hasBlockAccess = false;
private BlockPos anchorPos;
protected Multiblock multiblock;
protected BlockPos anchorPos;
@Override
public IBlockState getBlockState(BlockPos pos) {
@@ -88,9 +88,7 @@ public class MultiblockBlockAccess implements IBlockAccess {
@Override
public boolean extendedLevelsInChunkCache() {
if(hasBlockAccess)
return originalBlockAccess.extendedLevelsInChunkCache();
return false;
return hasBlockAccess && originalBlockAccess.extendedLevelsInChunkCache();
}
@Override
@@ -113,8 +111,7 @@ public class MultiblockBlockAccess implements IBlockAccess {
/**
* Returns the multiblock component for the coordinates, adjusted based on the anchor
*/
protected MultiblockComponent getComponent(BlockPos pos) {
MultiblockComponent comp = multiblock.getComponentForLocation(pos.add(new BlockPos(-anchorPos.getX(), -anchorPos.getY(), -anchorPos.getZ())));
return comp;
private MultiblockComponent getComponent(BlockPos pos) {
return multiblock.getComponentForLocation(pos.add(new BlockPos(-anchorPos.getX(), -anchorPos.getY(), -anchorPos.getZ())));
}
}
@@ -41,14 +41,13 @@ import vazkii.botania.common.block.ModBlocks;
public final class MultiblockRenderHandler {
public static boolean rendering = false;
private static MultiblockBlockAccess blockAccess = new MultiblockBlockAccess();
private static int dimension;
public static boolean rendering = false;
public static MultiblockSet currentMultiblock;
public static BlockPos anchor;
public static EnumFacing angle;
public static int dimension;
static {
// todo 1.8.8 temporary shim, because cannot renderBlockBrightness directly, see MinecraftForge issue 2353
@@ -128,24 +128,23 @@ public final class PersistentVariableHelper {
cacheFile = f;
}
public static File getCacheFile() throws IOException {
private static File getCacheFile() throws IOException {
if(!cacheFile.exists())
cacheFile.createNewFile();
return cacheFile;
}
public static NBTTagCompound getCacheCompound() throws IOException {
private static NBTTagCompound getCacheCompound() throws IOException {
return getCacheCompound(getCacheFile());
}
public static NBTTagCompound getCacheCompound(File cache) throws IOException {
private static NBTTagCompound getCacheCompound(File cache) throws IOException {
if(cache == null)
throw new RuntimeException("No cache file!");
try {
NBTTagCompound cmp = CompressedStreamTools.readCompressed(new FileInputStream(cache));
return cmp;
return CompressedStreamTools.readCompressed(new FileInputStream(cache));
} catch(IOException e) {
NBTTagCompound cmp = new NBTTagCompound();
CompressedStreamTools.writeCompressed(cmp, new FileOutputStream(cache));
@@ -153,7 +152,7 @@ public final class PersistentVariableHelper {
}
}
public static void injectNBTToFile(NBTTagCompound cmp, File f) {
private static void injectNBTToFile(NBTTagCompound cmp, File f) {
try {
CompressedStreamTools.writeCompressed(cmp, new FileOutputStream(f));
} catch(IOException e) {
@@ -32,7 +32,7 @@ import vazkii.botania.common.item.ModItems;
public final class RedStringRenderer {
public static final Queue<TileRedString> redStringTiles = new ArrayDeque<>();
static float sizeAlpha = 0F;
private static float sizeAlpha = 0F;
public static void renderAll() {
if(!redStringTiles.isEmpty()) {
@@ -81,7 +81,7 @@ public final class SubTileRadiusRenderHandler {
GlStateManager.popMatrix();
}
public void renderRectangle(AxisAlignedBB aabb) {
private void renderRectangle(AxisAlignedBB aabb) {
double renderPosX, renderPosY, renderPosZ;
try {
@@ -126,7 +126,7 @@ public final class SubTileRadiusRenderHandler {
GlStateManager.popMatrix();
}
public void renderCircle(BlockPos center, double radius) {
private void renderCircle(BlockPos center, double radius) {
double renderPosX, renderPosY, renderPosZ;
try {
@@ -12,12 +12,12 @@ package vazkii.botania.client.core.helper;
public final class FontHelper {
public static boolean isFormatColor(char par0) {
return par0 >= 48 && par0 <= 57 || par0 >= 97 && par0 <= 102 || par0 >= 65 && par0 <= 70;
private static boolean isFormatColor(char par0) {
return par0 >= '0' && par0 <= '9' || par0 >= 'a' && par0 <= 'f' || par0 >= 'A' && par0 <= 'F';
}
public static boolean isFormatSpecial(char par0) {
return par0 >= 107 && par0 <= 111 || par0 >= 75 && par0 <= 79 || par0 == 114 || par0 == 82;
private static boolean isFormatSpecial(char par0) {
return par0 >= 'k' && par0 <= 'o' || par0 >= 'K' && par0 <= 'O' || par0 == 'r' || par0 == 'R';
}
public static String getFormatFromString(String par0Str) {
@@ -25,7 +25,7 @@ public final class FontHelper {
int i = -1;
int j = par0Str.length();
while ((i = par0Str.indexOf(167, i + 1)) != -1) {
while ((i = par0Str.indexOf('w', i + 1)) != -1) {
if (i < j - 1) {
char c0 = par0Str.charAt(i + 1);
@@ -132,10 +132,10 @@ public final class RenderHelper {
public static void drawTexturedModalRect(int par1, int par2, float z, int par3, int par4, int par5, int par6, float f, float f1) {
Tessellator tessellator = Tessellator.getInstance();
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
tessellator.getBuffer().pos(par1 + 0, par2 + par6, z).tex((par3 + 0) * f, (par4 + par6) * f1).endVertex();
tessellator.getBuffer().pos(par1, par2 + par6, z).tex((par3) * f, (par4 + par6) * f1).endVertex();
tessellator.getBuffer().pos(par1 + par5, par2 + par6, z).tex((par3 + par5) * f, (par4 + par6) * f1).endVertex();
tessellator.getBuffer().pos(par1 + par5, par2 + 0, z).tex((par3 + par5) * f, (par4 + 0) * f1).endVertex();
tessellator.getBuffer().pos(par1 + 0, par2 + 0, z).tex((par3 + 0) * f, (par4 + 0) * f1).endVertex();
tessellator.getBuffer().pos(par1 + par5, par2, z).tex((par3 + par5) * f, (par4) * f1).endVertex();
tessellator.getBuffer().pos(par1, par2, z).tex((par3) * f, (par4) * f1).endVertex();
tessellator.draw();
}
@@ -149,52 +149,14 @@ public final class ShaderHelper {
}
private static String readFileAsString(String filename) throws Exception {
StringBuilder source = new StringBuilder();
InputStream in = ShaderHelper.class.getResourceAsStream(filename);
Exception exception = null;
BufferedReader reader;
if(in == null)
return "";
try {
reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
Exception innerExc= null;
try {
String line;
while((line = reader.readLine()) != null)
source.append(line).append('\n');
} catch(Exception exc) {
exception = exc;
} finally {
try {
reader.close();
} catch(Exception exc) {
if(innerExc == null)
innerExc = exc;
else exc.printStackTrace();
}
}
if(innerExc != null)
throw innerExc;
} catch(Exception exc) {
exception = exc;
} finally {
try {
in.close();
} catch(Exception exc) {
if(exception == null)
exception = exc;
else exc.printStackTrace();
}
if(exception != null)
throw exception;
try (BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"))) {
return reader.lines().reduce("", (s1, s2) -> s1 + "\n" + s2);
}
return source.toString();
}
}
@@ -285,12 +285,6 @@ public class ClientProxy extends CommonProxy {
render.addLayer(new BaubleRenderHandler());
}
@Override
@Optional.Method(modid = "NotEnoughItems")
public void registerNEIStuff() {
// todo 1.8.8 restore when nei updates NEIGuiHooks.init();
}
@Override
public void setEntryToOpen(LexiconEntry entry) {
GuiLexicon.currentOpenLexicon = new GuiLexiconEntry(entry, new GuiLexiconIndex(entry.category));
@@ -36,16 +36,16 @@ public class FXSparkle extends EntityFX {
public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_PARTICLES);
public static Queue<FXSparkle> queuedRenders = new ArrayDeque<>();
public static Queue<FXSparkle> queuedCorruptRenders = new ArrayDeque<>();
private static Queue<FXSparkle> queuedRenders = new ArrayDeque<>();
private static Queue<FXSparkle> queuedCorruptRenders = new ArrayDeque<>();
// Queue values
float f;
float f1;
float f2;
float f3;
float f4;
float f5;
private float f;
private float f1;
private float f2;
private float f3;
private float f4;
private float f5;
public boolean noClip = false;
@@ -167,7 +167,7 @@ public class FXSparkle extends EntityFX {
particleGravity = value;
}
protected boolean pushOutOfBlocks(double par1, double par3, double par5) {
private boolean pushOutOfBlocks(double par1, double par3, double par5) {
int var7 = MathHelper.floor_double(par1);
int var8 = MathHelper.floor_double(par3);
int var9 = MathHelper.floor_double(par5);
@@ -255,8 +255,8 @@ public class FXSparkle extends EntityFX {
public boolean corrupt = false;
public boolean fake = false;
public int multiplier = 2;
public boolean shrink = true;
private int multiplier = 2;
private boolean shrink = true;
public int particle = 16;
public boolean tinkle = false;
public boolean slowdown = true;
@@ -34,16 +34,16 @@ public class FXWisp extends EntityFX {
public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_WISP_LARGE);
public static Queue<FXWisp> queuedRenders = new ArrayDeque<>();
public static Queue<FXWisp> queuedDepthIgnoringRenders = new ArrayDeque<>();
private static Queue<FXWisp> queuedRenders = new ArrayDeque<>();
private static Queue<FXWisp> queuedDepthIgnoringRenders = new ArrayDeque<>();
// Queue values
float f;
float f1;
float f2;
float f3;
float f4;
float f5;
private float f;
private float f1;
private float f2;
private float f3;
private float f4;
private float f5;
public FXWisp(World world, double d, double d1, double d2, float size, float red, float green, float blue, boolean distanceLimit, boolean depthTest, float maxAgeMul) {
super(world, d, d1, d2, 0.0D, 0.0D, 0.0D);
@@ -108,8 +108,7 @@ public class FXWisp extends EntityFX {
ParticleRenderDispatcher.wispFxCount++;
else ParticleRenderDispatcher.depthIgnoringWispFxCount++;
float agescale = 0;
agescale = (float)particleAge / (float) moteHalfLife;
float agescale = (float)particleAge / (float) moteHalfLife;
if (agescale > 1F)
agescale = 2 - agescale;
@@ -168,10 +167,10 @@ public class FXWisp extends EntityFX {
zSpeed = mz;
}
boolean depthTest = true;
private boolean depthTest = true;
public boolean distanceLimit = true;
float moteParticleScale;
int moteHalfLife;
private float moteParticleScale;
private int moteHalfLife;
public boolean tinkle = false;
public int blendmode = 1;
}
@@ -1,64 +0,0 @@
/*
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;
}
@Override
public String getVersion() {
return LibMisc.VERSION;
}
@Override
public void loadConfig() {
API.registerRecipeHandler(new RecipeHandlerFloatingFlowers());
API.registerUsageHandler(new RecipeHandlerFloatingFlowers());
API.registerRecipeHandler(new RecipeHandlerPetalApothecary());
API.registerUsageHandler(new RecipeHandlerPetalApothecary());
API.registerRecipeHandler(new RecipeHandlerRunicAltar());
API.registerUsageHandler(new RecipeHandlerRunicAltar());
API.registerRecipeHandler(new RecipeHandlerManaPool());
API.registerUsageHandler(new RecipeHandlerManaPool());
API.registerRecipeHandler(new RecipeHandlerElvenTrade());
API.registerUsageHandler(new RecipeHandlerElvenTrade());
API.registerRecipeHandler(new RecipeHandlerBrewery());
API.registerUsageHandler(new RecipeHandlerBrewery());
API.registerRecipeHandler(new RecipeHandlerPureDaisy());
API.registerUsageHandler(new RecipeHandlerPureDaisy());
API.registerRecipeHandler(new RecipeHandlerLexicaBotania());
API.registerUsageHandler(new RecipeHandlerLexicaBotania());
API.addKeyBind(CORPOREA_KEY, Keyboard.KEY_C);
GuiContainerManager.addInputHandler(new NEIInputHandler());
}
}
*/
@@ -1,26 +0,0 @@
/**
* 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 @ [Dec 15, 2014, 6:09:38 PM (GMT)]
*//*
package vazkii.botania.client.integration.nei;
import vazkii.botania.client.gui.crafting.GuiCraftingHalo;
import codechicken.nei.api.API;
import codechicken.nei.recipe.DefaultOverlayHandler;
public class NEIGuiHooks {
public static void init() {
API.registerGuiOverlay(GuiCraftingHalo.class, "crafting");
API.registerGuiOverlayHandler(GuiCraftingHalo.class, new DefaultOverlayHandler(), "crafting");
}
}
*/
@@ -1,105 +0,0 @@
/**
* 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.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.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 = 1;
int max = stack.getMaxStackSize();
if(gui.isShiftKeyDown()) {
count = max;
if(gui.isCtrlKeyDown())
count /= 4;
} else if(gui.isCtrlKeyDown())
count = max / 2;
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,142 +0,0 @@
/*
package vazkii.botania.client.integration.nei.recipe;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.brew.IBrewContainer;
import vazkii.botania.api.brew.IBrewItem;
import vazkii.botania.api.recipe.RecipeBrew;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.item.ModItems;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
public class RecipeHandlerBrewery extends TemplateRecipeHandler {
public class CachedBreweryRecipe extends CachedRecipe {
public List<PositionedStack> inputs = new ArrayList<PositionedStack>();
public PositionedStack output;
public int mana;
public CachedBreweryRecipe(RecipeBrew recipe, ItemStack vial) {
if(recipe == null)
return;
setIngredients(recipe.getInputs());
ItemStack toVial;
if (vial == null)
toVial = new ItemStack(ModItems.vial);
else
toVial = vial.copy();
toVial.stackSize = 1;
inputs.add(new PositionedStack(toVial, 39, 42));
output = new PositionedStack(recipe.getOutput(toVial), 87, 42);
}
public CachedBreweryRecipe(RecipeBrew recipe) {
this(recipe, null);
}
public void setIngredients(List<Object> inputs) {
int left = 96 - inputs.size() * 18 / 2;
int i = 0;
for (Object o : inputs) {
if (o instanceof String)
this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), left + i * 18, 6));
else
this.inputs.add(new PositionedStack(o, left + i * 18, 6));
i++;
}
}
@Override
public List<PositionedStack> getIngredients() {
return getCycledIngredients(cycleticks / 20, inputs);
}
@Override
public PositionedStack getResult() {
return output;
}
}
@Override
public String getRecipeName() {
return I18n.translateToLocal("botania.nei.brewery");
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BREWERY;
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(87, 25, 15, 14), "botania.brewery"));
}
@Override
public void drawBackground(int recipe) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 166, 65);
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if(outputId.equals("botania.brewery"))
for(RecipeBrew recipe : BotaniaAPI.brewRecipes)
arecipes.add(new CachedBreweryRecipe(recipe));
else super.loadCraftingRecipes(outputId, results);
}
@Override
public void loadCraftingRecipes(ItemStack result) {
if(result.getItem() instanceof IBrewItem)
for(RecipeBrew recipe : BotaniaAPI.brewRecipes) {
if(recipe == null)
continue;
if(((IBrewItem) result.getItem()).getBrew(result) == recipe.getBrew())
arecipes.add(new CachedBreweryRecipe(recipe));
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
if(ingredient.getItem() instanceof IBrewContainer) {
for(RecipeBrew recipe : BotaniaAPI.brewRecipes) {
if(recipe == null)
continue;
if(recipe.getOutput(ingredient) != null)
arecipes.add(new CachedBreweryRecipe(recipe, ingredient));
}
} else for(RecipeBrew recipe : BotaniaAPI.brewRecipes) {
if(recipe == null)
continue;
CachedBreweryRecipe crecipe = new CachedBreweryRecipe(recipe);
if(crecipe.contains(crecipe.inputs, ingredient))
arecipes.add(crecipe);
}
}
}
*/
@@ -1,172 +0,0 @@
/*
package vazkii.botania.client.integration.nei.recipe;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.ILexicon;
import vazkii.botania.api.recipe.RecipeElvenTrade;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.block.BlockAlfPortal;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
public class RecipeHandlerElvenTrade extends TemplateRecipeHandler {
public class CachedElvenTradeRecipe extends CachedRecipe {
public List<PositionedStack> inputs = new ArrayList<PositionedStack>();
public PositionedStack output;
public CachedElvenTradeRecipe(RecipeElvenTrade recipe) {
if(recipe == null)
return;
setIngredients(recipe.getInputs());
output = new PositionedStack(recipe.getOutput(), 107, 46);
}
public void setIngredients(List<Object> inputs) {
int i = 0;
for(Object o : inputs) {
if(o instanceof String)
this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), 60 + i * 18, 6));
else this.inputs.add(new PositionedStack(o, 60 + i * 18, 6));
i++;
}
}
@Override
public List<PositionedStack> getIngredients() {
return getCycledIngredients(cycleticks / 20, inputs);
}
@Override
public PositionedStack getResult() {
return output;
}
}
@Override
public String getRecipeName() {
return I18n.translateToLocal("botania.nei.elvenTrade");
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BLANK;
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(35, 30, 48, 48), "botania.elvenTrade"));
}
@Override
public int recipiesPerPage() {
return 1;
}
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
GlStateManager.enableBlend();
GlStateManager.color(1.0F, 1.0F, 1.0F, 0.7F);
GuiDraw.changeTexture(LibResources.GUI_ELVEN_TRADE_OVERLAY);
GuiDraw.drawTexturedModalRect(30, 10, 17, 17, 100, 80);
GlStateManager.disableBlend();
GuiDraw.changeTexture(TextureMap.locationBlocksTexture);
renderIcon(35, 29, BlockAlfPortal.portalTex, 48, 48, 240); // todo 1.8
}
private static boolean hasElvenKnowledge() {
*/
/*EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (player != null) {
for (ItemStack stack : player.inventory.mainInventory) {
if (stack != null && stack.getItem() instanceof ILexicon) {
ILexicon lexicon = (ILexicon) stack.getItem();
if (lexicon.isKnowledgeUnlocked(stack, BotaniaAPI.elvenKnowledge)) {
return true;
}
}
}
}
return false;*//*
return true;
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if(outputId.equals("botania.elvenTrade") && hasElvenKnowledge()) {
if(hasElvenKnowledge()) {
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
if(recipe == null)
continue;
arecipes.add(new CachedElvenTradeRecipe(recipe));
}
}
} else super.loadCraftingRecipes(outputId, results);
}
@Override
public void loadCraftingRecipes(ItemStack result) {
if(hasElvenKnowledge()) {
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
if(recipe == null)
continue;
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result))
arecipes.add(new CachedElvenTradeRecipe(recipe));
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
if(hasElvenKnowledge()) {
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
if(recipe == null)
continue;
CachedElvenTradeRecipe crecipe = new CachedElvenTradeRecipe(recipe);
if(crecipe.contains(crecipe.inputs, ingredient))
arecipes.add(crecipe);
}
}
}
public void renderIcon(int par1, int par2, TextureAtlasSprite par3Icon, int par4, int par5, int brightness) {
Tessellator tessellator = Tessellator.getInstance();
tessellator.getBuffer().startDrawingQuads();
tessellator.getBuffer().setBrightness(brightness);
tessellator.getBuffer().addVertexWithUV(par1 + 0, par2 + par5, 0, par3Icon.getMinU(), par3Icon.getMaxV());
tessellator.getBuffer().addVertexWithUV(par1 + par4, par2 + par5, 0, par3Icon.getMaxU(), par3Icon.getMaxV());
tessellator.getBuffer().addVertexWithUV(par1 + par4, par2 + 0, 0, par3Icon.getMaxU(), par3Icon.getMinV());
tessellator.getBuffer().addVertexWithUV(par1 + 0, par2 + 0, 0, par3Icon.getMinU(), par3Icon.getMinV());
tessellator.draw();
}
}
*/
@@ -1,83 +0,0 @@
/*
package vazkii.botania.client.integration.nei.recipe;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.oredict.OreDictionary;
import vazkii.botania.common.block.BlockFloatingSpecialFlower;
import vazkii.botania.common.block.BlockSpecialFlower;
import vazkii.botania.common.block.ModBlocks;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
public class RecipeHandlerFloatingFlowers extends TemplateRecipeHandler {
public class CachedFloatingFlowerRecipe extends CachedRecipe {
public List<PositionedStack> inputs = new ArrayList<PositionedStack>();
public PositionedStack output;
public CachedFloatingFlowerRecipe(ItemStack floatingFlower, ItemStack specialFlower, ItemStack output) {
inputs.add(new PositionedStack(floatingFlower, 25, 6));
inputs.add(new PositionedStack(specialFlower, 43, 6));
this.output = new PositionedStack(output, 119, 24);
this.output.setMaxSize(1);
}
@Override
public List<PositionedStack> getIngredients() {
return getCycledIngredients(cycleticks / 20, inputs);
}
@Override
public PositionedStack getResult() {
return output;
}
}
@Override
public String getRecipeName() {
return I18n.translateToLocal("botania.nei.floatingFlowers");
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "crafting"));
}
@Override
public String getGuiTexture() {
return "textures/gui/container/crafting_table.png";
}
@Override
public void loadCraftingRecipes(ItemStack result) {
if(Block.getBlockFromItem(result.getItem()) instanceof BlockFloatingSpecialFlower) {
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE);
ItemStack specialFlower = new ItemStack(ModBlocks.specialFlower);
specialFlower.setTagCompound((NBTTagCompound) result.getTagCompound().copy());
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, specialFlower, result.copy()));
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
if(Block.getBlockFromItem(ingredient.getItem()) instanceof BlockSpecialFlower) {
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower, 1, OreDictionary.WILDCARD_VALUE);
ItemStack result = new ItemStack(ModBlocks.floatingSpecialFlower);
result.setTagCompound((NBTTagCompound) ingredient.getTagCompound().copy());
arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower, ingredient.copy(), result));
}
}
}
*/
@@ -1,173 +0,0 @@
/**
* 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 @ [12/12/2015, 23:25:47 (GMT)]
*//*
package vazkii.botania.client.integration.nei.recipe;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.KnowledgeType;
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.recipe.RecipeHandlerManaPool.CachedManaPoolRecipe;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.client.render.tile.RenderTilePool;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.mana.TilePool;
import vazkii.botania.common.core.helper.InventoryHelper;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lexicon.page.PageRecipe;
import vazkii.botania.common.lexicon.page.PageText;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
import codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe;
import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect;
public class RecipeHandlerLexicaBotania extends TemplateRecipeHandler {
public class CachedLexicaBotaniaRecipe extends CachedRecipe {
public LexiconEntry entry;
public PositionedStack item;
public List<PositionedStack> otherStacks = new ArrayList<PositionedStack>();
public CachedLexicaBotaniaRecipe(ItemStack stack, LexiconEntry entry) {
otherStacks.add(new PositionedStack(new ItemStack(ModItems.lexicon), 51, 5));
item = new PositionedStack(stack, 91, 5);
this.entry = entry;
}
@Override
public List<PositionedStack> getIngredients() {
return otherStacks;
}
@Override
public PositionedStack getResult() {
return item;
}
@Override
public List<PositionedStack> getOtherStacks() {
return otherStacks;
}
@Override
public boolean contains(Collection<PositionedStack> ingredients, ItemStack ingredient) {
return ingredient.getItem() == ModItems.lexicon;
}
}
@Override
public String getRecipeName() {
return I18n.translateToLocal("botania.nei.lexica");
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BLANK;
}
@Override
public int recipiesPerPage() {
return 1;
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(50, 4, 18, 18), "botania.lexica"));
}
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
CachedLexicaBotaniaRecipe recipeObj = ((CachedLexicaBotaniaRecipe) arecipes.get(recipe));
String s = TextFormatting.UNDERLINE + I18n.translateToLocal(recipeObj.entry.getUnlocalizedName());
font.drawString(s, 82 - font.getStringWidth(s) / 2, 30, 4210752);
KnowledgeType type = recipeObj.entry.getKnowledgeType();
s = type.color + I18n.translateToLocal(type.getUnlocalizedName()).replaceAll("\\&.", "");
font.drawString(s, 82 - font.getStringWidth(s) / 2, 42, 4210752);
s = "\"" + I18n.translateToLocal(recipeObj.entry.getTagline()) + "\"";
PageText.renderText(5, 42, 160, 200, s);
String key = LexiconRecipeMappings.stackToString(recipeObj.item.item);
String quickInfo = "botania.nei.quickInfo:" + key;
String quickInfoLocal = I18n.translateToLocal(quickInfo);
if(GuiScreen.isShiftKeyDown() && GuiScreen.isCtrlKeyDown() && Minecraft.getMinecraft().gameSettings.advancedItemTooltips)
s = "name: " + key;
else if(quickInfo.equals(quickInfoLocal))
s = I18n.translateToLocal("botania.nei.lexicaNoInfo");
else {
s = I18n.translateToLocal("botania.nei.lexicaSeparator");
font.drawString(s, 82 - font.getStringWidth(s) / 2, 80, 4210752);
s = quickInfoLocal;
}
PageText.renderText(5, 80, 160, 200, s);
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if(outputId.equals("botania.lexica")) {
for(LexiconEntry entry : BotaniaAPI.getAllEntries()) {
List<ItemStack> stacks = entry.getDisplayedRecipes();
for(ItemStack stack : stacks)
arecipes.add(new CachedLexicaBotaniaRecipe(stack, entry));
}
} else super.loadCraftingRecipes(outputId, results);
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for(LexiconEntry entry : BotaniaAPI.getAllEntries()) {
List<ItemStack> stacks = entry.getDisplayedRecipes();
for(ItemStack stack : stacks) {
String key1 = LexiconRecipeMappings.stackToString(stack);
String key2 = LexiconRecipeMappings.stackToString(result);
if(key1.equals(key2))
arecipes.add(new CachedLexicaBotaniaRecipe(stack, entry));
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
// NO-OP
}
}
*/
@@ -1,159 +0,0 @@
/*
package vazkii.botania.client.integration.nei.recipe;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipeManaInfusion;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.client.render.tile.RenderTilePool;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.mana.TilePool;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
public class RecipeHandlerManaPool extends TemplateRecipeHandler {
public class CachedManaPoolRecipe extends CachedRecipe {
public List<PositionedStack> inputs = new ArrayList<PositionedStack>();
public PositionedStack output;
public List<PositionedStack> otherStacks = new ArrayList<PositionedStack>();
public int mana;
public CachedManaPoolRecipe(RecipeManaInfusion recipe) {
if(recipe == null)
return;
inputs.add(new PositionedStack(new ItemStack(ModBlocks.pool, 1, recipe.getOutput().getItem() == Item.getItemFromBlock(ModBlocks.pool) ? 2 : 0), 71, 37));
if(recipe.getInput() instanceof String)
inputs.add(new PositionedStack(OreDictionary.getOres((String) recipe.getInput()), 42, 37));
else inputs.add(new PositionedStack(recipe.getInput(), 42, 37));
if(recipe.isAlchemy())
otherStacks.add(new PositionedStack(new ItemStack(ModBlocks.alchemyCatalyst), 10, 37));
else if (recipe.isConjuration())
otherStacks.add(new PositionedStack(new ItemStack(ModBlocks.conjurationCatalyst), 10, 37));
output = new PositionedStack(recipe.getOutput(), 101, 37);
mana = recipe.getManaToConsume();
}
@Override
public List<PositionedStack> getIngredients() {
return getCycledIngredients(cycleticks / 20, inputs);
}
@Override
public PositionedStack getResult() {
return output;
}
@Override
public List<PositionedStack> getOtherStacks() {
return otherStacks;
}
@Override
public boolean contains(Collection<PositionedStack> ingredients, ItemStack ingredient) {
if(ingredients == inputs) {
boolean skippedPool = false;
for(PositionedStack stack : ingredients) {
if(!skippedPool) {
skippedPool = true;
continue;
}
if(stack.contains(ingredient))
return true;
}
}
return super.contains(ingredients, ingredient);
}
}
@Override
public String getRecipeName() {
return I18n.translateToLocal("botania.nei.manaPool");
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BLANK;
}
@Override
public int recipiesPerPage() {
return 1;
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(70, 36, 18, 18), "botania.manaPool"));
}
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
GlStateManager.enableBlend();
GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F);
GuiDraw.changeTexture(LibResources.GUI_MANA_INFUSION_OVERLAY);
GuiDraw.drawTexturedModalRect(45, 20, 38, 35, 92, 50);
HUDHandler.renderManaBar(32, 80, 0x0000FF, 0.75F, ((CachedManaPoolRecipe) arecipes.get(recipe)).mana, TilePool.MAX_MANA / 10);
RenderTilePool.forceMana = true;
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if(outputId.equals("botania.manaPool")) {
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
if(recipe == null)
continue;
arecipes.add(new CachedManaPoolRecipe(recipe));
}
} else super.loadCraftingRecipes(outputId, results);
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
if(recipe == null)
continue;
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result))
arecipes.add(new CachedManaPoolRecipe(recipe));
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
if(recipe == null)
continue;
CachedManaPoolRecipe crecipe = new CachedManaPoolRecipe(recipe);
if(crecipe.contains(crecipe.getIngredients(), ingredient) || crecipe.contains(crecipe.getOtherStacks(), ingredient))
arecipes.add(crecipe);
}
}
}
*/
@@ -1,145 +0,0 @@
/*
package vazkii.botania.client.integration.nei.recipe;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.block.ModBlocks;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
public class RecipeHandlerPetalApothecary extends TemplateRecipeHandler {
public class CachedPetalApothecaryRecipe extends CachedRecipe {
public List<PositionedStack> inputs = new ArrayList<PositionedStack>();
public PositionedStack output;
public CachedPetalApothecaryRecipe(RecipePetals recipe, boolean addCenterItem) {
setIngredients(recipe.getInputs());
output = new PositionedStack(recipe.getOutput(), 111, 21);
if(addCenterItem)
inputs.add(new PositionedStack(new ItemStack(ModBlocks.altar), 73, 55));
}
public CachedPetalApothecaryRecipe(RecipePetals recipe) {
this(recipe, true);
}
public void setIngredients(List<Object> inputs) {
float degreePerInput = 360F / inputs.size();
float currentDegree = -90F;
for(Object o : inputs) {
int posX = (int) Math.round(73 + Math.cos(currentDegree * Math.PI / 180D) * 32);
int posY = (int) Math.round(55 + Math.sin(currentDegree * Math.PI / 180D) * 32);
if(o instanceof String)
this.inputs.add(new PositionedStack(OreDictionary.getOres((String) o), posX, posY));
else this.inputs.add(new PositionedStack(o, posX, posY));
currentDegree += degreePerInput;
}
}
@Override
public List<PositionedStack> getIngredients() {
return getCycledIngredients(cycleticks / 20, inputs);
}
@Override
public PositionedStack getResult() {
return output;
}
}
@Override
public String getRecipeName() {
return I18n.translateToLocal("botania.nei.petalApothecary");
}
public String getRecipeID() {
return "botania.petalApothecary";
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BLANK;
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(72, 54, 18, 18), getRecipeID()));
}
@Override
public int recipiesPerPage() {
return 1;
}
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
GlStateManager.enableBlend();
GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F);
GuiDraw.changeTexture(LibResources.GUI_PETAL_OVERLAY);
GuiDraw.drawTexturedModalRect(45, 10, 38, 7, 92, 92);
}
public List<? extends RecipePetals> getRecipes() {
return BotaniaAPI.petalRecipes;
}
public CachedPetalApothecaryRecipe getCachedRecipe(RecipePetals recipe) {
return new CachedPetalApothecaryRecipe(recipe);
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if(outputId.equals(getRecipeID())) {
for(RecipePetals recipe : getRecipes())
if(recipe.getOutput().getItem() != Items.skull)
arecipes.add(getCachedRecipe(recipe));
} else super.loadCraftingRecipes(outputId, results);
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for(RecipePetals recipe : getRecipes()){
if(recipe == null)
continue;
if(recipe.getOutput().getTagCompound() != null && NEIServerUtils.areStacksSameType(recipe.getOutput(), result) || recipe.getOutput().getTagCompound() == null && NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result) && recipe.getOutput().getItem() != Items.skull)
arecipes.add(getCachedRecipe(recipe));
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for(RecipePetals recipe : getRecipes()) {
if(recipe == null)
continue;
CachedPetalApothecaryRecipe crecipe = getCachedRecipe(recipe);
if(crecipe.contains(crecipe.inputs, ingredient) && recipe.getOutput().getItem() != Items.skull)
arecipes.add(crecipe);
}
}
}
*/
@@ -1,140 +0,0 @@
/*
package vazkii.botania.client.integration.nei.recipe;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipePureDaisy;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.lib.LibBlockNames;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
public class RecipeHandlerPureDaisy extends TemplateRecipeHandler {
public class CachedPureDaisyRecipe extends CachedRecipe {
public List<PositionedStack> inputs = new ArrayList<PositionedStack>();
public PositionedStack output;
public List<PositionedStack> otherStacks = new ArrayList<PositionedStack>();
public CachedPureDaisyRecipe(RecipePureDaisy recipe) {
if(recipe == null)
return;
inputs.add(new PositionedStack(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY), 71, 23));
if(recipe.getInput() instanceof String)
inputs.add(new PositionedStack(OreDictionary.getOres((String) recipe.getInput()), 42, 23));
else inputs.add(new PositionedStack(new ItemStack((Block) recipe.getInput()), 42, 23));
output = new PositionedStack(new ItemStack(recipe.getOutputState().getBlock()), 101, 23); // todo 1.8 getOutput -> getOutputState
}
@Override
public List<PositionedStack> getIngredients() {
return getCycledIngredients(cycleticks / 20, inputs);
}
@Override
public PositionedStack getResult() {
return output;
}
@Override
public List<PositionedStack> getOtherStacks() {
return otherStacks;
}
@Override
public boolean contains(Collection<PositionedStack> ingredients, ItemStack ingredient) {
if(ingredients == inputs) {
for(PositionedStack stack : ingredients)
if(stack.contains(ingredient))
return true;
}
return super.contains(ingredients, ingredient);
}
}
@Override
public String getRecipeName() {
return I18n.translateToLocal("botania.nei.pureDaisy");
}
@Override
public String getGuiTexture() {
return LibResources.GUI_NEI_BLANK;
}
@Override
public int recipiesPerPage() {
return 2;
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(70, 22, 18, 18), "botania.pureDaisy"));
}
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
GlStateManager.enableBlend();
GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F);
GuiDraw.changeTexture(LibResources.GUI_PURE_DAISY_OVERLAY);
GuiDraw.drawTexturedModalRect(45, 10, 0, 0, 65, 44);
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if(outputId.equals("botania.pureDaisy")) {
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
if(recipe == null)
continue;
arecipes.add(new CachedPureDaisyRecipe(recipe));
}
} else super.loadCraftingRecipes(outputId, results);
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
if(recipe == null)
continue;
if(NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(recipe.getOutputState().getBlock()), result)) // todo 1.8 getOutput -> getOutputState
arecipes.add(new CachedPureDaisyRecipe(recipe));
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
if(recipe == null)
continue;
CachedPureDaisyRecipe crecipe = new CachedPureDaisyRecipe(recipe);
if(crecipe.contains(crecipe.getIngredients(), ingredient) || crecipe.contains(crecipe.getOtherStacks(), ingredient))
arecipes.add(crecipe);
}
}
}
*/
@@ -1,59 +0,0 @@
/*
package vazkii.botania.client.integration.nei.recipe;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.translation.I18n;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.api.recipe.RecipeRuneAltar;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.mana.TilePool;
import codechicken.nei.PositionedStack;
public class RecipeHandlerRunicAltar extends RecipeHandlerPetalApothecary {
public class CachedRunicAltarRecipe extends CachedPetalApothecaryRecipe {
public int manaUsage;
public CachedRunicAltarRecipe(RecipeRuneAltar recipe) {
super(recipe, false);
if(recipe == null)
return;
manaUsage = recipe.getManaUsage();
inputs.add(new PositionedStack(new ItemStack(ModBlocks.runeAltar), 73, 55));
}
}
@Override
public String getRecipeName() {
return I18n.translateToLocal("botania.nei.runicAltar");
}
@Override
public String getRecipeID() {
return "botania.runicAltar";
}
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
HUDHandler.renderManaBar(32, 113, 0x0000FF, 0.75F, ((CachedRunicAltarRecipe) arecipes.get(recipe)).manaUsage, TilePool.MAX_MANA / 10);
}
@Override
public List<? extends RecipePetals> getRecipes() {
return BotaniaAPI.runeAltarRecipes;
}
@Override
public CachedPetalApothecaryRecipe getCachedRecipe(RecipePetals recipe) {
return new CachedRunicAltarRecipe((RecipeRuneAltar) recipe);
}
}
*/
@@ -18,9 +18,8 @@ public class TileManaFlame extends TileMod {
private static final String TAG_COLOR = "color";
int color = 0x20FF20;
int lightColor = -1;
private int color = 0x20FF20;
private int lightColor = -1;
public void setColor(int color) {
this.color = color;
@@ -190,7 +190,8 @@ public class InternalMethodHandler extends DummyMethodHandler {
@Override
public IItemHandlerModifiable getBaublesInventoryWrapped(EntityPlayer player) {
return new InvWrapper(getBaublesInventory(player));
IInventory inv = getBaublesInventory(player);
return inv == null ? null : new InvWrapper(inv);
}
@Override
@@ -163,8 +163,6 @@ public class CommonProxy {
ConfigHandler.loadPostInit();
LexiconData.postInit();
registerNEIStuff();
int words = 0;
for(LexiconEntry entry : BotaniaAPI.getAllEntries())
for(LexiconPage page : entry.pages) {
@@ -226,10 +224,6 @@ public class CommonProxy {
event.registerServerCommand(new CommandSkyblockSpread());
}
public void registerNEIStuff() {
// NO-OP
}
public void setEntryToOpen(LexiconEntry entry) {
// NO-OP
}