mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-15 12:01:51 +01:00
[BLEEDING] Set CompatCBDev to CB for MC 1.7.10.
This commit is contained in:
parent
8f32c822dc
commit
56611cd44b
@ -22,7 +22,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.7.9-R0.2</version>
|
||||
<version>1.7.10-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user