Merging in master.

This commit is contained in:
rhilenova 2013-09-30 20:30:08 -04:00
commit 7147cdb1c1
25 changed files with 529 additions and 57 deletions

View file

@ -0,0 +1,140 @@
package net.minecraftforge.client;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.command.CommandException;
import net.minecraft.command.CommandHandler;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.util.ChatMessageComponent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.CommandEvent;
import cpw.mods.fml.client.FMLClientHandler;
import static net.minecraft.util.EnumChatFormatting.*;
/**
* The class that handles client-side chat commands. You should register any
* commands that you want handled on the client with this command handler.
*
* If there is a command with the same name registered both on the server and
* client, the client takes precedence!
*
*/
public class ClientCommandHandler extends CommandHandler
{
public static final ClientCommandHandler instance = new ClientCommandHandler();
public String[] latestAutoComplete = null;
/**
* @return 1 if successfully executed, 0 if wrong usage, it doesn't exist or
* it was canceled.
*/
@Override
public int executeCommand(ICommandSender sender, String message)
{
message = message.trim();
if (message.startsWith("/"))
{
message = message.substring(1);
}
String[] args = message.split(" ");
String commandName = args[0];
System.arraycopy(args, 1, args, 0, args.length - 1);
ICommand icommand = (ICommand) getCommands().get(commandName);
try
{
if (icommand == null)
{
return 0;
}
if (icommand.canCommandSenderUseCommand(sender))
{
CommandEvent event = new CommandEvent(icommand, sender, args);
if (MinecraftForge.EVENT_BUS.post(event))
{
if (event.exception != null)
{
throw event.exception;
}
return 0;
}
icommand.processCommand(sender, args);
return 1;
}
else
{
sender.sendChatToPlayer(format("commands.generic.permission").setColor(RED));
}
}
catch (WrongUsageException wue)
{
sender.sendChatToPlayer(format("commands.generic.usage", format(wue.getMessage(), wue.getErrorOjbects())).setColor(RED));
}
catch (CommandException ce)
{
sender.sendChatToPlayer(format(ce.getMessage(), ce.getErrorOjbects()).setColor(RED));
}
catch (Throwable t)
{
sender.sendChatToPlayer(format("commands.generic.exception").setColor(RED));
t.printStackTrace();
}
return 0;
}
//Couple of helpers because the mcp names are stupid and long...
private ChatMessageComponent format(String str, Object... args)
{
return ChatMessageComponent.createFromTranslationWithSubstitutions(str, args);
}
private ChatMessageComponent format(String str)
{
return ChatMessageComponent.createFromTranslationKey(str);
}
public void autoComplete(String leftOfCursor, String full)
{
latestAutoComplete = null;
if (leftOfCursor.charAt(0) == '/')
{
leftOfCursor = leftOfCursor.substring(1);
Minecraft mc = FMLClientHandler.instance().getClient();
if (mc.currentScreen instanceof GuiChat)
{
List<String> commands = getPossibleCommands(mc.thePlayer, leftOfCursor);
if (commands != null && !commands.isEmpty())
{
if (leftOfCursor.indexOf(' ') == -1)
{
for (int i = 0; i < commands.size(); i++)
{
commands.set(i, GRAY + "/" + commands.get(i) + RESET);
}
}
else
{
for (int i = 0; i < commands.size(); i++)
{
commands.set(i, GRAY + commands.get(i) + RESET);
}
}
latestAutoComplete = commands.toArray(new String[commands.size()]);
}
}
}
}
}

View file

@ -723,12 +723,19 @@ public class GuiIngameForge extends GuiIngame
protected void renderChat(int width, int height) protected void renderChat(int width, int height)
{ {
GL11.glPushMatrix();
GL11.glTranslatef(0.0F, (float)(height - 48), 0.0F);
mc.mcProfiler.startSection("chat"); mc.mcProfiler.startSection("chat");
RenderGameOverlayEvent.Chat event = new RenderGameOverlayEvent.Chat(eventParent, 0, height - 48);
if (MinecraftForge.EVENT_BUS.post(event)) return;
GL11.glPushMatrix();
GL11.glTranslatef((float)event.posX, (float)event.posY, 0.0F);
persistantChatGUI.drawChat(updateCounter); persistantChatGUI.drawChat(updateCounter);
mc.mcProfiler.endSection();
GL11.glPopMatrix(); GL11.glPopMatrix();
post(CHAT);
mc.mcProfiler.endSection();
} }
protected void renderPlayerList(int width, int height) protected void renderPlayerList(int width, int height)

