22 Commits

Author SHA1 Message Date
Dylan K. Taylor
98b36fd73e Enchantment: Implemented Efficiency
This is only needed server-side for block-break animation times.
2018-01-11 20:13:57 +00:00
Dylan K. Taylor
07c7048433 Enchantment: Converted item type bitflags to hex 2018-01-11 20:09:42 +00:00
Dylan K. Taylor
f09cf92197 Enchantment: Updated item type flags 2018-01-11 20:08:50 +00:00
Dylan K. Taylor
a6c1e02847 Enchantment: Register Respiration enchantment
First working enchantment on master. Hooray for 3 years late.

This works out of the box (the code checking for this enchantment already exists in Human->doAirSupplyTick()).
2018-01-11 18:32:22 +00:00
Dylan K. Taylor
a842a5319f Enchantment: Create constant name once, and reuse it
this is more readable and more maintainable.
2017-12-21 13:11:31 +00:00
Dylan K. Taylor
c2b0f6af22 Enchantment: Simplify getEnchantment() with null coalesce
This is made possible by 0e538ee51dc543e97994899bbf7a73f288fb33a6.
2017-12-21 13:02:24 +00:00
Dylan K. Taylor
6490d99ac2 Enchantment: Added a TODO (calculating XP min/max level cost bounds) 2017-12-21 12:55:55 +00:00
Dylan K. Taylor
e0b063ac85 Enchantment: Added max level property 2017-12-21 12:49:34 +00:00
Dylan K. Taylor
12ac2f4ac7 Enchantment: Fixed rarity constant values to match vanilla
Rarity is used for "weighting" enchantments on enchantment tables and such. Therefore higher numbers mean the enchantment is more common. This changes the rarity values to match vanilla.
2017-12-21 12:48:35 +00:00
Dylan K. Taylor
cc1951c7ba Enchantment: Remove activation type stuff
This isn't and won't be used anywhere.
2017-12-21 12:48:14 +00:00
Dylan K. Taylor
0e538ee51d
Enchantment: Split up enchantment type data and enchantment instance data (#1825)
* Enchantment: Split enchantment type data from instance data
This commit splits enchantments into (effectively) enchantment TYPES vs enchantment INSTANCES.

When applying an enchantment to an item, it only needs to know 2 things:
1. the enchantment ID (identifier) which is used to identify the TYPE
2. the enchantment LEVEL which is used to modify the enchantment's power IN THIS INSTANCE.

Therefore, the LEVEL is not an immutable property. However, all other properties of the currently-named "Enchantment" class are immutable type properties.
Currently, when applying an enchantment to an item, a copy of the enchantment object is created from the registry, and returned. This copies all of the properties contained by the type, which is obviously sub optimal.
2017-12-21 12:40:33 +00:00
Dylan K. Taylor
4f8e4f0522
Add EOF newlines where missing (bulk) (#1836)
This should solve issues with people making GitHub PRs and having the web editor messing things up. GitHub Web Editor sucks :(
2017-12-20 11:56:36 +00:00
Dylan K. Taylor
914e4c9a72 Enchantment: Fix formatting issue 2017-12-16 13:04:25 +00:00
Dylan K. Taylor
24387d1efe Enchantment: Add some PhpDoc for fields 2017-12-16 10:01:42 +00:00
Dylan K. Taylor
74b074753f Bulk addition of constant visibilities
thanks PhpStorm inspections plugin for annoying the shit out of me until
I did this.
2017-11-21 14:44:10 +00:00
Dylan K. Taylor
6dbdefafdd Add the long-awaited Enchantment::registerEnchantment() API method
api3/blocks users: I am sorry I kept you waiting so long
2017-10-09 11:40:53 +01:00
Dylan K. Taylor
3b7fc21839 Enchantment API changes, understandable constant names 2017-08-05 21:27:57 +01:00
Dylan K. Taylor
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
Dylan K. Taylor
9004417456 Fixed file headers (#255) 2017-01-13 16:57:05 +00:00
Shoghi Cervantes
fabb632286 More changes! 2015-08-13 18:02:10 +02:00
Shoghi Cervantes
f093a6498d Added base enchantment adding utilities, /enchant command 2015-08-08 16:03:04 +02:00
Shoghi Cervantes
4dd0469792 Base enchantment class 2015-08-08 14:53:03 +02:00