Added missing native library path to forge_client project.

Added harvest levels/effectiveness for Axes and Shovels.
This commit is contained in:
LexManos 2011-12-16 10:06:57 +00:00
parent d8a14ee928
commit 8c9762fd9a
3 changed files with 145 additions and 51 deletions

View file

@ -1,12 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry including="*.java" kind="src" path="start"/>
<classpathentry kind="src" path="forge_common"/> <classpathentry kind="src" path="forge_common"/>
<classpathentry kind="src" path="minecraft"/> <classpathentry kind="src" path="minecraft"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="../../jars/bin/jinput.jar"/> <classpathentry kind="lib" path="../../jars/bin/jinput.jar">
<classpathentry kind="lib" path="../../jars/bin/lwjgl.jar"/> <attributes>
<classpathentry kind="lib" path="../../jars/bin/lwjgl_util.jar"/> <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="forge_client/jars/bin/natives"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="../../jars/bin/lwjgl.jar">
<attributes>
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="forge_client/jars/bin/natives"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="../../jars/bin/lwjgl_util.jar">
<attributes>
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="forge_client/jars/bin/natives"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="../../jars/bin/minecraft.jar"/> <classpathentry kind="lib" path="../../jars/bin/minecraft.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View file

@ -20,10 +20,64 @@
<type>2</type> <type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/forge_common</locationURI> <locationURI>PARENT-1-PROJECT_LOC/forge_common</locationURI>
</link> </link>
<link>
<name>jars</name>
<type>2</type>
<locationURI>MCP_LOC/jars</locationURI>
</link>
<link> <link>
<name>minecraft</name> <name>minecraft</name>
<type>2</type> <type>2</type>
<locationURI>PARENT-1-WORKSPACE_LOC/src_work/minecraft</locationURI> <locationURI>PARENT-1-WORKSPACE_LOC/src_work/minecraft</locationURI>
</link> </link>
<link>
<name>start</name>
<type>2</type>
<locationURI>MCP_LOC/conf/patches</locationURI>
</link>
</linkedResources> </linkedResources>
<filteredResources>
<filter>
<id>1324024223159</id>
<name>jars</name>
<type>9</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-bin</arguments>
</matcher>
</filter>
<filter>
<id>1324024223163</id>
<name>jars</name>
<type>6</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-*</arguments>
</matcher>
</filter>
<filter>
<id>1324022795404</id>
<name>start</name>
<type>5</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-*.java</arguments>
</matcher>
</filter>
<filter>
<id>1324024144075</id>
<name>jars/bin</name>
<type>5</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-*.jar</arguments>
</matcher>
</filter>
</filteredResources>
<variableList>
<variable>
<name>MCP_LOC</name>
<value>$%7BPARENT-1-WORKSPACE_LOC%7D</value>
</variable>
</variableList>
</projectDescription> </projectDescription>

View file

