Commit Graph

2077 Commits

Author SHA1 Message Date
feildmaster
2ee62eb580 Implement API to get and set FireworkMeta on Firework entities 2012-12-21 23:56:54 -06:00
meiskam
fdb4b2d911 Implement Skull BlockState. Adds BUKKIT-3259 2012-12-21 22:47:11 -06:00
meiskam
39e2af7bd1 Added TileEntitySkull for diff visibility 2012-12-21 21:56:47 -06:00
Wesley Wolfe
78d384de93 Zero is not less than zero. Fixes BUKKIT-3259 2012-12-21 21:48:09 -06:00
feildmaster
a0cf0d03f4 Check file existence before determining readOnly. Fixes BUKKIT-3255 2012-12-21 19:31:39 -06:00
feildmaster
ec211ed952 Update enchantment handling to 1.4.6. Fixes BUKKIT-3256 2012-12-21 19:31:28 -06:00
feildmaster
f71be2506d Fix loading Items entities with an invalid item. Addresses BUKKIT-3249 2012-12-21 16:07:59 -06:00
feildmaster
118682ce5c Don't save server properties when it's read only. Fixes BUKKIT-3250 2012-12-21 15:40:39 -06:00
feildmaster
0216d09033 Fix command line arguments being ignored. Fixes BUKKIT-3247 2012-12-21 15:40:39 -06:00
feildmaster
e937307596 Add a null check for Item Entities. Fixes BUKKIT-3249 2012-12-21 15:40:27 -06:00
Wesley Wolfe
b870755edb Use max inventory size for new stack. Fixes BUKKIT-3240 2012-12-21 11:10:23 -06:00
Wesley Wolfe
708252c020 Implement 1.4.6 ItemMeta. Adds BUKKIT-3236, BUKKIT-3237
Some meta functionality is refactored into common methods.

CraftItemStack uses the ItemMetaKey identifiers for enchantments.

Refactored unit test to include extra functionality; initially only
checking the presence of the DelegateDeserialization annotation.
2012-12-21 10:36:34 -06:00
Wojciech Stryjewski
f377a7680f Add API to allow plugins to request players switch to a texture pack. Adds BUKKIT-2579
The setTexturePack method causes the player's client to
download and switch to a texture pack specified by a URL.

Note: Players can disable server textures on their client, in which
case this API would not affect them.
2012-12-20 22:09:38 -05:00
feildmaster
f4836fb428 Add the ability to make Enchanted Books. Fixes BUKKIT-3220 2012-12-20 20:51:51 -06:00
feildmaster
bd0daa6d54 Remove obsolete fix for the end
The end was getting block offsets, causing client side issues.
2012-12-20 19:15:37 -06:00
Travis Watkins
ca7f67da9d Fetch correct info for skulls in block.getDrops(). Fixes BUKKIT-3205 2012-12-20 15:06:01 -06:00
Mike Primm
ed2dd31a80 [Bleeding] Fix exception in getChunkSnapshot() - sky light can be null 2012-12-20 14:22:25 -06:00
feildmaster
686807e387 Filter invalid ItemStacks from Packets.
Invalid ItemStacks are causing Fireworks to disconnect players and
prevent them from reconnecting
2012-12-20 10:52:44 -06:00
feildmaster
23b6764374 Update CraftBukkit to Minecraft 1.4.6 2012-12-20 10:43:00 -06:00
mbax
924a46469d [Bleeding] Check visibility API for sounds. Fixes BUKKIT-3114
With 1.4, entity sound tracking changed for the better.
Our previous method additions can now be removed.
All that's left is checking if the source can be seen
by the recipient of the sound packet. Thanks, Mojang!
2012-12-18 19:02:20 -06:00
feildmaster
d9708d032e Fix PotionMeta not applying the correct Id. Fixes BUKKIT-3193 2012-12-18 18:43:53 -06:00
feildmaster
d73e5ab469 Add missing name in PotionEffect for Wither 2012-12-18 18:20:11 -06:00
feildmaster
a2d551fafa Refactor get/setChestPlate to Chestplate. Addresses BUKKIT-3189 2012-12-18 03:46:58 -06:00
Wesley Wolfe
6cec8ba5cb Change enchantment comparisons to isSimilar. Fixes BUKKIT-3183
The purpose of the isSimilar method was designed to consider all NBT
data, not solely enchantments, without the need to have exact stack
size matches. The respective methods in CraftInventory were still
comparing enchantments instead of the ItemMeta.
2012-12-17 16:43:16 -06:00
Wesley Wolfe
d66d3674ea Clarify functionality in CraftInventory. Fixes BUKKIT-3097
Changes some NPEs to IllegalArgumentExceptions for exception consistency.

