mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 00:37:52 +00:00
MinecraftForge/FML@f0bba74a47 Update for minecraft 1.5.2 MinecraftForge/FML@62fdbad74c Update MCP's md5 for the fixed srg files.
161 lines
7.6 KiB
Diff
161 lines
7.6 KiB
Diff
--- ../src_base/minecraft/net/minecraft/network/NetServerHandler.java
|
|
+++ ../src_work/minecraft/net/minecraft/network/NetServerHandler.java
|
|
@@ -65,6 +65,13 @@
|
|
import net.minecraft.util.ReportedException;
|
|
import net.minecraft.world.WorldServer;
|
|
|
|
+import net.minecraftforge.common.MinecraftForge;
|
|
+import net.minecraftforge.event.Event;
|
|
+import net.minecraftforge.event.ForgeEventFactory;
|
|
+import net.minecraftforge.event.ServerChatEvent;
|
|
+import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
|
+import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
|
+
|
|
public class NetServerHandler extends NetHandler
|
|
{
|
|
/** The underlying network manager for this server handler. */
|
|
@@ -233,6 +240,11 @@
|
|
if (this.playerEntity.ridingEntity != null)
|
|
{
|
|
this.playerEntity.ridingEntity.updateRiderPosition();
|
|
+ }
|
|
+
|
|
+ if (!this.hasMoved) //Fixes teleportation kick while riding entities
|
|
+ {
|
|
+ return;
|
|
}
|
|
|
|
this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity);
|
|
@@ -305,9 +317,9 @@
|
|
d4 = d1 - this.playerEntity.posX;
|
|
double d6 = d2 - this.playerEntity.posY;
|
|
double d7 = d3 - this.playerEntity.posZ;
|
|
- double d8 = Math.min(Math.abs(d4), Math.abs(this.playerEntity.motionX));
|
|
- double d9 = Math.min(Math.abs(d6), Math.abs(this.playerEntity.motionY));
|
|
- double d10 = Math.min(Math.abs(d7), Math.abs(this.playerEntity.motionZ));
|
|
+ double d8 = Math.max(Math.abs(d4), Math.abs(this.playerEntity.motionX));
|
|
+ double d9 = Math.max(Math.abs(d6), Math.abs(this.playerEntity.motionY));
|
|
+ double d10 = Math.max(Math.abs(d7), Math.abs(this.playerEntity.motionZ));
|
|
double d11 = d8 * d8 + d9 * d9 + d10 * d10;
|
|
|
|
if (d11 > 100.0D && (!this.mcServer.isSinglePlayer() || !this.mcServer.getServerOwner().equals(this.playerEntity.username)))
|
|
@@ -323,6 +335,11 @@
|
|
if (this.playerEntity.onGround && !par1Packet10Flying.onGround && d6 > 0.0D)
|
|
{
|
|
this.playerEntity.addExhaustion(0.2F);
|
|
+ }
|
|
+
|
|
+ if (!this.hasMoved) //Fixes "Moved Too Fast" kick when being teleported while moving
|
|
+ {
|
|
+ return;
|
|
}
|
|
|
|
this.playerEntity.moveEntity(d4, d6, d7);
|
|
@@ -347,10 +364,15 @@
|
|
this.mcServer.getLogAgent().logWarning(this.playerEntity.username + " moved wrongly!");
|
|
}
|
|
|
|
+ if (!this.hasMoved) //Fixes "Moved Too Fast" kick when being teleported while moving
|
|
+ {
|
|
+ return;
|
|
+ }
|
|
+
|
|
this.playerEntity.setPositionAndRotation(d1, d2, d3, f2, f3);
|
|
boolean flag2 = worldserver.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.boundingBox.copy().contract((double)f4, (double)f4, (double)f4)).isEmpty();
|
|
|
|
- if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping())
|
|
+ if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping() && !this.playerEntity.noClip)
|
|
{
|
|
this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, f2, f3);
|
|
return;
|
|
@@ -358,7 +380,7 @@
|
|
|
|
AxisAlignedBB axisalignedbb = this.playerEntity.boundingBox.copy().expand((double)f4, (double)f4, (double)f4).addCoord(0.0D, -0.55D, 0.0D);
|
|
|
|
- if (!this.mcServer.isFlightAllowed() && !this.playerEntity.theItemInWorldManager.isCreative() && !worldserver.checkBlockCollision(axisalignedbb))
|
|
+ if (!this.mcServer.isFlightAllowed() && !this.playerEntity.theItemInWorldManager.isCreative() && !worldserver.checkBlockCollision(axisalignedbb) && !this.playerEntity.capabilities.allowFlying)
|
|
{
|
|
if (d12 >= -0.03125D)
|
|
{
|
|
@@ -377,6 +399,11 @@
|
|
this.ticksForFloatKick = 0;
|
|
}
|
|
|
|
+ if (!this.hasMoved) //Fixes "Moved Too Fast" kick when being teleported while moving
|
|
+ {
|
|
+ return;
|
|
+ }
|
|
+
|
|
this.playerEntity.onGround = par1Packet10Flying.onGround;
|
|
this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity);
|
|
this.playerEntity.updateFlyingState(this.playerEntity.posY - d0, par1Packet10Flying.onGround);
|
|
@@ -443,7 +470,10 @@
|
|
double d2 = this.playerEntity.posZ - ((double)k + 0.5D);
|
|
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
|
|
|
- if (d3 > 36.0D)
|
|
+ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1;
|
|
+ dist *= dist;
|
|
+
|
|
+ if (d3 > dist)
|
|
{
|
|
return;
|
|
}
|
|
@@ -503,7 +533,11 @@
|
|
return;
|
|
}
|
|
|
|
- this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack);
|
|
+ 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, worldserver, itemstack);
|
|
+ }
|
|
}
|
|
else if (par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit() - 1 && (par1Packet15Place.getDirection() == 1 || par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit()))
|
|
{
|
|
@@ -512,7 +546,9 @@
|
|
}
|
|
else
|
|
{
|
|
- if (this.hasMoved && this.playerEntity.getDistanceSq((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D) < 64.0D && !this.mcServer.func_96290_a(worldserver, i, j, k, this.playerEntity))
|
|
+ double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1;
|
|
+ dist *= dist;
|
|
+ if (this.hasMoved && this.playerEntity.getDistanceSq((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D) < dist && !this.mcServer.func_96290_a(worldserver, i, j, k, this.playerEntity))
|
|
{
|
|
this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, i, j, k, l, par1Packet15Place.getXOffset(), par1Packet15Place.getYOffset(), par1Packet15Place.getZOffset());
|
|
}
|
|
@@ -691,7 +727,14 @@
|
|
return;
|
|
}
|
|
|
|
+ String old = s;
|
|
s = "<" + this.playerEntity.getTranslatedEntityName() + "> " + s;
|
|
+ ServerChatEvent event = new ServerChatEvent(this.playerEntity, old, s);
|
|
+ if (MinecraftForge.EVENT_BUS.post(event))
|
|
+ {
|
|
+ return;
|
|
+ }
|
|
+ s = event.line;
|
|
this.mcServer.getLogAgent().logInfo(s);
|
|
this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new Packet3Chat(s, false));
|
|
}
|
|
@@ -822,7 +865,7 @@
|
|
return;
|
|
}
|
|
|
|
- this.playerEntity = this.mcServer.getConfigurationManager().respawnPlayer(this.playerEntity, 0, false);
|
|
+ this.playerEntity = this.mcServer.getConfigurationManager().respawnPlayer(this.playerEntity, playerEntity.dimension, false);
|
|
}
|
|
}
|
|
}
|
|
@@ -1220,7 +1263,7 @@
|
|
}
|
|
}
|
|
}
|
|
-
|
|
+
|
|
|
|
@Override
|
|
|