diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/BlockRedstoneWire.java ../src_work/minecraft/net/minecraft/src/BlockRedstoneWire.java --- ../src_base/minecraft/net/minecraft/src/BlockRedstoneWire.java 2011-08-04 20:51:16.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneWire.java 2011-08-04 20:51:18.000000000 -0400 @@ -3,6 +3,7 @@ // Decompiler options: packimports(3) braces deadcode package net.minecraft.src; +import net.minecraft.src.forge.*; import java.util.*; @@ -451,6 +452,10 @@ { return false; } + if (Block.blocksList[i1] instanceof IConnectRedstone) { + IConnectRedstone icr = (IConnectRedstone) Block.blocksList[i1]; + return icr.canConnectRedstone(iblockaccess, i, j, k, l); + } if(Block.blocksList[i1].canProvidePower()) { return true; diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/Chunk.java ../src_work/minecraft/net/minecraft/src/Chunk.java --- ../src_base/minecraft/net/minecraft/src/Chunk.java 2011-08-04 20:51:16.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/Chunk.java 2011-08-04 20:51:18.000000000 -0400 @@ -3,6 +3,7 @@ // Decompiler options: packimports(3) braces deadcode package net.minecraft.src; +import net.minecraft.src.forge.*; import java.io.PrintStream; import java.util.*; @@ -249,6 +250,13 @@ } int l1 = xPosition * 16 + i; int i2 = zPosition * 16 + k; + + if (Block.blocksList[k1] instanceof IOverrideReplace) { + IOverrideReplace iovr = (IOverrideReplace) Block.blocksList[k1]; + if (!iovr.canReplaceBlock(worldObj, l1, j, i2, l)) + return iovr.getReplacedSuccess(); + } + blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff); if(k1 != 0 && !worldObj.multiplayerWorld) { @@ -292,6 +300,13 @@ } int k1 = xPosition * 16 + i; int l1 = zPosition * 16 + k; + + if (Block.blocksList[j1] instanceof IOverrideReplace) { + IOverrideReplace iovr = (IOverrideReplace) Block.blocksList[j1]; + if (!iovr.canReplaceBlock(worldObj, k1, j, l1, l)) + return iovr.getReplacedSuccess(); + } + blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff); if(j1 != 0) { diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/EffectRenderer.java ../src_work/minecraft/net/minecraft/src/EffectRenderer.java --- ../src_base/minecraft/net/minecraft/src/EffectRenderer.java 2011-08-04 20:51:16.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/EffectRenderer.java 2011-08-04 20:51:18.000000000 -0400 @@ -7,6 +7,9 @@ import java.util.*; import org.lwjgl.opengl.GL11; +import net.minecraft.src.forge.BlockTextureParticles; +import net.minecraft.src.forge.ITextureProvider; + // Referenced classes of package net.minecraft.src: // EntityFX, Entity, MathHelper, RenderEngine, // Tessellator, Block, EntityDiggingFX, World @@ -16,6 +19,7 @@ public EffectRenderer(World world, RenderEngine renderengine) { + effectList = new ArrayList(); fxLayers = new List[4]; rand = new Random(); if(world != null) @@ -55,6 +59,18 @@ } } + for (int x = 0; x < effectList.size(); x++) { + BlockTextureParticles entry = (BlockTextureParticles) effectList + .get(x); + for (int y = 0; y < entry.effects.size(); y++) { + EntityFX entityfx = (EntityFX) entry.effects.get(y); + if (entityfx.isDead) { + entry.effects.remove(y--); + } + } + if (effectList.size() == 0) + effectList.remove(x--); + } } @@ -93,11 +109,26 @@ for(int k = 0; k < fxLayers[i].size(); k++) { EntityFX entityfx = (EntityFX)fxLayers[i].get(k); + if(entityfx instanceof EntityDiggingFX) continue; entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4); } tessellator.draw(); } + Tessellator tessellator = Tessellator.instance; + + for (int x = 0; x < effectList.size(); x++) { + BlockTextureParticles entry = (BlockTextureParticles) effectList + .get(x); + GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, + renderer.getTexture(entry.texture)); + tessellator.startDrawingQuads(); + for (int y = 0; y < entry.effects.size(); y++) { + EntityFX entityfx = (EntityFX) entry.effects.get(y); + entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4); + } + tessellator.draw(); + } } @@ -124,6 +155,13 @@ { fxLayers[i].clear(); } + + for (int x = 0; x < effectList.size(); x++) { + BlockTextureParticles entry = (BlockTextureParticles) effectList + .get(x); + entry.effects.clear(); + } + effectList.clear(); } @@ -145,7 +183,12 @@ double d1 = (double)j + ((double)l1 + 0.5D) / (double)j1; double d2 = (double)k + ((double)i2 + 0.5D) / (double)j1; int j2 = rand.nextInt(6); - addEffect((new EntityDiggingFX(worldObj, d, d1, d2, d - (double)i - 0.5D, d1 - (double)j - 0.5D, d2 - (double)k - 0.5D, block, j2, i1)).func_4041_a(i, j, k)); + EntityDiggingFX dig_effect = new EntityDiggingFX(worldObj, + d, d1, d2, d - (double) i - 0.5D, d1 - (double) j + - 0.5D, d2 - (double) k - 0.5D, block, j2, + i1); + dig_effect.func_4041_a(i, j, k); + addDigParticleEffect(dig_effect, block); } } @@ -190,16 +233,48 @@ { d = (double)i + block.maxX + (double)f; } - addEffect((new EntityDiggingFX(worldObj, d, d1, d2, 0.0D, 0.0D, 0.0D, block, l, worldObj.getBlockMetadata(i, j, k))).func_4041_a(i, j, k).func_407_b(0.2F).func_405_d(0.6F)); + EntityDiggingFX dig_effect = new EntityDiggingFX(worldObj, d, d1, d2, + 0.0D, 0.0D, 0.0D, block, l, worldObj.getBlockMetadata(i, j, k)); + dig_effect.func_4041_a(i, j, k); + dig_effect.func_407_b(0.2F); + dig_effect.func_405_d(0.6F); + addDigParticleEffect(dig_effect, block); } public String getStatistics() { return (new StringBuilder()).append("").append(fxLayers[0].size() + fxLayers[1].size() + fxLayers[2].size()).toString(); } + + public void addDigParticleEffect(EntityDiggingFX dig_effect, Block block) { + boolean added = false; + String comp; + + if (block instanceof ITextureProvider) { + comp = ((ITextureProvider) block).getTextureFile(); + } else { + comp = "/terrain.png"; + } + for (int x = 0; x < effectList.size(); x++) { + BlockTextureParticles entry = (BlockTextureParticles) effectList + .get(x); + if (entry.texture.equals(comp)) { + entry.effects.add(dig_effect); + added = true; + } + } + if (!added) { + BlockTextureParticles entry = new BlockTextureParticles(); + entry.texture = comp; + entry.effects.add(dig_effect); + effectList.add(entry); + } + addEffect(dig_effect); + } protected World worldObj; private List fxLayers[]; + private List effectList; private RenderEngine renderer; private Random rand; } diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/EntityPlayer.java ../src_work/minecraft/net/minecraft/src/EntityPlayer.java --- ../src_base/minecraft/net/minecraft/src/EntityPlayer.java 2011-08-04 20:51:17.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/EntityPlayer.java 2011-08-04 20:51:18.000000000 -0400 @@ -6,6 +6,8 @@ import java.util.*; +import net.minecraft.src.forge.ISpecialArmor; + // Referenced classes of package net.minecraft.src: // EntityLiving, InventoryPlayer, ContainerPlayer, World, // ChunkCoordinates, DataWatcher, Container, StatList, @@ -477,6 +479,21 @@ protected void damageEntity(int i) { + boolean doRegularComputation = true; + for (ItemStack stack : inventory.armorInventory) { + if (stack != null && stack.getItem() instanceof ISpecialArmor) { + ISpecialArmor armor = (ISpecialArmor) stack.getItem(); + + i = armor.adjustArmorDamage(i); + doRegularComputation = doRegularComputation + && armor.allowRegularComputation(); + } + } + + if (!doRegularComputation) { + super.damageEntity(i); + } + int j = 25 - inventory.getTotalArmorValue(); int k = i * j + damageRemainder; inventory.damageArmor(i); 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-08-04 20:51:16.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/Explosion.java 2011-08-04 20:51:18.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,17 @@ 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 --- ../src_base/minecraft/net/minecraft/src/ItemBucket.java 2011-08-04 20:51:17.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/ItemBucket.java 2011-08-04 20:51:18.000000000 -0400 @@ -6,6 +6,8 @@ import java.util.Random; +import net.minecraft.src.forge.MinecraftForge; + // Referenced classes of package net.minecraft.src: // Item, EntityPlayer, Vec3D, MathHelper, // World, MovingObjectPosition, EnumMovingObjectType, Material, @@ -55,6 +57,13 @@ } if(isFull == 0) { + ItemStack customBucket = MinecraftForge.fillCustomBucket(world, + i, j, k); + + if (customBucket != null) { + return customBucket; + } + if(world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0) { world.setBlockWithNotify(i, j, k, 0); diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemPickaxe.java ../src_work/minecraft/net/minecraft/src/ItemPickaxe.java --- ../src_base/minecraft/net/minecraft/src/ItemPickaxe.java 2011-08-04 20:51:16.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/ItemPickaxe.java 2011-08-04 20:51:18.000000000 -0400 @@ -4,6 +4,8 @@ package net.minecraft.src; +import net.minecraft.src.forge.MinecraftForge; + // Referenced classes of package net.minecraft.src: // ItemTool, Block, EnumToolMaterial, Material @@ -42,6 +44,9 @@ { return toolMaterial.getHarvestLevel() >= 2; } + if (MinecraftForge.canHarvestBlock(this, block)) { + return true; + } if(block.blockMaterial == Material.rock) { return true; diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemRenderer.java ../src_work/minecraft/net/minecraft/src/ItemRenderer.java --- ../src_base/minecraft/net/minecraft/src/ItemRenderer.java 2011-08-04 20:51:16.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/ItemRenderer.java 2011-08-05 00:58:57.000000000 -0400 @@ -5,6 +5,8 @@ package net.minecraft.src; import net.minecraft.client.Minecraft; +import net.minecraft.src.forge.ForgeHooksClient; + import org.lwjgl.opengl.GL11; // Referenced classes of package net.minecraft.src: @@ -34,15 +36,18 @@ if(itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) { GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png")); + ForgeHooksClient.overrideTexture (Block.blocksList[itemstack.itemID]); renderBlocksInstance.renderBlockOnInventory(Block.blocksList[itemstack.itemID], itemstack.getItemDamage(), entityliving.getEntityBrightness(1.0F)); } else { if(itemstack.itemID < 256) { GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png")); + ForgeHooksClient.overrideTexture (Block.blocksList[itemstack.itemID]); } else { GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/gui/items.png")); + ForgeHooksClient.overrideTexture (Item.itemsList[itemstack.itemID]); } Tessellator tessellator = Tessellator.instance; int i = entityliving.getItemIcon(itemstack); diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ItemTool.java ../src_work/minecraft/net/minecraft/src/ItemTool.java --- ../src_base/minecraft/net/minecraft/src/ItemTool.java 2011-08-04 20:51:16.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/ItemTool.java 2011-08-04 20:51:18.000000000 -0400 @@ -4,6 +4,7 @@ package net.minecraft.src; +import java.util.Arrays; // Referenced classes of package net.minecraft.src: // Item, EnumToolMaterial, ItemStack, Block, @@ -63,4 +64,11 @@ private float efficiencyOnProperMaterial; private int damageVsEntity; protected EnumToolMaterial toolMaterial; + + public void addBlockEffectiveAgainst (Block block) { + blocksEffectiveAgainst = Arrays.copyOf(blocksEffectiveAgainst, + blocksEffectiveAgainst.length + 1); + + blocksEffectiveAgainst [blocksEffectiveAgainst.length-1] = block; + } } diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/PlayerController.java ../src_work/minecraft/net/minecraft/src/PlayerController.java --- ../src_base/minecraft/net/minecraft/src/PlayerController.java 2011-08-04 20:51:16.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/PlayerController.java 2011-08-04 20:51:18.000000000 -0400 @@ -3,6 +3,7 @@ // Decompiler options: packimports(3) braces deadcode package net.minecraft.src; +import net.minecraft.src.forge.*; import net.minecraft.client.Minecraft; @@ -98,6 +99,12 @@ public boolean sendPlaceBlock(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l) { + if (itemstack != null && itemstack.getItem() instanceof IUseItemFirst) { + IUseItemFirst iuif = (IUseItemFirst) itemstack.getItem(); + if (iuif.onItemUseFirst(itemstack, entityplayer, world, i, j, k, l)) { + return true; + } + } int i1 = world.getBlockId(i, j, k); if(i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer)) { diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/RenderItem.java ../src_work/minecraft/net/minecraft/src/RenderItem.java --- ../src_base/minecraft/net/minecraft/src/RenderItem.java 2011-08-04 20:51:16.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/RenderItem.java 2011-08-05 00:59:18.000000000 -0400 @@ -5,6 +5,9 @@ package net.minecraft.src; import java.util.Random; + +import net.minecraft.src.forge.ForgeHooksClient; + import org.lwjgl.opengl.GL11; // Referenced classes of package net.minecraft.src: @@ -51,6 +54,7 @@ { GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F); loadTexture("/terrain.png"); + ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]); float f4 = 0.25F; if(!Block.blocksList[itemstack.itemID].renderAsNormalBlock() && itemstack.itemID != Block.stairSingle.blockID && Block.blocksList[itemstack.itemID].getRenderType() != 16) { @@ -78,10 +82,12 @@ if(itemstack.itemID < 256) { loadTexture("/terrain.png"); + ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]); } else { loadTexture("/gui/items.png"); - } + ForgeHooksClient.overrideTexture(Item.itemsList[itemstack.itemID]); + } Tessellator tessellator = Tessellator.instance; float f6 = (float)((i % 16) * 16 + 0) / 256F; float f8 = (float)((i % 16) * 16 + 16) / 256F; @@ -92,6 +98,7 @@ float f14 = 0.25F; if(field_27004_a) { + int k = Item.itemsList[itemstack.itemID].getColorFromDamage(itemstack.getItemDamage()); float f15 = (float)(k >> 16 & 0xff) / 255F; float f17 = (float)(k >> 8 & 0xff) / 255F; @@ -131,6 +138,7 @@ { int j1 = i; renderengine.bindTexture(renderengine.getTexture("/terrain.png")); + ForgeHooksClient.overrideTexture (Block.blocksList[i]); Block block = Block.blocksList[j1]; GL11.glPushMatrix(); GL11.glTranslatef(l - 2, i1 + 3, -3F); @@ -159,9 +167,11 @@ if(i < 256) { renderengine.bindTexture(renderengine.getTexture("/terrain.png")); + ForgeHooksClient.overrideTexture (Block.blocksList[i]); } else { renderengine.bindTexture(renderengine.getTexture("/gui/items.png")); + ForgeHooksClient.overrideTexture(Item.itemsList[i]); } int k1 = Item.itemsList[i].getColorFromDamage(j); float f = (float)(k1 >> 16 & 0xff) / 255F; diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/Tessellator.java ../src_work/minecraft/net/minecraft/src/Tessellator.java --- ../src_base/minecraft/net/minecraft/src/Tessellator.java 2011-08-04 20:51:16.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/Tessellator.java 2011-08-05 05:09:37.000000000 -0400 @@ -6,6 +6,7 @@ import java.io.PrintStream; import java.nio.*; +import java.util.*; import org.lwjgl.opengl.*; // Referenced classes of package net.minecraft.src: @@ -14,8 +15,11 @@ public class Tessellator { - private Tessellator(int i) - { + public int instanceNo; + static int instanceTotal=0; + + public Tessellator() { + instanceNo=instanceTotal++; vertexCount = 0; hasColor = false; hasTexture = false; @@ -24,20 +28,10 @@ addedVertices = 0; isColorDisabled = false; isDrawing = false; - useVBO = false; vboIndex = 0; - vboCount = 10; - bufferSize = i; - byteBuffer = GLAllocation.createDirectByteBuffer(i * 4); - intBuffer = byteBuffer.asIntBuffer(); - floatBuffer = byteBuffer.asFloatBuffer(); - rawBuffer = new int[i]; - useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object; - if(useVBO) - { - vertexBuffers = GLAllocation.createDirectIntBuffer(vboCount); - ARBVertexBufferObject.glGenBuffersARB(vertexBuffers); - } + + rawBuffer=null; + rawBufferSize=0; } public void draw() @@ -47,12 +41,20 @@ throw new IllegalStateException("Not tesselating!"); } isDrawing = false; - if(vertexCount > 0) - { + int offs=0; + while(offs < vertexCount) { + int vtc; + if(drawMode == 7 && convertQuadsToTriangles) { + vtc=Math.min(vertexCount-offs,trivertsInBuffer); + } else { + vtc=Math.min(vertexCount-offs,nativeBufferSize>>5); + } + intBuffer.clear(); - intBuffer.put(rawBuffer, 0, rawBufferIndex); + intBuffer.put(rawBuffer, offs*8, vtc*8); byteBuffer.position(0); - byteBuffer.limit(rawBufferIndex * 4); + byteBuffer.limit(vtc*32); + offs+=vtc; if(useVBO) { vboIndex = (vboIndex + 1) % vboCount; @@ -106,10 +108,10 @@ GL11.glEnableClientState(32884 /*GL_VERTEX_ARRAY_EXT*/); if(drawMode == 7 && convertQuadsToTriangles) { - GL11.glDrawArrays(4, 0, vertexCount); + GL11.glDrawArrays(4, 0, vtc); } else { - GL11.glDrawArrays(drawMode, 0, vertexCount); + GL11.glDrawArrays(drawMode, 0, vtc); } GL11.glDisableClientState(32884 /*GL_VERTEX_ARRAY_EXT*/); if(hasTexture) @@ -125,6 +127,10 @@ GL11.glDisableClientState(32885 /*GL_NORMAL_ARRAY_EXT*/); } } + if(rawBufferSize>0x20000 && rawBufferIndex<(rawBufferSize<<3)) { + rawBufferSize=0; + rawBuffer=null; + } reset(); } @@ -237,6 +243,15 @@ public void addVertex(double d, double d1, double d2) { + if(rawBufferIndex >= rawBufferSize-32) { + if(rawBufferSize==0) { + rawBufferSize=0x10000; + rawBuffer=new int[rawBufferSize]; + } else { + rawBufferSize*=2; + rawBuffer=Arrays.copyOf(rawBuffer,rawBufferSize); + } + } addedVertices++; if(drawMode == 7 && convertQuadsToTriangles && addedVertices % 4 == 0) { @@ -278,11 +293,6 @@ rawBuffer[rawBufferIndex + 2] = Float.floatToRawIntBits((float)(d2 + zOffset)); rawBufferIndex += 8; vertexCount++; - if(vertexCount % 4 == 0 && rawBufferIndex >= bufferSize - 32) - { - draw(); - isDrawing = true; - } } public void setColorOpaque_I(int i) @@ -335,9 +345,7 @@ private static boolean convertQuadsToTriangles = true; private static boolean tryVBO = false; - private ByteBuffer byteBuffer; - private IntBuffer intBuffer; - private FloatBuffer floatBuffer; + private static boolean useVBO = false; private int rawBuffer[]; private int vertexCount; private double textureU; @@ -350,16 +358,40 @@ private int addedVertices; private boolean isColorDisabled; private int drawMode; - private double xOffset; - private double yOffset; - private double zOffset; + public double xOffset; + public double yOffset; + public double zOffset; private int normal; - public static final Tessellator instance = new Tessellator(0x200000); private boolean isDrawing; - private boolean useVBO; - private IntBuffer vertexBuffers; private int vboIndex; - private int vboCount; - private int bufferSize; + + private int rawBufferSize; + private static int vboCount; + private static IntBuffer vertexBuffers; + private static int nativeBufferSize; + private static int trivertsInBuffer; + private static ByteBuffer byteBuffer; + private static IntBuffer intBuffer; + private static FloatBuffer floatBuffer; + public static Tessellator instance; + public static Tessellator firstInstance; + + static { + instance=new Tessellator(); + firstInstance=instance; + + nativeBufferSize = 0x200000; + trivertsInBuffer = (nativeBufferSize/48)*6; + byteBuffer = GLAllocation.createDirectByteBuffer(nativeBufferSize * 4); + intBuffer = byteBuffer.asIntBuffer(); + floatBuffer = byteBuffer.asFloatBuffer(); + useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object; + vboCount = 10; + if(useVBO) + { + vertexBuffers = GLAllocation.createDirectIntBuffer(vboCount); + ARBVertexBufferObject.glGenBuffersARB(vertexBuffers); + } + } } diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/World.java ../src_work/minecraft/net/minecraft/src/World.java --- ../src_base/minecraft/net/minecraft/src/World.java 2011-08-04 20:51:16.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/World.java 2011-08-04 20:51:18.000000000 -0400 @@ -7,6 +7,8 @@ import java.io.PrintStream; import java.util.*; +import net.minecraft.src.forge.IBlockSecondaryProperties; + // Referenced classes of package net.minecraft.src: // IBlockAccess, WorldProvider, WorldInfo, MapStorage, // ISaveHandler, ChunkProvider, EntityPlayer, ChunkProviderLoadOrGenerate, @@ -313,7 +315,25 @@ public boolean isAirBlock(int i, int j, int k) { - return getBlockId(i, j, k) == 0; + int iBlockID = getBlockId( i, j, k ); + + if ( iBlockID == 0 ) + { + return true; + } + else + { + Block block = Block.blocksList[iBlockID]; + + if ( block instanceof IBlockSecondaryProperties ) + { + return ((IBlockSecondaryProperties)block).isAirBlock( this, i, j, k ); + } + else + { + return false; + } + } } public boolean blockExists(int i, int j, int k) @@ -1608,6 +1628,18 @@ { return true; } + else + { + Block block = Block.blocksList[j2]; + + if ( block instanceof IBlockSecondaryProperties ) + { + if ( ((IBlockSecondaryProperties)block).isBlockBurning( this, k1, i1, i2 ) ) + { + return true; + } + } + } } } @@ -1900,7 +1932,14 @@ return false; } else { - return block.blockMaterial.getIsTranslucent() && block.renderAsNormalBlock(); + if ( block instanceof IBlockSecondaryProperties ) + { + return ((IBlockSecondaryProperties)block).isBlockNormalCube( this, i, j, k ); + } + else + { + return block.blockMaterial.getIsTranslucent() && block.renderAsNormalBlock(); + } } } @@ -2425,6 +2464,16 @@ { block = null; } + else + { + if ( block instanceof IBlockSecondaryProperties ) + { + if ( ((IBlockSecondaryProperties)block).isBlockReplaceable( this, j, k, l ) ) + { + block = null; + } + } + } return i > 0 && block == null && block1.canPlaceBlockOnSide(this, j, k, l, i1); } diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/WorldRenderer.java ../src_work/minecraft/net/minecraft/src/WorldRenderer.java --- ../src_base/minecraft/net/minecraft/src/WorldRenderer.java 2011-08-04 20:51:17.000000000 -0400 +++ ../src_work/minecraft/net/minecraft/src/WorldRenderer.java 2011-08-05 06:22:55.000000000 -0400 @@ -3,8 +3,12 @@ // Decompiler options: packimports(3) braces deadcode package net.minecraft.src; +import net.minecraft.src.forge.*; import java.util.*; + +import net.minecraft.src.forge.ForgeHooksClient; + import org.lwjgl.opengl.GL11; // Referenced classes of package net.minecraft.src: @@ -125,8 +129,10 @@ GL11.glTranslatef((float)(-sizeDepth) / 2.0F, (float)(-sizeHeight) / 2.0F, (float)(-sizeDepth) / 2.0F); GL11.glScalef(f, f, f); GL11.glTranslatef((float)sizeDepth / 2.0F, (float)sizeHeight / 2.0F, (float)sizeDepth / 2.0F); - tessellator.startDrawingQuads(); - tessellator.setTranslationD(-posX, -posY, -posZ); + + ForgeHooksClient.beforeRenderPass(i2); + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setTranslationD(-posX, -posY, -posZ); } if(i2 == 0 && Block.isBlockContainer[i3]) { @@ -136,17 +142,17 @@ tileEntityRenderers.add(tileentity); } } + Block block = Block.blocksList[i3]; int j3 = block.getRenderBlockPass(); - if(j3 != i2) - { - flag = true; - continue; - } - if(j3 == i2) - { - flag1 |= renderblocks.renderBlockByRenderType(block, l2, j2, k2); - } + if(j3>i2) flag=true; + + if(!ForgeHooksClient.canRenderInPass(block,i2)) + continue; + + ForgeHooksClient.beforeBlockRender(block, renderblocks); + flag1 |= renderblocks.renderBlockByRenderType(block, l2, j2, k2); + ForgeHooksClient.afterBlockRender(block, renderblocks); } } @@ -155,10 +161,11 @@ if(flag2) { - tessellator.draw(); + ForgeHooksClient.afterRenderPass(i2); + Tessellator.instance.draw(); GL11.glPopMatrix(); GL11.glEndList(); - tessellator.setTranslationD(0.0D, 0.0D, 0.0D); + Tessellator.instance.setTranslationD(0.0D, 0.0D, 0.0D); } else { flag1 = false; @@ -251,7 +258,6 @@ public World worldObj; private int glRenderList; - private static Tessellator tessellator; public static int chunksUpdated = 0; public int posX; public int posY; @@ -282,8 +288,4 @@ public List tileEntityRenderers; private List tileEntities; - static - { - tessellator = Tessellator.instance; - } } diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneWire.java ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneWire.java --- ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 2011-08-04 20:51:17.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 2011-08-04 20:51:18.000000000 -0400 @@ -3,6 +3,7 @@ // Decompiler options: packimports(3) braces deadcode package net.minecraft.src; +import net.minecraft.src.forge.*; import java.util.*; @@ -413,6 +414,10 @@ { return false; } + if(Block.blocksList[i1] instanceof IConnectRedstone) { + IConnectRedstone icr=(IConnectRedstone)Block.blocksList[i1]; + return icr.canConnectRedstone(iblockaccess,i,j,k,l); + } if(Block.blocksList[i1].canProvidePower()) { return true; diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/Chunk.java ../src_work/minecraft_server/net/minecraft/src/Chunk.java --- ../src_base/minecraft_server/net/minecraft/src/Chunk.java 2011-08-04 20:51:17.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/Chunk.java 2011-08-04 20:51:18.000000000 -0400 @@ -3,6 +3,7 @@ // Decompiler options: packimports(3) braces deadcode package net.minecraft.src; +import net.minecraft.src.forge.*; import java.io.PrintStream; import java.util.*; @@ -227,6 +228,13 @@ } int l1 = xPosition * 16 + i; int i2 = zPosition * 16 + k; + + if(Block.blocksList[k1] instanceof IOverrideReplace) { + IOverrideReplace iovr=(IOverrideReplace)Block.blocksList[k1]; + if(!iovr.canReplaceBlock(worldObj,l1,j,i2,l)) + return iovr.getReplacedSuccess(); + } + blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff); if(k1 != 0 && !worldObj.singleplayerWorld) { @@ -270,6 +278,13 @@ } int k1 = xPosition * 16 + i; int l1 = zPosition * 16 + k; + + if(Block.blocksList[j1] instanceof IOverrideReplace) { + IOverrideReplace iovr=(IOverrideReplace)Block.blocksList[j1]; + if(!iovr.canReplaceBlock(worldObj,k1,j,l1,l)) + return iovr.getReplacedSuccess(); + } + blocks[i << 11 | k << 7 | j] = (byte)(byte0 & 0xff); if(j1 != 0) { diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/EntityPlayer.java ../src_work/minecraft_server/net/minecraft/src/EntityPlayer.java --- ../src_base/minecraft_server/net/minecraft/src/EntityPlayer.java 2011-08-04 20:51:17.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/EntityPlayer.java 2011-08-04 20:51:18.000000000 -0400 @@ -6,6 +6,8 @@ import java.util.*; +import net.minecraft.src.forge.ISpecialArmor; + // Referenced classes of package net.minecraft.src: // EntityLiving, InventoryPlayer, ContainerPlayer, World, // ChunkCoordinates, DataWatcher, Container, StatList, @@ -457,6 +459,21 @@ protected void damageEntity(int i) { + boolean doRegularComputation = true; + for (ItemStack stack : inventory.armorInventory) { + if (stack != null && stack.getItem() instanceof ISpecialArmor) { + ISpecialArmor armor = (ISpecialArmor) stack.getItem(); + + i = armor.adjustArmorDamage(i); + doRegularComputation = doRegularComputation + && armor.allowRegularComputation(); + } + } + + if (!doRegularComputation) { + super.damageEntity(i); + } + int j = 25 - inventory.getTotalArmorValue(); int k = i * j + damageRemainder; inventory.damageArmor(i); 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-08-04 20:51:17.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/Explosion.java 2011-08-04 20:51:18.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 --- ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java 2011-08-04 20:51:17.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java 2011-08-04 20:51:18.000000000 -0400 @@ -6,6 +6,8 @@ import java.util.Random; +import net.minecraft.src.forge.MinecraftForge; + // Referenced classes of package net.minecraft.src: // Item, EntityPlayer, Vec3D, MathHelper, // World, MovingObjectPosition, EnumMovingObjectType, Material, @@ -55,6 +57,13 @@ } if(isFull == 0) { + ItemStack customBucket = MinecraftForge.fillCustomBucket(world, + i, j, k); + + if (customBucket != null) { + return customBucket; + } + if(world.getBlockMaterial(i, j, k) == Material.water && world.getBlockMetadata(i, j, k) == 0) { world.setBlockWithNotify(i, j, k, 0); diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemInWorldManager.java ../src_work/minecraft_server/net/minecraft/src/ItemInWorldManager.java --- ../src_base/minecraft_server/net/minecraft/src/ItemInWorldManager.java 2011-08-04 20:51:17.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/ItemInWorldManager.java 2011-08-04 20:51:18.000000000 -0400 @@ -3,6 +3,7 @@ // Decompiler options: packimports(3) braces deadcode package net.minecraft.src; +import net.minecraft.src.forge.*; // Referenced classes of package net.minecraft.src: @@ -145,6 +146,11 @@ public boolean activeBlockOrUseItem(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l) { + if(itemstack!=null && itemstack.getItem() instanceof IUseItemFirst) { + IUseItemFirst iuif=(IUseItemFirst)itemstack.getItem(); + if(iuif.onItemUseFirst(itemstack,entityplayer,world,i,j,k,l)) + return true; + } int i1 = world.getBlockId(i, j, k); if(i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer)) { diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemPickaxe.java ../src_work/minecraft_server/net/minecraft/src/ItemPickaxe.java --- ../src_base/minecraft_server/net/minecraft/src/ItemPickaxe.java 2011-08-04 20:51:17.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/ItemPickaxe.java 2011-08-04 20:51:18.000000000 -0400 @@ -4,6 +4,8 @@ package net.minecraft.src; +import net.minecraft.src.forge.MinecraftForge; + // Referenced classes of package net.minecraft.src: // ItemTool, Block, EnumToolMaterial, Material @@ -42,6 +44,9 @@ { return toolMaterial.getHarvestLevel() >= 2; } + if (MinecraftForge.canHarvestBlock(this, block)) { + return true; + } if(block.blockMaterial == Material.rock) { return true; diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ItemTool.java ../src_work/minecraft_server/net/minecraft/src/ItemTool.java --- ../src_base/minecraft_server/net/minecraft/src/ItemTool.java 2011-08-04 20:51:17.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/ItemTool.java 2011-08-04 20:51:18.000000000 -0400 @@ -4,6 +4,8 @@ package net.minecraft.src; +import java.util.Arrays; + // Referenced classes of package net.minecraft.src: // Item, EnumToolMaterial, ItemStack, Block, @@ -58,4 +60,11 @@ private float efficiencyOnProperMaterial; private int damageVsEntity; protected EnumToolMaterial toolMaterial; + + public void addBlockEffectiveAgainst (Block block) { + blocksEffectiveAgainst = Arrays.copyOf(blocksEffectiveAgainst, + blocksEffectiveAgainst.length + 1); + + blocksEffectiveAgainst [blocksEffectiveAgainst.length-1] = block; + } } diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/PlayerInstance.java ../src_work/minecraft_server/net/minecraft/src/PlayerInstance.java --- ../src_base/minecraft_server/net/minecraft/src/PlayerInstance.java 2011-08-04 20:51:17.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/PlayerInstance.java 2011-08-04 20:51:18.000000000 -0400 @@ -169,12 +169,11 @@ sendPacketToPlayersInInstance(new Packet52MultiBlockChange(chunkX, chunkZ, blocksToUpdate, numBlocksToUpdate, worldserver)); for(int k = 0; k < numBlocksToUpdate; k++) { - int j1 = chunkX * 16 + (numBlocksToUpdate >> 12 & 0xf); - int i2 = numBlocksToUpdate & 0xff; - int k2 = chunkZ * 16 + (numBlocksToUpdate >> 8 & 0xf); + int j1 = chunkX * 16 + (blocksToUpdate[k] >> 12 & 0xf); + int i2 = blocksToUpdate[k] & 0xff; + int k2 = chunkZ * 16 + (blocksToUpdate[k] >> 8 & 0xf); if(Block.isBlockContainer[worldserver.getBlockId(j1, i2, k2)]) { - System.out.println("Sending!"); updateTileEntity(worldserver.getBlockTileEntity(j1, i2, k2)); } } diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/World.java ../src_work/minecraft_server/net/minecraft/src/World.java --- ../src_base/minecraft_server/net/minecraft/src/World.java 2011-08-04 20:51:17.000000000 -0400 +++ ../src_work/minecraft_server/net/minecraft/src/World.java 2011-08-04 20:51:18.000000000 -0400 @@ -7,6 +7,8 @@ import java.io.PrintStream; import java.util.*; +import net.minecraft.src.forge.IBlockSecondaryProperties; + // Referenced classes of package net.minecraft.src: // IBlockAccess, WorldProvider, MapStorage, ISaveHandler, // WorldInfo, ChunkProvider, IChunkProvider, IProgressUpdate, @@ -166,7 +168,25 @@ public boolean isAirBlock(int i, int j, int k) { - return getBlockId(i, j, k) == 0; + int iBlockID = getBlockId( i, j, k ); + + if ( iBlockID == 0 ) + { + return true; + } + else + { + Block block = Block.blocksList[iBlockID]; + + if ( block instanceof IBlockSecondaryProperties ) + { + return ((IBlockSecondaryProperties)block).isAirBlock( this, i, j, k ); + } + else + { + return false; + } + } } public boolean blockExists(int i, int j, int k) @@ -1409,6 +1429,18 @@ { return true; } + else + { + Block block = Block.blocksList[j2]; + + if ( block instanceof IBlockSecondaryProperties ) + { + if ( ((IBlockSecondaryProperties)block).isBlockBurning( this, k1, i1, i2 ) ) + { + return true; + } + } + } } } @@ -1686,7 +1718,14 @@ return false; } else { - return block.blockMaterial.getIsOpaque() && block.isACube(); + if ( block instanceof IBlockSecondaryProperties ) + { + return ((IBlockSecondaryProperties)block).isBlockNormalCube( this, i, j, k ); + } + else + { + return block.blockMaterial.getIsOpaque() && block.isACube(); + } } } @@ -2178,6 +2217,16 @@ { block = null; } + else + { + if ( block instanceof IBlockSecondaryProperties ) + { + if ( ((IBlockSecondaryProperties)block).isBlockReplaceable( this, j, k, l ) ) + { + block = null; + } + } + } return i > 0 && block == null && block1.canPlaceBlockOnSide(this, j, k, l, i1); }