Bleeding: Quick adaption to CB 2406.

This commit is contained in:
asofold 2012-10-28 04:45:47 +01:00
parent 2cd43c2728
commit 9d046d3298
4 changed files with 31 additions and 12 deletions

View File

@ -1,7 +1,6 @@
package fr.neatmonster.nocheatplus.checks.fight;
import net.minecraft.server.Entity;
import net.minecraft.server.EntityComplex;
import net.minecraft.server.EntityComplexPart;
import org.bukkit.Location;
@ -49,7 +48,8 @@ public class Direction extends Check {
boolean cancel = false;
// Safeguard, if entity is complex, this check will fail due to giant and hard to define hitboxes.
if (damaged instanceof EntityComplex || damaged instanceof EntityComplexPart)
// if (damaged instanceof EntityComplex || damaged instanceof EntityComplexPart)
if (damaged instanceof EntityComplexPart)
return false;
// Find out how wide the entity is.

View File

@ -1,7 +1,6 @@
package fr.neatmonster.nocheatplus.net;
import java.lang.reflect.Field;
import java.util.List;
import net.minecraft.server.AxisAlignedBB;
import net.minecraft.server.EntityPlayer;
@ -82,11 +81,13 @@ public class NCPNetServerHandler extends NetServerHandler {
final NCPNetServerHandler customNSH = new NCPNetServerHandler(MinecraftServer.getServer(),
vanillaNSH.networkManager, entityPlayer, useProxy ? vanillaNSH : null);
customNSH.a(entityPlayer.locX, entityPlayer.locY, entityPlayer.locZ, entityPlayer.yaw, entityPlayer.pitch);
MinecraftServer.getServer().ac().a(customNSH);
// TODO: MC method changed.
// MinecraftServer.getServer().ac().a(customNSH);
try {
final Field connectionsField = ServerConnection.class.getDeclaredField("d");
connectionsField.setAccessible(true);
((List<?>) connectionsField.get(MinecraftServer.getServer().ac())).remove(vanillaNSH);
// TODO: MC method changed.
// ((List<?>) connectionsField.get(MinecraftServer.getServer().ac())).remove(vanillaNSH);
} catch (final Exception e) {
e.printStackTrace();
}

View File

@ -6,6 +6,7 @@ import java.util.Map;
import net.minecraft.server.IBlockAccess;
import net.minecraft.server.Material;
import net.minecraft.server.TileEntity;
import net.minecraft.server.Vec3DPool;
import org.bukkit.World;
import org.bukkit.craftbukkit.CraftWorld;
@ -157,5 +158,15 @@ public class BlockCache implements IBlockAccess{
public boolean s(int arg0, int arg1, int arg2) {
return access.s(arg0, arg1, arg2);
}
@Override
public Vec3DPool getVec3DPool() {
return access.getVec3DPool();
}
@Override
public boolean isBlockFacePowered(int arg0, int arg1, int arg2, int arg3) {
return access.isBlockFacePowered(arg0, arg1, arg2, arg3);
}
}

View File

@ -521,7 +521,7 @@ public class BlockProperties {
else if (all) CheckUtils.logInfo(i + ": (" + mat + ") " + blocks[i].toString());
}
if (!missing.isEmpty()){
Bukkit.getLogger().warning("[NoCheatPlus] The block breaking data is incomplete, interpret some as stone :");
Bukkit.getLogger().warning("[NoCheatPlus] The block breaking data is incomplete, default to allow instant breaking:");
CheckUtils.logWarning("--- Missing entries -------------------------------");
for (String spec : missing){
CheckUtils.logWarning(spec);
@ -900,7 +900,8 @@ public class BlockProperties {
final double fx = x - bx;
final double fy = y - by;
final double fz = z - bz;
if (fx < block.minX || fx >= block.maxX || fy < block.minY || fy >= block.maxY || fz < block.minZ || fz >= block.maxZ) return true;
// if (fx < block.minX || fx >= block.maxX || fy < block.minY || fy >= block.maxY || fz < block.minZ || fz >= block.maxZ) return true;
if (fx < block.v() || fx >= block.w() || fy < block.x() || fy >= block.y() || fz < block.z() || fz >= block.A()) return true;
else{
// Workarounds (might get generalized some time).
if (isStairs(id)){
@ -1055,10 +1056,17 @@ public class BlockProperties {
// TODO: use internal block data unless delegation wanted?
final Block block = Block.byId[id];
block.updateShape(access, x, y, z);
if ((blockFlags[id] & F_HEIGHT150) != 0) block.maxY = 1.5;
if (minX > block.maxX + x || maxX < block.minX + x) return false;
else if (minY > block.maxY + y || maxY < block.minY + y) return false;
else if (minZ > block.maxZ + z || maxZ < block.minZ + z) return false;
final double bmaxY;
// if ((blockFlags[id] & F_HEIGHT150) != 0) block.maxY = 1.5;
if ((blockFlags[id] & F_HEIGHT150) != 0) bmaxY = 1.5;
else bmaxY = block.y(); // maxY
// if (minX > block.maxX + x || maxX < block.minX + x) return false;
// else if (minY > block.maxY + y || maxY < block.minY + y) return false;
// else if (minZ > block.maxZ + z || maxZ < block.minZ + z) return false;
if (minX > block.w() + x || maxX < block.v() + x) return false;
else if (minY > bmaxY + y || maxY < block.x() + y) return false;
else if (minZ > block.A() + z || maxZ < block.z() + z) return false;
else return true;
}
@ -1152,5 +1160,4 @@ public class BlockProperties {
}
return false;
}
}