More patches converted.
Refactored some of the events to be a better hiarachy.
This commit is contained in:
parent
80ad4be5b1
commit
31a908b754
55 changed files with 1616 additions and 584 deletions
|
@ -46,6 +46,19 @@ public class ForgeHooksClient
|
|||
public static TreeSet<TesKey> renderTextures = new TreeSet<TesKey>();
|
||||
public static Tessellator defaultTessellator = null;
|
||||
public static boolean inWorld = false;
|
||||
public static HashMap<TesKey, IRenderContextHandler> renderHandlers = new HashMap<TesKey, IRenderContextHandler>();
|
||||
public static IRenderContextHandler unbindContext = null;
|
||||
|
||||
protected static void registerRenderContextHandler(String texture, int subID, IRenderContextHandler handler)
|
||||
{
|
||||
Integer texID = textures.get(texture);
|
||||
if (texID == null)
|
||||
{
|
||||
texID = ModLoader.getMinecraftInstance().renderEngine.getTexture(texture);
|
||||
textures.put(texture, texID);
|
||||
}
|
||||
renderHandlers.put(new TesKey(texID, subID), handler);
|
||||
}
|
||||
|
||||
public static void bindTexture(String texture, int subID)
|
||||
{
|
||||
|
@ -57,11 +70,11 @@ public class ForgeHooksClient
|
|||
}
|
||||
if (!inWorld)
|
||||
{
|
||||
/*if (unbindContext != null)
|
||||
if (unbindContext != null)
|
||||
{
|
||||
unbindContext.afterRenderContext();
|
||||
unbindContext = null;
|
||||
}*/
|
||||
}
|
||||
if (Tessellator.instance.isDrawing)
|
||||
{
|
||||
int mode = Tessellator.instance.drawMode;
|
||||
|
@ -69,11 +82,11 @@ public class ForgeHooksClient
|
|||
Tessellator.instance.startDrawing(mode);
|
||||
}
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID);
|
||||
/*unbindContext = renderHandlers.get(new TesKey(texID, subID));
|
||||
unbindContext = renderHandlers.get(new TesKey(texID, subID));
|
||||
if (unbindContext != null)
|
||||
{
|
||||
unbindContext.beforeRenderContext();
|
||||
}*/
|
||||
}
|
||||
return;
|
||||
}
|
||||
bindTessellator(texID, subID);
|
||||
|
@ -91,11 +104,11 @@ public class ForgeHooksClient
|
|||
{
|
||||
int mode = Tessellator.instance.drawMode;
|
||||
Tessellator.instance.draw();
|
||||
/*if (unbindContext != null)
|
||||
if (unbindContext != null)
|
||||
{
|
||||
unbindContext.afterRenderContext();
|
||||
unbindContext = null;
|
||||
}*/
|
||||
}
|
||||
Tessellator.instance.startDrawing(mode);
|
||||
}
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, ModLoader.getMinecraftInstance().renderEngine.getTexture("/terrain.png"));
|
||||
|
@ -142,20 +155,20 @@ public class ForgeHooksClient
|
|||
inWorld = false;
|
||||
for (TesKey info : renderTextures)
|
||||
{
|
||||
//IRenderContextHandler handler = renderHandlers.get(info);
|
||||
IRenderContextHandler handler = renderHandlers.get(info);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, info.texture);
|
||||
Tessellator tess = tessellators.get(info);
|
||||
//if (handler == null)
|
||||
//{
|
||||
if (handler == null)
|
||||
{
|
||||
tess.draw();
|
||||
/*}
|
||||
}
|
||||
else
|
||||
{
|
||||
Tessellator.instance = tess;
|
||||
handler.beforeRenderContext();
|
||||
tess.draw();
|
||||
handler.afterRenderContext();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, ModLoader.getMinecraftInstance().renderEngine.getTexture("/terrain.png"));
|
||||
Tessellator.renderingWorldRenderer = false;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package net.minecraft.src.forge;
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import net.minecraft.src.EntityItem;
|
||||
import net.minecraft.src.EntityLiving;
|
|
@ -2,7 +2,7 @@
|
|||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
package net.minecraft.src.forge;
|
||||
package net.minecraftforge.client;
|
||||
|
||||
public interface IRenderContextHandler
|
||||
{
|
|
@ -3,7 +3,7 @@
|
|||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import org.lwjgl.opengl.Display;
|
||||
|
||||
|
@ -14,18 +14,10 @@ import net.minecraft.src.ItemStack;
|
|||
import net.minecraft.src.ModLoader;
|
||||
import net.minecraft.src.RenderBlocks;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.forge.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
|
||||
public class MinecraftForgeClient
|
||||
{
|
||||
/**
|
||||
* Registers a new block highlight handler.
|
||||
*/
|
||||
public static void registerHighlightHandler(IHighlightHandler handler)
|
||||
{
|
||||
ForgeHooksClient.highlightHandlers.add(handler);
|
||||
}
|
||||
|
||||
/** Register a new render context handler. A render context is a block
|
||||
* of rendering performed with similar OpenGL modes, for example,
|
||||
* texture name.
|
||||
|
@ -39,76 +31,9 @@ public class MinecraftForgeClient
|
|||
{
|
||||
ForgeHooksClient.registerRenderContextHandler(texture, subid, handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Texture Load Handler
|
||||
* @param handler The handler
|
||||
*/
|
||||
public static void registerTextureLoadHandler(ITextureLoadHandler handler)
|
||||
{
|
||||
ForgeHooksClient.textureLoadHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Render Last Handler
|
||||
* @param handler The handler
|
||||
*/
|
||||
public static void registerRenderLastHandler(IRenderWorldLastHandler handler)
|
||||
{
|
||||
ForgeHooksClient.renderWorldLastHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Sound Handler
|
||||
* @param handler The handler
|
||||
*/
|
||||
public static void registerSoundHandler(ISoundHandler handler)
|
||||
{
|
||||
ForgeHooksClient.soundHandlers.add(handler);
|
||||
checkMinecraftVersion("Minecraft Minecraft 1.2.5", "Interface check in registerSoundHandler, remove it Mods should be updated");
|
||||
try
|
||||
{
|
||||
if (handler.getClass().getDeclaredMethod("onPlaySoundAtEntity", Entity.class, String.class, float.class, float.class) != null)
|
||||
{
|
||||
ForgeHooksClient.soundHandlers2.add(handler);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (World.class.getName().contains("World"))
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Bind a texture. This is used to bind a texture file when
|
||||
* performing your own rendering, rather than using ITextureProvider.
|
||||
*
|
||||
* This variation is reserved for future expansion.
|
||||
*/
|
||||
public static void bindTexture(String texture, int subid)
|
||||
{
|
||||
ForgeHooksClient.bindTexture(texture, subid);
|
||||
}
|
||||
|
||||
/** Bind a texture. This is used to bind a texture file when
|
||||
* performing your own rendering, rather than using ITextureProvider.
|
||||
*/
|
||||
public static void bindTexture(String texture)
|
||||
{
|
||||
ForgeHooksClient.bindTexture(texture, 0);
|
||||
}
|
||||
|
||||
/** Unbind a texture. This binds the default texture, when you are
|
||||
* finished performing custom rendering.
|
||||
*/
|
||||
public static void unbindTexture()
|
||||
{
|
||||
ForgeHooksClient.unbindTexture();
|
||||
}
|
||||
|
||||
/** Preload a texture. Textures must be preloaded before the first
|
||||
/**
|
||||
* Preload a texture. Textures must be preloaded before the first
|
||||
* use, or they will cause visual anomalies.
|
||||
*/
|
||||
public static void preloadTexture(String texture)
|
||||
|
@ -118,14 +43,15 @@ public class MinecraftForgeClient
|
|||
|
||||
/** Render a block. Render a block which may have a custom texture.
|
||||
*/
|
||||
public static void renderBlock(RenderBlocks render, Block block, int X, int Y, int Z)
|
||||
public static void renderBlock(RenderBlocks render, Block block, int x, int y, int z)
|
||||
{
|
||||
ForgeHooksClient.beforeBlockRender(block, render);
|
||||
render.renderBlockByRenderType(block, X, Y, Z);
|
||||
render.renderBlockByRenderType(block, x, y, z);
|
||||
ForgeHooksClient.afterBlockRender(block, render);
|
||||
}
|
||||
|
||||
/** Get the current render pass.
|
||||
/**
|
||||
* Get the current render pass.
|
||||
*/
|
||||
public static int getRenderPass()
|
||||
{
|
||||
|
@ -134,7 +60,8 @@ public class MinecraftForgeClient
|
|||
|
||||
private static IItemRenderer[] customItemRenderers = new IItemRenderer[Item.itemsList.length];
|
||||
|
||||
/** Register a custom renderer for a specific item. This can be used to
|
||||
/**
|
||||
* Register a custom renderer for a specific item. This can be used to
|
||||
* render the item in-world as an EntityItem, when the item is equipped, or
|
||||
* when the item is in an inventory slot.
|
||||
* @param itemID The item ID (shifted index) to handle rendering.
|
|
@ -8,14 +8,21 @@ public avd.w # yOffset
|
|||
public avd.x # zOffset
|
||||
public-f avd.a # instance remove final
|
||||
public avd.z # isDrawing
|
||||
#ItemPickaxe
|
||||
# ItemPickaxe
|
||||
public+f rp.c # blocksEffectiveAgainst
|
||||
#ItemAxe
|
||||
# ItemAxe
|
||||
public+f re.c # blocksEffectiveAgainst
|
||||
#ItemSpade
|
||||
# ItemSpade
|
||||
public+f sa.c # blocksEffectiveAgainst
|
||||
#ItemTool
|
||||
# ItemTool
|
||||
public gs.a # efficiencyOnProperMaterial
|
||||
public gs.bY # damageVsEntity
|
||||
#EntityEnderman
|
||||
public no.d # EntityEnderman.carriableBlocks
|
||||
# EntityEnderman
|
||||
public no.d # carriableBlocks
|
||||
# RenderEngine
|
||||
public ave.k # texturePack
|
||||
# RenderGlobal
|
||||
public ava.h # theWorld
|
||||
public ava.i # renderEngine
|
||||
public ava.q # mc
|
||||
public ava.r # globalRenderBlocks
|
||||
|
|
|
@ -174,16 +174,6 @@ public class ForgeHooks
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
grassList.add(new GrassEntry(Block.plantYellow, 0, 20));
|
||||
grassList.add(new GrassEntry(Block.plantRed, 0, 10));
|
||||
seedList.add(new SeedEntry(new ItemStack(Item.seeds), 10));
|
||||
initTools();
|
||||
System.out.printf("MinecraftForge v%s Initialized\n", ForgeVersion.getVersion());
|
||||
ModLoader.getLogger().info(String.format("MinecraftForge v%s Initialized", ForgeVersion.getVersion()));
|
||||
}
|
||||
|
||||
public static String getTexture(String _default, Object obj)
|
||||
{
|
||||
|
@ -200,4 +190,32 @@ public class ForgeHooks
|
|||
return _default;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getTotalArmorValue(EntityPlayer player)
|
||||
{
|
||||
int ret = 0;
|
||||
for (int x = 0; x < player.inventory.armorInventory.length; x++)
|
||||
{
|
||||
ItemStack stack = player.inventory.armorInventory[x];
|
||||
if (stack != null && stack.getItem() instanceof ISpecialArmor)
|
||||
{
|
||||
ret += ((ISpecialArmor)stack.getItem()).getArmorDisplay(player, stack, x);
|
||||
}
|
||||
else if (stack != null && stack.getItem() instanceof ItemArmor)
|
||||
{
|
||||
ret += ((ItemArmor)stack.getItem()).damageReduceAmount;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
grassList.add(new GrassEntry(Block.plantYellow, 0, 20));
|
||||
grassList.add(new GrassEntry(Block.plantRed, 0, 10));
|
||||
seedList.add(new SeedEntry(new ItemStack(Item.seeds), 10));
|
||||
initTools();
|
||||
System.out.printf("MinecraftForge v%s Initialized\n", ForgeVersion.getVersion());
|
||||
ModLoader.getLogger().info(String.format("MinecraftForge v%s Initialized", ForgeVersion.getVersion()));
|
||||
}
|
||||
}
|
||||
|
|
319
common/net/minecraftforge/common/ISpecialArmor.java
Normal file
319
common/net/minecraftforge/common/ISpecialArmor.java
Normal file
|
@ -0,0 +1,319 @@
|
|||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.src.DamageSource;
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemArmor;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
/**
|
||||
* This interface is to be implemented by ItemArmor classes. It will allow to
|
||||
* modify computation of damage and health loss. Computation will be called
|
||||
* before the actual armor computation, which can then be cancelled.
|
||||
*
|
||||
* @see ItemArmor
|
||||
*/
|
||||
public interface ISpecialArmor
|
||||
{
|
||||
/**
|
||||
* Retrieves the modifiers to be used when calculating armor damage.
|
||||
*
|
||||
* Armor will higher priority will have damage applied to them before
|
||||
* lower priority ones. If there are multiple pieces of armor with the
|
||||
* same priority, damage will be distributed between them based on there
|
||||
* absorption ratio.
|
||||
*
|
||||
* @param entity The entity wearing the armor.
|
||||
* @param armor The ItemStack of the armor item itself.
|
||||
* @param source The source of the damage, which can be used to alter armor
|
||||
* properties based on the type or source of damage.
|
||||
* @param damage The total damage being applied to the entity
|
||||
* @param slot The armor slot the item is in.
|
||||
* @return A ArmorProperties instance holding information about how the armor effects damage.
|
||||
*/
|
||||
public ArmorProperties getProperties(EntityLiving player, ItemStack armor, DamageSource source, double damage, int slot);
|
||||
|
||||
/**
|
||||
* Get the displayed effective armor.
|
||||
*
|
||||
* @param player The player wearing the armor.
|
||||
* @param armor The ItemStack of the armor item itself.
|
||||
* @param slot The armor slot the item is in.
|
||||
* @return The number of armor points for display, 2 per shield.
|
||||
*/
|
||||
public abstract int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot);
|
||||
|
||||
/**
|
||||
* Applies damage to the ItemStack. The mod is responsible for reducing the
|
||||
* item durability and stack size. If the stack is depleted it will be cleaned
|
||||
* up automatically.
|
||||
*
|
||||
* @param entity The entity wearing the armor
|
||||
* @param armor The ItemStack of the armor item itself.
|
||||
* @param source The source of the damage, which can be used to alter armor
|
||||
* properties based on the type or source of damage.
|
||||
* @param damage The amount of damage being applied to the armor
|
||||
* @param slot The armor slot the item is in.
|
||||
*/
|
||||
public abstract void damageArmor(EntityLiving entity, ItemStack stack, DamageSource source, int damage, int slot);
|
||||
|
||||
public static class ArmorProperties implements Comparable<ArmorProperties>
|
||||
{
|
||||
public int Priority = 0;
|
||||
public int AbsorbMax = Integer.MAX_VALUE;
|
||||
public double AbsorbRatio = 0;
|
||||
public int Slot = 0;
|
||||
private static final boolean DEBUG = false; //Only enable this if you wish to be spamed with debugging information.
|
||||
//Left it in because I figured it'd be useful for modders developing custom armor.
|
||||
|
||||
public ArmorProperties(int priority, double ratio, int max)
|
||||
{
|
||||
Priority = priority;
|
||||
AbsorbRatio = ratio;
|
||||
AbsorbMax = max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gathers and applies armor reduction to damage being dealt to a entity.
|
||||
*
|
||||
* @param entity The Entity being damage
|
||||
* @param inventory An array of armor items
|
||||
* @param source The damage source type
|
||||
* @param damage The total damage being done
|
||||
* @return The left over damage that has not been absorbed by the armor
|
||||
*/
|
||||
public static int ApplyArmor(EntityLiving entity, ItemStack[] inventory, DamageSource source, double damage)
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.println("Start: " + damage + " " + (damage * 25));
|
||||
}
|
||||
damage *= 25;
|
||||
ArrayList<ArmorProperties> dmgVals = new ArrayList<ArmorProperties>();
|
||||
for (int x = 0; x < inventory.length; x++)
|
||||
{
|
||||
ItemStack stack = inventory[x];
|
||||
if (stack == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ArmorProperties prop = null;
|
||||
if (stack.getItem() instanceof ISpecialArmor)
|
||||
{
|
||||
ISpecialArmor armor = (ISpecialArmor)stack.getItem();
|
||||
prop = armor.getProperties(entity, stack, source, damage / 25D, x).copy();
|
||||
}
|
||||
else if (stack.getItem() instanceof ItemArmor && !source.isUnblockable())
|
||||
{
|
||||
ItemArmor armor = (ItemArmor)stack.getItem();
|
||||
prop = new ArmorProperties(0, armor.damageReduceAmount / 25D, armor.getMaxDamage() + 1 - stack.getItemDamage());
|
||||
}
|
||||
if (prop != null)
|
||||
{
|
||||
prop.Slot = x;
|
||||
dmgVals.add(prop);
|
||||
}
|
||||
}
|
||||
if (dmgVals.size() > 0)
|
||||
{
|
||||
ArmorProperties[] props = dmgVals.toArray(new ArmorProperties[0]);
|
||||
StandardizeList(props, damage);
|
||||
int level = props[0].Priority;
|
||||
double ratio = 0;
|
||||
for (ArmorProperties prop : props)
|
||||
{
|
||||
if (level != prop.Priority)
|
||||
{
|
||||
damage -= (damage * ratio);
|
||||
ratio = 0;
|
||||
level = prop.Priority;
|
||||
}
|
||||
ratio += prop.AbsorbRatio;
|
||||
|
||||
double absorb = damage * prop.AbsorbRatio;
|
||||
if (absorb > 0)
|
||||
{
|
||||
ItemStack stack = inventory[prop.Slot];
|
||||
int itemDamage = (int)(absorb / 25D < 1 ? 1 : absorb / 25D);
|
||||
if (stack.getItem() instanceof ISpecialArmor)
|
||||
{
|
||||
((ISpecialArmor)stack.getItem()).damageArmor(entity, stack, source, itemDamage, prop.Slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.println("Item: " + stack.toString() + " Absorbed: " + (absorb / 25D) + " Damaged: " + itemDamage);
|
||||
}
|
||||
stack.damageItem(itemDamage, entity);
|
||||
}
|
||||
if (stack.stackSize <= 0)
|
||||
{
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
stack.onItemDestroyedByUse((EntityPlayer)entity);
|
||||
}
|
||||
inventory[prop.Slot] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
damage -= (damage * ratio);
|
||||
}
|
||||
damage += entity.carryoverDamage;
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.println("Return: " + (int)(damage / 25D) + " " + damage);
|
||||
}
|
||||
entity.carryoverDamage = (int)damage % 25;
|
||||
return (int)(damage / 25D);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts and standardizes the distribution of damage over armor.
|
||||
*
|
||||
* @param armor The armor information
|
||||
* @param damage The total damage being received
|
||||
*/
|
||||
private static void StandardizeList(ArmorProperties[] armor, double damage)
|
||||
{
|
||||
Arrays.sort(armor);
|
||||
|
||||
int start = 0;
|
||||
double total = 0;
|
||||
int priority = armor[0].Priority;
|
||||
int pStart = 0;
|
||||
boolean pChange = false;
|
||||
boolean pFinished = false;
|
||||
|
||||
if (DEBUG)
|
||||
{
|
||||
for (ArmorProperties prop : armor)
|
||||
{
|
||||
System.out.println(prop);
|
||||
}
|
||||
System.out.println("========================");
|
||||
}
|
||||
|
||||
for (int x = 0; x < armor.length; x++)
|
||||
{
|
||||
total += armor[x].AbsorbRatio;
|
||||
if (x == armor.length - 1 || armor[x].Priority != priority)
|
||||
{
|
||||
if (armor[x].Priority != priority)
|
||||
{
|
||||
total -= armor[x].AbsorbRatio;
|
||||
x--;
|
||||
pChange = true;
|
||||
}
|
||||
if (total > 1)
|
||||
{
|
||||
for (int y = start; y <= x; y++)
|
||||
{
|
||||
double newRatio = armor[y].AbsorbRatio / total;
|
||||
if (newRatio * damage > armor[y].AbsorbMax)
|
||||
{
|
||||
armor[y].AbsorbRatio = (double)armor[y].AbsorbMax / damage;
|
||||
total = 0;
|
||||
for (int z = pStart; z <= y; z++)
|
||||
{
|
||||
total += armor[z].AbsorbRatio;
|
||||
}
|
||||
start = y + 1;
|
||||
x = y;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
armor[y].AbsorbRatio = newRatio;
|
||||
pFinished = true;
|
||||
}
|
||||
}
|
||||
if (pChange && pFinished)
|
||||
{
|
||||
damage -= (damage * total);
|
||||
total = 0;
|
||||
start = x + 1;
|
||||
priority = armor[start].Priority;
|
||||
pStart = start;
|
||||
pChange = false;
|
||||
pFinished = false;
|
||||
if (damage <= 0)
|
||||
{
|
||||
for (int y = x + 1; y < armor.length; y++)
|
||||
{
|
||||
armor[y].AbsorbRatio = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int y = start; y <= x; y++)
|
||||
{
|
||||
total -= armor[y].AbsorbRatio;
|
||||
if (damage * armor[y].AbsorbRatio > armor[y].AbsorbMax)
|
||||
{
|
||||
armor[y].AbsorbRatio = (double)armor[y].AbsorbMax / (double)damage;
|
||||
}
|
||||
total += armor[y].AbsorbRatio;
|
||||
}
|
||||
damage -= (damage * total);
|
||||
total = 0;
|
||||
if (x != armor.length - 1)
|
||||
{
|
||||
start = x + 1;
|
||||
priority = armor[start].Priority;
|
||||
pStart = start;
|
||||
pChange = false;
|
||||
if (damage <= 0)
|
||||
{
|
||||
for (int y = x + 1; y < armor.length; y++)
|
||||
{
|
||||
armor[y].AbsorbRatio = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (DEBUG)
|
||||
{
|
||||
for (ArmorProperties prop : armor)
|
||||
{
|
||||
System.out.println(prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int compareTo(ArmorProperties o)
|
||||
{
|
||||
if (o.Priority != Priority)
|
||||
{
|
||||
return o.Priority - Priority;
|
||||
}
|
||||
double left = ( AbsorbRatio == 0 ? 0 : AbsorbMax * 100.0D / AbsorbRatio);
|
||||
double right = (o.AbsorbRatio == 0 ? 0 : o.AbsorbMax * 100.0D / o.AbsorbRatio);
|
||||
return (int)(left - right);
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return String.format("%d, %d, %f, %d", Priority, AbsorbMax, AbsorbRatio, (AbsorbRatio == 0 ? 0 : (int)(AbsorbMax * 100.0D / AbsorbRatio)));
|
||||
}
|
||||
|
||||
public ArmorProperties copy()
|
||||
{
|
||||
return new ArmorProperties(Priority, AbsorbRatio, AbsorbMax);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.EntityItem;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
|
||||
public class EntityItemPickupEvent extends EntityEvent
|
||||
{
|
||||
private final EntityItem item;
|
||||
private final EntityPlayer player;
|
||||
|
||||
public EntityItemPickupEvent(EntityItem item, EntityPlayer player)
|
||||
{
|
||||
super(item);
|
||||
this.item = item;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public EntityItem getItem()
|
||||
{
|
||||
return item;
|
||||
}
|
||||
|
||||
public EntityPlayer getPlayer()
|
||||
{
|
||||
return player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
|
||||
public class PlayerEvent extends EntityEvent
|
||||
{
|
||||
private final EntityPlayer player;
|
||||
public PlayerEvent(EntityPlayer player)
|
||||
{
|
||||
super(player);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public EntityPlayer getPlayer()
|
||||
{
|
||||
return player;
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package net.minecraftforge.event.entity;
|
|||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
|
||||
public class UseHoeEvent extends PlayerEvent
|
||||
{
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
|
||||
public class LivingEvent extends EntityEvent
|
||||
{
|
||||
public final EntityLiving entityLiving;
|
||||
public LivingEvent(EntityLiving entity)
|
||||
{
|
||||
super(entity);
|
||||
entityLiving = entity;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraft.src.World;
|
||||
|
||||
public class LivingSpecialSpawnEvent extends LivingEvent
|
||||
{
|
||||
public final World world;
|
||||
public final float x;
|
||||
public final float y;
|
||||
public final float z;
|
||||
private boolean handeled = false;
|
||||
|
||||
public LivingSpecialSpawnEvent(EntityLiving entity, World world, float x, float y, float z)
|
||||
{
|
||||
super(entity);
|
||||
this.world = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public void setHandeled()
|
||||
{
|
||||
handeled = true;
|
||||
}
|
||||
|
||||
public boolean isHandeled()
|
||||
{
|
||||
return handeled;
|
||||
}
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
package net.minecraftforge.event.entity;
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
public class ArrowLooseEvent extends PlayerEvent
|
||||
{
|
||||
private final ItemStack bow;
|
||||
private int charge;
|
||||
public final ItemStack bow;
|
||||
public int charge;
|
||||
|
||||
public ArrowLooseEvent(EntityPlayer player, ItemStack bow, int charge)
|
||||
{
|
||||
|
@ -20,19 +20,4 @@ public class ArrowLooseEvent extends PlayerEvent
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack getBow()
|
||||
{
|
||||
return bow;
|
||||
}
|
||||
|
||||
public int getCharge()
|
||||
{
|
||||
return charge;
|
||||
}
|
||||
|
||||
public void setCharge(int charge)
|
||||
{
|
||||
this.charge = charge;
|
||||
}
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
package net.minecraftforge.event.entity;
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
public class ArrowNockEvent extends PlayerEvent
|
||||
{
|
||||
private ItemStack result;
|
||||
public ItemStack result;
|
||||
|
||||
public ArrowNockEvent(EntityPlayer player, ItemStack result)
|
||||
{
|
||||
|
@ -18,14 +18,4 @@ public class ArrowNockEvent extends PlayerEvent
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack getResultStack()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResultStack(ItemStack result)
|
||||
{
|
||||
this.result = result;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package net.minecraftforge.event.entity;
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.World;
|
|
@ -0,0 +1,22 @@
|
|||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.EntityItem;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
|
||||
public class EntityItemPickupEvent extends PlayerEvent
|
||||
{
|
||||
public final EntityItem item;
|
||||
|
||||
public EntityItemPickupEvent(EntityPlayer player, EntityItem item)
|
||||
{
|
||||
super(player);
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package net.minecraftforge.event.entity;
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
@ -7,11 +7,11 @@ import net.minecraft.src.World;
|
|||
|
||||
public class FillBucketEvent extends PlayerEvent
|
||||
{
|
||||
private final ItemStack current;
|
||||
private final World world;
|
||||
private final MovingObjectPosition target;
|
||||
public final ItemStack current;
|
||||
public final World world;
|
||||
public final MovingObjectPosition target;
|
||||
|
||||
private ItemStack result;
|
||||
public ItemStack result;
|
||||
private boolean handeled = false;
|
||||
|
||||
public FillBucketEvent(EntityPlayer player, ItemStack current, World world, MovingObjectPosition target)
|
||||
|
@ -28,21 +28,6 @@ public class FillBucketEvent extends PlayerEvent
|
|||
return true;
|
||||
}
|
||||
|
||||
public ItemStack getCurrentItem()
|
||||
{
|
||||
return current;
|
||||
}
|
||||
|
||||
public World getWorld()
|
||||
{
|
||||
return world;
|
||||
}
|
||||
|
||||
public MovingObjectPosition getTarget()
|
||||
{
|
||||
return target;
|
||||
}
|
||||
|
||||
public boolean isHandeled()
|
||||
{
|
||||
return handeled;
|
||||
|
@ -52,15 +37,4 @@ public class FillBucketEvent extends PlayerEvent
|
|||
{
|
||||
handeled = true;
|
||||
}
|
||||
|
||||
public ItemStack getResult()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(ItemStack result)
|
||||
{
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
|
||||
public class PlayerEvent extends LivingEvent
|
||||
{
|
||||
public final EntityPlayer entityPlayer;
|
||||
public PlayerEvent(EntityPlayer player)
|
||||
{
|
||||
super(player);
|
||||
entityPlayer = player;
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package net.minecraft.src.forge;
|
||||
|
||||
@Deprecated //Now consolidated into IITemRenderer
|
||||
public enum ItemRenderType
|
||||
{
|
||||
ENTITY, // Render type for in-world EntityItems
|
||||
EQUIPPED, // Render type for an item equipped in-hand
|
||||
INVENTORY; // Render type for items shown in a GUI inventory slot
|
||||
}
|
|
@ -1,267 +0,0 @@
|
|||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.src.DamageSource;
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemArmor;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
public class ArmorProperties implements Comparable<ArmorProperties>
|
||||
{
|
||||
public int Priority = 0;
|
||||
public int AbsorbMax = Integer.MAX_VALUE;
|
||||
public double AbsorbRatio = 0;
|
||||
public int Slot = 0;
|
||||
private static final boolean DEBUG = false; //Only enable this if you wish to be spamed with debugging information.
|
||||
//Left it in because I figured it'd be useful for modders developing custom armor.
|
||||
|
||||
public ArmorProperties(int priority, double ratio, int max)
|
||||
{
|
||||
Priority = priority;
|
||||
AbsorbRatio = ratio;
|
||||
AbsorbMax = max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gathers and applies armor reduction to damage being dealt to a entity.
|
||||
*
|
||||
* @param entity The Entity being damage
|
||||
* @param inventory An array of armor items
|
||||
* @param source The damage source type
|
||||
* @param damage The total damage being done
|
||||
* @return The left over damage that has not been absorbed by the armor
|
||||
*/
|
||||
public static int ApplyArmor(EntityLiving entity, ItemStack[] inventory, DamageSource source, double damage)
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.println("Start: " + damage + " " + (damage * 25));
|
||||
}
|
||||
damage *= 25;
|
||||
ArrayList<ArmorProperties> dmgVals = new ArrayList<ArmorProperties>();
|
||||
for (int x = 0; x < inventory.length; x++)
|
||||
{
|
||||
ItemStack stack = inventory[x];
|
||||
if (stack == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ArmorProperties prop = null;
|
||||
if (stack.getItem() instanceof ISpecialArmor)
|
||||
{
|
||||
ISpecialArmor armor = (ISpecialArmor)stack.getItem();
|
||||
prop = armor.getProperties(entity, stack, source, damage / 25D, x).copy();
|
||||
}
|
||||
else if (stack.getItem() instanceof ItemArmor && !source.isUnblockable())
|
||||
{
|
||||
ItemArmor armor = (ItemArmor)stack.getItem();
|
||||
prop = new ArmorProperties(0, armor.damageReduceAmount / 25D, armor.getMaxDamage() + 1 - stack.getItemDamage());
|
||||
}
|
||||
if (prop != null)
|
||||
{
|
||||
prop.Slot = x;
|
||||
dmgVals.add(prop);
|
||||
}
|
||||
}
|
||||
if (dmgVals.size() > 0)
|
||||
{
|
||||
ArmorProperties[] props = dmgVals.toArray(new ArmorProperties[0]);
|
||||
StandardizeList(props, damage);
|
||||
int level = props[0].Priority;
|
||||
double ratio = 0;
|
||||
for (ArmorProperties prop : props)
|
||||
{
|
||||
if (level != prop.Priority)
|
||||
{
|
||||
damage -= (damage * ratio);
|
||||
ratio = 0;
|
||||
level = prop.Priority;
|
||||
}
|
||||
ratio += prop.AbsorbRatio;
|
||||
|
||||
double absorb = damage * prop.AbsorbRatio;
|
||||
if (absorb > 0)
|
||||
{
|
||||
ItemStack stack = inventory[prop.Slot];
|
||||
int itemDamage = (int)(absorb / 25D < 1 ? 1 : absorb / 25D);
|
||||
if (stack.getItem() instanceof ISpecialArmor)
|
||||
{
|
||||
((ISpecialArmor)stack.getItem()).damageArmor(entity, stack, source, itemDamage, prop.Slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.println("Item: " + stack.toString() + " Absorbed: " + (absorb / 25D) + " Damaged: " + itemDamage);
|
||||
}
|
||||
stack.damageItem(itemDamage, entity);
|
||||
}
|
||||
if (stack.stackSize <= 0)
|
||||
{
|
||||
if (entity instanceof EntityPlayer)
|
||||
{
|
||||
stack.onItemDestroyedByUse((EntityPlayer)entity);
|
||||
}
|
||||
inventory[prop.Slot] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
damage -= (damage * ratio);
|
||||
}
|
||||
damage += entity.carryoverDamage;
|
||||
if (DEBUG)
|
||||
{
|
||||
System.out.println("Return: " + (int)(damage / 25D) + " " + damage);
|
||||
}
|
||||
entity.carryoverDamage = (int)damage % 25;
|
||||
return (int)(damage / 25D);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts and standardizes the distribution of damage over armor.
|
||||
*
|
||||
* @param armor The armor information
|
||||
* @param damage The total damage being received
|
||||
*/
|
||||
private static void StandardizeList(ArmorProperties[] armor, double damage)
|
||||
{
|
||||
Arrays.sort(armor);
|
||||
|
||||
int start = 0;
|
||||
double total = 0;
|
||||
int priority = armor[0].Priority;
|
||||
int pStart = 0;
|
||||
boolean pChange = false;
|
||||
boolean pFinished = false;
|
||||
|
||||
if (DEBUG)
|
||||
{
|
||||
for (ArmorProperties prop : armor)
|
||||
{
|
||||
System.out.println(prop);
|
||||
}
|
||||
System.out.println("========================");
|
||||
}
|
||||
|
||||
for (int x = 0; x < armor.length; x++)
|
||||
{
|
||||
total += armor[x].AbsorbRatio;
|
||||
if (x == armor.length - 1 || armor[x].Priority != priority)
|
||||
{
|
||||
if (armor[x].Priority != priority)
|
||||
{
|
||||
total -= armor[x].AbsorbRatio;
|
||||
x--;
|
||||
pChange = true;
|
||||
}
|
||||
if (total > 1)
|
||||
{
|
||||
for (int y = start; y <= x; y++)
|
||||
{
|
||||
double newRatio = armor[y].AbsorbRatio / total;
|
||||
if (newRatio * damage > armor[y].AbsorbMax)
|
||||
{
|
||||
armor[y].AbsorbRatio = (double)armor[y].AbsorbMax / damage;
|
||||
total = 0;
|
||||
for (int z = pStart; z <= y; z++)
|
||||
{
|
||||
total += armor[z].AbsorbRatio;
|
||||
}
|
||||
start = y + 1;
|
||||
x = y;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
armor[y].AbsorbRatio = newRatio;
|
||||
pFinished = true;
|
||||
}
|
||||
}
|
||||
if (pChange && pFinished)
|
||||
{
|
||||
damage -= (damage * total);
|
||||
total = 0;
|
||||
start = x + 1;
|
||||
priority = armor[start].Priority;
|
||||
pStart = start;
|
||||
pChange = false;
|
||||
pFinished = false;
|
||||
if (damage <= 0)
|
||||
{
|
||||
for (int y = x + 1; y < armor.length; y++)
|
||||
{
|
||||
armor[y].AbsorbRatio = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int y = start; y <= x; y++)
|
||||
{
|
||||
total -= armor[y].AbsorbRatio;
|
||||
if (damage * armor[y].AbsorbRatio > armor[y].AbsorbMax)
|
||||
{
|
||||
armor[y].AbsorbRatio = (double)armor[y].AbsorbMax / (double)damage;
|
||||
}
|
||||
total += armor[y].AbsorbRatio;
|
||||
}
|
||||
damage -= (damage * total);
|
||||
total = 0;
|
||||
if (x != armor.length - 1)
|
||||
{
|
||||
start = x + 1;
|
||||
priority = armor[start].Priority;
|
||||
pStart = start;
|
||||
pChange = false;
|
||||
if (damage <= 0)
|
||||
{
|
||||
for (int y = x + 1; y < armor.length; y++)
|
||||
{
|
||||
armor[y].AbsorbRatio = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (DEBUG)
|
||||
{
|
||||
for (ArmorProperties prop : armor)
|
||||
{
|
||||
System.out.println(prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int compareTo(ArmorProperties o)
|
||||
{
|
||||
if (o.Priority != Priority)
|
||||
{
|
||||
return o.Priority - Priority;
|
||||
}
|
||||
double left = ( AbsorbRatio == 0 ? 0 : AbsorbMax * 100.0D / AbsorbRatio);
|
||||
double right = (o.AbsorbRatio == 0 ? 0 : o.AbsorbMax * 100.0D / o.AbsorbRatio);
|
||||
return (int)(left - right);
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return String.format("%d, %d, %f, %d", Priority, AbsorbMax, AbsorbRatio, (AbsorbRatio == 0 ? 0 : (int)(AbsorbMax * 100.0D / AbsorbRatio)));
|
||||
}
|
||||
|
||||
public ArmorProperties copy()
|
||||
{
|
||||
return new ArmorProperties(Priority, AbsorbRatio, AbsorbMax);
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraft.src.forge;
|
||||
|
||||
import net.minecraft.src.DamageSource;
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemArmor;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
||||
/**
|
||||
* This interface is to be implemented by ItemArmor classes. It will allow to
|
||||
* modify computation of damage and health loss. Computation will be called
|
||||
* before the actual armor computation, which can then be cancelled.
|
||||
*
|
||||
* @see ItemArmor
|
||||
*/
|
||||
public interface ISpecialArmor
|
||||
{
|
||||
/**
|
||||
* Retrieves the modifiers to be used when calculating armor damage.
|
||||
*
|
||||
* Armor will higher priority will have damage applied to them before
|
||||
* lower priority ones. If there are multiple pieces of armor with the
|
||||
* same priority, damage will be distributed between them based on there
|
||||
* absorption ratio.
|
||||
*
|
||||
* @param entity The entity wearing the armor.
|
||||
* @param armor The ItemStack of the armor item itself.
|
||||
* @param source The source of the damage, which can be used to alter armor
|
||||
* properties based on the type or source of damage.
|
||||
* @param damage The total damage being applied to the entity
|
||||
* @param slot The armor slot the item is in.
|
||||
* @return A ArmorProperties instance holding information about how the armor effects damage.
|
||||
*/
|
||||
public ArmorProperties getProperties(EntityLiving player, ItemStack armor, DamageSource source, double damage, int slot);
|
||||
|
||||
/**
|
||||
* Get the displayed effective armor.
|
||||
*
|
||||
* @param player The player wearing the armor.
|
||||
* @param armor The ItemStack of the armor item itself.
|
||||
* @param slot The armor slot the item is in.
|
||||
* @return The number of armor points for display, 2 per shield.
|
||||
*/
|
||||
public abstract int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot);
|
||||
|
||||
/**
|
||||
* Applies damage to the ItemStack. The mod is responsible for reducing the
|
||||
* item durability and stack size. If the stack is depleted it will be cleaned
|
||||
* up automatically.
|
||||
*
|
||||
* @param entity The entity wearing the armor
|
||||
* @param armor The ItemStack of the armor item itself.
|
||||
* @param source The source of the damage, which can be used to alter armor
|
||||
* properties based on the type or source of damage.
|
||||
* @param damage The amount of damage being applied to the armor
|
||||
* @param slot The armor slot the item is in.
|
||||
*/
|
||||
public abstract void damageArmor(EntityLiving entity, ItemStack stack, DamageSource source, int damage, int slot);
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
import java.util.Iterator;
|
||||
+
|
||||
+import net.minecraftforge.common.MinecraftForge;
|
||||
+import net.minecraftforge.event.entity.EntityItemPickupEvent;
|
||||
+import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
|
||||
public class EntityItem extends Entity
|
||||
{
|
||||
|
@ -14,7 +14,7 @@
|
|||
{
|
||||
int var2 = this.item.stackSize;
|
||||
|
||||
+ EntityItemPickupEvent event = new EntityItemPickupEvent(this, par1EntityPlayer);
|
||||
+ EntityItemPickupEvent event = new EntityItemPickupEvent(par1EntityPlayer, this);
|
||||
+ MinecraftForge.EVENT_BUS.post(event);
|
||||
+
|
||||
+ if (delayBeforeCanPickup == 0 && (!event.isCanceled() || item.stackSize <= 0))
|
||||
|
|
77
patches/common/net/minecraft/src/EntityMooshroom.java.patch
Normal file
77
patches/common/net/minecraft/src/EntityMooshroom.java.patch
Normal file
|
@ -0,0 +1,77 @@
|
|||
--- ../src_base/common/net/minecraft/src/EntityMooshroom.java
|
||||
+++ ../src_work/common/net/minecraft/src/EntityMooshroom.java
|
||||
@@ -1,6 +1,10 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
-public class EntityMooshroom extends EntityCow
|
||||
+import java.util.ArrayList;
|
||||
+
|
||||
+import net.minecraftforge.common.IShearable;
|
||||
+
|
||||
+public class EntityMooshroom extends EntityCow implements IShearable
|
||||
{
|
||||
public EntityMooshroom(World par1World)
|
||||
{
|
||||
@@ -31,31 +35,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (var2 != null && var2.itemID == Item.shears.shiftedIndex && this.getGrowingAge() >= 0)
|
||||
- {
|
||||
- this.setDead();
|
||||
- this.worldObj.spawnParticle("largeexplode", this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D);
|
||||
-
|
||||
- if (!this.worldObj.isRemote)
|
||||
- {
|
||||
- EntityCow var3 = new EntityCow(this.worldObj);
|
||||
- var3.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
|
||||
- var3.setEntityHealth(this.getHealth());
|
||||
- var3.renderYawOffset = this.renderYawOffset;
|
||||
- this.worldObj.spawnEntityInWorld(var3);
|
||||
-
|
||||
- for (int var4 = 0; var4 < 5; ++var4)
|
||||
- {
|
||||
- this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY + (double)this.height, this.posZ, new ItemStack(Block.mushroomRed)));
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return true;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- return super.interact(par1EntityPlayer);
|
||||
- }
|
||||
+ return super.interact(par1EntityPlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,4 +45,29 @@
|
||||
{
|
||||
return new EntityMooshroom(this.worldObj);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isShearable(ItemStack item, World world, int X, int Y, int Z)
|
||||
+ {
|
||||
+ return getGrowingAge() >= 0;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ArrayList<ItemStack> onSheared(ItemStack item, World world, int X, int Y, int Z, int fortune)
|
||||
+ {
|
||||
+ setDead();
|
||||
+ EntityCow entitycow = new EntityCow(worldObj);
|
||||
+ entitycow.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
|
||||
+ entitycow.setEntityHealth(getHealth());
|
||||
+ entitycow.renderYawOffset = renderYawOffset;
|
||||
+ worldObj.spawnEntityInWorld(entitycow);
|
||||
+ worldObj.spawnParticle("largeexplode", posX, posY + (double)(height / 2.0F), posZ, 0.0D, 0.0D, 0.0D);
|
||||
+
|
||||
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
+ for (int x = 0; x < 5; x++)
|
||||
+ {
|
||||
+ ret.add(new ItemStack(Block.mushroomRed));
|
||||
+ }
|
||||
+ return ret;
|
||||
+ }
|
||||
}
|
62
patches/common/net/minecraft/src/FurnaceRecipes.java.patch
Normal file
62
patches/common/net/minecraft/src/FurnaceRecipes.java.patch
Normal file
|
@ -0,0 +1,62 @@
|
|||
--- ../src_base/common/net/minecraft/src/FurnaceRecipes.java
|
||||
+++ ../src_work/common/net/minecraft/src/FurnaceRecipes.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
+import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -10,6 +11,7 @@
|
||||
/** The list of smelting results. */
|
||||
private Map smeltingList = new HashMap();
|
||||
private Map field_77605_c = new HashMap();
|
||||
+ private Map metaSmeltingList = new HashMap();
|
||||
|
||||
/**
|
||||
* Used to call methods addSmelting and getSmeltingResult.
|
||||
@@ -50,7 +52,9 @@
|
||||
|
||||
/**
|
||||
* Returns the smelting result of an item.
|
||||
+ * Deprecated in favor of a metadata sensitive version
|
||||
*/
|
||||
+ @Deprecated
|
||||
public ItemStack getSmeltingResult(int par1)
|
||||
{
|
||||
return (ItemStack)this.smeltingList.get(Integer.valueOf(par1));
|
||||
@@ -65,4 +69,34 @@
|
||||
{
|
||||
return this.field_77605_c.containsKey(Integer.valueOf(par1)) ? ((Float)this.field_77605_c.get(Integer.valueOf(par1))).floatValue() : 0.0F;
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Add a metadata-sensitive furnace recipe
|
||||
+ * @param itemID The Item ID
|
||||
+ * @param metadata The Item Metadata
|
||||
+ * @param itemstack The ItemStack for the result
|
||||
+ */
|
||||
+ public void addSmelting(int itemID, int metadata, ItemStack itemstack)
|
||||
+ {
|
||||
+ metaSmeltingList.put(Arrays.asList(itemID, metadata), itemstack);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Used to get the resulting ItemStack form a source ItemStack
|
||||
+ * @param item The Source ItemStack
|
||||
+ * @return The result ItemStack
|
||||
+ */
|
||||
+ public ItemStack getSmeltingResult(ItemStack item)
|
||||
+ {
|
||||
+ if (item == null)
|
||||
+ {
|
||||
+ return null;
|
||||
+ }
|
||||
+ ItemStack ret = (ItemStack)metaSmeltingList.get(Arrays.asList(item.itemID, item.getItemDamage()));
|
||||
+ if (ret != null)
|
||||
+ {
|
||||
+ return ret;
|
||||
+ }
|
||||
+ return (ItemStack)smeltingList.get(Integer.valueOf(item.itemID));
|
||||
+ }
|
||||
}
|
|
@ -4,8 +4,8 @@
|
|||
package net.minecraft.src;
|
||||
+
|
||||
+import net.minecraftforge.common.MinecraftForge;
|
||||
+import net.minecraftforge.event.entity.ArrowLooseEvent;
|
||||
+import net.minecraftforge.event.entity.ArrowNockEvent;
|
||||
+import net.minecraftforge.event.entity.player.ArrowLooseEvent;
|
||||
+import net.minecraftforge.event.entity.player.ArrowNockEvent;
|
||||
|
||||
public class ItemBow extends Item
|
||||
{
|
||||
|
@ -21,7 +21,7 @@
|
|||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ var6 = event.getCharge();
|
||||
+ var6 = event.charge;
|
||||
+
|
||||
boolean var5 = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0;
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
|||
+ MinecraftForge.EVENT_BUS.post(event);
|
||||
+ if (event.isCanceled())
|
||||
+ {
|
||||
+ return event.getResultStack();
|
||||
+ return event.result;
|
||||
+ }
|
||||
+
|
||||
if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Item.arrow.shiftedIndex))
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
@@ -1,4 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
+
|
||||
+import net.minecraftforge.event.entity.FillBucketEvent;
|
||||
+import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
|
||||
public class ItemBucket extends Item
|
||||
{
|
||||
|
@ -19,7 +19,7 @@
|
|||
+
|
||||
+ if (event.isHandeled())
|
||||
+ {
|
||||
+ return event.getResult();
|
||||
+ return event.result;
|
||||
+ }
|
||||
+
|
||||
if (var12.typeOfHit == EnumMovingObjectType.TILE)
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
--- ../src_base/common/net/minecraft/src/SlotCrafting.java
|
||||
+++ ../src_work/common/net/minecraft/src/SlotCrafting.java
|
||||
@@ -107,6 +107,7 @@
|
||||
@@ -1,4 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
+
|
||||
+import net.minecraftforge.common.ForgeHooks;
|
||||
|
||||
public class SlotCrafting extends Slot
|
||||
{
|
||||
@@ -107,6 +109,7 @@
|
||||
*/
|
||||
public void onPickupFromSlot(ItemStack par1ItemStack)
|
||||
{
|
||||
|
@ -8,7 +15,7 @@
|
|||
this.onCrafting(par1ItemStack);
|
||||
|
||||
for (int var2 = 0; var2 < this.craftMatrix.getSizeInventory(); ++var2)
|
||||
@@ -119,7 +120,7 @@
|
||||
@@ -119,7 +122,7 @@
|
||||
|
||||
if (var3.getItem().hasContainerItem())
|
||||
{
|
||||
|
|
54
patches/common/net/minecraft/src/SpawnerAnimals.java.patch
Normal file
54
patches/common/net/minecraft/src/SpawnerAnimals.java.patch
Normal file
|
@ -0,0 +1,54 @@
|
|||
--- ../src_base/common/net/minecraft/src/SpawnerAnimals.java
|
||||
+++ ../src_work/common/net/minecraft/src/SpawnerAnimals.java
|
||||
@@ -1,9 +1,14 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
+
|
||||
+import net.minecraftforge.common.MinecraftForge;
|
||||
+import net.minecraftforge.event.entity.living.LivingSpecialSpawnEvent;
|
||||
|
||||
public final class SpawnerAnimals
|
||||
{
|
||||
@@ -79,6 +84,12 @@
|
||||
if ((!var34.getPeacefulCreature() || par2) && (var34.getPeacefulCreature() || par1) && par0WorldServer.countEntities(var34.getCreatureClass()) <= var34.getMaxNumberOfCreature() * eligibleChunksForSpawning.size() / 256)
|
||||
{
|
||||
Iterator var35 = eligibleChunksForSpawning.keySet().iterator();
|
||||
+ if (mod_MinecraftForge.SPAWNER_MAKE_MORE_RANDOM)
|
||||
+ {
|
||||
+ ArrayList<ChunkCoordIntPair> tmp = new ArrayList(eligibleChunksForSpawning.keySet());
|
||||
+ Collections.shuffle(tmp);
|
||||
+ var35 = tmp.iterator();
|
||||
+ }
|
||||
label108:
|
||||
|
||||
while (var35.hasNext())
|
||||
@@ -207,7 +218,8 @@
|
||||
else
|
||||
{
|
||||
int var5 = par1World.getBlockId(par2, par3 - 1, par4);
|
||||
- return var5 != Block.bedrock.blockID && !par1World.isBlockNormalCube(par2, par3, par4) && !par1World.getBlockMaterial(par2, par3, par4).isLiquid() && !par1World.isBlockNormalCube(par2, par3 + 1, par4);
|
||||
+ boolean spawnBlock = (Block.blocksList[var5] != null && Block.blocksList[var5].canCreatureSpawn(par0EnumCreatureType, par1World, par2, par3 - 1, par4));
|
||||
+ return spawnBlock && var5 != Block.bedrock.blockID && !par1World.isBlockNormalCube(par2, par3, par4) && !par1World.getBlockMaterial(par2, par3, par4).isLiquid() && !par1World.isBlockNormalCube(par2, par3 + 1, par4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,6 +228,13 @@
|
||||
*/
|
||||
private static void creatureSpecificInit(EntityLiving par0EntityLiving, World par1World, float par2, float par3, float par4)
|
||||
{
|
||||
+ LivingSpecialSpawnEvent event = new LivingSpecialSpawnEvent(par0EntityLiving, par1World, par2, par3, par4);
|
||||
+ MinecraftForge.EVENT_BUS.post(event);
|
||||
+ if (event.isHandeled())
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (par0EntityLiving instanceof EntitySpider && par1World.rand.nextInt(100) == 0)
|
||||
{
|
||||
EntitySkeleton var7 = new EntitySkeleton(par1World);
|
|
@ -0,0 +1,35 @@
|
|||
--- ../src_base/common/net/minecraft/src/WorldGenBigMushroom.java
|
||||
+++ ../src_work/common/net/minecraft/src/WorldGenBigMushroom.java
|
||||
@@ -54,7 +54,9 @@
|
||||
{
|
||||
var13 = par1World.getBlockId(var11, var9, var12);
|
||||
|
||||
- if (var13 != 0 && var13 != Block.leaves.blockID)
|
||||
+ Block block = Block.blocksList[var13];
|
||||
+
|
||||
+ if (var13 != 0 && block != null && !block.isLeaves(par1World, var11, var9, var12))
|
||||
{
|
||||
var8 = false;
|
||||
}
|
||||
@@ -181,7 +183,9 @@
|
||||
var15 = 0;
|
||||
}
|
||||
|
||||
- if ((var15 != 0 || par4 >= par4 + var7 - 1) && !Block.opaqueCubeLookup[par1World.getBlockId(var13, var11, var14)])
|
||||
+ Block block = Block.blocksList[par1World.getBlockId(var13, var11, var14)];
|
||||
+
|
||||
+ if ((var15 != 0 || par4 >= par4 + var7 - 1) && (block == null || block.canBeReplacedByLeaves(par1World, var13, var11, var14)))
|
||||
{
|
||||
this.setBlockAndMetadata(par1World, var13, var11, var14, Block.mushroomCapBrown.blockID + var6, var15);
|
||||
}
|
||||
@@ -193,7 +197,9 @@
|
||||
{
|
||||
var12 = par1World.getBlockId(par3, par4 + var11, par5);
|
||||
|
||||
- if (!Block.opaqueCubeLookup[var12])
|
||||
+ Block block = Block.blocksList[var12];
|
||||
+
|
||||
+ if (block == null || block.canBeReplacedByLeaves(par1World, par3, par4 + var11, par5))
|
||||
{
|
||||
this.setBlockAndMetadata(par1World, par3, par4 + var11, par5, Block.mushroomCapBrown.blockID + var6, 10);
|
||||
}
|
23
patches/common/net/minecraft/src/WorldGenDungeons.java.patch
Normal file
23
patches/common/net/minecraft/src/WorldGenDungeons.java.patch
Normal file
|
@ -0,0 +1,23 @@
|
|||
--- ../src_base/common/net/minecraft/src/WorldGenDungeons.java
|
||||
+++ ../src_work/common/net/minecraft/src/WorldGenDungeons.java
|
||||
@@ -1,6 +1,8 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.util.Random;
|
||||
+
|
||||
+import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class WorldGenDungeons extends WorldGenerator
|
||||
{
|
||||
@@ -117,9 +119,9 @@
|
||||
|
||||
if (var16 != null)
|
||||
{
|
||||
- for (int var17 = 0; var17 < 8; ++var17)
|
||||
+ for (int var17 = 0; var17 < MinecraftForge.getDungeonLootTries(); ++var17)
|
||||
{
|
||||
- ItemStack var18 = this.pickCheckLootItem(par2Random);
|
||||
+ ItemStack var18 = MinecraftForge.getRandomDungeonLoot(par2Random);
|
||||
|
||||
if (var18 != null)
|
||||
{
|
36
patches/common/net/minecraft/src/WorldGenForest.java.patch
Normal file
36
patches/common/net/minecraft/src/WorldGenForest.java.patch
Normal file
|
@ -0,0 +1,36 @@
|
|||
--- ../src_base/common/net/minecraft/src/WorldGenForest.java
|
||||
+++ ../src_work/common/net/minecraft/src/WorldGenForest.java
|
||||
@@ -43,7 +43,9 @@
|
||||
{
|
||||
var12 = par1World.getBlockId(var10, var8, var11);
|
||||
|
||||
- if (var12 != 0 && var12 != Block.leaves.blockID)
|
||||
+ Block block = Block.blocksList[var12];
|
||||
+
|
||||
+ if (var12 != 0 && (block != null && !block.isLeaves(par1World, var10, var8, var11)))
|
||||
{
|
||||
var7 = false;
|
||||
}
|
||||
@@ -82,7 +84,10 @@
|
||||
{
|
||||
int var15 = var14 - par5;
|
||||
|
||||
- if ((Math.abs(var13) != var11 || Math.abs(var15) != var11 || par2Random.nextInt(2) != 0 && var10 != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var12, var16, var14)])
|
||||
+ Block block = Block.blocksList[par1World.getBlockId(var12, var16, var14)];
|
||||
+
|
||||
+ if ((Math.abs(var13) != var11 || Math.abs(var15) != var11 || par2Random.nextInt(2) != 0 && var10 != 0) &&
|
||||
+ (block == null || block.canBeReplacedByLeaves(par1World, var12, var16, var14)))
|
||||
{
|
||||
this.setBlockAndMetadata(par1World, var12, var16, var14, Block.leaves.blockID, 2);
|
||||
}
|
||||
@@ -94,7 +99,9 @@
|
||||
{
|
||||
var10 = par1World.getBlockId(par3, par4 + var16, par5);
|
||||
|
||||
- if (var10 == 0 || var10 == Block.leaves.blockID)
|
||||
+ Block block = Block.blocksList[var10];
|
||||
+
|
||||
+ if (var10 == 0 || block == null || block.isLeaves(par1World, par3, par4 + var16, par5))
|
||||
{
|
||||
this.setBlockAndMetadata(par1World, par3, par4 + var16, par5, Block.wood.blockID, 2);
|
||||
}
|
36
patches/common/net/minecraft/src/WorldGenMinable.java.patch
Normal file
36
patches/common/net/minecraft/src/WorldGenMinable.java.patch
Normal file
|
@ -0,0 +1,36 @@
|
|||
--- ../src_base/common/net/minecraft/src/WorldGenMinable.java
|
||||
+++ ../src_work/common/net/minecraft/src/WorldGenMinable.java
|
||||
@@ -6,6 +6,7 @@
|
||||
{
|
||||
/** The block ID of the ore to be placed using this generator. */
|
||||
private int minableBlockId;
|
||||
+ private int minableBlockMeta = 0;
|
||||
|
||||
/** The number of blocks to generate. */
|
||||
private int numberOfBlocks;
|
||||
@@ -14,6 +15,12 @@
|
||||
{
|
||||
this.minableBlockId = par1;
|
||||
this.numberOfBlocks = par2;
|
||||
+ }
|
||||
+
|
||||
+ public WorldGenMinable(int id, int meta, int number)
|
||||
+ {
|
||||
+ this(id, number);
|
||||
+ minableBlockMeta = meta;
|
||||
}
|
||||
|
||||
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
|
||||
@@ -57,9 +64,10 @@
|
||||
{
|
||||
double var45 = ((double)var44 + 0.5D - var24) / (var28 / 2.0D);
|
||||
|
||||
- if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && par1World.getBlockId(var38, var41, var44) == Block.stone.blockID)
|
||||
+ Block block = Block.blocksList[par1World.getBlockId(var38, var41, var44)];
|
||||
+ if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && (block != null && block.isGenMineableReplaceable(par1World, var38, var41, var44)))
|
||||
{
|
||||
- par1World.setBlock(var38, var41, var44, this.minableBlockId);
|
||||
+ par1World.setBlockAndMetadata(var38, var41, var44, this.minableBlockId, minableBlockMeta);
|
||||
}
|
||||
}
|
||||
}
|
34
patches/common/net/minecraft/src/WorldGenShrub.java.patch
Normal file
34
patches/common/net/minecraft/src/WorldGenShrub.java.patch
Normal file
|
@ -0,0 +1,34 @@
|
|||
--- ../src_base/common/net/minecraft/src/WorldGenShrub.java
|
||||
+++ ../src_work/common/net/minecraft/src/WorldGenShrub.java
|
||||
@@ -17,10 +17,16 @@
|
||||
{
|
||||
int var15;
|
||||
|
||||
- for (boolean var6 = false; ((var15 = par1World.getBlockId(par3, par4, par5)) == 0 || var15 == Block.leaves.blockID) && par4 > 0; --par4)
|
||||
+ Block block = null;
|
||||
+ do
|
||||
{
|
||||
- ;
|
||||
- }
|
||||
+ block = Block.blocksList[par1World.getBlockId(par3, par4, par5)];
|
||||
+ if (block != null && !block.isLeaves(par1World, par3, par4, par5))
|
||||
+ {
|
||||
+ break;
|
||||
+ }
|
||||
+ par4--;
|
||||
+ } while (par4 > 0);
|
||||
|
||||
int var7 = par1World.getBlockId(par3, par4, par5);
|
||||
|
||||
@@ -42,7 +48,10 @@
|
||||
{
|
||||
int var14 = var13 - par5;
|
||||
|
||||
- if ((Math.abs(var12) != var10 || Math.abs(var14) != var10 || par2Random.nextInt(2) != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var11, var8, var13)])
|
||||
+ block = Block.blocksList[par1World.getBlockId(var11, var8, var13)];
|
||||
+
|
||||
+ if ((Math.abs(var12) != var10 || Math.abs(var14) != var10 || par2Random.nextInt(2) != 0) &&
|
||||
+ (block == null || block.canBeReplacedByLeaves(par1World, var11, var8, var13)))
|
||||
{
|
||||
this.setBlockAndMetadata(par1World, var11, var8, var13, Block.leaves.blockID, this.field_76527_a);
|
||||
}
|
44
patches/common/net/minecraft/src/WorldGenSwamp.java.patch
Normal file
44
patches/common/net/minecraft/src/WorldGenSwamp.java.patch
Normal file
|
@ -0,0 +1,44 @@
|
|||
--- ../src_base/common/net/minecraft/src/WorldGenSwamp.java
|
||||
+++ ../src_work/common/net/minecraft/src/WorldGenSwamp.java
|
||||
@@ -44,7 +44,7 @@
|
||||
{
|
||||
var12 = par1World.getBlockId(var10, var8, var11);
|
||||
|
||||
- if (var12 != 0 && var12 != Block.leaves.blockID)
|
||||
+ if (var12 != 0 && (Block.blocksList[var12] != null && !Block.blocksList[var12].isLeaves(par1World, var10, var8, var11)))
|
||||
{
|
||||
if (var12 != Block.waterStill.blockID && var12 != Block.waterMoving.blockID)
|
||||
{
|
||||
@@ -91,7 +91,10 @@
|
||||
{
|
||||
int var15 = var14 - par5;
|
||||
|
||||
- if ((Math.abs(var13) != var11 || Math.abs(var15) != var11 || par2Random.nextInt(2) != 0 && var10 != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var12, var16, var14)])
|
||||
+ Block block = Block.blocksList[par1World.getBlockId(var12, var16, var14)];
|
||||
+
|
||||
+ if ((Math.abs(var13) != var11 || Math.abs(var15) != var11 || par2Random.nextInt(2) != 0 && var10 != 0) &&
|
||||
+ (block == null || block.canBeReplacedByLeaves(par1World, var12, var16, var14)))
|
||||
{
|
||||
this.setBlock(par1World, var12, var16, var14, Block.leaves.blockID);
|
||||
}
|
||||
@@ -103,7 +106,9 @@
|
||||
{
|
||||
var10 = par1World.getBlockId(par3, par4 + var16, par5);
|
||||
|
||||
- if (var10 == 0 || var10 == Block.leaves.blockID || var10 == Block.waterMoving.blockID || var10 == Block.waterStill.blockID)
|
||||
+ Block block = Block.blocksList[var10];
|
||||
+
|
||||
+ if (var10 == 0 || (block != null && block.isLeaves(par1World, par3, par4 + var16, par5)) || var10 == Block.waterMoving.blockID || var10 == Block.waterStill.blockID)
|
||||
{
|
||||
this.setBlock(par1World, par3, par4 + var16, par5, Block.wood.blockID);
|
||||
}
|
||||
@@ -118,7 +123,8 @@
|
||||
{
|
||||
for (var13 = par5 - var11; var13 <= par5 + var11; ++var13)
|
||||
{
|
||||
- if (par1World.getBlockId(var12, var16, var13) == Block.leaves.blockID)
|
||||
+ Block block = Block.blocksList[par1World.getBlockId(var12, var16, var13)];
|
||||
+ if (block != null && block.isLeaves(par1World, var12, var16, var13))
|
||||
{
|
||||
if (par2Random.nextInt(4) == 0 && par1World.getBlockId(var12 - 1, var16, var13) == 0)
|
||||
{
|
36
patches/common/net/minecraft/src/WorldGenTaiga1.java.patch
Normal file
36
patches/common/net/minecraft/src/WorldGenTaiga1.java.patch
Normal file
|
@ -0,0 +1,36 @@
|
|||
--- ../src_base/common/net/minecraft/src/WorldGenTaiga1.java
|
||||
+++ ../src_work/common/net/minecraft/src/WorldGenTaiga1.java
|
||||
@@ -41,7 +41,9 @@
|
||||
{
|
||||
var15 = par1World.getBlockId(var13, var11, var14);
|
||||
|
||||
- if (var15 != 0 && var15 != Block.leaves.blockID)
|
||||
+ Block block = Block.blocksList[var15];
|
||||
+
|
||||
+ if (var15 != 0 && (block == null || !block.isLeaves(par1World, var13, var11, var14)))
|
||||
{
|
||||
var10 = false;
|
||||
}
|
||||
@@ -77,7 +79,10 @@
|
||||
{
|
||||
int var17 = var16 - par5;
|
||||
|
||||
- if ((Math.abs(var15) != var18 || Math.abs(var17) != var18 || var18 <= 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var14, var13, var16)])
|
||||
+ Block block = Block.blocksList[par1World.getBlockId(var14, var13, var16)];
|
||||
+
|
||||
+ if ((Math.abs(var15) != var18 || Math.abs(var17) != var18 || var18 <= 0) &&
|
||||
+ (block == null || block.canBeReplacedByLeaves(par1World, var14, var13, var16)))
|
||||
{
|
||||
this.setBlockAndMetadata(par1World, var14, var13, var16, Block.leaves.blockID, 1);
|
||||
}
|
||||
@@ -98,7 +103,9 @@
|
||||
{
|
||||
var14 = par1World.getBlockId(par3, par4 + var13, par5);
|
||||
|
||||
- if (var14 == 0 || var14 == Block.leaves.blockID)
|
||||
+ Block block = Block.blocksList[var14];
|
||||
+
|
||||
+ if (var14 == 0 || block == null || block.isLeaves(par1World, par3, par4 + var13, par5))
|
||||
{
|
||||
this.setBlockAndMetadata(par1World, par3, par4 + var13, par5, Block.wood.blockID, 1);
|
||||
}
|
36
patches/common/net/minecraft/src/WorldGenTaiga2.java.patch
Normal file
36
patches/common/net/minecraft/src/WorldGenTaiga2.java.patch
Normal file
|
@ -0,0 +1,36 @@
|
|||
--- ../src_base/common/net/minecraft/src/WorldGenTaiga2.java
|
||||
+++ ../src_work/common/net/minecraft/src/WorldGenTaiga2.java
|
||||
@@ -45,7 +45,9 @@
|
||||
{
|
||||
var15 = par1World.getBlockId(var13, var11, var14);
|
||||
|
||||
- if (var15 != 0 && var15 != Block.leaves.blockID)
|
||||
+ Block block = Block.blocksList[var15];
|
||||
+
|
||||
+ if (var15 != 0 && block != null && !block.isLeaves(par1World, var13, var11, var14))
|
||||
{
|
||||
var10 = false;
|
||||
}
|
||||
@@ -87,7 +89,10 @@
|
||||
{
|
||||
int var20 = var19 - par5;
|
||||
|
||||
- if ((Math.abs(var18) != var21 || Math.abs(var20) != var21 || var21 <= 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var17, var16, var19)])
|
||||
+ Block block = Block.blocksList[par1World.getBlockId(var17, var16, var19)];
|
||||
+
|
||||
+ if ((Math.abs(var18) != var21 || Math.abs(var20) != var21 || var21 <= 0) &&
|
||||
+ (block == null || block.canBeReplacedByLeaves(par1World, var17, var16, var19)))
|
||||
{
|
||||
this.setBlockAndMetadata(par1World, var17, var16, var19, Block.leaves.blockID, 1);
|
||||
}
|
||||
@@ -117,7 +122,9 @@
|
||||
{
|
||||
var17 = par1World.getBlockId(par3, par4 + var16, par5);
|
||||
|
||||
- if (var17 == 0 || var17 == Block.leaves.blockID)
|
||||
+ Block block = Block.blocksList[var17];
|
||||
+
|
||||
+ if (var17 == 0 || block == null || block.isLeaves(par1World, par3, par4 + var16, par5))
|
||||
{
|
||||
this.setBlockAndMetadata(par1World, par3, par4 + var16, par5, Block.wood.blockID, 1);
|
||||
}
|
50
patches/common/net/minecraft/src/WorldGenTrees.java.patch
Normal file
50
patches/common/net/minecraft/src/WorldGenTrees.java.patch
Normal file
|
@ -0,0 +1,50 @@
|
|||
--- ../src_base/common/net/minecraft/src/WorldGenTrees.java
|
||||
+++ ../src_work/common/net/minecraft/src/WorldGenTrees.java
|
||||
@@ -64,7 +64,13 @@
|
||||
{
|
||||
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)
|
||||
+ Block block = Block.blocksList[var12];
|
||||
+
|
||||
+ if (var12 != 0 &&
|
||||
+ !block.isLeaves(par1World, var10, var8, var11) &&
|
||||
+ var12 != Block.grass.blockID &&
|
||||
+ var12 != Block.dirt.blockID &&
|
||||
+ !block.isWood(par1World, var10, var8, var11))
|
||||
{
|
||||
var7 = false;
|
||||
}
|
||||
@@ -107,7 +113,10 @@
|
||||
{
|
||||
int var17 = var16 - par5;
|
||||
|
||||
- if ((Math.abs(var15) != var13 || Math.abs(var17) != var13 || par2Random.nextInt(2) != 0 && var12 != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var14, var11, var16)])
|
||||
+ Block block = Block.blocksList[par1World.getBlockId(var14, var11, var16)];
|
||||
+
|
||||
+ if ((Math.abs(var15) != var13 || Math.abs(var17) != var13 || par2Random.nextInt(2) != 0 && var12 != 0) &&
|
||||
+ (block == null || block.canBeReplacedByLeaves(par1World, var14, var11, var16)))
|
||||
{
|
||||
this.setBlockAndMetadata(par1World, var14, var11, var16, Block.leaves.blockID, this.metaLeaves);
|
||||
}
|
||||
@@ -119,7 +128,9 @@
|
||||
{
|
||||
var12 = par1World.getBlockId(par3, par4 + var11, par5);
|
||||
|
||||
- if (var12 == 0 || var12 == Block.leaves.blockID)
|
||||
+ Block block = Block.blocksList[var12];
|
||||
+
|
||||
+ if (var12 == 0 || block == null || block.isLeaves(par1World, par3, par4 + var11, par5))
|
||||
{
|
||||
this.setBlockAndMetadata(par1World, par3, par4 + var11, par5, Block.wood.blockID, this.metaWood);
|
||||
|
||||
@@ -159,7 +170,8 @@
|
||||
{
|
||||
for (var15 = par5 - var13; var15 <= par5 + var13; ++var15)
|
||||
{
|
||||
- if (par1World.getBlockId(var14, var11, var15) == Block.leaves.blockID)
|
||||
+ Block block = Block.blocksList[par1World.getBlockId(var14, var11, var15)];
|
||||
+ if (block != null && block.isLeaves(par1World, var14, var11, var15))
|
||||
{
|
||||
if (par2Random.nextInt(4) == 0 && par1World.getBlockId(var14 - 1, var11, var15) == 0)
|
||||
{
|
96
patches/minecraft/net/minecraft/src/Entity.java.patch
Normal file
96
patches/minecraft/net/minecraft/src/Entity.java.patch
Normal file
|
@ -0,0 +1,96 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/Entity.java
|
||||
+++ ../src_work/minecraft/net/minecraft/src/Entity.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
+import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -180,6 +181,11 @@
|
||||
public boolean isAirBorne;
|
||||
public EnumEntitySize myEntitySize;
|
||||
|
||||
+ /** Forge: Used to store custom data for each entity. */
|
||||
+ private NBTTagCompound customEntityData;
|
||||
+ protected boolean captureDrops = false;
|
||||
+ protected ArrayList<EntityItem> capturedDrops = new ArrayList<EntityItem>();
|
||||
+
|
||||
public Entity(World par1World)
|
||||
{
|
||||
this.entityId = nextEntityID++;
|
||||
@@ -1364,6 +1370,10 @@
|
||||
par1NBTTagCompound.setShort("Fire", (short)this.fire);
|
||||
par1NBTTagCompound.setShort("Air", (short)this.getAir());
|
||||
par1NBTTagCompound.setBoolean("OnGround", this.onGround);
|
||||
+ if (customEntityData != null)
|
||||
+ {
|
||||
+ par1NBTTagCompound.setCompoundTag("ForgeData", customEntityData);
|
||||
+ }
|
||||
this.writeEntityToNBT(par1NBTTagCompound);
|
||||
}
|
||||
|
||||
@@ -1405,6 +1415,10 @@
|
||||
this.onGround = par1NBTTagCompound.getBoolean("OnGround");
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
this.setRotation(this.rotationYaw, this.rotationPitch);
|
||||
+ if (par1NBTTagCompound.hasKey("ForgeData"))
|
||||
+ {
|
||||
+ customEntityData = par1NBTTagCompound.getCompoundTag("ForgeData");
|
||||
+ }
|
||||
this.readEntityFromNBT(par1NBTTagCompound);
|
||||
}
|
||||
|
||||
@@ -1490,7 +1504,14 @@
|
||||
{
|
||||
EntityItem var3 = new EntityItem(this.worldObj, this.posX, this.posY + (double)par2, this.posZ, par1ItemStack);
|
||||
var3.delayBeforeCanPickup = 10;
|
||||
- this.worldObj.spawnEntityInWorld(var3);
|
||||
+ if (captureDrops)
|
||||
+ {
|
||||
+ capturedDrops.add(var3);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ this.worldObj.spawnEntityInWorld(var3);
|
||||
+ }
|
||||
return var3;
|
||||
}
|
||||
|
||||
@@ -1813,7 +1834,7 @@
|
||||
*/
|
||||
public boolean isRiding()
|
||||
{
|
||||
- return this.ridingEntity != null || this.getFlag(2);
|
||||
+ return (this.ridingEntity != null && ridingEntity.shouldRiderSit()) || this.getFlag(2);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2074,4 +2095,27 @@
|
||||
{
|
||||
return String.format("%s[\'%s\'/%d, l=\'%s\', x=%.2f, y=%.2f, z=%.2f]", new Object[] {this.getClass().getSimpleName(), this.getEntityName(), Integer.valueOf(this.entityId), this.worldObj == null ? "~NULL~" : this.worldObj.getWorldInfo().getWorldName(), Double.valueOf(this.posX), Double.valueOf(this.posY), Double.valueOf(this.posZ)});
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a NBTTagCompound that can be used to store custom data for this entity.
|
||||
+ * It will be written, and read from disc, so it persists over world saves.
|
||||
+ * @return A NBTTagCompound
|
||||
+ */
|
||||
+ public NBTTagCompound getEntityData()
|
||||
+ {
|
||||
+ if (customEntityData == null)
|
||||
+ {
|
||||
+ customEntityData = new NBTTagCompound();
|
||||
+ }
|
||||
+ return customEntityData;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position.
|
||||
+ * @return false to prevent an entity that is mounted to this entity from displaying the 'sitting' animation.
|
||||
+ */
|
||||
+ public boolean shouldRiderSit()
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
}
|
|
@ -34,11 +34,13 @@
|
|||
{
|
||||
var2 += (float)(var3 * var3 + 1);
|
||||
}
|
||||
@@ -1056,6 +1066,7 @@
|
||||
@@ -1055,7 +1065,9 @@
|
||||
*/
|
||||
public void destroyCurrentEquippedItem()
|
||||
{
|
||||
+ ItemStack oldItem = getCurrentEquippedItem();
|
||||
this.inventory.setInventorySlotContents(this.inventory.currentItem, (ItemStack)null);
|
||||
+ ForgeHooks.onDestroyCurrentItem(par1EntityPlayer, var5);
|
||||
+ ForgeHooks.onDestroyCurrentItem(this, oldItem);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
67
patches/minecraft/net/minecraft/src/EntitySheep.java.patch
Normal file
67
patches/minecraft/net/minecraft/src/EntitySheep.java.patch
Normal file
|
@ -0,0 +1,67 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/EntitySheep.java
|
||||
+++ ../src_work/minecraft/net/minecraft/src/EntitySheep.java
|
||||
@@ -1,8 +1,11 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
+import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
-public class EntitySheep extends EntityAnimal
|
||||
+import net.minecraftforge.common.IShearable;
|
||||
+
|
||||
+public class EntitySheep extends EntityAnimal implements IShearable
|
||||
{
|
||||
/**
|
||||
* Holds the RGB table of the sheep colors - in OpenGL glColor3f values - used to render the sheep colored fleece.
|
||||
@@ -129,27 +132,6 @@
|
||||
*/
|
||||
public boolean interact(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
- ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem();
|
||||
-
|
||||
- if (var2 != null && var2.itemID == Item.shears.shiftedIndex && !this.getSheared() && !this.isChild())
|
||||
- {
|
||||
- if (!this.worldObj.isRemote)
|
||||
- {
|
||||
- this.setSheared(true);
|
||||
- int var3 = 1 + this.rand.nextInt(3);
|
||||
-
|
||||
- for (int var4 = 0; var4 < var3; ++var4)
|
||||
- {
|
||||
- EntityItem var5 = this.entityDropItem(new ItemStack(Block.cloth.blockID, 1, this.getFleeceColor()), 1.0F);
|
||||
- var5.motionY += (double)(this.rand.nextFloat() * 0.05F);
|
||||
- var5.motionX += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F);
|
||||
- var5.motionZ += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- var2.damageItem(1, par1EntityPlayer);
|
||||
- }
|
||||
-
|
||||
return super.interact(par1EntityPlayer);
|
||||
}
|
||||
|
||||
@@ -282,4 +264,23 @@
|
||||
this.setGrowingAge(var1);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isShearable(ItemStack item, World world, int X, int Y, int Z)
|
||||
+ {
|
||||
+ return !getSheared() && !isChild();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ArrayList<ItemStack> onSheared(ItemStack item, World world, int X, int Y, int Z, int fortune)
|
||||
+ {
|
||||
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
+ setSheared(true);
|
||||
+ int i = 1 + rand.nextInt(3);
|
||||
+ for (int j = 0; j < i; j++)
|
||||
+ {
|
||||
+ ret.add(new ItemStack(Block.cloth.blockID, 1, getFleeceColor()));
|
||||
+ }
|
||||
+ return ret;
|
||||
+ }
|
||||
}
|
20
patches/minecraft/net/minecraft/src/GuiIngame.java.patch
Normal file
20
patches/minecraft/net/minecraft/src/GuiIngame.java.patch
Normal file
|
@ -0,0 +1,20 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/GuiIngame.java
|
||||
+++ ../src_work/minecraft/net/minecraft/src/GuiIngame.java
|
||||
@@ -4,6 +4,8 @@
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import net.minecraft.client.Minecraft;
|
||||
+import net.minecraftforge.common.ForgeHooks;
|
||||
+
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
@@ -134,7 +136,7 @@
|
||||
|
||||
var47 = var7 - 39;
|
||||
var22 = var47 - 10;
|
||||
- var23 = this.mc.thePlayer.getTotalArmorValue();
|
||||
+ var23 = ForgeHooks.getTotalArmorValue(mc.thePlayer);
|
||||
int var24 = -1;
|
||||
|
||||
if (this.mc.thePlayer.isPotionActive(Potion.regeneration))
|
|
@ -7,7 +7,7 @@
|
|||
+
|
||||
+import net.minecraftforge.common.ForgeHooks;
|
||||
+import net.minecraftforge.common.MinecraftForge;
|
||||
+import net.minecraftforge.event.entity.BonemealEvent;
|
||||
+import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||
|
||||
public class ItemDye extends Item
|
||||
{
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/MemoryConnection.java
|
||||
+++ ../src_work/minecraft/net/minecraft/src/MemoryConnection.java
|
||||
@@ -6,6 +6,8 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
+
|
||||
+import net.minecraftforge.common.ForgeHooks;
|
||||
|
||||
public class MemoryConnection implements NetworkManager
|
||||
{
|
||||
@@ -106,6 +108,7 @@
|
||||
this.shuttingDown = true;
|
||||
this.shutdownReason = par1Str;
|
||||
this.field_74439_g = par2ArrayOfObj;
|
||||
+ ForgeHooks.onDisconnect(this, par1Str, par2ArrayOfObj);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,4 +154,10 @@
|
||||
this.readPacketCache.add(par1Packet);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public NetHandler getNetHandler()
|
||||
+ {
|
||||
+ return myNetHandler;
|
||||
+ }
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/NetClientHandler.java
|
||||
+++ ../src_work/minecraft/net/minecraft/src/NetClientHandler.java
|
||||
@@ -18,6 +18,8 @@
|
||||
import java.util.Random;
|
||||
import javax.crypto.SecretKey;
|
||||
import net.minecraft.client.Minecraft;
|
||||
+import net.minecraftforge.common.ForgeHooks;
|
||||
+
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class NetClientHandler extends NetHandler
|
||||
@@ -56,6 +58,8 @@
|
||||
this.mc = par1Minecraft;
|
||||
Socket var4 = new Socket(InetAddress.getByName(par2Str), par3);
|
||||
this.netManager = new TcpConnection(var4, "Client", this);
|
||||
+
|
||||
+ ForgeHooks.onConnect(netManager);
|
||||
}
|
||||
|
||||
public NetClientHandler(Minecraft par1Minecraft, IntegratedServer par2IntegratedServer) throws IOException
|
|
@ -0,0 +1,11 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/NetworkManager.java
|
||||
+++ ../src_work/minecraft/net/minecraft/src/NetworkManager.java
|
||||
@@ -5,6 +5,8 @@
|
||||
public interface NetworkManager
|
||||
{
|
||||
void setNetHandler(NetHandler var1);
|
||||
+
|
||||
+ NetHandler getNetHandler();
|
||||
|
||||
/**
|
||||
* Adds the packet to the correct send queue (chunk data packets go to a separate queue).
|
|
@ -1,6 +1,26 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/PlayerControllerMP.java
|
||||
+++ ../src_work/minecraft/net/minecraft/src/PlayerControllerMP.java
|
||||
@@ -112,7 +112,7 @@
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
+import net.minecraftforge.common.ForgeHooks;
|
||||
|
||||
public class PlayerControllerMP
|
||||
{
|
||||
@@ -95,6 +96,11 @@
|
||||
*/
|
||||
public boolean onPlayerDestroyBlock(int par1, int par2, int par3, int par4)
|
||||
{
|
||||
+ ItemStack stack = mc.thePlayer.getCurrentEquippedItem();
|
||||
+ if (stack != null && stack.getItem() != null && stack.getItem().onBlockStartBreak(stack, par1, par2, par3, mc.thePlayer))
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
if (this.currentGameType.isAdventure())
|
||||
{
|
||||
return false;
|
||||
@@ -112,7 +118,7 @@
|
||||
{
|
||||
var5.playAuxSFX(2001, par1, par2, par3, var6.blockID + (var5.getBlockMetadata(par1, par2, par3) << 12));
|
||||
int var7 = var5.getBlockMetadata(par1, par2, par3);
|
||||
|
@ -9,3 +29,33 @@
|
|||
|
||||
if (var8)
|
||||
{
|
||||
@@ -290,6 +296,12 @@
|
||||
public boolean onPlayerRightClick(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7, Vec3 par8Vec3)
|
||||
{
|
||||
this.syncCurrentPlayItem();
|
||||
+ if (par3ItemStack != null &&
|
||||
+ par3ItemStack.getItem() != null &&
|
||||
+ par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7))
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
float var9 = (float)par8Vec3.xCoord - (float)par4;
|
||||
float var10 = (float)par8Vec3.yCoord - (float)par5;
|
||||
float var11 = (float)par8Vec3.zCoord - (float)par6;
|
||||
@@ -333,6 +345,16 @@
|
||||
else
|
||||
{
|
||||
return par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, var9, var10, var11);
|
||||
+
|
||||
+ if (!par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, var9, var10, var11))
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (par3ItemStack.stackSize <= 0)
|
||||
+ {
|
||||
+ ForgeHooks.onDestroyCurrentItem(par1EntityPlayer, par3ItemStack);
|
||||
+ }
|
||||
+ return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
41
patches/minecraft/net/minecraft/src/RenderBiped.java.patch
Normal file
41
patches/minecraft/net/minecraft/src/RenderBiped.java.patch
Normal file
|
@ -0,0 +1,41 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/RenderBiped.java
|
||||
+++ ../src_work/minecraft/net/minecraft/src/RenderBiped.java
|
||||
@@ -1,6 +1,10 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
+import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
|
||||
+import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
|
||||
+import net.minecraftforge.client.IItemRenderer;
|
||||
+import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
public class RenderBiped extends RenderLiving
|
||||
{
|
||||
@@ -31,8 +35,11 @@
|
||||
this.modelBipedMain.bipedRightArm.postRender(0.0625F);
|
||||
GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);
|
||||
float var4;
|
||||
-
|
||||
- if (var3.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType()))
|
||||
+
|
||||
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var3, EQUIPPED);
|
||||
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var3, BLOCK_3D));
|
||||
+
|
||||
+ if (var3.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType())))
|
||||
{
|
||||
var4 = 0.5F;
|
||||
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
|
||||
@@ -71,8 +78,11 @@
|
||||
this.renderManager.itemRenderer.renderItem(par1EntityLiving, var3, 0);
|
||||
|
||||
if (var3.getItem().requiresMultipleRenderPasses())
|
||||
- {
|
||||
- this.renderManager.itemRenderer.renderItem(par1EntityLiving, var3, 1);
|
||||
+ {
|
||||
+ for (int x = 1; x < var3.getItem().getRenderPasses(var3.getItemDamage()); x++)
|
||||
+ {
|
||||
+ this.renderManager.itemRenderer.renderItem(par1EntityLiving, var3, x);
|
||||
+ }
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
28
patches/minecraft/net/minecraft/src/RenderEngine.java.patch
Normal file
28
patches/minecraft/net/minecraft/src/RenderEngine.java.patch
Normal file
|
@ -0,0 +1,28 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/RenderEngine.java
|
||||
+++ ../src_work/minecraft/net/minecraft/src/RenderEngine.java
|
||||
@@ -14,6 +14,9 @@
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.imageio.ImageIO;
|
||||
+
|
||||
+import net.minecraftforge.client.ForgeHooksClient;
|
||||
+
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderEngine
|
||||
@@ -155,6 +158,7 @@
|
||||
|
||||
try
|
||||
{
|
||||
+ ForgeHooksClient.onTextureLoadPre(par1Str);
|
||||
this.singleIntBuffer.clear();
|
||||
GLAllocation.generateTextureNames(this.singleIntBuffer);
|
||||
int var3 = this.singleIntBuffer.get(0);
|
||||
@@ -198,6 +202,7 @@
|
||||
}
|
||||
|
||||
this.textureMap.put(par1Str, Integer.valueOf(var3));
|
||||
+ ForgeHooksClient.onTextureLoad(par1Str, var6);
|
||||
return var3;
|
||||
}
|
||||
catch (Exception var5)
|
47
patches/minecraft/net/minecraft/src/RenderGlobal.java.patch
Normal file
47
patches/minecraft/net/minecraft/src/RenderGlobal.java.patch
Normal file
|
@ -0,0 +1,47 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/RenderGlobal.java
|
||||
+++ ../src_work/minecraft/net/minecraft/src/RenderGlobal.java
|
||||
@@ -1787,6 +1787,7 @@
|
||||
double var17 = this.mc.renderViewEntity.posY - par4;
|
||||
double var19 = this.mc.renderViewEntity.posZ - par6;
|
||||
EntityFX var21 = null;
|
||||
+ Object effectObject = null;
|
||||
|
||||
if (par1Str.equals("hugeexplosion"))
|
||||
{
|
||||
@@ -1906,6 +1907,7 @@
|
||||
else if (par1Str.equals("snowballpoof"))
|
||||
{
|
||||
var21 = new EntityBreakingFX(this.theWorld, par2, par4, par6, Item.snowball);
|
||||
+ effectObject = Item.snowball;
|
||||
}
|
||||
else if (par1Str.equals("dripWater"))
|
||||
{
|
||||
@@ -1922,6 +1924,7 @@
|
||||
else if (par1Str.equals("slime"))
|
||||
{
|
||||
var21 = new EntityBreakingFX(this.theWorld, par2, par4, par6, Item.slimeBall);
|
||||
+ effectObject = Item.slimeBall;
|
||||
}
|
||||
else if (par1Str.equals("heart"))
|
||||
{
|
||||
@@ -1935,17 +1938,19 @@
|
||||
{
|
||||
var24 = Integer.parseInt(par1Str.substring(par1Str.indexOf("_") + 1));
|
||||
var21 = new EntityBreakingFX(this.theWorld, par2, par4, par6, par8, par10, par12, Item.itemsList[var24]);
|
||||
+ effectObject = Item.itemsList[var24];
|
||||
}
|
||||
else if (par1Str.startsWith("tilecrack_"))
|
||||
{
|
||||
var24 = Integer.parseInt(par1Str.substring(par1Str.indexOf("_") + 1));
|
||||
var21 = new EntityDiggingFX(this.theWorld, par2, par4, par6, par8, par10, par12, Block.blocksList[var24], 0, 0);
|
||||
+ effectObject = Block.blocksList[var24];
|
||||
}
|
||||
}
|
||||
|
||||
if (var21 != null)
|
||||
{
|
||||
- this.mc.effectRenderer.addEffect((EntityFX)var21);
|
||||
+ this.mc.effectRenderer.addEffect((EntityFX)var21, effectObject);
|
||||
}
|
||||
|
||||
return (EntityFX)var21;
|
22
patches/minecraft/net/minecraft/src/RenderManager.java.patch
Normal file
22
patches/minecraft/net/minecraft/src/RenderManager.java.patch
Normal file
|
@ -0,0 +1,22 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/RenderManager.java
|
||||
+++ ../src_work/minecraft/net/minecraft/src/RenderManager.java
|
||||
@@ -124,12 +124,14 @@
|
||||
|
||||
if (par4EntityLiving.isPlayerSleeping())
|
||||
{
|
||||
- int var7 = par1World.getBlockId(MathHelper.floor_double(par4EntityLiving.posX), MathHelper.floor_double(par4EntityLiving.posY), MathHelper.floor_double(par4EntityLiving.posZ));
|
||||
-
|
||||
- if (var7 == Block.bed.blockID)
|
||||
+ int x = MathHelper.floor_double(par4EntityLiving.posX);
|
||||
+ int y = MathHelper.floor_double(par4EntityLiving.posY);
|
||||
+ int z = MathHelper.floor_double(par4EntityLiving.posZ);
|
||||
+ Block block = Block.blocksList[par1World.getBlockId(x, y, z)];
|
||||
+
|
||||
+ if (block != null && block.isBed(par1World, x, y, z, par4EntityLiving))
|
||||
{
|
||||
- int var8 = par1World.getBlockMetadata(MathHelper.floor_double(par4EntityLiving.posX), MathHelper.floor_double(par4EntityLiving.posY), MathHelper.floor_double(par4EntityLiving.posZ));
|
||||
- int var9 = var8 & 3;
|
||||
+ int var9 = block.getBedDirection(par1World, x, y, z);;
|
||||
this.playerViewY = (float)(var9 * 90 + 180);
|
||||
this.playerViewX = 0.0F;
|
||||
}
|
30
patches/minecraft/net/minecraft/src/RenderSnowMan.java.patch
Normal file
30
patches/minecraft/net/minecraft/src/RenderSnowMan.java.patch
Normal file
|
@ -0,0 +1,30 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/RenderSnowMan.java
|
||||
+++ ../src_work/minecraft/net/minecraft/src/RenderSnowMan.java
|
||||
@@ -1,4 +1,9 @@
|
||||
package net.minecraft.src;
|
||||
+
|
||||
+import net.minecraftforge.client.IItemRenderer;
|
||||
+import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*;
|
||||
+import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*;
|
||||
+import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -19,12 +24,15 @@
|
||||
super.renderEquippedItems(par1EntitySnowman, par2);
|
||||
ItemStack var3 = new ItemStack(Block.pumpkin, 1);
|
||||
|
||||
- if (var3 != null && var3.getItem().shiftedIndex < 256)
|
||||
+ if (var3 != null && var3.getItem() instanceof ItemBlock)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
this.snowmanModel.field_78195_c.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.34375F, 0.0F);
|
53
patches/minecraft/net/minecraft/src/SoundPool.java.patch
Normal file
53
patches/minecraft/net/minecraft/src/SoundPool.java.patch
Normal file
|
@ -0,0 +1,53 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/SoundPool.java
|
||||
+++ ../src_work/minecraft/net/minecraft/src/SoundPool.java
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
+import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -33,6 +34,26 @@
|
||||
*/
|
||||
public SoundPoolEntry addSound(String par1Str, File par2File)
|
||||
{
|
||||
+ try
|
||||
+ {
|
||||
+ return addSound(par1Str, par2File.toURI().toURL());
|
||||
+ }
|
||||
+ catch (MalformedURLException ex)
|
||||
+ {
|
||||
+ ex.printStackTrace();
|
||||
+ throw new RuntimeException(ex);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * URL version of addSound, as the back-end sound engine has full support for various types of URLs
|
||||
+ *
|
||||
+ * @param par1Str The name of the sound to add
|
||||
+ * @param url The url of the sound resource
|
||||
+ * @return A SoundPoolEntry for the newly added sound
|
||||
+ */
|
||||
+ public SoundPoolEntry addSound(String par1Str, URL url)
|
||||
+ {
|
||||
try
|
||||
{
|
||||
String var3 = par1Str;
|
||||
@@ -53,13 +74,13 @@
|
||||
this.nameToSoundPoolEntriesMapping.put(par1Str, new ArrayList());
|
||||
}
|
||||
|
||||
- SoundPoolEntry var4 = new SoundPoolEntry(var3, par2File.toURI().toURL());
|
||||
+ SoundPoolEntry var4 = new SoundPoolEntry(var3, url);
|
||||
((List)this.nameToSoundPoolEntriesMapping.get(par1Str)).add(var4);
|
||||
this.allSoundPoolEntries.add(var4);
|
||||
++this.numberOfSoundPoolEntries;
|
||||
return var4;
|
||||
}
|
||||
- catch (MalformedURLException var5)
|
||||
+ catch (Exception var5)
|
||||
{
|
||||
var5.printStackTrace();
|
||||
throw new RuntimeException(var5);
|
30
patches/minecraft/net/minecraft/src/TcpConnection.java.patch
Normal file
30
patches/minecraft/net/minecraft/src/TcpConnection.java.patch
Normal file
|
@ -0,0 +1,30 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/TcpConnection.java
|
||||
+++ ../src_work/minecraft/net/minecraft/src/TcpConnection.java
|
||||
@@ -14,6 +14,8 @@
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import javax.crypto.SecretKey;
|
||||
+
|
||||
+import net.minecraftforge.common.ForgeHooks;
|
||||
|
||||
public class TcpConnection implements NetworkManager
|
||||
{
|
||||
@@ -399,6 +401,7 @@
|
||||
{
|
||||
;
|
||||
}
|
||||
+ ForgeHooks.onDisconnect(this, par1Str, par2ArrayOfObj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -559,4 +562,10 @@
|
||||
{
|
||||
return par0TcpConnection.writeThread;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public NetHandler getNetHandler()
|
||||
+ {
|
||||
+ return theNetHandler;
|
||||
+ }
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/TileEntity.java
|
||||
+++ ../src_work/minecraft/net/minecraft/src/TileEntity.java
|
||||
@@ -243,4 +243,29 @@
|
||||
@@ -243,4 +243,33 @@
|
||||
addMapping(TileEntityEnchantmentTable.class, "EnchantTable");
|
||||
addMapping(TileEntityEndPortal.class, "Airportal");
|
||||
}
|
||||
|
@ -23,10 +23,14 @@
|
|||
+ * @param net The NetworkManager the packet originated from
|
||||
+ * @param pkt The data packet
|
||||
+ */
|
||||
+ public void onDataPacket(NetworkManager net, Packet132TileEntityData pkt){}
|
||||
+ public void onDataPacket(NetworkManager net, Packet132TileEntityData pkt)
|
||||
+ {
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Called when the chunk this TileEntity is on is Unloaded.
|
||||
+ */
|
||||
+ public void onChunkUnload(){}
|
||||
+ public void onChunkUnload()
|
||||
+ {
|
||||
+ }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
--- ../src_base/minecraft/net/minecraft/src/TileEntityRendererPiston.java
|
||||
+++ ../src_work/minecraft/net/minecraft/src/TileEntityRendererPiston.java
|
||||
@@ -1,6 +1,8 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
+import net.minecraftforge.client.ForgeHooksClient;
|
||||
+
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntityRendererPiston extends TileEntitySpecialRenderer
|
||||
@@ -30,6 +32,7 @@
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}
|
||||
|
||||
+ ForgeHooksClient.beforeBlockRender(var9, blockRenderer);
|
||||
var10.startDrawingQuads();
|
||||
var10.setTranslation((double)((float)par2 - (float)par1TileEntityPiston.xCoord + par1TileEntityPiston.getOffsetX(par8)), (double)((float)par4 - (float)par1TileEntityPiston.yCoord + par1TileEntityPiston.getOffsetY(par8)), (double)((float)par6 - (float)par1TileEntityPiston.zCoord + par1TileEntityPiston.getOffsetZ(par8)));
|
||||
var10.setColorOpaque(1, 1, 1);
|
||||
@@ -53,6 +56,7 @@
|
||||
|
||||
var10.setTranslation(0.0D, 0.0D, 0.0D);
|
||||
var10.draw();
|
||||
+ ForgeHooksClient.afterBlockRender(var9, blockRenderer);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue