[BLEDING] Update dev-module to CB/1.5.

This commit is contained in:
asofold 2013-03-15 22:31:02 +01:00
parent 32600dd335
commit 636faecd52
4 changed files with 50 additions and 52 deletions

View File

@ -22,7 +22,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.4.7-R1.1-SNAPSHOT</version>
<version>1.5-R0.1-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@ -3,16 +3,16 @@ package fr.neatmonster.nocheatplus.compat.cbdev;
import java.util.Iterator;
import java.util.List;
import net.minecraft.server.v1_4_R1.AxisAlignedBB;
import net.minecraft.server.v1_4_R1.EntityBoat;
import net.minecraft.server.v1_4_R1.IBlockAccess;
import net.minecraft.server.v1_4_R1.Material;
import net.minecraft.server.v1_4_R1.TileEntity;
import net.minecraft.server.v1_4_R1.Vec3DPool;
import net.minecraft.server.v1_5_R1.AxisAlignedBB;
import net.minecraft.server.v1_5_R1.EntityBoat;
import net.minecraft.server.v1_5_R1.IBlockAccess;
import net.minecraft.server.v1_5_R1.Material;
import net.minecraft.server.v1_5_R1.TileEntity;
import net.minecraft.server.v1_5_R1.Vec3DPool;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_4_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_4_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_5_R1.entity.CraftEntity;
import org.bukkit.entity.Entity;
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(!). */
protected static final AxisAlignedBB useBox = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
protected net.minecraft.server.v1_4_R1.World world;
protected net.minecraft.server.v1_5_R1.World world;
public BlockCacheCBDev(World world) {
setAccess(world);
@ -48,12 +48,12 @@ 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_4_R1.Block block = net.minecraft.server.v1_4_R1.Block.byId[id];
final net.minecraft.server.v1_5_R1.Block block = net.minecraft.server.v1_5_R1.Block.byId[id];
if (block == null) return null;
block.updateShape(this, x, y, z); // TODO: use THIS instead of world.
// minX, minY, minZ, maxX, maxY, maxZ
return new double[]{block.v(), block.x(), block.z(), block.w(), block.y(), block.A()};
return new double[]{block.u(), block.w(), block.y(), block.v(), block.x(), block.z()};
}
@Override
@ -61,7 +61,7 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{
try{
// TODO: Probably check other ids too before doing this ?
final net.minecraft.server.v1_4_R1.Entity mcEntity = ((CraftEntity) entity).getHandle();
final net.minecraft.server.v1_5_R1.Entity mcEntity = ((CraftEntity) entity).getHandle();
final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ);
@SuppressWarnings("rawtypes")
@ -69,7 +69,7 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{
@SuppressWarnings("rawtypes")
final Iterator iterator = list.iterator();
while (iterator.hasNext()) {
final net.minecraft.server.v1_4_R1.Entity other = (net.minecraft.server.v1_4_R1.Entity) iterator.next();
final net.minecraft.server.v1_5_R1.Entity other = (net.minecraft.server.v1_5_R1.Entity) iterator.next();
if (!(other instanceof EntityBoat)){ // && !(other instanceof EntityMinecart)) continue;
continue;
}
@ -111,13 +111,13 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{
}
@Override
public boolean isBlockFacePowered(final int arg0, final int arg1, final int arg2, final int arg3) {
return world.isBlockFacePowered(arg0, arg1, arg2, arg3);
public int getBlockPower(final int arg0, final int arg1, final int arg2, final int arg3) {
return world.getBlockPower(arg0, arg1, arg2, arg3);
}
@Override
public boolean t(final int x, final int y, final int z) {
return world.t(x, y, z);
public boolean u(final int arg0, final int arg1, final int arg2) {
return world.u(arg0, arg1, arg2);
}
}

View File

@ -1,18 +1,18 @@
package fr.neatmonster.nocheatplus.compat.cbdev;
import net.minecraft.server.v1_4_R1.AxisAlignedBB;
import net.minecraft.server.v1_4_R1.Block;
import net.minecraft.server.v1_4_R1.DamageSource;
import net.minecraft.server.v1_4_R1.EntityComplexPart;
import net.minecraft.server.v1_4_R1.EntityPlayer;
import net.minecraft.server.v1_4_R1.MobEffectList;
import net.minecraft.server.v1_5_R1.AxisAlignedBB;
import net.minecraft.server.v1_5_R1.Block;
import net.minecraft.server.v1_5_R1.DamageSource;
import net.minecraft.server.v1_5_R1.EntityComplexPart;
import net.minecraft.server.v1_5_R1.EntityPlayer;
import net.minecraft.server.v1_5_R1.MobEffectList;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.CommandMap;
import org.bukkit.craftbukkit.v1_4_R1.CraftServer;
import org.bukkit.craftbukkit.v1_4_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_4_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_5_R1.CraftServer;
import org.bukkit.craftbukkit.v1_5_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_5_R1.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -20,6 +20,7 @@ import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
import fr.neatmonster.nocheatplus.compat.MCAccess;
import fr.neatmonster.nocheatplus.utilities.BlockCache;
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
public class MCAccessCBDev implements MCAccess{
@ -29,18 +30,18 @@ public class MCAccessCBDev implements MCAccess{
*/
public MCAccessCBDev(){
getCommandMap();
ReflectionUtil.checkMembers("net.minecraft.server.v1_4_R1.", new String[]{"Entity" , "dead"});
ReflectionUtil.checkMembers("net.minecraft.server.v1_5_R1.", new String[]{"Entity" , "dead"});
}
@Override
public String getMCVersion() {
// 1_4_R1
return "1.4.7";
// 1_5_R1
return "1.5";
}
@Override
public String getServerVersionTag() {
return "CB-DEV(2602+)";
return "CB-DEV(2645+)";
}
@Override
@ -55,7 +56,7 @@ public class MCAccessCBDev implements MCAccess{
@Override
public double getHeight(final Entity entity) {
final net.minecraft.server.v1_4_R1.Entity mcEntity = ((CraftEntity) entity).getHandle();
final net.minecraft.server.v1_5_R1.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);
@ -78,13 +79,8 @@ public class MCAccessCBDev implements MCAccess{
@Override
public boolean Block_i(final int id) {
try{
return Block.i(id);
}
catch(Throwable t){
// Minecraft default value.
return true;
}
// TODO: This is inaccurate (would be something like "can suffocate"), however it is used for piling upwards and might about do.
return BlockProperties.isGround(id) || BlockProperties.isSolid(id);
}
@Override
@ -96,6 +92,7 @@ public class MCAccessCBDev implements MCAccess{
public AlmostBoolean isIllegalBounds(final Player player) {
final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
if (entityPlayer.dead) return AlmostBoolean.NO;
// TODO: Does this need a method call for the "real" box? Might be no problem during moving events, though.
final AxisAlignedBB box = entityPlayer.boundingBox;
if (!entityPlayer.isSleeping()){
// This can not really test stance but height of bounding box.
@ -108,7 +105,7 @@ public class MCAccessCBDev implements MCAccess{
@Override
public double getJumpAmplifier(final Player player) {
final net.minecraft.server.v1_4_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
final net.minecraft.server.v1_5_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
else return Double.NEGATIVE_INFINITY;
@ -116,7 +113,7 @@ public class MCAccessCBDev implements MCAccess{
@Override
public double getFasterMovementAmplifier(final Player player) {
final net.minecraft.server.v1_4_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
final net.minecraft.server.v1_5_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
else return Double.NEGATIVE_INFINITY;
}
@ -143,13 +140,13 @@ public class MCAccessCBDev implements MCAccess{
@Override
public boolean shouldBeZombie(final Player player) {
final net.minecraft.server.v1_4_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
final net.minecraft.server.v1_5_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
return !mcPlayer.dead && mcPlayer.getHealth() <= 0 ;
}
@Override
public void setDead(final Player player, final int deathTicks) {
final net.minecraft.server.v1_4_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
final net.minecraft.server.v1_5_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
mcPlayer.deathTicks = deathTicks;
mcPlayer.dead = true;
}

View File

@ -8,6 +8,7 @@ import fr.neatmonster.nocheatplus.compat.cb2511.MCAccessCB2511;
import fr.neatmonster.nocheatplus.compat.cb2512.MCAccessCB2512;
import fr.neatmonster.nocheatplus.compat.cb2545.MCAccessCB2545;
import fr.neatmonster.nocheatplus.compat.cb2602.MCAccessCB2602;
import fr.neatmonster.nocheatplus.compat.cbdev.MCAccessCBDev;
import fr.neatmonster.nocheatplus.config.ConfPaths;
import fr.neatmonster.nocheatplus.config.ConfigManager;
import fr.neatmonster.nocheatplus.logging.LogUtil;
@ -35,15 +36,15 @@ public class MCAccessFactory {
// Try to set up native access.
if (!bukkitOnly){
// // TEST //
// // Only add as long as no stable module has been added.
// try{
// return new MCAccessCBDev();
// }
// catch(Throwable t){
// throwables.add(t);
// };
// // TEST END //
// TEST //
// Only add as long as no stable module has been added.
try{
return new MCAccessCBDev();
}
catch(Throwable t){
throwables.add(t);
};
// TEST END //
// 1.4.7
try{