Contains(ItemStack, int) correctly calculates number of ItemStacks.

Adds a containsAtLeast(ItemStack, int) for finding a combined amount of a
single similar ItemStack.

Makes some utility methods private to prevent ambiguity in use.
2012-12-17 16:39:25 -06:00
Wesley Wolfe
78f48258d8 Implement ItemFactory and ItemMeta values. Adds BUKKIT-15 2012-12-17 01:31:41 -06:00
feildmaster
d20d4dc43a ItemStack.asBukkitStack(null) should return Air. Fixes BUKKIT-3170 2012-12-15 01:52:42 -06:00
Wesley Wolfe
0f4c206f9b Add isRecord and new material method tests.
Cleaned up all of the CraftBukkit tests, including moving some tests
from MaterialTest to PerMaterialTest.
2012-12-14 02:02:02 -06:00
deathmarine
53b064ec79 Fix EntityEquipment positions being reversed. Fixes BUKKIT-3157 2012-12-12 22:20:44 -06:00
Travis Watkins
24143ef6a1 Load chunks asynchronously for players.
When a player triggers a chunk load via walking around or teleporting there
is no need to stop everything and get this chunk on the main thread. The
client is used to having to wait some time for this chunk and the server
doesn't immediately do anything with it except send it to the player. At
the same time chunk loading is the last major source of file IO that still
runs on the main thread.

These two facts make it possible to offload chunks loaded for this reason
to another thread. However, not all parts of chunk loading can happen off
the main thread. For this we use the new AsynchronousExecutor system to
split chunk loading in to three pieces. The first is loading data from
disk, decompressing it, and parsing it in to an NBT structure.  The second
piece is creating entities and tile entities in the chunk and adding them
to the world, this is still done on the main thread. The third piece is
informing everyone who requested a chunk load that the load is finished.
For this we register callbacks and then run them on the main thread once
the previous two stages are finished.

There are still cases where a chunk is needed immediately and these will
still trigger chunk loading entirely on the main thread. The most obvious
case is plugins using the API to request a chunk load. We also must load
the chunk immediately when something in the world tries to access it. In
these cases we ignore any possibly pending or in progress chunk loading
that is happening asynchronously as we will have the chunk loaded by the
time they are finished.

The hope is that overall this system will result in less CPU time and
pauses due to blocking file IO on the main thread thus giving more
consistent performance. Testing so far has shown that this also speeds up
chunk loading client side although some of this is likely to be because
we are sending less chunks at once for the client to process.

Thanks for @ammaraskar for help with the implementation of this feature.
2012-12-12 19:35:53 -06:00
Travis Watkins
11593b4592 Add RegionFile from mc-dev for diff visibility 2012-12-12 04:05:47 -06:00
Wesley Wolfe
29d7cc711b Add utility class AsynchronousExecutor
This class is a general purpose task execution system, that uses stages
to separate processing blocks for asynchronous and synchronous
executions.
2012-12-12 04:05:47 -06:00
Travis Watkins
24c04dc784 Don't run mob pickup code on players. Fixes BUKKIT-3150
When a player has canPickUpLoot set to true the code for mob pickup is
triggerd which does not know how to deal with player inventory. Since
players have their own logic for picking up items we simply disable this
code for them.
2012-12-12 03:08:14 -06:00
feildmaster
4e91fbd0db Fix players not being able to pickup items due to default values.
The old flag for picking up loot was default to false, making existing players not able to pickup items. We now use this flag for Players, which gives us the problem we had in 48b46f83.

To fix this, we add an incremental flag that will be cross-examined to check if the data was saved before or after the flag level was introduced.

