Compare commits

...
Author SHA1 Message Date
Thomas Guimbretiere 09f8bbe33e Full TE3 support 2013-11-17 14:08:54 +01:00
Thomas Guimbretiere 1908f39995 Added support for TE
Added some stuff to the reflection helper.
2013-11-16 15:14:30 +01:00
Thomas Guimbretiere 748fc3fffa Added License 2013-11-12 23:53:20 +01:00
Thomas Guimbretiere 250dc6ac2a Added try/catch around getPickBlock in the raytracing. Was crashing on some circunstances. 2013-10-26 13:53:39 +02:00
Thomas Guimbretiere b81d2d3709 Added tag Nightly_131025 for changeset bc4937f3a7d4 2013-10-26 13:53:05 +02:00
Thomas Guimbretiere a873131d2f Removed some wrong imports. 2013-10-26 12:54:37 +02:00
Thomas Guimbretiere b5689428e8 Added assets folder 2013-10-26 12:48:13 +02:00
Thomas Guimbretiere d6285e2932 Fixed enchant table rendering out of screen. 2013-10-25 14:57:41 +02:00
Thomas Guimbretiere eb348d10fc Fixed string discovery for keybind config screen.
Adding tag is controlled by a config option.
2013-10-25 14:22:29 +02:00
Thomas Guimbretiere 7eb3ddb50c Added an helper for reflection.
Moved all mod identification to a static class.
Dump of KeyHandler string + mod on startup.
2013-10-25 13:35:01 +02:00
Thomas Guimbretiere fde934363c Cleanup 2013-10-24 21:54:33 +02:00
Thomas Guimbretiere dce9809205 Cleanup 2013-10-24 21:51:32 +02:00
Thomas Guimbretiere 15bee287f3 Added tag Nightly_131024 for changeset 02ebbb4aeebe 2013-10-24 18:39:41 +02:00
31 changed files with 1245 additions and 363 deletions

No files matched your search

+387
View File
@@ -0,0 +1,387 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
APACHE COMMONS MATH DERIVATIVE WORKS:
The Apache commons-math library includes a number of subcomponents
whose implementation is derived from original sources written
in C or Fortran. License terms of the original sources
are reproduced below.
===============================================================================
For the lmder, lmpar and qrsolv Fortran routine from minpack and translated in
the LevenbergMarquardtOptimizer class in package
org.apache.commons.math3.optimization.general
Original source copyright and license statement:
Minpack Copyright Notice (1999) University of Chicago. All rights reserved
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
3. The end-user documentation included with the
redistribution, if any, must include the following
acknowledgment:
"This product includes software developed by the
University of Chicago, as Operator of Argonne National
Laboratory.
Alternately, this acknowledgment may appear in the software
itself, if and wherever such third-party acknowledgments
normally appear.
4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
BE CORRECTED.
5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
POSSIBILITY OF SUCH LOSS OR DAMAGES.
===============================================================================
Copyright and license statement for the odex Fortran routine developed by
E. Hairer and G. Wanner and translated in GraggBulirschStoerIntegrator class
in package org.apache.commons.math3.ode.nonstiff:
Copyright (c) 2004, Ernst Hairer
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
===============================================================================
Copyright and license statement for the original lapack fortran routines
translated in EigenDecompositionImpl class in package
org.apache.commons.math3.linear:
Copyright (c) 1992-2008 The University of Tennessee. All rights reserved.
$COPYRIGHT$
Additional copyrights may follow
$HEADER$
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer listed
in this license in the documentation and/or other materials
provided with the distribution.
- Neither the name of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
===============================================================================
Copyright and license statement for the original Mersenne twister C
routines translated in MersenneTwister class in package
org.apache.commons.math3.random:
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The names of its contributors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
===============================================================================
The class "org.apache.commons.math3.exception.util.LocalizedFormatsTest" is
an adapted version of "OrekitMessagesTest" test class for the Orekit library
The "org.apache.commons.math3.analysis.interpolation.HermiteInterpolator"
has been imported from the Orekit space flight dynamics library.
Th Orekit library is described at:
https://www.orekit.org/forge/projects/orekit
The original files are distributed under the terms of the Apache 2 license
which is: Copyright 2010 CS Communication & Systèmes
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 KiB

