mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-28 18:31:24 +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>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>craftbukkit</artifactId>
|
<artifactId>craftbukkit</artifactId>
|
||||||
<version>1.7.9-R0.2</version>
|
<version>1.7.10-R0.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -3,15 +3,15 @@ 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_7_R3.AxisAlignedBB;
|
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
|
||||||
import net.minecraft.server.v1_7_R3.Block;
|
import net.minecraft.server.v1_7_R4.Block;
|
||||||
import net.minecraft.server.v1_7_R3.EntityBoat;
|
import net.minecraft.server.v1_7_R4.EntityBoat;
|
||||||
import net.minecraft.server.v1_7_R3.IBlockAccess;
|
import net.minecraft.server.v1_7_R4.IBlockAccess;
|
||||||
import net.minecraft.server.v1_7_R3.TileEntity;
|
import net.minecraft.server.v1_7_R4.TileEntity;
|
||||||
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld;
|
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
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(!). */
|
/** 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_7_R3.WorldServer world;
|
protected net.minecraft.server.v1_7_R4.WorldServer world;
|
||||||
|
|
||||||
public BlockCacheCBDev(World world) {
|
public BlockCacheCBDev(World world) {
|
||||||
setAccess(world);
|
setAccess(world);
|
||||||
@ -52,8 +52,10 @@ 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_7_R3.Block block = net.minecraft.server.v1_7_R3.Block.e(id);
|
final net.minecraft.server.v1_7_R4.Block block = net.minecraft.server.v1_7_R4.Block.getById(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
|
||||||
@ -65,7 +67,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_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);
|
final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ);
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
@ -73,7 +75,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_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;
|
if (!(other instanceof EntityBoat)){ // && !(other instanceof EntityMinecart)) continue;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -82,7 +84,9 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{
|
|||||||
}
|
}
|
||||||
// Still check this for some reason.
|
// Still check this for some reason.
|
||||||
final AxisAlignedBB otherBox = other.boundingBox;
|
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 {
|
else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
package fr.neatmonster.nocheatplus.compat.cbdev;
|
package fr.neatmonster.nocheatplus.compat.cbdev;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R3.AxisAlignedBB;
|
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
|
||||||
import net.minecraft.server.v1_7_R3.Block;
|
import net.minecraft.server.v1_7_R4.Block;
|
||||||
import net.minecraft.server.v1_7_R3.DamageSource;
|
import net.minecraft.server.v1_7_R4.DamageSource;
|
||||||
import net.minecraft.server.v1_7_R3.EntityComplexPart;
|
import net.minecraft.server.v1_7_R4.EntityComplexPart;
|
||||||
import net.minecraft.server.v1_7_R3.EntityPlayer;
|
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
||||||
import net.minecraft.server.v1_7_R3.MobEffectList;
|
import net.minecraft.server.v1_7_R4.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_7_R3.CraftServer;
|
import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_7_R4.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_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
|
// 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);
|
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_7_R3
|
// 1_7_R4
|
||||||
return "1.7.8|1.7.9";
|
return "1.7.10";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getServerVersionTag() {
|
public String getServerVersionTag() {
|
||||||
return "CB3043-DEV";
|
return "CB3100-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_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));
|
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,7 +69,7 @@ public class MCAccessCBDev implements MCAccess{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AlmostBoolean isBlockSolid(final int id) {
|
public AlmostBoolean isBlockSolid(final int id) {
|
||||||
final Block block = Block.e(id);
|
final Block block = Block.getById(id);
|
||||||
if (block == null || block.getMaterial() == null) {
|
if (block == null || block.getMaterial() == null) {
|
||||||
return AlmostBoolean.MAYBE;
|
return AlmostBoolean.MAYBE;
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ public class MCAccessCBDev implements MCAccess{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AlmostBoolean isBlockLiquid(final int id) {
|
public AlmostBoolean isBlockLiquid(final int id) {
|
||||||
final Block block = Block.e(id);
|
final Block block = Block.getById(id);
|
||||||
if (block == null || block.getMaterial() == null) {
|
if (block == null || block.getMaterial() == null) {
|
||||||
return AlmostBoolean.MAYBE;
|
return AlmostBoolean.MAYBE;
|
||||||
}
|
}
|
||||||
|
@ -58,14 +58,13 @@ public class MCAccessFactory {
|
|||||||
|
|
||||||
// TEMP //
|
// TEMP //
|
||||||
// Only add as long as no stable module has been added.
|
// Only add as long as no stable module has been added.
|
||||||
// Note: 1_7_R4 is build 3100 :p
|
|
||||||
// 1.7.10
|
// 1.7.10
|
||||||
// try{
|
try{
|
||||||
// return new MCAccessCBDev();
|
return new MCAccessCBDev();
|
||||||
// }
|
}
|
||||||
// catch(Throwable t) {
|
catch(Throwable t) {
|
||||||
// throwables.add(t);
|
throwables.add(t);
|
||||||
// };
|
};
|
||||||
// TEMP END //
|
// TEMP END //
|
||||||
|
|
||||||
// 1.7.8|1.7.9
|
// 1.7.8|1.7.9
|
||||||
|
Loading…
Reference in New Issue
Block a user