From 9d046d3298143ffdcdbdbc062e53deec457d1216 Mon Sep 17 00:00:00 2001 From: asofold Date: Sun, 28 Oct 2012 04:45:47 +0100 Subject: [PATCH] Bleeding: Quick adaption to CB 2406. --- .../nocheatplus/checks/fight/Direction.java | 4 ++-- .../nocheatplus/net/NCPNetServerHandler.java | 7 ++++--- .../nocheatplus/utilities/BlockCache.java | 11 ++++++++++ .../utilities/BlockProperties.java | 21 ++++++++++++------- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/fr/neatmonster/nocheatplus/checks/fight/Direction.java b/src/fr/neatmonster/nocheatplus/checks/fight/Direction.java index b77f83ab..d349c38b 100644 --- a/src/fr/neatmonster/nocheatplus/checks/fight/Direction.java +++ b/src/fr/neatmonster/nocheatplus/checks/fight/Direction.java @@ -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. diff --git a/src/fr/neatmonster/nocheatplus/net/NCPNetServerHandler.java b/src/fr/neatmonster/nocheatplus/net/NCPNetServerHandler.java index 7f33c2b1..011aec76 100644 --- a/src/fr/neatmonster/nocheatplus/net/NCPNetServerHandler.java +++ b/src/fr/neatmonster/nocheatplus/net/NCPNetServerHandler.java @@ -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(); } diff --git a/src/fr/neatmonster/nocheatplus/utilities/BlockCache.java b/src/fr/neatmonster/nocheatplus/utilities/BlockCache.java index 57b9e67b..43a67900 100644 --- a/src/fr/neatmonster/nocheatplus/utilities/BlockCache.java +++ b/src/fr/neatmonster/nocheatplus/utilities/BlockCache.java @@ -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); + } } diff --git a/src/fr/neatmonster/nocheatplus/utilities/BlockProperties.java b/src/fr/neatmonster/nocheatplus/utilities/BlockProperties.java index db9b3596..8371b365 100644 --- a/src/fr/neatmonster/nocheatplus/utilities/BlockProperties.java +++ b/src/fr/neatmonster/nocheatplus/utilities/BlockProperties.java @@ -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; } - }