+9 -18
View File
@@ -1,35 +1,26 @@
package mcp.mobius.waila;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import org.lwjgl.input.Keyboard;
import codechicken.core.Profiler;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.api.API;
import codechicken.nei.forge.GuiContainerManager;
import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;
import codechicken.nei.recipe.ICraftingHandler;
import codechicken.nei.recipe.ProfilerRecipeHandler;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.gui.screens.ScreenBase;
import mcp.mobius.waila.gui.screens.config.ScreenConfig;
import mcp.mobius.waila.gui.screens.config.ScreenHUDConfig;
import mcp.mobius.waila.gui.screens.config.ScreenWailaConfig;
import mcp.mobius.waila.gui.screens.info.ScreenEnchants;
import mcp.mobius.waila.gui.testing.ScreenTest;
import mcp.mobius.waila.handlers.nei.HandlerEnchants;
import mcp.mobius.waila.overlay.RayTracing;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumMovingObjectType;
import org.lwjgl.input.Keyboard;
import codechicken.nei.api.API;
import codechicken.nei.forge.GuiContainerManager;
import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;
import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.registry.LanguageRegistry;
@@ -46,14 +37,14 @@ public class ConfigKeyHandler extends KeyHandler {
new KeyBinding(Constants.BIND_WAILA_LIQUID, Keyboard.KEY_NUMPAD2),
new KeyBinding(Constants.BIND_WAILA_RECIPE, Keyboard.KEY_NUMPAD3),
new KeyBinding(Constants.BIND_WAILA_USAGE, Keyboard.KEY_NUMPAD4),
new KeyBinding(Constants.BIND_WAILA_TESTING, Keyboard.KEY_NUMPAD9),
//new KeyBinding(Constants.BIND_WAILA_TESTING, Keyboard.KEY_NUMPAD9),
}, new boolean[]{
false,
false,
false,
false,
false,
false
//false
});
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_CFG, "[Waila] Config screen");
+1
View File
@@ -19,6 +19,7 @@ public final class Constants {
public static String CFG_WAILA_MODE = "waila.cfg.showmode";
public static String CFG_WAILA_LIQUID = "waila.cfg.liquid";
public static String CFG_WAILA_METADATA = "waila.cfg.metadata";
public static String CFG_WAILA_KEYBIND = "waila.cfg.keybind";
public static String CFG_WAILA_POSX = "waila.cfg.posx";
public static String CFG_WAILA_POSY = "waila.cfg.posy";
public static String CFG_WAILA_SCALE = "waila.cfg.scale";
+19 -19
View File
@@ -1,5 +1,21 @@
package mcp.mobius.waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import mcp.mobius.waila.addons.appeng.AppEngModule;
import mcp.mobius.waila.addons.buildcraft.BCModule;
import mcp.mobius.waila.addons.enderstorage.EnderStorageModule;
import mcp.mobius.waila.addons.gravestone.GravestoneModule;
import mcp.mobius.waila.addons.ic2.IC2Module;
import mcp.mobius.waila.addons.thaumcraft.ThaumcraftModule;
import mcp.mobius.waila.addons.thermalexpansion.ThermalExpansionModule;
import mcp.mobius.waila.addons.twilightforest.TwilightForestModule;
import mcp.mobius.waila.addons.vanillamc.HUDHandlerVanilla;
import mcp.mobius.waila.handlers.SummaryProviderDefault;
import mcp.mobius.waila.handlers.hud.HUDHandlerExternal;
import mcp.mobius.waila.handlers.hud.HUDHandlerWaila;
import mcp.mobius.waila.handlers.tooltip.TooltipHandlerWaila;
import mcp.mobius.waila.overlay.WailaTickHandler;
import mcp.mobius.waila.server.ProxyServer;
import net.minecraft.item.Item;
import org.lwjgl.input.Keyboard;
@@ -11,25 +27,6 @@ import codechicken.nei.forge.GuiContainerManager;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import mcp.mobius.waila.addons.appeng.AppEngModule;
import mcp.mobius.waila.addons.betterbarrels.BetterBarrelsModule;
import mcp.mobius.waila.addons.buildcraft.BCModule;
import mcp.mobius.waila.addons.enderstorage.EnderStorageModule;
import mcp.mobius.waila.addons.gravestone.GravestoneModule;
import mcp.mobius.waila.addons.ic2.IC2Module;
import mcp.mobius.waila.addons.thaumcraft.ThaumcraftModule;
import mcp.mobius.waila.addons.twilightforest.TwilightForestModule;
import mcp.mobius.waila.addons.vanillamc.HUDHandlerVanilla;
import mcp.mobius.waila.gui_old.NEI.HandlerTechTree;
import mcp.mobius.waila.gui_old.NEI.HandlerWiki;
import mcp.mobius.waila.handlers.SummaryProviderDefault;
import mcp.mobius.waila.handlers.hud.HUDHandlerExternal;
import mcp.mobius.waila.handlers.hud.HUDHandlerWaila;
import mcp.mobius.waila.handlers.nei.HandlerEnchants;
import mcp.mobius.waila.handlers.tooltip.TooltipHandlerWaila;
import mcp.mobius.waila.overlay.WailaTickHandler;
import mcp.mobius.waila.server.ProxyServer;
public class ProxyClient extends ProxyServer {
@@ -87,6 +84,9 @@ public class ProxyClient extends ProxyServer {
/* Applied Energetics */
AppEngModule.register();
/* Thermal Expansion */
ThermalExpansionModule.register();
}
}
@@ -0,0 +1,51 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerConduitFluid implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (config.getConfig("thermalexpansion.fluidtype")){
try {
FluidStack fluid = (FluidStack)ThermalExpansionModule.TileConduitFluid_getRenderFluid.invoke(accessor.getTileEntity());
try{
currenttip.add(fluid.getFluid().getLocalizedName());
} catch (NullPointerException f){
currenttip.add("Empty");
}
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,40 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.util.List;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerEnergyCell implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("thermalexpansion.energycell")) return currenttip;
int energyReceive = accessor.getNBTInteger(accessor.getNBTData(), "Recv");
int energySend = accessor.getNBTInteger(accessor.getNBTData(), "Send");
currenttip.add(String.format("In/Out : %d / %d RF/t", energyReceive, energySend));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,49 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerIEnergyHandler implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("thermalexpansion.energyhandler")) return currenttip;
int energy = accessor.getNBTInteger(accessor.getNBTData(), "Energy");
try {
Integer maxEnergy = (Integer)ThermalExpansionModule.IEnergyHandler_getMaxStorage.invoke(accessor.getTileEntity(), ForgeDirection.UNKNOWN);
if (maxEnergy != 0)
currenttip.add(String.format("%d / %d RF", energy, maxEnergy));
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,58 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.util.List;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerISecureTile implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (config.getConfig("thermalexpansion.owner")){
String owner = accessor.getNBTData().getString("Owner");
int iaccess = accessor.getNBTInteger(accessor.getNBTData(), "Access");
String access = "INVALID";
switch(iaccess){
case 0:
access = "Public";
break;
case 1:
access = "Restricted";
break;
case 2:
access = "Private";
break;
}
currenttip.add(String.format("Owner : \u00a7f%s\u00a7r [ %s ]", owner, access));
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,81 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTank implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("thermalexpansion.fluidtype")) return currenttip;
try {
FluidStack fluid = (FluidStack)ThermalExpansionModule.TileTank_getTankFluid.invoke(accessor.getTileEntity());
String name = currenttip.get(0);
try{
name += String.format(" < %s >", fluid.getFluid().getLocalizedName());
} catch (NullPointerException f){
name += " < Empty >";
}
currenttip.set(0, name);
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
try {
if (config.getConfig("thermalexpansion.fluidamount")){
int amount = 0;
if (accessor.getNBTData().hasKey("Amount"))
amount = accessor.getNBTInteger(accessor.getNBTData(), "Amount");
Integer capacity = (Integer)ThermalExpansionModule.TileTank_getTankCapacity.invoke(accessor.getTileEntity());
currenttip.add(String.format("%d / %d mB", amount, capacity));
}
if (config.getConfig("thermalexpansion.tankmode")){
Byte mode = (Byte)ThermalExpansionModule.TileTank_mode.get(accessor.getTileEntity());
if (mode == 0)
currenttip.add("Mode : \u00a7aInput");
else if (mode == 1)
currenttip.add("Mode : \u00a7cOutput");
else
currenttip.add(String.format("Mode : Unknown (%d)", mode));
}
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,86 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.util.List;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTesseract implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (config.getConfig("thermalexpansion.tesssendrecv")){
String send = "Send : ";
String recv = "Recv : ";
switch (accessor.getNBTInteger(accessor.getNBTData(), "Item.Mode")){
case 0:
send += "\u00a7aItem ";
break;
case 1:
recv += "\u00a7aItem ";
break;
case 2:
send += "\u00a7aItem ";
recv += "\u00a7aItem ";
break;
}
switch (accessor.getNBTInteger(accessor.getNBTData(), "Fluid.Mode")){
case 0:
send += "\u00a79Fluid ";
break;
case 1:
recv += "\u00a79Fluid ";
break;
case 2:
send += "\u00a79Fluid ";
recv += "\u00a79Fluid ";
break;
}
switch (accessor.getNBTInteger(accessor.getNBTData(), "Energy.Mode")){
case 0:
send += "\u00a7cEnergy";
break;
case 1:
recv += "\u00a7cEnergy";
break;
case 2:
send += "\u00a7cEnergy";
recv += "\u00a7cEnergy";
break;
}
if (!send.equals("Send : "))
currenttip.add(send);
if (!send.equals("Recv : "))
currenttip.add(recv);
}
if (config.getConfig("thermalexpansion.tessfreq"))
currenttip.add(String.format("Frequency : %d",accessor.getNBTInteger(accessor.getNBTData(), "Frequency")));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,120 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.logging.Level;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class ThermalExpansionModule {
public static Class IEnergyHandler = null;
public static Method IEnergyHandler_getMaxStorage = null;
public static Class TileEnergyCell = null;
public static Class TileTank = null;
public static Method TileTank_getTankFluid = null;
public static Method TileTank_getTankCapacity = null;
public static Field TileTank_mode = null;
public static Class TileConduitFluid = null;
public static Method TileConduitFluid_getRenderFluid = null;
public static Method TileConduitFluid_getRenderFluidLevel = null;
public static Class TileTesseract = null;
public static Class ISecureTile = null;
//public static Field TileTesseract_modItem = null;
//public static Field TileTesseract_modFluid = null;
//public static Field TileTesseract_modEnergy = null;
//public static Class TileConduitBase = null;
//public static Field TileConduitBase_isInput = null;
//public static Field TileConduitBase_isOutput = null;
public static void register(){
try{
Class ModThermalExpansion = Class.forName("thermalexpansion.ThermalExpansion");
mod_Waila.log.log(Level.INFO, "Thermal Expansion mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[Thermal Expansion] ThermalExpansion mod not found.");
return;
}
try{
IEnergyHandler = Class.forName("cofh.api.energy.IEnergyHandler");
IEnergyHandler_getMaxStorage = IEnergyHandler.getMethod("getMaxEnergyStored", ForgeDirection.class);
TileEnergyCell = Class.forName("thermalexpansion.block.energycell.TileEnergyCell");
TileTank = Class.forName("thermalexpansion.block.tank.TileTank");
TileTank_getTankFluid = TileTank.getMethod("getTankFluid");
TileTank_getTankCapacity = TileTank.getMethod("getTankCapacity");
TileTank_mode = TileTank.getField("mode");
TileConduitFluid = Class.forName("thermalexpansion.block.conduit.fluid.TileConduitFluidTrans");
TileConduitFluid_getRenderFluid = TileConduitFluid.getMethod("getRenderFluid");
TileConduitFluid_getRenderFluidLevel = TileConduitFluid.getMethod("getRenderFluidLevel");
TileTesseract = Class.forName("thermalexpansion.block.tesseract.TileTesseract");
ISecureTile = Class.forName("cofh.api.tileentity.ISecureTile");
//TileTesseract_modItem = TileTesseract.getField("modItem");
//TileTesseract_modFluid = TileTesseract.getField("modFluid");
//TileTesseract_modEnergy = TileTesseract.getField("modEnergy");
//TileConduitBase = Class.forName("thermalexpansion.block.conduit.TileConduitBase");
//TileConduitBase_isInput = TileConduitBase.getField("isInput");
//TileConduitBase_isOutput = TileConduitBase.getField("isOutput");
//TileEnergyCell_energyReceive = TileEnergyCell.getField("energyReceive");
//TileEnergyCell_energySend = TileEnergyCell.getField("energySend");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[Thermal Expansion] Class not found. " + e);
return;
} catch (NoSuchMethodException e){
mod_Waila.log.log(Level.WARNING, "[Thermal Expansion] Method not found." + e);
return;
} catch (NoSuchFieldException e){
mod_Waila.log.log(Level.WARNING, "[Thermal Expansion] Field not found." + e);
return;
// } catch (Exception e){
// mod_Waila.log.log(Level.WARNING, "[Thermal Expansion] Unhandled exception." + e);
// return;
}
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.energyhandler", "Show RF storage");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.energycell", "Show ECell IN/OUT");
ExternalModulesHandler.instance().addConfig("Thermal Expansion", "thermalexpansion.fluidtype", "Show fluid type");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.fluidamount", "Show fluid amount");
ExternalModulesHandler.instance().addConfig("Thermal Expansion", "thermalexpansion.tankmode", "Show tank mode");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.tesssendrecv", "Tesseract mode");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.tessfreq", "Tesseract frequency");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.owner", "Show owner");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerIEnergyHandler(), IEnergyHandler);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerEnergyCell(), TileEnergyCell);
ExternalModulesHandler.instance().registerHeadProvider(new HUDHandlerTank(), TileTank);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTank(), TileTank);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerConduitFluid(), TileConduitFluid);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTesseract(), TileTesseract);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerISecureTile(), ISecureTile);
//ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerConduitBase(), TileConduitBase);
}
}
@@ -29,7 +29,7 @@ public class ScreenEnchants extends ScreenBase {
.setGeometry(new WidgetGeometry(40.0, 22.0, 16.0, 16.0, CType.ABSXY, CType.REL_X, WAlign.LEFT, WAlign.BOTTOM));
this.getRoot().addWidget("Table", new ViewTable(null))
.setGeometry(new WidgetGeometry(50.0, 50.0, 90.0, 90.0, CType.REL_X, CType.RELXY, WAlign.CENTER, WAlign.TOP));
.setGeometry(new WidgetGeometry(50.0, 50.0, 90.0, 80.0, CType.REL_X, CType.RELXY, WAlign.CENTER, WAlign.TOP));
((ViewTable)this.getRoot().getWidget("Table"))
.setColumnsTitle("\u00a7a\u00a7oName","\u00a7a\u00a7oMin lvl","\u00a7a\u00a7oMax lvl","\u00a7a\u00a7oWeight", "\u00a7a\u00a7oMod")
@@ -1,57 +0,0 @@
package mcp.mobius.waila.gui_old;
import mcp.mobius.waila.gui_old.widget.ContainerTable;
import mcp.mobius.waila.gui_old.widget.Label;
import mcp.mobius.waila.gui_old.widget.StackDisplay;
import net.minecraft.client.gui.GuiScreen;
public class GuiEnchantScreen extends BaseWailaScreen {
public ContainerTable widTable;
public StackDisplay widStackDisplay;
public Label widStackName;
public Label widStackEnchantability;
public GuiEnchantScreen(GuiScreen _parentGui) {
super(_parentGui);
this.zLevel = -1.0F;
this.widTable = new ContainerTable(this);
this.widStackDisplay = new StackDisplay(this);
this.widStackName = new Label(this);
this.widStackEnchantability = new Label(this);
this.widTable.setColumns(8, "\u00a7a\u00a7oName", "\u00a7a\u00a7oMin lvl", "\u00a7a\u00a7oMax lvl", "\u00a7a\u00a7oMod");
this.widTable.setHeight(this.res.getScaledHeight() - 16 - 32);
this.addWidget("datatable", this.widTable);
this.addWidget("stackdisplay", this.widStackDisplay);
this.addWidget("stackname", this.widStackName);
this.addWidget("stackenchant", this.widStackEnchantability);
}
@Override
/* Here we draw anything special, and super takes care of the buttons for us */
public void drawScreen(int i, int j, float f)
{
//this.parentGui.drawScreen(i, j, f);
//this.parentGui.allowUserInput = false;
super.drawScreen(i, j, f);
widTable.draw(this.getXCentered(widTable.getWidth()), 32, 0);
widStackDisplay.draw(this.getXCentered(widTable.getWidth()), 0, 0);
widStackName.draw(this.getXCentered(widTable.getWidth())+32, 0, 0);
widStackEnchantability.draw(this.getXCentered(widTable.getWidth())+32, 8, 0);
}
@Override
public void initGui()
{
}
@Override
public void drawDefaultBackground()
{
this.drawGradientRect(0, 0, this.width, this.height, 0xdd000000, 0xdd000000);
}
}
@@ -3,8 +3,6 @@ package mcp.mobius.waila.gui_old.NEI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import codechicken.core.ReflectionManager;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.FuelRecipeHandler;
@@ -14,13 +12,7 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
import codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
public class CraftingTreeNode {
@@ -169,6 +161,7 @@ public class CraftingTreeNode {
return curratedStacks;
}
@Override
public String toString(){
return this.elements.toString();
}
@@ -1,171 +0,0 @@
package mcp.mobius.waila.gui_old.NEI;
import java.lang.reflect.Method;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.gui_old.GuiEnchantScreen;
import mcp.mobius.waila.gui_old.widget.Label;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.forge.IContainerInputHandler;
public class HandlerEnchantment implements IContainerInputHandler {
static Class EplusApi;
static Method Tooltip;
@Override
public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) {
// TODO Auto-generated method stub
}
@Override
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) {
ItemStack stackover = gui.manager.getStackMouseOver();
if(stackover == null)
return false;
if(keyID == NEIClientConfig.getKeyBinding(Constants.BIND_SCREEN_ENCH)){
//try{
int itemEnchantability = stackover.getItem().getItemEnchantability();
if (itemEnchantability == 0){return false;}
Minecraft mc = Minecraft.getMinecraft();
GuiEnchantScreen enchantScreen = new GuiEnchantScreen(mc.currentScreen);
enchantScreen.widStackDisplay.setStack(stackover);
enchantScreen.widStackName.setLabel("\u00a7f" + stackover.getDisplayName());
enchantScreen.widStackEnchantability.setLabel(String.format("\u00a7fEnchantability : %s", itemEnchantability));
Enchantment[] enchants = null;
if (stackover.getItem() == Item.book)
enchants = Enchantment.enchantmentsBookList;
else
enchants = Enchantment.enchantmentsList;
for(Enchantment enchant : enchants){
if (enchant == null){continue;}
if (enchant.canApplyAtEnchantingTable(stackover) || stackover.getItem() == Item.book){
for (int lvl = enchant.getMinLevel(); lvl <= enchant.getMaxLevel(); lvl++){
int minEnchantEnchantability = enchant.getMinEnchantability(lvl);
int maxEnchantEnchantability = enchant.getMaxEnchantability(lvl);
int minItemEnchantability = 1;
int meanItemEnchantability = 1 + itemEnchantability/4;
int maxItemEnchantability = 1 + itemEnchantability/2;
int minModifiedEnchantability = (int)(0.85*minItemEnchantability + 0.5);
int meanModifiedEnchantability = (int)(1.00*meanItemEnchantability + 0.5);
int maxModifiedEnchantability = (int)(1.15*maxItemEnchantability + 0.5);
int minLevel = (int) ((minEnchantEnchantability - minModifiedEnchantability)/1.15);
int maxLevel = (int) ((maxEnchantEnchantability - maxModifiedEnchantability)/0.85);
int meanMinLevel = (int) ((minEnchantEnchantability - meanModifiedEnchantability)/1.0);
int meanMaxLevel = (int) ((maxEnchantEnchantability - meanModifiedEnchantability)/1.0);
enchantScreen.widTable.addRow(new Label(enchant.getTranslatedName(lvl)),
new Label(String.valueOf(minLevel)),
new Label(String.valueOf(maxLevel)),
//new Label(String.valueOf(meanMinLevel)),
//new Label(String.valueOf(meanMaxLevel)),
new Label("\u00a79\u00a7o"+ this.getEnchantModName(enchant))
);
//String description = this.getEnchantmentToolTip(enchant);
}
}
}
mc.displayGuiScreen(enchantScreen);
//}
//catch (NullPointerException e){
// System.out.printf("%s\n", e);
//}
}
return false;
}
public String getEnchantModName(Enchantment enchant){
String enchantPath = enchant.getClass().getProtectionDomain().getCodeSource().getLocation().toString();
String enchantModName = "<Unknown>";
for (String s: mod_Waila.instance.modSourceList.keySet())
if (enchantPath.contains(s))
enchantModName = mod_Waila.instance.modSourceList.get(s);
if (enchantModName.equals("Minecraft Coder Pack"))
enchantModName = "Minecraft";
return enchantModName;
}
@Override
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey,
int button) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onMouseClicked(GuiContainer gui, int mousex, int mousey,
int button) {
// TODO Auto-generated method stub
}
@Override
public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) {
// TODO Auto-generated method stub
}
@Override
public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey,
int scrolled) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onMouseScrolled(GuiContainer gui, int mousex, int mousey,
int scrolled) {
// TODO Auto-generated method stub
}
@Override
public void onMouseDragged(GuiContainer gui, int mousex, int mousey,
int button, long heldTime) {
// TODO Auto-generated method stub
}
private String getEnchantmentToolTip(Enchantment enchantment) {
try {
if (EplusApi == null) {
EplusApi = Class.forName("eplus.api.EplusApi");
}
if (Tooltip == null) {
Tooltip = EplusApi.getMethod("getEnchantmentToolTip", Enchantment.class);
}
return String.valueOf(Tooltip.invoke(null, enchantment));
} catch (Exception e) {
return "";
}
}
}
@@ -2,23 +2,12 @@ package mcp.mobius.waila.gui_old.NEI;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.gui_old.GuiIngameWiki;
import mcp.mobius.waila.gui_old.GuiTechTree;
import mcp.mobius.waila.gui_old.widget.ComponentDisplay;
import mcp.mobius.waila.gui_old.widget.StackDisplay;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.forge.IContainerInputHandler;
@@ -6,10 +6,10 @@ import mcp.mobius.waila.Constants;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.gui_old.GuiIngameWiki;
import mcp.mobius.waila.gui_old.widget.Label;
import mcp.mobius.waila.handlers.SummaryProvider;
import mcp.mobius.waila.tools.ModIdentification;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
@@ -58,7 +58,7 @@ public class HandlerWiki implements IContainerInputHandler {
Minecraft mc = Minecraft.getMinecraft();
GuiIngameWiki wikiScreen = new GuiIngameWiki(mc.currentScreen);
wikiScreen.widReader.setText(this.getDescriptionString(mod_Waila.instance.getModID(stackover), stackover.getItemName(), String.valueOf(stackover.getItemDamage())));
wikiScreen.widReader.setText(this.getDescriptionString(ModIdentification.idFromStack(stackover), stackover.getItemName(), String.valueOf(stackover.getItemDamage())));
wikiScreen.widStack.setStack(stackover);
wikiScreen.widItemName.setLabel(stackover.getDisplayName());
@@ -3,8 +3,6 @@ package mcp.mobius.waila.gui_old.widget;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class DraggableViewport extends BaseWidget {
@@ -2,10 +2,8 @@ package mcp.mobius.waila.gui_old.widget;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
@@ -20,7 +18,7 @@ public class StackDisplay extends BaseWidget {
public StackDisplay(GuiScreen parent){
this.parent = parent;
this.drawItems.zLevel = 500.0f;
StackDisplay.drawItems.zLevel = 500.0f;
};
public StackDisplay(GuiScreen parent, ItemStack stack){
@@ -5,6 +5,7 @@ import java.util.List;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.tools.ModIdentification;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
@@ -23,7 +24,7 @@ public class HUDHandlerWaila implements IHighlightHandler {
public List<String> handleTextData(ItemStack itemStack, World world, EntityPlayer player, MovingObjectPosition mop, List<String> currenttip, Layout layout) {
if (layout == Layout.FOOTER){
String modName = mod_Waila.instance.getModName(itemStack);
String modName = ModIdentification.nameFromStack(itemStack);
if (modName != null && !modName.equals(""))
currenttip.add("\u00a79\u00a7o" + modName);
} else if (layout == Layout.HEADER && ConfigHandler.instance().getConfig(Constants.CFG_WAILA_METADATA, false)){
@@ -6,6 +6,7 @@ import java.util.logging.Level;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.gui.screens.info.ScreenEnchants;
import mcp.mobius.waila.tools.ModIdentification;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.enchantment.Enchantment;
@@ -93,7 +94,7 @@ public class HandlerEnchants implements IContainerInputHandler {
colorcode + String.valueOf(minLevel),
colorcode + String.valueOf(maxLevel),
colorcode + String.valueOf(enchant.getWeight()),
"\u00a79\u00a7o"+ this.getEnchantModName(enchant));
"\u00a79\u00a7o"+ ModIdentification.nameFromObject(enchant));
}
}
}
@@ -103,6 +104,7 @@ public class HandlerEnchants implements IContainerInputHandler {
return false;
}
/*
public String getEnchantModName(Enchantment enchant){
String enchantPath = enchant.getClass().getProtectionDomain().getCodeSource().getLocation().toString();
@@ -116,7 +118,8 @@ public class HandlerEnchants implements IContainerInputHandler {
if (enchantModName.equals("Minecraft Coder Pack"))
enchantModName = "Minecraft";
return enchantModName;
}
}
*/
@Override
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) { return false; }
@@ -1,15 +1,15 @@
package mcp.mobius.waila.handlers.tooltip;
import java.util.List;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.tools.ModIdentification;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import codechicken.nei.forge.IContainerTooltipHandler;
public class TooltipHandlerWaila implements IContainerTooltipHandler {
private mod_Waila waila = mod_Waila.instance;
@Override
public List<String> handleTooltipFirst(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
return currenttip;
@@ -17,7 +17,7 @@ public class TooltipHandlerWaila implements IContainerTooltipHandler {
@Override
public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, List<String> currenttip) {
String canonicalName = waila.getModName(itemstack);
String canonicalName = ModIdentification.nameFromStack(itemstack);
if (canonicalName != null && !canonicalName.equals(""))
currenttip.add("\u00a79\u00a7o" + canonicalName);
return currenttip;
+44 -49
View File
@@ -1,7 +1,9 @@
package mcp.mobius.waila;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -11,21 +13,26 @@ import mcp.mobius.waila.api.IWailaRegistrar;
import mcp.mobius.waila.network.WailaConnectionHandler;
import mcp.mobius.waila.network.WailaPacketHandler;
import mcp.mobius.waila.server.ProxyServer;
import mcp.mobius.waila.tools.ModIdentification;
import mcp.mobius.waila.tools.Reflect;
import net.minecraft.client.resources.I18n;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property;
import codechicken.core.CommonUtils;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.IMCCallback;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
@@ -34,6 +41,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.ItemData;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid="Waila", name="Waila", version="1.4.0_dev")
@NetworkMod(channels = {"Waila"},clientSideRequired=false, serverSideRequired=false, connectionHandler = WailaConnectionHandler.class,
@@ -48,10 +56,8 @@ public class mod_Waila {
public static ProxyServer proxy;
public static Logger log = Logger.getLogger("Waila");
private HashMap<Integer, String> itemMap = new HashMap<Integer, String>();
public Configuration config = null;
public boolean serverPresent = false;
public HashMap<String, String> modSourceList = new HashMap<String, String>();
public static int posX;
public static int posY;
@@ -70,6 +76,9 @@ public class mod_Waila {
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_MODE, true);
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_LIQUID, false);
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_METADATA, false);
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_KEYBIND, true);
posX = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_POSX, 5000).getInt();
posY = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_POSY, 100).getInt();
@@ -93,30 +102,38 @@ public class mod_Waila {
@PostInit
public void postInit(FMLPostInitializationEvent event) {
/* This section is about preloading the name/modid of the items in a table, so we don't look it up at every cycle */
NBTTagList itemDataList = new NBTTagList();
GameData.writeItemData(itemDataList);
ModIdentification.init();
for(int i = 0; i < itemDataList.tagCount(); i++)
{
ItemData itemData = new ItemData((NBTTagCompound) itemDataList.tagAt(i));
this.itemMap.put(itemData.getItemId(), itemData.getModId());
}
if (ConfigHandler.instance().getConfig(Constants.CFG_WAILA_KEYBIND)){
for (ModContainer mod : Loader.instance().getModList()) {
this.modSourceList.put(mod.getSource().getName(), mod.getName());
//log.log(Level.INFO, String.format("%s %s", mod.getSource().getName(), mod.getName()));
for (String key: ModIdentification.keyhandlerStrings.keySet()){
String orig = I18n.func_135053_a(key);
if (orig.equals(key))
orig = LanguageRegistry.instance().getStringLocalization(key);
if (orig.isEmpty())
orig = key;
String modif;
if (orig.startsWith("[") || orig.contains(":"))
modif = orig;
else{
String id = ModIdentification.keyhandlerStrings.get(key);
if (id.contains("."))
id = id.split("\\.")[0];
if (id.length() > 10)
id = id.substring(0, 11);
if (id.isEmpty())
id = "????";
modif = String.format("[%s] %s", id, orig);
}
LanguageRegistry.instance().addStringLocalization(key, modif);
}
}
this.modSourceList.put("1.6.2.jar", "Minecraft");
this.modSourceList.put("1.6.3.jar", "Minecraft");
this.modSourceList.put("1.6.4.jar", "Minecraft");
// for (String s : this.modSourceList.keySet())
// if (this.modSourceList.get(s) == "Minecraft Coder Pack")
// this.modSourceList.put(s, "Minecraft");
}
@IMCCallback
@@ -166,28 +183,6 @@ public class mod_Waila {
}
public String getModName(ItemStack itemstack){
try{
String modID = this.itemMap.get(itemstack.itemID);
ModContainer mod = CommonUtils.findModContainer(modID);
String modname = mod == null ? modID : mod.getName();
return modname;
} catch (NullPointerException e){
//System.out.printf("NPE : %s\n",itemstack.toString());
return "";
}
}
public String getModID(ItemStack itemstack){
try{
String modID = this.itemMap.get(itemstack.itemID);
return modID;
} catch (NullPointerException e){
//System.out.printf("NPE : %s\n",itemstack.toString());
return "";
}
}
public static void updateColors(){
alpha = (int)(ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_ALPHA) / 100.0f * 256) << 24;
bgcolor = alpha + ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_BGCOLOR);
@@ -3,13 +3,11 @@ package mcp.mobius.waila.overlay;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import codechicken.nei.api.IHighlightHandler;
import codechicken.nei.api.ItemInfo;
import codechicken.nei.forge.GuiContainerManager;
import cpw.mods.fml.common.ModContainer;
@@ -22,21 +20,13 @@ import java.awt.Point;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ConfigHandler;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.IShearable;
import static codechicken.core.gui.GuiDraw.*;
import static mcp.mobius.waila.gui.helpers.UIHelper.*;
public class OverlayRenderer {
+7 -5
View File
@@ -48,9 +48,9 @@ public class RayTracing {
float f = 1.0F;
float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f;
float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f;
double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double)f;
double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double)f + 1.62D - (double)player.yOffset;
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double)f;
double d0 = player.prevPosX + (player.posX - player.prevPosX) * f;
double d1 = player.prevPosY + (player.posY - player.prevPosY) * f + 1.62D - player.yOffset;
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * f;
Vec3 vec3 = world.getWorldVec3Pool().getVecFromPool(d0, d1, d2);
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI);
float f4 = MathHelper.sin(-f2 * 0.017453292F - (float)Math.PI);
@@ -59,7 +59,7 @@ public class RayTracing {
float f7 = f4 * f5;
float f8 = f3 * f5;
double d3 = 5.0D;
Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3);
Vec3 vec31 = vec3.addVector(f7 * d3, f6 * d3, f8 * d3);
return world.clip(vec3, vec31, true);
}
@@ -107,10 +107,12 @@ public class RayTracing {
if(items.size() > 0)
return items;
try{
ItemStack pick = mouseoverBlock.getPickBlock(raytracedTarget, world, x, y, z);
if(pick != null)
items.add(pick);
}catch(Exception e){}
if(items.size() > 0)
return items;
@@ -2,7 +2,6 @@ package mcp.mobius.waila.overlay;
import java.util.EnumSet;
import mcp.mobius.waila.mod_Waila;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
+143
View File
@@ -0,0 +1,143 @@
package mcp.mobius.waila.tools;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mcp.mobius.waila.mod_Waila;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.item.crafting.IRecipe;
public class AccessHelper {
public static Field getDeclaredField(String classname, String fieldname){
try {
Class class_ = Class.forName(classname);
Field field_ = class_.getDeclaredField(fieldname);
field_.setAccessible(true);
mod_Waila.log.fine(String.format("++ Found field %s %s\n", classname, fieldname));
return field_;
}
catch (NoSuchFieldException e) {
mod_Waila.log.warning(String.format("== Field %s %s not found !\n", classname, fieldname));
return null;
}
catch (SecurityException e) {
mod_Waila.log.warning(String.format("== Field %s %s security exception !\n", classname, fieldname));
return null;
}
catch (ClassNotFoundException e) {
mod_Waila.log.warning(String.format("== Class %s not found !\n", classname));
return null;
}
}
public static Object getField(String classname, String fieldname, Object instance){
try {
Class class_ = Class.forName(classname);
Field field_ = class_.getDeclaredField(fieldname);
field_.setAccessible(true);
mod_Waila.log.fine(String.format("++ Found field %s %s\n", classname, fieldname));
return field_.get(instance);
}
catch (NoSuchFieldException e) {
mod_Waila.log.warning(String.format("== Field %s %s not found !\n", classname, fieldname));
return null;
}
catch (SecurityException e) {
mod_Waila.log.warning(String.format("== Field %s %s security exception !\n", classname, fieldname));
return null;
}
catch (ClassNotFoundException e) {
mod_Waila.log.warning(String.format("== Class %s not found !\n", classname));
return null;
} catch (IllegalArgumentException e) {
mod_Waila.log.warning(String.format("== %s\n", e));
return null;
} catch (IllegalAccessException e) {
mod_Waila.log.warning(String.format("== %s\n", e));
return null;
}
}
public static Block getBlock(String classname, String fieldname){
Field field_ = getDeclaredField(classname, fieldname);
try{
return (Block)field_.get(Block.class);
} catch (Exception e) {
System.out.printf("%s\n", e);
mod_Waila.log.warning(String.format("== ERROR GETTING BLOCK %s %s\n", classname, fieldname));
return null;
}
}
public static Item getItem(String classname, String fieldname){
Field field_ = getDeclaredField(classname, fieldname);
try{
return (Item)field_.get(Item.class);
} catch (Exception e) {
System.out.printf("%s\n", e);
mod_Waila.log.warning(String.format("== ERROR GETTING ITEM %s %s\n", classname, fieldname));
return null;
}
}
public static ArrayList<IRecipe> getCraftingRecipes(ItemStack stack){
ArrayList<IRecipe> recipes = new ArrayList<IRecipe>();
for (IRecipe recipe : (ArrayList<IRecipe>)CraftingManager.getInstance().getRecipeList()){
if (recipe != null && recipe.getRecipeOutput() != null){
if (recipe.getRecipeOutput().isItemEqual(stack))
recipes.add(recipe);
}
}
return recipes;
}
public static void cleanCraftingRecipes(ItemStack stack){
for (IRecipe recipe: getCraftingRecipes(stack)){
CraftingManager.getInstance().getRecipeList().remove(recipe);
}
}
public static void cleanSmeltingRecipes(ItemStack stack){
Map smeltingList = FurnaceRecipes.smelting().getSmeltingList();
Map<List<Integer>, ItemStack> smeltingListMeta = FurnaceRecipes.smelting().getMetaSmeltingList();
HashMap<Integer, ItemStack> matchingRecipes = new HashMap<Integer, ItemStack>();
HashMap<List<Integer>, ItemStack> matchingRecipesMeta = new HashMap<List<Integer>, ItemStack>();
// We walk the none meta list to find all the recipes
for (Object id_ : smeltingList.keySet()){
Integer id = (Integer)id_;
ItemStack result = (ItemStack)smeltingList.get(id_);
if (stack.isItemEqual(result))
matchingRecipes.put(id, result);
}
for (List<Integer> key : smeltingListMeta.keySet()){
ItemStack result = smeltingListMeta.get(key);
if (stack.isItemEqual(result))
matchingRecipesMeta.put(key, result);
}
for (Integer key : matchingRecipes.keySet())
FurnaceRecipes.smelting().getSmeltingList().remove(key);
for (List<Integer> key : matchingRecipesMeta.keySet())
FurnaceRecipes.smelting().getMetaSmeltingList().remove(key);
}
}
@@ -0,0 +1,135 @@
package mcp.mobius.waila.tools;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Set;
import java.util.logging.Level;
import codechicken.core.CommonUtils;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.ItemData;
import mcp.mobius.waila.mod_Waila;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
public class ModIdentification {
public static HashMap<String, String> modSource_Name = new HashMap<String, String>();
public static HashMap<String, String> modSource_ID = new HashMap<String, String>();
public static HashMap<Integer, String> itemMap = new HashMap<Integer, String>();
public static HashMap<String, String> keyhandlerStrings = new HashMap<String, String>();
public static void init(){
NBTTagList itemDataList = new NBTTagList();
GameData.writeItemData(itemDataList);
for(int i = 0; i < itemDataList.tagCount(); i++)
{
ItemData itemData = new ItemData((NBTTagCompound) itemDataList.tagAt(i));
itemMap.put(itemData.getItemId(), itemData.getModId());
}
for (ModContainer mod : Loader.instance().getModList()){
modSource_Name.put(mod.getSource().getName(), mod.getName());
modSource_ID.put(mod.getSource().getName(), mod.getModId());
}
modSource_Name.put("1.6.2.jar", "Minecraft");
modSource_Name.put("1.6.3.jar", "Minecraft");
modSource_Name.put("1.6.4.jar", "Minecraft");
modSource_ID.put("1.6.2.jar", "Minecraft");
modSource_ID.put("1.6.3.jar", "Minecraft");
modSource_ID.put("1.6.4.jar", "Minecraft");
// for (String s : this.modSourceList.keySet())
// if (this.modSourceList.get(s) == "Minecraft Coder Pack")
// this.modSourceList.put(s, "Minecraft");
// Code to retrieve all the registered keybindings along with the mod adding them.
Field keyHandlers_Field = AccessHelper.getDeclaredField("cpw.mods.fml.client.registry.KeyBindingRegistry", "keyHandlers");
try {
Set<KeyHandler> keyHandlers = (Set<KeyHandler>)keyHandlers_Field.get(KeyBindingRegistry.instance());
for (KeyHandler keyhandler : keyHandlers)
for (int i = 0; i < keyhandler.getKeyBindings().length; i++)
keyhandlerStrings.put(keyhandler.getKeyBindings()[i].keyDescription, idFromObject(keyhandler));
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
public static String nameFromObject(Object obj){
String objPath = obj.getClass().getProtectionDomain().getCodeSource().getLocation().toString();
try {
objPath = URLDecoder.decode(objPath, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String modName = "<Unknown>";
for (String s: modSource_Name.keySet())
if (objPath.contains(s))
modName = modSource_Name.get(s);
if (modName.equals("Minecraft Coder Pack"))
modName = "Minecraft";
return modName;
}
public static String idFromObject(Object obj){
String objPath = obj.getClass().getProtectionDomain().getCodeSource().getLocation().toString();
try {
objPath = URLDecoder.decode(objPath, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String modName = "<Unknown>";
for (String s: modSource_ID.keySet())
if (objPath.contains(s))
modName = modSource_ID.get(s);
if (modName.equals("Minecraft Coder Pack"))
modName = "Minecraft";
return modName;
}
public static String nameFromStack(ItemStack itemstack){
try{
String modID = itemMap.get(itemstack.itemID);
ModContainer mod = CommonUtils.findModContainer(modID);
String modname = mod == null ? modID : mod.getName();
return modname;
} catch (NullPointerException e){
//System.out.printf("NPE : %s\n",itemstack.toString());
return "";
}
}
public static String idFromStack(ItemStack itemstack){
try{
String modID = itemMap.get(itemstack.itemID);
return modID;
} catch (NullPointerException e){
//System.out.printf("NPE : %s\n",itemstack.toString());
return "";
}
}
}