Compare commits

..
314 Commits
Author SHA1 Message Date
LexManos e08c63b57b Merge pull request #1184 from bspkrs/patch-2
Fix config category names being quoted to many times.
2014-07-02 14:55:03 -07:00
LexManos db1e2c863d Merge pull request #1192 from bloodmc/mc172
Fixed wrong method call in ChunkIOProvider.
2014-06-29 14:56:10 -07:00
bloodshot ea7be67db2 Fixed wrong method call in ChunkIOProvider.
When a chunk fails to load async, we fallback to the original sync method.
In this case, it was calling the async method twice which ended up causing
a stackoverflow.
2014-06-29 14:31:53 -04:00
bspkrs 6144650579 dupe quotes fix for category names 2014-06-26 16:43:17 -04:00
cpw 6998e76d3f Fix API incompatibilities. Should mean mods will work with new config changes. 2014-06-25 20:47:33 -04:00
cpw bcda92e941 Merge branch 'bspkrsgui' 2014-06-25 20:16:20 -04:00
cpw 013c0b0feb MinecraftForge/FML@701d98eafa Added config GUI system
MinecraftForge/FML@50164db5c1 Merge branch 'master' of github.com:bspkrs/FML into bspkrsgui
MinecraftForge/FML@7eb36a1481 Merge branch 'bspkrsgui'
2014-06-25 20:15:08 -04:00
cpw 24c05a73ce Merge branch 'master' of github.com:bspkrs/MinecraftForge into bspkrsgui
Conflicts:
	src/main/resources/assets/forge/lang/en_US.lang
2014-06-25 20:13:36 -04:00
cpw 4c26057a4e MinecraftForge/FML@5d6dc5dce3 Fix up other exit points. Should stop process hangs for clean exits. 2014-06-24 22:16:39 -04:00
Christian 1275aa732e Null check the Item in the supplied stack as well as the stack itself. 2014-06-22 14:47:24 -04:00
Christian 4778c33902 And fix firing for single player loading. 2014-06-22 14:39:23 -04:00
Christian 127605ec3e Fix derpity derp. 2014-06-22 10:11:32 -04:00
Christian f7736e9a0a Fire an event when a player loads or saves from disk. Mods that want to load an additional
player related file from the players dir can now do so in that event.
2014-06-21 17:38:21 -04:00
Christian ea7c11baf4 Some patch offsets
MinecraftForge/FML@7219061b05 Also patch in warnings for Vec3Pool - similarly removed.
MinecraftForge/FML@dff2204558 FML now sets a security manager (FINALLY!). It's primary purpose at this point is to catch rogue calls to System.exit so that they can cause a proper crash report, rather than silently abandoning the game.
2014-06-21 17:34:52 -04:00
LexManos 755dd9b954 Merge pull request #1164 from lumien231/Fix-DimensionCrash
Fixes a server crash caused by a player joining that is in a non existen...
2014-06-20 17:31:45 -07:00
Lumien a21ad8fa9d Fixes a server crash caused by a player joining that is in a non existent dimension 2014-06-20 11:18:23 +02:00
LexManos 9701e944c2 Merge pull request #1162 from Thog92/1.7-biome
Add missing 1.7 biomes to BiomeDictionary
2014-06-19 11:26:38 -07:00
Thog92 a905fe578b Add missing 1.7 biomes to BiomeDictionary 2014-06-19 19:06:27 +02:00
LexManos 5ac6f2289b Merge pull request #1155 from Zarathul/master
Added soft return for modders passing invalid negative ids to OreDictionary.getOreName. Warning: WILL Error in 1.8+
2014-06-16 19:49:13 -07:00
Zarathul e68cfa9f72 Fixed ArrayIndexOutOfBoundsException in getOreName
Added sanity check to prevent ArrayIndexOutOfBoundsException in getOreName for negative ids.
2014-06-16 23:00:40 +02:00
Lex Manos bb15efd037 Fixed vines generation for hanging off of trees. 2014-06-15 11:59:11 -07:00
LexManos 7d700c9ad2 Merge pull request #1147 from bloodmc/chunkasync
Don't call ChunkDataEvent.Load async
2014-06-12 23:10:30 -07:00
bloodshot 61a6b67d51 Don't call ChunkDataEvent.Load async
ChunkDataEvent.Load must be called after TE's are loaded since this is
what mods expect. The event is handled by ChunkIOProvider during
callStage2.
2014-06-13 00:52:13 -04:00
LexManos 96286b77f9 Merge pull request #938 from bloodmc/chunkasync
Load chunks asynchronously for players.
2014-06-12 17:43:28 -07:00
LexManos 7b6b88b002 Merge pull request #1125 from alucas/addmissingjumpevent
Add missing onLivingJump calls
2014-06-12 16:20:03 -07:00
Lex Manos 1b7190c50b Pop version for new Recomended build. 2014-06-12 15:16:56 -07:00
Travis Watkins e6bbcf6a3d Load chunks asynchronously for players.
When a player triggers a chunk load via walking around or teleporting
there is no need to stop everything and get this chunk on the main thread.
The client is used to having to wait some time for this chunk and the
server doesn't immediately do anything with it except send it to the
player. At the same time chunk loading is the last major source of file IO
that still runs on the main thread.

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

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

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

Thanks for ammaraskar for help with the implementation of this feature.

This commit is based off the following :

Bukkit/CraftBukkit@b8fc6ab2c1
Bukkit/CraftBukkit@85f5776df2
Bukkit/CraftBukkit@0714971ca2
Bukkit/CraftBukkit@7f49722f45
Bukkit/CraftBukkit@53ad0cf1ab
2014-06-12 16:51:17 -04:00
Christian b12e0bff2a MinecraftForge/FML@1a99ec7db6 Deprecate getAABBPool so people can stop using it in mods. Failure to do so will result in 1.7.10 upgrade incompatibility. Use getBoundingBox instead. 2014-06-12 14:45:25 -04:00
Christian aaccbb8247 Warn when chunks are being self-recursively loaded. This can cause serious issues. Modders should watch out. 2014-06-12 14:45:25 -04:00
LexManos c45ed6f6d8 Changed dustLapis to gemLapis to make OM SHUT THE HELL UP. 2014-06-11 22:43:15 -07:00
Lex Manos dd5b51aac1 Fixed missed metadata offset, and now cache return values of getOres for speed. 2014-06-11 10:27:28 -07:00
Antoine 27d9edac67 Add missing onLivingJump calls 2014-06-11 13:37:36 +02:00
LexManos a08357a845 Merge pull request #1126 from Cojomax99/fog_customization
World fog color and density can now be controlled through an event
2014-06-11 00:57:33 -07:00
Cojomax99 9a3bc1fff5 World fog color and density can now be controlled through an event 2014-06-11 10:54:54 +03:00
LexManos 4ae1abd7d4 Merge pull request #1134 from diesieben07/ender-teleport
Fix EnderTeleportEvent for Ender Pearls.
2014-06-10 18:49:32 -07:00
Lex Manos d5a4ee2c10 Fixed inverted player parameters in PlayerEvent.Clone, Closes #1142 Closes #1140 2014-06-10 18:48:00 -07:00
Lex Manos 5849458443 Changed EntityWolf to EntityTameable in EntityLivingBase.attackEntityFrom, to allow for more custom pets. Closes #1141 2014-06-10 18:20:59 -07:00
Lex Manos 7a43d2f96a Rework OreDictionary's internals to be a bit more speedy to help combat modders using it inapropriatly. Closes #1022 Closes #1131 2014-06-10 18:05:09 -07:00
diesieben07 b0195f31e4 Fix not being able to change target & attackDamage for EnderTeleportEvent. 2014-06-07 13:45:29 +02:00
Christian 58e69af1b3 MinecraftForge/FML@e3ce211cc7 Nullcheck the dispatchers on players. Should stop some crashes when spamming connectivity.
MinecraftForge/FML@480bf2c1d0 Fix REPLY handling in SimpleNetworkWrapper. Closes  #440
2014-06-05 15:31:11 -04:00
Lex Manos 03ae909762 Fix inverted parameters in OreDictionary.getOreID Closes #1123
-.- Closes #1120
2014-06-04 23:09:13 -07:00
bspkrs 04c2ed554d Added support for new FML config GUI classes
refactored lots of stuff based on comments

added Configuration.load() exception handling and logging
2014-06-04 17:39:47 -04:00
LexManos f3cbc6c262 Merge pull request #1034 from Adubbz/master
Greatly simplified the addition of new biomes to the default world. If this breaks things blame Adubbz.
2014-06-02 17:00:47 -07:00
Lex Manos 42fc3c9516 Added Noteblock change and play events. Closes #1027 #1025 2014-06-02 16:57:04 -07:00
Lex Manos b301b1f70c Add target world to PlayerInteractEvent for potential 'cross dimension' interaction such as LittleBlocks. Closes #1071 2014-06-02 15:49:11 -07:00
Lex Manos eb1ddab278 Add a couple of localizations to Forge added strings. Closes #1068 2014-06-02 15:28:11 -07:00
LexManos 0456c4d5ae Merge pull request #1095 from rwtema/master
Fixed setBlock not using the location version of getLightOpacity()
2014-06-02 14:28:42 -07:00
Lex Manos fa3feda0d5 Filter all vanilla blocks that we missed through Forge's getDrops and BlockDrops events. As well as implemented IShearable for DoublePlants and DeadBushes. Mojang really should generic out some of this stuff instead of repeating logic all over the place! 2014-06-02 14:10:49 -07:00
Lex Manos f2a33ea9f6 Add comment to RotationHelper telling modders where to actually look, closes #1115 2014-06-02 12:20:28 -07:00
Lex Manos e7f492a15b Fixed GuiContainer calling button.mouseReleased. Closes #1116 2014-06-02 12:01:34 -07:00
Lex Manos 5fe0a0ea5a Fix patch fuzz 2014-06-02 12:01:10 -07:00
Christian 2e152c52c4 MinecraftForge/FML@585d3a91e1 If a packet is not handled by the channel, log it, and clear it. Could be spammy, but this is a serious bug and could cause a memory leak otherwise.
MinecraftForge/FML@cd715efca1 Log the queue as well
2014-05-31 09:53:36 -04:00
LexManos 7f018dad0f Merge pull request #1112 from diesieben07/entity-tracking
Add PlayerEvent.StartTracking and .StopTracking
2014-05-29 17:19:58 -07:00
diesieben07 deb5df542e Add PlayerEvent.StartTracking and .StopTracking & make trackedEntityIDs visible
& Update, as discussed on IRC (squash)
2014-05-30 01:59:05 +02:00
LexManos 4a6a49e073 Merge pull request #1109 from Open-Code-Developers/finite-patch
Make finite fluid blocks drainable
2014-05-29 15:18:34 -07:00
Lex Manos 0737601dbf Fix enum helpers for EnumRarity {moved to Commn and changed paramter} and EnumCreatureType {new parameter} and added junit test for them. Closes #1009 2014-05-28 15:28:40 -07:00
Christian 0a56e19d47 MinecraftForge/FML@1d41aa978d Fix the side for the compatibility check. Should result in green ticks finally! 2014-05-26 15:30:22 -04:00
Lex Manos 5f90e0788b Change IShearable JavaDoc by one line so Anti would shut up. Closes #1054 2014-05-26 11:26:53 -07:00
Christian 36ab17474b MinecraftForge/FML@4512f8e5e3 Warn when the objectholder finds nothing in the registry. Helps debug mismatched names. Also, actually make the scoping thing work with objectholder 2014-05-26 11:29:15 -04:00
LexManos 96ee4caf39 Merge pull request #1089 from RainWarrior/render-events
Added world display list render events
2014-05-25 17:16:08 -07:00
RainWarrior 3980bf79da Added world display list render events 2014-05-26 04:09:21 +04:00
LexManos 5eb99791b0 Merge pull request #1103 from ganymedes01/patch-1
Fix getOreIDs not using the wildcard value correctly
2014-05-25 15:35:15 -07:00
ganymedes01 6924fef324 Fix getOreIDs not using the wildcard value correctly
You can see it's not working by requesting the ore IDs from lapis, and you'll see the name "dye" is missing (and that's the one registered using the wildcard).

Fixed it by inverting the order of the item stack parameters.
2014-05-25 19:15:26 -03:00
Lex Manos 25ef7e3469 Prevent duplciates in registered Ores in the OreDictionary and clean up some of the code, add new function to return all ores the specified ItemStack satisfies. Closes #1102 2014-05-25 14:20:02 -07:00
LexManos 507f184144 Merge pull request #1101 from Open-Code-Developers/master
Fix fluid blocks
2014-05-25 13:41:13 -07:00
Vilim bc1434ff04 Make finite fluid blocks drainable 2014-05-25 19:59:59 +02:00
Vilim bab2de72bc Fix fluid blocks
For https://github.com/BuildCraft/BuildCraft/issues/1843 .
2014-05-25 18:42:17 +02:00
Lex Manos fcc43e0aaa Updated FML:
MinecraftForge/FML@3aba56440a lastIndexOf, Note Don't code while sick.
2014-05-24 21:49:22 -07:00
Lex Manos fc70334343 Updated FML:
MinecraftForge/FML@3a687f48b9 -.- Save File First. My Bad.
2014-05-24 21:11:35 -07:00
Lex Manos db52113a7e Updated FML:
MinecraftForge/FML@c828bb63c5 Make AccessTransformer change INVOKESPECIAL to INVOKEVIRTUAL when making methods visible
MinecraftForge/FML@a9aa468457 Merge pull request #431 from diesieben07/at-invokevirtual
MinecraftForge/FML@31d726abad Fix the null networkHandler in the MessageContext
MinecraftForge/FML@725d988e36 Add in the objectholder, autopopulated by FML based on simple rules. Allows for reference driven substitution of mod blocks and items based on their server running state.
MinecraftForge/FML@f07bf5cb30 Fixed deobfusication of nested inner classes. And removed legacy ModLoader remaps.
2014-05-24 20:46:04 -07:00
Lex Manos 243aa60bf9 Add Glass, Colored glass, ore storage blocks, alines, and a few others to ore dicitonary. Closes #1011 2014-05-24 13:01:35 -07:00
Lex Manos acf8e468f3 Made WorldGenShrub respect Block.canSustainPlant, Closes #1096 2014-05-24 10:55:57 -07:00
Lex Manos dc10db1d90 Add new PlayerEvent.Clone called when an EntityPlayer is cloned via dimension travil or respawn. 2014-05-24 10:50:52 -07:00
rwtema 576a1294da Fixed setBlock not using the location-specific version of getLightOpacity() 2014-05-23 22:37:41 +01:00
LexManos 8145de123e Merge pull request #1091 from Clashsoft/master
Don't render ItemStack tooltip twice
2014-05-22 09:57:36 -07:00
Clashsoft e530089639 Update GuiScreen.java.patch 2014-05-22 16:12:52 +02:00
LexManos d63a9b1b10 Merge pull request #1086 from WaDelma/master
Added amount that is being filled/drained to the FluidEvent
2014-05-21 18:44:38 -07:00
WaDelma a3e8f0cbe4 Fluid events now know how much fluid is moved
Added amount that is being filled/drained to the FluidEvent

Added constructors without amount to ensure backwards compability

Added deprecation to amountless constructors
2014-05-20 01:39:51 +03:00
Lex Manos 7b062dd390 Fixed Stems not droping a random number of seeds based on metadata, Closes #1087 2014-05-19 11:11:04 -07:00
LexManos 83e7130216 Merge pull request #1081 from XCompWiz/master
Bug Fixes to Biome Decoration and Chunk
2014-05-18 15:48:10 -07:00
XCompWiz cdad2dc55a Bug Fixes to Biome Decoration and Chunk
Fixes issue with biome decoration crashing on worlds with exposed void
Fixes same issue in JungleBiome decoration
Fixes forge bug in getting lighting from a block in chunk
2014-05-19 01:37:59 +03:00
Lex Manos 9d66c91c86 Added accessible instance to RenderBlocks and RenderItem for modders to use who don't wish to create there own instance. Warning: Other modders may influance the transient state of the instance, BE WEARY MODDERS. 2014-05-14 12:23:22 -07:00
Lex Manos 1c7341b982 Added Farmland to PLAINS type plants as that has changed in 1.7. Also made BlockTallGrass call it's super.canBlockStay to better support custom soils. Closes #1077 2014-05-14 12:21:24 -07:00
Lex Manos 5e6c346c7c In Flower Forest biome a Poppy should spawn instead of Blue Orchid Closes #1078 2014-05-14 12:20:04 -07:00
Christian 3d9b5b1472 MinecraftForge/FML@43e3ee1af1 Swap Listenerlist constructor around. Should fix parent resizing issue? 2014-05-14 14:24:16 -04:00
Christian 7578f0813b MinecraftForge/FML@70570a863f Fix up possible CME 2014-05-14 10:13:00 -04:00
Christian 71b3ba2041 MinecraftForge/FML@503da3a257 Don't consider null NetworkDispatchers. This should fix a bunch of fakeplayer issues. 2014-05-13 08:16:22 -04:00
Lex Manos f95ca18707 Fixed No Blue Orchids spawn in swamp when using bone meal Closes #1072 2014-05-12 12:36:36 -07:00
Lex Manos 711e92a59f Fully clear DimensionManager's DimensionID bitset when world is loaded. Closes #1074 2014-05-12 11:46:03 -07:00
Christian 26c55d89ef Fix forge validating strict versions on remote connections. 2014-05-12 13:49:46 -04:00
Christian 51b55eaf25 MinecraftForge/FML@a8cbef2321 Finally hopefully fully kills the race condition causing a classcast on slow machines.
MinecraftForge/FML@8dbd1ae0a1 Fix ObjectIntIdentityMap sporadically matching non-identical objects.
MinecraftForge/FML@42713c66e5 Merge pull request #426 from sfPlayer1/master
2014-05-12 10:51:00 -04:00
Adubbz 4454d3f341 Greatly simplified the addition of new biomes to the default world 2014-05-11 15:06:14 +10:00
Christian bb52a6b062 MinecraftForge/FML@d8b6adb259 Add a helper for casting some common collection types into generic form
MinecraftForge/FML@5275cea844 Try and see if there is anything to the identityHashCode collision hypothesis. If you see this in your error messages, kindly let us know!
2014-05-10 14:54:23 -04:00
Lex Manos 80511409ff Updated FML:
MinecraftForge/FML@a70308ef41 Update mcmod.info
MinecraftForge/FML@8555344eb3 updated wrapper to gradle 1.12
MinecraftForge/FML@1d5fc60f82 Merge pull request #411 from matthewprenger/master
MinecraftForge/FML@3612ad0c25 Attempt to fix another race condition related to reading NetClientHandler.
MinecraftForge/FML@c73a2076e3 Fix potential rance condition in connecting to vanilla servers as well. And move latch into client side only.
MinecraftForge/FML@1436ac2f14 Fine use FMLCommonHandler.
MinecraftForge/FML@542e9acec1 documented dependencies
MinecraftForge/FML@ddc2cfbe86 Merge pull request #402 from AbrarSyed/patch-1
MinecraftForge/FML@362ec8dee7 Merge pull request #419 from Thog92/master
MinecraftForge/FML@b9de9ebc96 Revert "Fix refreshResources not happening if an error occurs."
MinecraftForge/FML@738ce1d7cd Re-add removed genericiterable to clean a warning
MinecraftForge/FML@b0eb1ef7c6 Split loadmods into loadmods and preinitmods, to allow resource loading to occur *always* between the two phases. This should fix mods not being able to access resources during preinit.
MinecraftForge/FML@de546bdf6c Clean up some missing generic info
MinecraftForge/FML@cd43eacbb2 Ensure that the loadcontroller is ready to preinit.
MinecraftForge/FML@f2fe80dc36 Fixed default network mod checking to allow client side mods without the server side. Mods wishing to REQUIRE server side components must specify a custom check handler using @NetworkCheckHandler
MinecraftForge/FML@0c36868f92 Fix network disconnect with message on the client side in NetworkDispatcher.
2014-05-09 13:34:08 -07:00
LexManos 51628825e5 Merge pull request #1064 from bspkrs/patch-2
Fixed unforeseen NPE
2014-05-08 08:40:25 -07:00
bspkrs e625622b6e Fixed unforeseen NPE 2014-05-08 10:22:48 -04:00
Lex Manos 9e1f038c16 Revert "Implemented hashCode and equals in ItemStack, Closes #986"
This reverts commit 0b01545a03.
2014-05-07 22:08:06 -07:00
Lex Manos 0b01545a03 Implemented hashCode and equals in ItemStack, Closes #986 2014-05-07 15:28:03 -07:00
Lex Manos c8abc41aa0 Fix extended entity properties being lost when leaving the end, This introduces the concept of calling IExtendedEntityProperties.init when entites/worlds change. Lets see if mods explode. 2014-05-07 14:52:18 -07:00
LexManos 3b79370be1 Merge pull request #1062 from bspkrs/master
New GuiScreen events and a new ElementType DEBUG for RenderGameOverlayEvent
2014-05-07 13:58:18 -07:00
bspkrs eb2549c773 New GuiScreen events and a new ElementType DEBUG for RenderGameOverlayEvent 2014-05-07 16:52:10 -04:00
Lex Manos d881baa581 Added new hook to WeightedRandom.getItem that allows for use of custom rnadom generators, prevents redundant code in mods. 2014-05-07 13:27:05 -07:00
Lex Manos f81c0cb58f Fixed hard references in WorldGenBigTree and ForgeCommand that caused worlds to leak in the client. 2014-05-07 12:18:56 -07:00
Lex Manos 0fe2584b77 Updated FML:
MinecraftForge/FML@2c56c32c5a Fix saving backups with the raw name. Fix air block not being assigned as the default.
MinecraftForge/FML@d0f8073fa5 Merge pull request #413 from sfPlayer1/master
MinecraftForge/FML@810b1f3075 Clean some generic warnings up. Make a generic list handler. Helpful for others I think too.
MinecraftForge/FML@fff86ee9d3 Fix refreshResources not happening if an error occurs.
MinecraftForge/FML@76d8d0e870 Fix mod version checking
MinecraftForge/FML@b84d0760ae Fix display of mod status at the server
MinecraftForge/FML@251af1d09d Fixed memory leak on the client caused by Netty holding references to the World.
2014-05-07 12:17:52 -07:00
LexManos 5fc3e7e913 Merge pull request #1060 from Azanor/master
Fix for Block.getExplosionResistance getting passed the wrong parameters
2014-05-07 09:41:43 -07:00
Azanor 2e1033b045 Fix for Block.getExplosionResistance getting passed the wrong parameters
It is being sent the x, x, y coordinates instead of x, y, z
2014-05-07 17:21:58 +02:00
LexManos 80fd60eaff Merge pull request #1051 from Deadrik/ChunkProviderFixes
ReplaceBiomeBlocks Event changes
2014-04-29 17:38:37 -07:00
Bioxx f848955263 Adds a new ReplaceBiomeBlocks Event constructor that supplies the metadata array if applicable and updates the ChunkProviderGenerate class to pass in the metadata array. 2014-04-29 19:40:32 -04:00
LexManos d01758e90d Merge pull request #1050 from CovertJaguar/master
Flexible Rail return value was inverted between 1.6 and 1.7
2014-04-29 14:12:33 -07:00
CovertJaguar 5f6e1167f4 Fix issue with flexible rail return value
Between 1.6 and 1.7 the return value to BlockRailBase.isFlexibleRail()
was inverted. While this is not a huge deal and could be worked around
by simply inverting your return value, it does mean its no longer
consistent with the function name and javadocs.
2014-04-29 14:07:59 -07:00
Christian 63a205c043 No, this is not me modding either. I'm doing this as a favour for Lex, who's a bit computerless at the minute.
MinecraftForge/FML@77c254a6d9 I am not modding, I am fixing an annoyance. The MCP version has long since been 9.03. Also, the JSON from MC updated..
MinecraftForge/FML@7f01cf549b I'm still not modding. Player has contributed greatly to the 1.7 release of FML. He needs authorship credit.
MinecraftForge/FML@2b8d0f6680 Fix SimpleNetworkWrapper - this is not me modding, I didn't realize it was broken until Pahimar told me.
MinecraftForge/FML@ddee7eb117 Fix vanilla bug causing integrated server saving from 2 threads concurrently after a crash
MinecraftForge/FML@59a5adfdb3 Registry: Fix Block-before-ItemBlock allocation when loading 1.6 world saves, more validation
MinecraftForge/FML@d88b2aa0c5 prevent the world from getting saved twice at shutdown
MinecraftForge/FML@9b1cbab03b Registry: Crash earlier with conflicting name/object registrations.
MinecraftForge/FML@7ba167c500 Registry: Misc tweaks
MinecraftForge/FML@78248da399 Registry: Treat all 1.6 entries as items.
2014-04-28 15:59:30 -04:00
LexManos 022cefc72a Merge pull request #1044 from bspkrs/patch-1
Fixed typo in update checker
2014-04-20 03:52:55 -07:00
bspkrs 3fa0c70f2b get a spelling checker :P 2014-04-18 11:21:40 -04:00
Lex Manos a008339c6e Bump Forge version in prep for release. 2014-04-16 17:30:50 -07:00
Lex Manos 172ea90c59 Try and fix invalid framebuffer depth/stencil setup, Thanks Ivoforce. Closes #1032 2014-04-15 12:03:31 -07:00
LexManos cc08cb46c8 Merge pull request #1038 from planetguy32/master
Fix infinite loop in RecipeSorter
2014-04-15 14:47:36 -04:00
planetguy32 fd59ab261f Fix infinite loop in RecipeSorter
If recipe is multiple levels of inheritance from Object and not categorized, cls=cls.getSuperclass(); needs to be repeated more than once. It must therefore be moved to inside the while loop.
2014-04-12 20:04:02 -07:00
LexManos 2cef9c5cb2 Merge pull request #1029 from iChun/patch-1
Fixes stencil buffers on platforms not supporting OpenGL 3.0 or higher.
2014-04-07 10:43:02 -07:00
iChun cc54645bf3 Fixes stencil buffers on platforms not supporting OpenGL 3.0 or higher. 2014-04-08 01:09:17 +08:00
Lex Manos 2b40a5e3ce Small wording change in license to allow for specifc differnet licnense contributions.
Updated FML:
MinecraftForge/FML@e58562d3ed Fix remaining issue with autoassigned Block and Item IDs overlapping.
MinecraftForge/FML@a82195772e Registry: Block IDs after failing to find a mapping for them
MinecraftForge/FML@fd9389015f Fix FMLMissingMappingsEvent.get
MinecraftForge/FML@5eebd4df71 Registry: Implement support for remapping blocks/items to a new name.
MinecraftForge/FML@7325aa5033 Registry: cleanup, fix missing id error GUI formatting
MinecraftForge/FML@eb29d651eb Fix old 1.7 worlds with broken ID mappings
MinecraftForge/FML@6fd3c12a4a Registry: allow handling missing blocks/items regardless of the mod id
MinecraftForge/FML@038fa17ad3 Merge branch 'master' of https://github.com/MinecraftForge/FML
MinecraftForge/FML@49c623f59c initial attempt at a better way to ask the user in case of startup issues
MinecraftForge/FML@9be92dcfcb Registry: Complain about bogus registrations
MinecraftForge/FML@fd6d55afcc Registry: Allow ignoring missing mods from the GUI, with confirm+backup
  Registry: Add confirm+backup for automated corrupted id table fixup Require the user to confirm loading from a backup level.dat
MinecraftForge/FML@c47fc3b382 Enable custom gui rendering only as required
MinecraftForge/FML@f77632df35 Remove unneeded entity spawn debug logging.
MinecraftForge/FML@c7adb42199 Registry: Repair mismatched ItemBlocks as well Fix a few misc issues
MinecraftForge/FML@c8a245a985 Registry: Fix debug info
MinecraftForge/FML@c8a0b72eba Registry: Complain about missing mods when repairing broken worlds Registry: Reduce console spam
MinecraftForge/FML@8e44006f43 Registry: Protect against putObject misuse, handle duplicate registrations better
MinecraftForge/FML@294c93212c Registry: Add support for registering ItemBlocks before their Blocks
MinecraftForge/FML@3b42b33b6e Merge pull request #400 from sfPlayer1/master
2014-04-07 10:01:56 -07:00
LexManos ae81ad58ea Merge pull request #1028 from alexbegt/patch-1
Small Fix: Held Items & Multiple Render Passes
2014-04-06 16:34:58 -07:00
Alexander Behrhof 36298e2bfe Small Fix: Held Items & Multiple Render Passes
Passes beyond 1 now have the correct icon.
2014-04-06 17:29:23 -04:00
Lex Manos 7b19768c4c Fix line offset in Minecraft patch, and mix RenderPlayer looping once to many on multi-pass items. 2014-04-04 14:20:56 -07:00
LexManos 094d80fe66 Merge pull request #1024 from ShetiPhian/patch-1
Add a variable for SoundCategory in PlaySoundEvent17
2014-04-03 19:59:56 -07:00
ShetiPhian bba42d4230 Update PlaySoundEvent17.java 2014-04-03 22:25:49 -04:00
Lex Manos 621fb050ce Finally do SoundSystem workup for 1.7, Closes #982 2014-04-03 03:12:22 -07:00
Lex Manos 5fbc70173c Add NPE protection to GuiingameMenu.actionPerformed, Closes #961 2014-04-03 02:11:17 -07:00
Lex Manos 72d22c5827 Update access transformer, Closes #951 and #1021 2014-04-03 02:10:43 -07:00
Lex Manos 12e8d95e9f Fix potential threading issue if FluidRegistry.loopupFluidForBlock is called from two threads at the same time before being setup. Closes #936 2014-04-02 23:53:05 -07:00
Lex Manos 14b9d639a2 Use BiomeGenBase's array size instead of hardcoding it in BiomeDictionary. Closes #871 2014-04-02 23:46:52 -07:00
Lex Manos 5f62afb5f2 Add AnvilUpdateEvent which is fired when a user places a item in both input slots of a Anvil and allows modders to control the output. Closes #838 2014-04-02 18:33:13 -07:00
Lex Manos 33bf2c8a69 Add ANIMALS tpe to PopulateChunkEvent.Populate Custom providers should call this function if they spawn animals curing population. Closes #790 2014-04-02 17:40:03 -07:00
Lex Manos 56084b584d ItemStack sensitive version of Item.getAttributeModifiers, Closes #816 2014-04-02 17:24:25 -07:00
Lex Manos b0bfea4e03 New hook to truely seperate the display of the 'durability' bar from the current / max durability. Allowing modders to control that display easier. 2014-04-02 17:08:22 -07:00
Lex Manos aa0c902d22 Advanced Model Loader available server-side for data driven models. To be cleanuped and re-evaluated in 1.8. Closes #773 2014-04-01 15:02:06 -07:00
Lex Manos d9a1c718bf Add position to BreakSpeed event. Closes #621 2014-04-01 15:00:25 -07:00
Lex Manos f436b3e62d Update patches for new Fixed FernFlower used in FG 1.2. 2014-03-31 16:48:21 -07:00
LexManos 8576fe6dbe Merge pull request #1012 from AbrarSyed/master
Updated for ForgeGradle 1.2
2014-03-31 16:05:09 -07:00
AbrarSyed 1d2d0ea5cd fixed remaining noop patches and exc derp 2014-03-29 01:52:11 -05:00
AbrarSyed 5d43695710 updated FML to latest master 2014-03-29 01:14:24 -05:00
AbrarSyed 0e1a1202d8 added .exe file.. fixed a bunch of patches 2014-03-29 01:12:45 -05:00
AbrarSyed 9d3a274cb6 updated for ForgeGradle 1.2 2014-03-25 10:15:42 -05:00
AbrarSyed 2a2e201f4a COnverted patches to SRG names 2014-03-25 10:13:57 -05:00
LexManos 0620a64813 Merge pull request #998 from Eurymachus/master
This correctly uses the world height less one block for placement of a door
2014-03-15 16:31:57 -05:00
Eurymachus 05afb0c347 This correctly uses the world height less one block for placement of a
Door.

Required for placing doors inside a littleblocks area.
2014-03-12 13:26:48 +00:00
Lex Manos 185b9f8368 MinecraftForge/FML@ef07de4f65 Fix hard link to DedicatedSerever when opening a LAN connection causing stalls on connecting. 2014-03-11 00:55:57 -07:00
Lex Manos ea2c07c727 -.- Both null combinations. 2014-03-10 23:41:37 -07:00
Lex Manos 1a9e13f880 properly implement equals, sod off Player. 2014-03-10 23:27:30 -07:00
Lex Manos d97ec2763c Implement simple hash based equals in Fluid ContainerKey. 2014-03-10 22:51:31 -07:00
Lex Manos 534b241e9f Make StructureVillagePieces.Village public. 2014-03-10 22:12:46 -07:00
LexManos 0513182e3c Merge pull request #995 from iChun/master
Fixes stencil bits not existing in Minecraft's framebuffer causing stencil test to not work.
2014-03-10 17:42:55 -05:00
iChun 741a90c6bd Fixes stencil bits not existing in Minecraft's framebuffer causing stencil test to not work. 2014-03-11 06:40:37 +08:00
Lex Manos 68eb0d15dc Updated FML:
MinecraftForge/FML@e8b60441cc Reload game settings after mod loading is finished to capture mod keybindings. Closes #378
MinecraftForge/FML@399770e572 Kill the modEventTypes list, register anything that extends FMLEvent, Fixes MissingMappingEvent handler, and any futureevents added.
MinecraftForge/FML@b7ad532ab5 Re-enable post initalize texture pack reloading to allow Icons to be registerd through any init phase.
2014-03-09 13:44:36 -07:00
LexManos 8660d0471f Merge pull request #983 from DemoXinMC/master
Added Ore Dictionary entries and recipe replacements for Diamond, Emerald, Crops, Redstone, and Glowstone
2014-03-01 12:06:08 -08:00
LexManos 0a6dc66749 Merge pull request #984 from ShetiPhian/item-renderer-fix
Small Fix: Held Items & Multiple Render Passes
2014-02-28 05:03:41 -08:00
DemoXin 488eb30272 * Fixed Items.glowstone to Items.glowstone_dust 2014-02-28 02:54:50 -05:00
Timothy Tomkins d2d2032f93 Small Fix: Held Items & Multiple Render Passes
Passes beyond 1 now have the correct icon.
2014-02-27 23:57:44 -05:00
DemoXin 58fde290f8 * Added Ore Dictionary entries and recipe replacements for Diamond, Emerald, Crops, Redstone, and Glowstone 2014-02-27 22:48:33 -05:00
Lex Manos 246152d3c4 Fixed hashcode in FluidContainerRegistry, still needs a redesign. Closes #967 2014-02-23 16:56:29 -08:00
LexManos ee7aa93416 Merge pull request #978 from iChun/master
Add cancelable RenderHandEvent.
2014-02-21 10:28:37 -08:00
iChun bad0639e90 Add cancelable RenderHandEvent. 2014-02-22 01:13:40 +08:00
Lex Manos 6f49bba302 Fix a typo in our tile entity fix causing it to be ineffective. 2014-02-20 12:04:27 -08:00
Lex Manos b01d87f0c6 Fix items with color rendering incorrectly. 2014-02-19 12:34:21 -08:00
Christian 08a636c34f Update Forge for patch changes
MinecraftForge/FML@064b66af3d Prevent players from logging in until server has finished starting.
MinecraftForge/FML@2aa73afa15 Fix ExampleMod.java for build #1024+
MinecraftForge/FML@c890206268 Try and handle removal of mods a bit better. Currently no way to allow a world which has missing blocks to load - but i have the code in place to allow it i think.
MinecraftForge/FML@995c204338 Fix failing to load a world with missing mod blocks and items. There will be a way to force worlds to load when stuff is missing, but for right now, it will fail as this is "world safe".
MinecraftForge/FML@fa5f4c8842 Some argumentation
MinecraftForge/FML@45409bfa0c Prevent player dat files getting reset during disconnects.
MinecraftForge/FML@33100d6bab Merge pull request #371 from bl4ckscor3/patch-1
MinecraftForge/FML@572d32358a Merge pull request #373 from bloodmc/master
MinecraftForge/FML@d0dd05a15c FML expands S3F to support payloads up to 2 megs in size. Should be transparent
2014-02-18 21:03:44 -05:00
Lex Manos 3322996885 Fixeed a missed -1 in SpawnerAnimals patch. Thanks Blood. 2014-02-12 23:06:11 -08:00
Lex Manos b43d63a7ad Cull FakePlayers when worlds are unloaded. 2014-02-11 18:25:33 -08:00
Lex Manos c8e0b4a193 Use correct tag types when reading Forced Chunk data. Fixes ticket loading. Closes #964 2014-02-10 16:16:03 -08:00
Lex Manos c4972b7658 Fixed FluidContainerRegisry.contansFluid closes #845 2014-02-10 15:29:36 -08:00
Lex Manos 8462f3b17c Fix AIOOB error with Endermen and blocks >256. Also better support for ID remapping. More to come later. 2014-02-07 19:15:05 -08:00
Lex Manos 1e2c63f486 Add the beginnings of a Constants class, to document/clean some of the magic numbers that are in the MC code base. 2014-02-05 01:14:57 -08:00
Lex Manos e68577ffd3 Updated FML:
MinecraftForge/FML@03fb1879d7 Fix obf error when right clicking a Empty Map.
MinecraftForge/FML@6bb9b8b953 Clean up FMLEventChannel. Closes #367.
MinecraftForge/FML@b7b3450dcd Update MCP mapping snapshot to latest crowdsourced names.
MinecraftForge/FML@8c9e8b5270 Fix isRemote, this is integral to so many parts of the code, everyone knows it by this name, People should not change it.
2014-02-05 01:14:24 -08:00
Christian 9d919f8ac9 Fix up the event handler so it knows it's owned by forge 2014-02-02 12:34:34 -05:00
Christian 67d9dac16d Add a discriminator for fluididspacket. remove extraneous channel handler. 2014-02-02 12:19:37 -05:00
Christian 978bfd6eb1 MinecraftForge/FML@d87822ad85 Bump gradle wrapper to 1.10
MinecraftForge/FML@359ac3ca2a Ensure we check both item and block registries when finding valid IDs. Should fix #365
MinecraftForge/FML@cee0f0b811 Tweak so that writing to the context will automatically send a message back to the originator in handshakeestablished.
2014-02-02 12:18:32 -05:00
Lex Manos 539ee0ea88 Fixed missed parens causing trapdoors to fall off incorrectly. 2014-01-31 15:12:19 -08:00
Lex Manos f85ab543ee Fixed issue where enchantment effects caused slight rendeirng issue. 2014-01-31 14:32:32 -08:00
Lex Manos 51414375e4 Uncomment aa few FluidRegistry entries. 2014-01-29 21:04:34 -08:00
Lex Manos 2b9a2b5c1a Inital Fluid system update, untested. Still in progress. 2014-01-29 18:34:23 -08:00
Lex Manos 51b008c391 Attempt a AIOOB error fix in tesselator when there are alot of transparent blocks in the rendering range. 2014-01-29 16:17:31 -08:00
Lex Manos 0d84da021f Fix NPE when breaking ice. 2014-01-29 15:43:13 -08:00
Christian 3059e517c5 MinecraftForge/FML@544320b8d2 Beginning of a saveinspectionhandler.
MinecraftForge/FML@ab199c5811 Try harder to find a mod container.
MinecraftForge/FML@8633d780c9 And make a loud message if there isn't a modcontainer found, substitute Minecraft. In general, this can only happen for coremods not properly registering their code. Closes #363
2014-01-25 06:30:12 -05:00
Lex Manos f8f1b4211b Fix imporerly efficient tools breaking blocks to fast. 2014-01-24 21:43:47 -08:00
Lex Manos 30a390d4bf Adds a WeatherRender in the style of SkyRender, Closes #844 2014-01-24 19:38:33 -08:00
Lex Manos 790030ab05 Fixed potential NPE in SlotCrafting, and added ItemStack sensitive version fo hasContainerItem. Closes #854 2014-01-24 19:30:17 -08:00
Lex Manos d73f4fb7b3 Move change of metadata to immediatly after change of Block, should prevent any 'invalid' tile entities from breaking created. Reference: #897 2014-01-24 19:21:59 -08:00
Lex Manos 6f7ac27c96 New PlayerUseItemEvents, Start, Stop, Tick and Finish. See PlayerUseItemEvent.java for more details. Closes #924 2014-01-24 19:10:51 -08:00
Lex Manos 6ae2353f41 Don't short circuit item icons for multiple render passes while being used. Closes #929 2014-01-24 17:23:49 -08:00
Lex Manos c62061728b Add the ability for custom records to have finer control over there sound resource location. Closes #933 2014-01-24 17:16:35 -08:00
Lex Manos 796b53f549 Exclude cobblestone slab recipe from ore dictification, closes #940 2014-01-24 16:44:23 -08:00
Lex Manos 6c6f664c30 Implement PlayerPickupXpEvent, fired when a player aquires XP from a EntityXPOrb. Closes #942 2014-01-24 16:31:38 -08:00
Lex Manos 2e47771860 Missing EntityAITasks.tasks and MapgGenStructreIO register ATs, Closes #949 2014-01-24 16:04:41 -08:00
Lex Manos 75a80f2f75 Make ItemBlock.field_150939_a public, closes #945 2014-01-24 16:02:39 -08:00
Lex Manos aaf6dd2b2e Fix Furnace stopping on 63rd Item, Closes #947 2014-01-22 15:35:55 -08:00
Christian af011d1a57 MinecraftForge/FML@b6d95d704b Name the log files properly. fml-junk is an early startup annoyance I can't kill because log4j2.
MinecraftForge/FML@8692ca17d1 Log4j2 logging context for things. This should help add context when things go wrong in mods.
MinecraftForge/FML@a7ca131a33 And don't spam NONE everywhere
MinecraftForge/FML@741e172ffe Log4j2 doesn't need debug level logging for itself anymore
2014-01-20 22:04:52 -05:00
Christian e653204638 MinecraftForge/FML@458b0620b4 Log the bad packet in a prettier way. Also, don't show the authlib debug data in the log file. 2014-01-20 17:30:16 -05:00
Lex Manos adf0e3ab7d Add BookCloning to the recipe sorter. 2014-01-20 14:04:34 -08:00
Christian eeef1137a8 MinecraftForge/FML@9a8d16b66e Fix log4j2 config. Fix server gui to *show* logging. Fix log spamminess in the console. Fix bug in servergui that can cause deadlock.
MinecraftForge/FML@a355eecb2c Add in error logging for outbound messages. Fix bug with indexedcodec NPE
MinecraftForge/FML@1c793abe0e Fix derp with networkcheck
MinecraftForge/FML@675b5a0778 And turn down some more logging, now we have useful logging back again..
2014-01-20 16:15:57 -05:00
Christian 49886aa633 MinecraftForge/FML@4aa2416ce5 Propagate Optional method removal to trait implementation classes
MinecraftForge/FML@fc025a7b73 Logging Changes
MinecraftForge/FML@f0132a6f3b changed fml log level to all
MinecraftForge/FML@f23eba4352 put max number of FML log files to 3
MinecraftForge/FML@449ac98b77 SSP Worlds updating from 1.6 will now pop a warning message before loading, and will capture a timestamped zip file in the minecraft dir before starting to load. Allows for people to test updates.
MinecraftForge/FML@3557fe31c9 Throw an exception when discriminator is not found
MinecraftForge/FML@2524045728 Make NetworkEventFiringHandler sharable
MinecraftForge/FML@dfc0899ec6 Merge pull request #357 from jk-5/sharable
MinecraftForge/FML@79d42fca8d Merge pull request #355 from jk-5/errorhandling
MinecraftForge/FML@7907e16e96 Add a type adapter for artifact version. Should fix #354
MinecraftForge/FML@7ac5bddbc3 Allow indexed messages to validate themselves. Also, catch exceptions from an embedded channel, and cause them to close the connection. It's ugly, but it means that the client doesn't crash if it connects to a screwy bungycord that's trying a 1.6 handshake for some reason.
MinecraftForge/FML@5adacc3b33 Check the mod, not it's container, in the check handler. Closes #358
MinecraftForge/FML@3d26f28bcf Allow connection when server is apparently offline. Might allow :NOFML circumvention though. Hmmm. Closes #359
MinecraftForge/FML@a62374d4ac findBlock should now return null, not the default block, if the thing being looked for is not found. Closes #352
MinecraftForge/FML@6a695c4348 Try and stop the epic channel closed spam at close time. Closes #353
MinecraftForge/FML@35a38d7840 Make sidedproxy support non-public fields. Closes #344
MinecraftForge/FML@9d2e089df6 Merge branch 'logging' of github.com:AbrarSyed/FML into abrar-borked
MinecraftForge/FML@79b04898d4 And restore suppressions. ABRAR, DON'T TIDY CODE!!!!
MinecraftForge/FML@3dfb54e066 Merge branch 'trait-optional' of github.com:RainWarrior/FML
MinecraftForge/FML@32bb7315cc Add in example assets dir. Closes #308
MinecraftForge/FML@16d33d2989 Clean up and document outbound handler a bit better. Add in dispatcher target. Closes #361
MinecraftForge/FML@5719b9ec53 Fix reply handling. Make the proxy message available for subclasses of indexedcodec. Fire user events into the network event firing.
2014-01-20 12:03:07 -05:00
Lex Manos 28f7f523ee Add support in Techne models for the TextureSize tag. Closes #856 2014-01-18 13:53:54 -08:00
Lex Manos b917d48cff Fixed RenderWorldLastEvent never being called, was missed in 1.7 update. Closes #932 2014-01-18 13:22:09 -08:00
Lex Manos 79ebdfa145 Updated FML: MinecraftForge/FML@444a7d7fa1 Move placement of single player world load hook to fix NPEs. 2014-01-18 13:19:51 -08:00
Lex Manos 612a8a71b0 Fix flexible rails, Closes #944 2014-01-18 04:45:25 -08:00
Lex Manos b93217397c Updated FML:
MinecraftForge/FML@7c5d62704a Make UniqueIdentifier final and add a hashCode. Closes #348
MinecraftForge/FML@ff7b5845e7 Clean up some warnings about @Override
MinecraftForge/FML@275ccac6f1 Fix NPE at startup
MinecraftForge/FML@2a5a8d0cd0 Fix memory leak?!
2014-01-17 21:55:54 -08:00
Lex Manos baf95e747a Fix warnings in Forge codebase. 2014-01-17 21:55:48 -08:00
Christian eeeb4d37e8 Add exception logging to forge channel handlers as well
MinecraftForge/FML@53557dcd05 Put logging exception handlers on all channel inbounds. Fix problem with failure to login. Closes #350
2014-01-17 17:05:11 -05:00
Christian b3d8e4ea68 MinecraftForge/FML@9c96ca4402 Fire a custom packet channel registration/deregistration event, for any mods that care about that kind of thing 2014-01-16 19:47:03 -05:00
Christian b463476815 MinecraftForge/FML@e14efe786f Some fixes and tweaks
MinecraftForge/FML@c013870b1d Merge branch 'simplenet'
MinecraftForge/FML@30882b0c1d Clean up some warnings. Add in simple network impl
MinecraftForge/FML@9cab2ab36e Add in some tests and examples for the "simple" network stuff
MinecraftForge/FML@a429e106dd Fix bug with SSP, and hook so we can do confirmation of world loading, as well as other things
2014-01-16 18:19:28 -05:00
Christian c71b7554e0 MinecraftForge/FML@b362e8a273 At the request of AbrarSyed.
MinecraftForge/FML@e344303ec7 Merge pull request #346 from Jezzadabomb338/master
MinecraftForge/FML@a4686b1261 Added basic Mojang account authentication support for development time login.
MinecraftForge/FML@dd17979a2f Fix bukkit connectivity issue.
2014-01-16 15:07:48 -05:00
Christian 3c8bd6346f Updated FML:
MinecraftForge/FML@1db3daa0e8 added override toString method for getting full name.
MinecraftForge/FML@acf74a3403 changed the readme to reflect new setup task.
MinecraftForge/FML@96c19b3580 undid readme change
MinecraftForge/FML@a89939e57e Merge pull request #336 from jadar/master
MinecraftForge/FML@717a8d6945 Fix csv string vs list of strings. Thanks immibis. Closes #334
MinecraftForge/FML@584c0f368b Fix potential ordering issue, clean up some imports
MinecraftForge/FML@28293b29ea Add in a simple(ish) event driven network handling system. Register using newEventDrivenChannel and you'll get a simple network handler that will fire events at the subscriber(s) of your choice, whenever a packet is received. You'll also get some convenience methods for sending to things.
MinecraftForge/FML@80b00dc796 Fix openGui. Closes #342
MinecraftForge/FML@fc69bcf280 Fix up privacy derp in TickEvent. Closes #343
MinecraftForge/FML@10d056a494 Fix possible NPE derp
MinecraftForge/FML@5da6dcc7e3 Divert connection through FML, so we can deny connections to servers that don't want us
2014-01-14 22:02:57 -05:00
LexManos 0296803fe3 Merge pull request #926 from iChun/master
Fix erroneous position when getting player position with changed eye height.
2014-01-11 17:32:27 -08:00
iChun b1f8af7f55 Squash commits so Lex would stop whining. Fix erroneous position when getting player position with changed eye height. 2014-01-12 07:59:39 +08:00
Christian 3c0ef2cce8 Updated FML:
MinecraftForge/FML@d5bfd69e35 Fix problem with connecting to vanilla. SHOW what's modded and what's vanilla in the list. Hooks that make the blocking work to come
MinecraftForge/FML@dd098854b0 Fix the keybinding array to the right one
MinecraftForge/FML@43068eb986 Fix TargetPoint to be static
2014-01-09 08:44:52 -05:00
Lex Manos aab5b04a6d Attempt to prevent a NPE when MC renders a lot of things at once. 2014-01-06 20:25:34 -08:00
LexManos 4e45156eaf Merge pull request #928 from Minalien/master
Fixed issue with forward-slashes in texture names when registering icons, fixed custom item renderer retrieval.
2014-01-05 21:08:06 -08:00
Ken 'Minalien' Murray 9e91b0ca81 Fixed MinecraftForgeClient for custom Item Renderer implementations. Removed check for forward-slashes (/) in texture asset locations (but left check for backslash in place). 2014-01-05 21:55:04 -07:00
Lex Manos 08eb897996 MinecraftForge/FML@0d810c01fa Mark jopt needed on the server, herp derp, blame Abrar! 2014-01-05 19:08:00 -08:00
Lex Manos 0da954cc10 Fix DoublePlant placement, closes #921 2014-01-04 13:07:05 -08:00
Lex Manos a1b68d938d Deprecate BlockFire.func_149842_a, and throw exception if someone tries to set the burn properties for air. Should prevent 'The Air is on fire!' reports. 2014-01-04 13:06:31 -08:00
LexManos 325423ab02 Merge pull request #919 from VeryBigBro/patch-2
Create ru_RU.lang
2014-01-04 00:08:43 -08:00
Anton 9523059d85 Create ru_RU.lang 2014-01-04 09:28:29 +03:00
Christian 95c12b6c20 Updated FML:
MinecraftForge/FML@5317672631 Add a utility method for finding the channel handler name based on type. Should fix naming weirdnesses.
MinecraftForge/FML@9de9a15530 Fix stupid hardcoding derp
2014-01-03 23:07:55 -05:00
Lex Manos b6199c202e Fixed pipeline naming issue in the ForgeNetworkHandler. 2014-01-03 18:54:52 -08:00
LexManos 367c5d1ede Merge pull request #882 from Vexatos/patch-2
Create de_DE.lang
2014-01-03 18:29:55 -08:00
Lex Manos ef5d66ebd2 Fixed the run config for dev time server, Cloases #913 2014-01-03 17:29:40 -08:00
Lex Manos 3953eb3f6c Fix panes/iron bars not connecting correctly. Closes #904 2014-01-03 17:26:40 -08:00
Lex Manos b149ccbc17 Models now load from resource packs
Models must now be loaded from resource packs using the standard resource pack reference. For example, to load a model named "assets/mymod/models/mymodel.obj", you would call AdvancedModelLoader.loadModel("mymod:models/mymodel.obj");
Closes #670
2014-01-03 17:10:15 -08:00
Lex Manos df0b1751e6 Fixing an infinite recursion case, Closes #916 2014-01-03 16:50:02 -08:00
LexManos bb756115fa Merge pull request #915 from Adubbz/master
Made canBeReplacedByLeaves default to whether a block isn't opaque rathe...
2014-01-03 16:14:37 -08:00
Adubbz 48a9e24630 Made canBeReplacedByLeaves default to whether a block isn't opaque rather than if it is, also uninverted the checks for canBeReplacedByLeaves in WorldGenBigMushroom, WorldGenSwamp, WorldGenTaiga1 and WorldGenTaiga2 2014-01-03 18:00:11 +11:00
Christian 3896a63016 Fix inversion 2014-01-02 22:52:04 -05:00
Christian 50144d178a Updated FML:
MinecraftForge/FML@6f1da6550e Fix up mcpname derp in GuiScrollingList.
2014-01-02 22:46:42 -05:00
Christian e0840e392c Updated FML:
MinecraftForge/FML@21b13d6351 Lots of network cleanup. Gui packets now work too!
MinecraftForge/FML@b3f98d1ee0 Fix derpiness with Mods button when Realms is available
MinecraftForge/FML@cdd9d92a4f Starting work on the actual GUI. Still work to do. Needs an API.
MinecraftForge/FML@ab5eb3ccff Fix button size for GuiModList
MinecraftForge/FML@3113138bd1 Tweak button positions.
MinecraftForge/FML@c5e29b574a Avoiding redundant calls to LogManager
MinecraftForge/FML@fbc1f8f6f9 Config GUIs in the modlist now work.
MinecraftForge/FML@fa4f3015a0 Added transparent background for GuiIngameModOptions as per cpw's request. May not compile due to manual de-mcp-fication.
MinecraftForge/FML@7bf119e1e5 Fix up readmes and credits. We no longer support modloader.
MinecraftForge/FML@779cd05aa1 Tweaks
MinecraftForge/FML@b51fb91355 Merge branch 'patch-1' of github.com:airbreather/FML
2014-01-02 22:27:42 -05:00
Vexatos e6bfb6b7b3 Update de_DE.lang 2014-01-01 09:06:40 +01:00
LexManos 165cbd1c48 Merge pull request #912 from Adubbz/master
Fixed sky colour transitions on a render distance of 16, fixed the World...
2013-12-31 23:53:45 -08:00
Adubbz bd5e7f8118 Fixed sky colour transitions on a render distance of 16, fixed the WorldGen of various things 2014-01-01 18:50:52 +11:00
LexManos ccee30b15e Merge pull request #908 from jk-5/patch-1
Add constructors to DimensionRegisterMessage
2013-12-31 13:08:56 -08:00
Lex Manos 32f26561b1 Fix inverted login in BlockPistonBase causing blocks to break incorrectly. Closes #910 #909 2013-12-31 13:07:44 -08:00
Lex Manos ea0be720a1 Update patches for AT changes. 2013-12-31 13:03:45 -08:00
Lex Manos b31fbe528a Update for the FMLEmbeddedChannel change. 2013-12-31 12:48:59 -08:00
Christian 2f13622d37 Updated FML:
MinecraftForge/FML@22ba6fda5e Expose the nethandler in a few places, and pull out FMLEmbeddedChannel, exposing a utility method on it. More to come.
2013-12-31 09:46:50 -05:00
jk-5 03c4282ebf Added default constructor for reflection 2013-12-31 08:21:05 +01:00
jk-5 5ff5f1b0d5 Added a constructor and made the fields package-private 2013-12-30 21:58:53 +01:00
jk-5 07fa6615f8 Update ForgeMessage.java 2013-12-30 20:12:15 +01:00
Christian 941c2b1d14 Fix build.gradle for tweakClass property
Updated FML:
MinecraftForge/FML@f36152398d Add in the tweakclass, fix the json for lzma @ the server.
2013-12-30 13:27:15 -05:00
Christian aa67bc5da6 Updated FML:
MinecraftForge/FML@5d069629cf Allow itemstacks for furnace recipe inputs. Allow passing extra arguments through registerblock into the itemblock constructor.
2013-12-28 18:06:18 -05:00
Christian 946166f13e Updated FML:
MinecraftForge/FML@061288909d Fire simple network connect/disconnect gameevents.
2013-12-28 17:53:29 -05:00
Christian 6ab5ef1315 Merge branch 'master' of github.com:Adubbz/MinecraftForge 2013-12-28 17:02:41 -05:00
Christian 5c647d4515 Fix the network handler for forge 2013-12-28 17:01:58 -05:00
Christian 906ced3c32 Updated FML:
MinecraftForge/FML@34819c9303 Make gradlew executable on linux
MinecraftForge/FML@53a1f98414 Attempt to load old pre-1.7 worlds. ENSURE YOU HAVE A BACKUP!
MinecraftForge/FML@6a5f9e135f Fix example mod code for 1.7
2013-12-28 13:49:18 -05:00
Adubbz 164fa8f646 Made BlockCrops.getDrops call its super method 2013-12-28 23:15:09 +11:00
Christian f075264d6f Allow tools to override their material harvest levels. 2013-12-27 23:48:10 -05:00
Christian cf3447feea Tidier implementation of previous commit. Should fix for subclasses of individual tools too 2013-12-27 21:48:42 -05:00
Christian 78b1b54e2b Add in harvesting abilities of the items, should fix effectiveness 2013-12-27 21:26:42 -05:00
Christian b7eac150cc Updated FML:
MinecraftForge/FML@f8d6213829 Update render registry
MinecraftForge/FML@ec316f113f AT for renderblocks
2013-12-27 00:09:22 -05:00
Christian a9876475c1 Updated FML:
MinecraftForge/FML@268bbabee6 Fix handling world reloads when new stuffs are added
2013-12-26 12:43:34 -05:00
LexManos 46296328ff Merge pull request #893 from iChun/master
Add render offset to event.
2013-12-25 01:05:45 -08:00
iChun 5f3ece629c Add render offset to event. 2013-12-25 17:03:19 +08:00
Lex Manos a6827f9820 Fix dig speed on redstone ore and obsidian. 2013-12-25 00:41:21 -08:00
Lex Manos 40d02fe6c3 Add a version check mechanic to startup, it is done in a seperate thread and has a config option to compleetly disable it. This allows us to notify users of new recomended builds. Hopefully stemming the flow of outdated help request. Also adds a warning to the main screen if you are running a 'Beta' Forge. Which means a Forge for a new version of Minecraft that we have not promoted a recomended build for yet. 2013-12-25 00:35:59 -08:00
Lex Manos 572bc48a25 Resize pending tile updates when it goes over the curent length. Fixed AIOOB error. 2013-12-24 19:59:34 -08:00
Lex Manos 1959e414e2 Forgot to regen patches... 2013-12-23 22:45:45 -08:00
Lex Manos 08a875c39a Added constructor to WorldType, and delegated the BiomeLayer management to it. Also updated the access transformer for Item/Block classes. 2013-12-23 22:40:54 -08:00
Lex Manos 90be589ffa MinecraftForge/FML@c180d9b157 Add 1.7.2 base json, Gradle will automatically download updated versions of this. Keeping it in the repo allows us to se
e what base json we have built our jsons off of. And if it changes update accordingly.
2013-12-23 22:40:54 -08:00
Christian 780865cfed Updated FML:
MinecraftForge/FML@156a9ae03a Fix build script
MinecraftForge/FML@7d3b1250e8 Fix handshaking properly. Also, fix ID syncup. It now will completely freeze the idmap after preinit. This frozen map is used to inject "new" stuff into existing serverside worlds. Interesting sideeffect: remote servers lacking things will change the client, to also LACK ids for those things. watch for -1 ids in your remap events. Note: idmaps should be considered temporary per server instance. SERVERSTOPPED will restore "startup" state, as will client logout.
2013-12-24 01:37:25 -05:00
Lex Manos d795f1b898 Fix items rendering on the GUI with invalid state due to glint rendering changing it. Thanks iChun. 2013-12-23 20:58:48 -08:00
Lex Manos ecf8d29724 Fixed accedential inverted logic that caused Potions to render incorrectly. Thanks iChun. 2013-12-23 20:47:07 -08:00
Lex Manos 8ca1179e04 Move Grass {Flower} registry to BiomeGenBase as 1.7 made flowers Biome specifc, this means modders who wish to add global base flowers need to add them to all the biomes indavidually. 2013-12-23 20:34:39 -08:00
Lex Manos 96e23516f6 Temporary fix for items rendering with effects on one layer. Restores default vanilla rendering, which is considered a bug in modded community. 2013-12-23 20:33:32 -08:00
Lex Manos 2102965fac Fix debug HUD rendering semi-transparently. 2013-12-23 20:32:37 -08:00
Lex Manos 436f7fc550 Bump version to 10.12.0 to mark 1.7. 2013-12-22 18:48:22 -08:00
Lex Manos 2b10a2b874 Updated FML:
MinecraftForge/FML@58132ccda3 Add new required --accessToken to launch specs.
2013-12-22 18:37:53 -08:00
Lex Manos 9ee5053b71 Fix:
Block placement/interaction
  Tesselator crash due to wrong mapping
  Missing isreplaceable check in world.canPlaceAt
  Small foratting/logging cleanup
  Temporarly commented out efficancy changes till I implement it.
2013-12-22 18:25:26 -08:00
Lex Manos 30494f8ddb Fix MethodNotFound crash when shutting down internal server. 2013-12-22 18:22:57 -08:00
Lex Manos 21e505c334 Forge uses the FORGE channel for packets. 2013-12-22 18:21:56 -08:00
Lex Manos 7e668ca9ac Get object based on identity not name. 2013-12-22 18:21:43 -08:00
LexManos 1d556a5668 Merge pull request #890 from bloodmc/master
Refactored BiomeManager stronghold add/remove methods to support new MapGenStronghold dynamic biome changes.
2013-12-22 15:52:37 -08:00
bloodshot 8654623271 Refactored BiomeManager stronghold add/remove methods to support new
MapGenStronghold dynamic biome changes.
Changed InitNoiseGensEvent to pass a NoiseGenerator array instead of
NoiseGeneratorOctaves due to new NoiseGeneratorPerlin in
ChunkProviderGenerate.
Fixed worldgen crash caused by wrong metadata in Chunk patch.
2013-12-22 18:47:51 -05:00
Lex Manos e1c0cad8e1 Updated FML:
MinecraftForge/FML@a17489172c Code to disable mods at runtime, or other times.
MinecraftForge/FML@85516d9588 ICraftingHandler, IPickupHandler are now both events.
MinecraftForge/FML@e4b63a1801 IWorldGenerator now has an ordering at registration time. This means the order of worldgen should be much more stable.
MinecraftForge/FML@ef3856f9a3 Update patches for Gradle's rename rewrite: MinecraftForge/ForgeGradle@19e7acf2a2
MinecraftForge/FML@31ea100b29 Working on id missing handling
MinecraftForge/FML@3e76dfba34 More tweaking on id stuffs at worldload
MinecraftForge/FML@f860c8ad3b bump to legacy launcher 1.9 with logging unification stuffs.
2013-12-22 03:07:48 -08:00
Lex Manos a6c45a7ade Inital patch update for 1.7.2, Doesn't compile, not done yet. 2013-12-22 03:06:10 -08:00
Christian cd34090eb8 Updated FML:
MinecraftForge/FML@32561265fc Ticks, Player events, keybindings, all migrated to the new event driven system.
2013-12-16 23:20:06 -05:00
Christian ae478c92a2 Moved the core event handler parts to FML. Implemented the Forge network handler based on the new
netty strategy.

Updated FML:
MinecraftForge/FML@3b2994a3de Some patching touchups
MinecraftForge/FML@557357fe17 Update for log4j2
MinecraftForge/FML@a2b324beb2 Copy eventhandler from Forge into FML. It is going to replace a lot of the runtime event systems.
MinecraftForge/FML@4071ff38af Patch some GUIs. We're gonna add some basic mod gui config support.
MinecraftForge/FML@0b419ac79c Fire a user event down the channels when a handshake has occured.
2013-12-16 20:19:03 -05:00
Lex Manos 439dbd8bb3 Killed a few hundred compile errors. 2013-12-12 23:32:36 -08:00
Lex Manos 9cf0a5b68b Comment out fluids until King gets his hands on it 2013-12-12 23:32:18 -08:00
Lex Manos 6eb9915690 Updated FML:
MinecraftForge/FML@1d71c017f4 ID syncing.
MinecraftForge/FML@fd36f50d82 Cleanups
MinecraftForge/FML@89e4e483c2 Add in a remapping event for mods to consume.
MinecraftForge/FML@cd417c6786 Fixed remote and local connections work with mods now.
MinecraftForge/FML@ef492407ef Entity spawning works.
MinecraftForge/FML@d0d31d9575 SpawnAdjustment packet. Clean up stuffs. No more compile errors.
MinecraftForge/FML@3e278acb71 Fix stupid possible compiler error.
MinecraftForge/FML@009d4dee23 Fix the exc file. Fix the deobfremapper for handling inner classes.
MinecraftForge/FML@49cb893d12 Fix exc this time *sigh*
MinecraftForge/FML@31efcfc3b2 Clean up patches for latest exc.
MinecraftForge/FML@7a4ceebf5e Kill old patches and add rejects to ignore file.
MinecraftForge/FML@7ea571f593 Fix AT, Fix exc. Almost works now!
MinecraftForge/FML@b852e30285 First functional release under reobfuscation.
MinecraftForge/FML@df870c1a33 Update shiped ForgeGradle for 1.7
MinecraftForge/FML@55aa337f95 Rename synthetic bridge methods, these methods are not decompiled, but need to reobf correctly cross the recompile boundary.
MinecraftForge/FML@0098c57f94 Merge pull request #316 from AbrarSyed/patch-4
2013-12-12 22:59:35 -08:00
Vexatos ca7a404fc8 Create de_DE.lang 2013-12-11 15:17:20 +01:00
Lex Manos 4a1a0be51d Updated FML:
MinecraftForge/FML@a30f173627 Add sonatype snapshots repo for SpecialSource snapshots.
MinecraftForge/FML@b2550b8a69 Add mappings for Items/Blocks fields.
MinecraftForge/FML@57f7f1d7ab Update for fixed Enum cleaning and names.
MinecraftForge/FML@99c681ad87 Did it manually, forgot it needed the end comma
2013-12-09 22:03:39 -08:00
Lex Manos 521b8a16c4 Some work on 1.7, waiting for Abrar to fix a few things. 2013-12-09 21:59:12 -08:00
Lex Manos d4e7a5c68e Bump data for 1.7 start. 2013-12-09 18:47:55 -08:00
Lex Manos b474c2ca7a Kill liquids finally. 2013-12-09 18:47:15 -08:00
Lex Manos 4142f7c728 MinecraftForge/FML@3714426e19 fix derp in example builscript
MinecraftForge/FML@01fb451b69 Merge pull request #311 from AbrarSyed/patch-3
MinecraftForge/FML@30d532f4fc Pass 1: Most patches are restored.
MinecraftForge/FML@53127eec30 Merge branch 'master' of github.com:MinecraftForge/FML
MinecraftForge/FML@7ab3c3a37c Update gitignore
MinecraftForge/FML@38cec7a11f The basic network handshaking for FML is done. All scenarios seem to work.
MinecraftForge/FML@9f928963f2 A network design I like. It uses the netty embedded channel to allow mods to build channel pipelines on top of custom payload packets.
MinecraftForge/FML@58f7487cfa Check in patches. Add in some network timeout tweaking values so you can debug the network.
MinecraftForge/FML@e544adba5c More cleanup. Bidirectional server <-> client network works for mods as well as FML|HS now.
MinecraftForge/FML@f5c38e2359 OK, network channels appear to be working well for both dedi and integrated servers. The beginnings of the new mod structure too.
MinecraftForge/FML@9c96a0a10a More network stuff, partially done id syncing.
MinecraftForge/FML@2aaaeba15e ID loading from the server save now works.
2013-12-09 18:45:17 -08:00
Lex Manos 54c440d75c Bump build for gradle fixes:
Now Builds for java 1.6
  Include version,json in universal
  Fixed classpath issues in eclipse task.
2013-11-20 23:44:54 -08:00
LexManos 954d46e587 Merge pull request #868 from luacs1998/patch-1
Update readme for ForgeGradle
2013-11-20 21:47:08 -08:00
Lex Manos 198539479f Updated FML: MinecraftForge/FML@c2b919d339 Don't validate signatures in dev env. 2013-11-20 20:41:20 -08:00
luacs1998 30680d0268 Update README.txt 2013-11-20 22:49:20 +08:00
luacs1998 c1c88644ae Another update for eclipse users 2013-11-20 16:16:48 +08:00
luacs1998 36ce23073c Updated 2013-11-20 16:09:34 +08:00
luacs1998 45e2d12d06 Update readme for ForgeGradle
Let me know if there's anything else to add or change.
2013-11-20 15:49:08 +08:00
Lex Manos e18a7569f8 Fix build file pom closures. 2013-11-19 16:47:50 -08:00
Lex Manos 3470b44e9a Proper configuratuion name for jenkins. 2013-11-19 15:35:06 -08:00
LexManos 23cfb03a3b Merge pull request #867 from GUIpsp/master
Fix gradle wrapper.
2013-11-19 15:15:09 -08:00
Guilherme Espada 918f91bc44 Make the gradle wrapper executable. 2013-11-19 22:37:52 +00:00
LexManos 6ff7584f96 Merge pull request #859 from AbrarSyed/master
Gradlization
2013-11-19 14:13:56 -08:00
Lex Manos b15289113b update build.gradle 2013-11-19 16:00:07 -06:00
Lex Manos 99faaae9f6 Regenerate all patches, No functional change as added this is a formatting change only. 2013-11-18 17:17:45 -08:00
Lex Manos 0999017fda Updated FML:
MinecraftForge/FML@e9a7660cb8 updated samples
MinecraftForge/FML@30894f7afa Merge pull request #307 from AbrarSyed/master
MinecraftForge/FML@c4b8a393f9 Make the working directory the root of the eclipse workspace.
2013-11-18 17:17:22 -08:00
Lex Manos 34f4b58f69 Update run configs. 2013-11-18 16:19:31 -08:00
Lex Manos e9af710cf4 Fix for new FML, and publish to maven local 2013-11-17 12:01:31 -08:00
AbrarSyed 74104fe5d0 Update forge 2013-11-17 12:07:22 -06:00
AbrarSyed f5335d59cc added buildSrc to the gitIgnore 2013-11-14 20:22:31 -06:00
AbrarSyed cdbdd0d6fb fixed versioning and stuff 2013-11-10 00:54:57 -06:00
AbrarSyed 743d10d50e Step 3: The Rebirth 2013-11-09 21:48:53 -06:00
AbrarSyed 797399ff7f Step 2: The Reformation 2013-11-09 15:57:08 -06:00
AbrarSyed 9332673944 update FML for gradle changes 2013-11-09 15:53:05 -06:00
AbrarSyed f9563e5a34 Step 1: The Purge 2013-11-09 15:44:50 -06:00
536 changed files with 20506 additions and 17330 deletions

No files matched your search

+9 -2
View File
@@ -1,7 +1,14 @@
* text eol=lf
*.bat text eol=crlf
*.patch text
*.patch text eol=lf
*.java text eol=lf
*.gradle text eol=crlf
*.png binary
*.exe binary
*.dll binary
*.zip binary
*.jar binary
*.lzma binary
*.zip binary
*.pyd binary
*.cfg text eol=lf
*.py text eol=lf
+22 -8
View File
@@ -1,9 +1,23 @@
*.DS_Store
/logs/
/*.pyc
/forge-*/
/patches-old/
/mcp/
#eclipse
/bin
/.settings
/.classpath
#idea
/.idea
*.iml
#gradle
/build
/.gradle
#occupational hazards
/eclipse/
/target/
/temp/
/repo/
/buildSrc
#Patch rejects
*.rej
/patches-/
# FML changelog
changelog.txt
File renamed without changes.
@@ -24,9 +24,9 @@ the Minecraft sources that are required to have Minecraft Forge working.
1. Scope
--------
The present license is granted to any user of Minecraft Forge. As a
prerequisite, a user of Minecraft Forge must own a legally aquired copy of
Minecraft
The present license is granted to any user of Minecraft Forge, for all files included
unless stated otherwise in the file itself. As a prerequisite, a user of Minecraft
Forge must own a legally aquired copy of Minecraft.
2. Play rights
--------------
+31
View File
@@ -0,0 +1,31 @@
*** HOW TO INSTALL ***
For Mod Users:
Download the latest installer from http://files.minecraftforge.net and follow instructions given by the installer.
For Mod Devs:
Download the latest Forge source distribution from http://files.minecraftforge.net and unzip it to a folder.
Open a command prompt, navigate to the directory where you unzipped the Forge sources, and run:
If you have Gradle: gradle setupDevWorkspace
If you DO NOT have Gradle installed:
Windows: ./gradlew.bat setupDevWorkspace
MacOS/Linux: ./gradlew setupDevWorkspace
If you wish to use the Eclipse IDE, run gradle eclipse instead of gradle setupDevWorkspace, or install the Gradle plugin for Eclipse and import the Forge source folder as a Gradle project.
For Contributors: (Note: This assumes you have Gradle installed. If you don't, use ./gradlew(.bat) instead of gradle.
Clone this repository to a folder.
Open a command prompt and navigate to the folder where you cloned this repo.
Run gradle setupForge to setup your development environment.
To use Eclipse, point your Eclipse workspace at the eclipse folder inside the repo.
Requirements (for both mod devs and contributors):
You must have a JDK installed and accessible.
If you do not wish to use the gradle wrapper, you can install Gradle from http://www.gradle.org/ .
-95
View File
@@ -1,95 +0,0 @@
import os
import sys
import fnmatch
import shlex
import difflib
import time, subprocess
from optparse import OptionParser
def cmdsplit(args):
if os.sep == '\\':
args = args.replace('\\', '\\\\')
return shlex.split(args)
def main():
print("Applying patches")
parser = OptionParser()
parser.add_option('-m', '--mcp-dir', action='store', dest='mcp_dir', help='Path to MCP', default=None)
parser.add_option('-p', '--patch-dir', action='store', dest='patch_dir', help='Patches Directory', default=None)
parser.add_option('-t', '--target-dir', action='store', dest='target_dir', help='Target Directory', default=None)
options, _ = parser.parse_args()
if options.mcp_dir is None:
print 'Must supply MCP directory with --mcp-dir'
return
elif options.patch_dir is None:
print 'Must supply patches directory with --patch-dir'
return
elif options.target_dir is None:
print 'Must supplt target directory with --target-dir'
return
print "Applying patches from '%s' to '%s'" % (options.patch_dir, options.target_dir)
apply_patches(options.mcp_dir, options.patch_dir, options.target_dir)
def apply_patches(mcp_dir, patch_dir, target_dir, find=None, rep=None):
# Attempts to apply a directory full of patch files onto a target directory.
sys.path.append(mcp_dir)
temp = os.path.abspath('temp.patch')
cmd = cmdsplit('patch -p2 -i "%s" ' % temp)
if os.name == 'nt':
applydiff = os.path.abspath(os.path.join(mcp_dir, 'runtime', 'bin', 'applydiff.exe'))
cmd = cmdsplit('"%s" -uf -p2 -i "%s"' % (applydiff, temp))
for path, _, filelist in os.walk(patch_dir, followlinks=True):
for cur_file in fnmatch.filter(filelist, '*.patch'):
patch_file = os.path.normpath(os.path.join(patch_dir, path[len(patch_dir)+1:], cur_file))
target_file = os.path.join(target_dir, fix_patch(patch_file, temp, find, rep))
process = subprocess.Popen(cmd, cwd=target_dir, bufsize=-1)
process.communicate()
if os.path.isfile(temp):
os.remove(temp)
def fix_patch(in_file, out_file, find=None, rep=None):
#Fixes the following issues in the patch file if they exist:
# Normalizes the path seperators for the current OS
# Normalizes the line endings
# Returns the path that the file wants to apply to
in_file = os.path.normpath(in_file)
if out_file is None:
tmp_file = in_file + '.tmp'
else:
out_file = os.path.normpath(out_file)
tmp_file = out_file
dir_name = os.path.dirname(out_file)
if dir_name:
if not os.path.exists(dir_name):
os.makedirs(dir_name)
file = 'not found'
with open(in_file, 'rb') as inpatch:
with open(tmp_file, 'wb') as outpatch:
for line in inpatch:
line = line.rstrip('\r\n')
if line[:3] in ['+++', '---', 'Onl', 'dif']:
if not find == None and not rep == None:
line = line.replace('\\', '/').replace(find, rep).replace('/', os.sep)
else:
line = line.replace('\\', '/').replace('/', os.sep)
outpatch.write(line + os.linesep)
else:
outpatch.write(line + os.linesep)
if line[:3] == '---':
file = line[line.find(os.sep, line.find(os.sep)+1)+1:]
if out_file is None:
shutil.move(tmp_file, in_file)
return file
if __name__ == '__main__':
main()
+122
View File
@@ -0,0 +1,122 @@
buildscript {
repositories {
mavenCentral()
mavenLocal()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
configurations {
deployJars
}
import static net.minecraftforge.gradle.dev.ForgeDevPlugin.*
apply plugin: 'maven'
apply plugin: 'forgedev'
repositories {
mavenLocal()
flatDir {
name "fileRepo"
dirs "repo"
}
}
minecraft {
version = '1.7.2'
mcpVersion = '9.03'
fmlDir = projectDir.getAbsolutePath() + "/fml";
mainClass = 'cpw.mods.fml.relauncher.ServerLaunchWrapper'
tweakClass = 'cpw.mods.fml.common.launcher.FMLTweaker'
installerVersion = "1.4"
}
group = 'net.minecraftforge'
version = getVersionFromJava(getProject(), 'src/main/java/net/minecraftforge/common/ForgeVersion.java')
jenkins {
job = 'minecraftforge'
}
launch4j {
jreMinVersion = '1.6.0'
}
uploadArchives {
repositories {
add getProject().repositories.mavenLocal()
}
repositories.mavenDeployer {
configuration = configurations.deployJars
if (project.hasProperty("filesmaven")) {
logger.info('Publishing to files server')
repository(url: project.filesmaven.url) {
authentication(userName: project.filesmaven.username, privateKey: project.filesmaven.key)
}
} else {
logger.info('Publishing to repo folder')
repository(url: 'file://localhost/' + project.file('repo').getAbsolutePath())
}
pom {
groupId = project.group
version = project.version
artifactId = project.archivesBaseName
}
pom.project {
name project.archivesBaseName
packaging 'jar'
description 'Minecraft Forge API'
url 'https://github.com/MinecraftForge/MinecraftForge'
scm {
url 'https://github.com/MinecraftForge/MinecraftForge'
connection 'scm:git:git://github.com/MinecraftForge/MinecraftForge.git'
developerConnection 'scm:git:[email protected]:MinecraftForge/MinecraftForge.git'
}
issueManagement {
system 'github'
url 'https://github.com/MinecraftForge/MinecraftForge/issues'
}
licenses {
license {
name 'Forge Public License'
url 'https://raw.github.com/MinecraftForge/MinecraftForge/master/MinecraftForge-License.txt'
distribution 'repo'
}
}
developers {
developer {
id 'cpw'
name 'cpw'
roles { role 'developer' }
}
developer {
id 'LexManos'
name 'Lex Manos'
roles { role 'developer' }
}
developer {
id 'AbrarSyed'
name 'Abrar Syed'
roles { role 'contributor' }
}
}
}
}
}
-34
View File
@@ -1,34 +0,0 @@
import os, os.path, sys
from optparse import OptionParser
forge_dir = os.path.dirname(os.path.abspath(__file__))
mcp_dir = os.path.abspath('..')
from forge import build_forge_dev
def main():
parser = OptionParser()
parser.add_option('-m', '--mcp-dir', action='store', dest='mcp_dir', help='MCP Path', default=None)
parser.add_option('-b', '--build', action='store', dest='build', help='Build number', default=None)
options, _ = parser.parse_args()
build_num = 0
if not options.build is None:
try:
build_num = int(options.build)
except:
pass
fml_dir = os.path.join(forge_dir, 'fml')
mcp_dir = os.path.join(forge_dir, 'mcp')
if not options.mcp_dir is None:
mcp_dir = os.path.abspath(options.mcp_dir)
elif os.path.isfile(os.path.join('..', 'runtime', 'commands.py')):
mcp_dir = os.path.abspath('..')
sys.exit(build_forge_dev(mcp_dir, forge_dir, fml_dir, build_num))
if __name__ == '__main__':
main()
-113
View File
@@ -1,113 +0,0 @@
import os, os.path, sys, re
import json, urllib2
from pprint import pprint
from urlparse import urlparse
import base64
import optparse, ast
class PreemptiveBasicAuthHandler(urllib2.BaseHandler):
def __init__(self, password_mgr=None):
if password_mgr is None:
password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
self.passwd = password_mgr
self.add_password = self.passwd.add_password
def http_request(self,req):
uri = req.get_full_url()
user, pw = self.passwd.find_user_password(None,uri)
if pw is None: return req
raw = "%s:%s" % (user, pw)
auth = 'Basic %s' % base64.b64encode(raw).strip()
req.add_unredirected_header('Authorization', auth)
return req
def https_request(self,req):
return self.http_request(req)
def read_url(url):
handler = PreemptiveBasicAuthHandler()
handler.add_password(None, 'ci.jenkins.minecraftforge.net', 'console_script', 'dc6d48ca20a474beeac280a9a16a926e')
file = urllib2.build_opener(handler).open(url)
data = file.read()
file.close()
return data
def getBuildInfo(url, current_version=None):
data = read_url(url)
data = ast.literal_eval(data)['allBuilds']
data = sorted(data, key=lambda key: key['number'], reverse=False)
items = []
output = []
for build in data:
build['actions'] = filter(lambda act: act is not None, build['actions'])
build['actions'] = filter(lambda act: 'text' in act, build['actions'])
build['actions'] = filter(lambda act: not ' ' in act['text'], build['actions'])
if len(build['actions']) == 0:
build['version'] = current_version
current_version = None
else:
build['version'] = build['actions'][0]['text']
build['items'] = build['changeSet']['items']
for item in build['items']:
item['author'] = item['author']['fullName']
if build['result'] != 'SUCCESS':
items += build['items']
else:
build['items'] = items + build['items']
items = []
output += [build]
build.pop('changeSet')
build.pop('actions')
return sorted(output, key=lambda key: key['number'], reverse=True)
def add_latest_build(url, builds, current_version=None):
data = read_url(url)
data = ast.literal_eval(data)
number = data['number']
if builds[0]['number'] == data['number']:
return builds
for item in data['changeSet']['items']:
item['author'] = item['author']['fullName']
build = {
'number' : data['number'],
'result' : 'SUCCESS', #Currently build should always be success... Else things derp after words
'version' : current_version,
'items' : data['changeSet']['items']
}
return [build] + builds
def make_changelog(job_path, target_build, change_file, current_version=None):
builds = getBuildInfo('%s/api/python?tree=allBuilds[result,number,actions[text],changeSet[items[author[fullName],comment]]]&pretty=true' % job_path, current_version)
builds = add_latest_build('%s/lastBuild/api/python?pretty=true&tree=number,changeSet[items[author[fullName],comment]]' % job_path, builds, current_version)
log = [ "Changelog:" ]
for build in builds:
if int(build['number']) > target_build: continue
if len(build['items']) == 0: continue
log.append('')
if build['version'] is None:
log.append('Build %s' % build['number'])
else:
log.append('Build %s' % build['version'])
for change in build['items']:
comments = filter(lambda cmt: len(cmt) > 0, change['comment'].split('\n'))
if len(comments) > 1:
log.append('\t' + change['author'])
for comment in comments:
log.append('\t\t' + comment)
elif len(comments) == 1:
log.append('\t%s: %s' % (change['author'], comments[0]))
file = open(change_file, 'wb')
for line in log:
file.write('%s\n' % line)
file.close()
if __name__ == '__main__':
make_changelog("http://ci.jenkins.minecraftforge.net/job/minecraftforge/", 70000, 'changelog.txt', 'pinecone')
@@ -1,44 +0,0 @@
package net.minecraftforge.client;
import net.minecraft.world.EnumGameType;
import net.minecraft.util.EnumOS;
import net.minecraft.client.settings.EnumOptions;
import net.minecraft.item.EnumRarity;
import net.minecraftforge.common.EnumHelper;
public class EnumHelperClient extends EnumHelper
{
private static Class[][] clentTypes =
{
{EnumGameType.class, int.class, String.class},
{EnumOptions.class, String.class, boolean.class, boolean.class},
{EnumOS.class},
{EnumRarity.class, int.class, String.class}
};
public static EnumGameType addGameType(String name, int id, String displayName)
{
return addEnum(EnumGameType.class, name, id, displayName);
}
public static EnumOptions addOptions(String name, String langName, boolean isSlider, boolean isToggle)
{
return addEnum(EnumOptions.class, name, langName, isSlider, isToggle);
}
public static EnumOS addOS2(String name)
{
return addEnum(EnumOS.class, name);
}
public static EnumRarity addRarity(String name, int color, String displayName)
{
return addEnum(EnumRarity.class, name, color, displayName);
}
public static <T extends Enum<? >> T addEnum(Class<T> enumType, String enumName, Object... paramValues)
{
return addEnum(clentTypes, enumType, enumName, paramValues);
}
}
@@ -1,128 +0,0 @@
package net.minecraftforge.client;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.gui.GuiControls;
import net.minecraft.client.gui.GuiSlot;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
public class GuiControlsScrollPanel extends GuiSlot
{
protected static final ResourceLocation WIDGITS = new ResourceLocation("textures/gui/widgets.png");
private GuiControls controls;
private GameSettings options;
private Minecraft mc;
private String[] message;
private int _mouseX;
private int _mouseY;
private int selected = -1;
public GuiControlsScrollPanel(GuiControls controls, GameSettings options, Minecraft mc)
{
super(mc, controls.width, controls.height, 16, (controls.height - 32) + 4, 25);
this.controls = controls;
this.options = options;
this.mc = mc;
}
@Override
protected int getSize()
{
return options.keyBindings.length;
}
@Override
protected void elementClicked(int i, boolean flag)
{
if (!flag)
{
if (selected == -1)
{
selected = i;
}
else
{
options.setKeyBinding(selected, -100);
selected = -1;
KeyBinding.resetKeyBindingArrayAndHash();
}
}
}
@Override
protected boolean isSelected(int i)
{
return false;
}
@Override
protected void drawBackground() {}
@Override
public void drawScreen(int mX, int mY, float f)
{
_mouseX = mX;
_mouseY = mY;
if (selected != -1 && !Mouse.isButtonDown(0) && Mouse.getDWheel() == 0)
{
if (Mouse.next() && Mouse.getEventButtonState())
{
options.setKeyBinding(selected, -100 + Mouse.getEventButton());
selected = -1;
KeyBinding.resetKeyBindingArrayAndHash();
}
}
super.drawScreen(mX, mY, f);
}
@Override
protected void drawSlot(int index, int xPosition, int yPosition, int l, Tessellator tessellator)
{
int width = 70;
int height = 20;
xPosition -= 20;
boolean flag = _mouseX >= xPosition && _mouseY >= yPosition && _mouseX < xPosition + width && _mouseY < yPosition + height;
int k = (flag ? 2 : 1);
mc.renderEngine.bindTexture(WIDGITS);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
controls.drawTexturedModalRect(xPosition, yPosition, 0, 46 + k * 20, width / 2, height);
controls.drawTexturedModalRect(xPosition + width / 2, yPosition, 200 - width / 2, 46 + k * 20, width / 2, height);
controls.drawString(mc.fontRenderer, options.getKeyBindingDescription(index), xPosition + width + 4, yPosition + 6, 0xFFFFFFFF);
boolean conflict = false;
for (int x = 0; x < options.keyBindings.length; x++)
{
if (x != index && options.keyBindings[x].keyCode == options.keyBindings[index].keyCode)
{
conflict = true;
break;
}
}
String str = (conflict ? EnumChatFormatting.RED : "") + options.getOptionDisplayString(index);
str = (index == selected ? EnumChatFormatting.WHITE + "> " + EnumChatFormatting.YELLOW + "??? " + EnumChatFormatting.WHITE + "<" : str);
controls.drawCenteredString(mc.fontRenderer, str, xPosition + (width / 2), yPosition + (height - 8) / 2, 0xFFFFFFFF);
}
public boolean keyTyped(char c, int i)
{
if (selected != -1)
{
options.setKeyBinding(selected, i);
selected = -1;
KeyBinding.resetKeyBindingArrayAndHash();
return false;
}
return true;
}
}
@@ -1,14 +0,0 @@
package net.minecraftforge.client.event;
import net.minecraftforge.event.Cancelable;
import net.minecraftforge.event.Event;
@Cancelable
public class ClientChatReceivedEvent extends Event
{
public String message;
public ClientChatReceivedEvent(String message)
{
this.message = message;
}
}
@@ -1,20 +0,0 @@
package net.minecraftforge.client.event.sound;
import net.minecraft.client.audio.SoundManager;
public class PlaySoundSourceEvent extends SoundEvent
{
public final SoundManager manager;
public final String name;
public final float x;
public final float y;
public final float z;
public PlaySoundSourceEvent(SoundManager manager, String name, float x, float y, float z)
{
this.manager = manager;
this.name = name;
this.x = x;
this.y = y;
this.z = z;
}
}
@@ -1,20 +0,0 @@
package net.minecraftforge.client.event.sound;
import net.minecraft.client.audio.SoundManager;
public class PlayStreamingSourceEvent extends SoundEvent
{
public final SoundManager manager;
public final String name;
public final float x;
public final float y;
public final float z;
public PlayStreamingSourceEvent(SoundManager manager, String name, float x, float y, float z)
{
this.manager = manager;
this.name = name;
this.x = x;
this.y = y;
this.z = z;
}
}
@@ -1,19 +0,0 @@
package net.minecraftforge.client.event.sound;
import net.minecraft.entity.Entity;
import net.minecraft.client.audio.SoundManager;
import net.minecraft.client.audio.SoundPoolEntry;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Cancelable;
import net.minecraftforge.event.Event;
public class SoundEvent extends Event
{
public SoundEvent(){}
public static SoundPoolEntry getResult(SoundResultEvent event)
{
MinecraftForge.EVENT_BUS.post(event);
return event.result;
}
}
-5
View File
@@ -1,5 +0,0 @@
commands.forge.usage=Use /forge <subcommand>. Subcommands are tps, track
commands.forge.usage.tracking=Use /forge track <type> <duration>. Valid types are te (Tile Entities). Duration is < 60.
commands.forge.tps.summary=%s : Mean tick time: %d ms. Mean TPS: %d
commands.forge.tracking.te.enabled=Tile Entity tracking enabled for %d seconds.
-160
View File
@@ -1,160 +0,0 @@
#Main Forge Access Transformer configuration file
# Tessellator
public-f bfq.a #FD:Tessellator/field_78398_a #instance
public bfq.u #FD:Tessellator/field_78409_u #drawMode
public bfq.v #FD:Tessellator/field_78408_v #xOffset
public bfq.w #FD:Tessellator/field_78407_w #yOffset
public bfq.x #FD:Tessellator/field_78417_x #zOffset
public bfq.z #FD:Tessellator/field_78415_z #isDrawing
# ItemPickaxe
public yn.<init>(ILyd;)V #MD:ItemPickaxe/<init>(ILnet/minecraft/src/EnumToolMaterial;) #constructor
public+f yn.c #FD:ItemPickaxe/field_77867_c #blocksEffectiveAgainst
# ItemAxe
public ya.<init>(ILyd;)V #MD:ItemAxe/<init>(ILnet/minecraft/src/EnumToolMaterial;) #constructor
public+f ya.c #FD:ItemAxe/field_77868_c #blocksEffectiveAgainst
# ItemSpade
public yy.<init>(ILyd;)V #MD:ItemSpade/<init>(ILnet/minecraft/src/EnumToolMaterial;) #constructor
public+f yy.c #FD:ItemSpade/field_77866_c #blocksEffectiveAgainst
# ItemTool
public xj.a #FD:ItemTool/field_77864_a #efficiencyOnProperMaterial
public xj.d #FD:ItemTool/field_77865_bY #damageVsEntity
# EntityEnderman
public tg.br #FD:EntityEnderman/field_70827_d #carriableBlocks
# RenderGlobal
public bfl.k #FD:RenderGlobal/field_72769_h #theWorld
public bfl.l #FD:RenderGlobal/field_72770_i #renderEngine
public bfl.t #FD:RenderGlobal/field_72777_q #mc
public bfl.u #FD:RenderGlobal/field_72776_r #globalRenderBlocks
public bfl.H #FD:RenderGlobal/field_72738_E #damagedBlocks
# SoundManager
public bln.b #FD:SoundManager/field_77381_a #sndSystem
public bln.d #FD:SoundManager/field_77379_b #soundPoolSounds
public bln.e #FD:SoundManager/field_77380_c #soundPoolStreaming
public bln.f #FD:SoundManager/field_77377_d #soundPoolMusic
# EntityMinecart
protected st.* #FD:EntityMinecart/* # All private -> protected
# Block
public aqz.<init>(ILakc;)V #MD:Block/<init>(ILnet/minecraft/src/Material;) #Constructor
public aqz.<init>(IILakc;)V #MD:Block/<init>(IILnet/minecraft/src/Material;) #Constructor
public aqz.cH #FD:Block/field_72029_cc #blockResistance
public aqz.cG #FD:Block/field_71989_cb #blockHardness
public aqz.d(Ljava/lang/String;)Laqz; #MD:Block/func_111022_d #setIconName
public aqz.a(Lard;)Laqz; #MD:Block/func_71884_a #setStepSound
public aqz.b(F)Laqz; #MD:Block/func_71894_b #setResistance
public aqz.c(F)Laqz; #MD:Block/func_71848_c #setHardness
public aqz.k(I)Laqz; #MD:Block/func_71868_h #setLightOpacity
public aqz.a(F)Laqz; #MD:Block/func_71900_a #setLightValue
public aqz.r()Laqz; #MD:Block/func_71875_q #setBlockUnbreakable
public aqz.b(Z)Laqz; #MD:Block/func_71907_b #setTickRandomly
public aqz.a(FFFFFF)V #MD:Block/func_71905_a #setBlockBounds
public aqz.j(Labw;IIII)V #MD:Block/func_71923_g #dropXpOnBlockBreak
# NetServerHandler
public ka.f #FD:NetServerHandler/field_72572_g #playerInAirTime
# TileEntity
public asp.k #FD:TileEntity/field_70331_k #worldObj
# BlockLeavesBase
public arh.d #FD:BlockLeavesBase/field_72131_c #graphicsLevel
# Item
public yc.<init>(I)V #MD:Item/<init>(I) #Constructor
public yc.e(I)Lyc; #MD:Item/func_77656_e #setMaxDamage
public-f yc.h(Lye;)Lms; #MD:Item/func_77650_f #getIconIndex
public yc.c(Ljava/lang/String;)Lyc; #MD:Item/func_77631_c #setPotionEffect
public yc.d(Ljava/lang/String;)Lyc; #MD:Item/func_111206_d #setIconName
# RailLogic
public amz #CL:BlockBaseRailLogic
public amz.a()I #MD:BlockBaseRailLogic/func_94505_a #getNAdjacentTiles
# EntityPlayer
public uf.a(Lss;)V #MD:EntityPlayer/func_71012_a #joinEntityItemWithWorld
public uf.i()V #MD:EntityPlayer/func_71053_j #closeScreen
public uf.b #FD:EntityPlayer/field_71076_b #sleepTimer
# EntityPlayerMP
public bdi.a(Lss;)V #MD:EntityClientPlayerMP/func_71012_a #joinEntityItemWithWorld
# World Gen Chests Related
public mk.* #FD:WeightedRandomChestContent/* #all
public js.T #FD:WorldServer/field_73069_S #bonusChestContent
public agh.a #FD:StructureMineshaftPieces/field_78818_a #mineshaftChestContents
public ahl.i #FD:ComponentScatteredFeatureDesertPyramid/field_74941_i #itemsToGenerateInTemple
public ahm.l #FD:ComponentScatteredFeatureJunglePyramid/field_74943_l #junglePyramidsChestContents
public ahm.m #FD:ComponentScatteredFeatureJunglePyramid/field_74944_m #junglePyramidsDispenserContents
public ahw.a #FD:ComponentStrongholdChestCorridor/field_75003_a #strongholdChestContents
public aia.a #FD:ComponentStrongholdLibrary/field_75007_b #strongholdLibraryChestContents
public aif.b #FD:ComponentStrongholdRoomCrossing/field_75014_c #strongholdCorridorChestContents
public aji.a #FD:ComponentVillageHouse2/field_74918_a #villageBlacksmithChestContents
public afp.a #FD:WorldGenDungeons/field_111189_a #chestContents
# AnvilChunkLoader.chunkSaveLocation
public aee.d #FD:AnvilChunkLoader/field_75825_d
# ChunkProviderServer.currentChunkLoader
public jr.e #FD:ChunkProviderServer/field_73247_e
# PlayerManager
public jp.a(IIZ)Ljq; #MD:PlayerManager/func_72690_a #getOrCreateChunkWatcher
# PlayerInstance
public jq #CL:PlayerInstance
# World
public-f abw.A #FD:World/field_72982_D #villageCollectionObj
public abw.G #FD:World/field_72993_I #activeChunkSet
# EntityLiving
public og.b #FD:EntityLiving/field_70728_aV #experienceValue
public og.d #FD:EntityLiving/field_70715_bh #targetTasks
# GuiFlatPresets
public avz.a(Ljava/lang/String;ILacq;Ljava/util/List;[Lagd;)V #MD:GuiFlatPresets/func_82294_a
public avz.a(Ljava/lang/String;ILacq;[Lagd;)V #MD:GuiFlatPresets/func_82297_a
# BiomeGenBase
public acq.*() #MD:BiomeGenBase/* #Everything protected->public
# MapGenVillage
public-f aiw.e #FD:MapGenVillage/field_75055_e #villageSpawnBiomes
# ShapedRecipes
public+f aai.d #FD:ShapedRecipes/field_77574_d #recipeItems
public+f aai.b #FD:ShapedRecipes/field_77576_b #recipeWidth
public+f aai.c #FD:ShapedRecipes/field_77577_c #recipeHeight
# ShapelessRecipes
public aaj.b #FD:ShapelessRecipes/field_77579_b #recipeItems
# GuiContainer
protected awy.a(Lwe;)V #MD:GuiContainer/func_74192_a #drawSlotInventory
# ContainerPlayer
protected vv.h #FD:ContainerPlayer/field_82862_h #player
# BlockButton
protected anf.n(Labw;III)V #MD:BlockButton/func_82535_o #checkActivation
protected-f anf.a #FD:BlockButton/field_82537_a #sensible
# BiomeDecorator
public acu.* #FD:BiomeDecorator/* # All private -> protected
# CreativeTabs
public-f ww.a #FD:CreativeTabs/field_78032_a # creativeTabArray non-final
# Packet
public ey.a(IZZLjava/lang/Class;)V #MD:Packet/func_73285_a #addIdClassMapping
# SaveHandler
public alq.b()Ljava/io/File; #MD:SaveHandler/func_75765_b
# World stuff
public abw.b(Lnn;)V #MD:World/func_72847_b #releaseEntitySkin
public abw.m #FD:World/field_73003_n #prevRainingStrength
public abw.n #FD:World/field_73004_o #rainingStrength
public abw.p #FD:World/field_73017_q #thunderingStrength
public abw.o #FD:World/field_73018_p #prevThunderingStrength
#WorldClient
public bdd.b(Lnn;)V #MD:WorldClient/func_72847_b #releaseEntitySkin
#WorldServer
public js.b(Lnn;)V #MD:WorldServer/func_72847_b #releaseEntitySkin
public js.N #FD:WorldServer/field_73068_P #allPlayersSleeping
#TextureMap
public bik.g #FD:TextureMap/field_94255_a
public bik.h #FD:TextureMap/field_94254_c
#Potion
public ni.b(II)Lni; #MD:Potion/func_76399_b #setIconIndex
#PotionHelper
public zp.m #FD:PotionHelper/field_77927_l #potionRequirements
public zp.n #FD:PotionHelper/field_77928_m #potionAmplifiers
#PotionEffect
public nj.b #FD:PotionEffect/field_76460_b #duration
#BlockFluid
protected apc.a #FD:BlockFluid/field_94425_a #theIcon
#GuiIngame
protected avj.* #FD:GuiIngame/* # All private -> protected
protected avj.*() #MD:GuiIngame/* # All private -> protected
#ItemStack
default ye.f #FD:ItemStack/field_77991_e # make default access for itemDamage
#GuiSlot
protected awg.b(IIII)V #MD:GuiSlot/func_77206_b #overlayBackground
#EntityPlayer
public uf.bu #FD:EntityPlayer/field_71092_bJ #username
#MapGenStructureIO
public air.b(Ljava/lang/Class;Ljava/lang/String;)V #MD:MapGenStructureIO/func_143034_b #registerStart
public air.a(Ljava/lang/Class;Ljava/lang/String;)V #MD:MapGenStructureIO/func_143031_a #registerPiece
@@ -1,70 +0,0 @@
package net.minecraftforge.common;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.ChunkProviderGenerate;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.structure.MapGenStronghold;
import net.minecraft.world.gen.structure.MapGenVillage;
import net.minecraft.world.biome.WorldChunkManager;
import com.google.common.collect.Lists;
public class BiomeManager
{
public static void addVillageBiome(BiomeGenBase biome, boolean canSpawn)
{
if (!MapGenVillage.villageSpawnBiomes.contains(biome))
{
ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
biomes.add(biome);
MapGenVillage.villageSpawnBiomes = biomes;
}
}
public static void removeVillageBiome(BiomeGenBase biome)
{
if (MapGenVillage.villageSpawnBiomes.contains(biome))
{
ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
biomes.remove(biome);
MapGenVillage.villageSpawnBiomes = biomes;
}
}
public static void addStrongholdBiome(BiomeGenBase biome)
{
if (!MapGenStronghold.allowedBiomes.contains(biome))
{
MapGenStronghold.allowedBiomes.add(biome);
}
}
public static void removeStrongholdBiome(BiomeGenBase biome)
{
if (MapGenStronghold.allowedBiomes.contains(biome))
{
MapGenStronghold.allowedBiomes.remove(biome);
}
}
public static void addSpawnBiome(BiomeGenBase biome)
{
if (!WorldChunkManager.allowedBiomes.contains(biome))
{
WorldChunkManager.allowedBiomes.add(biome);
}
}
public static void removeSpawnBiome(BiomeGenBase biome)
{
if (WorldChunkManager.allowedBiomes.contains(biome))
{
WorldChunkManager.allowedBiomes.remove(biome);
}
}
}
@@ -1,927 +0,0 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraftforge.common;
import static net.minecraftforge.common.Property.Type.BOOLEAN;
import static net.minecraftforge.common.Property.Type.DOUBLE;
import static net.minecraftforge.common.Property.Type.INTEGER;
import static net.minecraftforge.common.Property.Type.STRING;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PushbackInputStream;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import com.google.common.base.CharMatcher;
import com.google.common.collect.ImmutableSet;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.FMLInjectionData;
/**
* This class offers advanced configurations capabilities, allowing to provide
* various categories for configuration variables.
*/
public class Configuration
{
private static boolean[] configMarkers = new boolean[Item.itemsList.length];
private static final int ITEM_SHIFT = 256;
private static final int MAX_BLOCKS = 4096;
public static final String CATEGORY_GENERAL = "general";
public static final String CATEGORY_BLOCK = "block";
public static final String CATEGORY_ITEM = "item";
public static final String ALLOWED_CHARS = "._-";
public static final String DEFAULT_ENCODING = "UTF-8";
public static final String CATEGORY_SPLITTER = ".";
public static final String NEW_LINE;
private static final Pattern CONFIG_START = Pattern.compile("START: \"([^\\\"]+)\"");
private static final Pattern CONFIG_END = Pattern.compile("END: \"([^\\\"]+)\"");
public static final CharMatcher allowedProperties = CharMatcher.JAVA_LETTER_OR_DIGIT.or(CharMatcher.anyOf(ALLOWED_CHARS));
private static Configuration PARENT = null;
File file;
private Map<String, ConfigCategory> categories = new TreeMap<String, ConfigCategory>();
private Map<String, Configuration> children = new TreeMap<String, Configuration>();
private boolean caseSensitiveCustomCategories;
public String defaultEncoding = DEFAULT_ENCODING;
private String fileName = null;
public boolean isChild = false;
private boolean changed = false;
static
{
Arrays.fill(configMarkers, false);
NEW_LINE = System.getProperty("line.separator");
}
public Configuration(){}
/**
* Create a configuration file for the file given in parameter.
*/
public Configuration(File file)
{
this.file = file;
String basePath = ((File)(FMLInjectionData.data()[6])).getAbsolutePath().replace(File.separatorChar, '/').replace("/.", "");
String path = file.getAbsolutePath().replace(File.separatorChar, '/').replace("/./", "/").replace(basePath, "");
if (PARENT != null)
{
PARENT.setChild(path, this);
isChild = true;
}
else
{
fileName = path;
load();
}
}
public Configuration(File file, boolean caseSensitiveCustomCategories)
{
this(file);
this.caseSensitiveCustomCategories = caseSensitiveCustomCategories;
}
/**
* Gets or create a block id property. If the block id property key is
* already in the configuration, then it will be used. Otherwise,
* defaultId will be used, except if already taken, in which case this
* will try to determine a free default id.
*/
public Property getBlock(String key, int defaultID) { return getBlock(CATEGORY_BLOCK, key, defaultID, null); }
public Property getBlock(String key, int defaultID, String comment) { return getBlock(CATEGORY_BLOCK, key, defaultID, comment); }
public Property getBlock(String category, String key, int defaultID) { return getBlockInternal(category, key, defaultID, null, 256, Block.blocksList.length); }
public Property getBlock(String category, String key, int defaultID, String comment) { return getBlockInternal(category, key, defaultID, comment, 256, Block.blocksList.length); }
/**
* Special version of getBlock to be used when you want to garentee the ID you get is below 256
* This should ONLY be used by mods who do low level terrain generation, or ones that add new
* biomes.
* EXA: ExtraBiomesXL
*
* Specifically, if your block is used BEFORE the Chunk is created, and placed in the terrain byte array directly.
* If you add a new biome and you set the top/filler block, they need to be <256, nothing else.
*
* If you're adding a new ore, DON'T call this function.
*
* Normal mods such as '50 new ores' do not need to be below 256 so should use the normal getBlock
*/
public Property getTerrainBlock(String category, String key, int defaultID, String comment)
{
return getBlockInternal(category, key, defaultID, comment, 0, 256);
}
private Property getBlockInternal(String category, String key, int defaultID, String comment, int lower, int upper)
{
Property prop = get(category, key, -1, comment);
if (prop.getInt() != -1)
{
configMarkers[prop.getInt()] = true;
return prop;
}
else
{
if (defaultID < lower)
{
FMLLog.warning(
"Mod attempted to get a block ID with a default in the Terrain Generation section, " +
"mod authors should make sure there defaults are above 256 unless explicitly needed " +
"for terrain generation. Most ores do not need to be below 256.");
FMLLog.warning("Config \"%s\" Category: \"%s\" Key: \"%s\" Default: %d", fileName, category, key, defaultID);
defaultID = upper - 1;
}
if (Block.blocksList[defaultID] == null && !configMarkers[defaultID])
{
prop.set(defaultID);
configMarkers[defaultID] = true;
return prop;
}
else
{
for (int j = upper - 1; j > 0; j--)
{
if (Block.blocksList[j] == null && !configMarkers[j])
{
prop.set(j);
configMarkers[j] = true;
return prop;
}
}
throw new RuntimeException("No more block ids available for " + key);
}
}
}
public Property getItem(String key, int defaultID) { return getItem(CATEGORY_ITEM, key, defaultID, null); }
public Property getItem(String key, int defaultID, String comment) { return getItem(CATEGORY_ITEM, key, defaultID, comment); }
public Property getItem(String category, String key, int defaultID) { return getItem(category, key, defaultID, null); }
public Property getItem(String category, String key, int defaultID, String comment)
{
Property prop = get(category, key, -1, comment);
int defaultShift = defaultID + ITEM_SHIFT;
if (prop.getInt() != -1)
{
configMarkers[prop.getInt() + ITEM_SHIFT] = true;
return prop;
}
else
{
if (defaultID < MAX_BLOCKS - ITEM_SHIFT)
{
FMLLog.warning(
"Mod attempted to get a item ID with a default value in the block ID section, " +
"mod authors should make sure there defaults are above %d unless explicitly needed " +
"so that all block ids are free to store blocks.", MAX_BLOCKS - ITEM_SHIFT);
FMLLog.warning("Config \"%s\" Category: \"%s\" Key: \"%s\" Default: %d", fileName, category, key, defaultID);
}
if (Item.itemsList[defaultShift] == null && !configMarkers[defaultShift] && defaultShift >= Block.blocksList.length)
{
prop.set(defaultID);
configMarkers[defaultShift] = true;
return prop;
}
else
{
for (int x = Item.itemsList.length - 1; x >= ITEM_SHIFT; x--)
{
if (Item.itemsList[x] == null && !configMarkers[x])
{
prop.set(x - ITEM_SHIFT);
configMarkers[x] = true;
return prop;
}
}
throw new RuntimeException("No more item ids available for " + key);
}
}
}
public Property get(String category, String key, int defaultValue)
{
return get(category, key, defaultValue, null);
}
public Property get(String category, String key, int defaultValue, String comment)
{
Property prop = get(category, key, Integer.toString(defaultValue), comment, INTEGER);
if (!prop.isIntValue())
{
prop.set(defaultValue);
}
return prop;
}
public Property get(String category, String key, boolean defaultValue)
{
return get(category, key, defaultValue, null);
}
public Property get(String category, String key, boolean defaultValue, String comment)
{
Property prop = get(category, key, Boolean.toString(defaultValue), comment, BOOLEAN);
if (!prop.isBooleanValue())
{
prop.set(defaultValue);
}
return prop;
}
public Property get(String category, String key, double defaultValue)
{
return get(category, key, defaultValue, null);
}
public Property get(String category, String key, double defaultValue, String comment)
{
Property prop = get(category, key, Double.toString(defaultValue), comment, DOUBLE);
if (!prop.isDoubleValue())
{
prop.set(defaultValue);
}
return prop;
}
public Property get(String category, String key, String defaultValue)
{
return get(category, key, defaultValue, null);
}
public Property get(String category, String key, String defaultValue, String comment)
{
return get(category, key, defaultValue, comment, STRING);
}
public Property get(String category, String key, String[] defaultValue)
{
return get(category, key, defaultValue, null);
}
public Property get(String category, String key, String[] defaultValue, String comment)
{
return get(category, key, defaultValue, comment, STRING);
}
public Property get(String category, String key, int[] defaultValue)
{
return get(category, key, defaultValue, null);
}
public Property get(String category, String key, int[] defaultValue, String comment)
{
String[] values = new String[defaultValue.length];
for (int i = 0; i < defaultValue.length; i++)
{
values[i] = Integer.toString(defaultValue[i]);
}
Property prop = get(category, key, values, comment, INTEGER);
if (!prop.isIntList())
{
prop.set(values);
}
return prop;
}
public Property get(String category, String key, double[] defaultValue)
{
return get(category, key, defaultValue, null);
}
public Property get(String category, String key, double[] defaultValue, String comment)
{
String[] values = new String[defaultValue.length];
for (int i = 0; i < defaultValue.length; i++)
{
values[i] = Double.toString(defaultValue[i]);
}
Property prop = get(category, key, values, comment, DOUBLE);
if (!prop.isDoubleList())
{
prop.set(values);
}
return prop;
}
public Property get(String category, String key, boolean[] defaultValue)
{
return get(category, key, defaultValue, null);
}
public Property get(String category, String key, boolean[] defaultValue, String comment)
{
String[] values = new String[defaultValue.length];
for (int i = 0; i < defaultValue.length; i++)
{
values[i] = Boolean.toString(defaultValue[i]);
}
Property prop = get(category, key, values, comment, BOOLEAN);
if (!prop.isBooleanList())
{
prop.set(values);
}
return prop;
}
public Property get(String category, String key, String defaultValue, String comment, Property.Type type)
{
if (!caseSensitiveCustomCategories)
{
category = category.toLowerCase(Locale.ENGLISH);
}
ConfigCategory cat = getCategory(category);
if (cat.containsKey(key))
{
Property prop = cat.get(key);
if (prop.getType() == null)
{
prop = new Property(prop.getName(), prop.getString(), type);
cat.put(key, prop);
}
prop.comment = comment;
return prop;
}
else if (defaultValue != null)
{
Property prop = new Property(key, defaultValue, type);
prop.set(defaultValue); //Set and mark as dirty to signify it should save
cat.put(key, prop);
prop.comment = comment;
return prop;
}
else
{
return null;
}
}
public Property get(String category, String key, String[] defaultValue, String comment, Property.Type type)
{
if (!caseSensitiveCustomCategories)
{
category = category.toLowerCase(Locale.ENGLISH);
}
ConfigCategory cat = getCategory(category);
if (cat.containsKey(key))
{
Property prop = cat.get(key);
if (prop.getType() == null)
{
prop = new Property(prop.getName(), prop.getString(), type);
cat.put(key, prop);
}
prop.comment = comment;
return prop;
}
else if (defaultValue != null)
{
Property prop = new Property(key, defaultValue, type);
prop.comment = comment;
cat.put(key, prop);
return prop;
}
else
{
return null;
}
}
public boolean hasCategory(String category)
{
return categories.get(category) != null;
}
public boolean hasKey(String category, String key)
{
ConfigCategory cat = categories.get(category);
return cat != null && cat.containsKey(key);
}
public void load()
{
if (PARENT != null && PARENT != this)
{
return;
}
BufferedReader buffer = null;
UnicodeInputStreamReader input = null;
try
{
if (file.getParentFile() != null)
{
file.getParentFile().mkdirs();
}
if (!file.exists() && !file.createNewFile())
{
return;
}
if (file.canRead())
{
input = new UnicodeInputStreamReader(new FileInputStream(file), defaultEncoding);
defaultEncoding = input.getEncoding();
buffer = new BufferedReader(input);
String line;
ConfigCategory currentCat = null;
Property.Type type = null;
ArrayList<String> tmpList = null;
int lineNum = 0;
String name = null;
while (true)
{
lineNum++;
line = buffer.readLine();
if (line == null)
{
break;
}
Matcher start = CONFIG_START.matcher(line);
Matcher end = CONFIG_END.matcher(line);
if (start.matches())
{
fileName = start.group(1);
categories = new TreeMap<String, ConfigCategory>();
continue;
}
else if (end.matches())
{
fileName = end.group(1);
Configuration child = new Configuration();
child.categories = categories;
this.children.put(fileName, child);
continue;
}
int nameStart = -1, nameEnd = -1;
boolean skip = false;
boolean quoted = false;
for (int i = 0; i < line.length() && !skip; ++i)
{
if (Character.isLetterOrDigit(line.charAt(i)) || ALLOWED_CHARS.indexOf(line.charAt(i)) != -1 || (quoted && line.charAt(i) != '"'))
{
if (nameStart == -1)
{
nameStart = i;
}
nameEnd = i;
}
else if (Character.isWhitespace(line.charAt(i)))
{
// ignore space charaters
}
else
{
switch (line.charAt(i))
{
case '#':
skip = true;
continue;
case '"':
if (quoted)
{
quoted = false;
}
if (!quoted && nameStart == -1)
{
quoted = true;
}
break;
case '{':
name = line.substring(nameStart, nameEnd + 1);
String qualifiedName = ConfigCategory.getQualifiedName(name, currentCat);
ConfigCategory cat = categories.get(qualifiedName);
if (cat == null)
{
currentCat = new ConfigCategory(name, currentCat);
categories.put(qualifiedName, currentCat);
}
else
{
currentCat = cat;
}
name = null;
break;
case '}':
if (currentCat == null)
{
throw new RuntimeException(String.format("Config file corrupt, attepted to close to many categories '%s:%d'", fileName, lineNum));
}
currentCat = currentCat.parent;
break;
case '=':
name = line.substring(nameStart, nameEnd + 1);
if (currentCat == null)
{
throw new RuntimeException(String.format("'%s' has no scope in '%s:%d'", name, fileName, lineNum));
}
Property prop = new Property(name, line.substring(i + 1), type, true);
i = line.length();
currentCat.put(name, prop);
break;
case ':':
type = Property.Type.tryParse(line.substring(nameStart, nameEnd + 1).charAt(0));
nameStart = nameEnd = -1;
break;
case '<':
if (tmpList != null)
{
throw new RuntimeException(String.format("Malformed list property \"%s:%d\"", fileName, lineNum));
}
name = line.substring(nameStart, nameEnd + 1);
if (currentCat == null)
{
throw new RuntimeException(String.format("'%s' has no scope in '%s:%d'", name, fileName, lineNum));
}
tmpList = new ArrayList<String>();
skip = true;
break;
case '>':
if (tmpList == null)
{
throw new RuntimeException(String.format("Malformed list property \"%s:%d\"", fileName, lineNum));
}
currentCat.put(name, new Property(name, tmpList.toArray(new String[tmpList.size()]), type));
name = null;
tmpList = null;
type = null;
break;
default:
throw new RuntimeException(String.format("Unknown character '%s' in '%s:%d'", line.charAt(i), fileName, lineNum));
}
}
}
if (quoted)
{
throw new RuntimeException(String.format("Unmatched quote in '%s:%d'", fileName, lineNum));
}
else if (tmpList != null && !skip)
{
tmpList.add(line.trim());
}
}
}
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
if (buffer != null)
{
try
{
buffer.close();
} catch (IOException e){}
}
if (input != null)
{
try
{
input.close();
} catch (IOException e){}
}
}
resetChangedState();
}
public void save()
{
if (PARENT != null && PARENT != this)
{
PARENT.save();
return;
}
try
{
if (file.getParentFile() != null)
{
file.getParentFile().mkdirs();
}
if (!file.exists() && !file.createNewFile())
{
return;
}
if (file.canWrite())
{
FileOutputStream fos = new FileOutputStream(file);
BufferedWriter buffer = new BufferedWriter(new OutputStreamWriter(fos, defaultEncoding));
buffer.write("# Configuration file" + NEW_LINE + NEW_LINE);
if (children.isEmpty())
{
save(buffer);
}
else
{
for (Map.Entry<String, Configuration> entry : children.entrySet())
{
buffer.write("START: \"" + entry.getKey() + "\"" + NEW_LINE);
entry.getValue().save(buffer);
buffer.write("END: \"" + entry.getKey() + "\"" + NEW_LINE + NEW_LINE);
}
}
buffer.close();
fos.close();
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
private void save(BufferedWriter out) throws IOException
{
for (ConfigCategory cat : categories.values())
{
if (!cat.isChild())
{
cat.write(out, 0);
out.newLine();
}
}
}
public ConfigCategory getCategory(String category)
{
ConfigCategory ret = categories.get(category);
if (ret == null)
{
if (category.contains(CATEGORY_SPLITTER))
{
String[] hierarchy = category.split("\\"+CATEGORY_SPLITTER);
ConfigCategory parent = categories.get(hierarchy[0]);
if (parent == null)
{
parent = new ConfigCategory(hierarchy[0]);
categories.put(parent.getQualifiedName(), parent);
changed = true;
}
for (int i = 1; i < hierarchy.length; i++)
{
String name = ConfigCategory.getQualifiedName(hierarchy[i], parent);
ConfigCategory child = categories.get(name);
if (child == null)
{
child = new ConfigCategory(hierarchy[i], parent);
categories.put(name, child);
changed = true;
}
ret = child;
parent = child;
}
}
else
{
ret = new ConfigCategory(category);
categories.put(category, ret);
changed = true;
}
}
return ret;
}
public void removeCategory(ConfigCategory category)
{
for (ConfigCategory child : category.getChildren())
{
removeCategory(child);
}
if (categories.containsKey(category.getQualifiedName()))
{
categories.remove(category.getQualifiedName());
if (category.parent != null)
{
category.parent.removeChild(category);
}
changed = true;
}
}
public void addCustomCategoryComment(String category, String comment)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
getCategory(category).setComment(comment);
}
private void setChild(String name, Configuration child)
{
if (!children.containsKey(name))
{
children.put(name, child);
changed = true;
}
else
{
Configuration old = children.get(name);
child.categories = old.categories;
child.fileName = old.fileName;
old.changed = true;
}
}
public static void enableGlobalConfig()
{
PARENT = new Configuration(new File(Loader.instance().getConfigDir(), "global.cfg"));
PARENT.load();
}
public static class UnicodeInputStreamReader extends Reader
{
private final InputStreamReader input;
private final String defaultEnc;
public UnicodeInputStreamReader(InputStream source, String encoding) throws IOException
{
defaultEnc = encoding;
String enc = encoding;
byte[] data = new byte[4];
PushbackInputStream pbStream = new PushbackInputStream(source, data.length);
int read = pbStream.read(data, 0, data.length);
int size = 0;
int bom16 = (data[0] & 0xFF) << 8 | (data[1] & 0xFF);
int bom24 = bom16 << 8 | (data[2] & 0xFF);
int bom32 = bom24 << 8 | (data[3] & 0xFF);
if (bom24 == 0xEFBBBF)
{
enc = "UTF-8";
size = 3;
}
else if (bom16 == 0xFEFF)
{
enc = "UTF-16BE";
size = 2;
}
else if (bom16 == 0xFFFE)
{
enc = "UTF-16LE";
size = 2;
}
else if (bom32 == 0x0000FEFF)
{
enc = "UTF-32BE";
size = 4;
}
else if (bom32 == 0xFFFE0000) //This will never happen as it'll be caught by UTF-16LE,
{ //but if anyone ever runs across a 32LE file, i'd like to disect it.
enc = "UTF-32LE";
size = 4;
}
if (size < read)
{
pbStream.unread(data, size, read - size);
}
this.input = new InputStreamReader(pbStream, enc);
}
public String getEncoding()
{
return input.getEncoding();
}
@Override
public int read(char[] cbuf, int off, int len) throws IOException
{
return input.read(cbuf, off, len);
}
@Override
public void close() throws IOException
{
input.close();
}
}
public boolean hasChanged()
{
if (changed) return true;
for (ConfigCategory cat : categories.values())
{
if (cat.hasChanged()) return true;
}
for (Configuration child : children.values())
{
if (child.hasChanged()) return true;
}
return false;
}
private void resetChangedState()
{
changed = false;
for (ConfigCategory cat : categories.values())
{
cat.resetChangedState();
}
for (Configuration child : children.values())
{
child.resetChangedState();
}
}
public Set<String> getCategoryNames()
{
return ImmutableSet.copyOf(categories.keySet());
}
}
@@ -1,48 +0,0 @@
package net.minecraftforge.common;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemInWorldManager;
import net.minecraft.network.packet.Packet204ClientInfo;
import net.minecraft.server.MinecraftServer;
import net.minecraft.stats.StatBase;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
//Preliminary, simple Fake Player class
public class FakePlayer extends EntityPlayerMP
{
public FakePlayer(World world, String name)
{
super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new ItemInWorldManager(world));
}
public void sendChatToPlayer(String s){}
public boolean canCommandSenderUseCommand(int i, String s){ return false; }
public ChunkCoordinates getPlayerCoordinates()
{
return new ChunkCoordinates(0,0,0);
}
@Override
public void sendChatToPlayer(ChatMessageComponent chatmessagecomponent){}
@Override
public void addStat(StatBase par1StatBase, int par2){}
@Override
public void openGui(Object mod, int modGuiId, World world, int x, int y, int z){}
@Override
public boolean isEntityInvulnerable(){ return true; }
@Override
public boolean canAttackPlayer(EntityPlayer player){ return false; }
@Override
public void onDeath(DamageSource source){ return; }
@Override
public void onUpdate(){ return; }
@Override
public void travelToDimension(int dim){ return; }
@Override
public void updateClientInfo(Packet204ClientInfo pkt){ return; }
}
@@ -1,34 +0,0 @@
package net.minecraftforge.common;
import net.minecraft.world.World;
//To be expanded for generic Mod fake players?
public class FakePlayerFactory
{
// Map of all active fake player usernames to their entities
private static java.util.Map<String, FakePlayer> fakePlayers = new java.util.HashMap<String, FakePlayer>();
private static FakePlayer MINECRAFT_PLAYER = null;
public static FakePlayer getMinecraft(World world)
{
if (MINECRAFT_PLAYER == null)
{
MINECRAFT_PLAYER = FakePlayerFactory.get(world, "[Minecraft]");
}
return MINECRAFT_PLAYER;
}
/**
* Get a fake player with a given username
*/
public static FakePlayer get(World world, String username)
{
if (!fakePlayers.containsKey(username))
{
FakePlayer fakePlayer = new FakePlayer(world, username);
fakePlayers.put(username, fakePlayer);
}
return fakePlayers.get(username);
}
}
@@ -1,254 +0,0 @@
package net.minecraftforge.common;
import java.io.File;
import java.util.Arrays;
import java.util.Map;
import java.util.logging.Level;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.management.PlayerInstance;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.classloading.FMLForgePlugin;
import net.minecraftforge.common.network.ForgeConnectionHandler;
import net.minecraftforge.common.network.ForgeNetworkHandler;
import net.minecraftforge.common.network.ForgePacketHandler;
import net.minecraftforge.common.network.ForgeTinyPacketHandler;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.server.command.ForgeCommand;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import cpw.mods.fml.client.FMLFileResourcePack;
import cpw.mods.fml.client.FMLFolderResourcePack;
import cpw.mods.fml.common.DummyModContainer;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.LoadController;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.WorldAccessContainer;
import cpw.mods.fml.common.event.FMLConstructionEvent;
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.network.FMLNetworkHandler;
import cpw.mods.fml.common.network.NetworkMod;
import static net.minecraftforge.common.ForgeVersion.*;
import static net.minecraftforge.common.Configuration.*;
@NetworkMod(
channels = "FORGE",
connectionHandler = ForgeConnectionHandler.class,
packetHandler = ForgePacketHandler.class,
tinyPacketHandler = ForgeTinyPacketHandler.class
)
public class ForgeDummyContainer extends DummyModContainer implements WorldAccessContainer
{
public static int clumpingThreshold = 64;
public static boolean removeErroringEntities = false;
public static boolean removeErroringTileEntities = false;
public static boolean disableStitchedFileSaving = false;
public static boolean forceDuplicateFluidBlockCrash = true;
public static boolean fullBoundingBoxLadders = false;
public static double zombieSummonBaseChance = 0.1;
public static int[] blendRanges = { 20, 15, 10, 5 };
public static float zombieBabyChance = 0.05f;
public static boolean shouldSortRecipies = false;
public ForgeDummyContainer()
{
super(new ModMetadata());
ModMetadata meta = getMetadata();
meta.modId = "Forge";
meta.name = "Minecraft Forge";
meta.version = String.format("%d.%d.%d.%d", majorVersion, minorVersion, revisionVersion, buildVersion);
meta.credits = "Made possible with help from many people";
meta.authorList = Arrays.asList("LexManos", "Eloraam", "Spacetoad");
meta.description = "Minecraft Forge is a common open source API allowing a broad range of mods " +
"to work cooperatively together. It allows many mods to be created without " +
"them editing the main Minecraft code.";
meta.url = "http://MinecraftForge.net";
meta.updateUrl = "http://MinecraftForge.net/forum/index.php/topic,5.0.html";
meta.screenshots = new String[0];
meta.logoFile = "/forge_logo.png";
Configuration config = null;
File cfgFile = new File(Loader.instance().getConfigDir(), "forge.cfg");
try
{
config = new Configuration(cfgFile);
}
catch (Exception e)
{
System.out.println("Error loading forge.cfg, deleting file and resetting: ");
e.printStackTrace();
if (cfgFile.exists())
cfgFile.delete();
config = new Configuration(cfgFile);
}
if (!config.isChild)
{
config.load();
Property enableGlobalCfg = config.get(Configuration.CATEGORY_GENERAL, "enableGlobalConfig", false);
if (enableGlobalCfg.getBoolean(false))
{
Configuration.enableGlobalConfig();
}
}
Property prop;
prop = config.get(Configuration.CATEGORY_GENERAL, "clumpingThreshold", 64);
prop.comment = "Controls the number threshold at which Packet51 is preferred over Packet52, default and minimum 64, maximum 1024";
clumpingThreshold = prop.getInt(64);
if (clumpingThreshold > 1024 || clumpingThreshold < 64)
{
clumpingThreshold = 64;
prop.set(64);
}
prop = config.get(Configuration.CATEGORY_GENERAL, "removeErroringEntities", false);
prop.comment = "Set this to just remove any TileEntity that throws a error in there update method instead of closing the server and reporting a crash log. BE WARNED THIS COULD SCREW UP EVERYTHING USE SPARINGLY WE ARE NOT RESPONSIBLE FOR DAMAGES.";
removeErroringEntities = prop.getBoolean(false);
if (removeErroringEntities)
{
FMLLog.warning("Enabling removal of erroring Entities - USE AT YOUR OWN RISK");
}
prop = config.get(Configuration.CATEGORY_GENERAL, "removeErroringTileEntities", false);
prop.comment = "Set this to just remove any TileEntity that throws a error in there update method instead of closing the server and reporting a crash log. BE WARNED THIS COULD SCREW UP EVERYTHING USE SPARINGLY WE ARE NOT RESPONSIBLE FOR DAMAGES.";
removeErroringTileEntities = prop.getBoolean(false);
if (removeErroringTileEntities)
{
FMLLog.warning("Enabling removal of erroring Tile Entities - USE AT YOUR OWN RISK");
}
//prop = config.get(Configuration.CATEGORY_GENERAL, "disableStitchedFileSaving", true);
//prop.comment = "Set this to just disable the texture stitcher from writing the 'debug.stitched_{name}.png file to disc. Just a small performance tweak. Default: true";
//disableStitchedFileSaving = prop.getBoolean(true);
prop = config.get(Configuration.CATEGORY_GENERAL, "fullBoundingBoxLadders", false);
prop.comment = "Set this to check the entire entity's collision bounding box for ladders instead of just the block they are in. Causes noticable differences in mechanics so default is vanilla behavior. Default: false";
fullBoundingBoxLadders = prop.getBoolean(false);
prop = config.get(Configuration.CATEGORY_GENERAL, "forceDuplicateFluidBlockCrash", true);
prop.comment = "Set this to force a crash if more than one block attempts to link back to the same Fluid. Enabled by default.";
forceDuplicateFluidBlockCrash = prop.getBoolean(true);
if (!forceDuplicateFluidBlockCrash)
{
FMLLog.warning("Disabling forced crashes on duplicate Fluid Blocks - USE AT YOUR OWN RISK");
}
prop = config.get(Configuration.CATEGORY_GENERAL, "biomeSkyBlendRange", new int[] { 20, 15, 10, 5 });
prop.comment = "Control the range of sky blending for colored skies in biomes.";
blendRanges = prop.getIntList();
prop = config.get(Configuration.CATEGORY_GENERAL, "zombieBaseSummonChance", 0.1);
prop.comment = "Base zombie summoning spawn chance. Allows changing the bonus zombie summoning mechanic.";
zombieSummonBaseChance = prop.getDouble(0.1);
prop = config.get(Configuration.CATEGORY_GENERAL, "zombieBabyChance", 0.05);
prop.comment = "Chance that a zombie (or subclass) is a baby. Allows changing the zombie spawning mechanic.";
zombieBabyChance = (float) prop.getDouble(0.05);
prop = config.get(CATEGORY_GENERAL, "sortRecipies", shouldSortRecipies);
prop.comment = "Set to true to enable the post initlization sorting of crafting recipes using Froge's sorter. May cause desyncing on conflicting recipies. ToDo: Set to true by default in 1.7";
shouldSortRecipies = prop.getBoolean(shouldSortRecipies);
if (config.hasChanged())
{
config.save();
}
}
@Override
public boolean registerBus(EventBus bus, LoadController controller)
{
bus.register(this);
return true;
}
@Subscribe
public void modConstruction(FMLConstructionEvent evt)
{
FMLLog.info("Registering Forge Packet Handler");
try
{
FMLNetworkHandler.instance().registerNetworkMod(new ForgeNetworkHandler(this));
FMLLog.info("Succeeded registering Forge Packet Handler");
}
catch (Exception e)
{
FMLLog.log(Level.SEVERE, e, "Failed to register packet handler for Forge");
}
}
@Subscribe
public void preInit(FMLPreInitializationEvent evt)
{
ForgeChunkManager.captureConfig(evt.getModConfigurationDirectory());
}
@Subscribe
public void postInit(FMLPostInitializationEvent evt)
{
BiomeDictionary.registerAllBiomesAndGenerateEvents();
ForgeChunkManager.loadConfiguration();
}
@Subscribe
public void onAvalible(FMLLoadCompleteEvent evt)
{
if (shouldSortRecipies)
{
RecipeSorter.sortCraftManager();
}
}
@Subscribe
public void serverStarting(FMLServerStartingEvent evt)
{
evt.registerServerCommand(new ForgeCommand(evt.getServer()));
}
@Override
public NBTTagCompound getDataForWriting(SaveHandler handler, WorldInfo info)
{
NBTTagCompound forgeData = new NBTTagCompound();
NBTTagCompound dimData = DimensionManager.saveDimensionDataMap();
forgeData.setCompoundTag("DimensionData", dimData);
return forgeData;
}
@Override
public void readData(SaveHandler handler, WorldInfo info, Map<String, NBTBase> propertyMap, NBTTagCompound tag)
{
if (tag.hasKey("DimensionData"))
{
DimensionManager.loadDimensionDataMap(tag.hasKey("DimensionData") ? tag.getCompoundTag("DimensionData") : null);
}
}
@Override
public File getSource()
{
return FMLForgePlugin.forgeLocation;
}
@Override
public Class<?> getCustomResourcePackClass()
{
if (getSource().isDirectory())
{
return FMLFolderResourcePack.class;
}
else
{
return FMLFileResourcePack.class;
}
}
}
@@ -1,44 +0,0 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraftforge.common;
public class ForgeVersion
{
//This number is incremented every time we remove deprecated code/major API changes, never reset
public static final int majorVersion = 9;
//This number is incremented every minecraft release, never reset
public static final int minorVersion = 11;
//This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version
public static final int revisionVersion = 1;
//This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code.
public static final int buildVersion = 0;
public static int getMajorVersion()
{
return majorVersion;
}
public static int getMinorVersion()
{
return minorVersion;
}
public static int getRevisionVersion()
{
return revisionVersion;
}
public static int getBuildVersion()
{
return buildVersion;
}
public static String getVersion()
{
return String.format("%d.%d.%d.%d", majorVersion, minorVersion, revisionVersion, buildVersion);
}
}
@@ -1,10 +0,0 @@
package net.minecraftforge.common;
import net.minecraft.world.World;
public interface IPlantable
{
public EnumPlantType getPlantType(World world, int x, int y, int z);
public int getPlantID(World world, int x, int y, int z);
public int getPlantMetadata(World world, int x, int y, int z);
}
@@ -1,222 +0,0 @@
package net.minecraftforge.common;
import java.lang.reflect.Constructor;
import java.util.*;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.crash.CrashReport;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeHooks.GrassEntry;
import net.minecraftforge.common.ForgeHooks.SeedEntry;
import net.minecraftforge.event.EventBus;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.oredict.OreDictionary;
public class MinecraftForge
{
/**
* The core Forge EventBusses, all events for Forge will be fired on these,
* you should use this to register all your listeners.
* This replaces every register*Handler() function in the old version of Forge.
* TERRAIN_GEN_BUS for terrain gen events
* ORE_GEN_BUS for ore gen events
* EVENT_BUS for everything else
*/
public static final EventBus EVENT_BUS = new EventBus();
public static final EventBus TERRAIN_GEN_BUS = new EventBus();
public static final EventBus ORE_GEN_BUS = new EventBus();
private static final ForgeInternalHandler INTERNAL_HANDLER = new ForgeInternalHandler();
/** Register a new plant to be planted when bonemeal is used on grass.
* @param block The block to place.
* @param metadata The metadata to set for the block when being placed.
* @param weight The weight of the plant, where red flowers are
* 10 and yellow flowers are 20.
*/
public static void addGrassPlant(Block block, int metadata, int weight)
{
ForgeHooks.grassList.add(new GrassEntry(block, metadata, weight));
}
/**
* Register a new seed to be dropped when breaking tall grass.
*
* @param seed The item to drop as a seed.
* @param weight The relative probability of the seeds,
* where wheat seeds are 10.
*/
public static void addGrassSeed(ItemStack seed, int weight)
{
ForgeHooks.seedList.add(new SeedEntry(seed, weight));
}
/**
*
* Register a tool as a tool class with a given harvest level.
*
* @param tool The custom tool to register.
* @param toolClass The tool class to register as. The predefined tool
* clases are "pickaxe", "shovel", "axe". You can add
* others for custom tools.
* @param harvestLevel The harvest level of the tool.
*/
public static void setToolClass(Item tool, String toolClass, int harvestLevel)
{
ForgeHooks.toolClasses.put(tool, Arrays.asList(toolClass, harvestLevel));
}
/**
* Register a block to be harvested by a tool class. This is the metadata
* sensitive version, use it if your blocks are using metadata variants.
* By default, this sets the block class as effective against that type.
*
* @param block The block to register.
* @param metadata The metadata for the block subtype.
* @param toolClass The tool class to register as able to remove this block.
* You may register the same block multiple times with different tool
* classes, if multiple tool types can be used to harvest this block.
* @param harvestLevel The minimum tool harvest level required to successfully
* harvest the block.
* @see MinecraftForge#setToolClass for details on tool classes.
*/
public static void setBlockHarvestLevel(Block block, int metadata, String toolClass, int harvestLevel)
{
List key = Arrays.asList(block, metadata, toolClass);
ForgeHooks.toolHarvestLevels.put(key, harvestLevel);
ForgeHooks.toolEffectiveness.add(key);
}
/**
* Remove a block effectiveness mapping. Since setBlockHarvestLevel
* makes the tool class effective against the block by default, this can be
* used to remove that mapping. This will force a block to be harvested at
* the same speed regardless of tool quality, while still requiring a given
* harvesting level.
*
* @param block The block to remove effectiveness from.
* @param metadata The metadata for the block subtype.
* @param toolClass The tool class to remove the effectiveness mapping from.
* @see MinecraftForge#setToolClass for details on tool classes.
*/
public static void removeBlockEffectiveness(Block block, int metadata, String toolClass)
{
List key = Arrays.asList(block, metadata, toolClass);
ForgeHooks.toolEffectiveness.remove(key);
}
/**
* Register a block to be harvested by a tool class.
* By default, this sets the block class as effective against that type.
*
* @param block The block to register.
* @param toolClass The tool class to register as able to remove this block.
* You may register the same block multiple times with different tool
* classes, if multiple tool types can be used to harvest this block.
* @param harvestLevel The minimum tool harvest level required to successfully
* harvest the block.
* @see MinecraftForge#setToolClass for details on tool classes.
*/
public static void setBlockHarvestLevel(Block block, String toolClass, int harvestLevel)
{
for (int metadata = 0; metadata < 16; metadata++)
{
List key = Arrays.asList(block, metadata, toolClass);
ForgeHooks.toolHarvestLevels.put(key, harvestLevel);
ForgeHooks.toolEffectiveness.add(key);
}
}
/**
* Returns the block harvest level for a particular tool class.
*
* @param block The block to check.
* @param metadata The metadata for the block subtype.
* @param toolClass The tool class to check as able to remove this block.
* @see MinecraftForge#setToolClass for details on tool classes.
* @return The harvest level or -1 if no mapping exists.
*/
public static int getBlockHarvestLevel(Block block, int metadata, String toolClass)
{
ForgeHooks.initTools();
List key = Arrays.asList(block, metadata, toolClass);
Integer harvestLevel = ForgeHooks.toolHarvestLevels.get(key);
return (harvestLevel == null ? -1 : harvestLevel);
}
/**
* Remove a block effectiveness mapping. Since setBlockHarvestLevel
* makes the tool class effective against the block by default, this can be
* used to remove that mapping. This will force a block to be harvested at
* the same speed regardless of tool quality, while still requiring a given
* harvesting level.
*
* @param block The block to remove effectiveness from.
* @param toolClass The tool class to remove the effectiveness mapping from.
* @see MinecraftForge#setToolClass for details on tool classes.
*/
public static void removeBlockEffectiveness(Block block, String toolClass)
{
for (int metadata = 0; metadata < 16; metadata++)
{
List key = Arrays.asList(block, metadata, toolClass);
ForgeHooks.toolEffectiveness.remove(key);
}
}
/**
* Method invoked by FML before any other mods are loaded.
*/
public static void initialize()
{
System.out.printf("MinecraftForge v%s Initialized\n", ForgeVersion.getVersion());
FMLLog.info("MinecraftForge v%s Initialized", ForgeVersion.getVersion());
Block filler = new Block(0, Material.air)
{
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IconRegister register){}
};
Block.blocksList[0] = null;
Block.opaqueCubeLookup[0] = false;
Block.lightOpacity[0] = 0;
filler.setUnlocalizedName("ForgeFiller");
for (int x = 256; x < 4096; x++)
{
if (Item.itemsList[x] != null)
{
Block.blocksList[x] = filler;
}
}
boolean[] temp = new boolean[4096];
System.arraycopy(EntityEnderman.carriableBlocks, 0, temp, 0, EntityEnderman.carriableBlocks.length);
EntityEnderman.carriableBlocks = temp;
EVENT_BUS.register(INTERNAL_HANDLER);
OreDictionary.getOreName(0);
//Force these classes to be defined, Should prevent derp error hiding.
new CrashReport("ThisIsFake", new Exception("Not real"));
}
public static String getBrandingVersion()
{
return "Minecraft Forge "+ ForgeVersion.getVersion();
}
}
@@ -1,409 +0,0 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraftforge.common;
import java.util.ArrayList;
import net.minecraftforge.common.Property.Type;
public class Property
{
public enum Type
{
STRING,
INTEGER,
BOOLEAN,
DOUBLE;
private static Type[] values = {STRING, INTEGER, BOOLEAN, DOUBLE};
public static Type tryParse(char id)
{
for (int x = 0; x < values.length; x++)
{
if (values[x].getID() == id)
{
return values[x];
}
}
return STRING;
}
public char getID()
{
return name().charAt(0);
}
}
private String name;
private String value;
public String comment;
private String[] values;
private final boolean wasRead;
private final boolean isList;
private final Type type;
private boolean changed = false;
public Property()
{
wasRead = false;
type = null;
isList = false;
}
public Property(String name, String value, Type type)
{
this(name, value, type, false);
}
Property(String name, String value, Type type, boolean read)
{
setName(name);
this.value = value;
this.type = type;
wasRead = read;
isList = false;
}
public Property(String name, String[] values, Type type)
{
this(name, values, type, false);
}
Property(String name, String[] values, Type type, boolean read)
{
setName(name);
this.type = type;
this.values = values;
wasRead = read;
isList = true;
}
/**
* Returns the value in this property as it's raw string.
*
* @return current value
*/
public String getString()
{
return value;
}
/**
* Returns the value in this property as an integer,
* if the value is not a valid integer, it will return -1.
*
* @return The value
*/
public int getInt()
{
return getInt(-1);
}
/**
* Returns the value in this property as an integer,
* if the value is not a valid integer, it will return the
* provided default.
*
* @param _default The default to provide if the current value is not a valid integer
* @return The value
*/
public int getInt(int _default)
{
try
{
return Integer.parseInt(value);
}
catch (NumberFormatException e)
{
return _default;
}
}
/**
* Checks if the current value stored in this property can be converted to an integer.
* @return True if the type of the Property is an Integer
*/
public boolean isIntValue()
{
try
{
Integer.parseInt(value);
return true;
}
catch (NumberFormatException e)
{
return false;
}
}
/**
* Returns the value in this property as a boolean,
* if the value is not a valid boolean, it will return the
* provided default.
*
* @param _default The default to provide
* @return The value as a boolean, or the default
*/
public boolean getBoolean(boolean _default)
{
if (isBooleanValue())
{
return Boolean.parseBoolean(value);
}
else
{
return _default;
}
}
/**
* Checks if the current value held by this property is a valid boolean value.
* @return True if it is a boolean value
*/
public boolean isBooleanValue()
{
return ("true".equals(value.toLowerCase()) || "false".equals(value.toLowerCase()));
}
/**
* Checks if the current value held by this property is a valid double value.
* @return True if the value can be converted to an double
*/
public boolean isDoubleValue()
{
try
{
Double.parseDouble(value);
return true;
}
catch (NumberFormatException e)
{
return false;
}
}
/**
* Returns the value in this property as a double,
* if the value is not a valid double, it will return the
* provided default.
*
* @param _default The default to provide if the current value is not a valid double
* @return The value
*/
public double getDouble(double _default)
{
try
{
return Double.parseDouble(value);
}
catch (NumberFormatException e)
{
return _default;
}
}
public String[] getStringList()
{
return values;
}
/**
* Returns the integer value of all values that can
* be parsed in the list.
*
* @return Array of length 0 if none of the values could be parsed.
*/
public int[] getIntList()
{
ArrayList<Integer> nums = new ArrayList<Integer>();
for (String value : values)
{
try
{
nums.add(Integer.parseInt(value));
}
catch (NumberFormatException e){}
}
int[] primitives = new int[nums.size()];
for (int i = 0; i < nums.size(); i++)
{
primitives[i] = nums.get(i);
}
return primitives;
}
/**
* Checks if all of the current values stored in this property can be converted to an integer.
* @return True if the type of the Property is an Integer List
*/
public boolean isIntList()
{
for (String value : values)
{
try
{
Integer.parseInt(value);
}
catch (NumberFormatException e)
{
return false;
}
}
return true;
}
/**
* Returns the boolean value of all values that can
* be parsed in the list.
*
* @return Array of length 0 if none of the values could be parsed.
*/
public boolean[] getBooleanList()
{
ArrayList<Boolean> tmp = new ArrayList<Boolean>();
for (String value : values)
{
try
{
tmp.add(Boolean.parseBoolean(value));
}
catch (NumberFormatException e){}
}
boolean[] primitives = new boolean[tmp.size()];
for (int i = 0; i < tmp.size(); i++)
{
primitives[i] = tmp.get(i);
}
return primitives;
}
/**
* Checks if all of current values stored in this property can be converted to a boolean.
* @return True if it is a boolean value
*/
public boolean isBooleanList()
{
for (String value : values)
{
if (!"true".equalsIgnoreCase(value) && !"false".equalsIgnoreCase(value))
{
return false;
}
}
return true;
}
/**
* Returns the double value of all values that can
* be parsed in the list.
*
* @return Array of length 0 if none of the values could be parsed.
*/
public double[] getDoubleList()
{
ArrayList<Double> tmp = new ArrayList<Double>();
for (String value : values)
{
try
{
tmp.add(Double.parseDouble(value));
}
catch (NumberFormatException e) {}
}
double[] primitives = new double[tmp.size()];
for (int i = 0; i < tmp.size(); i++)
{
primitives[i] = tmp.get(i);
}
return primitives;
}
/**
* Checks if all of the current values stored in this property can be converted to a double.
* @return True if the type of the Property is a double List
*/
public boolean isDoubleList()
{
for (String value : values)
{
try
{
Double.parseDouble(value);
}
catch (NumberFormatException e)
{
return false;
}
}
return true;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
/**
* Determines if this config value was just created, or if it was read from the config file.
* This is useful for mods who auto-assign there blocks to determine if the ID returned is
* a configured one, or a automatically generated one.
*
* @return True if this property was loaded from the config file with a value
*/
public boolean wasRead()
{
return wasRead;
}
public Type getType()
{
return type;
}
public boolean isList()
{
return isList;
}
public boolean hasChanged(){ return changed; }
void resetChangedState(){ changed = false; }
public void set(String value)
{
this.value = value;
changed = true;
}
public void set(String[] values)
{
this.values = values;
changed = true;
}
public void set(int value){ set(Integer.toString(value)); }
public void set(boolean value){ set(Boolean.toString(value)); }
public void set(double value){ set(Double.toString(value)); }
}
@@ -1,55 +0,0 @@
package net.minecraftforge.common.network;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.NetLoginHandler;
import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet1Login;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.fluids.FluidIdMapPacket;
import cpw.mods.fml.common.network.IConnectionHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;
public class ForgeConnectionHandler implements IConnectionHandler {
@Override
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)
{
Packet250CustomPayload[] fluidPackets = ForgePacket.makePacketSet(new FluidIdMapPacket());
for (int i = 0; i < fluidPackets.length; i++) {
PacketDispatcher.sendPacketToPlayer(fluidPackets[i], player);
}
}
@Override
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
{
return null;
}
@Override
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
{
}
@Override
public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager)
{
}
@Override
public void connectionClosed(INetworkManager manager)
{
}
@Override
public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login)
{
}
}
@@ -1,20 +0,0 @@
package net.minecraftforge.common.network;
import net.minecraftforge.common.ForgeDummyContainer;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkModHandler;
public class ForgeNetworkHandler extends NetworkModHandler
{
public ForgeNetworkHandler(ForgeDummyContainer container)
{
super(container,container.getClass().getAnnotation(NetworkMod.class));
configureNetworkMod(container);
}
@Override
public boolean acceptVersion(String version)
{
return true;
}
}
@@ -1,192 +0,0 @@
package net.minecraftforge.common.network;
import java.util.Arrays;
import java.util.concurrent.ConcurrentMap;
import java.util.logging.Level;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraftforge.common.network.packet.DimensionRegisterPacket;
import net.minecraftforge.fluids.FluidIdMapPacket;
import com.google.common.base.Throwables;
import com.google.common.collect.MapMaker;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams;
import com.google.common.primitives.Bytes;
import com.google.common.primitives.Ints;
import com.google.common.primitives.UnsignedBytes;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.network.FMLNetworkException;
public abstract class ForgePacket
{
public static final String CHANNEL_ID = "FORGE";
enum Type
{
/**
* Registers a dimension for a provider on client
*/
REGISTERDIMENSION(DimensionRegisterPacket.class),
/**
* The Fluid ID map to send to the client
*/
FLUID_IDMAP(FluidIdMapPacket.class);
private Class<? extends ForgePacket> packetType;
private ConcurrentMap<INetworkManager, ForgePacket> partTracker;
private Type(Class<? extends ForgePacket> clazz)
{
this.packetType = clazz;
}
ForgePacket make()
{
try
{
return this.packetType.newInstance();
}
catch (Exception e)
{
Throwables.propagateIfPossible(e);
FMLLog.log(Level.SEVERE, e, "A bizarre critical error occured during packet encoding");
throw new FMLNetworkException(e);
}
}
private ForgePacket consumePart(INetworkManager network, byte[] data)
{
if (partTracker == null)
{
partTracker = new MapMaker().weakKeys().weakValues().makeMap();
}
if (!partTracker.containsKey(network))
{
partTracker.put(network, make());
}
ForgePacket pkt = partTracker.get(network);
ByteArrayDataInput bdi = ByteStreams.newDataInput(data);
int chunkIdx = UnsignedBytes.toInt(bdi.readByte());
int chunkTotal = UnsignedBytes.toInt(bdi.readByte());
int chunkLength = bdi.readInt();
if (pkt.partials == null)
{
pkt.partials = new byte[chunkTotal][];
}
pkt.partials[chunkIdx] = new byte[chunkLength];
bdi.readFully(pkt.partials[chunkIdx]);
for (int i = 0; i < pkt.partials.length; i++)
{
if (pkt.partials[i] == null)
{
return null;
}
}
return pkt;
}
}
private Type type;
private byte[][] partials;
public static Packet250CustomPayload[] makePacketSet(ForgePacket packet)
{
byte[] packetData = packet.generatePacket();
if (packetData.length < 32000)
{
return new Packet250CustomPayload[]
{
new Packet250CustomPayload(CHANNEL_ID,
Bytes.concat(new byte[]
{
UnsignedBytes.checkedCast(0), //IsMultipart: False
UnsignedBytes.checkedCast(packet.getID())
},
packetData))
};
}
else
{
byte[][] chunks = new byte[packetData.length / 32000 + 1][];
for (int i = 0; i < packetData.length / 32000 + 1; i++)
{
int len = Math.min(32000, packetData.length - i* 32000);
chunks[i] = Bytes.concat(new byte[]
{
UnsignedBytes.checkedCast(1), //IsMultipart: True
UnsignedBytes.checkedCast(packet.getID()), //Packet ID
UnsignedBytes.checkedCast(i), //Part Number
UnsignedBytes.checkedCast(chunks.length), //Total Parts
},
Ints.toByteArray(len), //Length
Arrays.copyOfRange(packetData, i * 32000, len + i * 32000));
}
Packet250CustomPayload[] ret = new Packet250CustomPayload[chunks.length];
for (int i = 0; i < chunks.length; i++)
{
ret[i] = new Packet250CustomPayload(CHANNEL_ID, chunks[i]);
}
return ret;
}
}
public static ForgePacket readPacket(INetworkManager network, byte[] payload)
{
boolean multipart = UnsignedBytes.toInt(payload[0]) == 1;
int type = UnsignedBytes.toInt(payload[1]);
Type eType = Type.values()[type];
byte[] data = Arrays.copyOfRange(payload, 2, payload.length);
if (multipart)
{
ForgePacket pkt = eType.consumePart(network, data);
if (pkt != null)
{
return pkt.consumePacket(Bytes.concat(pkt.partials));
}
return null;
}
else
{
return eType.make().consumePacket(data);
}
}
public ForgePacket()
{
for (Type t : Type.values())
{
if (t.packetType == getClass())
{
type = t;
continue;
}
}
if (type == null)
{
throw new RuntimeException("ForgePacket constructor called on ungregistered type.");
}
}
public byte getID()
{
return UnsignedBytes.checkedCast(type.ordinal());
}
public abstract byte[] generatePacket();
public abstract ForgePacket consumePacket(byte[] data);
public abstract void execute(INetworkManager network, EntityPlayer player);
}
@@ -1,26 +0,0 @@
package net.minecraftforge.common.network;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.NetLoginHandler;
import net.minecraft.network.packet.Packet250CustomPayload;
import cpw.mods.fml.common.network.FMLPacket;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;
public class ForgePacketHandler implements IPacketHandler {
@Override
public void onPacketData(INetworkManager network, Packet250CustomPayload packet, Player player)
{
ForgePacket pkt = ForgePacket.readPacket(network, packet.data);
// Part of an incomplete multipart packet
if (pkt == null)
{
return;
}
pkt.execute(network, (EntityPlayer)player);
}
}
@@ -1,15 +0,0 @@
package net.minecraftforge.common.network;
import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet131MapData;
import cpw.mods.fml.common.network.ITinyPacketHandler;
public class ForgeTinyPacketHandler implements ITinyPacketHandler {
@Override
public void handle(NetHandler handler, Packet131MapData mapData)
{
}
}
@@ -1,69 +0,0 @@
/**
* This software is provided under the terms of the Minecraft Forge Public
* License v1.0.
*/
package net.minecraftforge.common.network.packet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.NetHandler;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.network.ForgePacket;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
/**
* This class offers the ability for servers to register dimensions on client.
*/
public class DimensionRegisterPacket extends ForgePacket
{
/** The dimension ID to register on client */
public int dimensionId;
/** The provider ID to register with dimension on client */
public int providerId;
// nullary constructor required by ForgePacket.make()
public DimensionRegisterPacket() {}
public DimensionRegisterPacket(int dimensionId, int providerId)
{
this.dimensionId = dimensionId;
this.providerId = providerId;
}
@Override
public byte[] generatePacket()
{
ByteArrayDataOutput dat = ByteStreams.newDataOutput();
dat.writeInt(this.dimensionId);
dat.writeInt(this.providerId);
return dat.toByteArray();
}
@Override
public ForgePacket consumePacket(byte[] data)
{
ByteArrayDataInput dat = ByteStreams.newDataInput(data);
dimensionId = dat.readInt();
providerId = dat.readInt();
return this;
}
@Override
public void execute(INetworkManager network, EntityPlayer player)
{
if (!(player instanceof EntityPlayerMP))
{
if (!DimensionManager.isDimensionRegistered(dimensionId))
{
DimensionManager.registerDimension(dimensionId, providerId);
}
}
}
}
@@ -1,130 +0,0 @@
package net.minecraftforge.event;
import static org.objectweb.asm.Opcodes.*;
import java.lang.reflect.Method;
import java.util.HashMap;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Type;
import com.google.common.collect.Maps;
public class ASMEventHandler implements IEventListener
{
private static int IDs = 0;
private static final String HANDLER_DESC = Type.getInternalName(IEventListener.class);
private static final String HANDLER_FUNC_DESC = Type.getMethodDescriptor(IEventListener.class.getDeclaredMethods()[0]);
private static final ASMClassLoader LOADER = new ASMClassLoader();
private static final HashMap<Method, Class<?>> cache = Maps.newHashMap();
private final IEventListener handler;
private final ForgeSubscribe subInfo;
public ASMEventHandler(Object target, Method method) throws Exception
{
handler = (IEventListener)createWrapper(method).getConstructor(Object.class).newInstance(target);
subInfo = method.getAnnotation(ForgeSubscribe.class);
}
@Override
public void invoke(Event event)
{
if (handler != null)
{
if (!event.isCancelable() || !event.isCanceled() || subInfo.receiveCanceled())
{
handler.invoke(event);
}
}
}
public EventPriority getPriority()
{
return subInfo.priority();
}
public Class<?> createWrapper(Method callback)
{
if (cache.containsKey(callback))
{
return cache.get(callback);
}
ClassWriter cw = new ClassWriter(0);
MethodVisitor mv;
String name = getUniqueName(callback);
String desc = name.replace('.', '/');
String instType = Type.getInternalName(callback.getDeclaringClass());
String eventType = Type.getInternalName(callback.getParameterTypes()[0]);
/*
System.out.println("Name: " + name);
System.out.println("Desc: " + desc);
System.out.println("InstType: " + instType);
System.out.println("Callback: " + callback.getName() + Type.getMethodDescriptor(callback));
System.out.println("Event: " + eventType);
*/
cw.visit(V1_6, ACC_PUBLIC | ACC_SUPER, desc, null, "java/lang/Object", new String[]{ HANDLER_DESC });
cw.visitSource(".dynamic", null);
{
cw.visitField(ACC_PUBLIC, "instance", "Ljava/lang/Object;", null, null).visitEnd();
}
{
mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(Ljava/lang/Object;)V", null, null);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ALOAD, 1);
mv.visitFieldInsn(PUTFIELD, desc, "instance", "Ljava/lang/Object;");
mv.visitInsn(RETURN);
mv.visitMaxs(2, 2);
mv.visitEnd();
}
{
mv = cw.visitMethod(ACC_PUBLIC, "invoke", HANDLER_FUNC_DESC, null, null);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, desc, "instance", "Ljava/lang/Object;");
mv.visitTypeInsn(CHECKCAST, instType);
mv.visitVarInsn(ALOAD, 1);
mv.visitTypeInsn(CHECKCAST, eventType);
mv.visitMethodInsn(INVOKEVIRTUAL, instType, callback.getName(), Type.getMethodDescriptor(callback));
mv.visitInsn(RETURN);
mv.visitMaxs(2, 2);
mv.visitEnd();
}
cw.visitEnd();
Class<?> ret = LOADER.define(name, cw.toByteArray());
cache.put(callback, ret);
return ret;
}
private String getUniqueName(Method callback)
{
return String.format("%s_%d_%s_%s_%s", getClass().getName(), IDs++,
callback.getDeclaringClass().getSimpleName(),
callback.getName(),
callback.getParameterTypes()[0].getSimpleName());
}
private static class ASMClassLoader extends ClassLoader
{
private ASMClassLoader()
{
super(ASMClassLoader.class.getClassLoader());
}
public Class<?> define(String name, byte[] data)
{
return defineClass(name, data, 0, data.length);
}
}
}
@@ -1,11 +0,0 @@
package net.minecraftforge.event;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Retention(value = RUNTIME)
@Target(value = TYPE)
public @interface Cancelable{}
-155
View File
@@ -1,155 +0,0 @@
package net.minecraftforge.event;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* Base Event class that all other events are derived from
*/
public class Event
{
@Retention(value = RUNTIME)
@Target(value = TYPE)
public @interface HasResult{}
public enum Result
{
DENY,
DEFAULT,
ALLOW
}
private boolean isCanceled = false;
private final boolean isCancelable;
private Result result = Result.DEFAULT;
private final boolean hasResult;
private static ListenerList listeners = new ListenerList();
private static final Map<Class, Map<Class, Boolean>> annotationMap = new ConcurrentHashMap<Class, Map<Class, Boolean>>();
public Event()
{
setup();
isCancelable = hasAnnotation(Cancelable.class);
hasResult = hasAnnotation(HasResult.class);
}
private boolean hasAnnotation(Class annotation)
{
Class me = this.getClass();
Map<Class, Boolean> list = annotationMap.get(me);
if (list == null)
{
list = new ConcurrentHashMap<Class, Boolean>();
annotationMap.put(me, list);
}
Boolean cached = list.get(annotation);
if (cached != null)
{
return cached;
}
Class cls = me;
while (cls != Event.class)
{
if (cls.isAnnotationPresent(annotation))
{
list.put(annotation, true);
return true;
}
cls = cls.getSuperclass();
}
list.put(annotation, false);
return false;
}
/**
* Determine if this function is cancelable at all.
* @return If access to setCanceled should be allowed
*/
public boolean isCancelable()
{
return isCancelable;
}
/**
* Determine if this event is canceled and should stop executing.
* @return The current canceled state
*/
public boolean isCanceled()
{
return isCanceled;
}
/**
* Sets the state of this event, not all events are cancelable, and any attempt to
* cancel a event that can't be will result in a IllegalArgumentException.
*
* The functionality of setting the canceled state is defined on a per-event bases.
*
* @param cancel The new canceled value
*/
public void setCanceled(boolean cancel)
{
if (!isCancelable())
{
throw new IllegalArgumentException("Attempted to cancel a uncancelable event");
}
isCanceled = cancel;
}
/**
* Determines if this event expects a significant result value.
*/
public boolean hasResult()
{
return hasResult;
}
/**
* Returns the value set as the result of this event
*/
public Result getResult()
{
return result;
}
/**
* Sets the result value for this event, not all events can have a result set, and any attempt to
* set a result for a event that isn't expecting it will result in a IllegalArgumentException.
*
* The functionality of setting the result is defined on a per-event bases.
*
* @param value The new result
*/
public void setResult(Result value)
{
result = value;
}
/**
* Called by the base constructor, this is used by ASM generated
* event classes to setup various functionality such as the listener's list.
*/
protected void setup()
{
}
/**
* Returns a ListenerList object that contains all listeners
* that are registered to this event.
*
* @return Listener List
*/
public ListenerList getListenerList()
{
return listeners;
}
}
@@ -1,112 +0,0 @@
package net.minecraftforge.event;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import com.google.common.reflect.TypeToken;
public class EventBus
{
private static int maxID = 0;
private ConcurrentHashMap<Object, ArrayList<IEventListener>> listeners = new ConcurrentHashMap<Object, ArrayList<IEventListener>>();
private final int busID = maxID++;
public EventBus()
{
ListenerList.resize(busID + 1);
}
public void register(Object target)
{
if (listeners.containsKey(target))
{
return;
}
Set<? extends Class<?>> supers = TypeToken.of(target.getClass()).getTypes().rawTypes();
for (Method method : target.getClass().getMethods())
{
for (Class<?> cls : supers)
{
try
{
Method real = cls.getDeclaredMethod(method.getName(), method.getParameterTypes());
if (real.isAnnotationPresent(ForgeSubscribe.class))
{
Class<?>[] parameterTypes = method.getParameterTypes();
if (parameterTypes.length != 1)
{
throw new IllegalArgumentException(
"Method " + method + " has @ForgeSubscribe annotation, but requires " + parameterTypes.length +
" arguments. Event handler methods must require a single argument."
);
}
Class<?> eventType = parameterTypes[0];
if (!Event.class.isAssignableFrom(eventType))
{
throw new IllegalArgumentException("Method " + method + " has @ForgeSubscribe annotation, but takes a argument that is not a Event " + eventType);
}
register(eventType, target, method);
break;
}
}
catch (NoSuchMethodException e)
{
;
}
}
}
}
private void register(Class<?> eventType, Object target, Method method)
{
try
{
Constructor<?> ctr = eventType.getConstructor();
ctr.setAccessible(true);
Event event = (Event)ctr.newInstance();
ASMEventHandler listener = new ASMEventHandler(target, method);
event.getListenerList().register(busID, listener.getPriority(), listener);
ArrayList<IEventListener> others = listeners.get(target);
if (others == null)
{
others = new ArrayList<IEventListener>();
listeners.put(target, others);
}
others.add(listener);
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void unregister(Object object)
{
ArrayList<IEventListener> list = listeners.remove(object);
for (IEventListener listener : list)
{
ListenerList.unregiterAll(busID, listener);
}
}
public boolean post(Event event)
{
IEventListener[] listeners = event.getListenerList().getListeners(busID);
for (IEventListener listener : listeners)
{
listener.invoke(event);
}
return (event.isCancelable() ? event.isCanceled() : false);
}
}
@@ -1,16 +0,0 @@
package net.minecraftforge.event;
public enum EventPriority
{
/*Priority of event listeners, listeners will be sorted with respect to this priority level.
*
* Note:
* Due to using a ArrayList in the ListenerList,
* these need to stay in a contiguous index starting at 0. {Default ordinal}
*/
HIGHEST, //First to execute
HIGH,
NORMAL,
LOW,
LOWEST //Last to execute
}
@@ -1,15 +0,0 @@
package net.minecraftforge.event;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.RetentionPolicy.*;
import static java.lang.annotation.ElementType.*;
@Retention(value = RUNTIME)
@Target(value = METHOD)
public @interface ForgeSubscribe
{
public EventPriority priority() default EventPriority.NORMAL;
public boolean receiveCanceled() default false;
}
@@ -1,8 +0,0 @@
package net.minecraftforge.event;
public interface IEventListener
{
public void invoke(Event event);
}
@@ -1,219 +0,0 @@
package net.minecraftforge.event;
import java.util.*;
public class ListenerList
{
private static ArrayList<ListenerList> allLists = new ArrayList<ListenerList>();
private static int maxSize = 0;
private ListenerList parent;
private ListenerListInst[] lists = new ListenerListInst[0];
public ListenerList()
{
allLists.add(this);
resizeLists(maxSize);
}
public ListenerList(ListenerList parent)
{
allLists.add(this);
this.parent = parent;
resizeLists(maxSize);
}
public static void resize(int max)
{
if (max <= maxSize)
{
return;
}
for (ListenerList list : allLists)
{
list.resizeLists(max);
}
maxSize = max;
}
public void resizeLists(int max)
{
if (parent != null)
{
parent.resizeLists(max);
}
if (lists.length >= max)
{
return;
}
ListenerListInst[] newList = new ListenerListInst[max];
int x = 0;
for (; x < lists.length; x++)
{
newList[x] = lists[x];
}
for(; x < max; x++)
{
if (parent != null)
{
newList[x] = new ListenerListInst(parent.getInstance(x));
}
else
{
newList[x] = new ListenerListInst();
}
}
lists = newList;
}
public static void clearBusID(int id)
{
for (ListenerList list : allLists)
{
list.lists[id].dispose();
}
}
protected ListenerListInst getInstance(int id)
{
return lists[id];
}
public IEventListener[] getListeners(int id)
{
return lists[id].getListeners();
}
public void register(int id, EventPriority priority, IEventListener listener)
{
lists[id].register(priority, listener);
}
public void unregister(int id, IEventListener listener)
{
lists[id].unregister(listener);
}
public static void unregiterAll(int id, IEventListener listener)
{
for (ListenerList list : allLists)
{
list.unregister(id, listener);
}
}
private class ListenerListInst
{
private boolean rebuild = true;
private IEventListener[] listeners;
private ArrayList<ArrayList<IEventListener>> priorities;
private ListenerListInst parent;
private ListenerListInst()
{
int count = EventPriority.values().length;
priorities = new ArrayList<ArrayList<IEventListener>>(count);
for (int x = 0; x < count; x++)
{
priorities.add(new ArrayList<IEventListener>());
}
}
public void dispose()
{
for (ArrayList<IEventListener> listeners : priorities)
{
listeners.clear();
}
priorities.clear();
parent = null;
listeners = null;
}
private ListenerListInst(ListenerListInst parent)
{
this();
this.parent = parent;
}
/**
* Returns a ArrayList containing all listeners for this event,
* and all parent events for the specified priority.
*
* The list is returned with the listeners for the children events first.
*
* @param priority The Priority to get
* @return ArrayList containing listeners
*/
public ArrayList<IEventListener> getListeners(EventPriority priority)
{
ArrayList<IEventListener> ret = new ArrayList<IEventListener>(priorities.get(priority.ordinal()));
if (parent != null)
{
ret.addAll(parent.getListeners(priority));
}
return ret;
}
/**
* Returns a full list of all listeners for all priority levels.
* Including all parent listeners.
*
* List is returned in proper priority order.
*
* Automatically rebuilds the internal Array cache if its information is out of date.
*
* @return Array containing listeners
*/
public IEventListener[] getListeners()
{
if (shouldRebuild()) buildCache();
return listeners;
}
protected boolean shouldRebuild()
{
return rebuild || (parent != null && parent.shouldRebuild());
}
/**
* Rebuild the local Array of listeners, returns early if there is no work to do.
*/
private void buildCache()
{
if(parent != null && parent.shouldRebuild())
{
parent.buildCache();
}
ArrayList<IEventListener> ret = new ArrayList<IEventListener>();
for (EventPriority value : EventPriority.values())
{
ret.addAll(getListeners(value));
}
listeners = ret.toArray(new IEventListener[ret.size()]);
rebuild = false;
}
public void register(EventPriority priority, IEventListener listener)
{
priorities.get(priority.ordinal()).add(listener);
rebuild = true;
}
public void unregister(IEventListener listener)
{
for(ArrayList<IEventListener> list : priorities)
{
if (list.remove(listener))
{
rebuild = true;
}
}
}
}
}
@@ -1,60 +0,0 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.event.Cancelable;
import net.minecraftforge.event.entity.living.LivingEvent;
public class PlayerEvent extends LivingEvent
{
public final EntityPlayer entityPlayer;
public PlayerEvent(EntityPlayer player)
{
super(player);
entityPlayer = player;
}
public static class HarvestCheck extends PlayerEvent
{
public final Block block;
public boolean success;
public HarvestCheck(EntityPlayer player, Block block, boolean success)
{
super(player);
this.block = block;
this.success = success;
}
}
@Cancelable
public static class BreakSpeed extends PlayerEvent
{
public final Block block;
public final int metadata;
public final float originalSpeed;
public float newSpeed = 0.0f;
public BreakSpeed(EntityPlayer player, Block block, int metadata, float original)
{
super(player);
this.block = block;
this.metadata = metadata;
this.originalSpeed = original;
this.newSpeed = original;
}
}
public static class NameFormat extends PlayerEvent
{
public final String username;
public String displayname;
public NameFormat(EntityPlayer player, String username) {
super(player);
this.username = username;
this.displayname = username;
}
}
}
@@ -1,52 +0,0 @@
package net.minecraftforge.fluids;
import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.INetworkManager;
import net.minecraftforge.common.network.ForgePacket;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
public class FluidIdMapPacket extends ForgePacket
{
private BiMap<String, Integer> fluidIds = HashBiMap.create();
@Override
public byte[] generatePacket()
{
ByteArrayDataOutput dat = ByteStreams.newDataOutput();
dat.writeInt(FluidRegistry.maxID);
for (Map.Entry<String, Integer> entry : FluidRegistry.fluidIDs.entrySet())
{
dat.writeUTF(entry.getKey());
dat.writeInt(entry.getValue());
}
return dat.toByteArray();
}
@Override
public ForgePacket consumePacket(byte[] data)
{
ByteArrayDataInput dat = ByteStreams.newDataInput(data);
int listSize = dat.readInt();
for (int i = 0; i < listSize; i++) {
String fluidName = dat.readUTF();
int fluidId = dat.readInt();
fluidIds.put(fluidName, fluidId);
}
return this;
}
@Override
public void execute(INetworkManager network, EntityPlayer player)
{
FluidRegistry.initFluidIDs(fluidIds);
}
}
@@ -1,59 +0,0 @@
package net.minecraftforge.liquids;
import net.minecraft.nbt.NBTTagCompound;
/**
* Implementors of this interface are a liquid which may receive a block implementation and can be placed in the world.
*
* @author cpw
*
*/
@Deprecated //See new net.minecraftforge.fluids
public interface IBlockLiquid extends ILiquid {
/**
* Controls the type of block that is generated by this IBlockLiquid
*
*/
public enum BlockType {
/**
* No block. Completeness really.
*/
NONE,
/**
* Vanilla style block, up to 8 flowing states. May be able to generate new sources.
*/
VANILLA,
/**
* Finite liquid style, uses cellular automata to model flowing behaviour.
*/
FINITE;
}
/**
* Can this liquid, when placed in a specific configuration, generate new source blocks of the liquid.
* @return if this liquid will generate new sources
*/
public boolean willGenerateSources();
/**
* @return the distance this liquid will flow if placed in the world. Maximum of 7 levels for vanilla types.
*/
public int getFlowDistance();
/**
* @return the RGB rendering for this liquid
*/
public byte[] getLiquidRGB();
/**
* Get the texture file for rendering the liquid
* @return the texture file for this liquid
*/
public String getLiquidBlockTextureFile();
/**
* Custom properties of the liquid.
* @return a compound tag of custom liquid properties
*/
public NBTTagCompound getLiquidProperties();
}
@@ -1,36 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package net.minecraftforge.liquids;
/**
* Liquids implement this interface
*
*/
@Deprecated //See new net.minecraftforge.fluids
public interface ILiquid {
/**
* The itemId of the liquid item
* @return the itemId
*/
public int stillLiquidId();
/**
* Is this liquid a metadata based liquid
* @return if this is a metadata liquid
*/
public boolean isMetaSensitive();
/**
* The item metadata of the liquid
* @return the metadata of the liquid
*/
public int stillLiquidMeta();
}
@@ -1,45 +0,0 @@
package net.minecraftforge.liquids;
/**
* A tank is the unit of interaction with liquid inventories.
*
* @author cpw
*/
@Deprecated //See new net.minecraftforge.fluids
public interface ILiquidTank {
/**
* @return LiquidStack representing the liquid contained in the tank, null if empty.
*/
LiquidStack getLiquid();
/**
* @return capacity of this tank
*/
int getCapacity();
/**
*
* @param resource
* @param doFill
* @return Amount of liquid used for filling.
*/
int fill(LiquidStack resource, boolean doFill);
/**
*
* @param maxDrain
* @param doDrain
* @return Null if nothing was drained, otherwise a LiquidStack containing the drained.
*/
LiquidStack drain(int maxDrain, boolean doDrain);
/**
* Positive values indicate a positive liquid pressure (liquid wants to leave this tank)
* Negative values indicate a negative liquid pressure (liquid wants to fill this tank)
* Zero indicates no pressure
*
* @return a number indicating tank pressure
*/
public int getTankPressure();
}
@@ -1,56 +0,0 @@
package net.minecraftforge.liquids;
import net.minecraftforge.common.ForgeDirection;
@Deprecated //See new net.minecraftforge.fluids
public interface ITankContainer {
/**
* Fills liquid into internal tanks, distribution is left to the ITankContainer.
* @param from Orientation the liquid is pumped in from.
* @param resource LiquidStack representing the maximum amount of liquid filled into the ITankContainer
* @param doFill If false filling will only be simulated.
* @return Amount of resource that was filled into internal tanks.
*/
int fill(ForgeDirection from, LiquidStack resource, boolean doFill);
/**
* Fills liquid into the specified internal tank.
* @param tankIndex the index of the tank to fill
* @param resource LiquidStack representing the maximum amount of liquid filled into the ITankContainer
* @param doFill If false filling will only be simulated.
* @return Amount of resource that was filled into internal tanks.
*/
int fill(int tankIndex, LiquidStack resource, boolean doFill);
/**
* Drains liquid out of internal tanks, distribution is left to the ITankContainer.
* @param from Orientation the liquid is drained to.
* @param maxDrain Maximum amount of liquid to drain.
* @param doDrain If false draining will only be simulated.
* @return LiquidStack representing the liquid and amount actually drained from the ITankContainer
*/
LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain);
/**
* Drains liquid out of the specified internal tank.
* @param tankIndex the index of the tank to drain
* @param maxDrain Maximum amount of liquid to drain.
* @param doDrain If false draining will only be simulated.
* @return LiquidStack representing the liquid and amount actually drained from the ITankContainer
*/
LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain);
/**
* @param direction tank side: UNKNOWN for default tank set
* @return Array of {@link LiquidTank}s contained in this ITankContainer for this direction
*/
ILiquidTank[] getTanks(ForgeDirection direction);
/**
* Return the tank that this tank container desired to be used for the specified liquid type from the specified direction
*
* @param direction the direction
* @param type the liquid type, null is always an acceptable value
* @return a tank or null for no such tank
*/
ILiquidTank getTank(ForgeDirection direction, LiquidStack type);
}
@@ -1,31 +0,0 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package net.minecraftforge.liquids;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@Deprecated //See new net.minecraftforge.fluids
public class LiquidContainerData {
public final LiquidStack stillLiquid;
public final ItemStack filled;
public final ItemStack container;
public LiquidContainerData(LiquidStack stillLiquid, ItemStack filled, ItemStack container) {
this.stillLiquid = stillLiquid;
this.filled = filled;
this.container = container;
if(stillLiquid == null || filled == null || container == null)
throw new RuntimeException("stillLiquid, filled, or container is null, this is an error");
}
}
@@ -1,131 +0,0 @@
package net.minecraftforge.liquids;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@Deprecated //See new net.minecraftforge.fluids
public class LiquidContainerRegistry
{
public static final int BUCKET_VOLUME = 1000;
public static final ItemStack EMPTY_BUCKET = new ItemStack(Item.bucketEmpty);
private static Map<List, LiquidContainerData> mapFilledItemFromLiquid = new HashMap();
private static Map<List, LiquidContainerData> mapLiquidFromFilledItem = new HashMap();
private static Set<List> setContainerValidation = new HashSet();
private static Set<List> setLiquidValidation = new HashSet();
private static ArrayList<LiquidContainerData> liquids = new ArrayList();
/**
* Default registrations
*/
static
{
registerLiquid(new LiquidContainerData(new LiquidStack(Block.waterStill, LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Item.bucketWater), new ItemStack(Item.bucketEmpty)));
registerLiquid(new LiquidContainerData(new LiquidStack(Block.lavaStill, LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Item.bucketLava), new ItemStack(Item.bucketEmpty)));
registerLiquid(new LiquidContainerData(new LiquidStack(Block.waterStill, LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Item.potion), new ItemStack(Item.glassBottle)));
// registerLiquid(new LiquidContainerData(new LiquidStack(Item.bucketMilk, LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Item.bucketMilk), new ItemStack(Item.bucketEmpty)));
}
/**
* To register a container with a non-bucket size, the LiquidContainerData entry simply needs to use a size other than LiquidManager.BUCKET_VOLUME
*/
public static void registerLiquid(LiquidContainerData data)
{
mapFilledItemFromLiquid.put(Arrays.asList(data.container.itemID, data.container.getItemDamage(), data.stillLiquid.itemID, data.stillLiquid.itemMeta), data);
mapLiquidFromFilledItem.put(Arrays.asList(data.filled.itemID, data.filled.getItemDamage()), data);
setContainerValidation.add(Arrays.asList(data.container.itemID, data.container.getItemDamage()));
setLiquidValidation.add(Arrays.asList(data.stillLiquid.itemID, data.stillLiquid.itemMeta));
liquids.add(data);
}
public static LiquidStack getLiquidForFilledItem(ItemStack filledContainer)
{
if (filledContainer == null)
{
return null;
}
LiquidContainerData ret = mapLiquidFromFilledItem.get(Arrays.asList(filledContainer.itemID, filledContainer.getItemDamage()));
return ret == null ? null : ret.stillLiquid.copy();
}
public static ItemStack fillLiquidContainer(LiquidStack liquid, ItemStack emptyContainer)
{
if (emptyContainer == null || liquid == null)
{
return null;
}
LiquidContainerData ret = mapFilledItemFromLiquid.get(Arrays.asList(emptyContainer.itemID, emptyContainer.getItemDamage(), liquid.itemID, liquid.itemMeta));
if (ret != null && liquid.amount >= ret.stillLiquid.amount)
{
return ret.filled.copy();
}
return null;
}
public static boolean containsLiquid(ItemStack filledContainer, LiquidStack liquid)
{
if (filledContainer == null || liquid == null)
{
return false;
}
LiquidContainerData ret = mapLiquidFromFilledItem.get(Arrays.asList(filledContainer.itemID, filledContainer.getItemDamage()));
return ret != null && ret.stillLiquid.isLiquidEqual(liquid);
}
public static boolean isBucket(ItemStack container)
{
if (container == null)
{
return false;
}
if (container.isItemEqual(EMPTY_BUCKET))
{
return true;
}
LiquidContainerData ret = mapLiquidFromFilledItem.get(Arrays.asList(container.itemID, container.getItemDamage()));
return ret != null && ret.container.isItemEqual(EMPTY_BUCKET);
}
public static boolean isContainer(ItemStack container)
{
return isEmptyContainer(container) || isFilledContainer(container);
}
public static boolean isEmptyContainer(ItemStack emptyContainer)
{
return emptyContainer != null && setContainerValidation.contains(Arrays.asList(emptyContainer.itemID, emptyContainer.getItemDamage()));
}
public static boolean isFilledContainer(ItemStack filledContainer)
{
return filledContainer != null && getLiquidForFilledItem(filledContainer) != null;
}
public static boolean isLiquid(ItemStack item)
{
return item != null && setLiquidValidation.contains(Arrays.asList(item.itemID, item.getItemDamage()));
}
public static LiquidContainerData[] getRegisteredLiquidContainerData()
{
return liquids.toArray(new LiquidContainerData[liquids.size()]);
}
}
@@ -1,124 +0,0 @@
package net.minecraftforge.liquids;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.ImmutableMap;
/**
* When creating liquids you should register them with this class.
*
* @author CovertJaguar <railcraft.wikispaces.com>
*/
@Deprecated //See new net.minecraftforge.fluids
public abstract class LiquidDictionary
{
private static BiMap<String, LiquidStack> liquids = HashBiMap.create();
/**
* When creating liquids you should call this function.
*
* Upon passing it a name and liquid item it will return either
* a preexisting implementation of that liquid or the liquid passed in.
*
*
* @param name the name of the liquid
* @param liquid the liquid to use if one doesn't exist
* @return the matching liquid stack
*/
public static LiquidStack getOrCreateLiquid(String name, LiquidStack liquid)
{
if (liquid == null)
{
throw new NullPointerException("You cannot register a null LiquidStack");
}
LiquidStack existing = liquids.get(name);
if(existing != null) {
return existing.copy();
}
liquids.put(name, liquid.copy());
MinecraftForge.EVENT_BUS.post(new LiquidRegisterEvent(name, liquid));
return liquid;
}
/**
* Returns the liquid matching the name,
* if such a liquid exists.
*
* Can return null.
*
* @param name the name of the liquid
* @param amount the amout of liquid
* @return a liquidstack for the requested liquid
*/
public static LiquidStack getLiquid(String name, int amount)
{
LiquidStack liquid = liquids.get(name);
if(liquid == null)
return null;
liquid = liquid.copy();
liquid.amount = amount;
return liquid;
}
public static LiquidStack getCanonicalLiquid(String name)
{
return liquids.get(name);
}
/**
* Get an immutable list of the liquids defined
*
* @return the defined liquids
*/
public static Map<String, LiquidStack> getLiquids()
{
return ImmutableMap.copyOf(liquids);
}
/**
* Fired when a new liquid is created
*
*/
public static class LiquidRegisterEvent extends Event
{
public final String Name;
public final LiquidStack Liquid;
public LiquidRegisterEvent(String name, LiquidStack liquid)
{
this.Name = name;
this.Liquid = liquid.copy();
}
}
static
{
getOrCreateLiquid("Water", new LiquidStack(Block.waterStill, LiquidContainerRegistry.BUCKET_VOLUME));
getOrCreateLiquid("Lava", new LiquidStack(Block.lavaStill, LiquidContainerRegistry.BUCKET_VOLUME));
}
public static String findLiquidName(LiquidStack reference)
{
if (reference != null)
{
return liquids.inverse().get(reference);
}
else
{
return null;
}
}
public static LiquidStack getCanonicalLiquid(LiquidStack liquidStack)
{
return liquids.get(liquids.inverse().get(liquidStack));
}
}
@@ -1,96 +0,0 @@
package net.minecraftforge.liquids;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event;
@Deprecated //See new net.minecraftforge.fluids
public class LiquidEvent extends Event {
public final LiquidStack liquid;
public final int x;
public final int y;
public final int z;
public final World world;
public LiquidEvent(LiquidStack liquid, World world, int x, int y, int z)
{
this.liquid = liquid;
this.world = world;
this.x = x;
this.y = y;
this.z = z;
}
/**
* Mods should fire this event when they move liquids around (pipe networks etc)
*
* @author cpw
*
*/
public static class LiquidMotionEvent extends LiquidEvent
{
public LiquidMotionEvent(LiquidStack liquid, World world, int x, int y, int z)
{
super(liquid, world, x, y, z);
}
}
/**
* Mods should fire this event when a liquid is {@link ILiquidTank#fill(LiquidStack, boolean)} their tank implementation.
* {@link LiquidTank} does.
*
* @author cpw
*
*/
public static class LiquidFillingEvent extends LiquidEvent
{
public final ILiquidTank tank;
public LiquidFillingEvent(LiquidStack liquid, World world, int x, int y, int z, ILiquidTank tank)
{
super(liquid, world, x, y, z);
this.tank = tank;
}
}
/**
* Mods should fire this event when a liquid is {@link ILiquidTank#drain(int, boolean)} from their tank.
* @author cpw
*
*/
public static class LiquidDrainingEvent extends LiquidEvent
{
public final ILiquidTank tank;
public LiquidDrainingEvent(LiquidStack liquid, World world, int x, int y, int z, ILiquidTank tank)
{
super(liquid, world, x, y, z);
this.tank = tank;
}
}
/**
* Mods should fire this event when a liquid "spills", for example, if a block containing liquid is broken.
*
* @author cpw
*
*/
public static class LiquidSpilledEvent extends LiquidEvent
{
public LiquidSpilledEvent(LiquidStack liquid, World world, int x, int y, int z)
{
super(liquid, world, x, y, z);
}
}
/**
* A handy shortcut for firing the various liquid events
*
* @param event
*/
public static final void fireEvent(LiquidEvent event)
{
MinecraftForge.EVENT_BUS.post(event);
}
}
@@ -1,257 +0,0 @@
package net.minecraftforge.liquids;
import static cpw.mods.fml.relauncher.Side.CLIENT;
import com.google.common.base.Objects;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFluid;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Icon;
/**
* ItemStack substitute for liquids
* Things of note: they are equal if their items are equal. Amount does NOT matter for java equals() testing
* <br/>
* The canonical liquidstack is probably the only one that has a lot of the rendering data on it. Use {@link #canonical()}
* to get it.
*
* @author SirSengir
*/
@Deprecated //See new net.minecraftforge.fluids
public class LiquidStack
{
public final int itemID;
public int amount;
public final int itemMeta;
public NBTTagCompound extra;
public LiquidStack(int itemID, int amount) { this(itemID, amount, 0); }
public LiquidStack(Item item, int amount) { this(item.itemID, amount, 0); }
public LiquidStack(Block block, int amount) { this(block.blockID, amount, 0); }
public LiquidStack(int itemID, int amount, int itemDamage)
{
this.itemID = itemID;
this.amount = amount;
this.itemMeta = itemDamage;
}
public LiquidStack(int itemID, int amount, int itemDamage, NBTTagCompound nbt)
{
this(itemID, amount, itemDamage);
if (nbt != null)
{
extra = (NBTTagCompound)nbt.copy();
}
}
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{
nbt.setInteger("Amount", amount);
nbt.setShort("Id", (short)itemID);
nbt.setShort("Meta", (short)itemMeta);
String name = LiquidDictionary.findLiquidName(this);
if(name != null)
{
nbt.setString("LiquidName", name);
}
if (extra != null)
{
nbt.setTag("extra", extra);
}
return nbt;
}
/**
* @return A copy of this LiquidStack
*/
public LiquidStack copy()
{
return new LiquidStack(itemID, amount, itemMeta, extra);
}
/**
* @param other
* @return true if this LiquidStack contains the same liquid as the one passed in.
*/
public boolean isLiquidEqual(LiquidStack other)
{
return other != null && itemID == other.itemID && itemMeta == other.itemMeta && (extra == null ? other.extra == null : extra.equals(other.extra));
}
/**
* @param other
* @return true if this LiquidStack contains the other liquid (liquids are equal and amount >= other.amount).
*/
public boolean containsLiquid(LiquidStack other)
{
return isLiquidEqual(other) && amount >= other.amount;
}
/**
* @param other ItemStack containing liquids.
* @return true if this LiquidStack contains the same liquid as the one passed in.
*/
public boolean isLiquidEqual(ItemStack other)
{
if (other == null)
{
return false;
}
if (itemID == other.itemID && itemMeta == other.getItemDamage())
{
return true;
}
return isLiquidEqual(LiquidContainerRegistry.getLiquidForFilledItem(other));
}
/**
* @return ItemStack representation of this LiquidStack
*/
public ItemStack asItemStack()
{
ItemStack stack = new ItemStack(itemID, 1, itemMeta);
if (extra != null)
{
stack.stackTagCompound = (NBTTagCompound)extra.copy();
}
return stack;
}
/**
* Reads a liquid stack from the passed nbttagcompound and returns it.
*
* @param nbt
* @return the liquid stack
*/
public static LiquidStack loadLiquidStackFromNBT(NBTTagCompound nbt)
{
if (nbt == null)
{
return null;
}
String liquidName = nbt.getString("LiquidName");
int itemID = nbt.getShort("Id");
int itemMeta = nbt.getShort("Meta");
LiquidStack liquid = LiquidDictionary.getCanonicalLiquid(liquidName);
if(liquid != null) {
itemID = liquid.itemID;
itemMeta = liquid.itemMeta;
}
// if the item is not existent, and no liquid dictionary is found, null returns
else if (Item.itemsList[itemID] == null)
{
return null;
}
int amount = nbt.getInteger("Amount");
LiquidStack liquidstack = new LiquidStack(itemID, amount, itemMeta);
if (nbt.hasKey("extra"))
{
liquidstack.extra = nbt.getCompoundTag("extra");
}
return liquidstack.itemID == 0 ? null : liquidstack;
}
private String textureSheet = "/terrain.png";
/**
* Return the textureSheet used for this liquid stack's texture Icon
* Defaults to '/terrain.png'
*
* See {@link #getRenderingIcon()} for the actual icon
*
* @return The texture sheet
*/
public String getTextureSheet()
{
return textureSheet;
}
/**
* Set the texture sheet for this icon (usually /terrain.png or /gui/items.png)
*
* See also the {@link #setRenderingIcon(Icon)} for the icon itself
*
* @param textureSheet
* @return the liquid stack
*/
public LiquidStack setTextureSheet(String textureSheet)
{
this.textureSheet = textureSheet;
return this;
}
@SideOnly(CLIENT)
private Icon renderingIcon;
/**
* Get the rendering icon for this liquid stack, for presentation in the world or in GUIs.
* Defaults to handling water and lava, and returns the set rendering icon otherwise.
*
* See {@link #getTextureSheet()} to get the texture sheet this icon is associated with
*
* @return The icon for rendering this liquid
*/
@SideOnly(CLIENT)
public Icon getRenderingIcon()
{
if (itemID == Block.waterStill.blockID)
{
return BlockFluid.getFluidIcon("water");
}
else if (itemID == Block.lavaStill.blockID)
{
return BlockFluid.getFluidIcon("lava");
}
return renderingIcon;
}
/**
* Set the icon for rendering this liquid
* It should be refreshed whenever textures are refreshed.
*
* See also {@link #setTextureSheet(String)} for setting the sheet this icon is associated with
*
* @param icon The icon to render
* @return The liquid stack
*/
@SideOnly(CLIENT)
public LiquidStack setRenderingIcon(Icon icon)
{
this.renderingIcon = icon;
return this;
}
@Override
public final int hashCode()
{
return 31 * itemMeta + itemID;
}
@Override
public final boolean equals(Object ob)
{
if (ob instanceof LiquidStack)
{
LiquidStack ls = (LiquidStack)ob;
return ls.itemID == itemID && ls.itemMeta == itemMeta && (extra == null ? ls.extra == null : extra.equals(ls.extra));
}
return false;
}
/**
* Get the canonical version of this liquid stack (will contain things like icons and texturesheets)
* @return The canonical liquidstack
*/
public LiquidStack canonical()
{
return LiquidDictionary.getCanonicalLiquid(this);
}
}
@@ -1,181 +0,0 @@
package net.minecraftforge.liquids;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
/**
* Reference implementation of ILiquidTank. Use this or implement your own.
*/
@Deprecated //See new net.minecraftforge.fluids
public class LiquidTank implements ILiquidTank {
private LiquidStack liquid;
private int capacity;
private int tankPressure;
private TileEntity tile;
public LiquidTank(int capacity)
{
this(null, capacity);
}
public LiquidTank(int liquidId, int quantity, int capacity)
{
this(new LiquidStack(liquidId, quantity), capacity);
}
public LiquidTank(int liquidId, int quantity, int capacity, TileEntity tile)
{
this(liquidId, quantity, capacity);
this.tile = tile;
}
public LiquidTank(LiquidStack liquid, int capacity)
{
this.liquid = liquid;
this.capacity = capacity;
}
public LiquidTank(LiquidStack liquid, int capacity, TileEntity tile)
{
this(liquid, capacity);
this.tile = tile;
}
@Override
public LiquidStack getLiquid()
{
return this.liquid;
}
@Override
public int getCapacity()
{
return this.capacity;
}
public void setLiquid(LiquidStack liquid)
{
this.liquid = liquid;
}
public void setCapacity(int capacity)
{
this.capacity = capacity;
}
@Override
public int fill(LiquidStack resource, boolean doFill)
{
if (resource == null || resource.itemID <= 0) return 0;
if (liquid == null || liquid.itemID <= 0)
{
if (resource.amount <= capacity)
{
if (doFill) this.liquid = resource.copy();
return resource.amount;
}
else
{
if (doFill)
{
this.liquid = resource.copy();
this.liquid.amount = capacity;
if (tile != null)
LiquidEvent.fireEvent(new LiquidEvent.LiquidFillingEvent(liquid, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this));
}
return capacity;
}
}
if (!liquid.isLiquidEqual(resource)) return 0;
int space = capacity - liquid.amount;
if (resource.amount <= space)
{
if (doFill) this.liquid.amount += resource.amount;
return resource.amount;
}
else
{
if (doFill) this.liquid.amount = capacity;
return space;
}
}
@Override
public LiquidStack drain(int maxDrain, boolean doDrain)
{
if (liquid == null || liquid.itemID <= 0) return null;
if (liquid.amount <= 0) return null;
int used = maxDrain;
if (liquid.amount < used) used = liquid.amount;
if (doDrain)
{
liquid.amount -= used;
}
LiquidStack drained = new LiquidStack(liquid.itemID, used, liquid.itemMeta);
// Reset liquid if emptied
if (liquid.amount <= 0) liquid = null;
if (doDrain && tile != null)
LiquidEvent.fireEvent(new LiquidEvent.LiquidDrainingEvent(drained, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this));
return drained;
}
@Override
public int getTankPressure()
{
return tankPressure;
}
public void setTankPressure(int pressure)
{
this.tankPressure = pressure;
}
public String getLiquidName()
{
return liquid!= null ? LiquidDictionary.findLiquidName(liquid) : null;
}
public boolean containsValidLiquid()
{
return LiquidDictionary.findLiquidName(liquid) != null;
}
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{
if (containsValidLiquid())
{
liquid.writeToNBT(nbt);
}
else
{
nbt.setString("emptyTank", "");
}
return nbt;
}
public LiquidTank readFromNBT(NBTTagCompound nbt)
{
if (!nbt.hasKey("emptyTank"))
{
LiquidStack liquid = LiquidStack.loadLiquidStackFromNBT(nbt);
if (liquid != null)
{
setLiquid(liquid);
}
}
return this;
}
}
@@ -1,345 +0,0 @@
package net.minecraftforge.oredict;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event;
public class OreDictionary
{
private static boolean hasInit = false;
private static int maxID = 0;
private static HashMap<String, Integer> oreIDs = new HashMap<String, Integer>();
private static HashMap<Integer, ArrayList<ItemStack>> oreStacks = new HashMap<Integer, ArrayList<ItemStack>>();
/**
* Minecraft changed from -1 to Short.MAX_VALUE in 1.5 release for the "block wildcard". Use this in case it
* changes again.
*/
public static final int WILDCARD_VALUE = Short.MAX_VALUE;
static {
initVanillaEntries();
}
public static void initVanillaEntries()
{
if (!hasInit)
{
registerOre("logWood", new ItemStack(Block.wood, 1, WILDCARD_VALUE));
registerOre("plankWood", new ItemStack(Block.planks, 1, WILDCARD_VALUE));
registerOre("slabWood", new ItemStack(Block.woodSingleSlab, 1, WILDCARD_VALUE));
registerOre("stairWood", Block.stairsWoodOak);
registerOre("stairWood", Block.stairsWoodBirch);
registerOre("stairWood", Block.stairsWoodJungle);
registerOre("stairWood", Block.stairsWoodSpruce);
registerOre("stickWood", Item.stick);
registerOre("treeSapling", new ItemStack(Block.sapling, 1, WILDCARD_VALUE));
registerOre("treeLeaves", new ItemStack(Block.leaves, 1, WILDCARD_VALUE));
registerOre("oreGold", Block.oreGold);
registerOre("oreIron", Block.oreIron);
registerOre("oreLapis", Block.oreLapis);
registerOre("oreDiamond", Block.oreDiamond);
registerOre("oreRedstone", Block.oreRedstone);
registerOre("oreEmerald", Block.oreEmerald);
registerOre("oreQuartz", Block.oreNetherQuartz);
registerOre("stone", Block.stone);
registerOre("cobblestone", Block.cobblestone);
registerOre("record", Item.record13);
registerOre("record", Item.recordCat);
registerOre("record", Item.recordBlocks);
registerOre("record", Item.recordChirp);
registerOre("record", Item.recordFar);
registerOre("record", Item.recordMall);
registerOre("record", Item.recordMellohi);
registerOre("record", Item.recordStal);
registerOre("record", Item.recordStrad);
registerOre("record", Item.recordWard);
registerOre("record", Item.record11);
registerOre("record", Item.recordWait);
}
// Build our list of items to replace with ore tags
Map<ItemStack, String> replacements = new HashMap<ItemStack, String>();
replacements.put(new ItemStack(Item.stick), "stickWood");
replacements.put(new ItemStack(Block.planks), "plankWood");
replacements.put(new ItemStack(Block.planks, 1, WILDCARD_VALUE), "plankWood");
replacements.put(new ItemStack(Block.stone), "stone");
replacements.put(new ItemStack(Block.stone, 1, WILDCARD_VALUE), "stone");
replacements.put(new ItemStack(Block.cobblestone), "cobblestone");
replacements.put(new ItemStack(Block.cobblestone, 1, WILDCARD_VALUE), "cobblestone");
// Register dyes
String[] dyes =
{
"dyeBlack",
"dyeRed",
"dyeGreen",
"dyeBrown",
"dyeBlue",
"dyePurple",
"dyeCyan",
"dyeLightGray",
"dyeGray",
"dyePink",
"dyeLime",
"dyeYellow",
"dyeLightBlue",
"dyeMagenta",
"dyeOrange",
"dyeWhite"
};
for(int i = 0; i < 16; i++)
{
ItemStack dye = new ItemStack(Item.dyePowder, 1, i);
if (!hasInit)
{
registerOre(dyes[i], dye);
}
replacements.put(dye, dyes[i]);
}
hasInit = true;
ItemStack[] replaceStacks = replacements.keySet().toArray(new ItemStack[replacements.keySet().size()]);
// Ignore recipes for the following items
ItemStack[] exclusions = new ItemStack[]
{
new ItemStack(Block.blockLapis),
new ItemStack(Item.cookie),
new ItemStack(Block.stoneBrick),
new ItemStack(Block.stoneSingleSlab),
new ItemStack(Block.stairsCobblestone),
new ItemStack(Block.cobblestoneWall),
new ItemStack(Block.stairsWoodOak),
new ItemStack(Block.stairsWoodBirch),
new ItemStack(Block.stairsWoodJungle),
new ItemStack(Block.stairsWoodSpruce)
};
List recipes = CraftingManager.getInstance().getRecipeList();
List<IRecipe> recipesToRemove = new ArrayList<IRecipe>();
List<IRecipe> recipesToAdd = new ArrayList<IRecipe>();
// Search vanilla recipes for recipes to replace
for(Object obj : recipes)
{
if(obj instanceof ShapedRecipes)
{
ShapedRecipes recipe = (ShapedRecipes)obj;
ItemStack output = recipe.getRecipeOutput();
if (output != null && containsMatch(false, exclusions, output))
{
continue;
}
if(containsMatch(true, recipe.recipeItems, replaceStacks))
{
recipesToRemove.add(recipe);
recipesToAdd.add(new ShapedOreRecipe(recipe, replacements));
}
}
else if(obj instanceof ShapelessRecipes)
{
ShapelessRecipes recipe = (ShapelessRecipes)obj;
ItemStack output = recipe.getRecipeOutput();
if (output != null && containsMatch(false, exclusions, output))
{
continue;
}
if(containsMatch(true, (ItemStack[])recipe.recipeItems.toArray(new ItemStack[recipe.recipeItems.size()]), replaceStacks))
{
recipesToRemove.add((IRecipe)obj);
IRecipe newRecipe = new ShapelessOreRecipe(recipe, replacements);
recipesToAdd.add(newRecipe);
}
}
}
recipes.removeAll(recipesToRemove);
recipes.addAll(recipesToAdd);
if (recipesToRemove.size() > 0)
{
System.out.println("Replaced " + recipesToRemove.size() + " ore recipies");
}
}
/**
* Gets the integer ID for the specified ore name.
* If the name does not have a ID it assigns it a new one.
*
* @param name The unique name for this ore 'oreIron', 'ingotIron', etc..
* @return A number representing the ID for this ore type
*/
public static int getOreID(String name)
{
Integer val = oreIDs.get(name);
if (val == null)
{
val = maxID++;
oreIDs.put(name, val);
oreStacks.put(val, new ArrayList<ItemStack>());
}
return val;
}
/**
* Reverse of getOreID, will not create new entries.
*
* @param id The ID to translate to a string
* @return The String name, or "Unknown" if not found.
*/
public static String getOreName(int id)
{
for (Map.Entry<String, Integer> entry : oreIDs.entrySet())
{
if (id == entry.getValue())
{
return entry.getKey();
}
}
return "Unknown";
}
/**
* Gets the integer ID for the specified item stack.
* If the item stack is not linked to any ore, this will return -1 and no new entry will be created.
*
* @param itemStack The item stack of the ore.
* @return A number representing the ID for this ore type, or -1 if couldn't find it.
*/
public static int getOreID(ItemStack itemStack)
{
if (itemStack == null)
{
return -1;
}
for(Entry<Integer, ArrayList<ItemStack>> ore : oreStacks.entrySet())
{
for(ItemStack target : ore.getValue())
{
if(itemStack.itemID == target.itemID && (target.getItemDamage() == WILDCARD_VALUE || itemStack.getItemDamage() == target.getItemDamage()))
{
return ore.getKey();
}
}
}
return -1; // didn't find it.
}
/**
* Retrieves the ArrayList of items that are registered to this ore type.
* Creates the list as empty if it did not exist.
*
* @param name The ore name, directly calls getOreID
* @return An arrayList containing ItemStacks registered for this ore
*/
public static ArrayList<ItemStack> getOres(String name)
{
return getOres(getOreID(name));
}
/**
* Retrieves a list of all unique ore names that are already registered.
*
* @return All unique ore names that are currently registered.
*/
public static String[] getOreNames()
{
return oreIDs.keySet().toArray(new String[oreIDs.keySet().size()]);
}
/**
* Retrieves the ArrayList of items that are registered to this ore type.
* Creates the list as empty if it did not exist.
*
* @param id The ore ID, see getOreID
* @return An arrayList containing ItemStacks registered for this ore
*/
public static ArrayList<ItemStack> getOres(Integer id)
{
ArrayList<ItemStack> val = oreStacks.get(id);
if (val == null)
{
val = new ArrayList<ItemStack>();
oreStacks.put(id, val);
}
return val;
}
private static boolean containsMatch(boolean strict, ItemStack[] inputs, ItemStack... targets)
{
for (ItemStack input : inputs)
{
for (ItemStack target : targets)
{
if (itemMatches(target, input, strict))
{
return true;
}
}
}
return false;
}
public static boolean itemMatches(ItemStack target, ItemStack input, boolean strict)
{
if (input == null && target != null || input != null && target == null)
{
return false;
}
return (target.itemID == input.itemID && ((target.getItemDamage() == WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage()));
}
//Convenience functions that make for cleaner code mod side. They all drill down to registerOre(String, int, ItemStack)
public static void registerOre(String name, Item ore){ registerOre(name, new ItemStack(ore)); }
public static void registerOre(String name, Block ore){ registerOre(name, new ItemStack(ore)); }
public static void registerOre(String name, ItemStack ore){ registerOre(name, getOreID(name), ore); }
public static void registerOre(int id, Item ore){ registerOre(id, new ItemStack(ore)); }
public static void registerOre(int id, Block ore){ registerOre(id, new ItemStack(ore)); }
public static void registerOre(int id, ItemStack ore){ registerOre(getOreName(id), id, ore); }
/**
* Registers a ore item into the dictionary.
* Raises the registerOre function in all registered handlers.
*
* @param name The name of the ore
* @param id The ID of the ore
* @param ore The ore's ItemStack
*/
private static void registerOre(String name, int id, ItemStack ore)
{
ArrayList<ItemStack> ores = getOres(id);
ore = ore.copy();
ores.add(ore);
MinecraftForge.EVENT_BUS.post(new OreRegisterEvent(name, ore));
}
public static class OreRegisterEvent extends Event
{
public final String Name;
public final ItemStack Ore;
public OreRegisterEvent(String name, ItemStack ore)
{
this.Name = name;
this.Ore = ore;
}
}
}
@@ -1,164 +0,0 @@
package net.minecraftforge.transformers;
import java.util.List;
import net.minecraft.launchwrapper.IClassTransformer;
import net.minecraftforge.event.Event;
import net.minecraftforge.event.ListenerList;
import org.objectweb.asm.*;
import org.objectweb.asm.tree.*;
import static org.objectweb.asm.Opcodes.*;
import static org.objectweb.asm.Type.*;
import static org.objectweb.asm.ClassWriter.*;
public class EventTransformer implements IClassTransformer
{
public EventTransformer()
{
}
@Override
public byte[] transform(String name, String transformedName, byte[] bytes)
{
if (bytes == null || name.equals("net.minecraftforge.event.Event") || name.startsWith("net.minecraft.") || name.indexOf('.') == -1)
{
return bytes;
}
ClassReader cr = new ClassReader(bytes);
ClassNode classNode = new ClassNode();
cr.accept(classNode, 0);
try
{
if (buildEvents(classNode))
{
ClassWriter cw = new ClassWriter(COMPUTE_MAXS | COMPUTE_FRAMES);
classNode.accept(cw);
return cw.toByteArray();
}
return bytes;
}
catch (ClassNotFoundException ex)
{
// Discard silently- it's just noise
}
catch (Exception e)
{
e.printStackTrace();
}
return bytes;
}
@SuppressWarnings("unchecked")
private boolean buildEvents(ClassNode classNode) throws Exception
{
Class<?> parent = this.getClass().getClassLoader().loadClass(classNode.superName.replace('/', '.'));
if (!Event.class.isAssignableFrom(parent))
{
return false;
}
boolean hasSetup = false;
boolean hasGetListenerList = false;
boolean hasDefaultCtr = false;
Class<?> listenerListClazz = Class.forName("net.minecraftforge.event.ListenerList", false, getClass().getClassLoader());
Type tList = Type.getType(listenerListClazz);
for (MethodNode method : (List<MethodNode>)classNode.methods)
{
if (method.name.equals("setup") &&
method.desc.equals(Type.getMethodDescriptor(VOID_TYPE)) &&
(method.access & ACC_PROTECTED) == ACC_PROTECTED)
{
hasSetup = true;
}
if (method.name.equals("getListenerList") &&
method.desc.equals(Type.getMethodDescriptor(tList)) &&
(method.access & ACC_PUBLIC) == ACC_PUBLIC)
{
hasGetListenerList = true;
}
if (method.name.equals("<init>") &&
method.desc.equals(Type.getMethodDescriptor(VOID_TYPE)))
{
hasDefaultCtr = true;
}
}
if (hasSetup)
{
if (!hasGetListenerList)
{
throw new RuntimeException("Event class defines setup() but does not define getListenerList! " + classNode.name);
}
else
{
return false;
}
}
Type tSuper = Type.getType(classNode.superName);
//Add private static ListenerList LISTENER_LIST
classNode.fields.add(new FieldNode(ACC_PRIVATE | ACC_STATIC, "LISTENER_LIST", tList.getDescriptor(), null, null));
/*Add:
* public <init>()
* {
* super();
* }
*/
MethodNode method = new MethodNode(ASM4, ACC_PUBLIC, "<init>", getMethodDescriptor(VOID_TYPE), null, null);
method.instructions.add(new VarInsnNode(ALOAD, 0));
method.instructions.add(new MethodInsnNode(INVOKESPECIAL, tSuper.getInternalName(), "<init>", getMethodDescriptor(VOID_TYPE)));
method.instructions.add(new InsnNode(RETURN));
if (!hasDefaultCtr)
{
classNode.methods.add(method);
}
/*Add:
* protected void setup()
* {
* super.setup();
* if (LISTENER_LIST != NULL)
* {
* return;
* }
* LISTENER_LIST = new ListenerList(super.getListenerList());
* }
*/
method = new MethodNode(ASM4, ACC_PROTECTED, "setup", getMethodDescriptor(VOID_TYPE), null, null);
method.instructions.add(new VarInsnNode(ALOAD, 0));
method.instructions.add(new MethodInsnNode(INVOKESPECIAL, tSuper.getInternalName(), "setup", getMethodDescriptor(VOID_TYPE)));
method.instructions.add(new FieldInsnNode(GETSTATIC, classNode.name, "LISTENER_LIST", tList.getDescriptor()));
LabelNode initLisitener = new LabelNode();
method.instructions.add(new JumpInsnNode(IFNULL, initLisitener));
method.instructions.add(new InsnNode(RETURN));
method.instructions.add(initLisitener);
method.instructions.add(new FrameNode(F_SAME, 0, null, 0, null));
method.instructions.add(new TypeInsnNode(NEW, tList.getInternalName()));
method.instructions.add(new InsnNode(DUP));
method.instructions.add(new VarInsnNode(ALOAD, 0));
method.instructions.add(new MethodInsnNode(INVOKESPECIAL, tSuper.getInternalName(), "getListenerList", getMethodDescriptor(tList)));
method.instructions.add(new MethodInsnNode(INVOKESPECIAL, tList.getInternalName(), "<init>", getMethodDescriptor(VOID_TYPE, tList)));
method.instructions.add(new FieldInsnNode(PUTSTATIC, classNode.name, "LISTENER_LIST", tList.getDescriptor()));
method.instructions.add(new InsnNode(RETURN));
classNode.methods.add(method);
/*Add:
* public ListenerList getListenerList()
* {
* return this.LISTENER_LIST;
* }
*/
method = new MethodNode(ASM4, ACC_PUBLIC, "getListenerList", getMethodDescriptor(tList), null, null);
method.instructions.add(new FieldInsnNode(GETSTATIC, classNode.name, "LISTENER_LIST", tList.getDescriptor()));
method.instructions.add(new InsnNode(ARETURN));
classNode.methods.add(method);
return true;
}
}
Binary file not shown.
+1 -1
Submodule fml updated: 23baf3a8ce...7eb36a1481.
-139
View File
@@ -1,139 +0,0 @@
import os, os.path, sys
import urllib, zipfile
import shutil, glob, fnmatch
import subprocess, logging, re
import csv, shutil
import pprint
forge_dir = os.path.dirname(os.path.abspath(__file__))
def reset_logger():
log = logging.getLogger()
while len(log.handlers) > 0:
log.removeHandler(log.handlers[0])
version_reg = re.compile(r'(([a-z]+)Version[\s]+=[\s]+)(\d+);')
def load_version(build=0):
info = {'major' : -1,
'minor' : -1,
'revision' : -1,
'build' : -1
}
hook_file = os.path.join(forge_dir, 'common/net/minecraftforge/common/ForgeVersion.java'.replace('/', os.sep))
with open(hook_file, 'r') as fh:
buf = fh.read()
def proc(match):
try:
info[match.group(2)] = int(match.group(3))
except:
pass
return match.group(0)
buf = version_reg.sub(proc, buf)
info['build'] = build
return info
def inject_version(src_file, build=0):
version = load_version(build)
tmp_file = src_file + '.tmp'
with open(src_file, 'r') as fh:
buf = fh.read()
def mapname(match):
try:
return '%s%s;' % (match.group(1), version[match.group(2)])
except KeyError:
pass
return match.group(0)
buf = version_reg.sub(mapname, buf).replace('\r\n', '\n')
with open(tmp_file, 'wb') as fh:
fh.write(buf)
shutil.move(tmp_file, src_file)
def zip_folder(path, key, zip):
import pprint
files = os.listdir(path)
for file in files:
file_path = os.path.join(path, file)
file_key = os.path.join(key, file)
if os.path.isdir(file_path):
zip_folder(file_path, file_key, zip)
else:
if not file_key.replace(os.sep, '/') in zip.NameToInfo:
print ' ' + file_key
zip.write(file_path, file_key)
def zip_create(path, key, zip_name):
zip = zipfile.ZipFile(zip_name, 'w', zipfile.ZIP_DEFLATED)
if os.path.isdir(path):
zip_folder(path, key, zip)
else:
zip.write(path, key)
zip.close()
def apply_forge_patches(fml_dir, mcp_dir, forge_dir, src_dir, copy_files=True):
sys.path.append(fml_dir)
sys.path.append(os.path.join(fml_dir, 'install'))
from fml import copytree, apply_patches
#patch files
print 'Applying Minecraft Forge patches'
sys.stdout.flush()
if os.path.isdir(os.path.join(forge_dir, 'patches', 'minecraft')):
apply_patches(mcp_dir, os.path.join(forge_dir, 'patches', 'minecraft'), src_dir)
if copy_files and os.path.isdir(os.path.join(forge_dir, 'client')):
copytree(os.path.join(forge_dir, 'client'), os.path.join(src_dir, 'minecraft'))
if copy_files and os.path.isdir(os.path.join(forge_dir, 'common')):
copytree(os.path.join(forge_dir, 'common'), os.path.join(src_dir, 'minecraft'))
def build_forge_dev(mcp_dir, forge_dir, fml_dir, build_num=0):
version = load_version(build_num)
print '=================================== Build %d.%d.%d.%d Start =================================' % (version['major'], version['minor'], version['revision'], version['build'])
src_dir = os.path.join(mcp_dir, 'src')
if os.path.isdir(src_dir):
shutil.rmtree(src_dir)
sys.path.append(fml_dir)
sys.path.append(os.path.join(fml_dir, 'install'))
from fml import copytree
print 'src_work -> src'
copytree(os.path.join(mcp_dir, 'src_work'), src_dir)
print '\nCopying Client Code'
copytree(os.path.join(forge_dir, 'client'), os.path.join(src_dir, 'minecraft'), -1)
print '\nCopying Common Code'
copytree(os.path.join(forge_dir, 'common'), os.path.join(src_dir, 'minecraft'), -1)
print
inject_version(os.path.join(src_dir, 'minecraft/net/minecraftforge/common/ForgeVersion.java'.replace('/', os.sep)), build_num)
error_level = 0
try:
sys.path.append(mcp_dir)
from runtime.commands import Commands, CLIENT, SERVER, CalledProcessError
from runtime.mcp import recompile_side
os.chdir(mcp_dir)
reset_logger()
commands = Commands(None, verify=True)
try:
recompile_side(commands, CLIENT)
except CalledProcessError as e:
error_level = 1
pass
reset_logger()
os.chdir(forge_dir)
except SystemExit, e:
if not e.code == 0:
print 'Recompile Exception: %d ' % e.code
error_level = e.code
print '=================================== Build Finished %d =================================' % error_level
return error_level
Vendored Executable
+164
View File
@@ -0,0 +1,164 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/fml/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
Vendored
+90
View File
@@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\fml\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
-30
View File
@@ -1,30 +0,0 @@
*** HOW TO INSTALL ***
For Mod Users:
Copy all files from this zip to your minecraft.jar, thats it.
Thats it, you're done, during first run FML will download all needed libraries for you.
For Mod Devs:
The install scripts should take care of everything for you, you do NOT need to
have MCP installed before running install.cmd/sh as Forge will download it for you.
Just start the install.cmd/.sh, MCForge will install itself into the proper
locations and copy all needed files, as well as modifying the needed baseclasses.
Forge also includes a snapshot of the MCP mapings, this may not be the current
version of the mapings. But you must use the provided mapings in order for the
patch files to work together.
Requirements:
You must ahve a JDK installed and accessible, there is a big in java 1.6_21 that
causes compile errors, just update your jdk to fix them.
For Mac users:
It should automatically set the execution bits on mcp/runtime/bin/astyle-osx,
if it does not, please do so manually: chmod +x mcp/runtime/bin/astyle-osx
For Linux users:
Astyle is required for the patches to apply properly, so either install wine, or astyle
Instalation instructions are distro specific, so I can not give them here.
-3
View File
@@ -1,3 +0,0 @@
@echo off
.\fml\python\python_fml install.py %*
pause
-78
View File
@@ -1,78 +0,0 @@
import os, os.path, sys
import urllib, zipfile
import shutil, glob, fnmatch
import subprocess, logging
from optparse import OptionParser
def fml_main(fml_dir, mcp_dir, gen_conf=True, disable_patches=False, disable_at=False, disable_merge=False, enable_server=False,
disable_client=False, disable_rename=False, disable_assets=False, decompile=False):
sys.path.append(fml_dir)
from fml import download_mcp, setup_mcp, decompile_minecraft, apply_fml_patches, finish_setup_fml
print '================ Forge ModLoader Setup Start ==================='
download_mcp(fml_dir, mcp_dir)
setup_mcp(fml_dir, mcp_dir, gen_conf)
if decompile:
decompile_minecraft(fml_dir, mcp_dir, disable_at=disable_at, disable_merge=disable_merge,
enable_server=enable_server, disable_client=disable_client,
disable_assets=disable_assets)
if disable_patches:
print 'Patching disabled'
else:
apply_fml_patches(fml_dir, mcp_dir, os.path.join(mcp_dir, 'src'))
finish_setup_fml(fml_dir, mcp_dir, enable_server=enable_server, disable_client=disable_client, disable_rename=disable_rename)
else:
print 'Decompile free install is on the to-do!'
print '================ Forge ModLoader Setup End ==================='
def forge_main(forge_dir, fml_dir, mcp_dir):
sys.path.append(mcp_dir)
sys.path.append(fml_dir)
from runtime.updatenames import updatenames
from runtime.updatemd5 import updatemd5
from forge import apply_forge_patches
from fml import reset_logger
print '=============================== Minecraft Forge Setup Start ====================================='
print 'Applying forge patches'
apply_forge_patches(fml_dir, mcp_dir, forge_dir, os.path.join(mcp_dir, 'src'), True)
os.chdir(mcp_dir)
updatenames(None, True, True, False)
reset_logger()
updatemd5(None, True, True, False)
reset_logger()
os.chdir(forge_dir)
print '=============================== Minecraft Forge Setup Finished ================================='
if __name__ == '__main__':
parser = OptionParser()
parser.add_option('-m', '--mcp-dir', action='store', dest='mcp_dir', help='Path to download/extract MCP to', default=None )
parser.add_option('-p', '--no-patch', action="store_true", dest='no_patch', help='Disable application of FML patches', default=False)
parser.add_option('-a', '--no-access', action="store_true", dest='no_access', help='Disable access transformers', default=False)
parser.add_option('-s', '--server', action="store_true", dest='enable_server', help='Enable decompilation of server', default=False)
parser.add_option('-c', '--no-client', action="store_true", dest='no_client', help='Disable decompilation of server', default=False)
parser.add_option('-e', '--no-merge', action="store_true", dest='no_merge', help='Disable merging server code into client', default=False)
parser.add_option('-n', '--no-rename', action="store_true", dest='no_rename', help='Disable running updatenames', default=False)
parser.add_option( '--no-assets', action="store_true", dest='no_assets', help='Disable downloading of assets folder', default=False)
parser.add_option('-d', '--decompile', action="store_true", dest='decompile', help='Decompile minecraft and apply patches', default=True)
options, _ = parser.parse_args()
forge_dir = os.path.dirname(os.path.abspath(__file__))
fml_dir = os.path.abspath('fml')
mcp_dir = os.path.abspath('mcp')
if not options.mcp_dir is None:
mcp_dir = os.path.abspath(options.mcp_dir)
if options.no_client:
options.no_patch = True
if options.no_merge:
options.no_patch = True
fml_main(fml_dir, mcp_dir, disable_patches=options.no_patch,
disable_at=options.no_access, disable_merge=options.no_merge,
enable_server=options.enable_server, disable_client=options.no_client,
disable_rename=options.no_rename, disable_assets=options.no_assets,
decompile=options.decompile, gen_conf=False)
forge_main(forge_dir, fml_dir, mcp_dir)
-2
View File
@@ -1,2 +0,0 @@
#!/bin/bash
python install.py "$@"
File diff suppressed because it is too large. Load diff
@@ -1,70 +0,0 @@
--- ../src_base/minecraft/net/minecraft/block/BlockBaseRailLogic.java
+++ ../src_work/minecraft/net/minecraft/block/BlockBaseRailLogic.java
@@ -16,6 +16,8 @@
/** The chunk position the rail is at. */
private List railChunkPosition;
+ private final boolean canMakeSlopes;
+
final BlockRailBase theRail;
public BlockBaseRailLogic(BlockRailBase par1BlockRailBase, World par2World, int par3, int par4, int par5)
@@ -27,17 +29,11 @@
this.railY = par4;
this.railZ = par5;
int l = par2World.getBlockId(par3, par4, par5);
- int i1 = par2World.getBlockMetadata(par3, par4, par5);
-
- if (((BlockRailBase)Block.blocksList[l]).isPowered)
- {
- this.isStraightRail = true;
- i1 &= -9;
- }
- else
- {
- this.isStraightRail = false;
- }
+
+ BlockRailBase target = (BlockRailBase)Block.blocksList[l];
+ int i1 = target.getBasicRailMetadata(par2World, null, par3, par4, par5);
+ isStraightRail = !target.isFlexibleRail(par2World, par3, par4, par5);
+ canMakeSlopes = target.canMakeSlopes(par2World, par3, par4, par5);
this.setBasicRail(i1);
}
@@ -232,7 +228,7 @@
}
}
- if (b0 == 0)
+ if (b0 == 0 && canMakeSlopes)
{
if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX, this.railY + 1, this.railZ - 1))
{
@@ -245,7 +241,7 @@
}
}
- if (b0 == 1)
+ if (b0 == 1 && canMakeSlopes)
{
if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX + 1, this.railY + 1, this.railZ))
{
@@ -390,7 +386,7 @@
}
}
- if (b0 == 0)
+ if (b0 == 0 && canMakeSlopes)
{
if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX, this.railY + 1, this.railZ - 1))
{
@@ -403,7 +399,7 @@
}
}
- if (b0 == 1)
+ if (b0 == 1 && canMakeSlopes)
{
if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX + 1, this.railY + 1, this.railZ))
{
@@ -0,0 +1,73 @@
--- ../src-base/minecraft/net/minecraft/block/BlockBush.java
+++ ../src-work/minecraft/net/minecraft/block/BlockBush.java
@@ -6,8 +6,13 @@
import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
+import net.minecraft.world.IBlockAccess;
+import net.minecraftforge.common.EnumPlantType;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.common.IPlantable;
+import static net.minecraftforge.common.EnumPlantType.*;
-public class BlockBush extends Block
+public class BlockBush extends Block implements IPlantable
{
private static final String __OBFID = "CL_00000208";
@@ -27,7 +32,7 @@
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
- return super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && this.func_149854_a(p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ - 1, p_149742_4_));
+ return super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && this.func_149718_j(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_);
}
protected boolean func_149854_a(Block p_149854_1_)
@@ -57,7 +62,7 @@
public boolean func_149718_j(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_)
{
- return this.func_149854_a(p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_));
+ return p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_).canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this);
}
public AxisAlignedBB func_149668_a(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
@@ -79,4 +84,37 @@
{
return 1;
}
+
+ @Override
+ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z)
+ {
+ if (this == Blocks.field_150464_aj) return Crop;
+ if (this == Blocks.field_150459_bM) return Crop;
+ if (this == Blocks.field_150469_bN) return Crop;
+ if (this == Blocks.field_150394_bc) return Crop;
+ if (this == Blocks.field_150393_bb) return Crop;
+ if (this == Blocks.field_150330_I) return Desert;
+ if (this == Blocks.field_150392_bi) return Water;
+ if (this == Blocks.field_150337_Q) return Cave;
+ if (this == Blocks.field_150338_P) return Cave;
+ if (this == Blocks.field_150388_bm) return Nether;
+ if (this == Blocks.field_150345_g) return Plains;
+ if (this == Blocks.field_150329_H) return Plains;
+ if (this == Blocks.field_150398_cm) return Plains;
+ if (this == Blocks.field_150328_O) return Plains;
+ if (this == Blocks.field_150327_N) return Plains;
+ return Plains;
+ }
+
+ @Override
+ public Block getPlant(IBlockAccess world, int x, int y, int z)
+ {
+ return this;
+ }
+
+ @Override
+ public int getPlantMetadata(IBlockAccess world, int x, int y, int z)
+ {
+ return world.func_72805_g(x, y, z);
+ }
}
@@ -1,104 +1,100 @@
--- ../src_base/minecraft/net/minecraft/block/BlockButton.java
+++ ../src_work/minecraft/net/minecraft/block/BlockButton.java
--- ../src-base/minecraft/net/minecraft/block/BlockButton.java
+++ ../src-work/minecraft/net/minecraft/block/BlockButton.java
@@ -14,6 +14,9 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
+import static net.minecraftforge.common.ForgeDirection.*;
+import net.minecraftforge.common.util.ForgeDirection;
+import static net.minecraftforge.common.util.ForgeDirection.*;
+
public abstract class BlockButton extends Block
{
/** Whether this button is sensible to arrows, used by wooden buttons. */
@@ -66,7 +69,11 @@
*/
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
private final boolean field_150047_a;
@@ -49,12 +52,19 @@
public boolean func_149707_d(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_)
{
- return par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)));
+ ForgeDirection dir = ForgeDirection.getOrientation(par5);
+ return (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) ||
+ (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) ||
+ (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) ||
+ (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST));
- return p_149707_5_ == 2 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ + 1).func_149721_r() ? true : (p_149707_5_ == 3 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ - 1).func_149721_r() ? true : (p_149707_5_ == 4 && p_149707_1_.func_147439_a(p_149707_2_ + 1, p_149707_3_, p_149707_4_).func_149721_r() ? true : p_149707_5_ == 5 && p_149707_1_.func_147439_a(p_149707_2_ - 1, p_149707_3_, p_149707_4_).func_149721_r()));
+ ForgeDirection dir = ForgeDirection.getOrientation(p_149707_5_);
+ return (dir == NORTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ + 1, NORTH)) ||
+ (dir == SOUTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ - 1, SOUTH)) ||
+ (dir == WEST && p_149707_1_.isSideSolid(p_149707_2_ + 1, p_149707_3_, p_149707_4_, WEST)) ||
+ (dir == EAST && p_149707_1_.isSideSolid(p_149707_2_ - 1, p_149707_3_, p_149707_4_, EAST));
}
/**
@@ -74,7 +81,10 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1)));
+ return (par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) ||
+ (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) ||
+ (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) ||
+ (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH));
- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r()));
+ return (p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST)) ||
+ (p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST)) ||
+ (p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH)) ||
+ (p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH));
}
/**
@@ -86,19 +96,22 @@
public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
@@ -63,19 +73,21 @@
int k1 = j1 & 8;
j1 &= 7;
- if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1))
- if (p_149660_5_ == 2 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ + 1).func_149721_r())
+ ForgeDirection dir = ForgeDirection.getOrientation(p_149660_5_);
+
+ ForgeDirection dir = ForgeDirection.getOrientation(par5);
+
+ if (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH))
+ if (dir == NORTH && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH))
{
j1 = 4;
}
- else if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ else if (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH))
- else if (p_149660_5_ == 3 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ - 1).func_149721_r())
+ else if (dir == SOUTH && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH))
{
j1 = 3;
}
- else if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ else if (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST))
- else if (p_149660_5_ == 4 && p_149660_1_.func_147439_a(p_149660_2_ + 1, p_149660_3_, p_149660_4_).func_149721_r())
+ else if (dir == WEST && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST))
{
j1 = 2;
}
- else if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ else if (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST))
- else if (p_149660_5_ == 5 && p_149660_1_.func_147439_a(p_149660_2_ - 1, p_149660_3_, p_149660_4_).func_149721_r())
+ else if (dir == EAST && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST))
{
j1 = 1;
}
@@ -115,7 +128,11 @@
*/
private int getOrientation(World par1World, int par2, int par3, int par4)
@@ -89,7 +101,11 @@
private int func_150045_e(World p_150045_1_, int p_150045_2_, int p_150045_3_, int p_150045_4_)
{
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? 1 : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? 2 : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? 3 : (par1World.isBlockNormalCube(par2, par3, par4 + 1) ? 4 : 1)));
+ if (par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) return 1;
+ if (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) return 2;
+ if (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) return 3;
+ if (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) return 4;
- return p_150045_1_.func_147439_a(p_150045_2_ - 1, p_150045_3_, p_150045_4_).func_149721_r() ? 1 : (p_150045_1_.func_147439_a(p_150045_2_ + 1, p_150045_3_, p_150045_4_).func_149721_r() ? 2 : (p_150045_1_.func_147439_a(p_150045_2_, p_150045_3_, p_150045_4_ - 1).func_149721_r() ? 3 : (p_150045_1_.func_147439_a(p_150045_2_, p_150045_3_, p_150045_4_ + 1).func_149721_r() ? 4 : 1)));
+ if (p_150045_1_.isSideSolid(p_150045_2_ - 1, p_150045_3_, p_150045_4_, EAST)) return 1;
+ if (p_150045_1_.isSideSolid(p_150045_2_ + 1, p_150045_3_, p_150045_4_, WEST)) return 2;
+ if (p_150045_1_.isSideSolid(p_150045_2_, p_150045_3_, p_150045_4_ - 1, SOUTH)) return 3;
+ if (p_150045_1_.isSideSolid(p_150045_2_, p_150045_3_, p_150045_4_ + 1, NORTH)) return 4;
+ return 1;
}
/**
@@ -129,22 +146,22 @@
int i1 = par1World.getBlockMetadata(par2, par3, par4) & 7;
public void func_149695_a(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
@@ -99,22 +115,22 @@
int l = p_149695_1_.func_72805_g(p_149695_2_, p_149695_3_, p_149695_4_) & 7;
boolean flag = false;
- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && i1 == 1)
+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) && i1 == 1)
- if (!p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 1)
+ if (!p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST) && l == 1)
{
flag = true;
}
- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && i1 == 2)
+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) && i1 == 2)
- if (!p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 2)
+ if (!p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST) && l == 2)
{
flag = true;
}
- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && i1 == 3)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) && i1 == 3)
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r() && l == 3)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH) && l == 3)
{
flag = true;
}
- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && i1 == 4)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) && i1 == 4)
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r() && l == 4)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH) && l == 4)
{
flag = true;
}
@@ -1,46 +1,48 @@
--- ../src_base/minecraft/net/minecraft/block/BlockCactus.java
+++ ../src_work/minecraft/net/minecraft/block/BlockCactus.java
@@ -12,7 +12,11 @@
import net.minecraft.util.Icon;
--- ../src-base/minecraft/net/minecraft/block/BlockCactus.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCactus.java
@@ -11,9 +11,13 @@
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.EnumPlantType;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.common.IPlantable;
-public class BlockCactus extends Block
+import net.minecraftforge.common.EnumPlantType;
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.IPlantable;
+
+public class BlockCactus extends Block implements IPlantable
{
@SideOnly(Side.CLIENT)
private Icon cactusTopIcon;
@@ -158,7 +162,7 @@
private IIcon field_150041_a;
@@ -125,7 +129,7 @@
else
{
int l = par1World.getBlockId(par2, par3 - 1, par4);
- return l == Block.cactus.blockID || l == Block.sand.blockID;
+ return blocksList[l] != null && blocksList[l].canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this);
Block block = p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_);
- return block == Blocks.field_150434_aF || block == Blocks.field_150354_m;
+ return block.canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this);
}
}
@@ -182,4 +186,22 @@
this.cactusTopIcon = par1IconRegister.registerIcon(this.getTextureName() + "_top");
this.cactusBottomIcon = par1IconRegister.registerIcon(this.getTextureName() + "_bottom");
@@ -141,4 +145,22 @@
this.field_150041_a = p_149651_1_.func_94245_a(this.func_149641_N() + "_top");
this.field_150040_b = p_149651_1_.func_94245_a(this.func_149641_N() + "_bottom");
}
+
+ @Override
+ public EnumPlantType getPlantType(World world, int x, int y, int z)
+ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z)
+ {
+ return EnumPlantType.Desert;
+ }
+
+ @Override
+ public int getPlantID(World world, int x, int y, int z)
+ public Block getPlant(IBlockAccess world, int x, int y, int z)
+ {
+ return blockID;
+ return this;
+ }
+
+ @Override
+ public int getPlantMetadata(World world, int x, int y, int z)
+ public int getPlantMetadata(IBlockAccess world, int x, int y, int z)
+ {
+ return -1;
+ }
@@ -1,53 +1,44 @@
--- ../src_base/minecraft/net/minecraft/block/BlockChest.java
+++ ../src_work/minecraft/net/minecraft/block/BlockChest.java
--- ../src-base/minecraft/net/minecraft/block/BlockChest.java
+++ ../src-work/minecraft/net/minecraft/block/BlockChest.java
@@ -23,6 +23,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import static net.minecraftforge.common.ForgeDirection.*;
+import static net.minecraftforge.common.util.ForgeDirection.*;
+
public class BlockChest extends BlockContainer
{
private final Random random = new Random();
@@ -446,7 +448,7 @@
private final Random field_149955_b = new Random();
@@ -407,7 +409,7 @@
{
return null;
}
- else if (par1World.isBlockNormalCube(par2, par3 + 1, par4))
+ else if (par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN))
- else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_ + 1, p_149951_4_).func_149721_r())
+ else if (p_149951_1_.isSideSolid(p_149951_2_, p_149951_3_ + 1, p_149951_4_, DOWN))
{
return null;
}
@@ -454,19 +456,19 @@
@@ -415,19 +417,19 @@
{
return null;
}
- else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && (par1World.isBlockNormalCube(par2 - 1, par3 + 1, par4) || isOcelotBlockingChest(par1World, par2 - 1, par3, par4)))
- {
- return null;
- }
- else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && (par1World.isBlockNormalCube(par2 + 1, par3 + 1, par4) || isOcelotBlockingChest(par1World, par2 + 1, par3, par4)))
- {
- return null;
- }
- else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && (par1World.isBlockNormalCube(par2, par3 + 1, par4 - 1) || isOcelotBlockingChest(par1World, par2, par3, par4 - 1)))
- {
- return null;
- }
- else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && (par1World.isBlockNormalCube(par2, par3 + 1, par4 + 1) || isOcelotBlockingChest(par1World, par2, par3, par4 + 1)))
+ else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && (par1World.isBlockSolidOnSide(par2 - 1, par3 + 1, par4, DOWN) || isOcelotBlockingChest(par1World, par2 - 1, par3, par4)))
+ {
+ return null;
+ }
+ else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && (par1World.isBlockSolidOnSide(par2 + 1, par3 + 1, par4, DOWN) || isOcelotBlockingChest(par1World, par2 + 1, par3, par4)))
+ {
+ return null;
+ }
+ else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && (par1World.isBlockSolidOnSide(par2, par3 + 1, par4 - 1, DOWN) || isOcelotBlockingChest(par1World, par2, par3, par4 - 1)))
+ {
+ return null;
+ }
+ else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && (par1World.isBlockSolidOnSide(par2, par3 + 1, par4 + 1, DOWN) || isOcelotBlockingChest(par1World, par2, par3, par4 + 1)))
- else if (p_149951_1_.func_147439_a(p_149951_2_ - 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.func_147439_a(p_149951_2_ - 1, p_149951_3_ + 1, p_149951_4_).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_ - 1, p_149951_3_, p_149951_4_)))
+ else if (p_149951_1_.func_147439_a(p_149951_2_ - 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.isSideSolid(p_149951_2_ - 1, p_149951_3_ + 1, p_149951_4_, DOWN) || func_149953_o(p_149951_1_, p_149951_2_ - 1, p_149951_3_, p_149951_4_)))
{
return null;
}
- else if (p_149951_1_.func_147439_a(p_149951_2_ + 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.func_147439_a(p_149951_2_ + 1, p_149951_3_ + 1, p_149951_4_).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_ + 1, p_149951_3_, p_149951_4_)))
+ else if (p_149951_1_.func_147439_a(p_149951_2_ + 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.isSideSolid(p_149951_2_ + 1, p_149951_3_ + 1, p_149951_4_, DOWN) || func_149953_o(p_149951_1_, p_149951_2_ + 1, p_149951_3_, p_149951_4_)))
{
return null;
}
- else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ - 1) == this && (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_ + 1, p_149951_4_ - 1).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ - 1)))
+ else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ - 1) == this && (p_149951_1_.isSideSolid(p_149951_2_, p_149951_3_ + 1, p_149951_4_ - 1, DOWN) || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ - 1)))
{
return null;
}
- else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ + 1) == this && (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_ + 1, p_149951_4_ + 1).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ + 1)))
+ else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ + 1) == this && (p_149951_1_.isSideSolid(p_149951_2_, p_149951_3_ + 1, p_149951_4_ + 1, DOWN) || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ + 1)))
{
return null;
}
@@ -1,50 +1,46 @@
--- ../src_base/minecraft/net/minecraft/block/BlockCocoa.java
+++ ../src_work/minecraft/net/minecraft/block/BlockCocoa.java
@@ -2,6 +2,8 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java
@@ -2,6 +2,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
+import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
@@ -201,7 +203,14 @@
*/
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -160,6 +161,13 @@
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
{
- int j1 = func_72219_c(par5);
+ super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
+ super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
+ }
+
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int p_149690_5_, int fortune)
+ {
+ ArrayList<ItemStack> dropped = super.getBlockDropped(world, x, y, z, metadata, fortune);
+ int j1 = func_72219_c(metadata);
+ ArrayList<ItemStack> dropped = super.getDrops(world, x, y, z, p_149690_5_, fortune);
int j1 = func_149987_c(p_149690_5_);
byte b0 = 1;
if (j1 >= 2)
@@ -211,8 +220,9 @@
@@ -170,8 +178,9 @@
for (int k1 = 0; k1 < b0; ++k1)
{
- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.dyePowder, 1, 3));
- }
+ dropped.add(new ItemStack(Item.dyePowder, 1, 3));
+ }
- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(Items.field_151100_aR, 1, 3));
+ dropped.add(new ItemStack(Items.field_151100_aR, 1, 3));
}
+ return dropped;
}
@SideOnly(Side.CLIENT)
@@ -248,4 +258,10 @@
this.iconArray[i] = par1IconRegister.registerIcon(this.getTextureName() + "_stage_" + i);
}
@@ -216,4 +225,10 @@
++j1;
p_149853_1_.func_72921_c(p_149853_3_, p_149853_4_, p_149853_5_, j1 << 2 | i1, 2);
}
+
+ @Override
+ public int idDropped(int par1, Random par2Random, int par3)
+ public Item func_149650_a(int par1, Random par2Random, int par3)
+ {
+ return 0;
+ return null;
+ }
}
@@ -1,20 +0,0 @@
--- ../src_base/minecraft/net/minecraft/block/BlockComparator.java
+++ ../src_work/minecraft/net/minecraft/block/BlockComparator.java
@@ -268,4 +268,17 @@
{
return new TileEntityComparator();
}
+
+ @Override
+ public void onNeighborTileChange(World world, int x, int y, int z, int tileX, int tileY, int tileZ)
+ {
+ if(y == tileY)
+ onNeighborBlockChange(world, x, y, z, world.getBlockId(tileX, tileY, tileZ));
+ }
+
+ @Override
+ public boolean weakTileChanges()
+ {
+ return true;
+ }
}
@@ -1,70 +1,79 @@
--- ../src_base/minecraft/net/minecraft/block/BlockCrops.java
+++ ../src_work/minecraft/net/minecraft/block/BlockCrops.java
--- ../src-base/minecraft/net/minecraft/block/BlockCrops.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java
@@ -2,6 +2,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import java.util.ArrayList;
import java.util.Random;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
@@ -10,6 +11,7 @@
import net.minecraft.util.Icon;
@@ -12,6 +13,7 @@
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.util.ForgeDirection;
public class BlockCrops extends BlockFlower
public class BlockCrops extends BlockBush implements IGrowable
{
@@ -103,11 +105,11 @@
int j3 = par1World.getBlockId(l2, par3 - 1, i3);
@@ -89,11 +91,11 @@
{
float f1 = 0.0F;
- if (j3 == Block.tilledField.blockID)
+ if (blocksList[j3] != null && blocksList[j3].canSustainPlant(par1World, l2, par3 - 1, i3, ForgeDirection.UP, this))
- if (p_149864_1_.func_147439_a(l, p_149864_3_ - 1, i1) == Blocks.field_150458_ak)
+ if (p_149864_1_.func_147439_a(l, p_149864_3_ - 1, i1).canSustainPlant(p_149864_1_, l, p_149864_3_ - 1, i1, ForgeDirection.UP, this))
{
f1 = 1.0F;
- if (par1World.getBlockMetadata(l2, par3 - 1, i3) > 0)
+ if (blocksList[j3].isFertile(par1World, l2, par3 - 1, i3))
- if (p_149864_1_.func_72805_g(l, p_149864_3_ - 1, i1) > 0)
+ if (p_149864_1_.func_147439_a(l, p_149864_3_ - 1, i1).isFertile(p_149864_1_, l, p_149864_3_ - 1, i1))
{
f1 = 3.0F;
}
@@ -175,22 +177,25 @@
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
@@ -145,22 +147,6 @@
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
{
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, 0);
-
- if (!par1World.isRemote)
- if (!p_149690_1_.field_72995_K)
- {
- if (par5 >= 7)
+ }
+
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
+ {
+ ArrayList<ItemStack> ret = super.getBlockDropped(world, x, y, z, metadata, fortune);
+
+ if (metadata >= 7)
+ {
+ for (int n = 0; n < 3 + fortune; n++)
{
- int j1 = 3 + par7;
- if (p_149690_5_ >= 7)
- {
- int j1 = 3 + p_149690_7_;
-
- for (int k1 = 0; k1 < j1; ++k1)
- {
- if (par1World.rand.nextInt(15) <= par5)
- if (p_149690_1_.field_73012_v.nextInt(15) <= p_149690_5_)
- {
- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(this.getSeedItem(), 1, 0));
- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(this.func_149866_i(), 1, 0));
- }
+ if (world.rand.nextInt(15) <= metadata)
+ {
+ ret.add(new ItemStack(this.getSeedItem(), 1, 0));
}
}
}
+
+ return ret;
- }
- }
- }
}
/**
public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
@@ -204,4 +190,23 @@
{
this.func_149863_m(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_);
}
+
+ @Override
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
+ {
+ ArrayList<ItemStack> ret = super.getDrops(world, x, y, z, metadata, fortune);
+
+ if (metadata >= 7)
+ {
+ for (int i = 0; i < 3 + fortune; ++i)
+ {
+ if (world.field_73012_v.nextInt(15) <= metadata)
+ {
+ ret.add(new ItemStack(this.func_149866_i(), 1, 0));
+ }
+ }
+ }
+
+ return ret;
+ }
}
@@ -0,0 +1,45 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDeadBush.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDeadBush.java
@@ -1,5 +1,7 @@
package net.minecraft.block;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
@@ -8,9 +10,11 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.IShearable;
-public class BlockDeadBush extends BlockBush
+public class BlockDeadBush extends BlockBush implements IShearable
{
private static final String __OBFID = "CL_00000224";
@@ -33,14 +37,15 @@
public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_)
{
- if (!p_149636_1_.field_72995_K && p_149636_2_.func_71045_bC() != null && p_149636_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ)
{
- p_149636_2_.func_71064_a(StatList.field_75934_C[Block.func_149682_b(this)], 1);
- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Blocks.field_150330_I, 1, p_149636_6_));
- }
- else
- {
super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_);
}
}
+
+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) { return true; }
+ @Override
+ public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune)
+ {
+ return new ArrayList<ItemStack>(Arrays.asList(new ItemStack(Blocks.field_150330_I, 1, world.func_72805_g(x, y, z))));
+ }
}
@@ -1,11 +1,20 @@
--- ../src_base/minecraft/net/minecraft/block/BlockDoor.java
+++ ../src_work/minecraft/net/minecraft/block/BlockDoor.java
@@ -290,7 +290,7 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDoor.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java
@@ -249,7 +249,7 @@
{
if (this.blockMaterial == Material.iron)
if (this.field_149764_J == Material.field_151573_f)
{
- return true;
+ return false; //Allow items to interact with the door
}
else
{
@@ -367,7 +367,7 @@
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
- return p_149742_3_ >= 255 ? false : World.func_147466_a(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) && super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_ + 1, p_149742_4_);
+ return p_149742_3_ >= p_149742_1_.func_72800_K() - 1 ? false : World.func_147466_a(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) && super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_ + 1, p_149742_4_);
}
public int func_149656_h()
@@ -0,0 +1,52 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDoublePlant.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDoublePlant.java
@@ -2,6 +2,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.material.Material;
@@ -18,8 +19,9 @@
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.IShearable;
-public class BlockDoublePlant extends BlockBush implements IGrowable
+public class BlockDoublePlant extends BlockBush implements IGrowable, IShearable
{
public static final String[] field_149892_a = new String[] {"sunflower", "syringa", "grass", "fern", "rose", "paeonia"};
@SideOnly(Side.CLIENT)
@@ -81,6 +83,7 @@
public boolean func_149718_j(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_)
{
+ if (p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_, p_149718_4_) != this) return super.func_149718_j(p_149718_1_, p_149718_2_, p_149718_3_, p_149718_4_); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
int l = p_149718_1_.func_72805_g(p_149718_2_, p_149718_3_, p_149718_4_);
return func_149887_c(l) ? p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_) == this : p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ + 1, p_149718_4_) == this && super.func_149718_j(p_149718_1_, p_149718_2_, p_149718_3_, p_149718_4_);
}
@@ -262,4 +265,22 @@
int l = this.func_149885_e(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_);
this.func_149642_a(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_, new ItemStack(this, 1, l));
}
+
+ @Override
+ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z)
+ {
+ int metadata = world.func_72805_g(x, y, z);
+ int type = func_149890_d(metadata);
+ return func_149887_c(metadata) && (type == 3 || type == 4);
+ }
+
+ @Override
+ public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ int type = func_149890_d(world.func_72805_g(x, y, z));
+ if (type == 3 || type == 2)
+ ret.add(new ItemStack(Blocks.field_150329_H, 2, type == 3 ? 2 : 1));
+ return ret;
+ }
}
@@ -0,0 +1,19 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFalling.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java
@@ -84,7 +84,7 @@
{
Block block = p_149831_0_.func_147439_a(p_149831_1_, p_149831_2_, p_149831_3_);
- if (block.field_149764_J == Material.field_151579_a)
+ if (block.isAir(p_149831_0_, p_149831_1_, p_149831_2_, p_149831_3_))
{
return true;
}
@@ -94,6 +94,7 @@
}
else
{
+ //TODO: King, take a look here when doing liquids!
Material material = block.field_149764_J;
return material == Material.field_151586_h ? true : material == Material.field_151587_i;
}
@@ -1,22 +1,20 @@
--- ../src_base/minecraft/net/minecraft/block/BlockFarmland.java
+++ ../src_work/minecraft/net/minecraft/block/BlockFarmland.java
@@ -10,6 +10,9 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java
@@ -12,6 +12,8 @@
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Icon;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
+
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.IPlantable;
+import net.minecraftforge.common.util.ForgeDirection;
public class BlockFarmland extends Block
{
@@ -115,7 +118,8 @@
@@ -94,7 +96,7 @@
{
int j1 = par1World.getBlockId(l, par3 + 1, i1);
Block block = p_149822_1_.func_147439_a(l, p_149822_3_ + 1, i1);
- if (j1 == Block.crops.blockID || j1 == Block.melonStem.blockID || j1 == Block.pumpkinStem.blockID || j1 == Block.potato.blockID || j1 == Block.carrot.blockID)
+ Block plant = blocksList[j1];
+ if (plant instanceof IPlantable && canSustainPlant(par1World, par2, par3, par4, ForgeDirection.UP, (IPlantable)plant))
- if (block == Blocks.field_150464_aj || block == Blocks.field_150394_bc || block == Blocks.field_150393_bb || block == Blocks.field_150469_bN || block == Blocks.field_150459_bM)
+ if (block instanceof IPlantable && canSustainPlant(p_149822_1_, p_149822_2_, p_149822_3_, p_149822_4_, ForgeDirection.UP, (IPlantable)block))
{
return true;
}
@@ -1,216 +1,279 @@
--- ../src_base/minecraft/net/minecraft/block/BlockFire.java
+++ ../src_work/minecraft/net/minecraft/block/BlockFire.java
@@ -11,6 +11,9 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFire.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFire.java
@@ -2,7 +2,10 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import java.util.IdentityHashMap;
+import java.util.Map.Entry;
import java.util.Random;
+import com.google.common.collect.Maps;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -12,11 +15,15 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.WorldProviderEnd;
+import net.minecraftforge.common.util.ForgeDirection;
+import static net.minecraftforge.common.util.ForgeDirection.*;
+import net.minecraftforge.common.ForgeDirection;
+import static net.minecraftforge.common.ForgeDirection.*;
+
public class BlockFire extends Block
{
/** The chance this block will encourage nearby blocks to catch on fire */
@@ -36,6 +39,8 @@
*/
public void initializeBlock()
{
+ abilityToCatchFire = Block.blockFlammability;
+ chanceToEncourageFire = Block.blockFireSpreadSpeed;
this.setBurnRate(Block.planks.blockID, 5, 20);
this.setBurnRate(Block.woodDoubleSlab.blockID, 5, 20);
this.setBurnRate(Block.woodSingleSlab.blockID, 5, 20);
@@ -62,8 +67,7 @@
*/
private void setBurnRate(int par1, int par2, int par3)
{
- this.chanceToEncourageFire[par1] = par2;
- this.abilityToCatchFire[par1] = par3;
+ Block.setBurnProperties(par1, par2, par3);
- private int[] field_149849_a = new int[256];
- private int[] field_149848_b = new int[256];
+ @Deprecated
+ private int[] field_149849_a = new int[4096];
+ @Deprecated
+ private int[] field_149848_b = new int[4096];
@SideOnly(Side.CLIENT)
private IIcon[] field_149850_M;
private static final String __OBFID = "CL_00000245";
@@ -54,10 +61,10 @@
Blocks.field_150480_ab.func_149842_a(func_149682_b(Blocks.field_150404_cg), 60, 20);
}
/**
@@ -123,12 +127,8 @@
+ @Deprecated // Use setFireInfo
public void func_149842_a(int p_149842_1_, int p_149842_2_, int p_149842_3_)
{
if (par1World.getGameRules().getGameRuleBooleanValue("doFireTick"))
- this.field_149849_a[p_149842_1_] = p_149842_2_;
- this.field_149848_b[p_149842_1_] = p_149842_3_;
+ this.setFireInfo((Block)Block.field_149771_c.func_148754_a(p_149842_1_), p_149842_2_, p_149842_3_);
}
public AxisAlignedBB func_149668_a(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
@@ -94,13 +101,8 @@
{
if (p_149674_1_.func_82736_K().func_82766_b("doFireTick"))
{
- boolean flag = par1World.getBlockId(par2, par3 - 1, par4) == Block.netherrack.blockID;
-
- if (par1World.provider instanceof WorldProviderEnd && par1World.getBlockId(par2, par3 - 1, par4) == Block.bedrock.blockID)
- boolean flag = p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ - 1, p_149674_4_) == Blocks.field_150424_aL;
+ boolean flag = p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ - 1, p_149674_4_).isFireSource(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, UP);
- if (p_149674_1_.field_73011_w instanceof WorldProviderEnd && p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ - 1, p_149674_4_) == Blocks.field_150357_h)
- {
- flag = true;
- }
+ Block base = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
+ boolean flag = (base != null && base.isFireSource(par1World, par2, par3 - 1, par4, par1World.getBlockMetadata(par2, par3 - 1, par4), UP));
if (!this.canPlaceBlockAt(par1World, par2, par3, par4))
-
if (!this.func_149742_c(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_))
{
@@ -157,7 +157,7 @@
par1World.setBlockToAir(par2, par3, par4);
p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_);
@@ -128,7 +130,7 @@
p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_);
}
}
- else if (!flag && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4) && l == 15 && par5Random.nextInt(4) == 0)
+ else if (!flag && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4, UP) && l == 15 && par5Random.nextInt(4) == 0)
- else if (!flag && !this.func_149844_e(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_) && l == 15 && p_149674_5_.nextInt(4) == 0)
+ else if (!flag && !this.canCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, UP) && l == 15 && p_149674_5_.nextInt(4) == 0)
{
par1World.setBlockToAir(par2, par3, par4);
p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_);
}
@@ -171,12 +171,12 @@
@@ -142,12 +144,12 @@
b0 = -50;
}
- this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + b0, par5Random, l);
- this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + b0, par5Random, l);
- this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + b0, par5Random, l);
- this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + b0, par5Random, l);
- this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + b0, par5Random, l);
- this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + b0, par5Random, l);
+ this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + b0, par5Random, l, WEST );
+ this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + b0, par5Random, l, EAST );
+ this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + b0, par5Random, l, UP );
+ this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + b0, par5Random, l, DOWN );
+ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + b0, par5Random, l, SOUTH);
+ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + b0, par5Random, l, NORTH);
- this.func_149841_a(p_149674_1_, p_149674_2_ + 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l);
- this.func_149841_a(p_149674_1_, p_149674_2_ - 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l);
- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, 250 + b0, p_149674_5_, l);
- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, 250 + b0, p_149674_5_, l);
- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ - 1, 300 + b0, p_149674_5_, l);
- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ + 1, 300 + b0, p_149674_5_, l);
+ this.tryCatchFire(p_149674_1_, p_149674_2_ + 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l, WEST );
+ this.tryCatchFire(p_149674_1_, p_149674_2_ - 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l, EAST );
+ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, 250 + b0, p_149674_5_, l, UP );
+ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, 250 + b0, p_149674_5_, l, DOWN );
+ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ - 1, 300 + b0, p_149674_5_, l, SOUTH);
+ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ + 1, 300 + b0, p_149674_5_, l, NORTH);
for (int i1 = par2 - 1; i1 <= par2 + 1; ++i1)
for (int i1 = p_149674_2_ - 1; i1 <= p_149674_2_ + 1; ++i1)
{
@@ -230,9 +230,20 @@
@@ -201,10 +203,16 @@
return false;
}
+ @Deprecated
private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7)
private void func_149841_a(World p_149841_1_, int p_149841_2_, int p_149841_3_, int p_149841_4_, int p_149841_5_, Random p_149841_6_, int p_149841_7_)
{
- int j1 = this.abilityToCatchFire[par1World.getBlockId(par2, par3, par4)];
+ tryToCatchBlockOnFire(par1World, par2, par3, par4, par5, par6Random, par7, UP);
- int j1 = this.field_149848_b[Block.func_149682_b(p_149841_1_.func_147439_a(p_149841_2_, p_149841_3_, p_149841_4_))];
+ this.tryCatchFire(p_149841_1_, p_149841_2_, p_149841_3_, p_149841_4_, p_149841_5_, p_149841_6_, p_149841_7_, UP);
+ }
+
+ private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7, ForgeDirection face)
+ {
+ int j1 = 0;
+ Block block = Block.blocksList[par1World.getBlockId(par2, par3, par4)];
+ if (block != null)
+ {
+ j1 = block.getFlammability(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), face);
+ }
if (par6Random.nextInt(par5) < j1)
+ private void tryCatchFire(World p_149841_1_, int p_149841_2_, int p_149841_3_, int p_149841_4_, int p_149841_5_, Random p_149841_6_, int p_149841_7_, ForgeDirection face)
+ {
+ int j1 = p_149841_1_.func_147439_a(p_149841_2_, p_149841_3_, p_149841_4_).getFlammability(p_149841_1_, p_149841_2_, p_149841_3_, p_149841_4_, face);
+
if (p_149841_6_.nextInt(p_149841_5_) < j1)
{
@@ -266,7 +277,12 @@
*/
private boolean canNeighborBurn(World par1World, int par2, int par3, int par4)
boolean flag = p_149841_1_.func_147439_a(p_149841_2_, p_149841_3_, p_149841_4_) == Blocks.field_150335_W;
@@ -234,7 +242,12 @@
private boolean func_149847_e(World p_149847_1_, int p_149847_2_, int p_149847_3_, int p_149847_4_)
{
- return this.canBlockCatchFire(par1World, par2 + 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2 - 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 - 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 + 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3, par4 - 1) ? true : this.canBlockCatchFire(par1World, par2, par3, par4 + 1)))));
+ return canBlockCatchFire(par1World, par2 + 1, par3, par4, WEST ) ||
+ canBlockCatchFire(par1World, par2 - 1, par3, par4, EAST ) ||
+ canBlockCatchFire(par1World, par2, par3 - 1, par4, UP ) ||
+ canBlockCatchFire(par1World, par2, par3 + 1, par4, DOWN ) ||
+ canBlockCatchFire(par1World, par2, par3, par4 - 1, SOUTH) ||
+ canBlockCatchFire(par1World, par2, par3, par4 + 1, NORTH);
- return this.func_149844_e(p_149847_1_, p_149847_2_ + 1, p_149847_3_, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_ - 1, p_149847_3_, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_ - 1, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_ + 1, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ - 1) ? true : this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ + 1)))));
+ return this.canCatchFire(p_149847_1_, p_149847_2_ + 1, p_149847_3_, p_149847_4_, WEST ) ||
+ this.canCatchFire(p_149847_1_, p_149847_2_ - 1, p_149847_3_, p_149847_4_, EAST ) ||
+ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_ - 1, p_149847_4_, UP ) ||
+ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_ + 1, p_149847_4_, DOWN ) ||
+ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ - 1, SOUTH) ||
+ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ + 1, NORTH);
}
/**
@@ -282,12 +298,12 @@
private int func_149845_m(World p_149845_1_, int p_149845_2_, int p_149845_3_, int p_149845_4_)
@@ -247,12 +260,13 @@
}
else
{
- int l = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, b0);
- l = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, l);
- l = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, l);
- l = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, l);
- l = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, l);
- l = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, l);
+ int l = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, b0, WEST);
+ l = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, l, EAST);
+ l = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, l, UP);
+ l = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, l, DOWN);
+ l = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, l, SOUTH);
+ l = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, l, NORTH);
- int l = this.func_149846_a(p_149845_1_, p_149845_2_ + 1, p_149845_3_, p_149845_4_, b0);
- l = this.func_149846_a(p_149845_1_, p_149845_2_ - 1, p_149845_3_, p_149845_4_, l);
- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_ - 1, p_149845_4_, l);
- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_ + 1, p_149845_4_, l);
- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ - 1, l);
- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ + 1, l);
+ int l = b0;
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_ + 1, p_149845_3_, p_149845_4_, l, WEST );
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_ - 1, p_149845_3_, p_149845_4_, l, EAST );
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_ - 1, p_149845_4_, l, UP );
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_ + 1, p_149845_4_, l, DOWN );
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ - 1, l, SOUTH);
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ + 1, l, NORTH);
return l;
}
}
@@ -302,21 +318,24 @@
/**
* Checks the specified block coordinate to see if it can catch fire. Args: blockAccess, x, y, z
- */
+ * Deprecated for a side-sensitive version
+ */
+ @Deprecated
public boolean canBlockCatchFire(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
- return this.chanceToEncourageFire[par1IBlockAccess.getBlockId(par2, par3, par4)] > 0;
+ return canBlockCatchFire(par1IBlockAccess, par2, par3, par4, UP);
@@ -262,15 +276,16 @@
return false;
}
/**
* Retrieves a specified block's chance to encourage their neighbors to burn and if the number is greater than the
* current number passed in it will return its number instead of the passed in one. Args: world, x, y, z,
* curChanceToEncourageFire
- */
+ * Deprecated for a side-sensitive version
+ */
+ @Deprecated
public int getChanceToEncourageFire(World par1World, int par2, int par3, int par4, int par5)
public boolean func_149844_e(IBlockAccess p_149844_1_, int p_149844_2_, int p_149844_3_, int p_149844_4_)
{
- int i1 = this.chanceToEncourageFire[par1World.getBlockId(par2, par3, par4)];
- return i1 > par5 ? i1 : par5;
+ return getChanceToEncourageFire(par1World, par2, par3, par4, par5, UP);
- return this.field_149849_a[Block.func_149682_b(p_149844_1_.func_147439_a(p_149844_2_, p_149844_3_, p_149844_4_))] > 0;
+ return canCatchFire(p_149844_1_, p_149844_2_, p_149844_3_, p_149844_4_, UP);
}
/**
@@ -374,9 +393,9 @@
+ @Deprecated
public int func_149846_a(World p_149846_1_, int p_149846_2_, int p_149846_3_, int p_149846_4_, int p_149846_5_)
{
- int i1 = this.field_149849_a[Block.func_149682_b(p_149846_1_.func_147439_a(p_149846_2_, p_149846_3_, p_149846_4_))];
- return i1 > p_149846_5_ ? i1 : p_149846_5_;
+ return getChanceToEncourageFire(p_149846_1_, p_149846_2_, p_149846_3_, p_149846_4_, p_149846_5_, UP);
}
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
@@ -314,9 +329,9 @@
float f1;
float f2;
- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4))
- {
- if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4))
+ if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4, UP))
+ {
+ if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4, EAST))
- if (!World.func_147466_a(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_) && !Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_))
+ if (!World.func_147466_a(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_) && !Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_, UP))
{
- if (Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_ - 1, p_149734_3_, p_149734_4_))
+ if (Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_ - 1, p_149734_3_, p_149734_4_, EAST))
{
for (l = 0; l < 2; ++l)
{
@@ -387,7 +406,7 @@
@@ -327,7 +342,7 @@
}
}
- if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4))
+ if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4, WEST))
- if (Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_ + 1, p_149734_3_, p_149734_4_))
+ if (Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_ + 1, p_149734_3_, p_149734_4_, WEST))
{
for (l = 0; l < 2; ++l)
{
@@ -398,7 +417,7 @@
@@ -338,7 +353,7 @@
}
}
- if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1))
+ if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1, SOUTH))
- if (Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ - 1))
+ if (Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ - 1, SOUTH))
{
for (l = 0; l < 2; ++l)
{
@@ -409,7 +428,7 @@
@@ -349,7 +364,7 @@
}
}
- if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1))
+ if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1, NORTH))
- if (Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ + 1))
+ if (Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ + 1, NORTH))
{
for (l = 0; l < 2; ++l)
{
@@ -420,7 +439,7 @@
@@ -360,7 +375,7 @@
}
}
- if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4))
+ if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4, DOWN))
- if (Blocks.field_150480_ab.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_ + 1, p_149734_4_))
+ if (Blocks.field_150480_ab.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ + 1, p_149734_4_, DOWN))
{
for (l = 0; l < 2; ++l)
{
@@ -469,4 +488,46 @@
@@ -405,4 +420,101 @@
{
return this.iconArray[0];
return MapColor.field_151656_f;
}
+
+
+ /*================================= Forge Start ======================================*/
+ private static class FireInfo
+ {
+ private int encouragement = 0;
+ private int flammibility = 0;
+ }
+ private IdentityHashMap<Block, FireInfo> blockInfo = Maps.newIdentityHashMap();
+
+ public void setFireInfo(Block block, int encouragement, int flammibility)
+ {
+ if (block == Blocks.field_150350_a) throw new IllegalArgumentException("Tried to set air on fire... This is bad.");
+ int id = Block.func_149682_b(block);
+ this.field_149849_a[id] = encouragement;
+ this.field_149848_b[id] = flammibility;
+
+ FireInfo info = getInfo(block, true);
+ info.encouragement = encouragement;
+ info.flammibility = flammibility;
+ }
+
+ private FireInfo getInfo(Block block, boolean garentee)
+ {
+ FireInfo ret = blockInfo.get(block);
+ if (ret == null && garentee)
+ {
+ ret = new FireInfo();
+ blockInfo.put(block, ret);
+ }
+ return ret;
+ }
+
+ public void rebuildFireInfo()
+ {
+ for (int x = 0; x < 4096; x++)
+ {
+ //If we care.. we could detect changes in here and make sure we keep them, however
+ //it's my thinking that anyone who hacks into the private variables should DIAF and we don't care about them.
+ field_149849_a[x] = 0;
+ field_149848_b[x] = 0;
+ }
+
+ for (Entry<Block, FireInfo> e : blockInfo.entrySet())
+ {
+ int id = Block.func_149682_b(e.getKey());
+ if (id >= 0 && id < 4096)
+ {
+ field_149849_a[id] = e.getValue().encouragement;
+ field_149848_b[id] = e.getValue().flammibility;
+ }
+ }
+ }
+
+ public int getFlammability(Block block)
+ {
+ int id = Block.func_149682_b(block);
+ return id >= 0 && id < 4096 ? field_149848_b[id] : 0;
+ }
+
+ public int getEncouragement(Block block)
+ {
+ int id = Block.func_149682_b(block);
+ return id >= 0 && id < 4096 ? field_149849_a[id] : 0;
+ }
+
+ /**
+ * Side sensitive version that calls the block function.
+ *
@@ -221,14 +284,9 @@
+ * @param face The side the fire is coming from
+ * @return True if the face can catch fire.
+ */
+ public boolean canBlockCatchFire(IBlockAccess world, int x, int y, int z, ForgeDirection face)
+ public boolean canCatchFire(IBlockAccess world, int x, int y, int z, ForgeDirection face)
+ {
+ Block block = Block.blocksList[world.getBlockId(x, y, z)];
+ if (block != null)
+ {
+ return block.isFlammable(world, x, y, z, world.getBlockMetadata(x, y, z), face);
+ }
+ return false;
+ return world.func_147439_a(x, y, z).isFlammable(world, x, y, z, face);
+ }
+
+ /**
@@ -242,14 +300,10 @@
+ * @param face The side the fire is coming from
+ * @return The chance of the block catching fire, or oldChance if it is higher
+ */
+ public int getChanceToEncourageFire(World world, int x, int y, int z, int oldChance, ForgeDirection face)
+ public int getChanceToEncourageFire(IBlockAccess world, int x, int y, int z, int oldChance, ForgeDirection face)
+ {
+ int newChance = 0;
+ Block block = Block.blocksList[world.getBlockId(x, y, z)];
+ if (block != null)
+ {
+ newChance = block.getFireSpreadSpeed(world, x, y, z, world.getBlockMetadata(x, y, z), face);
+ }
+ int newChance = world.func_147439_a(x, y, z).getFireSpreadSpeed(world, x, y, z, face);
+ return (newChance > oldChance ? newChance : oldChance);
+ }
+ /*================================= Forge Start ======================================*/
}
@@ -1,69 +0,0 @@
--- ../src_base/minecraft/net/minecraft/block/BlockFlower.java
+++ ../src_work/minecraft/net/minecraft/block/BlockFlower.java
@@ -6,7 +6,12 @@
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
-public class BlockFlower extends Block
+import net.minecraftforge.common.EnumPlantType;
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.IPlantable;
+import static net.minecraftforge.common.EnumPlantType.*;
+
+public class BlockFlower extends Block implements IPlantable
{
protected BlockFlower(int par1, Material par2Material)
{
@@ -27,7 +32,7 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- return super.canPlaceBlockAt(par1World, par2, par3, par4) && this.canThisPlantGrowOnThisBlockID(par1World.getBlockId(par2, par3 - 1, par4));
+ return super.canPlaceBlockAt(par1World, par2, par3, par4) && canBlockStay(par1World, par2, par3, par4);
}
/**
@@ -71,7 +76,9 @@
*/
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
{
- return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) && this.canThisPlantGrowOnThisBlockID(par1World.getBlockId(par2, par3 - 1, par4));
+ Block soil = blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
+ return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) &&
+ (soil != null && soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this));
}
/**
@@ -107,4 +114,32 @@
{
return 1;
}
+
+ @Override
+ public EnumPlantType getPlantType(World world, int x, int y, int z)
+ {
+ if (blockID == crops.blockID ) return Crop;
+ if (blockID == deadBush.blockID ) return Desert;
+ if (blockID == waterlily.blockID ) return Water;
+ if (blockID == mushroomRed.blockID ) return Cave;
+ if (blockID == mushroomBrown.blockID) return Cave;
+ if (blockID == netherStalk.blockID ) return Nether;
+ if (blockID == sapling.blockID ) return Plains;
+ if (blockID == melonStem.blockID ) return Crop;
+ if (blockID == pumpkinStem.blockID ) return Crop;
+ if (blockID == tallGrass.blockID ) return Plains;
+ return Plains;
+ }
+
+ @Override
+ public int getPlantID(World world, int x, int y, int z)
+ {
+ return blockID;
+ }
+
+ @Override
+ public int getPlantMetadata(World world, int x, int y, int z)
+ {
+ return world.getBlockMetadata(x, y, z);
+ }
}
@@ -0,0 +1,38 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFlowerPot.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java
@@ -2,6 +2,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
@@ -139,12 +140,6 @@
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
{
super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
- TileEntityFlowerPot tileentityflowerpot = this.func_149929_e(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_);
-
- if (tileentityflowerpot != null && tileentityflowerpot.func_145965_a() != null)
- {
- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(tileentityflowerpot.func_145965_a(), 1, tileentityflowerpot.func_145966_b()));
- }
}
public void func_149749_a(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
@@ -242,4 +237,14 @@
return new TileEntityFlowerPot(Item.func_150898_a((Block)object), b0);
}
+
+ @Override
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
+ {
+ ArrayList<ItemStack> ret = super.getDrops(world, x, y, z, metadata, fortune);
+ TileEntityFlowerPot te = this.func_149929_e(world, x, y, z);
+ if (te != null && te.func_145965_a() != null)
+ ret.add(new ItemStack(te.func_145965_a(), 1, te.func_145966_b()));
+ return ret;
+ }
}
@@ -1,11 +0,0 @@
--- ../src_base/minecraft/net/minecraft/block/BlockFlowing.java
+++ ../src_work/minecraft/net/minecraft/block/BlockFlowing.java
@@ -206,7 +206,7 @@
{
this.triggerLavaMixEffects(par1World, par2, par3, par4);
}
- else
+ else if (i1 != Block.snow.blockID)//Forge: Damn snow.
{
Block.blocksList[i1].dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
}
@@ -1,25 +0,0 @@
--- ../src_base/minecraft/net/minecraft/block/BlockFluid.java
+++ ../src_work/minecraft/net/minecraft/block/BlockFluid.java
@@ -59,7 +59,7 @@
{
for (int l1 = -1; l1 <= 1; ++l1)
{
- int i2 = par1IBlockAccess.getBiomeGenForCoords(par2 + l1, par4 + k1).waterColorMultiplier;
+ int i2 = par1IBlockAccess.getBiomeGenForCoords(par2 + l1, par4 + k1).getWaterColorMultiplier();
l += (i2 & 16711680) >> 16;
i1 += (i2 & 65280) >> 8;
j1 += i2 & 255;
@@ -81,6 +81,13 @@
}
return (float)(par0 + 1) / 9.0F;
+ }
+
+
+ @Deprecated //Implemented here for compatibility, need to change this when we make vanilla fluids use our fluid methods.
+ public float getFilledPercentage(IBlockAccess world, int x, int y, int z)
+ {
+ return 1 - BlockFluid.getFluidHeightPercent(world.getBlockMetadata(x, y, z));
}
@SideOnly(Side.CLIENT)
@@ -1,20 +1,37 @@
--- ../src_base/minecraft/net/minecraft/block/BlockGrass.java
+++ ../src_work/minecraft/net/minecraft/block/BlockGrass.java
@@ -44,7 +44,7 @@
--- ../src-base/minecraft/net/minecraft/block/BlockGrass.java
+++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java
@@ -43,7 +43,7 @@
{
if (!par1World.isRemote)
if (!p_149674_1_.field_72995_K)
{
- if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2)
+ if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && par1World.getBlockLightOpacity(par2, par3 + 1, par4) > 2)
- if (p_149674_1_.func_72957_l(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ + 1, p_149674_4_).func_149717_k() > 2)
+ if (p_149674_1_.func_72957_l(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.getBlockLightOpacity(p_149674_2_, p_149674_3_ + 1, p_149674_4_) > 2)
{
par1World.setBlock(par2, par3, par4, Block.dirt.blockID);
p_149674_1_.func_147449_b(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.field_150346_d);
}
@@ -57,7 +57,7 @@
int k1 = par4 + par5Random.nextInt(3) - 1;
int l1 = par1World.getBlockId(i1, j1 + 1, k1);
@@ -56,7 +56,7 @@
int k1 = p_149674_4_ + p_149674_5_.nextInt(3) - 1;
Block block = p_149674_1_.func_147439_a(i1, j1 + 1, k1);
- if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && Block.lightOpacity[l1] <= 2)
+ if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && par1World.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
- if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.field_150346_d && p_149674_1_.func_72805_g(i1, j1, k1) == 0 && p_149674_1_.func_72957_l(i1, j1 + 1, k1) >= 4 && block.func_149717_k() <= 2)
+ if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.field_150346_d && p_149674_1_.func_72805_g(i1, j1, k1) == 0 && p_149674_1_.func_72957_l(i1, j1 + 1, k1) >= 4 && p_149674_1_.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
{
par1World.setBlock(i1, j1, k1, Block.grass.blockID);
p_149674_1_.func_147449_b(i1, j1, k1, Blocks.field_150349_c);
}
@@ -184,15 +184,7 @@
}
else
{
- String s = p_149853_1_.func_72807_a(i1, k1).func_150572_a(p_149853_2_, i1, j1, k1);
- field_149992_a.debug("Flower in " + p_149853_1_.func_72807_a(i1, k1).field_76791_y + ": " + s);
- BlockFlower blockflower = BlockFlower.func_149857_e(s);
-
- if (blockflower != null && blockflower.func_149718_j(p_149853_1_, i1, j1, k1))
- {
- int i2 = BlockFlower.func_149856_f(s);
- p_149853_1_.func_147465_d(i1, j1, k1, blockflower, i2, 3);
- }
+ p_149853_1_.func_72807_a(i1, k1).plantFlower(p_149853_1_, p_149853_2_, i1, j1, k1);
}
}
@@ -0,0 +1,50 @@
--- ../src-base/minecraft/net/minecraft/block/BlockIce.java
+++ ../src-work/minecraft/net/minecraft/block/BlockIce.java
@@ -2,6 +2,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
@@ -13,6 +14,7 @@
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.event.ForgeEventFactory;
public class BlockIce extends BlockBreakable
{
@@ -43,14 +45,16 @@
p_149636_2_.func_71064_a(StatList.field_75934_C[Block.func_149682_b(this)], 1);
p_149636_2_.func_71020_j(0.025F);
- if (this.func_149700_E() && EnchantmentHelper.func_77502_d(p_149636_2_))
+ if (this.canSilkHarvest(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_) && EnchantmentHelper.func_77502_d(p_149636_2_))
{
+ ArrayList<ItemStack> items = new ArrayList<ItemStack>();
ItemStack itemstack = this.func_149644_j(p_149636_6_);
- if (itemstack != null)
- {
- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, itemstack);
- }
+ if (itemstack != null) items.add(itemstack);
+
+ ForgeEventFactory.fireBlockHarvesting(items, p_149636_1_, this, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_, 0, 1.0f, true, p_149636_2_);
+ for (ItemStack is : items)
+ this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, is);
}
else
{
@@ -61,7 +65,9 @@
}
int i1 = EnchantmentHelper.func_77517_e(p_149636_2_);
+ harvesters.set(p_149636_2_);
this.func_149697_b(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_, i1);
+ harvesters.set(null);
Material material = p_149636_1_.func_147439_a(p_149636_3_, p_149636_4_ - 1, p_149636_5_).func_149688_o();
if (material.func_76230_c() || material.func_76224_d())
@@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/block/BlockLadder.java
+++ ../src_work/minecraft/net/minecraft/block/BlockLadder.java
@@ -5,9 +5,13 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLadder.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java
@@ -5,10 +5,14 @@
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
@@ -8,85 +8,85 @@
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+
+import net.minecraftforge.common.ForgeDirection;
+import static net.minecraftforge.common.ForgeDirection.*;
+import net.minecraftforge.common.util.ForgeDirection;
+import static net.minecraftforge.common.util.ForgeDirection.*;
+
public class BlockLadder extends Block
{
@@ -104,7 +108,10 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
private static final String __OBFID = "CL_00000262";
@@ -79,29 +83,32 @@
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1)));
+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ) ||
+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST ) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH);
- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r()));
+ return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST ) ||
+ p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST ) ||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH) ||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH);
}
/**
@@ -114,22 +121,22 @@
public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
{
int j1 = par9;
int j1 = p_149660_9_;
- if ((par9 == 0 || par5 == 2) && par1World.isBlockNormalCube(par2, par3, par4 + 1))
+ if ((j1 == 0 || par5 == 2) && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH))
- if ((p_149660_9_ == 0 || p_149660_5_ == 2) && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ + 1).func_149721_r())
+ if ((p_149660_9_ == 0 || p_149660_5_ == 2) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH))
{
j1 = 2;
}
- if ((j1 == 0 || par5 == 3) && par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ if ((j1 == 0 || par5 == 3) && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH))
- if ((j1 == 0 || p_149660_5_ == 3) && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ - 1).func_149721_r())
+ if ((j1 == 0 || p_149660_5_ == 3) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH))
{
j1 = 3;
}
- if ((j1 == 0 || par5 == 4) && par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ if ((j1 == 0 || par5 == 4) && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST))
- if ((j1 == 0 || p_149660_5_ == 4) && p_149660_1_.func_147439_a(p_149660_2_ + 1, p_149660_3_, p_149660_4_).func_149721_r())
+ if ((j1 == 0 || p_149660_5_ == 4) && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST))
{
j1 = 4;
}
- if ((j1 == 0 || par5 == 5) && par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ if ((j1 == 0 || par5 == 5) && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST))
- if ((j1 == 0 || p_149660_5_ == 5) && p_149660_1_.func_147439_a(p_149660_2_ - 1, p_149660_3_, p_149660_4_).func_149721_r())
+ if ((j1 == 0 || p_149660_5_ == 5) && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST))
{
j1 = 5;
}
@@ -146,22 +153,22 @@
int i1 = par1World.getBlockMetadata(par2, par3, par4);
@@ -114,22 +121,22 @@
int l = p_149695_1_.func_72805_g(p_149695_2_, p_149695_3_, p_149695_4_);
boolean flag = false;
- if (i1 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1))
+ if (i1 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH))
- if (l == 2 && p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r())
+ if (l == 2 && p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH))
{
flag = true;
}
- if (i1 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ if (i1 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH))
- if (l == 3 && p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r())
+ if (l == 3 && p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH))
{
flag = true;
}
- if (i1 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ if (i1 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST))
- if (l == 4 && p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r())
+ if (l == 4 && p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST))
{
flag = true;
}
- if (i1 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ if (i1 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST))
- if (l == 5 && p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r())
+ if (l == 5 && p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST))
{
flag = true;
}
@@ -182,4 +189,10 @@
@@ -147,4 +154,10 @@
{
return 1;
}
+
+ @Override
+ public boolean isLadder(World world, int x, int y, int z, EntityLivingBase entity)
+ public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity)
+ {
+ return true;
+ }
@@ -1,99 +1,171 @@
--- ../src_base/minecraft/net/minecraft/block/BlockLeaves.java
+++ ../src_work/minecraft/net/minecraft/block/BlockLeaves.java
@@ -2,6 +2,8 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java
@@ -2,6 +2,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
+import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.material.Material;
@@ -16,7 +18,9 @@
import net.minecraft.creativetab.CreativeTabs;
@@ -15,8 +16,9 @@
import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class BlockLeaves extends BlockLeavesBase
+import net.minecraftforge.common.IShearable;
+
+public class BlockLeaves extends BlockLeavesBase implements IShearable
{
public static final String[] LEAF_TYPES = new String[] {"oak", "spruce", "birch", "jungle"};
public static final String[][] field_94396_b = new String[][] {{"leaves_oak", "leaves_spruce", "leaves_birch", "leaves_jungle"}, {"leaves_oak_opaque", "leaves_spruce_opaque", "leaves_birch_opaque", "leaves_jungle_opaque"}};
@@ -111,10 +115,9 @@
{
int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2);
- if (j2 == Block.leaves.blockID)
+ if (Block.blocksList[j2] != null)
-public abstract class BlockLeaves extends BlockLeavesBase
+public abstract class BlockLeaves extends BlockLeavesBase implements IShearable
{
int[] field_150128_a;
@SideOnly(Side.CLIENT)
@@ -82,10 +84,10 @@
{
for (int l1 = -b0; l1 <= b0; ++l1)
{
- if (p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1).func_149688_o() == Material.field_151584_j)
+ Block block = p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
+ if (block.isLeaves(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1))
{
- int k2 = par1World.getBlockMetadata(par2 + k1, par3 + l1, par4 + i2);
- par1World.setBlockMetadataWithNotify(par2 + k1, par3 + l1, par4 + i2, k2 | 8, 4);
+ Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2);
- int i2 = p_149749_1_.func_72805_g(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
- p_149749_1_.func_72921_c(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1, i2 | 8, 4);
+ block.beginLeavesDecay(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
}
}
}
@@ -160,11 +163,13 @@
@@ -127,9 +129,9 @@
{
k2 = par1World.getBlockId(par2 + l1, par3 + i2, par4 + j2);
Block block = p_149674_1_.func_147439_a(p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2);
- if (k2 == Block.wood.blockID)
+ Block block = Block.blocksList[k2];
+
+ if (block != null && block.canSustainLeaves(par1World, par2 + l1, par3 + i2, par4 + j2))
- if (block != Blocks.field_150364_r && block != Blocks.field_150363_s)
+ if (!block.canSustainLeaves(p_149674_1_, p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2))
{
this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
}
- else if (k2 == Block.leaves.blockID)
+ else if (block != null && block.isLeaves(par1World, par2 + l1, par3 + i2, par4 + j2))
{
this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
}
@@ -329,15 +334,7 @@
*/
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
- if (block.func_149688_o() == Material.field_151584_j)
+ if (block.isLeaves(p_149674_1_, p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2))
{
this.field_150128_a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
}
@@ -236,40 +238,7 @@
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
{
- if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID)
- if (!p_149690_1_.field_72995_K)
- {
- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.leaves.blockID, 1, par6 & 3));
- int j1 = this.func_150123_b(p_149690_5_);
-
- if (p_149690_7_ > 0)
- {
- j1 -= 2 << p_149690_7_;
-
- if (j1 < 10)
- {
- j1 = 10;
- }
- }
-
- if (p_149690_1_.field_73012_v.nextInt(j1) == 0)
- {
- Item item = this.func_149650_a(p_149690_5_, p_149690_1_.field_73012_v, p_149690_7_);
- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(item, 1, this.func_149692_a(p_149690_5_)));
- }
-
- j1 = 200;
-
- if (p_149690_7_ > 0)
- {
- j1 -= 10 << p_149690_7_;
-
- if (j1 < 40)
- {
- j1 = 40;
- }
- }
-
- this.func_150124_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, j1);
- }
+ super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, 1.0f, p_149690_7_);
}
protected void func_150124_c(World p_150124_1_, int p_150124_2_, int p_150124_3_, int p_150124_4_, int p_150124_5_, int p_150124_6_) {}
@@ -281,13 +250,7 @@
public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_)
{
- if (!p_149636_1_.field_72995_K && p_149636_2_.func_71045_bC() != null && p_149636_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ)
{
- p_149636_2_.func_71064_a(StatList.field_75934_C[Block.func_149682_b(this)], 1);
- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Item.func_150898_a(this), 1, p_149636_6_ & 3));
- }
- else
- {
- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
- }
+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
}
/**
@@ -418,4 +415,30 @@
}
super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_);
}
}
@@ -318,4 +281,67 @@
}
public abstract String[] func_150125_e();
+
+
+ @Override
+ public boolean isShearable(ItemStack item, World world, int x, int y, int z)
+ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z)
+ {
+ return true;
+ }
+
+ @Override
+ public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
+ public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
+ ret.add(new ItemStack(this, 1, world.func_72805_g(x, y, z) & 3));
+ return ret;
+ }
+
+ @Override
+ public void beginLeavesDecay(World world, int x, int y, int z)
+ {
+ world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) | 8, 4);
+
+ int i2 = world.func_72805_g(x, y, z);
+
+ if ((i2 & 8) == 0)
+ {
+ world.func_72921_c(x, y, z, i2 | 8, 4);
+ }
+ world.func_72921_c(x, y, z, world.func_72805_g(x, y, z) | 8, 4);
+ }
+
+ @Override
+ public boolean isLeaves(World world, int x, int y, int z)
+ public boolean isLeaves(IBlockAccess world, int x, int y, int z)
+ {
+ return true;
+ }
+
+
+ @Override
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ int chance = this.func_150123_b(metadata);
+
+ if (fortune > 0)
+ {
+ chance -= 2 << fortune;
+ if (chance < 10) chance = 10;
+ }
+
+ if (world.field_73012_v.nextInt(chance) == 0)
+ ret.add(new ItemStack(this.func_149650_a(metadata, world.field_73012_v, fortune), 1, this.func_149692_a(metadata)));
+
+ chance = 200;
+ if (fortune > 0)
+ {
+ chance -= 10 << fortune;
+ if (chance < 40) chance = 40;
+ }
+
+ this.captureDrops(true);
+ this.func_150124_c(world, x, y, z, metadata, chance); // Dammet mojang
+ ret.addAll(this.captureDrops(false));
+ return ret;
+ }
}
@@ -1,159 +1,128 @@
--- ../src_base/minecraft/net/minecraft/block/BlockLever.java
+++ ../src_work/minecraft/net/minecraft/block/BlockLever.java
--- ../src-base/minecraft/net/minecraft/block/BlockLever.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLever.java
@@ -10,6 +10,9 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
+import static net.minecraftforge.common.ForgeDirection.*;
+import net.minecraftforge.common.util.ForgeDirection;
+import static net.minecraftforge.common.util.ForgeDirection.*;
+
public class BlockLever extends Block
{
protected BlockLever(int par1)
@@ -57,7 +60,13 @@
*/
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
private static final String __OBFID = "CL_00000264";
@@ -42,12 +45,23 @@
public boolean func_149707_d(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_)
{
- return par5 == 0 && par1World.isBlockNormalCube(par2, par3 + 1, par4) ? true : (par5 == 1 && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) ? true : (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)))));
+ ForgeDirection dir = ForgeDirection.getOrientation(par5);
+ return (dir == DOWN && par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN )) ||
+ (dir == UP && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP )) ||
+ (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) ||
+ (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) ||
+ (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST )) ||
+ (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ));
- return p_149707_5_ == 0 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_ + 1, p_149707_4_).func_149721_r() ? true : (p_149707_5_ == 1 && World.func_147466_a(p_149707_1_, p_149707_2_, p_149707_3_ - 1, p_149707_4_) ? true : (p_149707_5_ == 2 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ + 1).func_149721_r() ? true : (p_149707_5_ == 3 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ - 1).func_149721_r() ? true : (p_149707_5_ == 4 && p_149707_1_.func_147439_a(p_149707_2_ + 1, p_149707_3_, p_149707_4_).func_149721_r() ? true : p_149707_5_ == 5 && p_149707_1_.func_147439_a(p_149707_2_ - 1, p_149707_3_, p_149707_4_).func_149721_r()))));
+ ForgeDirection dir = ForgeDirection.getOrientation(p_149707_5_);
+ return (dir == DOWN && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_ + 1, p_149707_4_, DOWN )) ||
+ (dir == UP && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_ - 1, p_149707_4_, UP )) ||
+ (dir == NORTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ + 1, NORTH)) ||
+ (dir == SOUTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ - 1, SOUTH)) ||
+ (dir == WEST && p_149707_1_.isSideSolid(p_149707_2_ + 1, p_149707_3_, p_149707_4_, WEST )) ||
+ (dir == EAST && p_149707_1_.isSideSolid(p_149707_2_ - 1, p_149707_3_, p_149707_4_, EAST ));
}
/**
@@ -65,7 +74,12 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) ? true : par1World.isBlockNormalCube(par2, par3 + 1, par4)))));
+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ) ||
+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST ) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) ||
+ par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP ) ||
+ par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN );
- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r() ? true : (World.func_147466_a(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ + 1, p_149742_4_).func_149721_r()))));
+ return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST ) ||
+ p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST ) ||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH) ||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH) ||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_ - 1, p_149742_4_, UP ) ||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_ + 1, p_149742_4_, DOWN );
}
/**
@@ -77,32 +91,32 @@
int k1 = par9 & 7;
public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
@@ -56,32 +70,32 @@
int j1 = p_149660_9_ & 7;
byte b0 = -1;
- if (par5 == 0 && par1World.isBlockNormalCube(par2, par3 + 1, par4))
+ if (par5 == 0 && par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN))
- if (p_149660_5_ == 0 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_ + 1, p_149660_4_).func_149721_r())
+ if (p_149660_5_ == 0 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_ + 1, p_149660_4_, DOWN))
{
b0 = 0;
}
- if (par5 == 1 && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4))
+ if (par5 == 1 && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP))
- if (p_149660_5_ == 1 && World.func_147466_a(p_149660_1_, p_149660_2_, p_149660_3_ - 1, p_149660_4_))
+ if (p_149660_5_ == 1 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_ - 1, p_149660_4_, UP))
{
b0 = 5;
}
- if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1))
+ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH))
- if (p_149660_5_ == 2 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ + 1).func_149721_r())
+ if (p_149660_5_ == 2 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH))
{
b0 = 4;
}
- if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH))
- if (p_149660_5_ == 3 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ - 1).func_149721_r())
+ if (p_149660_5_ == 3 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH))
{
b0 = 3;
}
- if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST))
- if (p_149660_5_ == 4 && p_149660_1_.func_147439_a(p_149660_2_ + 1, p_149660_3_, p_149660_4_).func_149721_r())
+ if (p_149660_5_ == 4 && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST))
{
b0 = 2;
}
- if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST))
- if (p_149660_5_ == 5 && p_149660_1_.func_147439_a(p_149660_2_ - 1, p_149660_3_, p_149660_4_).func_149721_r())
+ if (p_149660_5_ == 5 && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST))
{
b0 = 1;
}
@@ -178,42 +192,42 @@
int i1 = par1World.getBlockMetadata(par2, par3, par4) & 7;
@@ -147,42 +161,42 @@
int l = p_149695_1_.func_72805_g(p_149695_2_, p_149695_3_, p_149695_4_) & 7;
boolean flag = false;
- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && i1 == 1)
- {
- flag = true;
- }
-
- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && i1 == 2)
- {
- flag = true;
- }
-
- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && i1 == 3)
- {
- flag = true;
- }
-
- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && i1 == 4)
- {
- flag = true;
- }
-
- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && i1 == 5)
- {
- flag = true;
- }
-
- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && i1 == 6)
- {
- flag = true;
- }
-
- if (!par1World.isBlockNormalCube(par2, par3 + 1, par4) && i1 == 0)
- {
- flag = true;
- }
-
- if (!par1World.isBlockNormalCube(par2, par3 + 1, par4) && i1 == 7)
+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) && i1 == 1)
+ {
+ flag = true;
+ }
+
+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) && i1 == 2)
+ {
+ flag = true;
+ }
+
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) && i1 == 3)
+ {
+ flag = true;
+ }
+
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) && i1 == 4)
+ {
+ flag = true;
+ }
+
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) && i1 == 5)
+ {
+ flag = true;
+ }
+
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) && i1 == 6)
+ {
+ flag = true;
+ }
+
+ if (!par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN) && i1 == 0)
+ {
+ flag = true;
+ }
+
+ if (!par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN) && i1 == 7)
- if (!p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 1)
+ if (!p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST) && l == 1)
{
flag = true;
}
- if (!p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 2)
+ if (!p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST) && l == 2)
{
flag = true;
}
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r() && l == 3)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH) && l == 3)
{
flag = true;
}
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r() && l == 4)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH) && l == 4)
{
flag = true;
}
- if (!World.func_147466_a(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_) && l == 5)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ - 1, p_149695_4_, UP) && l == 5)
{
flag = true;
}
- if (!World.func_147466_a(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_) && l == 6)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ - 1, p_149695_4_, UP) && l == 6)
{
flag = true;
}
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_ + 1, p_149695_4_).func_149721_r() && l == 0)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ + 1, p_149695_4_, DOWN) && l == 0)
{
flag = true;
}
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_ + 1, p_149695_4_).func_149721_r() && l == 7)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ + 1, p_149695_4_, DOWN) && l == 7)
{
flag = true;
}
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLiquid.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLiquid.java
@@ -67,7 +67,7 @@
{
for (int l1 = -1; l1 <= 1; ++l1)
{
- int i2 = p_149720_1_.func_72807_a(p_149720_2_ + l1, p_149720_4_ + k1).field_76759_H;
+ int i2 = p_149720_1_.func_72807_a(p_149720_2_ + l1, p_149720_4_ + k1).getWaterColorMultiplier();
l += (i2 & 16711680) >> 16;
i1 += (i2 & 65280) >> 8;
j1 += i2 & 255;
@@ -1,35 +1,44 @@
--- ../src_base/minecraft/net/minecraft/block/BlockLog.java
+++ ../src_work/minecraft/net/minecraft/block/BlockLog.java
@@ -62,14 +62,9 @@
{
int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2);
--- ../src-base/minecraft/net/minecraft/block/BlockLog.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLog.java
@@ -7,6 +7,7 @@
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
- if (j2 == Block.leaves.blockID)
+ if (Block.blocksList[j2] != null)
public abstract class BlockLog extends BlockRotatedPillar
@@ -53,14 +54,10 @@
{
for (int l1 = -b0; l1 <= b0; ++l1)
{
- if (p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1).func_149688_o() == Material.field_151584_j)
+ Block block = p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
+ if (block.isLeaves(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1))
{
- int k2 = par1World.getBlockMetadata(par2 + k1, par3 + l1, par4 + i2);
- int i2 = p_149749_1_.func_72805_g(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
-
- if ((k2 & 8) == 0)
- if ((i2 & 8) == 0)
- {
- par1World.setBlockMetadataWithNotify(par2 + k1, par3 + l1, par4 + i2, k2 | 8, 4);
- p_149749_1_.func_72921_c(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1, i2 | 8, 4);
- }
+ Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2);
+ block.beginLeavesDecay(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
}
}
}
@@ -135,4 +130,16 @@
this.tree_top[i] = par1IconRegister.registerIcon(this.getTextureName() + "_" + woodType[i] + "_top");
}
@@ -79,4 +76,16 @@
{
return this.field_150166_b[p_150161_1_ % this.field_150166_b.length];
}
+
+ @Override
+ public boolean canSustainLeaves(World world, int x, int y, int z)
+ public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z)
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isWood(World world, int x, int y, int z)
+ public boolean isWood(IBlockAccess world, int x, int y, int z)
+ {
+ return true;
+ }
@@ -1,17 +1,28 @@
--- ../src_base/minecraft/net/minecraft/block/BlockMobSpawner.java
+++ ../src_work/minecraft/net/minecraft/block/BlockMobSpawner.java
@@ -45,8 +45,12 @@
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
--- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java
@@ -7,6 +7,7 @@
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityMobSpawner;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockMobSpawner extends BlockContainer
@@ -36,10 +37,15 @@
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
{
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7);
- int j1 = 15 + par1World.rand.nextInt(15) + par1World.rand.nextInt(15);
- this.dropXpOnBlockBreak(par1World, par2, par3, par4, j1);
+ }
+
+ @Override
+ public int getExpDrop(World world, int data, int enchantmentLevel)
+ {
+ return 15 + world.rand.nextInt(15) + world.rand.nextInt(15);
super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
- int j1 = 15 + p_149690_1_.field_73012_v.nextInt(15) + p_149690_1_.field_73012_v.nextInt(15);
- this.func_149657_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, j1);
}
/**
+ private Random rand = new Random();
+ @Override
+ public int getExpDrop(IBlockAccess world, int metadata, int fortune)
+ {
+ return 15 + rand.nextInt(15) + rand.nextInt(15);
+ }
+
public boolean func_149662_c()
{
return false;
@@ -1,22 +1,19 @@
--- ../src_base/minecraft/net/minecraft/block/BlockMushroom.java
+++ ../src_work/minecraft/net/minecraft/block/BlockMushroom.java
@@ -3,6 +3,8 @@
import java.util.Random;
--- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java
@@ -4,6 +4,7 @@
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenBigMushroom;
+
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.util.ForgeDirection;
public class BlockMushroom extends BlockFlower
public class BlockMushroom extends BlockBush implements IGrowable
{
@@ -96,7 +98,9 @@
if (par3 >= 0 && par3 < 256)
@@ -85,7 +86,7 @@
if (p_149718_3_ >= 0 && p_149718_3_ < 256)
{
int l = par1World.getBlockId(par2, par3 - 1, par4);
- return l == Block.mycelium.blockID || par1World.getFullBlockLightValue(par2, par3, par4) < 13 && this.canThisPlantGrowOnThisBlockID(l);
+ Block soil = Block.blocksList[l];
+ return (l == Block.mycelium.blockID || par1World.getFullBlockLightValue(par2, par3, par4) < 13) &&
+ (soil != null && soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this));
Block block = p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_);
- return block == Blocks.field_150391_bh || block == Blocks.field_150346_d && p_149718_1_.func_72805_g(p_149718_2_, p_149718_3_ - 1, p_149718_4_) == 2 || p_149718_1_.func_72883_k(p_149718_2_, p_149718_3_, p_149718_4_) < 13 && this.func_149854_a(block);
+ return block == Blocks.field_150391_bh || block == Blocks.field_150346_d && p_149718_1_.func_72805_g(p_149718_2_, p_149718_3_ - 1, p_149718_4_) == 2 || p_149718_1_.func_72883_k(p_149718_2_, p_149718_3_, p_149718_4_) < 13 && block.canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this);
}
else
{
@@ -1,20 +1,20 @@
--- ../src_base/minecraft/net/minecraft/block/BlockMycelium.java
+++ ../src_work/minecraft/net/minecraft/block/BlockMycelium.java
@@ -41,7 +41,7 @@
--- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java
@@ -37,7 +37,7 @@
{
if (!par1World.isRemote)
if (!p_149674_1_.field_72995_K)
{
- if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2)
+ if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && par1World.getBlockLightOpacity(par2, par3 + 1, par4) > 2)
- if (p_149674_1_.func_72957_l(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ + 1, p_149674_4_).func_149717_k() > 2)
+ if (p_149674_1_.func_72957_l(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.getBlockLightOpacity(p_149674_2_, p_149674_3_ + 1, p_149674_4_) > 2)
{
par1World.setBlock(par2, par3, par4, Block.dirt.blockID);
p_149674_1_.func_147449_b(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.field_150346_d);
}
@@ -54,7 +54,7 @@
int k1 = par4 + par5Random.nextInt(3) - 1;
int l1 = par1World.getBlockId(i1, j1 + 1, k1);
@@ -50,7 +50,7 @@
int k1 = p_149674_4_ + p_149674_5_.nextInt(3) - 1;
Block block = p_149674_1_.func_147439_a(i1, j1 + 1, k1);
- if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && Block.lightOpacity[l1] <= 2)
+ if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && par1World.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
- if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.field_150346_d && p_149674_1_.func_72805_g(i1, j1, k1) == 0 && p_149674_1_.func_72957_l(i1, j1 + 1, k1) >= 4 && block.func_149717_k() <= 2)
+ if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.field_150346_d && p_149674_1_.func_72805_g(i1, j1, k1) == 0 && p_149674_1_.func_72957_l(i1, j1 + 1, k1) >= 4 && p_149674_1_.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
{
par1World.setBlock(i1, j1, k1, this.blockID);
p_149674_1_.func_147449_b(i1, j1, k1, this);
}
@@ -1,80 +0,0 @@
--- ../src_base/minecraft/net/minecraft/block/BlockNetherStalk.java
+++ ../src_work/minecraft/net/minecraft/block/BlockNetherStalk.java
@@ -2,6 +2,8 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
+import java.util.ArrayList;
import java.util.Random;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
@@ -9,6 +11,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
public class BlockNetherStalk extends BlockFlower
{
@@ -38,7 +41,8 @@
*/
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
{
- return this.canThisPlantGrowOnThisBlockID(par1World.getBlockId(par2, par3 - 1, par4));
+ Block block = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
+ return (block != null && block.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this));
}
/**
@@ -80,25 +84,7 @@
*/
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
{
- if (!par1World.isRemote)
- {
- int j1 = 1;
-
- if (par5 >= 3)
- {
- j1 = 2 + par1World.rand.nextInt(3);
-
- if (par7 > 0)
- {
- j1 += par1World.rand.nextInt(par7 + 1);
- }
- }
-
- for (int k1 = 0; k1 < j1; ++k1)
- {
- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.netherStalkSeeds));
- }
- }
+ super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7);
}
/**
@@ -142,4 +128,23 @@
this.iconArray[i] = par1IconRegister.registerIcon(this.getTextureName() + "_stage_" + i);
}
}
+
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ int count = 1;
+
+ if (metadata >= 3)
+ {
+ count = 2 + world.rand.nextInt(3) + (fortune > 0 ? world.rand.nextInt(fortune + 1) : 0);
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ ret.add(new ItemStack(Item.netherStalkSeeds));
+ }
+
+ return ret;
+ }
}
@@ -0,0 +1,65 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java
@@ -2,6 +2,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import java.util.ArrayList;
import java.util.Random;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
@@ -11,6 +12,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
public class BlockNetherWart extends BlockBush
{
@@ -33,7 +35,7 @@
public boolean func_149718_j(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_)
{
- return this.func_149854_a(p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_));
+ return super.func_149718_j(p_149718_1_, p_149718_2_, p_149718_3_, p_149718_4_);
}
public void func_149674_a(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
@@ -60,9 +62,12 @@
return 6;
}
+ @SuppressWarnings("unused")
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
{
- if (!p_149690_1_.field_72995_K)
+ super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
+
+ if (false && !p_149690_1_.field_72995_K)
{
int j1 = 1;
@@ -109,4 +114,23 @@
this.field_149883_a[i] = p_149651_1_.func_94245_a(this.func_149641_N() + "_stage_" + i);
}
}
+
+ @Override
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ int count = 1;
+
+ if (metadata >= 3)
+ {
+ count = 2 + world.field_73012_v.nextInt(3) + (fortune > 0 ? world.field_73012_v.nextInt(fortune + 1) : 0);
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ ret.add(new ItemStack(Items.field_151075_bm));
+ }
+
+ return ret;
+ }
}
@@ -0,0 +1,24 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNote.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNote.java
@@ -45,7 +45,9 @@
if (tileentitynote != null)
{
+ int old = tileentitynote.field_145879_a;
tileentitynote.func_145877_a();
+ if (old == tileentitynote.field_145879_a) return false;
tileentitynote.func_145878_a(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_);
}
@@ -73,6 +75,11 @@
public boolean func_149696_a(World p_149696_1_, int p_149696_2_, int p_149696_3_, int p_149696_4_, int p_149696_5_, int p_149696_6_)
{
+ int meta = p_149696_1_.func_72805_g(p_149696_2_, p_149696_3_, p_149696_4_);
+ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(p_149696_1_, p_149696_2_, p_149696_3_, p_149696_4_, meta, p_149696_6_, p_149696_5_);
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false;
+ p_149696_5_ = e.instrument.ordinal();
+ p_149696_6_ = e.getVanillaNoteId();
float f = (float)Math.pow(2.0D, (double)(p_149696_6_ - 12) / 12.0D);
String s = "harp";
@@ -1,27 +1,58 @@
--- ../src_base/minecraft/net/minecraft/block/BlockOre.java
+++ ../src_work/minecraft/net/minecraft/block/BlockOre.java
@@ -60,6 +60,11 @@
{
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7);
--- ../src-base/minecraft/net/minecraft/block/BlockOre.java
+++ ../src-work/minecraft/net/minecraft/block/BlockOre.java
@@ -7,6 +7,7 @@
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.util.MathHelper;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockOre extends Block
@@ -51,34 +52,40 @@
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
{
super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
+ }
+
- if (this.func_149650_a(p_149690_5_, p_149690_1_.field_73012_v, p_149690_7_) != Item.func_150898_a(this))
+ private Random rand = new Random();
+ @Override
+ public int getExpDrop(World par1World, int par5, int par7)
+ public int getExpDrop(IBlockAccess p_149690_1_, int p_149690_5_, int p_149690_7_)
+ {
if (this.idDropped(par5, par1World.rand, par7) != this.blockID)
+ if (this.func_149650_a(p_149690_5_, rand, p_149690_7_) != Item.func_150898_a(this))
{
int j1 = 0;
@@ -84,9 +89,10 @@
{
j1 = MathHelper.getRandomIntegerInRange(par1World.rand, 2, 5);
}
+ return j1;
+ }
- this.dropXpOnBlockBreak(par1World, par2, par3, par4, j1);
- }
if (this == Blocks.field_150365_q)
{
- j1 = MathHelper.func_76136_a(p_149690_1_.field_73012_v, 0, 2);
+ j1 = MathHelper.func_76136_a(rand, 0, 2);
}
else if (this == Blocks.field_150482_ag)
{
- j1 = MathHelper.func_76136_a(p_149690_1_.field_73012_v, 3, 7);
+ j1 = MathHelper.func_76136_a(rand, 3, 7);
}
else if (this == Blocks.field_150412_bA)
{
- j1 = MathHelper.func_76136_a(p_149690_1_.field_73012_v, 3, 7);
+ j1 = MathHelper.func_76136_a(rand, 3, 7);
}
else if (this == Blocks.field_150369_x)
{
- j1 = MathHelper.func_76136_a(p_149690_1_.field_73012_v, 2, 5);
+ j1 = MathHelper.func_76136_a(rand, 2, 5);
}
else if (this == Blocks.field_150449_bY)
{
- j1 = MathHelper.func_76136_a(p_149690_1_.field_73012_v, 2, 5);
+ j1 = MathHelper.func_76136_a(rand, 2, 5);
}
- this.func_149657_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, j1);
+ return j1;
}
+ return 0;
}
/**
public int func_149692_a(int p_149692_1_)
@@ -1,51 +1,52 @@
--- ../src_base/minecraft/net/minecraft/block/BlockPane.java
+++ ../src_work/minecraft/net/minecraft/block/BlockPane.java
@@ -13,6 +13,7 @@
import net.minecraft.util.Icon;
--- ../src-base/minecraft/net/minecraft/block/BlockPane.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPane.java
@@ -15,6 +15,8 @@
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.util.ForgeDirection;
+import static net.minecraftforge.common.util.ForgeDirection.*;
public class BlockPane extends Block
{
@@ -90,10 +91,10 @@
*/
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
@@ -62,10 +64,10 @@
public void func_149743_a(World p_149743_1_, int p_149743_2_, int p_149743_3_, int p_149743_4_, AxisAlignedBB p_149743_5_, List p_149743_6_, Entity p_149743_7_)
{
- boolean flag = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2, par3, par4 - 1));
- boolean flag1 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2, par3, par4 + 1));
- boolean flag2 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2 - 1, par3, par4));
- boolean flag3 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2 + 1, par3, par4));
+ boolean flag = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.NORTH);
+ boolean flag1 = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.SOUTH);
+ boolean flag2 = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.WEST);
+ boolean flag3 = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.EAST);
- boolean flag = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_, p_149743_3_, p_149743_4_ - 1));
- boolean flag1 = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_, p_149743_3_, p_149743_4_ + 1));
- boolean flag2 = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_ - 1, p_149743_3_, p_149743_4_));
- boolean flag3 = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_ + 1, p_149743_3_, p_149743_4_));
+ boolean flag = this.canPaneConnectTo(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_ - 1, NORTH);
+ boolean flag1 = this.canPaneConnectTo(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_ + 1, SOUTH);
+ boolean flag2 = this.canPaneConnectTo(p_149743_1_, p_149743_2_ - 1, p_149743_3_, p_149743_4_, WEST );
+ boolean flag3 = this.canPaneConnectTo(p_149743_1_, p_149743_2_ + 1, p_149743_3_, p_149743_4_, EAST );
if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1))
{
@@ -151,10 +152,10 @@
@@ -117,10 +119,10 @@
float f1 = 0.5625F;
float f2 = 0.4375F;
float f3 = 0.5625F;
- boolean flag = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2, par3, par4 - 1));
- boolean flag1 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2, par3, par4 + 1));
- boolean flag2 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2 - 1, par3, par4));
- boolean flag3 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2 + 1, par3, par4));
+ boolean flag = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.NORTH);
+ boolean flag1 = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.SOUTH);
+ boolean flag2 = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.WEST);
+ boolean flag3 = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.EAST);
- boolean flag = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_, p_149719_3_, p_149719_4_ - 1));
- boolean flag1 = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_, p_149719_3_, p_149719_4_ + 1));
- boolean flag2 = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_ - 1, p_149719_3_, p_149719_4_));
- boolean flag3 = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_ + 1, p_149719_3_, p_149719_4_));
+ boolean flag = this.canPaneConnectTo(p_149719_1_, p_149719_2_, p_149719_3_, p_149719_4_ - 1, NORTH);
+ boolean flag1 = this.canPaneConnectTo(p_149719_1_, p_149719_2_, p_149719_3_, p_149719_4_ + 1, SOUTH);
+ boolean flag2 = this.canPaneConnectTo(p_149719_1_, p_149719_2_ - 1, p_149719_3_, p_149719_4_, WEST );
+ boolean flag3 = this.canPaneConnectTo(p_149719_1_, p_149719_2_ + 1, p_149719_3_, p_149719_4_, EAST );
if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1))
{
@@ -240,4 +241,10 @@
this.blockIcon = par1IconRegister.registerIcon(this.field_94402_c);
this.theIcon = par1IconRegister.registerIcon(this.sideTextureIndex);
@@ -186,4 +188,10 @@
this.field_149761_L = p_149651_1_.func_94245_a(this.field_150101_M);
this.field_150102_N = p_149651_1_.func_94245_a(this.field_150100_a);
}
+
+ // FORGE START
+ public boolean canPaneConnectTo(IBlockAccess access, int x, int y, int z, ForgeDirection dir)
+ public boolean canPaneConnectTo(IBlockAccess world, int x, int y, int z, ForgeDirection dir)
+ {
+ return canThisPaneConnectToThisBlockID(access.getBlockId(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ)) || access.isBlockSolidOnSide(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, dir.getOpposite(), false);
+ return func_150098_a(world.func_147439_a(x, y, z)) ||
+ world.isSideSolid(x, y, z, dir.getOpposite(), false);
+ }
}
@@ -1,56 +1,65 @@
--- ../src_base/minecraft/net/minecraft/block/BlockPistonBase.java
+++ ../src_work/minecraft/net/minecraft/block/BlockPistonBase.java
@@ -439,7 +439,7 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java
@@ -11,6 +11,7 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
+import net.minecraft.server.management.PlayerManager;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityPiston;
import net.minecraft.util.AxisAlignedBB;
@@ -360,7 +361,8 @@
return false;
}
- return !(Block.blocksList[par0] instanceof ITileEntityProvider);
+ return !par1World.blockHasTileEntity(par2, par3, par4);
- return !(p_150080_0_ instanceof ITileEntityProvider);
+ return !(p_150080_1_.func_147439_a(p_150080_2_, p_150080_3_, p_150080_4_).hasTileEntity(p_150080_1_.func_72805_g(p_150080_2_, p_150080_3_, p_150080_4_)));
+
}
}
@@ -457,14 +457,14 @@
@@ -375,14 +377,14 @@
{
if (l1 < 13)
{
- if (j1 <= 0 || j1 >= 255)
+ if (j1 <= 0 || j1 >= par0World.getHeight() - 1)
+ if (j1 <= 0 || j1 >= p_150077_0_.func_72800_K())
{
return false;
}
int i2 = par0World.getBlockId(i1, j1, k1);
Block block = p_150077_0_.func_147439_a(i1, j1, k1);
- if (i2 != 0)
+ if (!par0World.isAirBlock(i1, j1, k1))
- if (block.func_149688_o() != Material.field_151579_a)
+ if (!block.isAir(p_150077_0_, i1, j1, k1))
{
if (!canPushBlock(i2, par0World, i1, j1, k1, true))
if (!func_150080_a(block, p_150077_0_, i1, j1, k1, true))
{
@@ -507,14 +507,14 @@
@@ -420,14 +422,14 @@
{
if (l1 < 13)
{
- if (j1 <= 0 || j1 >= 255)
+ if (j1 <= 0 || j1 >= par1World.getHeight() - 1)
+ if (j1 <= 0 || j1 >= p_150079_1_.func_72800_K())
{
return false;
}
i2 = par1World.getBlockId(i1, j1, k1);
Block block = p_150079_1_.func_147439_a(i1, j1, k1);
- if (i2 != 0)
+ if (!par1World.isAirBlock(i1, j1, k1))
- if (block.func_149688_o() != Material.field_151579_a)
+ if (!block.isAir(p_150079_1_, i1, j1, k1))
{
if (!canPushBlock(i2, par1World, i1, j1, k1, true))
if (!func_150080_a(block, p_150079_1_, i1, j1, k1, true))
{
@@ -535,7 +535,9 @@
@@ -448,7 +450,9 @@
continue;
}
- Block.blocksList[i2].dropBlockAsItem(par1World, i1, j1, k1, par1World.getBlockMetadata(i1, j1, k1), 0);
- block.func_149697_b(p_150079_1_, i1, j1, k1, p_150079_1_.func_72805_g(i1, j1, k1), 0);
+ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior.
+ float chance = (Block.blocksList[i2] instanceof BlockSnow ? -1.0f : 1.0f);
+ Block.blocksList[i2].dropBlockAsItemWithChance(par1World, i1, j1, k1, par1World.getBlockMetadata(i1, j1, k1), chance, 0);
par1World.setBlockToAir(i1, j1, k1);
+ float chance = block instanceof BlockSnow ? -1.0f : 1.0f;
+ block.func_149690_a(p_150079_1_, i1, j1, k1, p_150079_1_.func_72805_g(i1, j1, k1), chance, 0);
p_150079_1_.func_147468_f(i1, j1, k1);
}
}
Loaded 100 of 536 files, more files were not shown because too many files have changed in this diff. Show more