Addresses BUKKIT-3143
2012-12-11 06:05:54 -06:00
feildmaster
39fdb56200 Players should be able to pick up items by default. Fixes BUKKIT-3143
As an added feature, players defaulted to being able to not pick up items if the flag was false. However, since minecraft doesn't normally use the flag on players, the flag was always false.
2012-12-10 20:27:40 -06:00
feildmaster
3692209fe6 Missed a rename 2012-12-10 19:17:47 -06:00
feildmaster
430d352a5a Add EntityEquipment API. Adds BUKKIT-3103
Adds:
- Getting/Setting equipment
- getting/setting drop rates
- getting/setting ability to pick up items
-- As an added feature, players with this flag start off with a canceled PlayerPickupItemEvent
2012-12-10 19:01:50 -06:00
h31ix
684ba31c39 [Bleeding] Correct getEyeHeight value. Fixes BUKKIT-3130 2012-12-10 01:41:00 -06:00
feildmaster
22b1100001 Only display help aliases when there are aliases. Fixes BUKKIT-1621 2012-12-10 01:40:22 -06:00
feildmaster
dc93da8e34 Pass null help values values as empty strings to HelpTopics
Fixes BUKKIT-2618 and BUKKIT-2561
2012-12-10 01:40:21 -06:00
EdGruberman
f18b3cdc76 [Bleeding] Fix NPE with a null bedSpawnLocation. Fixes BUKKIT-1500 2012-12-10 01:40:20 -06:00
Wesley Wolfe
4d2a92ed47 Add isSolid() tests for each material 2012-12-09 18:15:34 -06:00
feildmaster
12c7c2f695 Implement FurnaceExtractEvent. Adds BUKKIT-2114 2012-12-08 03:58:34 -06:00
feildmaster
e760d6eb31 Add SlotFurnaceResult for diff visibility 2012-12-08 02:45:50 -06:00
EdGruberman
24abdd556d [Bleeding] Fix NPE in getBedSpawnLocation. Fixes BUKKIT-1949 2012-12-08 02:18:06 -06:00
Dark Arc
090c1a60bd Correctly shoot arrows with the spawnArrow Method. Fixes BUKKIT-3116 2012-12-08 02:15:15 -06:00
Travis Watkins
9973e7cdec Update entity state correctly when marked as persistent. Fixes BUKKIT-3123
When a mob is marked with the persistent flag (animal or anything with
setRemoveWhenFarAway(false)) the entire block of code for checking if they
should be despawned is skipped. However, one part of this code updates the
mob state if a player is close enough to them. It turns out this state is
used by the AI system to decide if the mob should move around randomly or
not. To stop mobs from being frozen in place we now update this state if
the persistent flag is set as well.
2012-12-07 21:18:51 -06:00
Travis Watkins
846a22304c Provide a faster way to get a location. Adds BUKKIT-3120
Currently when a plugin wants to get the location of something it calls
getLocation() which returns a new Location object. In some scenarios this
can cause enough object creation/destruction churn to be a significant
overhead. For this cases we add a method that updates a provided Location
object so there is no object creation done. This allows well written code
to work on several locations with only a single Location object getting
created.

Providing a more efficient way to set a location was also looked at but
the current solution is the fastest we can provide. You are not required
to create a new Location object every time you want to set something's
location so, with proper design, you can set locations with only a single
Location object being created.
2012-12-07 21:15:05 -06:00
feildmaster
c74fd4196f Use shooter constructor for Fireballs. Fixes BUKKIT-3121
Fixes fireballs exploding in the shooter's face and not having a shooter for the projectile. (Two birds with one stone!)
2012-12-07 05:25:20 -06:00
feildmaster
78bc0ad1d5 Add the ability to launch WitherSkulls. Fixes BUKKIT-3106 2012-12-07 05:25:11 -06:00
feildmaster
72ee1f3182 Fix "Commands Only" chat flag. Fixes BUKKIT-2238
Thanks for the commit @mrapple
2012-12-07 05:22:00 -06:00
feildmaster
6a04fd98ad Implement API for wolves collar color. Adds BUKKIT-3109 2012-12-05 18:08:31 -06:00
Travis Watkins
1af83da760 Don't run command blocks in empty worlds. Fixes BUKKIT-3094 2012-12-05 13:37:13 -06:00
feildmaster
09684ba9d7 Persistence isn't just animals. Fix BUKKIT-3105
Also set to this value if the persistence hasn't been updated
2012-12-05 12:28:09 -06:00
feildmaster
fb6d9e1808 Add a custom shutdown message set in bukkit.yml. Addresses BUKKIT-3031 2012-12-05 06:07:10 -06:00
Travis Watkins
320712aba7 Allow placing blocks in spawn if ops.txt is empty. Fixes BUKKIT-3004 2012-12-05 05:01:15 -06:00
Travis Watkins
5409d05d3a Ensure animals don't despawn due to old default setting.
The old default for the persistent flag on mobs was false which was then
written out to their NBT data when they were saved. We now use this data
for all mobs, not just non-animal mobs. However, this means animals that
spawned before that change will now start despawning like monsters do.

