mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-14 19:41:21 +01:00
Add Methods to correct yaw and pitch to MCAccess.
An implementation for NCPCompatBukkit is missing. Note that the native access can not set lastYaw nor lastPitch in PlayerConnection (private), but it could set lastYaw and lastPitch in EntityPlayer. Can't guarantee this actually helps with stuff like derp/magnet, because we can not really set the outcome of a PlayerMoveEvent without rubberbanding the whole planet. Hacks could send enough packets per tick to keep freezing people - we might be able to keep track of yaw/pitch correction and cancel (most) attacking for the same tick after yaw correction (invalidate "same" with in-bounds yaw).
This commit is contained in:
parent
829e52d473
commit
59054b402b
@ -28,10 +28,12 @@ import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
|
||||
public class MCAccessBukkit implements MCAccess, BlockPropertiesSetup{
|
||||
|
||||
// private AlmostBoolean entityPlayerAvailable = AlmostBoolean.MAYBE;
|
||||
|
||||
/**
|
||||
* Constructor to let it fail.
|
||||
*/
|
||||
public MCAccessBukkit(){
|
||||
public MCAccessBukkit() {
|
||||
// TODO: Add more that might fail if not supported ?
|
||||
Material.AIR.isSolid();
|
||||
Material.AIR.isOccluding();
|
||||
@ -55,7 +57,7 @@ public class MCAccessBukkit implements MCAccess, BlockPropertiesSetup{
|
||||
public CommandMap getCommandMap() {
|
||||
try{
|
||||
return (CommandMap) ReflectionUtil.invokeMethodNoArgs(Bukkit.getServer(), "getCommandMap");
|
||||
} catch (Throwable t){
|
||||
} catch (Throwable t) {
|
||||
// Nasty.
|
||||
return null;
|
||||
}
|
||||
@ -76,13 +78,19 @@ public class MCAccessBukkit implements MCAccess, BlockPropertiesSetup{
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockSolid(final int id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Material mat = Material.getMaterial(id);
|
||||
if (mat == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(mat.isSolid());
|
||||
if (mat == null) {
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
else {
|
||||
return AlmostBoolean.match(mat.isSolid());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockLiquid(final int id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Material mat = Material.getMaterial(id);
|
||||
if (mat == null) return AlmostBoolean.MAYBE;
|
||||
switch (mat) {
|
||||
@ -104,8 +112,10 @@ public class MCAccessBukkit implements MCAccess, BlockPropertiesSetup{
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isIllegalBounds(final Player player) {
|
||||
if (player.isDead()) return AlmostBoolean.NO;
|
||||
if (!player.isSleeping()){ // TODO: ignored sleeping ?
|
||||
if (player.isDead()) {
|
||||
return AlmostBoolean.NO;
|
||||
}
|
||||
if (!player.isSleeping()) { // TODO: ignored sleeping ?
|
||||
// TODO: This can test like ... nothing !
|
||||
// (Might not be necessary.)
|
||||
}
|
||||
@ -162,8 +172,10 @@ public class MCAccessBukkit implements MCAccess, BlockPropertiesSetup{
|
||||
BridgeHealth.damage(player, 1.0);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void setupBlockProperties(final WorldConfigProvider<?> worldConfigProvider) {
|
||||
// Note deprecation suppression: These ids should be unique for a server run, that should be ok for setting up generic properties.
|
||||
// TODO: (?) Set some generic properties matching what BlockCache.getShape returns.
|
||||
final Set<Integer> fullBlocks = new HashSet<Integer>();
|
||||
for (final Material mat : new Material[]{
|
||||
@ -171,17 +183,17 @@ public class MCAccessBukkit implements MCAccess, BlockPropertiesSetup{
|
||||
Material.GLASS, Material.GLOWSTONE, Material.ICE, Material.LEAVES,
|
||||
Material.COMMAND, Material.BEACON,
|
||||
Material.PISTON_BASE,
|
||||
}){
|
||||
}) {
|
||||
fullBlocks.add(mat.getId());
|
||||
}
|
||||
for (final Material mat : Material.values()){
|
||||
for (final Material mat : Material.values()) {
|
||||
if (!mat.isBlock()) continue;
|
||||
final int id = mat.getId();
|
||||
if (id < 0 || id >= 4096 || fullBlocks.contains(id)) continue;
|
||||
if (!mat.isOccluding() || !mat.isSolid() || mat.isTransparent()){
|
||||
if (!mat.isOccluding() || !mat.isSolid() || mat.isTransparent()) {
|
||||
// Uncertain bounding-box, allow passing through.
|
||||
long flags = BlockProperties.F_IGN_PASSABLE;
|
||||
if ((BlockProperties.isSolid(id) || BlockProperties.isGround(id)) && !BlockProperties.isLiquid(id)){
|
||||
if ((BlockProperties.isSolid(id) || BlockProperties.isGround(id)) && !BlockProperties.isLiquid(id)) {
|
||||
// Block can be ground, so allow standing on any height.
|
||||
flags |= BlockProperties.F_GROUND_HEIGHT;
|
||||
}
|
||||
@ -191,7 +203,7 @@ public class MCAccessBukkit implements MCAccess, BlockPropertiesSetup{
|
||||
// Blocks that are reported to be full and solid, but which are not.
|
||||
for (final Material mat : new Material[]{
|
||||
Material.ENDER_PORTAL_FRAME,
|
||||
}){
|
||||
}) {
|
||||
final int id = mat.getId();
|
||||
final long flags = BlockProperties.F_IGN_PASSABLE | BlockProperties.F_GROUND_HEIGHT;
|
||||
BlockProperties.setBlockFlags(id, BlockProperties.getBlockFlags(id) | flags);
|
||||
@ -209,9 +221,9 @@ public class MCAccessBukkit implements MCAccess, BlockPropertiesSetup{
|
||||
try{
|
||||
return mat.hasGravity();
|
||||
}
|
||||
catch(Throwable t){
|
||||
catch(Throwable t) {
|
||||
// Backwards compatibility.
|
||||
switch(mat){
|
||||
switch(mat) {
|
||||
case SAND:
|
||||
case GRAVEL:
|
||||
return true;
|
||||
@ -221,4 +233,9 @@ public class MCAccessBukkit implements MCAccess, BlockPropertiesSetup{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void correctDirection(Player player) {
|
||||
// TODO: Consider using reflection (detect CraftPlayer, access EntityPlayer + check if possible (!), use flags for if valid or invalid.)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.moving.LocUtil;
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||
@ -99,7 +100,7 @@ public class MCAccessCB2512 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_4_5.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
@ -107,7 +108,7 @@ public class MCAccessCB2512 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_4_5.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
@ -134,13 +135,13 @@ public class MCAccessCB2512 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final net.minecraft.server.v1_4_5.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final 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_5.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
@ -162,4 +163,13 @@ public class MCAccessCB2512 implements MCAccess{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void correctDirection(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// Main direction.
|
||||
mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// Consider setting the lastYaw here too.
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.moving.LocUtil;
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||
@ -99,7 +100,7 @@ public class MCAccessCB2545 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_4_6.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
@ -107,7 +108,7 @@ public class MCAccessCB2545 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_4_6.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
@ -134,13 +135,13 @@ public class MCAccessCB2545 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final net.minecraft.server.v1_4_6.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final 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_6.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
@ -162,4 +163,13 @@ public class MCAccessCB2545 implements MCAccess{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void correctDirection(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// Main direction.
|
||||
mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// Consider setting the lastYaw here too.
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.moving.LocUtil;
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||
@ -100,7 +101,7 @@ public class MCAccessCB2602 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_4_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
@ -108,7 +109,7 @@ public class MCAccessCB2602 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_4_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
@ -135,13 +136,13 @@ public class MCAccessCB2602 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final net.minecraft.server.v1_4_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final 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 EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
@ -164,4 +165,13 @@ public class MCAccessCB2602 implements MCAccess{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void correctDirection(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// Main direction.
|
||||
mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// Consider setting the lastYaw here too.
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.moving.LocUtil;
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||
@ -101,7 +102,7 @@ public class MCAccessCB2645 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_5_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
@ -109,7 +110,7 @@ public class MCAccessCB2645 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_5_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
@ -136,13 +137,13 @@ public class MCAccessCB2645 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final net.minecraft.server.v1_5_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final 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_5_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
@ -164,4 +165,13 @@ public class MCAccessCB2645 implements MCAccess{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void correctDirection(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// Main direction.
|
||||
mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// Consider setting the lastYaw here too.
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.moving.LocUtil;
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||
@ -62,7 +63,9 @@ public class MCAccessCB2691 implements MCAccess{
|
||||
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);
|
||||
} else return entityHeight;
|
||||
} else {
|
||||
return entityHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -101,7 +104,7 @@ public class MCAccessCB2691 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_5_R2.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
@ -109,7 +112,7 @@ public class MCAccessCB2691 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_5_R2.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
@ -136,13 +139,13 @@ public class MCAccessCB2691 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final net.minecraft.server.v1_5_R2.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final 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_5_R2.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
@ -164,4 +167,13 @@ public class MCAccessCB2691 implements MCAccess{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void correctDirection(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// Main direction.
|
||||
mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// Consider setting the lastYaw here too.
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.moving.LocUtil;
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||
@ -101,7 +102,7 @@ public class MCAccessCB2763 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_5_R3.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
@ -109,7 +110,7 @@ public class MCAccessCB2763 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_5_R3.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
@ -136,13 +137,13 @@ public class MCAccessCB2763 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final net.minecraft.server.v1_5_R3.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final 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_5_R3.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
@ -165,4 +166,13 @@ public class MCAccessCB2763 implements MCAccess{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void correctDirection(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// Main direction.
|
||||
mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// Consider setting the lastYaw here too.
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.moving.LocUtil;
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||
@ -101,7 +102,7 @@ public class MCAccessCB2794 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_6_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
@ -109,7 +110,7 @@ public class MCAccessCB2794 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_6_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
@ -136,13 +137,13 @@ public class MCAccessCB2794 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final net.minecraft.server.v1_6_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final net.minecraft.server.v1_6_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
@ -159,4 +160,13 @@ public class MCAccessCB2794 implements MCAccess{
|
||||
return mat.hasGravity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void correctDirection(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// Main direction.
|
||||
mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// Consider setting the lastYaw here too.
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.moving.LocUtil;
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||
@ -102,7 +103,7 @@ public class MCAccessCB2808 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_6_R2.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
@ -110,7 +111,7 @@ public class MCAccessCB2808 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_6_R2.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
@ -137,13 +138,13 @@ public class MCAccessCB2808 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final net.minecraft.server.v1_6_R2.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final net.minecraft.server.v1_6_R2.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
@ -160,4 +161,13 @@ public class MCAccessCB2808 implements MCAccess{
|
||||
return mat.hasGravity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void correctDirection(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// Main direction.
|
||||
mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// Consider setting the lastYaw here too.
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.moving.LocUtil;
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||
@ -103,7 +104,7 @@ public class MCAccessCB2882 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_6_R3.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
@ -111,7 +112,7 @@ public class MCAccessCB2882 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_6_R3.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
@ -138,13 +139,13 @@ public class MCAccessCB2882 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final net.minecraft.server.v1_6_R3.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final net.minecraft.server.v1_6_R3.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
@ -161,4 +162,13 @@ public class MCAccessCB2882 implements MCAccess{
|
||||
return mat.hasGravity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void correctDirection(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// Main direction.
|
||||
mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// Consider setting the lastYaw here too.
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.moving.LocUtil;
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.compat.cb2922.BlockCacheCB2922;
|
||||
@ -104,7 +105,7 @@ public class MCAccessCB2922 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_7_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
@ -112,7 +113,7 @@ public class MCAccessCB2922 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_7_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
@ -139,13 +140,13 @@ public class MCAccessCB2922 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final net.minecraft.server.v1_7_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final net.minecraft.server.v1_7_R1.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
@ -162,4 +163,13 @@ public class MCAccessCB2922 implements MCAccess{
|
||||
return mat.hasGravity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void correctDirection(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// Main direction.
|
||||
mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// Consider setting the lastYaw here too.
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.moving.LocUtil;
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||
@ -103,7 +104,7 @@ public class MCAccessCB3026 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_7_R2.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
@ -111,7 +112,7 @@ public class MCAccessCB3026 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_7_R2.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
@ -138,13 +139,13 @@ public class MCAccessCB3026 implements MCAccess{
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final net.minecraft.server.v1_7_R2.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final net.minecraft.server.v1_7_R2.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
@ -161,4 +162,13 @@ public class MCAccessCB3026 implements MCAccess{
|
||||
return mat.hasGravity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void correctDirection(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// Main direction.
|
||||
mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// Consider setting the lastYaw here too.
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.moving.LocUtil;
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.BlockCache;
|
||||
@ -28,9 +29,9 @@ public class MCAccessCBDev implements MCAccess{
|
||||
/**
|
||||
* Constructor to let it fail.
|
||||
*/
|
||||
public MCAccessCBDev(){
|
||||
public MCAccessCBDev() {
|
||||
getCommandMap();
|
||||
ReflectionUtil.checkMembers("net.minecraft.server.v1_7_R3.", new String[]{"Entity" , "dead"});
|
||||
ReflectionUtil.checkMembers("net.minecraft.server.v1_7_R3.", new String[] {"Entity" , "dead"});
|
||||
// block bounds, original: minX, maxX, minY, maxY, minZ, maxZ
|
||||
ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_7_R3.Block.class,
|
||||
new String[]{"x", "y", "z", "A", "B", "C"}, double.class);
|
||||
@ -70,15 +71,23 @@ public class MCAccessCBDev implements MCAccess{
|
||||
@Override
|
||||
public AlmostBoolean isBlockSolid(final int id) {
|
||||
final Block block = Block.e(id);
|
||||
if (block == null || block.getMaterial() == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.getMaterial().isSolid());
|
||||
if (block == null || block.getMaterial() == null) {
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
else {
|
||||
return AlmostBoolean.match(block.getMaterial().isSolid());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockLiquid(final int id) {
|
||||
final Block block = Block.e(id);
|
||||
if (block == null || block.getMaterial() == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.getMaterial().isLiquid());
|
||||
if (block == null || block.getMaterial() == null) {
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
else {
|
||||
return AlmostBoolean.match(block.getMaterial().isLiquid());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -92,28 +101,39 @@ public class MCAccessCBDev implements MCAccess{
|
||||
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()){
|
||||
if (!entityPlayer.isSleeping()) {
|
||||
// This can not really test stance but height of bounding box.
|
||||
final double dY = Math.abs(box.e - box.b);
|
||||
if (dY > 1.8) return AlmostBoolean.YES; // dY > 1.65D ||
|
||||
if (dY < 0.1D && entityPlayer.length >= 0.1) return AlmostBoolean.YES;
|
||||
if (dY > 1.8) {
|
||||
return AlmostBoolean.YES; // dY > 1.65D ||
|
||||
}
|
||||
if (dY < 0.1D && entityPlayer.length >= 0.1) {
|
||||
return AlmostBoolean.YES;
|
||||
}
|
||||
}
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_7_R3.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) {
|
||||
return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
}
|
||||
else {
|
||||
return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final net.minecraft.server.v1_7_R3.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) {
|
||||
return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
}
|
||||
else {
|
||||
return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -138,13 +158,13 @@ public class MCAccessCBDev implements MCAccess{
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final net.minecraft.server.v1_7_R3.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final net.minecraft.server.v1_7_R3.EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
@ -161,4 +181,13 @@ public class MCAccessCBDev implements MCAccess{
|
||||
return mat.hasGravity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void correctDirection(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// Main direction.
|
||||
mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// Consider setting the lastYaw here too.
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -136,4 +136,11 @@ public interface MCAccess {
|
||||
*/
|
||||
public boolean hasGravity(Material type);
|
||||
|
||||
/**
|
||||
* Correct the direction (yaw + pitch). If this can't be done lightly it should just do nothing. Check pitch and yaw before calling, use auxiliary methods from LocUtil.
|
||||
* @param player
|
||||
*/
|
||||
public void correctDirection(Player player);
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user