@ -179,72 +179,99 @@ public class ForgeHooks {
} }
public static boolean isToolEffective(ItemStack ist, Block bl, int md) { public static boolean isToolEffective(ItemStack ist, Block bl, int md) {
List tc=(List)toolClasses.get(ist.itemID); List tc = (List)toolClasses.get(ist.itemID);
if(tc==null) return false; if (tc == null)
Object[] ta=tc.toArray(); {
String cls=(String)ta[0]; return false;
}
return toolEffectiveness.contains(Arrays.asList( Object[] ta = tc.toArray();
bl.blockID,md,cls)); String cls = (String)ta[0];
return toolEffectiveness.contains(Arrays.asList(bl.blockID, md, cls));
} }
static void initTools() { static void initTools() {
if(toolInit) return; if(toolInit)
toolInit=true; {
return;
}
toolInit = true;
MinecraftForge.setToolClass(Item.pickaxeWood,"pickaxe",0); MinecraftForge.setToolClass(Item.pickaxeWood, "pickaxe", 0);
MinecraftForge.setToolClass(Item.pickaxeStone,"pickaxe",1); MinecraftForge.setToolClass(Item.pickaxeStone, "pickaxe", 1);
MinecraftForge.setToolClass(Item.pickaxeSteel,"pickaxe",2); MinecraftForge.setToolClass(Item.pickaxeSteel, "pickaxe", 2);
MinecraftForge.setToolClass(Item.pickaxeGold,"pickaxe",0); MinecraftForge.setToolClass(Item.pickaxeGold, "pickaxe", 0);
MinecraftForge.setToolClass(Item.pickaxeDiamond,"pickaxe",3); MinecraftForge.setToolClass(Item.pickaxeDiamond, "pickaxe", 3);
MinecraftForge.setToolClass(Item.axeWood,"axe",0); MinecraftForge.setToolClass(Item.axeWood, "axe", 0);
MinecraftForge.setToolClass(Item.axeStone,"axe",1); MinecraftForge.setToolClass(Item.axeStone, "axe", 1);
MinecraftForge.setToolClass(Item.axeSteel,"axe",2); MinecraftForge.setToolClass(Item.axeSteel, "axe", 2);
MinecraftForge.setToolClass(Item.axeGold,"axe",0); MinecraftForge.setToolClass(Item.axeGold, "axe", 0);
MinecraftForge.setToolClass(Item.axeDiamond,"axe",3); MinecraftForge.setToolClass(Item.axeDiamond, "axe", 3);
MinecraftForge.setToolClass(Item.shovelWood,"shovel",0); MinecraftForge.setToolClass(Item.shovelWood, "shovel", 0);
MinecraftForge.setToolClass(Item.shovelStone,"shovel",1); MinecraftForge.setToolClass(Item.shovelStone, "shovel", 1);
MinecraftForge.setToolClass(Item.shovelSteel,"shovel",2); MinecraftForge.setToolClass(Item.shovelSteel, "shovel", 2);
MinecraftForge.setToolClass(Item.shovelGold,"shovel",0); MinecraftForge.setToolClass(Item.shovelGold, "shovel", 0);
MinecraftForge.setToolClass(Item.shovelDiamond,"shovel",3); MinecraftForge.setToolClass(Item.shovelDiamond, "shovel", 3);
MinecraftForge.setBlockHarvestLevel(Block.obsidian,"pickaxe",3); MinecraftForge.setBlockHarvestLevel(Block.obsidian, "pickaxe", 3);
MinecraftForge.setBlockHarvestLevel(Block.oreDiamond,"pickaxe",2); MinecraftForge.setBlockHarvestLevel(Block.oreDiamond, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(Block.blockDiamond,"pickaxe",2); MinecraftForge.setBlockHarvestLevel(Block.blockDiamond, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(Block.oreGold,"pickaxe",2); MinecraftForge.setBlockHarvestLevel(Block.oreGold, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(Block.blockGold,"pickaxe",2); MinecraftForge.setBlockHarvestLevel(Block.blockGold, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(Block.oreIron,"pickaxe",1); MinecraftForge.setBlockHarvestLevel(Block.oreIron, "pickaxe", 1);
MinecraftForge.setBlockHarvestLevel(Block.blockSteel,"pickaxe",1); MinecraftForge.setBlockHarvestLevel(Block.blockSteel, "pickaxe", 1);
MinecraftForge.setBlockHarvestLevel(Block.oreLapis,"pickaxe",1); MinecraftForge.setBlockHarvestLevel(Block.oreLapis, "pickaxe", 1);
MinecraftForge.setBlockHarvestLevel(Block.blockLapis,"pickaxe",1); MinecraftForge.setBlockHarvestLevel(Block.blockLapis, "pickaxe", 1);
MinecraftForge.setBlockHarvestLevel(Block.oreRedstone,"pickaxe",2); MinecraftForge.setBlockHarvestLevel(Block.oreRedstone, "pickaxe", 2);
MinecraftForge.setBlockHarvestLevel(Block.oreRedstoneGlowing,"pickaxe",2); MinecraftForge.setBlockHarvestLevel(Block.oreRedstoneGlowing, "pickaxe", 2);
MinecraftForge.removeBlockEffectiveness(Block.oreRedstone,"pickaxe"); MinecraftForge.removeBlockEffectiveness(Block.oreRedstone, "pickaxe");
MinecraftForge.removeBlockEffectiveness(Block.oreRedstoneGlowing,"pickaxe"); MinecraftForge.removeBlockEffectiveness(Block.obsidian, "pickaxe");
MinecraftForge.removeBlockEffectiveness(Block.obsidian,"pickaxe"); MinecraftForge.removeBlockEffectiveness(Block.oreRedstoneGlowing, "pickaxe");
Block[] pickeff ={ Block[] pickeff = {
Block.cobblestone, Block.stairDouble, Block.cobblestone, Block.stairDouble,
Block.stairSingle, Block.stone, Block.sandStone, Block.stairSingle, Block.stone,
Block.cobblestoneMossy, Block.sandStone, Block.cobblestoneMossy,
Block.oreCoal, Block.oreCoal, Block.ice,
Block.ice, Block.netherrack, Block.oreLapis, Block.netherrack, Block.oreLapis,
Block.blockLapis Block.blockLapis
}; };
for(Block bl : pickeff) { for (Block bl : pickeff)
MinecraftForge.setBlockHarvestLevel(bl,"pickaxe",0); {
MinecraftForge.setBlockHarvestLevel(bl, "pickaxe", 0);
}
Block[] spadeEff = {
Block.grass, Block.dirt,
Block.sand, Block.gravel,
Block.snow, Block.blockSnow,
Block.blockClay, Block.tilledField,
Block.slowSand, Block.mycelium
};
for (Block bl : spadeEff)
{
MinecraftForge.setBlockHarvestLevel(bl, "shovel", 0);
}
Block[] axeEff = {
Block.planks, Block.bookShelf,
Block.wood, Block.chest,
Block.stairDouble, Block.stairSingle,
Block.pumpkin, Block.pumpkinLantern
};
for (Block bl : axeEff)
{
MinecraftForge.setBlockHarvestLevel(bl, "axe", 0);
} }
// TODO: add other tool tables.
} }
public static final int majorVersion=1; public static final int majorVersion=1;
public static final int minorVersion=2; public static final int minorVersion=2;
public static final int revisionVersion=2; public static final int revisionVersion=2;
static { static {
System.out.printf("MinecraftForge V%d.%d.%d Initialized\n",majorVersion,minorVersion,revisionVersion); System.out.printf("MinecraftForge V%d.%d.%d Initialized\n", majorVersion, minorVersion, revisionVersion);
} }
static boolean toolInit=false; static boolean toolInit=false;