[BLIND/BLIEEDING/INSTABLE/INCOMPLETE] Secrets (read below).

Does this even compile anywhere?
This commit is contained in:
asofold 2013-12-01 20:56:00 +01:00
parent 71b37aab7b
commit fd33820c8e
4 changed files with 53 additions and 57 deletions

View File

@ -22,12 +22,12 @@
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId> <artifactId>craftbukkit</artifactId>
<version>1.6.4-R0.1-SNAPSHOT</version> <version>1.7.2-R0.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId> <artifactId>bukkit</artifactId>
<version>1.6.4-R0.1-SNAPSHOT</version> <version>1.7.2-R0.1-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -3,16 +3,16 @@ package fr.neatmonster.nocheatplus.compat.cbdev;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import net.minecraft.server.v1_6_R3.AxisAlignedBB; import net.minecraft.server.v1_7_R1.AxisAlignedBB;
import net.minecraft.server.v1_6_R3.EntityBoat; import net.minecraft.server.v1_7_R1.Block;
import net.minecraft.server.v1_6_R3.IBlockAccess; import net.minecraft.server.v1_7_R1.EntityBoat;
import net.minecraft.server.v1_6_R3.Material; import net.minecraft.server.v1_7_R1.IBlockAccess;
import net.minecraft.server.v1_6_R3.TileEntity; import net.minecraft.server.v1_7_R1.TileEntity;
import net.minecraft.server.v1_6_R3.Vec3DPool; import net.minecraft.server.v1_7_R1.Vec3DPool;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import fr.neatmonster.nocheatplus.utilities.BlockCache; import fr.neatmonster.nocheatplus.utilities.BlockCache;
@ -22,7 +22,7 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{
/** Box for one time use, no nesting, no extra storing this(!). */ /** 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 static final AxisAlignedBB useBox = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
protected net.minecraft.server.v1_6_R3.World world; protected net.minecraft.server.v1_7_R1.WorldServer world;
public BlockCacheCBDev(World world) { public BlockCacheCBDev(World world) {
setAccess(world); setAccess(world);
@ -48,12 +48,12 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{
// TODO: change api for this / use nodes (!) // TODO: change api for this / use nodes (!)
final int id = getTypeId(x, y, z); final int id = getTypeId(x, y, z);
final net.minecraft.server.v1_6_R3.Block block = net.minecraft.server.v1_6_R3.Block.byId[id]; final net.minecraft.server.v1_7_R1.Block block = net.minecraft.server.v1_7_R1.Block.e(id);
if (block == null) return null; if (block == null) return null;
block.updateShape(this, x, y, z); // TODO: use THIS instead of world. block.updateShape(this, x, y, z); // TODO: use THIS instead of world.
// minX, minY, minZ, maxX, maxY, maxZ // minX, minY, minZ, maxX, maxY, maxZ
return new double[]{block.u(), block.w(), block.y(), block.v(), block.x(), block.z()}; return new double[]{block.x(), block.z(), block.B(), block.y(), block.A(), block.C()};
} }
@Override @Override
@ -61,7 +61,7 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{
try{ try{
// TODO: Probably check other ids too before doing this ? // TODO: Probably check other ids too before doing this ?
final net.minecraft.server.v1_6_R3.Entity mcEntity = ((CraftEntity) entity).getHandle(); final net.minecraft.server.v1_7_R1.Entity mcEntity = ((CraftEntity) entity).getHandle();
final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ); final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ);
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@ -69,7 +69,7 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
final Iterator iterator = list.iterator(); final Iterator iterator = list.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
final net.minecraft.server.v1_6_R3.Entity other = (net.minecraft.server.v1_6_R3.Entity) iterator.next(); final net.minecraft.server.v1_7_R1.Entity other = (net.minecraft.server.v1_7_R1.Entity) iterator.next();
if (!(other instanceof EntityBoat)){ // && !(other instanceof EntityMinecart)) continue; if (!(other instanceof EntityBoat)){ // && !(other instanceof EntityMinecart)) continue;
continue; continue;
} }
@ -99,11 +99,6 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{
world = null; world = null;
} }
@Override
public Material getMaterial(final int x, final int y, final int z) {
return world.getMaterial(x, y, z);
}
@Override @Override
public TileEntity getTileEntity(final int x, final int y, final int z) { public TileEntity getTileEntity(final int x, final int y, final int z) {
return world.getTileEntity(x, y, z); return world.getTileEntity(x, y, z);
@ -120,8 +115,8 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{
} }
@Override @Override
public boolean u(final int arg0, final int arg1, final int arg2) { public Block getType(int x, int y, int z) {
return world.u(arg0, arg1, arg2); return world.getType(x, y, z);
} }
} }

View File

@ -1,19 +1,19 @@
package fr.neatmonster.nocheatplus.compat.cbdev; package fr.neatmonster.nocheatplus.compat.cbdev;
import net.minecraft.server.v1_6_R3.AxisAlignedBB; import net.minecraft.server.v1_7_R1.AxisAlignedBB;
import net.minecraft.server.v1_6_R3.Block; import net.minecraft.server.v1_7_R1.Block;
import net.minecraft.server.v1_6_R3.DamageSource; import net.minecraft.server.v1_7_R1.DamageSource;
import net.minecraft.server.v1_6_R3.EntityComplexPart; import net.minecraft.server.v1_7_R1.EntityComplexPart;
import net.minecraft.server.v1_6_R3.EntityPlayer; import net.minecraft.server.v1_7_R1.EntityPlayer;
import net.minecraft.server.v1_6_R3.MobEffectList; import net.minecraft.server.v1_7_R1.MobEffectList;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.CommandMap; import org.bukkit.command.CommandMap;
import org.bukkit.craftbukkit.v1_6_R3.CraftServer; import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -30,22 +30,22 @@ public class MCAccessCBDev implements MCAccess{
*/ */
public MCAccessCBDev(){ public MCAccessCBDev(){
getCommandMap(); getCommandMap();
ReflectionUtil.checkMembers("net.minecraft.server.v1_6_R3.", new String[]{"Entity" , "dead"}); ReflectionUtil.checkMembers("net.minecraft.server.v1_7_R1.", new String[]{"Entity" , "dead"});
// block bounds, original: minX, maxX, minY, maxY, minZ, maxZ // block bounds, original: minX, maxX, minY, maxY, minZ, maxZ
ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_6_R3.Block.class, ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_7_R1.Block.class,
new String[]{"u", "v", "w", "x", "y", "z"}, double.class); new String[]{"x", "y", "z", "A", "B", "C"}, double.class);
// TODO: Nail it down further. // TODO: Nail it down further.
} }
@Override @Override
public String getMCVersion() { public String getMCVersion() {
// 1_6_R3 // 1_7_R1
return "1.6.4"; return "1.7.2";
} }
@Override @Override
public String getServerVersionTag() { public String getServerVersionTag() {
return "CB2882-DEV"; return "CB2922-DEV";
} }
@Override @Override
@ -60,7 +60,7 @@ public class MCAccessCBDev implements MCAccess{
@Override @Override
public double getHeight(final Entity entity) { public double getHeight(final Entity entity) {
final net.minecraft.server.v1_6_R3.Entity mcEntity = ((CraftEntity) entity).getHandle(); final net.minecraft.server.v1_7_R1.Entity mcEntity = ((CraftEntity) entity).getHandle();
final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.height, mcEntity.boundingBox.e - mcEntity.boundingBox.b)); final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.height, mcEntity.boundingBox.e - mcEntity.boundingBox.b));
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight); return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight);
@ -69,16 +69,16 @@ public class MCAccessCBDev implements MCAccess{
@Override @Override
public AlmostBoolean isBlockSolid(final int id) { public AlmostBoolean isBlockSolid(final int id) {
final Block block = Block.byId[id]; final Block block = Block.e(id);
if (block == null || block.material == null) return AlmostBoolean.MAYBE; if (block == null || block.getMaterial() == null) return AlmostBoolean.MAYBE;
else return AlmostBoolean.match(block.material.isSolid()); else return AlmostBoolean.match(block.getMaterial().isSolid());
} }
@Override @Override
public AlmostBoolean isBlockLiquid(final int id) { public AlmostBoolean isBlockLiquid(final int id) {
final Block block = Block.byId[id]; final Block block = Block.e(id);
if (block == null || block.material == null) return AlmostBoolean.MAYBE; if (block == null || block.getMaterial() == null) return AlmostBoolean.MAYBE;
else return AlmostBoolean.match(block.material.isLiquid()); else return AlmostBoolean.match(block.getMaterial().isLiquid());
} }
@Override @Override
@ -103,7 +103,7 @@ public class MCAccessCBDev implements MCAccess{
@Override @Override
public double getJumpAmplifier(final Player player) { public double getJumpAmplifier(final Player player) {
final net.minecraft.server.v1_6_R3.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); final net.minecraft.server.v1_7_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier(); if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
else return Double.NEGATIVE_INFINITY; else return Double.NEGATIVE_INFINITY;
@ -111,7 +111,7 @@ public class MCAccessCBDev implements MCAccess{
@Override @Override
public double getFasterMovementAmplifier(final Player player) { public double getFasterMovementAmplifier(final Player player) {
final net.minecraft.server.v1_6_R3.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); final net.minecraft.server.v1_7_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier(); if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
else return Double.NEGATIVE_INFINITY; else return Double.NEGATIVE_INFINITY;
} }
@ -138,13 +138,13 @@ public class MCAccessCBDev implements MCAccess{
@Override @Override
public boolean shouldBeZombie(final Player player) { public boolean shouldBeZombie(final Player player) {
final net.minecraft.server.v1_6_R3.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); final net.minecraft.server.v1_7_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ; return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ;
} }
@Override @Override
public void setDead(final Player player, final int deathTicks) { public void setDead(final Player player, final int deathTicks) {
final net.minecraft.server.v1_6_R3.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); final net.minecraft.server.v1_7_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
mcPlayer.deathTicks = deathTicks; mcPlayer.deathTicks = deathTicks;
mcPlayer.dead = true; mcPlayer.dead = true;
} }

View File

@ -14,6 +14,7 @@ import fr.neatmonster.nocheatplus.compat.cb2763.MCAccessCB2763;
import fr.neatmonster.nocheatplus.compat.cb2794.MCAccessCB2794; import fr.neatmonster.nocheatplus.compat.cb2794.MCAccessCB2794;
import fr.neatmonster.nocheatplus.compat.cb2808.MCAccessCB2808; import fr.neatmonster.nocheatplus.compat.cb2808.MCAccessCB2808;
import fr.neatmonster.nocheatplus.compat.cb2882.MCAccessCB2882; import fr.neatmonster.nocheatplus.compat.cb2882.MCAccessCB2882;
import fr.neatmonster.nocheatplus.compat.cbdev.MCAccessCBDev;
import fr.neatmonster.nocheatplus.config.ConfPaths; import fr.neatmonster.nocheatplus.config.ConfPaths;
import fr.neatmonster.nocheatplus.config.ConfigManager; import fr.neatmonster.nocheatplus.config.ConfigManager;
import fr.neatmonster.nocheatplus.logging.LogUtil; import fr.neatmonster.nocheatplus.logging.LogUtil;
@ -52,16 +53,16 @@ public class MCAccessFactory {
// Try to set up native access. // Try to set up native access.
if (!bukkitOnly){ if (!bukkitOnly){
// TEST // // TEMP //
// Only add as long as no stable module has been added. // Only add as long as no stable module has been added.
// 1.6.4 // 1.7.2
// try{ try{
// return new MCAccessCBDev(); return new MCAccessCBDev();
// } }
// catch(Throwable t){ catch(Throwable t){
// throwables.add(t); throwables.add(t);
// }; };
// TEST END // // TEMP END //
// 1.6.4 // 1.6.4
try{ try{