To avoid this we add a new flag to the mob's saved data to mark if the
data was saved before or after we started using it and ignore it if it
was before.
2012-12-04 23:15:53 -06:00
Wesley Wolfe
b854320fc8 Fire EntityFormBlockEvent for FallingBlocks. Adds BUKKIT-3078 2012-12-04 22:38:51 -06:00
Travis Watkins
4dadf0e2b5 Implement API for mob despawn when away from players. Adds BUKKIT-2986
As of 1.4 mobs have a flag to determine if they despawn when away from a
player or not. Unfortunately animals still use their own system to prevent
despawning instead of making use of this flag. This change modifies them
to use the new system (defaults to true) and to add API for plugins to adjust
this.
2012-12-04 20:10:23 -06:00
feildmaster
11894784b0 Fix leaky pipes (water flow). Fixes BUKKIT-3085
(Also, fix mistranslation for VehicleBlockCollisionEvent)
2012-12-01 13:33:44 -06:00
feildmaster
c596093c31 [BREAKING] Update BlockFace directions. Fixes BUKKIT-1567, BUKKIT-3069
The answer is 42
2012-12-01 01:14:25 -06:00
Wesley Wolfe
3404318bc5 Fix missed refactoring in EntityWither 2012-11-30 17:50:09 -06:00
Wesley Wolfe
1a6a828156 Add data values to EntityChangeBlockEvent. Adds BUKKIT-3077, BUKKIT-3076
This change affects Endermen and Silverfish, adding a data value for the block change event.
2012-11-30 11:59:29 -06:00
Wesley Wolfe
9bd02495df Use carried item for endermen's changed-block's id. Fixes BUKKIT-3075 2012-11-30 11:49:01 -06:00
feildmaster
0c16afd6e0 Take into account if the shooter is a player before considering pvp mode for projectiles. Fixes BUKKIT-3058 2012-11-27 12:14:53 -06:00
feildmaster
1040a81334 Fix multi-world sounds not being sent correctly. Fixes BUKKIT-3051 2012-11-25 18:05:17 -06:00
feildmaster
aa99d67963 Call EntityInteractEvent for Wood Buttons. Fixes BUKKIT-3022
Prior to this, there was no way to tell when arrows trigger buttons
2012-11-24 01:41:19 -06:00
feildmaster
cd66edd40f Fix the previous fix for "infinite 'breeding' with MonsterEggs" 2012-11-22 21:42:34 -06:00
feildmaster
22e26a5029 Call MapInitializeEvent on newly created maps. Fixes BUKKIT-2907 2012-11-21 16:48:25 -06:00
feildmaster
f0325da814 Add ItemMapEmpty for diff visibility 2012-11-21 16:19:56 -06:00
feildmaster
71b0510f88 Fix teleporting entities with vehicles/passengers teleporting you illegally. Fixes BUKKIT-2821
Also some formatting...
2012-11-20 19:41:56 -05:00
EvilSeph
fed863049d Update invalidItems array. Fixes BUKKIT-2554. 2012-11-20 19:37:01 -05:00
EvilSeph
a17ca07fe8 Add SPAWNER_EGG spawn reason to allow for filtering. Adds BUKKIT-3000 2012-11-20 19:37:01 -05:00
EvilSeph
c36b3da573 Fix infinite 'breeding' with MonsterEggs. Fixes BUKKIT-2997
If the player is not in Creative (i.e. does not have the ability to
instantly build) we need to decrement the MonsterEgg item stack when used
on a breedable parent mob.
2012-11-20 19:37:00 -05:00
feildmaster
5f5dd727b6 Add a DamageEvent for falling blocks which can damage entities. Fixes BUKKIT-2781 2012-11-20 17:16:30 -06:00
Wesley Wolfe
d039986be7 No teleporting people back into the server. Fixes BUKKIT-2298
Stale player references will add a player back into the world when
teleporting them, causing a cascade of issues relating to ghost entities
and servers failing to stop.
2012-11-19 21:38:31 -06:00
Travis Watkins
8f4cde24bd Don't add player to world if join event did it already.
On join we unconditionally add the player to the world they logged out in.
If a plugin teleports a player during PlayerJoinEvent in a way that adds
them to a world (cross-world teleport) we end up with one player in two
places. To avoid this we check to see if the player has changed worlds or
is already added to the world we have we skip adding them again.
2012-11-18 21:27:48 -05:00
EvilSeph
cc78e17312 Fix players losing experience when keepInventory is true. Fixes BUKKIT-2915 2012-11-18 17:45:29 -05:00
Travis Watkins
7ef9adc04e Fix missed rename making withers too cheaty. Fixes BUKKIT-2972 2012-11-18 16:14:08 -06:00
Travis Watkins
58636c2dd8 Don't do case lookups when we have the right case already.
This is a missed part of the original "[Bleeding] Use case from player data
for OfflinePlayer. Fixes BUKKIT-519" commit. It avoids doing (somewhat
expensive) lookups of player data to find the correct capitalization inside
getOfflinePlayers() as we're already loading their name from the player data
and thus have the correct capitalization.
2012-11-18 10:51:52 -06:00
Travis Watkins
1044c32a54 Lower compression level to avoid overloading the thread. Fixes BUKKIT-2963
When sending chunks to a player we use their writer thread to do chunk
compression to avoid blocking the main thread with this work. However,
after a teleport or respawn there are a large number of chunk packets to
process. This causes the thread to spend a long period handling compression
while we continue dumping more chunk packets on it to handle. The result of
this is a noticable delay in getting responses to commands and chat
immediately after teleporting.

