ForgePatch/forge/minecraft.patch

390 lines
17 KiB
Diff

diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/client/Minecraft.java ../src_work/minecraft/net/minecraft/client/Minecraft.java
--- ../src_base/minecraft/net/minecraft/client/Minecraft.java 2011-07-19 20:32:54.429858500 +0200
+++ ../src_work/minecraft/net/minecraft/client/Minecraft.java 2011-07-19 20:33:40.515494400 +0200
@@ -8,6 +8,8 @@
import java.io.File;
import java.io.PrintStream;
import net.minecraft.src.*;
+import net.minecraft.src.forge.MinecraftForgeClient;
+
import org.lwjgl.LWJGLException;
import org.lwjgl.input.*;
import org.lwjgl.opengl.*;
@@ -177,6 +179,7 @@
renderGlobal = new RenderGlobal(this, renderEngine);
GL11.glViewport(0, 0, displayWidth, displayHeight);
effectRenderer = new EffectRenderer(theWorld, renderEngine);
+ MinecraftForgeClient.onGameStart();
try
{
downloadResourcesThread = new ThreadDownloadResources(mcDataDir, this);
diff -u -r --strip-trailing-cr ../src_base/minecraft/net/minecraft/src/ChunkProviderGenerate.java ../src_work/minecraft/net/minecraft/src/ChunkProviderGenerate.java
--- ../src_base/minecraft/net/minecraft/src/ChunkProviderGenerate.java 2011-07-19 20:32:54.820880000 +0200
+++ ../src_work/minecraft/net/minecraft/src/ChunkProviderGenerate.java 2011-07-19 20:33:40.519494600 +0200
@@ -6,6 +6,8 @@
import java.util.Random;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// IChunkProvider, MapGenCaves, NoiseGeneratorOctaves, Block,
// BiomeGenBase, Chunk, World, WorldChunkManager,
@@ -632,6 +634,8 @@
int i25 = l + rand.nextInt(16) + 8;
(new WorldGenLiquids(Block.lavaMoving.blockID)).generate(worldObj, rand, i22, l23, i25);
}
+
+ MinecraftForge.populateBiome(worldObj, biomegenbase, k, l);
generatedTemperatures = worldObj.getWorldChunkManager().getTemperatures(generatedTemperatures, k + 8, l + 8, 16, 16);
for(int j19 = k + 8; j19 < k + 8 + 16; j19++)
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-07-19 20:32:54.895885100 +0200
+++ ../src_work/minecraft/net/minecraft/src/EffectRenderer.java 2011-07-19 20:40:47.501916600 +0200
@@ -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/ItemBucket.java ../src_work/minecraft/net/minecraft/src/ItemBucket.java
--- ../src_base/minecraft/net/minecraft/src/ItemBucket.java 2011-07-19 20:32:55.620926000 +0200
+++ ../src_work/minecraft/net/minecraft/src/ItemBucket.java 2011-07-19 20:33:40.524494900 +0200
@@ -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/ItemRenderer.java ../src_work/minecraft/net/minecraft/src/ItemRenderer.java
--- ../src_base/minecraft/net/minecraft/src/ItemRenderer.java 2011-07-19 20:32:55.684930300 +0200
+++ ../src_work/minecraft/net/minecraft/src/ItemRenderer.java 2011-07-19 20:33:40.528495200 +0200
@@ -5,6 +5,8 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.MinecraftForgeClient;
+
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"));
+ MinecraftForgeClient.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"));
+ MinecraftForgeClient.overrideTexture (Block.blocksList[itemstack.itemID]);
} else
{
GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/gui/items.png"));
+ MinecraftForgeClient.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/RenderBlocks.java ../src_work/minecraft/net/minecraft/src/RenderBlocks.java
--- ../src_base/minecraft/net/minecraft/src/RenderBlocks.java 2011-07-19 20:32:57.062009000 +0200
+++ ../src_work/minecraft/net/minecraft/src/RenderBlocks.java 2011-07-19 20:33:40.533495400 +0200
@@ -5,6 +5,8 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.MinecraftForgeClient;
+
import org.lwjgl.opengl.GL11;
// Referenced classes of package net.minecraft.src:
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-07-19 20:32:57.183015900 +0200
+++ ../src_work/minecraft/net/minecraft/src/RenderItem.java 2011-07-19 20:33:40.568497500 +0200
@@ -5,6 +5,9 @@
package net.minecraft.src;
import java.util.Random;
+
+import net.minecraft.src.forge.MinecraftForgeClient;
+
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");
+ MinecraftForgeClient.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");
+ MinecraftForgeClient.overrideTexture(Block.blocksList[itemstack.itemID]);
} else
{
loadTexture("/gui/items.png");
- }
+ MinecraftForgeClient.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"));
+ MinecraftForgeClient.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"));
+ MinecraftForgeClient.overrideTexture (Block.blocksList[i]);
} else
{
renderengine.bindTexture(renderengine.getTexture("/gui/items.png"));
+ MinecraftForgeClient.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/WorldRenderer.java ../src_work/minecraft/net/minecraft/src/WorldRenderer.java
--- ../src_base/minecraft/net/minecraft/src/WorldRenderer.java 2011-07-19 20:32:57.777049900 +0200
+++ ../src_work/minecraft/net/minecraft/src/WorldRenderer.java 2011-07-19 20:33:40.579498100 +0200
@@ -5,6 +5,9 @@
package net.minecraft.src;
import java.util.*;
+
+import net.minecraft.src.forge.MinecraftForgeClient;
+
import org.lwjgl.opengl.GL11;
// Referenced classes of package net.minecraft.src:
@@ -144,8 +147,10 @@
continue;
}
if(j3 == i2)
- {
+ {
+ MinecraftForgeClient.beforeBlockRender(block, renderblocks);
flag1 |= renderblocks.renderBlockByRenderType(block, l2, j2, k2);
+ MinecraftForgeClient.afterBlockRender(block, renderblocks);
}
}
diff -u -r --strip-trailing-cr ../src_base/minecraft_server/net/minecraft/src/ChunkProviderGenerate.java ../src_work/minecraft_server/net/minecraft/src/ChunkProviderGenerate.java
--- ../src_base/minecraft_server/net/minecraft/src/ChunkProviderGenerate.java 2011-07-19 20:33:10.318767000 +0200
+++ ../src_work/minecraft_server/net/minecraft/src/ChunkProviderGenerate.java 2011-07-19 20:33:40.583498300 +0200
@@ -6,6 +6,8 @@
import java.util.Random;
+import net.minecraft.src.forge.MinecraftForge;
+
// Referenced classes of package net.minecraft.src:
// IChunkProvider, MapGenCaves, NoiseGeneratorOctaves, Block,
// BiomeGenBase, Chunk, World, WorldChunkManager,
@@ -632,6 +634,8 @@
int i25 = l + rand.nextInt(16) + 8;
(new WorldGenLiquids(Block.lavaMoving.blockID)).generate(worldObj, rand, i22, l23, i25);
}
+
+ MinecraftForge.populateBiome(worldObj, biomegenbase, k, l);
generatedTemperatures = worldObj.getWorldChunkManager().getTemperatures(generatedTemperatures, k + 8, l + 8, 16, 16);
for(int j19 = k + 8; j19 < k + 8 + 16; j19++)
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-19 20:33:10.742791000 +0200
+++ ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java 2011-07-19 20:33:40.617500300 +0200
@@ -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);