summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server
Commit message (Collapse)AuthorAgeLines
* Load chunks asynchronously for players.Travis Watkins2012-12-12-22/+204
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add RegionFile from mc-dev for diff visibilityTravis Watkins2012-12-12-0/+250
|
* Don't run mob pickup code on players. Fixes BUKKIT-3150Travis Watkins2012-12-12-1/+2
| | | | | | | 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.
* Fix players not being able to pickup items due to default values.feildmaster2012-12-11-7/+16
| | | | | | | | 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
* Players should be able to pick up items by default. Fixes BUKKIT-3143feildmaster2012-12-10-0/+1
| | | | 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.
* Add EntityEquipment API. Adds BUKKIT-3103feildmaster2012-12-10-2/+4
| | | | | | | | 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
* [Bleeding] Fix NPE with a null bedSpawnLocation. Fixes BUKKIT-1500EdGruberman2012-12-10-0/+1
|
* Implement FurnaceExtractEvent. Adds BUKKIT-2114feildmaster2012-12-08-0/+16
|
* Add SlotFurnaceResult for diff visibilityfeildmaster2012-12-08-0/+69
|
* Update entity state correctly when marked as persistent. Fixes BUKKIT-3123Travis Watkins2012-12-07-0/+4
| | | | | | | | | | 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.
* Fix "Commands Only" chat flag. Fixes BUKKIT-2238feildmaster2012-12-07-1/+1
| | | | Thanks for the commit @mrapple
* Don't run command blocks in empty worlds. Fixes BUKKIT-3094Travis Watkins2012-12-05-1/+6
|
* Persistence isn't just animals. Fix BUKKIT-3105feildmaster2012-12-05-1/+3
| | | | Also set to this value if the persistence hasn't been updated
* Add a custom shutdown message set in bukkit.yml. Addresses BUKKIT-3031feildmaster2012-12-05-2/+5
|
* Ensure animals don't despawn due to old default setting.Travis Watkins2012-12-04-1/+8
| | | | | | | | | | | 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.
* Fire EntityFormBlockEvent for FallingBlocks. Adds BUKKIT-3078Wesley Wolfe2012-12-04-4/+13
|
* Implement API for mob despawn when away from players. Adds BUKKIT-2986Travis Watkins2012-12-04-3/+3
| | | | | | | | 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.
* Fix leaky pipes (water flow). Fixes BUKKIT-3085feildmaster2012-12-01-3/+3
| | | | (Also, fix mistranslation for VehicleBlockCollisionEvent)
* [BREAKING] Update BlockFace directions. Fixes BUKKIT-1567, BUKKIT-3069feildmaster2012-12-01-5/+5
| | | | The answer is 42
* Fix missed refactoring in EntityWitherWesley Wolfe2012-11-30-1/+1
|
* Add data values to EntityChangeBlockEvent. Adds BUKKIT-3077, BUKKIT-3076Wesley Wolfe2012-11-30-5/+3
| | | | This change affects Endermen and Silverfish, adding a data value for the block change event.
* Use carried item for endermen's changed-block's id. Fixes BUKKIT-3075Wesley Wolfe2012-11-30-1/+1
|
* Take into account if the shooter is a player before considering pvp mode for ↵feildmaster2012-11-27-3/+3
| | | | projectiles. Fixes BUKKIT-3058
* Fix multi-world sounds not being sent correctly. Fixes BUKKIT-3051feildmaster2012-11-25-1/+2
|
* Call EntityInteractEvent for Wood Buttons. Fixes BUKKIT-3022feildmaster2012-11-24-1/+12
| | | | Prior to this, there was no way to tell when arrows trigger buttons
* Fix the previous fix for "infinite 'breeding' with MonsterEggs"feildmaster2012-11-22-0/+4
|
* Call MapInitializeEvent on newly created maps. Fixes BUKKIT-2907feildmaster2012-11-21-1/+4
|
* Add ItemMapEmpty for diff visibilityfeildmaster2012-11-21-0/+34
|
* Update invalidItems array. Fixes BUKKIT-2554.EvilSeph2012-11-20-1/+1
|
* Add SPAWNER_EGG spawn reason to allow for filtering. Adds BUKKIT-3000EvilSeph2012-11-20-1/+1
|
* Fix infinite 'breeding' with MonsterEggs. Fixes BUKKIT-2997EvilSeph2012-11-20-0/+6
| | | | | | 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.
* Add a DamageEvent for falling blocks which can damage entities. Fixes ↵feildmaster2012-11-20-1/+12
| | | | BUKKIT-2781
* Don't add player to world if join event did it already.Travis Watkins2012-11-18-2/+6
| | | | | | | | 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.
* Fix players losing experience when keepInventory is true. Fixes BUKKIT-2915EvilSeph2012-11-18-2/+4
|
* Fix missed rename making withers too cheaty. Fixes BUKKIT-2972Travis Watkins2012-11-18-1/+1
|
* Lower compression level to avoid overloading the thread. Fixes BUKKIT-2963Travis Watkins2012-11-18-1/+2
| | | | | | | | | | | | | | | | | 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.
* Use correct itemstack for dispenser behavior chaining. Fixes BUKKIT-2886James Clarke2012-11-17-29/+27
| | | | | | | 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.
* Don't kick player when they travel too far. Fixes BUKKIT-2968Travis Watkins2012-11-17-1/+2
| | | | | | | | | 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.
* Implement API for Skeleton and Zombie types. Fixes BUKKIT-2818James Clarke2012-11-17-1/+1
|
* Fire BlockSpreadEvent for vine growth. Fixes BUKKIT-1097Travis Watkins2012-11-17-7/+23
|
* Add BlockVine.java from mc-dev for diff visibility.Travis Watkins2012-11-17-0/+293
|
* Fire BlockFadeEvent when soil turns back to dirt. Fixes BUKKIT-1854Travis Watkins2012-11-17-2/+12
|
* Don't wait for main thread when processing commands.Travis Watkins2012-11-17-42/+54
| | | | | | | | 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.
* Don't create tile entity when block placement fails. Fixes BUKKIT-2924Travis Watkins2012-11-16-0/+6
| | | | | | | | | 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.
* Ignore empty custom payload packets. Fixes BUKKIT-2957Travis Watkins2012-11-16-0/+6
|
* Use synchronous calls and wait for chat disconnect. Fixes BUKKIT-2946Wesley Wolfe2012-11-16-4/+59
| | | | | | | 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.
* Update tile entity when interact event is cancelled.Travis Watkins2012-11-16-0/+5
| | | | | | | 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.
* Update CraftBukkit to Minecraft 1.4.5.Travis Watkins2012-11-16-4/+8
|
* Remove fire ticks if damage has been canceled. Fixes BUKKIT-2933feildmaster2012-11-15-0/+3
|
* Don't thread single chunk compression. Fixes BUKKIT-2927Travis Watkins2012-11-15-32/+3
| | | | | | | | | | | | | 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.