Switching to a lower compression level reduces this load and makes our
behavior more like vanilla. We do, however, still give this thread more
work to do so there will likely still be some delay when comparing to
vanilla. The only way to avoid this would be to put chunk compression back
on the main thread and give everyone on the server a poorer experience
instead.
2012-11-18 09:16:50 -06:00
Karl Fritsche
028860399b Implement sound changes for Minecraft 1.4.2 changes. Fixes BUKKIT-2849 2012-11-17 15:06:18 -06:00
James Clarke
a575e6b075 Use correct itemstack for dispenser behavior chaining. Fixes BUKKIT-2886
When an event changes the item to be dispensed we check to see if the new
item has special behavior for dispensing and if so pass it on to that
behavior handler. However, we are actually checking the old itemstack and
passing the new itemstack so this check fails.
2012-11-17 15:06:18 -06:00
EdGruberman
293474d99b [Bleeding] Use case from player data for OfflinePlayer. Fixes BUKKIT-519
If a plugin looks up a player that is offline they may not know the correct
capitalization for the name. In this case they're likely to get it wrong
and since we cache the result even after the player joins the server all
future request for an OfflinePlayer will return one with incorrect case.

When looking up a player who has played on the server before we can
get the correct case from the player data file saved by the server. If
the player has never played before this point we cannot do anything and
will still have the same issue but this is not a solvable problem.
2012-11-17 15:06:18 -06:00
Travis Watkins
20c074ec6c Don't show a player on map if they're vanished. Fixes BUKKIT-1882 2012-11-17 15:06:06 -06:00
Travis Watkins
2d832bf148 Don't kick player when they travel too far. Fixes BUKKIT-2968
If a player travels past 32,000,000 blocks on the X or Z coordinates they
will be kicked for having an illegal position. On kick their player data
is saved which includes their (illegal) position. This means on join they
are immediately kicked again for the same reason and are stuck. Instead of
kicking at all in this case just teleport the player back to their previous
position just like the moved wrongly check does.
2012-11-17 15:00:14 -06:00
James Clarke
bd0868ae1e Implement API for Skeleton and Zombie types. Fixes BUKKIT-2818 2012-11-17 15:00:14 -06:00
Travis Watkins
dca54ff187 Fire BlockSpreadEvent for vine growth. Fixes BUKKIT-1097 2012-11-17 15:00:14 -06:00
Travis Watkins
0c78ce40e5 Add BlockVine.java from mc-dev for diff visibility. 2012-11-17 15:00:14 -06:00
Travis Watkins
9ab40b1ab3 Fire BlockFadeEvent when soil turns back to dirt. Fixes BUKKIT-1854 2012-11-17 14:59:41 -06:00
Travis Watkins
558411692a Don't wait for main thread when processing commands.
In order to correctly handle disconnects for invalid chat we setup a
Waitable and pass it to the main thread then wait for it to be processed.
However, commands are also chat packets and they are already on the main
thread. In this case, waiting will deadlock the server so we should just
do a normal disconnect.
2012-11-17 11:48:22 -06:00
Travis Watkins
9add7d3000 Don't create tile entity when block placement fails. Fixes BUKKIT-2924
End portals can only be placed in the end during the dragon's death.
Attempts to place them outside of this window causes the block to remove
itself. However, we still create the tile entity for the portal which
leads to exceptions spamming the console about a tile entity existing
without the appropriate block. In these cases we should not place the tile
entity at all.
2012-11-16 16:56:49 -06:00
Travis Watkins
d21c5f3871 Ignore empty custom payload packets. Fixes BUKKIT-2957 2012-11-16 16:15:41 -06:00
Wesley Wolfe
6466aa1d25 Use synchronous calls and wait for chat disconnect. Fixes BUKKIT-2946
When invalid chat is detected we currently drop the connection with no
hint as to why as anything else is not allowed while we're off the main
thread. To give valid disconnect reasons and fire proper events instead
pass these off to the main thread and wait for it to process them.
2012-11-16 15:56:13 -06:00
Travis Watkins
82c8cf4234 Update tile entity when interact event is cancelled.
If a plugin cancels a PlayerInteractEvent when left clicking a block the
client may have removed this block if they are in creative mode or if the
block breaks in a single hit. In this case, we need to update the client's
tile entity as well as telling it the block still exists.
2012-11-16 13:46:52 -06:00
Travis Watkins
6952ad1e59 Update CraftBukkit to Minecraft 1.4.5. 2012-11-16 10:13:34 -06:00
feildmaster
8e806550d7 Remove fire ticks if damage has been canceled. Fixes BUKKIT-2933 2012-11-15 19:26:39 -06:00
Travis Watkins
6149fc3e78 Don't thread single chunk compression. Fixes BUKKIT-2927
Packet 51 is used to send updates about large changes to single chunks
and to remove chunks from the client when they get out of range. In the
first case a single packet object is created and queued for all relevant
players. With our current chunk compression scheme this means the first
player to have the packet processed will start the compression and get the
packet correctly but the rest will get garbage.

