Compare commits

..
168 Commits
Author SHA1 Message Date
Eloraam 82c0731888 Bumping the version number. 2011-12-21 10:22:37 +00:00
Eloraam a0b0faf693 Fixed some strange behavior in snow blocks. Fixed a missing patch checkin. 2011-12-21 10:15:38 +00:00
Eloraam ed3fe86454 A minimalistic hook for rendering world effect overlays or other 3D overlay
data.
2011-12-21 09:57:10 +00:00
Eloraam 5bf8a30ab8 Major rework of the rendering core. Added support for custom render context
handling.
2011-12-21 09:01:45 +00:00
LexManos 663ed58610 Added Item.onDroppedByPlayer hook 2011-12-21 07:44:01 +00:00
Eloraam d1909d30ac Deprecated IUseItemFirst, and made onUseItemFirst work in Creative. 2011-12-21 06:34:57 +00:00
LexManos 5013991fa4 Added server side prototypes for addCreativeItems()s They are unused, but declared for compiling compatibility. 2011-12-21 04:38:59 +00:00
LexManos 1ed1d233c7 Added hooks to BlockFire for setting block flame interaction properties. 2011-12-21 04:30:53 +00:00
LexManos 3fb9b988d9 Replaced dropBlockAsItemWithChance in BlockNetherStalk with getBlockDropped. 2011-12-21 00:44:53 +00:00
Eloraam 10f8c2c426 Fixed a minor crop fortune bug. 2011-12-20 21:39:53 +00:00
LexManos 8d43d859c7 Commit of a hook for adding items into world dungeon generation.
Uses a weighted random selection scheme.
Also a hook for adding custom mobs to the dungeon generation list.
2011-12-20 07:00:43 +00:00
LexManos 106b9dc4c9 Updated mappings 2011-12-20 06:58:29 +00:00
LexManos 8735d92ecd Implemented ISidedInventory for Brewing Stands.
Top is input, 1 slot
All other sides are output, 3 slots.
2011-12-19 06:33:20 +00:00
LexManos 87ea7289cb Added missing native library path to forge_client project.
Added harvest levels/effectiveness for Axes and Shovels.
2011-12-16 10:06:57 +00:00
LexManos 8a08602dc3 Fixed a zLevel bug with custom item renderers. 2011-12-14 10:45:37 +00:00
Space Toad 2995f1c072 bumped version numbers 2011-12-13 19:33:37 +00:00
LexManos 812be37f5f Fixed seeds/wheat not dropping from Crops/TallGrass.
All future Forge code should use proper annotations when Overriding.
2011-12-11 21:55:35 +00:00
LexManos 4928e3b059 Small fix to decrease the number of glBindTexture calls that are immediately overridden. 2011-12-11 11:50:55 +00:00
LexManos 3262b656a3 The install scripts will now only patch the client/server if they are there.
This allows for people to only worry about getting one side setup correctly if they don't care about the other.
2011-12-11 07:37:54 +00:00
LexManos 5fc1ee844d Fixed a infinite recursion loop in spacetoad's commit to Block.java.patch
Added @Deprecated annotations to the 'backwards compatible' functions spacetoad re-added.

Made changes to the install scripts:
-Will overwrite the current MCP mappings and use the ones that ship with forge, this 
    should eliminate all the issues of people not being able to install it because they updated there mcp.cfg
-Will now move fernflower.jar if it is found, so that MCP will not decompile using it.
    Should fix the issues of people trying to use forge with fernflower installed.
-Will call updatemcp/updatenames so that users get the latest mappings for unmapped items.
-Also calls updatemd5s so that the forge API is skipped when spitting out reobfusicated files.

Update the readme to be more accurate.
Added my name to the credits :P
Updated the update_patches/package scripts to account for grabbing the conf folder.
Added GnuWin32's grep
2011-12-11 07:04:21 +00:00
Space Toad 1be3e18a9d bumped version number 2011-12-10 11:07:51 +00:00
Space Toad e511ba7db8 further backward compatibility fixes 2011-12-10 11:05:49 +00:00
LexManos e08cec3bc0 Added my EnumHelper classes, this allows for dynamic creation of Enum values at runtime.
See My post for a example:
http://www.minecraftforum.net/topic/514000-api-minecraft-forge/page__view__findpost__p__10948540
2011-12-09 07:58:32 +00:00
LexManos d6a5cf2828 Missed some mappings 2011-12-09 06:51:31 +00:00
LexManos 03c5d8aeb4 For for updated mappings. 2011-12-09 04:40:32 +00:00
Space Toad 3c3654b576 added server side of the previous commit 2011-12-08 07:51:17 +00:00
Space Toad fb30b67adb fixed backwards compatibility 2011-12-07 21:30:48 +00:00
LexManos d08641aae5 Fixed fortune enchant.
This breaks forge's quantityDropped signature, be careful when updating mods.
2011-12-06 07:41:59 +00:00
LexManos 99542f5ef5 Cleaned up a few things related to MLProp
Deleted unmaintained fernflower patch.
2011-12-05 08:30:07 +00:00
Eloraam 5decee87d6 Added a hoe handler for advanced farming. 2011-12-02 04:32:10 +00:00
Eloraam 590072e636 Added new tool harvest intercept hook. Removed mlprop.patch. 2011-12-02 04:08:15 +00:00
LexManos fb1cd9be88 Moved dye creative adds to the ItemDye class. 2011-12-02 03:57:11 +00:00
LexManos 576ff2fadb Creative Container population hook. 2011-12-02 03:37:48 +00:00
Eloraam 9e28c51d23 Fixed missing CraftingManager patches for the repair disable hook.
Fixed smp mlprop.
2011-12-02 02:26:15 +00:00
LexManos 6d5dffa458 Added MLprop.java that ST forgot when he merged.
Fixed EntityPlayer.getPlayerStrVsBlock metadata function for 1.0.0 changes in Enchantments/Potions.
2011-12-01 07:29:06 +00:00
Space Toad 30b1f4c2ed bumped version number 2011-11-30 19:02:10 +00:00
Space Toad 0e221f098c merged with pre-1.9p5 branch, for 1.0.0 release 2011-11-30 19:00:43 +00:00
Space Toad e835fd2a46 fixed mapping 2011-11-15 18:46:42 +00:00
Eloraam 55f599e2b3 New block destruction hook. Deprecated IOverrideReplace. 2011-10-31 20:07:31 +00:00
Eloraam 68c3a5675f Updated MCP mapping, backed out a useless patch. 2011-10-31 19:24:45 +00:00
Eloraam a31f983e6a Added some IC2 items. 2011-10-27 02:05:43 +00:00
Eloraam a2fac655b4 Changed a field permission for MFR. 2011-10-26 04:42:37 +00:00
Eloraam 670180a0b6 Small TileEntity fix. 2011-10-25 19:28:47 +00:00
Eloraam 54da114945 Added a few more known ingots. 2011-10-25 17:15:12 +00:00
Eloraam ebd92e094d Bugfix for numeric range of mob and window IDs. 2011-10-22 11:53:00 +00:00
Eloraam 7f67f1f13a Fixed TileEntity caching. 2011-10-21 21:00:44 +00:00
Eloraam b719f6142c Patch for a small activation glitch in doors. 2011-10-19 02:45:51 +00:00
Eloraam 18795572fe MCP update.
Fixed a problem with TileEntity sending.
2011-10-19 02:00:50 +00:00
Eloraam fba7f7d1ab Rolled in a critical MLMP fix, because MLMP is virtually unmaintained. 2011-10-18 19:11:57 +00:00
Eloraam 1c253966c8 Added ore dictionary. 2011-10-18 18:56:10 +00:00
Eloraam effbaa0c74 Fix for new MCP mappings.
Fixed the distribution of flowers with bonemeal.
Fixed accidentally making obsidian easy to mine.
2011-10-13 07:10:43 +00:00
LexManos 321c8196e7 Fixed line endings in install.sh 2011-10-11 22:38:39 +00:00
LexManos 024ebad54a Updated the package.sh script to include the patches, the new install.sh, and modLoaderMP/mlprop.patch 2011-10-11 22:23:39 +00:00
LexManos d58587a016 Changed the windows setup to use del instead of remove.
Both update patches scripts no longer remove svn entries.
Added the forge_client\bin and forge_server\bin folders to the svn ignore.
2011-10-10 23:47:30 +00:00
Space Toad 249d607397 bumbed forge minor version 2011-10-10 19:21:41 +00:00
Space Toad 5a3585adaa reactivated special armor code 2011-10-10 19:16:11 +00:00
LexManos 8fb9ad4687 Made the windows setup script a bit more robust, also made both scripts filter out non-patch files. {Issue with svn files} 2011-10-10 00:09:48 +00:00
LexManos 6715ccd14a Fixed a bug in forge_client project that had a hard link to E:/MCP/jars/bin/paul.jar now points to MCP/jars/bin/minecraft.jar {has the same paulsound libraries}
Major refactoring of the patches, now each modified file gets its own patch file.
Rewrote all the scripts to use new multi-patch system.
Added linux install.sh using new system.
Added some required libraries from GNUWin32 for the windows side of the new setup.bat/update_patches.bat http://gnuwin32.sourceforge.net/
2011-10-09 04:21:29 +00:00
Eloraam cf456f9f3d Changed a field permission. 2011-10-05 22:54:20 +00:00
Eloraam a19394d48a Fixed another TileEntity bug. 2011-10-04 21:46:00 +00:00
Space Toad e233005138 ISidedInventory is now explicitely an inventory 2011-10-02 19:14:20 +00:00
Eloraam f579b2db69 Fixed the MCP mappings. 2011-10-02 18:42:15 +00:00
Eloraam fe62372429 - Added an ItemStack parameter to IArmorTextureProvider
- Added ISidedInventory
- Added IBonemealHandler
- Added hooks in grow-on-grass and in break tall grass.
- Fixed furnace output of multiple items.
- Added getBlockDropped().
- Bumped version number to 1.1.1.
2011-10-02 08:55:31 +00:00
Eloraam 12853df285 Hopefully fixed the major TileEntity bugs. 2011-09-30 12:32:27 +00:00
Eloraam 9034062c8c Fixed TileEntities, bumped version number. 2011-09-28 23:35:31 +00:00
Eloraam 2a950f3e80 Fixed digging particles. 2011-09-26 19:37:28 +00:00
Eloraam fb0ccd3618 Added a fix for onItemUse regression. 2011-09-22 10:12:05 +00:00
Eloraam a6214f2d45 More MCP mapping fixes. 2011-09-22 03:01:10 +00:00
Eloraam 3135a0650a Undid that. Whoops. 2011-09-22 02:49:33 +00:00
Eloraam d2c6244ca8 Code to remove a single block effectiveness. 2011-09-22 02:45:47 +00:00
Eloraam 74e7431ab6 Metadata-sensitive quantity dropped. 2011-09-21 08:08:58 +00:00
Eloraam 086b155e6b Fixed up a few bugs in the tool path. 2011-09-21 07:14:53 +00:00
Eloraam f82ee17e48 Fixed another bug in the furnace patch. Works now. 2011-09-21 01:05:44 +00:00
Eloraam ae02a73c67 Small bugfix for furnace patch. 2011-09-21 00:59:37 +00:00
Eloraam 561e3c773f Metadata-sensitive smelting patch. 2011-09-21 00:55:09 +00:00
Eloraam 4127a60d3f Fixes for MCP updates. 2011-09-19 20:40:07 +00:00
Eloraam e7c2b0506f Fixed the 1.8.1 version for MLMP support. 2011-09-19 20:30:34 +00:00
Eloraam 65e1544168 A bunch of little patches to make it actually build for 1.8.1. 2011-09-19 01:44:40 +00:00
Eloraam e9ae3a0a82 First attempt at a 1.8.1 version. May not work. 2011-09-19 01:30:41 +00:00
Eloraam b4fa5f58db Unrolled a mistaken fix. 2011-09-11 04:46:16 +00:00
Eloraam eda99a16fb Another try for osx. 2011-09-11 04:05:39 +00:00
Eloraam 721b3015db A small fix to hopefully make the script work on a mac. 2011-09-11 03:49:01 +00:00
Eloraam 297b35a136 Redesigned TileEntity handling. 2011-09-08 21:33:03 +00:00
Space Toad 29a712e0f9 fixed SMP bug related to BuildCraft issue #226 2011-09-07 19:57:53 +00:00
Eloraam 81802108ca A few small patches to fix obscure piston rendering bugs. 2011-09-07 15:14:01 +00:00
Eloraam 0908fdfe5c Optifine compatibility patch. 2011-09-07 14:58:08 +00:00
Space Toad fb070104a2 updated to latest MCP, and added custom item rendering facilities 2011-09-03 11:46:59 +00:00
Eloraam e85d4af5da Improved trapdoor hook. 2011-09-01 08:01:47 +00:00
Eloraam 54bb9a6efb New lighting hook. 2011-08-30 10:32:14 +00:00
Eloraam ca979fe391 Fixed new MCP mappings. 2011-08-30 06:18:32 +00:00
Space Toad f59a0f61aa bumped forge version # to 1.0.6 2011-08-28 12:54:47 +00:00
Space Toad 2a1342dc75 added ArmorProperties constructors, remove deprecated subprograms (supposedly not used by anyone) 2011-08-28 12:33:16 +00:00
Space Toad f264295d12 fixed headers, implemented new armor computation for IC2 2011-08-27 11:42:48 +00:00
Eloraam fb4bbaa85b Fixed the permissions on a couple fields in ItemTool. 2011-08-27 05:49:09 +00:00
Space Toad c25a08e946 temporary reverted to r61 2011-08-27 01:12:20 +00:00
Space Toad a6a1bcf402 updated credits 2011-08-25 19:47:34 +00:00
Eloraam 0ae9be4710 Patched the installer again. 2011-08-25 17:15:02 +00:00
Eloraam 4f7c0b73f8 Fixed a typo. 2011-08-25 07:19:49 +00:00
Eloraam 87a9cc96cb Small RedPower-specific patch. 2011-08-25 07:17:10 +00:00
Eloraam 07dd048d50 Added armor texture hook. 2011-08-25 00:23:31 +00:00
Eloraam 47bf6357c3 New install script for Windows. 2011-08-24 04:18:57 +00:00
Eloraam 705fc5b26c Fixed the version number. 2011-08-21 07:50:09 +00:00
Eloraam 7b35ba5be4 Changed some field permissions. 2011-08-20 22:23:29 +00:00
Eloraam 1a04139657 Handler for custom block highlight. 2011-08-20 10:35:14 +00:00
Eloraam 6cfbc34940 Version control logic, improved the destroy handling hook. 2011-08-20 08:59:05 +00:00
Eloraam 8fcc2a1f9f Improved BTW compatibility.
Finished the placement hook changes.
Added a sleep handler.
Added a current item destroyed handler.
2011-08-18 00:14:09 +00:00
Eloraam d3323f547c Checking in the new crafting hook. 2011-08-17 16:05:38 +00:00
Eloraam ad3d08f0ee Added a little support for two-pass rendering. 2011-08-17 10:23:10 +00:00
Eloraam f7a3157174 Forgot the forge hooks. 2011-08-13 18:26:31 +00:00
Eloraam 7de8218e4a Updates:
- Added warning message for non-preloaded textures.
- Documentation
- Ladder fix for SMP.
- Obsoleted IBlockSecondaryProperties
- Added hooks for place-by-side.
- Fixed texture 3 and piston texture bug.
- Added new tool system.
2011-08-12 23:53:30 +00:00
FlowerChild 0aeb6f1eab Added patches for decompiled by fernflower source. Client only, and not tested enough. Using is currently not recommended. 2011-08-12 13:52:53 +00:00
Eloraam 08beffb945 Uploaded new install file. 2011-08-12 04:17:33 +00:00
Eloraam ff6a314cf8 Fixed for the new version of MCP. 2011-08-11 21:10:52 +00:00
Eloraam 5a9c5b4b67 Uploaded install fix. 2011-08-08 19:50:09 +00:00
Eloraam 0d6fbf063b The ladder hook. 2011-08-08 16:55:50 +00:00
Eloraam b9a56c48b1 Fixed a typo in isBoundingBoxBurning. 2011-08-07 21:37:05 +00:00
Space Toad b9d42053b2 updated list of contributers 2011-08-06 21:54:56 +00:00
Space Toad 00cd110fae updated release and package script to take into account credit file 2011-08-06 21:23:38 +00:00
Space Toad 36ed659b17 renamed file 2011-08-06 21:18:31 +00:00
Space Toad be3b4cc3bc initial revision of the credit file, to be completed 2011-08-06 21:16:53 +00:00
Eloraam da26ee2422 Added a comment. 2011-08-06 18:29:58 +00:00
Eloraam 92d0d6f4e1 Added a small patch to MovingObjectPosition. 2011-08-06 18:22:24 +00:00
Eloraam 44992f9b69 Not really a change. 2011-08-05 14:58:18 +00:00
Eloraam c9bcb73636 Added a texture preloader to avoid render glitches on the first render. 2011-08-05 11:58:14 +00:00
Eloraam cd865a256b New multiple-tessellator texture renderer. 2011-08-05 11:07:03 +00:00
Eloraam 01c34eb0be New install script for Linux users. 2011-08-05 00:32:56 +00:00
Space Toad c9c2bbef1d improved installation and setup scripts 2011-08-04 06:10:38 +00:00
Eloraam 606e0d8e80 Added secondary block properties patch. 2011-08-03 05:15:31 +00:00
Eloraam bedcc2fc64 Fixed a little path bug. 2011-08-02 05:18:52 +00:00
Eloraam c7db47d528 Improved the setup scripts. 2011-08-02 03:54:59 +00:00
Eloraam f50d35ce3f Fixed bugs in the pickaxe code. 2011-08-01 02:06:00 +00:00
Eloraam 112adbef8f Improved some documentation. 2011-07-31 18:52:19 +00:00
Space Toad 0d917cfdcc removed inner classes, remove redundant biome control 2011-07-31 12:01:23 +00:00
Space Toad 8f03e6cd24 fixed files for release 2011-07-30 21:25:39 +00:00
Space Toad e507f90276 additional comments 2011-07-30 21:10:42 +00:00
Space Toad dae71d0b7a added comments 2011-07-30 21:01:03 +00:00
Space Toad 5b2be7903c fixed exceptions in minecraft code 2011-07-30 19:05:28 +00:00
Space Toad 6389b16609 fixed previous checkin 2011-07-30 16:13:31 +00:00
Space Toad 902f8918a3 added sources packaging 2011-07-30 16:13:14 +00:00
Space Toad 73d19ef0a3 add custom armor, for #13 2011-07-30 07:13:10 +00:00
Space Toad 80ab9a98bb first batch of documentation + minor reformatings 2011-07-30 06:42:15 +00:00
Eloraam 7837e4d3a1 Added explosion resistance hook. 2011-07-29 22:00:08 +00:00
Space Toad 423490e1c8 fixed addPixaxeBlockEffectiveAgainst 2011-07-29 21:25:22 +00:00
Eloraam deae2de0eb Added the four new hooks from RedPower, and the TileEntity bugfix. 2011-07-29 21:15:21 +00:00
Space Toad 821cc3ec54 added missing copyright header 2011-07-29 20:59:01 +00:00
Space Toad 9cb5f47805 added missing file 2011-07-29 20:58:31 +00:00
Space Toad c51848db5b added mineable block configuration, for #6 2011-07-29 17:55:34 +00:00
Space Toad 20c30d541c added missing graphical features, added configuration management, for #5 2011-07-20 19:58:59 +00:00
Space Toad d9e4d13d69 improved previous patch, extracted internal class 2011-07-19 18:41:51 +00:00
Space Toad 1822dfd896 fixed compilation errors 2011-07-19 18:19:45 +00:00
Space Toad 8df7df145b fixed setup file 2011-07-19 17:58:23 +00:00
FlowerChild f89a1210df Removed MCForgeEffectRenderer, patched MC EffectRenderer 2011-07-19 11:24:36 +00:00
Space Toad 50c30fce23 removed OBE file 2011-07-18 06:18:14 +00:00
Space Toad ad56d1c879 fixed setup script for windows and patch 2011-07-17 12:16:26 +00:00
Space Toad 65aa6d6b43 fixed packaging script 2011-07-16 22:39:55 +00:00
Space Toad 6aa32def11 fixed patch script and added release scripts 2011-07-16 22:32:57 +00:00
FlowerChild 7be20d9c4d Added OnGameStart hook, added custom effect render to fulfill infinite sprite support. Render needs to be changed a little to cover items also, though. 2011-07-16 16:37:37 +00:00
Space Toad 3cf1792bec added headers 2011-07-15 23:13:09 +00:00
Space Toad d1a79c2a66 added support for infinite sprites, for #4 2011-07-15 23:04:10 +00:00
Space Toad 5b06661835 implement infinite terrain sprites, for #3 2011-07-15 22:40:53 +00:00
Space Toad a7e950e7c2 fixed style, added biome population support, for #2 2011-07-15 21:17:33 +00:00
Space Toad 341cfc0cf7 initial revision of the license 2011-07-15 18:26:33 +00:00
Space Toad ba6aa3368d fixed previous checkin 2011-07-14 11:19:22 +00:00
Space Toad 81e5a85a36 added basic build script for windows 2011-07-14 11:18:25 +00:00
Space Toad 050d0ac294 added missing patch step 2011-07-14 11:15:07 +00:00
Space Toad c0c4830ed4 made initial setup, implemented custom bucket, for #1 2011-07-14 11:10:21 +00:00
Space Toad 9eed4e19f2 added main project directories 2011-07-12 21:03:55 +00:00
Space Toad e8c2895042 added main source directory 2011-07-12 21:02:53 +00:00
222 changed files with 16955 additions and 21219 deletions

No files matched your search

