A bulk of more patches converted, updated fml

This commit is contained in:
LexManos 2012-08-06 17:52:23 -07:00
parent 31a908b754
commit e58129ddd2
20 changed files with 1960 additions and 5 deletions

View file

@ -6,9 +6,11 @@ import java.util.TreeSet;
import org.lwjgl.opengl.GL11;
import net.minecraft.src.Block;
import net.minecraft.src.ItemStack;
import net.minecraft.src.ModLoader;
import net.minecraft.src.RenderBlocks;
import net.minecraft.src.Tessellator;
import net.minecraftforge.common.IArmorTextureProvider;
public class ForgeHooksClient
{
@ -190,4 +192,13 @@ public class ForgeHooksClient
unbindTexture();
}
}
public static String getArmorTexture(ItemStack armor, String _default)
{
if (armor.getItem() instanceof IArmorTextureProvider)
{
return ((IArmorTextureProvider)armor.getItem()).getArmorTextureFile(armor);
}
return _default;
}
}

View file

@ -0,0 +1,124 @@
package net.minecraftforge.client;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.src.GameSettings;
import net.minecraft.src.GuiControls;
import net.minecraft.src.GuiSlot;
import net.minecraft.src.KeyBinding;
import net.minecraft.src.Tessellator;
public class GuiControlsScrollPanel extends GuiSlot
{
private GuiControls controls;
private GameSettings options;
private Minecraft mc;
private String[] message;
private int _mouseX;
private int _mouseY;
private int selected = -1;
public GuiControlsScrollPanel(GuiControls controls, GameSettings options, Minecraft mc)
{
super(mc, controls.width, controls.height, 16, (controls.height - 32) + 4, 25);
this.controls = controls;
this.options = options;
this.mc = mc;
}
@Override
protected int getSize()
{
return options.keyBindings.length;
}
@Override
protected void elementClicked(int i, boolean flag)
{
if (!flag)
{
if (selected == -1)
{
selected = i;
}
else
{
options.setKeyBinding(selected, -100);
selected = -1;
KeyBinding.resetKeyBindingArrayAndHash();
}
}
}
@Override
protected boolean isSelected(int i)
{
return false;
}
@Override
protected void drawBackground() {}
@Override
public void drawScreen(int mX, int mY, float f)
{
_mouseX = mX;
_mouseY = mY;
if (selected != -1 && !Mouse.isButtonDown(0) && Mouse.getDWheel() == 0)
{
if (Mouse.next() && Mouse.getEventButtonState())
{
System.out.println(Mouse.getEventButton());
options.setKeyBinding(selected, -100 + Mouse.getEventButton());
selected = -1;
KeyBinding.resetKeyBindingArrayAndHash();
}
}
super.drawScreen(mX, mY, f);
}
@Override
protected void drawSlot(int index, int xPosition, int yPosition, int l, Tessellator tessellator)
{
int width = 70;
int height = 20;
xPosition -= 20;
boolean flag = _mouseX >= xPosition && _mouseY >= yPosition && _mouseX < xPosition + width && _mouseY < yPosition + height;
int k = (flag ? 2 : 1);
GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/gui/gui.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
controls.drawTexturedModalRect(xPosition, yPosition, 0, 46 + k * 20, width / 2, height);
controls.drawTexturedModalRect(xPosition + width / 2, yPosition, 200 - width / 2, 46 + k * 20, width / 2, height);
controls.drawString(mc.fontRenderer, options.getKeyBindingDescription(index), xPosition + width + 4, yPosition + 6, 0xFFFFFFFF);
boolean conflict = false;
for (int x = 0; x < options.keyBindings.length; x++)
{
if (x != index && options.keyBindings[x].keyCode == options.keyBindings[index].keyCode)
{
conflict = true;
break;
}
}
String str = (conflict ? "\247c" : "") + options.getOptionDisplayString(index);
str = (index == selected ? "\247f> \247e??? \247f<" : str);
controls.drawCenteredString(mc.fontRenderer, str, xPosition + (width / 2), yPosition + (height - 8) / 2, 0xFFFFFFFF);
}
public boolean keyTyped(char c, int i)
{
if (selected != -1)
{
options.setKeyBinding(selected, i);
selected = -1;
KeyBinding.resetKeyBindingArrayAndHash();
return false;
}
return true;
}
}

View file