Since this packet never contains much data it is better to simply handle
compression of it on the main thread like vanilla does instead of putting in
locks and dealing with their overhead and complexity.
2012-11-15 16:09:21 -06:00
Travis Watkins
e1afee008f Update tile entity on client on cancelled block break. Fixes BUKKIT-2935
When a client tries to break a block it assumes it has done so unless told
otherwise by the server. This means the client also wipes out any tile
entity data it has for the block as well. We do not send this data when
updating the client so clients lose things like text on signs, skull type,
etc when they aren't allowed to break the block.
2012-11-14 20:14:47 -06:00
Travis Watkins
df69ea8814 Rework skull dropping. Fixes BUKKIT-2930 and BUKKIT-2820
Skulls need their tile entity in order to create an item correctly when
broken unlike every other block. Instead of sprinkling special cases all
over the code just override dropNaturally for skulls to read from their
tile entity and make sure everything that wants to drop them calls this
method before removing the block. There is only one case where this wasn't
already true so we end up with much less special casing.
2012-11-14 20:14:47 -06:00
Wesley Wolfe
092800af26 Fixed some async tasks running synchronously. Fixes BUKKIT-2934
Additionally refactored cancel method to be more object-oriented.
2012-11-14 16:47:21 -06:00
Travis Watkins
c2bae0bebb Add crafting result slot for sheep breeding. Fixes BUKKIT-2926
Sheep now use the crafting system when breeding to determine what color
their baby should be. This triggers an event but the event wants the
crafting inventory to have a result slot which sheep do not have. This
event could be useful for plugins to control the output of sheep breeding
so instead of disabling it we add a result slot so the event fires without
issue.
2012-11-14 13:27:45 -06:00
Travis Watkins
188a71ad5b Clear out empty extended block ID array. Fixes BUKKIT-2923
If a chunk gets a block added to it that requires the extended block id
nibble array (block id greater than 255) the array is created and saved
with the chunk. When the blocks are verified to make sure they exist these
entries are erased but the extended block id array is not. This causes the
server and client to disagree about how much data a chunk has which makes
the client crash while trying to load the chunk for rendering.

To resolve these issues we now clear the extended block id array on chunk
load if there is no valid data in it.
2012-11-14 11:36:06 -06:00
Travis Watkins
2b22ae2d45 Potentially fix glitch with falling entities.
When a block creates a falling entity the block is not immediately removed
from the world. Instead, the falling entity is responsible for removing it
but only if the block still exists. Due to certain piston mechanics it is
possible to move the block before this check happens and thus the block is
not removed. This should be fine as the entity will kill itself in this
situation. However, the code does not stop here and continues running the
rest of the entity logic which includes either placing a block in the world
or placing a block item in the world depending on the circumstances.
2012-11-13 23:34:43 -06:00
Travis Watkins
db43197ecf Add EntityFallingBlock from mc-dev 2012-11-13 23:23:04 -06:00
Travis Watkins
5a999a2660 Correct digging behavior. Fixes BUKKIT-2780
If a block is air we return immediately so miss the cleanup work that would
normally happen in this case in vanilla. This causes us to get in to a
situation where, due to odd packet sending from the client, we never
properly stop an attempt by the client to break a block and thus it
eventually breaks.

