Commit Graph

38 Commits

Author SHA1 Message Date
asofold 62df128efd [BLEEDING][BREAKING] MC 1.13 Material changes, first batch.
First batch:
* Initialize blocks somehow, so no errors nor missing blocks happen
during startup.

Possibly Missing:
* There might be references of removed/renamed material (blocks/items)
throughout the code.
* Some blocks may behave different now/then.

Missing:
* Block#getData may not reflect (all?) properties anymore.
* Block shape getting is missing. Block shapes are now (potentially)
more complex to process. Concept might be to keep a double array for the
rough bounds, and add an (optional +- null) array of arrays for sub
shapes, if present (IBlockCacheNode). So a first rough update is more
simple/compatible.
2018-08-20 12:37:51 +02:00
asofold f6f94d4eb7 Remove unused 4096, align flag values, add max flag. 2018-08-15 10:59:02 +02:00
asofold 0a373fb28b Block change tracking: add flags for use and redstone. (+)
Add block flags:
* F_VARIABLE_USE
* F_VARIABLE_REDSTONE

Add a test to ensure block flags are unique and not 0L.

(+) Use individual MiniListener instances.
(+) Track right click blocks (use block) and apply, aiming at trap door
issues.
2018-04-02 17:08:48 +02:00
asofold 350908cb47 [BLEEDING] Scan for ground with the void-to-void set back policy.
In case a player is above the void (no ground / liquid / web / climbable
underneath), they're teleported directly to the void.

Further adjustments:
* A flag for cobweb has been added.
* MovingUtil.getApplicableSetBackLocation / signature.

Missing:
* Precise scan (and set back policy down-to-ground, and what not).
* Special cases: illegal move, passable, morepackets. Some need an extra
policy.
* Standing on entities? Quite testing with scannning down to the void,
perhaps it'll be "ok" with a more complex scanning result, scanning for
entities near start and end only.
2018-03-01 21:12:25 +01:00
asofold 4a7efdc3a4 Add identity checks with various implementations of equals(Object). 2018-02-11 14:21:14 +01:00
asofold 715a49d1bd Passable / initially colliding blocks: catch 1.5 height.
Just check bounds vs. blocks up to 0.5 blocks lower within
BlockProperties.collectInitiallyColliding.
2018-02-06 12:17:27 +01:00
asofold 97d59045ae [BLEEDING][BREAKING][INSTABLE] Swiftly throw in permission caching.
Benefits:
* Improves performance, where permission lookup has major impact, with
timeout based lookup, static permissions (skip permission check
entirely), and world/offline based invalidation. (Once fully
implemented.)
* Hopefully more efficient: use Bukkit Permission for faster defaults.
* (Allows control over how which permission is to be
updated/invalidated, which is useful per se.)

Risks:
* Complex changes yield bugs.
* Other plugins depending on NCP might break.
* Cache incoherence might happen (permissions are changed dynamically +-
unintended malconfiguration, or in case of bugs).
* (Endless loops certainly have all been fixed.)

Breaking:
* Lots of more or less internal API has been changed or removed: Check,
CheckType, CheckUtils, TickTask, ...
* Permission checking behavior has been altered.

Rough points:
* Implement a permission cache within PlayerData.
* Remove the player tasks and permission updates in favour of handling
those within DataManager and PlayerData.
* Adjust everything else to it (partly TBD).
* Updating sets of permissions (e.g. for CHAT) is done more lazily now,
i.e. one per 10 ticks). An actual permission check would still yield an
update next tick (asynchronous).
* Fixed/extended random spots (DualCollection, MiniListener registration
support, StringUtil).

Missing:
* Basic implementation
  * Cleanup after logout (stages: 1. non-essential like permissions,
2. unrecoverable like set-back location, 3. complete data removal).
* Coverage
  * Might have missed spots.
  * NoCheatPlus.nameSetPerms should be replaced by caching + default
config for world-wise updating.
  * Command permissions are always checked. At least for players,
cache based lookup should get implemented.
  * More unit tests.
* Extended configurability: Per-world settings/policies.
* Efficiency
  * Not all parts of the implementation are 100%/optimal yet.
2018-01-30 23:09:34 +01:00
asofold e7aa12141a Fix overrides not respecting external side conditions. 2018-01-21 18:56:17 +01:00
asofold 6bf5b4c180 Support configuration for breaking time overrides. 2018-01-21 18:39:32 +01:00
asofold 1a8c292015 Support overriding the block breaking time for specific side conditions.
Relatively cheap addition, done:
* Internal API within BlockProperties.

