160 lines
6.5 KiB
Diff
160 lines
6.5 KiB
Diff
--- ../src_base/minecraft/net/minecraft/client/Minecraft.java
|
|
+++ ../src_work/minecraft/net/minecraft/client/Minecraft.java
|
|
@@ -120,6 +120,9 @@
|
|
import net.minecraft.src.WorldInfo;
|
|
import net.minecraft.src.WorldRenderer;
|
|
import net.minecraft.src.WorldSettings;
|
|
+import net.minecraftforge.common.ForgeHooks;
|
|
+import net.minecraftforge.event.ForgeEventFactory;
|
|
+import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
|
|
|
import org.lwjgl.LWJGLException;
|
|
import org.lwjgl.Sys;
|
|
@@ -1252,7 +1255,7 @@
|
|
|
|
if (this.thePlayer.canCurrentToolHarvestBlock(var3, var4, var5))
|
|
{
|
|
- this.effectRenderer.addBlockHitEffects(var3, var4, var5, this.objectMouseOver.sideHit);
|
|
+ this.effectRenderer.addBlockHitEffects(var3, var4, var5, this.objectMouseOver);
|
|
this.thePlayer.swingItem();
|
|
}
|
|
}
|
|
@@ -1318,7 +1321,8 @@
|
|
{
|
|
int var8 = var3 != null ? var3.stackSize : 0;
|
|
|
|
- if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, var3, var4, var5, var6, var7, this.objectMouseOver.hitVec))
|
|
+ boolean result = !ForgeEventFactory.onPlayerInteract(thePlayer, Action.RIGHT_CLICK_BLOCK, var4, var5, var6, var7).isCanceled();
|
|
+ if (result && this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, var3, var4, var5, var6, var7, this.objectMouseOver.hitVec))
|
|
{
|
|
var2 = false;
|
|
this.thePlayer.swingItem();
|
|
@@ -1344,7 +1348,8 @@
|
|
{
|
|
ItemStack var9 = this.thePlayer.inventory.getCurrentItem();
|
|
|
|
- if (var9 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, var9))
|
|
+ boolean result = !ForgeEventFactory.onPlayerInteract(thePlayer, Action.RIGHT_CLICK_AIR, 0, 0, 0, -1).isCanceled();
|
|
+ if (result && var9 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, var9))
|
|
{
|
|
this.entityRenderer.itemRenderer.func_78445_c();
|
|
}
|
|
@@ -1959,6 +1964,18 @@
|
|
if (this.theIntegratedServer != null)
|
|
{
|
|
this.theIntegratedServer.initiateShutdown();
|
|
+ if (loadingScreen!=null)
|
|
+ {
|
|
+ this.loadingScreen.resetProgresAndWorkingMessage("Shutting down internal server...");
|
|
+ }
|
|
+ while (!theIntegratedServer.isServerStopped())
|
|
+ {
|
|
+ try
|
|
+ {
|
|
+ Thread.sleep(10);
|
|
+ }
|
|
+ catch (InterruptedException ie) {}
|
|
+ }
|
|
}
|
|
|
|
this.theIntegratedServer = null;
|
|
@@ -2268,95 +2285,12 @@
|
|
if (this.objectMouseOver != null)
|
|
{
|
|
boolean var1 = this.thePlayer.capabilities.isCreativeMode;
|
|
- int var3 = 0;
|
|
- boolean var4 = false;
|
|
- int var2;
|
|
int var5;
|
|
|
|
- if (this.objectMouseOver.typeOfHit == EnumMovingObjectType.TILE)
|
|
- {
|
|
- var5 = this.objectMouseOver.blockX;
|
|
- int var6 = this.objectMouseOver.blockY;
|
|
- int var7 = this.objectMouseOver.blockZ;
|
|
- Block var8 = Block.blocksList[this.theWorld.getBlockId(var5, var6, var7)];
|
|
-
|
|
- if (var8 == null)
|
|
- {
|
|
- return;
|
|
- }
|
|
-
|
|
- var2 = var8.idPicked(this.theWorld, var5, var6, var7);
|
|
-
|
|
- if (var2 == 0)
|
|
- {
|
|
- return;
|
|
- }
|
|
-
|
|
- var4 = Item.itemsList[var2].getHasSubtypes();
|
|
- int var9 = var2 < 256 && !Block.blocksList[var8.blockID].func_82505_u_() ? var2 : var8.blockID;
|
|
- var3 = Block.blocksList[var9].getDamageValue(this.theWorld, var5, var6, var7);
|
|
- }
|
|
- else
|
|
- {
|
|
- if (this.objectMouseOver.typeOfHit != EnumMovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !var1)
|
|
- {
|
|
- return;
|
|
- }
|
|
-
|
|
- if (this.objectMouseOver.entityHit instanceof EntityPainting)
|
|
- {
|
|
- var2 = Item.painting.shiftedIndex;
|
|
- }
|
|
- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame)
|
|
- {
|
|
- EntityItemFrame var10 = (EntityItemFrame)this.objectMouseOver.entityHit;
|
|
-
|
|
- if (var10.func_82335_i() == null)
|
|
- {
|
|
- var2 = Item.itemFrame.shiftedIndex;
|
|
- }
|
|
- else
|
|
- {
|
|
- var2 = var10.func_82335_i().itemID;
|
|
- var3 = var10.func_82335_i().getItemDamage();
|
|
- var4 = true;
|
|
- }
|
|
- }
|
|
- else if (this.objectMouseOver.entityHit instanceof EntityMinecart)
|
|
- {
|
|
- EntityMinecart var11 = (EntityMinecart)this.objectMouseOver.entityHit;
|
|
-
|
|
- if (var11.minecartType == 2)
|
|
- {
|
|
- var2 = Item.minecartPowered.shiftedIndex;
|
|
- }
|
|
- else if (var11.minecartType == 1)
|
|
- {
|
|
- var2 = Item.minecartCrate.shiftedIndex;
|
|
- }
|
|
- else
|
|
- {
|
|
- var2 = Item.minecartEmpty.shiftedIndex;
|
|
- }
|
|
- }
|
|
- else if (this.objectMouseOver.entityHit instanceof EntityBoat)
|
|
- {
|
|
- var2 = Item.boat.shiftedIndex;
|
|
- }
|
|
- else
|
|
- {
|
|
- var2 = Item.monsterPlacer.shiftedIndex;
|
|
- var3 = EntityList.getEntityID(this.objectMouseOver.entityHit);
|
|
- var4 = true;
|
|
-
|
|
- if (var3 <= 0 || !EntityList.entityEggs.containsKey(Integer.valueOf(var3)))
|
|
- {
|
|
- return;
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
- this.thePlayer.inventory.setCurrentItem(var2, var3, var4, var1);
|
|
+ if (!ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld))
|
|
+ {
|
|
+ return;
|
|
+ }
|
|
|
|
if (var1)
|
|
{
|