We also use our own variable for block damage and never sync it up with the
vanilla one so damage reporting to other clients is not always correct.
2012-11-13 21:42:36 -06:00
Travis Watkins
7f7192f8fd Update CraftBukkit to Minecraft 1.4.4. 2012-11-13 16:09:52 -06:00
EvilSeph
f683d5568f Migrate world data with world when switching from vanilla Minecraft to
Bukkit. Fixes BUKKIT-2816 and BUKKIT-2760
2012-11-02 21:12:02 -04:00
md_5
53d24e2b22 [Bleeding] Fix mistranslation affecting time of the server vs time of day.
Fixes BUKKIT-2797
2012-11-02 16:36:43 -04:00
Wesley Wolfe
3dd0580d50 Improved the potion test to detect missing PotionType values. 2012-11-02 00:24:11 -05:00
Travis Watkins
87d25c4cc6 Fix compile issue with chunk generation. 2012-11-02 00:12:49 -05:00
feildmaster
a4892dfa72 Delegate recreateStructures to nms provider. Fixes BUKKIT-2760
This was a miss when updating to 1.4.2
2012-11-01 21:32:28 -05:00
Wesley Wolfe
1c14586c49 Add CraftArt mappings for Wither. Fixes BUKKIT-2667.
The static assertions are not normally evaluated in the JVM, and failed
to fail when the enums went from size 25 to size 26. This meant missing
values would not be detected at runtime and instead return null,
compounding problems later. The switches should never evaluate to null
so will instead throw runtime assertion errors.

