mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
973c129f3f | ||
|
|
8bb73671ba | ||
|
|
46a9ba178f | ||
|
|
5c60c2246c | ||
|
|
e79b5d1937 | ||
|
|
9bf4f67d9d | ||
|
|
c726e219d7 | ||
|
|
707a07511f | ||
|
|
d64c332266 | ||
|
|
800bb21bc8 | ||
|
|
1931d4fc09 | ||
|
|
17c9f9bf9b | ||
|
|
db1f438c2d | ||
|
|
d67cda76b8 | ||
|
|
b883254220 | ||
|
|
8a4636cba3 | ||
|
|
9c6f5bd8ee | ||
|
|
a2c606e98c | ||
|
|
6c578cd84d | ||
|
|
e35435abd5 | ||
|
|
5c7978d347 | ||
|
|
68cc1d315b | ||
|
|
96c05bbd25 | ||
|
|
d2cf70f8d5 | ||
|
|
f1a6f45353 | ||
|
|
8acaaa0e53 | ||
|
|
384da1b222 | ||
|
|
2be3e5845a | ||
|
|
600b2b86a6 | ||
|
|
6fb7b777ce | ||
|
|
28345bf839 | ||
|
|
56f612c186 | ||
|
|
80882bec9c | ||
|
|
f1f672b5fd | ||
|
|
bf5e706f06 | ||
|
|
c12b2c5b11 | ||
|
|
a64a47b24c | ||
|
|
8a7c087e34 | ||
|
|
756c3ce812 | ||
|
|
b8a84f2c29 | ||
|
|
ebc09a72db | ||
|
|
579f4de295 | ||
|
|
9f56b1cc03 | ||
|
|
141805d5bb | ||
|
|
d00a837635 | ||
|
|
da695e774f | ||
|
|
b3d605cd9d | ||
|
|
56438eb585 | ||
|
|
b763c73b74 | ||
|
|
ff7055fdb2 | ||
|
|
07dfc35e0e | ||
|
|
d290970b49 | ||
|
|
47749d454a | ||
|
|
ed7c343647 | ||
|
|
a386d0a8dc | ||
|
|
1a8d32f7de | ||
|
|
7a242e9562 | ||
|
|
afdbc4064b | ||
|
|
0392ecd8da | ||
|
|
cab70ce17a | ||
|
|
9fa40cb432 | ||
|
|
c9b6cdef1f | ||
|
|
5ecff4e5a1 | ||
|
|
115de819b3 | ||
|
|
bb6751cc59 | ||
|
|
0a874de91d | ||
|
|
3b61068a3c | ||
|
|
cfe5a542fc | ||
|
|
4f4a75d865 | ||
|
|
5c74f5efb9 | ||
|
|
878cac2697 | ||
|
|
8b5440b351 | ||
|
|
71c77d9e9a | ||
|
|
8ced84d8d3 | ||
|
|
3e09d92cd4 | ||
|
|
17132962c9 | ||
|
|
e7ca40009e | ||
|
|
62e7bdf805 | ||
|
|
705e5e62a0 | ||
|
|
a6ed5709ef | ||
|
|
aead41197f | ||
|
|
e9cd63abf7 | ||
|
|
d2878faa33 | ||
|
|
1c11f0eeb0 | ||
|
|
33bd0947e3 | ||
|
|
0457d8057f | ||
|
|
b0efd106bd | ||
|
|
9d22e76927 | ||
|
|
6ac2161f36 | ||
|
|
4cdb1cb3d0 | ||
|
|
651af86795 | ||
|
|
622f536f80 | ||
|
|
231c65da06 | ||
|
|
72864e4bc2 | ||
|
|
1d19069203 | ||
|
|
12b64fa287 | ||
|
|
fb5f9373c5 | ||
|
|
08b0913f04 | ||
|
|
8d9e0879d8 | ||
|
|
adf31e33fd | ||
|
|
61b8107ba4 | ||
|
|
cfda01b9ff | ||
|
|
4c259ce5d5 | ||
|
|
53dd73f2a5 | ||
|
|
691b87e876 | ||
|
|
b813f609a6 | ||
|
|
cbcdfbcfdb | ||
|
|
6c19a22244 | ||
|
|
f530d9f2b2 | ||
|
|
6accd6dfee | ||
|
|
f54eecb455 | ||
|
|
4bc2f86ea8 | ||
|
|
6d0e031989 | ||
|
|
d23812cb4c | ||
|
|
ee1f04bd58 | ||
|
|
98fbe565b3 | ||
|
|
197c847a5f | ||
|
|
73365fcbe4 | ||
|
|
e6cc73ce55 | ||
|
|
c9685426b2 | ||
|
|
c35f8e5ddb | ||
|
|
b892916d6f | ||
|
|
18f822a8d2 | ||
|
|
5717e3e979 | ||
|
|
e6dff0bfc6 | ||
|
|
0490d22992 | ||
|
|
5975944963 | ||
|
|
58f3084074 | ||
|
|
59e7645d61 | ||
|
|
7f0d588e62 | ||
|
|
8c19143961 | ||
|
|
f2a1b244e8 | ||
|
|
14b6dbe4f5 | ||
|
|
5af89543d3 | ||
|
|
b11e534f88 | ||
|
|
c9f7fc3475 | ||
|
|
f15ff6b925 | ||
|
|
1f78ce8b25 | ||
|
|
9584d7d2ad | ||
|
|
11c81cc91f | ||
|
|
5477f767b3 | ||
|
|
eba740b4ce | ||
|
|
1b7e8b6179 | ||
|
|
cd9d101e06 | ||
|
|
69a16fad9c | ||
|
|
c7fb93c4f9 | ||
|
|
955a056015 | ||
|
|
86612c1450 | ||
|
|
987ad5acd2 | ||
|
|
7385d80298 | ||
|
|
f9e5cdc9ab | ||
|
|
859a0d1dee | ||
|
|
b858205145 | ||
|
|
f0c6f089b4 | ||
|
|
999ef3817a |
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File diff suppressed because it is too large.
Load diff
File renamed without changes.
File diff suppressed because it is too large.
Load diff
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Executable
+12
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="forge_common"/>
|
||||
<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="lib" path="../../jars/bin/jinput.jar"/>
|
||||
<classpathentry kind="lib" path="../../jars/bin/lwjgl.jar"/>
|
||||
<classpathentry kind="lib" path="../../jars/bin/lwjgl_util.jar"/>
|
||||
<classpathentry kind="lib" path="../../jars/bin/minecraft.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>forge_client</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>forge_common</name>
|
||||
<type>2</type>
|
||||
<locationURI>PARENT-1-PROJECT_LOC/forge_common</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>minecraft</name>
|
||||
<type>2</type>
|
||||
<locationURI>PARENT-1-WORKSPACE_LOC/src_work/minecraft</locationURI>
|
||||
</link>
|
||||
</linkedResources>
|
||||
</projectDescription>
|
||||
File renamed without changes.
File renamed without changes.
+25
-81
@@ -30,16 +30,7 @@ public class ForgeHooksClient {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void onRenderWorldLast(RenderGlobal rg, float f) {
|
||||
for (IRenderWorldLastHandler handler : renderWorldLastHandlers) {
|
||||
handler.onRenderWorldLast(rg,f);
|
||||
}
|
||||
}
|
||||
|
||||
static LinkedList<IHighlightHandler> highlightHandlers =
|
||||
new LinkedList<IHighlightHandler>();
|
||||
static LinkedList<IRenderWorldLastHandler> renderWorldLastHandlers =
|
||||
new LinkedList<IRenderWorldLastHandler>();
|
||||
static LinkedList<IHighlightHandler> highlightHandlers = new LinkedList<IHighlightHandler>();
|
||||
|
||||
public static boolean canRenderInPass(Block block, int pass) {
|
||||
if(block instanceof IMultipassRender) {
|
||||
@@ -50,54 +41,25 @@ public class ForgeHooksClient {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class TesKey implements Comparable<TesKey> {
|
||||
public TesKey(int t, int s) { tex=t; sub=s; }
|
||||
public int compareTo(TesKey key) {
|
||||
if(sub==key.sub) return tex-key.tex;
|
||||
return sub-key.sub;
|
||||
}
|
||||
public boolean equals(Object obj) {
|
||||
return compareTo((TesKey)obj)==0;
|
||||
}
|
||||
public int hashCode() {
|
||||
int c1=Integer.valueOf(tex).hashCode();
|
||||
int c2=Integer.valueOf(sub).hashCode();
|
||||
return c1+31*c2;
|
||||
}
|
||||
public int tex, sub;
|
||||
}
|
||||
|
||||
static HashMap<TesKey,Tessellator> tessellators=
|
||||
new HashMap<TesKey,Tessellator>();
|
||||
static HashMap<String,Integer> textures=new HashMap<String,Integer>();
|
||||
static HashMap tessellators=new HashMap();
|
||||
static HashMap textures=new HashMap();
|
||||
static boolean inWorld=false;
|
||||
static TreeSet<TesKey> renderTextures=new TreeSet<TesKey>();
|
||||
static HashSet renderTextureTest=new HashSet();
|
||||
static ArrayList<List> renderTextureList=new ArrayList();
|
||||
static Tessellator defaultTessellator=null;
|
||||
static HashMap<TesKey,IRenderContextHandler> renderHandlers=new
|
||||
HashMap<TesKey,IRenderContextHandler>();
|
||||
|
||||
protected static void registerRenderContextHandler(String tex, int sub,
|
||||
IRenderContextHandler handler) {
|
||||
Integer n;
|
||||
n=textures.get(tex);
|
||||
if(n==null) {
|
||||
n=ModLoader.getMinecraftInstance().renderEngine
|
||||
.getTexture(tex);
|
||||
textures.put(tex,n);
|
||||
}
|
||||
renderHandlers.put(new TesKey(n,sub),handler);
|
||||
}
|
||||
|
||||
protected static void bindTessellator(int tex, int sub) {
|
||||
TesKey key=new TesKey(tex,sub);
|
||||
List key=Arrays.asList(tex,sub);
|
||||
Tessellator t;
|
||||
t=tessellators.get(key);
|
||||
if(t==null) {
|
||||
if(!tessellators.containsKey(key)) {
|
||||
t=new Tessellator();
|
||||
tessellators.put(key,t);
|
||||
} else {
|
||||
t=(Tessellator)tessellators.get(key);
|
||||
}
|
||||
if(inWorld && !renderTextures.contains(key)) {
|
||||
renderTextures.add(key);
|
||||
if(inWorld && !renderTextureTest.contains(key)) {
|
||||
renderTextureTest.add(key);
|
||||
renderTextureList.add(key);
|
||||
t.startDrawingQuads();
|
||||
t.setTranslationD(defaultTessellator.xOffset,
|
||||
defaultTessellator.yOffset,
|
||||
@@ -106,30 +68,22 @@ public class ForgeHooksClient {
|
||||
Tessellator.instance=t;
|
||||
}
|
||||
|
||||
static IRenderContextHandler unbindContext=null;
|
||||
protected static void bindTexture(String name, int sub) {
|
||||
Integer n;
|
||||
n=textures.get(name);
|
||||
if(n==null) {
|
||||
int n;
|
||||
if(!textures.containsKey(name)) {
|
||||
n=ModLoader.getMinecraftInstance().renderEngine
|
||||
.getTexture(name);
|
||||
textures.put(name,n);
|
||||
} else {
|
||||
n=(Integer)textures.get(name);
|
||||
}
|
||||
if(!inWorld) {
|
||||
if(unbindContext!=null) {
|
||||
unbindContext.afterRenderContext();
|
||||
unbindContext=null;
|
||||
}
|
||||
if(Tessellator.instance.isDrawing) {
|
||||
int mode=Tessellator.instance.drawMode;
|
||||
Tessellator.instance.draw();
|
||||
Tessellator.instance.startDrawing(mode);
|
||||
}
|
||||
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */,n);
|
||||
unbindContext=renderHandlers.get(new TesKey(n,sub));
|
||||
if(unbindContext!=null) {
|
||||
unbindContext.beforeRenderContext();
|
||||
}
|
||||
return;
|
||||
}
|
||||
bindTessellator(n,sub);
|
||||
@@ -142,10 +96,6 @@ public class ForgeHooksClient {
|
||||
if(Tessellator.instance.isDrawing) {
|
||||
int mode=Tessellator.instance.drawMode;
|
||||
Tessellator.instance.draw();
|
||||
if(unbindContext!=null) {
|
||||
unbindContext.afterRenderContext();
|
||||
unbindContext=null;
|
||||
}
|
||||
Tessellator.instance.startDrawing(mode);
|
||||
}
|
||||
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, ModLoader
|
||||
@@ -163,31 +113,25 @@ public class ForgeHooksClient {
|
||||
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, ModLoader
|
||||
.getMinecraftInstance().renderEngine
|
||||
.getTexture("/terrain.png"));
|
||||
renderTextures.clear();
|
||||
renderTextureTest.clear();
|
||||
renderTextureList.clear();
|
||||
inWorld=true;
|
||||
}
|
||||
|
||||
public static void afterRenderPass(int pass) {
|
||||
renderPass=-1;
|
||||
inWorld=false;
|
||||
for(TesKey tk : renderTextures) {
|
||||
IRenderContextHandler irch=renderHandlers.get(tk);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D,tk.tex);
|
||||
Tessellator t=tessellators.get(tk);
|
||||
if(irch==null) {
|
||||
t.draw();
|
||||
} else {
|
||||
Tessellator.instance=t;
|
||||
irch.beforeRenderContext();
|
||||
t.draw();
|
||||
irch.afterRenderContext();
|
||||
}
|
||||
for(List l : renderTextureList) {
|
||||
// TODO: call appropriate client hooks
|
||||
Integer[] tn=(Integer[])l.toArray();
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D,tn[0]);
|
||||
Tessellator t=(Tessellator)tessellators.get(l);
|
||||
t.draw();
|
||||
}
|
||||
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, ModLoader
|
||||
.getMinecraftInstance().renderEngine
|
||||
.getTexture("/terrain.png"));
|
||||
Tessellator.renderingWorldRenderer=false;
|
||||
Tessellator.instance=defaultTessellator;
|
||||
}
|
||||
|
||||
public static void beforeBlockRender(Block block,
|
||||
@@ -227,7 +171,7 @@ public class ForgeHooksClient {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void renderCustomItem(ICustomItemRenderer customRenderer, RenderBlocks renderBlocks,int itemID, int meta, float f) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
if (renderBlocks.useInventoryTint) {
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
-14
@@ -18,20 +18,6 @@ public class MinecraftForgeClient {
|
||||
ForgeHooksClient.highlightHandlers.add(handler);
|
||||
}
|
||||
|
||||
/** Register a new render context handler. A render context is a block
|
||||
* of rendering performed with similar OpenGL modes, for example,
|
||||
* texture name.
|
||||
* @param tex The name of the texture for this render context.
|
||||
* @param sub The subid of this render context. 0 is the default pass
|
||||
* for normal rendering, higher subids render later. All subids of 0
|
||||
* will render before all subids of 1, etc.
|
||||
* @param handler The handler to register.
|
||||
*/
|
||||
public static void registerRenderContextHandler(String tex, int sub,
|
||||
IRenderContextHandler handler) {
|
||||
ForgeHooksClient.registerRenderContextHandler(tex,sub,handler);
|
||||
}
|
||||
|
||||
/** Bind a texture. This is used to bind a texture file when
|
||||
* performing your own rendering, rather than using ITextureProvider.
|
||||
*
|
||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -309,7 +309,7 @@ public class EnumHelper {
|
||||
else
|
||||
{
|
||||
if ((field.getModifiers() & flags) == flags &&
|
||||
field.getType().getName().replace('.', '/').equals(valueType)) //Apparently some JVMs return .'s and some don't..
|
||||
field.getType().getName().equals(valueType))
|
||||
{
|
||||
valuesField = field;
|
||||
break;
|
||||
+49
-108
@@ -6,8 +6,6 @@
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.EntityMinecart;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.ItemStack;
|
||||
@@ -72,36 +70,6 @@ public class ForgeHooks {
|
||||
}
|
||||
|
||||
static LinkedList<ISleepHandler> sleepHandlers = new LinkedList<ISleepHandler>();
|
||||
|
||||
|
||||
public static void onMinecartUpdate(EntityMinecart minecart, int x, int y, int z)
|
||||
{
|
||||
for (IMinecartHandler handler : minecartHandlers)
|
||||
{
|
||||
handler.onMinecartUpdate(minecart, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
public static void onMinecartEntityCollision(EntityMinecart minecart, Entity entity)
|
||||
{
|
||||
for (IMinecartHandler handler : minecartHandlers)
|
||||
{
|
||||
handler.onMinecartEntityCollision(minecart, entity);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean onMinecartInteract(EntityMinecart minecart, EntityPlayer player)
|
||||
{
|
||||
boolean canceled = true;
|
||||
for (IMinecartHandler handler : minecartHandlers)
|
||||
{
|
||||
boolean tmp = handler.onMinecartInteract(minecart, player, canceled);
|
||||
canceled = canceled && tmp;
|
||||
}
|
||||
return canceled;
|
||||
}
|
||||
|
||||
static LinkedList<IMinecartHandler> minecartHandlers = new LinkedList<IMinecartHandler>();
|
||||
|
||||
// Plant Management
|
||||
// ------------------------------------------------------------
|
||||
@@ -211,99 +179,72 @@ public class ForgeHooks {
|
||||
}
|
||||
|
||||
public static boolean isToolEffective(ItemStack ist, Block bl, int md) {
|
||||
List tc = (List)toolClasses.get(ist.itemID);
|
||||
if (tc == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Object[] ta = tc.toArray();
|
||||
String cls = (String)ta[0];
|
||||
return toolEffectiveness.contains(Arrays.asList(bl.blockID, md, cls));
|
||||
List tc=(List)toolClasses.get(ist.itemID);
|
||||
if(tc==null) return false;
|
||||
Object[] ta=tc.toArray();
|
||||
String cls=(String)ta[0];
|
||||
|
||||
return toolEffectiveness.contains(Arrays.asList(
|
||||
bl.blockID,md,cls));
|
||||
}
|
||||
|
||||
static void initTools() {
|
||||
if(toolInit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
toolInit = true;
|
||||
if(toolInit) return;
|
||||
toolInit=true;
|
||||
|
||||
MinecraftForge.setToolClass(Item.pickaxeWood, "pickaxe", 0);
|
||||
MinecraftForge.setToolClass(Item.pickaxeStone, "pickaxe", 1);
|
||||
MinecraftForge.setToolClass(Item.pickaxeSteel, "pickaxe", 2);
|
||||
MinecraftForge.setToolClass(Item.pickaxeGold, "pickaxe", 0);
|
||||
MinecraftForge.setToolClass(Item.pickaxeDiamond, "pickaxe", 3);
|
||||
MinecraftForge.setToolClass(Item.pickaxeWood,"pickaxe",0);
|
||||
MinecraftForge.setToolClass(Item.pickaxeStone,"pickaxe",1);
|
||||
MinecraftForge.setToolClass(Item.pickaxeSteel,"pickaxe",2);
|
||||
MinecraftForge.setToolClass(Item.pickaxeGold,"pickaxe",0);
|
||||
MinecraftForge.setToolClass(Item.pickaxeDiamond,"pickaxe",3);
|
||||
|
||||
MinecraftForge.setToolClass(Item.axeWood, "axe", 0);
|
||||
MinecraftForge.setToolClass(Item.axeStone, "axe", 1);
|
||||
MinecraftForge.setToolClass(Item.axeSteel, "axe", 2);
|
||||
MinecraftForge.setToolClass(Item.axeGold, "axe", 0);
|
||||
MinecraftForge.setToolClass(Item.axeDiamond, "axe", 3);
|
||||
MinecraftForge.setToolClass(Item.axeWood,"axe",0);
|
||||
MinecraftForge.setToolClass(Item.axeStone,"axe",1);
|
||||
MinecraftForge.setToolClass(Item.axeSteel,"axe",2);
|
||||
MinecraftForge.setToolClass(Item.axeGold,"axe",0);
|
||||
MinecraftForge.setToolClass(Item.axeDiamond,"axe",3);
|
||||
|
||||
MinecraftForge.setToolClass(Item.shovelWood, "shovel", 0);
|
||||
MinecraftForge.setToolClass(Item.shovelStone, "shovel", 1);
|
||||
MinecraftForge.setToolClass(Item.shovelSteel, "shovel", 2);
|
||||
MinecraftForge.setToolClass(Item.shovelGold, "shovel", 0);
|
||||
MinecraftForge.setToolClass(Item.shovelDiamond, "shovel", 3);
|
||||
MinecraftForge.setToolClass(Item.shovelWood,"shovel",0);
|
||||
MinecraftForge.setToolClass(Item.shovelStone,"shovel",1);
|
||||
MinecraftForge.setToolClass(Item.shovelSteel,"shovel",2);
|
||||
MinecraftForge.setToolClass(Item.shovelGold,"shovel",0);
|
||||
MinecraftForge.setToolClass(Item.shovelDiamond,"shovel",3);
|
||||
|
||||
MinecraftForge.setBlockHarvestLevel(Block.obsidian, "pickaxe", 3);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreDiamond, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.blockDiamond, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreGold, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.blockGold, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreIron, "pickaxe", 1);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.blockSteel, "pickaxe", 1);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreLapis, "pickaxe", 1);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.blockLapis, "pickaxe", 1);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreRedstone, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreRedstoneGlowing, "pickaxe", 2);
|
||||
MinecraftForge.removeBlockEffectiveness(Block.oreRedstone, "pickaxe");
|
||||
MinecraftForge.removeBlockEffectiveness(Block.obsidian, "pickaxe");
|
||||
MinecraftForge.removeBlockEffectiveness(Block.oreRedstoneGlowing, "pickaxe");
|
||||
MinecraftForge.setBlockHarvestLevel(Block.obsidian,"pickaxe",3);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreDiamond,"pickaxe",2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.blockDiamond,"pickaxe",2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreGold,"pickaxe",2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.blockGold,"pickaxe",2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreIron,"pickaxe",1);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.blockSteel,"pickaxe",1);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreLapis,"pickaxe",1);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.blockLapis,"pickaxe",1);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreRedstone,"pickaxe",2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreRedstoneGlowing,"pickaxe",2);
|
||||
MinecraftForge.removeBlockEffectiveness(Block.oreRedstone,"pickaxe");
|
||||
MinecraftForge.removeBlockEffectiveness(Block.oreRedstoneGlowing,"pickaxe");
|
||||
MinecraftForge.removeBlockEffectiveness(Block.obsidian,"pickaxe");
|
||||
|
||||
Block[] pickeff = {
|
||||
Block[] pickeff ={
|
||||
Block.cobblestone, Block.stairDouble,
|
||||
Block.stairSingle, Block.stone,
|
||||
Block.sandStone, Block.cobblestoneMossy,
|
||||
Block.oreCoal, Block.ice,
|
||||
Block.netherrack, Block.oreLapis,
|
||||
Block.stairSingle, Block.stone, Block.sandStone,
|
||||
Block.cobblestoneMossy,
|
||||
Block.oreCoal,
|
||||
Block.ice, Block.netherrack, Block.oreLapis,
|
||||
Block.blockLapis
|
||||
};
|
||||
for (Block bl : pickeff)
|
||||
{
|
||||
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);
|
||||
};
|
||||
for(Block bl : pickeff) {
|
||||
MinecraftForge.setBlockHarvestLevel(bl,"pickaxe",0);
|
||||
}
|
||||
|
||||
// TODO: add other tool tables.
|
||||
}
|
||||
|
||||
public static final int majorVersion=1;
|
||||
public static final int minorVersion=2;
|
||||
public static final int revisionVersion=4;
|
||||
public static final int revisionVersion=2;
|
||||
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;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
-3
@@ -14,9 +14,6 @@ import net.minecraft.src.World;
|
||||
* This interface is to be implemented by item classes. It will allow an item
|
||||
* to perform a use before the block is activated.
|
||||
*
|
||||
* @deprecated This interface is no longer used, the function has been moved to
|
||||
* Item. The functionality remains, it simply does not require this interface
|
||||
* any further.
|
||||
* @see Item
|
||||
*/
|
||||
public interface IUseItemFirst {
|
||||
@@ -0,0 +1,368 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.World;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class MinecraftForge {
|
||||
|
||||
private static LinkedList<IBucketHandler> bucketHandlers = new LinkedList<IBucketHandler>();
|
||||
/**
|
||||
* Register a new custom bucket handler.
|
||||
*/
|
||||
public static void registerCustomBucketHandler(IBucketHandler handler) {
|
||||
bucketHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new sleeping handler.
|
||||
*/
|
||||
public static void registerSleepHandler(ISleepHandler handler) {
|
||||
ForgeHooks.sleepHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new bonemeal handler.
|
||||
*/
|
||||
public static void registerBonemealHandler(IBonemealHandler handler) {
|
||||
ForgeHooks.bonemealHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new hoe handler.
|
||||
*/
|
||||
public static void registerHoeHandler(IHoeHandler handler) {
|
||||
ForgeHooks.hoeHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new destroy tool handler.
|
||||
*/
|
||||
public static void registerDestroyToolHandler(IDestroyToolHandler handler) {
|
||||
ForgeHooks.destroyToolHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new crafting handler.
|
||||
*/
|
||||
public static void registerCraftingHandler(ICraftingHandler handler) {
|
||||
ForgeHooks.craftingHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is not supposed to be called outside of Minecraft internals.
|
||||
*/
|
||||
public static ItemStack fillCustomBucket(World w, int i, int j, int k) {
|
||||
for (IBucketHandler handler : bucketHandlers) {
|
||||
ItemStack stack = handler.fillCustomBucket(w, i, j, k);
|
||||
|
||||
if (stack != null) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// Ore Dictionary
|
||||
// ------------------------------------------------------------
|
||||
private static LinkedList<IOreHandler> oreHandlers = new LinkedList<IOreHandler>();
|
||||
private static TreeMap<String,List<ItemStack>> oreDict=
|
||||
new TreeMap<String,List<ItemStack>>();
|
||||
|
||||
/** Register a new ore handler. This will automatically call the handler
|
||||
* with all current ores during registration, and every time a new ore is
|
||||
* added later.
|
||||
*/
|
||||
public static void registerOreHandler(IOreHandler handler) {
|
||||
oreHandlers.add(handler);
|
||||
|
||||
for(String key : oreDict.keySet()) {
|
||||
List<ItemStack> val=oreDict.get(key);
|
||||
for(ItemStack ist : val) {
|
||||
handler.registerOre(key,ist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Register a new item with the ore dictionary.
|
||||
* @param oreClass The string class of the ore.
|
||||
* @param ore The ItemStack for the ore.
|
||||
*/
|
||||
public static void registerOre(String oreClass, ItemStack ore) {
|
||||
List<ItemStack> orelist=oreDict.get(oreClass);
|
||||
if(orelist==null) {
|
||||
orelist=new ArrayList<ItemStack>();
|
||||
oreDict.put(oreClass,orelist);
|
||||
}
|
||||
orelist.add(ore);
|
||||
for(IOreHandler ioh : oreHandlers) {
|
||||
ioh.registerOre(oreClass,ore);
|
||||
}
|
||||
}
|
||||
|
||||
/** Get the list of ores in a given class.
|
||||
*/
|
||||
public static List<ItemStack> getOreClass(String oreClass) {
|
||||
return oreDict.get(oreClass);
|
||||
}
|
||||
|
||||
public static class OreQuery implements Iterable<Object[]> {
|
||||
Object[] proto;
|
||||
|
||||
public class OreQueryIterator implements Iterator<Object[]> {
|
||||
LinkedList itering;
|
||||
LinkedList output;
|
||||
|
||||
private OreQueryIterator() {
|
||||
itering=new LinkedList();
|
||||
output=new LinkedList();
|
||||
|
||||
for(int i=0; i<proto.length; i++) {
|
||||
if(proto[i] instanceof Collection) {
|
||||
Iterator it=((Collection)proto[i])
|
||||
.iterator();
|
||||
if(!it.hasNext()) {
|
||||
output=null; break;
|
||||
}
|
||||
itering.addLast(it);
|
||||
output.addLast(it.next());
|
||||
} else {
|
||||
itering.addLast(proto[i]);
|
||||
output.addLast(proto[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasNext() {
|
||||
return output!=null;
|
||||
}
|
||||
|
||||
public Object[] next() {
|
||||
Object[] tr=output.toArray();
|
||||
|
||||
Object to;
|
||||
while(true) {
|
||||
if(itering.size()==0) {
|
||||
output=null;
|
||||
return tr;
|
||||
}
|
||||
to=itering.getLast();
|
||||
output.removeLast();
|
||||
if(to instanceof Iterator) {
|
||||
Iterator it=(Iterator)to;
|
||||
if(it.hasNext()) {
|
||||
output.addLast(it.next());
|
||||
break;
|
||||
}
|
||||
}
|
||||
itering.removeLast();
|
||||
}
|
||||
for(int i=itering.size(); i<proto.length; i++) {
|
||||
if(proto[i] instanceof Collection) {
|
||||
Iterator it=((Collection)proto[i])
|
||||
.iterator();
|
||||
if(!it.hasNext()) {
|
||||
output=null; break;
|
||||
}
|
||||
itering.addLast(it);
|
||||
output.addLast(it.next());
|
||||
} else {
|
||||
itering.addLast(proto[i]);
|
||||
output.addLast(proto[i]);
|
||||
}
|
||||
}
|
||||
return tr;
|
||||
}
|
||||
|
||||
public void remove() {}
|
||||
}
|
||||
|
||||
private OreQuery(Object[] pattern) {
|
||||
proto=pattern;
|
||||
}
|
||||
|
||||
public Iterator<Object[]> iterator() {
|
||||
return new OreQueryIterator();
|
||||
}
|
||||
}
|
||||
|
||||
/** Generate all valid legal recipe combinations. Any Lists in pattern
|
||||
* will be fully expanded to all valid combinations.
|
||||
*/
|
||||
public static OreQuery generateRecipes(Object... pattern) {
|
||||
return new OreQuery(pattern);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
/** Register a new plant to be planted when bonemeal is used on grass.
|
||||
* @param bid The block ID to plant.
|
||||
* @param md The metadata to plant.
|
||||
* @param prop The relative probability of the plant, where red flowers are
|
||||
* 10 and yellow flowers are 20.
|
||||
*/
|
||||
public static void addGrassPlant(int item, int md, int prop) {
|
||||
ForgeHooks.addPlantGrass(item,md,prop);
|
||||
}
|
||||
|
||||
/** Register a new seed to be dropped when breaking tall grass.
|
||||
* @param bid The item ID of the seeds.
|
||||
* @param md The metadata of the seeds.
|
||||
* @param qty The quantity of seeds to drop.
|
||||
* @param prop The relative probability of the seeds, where wheat seeds are
|
||||
* 10.
|
||||
*/
|
||||
public static void addGrassSeed(int item, int md, int qty, int prop) {
|
||||
ForgeHooks.addGrassSeed(item,md,qty,prop);
|
||||
}
|
||||
|
||||
/** Register a tool as a tool class with a given harvest level.
|
||||
*
|
||||
* @param tool The custom tool to register.
|
||||
* @param tclass The tool class to register as. The predefined tool
|
||||
* clases are "pickaxe", "shovel", "axe". You can add others for custom
|
||||
* tools.
|
||||
* @param hlevel The harvest level of the tool.
|
||||
*/
|
||||
public static void setToolClass(Item tool, String tclass, int hlevel) {
|
||||
ForgeHooks.initTools();
|
||||
ForgeHooks.toolClasses.put(tool.shiftedIndex,
|
||||
Arrays.asList(tclass,hlevel));
|
||||
}
|
||||
|
||||
/** Register a block to be harvested by a tool class. This is the metadata
|
||||
* sensitive version, use it if your blocks are using metadata variants.
|
||||
* By default, this sets the block class as effective against that type.
|
||||
*
|
||||
* @param bl The block to register.
|
||||
* @param md The metadata for the block subtype.
|
||||
* @param tclass The tool class to register as able to remove this block.
|
||||
* You may register the same block multiple times with different tool
|
||||
* classes, if multiple tool types can be used to harvest this block.
|
||||
* @param hlevel The minimum tool harvest level required to successfully
|
||||
* harvest the block.
|
||||
* @see setToolClass for details on tool classes.
|
||||
*/
|
||||
public static void setBlockHarvestLevel(Block bl, int md, String tclass,
|
||||
int hlevel) {
|
||||
ForgeHooks.initTools();
|
||||
List key=Arrays.asList(bl.blockID,md,tclass);
|
||||
ForgeHooks.toolHarvestLevels.put(key,hlevel);
|
||||
ForgeHooks.toolEffectiveness.add(key);
|
||||
}
|
||||
|
||||
/** Remove a block effectiveness mapping. Since setBlockHarvestLevel
|
||||
* makes the tool class effective against the block by default, this can be
|
||||
* used to remove that mapping. This will force a block to be harvested at
|
||||
* the same speed regardless of tool quality, while still requiring a given
|
||||
* harvesting level.
|
||||
* @param bl The block to remove effectiveness from.
|
||||
* @param md The metadata for the block subtype.
|
||||
* @param tclass The tool class to remove the effectiveness mapping from.
|
||||
* @see setToolClass for details on tool classes.
|
||||
*/
|
||||
public static void removeBlockEffectiveness(Block bl, int md,
|
||||
String tclass) {
|
||||
ForgeHooks.initTools();
|
||||
List key=Arrays.asList(bl.blockID,md,tclass);
|
||||
ForgeHooks.toolEffectiveness.remove(key);
|
||||
}
|
||||
|
||||
/** Register a block to be harvested by a tool class.
|
||||
* By default, this sets the block class as effective against that type.
|
||||
*
|
||||
* @param bl The block to register.
|
||||
* @param tclass The tool class to register as able to remove this block.
|
||||
* You may register the same block multiple times with different tool
|
||||
* classes, if multiple tool types can be used to harvest this block.
|
||||
* @param hlevel The minimum tool harvest level required to successfully
|
||||
* harvest the block.
|
||||
* @see setToolClass for details on tool classes.
|
||||
*/
|
||||
public static void setBlockHarvestLevel(Block bl, String tclass,
|
||||
int hlevel) {
|
||||
ForgeHooks.initTools();
|
||||
for(int md=0; md<16; md++) {
|
||||
List key=Arrays.asList(bl.blockID,md,tclass);
|
||||
ForgeHooks.toolHarvestLevels.put(key,hlevel);
|
||||
ForgeHooks.toolEffectiveness.add(key);
|
||||
}
|
||||
}
|
||||
|
||||
/** Remove a block effectiveness mapping. Since setBlockHarvestLevel
|
||||
* makes the tool class effective against the block by default, this can be
|
||||
* used to remove that mapping. This will force a block to be harvested at
|
||||
* the same speed regardless of tool quality, while still requiring a given
|
||||
* harvesting level.
|
||||
* @param bl The block to remove effectiveness from.
|
||||
* @param tclass The tool class to remove the effectiveness mapping from.
|
||||
* @see setToolClass for details on tool classes.
|
||||
*/
|
||||
public static void removeBlockEffectiveness(Block bl, String tclass) {
|
||||
ForgeHooks.initTools();
|
||||
for(int md=0; md<16; md++) {
|
||||
List key=Arrays.asList(bl.blockID,md,tclass);
|
||||
ForgeHooks.toolEffectiveness.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Kill minecraft with an error message.
|
||||
*/
|
||||
public static void killMinecraft(String modname, String msg) {
|
||||
throw new RuntimeException(modname+": "+msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Version checking. Ensures that a sufficiently recent version of Forge
|
||||
* is installed. Will result in a fatal error if the major versions
|
||||
* mismatch or if the version is too old. Will print a warning message if
|
||||
* the minor versions don't match.
|
||||
*/
|
||||
public static void versionDetect(String modname,
|
||||
int major, int minor, int revision) {
|
||||
if(major!=ForgeHooks.majorVersion) {
|
||||
killMinecraft(modname,"MinecraftForge Major Version Mismatch, expecting "+major+".x.x");
|
||||
} else if(minor!=ForgeHooks.minorVersion) {
|
||||
if(minor>ForgeHooks.minorVersion) {
|
||||
killMinecraft(modname,"MinecraftForge Too Old, need at least "+major+"."+minor+"."+revision);
|
||||
} else {
|
||||
System.out.println(modname + ": MinecraftForge minor version mismatch, expecting "+major+"."+minor+".x, may lead to unexpected behavior");
|
||||
}
|
||||
} else if(revision>ForgeHooks.revisionVersion) {
|
||||
killMinecraft(modname,"MinecraftForge Too Old, need at least "+major+"."+minor+"."+revision);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Strict version checking. Ensures that a sufficiently recent version of
|
||||
* Forge is installed. Will result in a fatal error if the major or minor
|
||||
* versions mismatch or if the version is too old. Use this function for
|
||||
* mods that use recent, new, or unstable APIs to prevent
|
||||
* incompatibilities.
|
||||
*/
|
||||
public static void versionDetectStrict(String modname,
|
||||
int major, int minor, int revision) {
|
||||
if(major!=ForgeHooks.majorVersion) {
|
||||
killMinecraft(modname,"MinecraftForge Major Version Mismatch, expecting "+major+".x.x");
|
||||
} else if(minor!=ForgeHooks.minorVersion) {
|
||||
if(minor>ForgeHooks.minorVersion) {
|
||||
killMinecraft(modname,"MinecraftForge Too Old, need at least "+major+"."+minor+"."+revision);
|
||||
} else {
|
||||
killMinecraft(modname,"MinecraftForge minor version mismatch, expecting "+major+"."+minor+".x");
|
||||
}
|
||||
} else if(revision>ForgeHooks.revisionVersion) {
|
||||
killMinecraft(modname,"MinecraftForge Too Old, need at least "+major+"."+minor+"."+revision);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+6
-156
@@ -35,7 +35,7 @@
|
||||
+ */
|
||||
+ public int quantityDropped(int meta, int fortune, Random random)
|
||||
+ {
|
||||
+ return quantityDroppedWithBonus(fortune, random);
|
||||
+ return func_40198_a(fortune, random);
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Metadata-sensitive version.
|
||||
@@ -112,11 +112,11 @@
|
||||
{
|
||||
return;
|
||||
}
|
||||
- int j1 = quantityDroppedWithBonus(i1, world.rand);
|
||||
- int j1 = func_40198_a(i1, world.rand);
|
||||
- for(int k1 = 0; k1 < j1; k1++)
|
||||
- {
|
||||
+ ArrayList<ItemStack> ar = getBlockDropped(world, i, j, k, l, i1);
|
||||
+ for (ItemStack ist : ar) {
|
||||
+ ArrayList<ItemStack> ar = getBlockDropped(world, i, j, k, l, i1);
|
||||
+ for (ItemStack ist : ar) {
|
||||
if(world.rand.nextFloat() > f)
|
||||
{
|
||||
continue;
|
||||
@@ -126,20 +126,11 @@
|
||||
- {
|
||||
- dropBlockAsItem_do(world, i, j, k, new ItemStack(l1, 1, damageDropped(l)));
|
||||
- }
|
||||
+ dropBlockAsItem_do(world, i, j, k, ist);
|
||||
+ dropBlockAsItem_do(world, i, j, k, ist);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -726,7 +769,7 @@
|
||||
{
|
||||
entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1);
|
||||
entityplayer.addExhaustion(0.025F);
|
||||
- if(renderAsNormalBlock() && !isBlockContainer[blockID] && EnchantmentHelper.getSilkTouchModifier(entityplayer.inventory))
|
||||
+ if(renderAsNormalBlock() && !hasTileEntity(l) && EnchantmentHelper.getSilkTouchModifier(entityplayer.inventory))
|
||||
{
|
||||
ItemStack itemstack = createStackedBlock(l);
|
||||
if(itemstack != null)
|
||||
@@ -805,6 +848,248 @@
|
||||
@@ -805,6 +848,107 @@
|
||||
return iblockaccess.isBlockNormalCube(i, j, k) ? 0.2F : 1.0F;
|
||||
}
|
||||
|
||||
@@ -151,21 +142,11 @@
|
||||
+
|
||||
+ /* FORGE: Implement and return true if you wish this block to behave
|
||||
+ * like a ladder when the player is inside.
|
||||
+ *
|
||||
+ * This is deprecated in favor of the more flexible version below.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public boolean isLadder() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Implement and return true if you wish this block to behave
|
||||
+ * like a ladder when the player is inside.
|
||||
+ */
|
||||
+ public boolean isLadder(World world, int i, int j, int k) {
|
||||
+ return isLadder();
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return true if the block is a normal, solid cube. This
|
||||
+ * determines indirect power state, entity ejection from blocks, and a few
|
||||
+ * others.
|
||||
@@ -253,137 +234,6 @@
|
||||
+ public void addCreativeItems(ArrayList itemList)
|
||||
+ {
|
||||
+ }
|
||||
+
|
||||
+ protected static int blockFireSpreadSpeed[] = new int[256];
|
||||
+ protected static int blockFlammability[] = new int[256];
|
||||
+
|
||||
+ /**
|
||||
+ * Chance that fire will spread and consume this block.
|
||||
+ * 300 being a 100% chance, 0, being a 0% chance.
|
||||
+ *
|
||||
+ * @param world The current world
|
||||
+ * @param x The blocks X position
|
||||
+ * @param y The blocks Y position
|
||||
+ * @param z The blocks Z position
|
||||
+ * @param metadata The blocks current metadata
|
||||
+ * @param face The face that the fire is coming from
|
||||
+ * @return A number ranging from 0 to 300 relating used to determine if the block will be consumed by fire
|
||||
+ */
|
||||
+ public int getFlammability(IBlockAccess world, int x, int y, int z, int metadata, int face)
|
||||
+ {
|
||||
+ return blockFlammability[blockID];
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Called when fire is updating, checks if a block face can catch fire.
|
||||
+ *
|
||||
+ *
|
||||
+ * @param world The current world
|
||||
+ * @param x The blocks X position
|
||||
+ * @param y The blocks Y position
|
||||
+ * @param z The blocks Z position
|
||||
+ * @param metadata The blocks current metadata
|
||||
+ * @param face The face that the fire is coming from
|
||||
+ * @return True if the face can be on fire, false otherwise.
|
||||
+ */
|
||||
+ public boolean isFlammable(IBlockAccess world, int x, int y, int z, int metadata, int face)
|
||||
+ {
|
||||
+ return getFlammability(world, x, y, z, metadata, face) > 0;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Called when fire is updating on a neighbor block.
|
||||
+ * The higher the number returned, the faster fire will spread around this block.
|
||||
+ *
|
||||
+ * @param world The current world
|
||||
+ * @param x The blocks X position
|
||||
+ * @param y The blocks Y position
|
||||
+ * @param z The blocks Z position
|
||||
+ * @param metadata The blocks current metadata
|
||||
+ * @param face The face that the fire is coming from
|
||||
+ * @return A number that is used to determine the speed of fire growth around the block
|
||||
+ */
|
||||
+ public int getFireSpreadSpeed(World world, int x, int y, int z, int metadata, int face)
|
||||
+ {
|
||||
+ return blockFireSpreadSpeed[blockID];
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Currently only called by fire when it is on top of this block.
|
||||
+ * Returning true will prevent the fire from naturally dying during updating.
|
||||
+ * Also prevents firing from dying from rain.
|
||||
+ *
|
||||
+ * @param world The current world
|
||||
+ * @param x The blocks X position
|
||||
+ * @param y The blocks Y position
|
||||
+ * @param z The blocks Z position
|
||||
+ * @param metadata The blocks current metadata
|
||||
+ * @param face The face that the fire is coming from
|
||||
+ * @return
|
||||
+ */
|
||||
+ public boolean isFireSource(World world, int x, int y, int z, int metadata, int face)
|
||||
+ {
|
||||
+ if (blockID == Block.netherrack.blockID && face == 0)
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ if ((world.worldProvider instanceof WorldProviderEnd) && blockID == Block.bedrock.blockID && face == 0)
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Called by BlockFire to setup the burn values of vanilla blocks.
|
||||
+ * @param id The block id
|
||||
+ * @param encouragement How much the block encourages fire to spread
|
||||
+ * @param flammability how easy a block is to catch fire
|
||||
+ */
|
||||
+ public static void setBurnProperties(int id, int encouragement, int flammability)
|
||||
+ {
|
||||
+ blockFireSpreadSpeed[id] = encouragement;
|
||||
+ blockFlammability[id] = flammability;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Called throughout the code as a replacement for block instanceof BlockContainer
|
||||
+ * Moving this to the Block base class allows for mods that wish to extend vinella
|
||||
+ * blocks, and also want to have a tile entity on that block, may.
|
||||
+ *
|
||||
+ * Return true from this function to specify this block has a tile entity.
|
||||
+ *
|
||||
+ * @param metadata Metadata of the current block
|
||||
+ * @return True if block has a tile entity, false otherwise
|
||||
+ */
|
||||
+ public boolean hasTileEntity(int metadata)
|
||||
+ {
|
||||
+ if (isBlockContainer[blockID])
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Called throughout the code as a replacement for BlockContainer.getBlockEntity
|
||||
+ * Return the same thing you would from that function.
|
||||
+ * This will fall back to BlockContainer.getBlockEntity if this block is a BlockContainer.
|
||||
+ *
|
||||
+ * @param metadata The Metadata of the current block
|
||||
+ * @return A instance of a class extending TileEntity
|
||||
+ */
|
||||
+ public TileEntity getTileEntity(int metadata)
|
||||
+ {
|
||||
+ if (this instanceof BlockContainer)
|
||||
+ {
|
||||
+ return ((BlockContainer)this).getBlockEntity(metadata);
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
static Class _mthclass$(String s)
|
||||
{
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-2
@@ -27,7 +27,7 @@
|
||||
- int j1 = 3 + i1;
|
||||
- for(int k1 = 0; k1 < j1; k1++)
|
||||
+
|
||||
+ for(int n = 0; n < 3+fortune; n++)
|
||||
+ for(int n = 0; n < 3; n++)
|
||||
{
|
||||
- if(world.rand.nextInt(15) <= l)
|
||||
+ if (world.rand.nextInt(15) <= md)
|
||||
@@ -38,7 +38,7 @@
|
||||
- float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
|
||||
- EntityItem entityitem = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.seeds));
|
||||
- entityitem.delayBeforeCanPickup = 10;
|
||||
- world.spawnEntityInWorld(entityitem);
|
||||
- world.entityJoinedWorld(entityitem);
|
||||
+ tr.add(new ItemStack(Item.seeds));
|
||||
}
|
||||
}
|
||||
File renamed without changes.
+1
-1
@@ -5,7 +5,7 @@
|
||||
}
|
||||
|
||||
+ /* FORGE: Implemented base method, see Block.isLadder */
|
||||
+ public boolean isLadder(World world, int i, int j, int k) {
|
||||
+ public boolean isLadder() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,55 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -18,12 +18,12 @@
|
||||
public static final boolean isRailBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
int l = world.getBlockId(i, j, k);
|
||||
- return l == Block.rail.blockID || l == Block.railPowered.blockID || l == Block.railDetector.blockID;
|
||||
+ return Block.blocksList[l] instanceof BlockRail;
|
||||
}
|
||||
|
||||
public static final boolean isRailBlock(int i)
|
||||
{
|
||||
- return i == Block.rail.blockID || i == Block.railPowered.blockID || i == Block.railDetector.blockID;
|
||||
+ return Block.blocksList[i] instanceof BlockRail;
|
||||
}
|
||||
|
||||
protected BlockRail(int i, int j, boolean flag)
|
||||
@@ -99,7 +99,7 @@
|
||||
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k)
|
||||
{
|
||||
- return world.isBlockNormalCube(i, j - 1, k);
|
||||
+ return world.isBlockSolidOnSide(i, j - 1, k,1);
|
||||
}
|
||||
|
||||
public void onBlockAdded(World world, int i, int j, int k)
|
||||
@@ -123,23 +123,23 @@
|
||||
j1 &= 7;
|
||||
}
|
||||
boolean flag = false;
|
||||
- if(!world.isBlockNormalCube(i, j - 1, k))
|
||||
+ if(!world.isBlockSolidOnSide(i, j - 1, k,1))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(j1 == 2 && !world.isBlockNormalCube(i + 1, j, k))
|
||||
+ if(j1 == 2 && !world.isBlockSolidOnSide(i + 1, j, k,1))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(j1 == 3 && !world.isBlockNormalCube(i - 1, j, k))
|
||||
+ if(j1 == 3 && !world.isBlockSolidOnSide(i - 1, j, k,1))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(j1 == 4 && !world.isBlockNormalCube(i, j, k - 1))
|
||||
+ if(j1 == 4 && !world.isBlockSolidOnSide(i, j, k - 1,1))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
- if(j1 == 5 && !world.isBlockNormalCube(i, j, k + 1))
|
||||
+ if(j1 == 5 && !world.isBlockSolidOnSide(i, j, k + 1,1))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -42,4 +42,4 @@
|
||||
+ return tr;
|
||||
}
|
||||
|
||||
public int quantityDroppedWithBonus(int i, Random random)
|
||||
public int func_40198_a(int i, Random random)
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+++ ../src_work/minecraft/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
private boolean canPlaceTorchOn(World world, int i, int j, int k)
|
||||
private boolean func_31032_h(World world, int i, int j, int k)
|
||||
{
|
||||
- if(world.func_41082_b(i, j, k, true))
|
||||
+ if(world.isBlockSolidOnSide(i, j, k, 1))
|
||||
File renamed without changes.
+23
-78
@@ -8,37 +8,17 @@
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.*;
|
||||
@@ -351,11 +352,12 @@
|
||||
blocks[i << worldObj.xShift | k << worldObj.heightShift | j] = (byte)(byte0 & 0xff);
|
||||
if(l1 != 0)
|
||||
{
|
||||
+ int meta = getBlockMetadata(i, j, k);
|
||||
if(!worldObj.multiplayerWorld)
|
||||
{
|
||||
Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2);
|
||||
} else
|
||||
- if(Block.blocksList[l1] instanceof BlockContainer)
|
||||
+ if(Block.blocksList[l1] != null && Block.blocksList[l1].hasTileEntity(meta))
|
||||
{
|
||||
worldObj.removeBlockTileEntity(i2, j, j2);
|
||||
}
|
||||
@@ -385,12 +387,12 @@
|
||||
{
|
||||
Block.blocksList[l].onBlockAdded(worldObj, i2, j, j2);
|
||||
}
|
||||
- if(Block.blocksList[l] instanceof BlockContainer)
|
||||
+ if(Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(i1))
|
||||
{
|
||||
@@ -390,7 +391,7 @@
|
||||
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
|
||||
if(tileentity == null)
|
||||
{
|
||||
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
|
||||
+ tileentity = Block.blocksList[l].getTileEntity(i1);
|
||||
+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(i1);
|
||||
worldObj.setBlockTileEntity(i, j, k, tileentity);
|
||||
}
|
||||
if(tileentity != null)
|
||||
@@ -398,15 +400,7 @@
|
||||
tileentity.updateContainingBlockInfo();
|
||||
@@ -398,14 +399,6 @@
|
||||
tileentity.func_35144_b();
|
||||
}
|
||||
}
|
||||
- } else
|
||||
@@ -47,14 +27,12 @@
|
||||
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
|
||||
- if(tileentity1 != null)
|
||||
- {
|
||||
- tileentity1.updateContainingBlockInfo();
|
||||
- tileentity1.func_35144_b();
|
||||
- }
|
||||
- }
|
||||
+ }
|
||||
}
|
||||
isModified = true;
|
||||
return true;
|
||||
}
|
||||
@@ -430,7 +424,11 @@
|
||||
@@ -430,7 +423,11 @@
|
||||
blocks[i << worldObj.xShift | k << worldObj.heightShift | j] = (byte)(byte0 & 0xff);
|
||||
if(k1 != 0)
|
||||
{
|
||||
@@ -67,25 +45,17 @@
|
||||
}
|
||||
data.setNibble(i, j, k, 0);
|
||||
if(Block.lightOpacity[byte0 & 0xff] != 0)
|
||||
@@ -453,27 +451,21 @@
|
||||
{
|
||||
Block.blocksList[l].onBlockAdded(worldObj, l1, j, i2);
|
||||
}
|
||||
- if(l > 0 && (Block.blocksList[l] instanceof BlockContainer))
|
||||
+ int meta = getBlockMetadata(i, j, k);
|
||||
+ if(l > 0 && Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(meta))
|
||||
{
|
||||
@@ -458,7 +455,7 @@
|
||||
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
|
||||
if(tileentity == null)
|
||||
{
|
||||
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
|
||||
+ tileentity = Block.blocksList[l].getTileEntity(meta);
|
||||
+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(0);
|
||||
worldObj.setBlockTileEntity(i, j, k, tileentity);
|
||||
}
|
||||
if(tileentity != null)
|
||||
{
|
||||
tileentity.updateContainingBlockInfo();
|
||||
+ tileentity.blockMetadata = meta;
|
||||
@@ -466,14 +463,6 @@
|
||||
tileentity.func_35144_b();
|
||||
}
|
||||
}
|
||||
- } else
|
||||
@@ -94,22 +64,12 @@
|
||||
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
|
||||
- if(tileentity1 != null)
|
||||
- {
|
||||
- tileentity1.updateContainingBlockInfo();
|
||||
- tileentity1.func_35144_b();
|
||||
- }
|
||||
}
|
||||
isModified = true;
|
||||
return true;
|
||||
@@ -494,7 +486,8 @@
|
||||
}
|
||||
data.setNibble(i, j, k, l);
|
||||
int j1 = getBlockID(i, j, k);
|
||||
- if(j1 > 0 && (Block.blocksList[j1] instanceof BlockContainer))
|
||||
+
|
||||
+ if(j1 > 0 && Block.blocksList[j1] != null && Block.blocksList[j1].hasTileEntity(i1))
|
||||
{
|
||||
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
|
||||
if(tileentity != null)
|
||||
@@ -609,27 +602,38 @@
|
||||
@@ -609,6 +598,11 @@
|
||||
{
|
||||
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
|
||||
TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
|
||||
@@ -121,16 +81,12 @@
|
||||
if(tileentity == null)
|
||||
{
|
||||
int l = getBlockID(i, j, k);
|
||||
- if(!Block.isBlockContainer[l])
|
||||
+ int meta = getBlockMetadata(i, j, k);
|
||||
+ if(Block.blocksList[l] == null || !Block.blocksList[l].hasTileEntity(meta))
|
||||
{
|
||||
return null;
|
||||
@@ -618,18 +612,23 @@
|
||||
}
|
||||
if(tileentity == null)
|
||||
{
|
||||
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
|
||||
+ tileentity = Block.blocksList[l].getTileEntity(meta);
|
||||
+ tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity(getBlockMetadata(i,j,k));
|
||||
worldObj.setBlockTileEntity(xPosition * 16 + i, j, zPosition * 16 + k, tileentity);
|
||||
}
|
||||
tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
|
||||
@@ -156,7 +112,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -641,7 +645,7 @@
|
||||
@@ -641,7 +640,7 @@
|
||||
setChunkBlockTileEntity(i, j, k, tileentity);
|
||||
if(isChunkLoaded)
|
||||
{
|
||||
@@ -165,15 +121,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -652,11 +656,15 @@
|
||||
tileentity.xCoord = xPosition * 16 + i;
|
||||
tileentity.yCoord = j;
|
||||
tileentity.zCoord = zPosition * 16 + k;
|
||||
- if(getBlockID(i, j, k) == 0 || !(Block.blocksList[getBlockID(i, j, k)] instanceof BlockContainer))
|
||||
+ int id = getBlockID(i, j, k);
|
||||
+ int meta = getBlockMetadata(i, j, k);
|
||||
+ if(id == 0 || Block.blocksList[id] == null || !Block.blocksList[id].hasTileEntity(meta))
|
||||
{
|
||||
@@ -657,6 +656,8 @@
|
||||
return;
|
||||
} else
|
||||
{
|
||||
@@ -182,7 +130,7 @@
|
||||
tileentity.validate();
|
||||
chunkTileEntityMap.put(chunkposition, tileentity);
|
||||
return;
|
||||
@@ -810,6 +818,15 @@
|
||||
@@ -810,6 +811,15 @@
|
||||
public int setChunkData(byte abyte0[], int i, int j, int k, int l, int i1, int j1,
|
||||
int k1)
|
||||
{
|
||||
@@ -190,7 +138,7 @@
|
||||
+ Iterator iterator = chunkTileEntityMap.values().iterator();
|
||||
+ while (iterator.hasNext()){
|
||||
+ te = (TileEntity)iterator.next();
|
||||
+ te.updateContainingBlockInfo();
|
||||
+ te.func_35144_b();
|
||||
+ te.getBlockMetadata();
|
||||
+ te.getBlockType();
|
||||
+ }
|
||||
@@ -198,18 +146,17 @@
|
||||
for(int l1 = i; l1 < l; l1++)
|
||||
{
|
||||
for(int l2 = k; l2 < j1; l2++)
|
||||
@@ -859,12 +876,29 @@
|
||||
@@ -859,12 +869,25 @@
|
||||
|
||||
}
|
||||
|
||||
- TileEntity tileentity;
|
||||
- for(Iterator iterator = chunkTileEntityMap.values().iterator(); iterator.hasNext(); tileentity.updateContainingBlockInfo())
|
||||
- for(Iterator iterator = chunkTileEntityMap.values().iterator(); iterator.hasNext(); tileentity.func_35144_b())
|
||||
- {
|
||||
- tileentity = (TileEntity)iterator.next();
|
||||
+ List<TileEntity> invalidList=new ArrayList();
|
||||
+ iterator = chunkTileEntityMap.values().iterator();
|
||||
+ while(iterator.hasNext())
|
||||
+ {
|
||||
+ while(iterator.hasNext()) {
|
||||
+ te = (TileEntity)iterator.next();
|
||||
+ if ((te.xCoord & 15) >= i && (te.xCoord & 15) <= l &&
|
||||
+ (te.yCoord >= j) && (te.yCoord <= i1) &&
|
||||
@@ -224,11 +171,9 @@
|
||||
+ invalidList.add(te);
|
||||
+ }
|
||||
}
|
||||
|
||||
-
|
||||
+ for(TileEntity te2 : invalidList)
|
||||
+ {
|
||||
+ te2.invalidate();
|
||||
+ }
|
||||
return k1;
|
||||
}
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -7,7 +7,7 @@
|
||||
- return worldObj.getBlockId(i, j, k) == Block.ladder.blockID;
|
||||
+ Block block=Block.blocksList[worldObj.getBlockId(i,j,k)];
|
||||
+ if(block==null) return false;
|
||||
+ return block.isLadder(worldObj,i,j,k);
|
||||
+ return block.isLadder();
|
||||
}
|
||||
|
||||
public void writeEntityToNBT(NBTTagCompound nbttagcompound)
|
||||
File renamed without changes.
+26
-52
@@ -11,34 +11,8 @@
|
||||
import java.util.*;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
@@ -166,6 +170,7 @@
|
||||
clearItemInUse();
|
||||
} else
|
||||
{
|
||||
+ itemInUse.getItem().onUsingItemTick(itemInUse,this,itemInUseCount);
|
||||
if(itemInUseCount <= 25 && itemInUseCount % 4 == 0)
|
||||
{
|
||||
func_35201_a(itemstack, 5);
|
||||
@@ -502,7 +507,16 @@
|
||||
|
||||
public void dropCurrentItem()
|
||||
{
|
||||
- dropPlayerItemWithRandomChoice(inventory.decrStackSize(inventory.currentItem, 1), false);
|
||||
+ ItemStack stack = inventory.getCurrentItem();
|
||||
+ if (stack == null)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (stack.getItem().onDroppedByPlayer(stack, this))
|
||||
+ {
|
||||
+ dropPlayerItemWithRandomChoice(inventory.decrStackSize(inventory.currentItem, 1), false);
|
||||
+ }
|
||||
}
|
||||
|
||||
public void dropPlayerItem(ItemStack itemstack)
|
||||
@@ -548,6 +562,8 @@
|
||||
worldObj.spawnEntityInWorld(entityitem);
|
||||
@@ -548,6 +552,8 @@
|
||||
worldObj.entityJoinedWorld(entityitem);
|
||||
}
|
||||
|
||||
+ /* FORGE: This isnt called anymore
|
||||
@@ -46,7 +20,7 @@
|
||||
public float getCurrentPlayerStrVsBlock(Block block)
|
||||
{
|
||||
float f = inventory.getStrVsBlock(block);
|
||||
@@ -576,6 +592,45 @@
|
||||
@@ -576,6 +582,45 @@
|
||||
return f1;
|
||||
}
|
||||
|
||||
@@ -92,33 +66,33 @@
|
||||
public boolean canHarvestBlock(Block block)
|
||||
{
|
||||
return inventory.canHarvestBlock(block);
|
||||
@@ -774,6 +829,25 @@
|
||||
@@ -774,6 +819,25 @@
|
||||
|
||||
protected void damageEntity(DamageSource damagesource, int i)
|
||||
{
|
||||
+ boolean doRegularComputation = true;
|
||||
+ int initialDamage = i;
|
||||
+
|
||||
+ for (ItemStack stack : inventory.armorInventory) {
|
||||
+ if (stack != null && stack.getItem() instanceof ISpecialArmor) {
|
||||
+ ISpecialArmor armor = (ISpecialArmor) stack.getItem();
|
||||
+
|
||||
+ ArmorProperties props = armor.getProperties(this, initialDamage, i);
|
||||
+ i = i - props.damageRemove;
|
||||
+ doRegularComputation = doRegularComputation
|
||||
+ && props.allowRegularComputation;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!doRegularComputation) {
|
||||
+ super.damageEntity(damagesource, i);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if(!damagesource.isUnblockable() && isBlocking())
|
||||
+ boolean doRegularComputation = true;
|
||||
+ int initialDamage = i;
|
||||
+
|
||||
+ for (ItemStack stack : inventory.armorInventory) {
|
||||
+ if (stack != null && stack.getItem() instanceof ISpecialArmor) {
|
||||
+ ISpecialArmor armor = (ISpecialArmor) stack.getItem();
|
||||
+
|
||||
+ ArmorProperties props = armor.getProperties(this, initialDamage, i);
|
||||
+ i = i - props.damageRemove;
|
||||
+ doRegularComputation = doRegularComputation
|
||||
+ && props.allowRegularComputation;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!doRegularComputation) {
|
||||
+ super.damageEntity(damagesource, i);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if(!damagesource.unblockable() && func_35162_ad())
|
||||
{
|
||||
i = 1 + i >> 1;
|
||||
@@ -825,7 +899,9 @@
|
||||
@@ -825,7 +889,9 @@
|
||||
|
||||
public void destroyCurrentEquippedItem()
|
||||
{
|
||||
@@ -128,7 +102,7 @@
|
||||
}
|
||||
|
||||
public double getYOffset()
|
||||
@@ -957,6 +1033,10 @@
|
||||
@@ -957,6 +1023,10 @@
|
||||
|
||||
public EnumStatus sleepInBedAt(int i, int j, int k)
|
||||
{
|
||||
-9
@@ -34,12 +34,3 @@
|
||||
GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
|
||||
}
|
||||
Profiler.endStartSection("weather");
|
||||
@@ -988,6 +993,8 @@
|
||||
setupFog(1, f);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
+ Profiler.endStartSection("fhooks");
|
||||
+ ForgeHooksClient.onRenderWorldLast(renderglobal,f);
|
||||
Profiler.endStartSection("hand");
|
||||
if(cameraZoom == 1.0D)
|
||||
{
|
||||
File renamed without changes.
File renamed without changes.
+4
-38
@@ -9,7 +9,7 @@
|
||||
import java.util.Random;
|
||||
|
||||
@@ -177,6 +178,9 @@
|
||||
private String potionModifier;
|
||||
private String field_39010_c;
|
||||
private String itemName;
|
||||
|
||||
+ // FORGE: To disable repair recipes.
|
||||
@@ -18,22 +18,7 @@
|
||||
protected Item(int i)
|
||||
{
|
||||
maxStackSize = 64;
|
||||
@@ -221,6 +225,14 @@
|
||||
return getIconFromDamage(itemstack.getItemDamage());
|
||||
}
|
||||
|
||||
+ /* FORGE: This is called when the item is used, before the block is
|
||||
+ * activated. Return true to prevent any further processing.
|
||||
+ */
|
||||
+ public boolean onItemUseFirst(ItemStack ist, EntityPlayer player,
|
||||
+ World world, int i, int j, int k, int l) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
|
||||
{
|
||||
return false;
|
||||
@@ -231,6 +243,13 @@
|
||||
@@ -231,6 +235,13 @@
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@@ -47,7 +32,7 @@
|
||||
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
|
||||
{
|
||||
return itemstack;
|
||||
@@ -278,6 +297,34 @@
|
||||
@@ -278,6 +289,29 @@
|
||||
return maxDamage > 0 && !hasSubtypes;
|
||||
}
|
||||
|
||||
@@ -73,16 +58,11 @@
|
||||
+ EntityPlayer player) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Called each tick while using an item.
|
||||
+ */
|
||||
+ public void onUsingItemTick(ItemStack ist, EntityPlayer player, int count) {
|
||||
+ }
|
||||
+
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
|
||||
{
|
||||
return false;
|
||||
@@ -473,6 +520,32 @@
|
||||
@@ -473,6 +507,18 @@
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -97,20 +77,6 @@
|
||||
+ {
|
||||
+ itemList.add(new ItemStack(this, 1));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Called when a player drops the item into the world,
|
||||
+ * returning false from this will prevent the item from
|
||||
+ * being removed from the players inventory and spawning
|
||||
+ * in the world
|
||||
+ *
|
||||
+ * @param player The player that dropped the item
|
||||
+ * @param item The item stack, before the item is removed.
|
||||
+ */
|
||||
+ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player)
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
|
||||
static
|
||||
File renamed without changes.
+10
-15
@@ -10,32 +10,27 @@
|
||||
import java.util.Random;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
@@ -45,13 +47,23 @@
|
||||
@@ -45,13 +47,18 @@
|
||||
|
||||
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
|
||||
{
|
||||
- if(!entityplayer.canPlayerEdit(i, j, k))
|
||||
+ if(entityplayer != null && !entityplayer.canPlayerEdit(i, j, k))
|
||||
- if(!entityplayer.func_35190_e(i, j, k))
|
||||
+ if(entityplayer!=null && !entityplayer.func_35190_e(i, j, k))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(itemstack.getItemDamage() == 15)
|
||||
{
|
||||
int i1 = world.getBlockId(i, j, k);
|
||||
+
|
||||
+ if (ForgeHooks.onUseBonemeal(world, i1, i, j, k))
|
||||
+ {
|
||||
+ if (!world.multiplayerWorld)
|
||||
+ {
|
||||
+ itemstack.stackSize--;
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if(ForgeHooks.onUseBonemeal(world,i1,i,j,k)) {
|
||||
+ if(!world.multiplayerWorld)
|
||||
+ itemstack.stackSize--;
|
||||
+ return true;
|
||||
+ }
|
||||
if(i1 == Block.sapling.blockID)
|
||||
{
|
||||
if(!world.multiplayerWorld)
|
||||
@@ -118,13 +130,7 @@
|
||||
@@ -118,13 +125,7 @@
|
||||
world.setBlockAndMetadataWithNotify(k1, l1, i2, Block.tallGrass.blockID, 1);
|
||||
continue;
|
||||
}
|
||||
@@ -50,7 +45,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -147,5 +153,17 @@
|
||||
@@ -147,5 +148,17 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
Loaded 100 of 199 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user