@ -0,0 +1,268 @@
package net.minecraftforge.client;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import paulscode.sound.SoundSystemConfig;
import paulscode.sound.codecs.CodecIBXM;
import net.minecraft.client.Minecraft;
import net.minecraft.src.*;
public class ModCompatibilityClient
{
/**
* Trys to get the class for the specified name, will also try the
* net.minecraft.src package in case we are in MCP
* Returns null if not found.
*
* @param name The class name
* @return The Class, or null if not found
*/
private static Class getClass(String name)
{
try
{
return Class.forName(name);
}
catch (Exception e)
{
try
{
return Class.forName("net.minecraft.src." + name);
}
catch (Exception e2)
{
return null;
}
}
}
/************************************************************************************************
* Risugami's AudioMod Compatibility
* http://www.minecraftforum.net/topic/75440-
*
* AudioMod adds a few extra codecs, loads audio from /resources/mods/*,
* introduces the concept of 'cave' sounds, which are determined by if
* the player is underneath a solid block.
*
* It also lowers the interval between background music songs to 6000
*/
public static SoundPool audioModSoundPoolCave;
/**
* Populates the sound pools with with sounds from the /resources/mods folder
* And sets the interval between background music to 6000
*
* @param mngr The SoundManager instance
*/
public static void audioModLoad(SoundManager mngr)
{
audioModSoundPoolCave = new SoundPool();
audioModLoadModAudio("resources/mod/sound", mngr.soundPoolSounds);
audioModLoadModAudio("resources/mod/streaming", mngr.soundPoolStreaming);
audioModLoadModAudio("resources/mod/music", mngr.soundPoolMusic);
audioModLoadModAudio("resources/mod/cavemusic", audioModSoundPoolCave);
if (mngr.MUSIC_INTERVAL == 12000)
{
mngr.MUSIC_INTERVAL = 6000;
}
}
/**
* Walks the given path in the Minecraft app directory and adds audio to the SoundPool
* @param path The path to walk
* @param pool The pool to add sound to
*/
private static void audioModLoadModAudio(String path, SoundPool pool)
{
File folder = new File(Minecraft.getMinecraftDir(), path);
try
{
audioModWalkFolder(folder, folder, pool);
}
catch (IOException ex)
{
ModLoader.getLogger().fine("Loading Mod audio failed for folder: " + path);
ModLoader.getLogger().fine(ex.toString());
ex.printStackTrace();
}
}
/**
* Walks the folder path recursively and calls pool.addSound on any file it finds.
*
* @param base The base path for the folder, determines the name when calling addSound
* @param folder The current folder
* @param pool The SoundPool to add the sound to
* @throws IOException
*/
private static void audioModWalkFolder(File base, File folder, SoundPool pool) throws IOException
{
if (folder.exists() || folder.mkdirs())
{
for (File file : folder.listFiles())
{
if (!file.getName().startsWith("."))
{
if (file.isDirectory())
{
audioModWalkFolder(base, file, pool);
}
else if (file.isFile())
{
String subpath = file.getPath().substring(base.getPath().length() + 1).replace('\\', '/');
pool.addSound(subpath, file);
}
}
}
}
}
/**
* Adds the IBXM codec and associates it with .xm, .s3m, and .mod
*/
public static void audioModAddCodecs()
{
SoundSystemConfig.setCodec("xm", CodecIBXM.class);
SoundSystemConfig.setCodec("s3m", CodecIBXM.class);
SoundSystemConfig.setCodec("mod", CodecIBXM.class);
}
/**
* If the current player is underground, it picks a random song from the cave sound pool,
* if they are not it returns the passed in entry.
*
* @param soundManager The SoundManager instance
* @param current The currently selected entry
* @return A soundPool entry to be played as the background music
*/
public static SoundPoolEntry audioModPickBackgroundMusic(SoundManager soundManager, SoundPoolEntry current)
{
Minecraft mc = ModLoader.getMinecraftInstance();
if (mc != null && mc.theWorld != null && audioModSoundPoolCave != null)
{
Entity ent = mc.renderViewEntity;
int x = MathHelper.truncateDoubleToInt(ent.posX);
int y = MathHelper.truncateDoubleToInt(ent.posY);
int z = MathHelper.truncateDoubleToInt(ent.posZ);
return (mc.theWorld.canBlockSeeTheSky(x, y, z) ? current : audioModSoundPoolCave.getRandomSound());
}
return current;
}
/***********************************************************************************************************
* SDK's ModLoaderMP
* http://www.minecraftforum.net/topic/86765-
*
* ModLoaderMP was supposed to be a reliable server side version of ModLoader, however it has
* gotten the reputation of being really slow to update. Never having bugfixes, breaking compatibility
* with the client side ModLoader.
*
* So we have replaced it with our own system called FML (Forge ModLoader)
* it is a stand alone mod, that Forge relies on, and that is open source/community driven.
* https://github.com/cpw/FML
*
* However, for compatibilities sake, we provide the ModLoaderMP's hooks so that the end user
* does not need to make a choice between the two on the client side.
**/
private static int isMLMPInstalled = -1;
/**
* Determine if ModLoaderMP is installed by checking for the existence of the BaseModMp class.
* @return True if BaseModMp was installed (indicating the existance of MLMP)
*/
public static boolean isMLMPInstalled()
{
if (isMLMPInstalled == -1)
{
isMLMPInstalled = (getClass("ModLoaderMp") != null ? 1 : 0);
}
return isMLMPInstalled == 1;
}
/**
* Attempts to spawn a vehicle using ModLoaderMP's vehicle spawn registry, if MLMP is not installed
* it returns the passed in currentEntity
*
* @param type The Type ID of the vehicle
* @param world The current world
* @param x The spawn X position
* @param y The spawn Y position
* @param z The spawn Z position
* @param thrower The entity that spawned the vehicle {possibly null}
* @param currentEntity The current value to return if MLMP is not installed
* @return The new spawned entity
* @throws Exception
*/
public static Object mlmpVehicleSpawn(int type, World world, double x, double y, double z, Entity thrower, Object currentEntity) throws Exception
{
Class mlmp = getClass("ModLoaderMp");
if (!isMLMPInstalled() || mlmp == null)
{
return currentEntity;
}
Object entry = mlmp.getDeclaredMethod("handleNetClientHandlerEntities", int.class).invoke(null, type);
if (entry == null)
{
return currentEntity;
}
Class entityClass = (Class)entry.getClass().getDeclaredField("entityClass").get(entry);
Object ret = (Entity)entityClass.getConstructor(World.class, Double.TYPE, Double.TYPE, Double.TYPE).newInstance(world, x, y, z);
if (entry.getClass().getDeclaredField("entityHasOwner").getBoolean(entry))
{
Field owner = entityClass.getField("owner");
if (!Entity.class.isAssignableFrom(owner.getType()))
{
throw new Exception(String.format("Entity\'s owner field must be of type Entity, but it is of type %s.", owner.getType()));
}
if (thrower == null)
{
System.out.println("Received spawn packet for entity with owner, but owner was not found.");
ModLoader.getLogger().fine("Received spawn packet for entity with owner, but owner was not found.");
}
else
{
if (!owner.getType().isAssignableFrom(thrower.getClass()))
{
throw new Exception(String.format("Tried to assign an entity of type %s to entity owner, which is of type %s.", thrower.getClass(), owner.getType()));
}
owner.set(ret, thrower);
}
}
return ret;
}
/**
* Attempts to invoke ModLoaderMp.handleGUI if ModLoaderMP is installed.
* If not, it does nothing
*
* @param pkt The open window packet
*/
public static void mlmpOpenWindow(Packet100OpenWindow pkt)
{
Class mlmp = getClass("ModLoaderMp");
if (!isMLMPInstalled() || mlmp == null)
{
return;
}
try
{
mlmp.getDeclaredMethod("handleGUI", Packet100OpenWindow.class).invoke(null, pkt);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}

View file

@ -26,3 +26,10 @@ public ava.h # theWorld
public ava.i # renderEngine
public ava.q # mc
public ava.r # globalRenderBlocks
# SoundManager
public ayp.a # sndSystem
public ayp.b # soundPoolSounds
public ayp.c # soundPoolStreaming
public ayp.d # soundPoolMusic
# EntityLiving
public jv.aM # carryoverDamage

View file

@ -0,0 +1,26 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraftforge.common;
import net.minecraft.src.ItemStack;
/**
* This interface has to be implemented by an instance of ItemArmor.
* It allows for the application of a custom texture file to the player skin
* when the armor is worn.
*/
public interface IArmorTextureProvider
{
/**
* This interface has to return the path to a file that is the same
* format as iron_1.png (or any of the other armor files). It will be
* applied to the player skin when the armor is worn.
*/
public String getArmorTextureFile(ItemStack itemstack);
}

View file

@ -0,0 +1,66 @@
--- ../src_base/common/net/minecraft/src/WorldGenHugeTrees.java
+++ ../src_work/common/net/minecraft/src/WorldGenHugeTrees.java
@@ -55,7 +55,12 @@
{
var12 = par1World.getBlockId(var10, var8, var11);
- if (var12 != 0 && var12 != Block.leaves.blockID && var12 != Block.grass.blockID && var12 != Block.dirt.blockID && var12 != Block.wood.blockID && var12 != Block.sapling.blockID)
+ if (var12 != 0 &&
+ (Block.blocksList[var12] != null && !Block.blocksList[var12].isLeaves(par1World, var10, var8, var11)) &&
+ var12 != Block.grass.blockID &&
+ var12 != Block.dirt.blockID &&
+ (Block.blocksList[var12] != null && !Block.blocksList[var12].isWood(par1World, var10, var8, var11)) &&
+ var12 != Block.sapling.blockID)
{
var7 = false;
}
@@ -103,7 +108,7 @@
{
var11 = par1World.getBlockId(par3, par4 + var10, par5);
- if (var11 == 0 || var11 == Block.leaves.blockID)
+ if (var11 == 0 || Block.blocksList[var11] == null || Block.blocksList[var11].isLeaves(par1World, par3, par4 + var10, par5))
{
this.setBlockAndMetadata(par1World, par3, par4 + var10, par5, Block.wood.blockID, this.woodMetadata);
@@ -125,7 +130,7 @@
{
var11 = par1World.getBlockId(par3 + 1, par4 + var10, par5);
- if (var11 == 0 || var11 == Block.leaves.blockID)
+ if (var11 == 0 || Block.blocksList[var11] == null || Block.blocksList[var11].isLeaves(par1World, par3 + 1, par4 + var10, par5))
{
this.setBlockAndMetadata(par1World, par3 + 1, par4 + var10, par5, Block.wood.blockID, this.woodMetadata);
@@ -145,7 +150,7 @@
var11 = par1World.getBlockId(par3 + 1, par4 + var10, par5 + 1);
- if (var11 == 0 || var11 == Block.leaves.blockID)
+ if (var11 == 0 || Block.blocksList[var11] == null || Block.blocksList[var11].isLeaves(par1World, par3 + 1, par4 + var10, par5 + 1))
{
this.setBlockAndMetadata(par1World, par3 + 1, par4 + var10, par5 + 1, Block.wood.blockID, this.woodMetadata);
@@ -165,7 +170,7 @@
var11 = par1World.getBlockId(par3, par4 + var10, par5 + 1);
- if (var11 == 0 || var11 == Block.leaves.blockID)
+ if (var11 == 0 || Block.blocksList[var11] == null || Block.blocksList[var11].isLeaves(par1World, par3, par4 + var10, par5 + 1))
{
this.setBlockAndMetadata(par1World, par3, par4 + var10, par5 + 1, Block.wood.blockID, this.woodMetadata);
@@ -216,7 +221,12 @@
{
int var14 = var13 - par3;
- if ((var12 >= 0 || var14 >= 0 || var12 * var12 + var14 * var14 <= var10 * var10) && (var12 <= 0 && var14 <= 0 || var12 * var12 + var14 * var14 <= (var10 + 1) * (var10 + 1)) && (par6Random.nextInt(4) != 0 || var12 * var12 + var14 * var14 <= (var10 - 1) * (var10 - 1)) && !Block.opaqueCubeLookup[par1World.getBlockId(var11, var8, var13)])
+ Block block = Block.blocksList[par1World.getBlockId(var11, var8, var13)];
+
+ if ((var12 >= 0 || var14 >= 0 || var12 * var12 + var14 * var14 <= var10 * var10) &&
+ (var12 <= 0 && var14 <= 0 || var12 * var12 + var14 * var14 <= (var10 + 1) * (var10 + 1)) &&
+ (par6Random.nextInt(4) != 0 || var12 * var12 + var14 * var14 <= (var10 - 1) * (var10 - 1)) &&
+ (block == null || block.canBeReplacedByLeaves(par1World, var11, var8, var13)))
{
this.setBlockAndMetadata(par1World, var11, var8, var13, Block.leaves.blockID, this.leavesMetadata);
}

View file

@ -0,0 +1,139 @@
--- ../src_base/minecraft/net/minecraft/src/EntityLiving.java
+++ ../src_work/minecraft/net/minecraft/src/EntityLiving.java
@@ -5,6 +5,9 @@
import java.util.Iterator;
import java.util.List;
import java.util.Random;
+
+import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.common.MinecraftForge;
public abstract class EntityLiving extends Entity
{
@@ -310,6 +313,7 @@
public void setAttackTarget(EntityLiving par1EntityLiving)
{
this.attackTarget = par1EntityLiving;
+ MinecraftForge.EVENT_BUS.post(new LivingSetAttackTargetEvent(this, par1EntityLiving));
}
public boolean isExplosiveMob(Class par1Class)
@@ -366,6 +370,7 @@
{
this.entityLivingToAttack = par1EntityLiving;
this.revengeTimer = this.entityLivingToAttack != null ? 60 : 0;
+ MinecraftForge.EVENT_BUS.post(new LivingSetAttackTargetEvent(this, par1EntityLiving));
}
protected void entityInit()
@@ -648,6 +653,11 @@
*/
public void onUpdate()
{
+ if (ForgeHooks.onEntityLivingUpdate(this))
+ {
+ return;
+ }
+
super.onUpdate();
if (this.arrowHitTempCounter > 0)
@@ -815,6 +825,11 @@
*/
public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
{
+ if (ForgeHooks.onEntityLivingAttacked(this, par1DamageSource, par2))
+ {
+ return false;
+ }
+
if (this.worldObj.isRemote)
{
return false;
@@ -997,6 +1012,12 @@
*/
protected void damageEntity(DamageSource par1DamageSource, int par2)
{
+ par2 = ForgeHooks.onEntityLivingHurt(this, par1DamageSource, par2);
+ if (par2 == 0)
+ {
+ return;
+ }
+
par2 = this.applyArmorCalculations(par1DamageSource, par2);
par2 = this.applyPotionDamageCalculations(par1DamageSource, par2);
this.health -= par2;
@@ -1060,6 +1081,11 @@
*/
public void onDeath(DamageSource par1DamageSource)
{
+ if (ForgeHooks.onEntityLivingDeath(this, par1DamageSource))
+ {
+ return;
+ }
+
Entity var2 = par1DamageSource.getEntity();
if (this.scoreValue >= 0 && var2 != null)
@@ -1083,13 +1109,17 @@
var3 = EnchantmentHelper.getLootingModifier(((EntityPlayer)var2).inventory);
}
+ captureDrops = true;
+ capturedDrops.clear();
+ int var4 = 0;
+
if (!this.isChild())
{
this.dropFewItems(this.recentlyHit > 0, var3);
if (this.recentlyHit > 0)
{
- int var4 = this.rand.nextInt(200) - var3;
+ var4 = this.rand.nextInt(200) - var3;
if (var4 < 5)
{
@@ -1097,6 +1127,13 @@
}
}
}
+
+ captureDrops = false;
+ ForgeHooks.onEntityLivingDrops(this, par1DamageSource, capturedDrops, var3, recentlyHit > 0, var4);
+ for (EntityItem item : capturedDrops)
+ {
+ worldObj.spawnEntityInWorld(item);
+ }
}
this.worldObj.setEntityState(this, (byte)3);
@@ -1140,6 +1177,11 @@
*/
protected void fall(float par1)
{
+ if (ForgeHooks.onEntityLivingFall(this, par1))
+ {
+ return;
+ }
+
super.fall(par1);
int var2 = MathHelper.ceiling_float_int(par1 - 3.0F);
@@ -1327,7 +1369,7 @@
int var2 = MathHelper.floor_double(this.boundingBox.minY);
int var3 = MathHelper.floor_double(this.posZ);
int var4 = this.worldObj.getBlockId(var1, var2, var3);
- return var4 == Block.ladder.blockID || var4 == Block.vine.blockID;
+ return Block.blocksList[var4] != null && Block.blocksList[var4].isLadder(worldObj, var1, var2, var3);
}
/**
@@ -1590,6 +1632,7 @@
}
this.isAirBorne = true;
+ ForgeHooks.onEntityLivingJump(this);
}
/**

View file

@ -0,0 +1,96 @@
--- ../src_base/minecraft/net/minecraft/src/EntityRenderer.java
+++ ../src_work/minecraft/net/minecraft/src/EntityRenderer.java
@@ -6,6 +6,8 @@
import java.util.List;
import java.util.Random;
import net.minecraft.client.Minecraft;
+import net.minecraftforge.client.ForgeHooksClient;
+
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
@@ -289,8 +291,15 @@
*/
private void updateFovModifierHand()
{
- EntityPlayerSP var1 = (EntityPlayerSP)this.mc.renderViewEntity;
- this.fovMultiplierTemp = var1.getFOVMultiplier();
+ if (mc.renderViewEntity instanceof EntityPlayerSP)
+ {
+ EntityPlayerSP var1 = (EntityPlayerSP)this.mc.renderViewEntity;
+ this.fovMultiplierTemp = var1.getFOVMultiplier();
+ }
+ else
+ {
+ this.fovMultiplierTemp = mc.thePlayer.getFOVMultiplier();
+ }
this.fovModifierHandPrev = this.fovModifierHand;
this.fovModifierHand += (this.fovMultiplierTemp - this.fovModifierHand) * 0.5F;
}
@@ -306,7 +315,7 @@
}
else
{
- EntityPlayer var3 = (EntityPlayer)this.mc.renderViewEntity;
+ EntityLiving var3 = (EntityLiving)this.mc.renderViewEntity;
float var4 = 70.0F;
if (par2)
@@ -394,11 +403,14 @@
if (!this.mc.gameSettings.debugCamEnable)
{
int var10 = this.mc.theWorld.getBlockId(MathHelper.floor_double(var2.posX), MathHelper.floor_double(var2.posY), MathHelper.floor_double(var2.posZ));
-
- if (var10 == Block.bed.blockID)
- {
- int var11 = this.mc.theWorld.getBlockMetadata(MathHelper.floor_double(var2.posX), MathHelper.floor_double(var2.posY), MathHelper.floor_double(var2.posZ));
- int var12 = var11 & 3;
+ int x = MathHelper.floor_double(var2.posX);
+ int y = MathHelper.floor_double(var2.posY);
+ int z = MathHelper.floor_double(var2.posZ);
+ Block block = Block.blocksList[mc.theWorld.getBlockId(x, y, z)];
+
+ if (block != null && block.isBed(mc.theWorld, x, y, z, var2))
+ {
+ int var12 = block.getBedDirection(mc.theWorld, x, y, z);
GL11.glRotatef((float)(var12 * 90), 0.0F, 1.0F, 0.0F);
}
@@ -1034,8 +1046,11 @@
var17 = (EntityPlayer)var4;
GL11.glDisable(GL11.GL_ALPHA_TEST);
this.mc.mcProfiler.endStartSection("outline");
- var5.drawBlockBreaking(var17, this.mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1);
- var5.drawSelectionBox(var17, this.mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1);
+ if (!ForgeHooksClient.onBlockHighlight(var5, var17, mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1))
+ {
+ var5.drawBlockBreaking(var17, this.mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1);
+ var5.drawSelectionBox(var17, this.mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1);
+ }
GL11.glEnable(GL11.GL_ALPHA_TEST);
}
}
@@ -1099,8 +1114,11 @@
var17 = (EntityPlayer)var4;
GL11.glDisable(GL11.GL_ALPHA_TEST);
this.mc.mcProfiler.endStartSection("outline");
- var5.drawBlockBreaking(var17, this.mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1);
- var5.drawSelectionBox(var17, this.mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1);
+ if (!ForgeHooksClient.onBlockHighlight(var5, var17, mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1))
+ {
+ var5.drawBlockBreaking(var17, this.mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1);
+ var5.drawSelectionBox(var17, this.mc.objectMouseOver, 0, var17.inventory.getCurrentItem(), par1);
+ }
GL11.glEnable(GL11.GL_ALPHA_TEST);
}
@@ -1124,6 +1142,9 @@
this.setupFog(1, par1);
GL11.glPopMatrix();
}
+
+ this.mc.mcProfiler.endStartSection("fhooks");
+ ForgeHooksClient.onRenderWorldLast(var5, par1);
this.mc.mcProfiler.endStartSection("hand");

View file

@ -0,0 +1,109 @@
--- ../src_base/minecraft/net/minecraft/src/GuiAchievements.java
+++ ../src_work/minecraft/net/minecraft/src/GuiAchievements.java
@@ -1,7 +1,11 @@
package net.minecraft.src;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Random;
import net.minecraft.client.Minecraft;
+import net.minecraftforge.common.MinecraftForge;
+
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@@ -41,6 +45,10 @@
/** Whether the Mouse Button is down or not */
private int isMouseButtonDown = 0;
private StatFileWriter statFileWriter;
+
+ private int currentPage = -1;
+ private GuiSmallButton button;
+ private LinkedList<Achievement> minecraftAchievements = new LinkedList<Achievement>();
public GuiAchievements(StatFileWriter par1StatFileWriter)
{
@@ -49,6 +57,14 @@
short var3 = 141;
this.field_74117_m = this.guiMapX = this.field_74124_q = (double)(AchievementList.openInventory.displayColumn * 24 - var2 / 2 - 12);
this.field_74115_n = this.guiMapY = this.field_74123_r = (double)(AchievementList.openInventory.displayRow * 24 - var3 / 2);
+ minecraftAchievements.clear();
+ for (Object achievement : AchievementList.achievementList)
+ {
+ if (!MinecraftForge.isAchievementInPages((Achievement)achievement))
+ {
+ minecraftAchievements.add((Achievement)achievement);
+ }
+ }
}
/**
@@ -58,6 +74,7 @@
{
this.controlList.clear();
this.controlList.add(new GuiSmallButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, StatCollector.translateToLocal("gui.done")));
+ this.controlList.add(button = new GuiSmallButton(2, (width - achievementsPaneWidth) / 2 + 24, height / 2 + 74, 125, 20, getAchievementPageTitle(currentPage)));
}
/**
@@ -69,6 +86,16 @@
{
this.mc.displayGuiScreen((GuiScreen)null);
this.mc.setIngameFocus();
+ }
+
+ if (par1GuiButton.id == 2)
+ {
+ currentPage++;
+ if (currentPage >= MinecraftForge.getAchievementPages().size())
+ {
+ currentPage = -1;
+ }
+ button.displayString = getAchievementPageTitle(currentPage);
}
super.actionPerformed(par1GuiButton);
@@ -293,11 +320,12 @@
int var27;
int var30;
- for (var22 = 0; var22 < AchievementList.achievementList.size(); ++var22)
- {
- Achievement var33 = (Achievement)AchievementList.achievementList.get(var22);
-
- if (var33.parentAchievement != null)
+ List<Achievement> achievementList = (currentPage == -1 ? minecraftAchievements : MinecraftForge.getAchievementPage(currentPage).getAchievements());
+ for (var22 = 0; var22 < achievementList.size(); ++var22)
+ {
+ Achievement var33 = achievementList.get(var22);
+
+ if (var33.parentAchievement != null && achievementList.contains(var33.parentAchievement))
{
var24 = var33.displayColumn * 24 - var4 + 11 + var10;
var25 = var33.displayRow * 24 - var5 + 11 + var11;
@@ -331,9 +359,9 @@
int var42;
int var41;
- for (var24 = 0; var24 < AchievementList.achievementList.size(); ++var24)
- {
- Achievement var35 = (Achievement)AchievementList.achievementList.get(var24);
+ for (var24 = 0; var24 < achievementList.size(); ++var24)
+ {
+ Achievement var35 = achievementList.get(var24);
var26 = var35.displayColumn * 24 - var4;
var27 = var35.displayRow * 24 - var5;
@@ -457,4 +485,12 @@
{
return true;
}
+
+ /**
+ * FORGE: Gets the name for an achievement page by its index
+ */
+ public static String getAchievementPageTitle(int index)
+ {
+ return index == -1 ? "Minecraft" : MinecraftForge.getAchievementPage(index).getName();
+ }
}

View file

@ -0,0 +1,142 @@
--- ../src_base/minecraft/net/minecraft/src/GuiControls.java
+++ ../src_work/minecraft/net/minecraft/src/GuiControls.java
@@ -1,4 +1,6 @@
package net.minecraft.src;
+
+import net.minecraftforge.client.GuiControlsScrollPanel;
public class GuiControls extends GuiScreen
{
@@ -16,6 +18,8 @@
/** The ID of the button that has been pressed. */
private int buttonId = -1;
+ private GuiControlsScrollPanel scrollPane;
+
public GuiControls(GuiScreen par1GuiScreen, GameSettings par2GameSettings)
{
this.parentScreen = par1GuiScreen;
@@ -32,15 +36,12 @@
*/
public void initGui()
{
+ scrollPane = new GuiControlsScrollPanel(this, options, mc);
StringTranslate var1 = StringTranslate.getInstance();
int var2 = this.func_73907_g();
- for (int var3 = 0; var3 < this.options.keyBindings.length; ++var3)
- {
- this.controlList.add(new GuiSmallButton(var3, var2 + var3 % 2 * 160, this.height / 6 + 24 * (var3 >> 1), 70, 20, this.options.getOptionDisplayString(var3)));
- }
-
- this.controlList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, var1.translateKey("gui.done")));
+ this.controlList.add(new GuiButton(200, this.width / 2 - 100, this.height - 28, var1.translateKey("gui.done")));
+ scrollPane.registerScrollButtons(controlList, 7, 8);
this.screenTitle = var1.translateKey("controls.title");
}
@@ -49,19 +50,9 @@
*/
protected void actionPerformed(GuiButton par1GuiButton)
{
- for (int var2 = 0; var2 < this.options.keyBindings.length; ++var2)
- {
- ((GuiButton)this.controlList.get(var2)).displayString = this.options.getOptionDisplayString(var2);
- }
-
if (par1GuiButton.id == 200)
{
this.mc.displayGuiScreen(this.parentScreen);
- }
- else
- {
- this.buttonId = par1GuiButton.id;
- par1GuiButton.displayString = "> " + this.options.getOptionDisplayString(par1GuiButton.id) + " <";
}
}
@@ -70,17 +61,7 @@
*/
protected void mouseClicked(int par1, int par2, int par3)
{
- if (this.buttonId >= 0)
- {
- this.options.setKeyBinding(this.buttonId, -100 + par3);
- ((GuiButton)this.controlList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId);
- this.buttonId = -1;
- KeyBinding.resetKeyBindingArrayAndHash();
- }
- else
- {
- super.mouseClicked(par1, par2, par3);
- }
+ super.mouseClicked(par1, par2, par3);
}
/**
@@ -88,14 +69,7 @@
*/
protected void keyTyped(char par1, int par2)
{
- if (this.buttonId >= 0)
- {
- this.options.setKeyBinding(this.buttonId, par2);
- ((GuiButton)this.controlList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId);
- this.buttonId = -1;
- KeyBinding.resetKeyBindingArrayAndHash();
- }
- else
+ if (scrollPane.keyTyped(par1, par2))
{
super.keyTyped(par1, par2);
}
@@ -107,47 +81,8 @@
public void drawScreen(int par1, int par2, float par3)
{
this.drawDefaultBackground();
- this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 20, 16777215);
- int var4 = this.func_73907_g();
- int var5 = 0;
-
- while (var5 < this.options.keyBindings.length)
- {
- boolean var6 = false;
- int var7 = 0;
-
- while (true)
- {
- if (var7 < this.options.keyBindings.length)
- {
- if (var7 == var5 || this.options.keyBindings[var5].keyCode != this.options.keyBindings[var7].keyCode)
- {
- ++var7;
- continue;
- }
-
- var6 = true;
- }
-
- if (this.buttonId == var5)
- {
- ((GuiButton)this.controlList.get(var5)).displayString = "\u00a7f> \u00a7e??? \u00a7f<";
- }
- else if (var6)
- {
- ((GuiButton)this.controlList.get(var5)).displayString = "\u00a7c" + this.options.getOptionDisplayString(var5);
- }
- else
- {
- ((GuiButton)this.controlList.get(var5)).displayString = this.options.getOptionDisplayString(var5);
- }
-
- this.drawString(this.fontRenderer, this.options.getKeyBindingDescription(var5), var4 + var5 % 2 * 160 + 70 + 6, this.height / 6 + 24 * (var5 >> 1) + 7, -1);
- ++var5;
- break;
- }
- }
-
+ scrollPane.drawScreen(par1, par2, par3);
+ drawCenteredString(fontRenderer, screenTitle, width / 2, 4, 0xffffff);
super.drawScreen(par1, par2, par3);
}
}

View file

@ -1,10 +1,222 @@
--- ../src_base/minecraft/net/minecraft/src/Item.java
+++ ../src_work/minecraft/net/minecraft/src/Item.java
@@ -625,4 +625,16 @@
@@ -194,13 +194,16 @@
/** full name of item from language file */
private String itemName;
+ /** FORGE: To disable repair recipes. */
+ protected boolean canRepair = true;
+
protected Item(int par1)
{
this.shiftedIndex = 256 + par1;
if (itemsList[256 + par1] != null)
{
- System.out.println("CONFLICT @ " + par1);
+ System.out.println("CONFLICT @ " + par1 + " item slot already occupied by " + itemsList[256 + par1] + " while adding " + this);
}
itemsList[256 + par1] = this;
@@ -570,7 +573,7 @@
float var17 = MathHelper.sin(-var5 * 0.017453292F);
float var18 = var15 * var16;
float var20 = var14 * var16;
- double var21 = 5.0D;
+ double var21 = ModLoader.getMinecraftInstance().playerController.getBlockReachDistance();
Vec3 var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21);
return par1World.rayTraceBlocks_do_do(var13, var23, par3, !par3);
}
@@ -625,4 +628,201 @@
{
StatList.initStats();
}
+
+
+
+ /* =========================================================== FORGE START ===============================================================*/
+ public boolean isDefaultTexture = true;
+ private String currentTexture = "/gui/items.png";
+ /**
+ * Called when a new CreativeContainer is opened, populate the list
+ * with all of the items for this item you want a player in creative mode
+ * to have access to.
+ *
+ * @param itemList The list of items currently in the creative inventory
+ */
+ public void addCreativeItems(ArrayList itemList)
+ {
+ if (this.shiftedIndex != Item.potion.shiftedIndex && this.shiftedIndex != Item.monsterPlacer.shiftedIndex)
+ {
+ 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;
+ }
+
+ /**
+ * This is called when the item is used, before the block is activated.
+ * @param stack The Item Stack
+ * @param player The Player that used the item
+ * @param world The Current World
+ * @param X Target X Position
+ * @param Y Target Y Position
+ * @param Z Target Z Position
+ * @param side The side of the target hit
+ * @return Return true to prevent any further processing.
+ */
+ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int X, int Y, int Z, int side)
+ {
+ return false;
+ }
+
+ /**
+ * Metadata-sensitive version of getStrVsBlock
+ * @param itemstack The Item Stack
+ * @param block The block the item is trying to break
+ * @param metadata The items current metadata
+ * @return The damage strength
+ */
+ public float getStrVsBlock(ItemStack itemstack, Block block, int metadata)
+ {
+ return getStrVsBlock(itemstack, block);
+ }
+
+ /**
+ * Called by CraftingManager to determine if an item is reparable.
+ * @return True if reparable
+ */
+ public boolean isRepairable()
+ {
+ return canRepair && isDamageable();
+ }
+
+ /**
+ * Call to disable repair recipes.
+ * @return The current Item instance
+ */
+ public Item setNoRepair()
+ {
+ canRepair = false;
+ return this;
+ }
+
+ /**
+ * Called before a block is broken. Return true to prevent default block harvesting.
+ *
+ * Note: In SMP, this is called on both client and server sides!
+ *
+ * @param itemstack The current ItemStack
+ * @param X The X Position
+ * @param Y The X Position
+ * @param Z The X Position
+ * @param player The Player that is wielding the item
+ * @return True to prevent harvesting, false to continue as normal
+ */
+ public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player)
+ {
+ return false;
+ }
+
+ /**
+ * Called each tick while using an item.
+ * @param stack The Item being used
+ * @param player The Player using the item
+ * @param count The amount of time in tick the item has been used for continuously
+ */
+ public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count)
+ {
+ }
+
+ /**
+ * Called when the player Left Clicks (attacks) an entity.
+ * Processed before damage is done, if return value is true further processing is canceled
+ * and the entity is not attacked.
+ *
+ * @param stack The Item being used
+ * @param player The player that is attacking
+ * @param entity The entity being attacked
+ * @return True to cancel the rest of the interaction.
+ */
+ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
+ {
+ return false;
+ }
+
+ /**
+ * Player, Render pass, and item usage sensitive version of getIconIndex.
+ *
+ * @param stack The item stack to get the icon for. (Usually this, and usingItem will be the same if usingItem is not null)
+ * @param renderPass The pass to get the icon for, 0 is default.
+ * @param player The player holding the item
+ * @param usingItem The item the player is actively using. Can be null if not using anything.
+ * @param useRemaining The ticks remaining for the active item.
+ * @return The icon index
+ */
+ public int getIconIndex(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
+ {
+ /*
+ * Here is an example usage for Vanilla bows.
+ if (usingItem != null && usingItem.getItem().shiftedIndex == Item.bow.shiftedIndex)
+ {
+ int k = usingItem.getMaxItemUseDuration() - useRemaining;
+ if (k >= 18) return 133;
+ if (k > 13) return 117;
+ if (k > 0) return 101;
+ }
+ */
+ return getIconIndex(stack);
+ }
+
+ /**
+ * Returns the number of render passes/layers this item has.
+ * Usually equates to ItemRenderer.renderItem being called for this many passes.
+ * Does not get called unless requiresMultipleRenderPasses() is true;
+ *
+ * @param metadata The item's metadata
+ * @return The number of passes to run.
+ */
+ public int getRenderPasses(int metadata)
+ {
+ return requiresMultipleRenderPasses() ? 2 : 1;
+ }
+
+ /**
+ * Grabs the current texture file used for this block
+ */
+ public String getTextureFile()
+ {
+ if (this instanceof ItemBlock)
+ {
+ return Block.blocksList[((ItemBlock)this).getBlockID()].getTextureFile();
+ }
+ return currentTexture;
+ }
+
+ /**
+ * Sets the current texture file for this item, used when rendering.
+ * Default is "/gui/items.png"
+ *
+ * @param texture The texture file
+ */
+ public void setTextureFile(String texture)
+ {
+ currentTexture = texture;
+ isDefaultTexture = false;
+ }
+
+ /**
+ * ItemStack sensitive version of getContainerItem.
+ * Returns a full ItemStack instance of the result.

View file

@ -0,0 +1,100 @@
--- ../src_base/minecraft/net/minecraft/src/ItemRenderer.java
+++ ../src_work/minecraft/net/minecraft/src/ItemRenderer.java
@@ -3,6 +3,12 @@
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
+
+import net.minecraftforge.client.ForgeHooksClient;
+import net.minecraftforge.client.IItemRenderer;
+import net.minecraftforge.client.MinecraftForgeClient;
+import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*;
+import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*;
public class ItemRenderer
{
@@ -35,23 +41,21 @@
public void renderItem(EntityLiving par1EntityLiving, ItemStack par2ItemStack, int par3)
{
GL11.glPushMatrix();
- Block var4 = Block.blocksList[par2ItemStack.itemID];
-
- if (var4 != null && RenderBlocks.renderItemIn3d(var4.getRenderType()))
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(par2ItemStack, EQUIPPED);
+
+ if (customRenderer != null)
+ {
+ GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture(par2ItemStack.getItem().getTextureFile()));
+ ForgeHooksClient.renderEquippedItem(customRenderer, renderBlocksInstance, par1EntityLiving, par2ItemStack);
+ }
+ else if (par2ItemStack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType()))
{
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
this.renderBlocksInstance.renderBlockAsItem(var4, par2ItemStack.getItemDamage(), 1.0F);
}
else
{
- if (var4 != null)
- {
- GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
- }
- else
- {
- GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/items.png"));
- }
+ GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture(par2ItemStack.getItem().getTextureFile()));
Tessellator var5 = Tessellator.instance;
int var6 = par1EntityLiving.getItemIcon(par2ItemStack, par3);
@@ -250,8 +254,9 @@
Render var24;
RenderPlayer var26;
- if (var17 != null && var17.itemID == Item.map.shiftedIndex)
- {
+ if (var17 != null && var17.getItem() instanceof ItemMap)
+ {
+ IItemRenderer custom = MinecraftForgeClient.getItemRenderer(var17, FIRST_PERSON_MAP);
GL11.glPushMatrix();
var7 = 0.8F;
var20 = var3.getSwingProgress(par1);
@@ -317,8 +322,15 @@
var28.addVertexWithUV((double)(128 + var27), (double)(0 - var27), 0.0D, 1.0D, 0.0D);
var28.addVertexWithUV((double)(0 - var27), (double)(0 - var27), 0.0D, 0.0D, 0.0D);
var28.draw();
- MapData var16 = Item.map.getMapData(var17, this.mc.theWorld);
- this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.renderEngine, var16);
+ MapData var16 = ((ItemMap)var17.getItem()).getMapData(var17, this.mc.theWorld);
+ if (custom == null)
+ {
+ this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.renderEngine, var16);
+ }
+ else
+ {
+ custom.renderItem(FIRST_PERSON_MAP, var17, mc.thePlayer, mc.renderEngine, var16);
+ }
GL11.glPopMatrix();
}
else if (var17 != null)
@@ -419,12 +431,15 @@
if (var17.getItem().requiresMultipleRenderPasses())
{
this.renderItem(var3, var17, 0);
- int var25 = Item.itemsList[var17.itemID].getColorFromDamage(var17.getItemDamage(), 1);
- var13 = (float)(var25 >> 16 & 255) / 255.0F;
- var14 = (float)(var25 >> 8 & 255) / 255.0F;
- var15 = (float)(var25 & 255) / 255.0F;
- GL11.glColor4f(var6 * var13, var6 * var14, var6 * var15, 1.0F);
- this.renderItem(var3, var17, 1);
+ for (int x = 1; x < var17.getItem().getRenderPasses(var17.getItemDamage()); x++)
+ {
+ int var25 = Item.itemsList[var17.itemID].getColorFromDamage(var17.getItemDamage(), 1);
+ var13 = (float)(var25 >> 16 & 255) / 255.0F;
+ var14 = (float)(var25 >> 8 & 255) / 255.0F;
+ var15 = (float)(var25 & 255) / 255.0F;
+ GL11.glColor4f(var6 * var13, var6 * var14, var6 * var15, 1.0F);
+ this.renderItem(var3, var17, x);
+ }
}
else
{

View file

@ -1,15 +1,16 @@
--- ../src_base/minecraft/net/minecraft/src/NetClientHandler.java
+++ ../src_work/minecraft/net/minecraft/src/NetClientHandler.java
@@ -18,6 +18,8 @@
@@ -18,6 +18,9 @@
import java.util.Random;
import javax.crypto.SecretKey;
import net.minecraft.client.Minecraft;
+import net.minecraftforge.client.ForgeHooksClient;
+import net.minecraftforge.common.ForgeHooks;
+
import org.lwjgl.input.Keyboard;
public class NetClientHandler extends NetHandler
@@ -56,6 +58,8 @@
import cpw.mods.fml.common.LoaderException;
@@ -59,6 +62,8 @@
this.mc = par1Minecraft;
Socket var4 = new Socket(InetAddress.getByName(par2Str), par3);
this.netManager = new TcpConnection(var4, "Client", this);
@ -18,3 +19,64 @@
}
public NetClientHandler(Minecraft par1Minecraft, IntegratedServer par2IntegratedServer) throws IOException
@@ -159,6 +164,7 @@
this.currentServerMaxPlayers = par1Packet1Login.maxPlayers;
this.mc.playerController.setGameType(par1Packet1Login.gameType);
this.addToSendQueue(new Packet204ClientInfo(this.mc.gameSettings.language, this.mc.gameSettings.renderDistance, this.mc.gameSettings.chatVisibility, this.mc.gameSettings.chatColours, this.mc.gameSettings.difficulty));
+ ForgeHooksClient.onLogin(par1Packet1Login, this, netManager);
}
public void handlePickupSpawn(Packet21PickupSpawn par1Packet21PickupSpawn)
@@ -586,7 +592,7 @@
public void handleKickDisconnect(Packet255KickDisconnect par1Packet255KickDisconnect)
{
- this.netManager.networkShutdown("disconnect.kicked", new Object[0]);
+ this.netManager.networkShutdown("disconnect.kicked", par1Packet255KickDisconnect.reason);
this.field_72554_f = true;
this.mc.loadWorld((WorldClient)null);
this.mc.displayGuiScreen(new GuiDisconnected("disconnect.disconnected", "disconnect.genericReason", new Object[] {par1Packet255KickDisconnect.reason}));
@@ -650,7 +656,11 @@
public void handleChat(Packet3Chat par1Packet3Chat)
{
- this.mc.ingameGUI.func_73827_b().func_73765_a(par1Packet3Chat.message);
+ par1Packet3Chat.message = ForgeHooks.onClientChatRecv(par1Packet3Chat.message);
+ if (par1Packet3Chat.message != null)
+ {
+ this.mc.ingameGUI.func_73827_b().func_73765_a(par1Packet3Chat.message);
+ }
}
public void handleAnimation(Packet18Animation par1Packet18Animation)
@@ -1005,6 +1015,19 @@
{
((TileEntityMobSpawner)var2).readFromNBT(par1Packet132TileEntityData.customParam1);
}
+ else if (var2 != null)
+ {
+ var2.onDataPacket(netManager, par1Packet132TileEntityData);
+ }
+ else
+ {
+ /*Packet132TileEntityData pkt = par1Packet132TileEntityData;
+ ModLoader.getLogger().log(Level.WARNING, String.format(
+ "Received a TileEntityData packet for a location that did not have a TileEntity: (%d, %d, %d) %d: %d, %d, %d",
+ pkt.xPosition, pkt.yPosition, pkt.zPosition,
+ pkt.actionType,
+ pkt.customParam1, pkt.customParam2, pkt.customParam3));*/
+ }
}
}
@@ -1141,6 +1164,10 @@
if (par1Packet131MapData.itemID == Item.map.shiftedIndex)
{
ItemMap.getMPMapData(par1Packet131MapData.uniqueID, this.mc.theWorld).updateMPMapData(par1Packet131MapData.itemData);
+ }
+ else if (ForgeHooks.onItemDataPacket(netManager, par1Packet131MapData))
+ {
+ ;
}
else
{

View file

@ -0,0 +1,149 @@
--- ../src_base/minecraft/net/minecraft/src/RenderBlocks.java
+++ ../src_work/minecraft/net/minecraft/src/RenderBlocks.java
@@ -1,6 +1,8 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
+import static net.minecraftforge.common.Orientation.*;
+
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@@ -423,9 +425,8 @@
public boolean renderBlockBed(Block par1Block, int par2, int par3, int par4)
{
Tessellator var5 = Tessellator.instance;
- int var6 = this.blockAccess.getBlockMetadata(par2, par3, par4);
- int var7 = BlockBed.getDirection(var6);
- boolean var8 = BlockBed.isBlockHeadOfBed(var6);
+ int var7 = par1Block.getBedDirection(blockAccess, par2, par3, par4);
+ boolean var8 = par1Block.isBedFoot(blockAccess, par2, par3, par4);
float var9 = 0.5F;
float var10 = 1.0F;
float var11 = 0.8F;
@@ -1890,7 +1891,7 @@
double var30;
double var32;
- if (!this.blockAccess.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 - 1, par4))
+ if (!this.blockAccess.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 - 1, par4, UP))
{
float var36 = 0.2F;
float var19 = 0.0625F;
@@ -1910,7 +1911,7 @@
var9 = var20;
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2 - 1, par3, par4))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2 - 1, par3, par4, EAST))
{
var5.addVertexWithUV((double)((float)par2 + var36), (double)((float)par3 + var17 + var19), (double)(par4 + 1), var11, var13);
var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 1), var11, var15);
@@ -1922,7 +1923,7 @@
var5.addVertexWithUV((double)((float)par2 + var36), (double)((float)par3 + var17 + var19), (double)(par4 + 1), var11, var13);
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2 + 1, par3, par4))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2 + 1, par3, par4, WEST))
{
var5.addVertexWithUV((double)((float)(par2 + 1) - var36), (double)((float)par3 + var17 + var19), (double)(par4 + 0), var9, var13);
var5.addVertexWithUV((double)(par2 + 1 - 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 0), var9, var15);
@@ -1934,7 +1935,7 @@
var5.addVertexWithUV((double)((float)(par2 + 1) - var36), (double)((float)par3 + var17 + var19), (double)(par4 + 0), var9, var13);
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 - 1))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 - 1, SOUTH))
{
var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17 + var19), (double)((float)par4 + var36), var11, var13);
var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 0), var11, var15);
@@ -1946,7 +1947,7 @@
var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17 + var19), (double)((float)par4 + var36), var11, var13);
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 + 1))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 + 1, NORTH))
{
var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17 + var19), (double)((float)(par4 + 1) - var36), var9, var13);
var5.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 0) + var19), (double)(par4 + 1 - 0), var9, var15);
@@ -1958,7 +1959,7 @@
var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17 + var19), (double)((float)(par4 + 1) - var36), var9, var13);
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 + 1, par4))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 + 1, par4, DOWN))
{
var20 = (double)par2 + 0.5D + 0.5D;
var22 = (double)par2 + 0.5D - 0.5D;
@@ -4142,7 +4143,7 @@
var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 2);
this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, var27);
- if (fancyGrass && var27 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && fancyGrass && var27 == 3 && this.overrideBlockTexture < 0)
{
this.colorRedTopLeft *= par5;
this.colorRedBottomLeft *= par5;
@@ -4265,7 +4266,7 @@
var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 3);
this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 3));
- if (fancyGrass && var27 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && fancyGrass && var27 == 3 && this.overrideBlockTexture < 0)
{
this.colorRedTopLeft *= par5;
this.colorRedBottomLeft *= par5;
@@ -4388,7 +4389,7 @@
var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 4);
this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, var27);
- if (fancyGrass && var27 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && fancyGrass && var27 == 3 && this.overrideBlockTexture < 0)
{
this.colorRedTopLeft *= par5;
this.colorRedBottomLeft *= par5;
@@ -4511,7 +4512,7 @@
var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 5);
this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, var27);
- if (fancyGrass && var27 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && fancyGrass && var27 == 3 && this.overrideBlockTexture < 0)
{
this.colorRedTopLeft *= par5;
this.colorRedBottomLeft *= par5;
@@ -4623,7 +4624,7 @@
var28 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 2);
this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, var28);
- if (fancyGrass && var28 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && fancyGrass && var28 == 3 && this.overrideBlockTexture < 0)
{
var8.setColorOpaque_F(var18 * par5, var21 * par6, var24 * par7);
this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, 38);
@@ -4639,7 +4640,7 @@
var28 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 3);
this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, var28);
- if (fancyGrass && var28 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && fancyGrass && var28 == 3 && this.overrideBlockTexture < 0)
{
var8.setColorOpaque_F(var18 * par5, var21 * par6, var24 * par7);
this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, 38);
@@ -4655,7 +4656,7 @@
var28 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 4);
this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, var28);
- if (fancyGrass && var28 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && fancyGrass && var28 == 3 && this.overrideBlockTexture < 0)
{
var8.setColorOpaque_F(var19 * par5, var22 * par6, var25 * par7);
this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, 38);
@@ -4671,7 +4672,7 @@
var28 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 5);
this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, var28);
- if (fancyGrass && var28 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && fancyGrass && var28 == 3 && this.overrideBlockTexture < 0)
{
var8.setColorOpaque_F(var19 * par5, var22 * par6, var25 * par7);
this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, 38);

