Added explosion resistance hook.

This commit is contained in:
Eloraam 2011-07-29 22:00:08 +00:00
parent 59e7645d61
commit 58f3084074
2 changed files with 65 additions and 0 deletions

View file

@ -0,0 +1,7 @@
package net.minecraft.src.forge;
import net.minecraft.src.*;
public interface ISpecialResistance {
public float getSpecialExplosionResistance(World world, int i, int j, int k,
double src_x, double src_y, double src_z, Entity exploder);
}

View file

@ -225,6 +225,35 @@ diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/EffectRen
private RenderEngine renderer; private RenderEngine renderer;
private Random rand; private Random rand;
} }
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/Explosion.java ../src_work/minecraft/net/minecraft/src/Explosion.java
--- ../src_base/minecraft/net/minecraft/src/Explosion.java 2011-07-29 16:35:27.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/Explosion.java 2011-07-29 17:56:22.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.ISpecialResistance;
import java.util.*;
@@ -65,7 +66,16 @@
int i5 = worldObj.getBlockId(j4, k4, l4);
if(i5 > 0)
{
- f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F) * f2;
+ if(Block.blocksList[i5] instanceof ISpecialResistance) {
+ ISpecialResistance isr=(ISpecialResistance)
+ Block.blocksList[i5];
+ f1-=(isr.getSpecialExplosionResistance(
+ worldObj,j4,k4,l4,
+ explosionX,explosionY,explosionZ,
+ exploder) + 0.3F) * f2;
+ } else {
+ f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F) * f2;
+ }
}
if(f1 > 0.0F)
{
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemBucket.java ../src_work/minecraft/net/minecraft/src/ItemBucket.java diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemBucket.java ../src_work/minecraft/net/minecraft/src/ItemBucket.java
--- ../src_base/minecraft/net/minecraft/src/ItemBucket.java 2011-07-29 16:35:27.000000000 -0400 --- ../src_base/minecraft/net/minecraft/src/ItemBucket.java 2011-07-29 16:35:27.000000000 -0400
+++ ../src_work/minecraft/net/minecraft/src/ItemBucket.java 2011-07-29 16:41:55.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/ItemBucket.java 2011-07-29 16:41:55.000000000 -0400
@ -536,6 +565,35 @@ diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/Ch
generatedTemperatures = worldObj.getWorldChunkManager().getTemperatures(generatedTemperatures, k + 8, l + 8, 16, 16); generatedTemperatures = worldObj.getWorldChunkManager().getTemperatures(generatedTemperatures, k + 8, l + 8, 16, 16);
for(int j19 = k + 8; j19 < k + 8 + 16; j19++) for(int j19 = k + 8; j19 < k + 8 + 16; j19++)
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/Explosion.java ../src_work/minecraft_server/net/minecraft/src/Explosion.java
--- ../src_base/minecraft_server/net/minecraft/src/Explosion.java 2011-07-29 16:35:28.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/Explosion.java 2011-07-29 17:56:53.000000000 -0400
@@ -3,6 +3,7 @@
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
+import net.minecraft.src.forge.ISpecialResistance;
import java.util.*;
@@ -65,7 +66,16 @@
int i5 = worldObj.getBlockId(j4, k4, l4);
if(i5 > 0)
{
- f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F) * f2;
+ if(Block.blocksList[i5] instanceof ISpecialResistance) {
+ ISpecialResistance isr=(ISpecialResistance)
+ Block.blocksList[i5];
+ f1-=(isr.getSpecialExplosionResistance(
+ worldObj,j4,k4,l4,
+ explosionX,explosionY,explosionZ,
+ exploder) + 0.3F) * f2;
+ } else {
+ f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F) * f2;
+ }
}
if(f1 > 0.0F)
{
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java
--- ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java 2011-07-29 16:35:28.000000000 -0400 --- ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java 2011-07-29 16:35:28.000000000 -0400
+++ ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java 2011-07-29 16:41:55.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java 2011-07-29 16:41:55.000000000 -0400