mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-27 14:13:11 +02:00
Add 1.11 blocks. Add/alter comments.
This commit is contained in:
parent
0a834624ac
commit
574390f90d
@ -92,6 +92,7 @@ public class Passable extends Check {
|
||||
// Direct return.
|
||||
return potentialViolation(player, from, to, manhattan, newTag, data, cc);
|
||||
}
|
||||
// TODO: Return already here, if not colliding?
|
||||
}
|
||||
if (to.isPassable()) {
|
||||
// Quick return.
|
||||
@ -99,6 +100,8 @@ public class Passable extends Check {
|
||||
data.passableVL *= 0.99;
|
||||
return null;
|
||||
} else {
|
||||
// TODO: Do make use of isPassableBox.
|
||||
// TODO: Some cases seem not to be covered here (same block !?).
|
||||
return potentialViolationLegacy(player, from, to, manhattan, "", data, cc);
|
||||
}
|
||||
}
|
||||
@ -162,7 +165,7 @@ public class Passable extends Check {
|
||||
|
||||
// Prefer the set-back location from the data.
|
||||
if (data.hasSetBack()) {
|
||||
setBackLoc = data.getSetBack(to);;
|
||||
setBackLoc = data.getSetBack(to);
|
||||
if (data.debug) {
|
||||
debug(player, "Using set-back location for passable.");
|
||||
}
|
||||
|
@ -53,7 +53,8 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
|
||||
* pistons, falling blocks, digging, block placing, explosions, vegetables
|
||||
* growing, all sorts of doors, plugins changing blocks and so on. This is
|
||||
* needed not only for elevator and parkour designs, but also to prevent piston
|
||||
* based trap designs, which could lead to players violating moving checks.
|
||||
* based trap designs, which could lead to victims continuously violating moving
|
||||
* checks.
|
||||
* <hr>
|
||||
* In general we assume that at the time of adding a block change entry, the
|
||||
* block has not yet been changed, so we access the "old state" at that point of
|
||||
@ -154,13 +155,18 @@ public class BlockChangeTracker {
|
||||
public final IBlockCacheNode previousState;
|
||||
|
||||
/**
|
||||
* A push entry.
|
||||
* A block change entry.
|
||||
*
|
||||
* @param id
|
||||
* @param tick
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param direction
|
||||
* Moving direction, NONE for none.
|
||||
* @param previousState
|
||||
* State of the block before changes may have happened. Pass
|
||||
* null to ignore.
|
||||
*/
|
||||
public BlockChangeEntry(long id, int tick, int x, int y, int z,
|
||||
Direction direction, IBlockCacheNode previousState) {
|
||||
@ -437,7 +443,7 @@ public class BlockChangeTracker {
|
||||
private void addPistonBlock(final long changeId, final int tick, final WorldNode worldNode,
|
||||
final int x, final int y, final int z, final BlockFace blockFace, final BlockCache blockCache) {
|
||||
// TODO: A filter for regions of player activity.
|
||||
// TODO: Test which ones can actually push a player (and what type of push).
|
||||
// TODO: Test which ones can actually move a player (/how).
|
||||
// Add this block.
|
||||
addBlockChange(changeId, tick, worldNode, x, y, z, Direction.getDirection(blockFace),
|
||||
blockCache.getBlockCacheNode(x, y, z, true));
|
||||
@ -450,7 +456,7 @@ public class BlockChangeTracker {
|
||||
* @param y
|
||||
* @param z
|
||||
* @param direction
|
||||
* If not NONE, pushing into that direction is assumed.
|
||||
* If not NONE, moving the block into that direction is assumed.
|
||||
*/
|
||||
private void addBlockChange(final long changeId, final int tick, final WorldNode worldNode,
|
||||
final int x, final int y, final int z, final Direction direction, final IBlockCacheNode previousState) {
|
||||
@ -528,7 +534,7 @@ public class BlockChangeTracker {
|
||||
}
|
||||
|
||||
/**
|
||||
* Query if there is a push available into the indicated direction.
|
||||
* Query past block states and moved blocks, including direction of moving.
|
||||
*
|
||||
* @param ref
|
||||
* Reference for checking the validity of BlockChangeEntry
|
||||
@ -538,11 +544,12 @@ public class BlockChangeTracker {
|
||||
* The current tick. Used for lazy expiration.
|
||||
* @param worldId
|
||||
* @param x
|
||||
* Block Coordinates where a push might have happened.
|
||||
* Block Coordinates.
|
||||
* @param y
|
||||
* @param z
|
||||
* @param direction
|
||||
* Desired direction of the push.
|
||||
* Desired direction of a moved block. Pass null to ignore
|
||||
* direction.
|
||||
* @return The matching entry, or null if there is no matching entry.
|
||||
*/
|
||||
public BlockChangeEntry getBlockChangeEntry(final BlockChangeReference ref, final long tick, final UUID worldId,
|
||||
@ -555,7 +562,7 @@ public class BlockChangeTracker {
|
||||
}
|
||||
|
||||
/**
|
||||
* Query if there is a push available into the indicated direction.
|
||||
* Query past block states and moved blocks, including direction of moving.
|
||||
*
|
||||
* @param ref
|
||||
* Reference for checking the validity of BlockChangeEntry
|
||||
@ -565,11 +572,12 @@ public class BlockChangeTracker {
|
||||
* The current tick. Used for lazy expiration.
|
||||
* @param worldNode
|
||||
* @param x
|
||||
* Block Coordinates where a push might have happened.
|
||||
* Block Coordinates.
|
||||
* @param y
|
||||
* @param z
|
||||
* @param direction
|
||||
* Desired direction of the push. Pass null to ignore direction.
|
||||
* Desired direction of a moved block. Pass null to ignore
|
||||
* direction.
|
||||
* @return The oldest matching entry, or null if there is no matching entry.
|
||||
*/
|
||||
private BlockChangeEntry getBlockChangeEntry(final BlockChangeReference ref, final long tick, final WorldNode worldNode,
|
||||
|
@ -0,0 +1,41 @@
|
||||
package fr.neatmonster.nocheatplus.compat.blocks.init.vanilla;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.BlockPropertiesSetup;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.init.BlockInit;
|
||||
import fr.neatmonster.nocheatplus.config.WorldConfigProvider;
|
||||
import fr.neatmonster.nocheatplus.logging.StaticLog;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties.BlockProps;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class BlocksMC1_11 implements BlockPropertiesSetup {
|
||||
|
||||
private static final int first_shulker_box = 219;
|
||||
private static final int last_shulker_box = 234;
|
||||
|
||||
public BlocksMC1_11() {
|
||||
BlockInit.assertMaterialNameMatch(218, "OBSERVER");
|
||||
for (int i = first_shulker_box; i <= last_shulker_box; i++) {
|
||||
BlockInit.assertMaterialNameMatch(i, "SHULKER_BOX");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupBlockProperties(WorldConfigProvider<?> worldConfigProvider) {
|
||||
long solidFlags = BlockProperties.F_SOLID | BlockProperties.F_GROUND;
|
||||
// 218 OBSERVER
|
||||
// Wiki (16-11-25): 17.5, 2.65, 1.32, 0.9, 0.7, 0.45
|
||||
BlockProperties.setBlockProps(218, new BlockProps(BlockProperties.woodPickaxe, 6,
|
||||
BlockProperties.secToMs(15.0, 2.2, 1.1, 0.7, 0.55, 0.45)));
|
||||
BlockProperties.setBlockFlags(218, solidFlags);
|
||||
// ALL SORTS OF SHULKER BOXES
|
||||
for (int i = first_shulker_box; i <= last_shulker_box; i++) {
|
||||
// Wiki (16-11-25): 9, 4.5, 2.25, 1.5, 1.15, 0.75
|
||||
BlockProperties.setBlockProps(i, new BlockProps(BlockProperties.woodPickaxe, 6,
|
||||
BlockProperties.secToMs(10.0, 1.45, 0.7, 0.5, 0.35, 0.2)));
|
||||
BlockProperties.setBlockFlags(i, solidFlags);
|
||||
}
|
||||
StaticLog.logInfo("Added block-info for Minecraft 1.11 blocks.");
|
||||
}
|
||||
|
||||
}
|
@ -35,6 +35,7 @@ public class VanillaBlocksFactory {
|
||||
setups.add(new BlocksMC1_8());
|
||||
setups.add(new BlocksMC1_9());
|
||||
setups.add(new BlocksMC1_10());
|
||||
setups.add(new BlocksMC1_11());
|
||||
}
|
||||
catch(Throwable t){}
|
||||
for (final BlockPropertiesSetup setup : setups){
|
||||
|
@ -404,7 +404,8 @@ public abstract class AxisTracing implements ICollideBlocks, ISetMargins {
|
||||
* @param increment
|
||||
* Direction of the move concerning the given axis (1 means from
|
||||
* min to max, -1 means from max to min).
|
||||
* @return
|
||||
* @return Return true to continue tracing. Return false to stop and trigger
|
||||
* a collision.
|
||||
*/
|
||||
protected abstract boolean step(int blockX, int blockY, int blockZ,
|
||||
double minX, double minY, double minZ, double maxX, double maxY, double maxZ,
|
||||
|
@ -49,7 +49,10 @@ public class PassableAxisTracing extends AxisTracing implements ICollidePassable
|
||||
* TODO: HEIGHT150 -> if not passable... how/where to test for block
|
||||
* change tracker? E.g.: y-offset from block < 0.5 -> check the
|
||||
* block underneath. (one method check box normal + opportunistic
|
||||
* past state handling in one?)
|
||||
* past state handling in one?) Prefer to set the
|
||||
* air/liquid/whichever block above the fence as ignored, in order
|
||||
* to allow collision with the 1.0 height border of the fence (TODO:
|
||||
* legacy only?).
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
@ -227,7 +227,8 @@ public class BlockProperties {
|
||||
* Instantiates a new block props.
|
||||
*
|
||||
* @param tool
|
||||
* the tool
|
||||
* The tool type that allows access to breaking times other
|
||||
* than MaterialBase.NONE.
|
||||
* @param hardness
|
||||
* the hardness
|
||||
*/
|
||||
@ -239,7 +240,8 @@ public class BlockProperties {
|
||||
* Instantiates a new block props.
|
||||
*
|
||||
* @param tool
|
||||
* the tool
|
||||
* The tool type that allows access to breaking times other
|
||||
* than MaterialBase.NONE.
|
||||
* @param hardness
|
||||
* the hardness
|
||||
* @param efficiencyMod
|
||||
@ -269,11 +271,13 @@ public class BlockProperties {
|
||||
* Instantiates a new block props.
|
||||
*
|
||||
* @param tool
|
||||
* the tool
|
||||
* The tool type that allows access to breaking times other
|
||||
* than MaterialBase.NONE.
|
||||
* @param hardness
|
||||
* the hardness
|
||||
* @param breakingTimes
|
||||
* the breaking times
|
||||
* The breaking times (NONE, WOOD, STONE, IRON, DIAMOND,
|
||||
* GOLD)
|
||||
*/
|
||||
public BlockProps(ToolProps tool, float hardness, long[] breakingTimes) {
|
||||
this(tool, hardness, breakingTimes, 1f);
|
||||
@ -283,11 +287,13 @@ public class BlockProperties {
|
||||
* Instantiates a new block props.
|
||||
*
|
||||
* @param tool
|
||||
* the tool
|
||||
* The tool type that allows access to breaking times other
|
||||
* than MaterialBase.NONE.
|
||||
* @param hardness
|
||||
* the hardness
|
||||
* @param breakingTimes
|
||||
* the breaking times
|
||||
* The breaking times (NONE, WOOD, STONE, IRON, DIAMOND,
|
||||
* GOLD)
|
||||
* @param efficiencyMod
|
||||
* the efficiency mod
|
||||
*/
|
||||
@ -3190,7 +3196,7 @@ public class BlockProperties {
|
||||
* passable.
|
||||
*
|
||||
* @param access
|
||||
* the access
|
||||
* the access <- we all love the access!
|
||||
* @param minX
|
||||
* the min x
|
||||
* @param minY
|
||||
@ -4069,7 +4075,7 @@ public class BlockProperties {
|
||||
* the max z
|
||||
* @param results
|
||||
* the results
|
||||
* @return the int
|
||||
* @return The number of added blocks.
|
||||
*/
|
||||
public static final int collectInitiallyCollidingBlocks(final BlockCache access,
|
||||
final double minX, final double minY, final double minZ,
|
||||
@ -4087,14 +4093,18 @@ public class BlockProperties {
|
||||
for (int y = iMinY; y <= iMaxY; y++) {
|
||||
if (!isPassableBox(access, x, y, z, minX, minY, minZ, maxX, maxY, maxZ)) {
|
||||
results.addBlockPosition(x, y, z);
|
||||
++added;
|
||||
added ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Consider doing an xz iteration here for HEIGHT150, iff y-offset <=
|
||||
* 0.5 (and possibly a flag is set).
|
||||
* Consider doing an xz iteration here for HEIGHT150, if y-offset <= 0.5
|
||||
* (and possibly a flag is set). Note that collision behavior of fences
|
||||
* can be peculiar, with barriers at 1.5 and 1.0 height (1.5 height only
|
||||
* applies with non solid blocks above, thus ignore air/liquid/certain
|
||||
* blocks if initially colliding with fence underneath (!)), for a
|
||||
* convention.
|
||||
*/
|
||||
return added;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user