Additional unit tests were added to detect new paintings and assure they
have proper, unique mappings. The test checks both that a mapping
exists, is not null, and does not duplicate another mapping.
2012-11-01 03:06:47 -05:00
Wesley Wolfe
9a88e615d4 Change ItemFrame to actually provide a defensive copy. Fixes BUKKIT-2784
If a defensive copy is not used in the API, changes to the item are
reflected in memory, but never updated to the client. It also goes
against the general contract provided in Bukkit, where setItem should be
the only way to change the underlying item frame.
2012-11-01 01:34:54 -05:00
EvilSeph
1623bf0f9b Fire HangingBreakEvent when explosions remove hanging entities. Fixes BUKKIT-2764 2012-10-31 14:24:03 -04:00
Travis Watkins
87a1cd3d43 Add inventory and slot types for new containers. Fixes BUKKIT-2741 2012-10-31 13:25:53 -04:00
Travis Watkins
347fd3cb6e Fix NPE when blowing up an item frame. Fixes BUKKIT-2763 2012-10-31 13:09:57 -04:00
Travis Watkins
f479aa84a4 Implement API for ambient mob spawn limit. Add spawn-limit.ambient to
bukkit.yml. Adds BUKKIT-2765
2012-10-31 13:01:48 -04:00
Travis Watkins
46d7cd1e05 Use BlockCommandSender for dispatching Command block commands
Also allow commands that don't start with a / to match vanilla behavior
2012-10-31 06:37:46 -05:00
feildmaster
9e4e2c62af Expose API for managing and using GameRules. Adds BUKKIT-2757 2012-10-31 03:40:43 -04:00
Travis Watkins
59dc403a61 Hook command block up to ConsoleCommandSender. Fixes BUKKIT-2684
This will need to have its own CommandSender but this makes command blocks
work for now with any command console can run.
2012-10-31 02:39:56 -05:00
h31ix
63eaf74d44 Implement the API for ItemFrames. Adds BUKKIT-2668 2012-10-31 01:18:59 -05:00
h31ix
02ca9be079 [Bleeding] Fire damage is no longer a valid reason for hanging entity removal 2012-10-31 00:45:47 -04:00
h31ix
54cce5bf92 [Bleeding] Implement new Hanging events. Adds BUKKIT-2754 2012-10-31 00:21:31 -04:00
EvilSeph
4efd06a6b5 Remove Anvil debug. Fixes BUKKIT-2732 2012-10-30 19:11:34 -04:00
md_5
42391009f7 [Bleeding] Prevent players from appearing to be sneaking after they change dimensions whilst doing so. 2012-10-30 19:11:34 -04:00
EvilSeph
b7886d1421 Disable portal support for entities for now. Restore allowNether check.
Relates to:
BUKKIT-2695 BUKKIT-2675
2012-10-30 19:11:33 -04:00
EvilSeph
6bf705dd08 Expose API for clearing a player's inventory with a successful count
return. Adds BUKKIT-2745
2012-10-30 04:55:02 -04:00
feildmaster
856fdc2ab6 Update map cursors to reflect 1.4 changes. Fixes BUKKIT-2740 2012-10-29 23:29:40 -04:00
EvilSeph
3047a424bb Expose API for giving and taking experience levels for use with ExpCommand's new behaviour with Minecraft 1.4. Adds BUKKIT-2739 2012-10-29 23:18:37 -04:00
feildmaster
aba7e2faf1 Revert changing EntityType.FIREBALL to LARGE_FIREBALL 2012-10-29 20:17:52 -05:00
Travis Watkins
216cddb2ab Get skull data before destroying block. Fixes BUKKIT-2723
Skull blocks store their type in a tile entity and use their block data
as rotation. When breaking a block the block data is used for determining
what item to drop. Simply changing this to use the skull method for getting
their drop data is not enough because their tile entity is already gone.
Therefore we have to special case skulls to get the correct data _and_ get
that data before breaking the block.
2012-10-29 12:54:16 -05:00
EvilSeph
14f4bd9024 Fix bug preventing non bed-reliant spawns from being successfully set. Fixes BUKKIT-2708 2012-10-29 04:56:30 -04:00
Travis Watkins
d16f8c5e65 Drop skulls like every other block. Fixes BUKKIT-2678
Instead of having a special case for skulls just use the normal logic for
breaking a block. This avoids issues when interacting with API.
2012-10-29 02:28:27 -05:00
EvilSeph
f4cdf8fe98 Add isHardcore API to check if the server is in hardcore mode or not. Adds BUKKIT-2707 2012-10-29 01:46:14 -04:00
EvilSeph
442b7a69f1 Prevent health from wrapping around. 2012-10-28 23:55:40 -04:00
h31ix
db49a57694 Update PotionEffects on player death. Fixes BUKKIT-2673
On player death player PotionEffects need to be updated so that a player's
invisibility and other effects are removed, otherwise they will persist
after a respawn. This is a carry-over from our use of persistent player
entities.
2012-10-28 23:27:02 -04:00
Travis Watkins
0fb806c566 Clamp difficulty levels to prevent invalid values
Some features added in 1.4.2 use the difficulty value as an index to an
array so while before having it set to an invalid value would do nothing
or maybe cause an odd side effect somewhere it now crashes the server. This
patch ensures difficulty values are clamped between 0 and 3, inclusive.
2012-10-28 10:07:11 -05:00
Travis Watkins
37a0d6757d Don't filter item data for anvils. Fixes BUKKIT-2640
Filtering item data is usually a good idea to make sure we don't have
invalid data or data on items that shouldn't have it. However, anvils
use item data in slightly different way and so running its code for
filtering here causes the data to be corrupted.
2012-10-28 09:37:47 -05:00
Travis Watkins
9841b77009 Use correct variable for squid Y motion. Fixes BUKKIT-2648 2012-10-28 03:23:48 -05:00
Travis Watkins
c675cc0b3b Fix missed rename for ore exp dropping. Fixes BUKKIT-2662 2012-10-28 02:43:23 -05:00
Travis Watkins
d97d193b91 Add new entities to World.spawn method. Fixes BUKKIT-2658 2012-10-28 02:21:34 -05:00
h31ix
788e9e84cf Fix incorrect method names missed during update. Fixes BUKKIT-2653
A couple method names were changed between 1.3.2 and 1.4.2 but were missed
in the update. One of these affects being able to enchant bows and the
other is used for updating player animations while firing.
2012-10-28 03:06:59 -04:00
EvilSeph
11d65171cd These books are too powerful! 2012-10-28 03:05:28 -04:00
EvilSeph
784f9e31a8 Remove spawn-radius setting in bukkit.yml in favour of spawn-protection in
server.properties. Fixes BUKKIT-2657
2012-10-28 01:55:27 -04:00
EvilSeph
5fe8523023 Fixed generator-settings not being set. Fixes BUKKIT-2652 2012-10-28 01:00:28 -04:00
Travis Watkins
5469311a36 Don't pass vanilla plugin channels to plugins. Fixes BUKKIT-2638
Vanilla has its own handlers for plugin channel messages for things like
texture packs, books, and anvils. When vanilla handles one of these messages
we should not also pass it to plugins because they will be duplicating work
and potentially running in to situations our plugin system isn't setup to
handle. This is how 1.3.2 worked but was lost in the 1.4.2 update.
2012-10-27 23:25:10 -05:00
Travis Watkins
60819c6693 Update CraftBukkit to Minecraft 1.4(.2). 2012-10-27 22:19:03 -04:00
EvilSeph
df7f86d028 Made books less powerful, though you should still read them! 2012-10-27 20:44:16 -04:00
Wesley Wolfe
4166af1d3a Implement chat tab completion API. Fixes BUKKIT-2608. Adds BUKKIT-2607.
The chat tab completion implementation also includes a sanity check to
assure type-safety in the list.
2012-10-17 04:31:36 -05:00