Missing updates from last commit
This commit is contained in:
parent
0e5c0be23e
commit
6ec887b34f
2 changed files with 64 additions and 26 deletions
|
@ -18,11 +18,12 @@
|
|||
/** The world object that this object is connected to. */
|
||||
public World theWorld;
|
||||
|
||||
@@ -134,6 +144,12 @@
|
||||
@@ -134,6 +144,13 @@
|
||||
{
|
||||
if (!this.gameType.isAdventure())
|
||||
{
|
||||
+ if (!ForgeEventFactory.onPlayerInteract(thisPlayerMP, Action.LEFT_CLICK_BLOCK, par1, par2, par3, par4))
|
||||
+ PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(thisPlayerMP, Action.LEFT_CLICK_BLOCK, par1, par2, par3, par4);
|
||||
+ if (event.isCanceled())
|
||||
+ {
|
||||
+ thisPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(par1, par2, par3, theWorld));
|
||||
+ return;
|
||||
|
@ -31,7 +32,46 @@
|
|||
if (this.isCreative())
|
||||
{
|
||||
if (!this.theWorld.extinguishFire((EntityPlayer)null, par1, par2, par3, par4))
|
||||
@@ -225,7 +241,7 @@
|
||||
@@ -143,15 +160,32 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
- this.theWorld.extinguishFire(this.thisPlayerMP, par1, par2, par3, par4);
|
||||
this.initialDamage = this.curblockDamage;
|
||||
float var5 = 1.0F;
|
||||
int var6 = this.theWorld.getBlockId(par1, par2, par3);
|
||||
-
|
||||
- if (var6 > 0)
|
||||
- {
|
||||
- Block.blocksList[var6].onBlockClicked(this.theWorld, par1, par2, par3, this.thisPlayerMP);
|
||||
- var5 = Block.blocksList[var6].getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, par1, par2, par3);
|
||||
+ Block block = Block.blocksList[var6];
|
||||
+
|
||||
+ if (block != null)
|
||||
+ {
|
||||
+ if (event.useBlock != Event.Result.DENY)
|
||||
+ {
|
||||
+ block.onBlockClicked(theWorld, par1, par2, par3, thisPlayerMP);
|
||||
+ theWorld.extinguishFire(thisPlayerMP, par1, par2, par3, par4);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ thisPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(par1, par2, par3, theWorld));
|
||||
+ }
|
||||
+ var5 = block.getPlayerRelativeBlockHardness(thisPlayerMP, thisPlayerMP.worldObj, par1, par2, par3);
|
||||
+ }
|
||||
+
|
||||
+ if (event.useItem == Event.Result.DENY)
|
||||
+ {
|
||||
+ if (var5 >= 1.0f)
|
||||
+ {
|
||||
+ thisPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(par1, par2, par3, theWorld));
|
||||
+ }
|
||||
+ return;
|
||||
}
|
||||
|
||||
if (var6 > 0 && var5 >= 1.0F)
|
||||
@@ -225,7 +259,7 @@
|
||||
var4.onBlockHarvested(this.theWorld, par1, par2, par3, var5, this.thisPlayerMP);
|
||||
}
|
||||
|
||||
|
@ -40,7 +80,7 @@
|
|||
|
||||
if (var4 != null && var6)
|
||||
{
|
||||
@@ -246,19 +262,30 @@
|
||||
@@ -246,19 +280,30 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -73,7 +113,7 @@
|
|||
|
||||
if (var7 != null)
|
||||
{
|
||||
@@ -267,9 +294,11 @@
|
||||
@@ -267,9 +312,11 @@
|
||||
if (var7.stackSize == 0)
|
||||
{
|
||||
this.thisPlayerMP.destroyCurrentEquippedItem();
|
||||
|
@ -85,7 +125,7 @@
|
|||
if (var6 && var8)
|
||||
{
|
||||
Block.blocksList[var4].harvestBlock(this.theWorld, this.thisPlayerMP, par1, par2, par3, var5);
|
||||
@@ -306,6 +335,7 @@
|
||||
@@ -306,6 +353,7 @@
|
||||
if (var6.stackSize == 0)
|
||||
{
|
||||
par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = null;
|
||||
|
@ -93,7 +133,7 @@
|
|||
}
|
||||
|
||||
return true;
|
||||
@@ -318,29 +348,54 @@
|
||||
@@ -318,29 +366,54 @@
|
||||
*/
|
||||
public boolean activateBlockOrUseItem(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
|
@ -170,7 +210,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
@@ -350,4 +405,13 @@
|
||||
@@ -350,4 +423,13 @@
|
||||
{
|
||||
this.theWorld = par1WorldServer;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
--- ../src_base/common/net/minecraft/src/NetServerHandler.java
|
||||
+++ ../src_work/common/net/minecraft/src/NetServerHandler.java
|
||||
@@ -10,6 +10,8 @@
|
||||
@@ -10,6 +10,10 @@
|
||||
|
||||
import cpw.mods.fml.common.network.FMLNetworkHandler;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraftforge.event.Event;
|
||||
+import net.minecraftforge.event.ForgeEventFactory;
|
||||
+import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
+import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||
|
||||
public class NetServerHandler extends NetHandler
|
||||
{
|
||||
@@ -310,7 +312,7 @@
|
||||
@@ -310,7 +314,7 @@
|
||||
this.playerEntity.setPositionAndRotation(var5, var7, var9, var11, var12);
|
||||
boolean var32 = var2.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.boundingBox.copy().contract((double)var27, (double)var27, (double)var27)).isEmpty();
|
||||
|
||||
|
@ -18,7 +20,7 @@
|
|||
{
|
||||
this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, var11, var12);
|
||||
return;
|
||||
@@ -318,7 +320,7 @@
|
||||
@@ -318,7 +322,7 @@
|
||||
|
||||
AxisAlignedBB var33 = this.playerEntity.boundingBox.copy().expand((double)var27, (double)var27, (double)var27).addCoord(0.0D, -0.55D, 0.0D);
|
||||
|
||||
|
@ -27,7 +29,7 @@
|
|||
{
|
||||
if (var29 >= -0.03125D)
|
||||
{
|
||||
@@ -395,7 +397,10 @@
|
||||
@@ -395,7 +399,10 @@
|
||||
double var12 = this.playerEntity.posZ - ((double)var7 + 0.5D);
|
||||
double var14 = var8 * var8 + var10 * var10 + var12 * var12;
|
||||
|
||||
|
@ -39,36 +41,32 @@
|
|||
{
|
||||
return;
|
||||
}
|
||||
@@ -417,7 +422,7 @@
|
||||
@@ -417,8 +424,9 @@
|
||||
|
||||
if (par1Packet14BlockDig.status == 0)
|
||||
{
|
||||
- if (var20 <= 16 && !var3)
|
||||
- {
|
||||
+ if (var20 <= mcServer.spawnProtectionSize && !var3)
|
||||
{
|
||||
+ {
|
||||
+ ForgeEventFactory.onPlayerInteract(playerEntity, Action.LEFT_CLICK_BLOCK, var5, var6, var7, 0);
|
||||
this.playerEntity.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(var5, var6, var7, var2));
|
||||
}
|
||||
@@ -463,6 +468,7 @@
|
||||
|
||||
public void handlePlace(Packet15Place par1Packet15Place)
|
||||
{
|
||||
+ System.out.println("15: " + par1Packet15Place.creationTimeMillis);
|
||||
WorldServer var2 = this.mcServer.worldServerForDimension(this.playerEntity.dimension);
|
||||
ItemStack var3 = this.playerEntity.inventory.getCurrentItem();
|
||||
boolean var4 = false;
|
||||
@@ -479,7 +485,10 @@
|
||||
else
|
||||
@@ -479,7 +487,11 @@
|
||||
return;
|
||||
}
|
||||
|
||||
- this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, var2, var3);
|
||||
+ if (ForgeEventFactory.onPlayerInteract(playerEntity, PlayerInteractEvent.Action.RIGHT_CLICK_AIR, 0, 0, 0, -1))
|
||||
+ PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(playerEntity, PlayerInteractEvent.Action.RIGHT_CLICK_AIR, 0, 0, 0, -1);
|
||||
+ if (event.useItem != Event.Result.DENY)
|
||||
+ {
|
||||
+ this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, var2, var3);
|
||||
+ }
|
||||
}
|
||||
else if (par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit() - 1 && (par1Packet15Place.getDirection() == 1 || par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit()))
|
||||
{
|
||||
@@ -497,7 +506,9 @@
|
||||
@@ -497,7 +509,9 @@
|
||||
var12 = var11;
|
||||
}
|
||||
|
||||
|
@ -79,7 +77,7 @@
|
|||
{
|
||||
this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, var2, var3, var5, var6, var7, var8, par1Packet15Place.getXOffset(), par1Packet15Place.getYOffset(), par1Packet15Place.getZOffset());
|
||||
}
|
||||
@@ -798,7 +809,7 @@
|
||||
@@ -798,7 +812,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue