Commit Graph

239 Commits

Author SHA1 Message Date
Jake Potrebic 8a940ca0ba Fix SculkBloomEvent firing for block entity loading 2024-08-19 13:43:06 -07:00
mja00 15c3f06938 Add skipping world symlink scan
In worlds that are extremely large (greater than 1TB), it can take an insanely long time to walk the entire world for symlinks.
This patch adds a system property to disable the symlink scan, which can be used to speed up world loading.
2024-08-12 06:27:15 -04:00
Nassim Jahnke 334058fa69 Check for block type in SculkSensorBlock#canActivate 2024-08-07 14:33:25 +02:00
Jake Potrebic d9e3bee3b5 Fix NPE for Jukebox#setRecord
Fallback to the global registry if no level exists
2024-06-17 17:41:09 -07:00
Tamion 276e09c3b0 Fix cancelling BlockPlaceEvent calling onRemove 2024-05-23 11:02:20 +02:00
SoSeDiK b50682ab2b More Chest Block API
== AT ==
public net.minecraft.world.level.block.ChestBlock isBlockedChestByBlock(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;)Z
2024-05-01 08:22:13 +03:00
Jake Potrebic 31725bc039 General ItemMeta fixes
== AT ==
private-f net/minecraft/world/item/ItemStack components
public net/minecraft/world/food/FoodProperties DEFAULT_EAT_SECONDS
public org/bukkit/craftbukkit/block/CraftBlockStates getBlockState(Lorg/bukkit/World;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/entity/BlockEntity;)Lorg/bukkit/craftbukkit/block/CraftBlockState;
public net/minecraft/world/level/block/entity/BlockEntity saveId(Lnet/minecraft/nbt/CompoundTag;)V

Co-authored-by: GhastCraftHD <julius.gruenberg@leghast.de>
2024-04-27 20:56:17 -07:00
Aikar eb626e1176 Protect Bedrock and End Portal/Frames from being destroyed
This fixes exploits that let players destroy bedrock by Pistons, explosions
and Mushrooom/Tree generation.

These blocks are designed to not be broken except by creative players/commands.
So protect them from a multitude of methods of destroying them.

A config is provided if you rather let players use these exploits, and let
them destroy the worlds End Portals and get on top of the nether easy.
2020-05-13 23:01:26 -04:00
Jake Potrebic 193d6ee2ca Per world ticks per spawn settings 2021-11-13 12:36:26 -08:00
Jake Potrebic 6c400a907b Fix possible StackOverflowError and NPE for some dispenses
For saddles, carpets, horse armor, and chests for horse-likes
a BlockDispenseEvent handler that always mutated the item without
changing the type would result in a SO error because when it went
to find the replacement dispense behavior (since the item "changed")
it didn't properly handle if the replacement was the same instance
of dispense behavior.

Additionally equippable mob heads, wither skulls, and carved pumpkins
are subject to the same possible error.

Furthermore since 1.21.2, the DISPENSER_REGISTRY map doesn't have a default
return value anymore and some dispense behaviors like equippable and
regular items will not have a defined behavior in that map and might throw
a NPE in that case.
2022-10-29 17:02:42 -07:00
Pierpaolo Coletta 368ca9c145 Fix creation of invalid block entity during world generation 2024-03-30 21:06:10 +01:00
Jake Potrebic 93a2600891 Fix bees aging inside hives
Fixes bees incorrectly being aged up due to upstream's
resetting the ticks inside hive on a failed release
2021-08-21 21:54:16 -07:00
Owen1212055 21837e419b Properly handle experience dropping on block break
This causes spawnAfterBreak to spawn xp by default, removing the need to manually add xp wherever this method is used.
For classes that use custom xp amounts, they can drop the resources with disabling
2023-12-30 15:00:06 -05:00
Nassim Jahnke 2506babe8e Validate ResourceLocation in NBT reading 2024-01-04 13:49:14 +01:00
Jake Potrebic fff5d44a12 Don't fire sync events during worldgen
Fixes EntityPotionEffectEvent
Fixes EntityPoseChangeEvent

