From 56611cd44bd991c2509df61209c7953b47ce2ed2 Mon Sep 17 00:00:00 2001 From: asofold Date: Sat, 12 Jul 2014 18:02:04 +0200 Subject: [PATCH] [BLEEDING] Set CompatCBDev to CB for MC 1.7.10. --- NCPCompatCBDev/pom.xml | 2 +- .../compat/cbdev/BlockCacheCBDev.java | 30 +++++++++------- .../compat/cbdev/MCAccessCBDev.java | 34 +++++++++---------- .../nocheatplus/compat/MCAccessFactory.java | 13 ++++--- 4 files changed, 41 insertions(+), 38 deletions(-) diff --git a/NCPCompatCBDev/pom.xml b/NCPCompatCBDev/pom.xml index b88485c6..413d78a2 100644 --- a/NCPCompatCBDev/pom.xml +++ b/NCPCompatCBDev/pom.xml @@ -22,7 +22,7 @@ org.bukkit craftbukkit - 1.7.9-R0.2 + 1.7.10-R0.1-SNAPSHOT diff --git a/NCPCompatCBDev/src/main/java/fr/neatmonster/nocheatplus/compat/cbdev/BlockCacheCBDev.java b/NCPCompatCBDev/src/main/java/fr/neatmonster/nocheatplus/compat/cbdev/BlockCacheCBDev.java index 37600135..0d9820d6 100644 --- a/NCPCompatCBDev/src/main/java/fr/neatmonster/nocheatplus/compat/cbdev/BlockCacheCBDev.java +++ b/NCPCompatCBDev/src/main/java/fr/neatmonster/nocheatplus/compat/cbdev/BlockCacheCBDev.java @@ -3,15 +3,15 @@ package fr.neatmonster.nocheatplus.compat.cbdev; import java.util.Iterator; import java.util.List; -import net.minecraft.server.v1_7_R3.AxisAlignedBB; -import net.minecraft.server.v1_7_R3.Block; -import net.minecraft.server.v1_7_R3.EntityBoat; -import net.minecraft.server.v1_7_R3.IBlockAccess; -import net.minecraft.server.v1_7_R3.TileEntity; +import net.minecraft.server.v1_7_R4.AxisAlignedBB; +import net.minecraft.server.v1_7_R4.Block; +import net.minecraft.server.v1_7_R4.EntityBoat; +import net.minecraft.server.v1_7_R4.IBlockAccess; +import net.minecraft.server.v1_7_R4.TileEntity; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_7_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; import org.bukkit.entity.Entity; import fr.neatmonster.nocheatplus.utilities.BlockCache; @@ -21,7 +21,7 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{ /** Box for one time use, no nesting, no extra storing this(!). */ protected static final AxisAlignedBB useBox = AxisAlignedBB.a(0, 0, 0, 0, 0, 0); - protected net.minecraft.server.v1_7_R3.WorldServer world; + protected net.minecraft.server.v1_7_R4.WorldServer world; public BlockCacheCBDev(World world) { setAccess(world); @@ -52,8 +52,10 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{ // TODO: change api for this / use nodes (!) final int id = getTypeId(x, y, z); - final net.minecraft.server.v1_7_R3.Block block = net.minecraft.server.v1_7_R3.Block.e(id); - if (block == null) return null; + final net.minecraft.server.v1_7_R4.Block block = net.minecraft.server.v1_7_R4.Block.getById(id); + if (block == null) { + return null; + } block.updateShape(this, x, y, z); // TODO: use THIS instead of world. // minX, minY, minZ, maxX, maxY, maxZ @@ -65,7 +67,7 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{ try{ // TODO: Probably check other ids too before doing this ? - final net.minecraft.server.v1_7_R3.Entity mcEntity = ((CraftEntity) entity).getHandle(); + final net.minecraft.server.v1_7_R4.Entity mcEntity = ((CraftEntity) entity).getHandle(); final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ); @SuppressWarnings("rawtypes") @@ -73,7 +75,7 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{ @SuppressWarnings("rawtypes") final Iterator iterator = list.iterator(); while (iterator.hasNext()) { - final net.minecraft.server.v1_7_R3.Entity other = (net.minecraft.server.v1_7_R3.Entity) iterator.next(); + final net.minecraft.server.v1_7_R4.Entity other = (net.minecraft.server.v1_7_R4.Entity) iterator.next(); if (!(other instanceof EntityBoat)){ // && !(other instanceof EntityMinecart)) continue; continue; } @@ -82,7 +84,9 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{ } // Still check this for some reason. final AxisAlignedBB otherBox = other.boundingBox; - if (box.a > otherBox.d || box.d < otherBox.a || box.b > otherBox.e || box.e < otherBox.b || box.c > otherBox.f || box.f < otherBox.c) continue; + if (box.a > otherBox.d || box.d < otherBox.a || box.b > otherBox.e || box.e < otherBox.b || box.c > otherBox.f || box.f < otherBox.c) { + continue; + } else { return true; } diff --git a/NCPCompatCBDev/src/main/java/fr/neatmonster/nocheatplus/compat/cbdev/MCAccessCBDev.java b/NCPCompatCBDev/src/main/java/fr/neatmonster/nocheatplus/compat/cbdev/MCAccessCBDev.java index 785a0368..dfc43bf3 100644 --- a/NCPCompatCBDev/src/main/java/fr/neatmonster/nocheatplus/compat/cbdev/MCAccessCBDev.java +++ b/NCPCompatCBDev/src/main/java/fr/neatmonster/nocheatplus/compat/cbdev/MCAccessCBDev.java @@ -1,19 +1,19 @@ package fr.neatmonster.nocheatplus.compat.cbdev; -import net.minecraft.server.v1_7_R3.AxisAlignedBB; -import net.minecraft.server.v1_7_R3.Block; -import net.minecraft.server.v1_7_R3.DamageSource; -import net.minecraft.server.v1_7_R3.EntityComplexPart; -import net.minecraft.server.v1_7_R3.EntityPlayer; -import net.minecraft.server.v1_7_R3.MobEffectList; +import net.minecraft.server.v1_7_R4.AxisAlignedBB; +import net.minecraft.server.v1_7_R4.Block; +import net.minecraft.server.v1_7_R4.DamageSource; +import net.minecraft.server.v1_7_R4.EntityComplexPart; +import net.minecraft.server.v1_7_R4.EntityPlayer; +import net.minecraft.server.v1_7_R4.MobEffectList; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.command.CommandMap; -import org.bukkit.craftbukkit.v1_7_R3.CraftServer; -import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R4.CraftServer; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -30,22 +30,22 @@ public class MCAccessCBDev implements MCAccess{ */ public MCAccessCBDev() { getCommandMap(); - ReflectionUtil.checkMembers("net.minecraft.server.v1_7_R3.", new String[] {"Entity" , "dead"}); + ReflectionUtil.checkMembers("net.minecraft.server.v1_7_R4.", new String[] {"Entity" , "dead"}); // block bounds, original: minX, maxX, minY, maxY, minZ, maxZ - ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_7_R3.Block.class, + ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_7_R4.Block.class, new String[]{"x", "y", "z", "A", "B", "C"}, double.class); // TODO: Nail it down further. } @Override public String getMCVersion() { - // 1_7_R3 - return "1.7.8|1.7.9"; + // 1_7_R4 + return "1.7.10"; } @Override public String getServerVersionTag() { - return "CB3043-DEV"; + return "CB3100-DEV"; } @Override @@ -60,7 +60,7 @@ public class MCAccessCBDev implements MCAccess{ @Override public double getHeight(final Entity entity) { - final net.minecraft.server.v1_7_R3.Entity mcEntity = ((CraftEntity) entity).getHandle(); + final net.minecraft.server.v1_7_R4.Entity mcEntity = ((CraftEntity) entity).getHandle(); final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.height, mcEntity.boundingBox.e - mcEntity.boundingBox.b)); if (entity instanceof LivingEntity) { return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight); @@ -69,7 +69,7 @@ public class MCAccessCBDev implements MCAccess{ @Override public AlmostBoolean isBlockSolid(final int id) { - final Block block = Block.e(id); + final Block block = Block.getById(id); if (block == null || block.getMaterial() == null) { return AlmostBoolean.MAYBE; } @@ -80,7 +80,7 @@ public class MCAccessCBDev implements MCAccess{ @Override public AlmostBoolean isBlockLiquid(final int id) { - final Block block = Block.e(id); + final Block block = Block.getById(id); if (block == null || block.getMaterial() == null) { return AlmostBoolean.MAYBE; } diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/compat/MCAccessFactory.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/compat/MCAccessFactory.java index cb11fb9f..94f7fcef 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/compat/MCAccessFactory.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/compat/MCAccessFactory.java @@ -58,14 +58,13 @@ public class MCAccessFactory { // TEMP // // Only add as long as no stable module has been added. - // Note: 1_7_R4 is build 3100 :p // 1.7.10 -// try{ -// return new MCAccessCBDev(); -// } -// catch(Throwable t) { -// throwables.add(t); -// }; + try{ + return new MCAccessCBDev(); + } + catch(Throwable t) { + throwables.add(t); + }; // TEMP END // // 1.7.8|1.7.9