327 Commits

Author SHA1 Message Date
Dylan K. Taylor
1e67360048 SpawnEgg: Remove redundant isSurvival() check 2018-01-18 17:04:25 +00:00
Dylan K. Taylor
9551e5b8e5 Durable: Allow subclasses to override behaviour when the item breaks 2018-01-18 14:37:22 +00:00
Dylan K. Taylor
c7f15a556d Durable: Don't allow damage to exceed max damage 2018-01-18 14:34:50 +00:00
Dylan K. Taylor
efca9f0450 Item: Moved getMaxDurability() to Durable class only, and make it abstract
It's only now used in the Durable class, so it does not make sense to keep it in Item anymore. This is a leftover from the days where Durable did not exist.
2018-01-18 14:16:30 +00:00
Dylan K. Taylor
8d7c65585c
Enchantment: Implement Silk Touch (#1912) 2018-01-14 13:37:27 +00:00
Dylan K. Taylor
94feecd44b Enchantment: Implemented Unbreaking 2018-01-13 19:34:45 +00:00
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
b04cee12ea Item: Added API method getEnchantmentLevel() 2018-01-11 18:22:29 +00:00
Dylan K. Taylor
90fc649441 Fixed bad PhpDoc leftovers from NBT streams refactor 2018-01-04 20:32:06 +00:00
Dylan K. Taylor
5f48433c95 Bucket: Added sounds for bucket fill/empty 2018-01-03 14:27:41 +00:00
Dylan K. Taylor
33352638a9 Bucket: Fixed appearing empty when picking up still liquids
Buckets already affected by this bug will still appear empty until used. After that they'll work fine.
2018-01-03 14:22:53 +00:00
Dylan K. Taylor
db52501462 Bucket: Fixed stack size handling for empty buckets
GOD this code is horrible
close #1472
2018-01-03 14:12:04 +00:00
Dylan K. Taylor
965c19375f NBT: Split up concerns of endianness and varint NBT into their own classes, separate stream handling from NBT class
The remaining methods, constants and fields in the NBT class now pertain to generic NBT functionality (except for the matchList()/matchTree() methods, but that's a job for another time). All NBT I/O specific logic has now been moved to NBTStream and its descendents.
2017-12-30 14:55:45 +00:00
Dylan K. Taylor
1edf69892a Fixed chorus fruit teleporting players into the void in superflat worlds 2017-12-24 16:27:58 +00:00
Dylan K. Taylor
3bbdc5ab5b Implemented chorus fruit 2017-12-23 15:11:48 +00:00
Dylan K. Taylor
082e3404c3 Potion: Implement potion effects 2017-12-23 15:07:39 +00:00
Dylan K. Taylor
6e1df36188
Consumables refactor (#1796)
* Removed broken EntityEatEvents - these don't fit the pattern since they only apply to Human entities anyway. PlayerItemConsumeEvent and PlayerInteractEvent can be used for cancellation purposes, and plugins can do custom stuff without mess.

* Restrict item consuming to Living entities only

* Added FoodSource->requiresHunger()

* Only items implementing the Consumable interface can now be consumed.

* The effects from consuming items are now generic-ized by way of the Living->consume() function. This is overridden in Human to allow applying food and hunger.

* Fixed the hardcoded mess for buckets
2017-12-23 13:03:41 +00:00
Dylan K. Taylor
375243860e Potion: Restrict item stack size to 1 2017-12-21 15:02:56 +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
4bd4d42b82 Fixed raw porkchop being inedible 2017-12-14 09:09:47 +00:00
Dylan K. Taylor
0004e7429f Added some documentation on harvest level properties 2017-12-12 16:55:00 +00:00
Dylan K. Taylor
e2e6b7516a Removed WoodenTool classes
These were only needed for their fuel properties, which are the same for all tools of the wooden tier anyway.
2017-12-12 13:55:38 +00:00
Dylan K. Taylor
b903161a5d Refactored tool efficiency handling
This fixes lots of bugs with things like wool, cobwebs, swords.
2017-12-12 13:55:36 +00:00
Dylan K. Taylor
dbc180315e Declare tool harvest level as a property 2017-12-12 13:54:16 +00:00
Dylan K. Taylor
a02af1053f Remove redundant overrides from WoodenTools 2017-12-12 13:54:16 +00:00
Dylan K. Taylor
58327d0514 Change block tool types to bitflags
This allows specification of multiple tool types for a block, such as cobwebs.
2017-12-12 13:51:33 +00:00
Dylan K. Taylor
db31d13f96 Added Item->getBlockToolType() 2017-12-12 13:45:52 +00:00
Dylan K. Taylor
55d0684565 Move block-breaking tool-type constants to a BlockToolType interface 2017-12-12 13:45:52 +00:00
Dylan K. Taylor
7e3cd24444 Added TieredTool->getTier() 2017-12-12 13:45:51 +00:00
Dylan K. Taylor
2088a43c56 Refactored tool hierarchy 2017-12-12 13:45:51 +00:00
Dylan K. Taylor
79fd9b1c96 added RottenFlesh item 2017-11-24 10:46:55 +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
9da19b5f15 Added API methods for getting & setting armour dye colours 2017-11-21 14:10:33 +00:00
Dylan K. Taylor
eaba105614 Durable: use new CompoundTag API 2017-11-18 11:13:35 +00:00
Dylan K. Taylor
48a7627b96 add constants for NBT tag names in WritableBook 2017-11-17 10:48:48 +00:00
Dylan K. Taylor
235fc4cd2f remove redundant null coalesce 2017-11-17 10:45:14 +00:00
Dylan K. Taylor
e0654b85ba get rid of dynamic field assignments
nearly there now... eventually
2017-11-17 10:43:51 +00:00
Dylan K. Taylor
19315dfd06 Some cleanup on WritableBook code, get rid of some CompoundTag magic 2017-11-17 10:43:51 +00:00