View file

@ -0,0 +1,127 @@
--- ../src_base/minecraft/net/minecraft/src/RenderItem.java
+++ ../src_work/minecraft/net/minecraft/src/RenderItem.java
@@ -2,6 +2,8 @@
import java.util.Random;
import net.minecraft.client.Minecraft;
+import net.minecraftforge.client.ForgeHooksClient;
+
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@@ -51,18 +53,21 @@
GL11.glTranslatef((float)par2, (float)par4 + var11, (float)par6);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- Block var14 = Block.blocksList[var10.itemID];
int var16;
float var19;
float var20;
float var24;
- if (var14 != null && RenderBlocks.renderItemIn3d(var14.getRenderType()))
+ if (ForgeHooksClient.renderEntityItem(par1EntityItem, var10, var11, var12, random, renderManager.renderEngine, renderBlocks))
+ {
+ ;
+ }
+ else if (var10.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.blocksList[var10.itemID].getRenderType()))
{
GL11.glRotatef(var12, 0.0F, 1.0F, 0.0F);
- this.loadTexture("/terrain.png");
+ this.loadTexture(Block.blocksList[var10.itemID].getTextureFile());
float var22 = 0.25F;
- var16 = var14.getRenderType();
+ var16 = Block.blocksList[var10.itemID].getRenderType();
if (var16 == 1 || var16 == 19 || var16 == 12 || var16 == 2)
{
@@ -84,7 +89,7 @@
}
var24 = 1.0F;
- this.renderBlocks.renderBlockAsItem(var14, var10.getItemDamage(), var24);
+ this.renderBlocks.renderBlockAsItem(Block.blocksList[var10.itemID], var10.getItemDamage(), var24);
GL11.glPopMatrix();
}
}
@@ -96,10 +101,11 @@
if (var10.getItem().requiresMultipleRenderPasses())
{
GL11.glScalef(0.5F, 0.5F, 0.5F);
- this.loadTexture("/gui/items.png");
-
- for (var15 = 0; var15 <= 1; ++var15)
+ this.loadTexture(Item.itemsList[var10.itemID].getTextureFile());
+
+ for (var15 = 0; var15 <= var10.getItem().getRenderPasses(var10.getItemDamage(); ++var15)
{
+ this.random.setSeed(187L); //Fixes Vanilla bug where layers would not render aligns properly.
var16 = var10.getItem().getIconFromDamageForRenderPass(var10.getItemDamage(), var15);
var17 = 1.0F;
@@ -120,14 +126,7 @@
GL11.glScalef(0.5F, 0.5F, 0.5F);
var15 = var10.getIconIndex();
- if (var14 != null)
- {
- this.loadTexture("/terrain.png");
- }
- else
- {
- this.loadTexture("/gui/items.png");
- }
+ this.loadTexture(var10.getItem().getTextureFile());
if (this.field_77024_a)
{
@@ -189,9 +188,9 @@
float var12;
float var16;
- if (par3 < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[par3].getRenderType()))
- {
- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/terrain.png"));
+ if (Item.itemsList[par3] instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.blocksList[par3].getRenderType()))
+ {
+ par2RenderEngine.bindTexture(par2RenderEngine.getTexture(Block.blocksList[par3].getTextureFile()));
Block var15 = Block.blocksList[par3];
GL11.glPushMatrix();
GL11.glTranslatef((float)(par6 - 2), (float)(par7 + 3), -3.0F + this.zLevel);
@@ -225,7 +224,7 @@
GL11.glDisable(GL11.GL_LIGHTING);
par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/gui/items.png"));
- for (var8 = 0; var8 <= 1; ++var8)
+ for (var8 = 0; var8 <= Item.itemsList[par3].getRenderPasses(par4); ++var8)
{
var9 = Item.itemsList[par3].getIconFromDamageForRenderPass(par4, var8);
int var10 = Item.itemsList[par3].getColorFromDamage(par4, var8);
@@ -247,14 +246,7 @@
{
GL11.glDisable(GL11.GL_LIGHTING);
- if (par3 < 256)
- {
- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/terrain.png"));
- }
- else
- {
- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/gui/items.png"));
- }
+ par2RenderEngine.bindTexture(par2RenderEngine.getTexture(Item.itemsList[par3].getTextureFile()));
var8 = Item.itemsList[par3].getColorFromDamage(par4, 0);
float var14 = (float)(var8 >> 16 & 255) / 255.0F;
@@ -281,7 +273,10 @@
{
if (par3ItemStack != null)
{
- this.drawItemIntoGui(par1FontRenderer, par2RenderEngine, par3ItemStack.itemID, par3ItemStack.getItemDamage(), par3ItemStack.getIconIndex(), par4, par5);
+ if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2RenderEngine, par3ItemStack, field_77024_a, zLevel, (float)par4, (float)par5))
+ {
+ this.drawItemIntoGui(par1FontRenderer, par2RenderEngine, par3ItemStack.itemID, par3ItemStack.getItemDamage(), par3ItemStack.getIconIndex(), par4, par5);
+ }
if (par3ItemStack != null && par3ItemStack.hasEffect())
{

View file

@ -0,0 +1,63 @@
--- ../src_base/minecraft/net/minecraft/src/RenderPlayer.java
+++ ../src_work/minecraft/net/minecraft/src/RenderPlayer.java
@@ -1,6 +1,12 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
+import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*;
+import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*;
+import net.minecraftforge.client.IItemRenderer;
+import net.minecraftforge.client.MinecraftForgeClient;
+import net.minecraftforge.client.ForgeHooksClient;
+
import org.lwjgl.opengl.GL11;
public class RenderPlayer extends RenderLiving
@@ -32,7 +38,7 @@
if (var5 instanceof ItemArmor)
{
ItemArmor var6 = (ItemArmor)var5;
- this.loadTexture("/armor/" + armorFilenamePrefix[var6.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png");
+ this.loadTexture(ForgeHooksClient.getArmorTexture(var4, "/armor/" + armorFilenamePrefix[var6.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png"));
ModelBiped var7 = par2 == 2 ? this.modelArmor : this.modelArmorChestplate;
var7.bipedHead.showModel = par2 == 0;
var7.bipedHeadwear.showModel = par2 == 0;
@@ -156,12 +162,14 @@
super.renderEquippedItems(par1EntityPlayer, par2);
ItemStack var3 = par1EntityPlayer.inventory.armorItemInSlot(3);
- if (var3 != null && var3.getItem().shiftedIndex < 256)
+ if (var3 != null && var3.getItem() instanceof ItemBlock)
{
GL11.glPushMatrix();
this.modelBipedMain.bipedHead.postRender(0.0625F);
-
- if (RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType()))
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var3, EQUIPPED);
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var3, BLOCK_3D));
+
+ if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType()))
{
float var4 = 0.625F;
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
@@ -263,7 +271,10 @@
var20 = var21.getItemUseAction();
}
- if (var21.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var21.itemID].getRenderType()))
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var21, EQUIPPED);
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var21, BLOCK_3D));
+
+ if (var21.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var21.itemID].getRenderType())))
{
var6 = 0.5F;
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
@@ -316,7 +327,7 @@
if (var21.getItem().requiresMultipleRenderPasses())
{
- for (int var25 = 0; var25 <= 1; ++var25)
+ for (int var25 = 0; var25 < var21.getItem().getRenderPasses(var21.getItemDamage()); ++var25)
{
int var24 = var21.getItem().getColorFromDamage(var21.getItemDamage(), var25);
float var26 = (float)(var24 >> 16 & 255) / 255.0F;

View file

@ -0,0 +1,80 @@
--- ../src_base/minecraft/net/minecraft/src/SoundManager.java
+++ ../src_work/minecraft/net/minecraft/src/SoundManager.java
@@ -2,6 +2,8 @@
import java.io.File;
import java.util.Random;
+
+import net.minecraftforge.client.ForgeHooksClient;
import paulscode.sound.SoundSystem;
import paulscode.sound.SoundSystemConfig;
import paulscode.sound.codecs.CodecJOrbis;
@@ -37,9 +39,11 @@
private Random rand = new Random();
private int ticksBeforeMusic;
+ public static int MUSIC_INTERVAL = 12000;
+
public SoundManager()
{
- this.ticksBeforeMusic = this.rand.nextInt(12000);
+ this.ticksBeforeMusic = this.rand.nextInt(MUSIC_INTERVAL);
}
/**
@@ -54,6 +58,8 @@
{
this.tryToSetLibraryAndCodecs();
}
+ ModCompatibilityClient.audioModLoad(this);
+ ForgeHooksClient.onLoadSoundSettings(this);
}
/**
@@ -73,6 +79,8 @@
SoundSystemConfig.setCodec("ogg", CodecJOrbis.class);
SoundSystemConfig.setCodec("mus", CodecMus.class);
SoundSystemConfig.setCodec("wav", CodecWav.class);
+ ModCompatibilityClient.audioModAddCodecs();
+ ForgeHooksClient.onSetupAudio(this);
sndSystem = new SoundSystem();
this.options.soundVolume = var1;
this.options.musicVolume = var2;
@@ -161,10 +169,12 @@
}
SoundPoolEntry var1 = this.soundPoolMusic.getRandomSound();
+ var1 = ModCompatibilityClient.audioModPickBackgroundMusic(this, var1);
+ var1 = ForgeHooksClient.onPlayBackgroundMusic(this, var1);
if (var1 != null)
{
- this.ticksBeforeMusic = this.rand.nextInt(12000) + 12000;
+ this.ticksBeforeMusic = this.rand.nextInt(MUSIC_INTERVAL) + MUSIC_INTERVAL;
sndSystem.backgroundMusic("BgMusic", var1.soundUrl, var1.soundName, false);
sndSystem.setVolume("BgMusic", this.options.musicVolume);
sndSystem.play("BgMusic");
@@ -214,6 +224,7 @@
if (par1Str != null)
{
SoundPoolEntry var8 = this.soundPoolStreaming.getRandomSoundFromSoundPool(par1Str);
+ var8 = ForgeHooksClient.onPlayStreaming(this, var8, par1Str, par2, par3, par4);
if (var8 != null && par5 > 0.0F)
{
@@ -239,6 +250,7 @@
if (loaded && this.options.soundVolume != 0.0F)
{
SoundPoolEntry var7 = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str);
+ var7 = ForgeHooksClient.onPlaySound(this, var7, par1Str, par2, par3, par4, par5, par6);
if (var7 != null && par5 > 0.0F)
{
@@ -274,6 +286,7 @@
if (loaded && this.options.soundVolume != 0.0F)
{
SoundPoolEntry var4 = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str);
+ var4 = ForgeHooksClient.onPlaySoundEffect(this, var4, par1Str, par2, par3);
if (var4 != null)
{

View file

@ -0,0 +1,109 @@
--- ../src_base/minecraft/net/minecraft/src/TileEntityFurnace.java
+++ ../src_work/minecraft/net/minecraft/src/TileEntityFurnace.java
@@ -1,6 +1,10 @@
package net.minecraft.src;
-public class TileEntityFurnace extends TileEntity implements IInventory
+import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.common.ISidedInventory;
+import net.minecraftforge.common.Orientation;
+
+public class TileEntityFurnace extends TileEntity implements IInventory, ISidedInventory
{
/**
* The ItemStacks that hold the items currently being used in the furnace
@@ -226,8 +230,7 @@
if (this.furnaceItemStacks[1].stackSize == 0)
{
- Item var3 = this.furnaceItemStacks[1].getItem().getContainerItem();
- this.furnaceItemStacks[1] = var3 != null ? new ItemStack(var3) : null;
+ this.furnaceItemStacks[1] = this.furnaceItemStacks[1].getItem().getContainerItemStack(furnaceItemStacks[1]);
}
}
}
@@ -273,8 +276,12 @@
}
else
{
- ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0].getItem().shiftedIndex);
- return var1 == null ? false : (this.furnaceItemStacks[2] == null ? true : (!this.furnaceItemStacks[2].isItemEqual(var1) ? false : (this.furnaceItemStacks[2].stackSize < this.getInventoryStackLimit() && this.furnaceItemStacks[2].stackSize < this.furnaceItemStacks[2].getMaxStackSize() ? true : this.furnaceItemStacks[2].stackSize < var1.getMaxStackSize())));
+ ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]);
+ if (var1 == null) return false;
+ if (this.furnaceItemStacks[2] == null) return true;
+ if (!this.furnaceItemStacks[2].isItemEqual(var1)) return false;
+ int result = furnaceItemStacks[2].stackSize + var1.stackSize;
+ return (result <= getInventoryStackLimit() && result <= var1.getMaxStackSize());
}
}
@@ -285,15 +292,15 @@
{
if (this.canSmelt())
{
- ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0].getItem().shiftedIndex);
+ ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]);
if (this.furnaceItemStacks[2] == null)
{
this.furnaceItemStacks[2] = var1.copy();
}
- else if (this.furnaceItemStacks[2].itemID == var1.itemID)
- {
- ++this.furnaceItemStacks[2].stackSize;
+ else if (this.furnaceItemStacks[2].isItemEqual(var1))
+ {
+ furnaceItemStacks[2].stackSize += var1.stackSize;
}
--this.furnaceItemStacks[0].stackSize;
@@ -320,7 +327,7 @@
int var1 = par0ItemStack.getItem().shiftedIndex;
Item var2 = par0ItemStack.getItem();
- if (var1 < 256 && Block.blocksList[var1] != null)
+ if (par0ItemStack.getItem() instanceof ItemBlock && Block.blocksList[var1] != null)
{
Block var3 = Block.blocksList[var1];
@@ -335,7 +342,20 @@
}
}
- return var2 instanceof ItemTool && ((ItemTool)var2).func_77861_e().equals("WOOD") ? 200 : (var2 instanceof ItemSword && ((ItemSword)var2).func_77825_f().equals("WOOD") ? 200 : (var2 instanceof ItemHoe && ((ItemHoe)var2).func_77842_f().equals("WOOD") ? 200 : (var1 == Item.stick.shiftedIndex ? 100 : (var1 == Item.coal.shiftedIndex ? 1600 : (var1 == Item.bucketLava.shiftedIndex ? 20000 : (var1 == Block.sapling.blockID ? 100 : (var1 == Item.blazeRod.shiftedIndex ? 2400 : 0)))))));
+ if (var2 instanceof ItemTool && ((ItemTool) var2).func_77861_e().equals("WOOD")) return 200;
+ if (var2 instanceof ItemSword && ((ItemSword)var2).func_77825_f().equals("WOOD")) return 200;
+ if (var2 instanceof ItemHoe && ((ItemHoe) var2).func_77842_f().equals("WOOD")) return 200;
+ if (var1 == Item.stick.shiftedIndex) return 100;
+ if (var1 == Item.coal.shiftedIndex) return 1600;
+ if (var1 == Item.bucketLava.shiftedIndex) return 20000;
+ if (var1 == Block.sapling.blockID) return 100;
+ if (var1 == Item.blazeRod.shiftedIndex) return 2400;
+ int ret = ForgeHooks.getItemBurnTime(par0ItemStack);
+ if (ret > 0)
+ {
+ return ret;
+ }
+ return 0;
}
}
@@ -358,4 +378,18 @@
public void openChest() {}
public void closeChest() {}
+
+ @Override
+ public int getStartInventorySide(Orientation side)
+ {
+ if (side == Orientation.DOWN) return 1;
+ if (side == Orientation.UP) return 0;
+ return 2;
+ }
+
+ @Override
+ public int getSizeInventorySide(Orientation side)
+ {
+ return 1;
+ }
}

View file

@ -1,6 +1,36 @@
--- ../src_base/minecraft/net/minecraft/src/WorldRenderer.java
+++ ../src_work/minecraft/net/minecraft/src/WorldRenderer.java
@@ -187,7 +187,7 @@
@@ -3,6 +3,9 @@
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
+
+import net.minecraftforge.client.ForgeHooksClient;
+
import org.lwjgl.opengl.GL11;
public class WorldRenderer
@@ -10,7 +13,7 @@
/** Reference to the World object. */
public World worldObj;
private int glRenderList = -1;
- private static Tessellator tessellator = Tessellator.instance;
+ //private static Tessellator tessellator = Tessellator.instance;
public static int chunksUpdated = 0;
public int posX;
public int posY;
@@ -179,15 +182,16 @@
GL11.glTranslatef(-8.0F, -8.0F, -8.0F);
GL11.glScalef(var19, var19, var19);
GL11.glTranslatef(8.0F, 8.0F, 8.0F);
- tessellator.startDrawingQuads();
- tessellator.setTranslation((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ));
+ ForgeHooksClient.beforeRenderPass(var11);
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setTranslation((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ));
}
Block var23 = Block.blocksList[var18];
if (var23 != null)
{
@ -9,3 +39,38 @@
{
TileEntity var20 = var9.getBlockTileEntity(var17, var15, var16);
@@ -199,14 +203,17 @@
int var24 = var23.getRenderBlockPass();
- if (var24 != var11)
+ if (var24 > var11)
{
var12 = true;
}
- else if (var24 == var11)
+ if (!ForgeHooksClient.canRenderInPass(var23, var11))
{
- var13 |= var10.renderBlockByRenderType(var23, var17, var15, var16);
+ continue;
}
+ ForgeHooksClient.beforeBlockRender(var23, var10);
+ var13 |= var10.renderBlockByRenderType(var23, var17, var15, var16);
+ ForgeHooksClient.afterBlockRender(var23, var10);
}
}
}
@@ -215,10 +222,11 @@
if (var14)
{
- this.bytesDrawn += tessellator.draw();
+ ForgeHooksClient.afterRenderPass(var11);
+ this.bytesDrawn += Tessellator.instance.draw();
GL11.glPopMatrix();
GL11.glEndList();
- tessellator.setTranslation(0.0D, 0.0D, 0.0D);
+ Tessellator.instance.setTranslation(0.0D, 0.0D, 0.0D);
}
else
{