Missing:
* Support configuration: compatibility.blocks.breakingtime
* Support a command to update by the last n mined blocks (!). Needs
storing all side conditions within BlockBreakKey and convenience methods
for getBlockBreakKey + use internally.
2018-01-21 18:11:03 +01:00
asofold cdbd49785e Adjust breaking time of stone axe vs iron block. 2018-01-21 16:44:08 +01:00
asofold 01f6db48b0 Correct javadocs. 2018-01-04 00:04:08 +01:00
asofold c6aec5ed09 Implement F_MIN_HEIGHT16_1 and F_MIN_HEIGHT16_15. Clarify javadocs.
Only applying with GROUND_HEIGHT set, these flags allow setting a
minimum height for passability and ground workarounds, covering two
typical cases.

Due to a range of hard coded workarounds being in place already, these
flags won't apply for all blocks. See getGroundMinHeight.
2018-01-03 23:57:12 +01:00
asofold af44f13fbd [BREAKING] BlockCache: rename getTypeId to getType. 2017-12-18 01:19:49 +01:00
asofold 7c5d67b1d4 Fixes and adjustments with String ids.
* Start renaming methods internally (getType for getting Material) -
unfinished.
* Temporary fix for the NCPCompatbukkit/cbreflect module: fetch NMS
blocks by id until we have a mapping and/or something efficient and
future proof in place.
2017-12-16 16:14:41 +01:00
md_5 3a111dc4a5 Remove Block IDs 2017-12-06 16:55:29 +11:00
asofold ddc0436e43 Fix boatsanywhere not recognizing other than oak boats.
Other:
* Add and use BlockProperties.isWater.
2017-05-26 14:13:02 +02:00
asofold 9e763c2584 [BLIND] Add 1.12 blocks. 2017-05-14 12:07:49 +02:00
asofold 9478daaa02 Prepare new block flags. Add comments.
To model differing behavior of fluids, i.e. half fall distance per
in-lava move vs. zero fall distance once in water, block flags will be
used. To really do this the NoFall check will be altered to account for
new flags. Once at it, the check should also treat from and to
independently of each other - there are some inconsistencies, such as
how oFallMaxY is set.

Further flags are reserved for MIN_HEIGHT..., indicating that
compatibility will be improved without compromising protection too much.
Thus instead of making a block entirely passable, you could set a
specific min height flag alongside ground_height (and possibly height
for max. height), in order to allow walking between level x and y but
not below (think of grass_path).
2017-05-12 21:11:41 +02:00
asofold 0c6cb6577d Use the lower eye height when gliding with elytra (selected checks).
* Block checks (interact/place/break): reach and direction.
* Random other places, like BlockProperties.getBreakingDuration.
2017-05-09 22:04:50 +02:00
asofold f560e756f5 isSameShape: with early return on either parameter being null. 2016-12-30 19:16:24 +01:00
asofold d69dc0b44d [BLEEDING] Double trouble potential: NaN, infinity.
+ random Formatting + random fix (same angle checked twice in TrigUtil).
2016-12-27 15:26:26 +01:00
asofold 9d01191bcd cleanup: null checks. 2016-12-19 07:42:50 +01:00
asofold cf3ea4a1e2 [BLEEDING] One more step on slimes with pistons.
* Less fall damage.
* Flag all velocity added due to slime bouncing appropriately.
* Experimental concept for splitting up velocity, likely to be altered /
removed.
* Add a flag for (faked) pvp velocity.

NOTE: Invalidation of past entries has been deactivated to progress on detecting the stupid past bouncing at all. This will need another iteration.
2016-12-17 15:02:26 +01:00
asofold 9dca93e650 Don't add bluntly redundant block change entries.
Match vs. the last entry of existing entries for those coordinates.
Seems to be better with piston retract events.
2016-12-07 22:18:53 +01:00
asofold e6673de09e [BLEEDING] Sketch one approach for on-ground with past states.
Still incomplete, could contain bugs (endless loops, perhaps).
Invalidation
mechanics may need to be refined.

Not covered:
* Exemption for moves resulting from horizontal push/pull.