View file

@ -25,6 +25,7 @@ public class RenderGameOverlayEvent extends Event
TEXT, TEXT,
HEALTHMOUNT, HEALTHMOUNT,
JUMPBAR, JUMPBAR,
CHAT,
PLAYER_LIST PLAYER_LIST
} }
@ -80,4 +81,17 @@ public class RenderGameOverlayEvent extends Event
this.right = right; this.right = right;
} }
} }
public static class Chat extends Pre
{
public int posX;
public int posY;
public Chat(RenderGameOverlayEvent parent, int posX, int posY)
{
super(parent, ElementType.CHAT);
this.posX = posX;
this.posY = posY;
}
}
} }

View file

@ -108,7 +108,7 @@ public class ChestGenHooks
{ {
ret = new ItemStack[0]; ret = new ItemStack[0];
} }
else if (count > source.getItem().getItemStackLimit()) else if (count > source.getMaxStackSize())
{ {
ret = new ItemStack[count]; ret = new ItemStack[count];
for (int x = 0; x < count; x++) for (int x = 0; x < count; x++)

View file

@ -12,7 +12,7 @@ public class ForgeVersion
//This number is incremented every minecraft release, never reset //This number is incremented every minecraft release, never reset
public static final int minorVersion = 11; public static final int minorVersion = 11;
//This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version //This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version
public static final int revisionVersion = 0; public static final int revisionVersion = 1;
//This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code. //This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code.
public static final int buildVersion = 0; public static final int buildVersion = 0;

View file

@ -15,6 +15,7 @@ import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.entity.living.LivingPackSizeEvent; import net.minecraftforge.event.entity.living.LivingPackSizeEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent.AllowDespawn; import net.minecraftforge.event.entity.living.LivingSpawnEvent.AllowDespawn;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@ -99,4 +100,11 @@ public class ForgeEventFactory
MinecraftForge.EVENT_BUS.post(event); MinecraftForge.EVENT_BUS.post(event);
return event.dropChance; return event.dropChance;
} }
public static ItemTooltipEvent onItemTooltip(ItemStack itemStack, EntityPlayer entityPlayer, List<String> toolTip, boolean showAdvancedItemTooltips)
{
ItemTooltipEvent event = new ItemTooltipEvent(itemStack, entityPlayer, toolTip, showAdvancedItemTooltips);
MinecraftForge.EVENT_BUS.post(event);
return event;
}
} }

View file

@ -0,0 +1,17 @@
package net.minecraftforge.event.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraftforge.event.Cancelable;
@Cancelable
public class EntityStruckByLightningEvent extends EntityEvent
{
public final EntityLightningBolt lightning;
public EntityStruckByLightningEvent(Entity entity, EntityLightningBolt lightning)
{
super(entity);
this.lightning = lightning;
}
}

View file

@ -0,0 +1,32 @@
package net.minecraftforge.event.entity.player;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public class ItemTooltipEvent extends PlayerEvent
{
/**
* Whether the advanced information on item tooltips is being shown, toggled by F3+H.
*/
public final boolean showAdvancedItemTooltips;
/**
* The {@link ItemStack} with the tooltip.
*/
public final ItemStack itemStack;
/**
* The {@link ItemStack} tooltip.
*/
public final List<String> toolTip;
/**
* This event is fired in {@link ItemStack#getTooltip(EntityPlayer, boolean)}, which in turn is called from it's respective GUIContainer.
*/
public ItemTooltipEvent(ItemStack itemStack, EntityPlayer entityPlayer, List<String> toolTip, boolean showAdvancedItemTooltips)
{
super(entityPlayer);
this.itemStack = itemStack;
this.toolTip = toolTip;
this.showAdvancedItemTooltips = showAdvancedItemTooltips;
}
}

View file

@ -58,6 +58,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
this.temperature = fluid.temperature; this.temperature = fluid.temperature;
this.maxScaledLight = fluid.luminosity; this.maxScaledLight = fluid.luminosity;
this.tickRate = fluid.viscosity / 200; this.tickRate = fluid.viscosity / 200;
this.densityDir = fluid.density > 0 ? -1 : 1;
fluid.setBlockID(id); fluid.setBlockID(id);
displacementIds.putAll(defaultDisplacementIds); displacementIds.putAll(defaultDisplacementIds);