Asynchronous chunk generation provides an opportunity for things
to happen async that previously fired synchronous-only events. This
patch is for mitigating those issues by various methods.

Also fixes correctly marking/clearing the entity generation flag.
This patch sets the generation flag anytime an entity is created
via StructureTemplate before loading from NBT to catch uses of
the flag during the loading logic. This patch clears the generation
flag from an entity when added to a ServerLevel for the situation
where generation happened directly to a ServerLevel and the
entity still has the flag set.
2023-11-23 10:33:25 -08:00
TonytheMacaroni 4866ee899b Add predicate for blocks when raytracing 2023-09-06 19:24:16 -04:00
Lulu13022002 93c87bedaf Fix NPE in SculkBloomEvent world access 2023-10-20 19:50:22 +02:00
Spottedleaf fa87f62891 Fix race condition on UpgradeData.BlockFixers class init
The CHUNKY_FIXERS field is modified during the constructors
of the BlockFixers, but the code that uses CHUNKY_FIXERS does
not properly ensure that BlockFixers has been initialised before
using it, leading to a possible race condition where instances of
BlockFixers are accessed before they have initialised correctly.

We can force the class to initialise fully before accessing the
field by calling any method on the class, and for convenience
we use values().
2023-08-08 17:29:33 -07:00
Spottedleaf 65466558be Do not read tile entities in chunks that are positioned outside of the chunk
The tile entities are not accessible and so should not be loaded.
This can happen as a result of users moving regionfiles around,
which would cause a crash on Folia but would appear to function
fine on Paper.
2023-06-18 23:04:46 -07:00
Warrior d4ab21c047 Call BlockRedstoneEvents properly
Call BlockRedstoneEvents for lecterns.
Fix previous power level for experimental redstone wire.
2023-09-13 05:46:10 +02:00
Martijn Muijsers cdc3b28062 Do crystal-portal proximity check before entity lookup
This adds a very cheap distance check when an end crystal is placed.

Attempting to respawn the dragon, which involves looking up the end crystal
entities near the portal, every time an end crystal is placed, can be slow on
some servers that have players placing end crystals as a style of combat.

The very cheap distance check prevents running the entity lookup every time.
2023-08-15 21:04:55 +02:00
Lulu13022002 d66a2c4c26 Configure sniffer egg hatch time 2023-06-27 13:26:06 +02:00
Martijn Muijsers badf809fef Optimize nearest structure border iteration
Getting the nearest generated structure contains a nested set of loops that
iterates over all chunks at a specific chessboard distance. It does this by
iterating over the entire square of chunks within that distance, and checking
if the coordinates are at exactly the right distance to be on the border.

This patch optimizes the iteration by only iterating over the border chunks.
This evaluated chunks are the same, and in the same order, as before, to
ensure that the returned found structure (which may for example be a buried
treasure that will be marked on a treasure map) is the same as in vanilla.
2023-08-21 21:05:09 +02:00
Jake Potrebic 4527215d8e More DragonBattle API
== AT ==
public net.minecraft.world.level.dimension.end.EndDragonFight GATEWAY_COUNT
public net.minecraft.world.level.dimension.end.EndDragonFight gateways
public net.minecraft.world.level.dimension.end.EndDragonFight respawnCrystals
public net.minecraft.world.level.dimension.end.EndDragonFight spawnNewGateway(Lnet/minecraft/core/BlockPos;)V
2022-12-18 13:40:05 -08:00
Astralchroma 1abc111403 Configurable Region Compression Format 2022-10-27 22:19:31 +01:00
Jake Potrebic 597cb633e8 Properly handle BlockBreakEvent#isDropItems
Setting whether a block break dropped items controlled
far more than just whether blocks dropped, like stat increases
food consumption, turtle egg count decreases, ice to water
conversions and beehive releases
2023-03-04 10:52:52 -08:00
Spottedleaf 88464f509b Remove UpgradeData neighbour ticks outside of range
The lists are only supposed to contain ticks for the 1 radius
neighbours of the chunk.
2023-08-09 14:00:40 -07:00
Warrior d2f251cc5c Use correct source for mushroom block spread event 2023-08-08 11:49:32 +02:00
Jake Potrebic 36ae0bcfea Only capture actual tree growth 2021-08-21 18:53:03 -07:00
Jacob Litewski 1b118883f2 Make Amethyst throw both Spread and Grow Events 2023-06-13 19:16:39 -04:00
galacticwarrior9 6f37c3e39b Determine lava and water fluid explosion resistance by their block explosion resistance
When selecting which explosion resistance to use for lava and water, vanilla selects the highest value between their block explosion resistance and fluid explosion resistance.