*
2016-12-06 13:28:37 +01:00
asofold 3cd7625516 [BREAKING] Make an extra package for block change tracking.
* Split off the BlockChangeReference, BlockChangeListener.
2016-12-05 14:29:57 +01:00
asofold da01ac1a48 Not AVR. 2016-12-01 13:09:17 +01:00
asofold 4e58ff980c Random/ alter on-ground logic (might fix fences+some abuse).
* In case of non-full bounds + variable, allow ground to be found
underneath. Can concern fences (tested on 1.11).
* There has been a probably misplaced/leftover check assuming the block
above to be passable, without checking for it (iMaxY). Since the
access.getMaxBlockY() has already been checked, this part appears to be
not of use, thus iMaxY has been removed from the signature together with
this exception.

If this causes something, please provide debug logs / circumstances :).
2016-11-30 00:35:08 +01:00
asofold 65777e0e32 Debug log the timing window for the BlockChangeTracker, Adjust comments.
Currently the oldest available entries are used, as if the player had
the maximum allowed latency always. Later on, at least attempting to hit
a global latency estimate (+window) should be attempted.

We'll still have a (moderate) fast-forward implementation to see what
opportunistic checking can do on live servers (elevators, doors etc.).
2016-11-29 13:20:38 +01:00
asofold 00b4dc5545 Format, adapt getCorrectedBounds to use a node. 2016-11-28 23:14:40 +01:00
asofold e926f34963 [BLEEDING][BREAKING] Rework internals to use IBlockCacheNode (rough).
Intention is to work towards passing stored IBlockCacheNode instances to
methods in BlockProperties, i.e. to have
isOnGroundInAnOverlyOpportunisticWay implemented.

If you need one of the old BlockProperties signatures (or a more
simplified one), just open a GitHub issue.

This is a slightly peculiar change.
* Passing node and nodeAbove is a little bit odd, despite seemingly
efficient at present.
* Later we might need a BlockCache instance that busies about past
states (currently too complicated to implement).
* Uncertain impact (could perform better, could perform worse).
* Possibly left out a couple of places.
* Might have introduced bugs (fast forward).

On the other hand there may be a lot of other types of changes, if we
ever go for a less opportunistic implementation, which can not be
estimated simply, so this may be about the best that can be done, to get
a quick step in.
2016-11-28 14:30:57 +01:00
asofold c80ca6c8a6 Split off the per-block logic in isOnGround.
Already have the signature use IBlockCacheNode for node+nodeAbove, like
it will be done with other methods like collidesBlock.

This will allow calling this with past block states, once other methods
have been adapted as well.
2016-11-28 00:07:43 +01:00
asofold 574390f90d Add 1.11 blocks. Add/alter comments. 2016-11-25 11:32:26 +01:00
asofold 0a834624ac Comment on height150 (with axis tracing). 2016-11-24 16:19:18 +01:00
asofold 518f2f08da More block flags: HEIGHT8_1 and ALLOW_LOWJUMP (see description below).
Attempt to enable workarounds for lily pads with servers that support
multiple client versions. Add to the configuration at
compatibility.blocks.overrideflags:
WATER_LILY: default+ign_passable+ground_height+height8_1

HEIGHT8_1 just means 1/8 height (0.125).

The ALLOW_LOWJUMP flag was intended to be used in case of
ground_height+height100 or the like leading to issues with
sprint-jumping due to the low jump detection, however other special
casing checks for bunny hopping let this still fail (less than before,
but still), thus this flag might get removed. Keeping it for now, to
provide some kind of toolkit.
2016-11-01 13:42:05 +01:00
asofold 67e7b95901 Allow walking on soil at the reported height (~1.10.2). 2016-06-23 22:41:18 +02:00
asofold 863b89763d [BREAKING] Move more classes around.
This time the focus is on the utilities package.

Possibly used, but not really official API:
* Move block cache to a 'map' sub-package.
* Move RichBounds/RichEntity/Player-Location and TrigUtil to a location
sub-package.

Not really official API, likely not used:
* Move AttribUtil to compat, since it belongs there.
* Split off direction check methods to collision.CollisionUtil.
* Move static BlockCache methods to map.MapUtil.
* Move food related methods from CheckUtils to InventoryUtil.
* Move vehicle/passenger related methods from CheckUtils to
PassengerUtil.

Not breaking:
* Move IdUtil to commons.
2016-06-21 09:56:50 +02:00