818 Commits

Author SHA1 Message Date
Dylan K. Taylor
d0d16cdeb7
RuntimeDataDescriber: Introduce boundedIntAuto, replacing boundedInt
closes #6096
boundedIntAuto automatically calculates the correct number of bits to use based on the given bounds. The bounds must be constant, of course.
2023-10-17 12:03:43 +01:00
Dylan K. Taylor
18b711aca8
Apparently this function is no longer needed 2023-10-17 11:34:02 +01:00
Dylan K. Taylor
b0936a50c1
Block: split generateStatePermutations into type and state parts
this makes it marginally faster, since we can skip all permutations containing invalid type data.
I measured a performance improvement of about 20% across all blocks.
In addition, this makes it easier to locate where a problem is coming from if invalid inputs are accepted.
2023-10-17 11:28:58 +01:00
ace
82d6fc3890
Fix loading of Chiseled Bookshelf tile from vanilla world (#6084)
Co-authored-by: Dylan T <dktapps@pmmp.io>
2023-10-17 11:10:36 +01:00
Dylan K. Taylor
3c614b505d
Merge branch 'stable' into minor-next 2023-10-16 21:28:59 +01:00
Dylan K. Taylor
7d200247f8
Cactus: do not update if only age changed
I'd prefer a smarter solution for this that automatically disables updates depending on which type of property was changed, but for now, this will significantly improve the performance of cactus farms.
The newly placed cactus block at the top cannot have updates disabled, though, since it needs to check its surroundings in case it grew into a space with a solid block next to it.

Thanks @KingOfTurkey38 for bringing this to light.
2023-10-13 12:45:11 +01:00
ace
8b52a5cd9e
Fix book placed in wrong slot in Chiseled Bookshelf (#6085) 2023-10-10 12:35:50 +01:00
ace
c9163a1505
ChiseledBookshelf: Fix duplication bug (#6086)
Also fixes being able to put more than 1 book in the slot
2023-10-10 10:59:39 +01:00
Dylan K. Taylor
55cc5a6651
NetherVines: optimize condition order 2023-09-29 12:45:55 +01:00
Dylan K. Taylor
390cc3060a
Disable random ticking for some blocks depending on their states
we don't need to waste CPU time attempting to tick fully grown crops.
2023-09-29 12:45:37 +01:00
Dylan K. Taylor
ca69f08da0
ChorusFlower: move ticksRandomly() to a more appropriate place 2023-09-29 12:44:27 +01:00
Dylan K. Taylor
eac0564792
Fix CS 2023-09-29 12:31:11 +01:00
Dylan K. Taylor
628d77f8d7
Implemented pitcher plants, crops and pods 2023-09-29 12:30:52 +01:00
Dylan K. Taylor
fe543a4789
AgeableTrait: fixed incorrect number of bits
the original method breaks if MAX_AGE is 0 or any power of 2.
2023-09-29 12:05:39 +01:00
Dylan K. Taylor
31cd096b4b
Implement torchflower, its seeds and its crop 2023-09-28 17:13:33 +01:00
Dylan K. Taylor
4b9d170954
RuntimeDataDescriber: added dynamic method for reading and writing enum sets
this was previously only needed for brewing stands, but it's now become needed for chiselled bookshelves too.
2023-09-28 16:06:17 +01:00
HimmelKreis4865
d94391af57
Implement Chiseled Bookshelf (#5827) 2023-09-28 15:56:46 +01:00
Dylan K. Taylor
a6b030f2b3
Fix CSÂ 2023-09-27 17:07:02 +01:00
Dylan K. Taylor
56d7039086
Implemented budding amethyst and amethyst clusters 2023-09-27 17:02:37 +01:00
Dylan K. Taylor
6ec340359b
Implemented crimson and warped roots 2023-09-27 13:07:46 +01:00
Dylan K. Taylor
e9169cfa67
ChorusPlant: change stupid code 2023-09-08 17:34:47 +01:00
Dylan K. Taylor
537e194161
ChorusPlant: make use of StaticSupportTrait 2023-09-08 17:33:32 +01:00
Dylan K. Taylor
f7f5af607c
Merge branch 'stable' into minor-next 2023-09-08 17:20:45 +01:00
Dylan T
b293d7bf1f
Static support trait (#6044)
Added StaticSupportTrait for blocks which require unconditional support

dynamic support requirements, such as those presented by item frames and torches, are not included.

in addition, double blocks, such as tallgrass, small dripleaf and doors, do not cooperate well with this, so they are also not included.

some blocks which could be migrated (such as chorus plant) were skipped due to unresolved problems.
2023-09-08 17:19:06 +01:00
Dylan K. Taylor
efafc2c6ca
DeadBush: updated support requirements
since 1.20 they can now be placed on grass and mud.
2023-09-08 16:41:06 +01:00
Dylan K. Taylor
093b1e1b18
Merge branch 'stable' into minor-next 2023-09-08 12:48:40 +01:00
Dylan K. Taylor
d7f69c5e24
CaveVines: fixed incorrect support condition 2023-09-08 12:47:46 +01:00
ShockedPlot7560
d60fca0a1c
Age blocks logic moved into dedicated trait (#5962) 2023-09-08 12:25:26 +01:00
Dylan K. Taylor
0e87ee1e0e
ÂHangingRoots: fixed incorrect support face 2023-09-08 12:22:00 +01:00
Dylan K. Taylor
03ecc98a24
HangingRoots: fixed support conditions 2023-09-08 12:16:45 +01:00
Dylan K. Taylor
d3ab516ba4
CS 2023-09-08 11:26:58 +01:00
Dylan K. Taylor
aa916b2c49
WoodLikeBlockIdHelper: reduce obnoxious code 2023-09-08 11:17:47 +01:00
Dylan K. Taylor
7ce33d9375
Migrate final remaining EnumTrait users to native enums 2023-09-08 10:34:12 +01:00
Dylan T
7dcd2592d4
RuntimeDataDescriber: Support dynamically describing arbitrary enums (#6039)
Previously, we were using codegen to support describing a fixed set of enums.

Instead, we implement an enum() function, allowing any native PHP enum to be described.
All enums used in runtime data have been migrated to native PHP 8.1 enums in minor-next to facilitate this.

This implementation:

- is faster (in extreme cases by 40x, such as with PotionType)
- requires way less code
- does not require a build step
- is way more flexible

This fixes #5877, increasing the range of stuff that plugins are now able to do.

EnumTrait enums are not supported, as it's easier and cleaner to just support native enums. Most core EnumTrait enums have been migrated to native enums by now to facilitate this.
2023-09-07 20:07:14 +01:00
Dylan K. Taylor
b50efbc15a
Fix CS 2023-09-07 19:38:29 +01:00
Dylan K. Taylor
94d98fb5c4
Migrate all but two remaining legacy enums to native PHP 8.1 enums 2023-09-07 19:32:45 +01:00
Dylan K. Taylor
ae564e445d
Start migrating EnumTrait enums to PHP 8.1 native enums 2023-09-07 17:20:52 +01:00
Dylan K. Taylor
fe94379a93
Fixed connection requirements for fences, glass, bars and walls
these connect to the back faces of stairs and to glass, for example.
2023-09-06 12:56:47 +01:00
Dylan K. Taylor
5a010e8213
Merge branch 'minor-next' into stable 2023-09-06 12:06:15 +01:00
Jonathan B
ce04478395
Fix SmithingTableInventory size (#6035)
Since 1.20 SmithingTable has a new Template slot, size is now 3

Fix debug error from InventoryManager
2023-09-06 08:15:27 +01:00
Dylan K. Taylor
1504fdca24
Use 'enchanting' terminology
'enchant' just didn't feel right, being a verb.
All these things pertain to the act of enchanting.

This is now also consistent with CraftingTransaction etc. The ship already sailed on EnchantInventory, which will have to be renamed at a later datte. However, that was already inconsistent with 'enchanting table', so that's the odd one out here.
2023-08-23 16:14:17 +01:00
Dylan K. Taylor
bf668c0f6c
Rename EnchantHelper related stuff
Perhaps this and EnchantOption should be called EnchantingHelper and EnchantingOption respectively. The terminology used is rather inconsistent, but 'enchantment' definitely isn't the right word here.
2023-08-23 16:07:02 +01:00
Dylan K. Taylor
cd6abbe0bb
BaseSign: remove redundant condition 2023-08-21 16:30:16 +01:00
Dylan K. Taylor
22778583cf
Sign: implement waxing using honeycomb 2023-08-21 16:28:17 +01:00
Dylan K. Taylor
d44e0e87d0
BaseSign: implement sign editing
this was originally submitted by #6000, but considering the overcomplicated PR and the triviality of the feature, I figured it would be quicker to do it myself instead of having a bunch of back-and-forth bikeshedding over it.
2023-08-21 16:14:43 +01:00
Dylan T
e323c5dd76
Implement pressure plate activation logic and events (#5991)
closes #5936

This implements all of the basic activation logic for pressure plates.
It also introduces a PressurePlateUpdateEvent, which is called in pulses when entities are standing on top of the plate and when it deactivates. Deactivation can be detected by checking if the list of activating entities is empty.

---------

Co-authored-by: Javier León <58715544+JavierLeon9966@users.noreply.github.com>
2023-08-16 13:00:23 +01:00
Dylan K. Taylor
b330cbe8e2
Merge remote-tracking branch 'origin/stable' into minor-next 2023-08-15 17:41:41 +01:00
S3v3Nice
39867b97c5
Implement enchanting using enchanting tables (#5953)
Co-authored-by: Dylan K. Taylor <dktapps@pmmp.io>
2023-08-15 17:28:26 +01:00
ipad54
af9ae445fc
Fix cake drops (#5985)
closes #5984
2023-08-10 17:42:32 +01:00
Dylan K. Taylor
91d5a3ddfe
PotionCauldron: fixed setPotionItem() not validating the given item
we should probably remove this API and have enums for potion container and type tbh... this API was a mistake
2023-08-10 16:06:41 +01:00