View file

@ -58,6 +58,18 @@ public class OreDictionary
registerOre("oreQuartz", Block.oreNetherQuartz); registerOre("oreQuartz", Block.oreNetherQuartz);
registerOre("stone", Block.stone); registerOre("stone", Block.stone);
registerOre("cobblestone", Block.cobblestone); registerOre("cobblestone", Block.cobblestone);
registerOre("record", Item.record13);
registerOre("record", Item.recordCat);
registerOre("record", Item.recordBlocks);
registerOre("record", Item.recordChirp);
registerOre("record", Item.recordFar);
registerOre("record", Item.recordMall);
registerOre("record", Item.recordMellohi);
registerOre("record", Item.recordStal);
registerOre("record", Item.recordStrad);
registerOre("record", Item.recordWard);
registerOre("record", Item.record11);
registerOre("record", Item.recordWait);
} }
// Build our list of items to replace with ore tags // Build our list of items to replace with ore tags

Binary file not shown.

2
fml

@ -1 +1 @@
Subproject commit 9b55f1f48f89a5348ac1d58622b71946f310316a Subproject commit 5265e34a350adbb762264379f0134bfa40d33eaa

View file

@ -1,3 +1,3 @@
@echo off @echo off
.\fml\python\python_fml install.py .\fml\python\python_fml install.py %*
pause pause

View file

@ -1,2 +1,2 @@
#!/bin/bash #!/bin/bash
python install.py python install.py "$@"

View file

@ -198,7 +198,7 @@
} }
/** /**
@@ -1457,4 +1491,979 @@ @@ -1457,4 +1491,993 @@
canBlockGrass[0] = true; canBlockGrass[0] = true;
StatList.initBreakableStats(); StatList.initBreakableStats();
} }
@ -1174,6 +1174,20 @@
+ return false; + return false;
+ } + }
+ +
+ /**
+ * Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules.
+ * @param world The world
+ * @param x The x position of this block instance
+ * @param y The y position of this block instance
+ * @param z The z position of this block instance
+ * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side
+ * @return Whether Block#isProvidingWeakPower should be called when determining indirect power
+ */
+ public boolean shouldCheckWeakPower(World world, int x, int y, int z, int side)
+ {
+ return !this.isNormalCube(world.getBlockId(x, y, z));
+ }
+
+ @Deprecated //Implemented here as we changed the IFluidBlock interface, and this allows us to do so without breaking exisitng mods. + @Deprecated //Implemented here as we changed the IFluidBlock interface, and this allows us to do so without breaking exisitng mods.
+ // To be removed next MC version {1.6.3+} + // To be removed next MC version {1.6.3+}
+ public float getFilledPercentage(World world, int x, int y, int z){ return 1; } + public float getFilledPercentage(World world, int x, int y, int z){ return 1; }

View file

@ -53,7 +53,7 @@
par1World.setBlockToAir(par2, par3, par4); par1World.setBlockToAir(par2, par3, par4);
} }
} }
@@ -177,4 +176,10 @@ @@ -177,4 +176,27 @@
{ {
return par5 == 1 ? true : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5); return par5 == 1 ? true : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5);
} }
@ -62,5 +62,22 @@
+ public int quantityDropped(int meta, int fortune, Random random) + public int quantityDropped(int meta, int fortune, Random random)
+ { + {
+ return (meta & 7) + 1; + return (meta & 7) + 1;
+ }
+
+ /**
+ * Determines if a new block can be replace the space occupied by this one,
+ * Used in the player's placement code to make the block act like water, and lava.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y position
+ * @param z Z position
+ * @return True if the block is replaceable by another block
+ */
+ @Override
+ public boolean isBlockReplaceable(World world, int x, int y, int z)
+ {
+ int meta = world.getBlockMetadata(x, y, z);
+ return (meta >= 7 ? false : blockMaterial.isReplaceable());
+ } + }
} }

View file