Problems emerge when we want to reduce the explosion resistance of water or lava, since the fluid explosion resistance is hardcoded to return 100.0F and can't be changed by a plugin. This simply makes the fluid explosion resistance the same as the block explosion resistance, which allows plugin to change the value. Since both are the same in vanilla, this has no side effects on servers that do not need to do this.
2023-07-13 21:32:13 +01:00
Jake Potrebic 5b97ae9832 More Sign Block API
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
2023-06-23 12:16:28 -07:00
Spottedleaf bfd4276e56 Optimize player lookups for beacons
For larger ranges, it's better to iterate over the player list
than the entity slices.
2023-07-06 20:17:37 -07:00
Boy 539071158d Add option to disable block updates 2023-06-18 17:45:33 +02:00
Jake Potrebic b0579722db Fix cmd permission levels for command blocks 2022-01-24 15:32:02 -08:00
by77er 6702fe7546 Add event for player editing sign 2023-06-12 12:56:46 -04:00
Jake Potrebic 275331ae56 fix MapLike spam for missing key 'selector' 2023-06-14 13:17:40 -07:00
Lulu13022002 8ad0899aca Call BlockGrowEvent for missing blocks
Call the event for pitcher crops and sniffer egg
2023-06-09 13:04:42 +02:00
Lulu13022002 439ca99331 Fix block place logic
Fix several issues when a player interact with a block:
* the place sound isn't played for the dispensed shulker block
* desync of the jukebox blocks between bukkit handler and the vanilla interaction
* poi can desync when the BlockPhysicsEvent is cancelled
2023-04-03 18:46:49 +02:00
Spottedleaf dfe1579715 Break redstone on top of trap doors early
This logic hooks into the neighbour update which should be invoked
as a result of redstone powering the trap door.
2023-05-01 18:31:26 -07:00
Jake Potrebic 988f9ed56f Fix a couple of upstream bed issues
Upstream incorrectly skipped explosion logic if
the bed was occupied and added a "feature" where
if you set your spawn in a respawn anchor world
but then replaced it with a bed, you could respawn
at the bed in that world.
2023-04-09 21:11:58 -07:00
Paul Sauve 8e6779e8e9 Use array for gamerule storage 2021-05-09 16:49:49 -05:00
Jake Potrebic b436c07ec7 Fix crash relating to bad recipes in furnace-like tile entities 2023-03-19 20:36:22 -07:00
Noah van der Aa 663afe7045 Add CompostItemEvent and EntityCompostItemEvent 2021-08-08 19:56:02 +02:00
Jake Potrebic 18a23db6f2 Improve PortalEvents 2022-12-15 10:33:39 -08:00
Jake Potrebic 981cf9de7a Add BlockLockCheckEvent 2022-05-21 20:59:45 -07:00
Spottedleaf adf175d7ca Improve inlining for some hot BlockBehavior and FluidState methods 2020-07-06 20:46:50 -07:00
Jan Villim bc5dd992ab Ability to control player's insomnia and phantoms 2022-01-22 17:56:19 +01:00
Jake Potrebic 012c32fac7 check global player list where appropriate
Makes certain entities check all players when searching for a player
instead of just checking players in their world.
2022-11-22 13:16:01 -08:00
Jake Potrebic e70d21dbfe ensure reset EnderDragon boss event name
Fix MC-257487
2022-11-12 10:08:58 -08:00