View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
+1591
View File
File diff suppressed because it is too large. Load diff
@@ -213,8 +213,6 @@ net/minecraft/src/Packet8UpdateHealth.func_322_a(Ljava/io/DataOutputStream;)V=ja
net/minecraft/src/Packet8UpdateHealth.func_327_a(Ljava/io/DataInputStream;)V=java/io/IOException
net/minecraft/src/Packet9Respawn.func_322_a(Ljava/io/DataOutputStream;)V=java/io/IOException
net/minecraft/src/Packet9Respawn.func_327_a(Ljava/io/DataInputStream;)V=java/io/IOException
net/minecraft/src/Packet250CustomPayload.func_322_a(Ljava/io/DataOutputStream;)V=java/io/IOException
net/minecraft/src/Packet250CustomPayload.func_327_a(Ljava/io/DataInputStream;)V=java/io/IOException
net/minecraft/src/RegionFile.func_22196_b()V=java/io/IOException
net/minecraft/src/RegionFile.func_22198_a(III)V=java/io/IOException
net/minecraft/src/RegionFile.func_22200_a(I[BI)V=java/io/IOException
@@ -228,4 +226,3 @@ net/minecraft/src/ThreadDownloadResources.func_1212_a(Ljava/net/URL;Ljava/io/Fil
net/minecraft/src/ThreadedChunkLoader.func_40551_a(Lnet/minecraft/src/ThreadedChunkLoaderPending;)V=java/io/IOException
net/minecraft/src/ThreadedChunkLoader.func_813_a(Lnet/minecraft/src/World;II)Lnet/minecraft/src/Chunk;=java/io/IOException
net/minecraft/src/ThreadedFileIOBase.func_40566_a()V=java/lang/InterruptedException
net/minecraft/src/StringTranslate.func_44025_a(Ljava/util/Properties;Ljava/lang/String;)V=java/io/IOException
+5999
View File
File diff suppressed because it is too large. Load diff
+35 -37
View File
@@ -9,9 +9,6 @@ DirConf = conf
DirRuntime = runtime
DirLib = lib
DirFFOut = temp/ffout
DirBinOut = temp/bin
DirModSrc = modsrc
DirEclipse = eclipse
[CSV]
Classes = %(DirConf)s/classes.csv
@@ -26,8 +23,8 @@ Server = %(DirTemp)s/server_rg.srg
DirNatives = %(DirJars)s/bin/natives
Client = %(DirJars)s/bin/minecraft.jar
Server = %(DirJars)s/minecraft_server.jar
MD5Client = e92302d2acdba7c97e0d8df1e10d2006
MD5Server = b0f4fb91f9723104adf35944bbf3d3cf
MD5Client = 3820d222b95d0b8c520d9596a756a6e6
MD5Server = 934b6010999daa1f1b1ccdf4cb77e052
[RETROGUARD]
Location = %(DirRuntime)s/bin/retroguard.jar
@@ -53,6 +50,8 @@ XClientLog = %(DirLogs)s/client_exc.log
XServerLog = %(DirLogs)s/server_exc.log
[DECOMPILE]
FFClientConf = -rbr=0 -dgs=1 -asc=1
FFServerConf = -rbr=0 -dgs=1 -asc=1
FFClientOut = %(DirFFOut)s/client
FFServerOut = %(DirFFOut)s/server
FFClientSrc = %(DirFFOut)s/minecraft_exc.jar
@@ -60,12 +59,15 @@ FFServerSrc = %(DirFFOut)s/minecraft_server_exc.jar
FFSource = net
[OUTPUT]
BinClient = %(DirBinOut)s/minecraft
BinServer = %(DirBinOut)s/minecraft_server
BinOut = %(DirTemp)s/bin
BinClient = %(DirTemp)s/bin/minecraft
BinServer = %(DirTemp)s/bin/minecraft_server
SrcClient = %(DirSrc)s/minecraft
SrcServer = %(DirSrc)s/minecraft_server
TestClient = net/minecraft/client/Minecraft
TestServer = net/minecraft/server/MinecraftServer
[PACKAGES]
PkgClient = net/minecraft/src,net/minecraft/client
PkgServer = net/minecraft/src,net/minecraft/server
[PATCHES]
PatchClient = %(DirConf)s/patches/minecraft.patch
@@ -73,8 +75,6 @@ PatchServer = %(DirConf)s/patches/minecraft_server.patch
PatchTemp = %(DirTemp)s/temp.patch
FFPatchClient = %(DirConf)s/patches/minecraft_ff.patch
FFPatchServer = %(DirConf)s/patches/minecraft_server_ff.patch
PatchClient_osx = %(DirConf)s/patches/minecraft_osx.patch
PatchServer_osx = %(DirConf)s/patches/minecraft_server_osx.patch
[RECOMPILE]
BinClient = %(DirBin)s/minecraft
@@ -84,6 +84,8 @@ ClassPathServer = %(DirLib)s/,%(DirLib)s/*,%(DirJars)s/minecraft_server.jar
ClientFixes = %(DirConf)s/patches
[REOBF]
SAFFXClient = %(DirTemp)s/minecraft.saffx
SAFFXServer = %(DirTemp)s/minecraft_server.saffx
MD5Client = %(DirTemp)s/client.md5
MD5Server = %(DirTemp)s/server.md5
MD5PreReobfClient = %(DirTemp)s/client_reobf.md5
@@ -96,46 +98,42 @@ ObfJarClient = %(DirTemp)s/client_reobf.jar
ObfJarServer = %(DirTemp)s/server_reobf.jar
ReobfDirClient = %(DirReobf)s/minecraft
ReobfDirServer = %(DirReobf)s/minecraft_server
ClientRoLog = %(DirLogs)s/client_ro.log
ServerRoLog = %(DirLogs)s/server_ro.log
ReobfClientLog = %(DirLogs)s/client_reob.log
ReobfServerLog = %(DirLogs)s/server_reob.log
FixSound = ga
FixStart = Start
FixSound = minecraft/me.class
FixStart = minecraft/Start.class
NullPkg = net/minecraft/src
IgnorePkg = paulscode,com/jcraft,isom,ibxm,de/matthiasmann/twl,org/xmlpull,javax/xml
[GETMODSOURCE]
OutSRCClient = %(DirModSrc)s/minecraft
OutSRCServer = %(DirModSrc)s/minecraft_server
OutSRCClient = modsrc/client
OutSRCServer = modsrc/server
OutSRC = modsrc
[MCP]
LogFile = %(DirLogs)s/mcp.log
LogFileErr = %(DirLogs)s/mcperr.log
UpdateUrl = http://mcp.ocean-labs.de/files/mcprolling_{version}/
IgnoreUpdate = %(DirBin)s,%(DirLib)s,%(DirLogs)s,%(DirModSrc)s,%(DirReobf)s,%(DirSrc)s,%(DirTemp)s,%(DirEclipse)s/Client/bin,%(DirEclipse)s/Server/bin,%(DirJars)s/world,%(DirJars)s/saves,%(DirJars)s/resources
[COMMANDS]
Patcher_win = %(DirRuntime)s/bin/applydiff.exe
Patcher_linux = patch
Patcher_osx = patch
Jad_win = %(DirRuntime)s/bin/jad.exe
Jad_linux = wine %(DirRuntime)s/bin/jad.exe
Jad_osx = %(DirRuntime)s/bin/jad-osx
AStyle_win = %(DirRuntime)s/bin/astyle.exe
AStyle_linux = wine %(DirRuntime)s/bin/astyle.exe
AStyle_osx = %(DirRuntime)s/bin/astyle-osx
Patcher = %(DirRuntime)s/bin/applydiff.exe
JadRetro = %(DirRuntime)s/bin/jadretro.jar
Fernflower = %(DirRuntime)s/bin/fernflower.jar
Jadwin = %(DirRuntime)s/bin/jad.exe
Jadlinux = %(DirRuntime)s/bin/jad.exe
Jadosx = %(DirRuntime)s/bin/jad-osx
Exceptor = %(DirRuntime)s/bin/exceptor.jar
CmdPatch = %s -p1 -u -i {patchfile} -d {srcdir}
CmdJad = %s -b -d {outdir} -dead -o -r -s .java -stat -ff {classes}
CmdAStyle = %s -A1s4CSKYm1M1pHjcnqz2 {classes}
CmdRG = %s -cp "{classpath}" RetroGuard -searge {conffile}
CmdRGReobf = %s -cp "{classpath}" RetroGuard -notch {conffile}
CmdJadretro = %s -jar %s {targetdir}
CmdFernflower = %s -jar %s -rbr=0 -dgs=1 -asc=1 -log=WARN {jarin} {jarout}
CmdExceptor = %s -jar %s {input} {output} {conf} {log}
CmdRecomp = %s -g -source 1.6 -target 1.6 -classpath "{classpath}" -sourcepath {sourcepath} -d {outpath} {pkgs}
CmdRG = %s -cp {classpath} RetroGuard -searge {conffile}
CmdRGReobf = %s -cp {classpath} RetroGuard -notch {conffile}
CmdJadretro = %s -jar {jarjr} {targetdir}
CmdRecompClt = %s -g -source 1.6 -target 1.6 -classpath "{classpath}" -sourcepath {sourcepath} -d {outpath} {pkgs} {fixes}/*.java
CmdRecompSrv = %s -g -source 1.6 -target 1.6 -classpath "{classpath}" -sourcepath {sourcepath} -d {outpath} {pkgs}
CmdStartSrv = %s -Xincgc -Xms1024M -Xmx1024M -cp "{classpath}" net.minecraft.server.MinecraftServer
CmdStartClt = %s -Xincgc -Xms1024M -Xmx1024M -cp "{classpath}" -Djava.library.path={natives} Start
CmdJadwin = .\{binjad} -b -d {outdir} -dead -o -r -s .java -stat -v -ff {classes}
CmdJadlinux = wine {binjad} -b -d {outdir} -dead -o -r -s .java -stat -v -ff "{classes}"
CmdJadosx = {binjad} -b -d {outdir} -dead -o -r -s .java -stat -v -ff {classes}
CmdPatchwin = .\%(Patcher)s --binary -p1 -u -i ..\..\{patchfile} -d {srcdir}
CmdPatchlinux = patch --binary -p1 -u -i ../../{patchfile} -d {srcdir}
CmdPatchosx = patch --binary -p1 -u -i ../../{patchfile} -d {srcdir}
CmdFernflower = %s -jar {jarff} {conf} {jarin} {jarout}
CmdExceptor = %s -jar {jarexc} {input} {output} {conf} {log}
+4880
View File
File diff suppressed because it is too large. Load diff
File renamed without changes.
@@ -1,6 +1,6 @@
// this is needed for the sound engine to work with deobfuscated sourcecode without crashing
public class ga
public class me
{
public static int c(double d)
{
File diff suppressed because it is too large. Load diff
@@ -1,7 +1,7 @@
diff -r -U 3 minecraft\net\minecraft\client\Minecraft.java minecraft_patched\net\minecraft\client\Minecraft.java
--- minecraft\net\minecraft\client\Minecraft.java Fri Jan 13 17:44:46 2012
+++ minecraft_patched\net\minecraft\client\Minecraft.java Fri Jan 13 17:35:06 2012
@@ -1609,11 +1609,13 @@
--- minecraft\net\minecraft\client\Minecraft.java Tue Nov 22 23:21:44 2011
+++ minecraft_patched\net\minecraft\client\Minecraft.java Wed Nov 23 00:09:14 2011
@@ -1600,11 +1600,13 @@
this.field_6324_e.func_600_a(var6.field_22395_a + var10, 64, var6.field_22396_c + var8);
if(!this.field_6327_b.func_35643_e()) {
@@ -16,8 +16,8 @@ diff -r -U 3 minecraft\net\minecraft\client\Minecraft.java minecraft_patched\net
}
}
diff -r -U 3 minecraft\net\minecraft\src\CodecMus.java minecraft_patched\net\minecraft\src\CodecMus.java
--- minecraft\net\minecraft\src\CodecMus.java Fri Jan 13 17:44:20 2012
+++ minecraft_patched\net\minecraft\src\CodecMus.java Fri Jan 13 17:35:06 2012
--- minecraft\net\minecraft\src\CodecMus.java Tue Nov 22 23:21:36 2011
+++ minecraft_patched\net\minecraft\src\CodecMus.java Wed Nov 23 00:09:14 2011
@@ -1,5 +1,6 @@
package net.minecraft.src;
@@ -39,8 +39,8 @@ diff -r -U 3 minecraft\net\minecraft\src\CodecMus.java minecraft_patched\net\min
}
}
diff -r -U 3 minecraft\net\minecraft\src\ItemMap.java minecraft_patched\net\minecraft\src\ItemMap.java
--- minecraft\net\minecraft\src\ItemMap.java Fri Jan 13 17:43:42 2012
+++ minecraft_patched\net\minecraft\src\ItemMap.java Fri Jan 13 17:35:06 2012
--- minecraft\net\minecraft\src\ItemMap.java Tue Nov 22 23:21:24 2011
+++ minecraft_patched\net\minecraft\src\ItemMap.java Wed Nov 23 00:09:14 2011
@@ -19,7 +19,6 @@
}
@@ -58,8 +58,8 @@ diff -r -U 3 minecraft\net\minecraft\src\ItemMap.java minecraft_patched\net\mine
if(var4 == null) {
var1.func_28156_b(var2.func_28101_b("map"));
diff -r -U 3 minecraft\net\minecraft\src\MusInputStream.java minecraft_patched\net\minecraft\src\MusInputStream.java
--- minecraft\net\minecraft\src\MusInputStream.java Fri Jan 13 17:42:36 2012
+++ minecraft_patched\net\minecraft\src\MusInputStream.java Fri Jan 13 17:35:06 2012
--- minecraft\net\minecraft\src\MusInputStream.java Tue Nov 22 23:21:24 2011
+++ minecraft_patched\net\minecraft\src\MusInputStream.java Wed Nov 23 00:09:14 2011
@@ -1,5 +1,6 @@
package net.minecraft.src;
@@ -82,8 +82,8 @@ diff -r -U 3 minecraft\net\minecraft\src\MusInputStream.java minecraft_patched\n
for(int var4 = 0; var4 < var3; ++var4) {
byte var5 = var1[var2 + var4] = (byte)(var1[var2 + var4] ^ this.field_1516_c >> 8);
diff -r -U 3 minecraft\net\minecraft\src\RenderGlobal.java minecraft_patched\net\minecraft\src\RenderGlobal.java
--- minecraft\net\minecraft\src\RenderGlobal.java Fri Jan 13 17:43:24 2012
+++ minecraft_patched\net\minecraft\src\RenderGlobal.java Fri Jan 13 17:35:06 2012
--- minecraft\net\minecraft\src\RenderGlobal.java Tue Nov 22 23:21:20 2011
+++ minecraft_patched\net\minecraft\src\RenderGlobal.java Wed Nov 23 00:10:20 2011
@@ -1466,7 +1466,7 @@
double var15 = this.field_1439_t.field_22009_h.field_611_ak - var2;
double var17 = this.field_1439_t.field_22009_h.field_610_al - var4;
@@ -94,8 +94,8 @@ diff -r -U 3 minecraft\net\minecraft\src\RenderGlobal.java minecraft_patched\net
this.field_1439_t.field_6321_h.func_1192_a(var21 = new EntityHugeExplodeFX(this.field_1448_k, var2, var4, var6, var8, var10, var12));
} else if(var1.equals("largeexplode")) {
diff -r -U 3 minecraft\net\minecraft\src\ThreadedFileIOBase.java minecraft_patched\net\minecraft\src\ThreadedFileIOBase.java
--- minecraft\net\minecraft\src\ThreadedFileIOBase.java Fri Jan 13 17:43:00 2012
+++ minecraft_patched\net\minecraft\src\ThreadedFileIOBase.java Fri Jan 13 17:35:06 2012
--- minecraft\net\minecraft\src\ThreadedFileIOBase.java Tue Nov 22 23:21:30 2011
+++ minecraft_patched\net\minecraft\src\ThreadedFileIOBase.java Wed Nov 23 00:09:14 2011
@@ -21,7 +21,9 @@
}
File diff suppressed because it is too large. Load diff
@@ -1,6 +1,6 @@
diff -r -U 3 minecraft_server\net\minecraft\src\ItemMap.java minecraft_server_patched\net\minecraft\src\ItemMap.java
--- minecraft_server\net\minecraft\src\ItemMap.java Fri Jan 13 17:46:22 2012
+++ minecraft_server_patched\net\minecraft\src\ItemMap.java Fri Jan 13 17:37:00 2012
--- minecraft_server\net\minecraft\src\ItemMap.java Tue Nov 22 23:21:56 2011
+++ minecraft_server_patched\net\minecraft\src\ItemMap.java Wed Nov 23 00:09:45 2011
@@ -22,7 +22,6 @@
}
@@ -11,8 +11,8 @@ diff -r -U 3 minecraft_server\net\minecraft\src\ItemMap.java minecraft_server_pa
var1.func_28145_b(var2.func_28104_b("map"));
diff -r -U 3 minecraft_server\net\minecraft\src\RConThreadClient.java minecraft_server_patched\net\minecraft\src\RConThreadClient.java
diff -r -U 3 minecraft_server\net\minecraft\src\ThreadedFileIOBase.java minecraft_server_patched\net\minecraft\src\ThreadedFileIOBase.java
--- minecraft_server\net\minecraft\src\ThreadedFileIOBase.java Fri Jan 13 17:45:20 2012
+++ minecraft_server_patched\net\minecraft\src\ThreadedFileIOBase.java Fri Jan 13 17:37:00 2012
--- minecraft_server\net\minecraft\src\ThreadedFileIOBase.java Tue Nov 22 23:22:10 2011
+++ minecraft_server_patched\net\minecraft\src\ThreadedFileIOBase.java Wed Nov 23 00:09:45 2011
@@ -21,7 +21,9 @@
}
File renamed without changes.
@@ -182,8 +182,6 @@ net/minecraft/src/Packet8UpdateHealth.func_68_a(Ljava/io/DataOutputStream;)V=jav
net/minecraft/src/Packet8UpdateHealth.func_70_a(Ljava/io/DataInputStream;)V=java/io/IOException
net/minecraft/src/Packet9Respawn.func_68_a(Ljava/io/DataOutputStream;)V=java/io/IOException
net/minecraft/src/Packet9Respawn.func_70_a(Ljava/io/DataInputStream;)V=java/io/IOException
net/minecraft/src/Packet250CustomPayload.func_68_a(Ljava/io/DataOutputStream;)V=java/io/IOException
net/minecraft/src/Packet250CustomPayload.func_70_a(Ljava/io/DataInputStream;)V=java/io/IOException
net/minecraft/src/RConOutputStream.func_40393_a(I)V=java/io/IOException
net/minecraft/src/RConOutputStream.func_40394_a(S)V=java/io/IOException
net/minecraft/src/RConOutputStream.func_40396_a([B)V=java/io/IOException
@@ -202,4 +200,3 @@ net/minecraft/src/RegionFile.func_22138_b(III)V=java/io/IOException
net/minecraft/src/ThreadedChunkLoader.func_40325_a(Lnet/minecraft/src/ThreadedChunkLoaderPending;)V=java/io/IOException
net/minecraft/src/ThreadedChunkLoader.func_659_a(Lnet/minecraft/src/World;II)Lnet/minecraft/src/Chunk;=java/io/IOException
net/minecraft/src/ThreadedFileIOBase.func_40508_a()V=java/lang/InterruptedException
net/minecraft/src/StringTranslate.func_44011_a(Ljava/util/Properties;Ljava/lang/String;)V=java/io/IOException
+4
View File
@@ -0,0 +1,4 @@
[VERSION]
MCPVersion = 5.0
ClientVersion = 1.0.0
ServerVersion = 1.0.1
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
-54
View File
@@ -1,54 +0,0 @@
diff -r -U 3 minecraft\net\minecraft\src\EntityMinecart.java minecraft_patched\net\minecraft\src\EntityMinecart.java
--- minecraft\net\minecraft\src\EntityMinecart.java Sat Jan 14 16:05:10 2012
+++ minecraft_patched\net\minecraft\src\EntityMinecart.java Sat Jan 14 16:07:41 2012
@@ -811,7 +811,7 @@
double d = entity.field_611_ak - field_611_ak;
double d1 = entity.field_609_am - field_609_am;
double d2 = d * d + d1 * d1;
- if(d2 >= 9.9999997473787516E-05D)
+ if(d2 >= 9.9999997473787516E-005D)
{
d2 = MathHelper.func_1109_a(d2);
d /= d2;
diff -r -U 3 minecraft\net\minecraft\src\RenderGlobal.java minecraft_patched\net\minecraft\src\RenderGlobal.java
--- minecraft\net\minecraft\src\RenderGlobal.java Sat Jan 14 16:05:10 2012
+++ minecraft_patched\net\minecraft\src\RenderGlobal.java Sat Jan 14 16:07:41 2012
@@ -968,7 +968,7 @@
f3 = f7;
f4 = f8;
}
- float f6 = 0.0004882812F;
+ float f6 = 0.0004882813F;
double d = (float)field_1435_x + f;
double d1 = field_1439_t.field_22009_h.field_9285_at + (field_1439_t.field_22009_h.field_611_ak - field_1439_t.field_22009_h.field_9285_at) * (double)f + d * 0.029999999329447746D;
double d2 = field_1439_t.field_22009_h.field_9283_av + (field_1439_t.field_22009_h.field_609_am - field_1439_t.field_22009_h.field_9283_av) * (double)f;
diff -r -U 3 minecraft\net\minecraft\src\Vec3D.java minecraft_patched\net\minecraft\src\Vec3D.java
--- minecraft\net\minecraft\src\Vec3D.java Sat Jan 14 16:05:10 2012
+++ minecraft_patched\net\minecraft\src\Vec3D.java Sat Jan 14 16:07:41 2012
@@ -137,7 +137,7 @@
double d1 = vec3d.field_1776_a - field_1776_a;
double d2 = vec3d.field_1775_b - field_1775_b;
double d3 = vec3d.field_1779_c - field_1779_c;
- if(d1 * d1 < 1.0000000116860974E-07D)
+ if(d1 * d1 < 1.0000000116860974E-007D)
{
return null;
}
@@ -156,7 +156,7 @@
double d1 = vec3d.field_1776_a - field_1776_a;
double d2 = vec3d.field_1775_b - field_1775_b;
double d3 = vec3d.field_1779_c - field_1779_c;
- if(d2 * d2 < 1.0000000116860974E-07D)
+ if(d2 * d2 < 1.0000000116860974E-007D)
{
return null;
}
@@ -175,7 +175,7 @@
double d1 = vec3d.field_1776_a - field_1776_a;
double d2 = vec3d.field_1775_b - field_1775_b;
double d3 = vec3d.field_1779_c - field_1779_c;
- if(d3 * d3 < 1.0000000116860974E-07D)
+ if(d3 * d3 < 1.0000000116860974E-007D)
{
return null;
}
@@ -1,60 +0,0 @@
diff -r -U 3 minecraft_server\net\minecraft\src\EntityMinecart.java minecraft_server_patched\net\minecraft\src\EntityMinecart.java
--- minecraft_server\net\minecraft\src\EntityMinecart.java Sat Jan 14 16:05:25 2012
+++ minecraft_server_patched\net\minecraft\src\EntityMinecart.java Sat Jan 14 16:07:50 2012
@@ -751,7 +751,7 @@
double d = entity.field_322_l - field_322_l;
double d1 = entity.field_320_n - field_320_n;
double d2 = d * d + d1 * d1;
- if(d2 >= 9.9999997473787516E-05D)
+ if(d2 >= 9.9999997473787516E-005D)
{
d2 = MathHelper.func_583_a(d2);
d /= d2;
diff -r -U 3 minecraft_server\net\minecraft\src\GuiStatsComponent.java minecraft_server_patched\net\minecraft\src\GuiStatsComponent.java
--- minecraft_server\net\minecraft\src\GuiStatsComponent.java Sat Jan 14 16:05:25 2012
+++ minecraft_server_patched\net\minecraft\src\GuiStatsComponent.java Sat Jan 14 16:07:50 2012
@@ -43,12 +43,12 @@
System.gc();
field_768_c[0] = (new StringBuilder()).append("Memory use: ").append(l / 1024L / 1024L).append(" mb (").append((Runtime.getRuntime().freeMemory() * 100L) / Runtime.getRuntime().maxMemory()).append("% free)").toString();
field_768_c[1] = (new StringBuilder()).append("Threads: ").append(NetworkManager.field_1052_b).append(" + ").append(NetworkManager.field_1051_c).toString();
- field_768_c[2] = (new StringBuilder()).append("Avg tick: ").append(field_40573_a.format(func_40571_a(field_40572_e.field_40027_f) * 9.9999999999999995E-07D)).append(" ms").toString();
+ field_768_c[2] = (new StringBuilder()).append("Avg tick: ").append(field_40573_a.format(func_40571_a(field_40572_e.field_40027_f) * 9.9999999999999995E-007D)).append(" ms").toString();
i = 0;
_L3:
if(i >= field_40572_e.field_6034_e.length) goto _L2; else goto _L1
_L1:
- field_768_c[3 + i] = (new StringBuilder()).append("Lvl ").append(i).append(" tick: ").append(field_40573_a.format(func_40571_a(field_40572_e.field_40028_g[i]) * 9.9999999999999995E-07D)).append(" ms").toString();
+ field_768_c[3 + i] = (new StringBuilder()).append("Lvl ").append(i).append(" tick: ").append(field_40573_a.format(func_40571_a(field_40572_e.field_40028_g[i]) * 9.9999999999999995E-007D)).append(" ms").toString();
if(field_40572_e.field_6034_e[i] == null || field_40572_e.field_6034_e[i].field_20911_y == null)
{
continue; /* Loop/switch isn't completed */
diff -r -U 3 minecraft_server\net\minecraft\src\Vec3D.java minecraft_server_patched\net\minecraft\src\Vec3D.java
--- minecraft_server\net\minecraft\src\Vec3D.java Sat Jan 14 16:05:25 2012
+++ minecraft_server_patched\net\minecraft\src\Vec3D.java Sat Jan 14 16:07:50 2012
@@ -121,7 +121,7 @@
double d1 = vec3d.field_1055_a - field_1055_a;
double d2 = vec3d.field_1054_b - field_1054_b;
double d3 = vec3d.field_1058_c - field_1058_c;
- if(d1 * d1 < 1.0000000116860974E-07D)
+ if(d1 * d1 < 1.0000000116860974E-007D)
{
return null;
}
@@ -140,7 +140,7 @@
double d1 = vec3d.field_1055_a - field_1055_a;
double d2 = vec3d.field_1054_b - field_1054_b;
double d3 = vec3d.field_1058_c - field_1058_c;
- if(d2 * d2 < 1.0000000116860974E-07D)
+ if(d2 * d2 < 1.0000000116860974E-007D)
{
return null;
}
@@ -159,7 +159,7 @@
double d1 = vec3d.field_1055_a - field_1055_a;
double d2 = vec3d.field_1054_b - field_1054_b;
double d3 = vec3d.field_1058_c - field_1058_c;
- if(d3 * d3 < 1.0000000116860974E-07D)
+ if(d3 * d3 < 1.0000000116860974E-007D)
{
return null;
}
-4
View File
@@ -1,4 +0,0 @@
[VERSION]
MCPVersion = 5.6
ClientVersion = 1.1
ServerVersion = 1.1
@@ -1,50 +0,0 @@
package net.minecraft.src.forge;
import net.minecraft.src.AxisAlignedBB;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityMinecart;
/**
* This class defines a replacement for the default minecart collision code.
* Only one handler can be registered at a time. It it registered with EntityMinecart.registerCollisionHandler().
* If you use this, make it a configuration option.
* @author CovertJaguar
*/
public interface IMinecartCollisionHandler
{
/**
* This basically replaces the function of the same name in EnityMinecart.
* Code in IMinecartHooks.applyEntityCollisionHook is still run.
* @param cart The cart that called the collision.
* @param other The object it collided with.
*/
public void onEntityCollision(EntityMinecart cart, Entity other);
/**
* This function replaced the function of the same name in EntityMinecart.
* It is used to define whether minecarts collide with specific entities,
* for example items.
* @param cart The cart for which the collision box was requested.
* @param other The entity requesting the collision box.
* @return The collision box or null.
*/
public AxisAlignedBB getCollisionBox(EntityMinecart cart, Entity other);
/**
* This function is used to define the box used for detecting minecart collisions.
* It is generally bigger that the normal collision box.
* @param cart The cart for which the collision box was requested.
* @return The collision box, cannot be null.
*/
public AxisAlignedBB getMinecartCollisionBox(EntityMinecart cart);
/**
* This function replaces the function of the same name in EntityMinecart.
* It defines whether minecarts are solid to the player.
* @param cart The cart for which the bounding box was requested.
* @return The bounding box or null.
*/
public AxisAlignedBB getBoundingBox(EntityMinecart cart);
}
@@ -1,38 +0,0 @@
package net.minecraft.src.forge;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityMinecart;
import net.minecraft.src.EntityPlayer;
public interface IMinecartHandler {
/**
* This functions is called at the end of every minecart's doUpdate loop.
* If you override EntityMinecart.doUpdate(), is recommended that you retain the code that calls this function.
* @param cart The cart that called the function.
* @param i X coordinate of the rail
* @param j Y coordinate of the rail
* @param k Z coordinate of the rail
*/
public void onMinecartUpdate(EntityMinecart minecart, int x, int y, int z);
/**
* This function allows several mods to add code into the collision routine at the same time regardless of the collision handler registered.
* If you override EntityMinecart.applyEntityCollision(), is recommended that you retain the code that calls this function.
* @param cart The cart that called the function.
* @param other
*/
public void onMinecartEntityCollision(EntityMinecart minecart, Entity entity);
/**
* This function is called whenever a player attempts to interact with a minecart.
* The primary reason for this hook is to fix a few bugs and put restrictions on how a minecart can be used under certain circumstances.
* If you override EntityMinecart.interact(), is recommended that you retain the code that calls this function.
* @param cart The cart that called the function.
* @param player The player that tried to interact with the minecart.
* @param canceled Wither or not a pervious hook has canceled the interaction of a player.
* @return Whether the player can interact with the minecart.
*/
public boolean onMinecartInteract(EntityMinecart minecart, EntityPlayer player, boolean canceled);
}
@@ -1,49 +0,0 @@
package net.minecraft.src.forge;
import net.minecraft.src.EntityMinecart;
/**
* Used to create hashmap values for Minecart/type pairs
* Written by CovertJaguar
*/
public class MinecartKey {
public final Class<? extends EntityMinecart> minecart;
public final int type;
public MinecartKey(Class<? extends EntityMinecart> c, int t)
{
minecart = c;
type = t;
}
@Override
public boolean equals(Object obj)
{
if(obj == null)
{
return false;
}
if(getClass() != obj.getClass())
{
return false;
}
final MinecartKey other = (MinecartKey)obj;
if(this.minecart != other.minecart && (this.minecart == null || !this.minecart.equals(other.minecart)))
{
return false;
}
return (this.type == other.type);
}
@Override
public int hashCode()
{
int hash = 7;
hash = 59 * hash + (this.minecart != null ? this.minecart.hashCode() : 0);
hash = 59 * hash + this.type;
return hash;
}
}
@@ -1,119 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000
@@ -32,36 +32,36 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
{
- if (l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
return true;
}
- if (l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- if (l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if (world.isBlockNormalCube(i - 1, j, k))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
return true;
}
- if (world.isBlockNormalCube(i + 1, j, k))
+ if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- if (world.isBlockNormalCube(i, j, k - 1))
+ if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- return world.isBlockNormalCube(i, j, k + 1);
+ return world.isBlockSolidOnSide(i, j, k + 1, 2);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
@@ -69,19 +69,19 @@
int i1 = world.getBlockMetadata(i, j, k);
int j1 = i1 & 8;
i1 &= 7;
- if (l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
i1 = 4;
}
- else if (l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ else if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
i1 = 3;
}
- else if (l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ else if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
i1 = 2;
}
- else if (l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ else if (l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
i1 = 1;
}
@@ -94,19 +94,19 @@
private int getOrientation(World world, int i, int j, int k)
{
- if (world.isBlockNormalCube(i - 1, j, k))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
return 1;
}
- if (world.isBlockNormalCube(i + 1, j, k))
+ if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return 2;
}
- if (world.isBlockNormalCube(i, j, k - 1))
+ if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return 3;
}
- return !world.isBlockNormalCube(i, j, k + 1) ? 1 : 4;
+ return !world.isBlockSolidOnSide(i, j, k + 1, 2) ? 1 : 4;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
@@ -115,19 +115,19 @@
{
int i1 = world.getBlockMetadata(i, j, k) & 7;
boolean flag = false;
- if (!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
+ if (!world.isBlockSolidOnSide(i - 1, j, k, 5) && i1 == 1)
{
flag = true;
}
- if (!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
+ if (!world.isBlockSolidOnSide(i + 1, j, k, 4) && i1 == 2)
{
flag = true;
}
- if (!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
+ if (!world.isBlockSolidOnSide(i, j, k - 1, 3) && i1 == 3)
{
flag = true;
}
- if (!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if (!world.isBlockSolidOnSide(i, j, k + 1, 2) && i1 == 4)
{
flag = true;
}
@@ -1,31 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000
@@ -424,23 +424,23 @@
{
return true;
}
- if (world.isBlockNormalCube(i, j + 1, k))
+ if (world.isBlockSolidOnSide(i, j + 1, k, 0))
{
return true;
}
- if (world.getBlockId(i - 1, j, k) == blockID && world.isBlockNormalCube(i - 1, j + 1, k))
+ if (world.getBlockId(i - 1, j, k) == blockID && world.isBlockSolidOnSide(i - 1, j + 1, k, 0))
{
return true;
}
- if (world.getBlockId(i + 1, j, k) == blockID && world.isBlockNormalCube(i + 1, j + 1, k))
+ if (world.getBlockId(i + 1, j, k) == blockID && world.isBlockSolidOnSide(i + 1, j + 1, k, 0))
{
return true;
}
- if (world.getBlockId(i, j, k - 1) == blockID && world.isBlockNormalCube(i, j + 1, k - 1))
+ if (world.getBlockId(i, j, k - 1) == blockID && world.isBlockSolidOnSide(i, j + 1, k - 1, 0))
{
return true;
}
- if (world.getBlockId(i, j, k + 1) == blockID && world.isBlockNormalCube(i, j + 1, k + 1))
+ if (world.getBlockId(i, j, k + 1) == blockID && world.isBlockSolidOnSide(i, j + 1, k + 1, 0))
{
return true;
}
@@ -1,93 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000
@@ -35,7 +35,7 @@
setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
}
return super.getSelectedBoundingBoxFromPool(world, i, j, k);
- }
+ }
public boolean isOpaqueCube()
{
@@ -54,37 +54,37 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if (world.isBlockNormalCube(i - 1, j, k))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
return true;
}
- if (world.isBlockNormalCube(i + 1, j, k))
+ if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- if (world.isBlockNormalCube(i, j, k - 1))
+ if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- return world.isBlockNormalCube(i, j, k + 1);
+ return world.isBlockSolidOnSide(i, j, k + 1, 2);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
{
int i1 = world.getBlockMetadata(i, j, k);
- if ((i1 == 0 || l == 2) && world.isBlockNormalCube(i, j, k + 1))
+ if ((i1 == 0 || l == 2) && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
i1 = 2;
}
- if ((i1 == 0 || l == 3) && world.isBlockNormalCube(i, j, k - 1))
+ if ((i1 == 0 || l == 3) && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
i1 = 3;
}
- if ((i1 == 0 || l == 4) && world.isBlockNormalCube(i + 1, j, k))
+ if ((i1 == 0 || l == 4) && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
i1 = 4;
}
- if ((i1 == 0 || l == 5) && world.isBlockNormalCube(i - 1, j, k))
+ if ((i1 == 0 || l == 5) && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
i1 = 5;
}
@@ -95,19 +95,19 @@
{
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = false;
- if (i1 == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if (i1 == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
flag = true;
}
- if (i1 == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if (i1 == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
flag = true;
}
- if (i1 == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if (i1 == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
flag = true;
}
- if (i1 == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if (i1 == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
flag = true;
}
@@ -123,4 +123,11 @@
{
return 1;
}
+
+ /* FORGE: Implemented base method, see Block.isLadder */
+ @Override
+ public boolean isLadder(World world, int X, int Y, int Z)
+ {
+ return true;
+ }
}
@@ -1,120 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000
@@ -31,44 +31,44 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
{
- if (l == 1 && world.isBlockNormalCube(i, j - 1, k))
+ if (l == 1 && world.isBlockSolidOnSide(i, j - 1, k, 1))
{
return true;
}
- if (l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
return true;
}
- if (l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- if (l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if (world.isBlockNormalCube(i - 1, j, k))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
return true;
}
- if (world.isBlockNormalCube(i + 1, j, k))
+ if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- if (world.isBlockNormalCube(i, j, k - 1))
+ if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- if (world.isBlockNormalCube(i, j, k + 1))
+ if (world.isBlockSolidOnSide(i, j, k + 1, 2))
{
return true;
}
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
@@ -77,23 +77,23 @@
int j1 = i1 & 8;
i1 &= 7;
i1 = -1;
- if (l == 1 && world.isBlockNormalCube(i, j - 1, k))
+ if (l == 1 && world.isBlockSolidOnSide(i, j - 1, k, 1))
{
i1 = 5 + world.rand.nextInt(2);
}
- if (l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
i1 = 4;
}
- if (l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
i1 = 3;
}
- if (l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
i1 = 2;
}
- if (l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if (l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
i1 = 1;
}
@@ -116,27 +116,27 @@
{
int i1 = world.getBlockMetadata(i, j, k) & 7;
boolean flag = false;
- if (!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
+ if (!world.isBlockSolidOnSide(i - 1, j, k, 5) && i1 == 1)
{
flag = true;
}
- if (!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
+ if (!world.isBlockSolidOnSide(i + 1, j, k, 4) && i1 == 2)
{
flag = true;
}
- if (!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
+ if (!world.isBlockSolidOnSide(i, j, k - 1, 3) && i1 == 3)
{
flag = true;
}
- if (!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if (!world.isBlockSolidOnSide(i, j, k + 1, 2) && i1 == 4)
{
flag = true;
}
- if (!world.isBlockNormalCube(i, j - 1, k) && i1 == 5)
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && i1 == 5)
{
flag = true;
}
- if (!world.isBlockNormalCube(i, j - 1, k) && i1 == 6)
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && i1 == 6)
{
flag = true;
}
@@ -1,11 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockPistonBase.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockPistonBase.java 0000-00-00 00:00:00.000000000 -0000
@@ -355,7 +355,7 @@
return false;
}
}
- return !(Block.blocksList[i] instanceof BlockContainer);
+ return !(Block.blocksList[i] != null && Block.blocksList[i].hasTileEntity(world.getBlockMetadata(j, k, l)));
}
private static boolean canExtend(World world, int i, int j, int k, int l)
@@ -1,201 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000
@@ -5,16 +5,29 @@
public class BlockRail extends Block
{
private final boolean isPowered;
+
+ /**
+ * Forge: Moved render type to a field and a setter.
+ * This allows for a mod to change the render type
+ * for vanilla rails, and any mod rails that extend
+ * this class.
+ */
+ private int renderType = 9;
+
+ public void setRenderType(int value)
+ {
+ renderType = value;
+ }
public static final boolean isRailBlockAt(World world, int i, int j, int k)
{
int l = world.getBlockId(i, j, k);
- return l == Block.rail.blockID || l == Block.railPowered.blockID || l == Block.railDetector.blockID;
+ return Block.blocksList[l] instanceof BlockRail;
}
public static final boolean isRailBlock(int i)
{
- return i == Block.rail.blockID || i == Block.railPowered.blockID || i == Block.railDetector.blockID;
+ return Block.blocksList[i] instanceof BlockRail;
}
protected BlockRail(int i, int j, boolean flag)
@@ -81,7 +94,7 @@
public int getRenderType()
{
- return 9;
+ return renderType;
}
public int quantityDropped(Random random)
@@ -91,7 +104,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1);
}
public void onBlockAdded(World world, int i, int j, int k)
@@ -119,23 +132,23 @@
j1 &= 7;
}
boolean flag = false;
- if (!world.isBlockNormalCube(i, j - 1, k))
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1))
{
flag = true;
}
- if (j1 == 2 && !world.isBlockNormalCube(i + 1, j, k))
+ if (j1 == 2 && !world.isBlockSolidOnSide(i + 1, j, k, 1))
{
flag = true;
}
- if (j1 == 3 && !world.isBlockNormalCube(i - 1, j, k))
+ if (j1 == 3 && !world.isBlockSolidOnSide(i - 1, j, k, 1))
{
flag = true;
}
- if (j1 == 4 && !world.isBlockNormalCube(i, j, k - 1))
+ if (j1 == 4 && !world.isBlockSolidOnSide(i, j, k - 1, 1))
{
flag = true;
}
- if (j1 == 5 && !world.isBlockNormalCube(i, j, k + 1))
+ if (j1 == 5 && !world.isBlockSolidOnSide(i, j, k + 1, 1))
{
flag = true;
}
@@ -317,8 +330,119 @@
return 0;
}
+ /**
+ * This function is no longer called by Minecraft
+ */
+ @Deprecated
static boolean isPoweredBlockRail(BlockRail blockrail)
{
return blockrail.isPowered;
}
+
+ /**
+ * Return true if the rail can make corners.
+ * Used by placement logic.
+ * @param world The world.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ * @return True if the rail can make corners.
+ */
+ public boolean isFlexibleRail(World world, int i, int j, int k)
+ {
+ return !isPowered;
+ }
+
+ /**
+ * Returns true if the rail can make up and down slopes.
+ * Used by placement logic.
+ * @param world The world.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ * @return True if the rail can make slopes.
+ */
+ public boolean canMakeSlopes(World world, int i, int j, int k)
+ {
+ return true;
+ }
+
+ /**
+ * Return the rails metadata (without the power bit if the rail uses one).
+ * Can be used to make the cart think the rail something other than it is,
+ * for example when making diamond junctions or switches.
+ * The cart parameter will often be null unless it it called from EntityMinecart.
+ *
+ * Valid rail metadata is defined as follows:
+ * 0x0: flat track going North-South
+ * 0x1: flat track going West-East
+ * 0x2: track ascending to the East
+ * 0x3: track ascending to the West
+ * 0x4: track ascending to the North
+ * 0x5: track ascending to the South
+ * 0x6: WestNorth corner (connecting East and South)
+ * 0x7: EastNorth corner (connecting West and South)
+ * 0x8: EastSouth corner (connecting West and North)
+ * 0x9: WestSouth corner (connecting East and North)
+ *
+ * All directions are Notch defined.
+ * In MC Beta 1.8.3 the Sun rises in the North.
+ * In MC 1.0.0 the Sun rises in the East.
+ * @param world The world.
+ * @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ * @return The metadata.
+ */
+ public int getBasicRailMetadata(IBlockAccess world, EntityMinecart cart, int i, int j, int k)
+ {
+ int meta = world.getBlockMetadata(i, j, k);
+ if(isPowered) {
+ meta = meta & 7;
+ }
+ return meta;
+ }
+
+ /**
+ * Returns the max speed of the rail at [i, j, k].
+ * @param world The world.
+ * @param cart The cart on the rail, may be null.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ * @return The max speed of the current rail.
+ */
+ public float getRailMaxSpeed(World world, EntityMinecart cart, int i, int j, int k)
+ {
+ return 0.4f;
+ }
+
+ /**
+ * This function is called by any minecart that passes over this rail.
+ * It is called once per update tick that the minecart is on the rail.
+ * @param world The world.
+ * @param cart The cart on the rail.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ */
+ public void onMinecartPass(World world, EntityMinecart cart, int i, int j, int k)
+ {
+ }
+
+ /**
+ * Return true if this rail uses the 4th bit as a power bit.
+ * Avoid using this function when getBasicRailMetadata() can be used instead.
+ * The only reason to use this function is if you wish to change the rails metadata.
+ * @param world The world.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ * @return True if the 4th bit is a power bit.
+ */
+ public boolean hasPowerBit(World world, int i, int j, int k)
+ {
+ return isPowered;
+ }
}
@@ -1,33 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,6 +2,8 @@
import java.util.*;
+import net.minecraft.src.forge.IConnectRedstone;
+
public class BlockRedstoneWire extends Block
{
private boolean wiresProvidePower;
@@ -47,7 +49,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1);
}
private void updateAndPropagateCurrentStrength(World world, int i, int j, int k)
@@ -467,6 +469,12 @@
int j1 = iblockaccess.getBlockMetadata(i, j, k);
return l == (j1 & 3) || l == Direction.footInvisibleFaceRemap[j1 & 3];
}
+
+ if (Block.blocksList[i1] instanceof IConnectRedstone)
+ {
+ return ((IConnectRedstone)Block.blocksList[i1]).canConnectRedstone(iblockaccess, i, j, k, l);
+ }
+
return Block.blocksList[i1].canProvidePower() && l != -1;
}
@@ -1,53 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockTallGrass.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockTallGrass.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,7 +1,10 @@
package net.minecraft.src;
+import java.util.ArrayList;
import java.util.Random;
+import net.minecraft.src.forge.ForgeHooks;
+
public class BlockTallGrass extends BlockFlower
{
protected BlockTallGrass(int i, int j)
@@ -65,14 +68,7 @@
public int idDropped(int i, Random random, int j)
{
- if (random.nextInt(8) == 0)
- {
- return Item.seeds.shiftedIndex;
- }
- else
- {
- return -1;
- }
+ return -1;
}
public int quantityDroppedWithBonus(int i, Random random)
@@ -80,6 +76,23 @@
return 1 + random.nextInt(i * 2 + 1);
}
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int md, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ if (world.rand.nextInt(8) != 0)
+ {
+ return ret;
+ }
+
+ ItemStack item = ForgeHooks.getGrassSeed(world);
+ if (item != null)
+ {
+ ret.add(item);
+ }
+ return ret;
+ }
+
public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l)
{
if (!world.multiplayerWorld && entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex)
@@ -1,107 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000
@@ -32,7 +32,7 @@
private boolean canPlaceTorchOn(World world, int i, int j, int k)
{
- if (world.func_41082_b(i, j, k, true))
+ if (world.isBlockSolidOnSide(i, j, k, 1))
{
return true;
}
@@ -45,19 +45,19 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if (world.func_41082_b(i - 1, j, k, true))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
return true;
}
- if (world.func_41082_b(i + 1, j, k, true))
+ if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- if (world.func_41082_b(i, j, k - 1, true))
+ if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- if (world.func_41082_b(i, j, k + 1, true))
+ if (world.isBlockSolidOnSide(i, j, k + 1, 2))
{
return true;
}
@@ -71,19 +71,19 @@
{
i1 = 5;
}
- if (l == 2 && world.func_41082_b(i, j, k + 1, true))
+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
i1 = 4;
}
- if (l == 3 && world.func_41082_b(i, j, k - 1, true))
+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
i1 = 3;
}
- if (l == 4 && world.func_41082_b(i + 1, j, k, true))
+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
i1 = 2;
}
- if (l == 5 && world.func_41082_b(i - 1, j, k, true))
+ if (l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
i1 = 1;
}
@@ -101,19 +101,19 @@
public void onBlockAdded(World world, int i, int j, int k)
{
- if (world.func_41082_b(i - 1, j, k, true))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
world.setBlockMetadataWithNotify(i, j, k, 1);
}
- else if (world.func_41082_b(i + 1, j, k, true))
+ else if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
world.setBlockMetadataWithNotify(i, j, k, 2);
}
- else if (world.func_41082_b(i, j, k - 1, true))
+ else if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
world.setBlockMetadataWithNotify(i, j, k, 3);
}
- else if (world.func_41082_b(i, j, k + 1, true))
+ else if (world.isBlockSolidOnSide(i, j, k + 1, 2))
{
world.setBlockMetadataWithNotify(i, j, k, 4);
}
@@ -130,19 +130,19 @@
{
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = false;
- if (!world.func_41082_b(i - 1, j, k, true) && i1 == 1)
+ if (!world.isBlockSolidOnSide(i - 1, j, k, 5) && i1 == 1)
{
flag = true;
}
- if (!world.func_41082_b(i + 1, j, k, true) && i1 == 2)
+ if (!world.isBlockSolidOnSide(i + 1, j, k, 4) && i1 == 2)
{
flag = true;
}
- if (!world.func_41082_b(i, j, k - 1, true) && i1 == 3)
+ if (!world.isBlockSolidOnSide(i, j, k - 1, 3) && i1 == 3)
{
flag = true;
}
- if (!world.func_41082_b(i, j, k + 1, true) && i1 == 4)
+ if (!world.isBlockSolidOnSide(i, j, k + 1, 2) && i1 == 4)
{
flag = true;
}
@@ -1,233 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000
@@ -338,7 +338,7 @@
{
Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2);
}
- else if ((Block.blocksList[l1] instanceof BlockContainer) && l1 != l)
+ else if (Block.blocksList[l1] != null && Block.blocksList[l1].hasTileEntity(getBlockMetadata(i, j, k)) && l1 != l)
{
worldObj.removeBlockTileEntity(i2, j, j2);
}
@@ -368,12 +368,12 @@
{
Block.blocksList[l].onBlockAdded(worldObj, i2, j, j2);
}
- if (Block.blocksList[l] instanceof BlockContainer)
+ if (Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(i1))
{
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if (tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = Block.blocksList[l].getTileEntity(i1);
worldObj.setBlockTileEntity(i2, j, j2, tileentity);
}
if (tileentity != null)
@@ -382,14 +382,6 @@
}
}
}
- else if (l1 > 0 && (Block.blocksList[l1] instanceof BlockContainer))
- {
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
- if (tileentity1 != null)
- {
- tileentity1.updateContainingBlockInfo();
- }
- }
isModified = true;
return true;
}
@@ -413,7 +405,11 @@
blocks[i << worldObj.xShift | k << worldObj.heightShift | j] = (byte)(byte0 & 0xff);
if (k1 != 0)
{
- Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2);
+ if (!worldObj.multiplayerWorld)
+ {
+ Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2);
+ }
+ removeChunkBlockTileEntity(i, j, k);
}
data.setNibble(i, j, k, 0);
if (Block.lightOpacity[byte0 & 0xff] != 0)
@@ -436,28 +432,22 @@
{
Block.blocksList[l].onBlockAdded(worldObj, l1, j, i2);
}
- if (l > 0 && (Block.blocksList[l] instanceof BlockContainer))
+ int meta = getBlockMetadata(i, j, k);
+ if (l > 0 && Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(meta))
{
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if (tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = Block.blocksList[l].getTileEntity(meta);
worldObj.setBlockTileEntity(l1, j, i2, tileentity);
}
if (tileentity != null)
{
tileentity.updateContainingBlockInfo();
+ tileentity.blockMetadata = meta;
}
}
}
- else if (k1 > 0 && (Block.blocksList[k1] instanceof BlockContainer))
- {
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
- if (tileentity1 != null)
- {
- tileentity1.updateContainingBlockInfo();
- }
- }
isModified = true;
return true;
}
@@ -477,7 +467,7 @@
}
data.setNibble(i, j, k, l);
int j1 = getBlockID(i, j, k);
- if (j1 > 0 && (Block.blocksList[j1] instanceof BlockContainer))
+ if (j1 > 0 && Block.blocksList[j1] != null && Block.blocksList[j1].hasTileEntity(i1))
{
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if (tileentity != null)
@@ -594,29 +584,27 @@
{
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if (tileentity != null && tileentity.isInvalid())
+ {
+ chunkTileEntityMap.remove(chunkposition);
+ tileentity = null;
+ }
if (tileentity == null)
{
int l = getBlockID(i, j, k);
- if (!Block.isBlockContainer[l])
+ int meta = getBlockMetadata(i, j, k);
+ if (Block.blocksList[l] == null || !Block.blocksList[l].hasTileEntity(meta))
{
return null;
}
if (tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = Block.blocksList[l].getTileEntity(meta);
worldObj.setBlockTileEntity(xPosition * 16 + i, j, zPosition * 16 + k, tileentity);
}
tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
}
- if (tileentity != null && tileentity.isInvalid())
- {
- chunkTileEntityMap.remove(chunkposition);
- return null;
- }
- else
- {
- return tileentity;
- }
+ return tileentity;
}
public void addTileEntity(TileEntity tileentity)
@@ -627,7 +615,7 @@
setChunkBlockTileEntity(i, j, k, tileentity);
if (isChunkLoaded)
{
- worldObj.loadedTileEntityList.add(tileentity);
+ worldObj.addTileEntity(tileentity);
}
}
@@ -638,12 +626,18 @@
tileentity.xCoord = xPosition * 16 + i;
tileentity.yCoord = j;
tileentity.zCoord = zPosition * 16 + k;
- if (getBlockID(i, j, k) == 0 || !(Block.blocksList[getBlockID(i, j, k)] instanceof BlockContainer))
+ int id = getBlockID(i, j, k);
+ if (id == 0 || Block.blocksList[id] == null || !Block.blocksList[id].hasTileEntity(getBlockMetadata(i, j, k)))
{
return;
}
else
{
+ TileEntity old = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if (old != null)
+ {
+ old.invalidate();
+ }
tileentity.validate();
chunkTileEntityMap.put(chunkposition, tileentity);
return;
@@ -790,6 +784,16 @@
public int setChunkData(byte abyte0[], int i, int j, int k, int l, int i1, int j1,
int k1)
{
+ TileEntity te;
+ Iterator iterator = chunkTileEntityMap.values().iterator();
+ while (iterator.hasNext())
+ {
+ te = (TileEntity)iterator.next();
+ te.updateContainingBlockInfo();
+ te.getBlockMetadata();
+ te.getBlockType();
+ }
+
for (int l1 = i; l1 < l; l1++)
{
for (int l2 = k; l2 < j1; l2++)
@@ -835,10 +839,29 @@
}
}
- TileEntity tileentity;
- for (Iterator iterator = chunkTileEntityMap.values().iterator(); iterator.hasNext(); tileentity.updateContainingBlockInfo())
+ List<TileEntity> invalidList=new ArrayList();
+ iterator = chunkTileEntityMap.values().iterator();
+ while(iterator.hasNext())
{
- tileentity = (TileEntity)iterator.next();
+ te = (TileEntity)iterator.next();
+ if ((te.xCoord & 15) >= i && (te.xCoord & 15) <= l &&
+ (te.yCoord >= j) && (te.yCoord <= i1) &&
+ (te.zCoord & 15) >= k && (te.zCoord & 15) <=j1)
+ {
+
+ Block bl = te.getBlockType();
+ if (bl != null &&
+ bl.blockID == worldObj.getBlockId(te.xCoord, te.yCoord, te.zCoord) &&
+ te.getBlockMetadata() == worldObj.getBlockMetadata(te.xCoord, te.yCoord, te.zCoord))
+ continue;
+
+ invalidList.add(te);
+ }
+ }
+
+ for(TileEntity te2 : invalidList)
+ {
+ te2.invalidate();
}
return k1;
@@ -917,4 +940,18 @@
{
return new ChunkCoordIntPair(xPosition, zPosition);
}
+
+ /* FORGE: Used to remove only invalid TileEntities */
+ public void cleanChunkBlockTileEntity(int i, int j, int k)
+ {
+ ChunkPosition chunkposition = new ChunkPosition(i, j, k);
+ if (isChunkLoaded)
+ {
+ TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if (tileentity != null && tileentity.isInvalid())
+ {
+ chunkTileEntityMap.remove(chunkposition);
+ }
+ }
+ }
}
@@ -1,19 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000
@@ -102,6 +102,16 @@
return (new StringBuilder()).append(s).append(" ").append(StatCollector.translateToLocal((new StringBuilder()).append("enchantment.level.").append(i).toString())).toString();
}
+ /**
+ * Called to determine if this enchantment can be applied to a ItemStack
+ * @param item The ItemStack that the enchantment might be put on
+ * @return True if the item is valid, false otherwise
+ */
+ public boolean canEnchantItem(ItemStack item)
+ {
+ return type.canEnchantItem(item.getItem());
+ }
+
static
{
looting = new EnchantmentLootBonus(21, 2, EnumEnchantmentType.weapon);
@@ -1,11 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000
@@ -261,7 +261,7 @@
for (int k = 0; k < j; k++)
{
Enchantment enchantment = aenchantment[k];
- if (enchantment == null || !enchantment.type.canEnchantItem(item))
+ if (enchantment == null || !enchantment.canEnchantItem(itemstack))
{
continue;
}
@@ -1,55 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/Entity.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Entity.java 0000-00-00 00:00:00.000000000 -0000
@@ -70,6 +70,9 @@
public int serverPosZ;
public boolean ignoreFrustumCheck;
public boolean isAirBorne;
+
+ //Forge: Used to store custom data for each entity.
+ private NBTTagCompound customEntityData;
public Entity(World world)
{
@@ -110,6 +113,20 @@
}
protected abstract void entityInit();
+
+ /**
+ * Returns a NBTTagCompound that can be used to store custom data for this entity.
+ * It will be written, and read from disc, so it persists over world saves.
+ * @return A NBTTagCompound
+ */
+ public NBTTagCompound getEntityData()
+ {
+ if (customEntityData == null)
+ {
+ customEntityData = new NBTTagCompound();
+ }
+ return customEntityData;
+ }
public DataWatcher getDataWatcher()
{
@@ -967,6 +984,10 @@
nbttagcompound.setShort("Fire", (short)fire);
nbttagcompound.setShort("Air", (short)getAir());
nbttagcompound.setBoolean("OnGround", onGround);
+ if (customEntityData != null)
+ {
+ nbttagcompound.setCompoundTag("ForgeData", customEntityData);
+ }
writeEntityToNBT(nbttagcompound);
}
@@ -1001,6 +1022,10 @@
onGround = nbttagcompound.getBoolean("OnGround");
setPosition(posX, posY, posZ);
setRotation(rotationYaw, rotationPitch);
+ if (nbttagcompound.hasKey("ForgeData"))
+ {
+ customEntityData = nbttagcompound.getCompoundTag("ForgeData");
+ }
readEntityFromNBT(nbttagcompound);
}
@@ -1,901 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/EntityMinecart.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EntityMinecart.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,18 +1,23 @@
package net.minecraft.src;
+import java.util.ArrayList;
import java.util.List;
import java.util.Random;
+import net.minecraft.src.forge.ForgeHooks;
+import net.minecraft.src.forge.IMinecartCollisionHandler;
+import net.minecraft.src.forge.MinecraftForge;
+
public class EntityMinecart extends Entity
implements IInventory
{
- private ItemStack cargoItems[];
- private int fuel;
- private boolean field_856_i;
+ protected ItemStack cargoItems[];
+ protected int fuel;
+ protected boolean field_856_i;
public int minecartType;
public double pushX;
public double pushZ;
- private static final int field_855_j[][][] =
+ protected static final int field_855_j[][][] =
{
{
{
@@ -76,16 +81,36 @@
}
}
};
- private int minecartPosRotationIncrements;
- private double minecartX;
- private double minecartY;
- private double minecartZ;
- private double minecartYaw;
- private double minecartPitch;
- private double velocityX;
- private double velocityY;
- private double velocityZ;
-
+ protected int minecartPosRotationIncrements;
+ protected double minecartX;
+ protected double minecartY;
+ protected double minecartZ;
+ protected double minecartYaw;
+ protected double minecartPitch;
+ protected double velocityX;
+ protected double velocityY;
+ protected double velocityZ;
+
+ /*Forge: Minecart Compatibility Layer Integration.
+ */
+ public static float defaultMaxSpeedRail = 0.4f;
+ public static float defaultMaxSpeedGround = 0.4f;
+ public static float defaultMaxSpeedAirLateral = 0.4f;
+ public static float defaultMaxSpeedAirVertical = -1f;
+ public static double defaultDragAir = 0.94999998807907104D;
+ protected boolean canUseRail = true;
+ protected boolean canBePushed = true;
+ private static IMinecartCollisionHandler collisionHandler = null;
+
+ /*
+ * Instance versions of the above physics properties
+ */
+ protected float maxSpeedRail;
+ protected float maxSpeedGround;
+ protected float maxSpeedAirLateral;
+ protected float maxSpeedAirVertical;
+ protected double dragAir;
+
public EntityMinecart(World world)
{
super(world);
@@ -95,6 +120,18 @@
preventEntitySpawning = true;
setSize(0.98F, 0.7F);
yOffset = height / 2.0F;
+
+ maxSpeedRail = defaultMaxSpeedRail;
+ maxSpeedGround = defaultMaxSpeedGround;
+ maxSpeedAirLateral = defaultMaxSpeedAirLateral;
+ maxSpeedAirVertical = defaultMaxSpeedAirVertical;
+ dragAir = defaultDragAir;
+ }
+
+ public EntityMinecart(World world, int type)
+ {
+ this(world);
+ minecartType = type;
}
protected boolean canTriggerWalking()
@@ -112,17 +149,27 @@
public AxisAlignedBB getCollisionBox(Entity entity)
{
+ if (getCollisionHandler() != null)
+ {
+ return getCollisionHandler().getCollisionBox(this, entity);
+ }
+
return entity.boundingBox;
}
public AxisAlignedBB getBoundingBox()
{
+ if (getCollisionHandler() != null)
+ {
+ return getCollisionHandler().getBoundingBox(this);
+ }
+
return null;
}
public boolean canBePushed()
{
- return true;
+ return canBePushed;
}
public EntityMinecart(World world, double d, double d1, double d2,
@@ -197,12 +244,6 @@
}
while (true);
}
-
- dropItemWithOffset(Block.chest.blockID, 1, 0.0F);
- }
- else if (minecartType == 2)
- {
- dropItemWithOffset(Block.stoneOvenIdle.blockID, 1, 0.0F);
}
}
return true;
@@ -268,7 +309,7 @@
{
func_41024_b(func_41025_i() - 1);
}
- if (isMinecartPowered() && rand.nextInt(4) == 0)
+ if (isMinecartPowered() && rand.nextInt(4) == 0 && minecartType == 2 && getClass() == EntityMinecart.class)
{
worldObj.spawnParticle("largesmoke", posX, posY + 0.80000000000000004D, posZ, 0.0D, 0.0D, 0.0D);
}
@@ -309,22 +350,18 @@
double d2 = 0.40000000000000002D;
double d4 = 0.0078125D;
int l = worldObj.getBlockId(i, j, k);
- if (BlockRail.isRailBlock(l))
+ if (canUseRail() && BlockRail.isRailBlock(l))
{
Vec3D vec3d = func_514_g(posX, posY, posZ);
- int i1 = worldObj.getBlockMetadata(i, j, k);
+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k);
posY = j;
boolean flag = false;
boolean flag1 = false;
if (l == Block.railPowered.blockID)
{
- flag = (i1 & 8) != 0;
+ flag = (worldObj.getBlockMetadata(i, j, k) & 8) != 0;
flag1 = !flag;
}
- if (((BlockRail)Block.blocksList[l]).getIsPowered())
- {
- i1 &= 7;
- }
if (i1 >= 2 && i1 <= 5)
{
posY = j + 1;
@@ -358,7 +395,7 @@
double d13 = Math.sqrt(motionX * motionX + motionZ * motionZ);
motionX = (d13 * d9) / d11;
motionZ = (d13 * d10) / d11;
- if (flag1)
+ if (flag1 && shouldDoRailFunctions())
{
double d16 = Math.sqrt(motionX * motionX + motionZ * motionZ);
if (d16 < 0.029999999999999999D)
@@ -401,30 +438,9 @@
posX = d18 + d9 * d17;
posZ = d19 + d10 * d17;
setPosition(posX, posY + (double)yOffset, posZ);
- double d23 = motionX;
- double d25 = motionZ;
- if (riddenByEntity != null)
- {
- d23 *= 0.75D;
- d25 *= 0.75D;
- }
- if (d23 < -d2)
- {
- d23 = -d2;
- }
- if (d23 > d2)
- {
- d23 = d2;
- }
- if (d25 < -d2)
- {
- d25 = -d2;
- }
- if (d25 > d2)
- {
- d25 = d2;
- }
- moveEntity(d23, 0.0D, d25);
+
+ moveMinecartOnRail(i, j, k);
+
if (ai[0][1] != 0 && MathHelper.floor_double(posX) - i == ai[0][0] && MathHelper.floor_double(posZ) - k == ai[0][2])
{
setPosition(posX, posY + (double)ai[0][1], posZ);
@@ -433,39 +449,9 @@
{
setPosition(posX, posY + (double)ai[1][1], posZ);
}
- if (riddenByEntity != null)
- {
- motionX *= 0.99699997901916504D;
- motionY *= 0.0D;
- motionZ *= 0.99699997901916504D;
- }
- else
- {
- if (minecartType == 2)
- {
- double d27 = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ);
- if (d27 > 0.01D)
- {
- pushX /= d27;
- pushZ /= d27;
- double d29 = 0.040000000000000001D;
- motionX *= 0.80000001192092896D;
- motionY *= 0.0D;
- motionZ *= 0.80000001192092896D;
- motionX += pushX * d29;
- motionZ += pushZ * d29;
- }
- else
- {
- motionX *= 0.89999997615814209D;
- motionY *= 0.0D;
- motionZ *= 0.89999997615814209D;
- }
- }
- motionX *= 0.95999997854232788D;
- motionY *= 0.0D;
- motionZ *= 0.95999997854232788D;
- }
+
+ applyDragAndPushForces();
+
Vec3D vec3d1 = func_514_g(posX, posY, posZ);
if (vec3d1 != null && vec3d != null)
{
@@ -486,26 +472,14 @@
motionX = d15 * (double)(k1 - i);
motionZ = d15 * (double)(l1 - k);
}
- if (minecartType == 2)
+
+ updatePushForces();
+
+ if (shouldDoRailFunctions())
{
- double d30 = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ);
- if (d30 > 0.01D && motionX * motionX + motionZ * motionZ > 0.001D)
- {
- pushX /= d30;
- pushZ /= d30;
- if (pushX * motionX + pushZ * motionZ < 0.0D)
- {
- pushX = 0.0D;
- pushZ = 0.0D;
- }
- else
- {
- pushX = motionX;
- pushZ = motionZ;
- }
- }
+ ((BlockRail)Block.blocksList[l]).onMinecartPass(worldObj, this, i, j, k);
}
- if (flag)
+ if (flag && shouldDoRailFunctions())
{
double d31 = Math.sqrt(motionX * motionX + motionZ * motionZ);
if (d31 > 0.01D)
@@ -540,35 +514,7 @@
}
else
{
- if (motionX < -d2)
- {
- motionX = -d2;
- }
- if (motionX > d2)
- {
- motionX = d2;
- }
- if (motionZ < -d2)
- {
- motionZ = -d2;
- }
- if (motionZ > d2)
- {
- motionZ = d2;
- }
- if (onGround)
- {
- motionX *= 0.5D;
- motionY *= 0.5D;
- motionZ *= 0.5D;
- }
- moveEntity(motionX, motionY, motionZ);
- if (!onGround)
- {
- motionX *= 0.94999998807907104D;
- motionY *= 0.94999998807907104D;
- motionZ *= 0.94999998807907104D;
- }
+ moveMinecartOffRail(i, j, k);
}
rotationPitch = 0.0F;
double d6 = prevPosX - posX;
@@ -590,7 +536,20 @@
field_856_i = !field_856_i;
}
setRotation(rotationYaw, rotationPitch);
- List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D));
+
+ AxisAlignedBB box = null;
+
+ if (getCollisionHandler() != null)
+ {
+ box = getCollisionHandler().getMinecartCollisionBox(this);
+ }
+ else
+ {
+
+ box = boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D);
+ }
+
+ List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, box);
if (list != null && list.size() > 0)
{
for (int j1 = 0; j1 < list.size(); j1++)
@@ -610,15 +569,8 @@
}
riddenByEntity = null;
}
- if (fuel > 0)
- {
- fuel--;
- }
- if (fuel <= 0)
- {
- pushX = pushZ = 0.0D;
- }
- setMinecartPowered(fuel > 0);
+ updateFuel();
+ ForgeHooks.onMinecartUpdate(this, i, j, k);
}
public Vec3D func_515_a(double d, double d1, double d2, double d3)
@@ -633,11 +585,7 @@
int l = worldObj.getBlockId(i, j, k);
if (BlockRail.isRailBlock(l))
{
- int i1 = worldObj.getBlockMetadata(i, j, k);
- if (((BlockRail)Block.blocksList[l]).getIsPowered())
- {
- i1 &= 7;
- }
+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k);
d1 = j;
if (i1 >= 2 && i1 <= 5)
{
@@ -679,12 +627,8 @@
int l = worldObj.getBlockId(i, j, k);
if (BlockRail.isRailBlock(l))
{
- int i1 = worldObj.getBlockMetadata(i, j, k);
+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k);
d1 = j;
- if (((BlockRail)Block.blocksList[l]).getIsPowered())
- {
- i1 &= 7;
- }
if (i1 >= 2 && i1 <= 5)
{
d1 = j + 1;
@@ -739,13 +683,13 @@
protected void writeEntityToNBT(NBTTagCompound nbttagcompound)
{
nbttagcompound.setInteger("Type", minecartType);
- if (minecartType == 2)
+ if (isPoweredCart())
{
nbttagcompound.setDouble("PushX", pushX);
nbttagcompound.setDouble("PushZ", pushZ);
- nbttagcompound.setShort("Fuel", (short)fuel);
+ nbttagcompound.setInteger("Fuel", fuel);
}
- else if (minecartType == 1)
+ if (getSizeInventory() > 0)
{
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < cargoItems.length; i++)
@@ -766,13 +710,13 @@
protected void readEntityFromNBT(NBTTagCompound nbttagcompound)
{
minecartType = nbttagcompound.getInteger("Type");
- if (minecartType == 2)
+ if (isPoweredCart())
{
pushX = nbttagcompound.getDouble("PushX");
pushZ = nbttagcompound.getDouble("PushZ");
- fuel = nbttagcompound.getShort("Fuel");
+ fuel = nbttagcompound.getInteger("Fuel");
}
- else if (minecartType == 1)
+ if (getSizeInventory() > 0)
{
NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
cargoItems = new ItemStack[getSizeInventory()];
@@ -795,6 +739,12 @@
public void applyEntityCollision(Entity entity)
{
+ ForgeHooks.onMinecartEntityCollision(this, entity);
+ if (getCollisionHandler() != null)
+ {
+ getCollisionHandler().onEntityCollision(this, entity);
+ return;
+ }
if (worldObj.multiplayerWorld)
{
return;
@@ -803,7 +753,7 @@
{
return;
}
- if ((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && minecartType == 0 && motionX * motionX + motionZ * motionZ > 0.01D && riddenByEntity == null && entity.ridingEntity == null)
+ if ((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && canBeRidden() && motionX * motionX + motionZ * motionZ > 0.01D && riddenByEntity == null && entity.ridingEntity == null)
{
entity.mountEntity(this);
}
@@ -841,7 +791,7 @@
}
double d7 = entity.motionX + motionX;
double d8 = entity.motionZ + motionZ;
- if (((EntityMinecart)entity).minecartType == 2 && minecartType != 2)
+ if (((EntityMinecart)entity).isPoweredCart() && !isPoweredCart())
{
motionX *= 0.20000000298023224D;
motionZ *= 0.20000000298023224D;
@@ -849,7 +799,7 @@
entity.motionX *= 0.94999998807907104D;
entity.motionZ *= 0.94999998807907104D;
}
- else if (((EntityMinecart)entity).minecartType != 2 && minecartType == 2)
+ else if (!((EntityMinecart)entity).isPoweredCart() && isPoweredCart())
{
entity.motionX *= 0.20000000298023224D;
entity.motionZ *= 0.20000000298023224D;
@@ -879,7 +829,7 @@
public int getSizeInventory()
{
- return 27;
+ return (minecartType == 1 && getClass() == EntityMinecart.class ? 27 : 0);
}
public ItemStack getStackInSlot(int i)
@@ -935,7 +885,11 @@
public boolean interact(EntityPlayer entityplayer)
{
- if (minecartType == 0)
+ if (!ForgeHooks.onMinecartInteract(this, entityplayer))
+ {
+ return true;
+ }
+ if (canBeRidden())
{
if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer)
{
@@ -946,14 +900,14 @@
entityplayer.mountEntity(this);
}
}
- else if (minecartType == 1)
+ else if (getSizeInventory() > 0)
{
if (!worldObj.multiplayerWorld)
{
entityplayer.displayGUIChest(this);
}
}
- else if (minecartType == 2)
+ else if (minecartType == 2 && getClass() == EntityMinecart.class)
{
ItemStack itemstack = entityplayer.inventory.getCurrentItem();
if (itemstack != null && itemstack.itemID == Item.coal.shiftedIndex)
@@ -1000,7 +954,7 @@
return entityplayer.getDistanceSqToEntity(this) <= 64D;
}
- protected boolean isMinecartPowered()
+ public boolean isMinecartPowered()
{
return (dataWatcher.getWatchableObjectByte(16) & 1) != 0;
}
@@ -1054,4 +1008,382 @@
{
return dataWatcher.getWatchableObjectInt(18);
}
+
+ /**
+ * Drops the cart as a item. The exact item dropped is defined by getItemDropped().
+ */
+ public void dropCartAsItem()
+ {
+ for(ItemStack item : getItemsDropped())
+ {
+ entityDropItem(item, 0);
+ }
+ }
+
+ /**
+ * Override this to define which items your cart drops when broken.
+ * This does not include items contained in the inventory,
+ * that is handled elsewhere.
+ * @return A list of items dropped.
+ */
+ public List<ItemStack> getItemsDropped()
+ {
+ List<ItemStack> items = new ArrayList<ItemStack>();
+ items.add(new ItemStack(Item.minecartEmpty));
+
+ switch(minecartType)
+ {
+ case 1:
+ items.add(new ItemStack(Block.chest));
+ break;
+ case 2:
+ items.add(new ItemStack(Block.stoneOvenIdle));
+ break;
+ }
+ return items;
+ }
+
+ /**
+ * This function returns an ItemStack that represents this cart.
+ * This should be an ItemStack that can be used by the player to place the cart.
+ * This is the item that was registered with the cart via the registerMinecart function,
+ * but is not necessary the item the cart drops when destroyed.
+ * @return An ItemStack that can be used to place the cart.
+ */
+ public ItemStack getCartItem()
+ {
+ return MinecraftForge.getItemForCart(this);
+ }
+
+ /**
+ * Returns true if this cart is self propelled.
+ * @return True if powered.
+ */
+ public boolean isPoweredCart()
+ {
+ return minecartType == 2 && getClass() == EntityMinecart.class;
+ }
+
+ /**
+ * Returns true if this cart is a storage cart
+ * Some carts may have inventories but not be storage carts
+ * and some carts without inventories may be storage carts.
+ * @return True if this cart should be classified as a storage cart.
+ */
+ public boolean isStorageCart()
+ {
+ return minecartType == 1 && getClass() == EntityMinecart.class;
+ }
+
+ /**
+ * Returns true if this cart can be ridden by an Entity.
+ * @return True if this cart can be ridden.
+ */
+ public boolean canBeRidden()
+ {
+ if(minecartType == 0 && getClass() == EntityMinecart.class)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns true if this cart can currently use rails.
+ * This function is mainly used to gracefully detach a minecart from a rail.
+ * @return True if the minecart can use rails.
+ */
+ public boolean canUseRail()
+ {
+ return canUseRail;
+ }
+
+ /**
+ * Set whether the minecart can use rails.
+ * This function is mainly used to gracefully detach a minecart from a rail.
+ * @param use Whether the minecart can currently use rails.
+ */
+ public void setCanUseRail(boolean use)
+ {
+ canUseRail = use;
+ }
+
+ /**
+ * Return false if this cart should not call IRail.onMinecartPass() and should ignore Powered Rails.
+ * @return True if this cart should call IRail.onMinecartPass().
+ */
+ public boolean shouldDoRailFunctions()
+ {
+ return true;
+ }
+
+ /**
+ * Simply returns the minecartType variable.
+ * @return minecartType
+ */
+ public int getMinecartType()
+ {
+ return minecartType;
+ }
+
+ /**
+ * Gets the current global Minecart Collision handler if none
+ * is registered, returns null
+ * @return The collision handler or null
+ */
+ public static IMinecartCollisionHandler getCollisionHandler()
+ {
+ return collisionHandler;
+ }
+
+ /**
+ * Sets the global Minecart Collision handler, overwrites any
+ * that is currently set.
+ * @param handler The new handler
+ */
+ public static void setCollisionHandler(IMinecartCollisionHandler handler)
+ {
+ collisionHandler = handler;
+ }
+
+ /**
+ * Carts should return their drag factor here
+ * @return The drag rate.
+ */
+ protected double getDrag()
+ {
+ if(riddenByEntity != null)
+ {
+ return 0.99699997901916504D;
+ }
+ return 0.95999997854232788D;
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code applies drag and updates push forces.
+ */
+ protected void applyDragAndPushForces()
+ {
+ if(isPoweredCart())
+ {
+ double d27 = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ);
+ if(d27 > 0.01D)
+ {
+ pushX /= d27;
+ pushZ /= d27;
+ double d29 = 0.040000000000000001D;
+ motionX *= 0.80000001192092896D;
+ motionY *= 0.0D;
+ motionZ *= 0.80000001192092896D;
+ motionX += pushX * d29;
+ motionZ += pushZ * d29;
+ } else
+ {
+ motionX *= 0.89999997615814209D;
+ motionY *= 0.0D;
+ motionZ *= 0.89999997615814209D;
+ }
+ }
+ motionX *= getDrag();
+ motionY *= 0.0D;
+ motionZ *= getDrag();
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code updates push forces.
+ */
+ protected void updatePushForces()
+ {
+ if(isPoweredCart())
+ {
+ double push = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ);
+ if(push > 0.01D && motionX * motionX + motionZ * motionZ > 0.001D)
+ {
+ pushX /= push;
+ pushZ /= push;
+ if(pushX * motionX + pushZ * motionZ < 0.0D)
+ {
+ pushX = 0.0D;
+ pushZ = 0.0D;
+ } else
+ {
+ pushX = motionX;
+ pushZ = motionZ;
+ }
+ }
+ }
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code handles minecart movement and speed capping when on a rail.
+ */
+ protected void moveMinecartOnRail(int i, int j, int k)
+ {
+ int id = worldObj.getBlockId(i, j, k);
+ if (!BlockRail.isRailBlock(id))
+ {
+ return;
+ }
+ float railMaxSpeed = ((BlockRail)Block.blocksList[id]).getRailMaxSpeed(worldObj, this, i, j, k);
+
+ double maxSpeed = Math.min(railMaxSpeed, getMaxSpeedRail());
+ double d23 = motionX;
+ double d25 = motionZ;
+ if(riddenByEntity != null)
+ {
+ d23 *= 0.75D;
+ d25 *= 0.75D;
+ }
+ if(d23 < -maxSpeed)
+ {
+ d23 = -maxSpeed;
+ }
+ if(d23 > maxSpeed)
+ {
+ d23 = maxSpeed;
+ }
+ if(d25 < -maxSpeed)
+ {
+ d25 = -maxSpeed;
+ }
+ if(d25 > maxSpeed)
+ {
+ d25 = maxSpeed;
+ }
+ moveEntity(d23, 0.0D, d25);
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code handles minecart movement and speed capping when not on a rail.
+ */
+ protected void moveMinecartOffRail(int i, int j, int k)
+ {
+ double d2 = getMaxSpeedGround();
+ if(!onGround)
+ {
+ d2 = getMaxSpeedAirLateral();
+ }
+ if(motionX < -d2)
+ {
+ motionX = -d2;
+ }
+ if(motionX > d2)
+ {
+ motionX = d2;
+ }
+ if(motionZ < -d2)
+ {
+ motionZ = -d2;
+ }
+ if(motionZ > d2)
+ {
+ motionZ = d2;
+ }
+ double moveY = motionY;
+ if(getMaxSpeedAirVertical() > 0 && motionY > getMaxSpeedAirVertical())
+ {
+ moveY = getMaxSpeedAirVertical();
+ if(Math.abs(motionX) < 0.3f && Math.abs(motionZ) < 0.3f)
+ {
+ moveY = 0.15f;
+ motionY = moveY;
+ }
+ }
+ if(onGround)
+ {
+ motionX *= 0.5D;
+ motionY *= 0.5D;
+ motionZ *= 0.5D;
+ }
+ moveEntity(motionX, moveY, motionZ);
+ if(!onGround)
+ {
+ motionX *= getDragAir();
+ motionY *= getDragAir();
+ motionZ *= getDragAir();
+ }
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code applies fuel consumption.
+ */
+ protected void updateFuel()
+ {
+ if (fuel > 0)
+ {
+ fuel--;
+ }
+ if (fuel <= 0)
+ {
+ pushX = pushZ = 0.0D;
+ }
+ setMinecartPowered(fuel > 0);
+ }
+
+ /**
+ * Getters/setters for physics variables
+ */
+
+ /**
+ * Returns the carts max speed.
+ * Carts going faster than 1.1 cause issues with chunk loading.
+ * Carts cant traverse slopes or corners at greater than 0.5 - 0.6.
+ * This value is compared with the rails max speed to determine
+ * the carts current max speed. A normal rails max speed is 0.4.
+ * @return Carts max speed.
+ */
+ public float getMaxSpeedRail()
+ {
+ return maxSpeedRail;
+ }
+
+ public void setMaxSpeedRail(float value)
+ {
+ maxSpeedRail = value;
+ }
+
+ public float getMaxSpeedGround()
+ {
+ return maxSpeedGround;
+ }
+
+ public void setMaxSpeedGround(float value)
+ {
+ maxSpeedGround = value;
+ }
+
+ public float getMaxSpeedAirLateral()
+ {
+ return maxSpeedAirLateral;
+ }
+
+ public void setMaxSpeedAirLateral(float value)
+ {
+ maxSpeedAirLateral = value;
+ }
+
+ public float getMaxSpeedAirVertical()
+ {
+ return maxSpeedAirVertical;
+ }
+
+ public void setMaxSpeedAirVertical(float value)
+ {
+ maxSpeedAirVertical = value;
+ }
+
+ public double getDragAir()
+ {
+ return dragAir;
+ }
+
+ public void setDragAir(double value)
+ {
+ dragAir = value;
+ }
}
@@ -1,130 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,6 +1,7 @@
package net.minecraft.src;
import java.io.PrintStream;
+import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@@ -157,6 +158,9 @@
private String potionModifier;
private String itemName;
+ // FORGE: To disable repair recipes.
+ protected boolean canRepair = true;
+
protected Item(int i)
{
maxStackSize = 64;
@@ -469,6 +473,109 @@
{
return getIconFromDamage(i);
}
+
+ /**
+ * Called when a new CreativeContainer is opened, populate the list
+ * with all of the items for this item you want a player in creative mode
+ * to have access to.
+ *
+ * @param itemList The list of items currently in the creative inventory
+ */
+ public void addCreativeItems(ArrayList itemList)
+ {
+ if (this.shiftedIndex != Item.potion.shiftedIndex && this.shiftedIndex != Item.field_44019_bC.shiftedIndex)
+ {
+ itemList.add(new ItemStack(this, 1));
+ }
+ }
+
+ /**
+ * Called when a player drops the item into the world,
+ * returning false from this will prevent the item from
+ * being removed from the players inventory and spawning
+ * in the world
+ *
+ * @param player The player that dropped the item
+ * @param item The item stack, before the item is removed.
+ */
+ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player)
+ {
+ return true;
+ }
+
+ /**
+ * This is called when the item is used, before the block is activated.
+ * @param stack The Item Stack
+ * @param player The Player that used the item
+ * @param world The Current World
+ * @param X Target X Position
+ * @param Y Target Y Position
+ * @param Z Target Z Position
+ * @param side The side of the target hit
+ * @return Return true to prevent any further processing.
+ */
+ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int X, int Y, int Z, int side)
+ {
+ return false;
+ }
+
+ /**
+ * Metadata-sensitive version of getStrVsBlock
+ * @param itemstack The Item Stack
+ * @param block The block the item is trying to break
+ * @param metadata The items current metadata
+ * @return The damage strength
+ */
+ public float getStrVsBlock(ItemStack itemstack, Block block, int metadata)
+ {
+ return getStrVsBlock(itemstack, block);
+ }
+
+ /**
+ * Called by CraftingManager to determine if an item is reparable.
+ * @return True if reparable
+ */
+ public boolean isRepairable()
+ {
+ return canRepair && isDamageable();
+ }
+
+ /**
+ * Call to disable repair recipes.
+ * @return The current Item instance
+ */
+ public Item setNoRepair()
+ {
+ canRepair = false;
+ return this;
+ }
+
+ /**
+ * Called before a block is broken. Return true to prevent default block harvesting.
+ *
+ * Note: In SMP, this is called on both client and server sides!
+ *
+ * @param itemstack The current ItemStack
+ * @param X The X Position
+ * @param Y The X Position
+ * @param Z The X Position
+ * @param player The Player that is wielding the item
+ * @return True to prevent harvesting, false to continue as normal
+ */
+ public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player)
+ {
+ return false;
+ }
+
+ /**
+ * Called each tick while using an item.
+ * @param stack The Item being used
+ * @param player The Player using the item
+ * @param count The amount of time in tick the item has been used for continuously
+ */
+ public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count)
+ {
+ }
static
{
@@ -1,87 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/RailLogic.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RailLogic.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,7 +3,7 @@
import java.util.ArrayList;
import java.util.List;
-class RailLogic
+public class RailLogic
{
private World worldObj;
private int trackX;
@@ -12,6 +12,7 @@
private final boolean isPoweredRail;
private List connectedTracks;
final BlockRail rail;
+ private final boolean canMakeSlopes;
public RailLogic(BlockRail blockrail, World world, int i, int j, int k)
{
@@ -23,16 +24,12 @@
trackY = j;
trackZ = k;
int l = world.getBlockId(i, j, k);
- int i1 = world.getBlockMetadata(i, j, k);
- if (BlockRail.isPoweredBlockRail((BlockRail)Block.blocksList[l]))
- {
- isPoweredRail = true;
- i1 &= -9;
- }
- else
- {
- isPoweredRail = false;
- }
+
+ BlockRail target = (BlockRail)Block.blocksList[l];
+ int i1 = target.getBasicRailMetadata(world, null, i, j, k);
+ isPoweredRail = !target.isFlexibleRail(world, i, j, k);
+ canMakeSlopes = target.canMakeSlopes(world, i, j, k);
+
setConnections(i1);
}
@@ -243,7 +240,7 @@
byte0 = 9;
}
}
- if (byte0 == 0)
+ if (byte0 == 0 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(worldObj, trackX, trackY + 1, trackZ - 1))
{
@@ -254,7 +251,7 @@
byte0 = 5;
}
}
- if (byte0 == 1)
+ if (byte0 == 1 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(worldObj, trackX + 1, trackY + 1, trackZ))
{
@@ -377,7 +374,7 @@
}
}
}
- if (byte0 == 0)
+ if (byte0 == 0 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(worldObj, trackX, trackY + 1, trackZ - 1))
{
@@ -388,7 +385,7 @@
byte0 = 5;
}
}
- if (byte0 == 1)
+ if (byte0 == 1 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(worldObj, trackX + 1, trackY + 1, trackZ))
{
@@ -428,7 +425,7 @@
}
}
- static int getNAdjacentTracks(RailLogic raillogic)
+ public static int getNAdjacentTracks(RailLogic raillogic)
{
return raillogic.getAdjacentTracks();
}
@@ -1,119 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000
@@ -32,36 +32,36 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
{
- if (l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
return true;
}
- if (l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- if (l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if (world.isBlockNormalCube(i - 1, j, k))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
return true;
}
- if (world.isBlockNormalCube(i + 1, j, k))
+ if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- if (world.isBlockNormalCube(i, j, k - 1))
+ if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- return world.isBlockNormalCube(i, j, k + 1);
+ return world.isBlockSolidOnSide(i, j, k + 1, 2);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
@@ -69,19 +69,19 @@
int i1 = world.getBlockMetadata(i, j, k);
int j1 = i1 & 8;
i1 &= 7;
- if (l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
i1 = 4;
}
- else if (l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ else if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
i1 = 3;
}
- else if (l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ else if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
i1 = 2;
}
- else if (l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ else if (l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
i1 = 1;
}
@@ -94,19 +94,19 @@
private int getOrientation(World world, int i, int j, int k)
{
- if (world.isBlockNormalCube(i - 1, j, k))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
return 1;
}
- if (world.isBlockNormalCube(i + 1, j, k))
+ if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return 2;
}
- if (world.isBlockNormalCube(i, j, k - 1))
+ if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return 3;
}
- return !world.isBlockNormalCube(i, j, k + 1) ? 1 : 4;
+ return !world.isBlockSolidOnSide(i, j, k + 1, 2) ? 1 : 4;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
@@ -115,19 +115,19 @@
{
int i1 = world.getBlockMetadata(i, j, k) & 7;
boolean flag = false;
- if (!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
+ if (!world.isBlockSolidOnSide(i - 1, j, k, 5) && i1 == 1)
{
flag = true;
}
- if (!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
+ if (!world.isBlockSolidOnSide(i + 1, j, k, 4) && i1 == 2)
{
flag = true;
}
- if (!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
+ if (!world.isBlockSolidOnSide(i, j, k - 1, 3) && i1 == 3)
{
flag = true;
}
- if (!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if (!world.isBlockSolidOnSide(i, j, k + 1, 2) && i1 == 4)
{
flag = true;
}
@@ -1,31 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000
@@ -334,23 +334,23 @@
{
return true;
}
- if (world.isBlockNormalCube(i, j + 1, k))
+ if (world.isBlockSolidOnSide(i, j + 1, k, 0))
{
return true;
}
- if (world.getBlockId(i - 1, j, k) == blockID && world.isBlockNormalCube(i - 1, j + 1, k))
+ if (world.getBlockId(i - 1, j, k) == blockID && world.isBlockSolidOnSide(i - 1, j + 1, k, 0))
{
return true;
}
- if (world.getBlockId(i + 1, j, k) == blockID && world.isBlockNormalCube(i + 1, j + 1, k))
+ if (world.getBlockId(i + 1, j, k) == blockID && world.isBlockSolidOnSide(i + 1, j + 1, k, 0))
{
return true;
}
- if (world.getBlockId(i, j, k - 1) == blockID && world.isBlockNormalCube(i, j + 1, k - 1))
+ if (world.getBlockId(i, j, k - 1) == blockID && world.isBlockSolidOnSide(i, j + 1, k - 1, 0))
{
return true;
}
- if (world.getBlockId(i, j, k + 1) == blockID && world.isBlockNormalCube(i, j + 1, k + 1))
+ if (world.getBlockId(i, j, k + 1) == blockID && world.isBlockSolidOnSide(i, j + 1, k + 1, 0))
{
return true;
}
@@ -1,83 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000
@@ -31,37 +31,37 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if (world.isBlockNormalCube(i - 1, j, k))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
return true;
}
- if (world.isBlockNormalCube(i + 1, j, k))
+ if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- if (world.isBlockNormalCube(i, j, k - 1))
+ if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- return world.isBlockNormalCube(i, j, k + 1);
+ return world.isBlockSolidOnSide(i, j, k + 1, 2);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
{
int i1 = world.getBlockMetadata(i, j, k);
- if ((i1 == 0 || l == 2) && world.isBlockNormalCube(i, j, k + 1))
+ if ((i1 == 0 || l == 2) && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
i1 = 2;
}
- if ((i1 == 0 || l == 3) && world.isBlockNormalCube(i, j, k - 1))
+ if ((i1 == 0 || l == 3) && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
i1 = 3;
}
- if ((i1 == 0 || l == 4) && world.isBlockNormalCube(i + 1, j, k))
+ if ((i1 == 0 || l == 4) && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
i1 = 4;
}
- if ((i1 == 0 || l == 5) && world.isBlockNormalCube(i - 1, j, k))
+ if ((i1 == 0 || l == 5) && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
i1 = 5;
}
@@ -72,19 +72,19 @@
{
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = false;
- if (i1 == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(i1 == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
flag = true;
}
- if (i1 == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(i1 == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
flag = true;
}
- if (i1 == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(i1 == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
flag = true;
}
- if (i1 == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(i1 == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
flag = true;
}
@@ -100,4 +100,10 @@
{
return 1;
}
+
+ /* FORGE: Implemented base method, see Block.isLadder */
+ public boolean isLadder(World world, int i, int j, int k)
+ {
+ return true;
+ }
}
@@ -1,120 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000
@@ -31,44 +31,44 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
{
- if (l == 1 && world.isBlockNormalCube(i, j - 1, k))
+ if (l == 1 && world.isBlockSolidOnSide(i, j - 1, k, 1))
{
return true;
}
- if (l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
return true;
}
- if (l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- if (l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if (world.isBlockNormalCube(i - 1, j, k))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
return true;
}
- if (world.isBlockNormalCube(i + 1, j, k))
+ if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- if (world.isBlockNormalCube(i, j, k - 1))
+ if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- if (world.isBlockNormalCube(i, j, k + 1))
+ if (world.isBlockSolidOnSide(i, j, k + 1, 2))
{
return true;
}
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
@@ -77,23 +77,23 @@
int j1 = i1 & 8;
i1 &= 7;
i1 = -1;
- if (l == 1 && world.isBlockNormalCube(i, j - 1, k))
+ if (l == 1 && world.isBlockSolidOnSide(i, j - 1, k, 1))
{
i1 = 5 + world.rand.nextInt(2);
}
- if (l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
i1 = 4;
}
- if (l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
i1 = 3;
}
- if (l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
i1 = 2;
}
- if (l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if (l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
i1 = 1;
}
@@ -116,27 +116,27 @@
{
int i1 = world.getBlockMetadata(i, j, k) & 7;
boolean flag = false;
- if (!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
+ if (!world.isBlockSolidOnSide(i - 1, j, k, 5) && i1 == 1)
{
flag = true;
}
- if (!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
+ if (!world.isBlockSolidOnSide(i + 1, j, k, 4) && i1 == 2)
{
flag = true;
}
- if (!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
+ if (!world.isBlockSolidOnSide(i, j, k - 1, 3) && i1 == 3)
{
flag = true;
}
- if (!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if (!world.isBlockSolidOnSide(i, j, k + 1, 2) && i1 == 4)
{
flag = true;
}
- if (!world.isBlockNormalCube(i, j - 1, k) && i1 == 5)
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && i1 == 5)
{
flag = true;
}
- if (!world.isBlockNormalCube(i, j - 1, k) && i1 == 6)
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && i1 == 6)
{
flag = true;
}
@@ -1,11 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockPistonBase.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockPistonBase.java 0000-00-00 00:00:00.000000000 -0000
@@ -350,7 +350,7 @@
return false;
}
}
- return !(Block.blocksList[i] instanceof BlockContainer);
+ return !(Block.blocksList[i] != null && Block.blocksList[i].hasTileEntity(world.getBlockMetadata(j, l, l)));
}
private static boolean canExtend(World world, int i, int j, int k, int l)
@@ -1,11 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000
@@ -38,7 +38,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k) || world.getBlockId(i, j - 1, k) == Block.fence.blockID;
+ return world.isBlockSolidOnSide(i, j - 1, k, 1) || world.getBlockId(i, j - 1, k) == Block.fence.blockID;
}
public void onBlockAdded(World world, int i, int j, int k)
@@ -1,196 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000
@@ -5,16 +5,29 @@
public class BlockRail extends Block
{
private final boolean isPowered;
+
+ /**
+ * Forge: Moved render type to a field and a setter.
+ * This allows for a mod to change the render type
+ * for vanilla rails, and any mod rails that extend
+ * this class.
+ */
+ private int renderType = 9;
+
+ public void setRenderType(int value)
+ {
+ renderType = value;
+ }
public static final boolean isRailBlockAt(World world, int i, int j, int k)
{
int l = world.getBlockId(i, j, k);
- return l == Block.rail.blockID || l == Block.railPowered.blockID || l == Block.railDetector.blockID;
+ return Block.blocksList[l] instanceof BlockRail;
}
public static final boolean isRailBlock(int i)
{
- return i == Block.rail.blockID || i == Block.railPowered.blockID || i == Block.railDetector.blockID;
+ return Block.blocksList[i] instanceof BlockRail;
}
protected BlockRail(int i, int j, boolean flag)
@@ -81,7 +94,7 @@
public int getRenderType()
{
- return 9;
+ return renderType;
}
public int quantityDropped(Random random)
@@ -91,7 +104,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1);
}
public void onBlockAdded(World world, int i, int j, int k)
@@ -123,19 +136,19 @@
{
flag = true;
}
- if (j1 == 2 && !world.isBlockNormalCube(i + 1, j, k))
+ if (j1 == 2 && !world.isBlockSolidOnSide(i + 1, j, k, 1))
{
flag = true;
}
- if (j1 == 3 && !world.isBlockNormalCube(i - 1, j, k))
+ if (j1 == 3 && !world.isBlockSolidOnSide(i - 1, j, k, 1))
{
flag = true;
}
- if (j1 == 4 && !world.isBlockNormalCube(i, j, k - 1))
+ if (j1 == 4 && !world.isBlockSolidOnSide(i, j, k - 1, 1))
{
flag = true;
}
- if (j1 == 5 && !world.isBlockNormalCube(i, j, k + 1))
+ if (j1 == 5 && !world.isBlockSolidOnSide(i, j, k + 1, 1))
{
flag = true;
}
@@ -317,8 +330,119 @@
return 0;
}
+ /**
+ * This function is no longer called by Minecraft
+ */
+ @Deprecated
static boolean isPoweredBlockRail(BlockRail blockrail)
{
return blockrail.isPowered;
}
+
+ /**
+ * Return true if the rail can make corners.
+ * Used by placement logic.
+ * @param world The world.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ * @return True if the rail can make corners.
+ */
+ public boolean isFlexibleRail(World world, int i, int j, int k)
+ {
+ return !isPowered;
+ }
+
+ /**
+ * Returns true if the rail can make up and down slopes.
+ * Used by placement logic.
+ * @param world The world.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ * @return True if the rail can make slopes.
+ */
+ public boolean canMakeSlopes(World world, int i, int j, int k)
+ {
+ return true;
+ }
+
+ /**
+ * Return the rails metadata (without the power bit if the rail uses one).
+ * Can be used to make the cart think the rail something other than it is,
+ * for example when making diamond junctions or switches.
+ * The cart parameter will often be null unless it it called from EntityMinecart.
+ *
+ * Valid rail metadata is defined as follows:
+ * 0x0: flat track going North-South
+ * 0x1: flat track going West-East
+ * 0x2: track ascending to the East
+ * 0x3: track ascending to the West
+ * 0x4: track ascending to the North
+ * 0x5: track ascending to the South
+ * 0x6: WestNorth corner (connecting East and South)
+ * 0x7: EastNorth corner (connecting West and South)
+ * 0x8: EastSouth corner (connecting West and North)
+ * 0x9: WestSouth corner (connecting East and North)
+ *
+ * All directions are Notch defined.
+ * In MC Beta 1.8.3 the Sun rises in the North.
+ * In MC 1.0.0 the Sun rises in the East.
+ * @param world The world.
+ * @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ * @return The metadata.
+ */
+ public int getBasicRailMetadata(IBlockAccess world, EntityMinecart cart, int i, int j, int k)
+ {
+ int meta = world.getBlockMetadata(i, j, k);
+ if(isPowered) {
+ meta = meta & 7;
+ }
+ return meta;
+ }
+
+ /**
+ * Returns the max speed of the rail at [i, j, k].
+ * @param world The world.
+ * @param cart The cart on the rail, may be null.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ * @return The max speed of the current rail.
+ */
+ public float getRailMaxSpeed(World world, EntityMinecart cart, int i, int j, int k)
+ {
+ return 0.4f;
+ }
+
+ /**
+ * This function is called by any minecart that passes over this rail.
+ * It is called once per update tick that the minecart is on the rail.
+ * @param world The world.
+ * @param cart The cart on the rail.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ */
+ public void onMinecartPass(World world, EntityMinecart cart, int i, int j, int k)
+ {
+ }
+
+ /**
+ * Return true if this rail uses the 4th bit as a power bit.
+ * Avoid using this function when getBasicRailMetadata() can be used instead.
+ * The only reason to use this function is if you wish to change the rails metadata.
+ * @param world The world.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ * @return True if the 4th bit is a power bit.
+ */
+ public boolean hasPowerBit(World world, int i, int j, int k)
+ {
+ return isPowered;
+ }
}
@@ -1,44 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockTallGrass.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockTallGrass.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,7 +1,10 @@
package net.minecraft.src;
+import java.util.ArrayList;
import java.util.Random;
+import net.minecraft.src.forge.ForgeHooks;
+
public class BlockTallGrass extends BlockFlower
{
protected BlockTallGrass(int i, int j)
@@ -33,15 +36,25 @@
public int idDropped(int i, Random random, int j)
{
- if (random.nextInt(8) == 0)
+ return -1;
+ }
+
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int md, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ if (world.rand.nextInt(8) != 0)
{
- return Item.seeds.shiftedIndex;
+ return ret;
}
- else
+
+ ItemStack item = ForgeHooks.getGrassSeed(world);
+ if (item != null)
{
- return -1;
+ ret.add(item);
}
- }
+ return ret;
+ }
public int quantityDroppedWithBonus(int i, Random random)
{
@@ -1,107 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000
@@ -32,7 +32,7 @@
private boolean canPlaceTorchOn(World world, int i, int j, int k)
{
- if (world.func_41047_b(i, j, k, true))
+ if(world.isBlockSolidOnSide(i, j, k, 1))
{
return true;
}
@@ -45,19 +45,19 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- if (world.func_41047_b(i - 1, j, k, true))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
return true;
}
- if (world.func_41047_b(i + 1, j, k, true))
+ if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- if (world.func_41047_b(i, j, k - 1, true))
+ if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- if (world.func_41047_b(i, j, k + 1, true))
+ if (world.isBlockSolidOnSide(i, j, k + 1, 2))
{
return true;
}
@@ -71,19 +71,19 @@
{
i1 = 5;
}
- if (l == 2 && world.func_41047_b(i, j, k + 1, true))
+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
i1 = 4;
}
- if (l == 3 && world.func_41047_b(i, j, k - 1, true))
+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
i1 = 3;
}
- if (l == 4 && world.func_41047_b(i + 1, j, k, true))
+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
i1 = 2;
}
- if (l == 5 && world.func_41047_b(i - 1, j, k, true))
+ if (l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
i1 = 1;
}
@@ -101,19 +101,19 @@
public void onBlockAdded(World world, int i, int j, int k)
{
- if (world.func_41047_b(i - 1, j, k, true))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
world.setBlockMetadataWithNotify(i, j, k, 1);
}
- else if (world.func_41047_b(i + 1, j, k, true))
+ else if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
world.setBlockMetadataWithNotify(i, j, k, 2);
}
- else if (world.func_41047_b(i, j, k - 1, true))
+ else if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
world.setBlockMetadataWithNotify(i, j, k, 3);
}
- else if (world.func_41047_b(i, j, k + 1, true))
+ else if (world.isBlockSolidOnSide(i, j, k + 1, 2))
{
world.setBlockMetadataWithNotify(i, j, k, 4);
}
@@ -130,19 +130,19 @@
{
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = false;
- if (!world.func_41047_b(i - 1, j, k, true) && i1 == 1)
+ if (!world.isBlockSolidOnSide(i - 1, j, k, 5) && i1 == 1)
{
flag = true;
}
- if (!world.func_41047_b(i + 1, j, k, true) && i1 == 2)
+ if (!world.isBlockSolidOnSide(i + 1, j, k, 4) && i1 == 2)
{
flag = true;
}
- if (!world.func_41047_b(i, j, k - 1, true) && i1 == 3)
+ if (!world.isBlockSolidOnSide(i, j, k - 1, 3) && i1 == 3)
{
flag = true;
}
- if (!world.func_41047_b(i, j, k + 1, true) && i1 == 4)
+ if (!world.isBlockSolidOnSide(i, j, k + 1, 2) && i1 == 4)
{
flag = true;
}
@@ -1,182 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000
@@ -316,7 +316,7 @@
{
Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2);
}
- else if ((Block.blocksList[l1] instanceof BlockContainer) && l1 != l)
+ else if (Block.blocksList[l1] != null && Block.blocksList[l1].hasTileEntity(getBlockMetadata(i, j, k)) && l1 != l)
{
worldObj.removeBlockTileEntity(i2, j, j2);
}
@@ -346,12 +346,12 @@
{
Block.blocksList[l].onBlockAdded(worldObj, i2, j, j2);
}
- if (Block.blocksList[l] instanceof BlockContainer)
+ if (Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(i1))
{
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if (tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = Block.blocksList[l].getTileEntity(i1);
worldObj.setBlockTileEntity(i2, j, j2, tileentity);
}
if (tileentity != null)
@@ -360,14 +360,6 @@
}
}
}
- else if (l1 > 0 && (Block.blocksList[l1] instanceof BlockContainer))
- {
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
- if (tileentity1 != null)
- {
- tileentity1.updateContainingBlockInfo();
- }
- }
isModified = true;
return true;
}
@@ -392,6 +384,11 @@
if (k1 != 0)
{
Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2);
+ if (!worldObj.singleplayerWorld)
+ {
+ Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2);
+ }
+ worldObj.removeBlockTileEntity(l1, j, i2);
}
data.setNibble(i, j, k, 0);
if (Block.lightOpacity[byte0 & 0xff] != 0)
@@ -414,28 +411,22 @@
{
Block.blocksList[l].onBlockAdded(worldObj, l1, j, i2);
}
- if (l > 0 && (Block.blocksList[l] instanceof BlockContainer))
+ int meta = getBlockMetadata(i, j, k);
+ if (l > 0 && Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(meta))
{
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if (tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = Block.blocksList[l].getTileEntity(meta);
worldObj.setBlockTileEntity(l1, j, i2, tileentity);
}
if (tileentity != null)
{
tileentity.updateContainingBlockInfo();
+ tileentity.blockMetadata = meta;
}
}
}
- else if (k1 > 0 && (Block.blocksList[k1] instanceof BlockContainer))
- {
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
- if (tileentity1 != null)
- {
- tileentity1.updateContainingBlockInfo();
- }
- }
isModified = true;
return true;
}
@@ -455,7 +446,7 @@
}
data.setNibble(i, j, k, l);
int j1 = getBlockID(i, j, k);
- if (j1 > 0 && (Block.blocksList[j1] instanceof BlockContainer))
+ if (j1 > 0 && Block.blocksList[j1] != null && Block.blocksList[j1].hasTileEntity(l))
{
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if (tileentity != null)
@@ -572,29 +563,27 @@
{
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if(tileentity != null && tileentity.isInvalid())
+ {
+ chunkTileEntityMap.remove(chunkposition);
+ tileentity = null;
+ }
if (tileentity == null)
{
int l = getBlockID(i, j, k);
- if (!Block.isBlockContainer[l])
+ int meta = getBlockMetadata(i, j, k);
+ if(Block.blocksList[l] == null || !Block.blocksList[l].hasTileEntity(meta))
{
return null;
}
if (tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = Block.blocksList[l].getTileEntity(meta);
worldObj.setBlockTileEntity(xPosition * 16 + i, j, zPosition * 16 + k, tileentity);
}
tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
}
- if (tileentity != null && tileentity.isInvalid())
- {
- chunkTileEntityMap.remove(chunkposition);
- return null;
- }
- else
- {
- return tileentity;
- }
+ return tileentity;
}
public void addTileEntity(TileEntity tileentity)
@@ -605,7 +594,7 @@
setChunkBlockTileEntity(i, j, k, tileentity);
if (isChunkLoaded)
{
- worldObj.loadedTileEntityList.add(tileentity);
+ worldObj.addTileEntity(tileentity);
}
}
@@ -616,12 +605,18 @@
tileentity.xCoord = xPosition * 16 + i;
tileentity.yCoord = j;
tileentity.zCoord = zPosition * 16 + k;
- if (getBlockID(i, j, k) == 0 || !(Block.blocksList[getBlockID(i, j, k)] instanceof BlockContainer))
+ int id = getBlockID(i, j, k);
+ if(id == 0 || Block.blocksList[id] == null || !Block.blocksList[id].hasTileEntity(getBlockMetadata(i, j, k)))
{
return;
}
else
{
+ TileEntity old = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if (old != null)
+ {
+ old.invalidate();
+ }
tileentity.validate();
chunkTileEntityMap.put(chunkposition, tileentity);
return;
@@ -903,4 +898,18 @@
{
return new ChunkCoordIntPair(xPosition, zPosition);
}
+
+ /* FORGE: Used to remove only invalid TileEntities */
+ public void cleanChunkBlockTileEntity(int i, int j, int k)
+ {
+ ChunkPosition chunkposition = new ChunkPosition(i, j, k);
+ if (isChunkLoaded)
+ {
+ TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if (tileentity != null && tileentity.isInvalid())
+ {
+ chunkTileEntityMap.remove(chunkposition);
+ }
+ }
+ }
}
@@ -1,19 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000
@@ -91,6 +91,16 @@
return this;
}
+ /**
+ * Called to determine if this enchantment can be applied to a ItemStack
+ * @param item The ItemStack that the enchantment might be put on
+ * @return True if the item is valid, false otherwise
+ */
+ public boolean canEnchantItem(ItemStack item)
+ {
+ return type.canEnchantItem(item.getItem());
+ }
+
static
{
looting = new EnchantmentLootBonus(21, 2, EnumEnchantmentType.weapon);
@@ -1,11 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000
@@ -261,7 +261,7 @@
for (int k = 0; k < j; k++)
{
Enchantment enchantment = aenchantment[k];
- if (enchantment == null || !enchantment.type.canEnchantItem(item))
+ if (enchantment == null || !enchantment.canEnchantItem(itemstack))
{
continue;
}
@@ -1,47 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/Entity.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/Entity.java 0000-00-00 00:00:00.000000000 -0000
@@ -106,6 +106,22 @@
protected abstract void entityInit();
+ //Forge: Used to store custom data for each entity.
+ private NBTTagCompound customEntityData;
+ /**
+ * Returns a NBTTagCompound that can be used to store custom data for this entity.
+ * It will be written, and read from disc, so it persists over world saves.
+ * @return A NBTTagCompound
+ */
+ public NBTTagCompound getEntityData()
+ {
+ if (customEntityData == null)
+ {
+ customEntityData = new NBTTagCompound();
+ }
+ return customEntityData;
+ }
+
public DataWatcher getDataWatcher()
{
return dataWatcher;
@@ -883,6 +899,10 @@
nbttagcompound.setShort("Fire", (short)fire);
nbttagcompound.setShort("Air", (short)getAir());
nbttagcompound.setBoolean("OnGround", onGround);
+ if (customEntityData != null)
+ {
+ nbttagcompound.setCompoundTag("ForgeData", customEntityData);
+ }
writeEntityToNBT(nbttagcompound);
}
@@ -917,6 +937,10 @@
onGround = nbttagcompound.getBoolean("OnGround");
setPosition(posX, posY, posZ);
setRotation(rotationYaw, rotationPitch);
+ if (nbttagcompound.hasKey("ForgeData"))
+ {
+ customEntityData = nbttagcompound.getCompoundTag("ForgeData");
+ }
readEntityFromNBT(nbttagcompound);
}
@@ -1,912 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/EntityMinecart.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/EntityMinecart.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,18 +1,23 @@
package net.minecraft.src;
+import java.util.ArrayList;
import java.util.List;
import java.util.Random;
+import net.minecraft.src.forge.ForgeHooks;
+import net.minecraft.src.forge.IMinecartCollisionHandler;
+import net.minecraft.src.forge.MinecraftForge;
+
public class EntityMinecart extends Entity
implements IInventory
{
- private ItemStack cargoItems[];
- private int fuel;
- private boolean field_469_aj;
+ protected ItemStack cargoItems[];
+ protected int fuel;
+ protected boolean field_469_aj;
public int minecartType;
public double pushX;
public double pushZ;
- private static final int field_468_ak[][][] =
+ protected static final int field_468_ak[][][] =
{
{
{
@@ -76,13 +81,36 @@
}
}
};
- private int turnProgress;
- private double minecartX;
- private double minecartY;
- private double minecartZ;
- private double field_9159_ar;
- private double minecartPitch;
-
+ protected int turnProgress;
+ protected double minecartX;
+ protected double minecartY;
+ protected double minecartZ;
+ protected double field_9159_ar;
+ protected double minecartPitch;
+
+ /*Forge: Minecart Compatibility Layer Integration.
+ */
+ protected double velocityX;
+ protected double velocityY;
+ protected double velocityZ;
+ public static float defaultMaxSpeedRail = 0.4f;
+ public static float defaultMaxSpeedGround = 0.4f;
+ public static float defaultMaxSpeedAirLateral = 0.4f;
+ public static float defaultMaxSpeedAirVertical = -1f;
+ public static double defaultDragAir = 0.94999998807907104D;
+ protected boolean canUseRail = true;
+ protected boolean canBePushed = true;
+ private static IMinecartCollisionHandler collisionHandler = null;
+
+ /*
+ * Instance versions of the above physics properties
+ */
+ protected float maxSpeedRail;
+ protected float maxSpeedGround;
+ protected float maxSpeedAirLateral;
+ protected float maxSpeedAirVertical;
+ protected double dragAir;
+
public EntityMinecart(World world)
{
super(world);
@@ -92,6 +120,18 @@
preventEntitySpawning = true;
setSize(0.98F, 0.7F);
yOffset = height / 2.0F;
+
+ maxSpeedRail = defaultMaxSpeedRail;
+ maxSpeedGround = defaultMaxSpeedGround;
+ maxSpeedAirLateral = defaultMaxSpeedAirLateral;
+ maxSpeedAirVertical = defaultMaxSpeedAirVertical;
+ dragAir = defaultDragAir;
+ }
+
+ public EntityMinecart(World world, int type)
+ {
+ this(world);
+ minecartType = type;
}
protected boolean canTriggerWalking()
@@ -109,17 +149,27 @@
public AxisAlignedBB getCollisionBox(Entity entity)
{
+ if (getCollisionHandler() != null)
+ {
+ return getCollisionHandler().getCollisionBox(this, entity);
+ }
+
return entity.boundingBox;
}
public AxisAlignedBB getBoundingBox()
{
+ if (getCollisionHandler() != null)
+ {
+ return getCollisionHandler().getBoundingBox(this);
+ }
+
return null;
}
public boolean canBePushed()
{
- return true;
+ return canBePushed;
}
public EntityMinecart(World world, double d, double d1, double d2,
@@ -158,8 +208,10 @@
riddenByEntity.mountEntity(this);
}
setEntityDead();
- dropItemWithOffset(Item.minecartEmpty.shiftedIndex, 1, 0.0F);
- if (minecartType == 1)
+
+ dropCartAsItem();
+
+ if (getSizeInventory() > 0)
{
EntityMinecart entityminecart = this;
label0:
@@ -194,12 +246,6 @@
}
while (true);
}
-
- dropItemWithOffset(Block.chest.blockID, 1, 0.0F);
- }
- else if (minecartType == 2)
- {
- dropItemWithOffset(Block.stoneOvenIdle.blockID, 1, 0.0F);
}
}
return true;
@@ -258,7 +304,7 @@
{
func_41018_e_(func_41020_o() - 1);
}
- if (isMinecartPowered() && rand.nextInt(4) == 0)
+ if (isMinecartPowered() && rand.nextInt(4) == 0 && minecartType == 2 && getClass() == EntityMinecart.class)
{
worldObj.spawnParticle("largesmoke", posX, posY + 0.80000000000000004D, posZ, 0.0D, 0.0D, 0.0D);
}
@@ -299,22 +345,18 @@
double d2 = 0.40000000000000002D;
double d4 = 0.0078125D;
int l = worldObj.getBlockId(i, j, k);
- if (BlockRail.isRailBlock(l))
+ if (canUseRail() && BlockRail.isRailBlock(l))
{
Vec3D vec3d = func_182_g(posX, posY, posZ);
- int i1 = worldObj.getBlockMetadata(i, j, k);
+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k);
posY = j;
boolean flag = false;
boolean flag1 = false;
if (l == Block.railPowered.blockID)
{
- flag = (i1 & 8) != 0;
+ flag = (worldObj.getBlockMetadata(i, j, k) & 8) != 0;
flag1 = !flag;
}
- if (((BlockRail)Block.blocksList[l]).getIsPowered())
- {
- i1 &= 7;
- }
if (i1 >= 2 && i1 <= 5)
{
posY = j + 1;
@@ -348,7 +390,7 @@
double d13 = Math.sqrt(motionX * motionX + motionZ * motionZ);
motionX = (d13 * d9) / d11;
motionZ = (d13 * d10) / d11;
- if (flag1)
+ if (flag1 && shouldDoRailFunctions())
{
double d16 = Math.sqrt(motionX * motionX + motionZ * motionZ);
if (d16 < 0.029999999999999999D)
@@ -391,30 +433,9 @@
posX = d18 + d9 * d17;
posZ = d19 + d10 * d17;
setPosition(posX, posY + (double)yOffset, posZ);
- double d23 = motionX;
- double d25 = motionZ;
- if (riddenByEntity != null)
- {
- d23 *= 0.75D;
- d25 *= 0.75D;
- }
- if (d23 < -d2)
- {
- d23 = -d2;
- }
- if (d23 > d2)
- {
- d23 = d2;
- }
- if (d25 < -d2)
- {
- d25 = -d2;
- }
- if (d25 > d2)
- {
- d25 = d2;
- }
- moveEntity(d23, 0.0D, d25);
+
+ moveMinecartOnRail(i, j, k);
+
if (ai[0][1] != 0 && MathHelper.floor_double(posX) - i == ai[0][0] && MathHelper.floor_double(posZ) - k == ai[0][2])
{
setPosition(posX, posY + (double)ai[0][1], posZ);
@@ -423,39 +444,9 @@
{
setPosition(posX, posY + (double)ai[1][1], posZ);
}
- if (riddenByEntity != null)
- {
- motionX *= 0.99699997901916504D;
- motionY *= 0.0D;
- motionZ *= 0.99699997901916504D;
- }
- else
- {
- if (minecartType == 2)
- {
- double d27 = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ);
- if (d27 > 0.01D)
- {
- pushX /= d27;
- pushZ /= d27;
- double d29 = 0.040000000000000001D;
- motionX *= 0.80000001192092896D;
- motionY *= 0.0D;
- motionZ *= 0.80000001192092896D;
- motionX += pushX * d29;
- motionZ += pushZ * d29;
- }
- else
- {
- motionX *= 0.89999997615814209D;
- motionY *= 0.0D;
- motionZ *= 0.89999997615814209D;
- }
- }
- motionX *= 0.95999997854232788D;
- motionY *= 0.0D;
- motionZ *= 0.95999997854232788D;
- }
+
+ applyDragAndPushForces();
+
Vec3D vec3d1 = func_182_g(posX, posY, posZ);
if (vec3d1 != null && vec3d != null)
{
@@ -476,26 +467,14 @@
motionX = d15 * (double)(k1 - i);
motionZ = d15 * (double)(l1 - k);
}
- if (minecartType == 2)
+
+ updatePushForces();
+
+ if (shouldDoRailFunctions())
{
- double d30 = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ);
- if (d30 > 0.01D && motionX * motionX + motionZ * motionZ > 0.001D)
- {
- pushX /= d30;
- pushZ /= d30;
- if (pushX * motionX + pushZ * motionZ < 0.0D)
- {
- pushX = 0.0D;
- pushZ = 0.0D;
- }
- else
- {
- pushX = motionX;
- pushZ = motionZ;
- }
- }
+ ((BlockRail)Block.blocksList[l]).onMinecartPass(worldObj, this, i, j, k);
}
- if (flag)
+ if (flag && shouldDoRailFunctions())
{
double d31 = Math.sqrt(motionX * motionX + motionZ * motionZ);
if (d31 > 0.01D)
@@ -530,35 +509,7 @@
}
else
{
- if (motionX < -d2)
- {
- motionX = -d2;
- }
- if (motionX > d2)
- {
- motionX = d2;
- }
- if (motionZ < -d2)
- {
- motionZ = -d2;
- }
- if (motionZ > d2)
- {
- motionZ = d2;
- }
- if (onGround)
- {
- motionX *= 0.5D;
- motionY *= 0.5D;
- motionZ *= 0.5D;
- }
- moveEntity(motionX, motionY, motionZ);
- if (!onGround)
- {
- motionX *= 0.94999998807907104D;
- motionY *= 0.94999998807907104D;
- motionZ *= 0.94999998807907104D;
- }
+ moveMinecartOffRail(i, j, k);
}
rotationPitch = 0.0F;
double d6 = prevPosX - posX;
@@ -580,7 +531,19 @@
field_469_aj = !field_469_aj;
}
setRotation(rotationYaw, rotationPitch);
- List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D));
+
+ AxisAlignedBB box = null;
+ if (getCollisionHandler() != null)
+ {
+ box = getCollisionHandler().getMinecartCollisionBox(this);
+ }
+ else
+ {
+ box = boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D);
+ }
+
+ List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, box);
+
if (list != null && list.size() > 0)
{
for (int j1 = 0; j1 < list.size(); j1++)
@@ -600,15 +563,9 @@
}
riddenByEntity = null;
}
- if (fuel > 0)
- {
- fuel--;
- }
- if (fuel <= 0)
- {
- pushX = pushZ = 0.0D;
- }
- setMinecartPowered(fuel > 0);
+
+ updateFuel();
+ ForgeHooks.onMinecartUpdate(this, i, j, k);
}
public Vec3D func_182_g(double d, double d1, double d2)
@@ -623,12 +580,8 @@
int l = worldObj.getBlockId(i, j, k);
if (BlockRail.isRailBlock(l))
{
- int i1 = worldObj.getBlockMetadata(i, j, k);
+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k);
d1 = j;
- if (((BlockRail)Block.blocksList[l]).getIsPowered())
- {
- i1 &= 7;
- }
if (i1 >= 2 && i1 <= 5)
{
d1 = j + 1;
@@ -683,13 +636,14 @@
protected void writeEntityToNBT(NBTTagCompound nbttagcompound)
{
nbttagcompound.setInteger("Type", minecartType);
- if (minecartType == 2)
+ if (isPoweredCart())
{
nbttagcompound.setDouble("PushX", pushX);
nbttagcompound.setDouble("PushZ", pushZ);
- nbttagcompound.setShort("Fuel", (short)fuel);
+ nbttagcompound.setInteger("Fuel", fuel);
}
- else if (minecartType == 1)
+
+ if (getSizeInventory() > 0)
{
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < cargoItems.length; i++)
@@ -702,7 +656,6 @@
nbttaglist.setTag(nbttagcompound1);
}
}
-
nbttagcompound.setTag("Items", nbttaglist);
}
}
@@ -710,13 +663,14 @@
protected void readEntityFromNBT(NBTTagCompound nbttagcompound)
{
minecartType = nbttagcompound.getInteger("Type");
- if (minecartType == 2)
+ if (isPoweredCart())
{
pushX = nbttagcompound.getDouble("PushX");
pushZ = nbttagcompound.getDouble("PushZ");
- fuel = nbttagcompound.getShort("Fuel");
+ fuel = nbttagcompound.getInteger("Fuel");
}
- else if (minecartType == 1)
+
+ if (getSizeInventory() > 0)
{
NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
cargoItems = new ItemStack[getSizeInventory()];
@@ -734,6 +688,13 @@
public void applyEntityCollision(Entity entity)
{
+ ForgeHooks.onMinecartEntityCollision(this, entity);
+
+ if (getCollisionHandler() != null)
+ {
+ getCollisionHandler().onEntityCollision(this, entity);
+ return;
+ }
if (worldObj.singleplayerWorld)
{
return;
@@ -742,7 +703,7 @@
{
return;
}
- if ((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && minecartType == 0 && motionX * motionX + motionZ * motionZ > 0.01D && riddenByEntity == null && entity.ridingEntity == null)
+ if ((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && canBeRidden() && motionX * motionX + motionZ * motionZ > 0.01D && riddenByEntity == null && entity.ridingEntity == null)
{
entity.mountEntity(this);
}
@@ -780,7 +741,7 @@
}
double d7 = entity.motionX + motionX;
double d8 = entity.motionZ + motionZ;
- if (((EntityMinecart)entity).minecartType == 2 && minecartType != 2)
+ if (((EntityMinecart)entity).isPoweredCart() && !isPoweredCart())
{
motionX *= 0.20000000298023224D;
motionZ *= 0.20000000298023224D;
@@ -788,7 +749,7 @@
entity.motionX *= 0.94999998807907104D;
entity.motionZ *= 0.94999998807907104D;
}
- else if (((EntityMinecart)entity).minecartType != 2 && minecartType == 2)
+ else if (!((EntityMinecart)entity).isPoweredCart() && isPoweredCart())
{
entity.motionX *= 0.20000000298023224D;
entity.motionZ *= 0.20000000298023224D;
@@ -818,7 +779,7 @@
public int getSizeInventory()
{
- return 27;
+ return (minecartType == 1 && getClass() == EntityMinecart.class ? 27 : 0);
}
public ItemStack getStackInSlot(int i)
@@ -874,7 +835,12 @@
public boolean interact(EntityPlayer entityplayer)
{
- if (minecartType == 0)
+ if (!ForgeHooks.onMinecartInteract(this, entityplayer))
+ {
+ return true;
+ }
+
+ if(canBeRidden())
{
if (riddenByEntity != null && (riddenByEntity instanceof EntityPlayer) && riddenByEntity != entityplayer)
{
@@ -885,14 +851,14 @@
entityplayer.mountEntity(this);
}
}
- else if (minecartType == 1)
+ else if (getSizeInventory() > 0)
{
if (!worldObj.singleplayerWorld)
{
entityplayer.displayGUIChest(this);
}
}
- else if (minecartType == 2)
+ else if (minecartType == 2 && getClass() == EntityMinecart.class)
{
ItemStack itemstack = entityplayer.inventory.getCurrentItem();
if (itemstack != null && itemstack.itemID == Item.coal.shiftedIndex)
@@ -918,7 +884,7 @@
return entityplayer.getDistanceSqToEntity(this) <= 64D;
}
- protected boolean isMinecartPowered()
+ public boolean isMinecartPowered()
{
return (dataWatcher.getWatchableObjectByte(16) & 1) != 0;
}
@@ -971,5 +937,384 @@
public int func_41021_q()
{
return dataWatcher.getWatchableObjectInt(18);
+ }
+
+ /**
+ * Carts should return their drag factor here
+ * @return The drag rate.
+ */
+ protected double getDrag()
+ {
+ if(riddenByEntity != null)
+ {
+ return 0.99699997901916504D;
+ }
+ return 0.95999997854232788D;
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code applies drag and updates push forces.
+ */
+ protected void applyDragAndPushForces()
+ {
+ if(isPoweredCart())
+ {
+ double d27 = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ);
+ if(d27 > 0.01D)
+ {
+ pushX /= d27;
+ pushZ /= d27;
+ double d29 = 0.040000000000000001D;
+ motionX *= 0.80000001192092896D;
+ motionY *= 0.0D;
+ motionZ *= 0.80000001192092896D;
+ motionX += pushX * d29;
+ motionZ += pushZ * d29;
+ } else
+ {
+ motionX *= 0.89999997615814209D;
+ motionY *= 0.0D;
+ motionZ *= 0.89999997615814209D;
+ }
+ }
+ motionX *= getDrag();
+ motionY *= 0.0D;
+ motionZ *= getDrag();
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code updates push forces.
+ */
+ protected void updatePushForces()
+ {
+ if(isPoweredCart())
+ {
+ double push = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ);
+ if(push > 0.01D && motionX * motionX + motionZ * motionZ > 0.001D)
+ {
+ pushX /= push;
+ pushZ /= push;
+ if(pushX * motionX + pushZ * motionZ < 0.0D)
+ {
+ pushX = 0.0D;
+ pushZ = 0.0D;
+ } else
+ {
+ pushX = motionX;
+ pushZ = motionZ;
+ }
+ }
+ }
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code handles minecart movement and speed capping when on a rail.
+ */
+ protected void moveMinecartOnRail(int i, int j, int k)
+ {
+ int id = worldObj.getBlockId(i, j, k);
+ if (!BlockRail.isRailBlock(id))
+ {
+ return;
+ }
+ float railMaxSpeed = ((BlockRail)Block.blocksList[id]).getRailMaxSpeed(worldObj, this, i, j, k);
+
+ double maxSpeed = Math.min(railMaxSpeed, getMaxSpeedRail());
+ double d23 = motionX;
+ double d25 = motionZ;
+ if(riddenByEntity != null)
+ {
+ d23 *= 0.75D;
+ d25 *= 0.75D;
+ }
+ if(d23 < -maxSpeed)
+ {
+ d23 = -maxSpeed;
+ }
+ if(d23 > maxSpeed)
+ {
+ d23 = maxSpeed;
+ }
+ if(d25 < -maxSpeed)
+ {
+ d25 = -maxSpeed;
+ }
+ if(d25 > maxSpeed)
+ {
+ d25 = maxSpeed;
+ }
+ moveEntity(d23, 0.0D, d25);
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code handles minecart movement and speed capping when not on a rail.
+ */
+ protected void moveMinecartOffRail(int i, int j, int k)
+ {
+ double d2 = getMaxSpeedGround();
+ if(!onGround)
+ {
+ d2 = getMaxSpeedAirLateral();
+ }
+ if(motionX < -d2)
+ {
+ motionX = -d2;
+ }
+ if(motionX > d2)
+ {
+ motionX = d2;
+ }
+ if(motionZ < -d2)
+ {
+ motionZ = -d2;
+ }
+ if(motionZ > d2)
+ {
+ motionZ = d2;
+ }
+ double moveY = motionY;
+ if(getMaxSpeedAirVertical() > 0 && motionY > getMaxSpeedAirVertical())
+ {
+ moveY = getMaxSpeedAirVertical();
+ if(Math.abs(motionX) < 0.3f && Math.abs(motionZ) < 0.3f)
+ {
+ moveY = 0.15f;
+ motionY = moveY;
+ }
+ }
+ if(onGround)
+ {
+ motionX *= 0.5D;
+ motionY *= 0.5D;
+ motionZ *= 0.5D;
+ }
+ moveEntity(motionX, moveY, motionZ);
+ if(!onGround)
+ {
+ motionX *= getDragAir();
+ motionY *= getDragAir();
+ motionZ *= getDragAir();
+ }
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code applies fuel consumption.
+ */
+ protected void updateFuel()
+ {
+ if(fuel > 0)
+ {
+ fuel--;
+ }
+ if(fuel <= 0)
+ {
+ pushX = pushZ = 0.0D;
+ }
+ setMinecartPowered(fuel > 0);
+ }
+
+
+ /**
+ * Drops the cart as a item. The exact item dropped is defined by getItemDropped().
+ */
+ public void dropCartAsItem()
+ {
+ for(ItemStack item : getItemsDropped())
+ {
+ entityDropItem(item, 0);
+ }
+ }
+
+ /**
+ * Override this to define which items your cart drops when broken.
+ * This does not include items contained in the inventory,
+ * that is handled elsewhere.
+ * @return A list of items dropped.
+ */
+ public List<ItemStack> getItemsDropped()
+ {
+ List<ItemStack> items = new ArrayList<ItemStack>();
+ items.add(new ItemStack(Item.minecartEmpty));
+
+ switch(minecartType)
+ {
+ case 1:
+ items.add(new ItemStack(Block.chest));
+ break;
+ case 2:
+ items.add(new ItemStack(Block.stoneOvenIdle));
+ break;
+ }
+ return items;
+ }
+
+ /**
+ * This function returns an ItemStack that represents this cart.
+ * This should be an ItemStack that can be used by the player to place the cart.
+ * This is the item that was registered with the cart via the registerMinecart function,
+ * but is not necessary the item the cart drops when destroyed.
+ * @return An ItemStack that can be used to place the cart.
+ */
+ public ItemStack getCartItem()
+ {
+ return MinecraftForge.getItemForCart(this);
+ }
+
+ /**
+ * Returns true if this cart is self propelled.
+ * @return True if powered.
+ */
+ public boolean isPoweredCart()
+ {
+ return minecartType == 2 && getClass() == EntityMinecart.class;
+ }
+
+ /**
+ * Returns true if this cart is a storage cart
+ * Some carts may have inventories but not be storage carts
+ * and some carts without inventories may be storage carts.
+ * @return True if this cart should be classified as a storage cart.
+ */
+ public boolean isStorageCart()
+ {
+ return minecartType == 1 && getClass() == EntityMinecart.class;
+ }
+
+ /**
+ * Returns true if this cart can be ridden by an Entity.
+ * @return True if this cart can be ridden.
+ */
+ public boolean canBeRidden()
+ {
+ if(minecartType == 0 && getClass() == EntityMinecart.class)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns true if this cart can currently use rails.
+ * This function is mainly used to gracefully detach a minecart from a rail.
+ * @return True if the minecart can use rails.
+ */
+ public boolean canUseRail()
+ {
+ return canUseRail;
+ }
+
+ /**
+ * Set whether the minecart can use rails.
+ * This function is mainly used to gracefully detach a minecart from a rail.
+ * @param use Whether the minecart can currently use rails.
+ */
+ public void setCanUseRail(boolean use)
+ {
+ canUseRail = use;
+ }
+
+ /**
+ * Return false if this cart should not call IRail.onMinecartPass() and should ignore Powered Rails.
+ * @return True if this cart should call IRail.onMinecartPass().
+ */
+ public boolean shouldDoRailFunctions()
+ {
+ return true;
+ }
+
+ /**
+ * Simply returns the minecartType variable.
+ * @return minecartType
+ */
+ public int getMinecartType()
+ {
+ return minecartType;
+ }
+
+ /**
+ * Gets the current global Minecart Collision handler if none
+ * is registered, returns null
+ * @return The collision handler or null
+ */
+ public static IMinecartCollisionHandler getCollisionHandler()
+ {
+ return collisionHandler;
+ }
+
+ /**
+ * Sets the global Minecart Collision handler, overwrites any
+ * that is currently set.
+ * @param handler The new handler
+ */
+ public static void setCollisionHandler(IMinecartCollisionHandler handler)
+ {
+ collisionHandler = handler;
+ }
+
+ /**
+ * Getters/setters for physics variables
+ */
+
+ /**
+ * Returns the carts max speed.
+ * Carts going faster than 1.1 cause issues with chunk loading.
+ * Carts cant traverse slopes or corners at greater than 0.5 - 0.6.
+ * This value is compared with the rails max speed to determine
+ * the carts current max speed. A normal rails max speed is 0.4.
+ * @return Carts max speed.
+ */
+ public float getMaxSpeedRail()
+ {
+ return maxSpeedRail;
+ }
+
+ public void setMaxSpeedRail(float value)
+ {
+ maxSpeedRail = value;
+ }
+
+ public float getMaxSpeedGround()
+ {
+ return maxSpeedGround;
+ }
+
+ public void setMaxSpeedGround(float value)
+ {
+ maxSpeedGround = value;
+ }
+
+ public float getMaxSpeedAirLateral()
+ {
+ return maxSpeedAirLateral;
+ }
+
+ public void setMaxSpeedAirLateral(float value)
+ {
+ maxSpeedAirLateral = value;
+ }
+
+ public float getMaxSpeedAirVertical()
+ {
+ return maxSpeedAirVertical;
+ }
+
+ public void setMaxSpeedAirVertical(float value)
+ {
+ maxSpeedAirVertical = value;
+ }
+
+ public double getDragAir()
+ {
+ return dragAir;
+ }
+
+ public void setDragAir(double value)
+ {
+ dragAir = value;
}
}
@@ -1,130 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,6 +1,7 @@
package net.minecraft.src;
import java.io.PrintStream;
+import java.util.ArrayList;
import java.util.Random;
public class Item
@@ -156,6 +157,9 @@
private String potionInfo;
private String itemName;
+ // FORGE: To disable repair recipes.
+ protected boolean canRepair = true;
+
protected Item(int i)
{
maxStackSize = 64;
@@ -393,6 +397,109 @@
MovingObjectPosition movingobjectposition = world.rayTraceBlocks_do_do(vec3d, vec3d1, flag, !flag);
return movingobjectposition;
}
+
+ /**
+ * Called when a new CreativeContainer is opened, populate the list
+ * with all of the items for this item you want a player in creative mode
+ * to have access to.
+ *
+ * @param itemList The list of items currently in the creative inventory
+ */
+ public void addCreativeItems(ArrayList itemList)
+ {
+ if (this.shiftedIndex != Item.potion.shiftedIndex && this.shiftedIndex != Item.field_44008_bB.shiftedIndex)
+ {
+ itemList.add(new ItemStack(this, 1));
+ }
+ }
+
+ /**
+ * Called when a player drops the item into the world,
+ * returning false from this will prevent the item from
+ * being removed from the players inventory and spawning
+ * in the world
+ *
+ * @param player The player that dropped the item
+ * @param item The item stack, before the item is removed.
+ */
+ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player)
+ {
+ return true;
+ }
+
+ /**
+ * This is called when the item is used, before the block is activated.
+ * @param stack The Item Stack
+ * @param player The Player that used the item
+ * @param world The Current World
+ * @param X Target X Position
+ * @param Y Target Y Position
+ * @param Z Target Z Position
+ * @param side The side of the target hit
+ * @return Return true to prevent any further processing.
+ */
+ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int X, int Y, int Z, int side)
+ {
+ return false;
+ }
+
+ /**
+ * Metadata-sensitive version of getStrVsBlock
+ * @param itemstack The Item Stack
+ * @param block The block the item is trying to break
+ * @param metadata The items current metadata
+ * @return The damage strength
+ */
+ public float getStrVsBlock(ItemStack itemstack, Block block, int metadata)
+ {
+ return getStrVsBlock(itemstack, block);
+ }
+
+ /**
+ * Called by CraftingManager to determine if an item is reparable.
+ * @return True if reparable
+ */
+ public boolean isRepairable()
+ {
+ return canRepair && isDamageable();
+ }
+
+ /**
+ * Call to disable repair recipes.
+ * @return The current Item instance
+ */
+ public Item setNoRepair()
+ {
+ canRepair = false;
+ return this;
+ }
+
+ /**
+ * Called before a block is broken. Return true to prevent default block harvesting.
+ *
+ * Note: In SMP, this is called on both client and server sides!
+ *
+ * @param itemstack The current ItemStack
+ * @param X The X Position
+ * @param Y The X Position
+ * @param Z The X Position
+ * @param player The Player that is wielding the item
+ * @return True to prevent harvesting, false to continue as normal
+ */
+ public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player)
+ {
+ return false;
+ }
+
+ /**
+ * Called each tick while using an item.
+ * @param stack The Item being used
+ * @param player The Player using the item
+ * @param count The amount of time in tick the item has been used for continuously
+ */
+ public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count)
+ {
+ }
public int getItemEnchantability()
{
@@ -1,23 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,6 +2,8 @@
import java.util.Random;
+import net.minecraft.src.forge.MinecraftForge;
+
public class ItemBucket extends Item
{
private int isFull;
@@ -36,6 +38,11 @@
}
if (isFull == 0)
{
+ ItemStack customBucket = MinecraftForge.fillCustomBucket(world, i, j, k);
+ if (customBucket != null)
+ {
+ return customBucket;
+ }
if (!entityplayer.canPlayerEdit(i, j, k))
{
return itemstack;
@@ -1,78 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/RailLogic.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/RailLogic.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,7 +3,7 @@
import java.util.ArrayList;
import java.util.List;
-class RailLogic
+public class RailLogic
{
private World worldObj;
private int trackX;
@@ -12,6 +12,7 @@
private final boolean isPoweredRail;
private List connectedTracks;
final BlockRail rail;
+ private final boolean canMakeSlopes;
public RailLogic(BlockRail blockrail, World world, int i, int j, int k)
{
@@ -23,16 +24,12 @@
trackY = j;
trackZ = k;
int l = world.getBlockId(i, j, k);
- int i1 = world.getBlockMetadata(i, j, k);
- if (BlockRail.isPoweredBlockRail((BlockRail)Block.blocksList[l]))
- {
- isPoweredRail = true;
- i1 &= -9;
- }
- else
- {
- isPoweredRail = false;
- }
+
+ BlockRail target = (BlockRail)Block.blocksList[l];
+ int i1 = target.getBasicRailMetadata(world, null, i, j, k);
+ isPoweredRail = !target.isFlexibleRail(world, i, j, k);
+ canMakeSlopes = target.canMakeSlopes(world, i, j, k);
+
setConnections(i1);
}
@@ -243,7 +240,7 @@
byte0 = 9;
}
}
- if (byte0 == 0)
+ if (byte0 == 0 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(worldObj, trackX, trackY + 1, trackZ - 1))
{
@@ -254,7 +251,7 @@
byte0 = 5;
}
}
- if (byte0 == 1)
+ if (byte0 == 1 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(worldObj, trackX + 1, trackY + 1, trackZ))
{
@@ -377,7 +374,7 @@
}
}
}
- if (byte0 == 0)
+ if (byte0 == 0 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(worldObj, trackX, trackY + 1, trackZ - 1))
{
@@ -388,7 +385,7 @@
byte0 = 5;
}
}
- if (byte0 == 1)
+ if (byte0 == 1 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(worldObj, trackX + 1, trackY + 1, trackZ))
{
@@ -1,217 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/World.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/World.java 0000-00-00 00:00:00.000000000 -0000
@@ -33,7 +33,7 @@
public int lightningFlash;
public boolean editingBlocks;
private long lockTimestamp;
- protected int autosavePeriod;
+ public int autosavePeriod;
public int difficultySetting;
public Random rand;
public boolean isNewWorld;
@@ -236,7 +236,13 @@
public boolean isAirBlock(int i, int j, int k)
{
- return getBlockId(i, j, k) == 0;
+ int iBlockID = getBlockId(i, j, k);
+
+ if (iBlockID == 0)
+ {
+ return true;
+ }
+ return Block.blocksList[iBlockID].isAirBlock(this, i, j, k);
}
public boolean blockExists(int i, int j, int k)
@@ -1205,7 +1211,7 @@
Chunk chunk = getChunkFromChunkCoords(tileentity.xCoord >> 4, tileentity.zCoord >> 4);
if (chunk != null)
{
- chunk.removeChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf);
+ chunk.cleanChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf);
}
}
}
@@ -1234,12 +1240,15 @@
{
loadedTileEntityList.add(tileentity1);
}
+ }
+ else
+ {
if (chunkExists(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4))
{
Chunk chunk1 = getChunkFromChunkCoords(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4);
if (chunk1 != null)
{
- chunk1.setChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf, tileentity1);
+ chunk1.cleanChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf);
}
}
markBlockNeedsUpdate(tileentity1.xCoord, tileentity1.yCoord, tileentity1.zCoord);
@@ -1254,13 +1263,13 @@
public void addTileEntity(Collection collection)
{
- if (scanningTileEntities)
+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
+ for(Object entity : collection)
{
- addedTileEntityList.addAll(collection);
- }
- else
- {
- loadedTileEntityList.addAll(collection);
+ if(((TileEntity)entity).canUpdate())
+ {
+ dest.add(entity);
+ }
}
}
@@ -1460,6 +1469,13 @@
if (j2 == Block.fire.blockID || j2 == Block.lavaMoving.blockID || j2 == Block.lavaStill.blockID)
{
return true;
+ }
+ else
+ {
+ if (j2 > 0 && Block.blocksList[j2].isBlockBurning(this, k1, l1, i2))
+ {
+ return true;
+ }
}
}
}
@@ -1690,47 +1706,28 @@
public void setBlockTileEntity(int i, int j, int k, TileEntity tileentity)
{
- if (tileentity != null && !tileentity.isInvalid())
+ if (tileentity == null || tileentity.isInvalid())
{
- if (scanningTileEntities)
- {
- tileentity.xCoord = i;
- tileentity.yCoord = j;
- tileentity.zCoord = k;
- addedTileEntityList.add(tileentity);
- }
- else
- {
- loadedTileEntityList.add(tileentity);
- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
- if (chunk != null)
- {
- chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity);
- }
- }
+ return;
+ }
+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
+ if (tileentity.canUpdate())
+ {
+ dest.add(tileentity);
+ }
+ Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
+ if (chunk != null)
+ {
+ chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity);
}
}
public void removeBlockTileEntity(int i, int j, int k)
{
- TileEntity tileentity = getBlockTileEntity(i, j, k);
- if (tileentity != null && scanningTileEntities)
+ Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
+ if (chunk != null)
{
- tileentity.invalidate();
- addedTileEntityList.remove(tileentity);
- }
- else
- {
- if (tileentity != null)
- {
- addedTileEntityList.remove(tileentity);
- loadedTileEntityList.remove(tileentity);
- }
- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
- if (chunk != null)
- {
- chunk.removeChunkBlockTileEntity(i & 0xf, j, k & 0xf);
- }
+ chunk.removeChunkBlockTileEntity(i & 0xf, j, k & 0xf);
}
}
@@ -1761,7 +1758,7 @@
}
else
{
- return block.blockMaterial.getIsOpaque() && block.renderAsNormalBlock();
+ return block.isBlockNormalCube(this, i, j, k);
}
}
@@ -2179,7 +2176,7 @@
private int computeBlockLightValue(int i, int j, int k, int l, int i1, int j1)
{
- int k1 = Block.lightValue[i1];
+ int k1 = (i1 == 0 || Block.blocksList[i1] == null ? 0 : Block.blocksList[i1].getLightValue(this, j, k, l));
int l1 = getSavedLightValue(EnumSkyBlock.Block, j - 1, k, l) - j1;
int i2 = getSavedLightValue(EnumSkyBlock.Block, j + 1, k, l) - j1;
int j2 = getSavedLightValue(EnumSkyBlock.Block, j, k - 1, l) - j1;
@@ -2557,6 +2554,10 @@
{
block = null;
}
+ if (block != null && block.isBlockReplaceable(this, j, k, l))
+ {
+ block = null;
+ }
return i > 0 && block == null && block1.canPlaceBlockOnSide(this, j, k, l, i1);
}
@@ -3028,4 +3029,38 @@
{
return getChunkProvider().func_40182_a(this, s, i, j, k);
}
+
+ /**
+ * Adds a single TileEntity to the world.
+ * TODO: Eloraam fully describe the bug this fixes.
+ * @param entity The TileEntity to be added.
+ */
+ public void addTileEntity(TileEntity entity)
+ {
+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
+ if(entity.canUpdate())
+ {
+ dest.add(entity);
+ }
+ }
+
+ /**
+ * Determine if the given block is considered solid on the
+ * specified side. Used by placement logic.
+ *
+ * @param X Block X Position
+ * @param Y Block Y Position
+ * @param Z Block Z Position
+ * @param side The Side in question
+ * @return True if the side is solid
+ */
+ public boolean isBlockSolidOnSide(int X, int Y, int Z, int side)
+ {
+ Block block = Block.blocksList[getBlockId(X, Y, Z)];
+ if(block == null)
+ {
+ return false;
+ }
+ return block.isBlockSolidOnSide(this, X, Y, Z, side);
+ }
}
@@ -1,38 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/WorldServer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/WorldServer.java 0000-00-00 00:00:00.000000000 -0000
@@ -54,15 +54,30 @@
public List getTileEntityList(int i, int j, int k, int l, int i1, int j1)
{
ArrayList arraylist = new ArrayList();
- for (int k1 = 0; k1 < loadedTileEntityList.size(); k1++)
+ for(int x = (i>>4); x <= (l>>4); x++)
{
- TileEntity tileentity = (TileEntity)loadedTileEntityList.get(k1);
- if (tileentity.xCoord >= i && tileentity.yCoord >= j && tileentity.zCoord >= k && tileentity.xCoord < l && tileentity.yCoord < i1 && tileentity.zCoord < j1)
+ for(int z = (k>>4); z <= (j1>>4); z++)
{
- arraylist.add(tileentity);
+ Chunk chunk = getChunkFromChunkCoords(x,z);
+ if (chunk == null)
+ {
+ continue;
+ }
+ for(Object obj : chunk.chunkTileEntityMap.values())
+ {
+ TileEntity entity = (TileEntity)obj;
+ if(entity.isInvalid())
+ {
+ continue;
+ }
+ if (entity.xCoord >= i && entity.yCoord >= j && entity.zCoord >= k &&
+ entity.xCoord <= l && entity.yCoord <= i1 && entity.zCoord <= j1)
+ {
+ arraylist.add(entity);
+ }
+ }
}
}
-
return arraylist;
}
File renamed without changes.
File renamed without changes.
@@ -106,7 +106,6 @@ public class ForgeHooksClient {
Tessellator.instance=t;
}
static IRenderContextHandler unbindContext=null;
protected static void bindTexture(String name, int sub) {
Integer n;
n=textures.get(name);
@@ -116,20 +115,12 @@ public class ForgeHooksClient {
textures.put(name,n);
}
if(!inWorld) {
if(unbindContext!=null) {
unbindContext.afterRenderContext();
unbindContext=null;
}
if(Tessellator.instance.isDrawing) {
int mode=Tessellator.instance.drawMode;
Tessellator.instance.draw();
Tessellator.instance.startDrawing(mode);
}
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */,n);
unbindContext=renderHandlers.get(new TesKey(n,sub));
if(unbindContext!=null) {
unbindContext.beforeRenderContext();
}
return;
}
bindTessellator(n,sub);
@@ -142,10 +133,6 @@ public class ForgeHooksClient {
if(Tessellator.instance.isDrawing) {
int mode=Tessellator.instance.drawMode;
Tessellator.instance.draw();
if(unbindContext!=null) {
unbindContext.afterRenderContext();
unbindContext=null;
}
Tessellator.instance.startDrawing(mode);
}
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, ModLoader
@@ -309,7 +309,7 @@ public class EnumHelper {
else
{
if ((field.getModifiers() & flags) == flags &&
field.getType().getName().replace('.', '/').equals(valueType)) //Apparently some JVMs return .'s and some don't..
field.getType().getName().equals(valueType))
{
valuesField = field;
break;
@@ -6,14 +6,11 @@
package net.minecraft.src.forge;
import net.minecraft.src.Block;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityMinecart;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.IInventory;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Item;
import net.minecraft.src.EnumStatus;
import net.minecraft.src.ModLoader;
import net.minecraft.src.World;
import java.util.*;
@@ -73,36 +70,6 @@ public class ForgeHooks {
}
static LinkedList<ISleepHandler> sleepHandlers = new LinkedList<ISleepHandler>();
public static void onMinecartUpdate(EntityMinecart minecart, int x, int y, int z)
{
for (IMinecartHandler handler : minecartHandlers)
{
handler.onMinecartUpdate(minecart, x, y, z);
}
}
public static void onMinecartEntityCollision(EntityMinecart minecart, Entity entity)
{
for (IMinecartHandler handler : minecartHandlers)
{
handler.onMinecartEntityCollision(minecart, entity);
}
}
public static boolean onMinecartInteract(EntityMinecart minecart, EntityPlayer player)
{
boolean canceled = true;
for (IMinecartHandler handler : minecartHandlers)
{
boolean tmp = handler.onMinecartInteract(minecart, player, canceled);
canceled = canceled && tmp;
}
return canceled;
}
static LinkedList<IMinecartHandler> minecartHandlers = new LinkedList<IMinecartHandler>();
// Plant Management
// ------------------------------------------------------------
@@ -301,11 +268,10 @@ public class ForgeHooks {
}
public static final int majorVersion=1;
public static final int minorVersion=3;
public static final int revisionVersion=0;
public static final int minorVersion=2;
public static final int revisionVersion=3;
static {
System.out.printf("MinecraftForge V%d.%d.%d Initialized\n", majorVersion, minorVersion, revisionVersion);
ModLoader.getLogger().info(String.format("MinecraftForge V%d.%d.%d Initialized\n", majorVersion, minorVersion, revisionVersion));
}
static boolean toolInit=false;
Loaded 100 of 222 files, more files were not shown because too many files have changed in this diff. Show more