@ -1,9 +1,10 @@
--- ../src_base/minecraft/net/minecraft/client/Minecraft.java --- ../src_base/minecraft/net/minecraft/client/Minecraft.java
+++ ../src_work/minecraft/net/minecraft/client/Minecraft.java +++ ../src_work/minecraft/net/minecraft/client/Minecraft.java
@@ -137,6 +137,15 @@ @@ -137,6 +137,16 @@
import com.google.common.collect.MapDifference; import com.google.common.collect.MapDifference;
+import net.minecraftforge.client.ClientCommandHandler;
+import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.ForgeHooksClient;
+import net.minecraftforge.client.GuiIngameForge; +import net.minecraftforge.client.GuiIngameForge;
+import net.minecraftforge.client.event.GuiOpenEvent; +import net.minecraftforge.client.event.GuiOpenEvent;
@ -16,7 +17,7 @@
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class Minecraft implements IPlayerUsage public class Minecraft implements IPlayerUsage
{ {
@@ -416,7 +425,7 @@ @@ -416,7 +426,7 @@
try try
{ {
@ -25,7 +26,7 @@
} }
catch (LWJGLException lwjglexception) catch (LWJGLException lwjglexception)
{ {
@@ -497,7 +506,7 @@ @@ -497,7 +507,7 @@
this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
FMLClientHandler.instance().finishMinecraftLoading(); FMLClientHandler.instance().finishMinecraftLoading();
this.checkGLError("Post startup"); this.checkGLError("Post startup");
@ -34,7 +35,7 @@
if (this.serverName != null) if (this.serverName != null)
{ {
@@ -679,11 +688,6 @@ @@ -679,11 +689,6 @@
*/ */
public void displayGuiScreen(GuiScreen par1GuiScreen) public void displayGuiScreen(GuiScreen par1GuiScreen)
{ {
@ -46,7 +47,7 @@
this.statFileWriter.syncStats(); this.statFileWriter.syncStats();
if (par1GuiScreen == null && this.theWorld == null) if (par1GuiScreen == null && this.theWorld == null)
@@ -693,6 +697,20 @@ @@ -693,6 +698,20 @@
else if (par1GuiScreen == null && this.thePlayer.getHealth() <= 0.0F) else if (par1GuiScreen == null && this.thePlayer.getHealth() <= 0.0F)
{ {
par1GuiScreen = new GuiGameOver(); par1GuiScreen = new GuiGameOver();
@ -67,7 +68,7 @@
} }
if (par1GuiScreen instanceof GuiMainMenu) if (par1GuiScreen instanceof GuiMainMenu)
@@ -1300,7 +1318,7 @@ @@ -1300,7 +1319,7 @@
if (this.thePlayer.isCurrentToolAdventureModeExempt(j, k, l)) if (this.thePlayer.isCurrentToolAdventureModeExempt(j, k, l))
{ {
@ -76,7 +77,7 @@
this.thePlayer.swingItem(); this.thePlayer.swingItem();
} }
} }
@@ -1366,7 +1384,8 @@ @@ -1366,7 +1385,8 @@
{ {
int j1 = itemstack != null ? itemstack.stackSize : 0; int j1 = itemstack != null ? itemstack.stackSize : 0;
@ -86,7 +87,7 @@
{ {
flag = false; flag = false;
this.thePlayer.swingItem(); this.thePlayer.swingItem();
@@ -1392,7 +1411,8 @@ @@ -1392,7 +1412,8 @@
{ {
ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem();
@ -96,7 +97,7 @@
{ {
this.entityRenderer.itemRenderer.resetEquippedProgress2(); this.entityRenderer.itemRenderer.resetEquippedProgress2();
} }
@@ -1574,6 +1594,8 @@ @@ -1574,6 +1595,8 @@
while (Mouse.next()) while (Mouse.next())
{ {
@ -105,7 +106,7 @@
i = Mouse.getEventButton(); i = Mouse.getEventButton();
if (isRunningOnMac && i == 0 && (Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157))) if (isRunningOnMac && i == 0 && (Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157)))
@@ -2046,6 +2068,11 @@ @@ -2046,6 +2069,11 @@
{ {
this.statFileWriter.syncStats(); this.statFileWriter.syncStats();
@ -117,7 +118,7 @@
if (par1WorldClient == null) if (par1WorldClient == null)
{ {
NetClientHandler netclienthandler = this.getNetHandler(); NetClientHandler netclienthandler = this.getNetHandler();
@@ -2063,6 +2090,18 @@ @@ -2063,6 +2091,18 @@
if (this.theIntegratedServer != null) if (this.theIntegratedServer != null)
{ {
this.theIntegratedServer.initiateShutdown(); this.theIntegratedServer.initiateShutdown();
@ -136,7 +137,16 @@
} }
this.theIntegratedServer = null; this.theIntegratedServer = null;
@@ -2236,107 +2275,12 @@ @@ -2225,7 +2265,7 @@
*/
public boolean handleClientCommand(String par1Str)
{
- return false;
+ return ClientCommandHandler.instance.executeCommand(thePlayer, par1Str) == 1;
}
/**
@@ -2236,107 +2276,12 @@
if (this.objectMouseOver != null) if (this.objectMouseOver != null)
{ {
boolean flag = this.thePlayer.capabilities.isCreativeMode; boolean flag = this.thePlayer.capabilities.isCreativeMode;
@ -248,7 +258,7 @@
if (flag) if (flag)
{ {
@@ -2419,11 +2363,18 @@ @@ -2419,11 +2364,18 @@
par1PlayerUsageSnooper.addData("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize())); par1PlayerUsageSnooper.addData("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize()));
} }
@ -267,7 +277,7 @@
for (int i = 16384; i > 0; i >>= 1) for (int i = 16384; i > 0; i >>= 1)
{ {
GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);
@@ -2431,6 +2382,7 @@ @@ -2431,6 +2383,7 @@
if (j != 0) if (j != 0)
{ {

View file

@ -0,0 +1,44 @@
--- ../src_base/minecraft/net/minecraft/client/gui/GuiChat.java
+++ ../src_work/minecraft/net/minecraft/client/gui/GuiChat.java
@@ -7,8 +7,11 @@
import java.util.Iterator;
import java.util.List;
import net.minecraft.network.packet.Packet203AutoComplete;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.client.ClientCommandHandler;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
+import com.google.common.collect.ObjectArrays;
@SideOnly(Side.CLIENT)
public class GuiChat extends GuiScreen
@@ -278,13 +281,14 @@
this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(stringbuilder.toString(), 1);
}
- this.inputField.writeText((String)this.field_73904_o.get(this.field_73903_n++));
+ this.inputField.writeText(EnumChatFormatting.func_110646_a((String)this.field_73904_o.get(this.field_73903_n++)));
}
private void func_73893_a(String par1Str, String par2Str)
{
if (par1Str.length() >= 1)
{
+ ClientCommandHandler.instance.autoComplete(par1Str, par2Str);
this.mc.thePlayer.sendQueue.addToSendQueue(new Packet203AutoComplete(par1Str));
this.field_73905_m = true;
}
@@ -347,6 +351,13 @@
String[] astring1 = par1ArrayOfStr;
int i = par1ArrayOfStr.length;
+ String[] complete = ClientCommandHandler.instance.latestAutoComplete;
+ if (complete != null)
+ {
+ astring1 = ObjectArrays.concat(complete, astring1, String.class);
+ i = astring1.length;
+ }
+
for (int j = 0; j < i; ++j)
{
String s = astring1[j];

View file

@ -15,14 +15,14 @@
} }
+ /** + /**
+ * This applies specifically to applying at the enchanting table. The other method {@link #func_92037_a(ItemStack)} + * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)}
+ * applies for <i>all possible</i> enchantments. + * applies for <i>all possible</i> enchantments.
+ * @param stack + * @param stack
+ * @return + * @return
+ */ + */
+ public boolean canApplyAtEnchantingTable(ItemStack stack) + public boolean canApplyAtEnchantingTable(ItemStack stack)
+ { + {
+ return this.type.canEnchantItem(stack.getItem()); + return canApply(stack);
+ } + }
+ +
+ /** + /**

View file

@ -0,0 +1,23 @@
--- ../src_base/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java
+++ ../src_work/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java
@@ -10,6 +10,8 @@
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.EntityStruckByLightningEvent;
public class EntityLightningBolt extends EntityWeatherEffect
{
@@ -116,7 +118,10 @@
for (int l = 0; l < list.size(); ++l)
{
Entity entity = (Entity)list.get(l);
- entity.onStruckByLightning(this);
+ if (!MinecraftForge.EVENT_BUS.post(new EntityStruckByLightningEvent(entity, this)))
+ {
+ entity.onStruckByLightning(this);
+ }
}
}
}

View file

@ -0,0 +1,11 @@
--- ../src_base/minecraft/net/minecraft/entity/passive/EntityVillager.java
+++ ../src_work/minecraft/net/minecraft/entity/passive/EntityVillager.java
@@ -205,7 +205,7 @@
ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem();
boolean flag = itemstack != null && itemstack.itemID == Item.monsterPlacer.itemID;
- if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild())
+ if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !par1EntityPlayer.isSneaking())
{
if (!this.worldObj.isRemote)
{

View file

@ -47,7 +47,15 @@
} }
itemsList[256 + par1] = this; itemsList[256 + par1] = this;
@@ -606,6 +616,7 @@ @@ -334,6 +344,7 @@
/**
* Returns the maximum size of the stack for a specific item. *Isn't this more a Set than a Get?*
*/
+ @Deprecated
public int getItemStackLimit()
{
return this.maxStackSize;
@@ -606,6 +617,7 @@
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -55,7 +63,16 @@
public boolean hasEffect(ItemStack par1ItemStack) public boolean hasEffect(ItemStack par1ItemStack)
{ {
return par1ItemStack.isItemEnchanted(); return par1ItemStack.isItemEnchanted();
@@ -635,7 +646,7 @@ @@ -626,7 +638,7 @@
*/
public boolean isItemTool(ItemStack par1ItemStack)
{
- return this.getItemStackLimit() == 1 && this.isDamageable();
+ return this.getItemStackLimit(par1ItemStack) == 1 && this.isDamageable();
}
protected MovingObjectPosition getMovingObjectPositionFromPlayer(World par1World, EntityPlayer par2EntityPlayer, boolean par3)
@@ -635,7 +647,7 @@
float f1 = par2EntityPlayer.prevRotationPitch + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * f; float f1 = par2EntityPlayer.prevRotationPitch + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * f;
float f2 = par2EntityPlayer.prevRotationYaw + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * f; float f2 = par2EntityPlayer.prevRotationYaw + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * f;
double d0 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * (double)f; double d0 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * (double)f;
@ -64,7 +81,7 @@
double d2 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * (double)f; double d2 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * (double)f;
Vec3 vec3 = par1World.getWorldVec3Pool().getVecFromPool(d0, d1, d2); Vec3 vec3 = par1World.getWorldVec3Pool().getVecFromPool(d0, d1, d2);
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI); float f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI);
@@ -645,6 +656,10 @@ @@ -645,6 +657,10 @@
float f7 = f4 * f5; float f7 = f4 * f5;
float f8 = f3 * f5; float f8 = f3 * f5;
double d3 = 5.0D; double d3 = 5.0D;
@ -75,7 +92,7 @@
Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3);
return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3); return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3);
} }
@@ -753,4 +768,534 @@ @@ -753,4 +769,546 @@
{ {
StatList.initStats(); StatList.initStats();
} }
@ -608,5 +625,17 @@
+ public boolean hasEffect(ItemStack par1ItemStack, int pass) + public boolean hasEffect(ItemStack par1ItemStack, int pass)
+ { + {
+ return hasEffect(par1ItemStack) && (pass == 0 || itemID != Item.potion.itemID); + return hasEffect(par1ItemStack) && (pass == 0 || itemID != Item.potion.itemID);
+ }
+
+ /**
+ * Gets the maximum number of items that this stack should be able to hold.
+ * This is a ItemStack (and thus NBT) sensitive version of Item.getItemStackLimit()
+ *
+ * @param stack The ItemStack
+ * @return THe maximum number this item can be stacked to
+ */
+ public int getItemStackLimit(ItemStack stack)
+ {
+ return this.getItemStackLimit();
+ } + }
} }

View file

@ -1,6 +1,32 @@
--- ../src_base/minecraft/net/minecraft/item/ItemStack.java --- ../src_base/minecraft/net/minecraft/item/ItemStack.java
+++ ../src_work/minecraft/net/minecraft/item/ItemStack.java +++ ../src_work/minecraft/net/minecraft/item/ItemStack.java
@@ -252,7 +252,9 @@ @@ -29,6 +29,7 @@
import net.minecraft.util.Icon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
+import net.minecraftforge.event.ForgeEventFactory;
public final class ItemStack
{
@@ -223,7 +224,7 @@
*/
public int getMaxStackSize()
{
- return this.getItem().getItemStackLimit();
+ return this.getItem().getItemStackLimit(this);
}
/**
@@ -239,7 +240,7 @@
*/
public boolean isItemStackDamageable()
{
- return Item.itemsList[this.itemID].getMaxDamage() > 0;
+ return Item.itemsList[this.itemID].getMaxDamage(this) > 0;
}
public boolean getHasSubtypes()
@@ -252,7 +253,9 @@
*/ */
public boolean isItemDamaged() public boolean isItemDamaged()
{ {
@ -11,7 +37,7 @@
} }
/** /**
@@ -260,6 +262,10 @@ @@ -260,6 +263,10 @@
*/ */
public int getItemDamageForDisplay() public int getItemDamageForDisplay()
{ {
@ -22,7 +48,7 @@
return this.itemDamage; return this.itemDamage;
} }
@@ -268,6 +274,10 @@ @@ -268,6 +275,10 @@
*/ */
public int getItemDamage() public int getItemDamage()
{ {
@ -33,7 +59,7 @@
return this.itemDamage; return this.itemDamage;
} }
@@ -276,6 +286,12 @@ @@ -276,6 +287,12 @@
*/ */
public void setItemDamage(int par1) public void setItemDamage(int par1)
{ {
@ -46,7 +72,7 @@
this.itemDamage = par1; this.itemDamage = par1;
if (this.itemDamage < 0) if (this.itemDamage < 0)
@@ -289,7 +305,7 @@ @@ -289,7 +306,7 @@
*/ */
public int getMaxDamage() public int getMaxDamage()
{ {
@ -55,7 +81,7 @@
} }
/** /**
@@ -327,8 +343,8 @@ @@ -327,8 +344,8 @@
} }
} }
@ -66,7 +92,7 @@
} }
} }
@@ -396,7 +412,7 @@ @@ -396,7 +413,7 @@
*/ */
public boolean canHarvestBlock(Block par1Block) public boolean canHarvestBlock(Block par1Block)
{ {
@ -75,7 +101,12 @@
} }
public boolean func_111282_a(EntityPlayer par1EntityPlayer, EntityLivingBase par2EntityLivingBase) public boolean func_111282_a(EntityPlayer par1EntityPlayer, EntityLivingBase par2EntityLivingBase)
@@ -737,10 +753,16 @@ @@ -733,14 +750,21 @@
{
arraylist.add("Durability: " + (this.getMaxDamage() - this.getItemDamageForDisplay()) + " / " + this.getMaxDamage());
}
+ ForgeEventFactory.onItemTooltip(this, par1EntityPlayer, arraylist, par2);
return arraylist; return arraylist;
} }

View file

@ -0,0 +1,38 @@
--- ../src_base/minecraft/net/minecraft/tileentity/TileEntityHopper.java
+++ ../src_work/minecraft/net/minecraft/tileentity/TileEntityHopper.java
@@ -453,17 +453,28 @@
if (itemstack1 == null)
{
- par0IInventory.setInventorySlotContents(par2, par1ItemStack);
- par1ItemStack = null;
+ int max = Math.min(par1ItemStack.getMaxStackSize(), par0IInventory.getInventoryStackLimit());
+ if (max >= par1ItemStack.stackSize)
+ {
+ par0IInventory.setInventorySlotContents(par2, par1ItemStack);
+ par1ItemStack = null;
+ }
+ else
+ {
+ par0IInventory.setInventorySlotContents(par2, par1ItemStack.splitStack(max));
+ }
flag = true;
}
else if (areItemStacksEqualItem(itemstack1, par1ItemStack))
{
- int k = par1ItemStack.getMaxStackSize() - itemstack1.stackSize;
- int l = Math.min(par1ItemStack.stackSize, k);
- par1ItemStack.stackSize -= l;
- itemstack1.stackSize += l;
- flag = l > 0;
+ int max = Math.min(par1ItemStack.getMaxStackSize(), par0IInventory.getInventoryStackLimit());
+ if (max > itemstack1.stackSize)
+ {
+ int l = Math.min(par1ItemStack.stackSize, max - itemstack1.stackSize);
+ par1ItemStack.stackSize -= l;
+ itemstack1.stackSize += l;
+ flag = l > 0;
+ }
}
if (flag)

View file

@ -748,7 +748,31 @@
{ {
block = null; block = null;
} }
@@ -3914,7 +4083,7 @@ @@ -3744,14 +3913,20 @@
*/
public int getIndirectPowerLevelTo(int par1, int par2, int par3, int par4)
{
- if (this.isBlockNormalCube(par1, par2, par3))
+ Block block = Block.blocksList[this.getBlockId(par1, par2, par3)];
+
+ if (block == null)
+ {
+ return 0;
+ }
+
+ if (!block.shouldCheckWeakPower(this, par1, par2, par3, par4))
{
return this.getBlockPowerInput(par1, par2, par3);
}
else
{
- int i1 = this.getBlockId(par1, par2, par3);
- return i1 == 0 ? 0 : Block.blocksList[i1].isProvidingWeakPower(this, par1, par2, par3, par4);
+ return block.isProvidingWeakPower(this, par1, par2, par3, par4);
}
}
@@ -3914,7 +4089,7 @@
*/ */
public long getSeed() public long getSeed()
{ {
@ -757,7 +781,7 @@
} }
public long getTotalWorldTime() public long getTotalWorldTime()
@@ -3924,7 +4093,7 @@ @@ -3924,7 +4099,7 @@
public long getWorldTime() public long getWorldTime()
{ {
@ -766,7 +790,7 @@
} }
/** /**
@@ -3932,7 +4101,7 @@ @@ -3932,7 +4107,7 @@
*/ */
public void setWorldTime(long par1) public void setWorldTime(long par1)
{ {
@ -775,7 +799,7 @@
} }
/** /**
@@ -3940,13 +4109,13 @@ @@ -3940,13 +4115,13 @@
*/ */
public ChunkCoordinates getSpawnPoint() public ChunkCoordinates getSpawnPoint()
{ {
@ -791,7 +815,7 @@
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@@ -3970,7 +4139,10 @@ @@ -3970,7 +4145,10 @@
if (!this.loadedEntityList.contains(par1Entity)) if (!this.loadedEntityList.contains(par1Entity))
{ {
@ -803,7 +827,7 @@
} }
} }
@@ -3978,6 +4150,11 @@ @@ -3978,6 +4156,11 @@
* Called when checking if a certain block can be mined or not. The 'spawn safe zone' check is located here. * Called when checking if a certain block can be mined or not. The 'spawn safe zone' check is located here.
*/ */
public boolean canMineBlock(EntityPlayer par1EntityPlayer, int par2, int par3, int par4) public boolean canMineBlock(EntityPlayer par1EntityPlayer, int par2, int par3, int par4)
@ -815,7 +839,7 @@
{ {
return true; return true;
} }
@@ -4098,8 +4275,7 @@ @@ -4098,8 +4281,7 @@
*/ */
public boolean isBlockHighHumidity(int par1, int par2, int par3) public boolean isBlockHighHumidity(int par1, int par2, int par3)
{ {
@ -825,7 +849,7 @@
} }
/** /**
@@ -4174,7 +4350,7 @@ @@ -4174,7 +4356,7 @@
*/ */
public int getHeight() public int getHeight()
{ {
@ -834,7 +858,7 @@
} }
/** /**
@@ -4182,7 +4358,7 @@ @@ -4182,7 +4364,7 @@
*/ */
public int getActualHeight() public int getActualHeight()
{ {
@ -843,7 +867,7 @@
} }
public IUpdatePlayerListBox getMinecartSoundUpdater(EntityMinecart par1EntityMinecart) public IUpdatePlayerListBox getMinecartSoundUpdater(EntityMinecart par1EntityMinecart)
@@ -4225,7 +4401,7 @@ @@ -4225,7 +4407,7 @@
*/ */
public double getHorizon() public double getHorizon()
{ {
@ -852,7 +876,7 @@
} }
/** /**
@@ -4294,30 +4470,28 @@ @@ -4294,30 +4476,28 @@
public void func_96440_m(int par1, int par2, int par3, int par4) public void func_96440_m(int par1, int par2, int par3, int par4)
{ {
@ -904,7 +928,7 @@
} }
} }
} }
@@ -4363,4 +4537,115 @@ @@ -4363,4 +4543,115 @@
return MathHelper.clamp_float(f, 0.0F, flag ? 1.5F : 1.0F); return MathHelper.clamp_float(f, 0.0F, flag ? 1.5F : 1.0F);
} }