Compare commits

..
235 Commits
Author SHA1 Message Date
LexManos 3cc76a3f60 Fix Entity.getPersistentData function name. Closes #6131
Bump spec version for first 1.14.4 RB.
2019-09-12 09:12:30 -07:00
Justin ffdeeb95b7 Fix ParticleFactoryRegisterEvent not firing (#6126) 2019-09-12 09:01:43 -07:00
David Quintana 58335d7bc0 Minor fixes to the fluids (#6150)
* Fixed vanilla rendering of fluids to take into account the alpha bits of the color, and fix usages accordingly.
* Fixed missing texture derp.
2019-09-12 17:33:19 +02:00
David Quintana b0c9d7cce9 Some (sadly breaking) improvements to the Fluid API (#6110)
* Some (sadly breaking) improvements to the API, after feedback and concerns provided by users:
  - Moved calculation of the translation key to the FluidAttributes constructor, so that builders can be shared between still & flowing sub-fluids.
  - Moved biome-based coloring to a dedicated FluidAttributes.Water variant, which is not used by default.
  - Added logic to automatically gather fluid textures into the list of textures to bake.
  - Patched BucketItem and FlowingFluidBlock to avoid eager access to the fluid objects.
  - Added a ForgeFlowingFluid class, as a more user-friendly way to construct a new FlowingFluid.
2019-09-11 16:00:32 +02:00
LexManos 281ef5a152 Add new DeferredRegistry helper, and change RegistryObject to update when overrides are registered. 2019-09-10 16:02:07 -07:00
LexManos 9183c2fa0d Delay Block loot table name generation until needed, as calling early will result in an empty name as the block is not registered yet. 2019-09-10 16:00:57 -07:00
LexManos 389751beae Fix slimes splitting more times then they should. Closes #6138 2019-09-09 15:30:11 -07:00
tterrag 2b4e3bcf54 Fix a couple places not calling forge getLightValue 2019-09-08 23:32:27 -04:00
tterrag 3dce85c49f Properly fix missing attribute issue, add vanilla bug ID 2019-09-08 02:23:16 -04:00
tterrag 185ce79a68 Fix vanilla typo causing errors when client is missing entity attributes 2019-09-08 02:05:01 -04:00
tterrag f777aba227 Remove StructureArgument to work around vanilla issue, clean up custom arguments 2019-09-08 02:01:17 -04:00
tterrag 5efa373d7f Fix SCommandListPacket underflowing buffer when encountering a missing argument type 2019-09-08 01:33:21 -04:00
cpw b6cd19b4ae Fix problem with network connections timing out frequently. Turns out
there's a race condition - and the extra work forge does causes it to
happen much more frequently than vanilla (though I'm sure it's a vanilla
issue). Closes #6124, #5767 and probably lots more.

Signed-off-by: cpw <[email protected]>
2019-09-07 18:42:50 -04:00
tterrag fc5573333d Make /locate command support modded structures 2019-09-07 01:09:42 -04:00
tterrag 55fe7c470f Make STRUCTURE_FEATURE registry a slave map of the FEATURE registry
Also convert Feature.STRUCTURES to a slave map
2019-09-06 23:42:19 -04:00
LexManos 3ef1d6919c Fix REGISTER packet encode/decode issues.
Changed ForgeConfig values to return the default value if the config is not loaded, and exposed the value objects as a internal config.
2019-09-05 15:38:14 -07:00
LexManos e1863383ff Fix naming conflicts with official names. 2019-09-04 22:33:17 -07:00
LexManos 4dc34b7d5b Fix item used stat not triggering properly on last item in the stack. 2019-09-03 19:58:57 -07:00
LexManos 2c8c022034 Add a bunch of tags from the omnibus.
Fix test imports. And update patches for line numbers.
2019-09-03 18:51:09 -07:00
bl4ckscor3 b5b43a5a36 Add spawn reason to spawn events (#6096) 2019-09-03 15:15:48 -07:00
Wire Segal c09fe57031 Add collisionExtendsVertically hook to allow modded blocks that extend collision into the block above similar to fences. (#6092) 2019-09-03 14:50:27 -07:00
Daniël Goossens 68524ddde9 Fixed PlayerInteractEvent.LeftClickBlock useItem/useBlock (#6045) 2019-09-03 14:41:46 -07:00
Daniël Goossens 55bdd4d937 Readded IForgeItem#getHighlightTip hook. (#6036) 2019-09-03 14:30:41 -07:00
mcenderdragon 3f089e3add Added gravity as attribute to Entities (#5630) 2019-09-03 13:20:44 -07:00
ichttt ddb90a69d3 Fix CME on chunk unload in FarmlandTicketManager (#5998) 2019-09-03 12:59:35 -07:00
cpw bdce8d0494 Add a modfolderfactory. Fix up login payload exposure.
Signed-off-by: cpw <[email protected]>
2019-09-01 14:40:39 -04:00
cpw 734a3d76aa Peel IModLocator into the SPI package and extract a small IModFile
interface as well. This allows building external IModLocator
implementations.

Signed-off-by: cpw <[email protected]>
2019-09-01 11:31:09 -04:00
cpw a4aa85259e Add in some client only player connectivity events. Closes #5536
Signed-off-by: cpw <[email protected]>
2019-08-31 13:55:46 -04:00
cpw ea1c7a7339 Add in MC REGISTER nonsense. Shut up #5730
Tweak network a bit to fix initialization order stupidity. (Constants don't
load classes!)

Signed-off-by: cpw <[email protected]>
2019-08-31 13:55:46 -04:00
Tobias Hotz 185f7344fa move default log level for debug file to debug instead of trace, and remove millis from console and GUI. Also remove unused config xmls 2019-08-31 13:55:46 -04:00
GirafiStudios 26e4bf92a0 Added getters for FMLPlayMessages.SpawnEntity 2019-08-31 13:55:46 -04:00
cpw 68cb017be1 Move indexFor and biConsumer into FMLHandshakeHandler and expose them publicly, so mods can add additional
login messages. Closes #6087

Signed-off-by: cpw <[email protected]>
2019-08-31 13:55:45 -04:00
David Quintana 68ff1afac1 Hookup BlockEvent.FluidPlaceBlockEvent (#6103) 2019-08-31 14:15:08 +02:00
cpw 0d448a5e4f Update libs to 1.0 versions, bump grgit, and fix tag search behaviour that resulted.
Signed-off-by: cpw <[email protected]>
2019-08-29 23:39:49 -04:00
David Quintana d9f6659f2c Fluid rework derp fixes. (#6098)
* Fix nulls returning from non-null methods, and null-check of non-nullable values.
* Fix missed computation of the isEmpty flag in FluidStack
* Cleanup getAmount/isEmpty calls.
* Remove redundant suppliers. That info is readily available from the vanilla Fluid / FluidState.
2019-08-29 21:09:42 +02:00
Vincent Lee bae2ee0420 Minor model system cleanup/documentation (#6089) 2019-08-28 21:33:49 -07:00
ichttt 799e864d93 Fix Digging particle sometimes using the wrong block pos to get additional model data (#6077) 2019-08-28 21:33:15 -07:00
DaemonUmbra aa38f62bae Change fml.modloading.brokenfile.optifine to not imply that Forge is responsible for Forge-Optifine compatibility. (#6080) 2019-08-28 21:32:33 -07:00
ichttt 06c3e255b3 Add a config comment that lists the available constants of enums (#6079) 2019-08-28 21:28:21 -07:00
bl4ckscor3 d5e20b13b9 Restore PotionShiftEvent (#6042) 2019-08-28 21:15:55 -07:00
Daniël Goossens c83d4d29e4 Added new InputEvent.MouseScrollEvent, fixes #5811 (#6037) 2019-08-28 21:13:31 -07:00
Brennan Ward ee1c06085b Add Villager Trading Events (#6016) 2019-08-28 20:34:07 -07:00
BlakeBr0 336d53b692 Strip side annotations from CropsBlock.getSeedsItem (#6013) 2019-08-28 20:14:41 -07:00
Wyn Price 95c58ba75c Updated constants to 1.14 (#6012) 2019-08-28 20:13:47 -07:00
valoeghese 56857cf5e7 Added hook to allow biomes to specify custom river variants. (#5969) 2019-08-28 20:12:52 -07:00
Vincent Lee 838998b885 Add particle factory registration event (#6018) 2019-08-28 18:42:17 -07:00
David Quintana a9b3b48273 Make FluidStacks non-nullable, and implement some TODOs. 2019-08-29 03:18:42 +02:00
David Quintana a788e8a475 Fix license headers so gradlew build is happy. 2019-08-29 03:18:42 +02:00
David Quintana b7e1cc5f6b Fluid API rework (#5983)
- Moved forge fluids into FluidAttributes companion object to the vanilla Fluid. By gigaherz
- Redesigned the Fluid API to be closer to the Items API. By King Lemming
Co-authored-by: King Lemming <[email protected]>
2019-08-29 03:18:41 +02:00
LexManos e784a7f606 Recipe system cleanup. (#6014) 2019-08-29 03:18:41 +02:00
Managarmr 3e9bc3c434 Fix regular arrows giving off particles after a world reload (MC-107941) (#6061) 2019-08-28 18:12:47 -07:00
ichttt dd340b8ef2 Fix coremod not redirecting to the correct method (#6078) 2019-08-28 17:49:46 -07:00
LexManos 7deb479676 Fix blocks being placed in adventure mode. Closes #6085
Add early error for setting invalid world directory. Closes #6084
Fix PlayerTickEvent not firing when dead, even if player isn't removed from world yet. Closes #6074
Fix PlayerDestroyItemEvent not firing for some cases. Closes #6067
2019-08-28 12:57:25 -07:00
LexManos 1ab40e0b3f Fix Javac generics breakage. 2019-08-20 15:40:36 -07:00
LexManos 283c3d1664 Prevent worlds from unloading while players are in out-of-world states by tracking all worlds references by every player in the server's player list. 2019-08-20 15:31:08 -07:00
LexManos 5291ea7270 Add Argument serializer for ModIdArgument. EnumArgument can't as vanilla doesn't support extra data. 2019-08-20 15:29:26 -07:00
LexManos 0c1c1b65e1 Sort server.properties while writing. 2019-08-20 15:27:31 -07:00
LexManos b0787e9f40 Fix chunk load failure when entering End portal Closes #6068 2019-08-19 19:46:00 -07:00
LexManos dc0eacb80f Fix Configs not generating correctly on first load Closes #6069 2019-08-19 19:45:32 -07:00
Vincent Lee 8c04651301 Add hook to load custom mrls/rls not attached to a block or item. (#6010) 2019-08-15 11:03:57 -07:00
bl4ckscor3 94621fecd1 Cover more cases for RightClickBlock event and restore onItemUseFirst (#6009) 2019-08-15 10:34:59 -07:00
kirderf1 5e392e3300 Make DimensionManager.SavedEntry save sky light consistently (#6019) 2019-08-15 10:17:28 -07:00
LexManos 88595dd26b Fix extract inheritance not using proper classpath and update buildscript for FG asm changes. 2019-08-14 16:13:15 -07:00
cpw 4323c6d845 Grrr. Stupid error. Sorry lex: I fixed it.
Signed-off-by: cpw <[email protected]>
2019-08-05 08:56:42 -04:00
cpw 81ec8b99ac Actually reload config when it changes on disk. Closes #5541 and #5959
Signed-off-by: cpw <[email protected]>
2019-08-04 22:37:43 -04:00
cpw 1af7b7603d Move fml's PlayerEvent and TickEvent to forge. Update
`import net.minecraftforge.fml.common.gameevent.PlayerEvent;`
to
`import net.minecraftforge.event.entity.player.PlayerEvent;`
and
`import net.minecraftforge.fml.common.gameevent.TickEvent;`
to
`import net.minecraftforge.event.TickEvent;`

Signed-off-by: cpw <[email protected]>
2019-08-04 22:34:14 -04:00
cpw 0fd8fa2211 Bump modlauncher to 3.2.x. Add a sender modid and document IMC. Closes #5746
Signed-off-by: cpw <[email protected]>
2019-08-04 22:19:02 -04:00
cpw 5048739b7f Turned minecraft into a proper Mod, with a "dummy" language provider.
Also fixed the "translations" not being available early if an exception occurs
by force loading the forge and MC ones. Closes #5984

Signed-off-by: cpw <[email protected]>
2019-08-04 20:16:01 -04:00
DaemonUmbra 44f3f9e2d0 Fix a crash I caused by misunderstanding formatToString (#6007) 2019-08-02 18:48:46 -07:00
LexManos ed1c55508f Fix userdev setup by moving SAS concept to FG. 2019-08-02 18:03:27 -07:00
its_meow 50e411b82a Add piston events (#5798) 2019-08-02 14:12:21 -07:00
its_meow a8a0306f98 Fix AT for EntitySpawnPlacementRegistry.register 2019-08-02 14:06:05 -07:00
desht 19b7d26bc2 Make ParticleManager.IParticleMetaFactory public (#5926) 2019-08-02 14:05:32 -07:00
JoJoModding c7940e70ed Add button to open mods folder (#5986) 2019-08-02 14:00:54 -07:00
DaemonUmbra 58ede2c80a Change ModLoadingException to display ModID instead of ModInfo instance identifier. (#5999) 2019-08-02 13:44:56 -07:00
henkelmax e83e00520f Fixed PlayerInteractEvents not working (#5976) 2019-08-02 13:44:17 -07:00
Gamebuster 9a50c208f0 Fixed Buttons in the error screen are incorrectly rendered if they are extremely long Closes #5687 (#5924) 2019-08-02 13:42:58 -07:00
Gamebuster 7acb380ba8 Fix LazyOptional throwing NPE to consumers when owners null. (#5772) 2019-08-02 13:42:13 -07:00
LexManos 48fa2f458c Make Villager profession unlocalized name use modids when not 'minecraft' Closes #5977
Fixed trees able to be generated through water. Closes #6000
Change Block#toString to use getRegistryName instead of getNameForObject Closes #5937
Allow Cooking Recipes to deserialize results with stack sizes. Closes #5960
2019-08-02 13:37:02 -07:00
LexManos 318fc6ffe8 Fixed DimensionType.getRegistryName() returning null Closes #5992
Fixed RegisterDimensionEvent not firing for new worlds. Closes #5987
2019-07-31 22:43:46 -07:00
LexManos b009cedc0c Introduce new Side Annotation Stripper system to semi-automate the shipment of Sided methods and cleanup patches.
New forge:checkSAS task to validate this config file. Closes #5995
2019-07-31 21:15:39 -07:00
ichttt c6dd475610 Move world unload patch to tick function to prevent duplicate unloading, fix log message in dim manager, fix javadoc for unload method (#5964) 2019-07-30 16:39:05 -07:00
bl4ckscor3 61285a098a fix melon and pumpkin seeds being peaceable on more than just farmland (#5980) 2019-07-30 16:35:23 -07:00
Paul Becker 995a8b8d35 Fixed possible ClassCastException with dye-able armor. (#5985) 2019-07-30 16:30:12 -07:00
cpw 5d33697cb1 Fix naming for dev launch providers - they're in MCP..
Signed-off-by: cpw <[email protected]>
2019-07-29 20:19:50 -04:00
cpw ae09fc6b6d Register a config command. Currently one subcommand: showfile, which
when passed a modid and a type (CLIENT, COMMON or SERVER) will display
a link in the caller's chat to open that file in the OS file viewer of choice.

Signed-off-by: cpw <[email protected]>
2019-07-28 21:09:15 -04:00
cpw cd826f7bcf Load default configs from the defaultconfig directory by default. (Can
be overridden in the fml.toml config file if desired).

Will load any type of config tracked file from there - client, common, server
or custom tracked file. This means you can ship defaults for your pack
in a defaultconfig directory. I am thinking about ways to force a specific
config override for an existing config.

Signed-off-by: cpw <[email protected]>
2019-07-28 13:44:18 -04:00
cpw 283ece29e8 Fix vanilla bug that hardcore death doesn't clean up properly, leaving
a running server and a broken GUI. Vanilla bug MC-148865

Signed-off-by: cpw <[email protected]>
2019-07-27 12:47:59 -04:00
LexManos 1918148b8e Fixed network ticking player entity while it is dead. And explicitly prevent overworld from unloading. Closes #5978 2019-07-27 02:35:06 -07:00
cpw e17714583f Crash report extended to show ModLauncher FML and Forge data.
Signed-off-by: cpw <[email protected]>
2019-07-26 20:02:21 -04:00
cpw 4c05c63a04 Fix potion transformer to look up the right name depending on context.
Signed-off-by: cpw <[email protected]>
2019-07-26 00:35:03 -04:00
cpw 0bdc2d04b4 Added a coremod, shush, don't tell Lex.
Seriously, this is how to do targeted changes to specific classes.

In this case, adding a fieldtomethod redirect for EffectInstance.potion
to allow substitution.

Signed-off-by: cpw <[email protected]>
2019-07-25 23:02:05 -04:00
LexManos 57d4d60a33 Fix Slimes not splitting on death Closes #5973 2019-07-25 17:59:57 -07:00
LexManos 731e1920d2 Fix @ObjectHolderRegistry not properly detecting vanilla class level references. Closes #5958 2019-07-25 17:59:08 -07:00
LexManos 7411b444d3 Fixed missed patch causing blocks to not dropping EXP and BreakEvent to not fire. 2019-07-24 11:15:23 -07:00
David Quintana ae3d002ac6 Fix & Improve state comparison when checking vanilla block replacements (#5922) 2019-07-22 19:23:20 -07:00
LexManos 1bd70ac5ab Keep player cap data until they have revived. Closes #5956 2019-07-22 15:45:38 -07:00
cpw c90b1732e9 Fix objloader registering at wrong time. Closes #5847. Added test
class as suggested in the issue.

Note: most tests are commented out at the present time, pending
rework. Tests that work, work.

Signed-off-by: cpw <[email protected]>
2019-07-20 21:04:00 -04:00
cpw fcd9582133 Fix datafixer exception catch: Closes #5951
Signed-off-by: cpw <[email protected]>
2019-07-20 19:59:08 -04:00
cpw 9d82d822db Fix error when ModsDiscoverer visits a non existent mods dir.
Closes cpw/modlauncher#30

Signed-off-by: cpw <[email protected]>
2019-07-20 19:37:54 -04:00
cpw 186d91c03f Merge branch 'pull/5948' into 1.14.x 2019-07-20 19:35:26 -04:00
cpw eec5809097 Realms' removal has removed the need for additional jar transformation.
Signed-off-by: cpw <[email protected]>
2019-07-20 19:33:54 -04:00
cpw 4582a29ec1 Make I18N format errors less spammy, also remove single apostrophes from
current translations in en_us.json. Other langs may still have problems.

Closes #5952
Signed-off-by: cpw <[email protected]>
2019-07-20 19:14:17 -04:00
JoJoModding 2f83234ccb Fix spam during startup (#5957) 2019-07-20 14:55:21 -07:00
ichttt bef52c945b Fix forge 1.14.4 startup in obfed enviroment (#5955) 2019-07-20 12:59:23 -07:00
Thomas Aunvik 1de4ad735b Updated Example Version Range for 1.14.4 (#5950)
* Updated Example Version Range for 1.14.4

* Also changed loader version and version range
2019-07-20 12:06:06 -04:00
LexManos 00fc29d40d Fix javac compile issues. 2019-07-19 23:27:31 -07:00
cpw 27afdc8a27 Provisional update to 1.14.4. Missing a lot of playerinteractionmanager patches because everything moved and I'm tired.
Fix up immediate problems.

bump to 28.
2019-07-20 00:35:40 -04:00
cpw eff42f6066 Update mappings to 20190719 in prep for 1.14.4..
Signed-off-by: cpw <[email protected]>
2019-07-19 11:55:30 -04:00
Barteks2x b99453d568 Fix RegistryObject when used with generic registry entry classes 2019-07-19 12:06:16 +02:00
CJ Miller 9f5ce12754 Remove OnlyIn Client Distribution from Effect and EffectType methods. (#5925) 2019-07-18 14:15:31 -07:00
LexManos cb21e95e0b Change default BrewingRecipe to use an Ingredient for the input instead of ItemStack. Closes #5944
Add AT for GameRules.register Closes #5946
Fix Forge Blockstate loader model path is inconsistent with vanilla blockstates Closes #5892
Fix client crashing when opting not to load a world when there's missing blocks Closes #5886
2019-07-18 14:13:20 -07:00
LexManos e6f032db1b Fix CheckSpawn event logic for natural spawns. 2019-07-16 22:38:11 -07:00
LexManos 86e9425638 Fixed item breaking particles not capturing current state of the ItemStack. Closes #5934 2019-07-16 16:02:52 -07:00
ewewukek 53ac33a84c Fix RenderSpecificHandEvent firing with wrong hand stack (#5927) 2019-07-16 12:42:33 -07:00
its_meow 5cf2af569f [1.14.x] Fix text positioning issues caused by scaling loading screen (#5932) 2019-07-16 12:41:21 -07:00
LexManos a46b7cb67a Fixed PlayerSleepInBedEvent pos is always null Closes #5936
Fixed decompile error causing Endless Loop in ModelBackery if model errors exist.
Fixed NPEs related to teleporting players without portals.
2019-07-16 11:52:51 -07:00
LexManos 3d78f30d18 Add simple concurrency protection to Server world list. Closes #5938 and #5739 2019-07-16 09:59:33 -07:00
cpw ad64d383e1 Update modlauncher to the 3.x series.
Signed-off-by: cpw <[email protected]>
2019-07-14 22:48:30 -04:00
tterrag1098 0a7f5ff9fa Rework GuiModList mod info to use custom scrolling panel impl 2019-07-10 20:13:33 -07:00
LexManos ce28c5794d Cleanup Forge's Access Transformer, and add ATs for Block.Properties#noDrop, and AxeItem/PickaxeItem. Closes #5866 and Closes #5921 2019-07-10 17:39:19 -07:00
LexManos e55c7c889b Fix race condition in client mouse handler. Closes #5888 2019-07-10 17:35:53 -07:00
LexManos 0633e8218f Added LootPool.Builder#bonusRolls setter. Closes #5887 2019-07-09 18:21:05 -07:00
LexManos 0fdfe1fd59 Implemented Item.get/setDamage hooks. Closes #5899 2019-07-09 18:03:19 -07:00
LexManos 2cc264645b Implement Item.isRepairable in Crafting and Grindstone. Closes #5917 2019-07-09 18:02:47 -07:00
LexManos 983e0a93db Re-implement state.onBlockExploded() Closes #5914 2019-07-09 17:07:09 -07:00
Vincent Lee d88e4fbf36 Add general damage hook for items. Closes #5502 (#5670) 2019-07-08 20:43:02 -07:00
LexManos f79da3edf7 Fix syntax error in IRenderHandler. 2019-07-08 20:14:41 -07:00
LexManos 8742d74e93 Pass tick counter to custom render handlers (#5744) 2019-07-08 19:55:47 -07:00
Cadiboo ff80ab6a23 Fire Loading event (#5795) 2019-07-08 19:49:47 -07:00
Dirk "YouDirk" Lehmann 8c37d642fe Fix logoFile not working properly (#5775) 2019-07-08 19:49:31 -07:00
ichttt 06a30e9f23 Adds some explanatory javadocs and check world in ModelDataManager (#5762) 2019-07-08 19:47:18 -07:00
Antoine Lucas 650e7dc16e Add InputEvent documentation (#5698) 2019-07-08 19:47:06 -07:00
ichttt d41fad51c2 Add IModelData to getParticleTexture (#5756) 2019-07-08 19:46:32 -07:00
ichttt 0463949ac3 Fixed BakedModelWrapper not delegating new methods (#5761) 2019-07-08 19:45:27 -07:00
Sargun Vohra 5f0fd4b706 Throw exception when a mod returns null from a dispatched capability provider (#5646) 2019-07-08 19:45:10 -07:00
Benjamin K 201c368325 Add isServer and isClient methods to LogicalSide (#5606)
* Add helper methods to LogicalSide.

* Fix backwards docs.
2019-07-08 19:44:35 -07:00
Cadiboo 3fe08f149d Added documentation to ObfuscationReflectionHelper adn deprecated index based functions. (#5893) 2019-07-08 19:44:21 -07:00
LexManos 61bea2bfda Fixed EntityJoinWorldEvent not being fired when player is added to ServerWorld. #5827
Fixed wrong example path for the access transformer in the MDK build.gradle. #5891
Added getters for mouse x/y velocity and if the middle-mouse button is being held down. #5776
Modify issue template for better clarity. #5874
Fixed grindstone not using ItemStack-sensitive getMaxDamage. #5831
Added ParticleManager.registerFactory to Forge's AT. #5896
Fixed NPE in SidedInvWrapper when side was null. #5787
Moved EndermanEntity.setAttackTarget super call to allow LivingSetAttackTargetEvent the ability to override default behavior. #5778
Added field to make "Looking at" debug info maximum distance configurable #5714
2019-07-08 18:42:12 -07:00
DaemonUmbra f720140481 Disable Config Button when no mods are selected (#5905)
Closes #5889
2019-07-08 15:56:49 -07:00
Tedstar 66a2d38ab8 Fix MC-258 on mod list screen, enable sorting, minor tweaks. (#5846) 2019-07-08 15:50:05 -07:00
DaemonUmbra bed266f310 Fixed #5895: Shearing via Displenser drops Shears (#5906) 2019-07-08 15:47:34 -07:00
Cloudhunter 719f08ea5e Fix link applying to whole component in chat if component starts with link (#5909) 2019-07-08 15:46:49 -07:00
Suppergerrie2 3992ea5c59 Added harvestLevel and harvestTool setter to the Block.Properties. (#5916) 2019-07-08 15:45:53 -07:00
LexManos a01c1cdc3a Fix installer realms issue on server.
Uptake EventBus changes to fix some potential dead locks.
2019-07-05 13:26:23 -07:00
m00nl1ght-dev 7a8ae9f56b Fix old entity not being removed on dimension change (#5833) 2019-07-04 13:03:45 -07:00
primetoxinz 765efc3c72 Update TextureStitchEvent.Pre to give access to the list of ResourceLocations that will be loaded as textures. (#5870) 2019-07-03 12:26:51 -07:00
LexManos bc23c1ddb2 Add installer processor to deobfuscate Mincraft's Realms library.
This task will processes the current realms library from the json, so the installer must be re-ran every time they update it.
2019-07-03 01:08:20 -07:00
David Quintana 87e2fcb4e5 Redirect a method to the recipe book container, to allow modded screens to have a recipe book. (#5873) 2019-07-02 13:05:03 -07:00
Take Weiland 478b7e7ccc Fix WorldEvent.Unload not firing on the client (fixes #5880) (#5884) 2019-07-02 12:58:45 -07:00
Take Weiland 0574db134c Fix TickEvent.PlayerTickEvent firing twice for tick end (fixes #5878) (#5885) 2019-07-02 12:57:06 -07:00
LexManos 358211ca66 Fix type cast issues in ForgeConfig values. Closes #5894
Added config value set and save functions.
By default mod configs are auto-saved, so you do not need to call save unless you create your own Config object.
2019-07-02 11:54:59 -07:00
cpw c8e5007913 Remove legacy StartupProgress.
Implement properly scalable progress thanks to @gigaherz. Closes #5863.
Implement API for pushing messages to the startup screen from mods.
Add memory display.

Signed-off-by: cpw <[email protected]>
2019-06-30 23:48:54 -04:00
cpw 943fedb073 Update coremods to newer version, with support for new targets.
Signed-off-by: cpw <[email protected]>
2019-06-29 17:05:18 -04:00
LexManos 13ae8e41ee Fix duplicate WorldEvent.Unload call in client key handler.
Add recipe generator to replace vanilla recipes with Forge tags.
2019-06-27 17:23:23 -07:00
LexManos ac8b196b8c Fix dimension save data invalid cache being to aggressive. 2019-06-27 10:57:03 -07:00
ある 2c3183bdae Fix garbled "µs" (#5818) 2019-06-26 13:23:47 -07:00
LexManos 53349603e2 Fix fmluserdevdata not being a valid launch target. 2019-06-25 18:16:10 -07:00
LexManos c284de366b Split userdev data entry point into it's own provider to fix duplicate mod issue. 2019-06-25 18:03:51 -07:00
tterrag e81c330694 Fix configs correcting numeric values when the primitive type differs
Fix configs with range not clamping the corrected value, and instead
just replacing with the default

Closes #5855
2019-06-25 19:56:31 -04:00
Ben Staddon 790da699dd Fix item placement losing NBT data in creative mode (#5757) 2019-06-25 13:59:10 -07:00
MajorTuvok 7915397377 Add extension to write entry id's to PacketBuffer's (#5812) 2019-06-25 13:55:24 -07:00
Someone b2a5d34679 Add isItemValid check for ItemStackHandler (#5850) 2019-06-25 13:50:08 -07:00
Johannes 73bb18e78b Fix leather armor dye recipe (#5836) 2019-06-25 13:48:49 -07:00
Tedstar 9701148819 [1.14.x] Replace dye items in Forge tags. (#5843) 2019-06-25 13:44:54 -07:00
Unnoen f1dbc8b117 Update readme and issue template. (#5773) 2019-06-25 13:38:32 -07:00
bl4ckscor3 b8131e6e67 implement Ingredient.getSerializer for custom ingredients (#5813) 2019-06-25 10:25:33 -07:00
LexManos f4598a97f7 Fix vines and scaffolding not being climbable.
Fix powered rails not spreading power correctly. Closes: #5854
2019-06-24 20:05:50 -07:00
LexManos c90d42973d Fix misaligned ServerWorld initCapabilities patch. 2019-06-24 19:37:02 -07:00
LexManos ff0bb8c83c Initial 1.14.3 update. 2019-06-24 19:01:03 -07:00
cpw e5acea60e6 Fix too many registries being sent from server to client
Signed-off-by: cpw <[email protected]>
2019-06-23 19:54:55 -04:00
tterrag 216b536967 Remove OnlyIn on TagCollection#getOwningTags
Fixes Block#getTags crashing on servers
2019-06-23 18:36:27 -04:00
cpw 0a819da0e7 Reorganize sided event dispatch slightly. Dispatch model and entityrenderer
functions at more appropriate times.

Signed-off-by: cpw <[email protected]>
2019-06-23 16:01:20 -04:00
cpw bdad2af27b Tweak for lowercase handling.
Signed-off-by: cpw <[email protected]>
2019-06-23 14:51:58 -04:00
cpw 60513446fa Merge branch 'pull/5793' into 1.14.x 2019-06-23 14:42:32 -04:00
cpw be415091cd Fix crash when crashing during modloading. Fix GuiModList being weird.
Signed-off-by: cpw <[email protected]>
2019-06-23 14:37:05 -04:00
cpw 9067dbf6a0 Process the main modloading work on the async thread, but still
do deferred work on the main thread by passing in the executor.

Signed-off-by: cpw <[email protected]>
2019-06-23 12:26:45 -04:00
tterrag 359be1a880 Clean up config comments, make comment array nonnull 2019-06-23 02:57:00 -04:00
tterrag 99624bf3b5 Fix forge event bus never starting up 2019-06-23 02:17:51 -04:00
tterrag 252b94a110 Automatically add range to config comments 2019-06-23 02:17:28 -04:00
cpw 448d996a45 First pass of adding text to the loading progress UI. It deliberately uses the very primitive STB
generated font, so can only render basic ASCII text, and also only renders pre-defined strings,
as translations aren't available either.

Signed-off-by: cpw <[email protected]>
2019-06-22 23:39:00 -04:00
JoJoDeveloping b9e5dfd286 Add mod failure identification 2019-06-23 03:14:05 +02:00
cpw d966746fbf Moved some events to the Mod's event bus. You'll need to update which bus
you're listening to for these. (The Mod event bus is the only one actively
dispatching events during model loading).

ModelRegistryEvent, ModelBakeEvent, TextureStitchEvent.Pre, TextureStitchEvent.Post, ColourHandlerEvent.Block, ColourHandlerEvent.Item

Signed-off-by: cpw <[email protected]>
2019-06-22 20:36:07 -04:00
cpw 89baeb3d5d Fix StartupQuery, and put tests back.
Signed-off-by: cpw <[email protected]>
2019-06-22 19:58:10 -04:00
cpw 89006458a2 Fix stupid bug introduced with the refactor..
Signed-off-by: cpw <[email protected]>
2019-06-22 19:08:49 -04:00
cpw 389bc1ecea Tidy up mod loading a bit more, and also crash if the [[mods]] list isn't
a list.

Signed-off-by: cpw <[email protected]>
2019-06-22 12:52:22 -04:00
cpw 1e0437208b Merge remote-tracking branch 'origin/1.14.x' into 1.14.x 2019-06-22 12:33:46 -04:00
cpw 256bd01e0c Fix server side loading, tweak mods command.
Signed-off-by: cpw <[email protected]>
2019-06-22 12:31:27 -04:00
tterrag ef7b035f02 Fix ModelDataTest 2019-06-21 23:35:08 -04:00
cpw 83a0dc2ef9 Merge remote-tracking branch 'origin/1.14.x' into 1.14.x 2019-06-21 22:42:33 -04:00
cpw c10174d50d Update mappings, move mod initialization to the async loader.
Signed-off-by: cpw <[email protected]>
2019-06-21 22:42:16 -04:00
tterrag 5a3b375147 Fix #5612 add entity to ISelectionContext 2019-06-21 21:15:56 -04:00
tterrag 656ff25ae1 Fix #5768 add access to MainWindow object in RenderGameOverlayEvent 2019-06-21 20:29:04 -04:00
tterrag 19059b054e Fix #5810 incorrect cullface on some models 2019-06-21 20:23:32 -04:00
tterrag 45bc487fc0 Fix #5686 ArmorLayer still calls deprecated getArmorResource 2019-06-21 19:48:00 -04:00
tterrag 9c74a31ca2 Fix bad patch breaking armor dyeing 2019-06-21 19:47:23 -04:00
tterrag 8c3e511538 Make sure test mods load, fix BlockstateRetextureTest 2019-06-21 19:35:32 -04:00
tterrag 5fb948fb35 Fix #5805 ModelBakeEvent does not fire 2019-06-21 19:34:58 -04:00
LexManos a14c2233e0 Fix lighting not being sent to client when large amounts of blocks change at once. Closes #5839
Remove RecipeType/VanillaRecipeTypes, as 1.14 has a vanilla system for this.
2019-06-19 18:10:02 -07:00
LexManos f01b87fac7 Fix some compile errors in test classes. 2019-06-19 18:07:58 -07:00
LexManos 40bdde2043 Fix Vanilla resources loading from classpath, instead of the extra jar. Causing issues in dev time, and Forge replacements. Closes #5824 2019-06-17 14:08:16 -07:00
LexManos 0a8a601877 Add temporary hard crash when mods error until we can load our error screen. 2019-06-16 00:48:38 -07:00
LexManos 002e29958e Make ReverseTagWrapper unmodifiable, fix error in log when mods folder doesn't exist initial scan. 2019-06-16 00:47:40 -07:00
cpw 604987a005 Skip running the datagenerator on unrequested mods.
Add a run config for the data task for modders to use

Signed-off-by: cpw <[email protected]>
2019-06-16 00:47:50 -04:00
cpw 7e3e6b1969 Remove paulscode hack. It is not needed in 1.14, since paulscode is
no longer used.

Signed-off-by: cpw <[email protected]>
2019-06-15 21:51:51 -04:00
cpw d821514372 Modify lex's data handler to use proper mod lifecycle event mechanisms
instead. New Lifecycle Event for requesting data harvesting. Mods will
be constructed, the registry will fire, and then a new Data event will
fire. Submit new data tag files to the data gatherer if you wish.
The game will shutdown after this. No other mod elements will happen.

Signed-off-by: cpw <[email protected]>
2019-06-15 21:24:45 -04:00
cpw 37a896fe1b Add params for the exception message
Signed-off-by: cpw <[email protected]>

tweak logging

Signed-off-by: cpw <[email protected]>
2019-06-15 19:47:08 -04:00
LexManos e1cdb2e558 Expose the data entry point and generate Forge's Tags using it. 2019-06-13 20:58:03 -07:00
LexManos c30b27fcfe Add reverse tag cache, to make looking up tags for items/blocks/etc.. less costly. 2019-06-12 19:28:10 -07:00
marcus8448 9542f51cd0 Update Example Mod (#5781) 2019-06-12 16:49:20 -07:00
its_meow a7b56f0975 Fix AT for EntitySpawnPlacementRegistry.register (#5799) 2019-06-12 16:17:25 -07:00
Johannes ed3dc8c7d3 Implement getValue in ClearableRegistry fixing DimensionArgument. (#5809)
Fix DimensionArgument
2019-06-12 16:16:32 -07:00
SquidDev ed6ce87c22 Fix RenderSpecificHandEvent firing with wrong hand (#5789) 2019-06-12 01:05:27 -04:00
kashike 4bd7427b70 Use dragon_immune block tag instead of manually checking blocks (#5792) 2019-06-12 01:04:13 -04:00
tterrag 0b1196db3f Fix #5806 sheep drop shears instead of wool
lol
2019-06-12 00:57:27 -04:00
tterrag b25ed7ef91 Fix incorrect method used in ShrubFeature patch 2019-06-12 00:51:45 -04:00
tterrag dc95130526 Rework AbstractTreeFeature patches to reduce impact and avoid name conflicts 2019-06-12 00:48:11 -04:00
tterrag d5ee80a70a Add IContainerFactory for reading custom container data on the client 2019-06-10 18:14:49 -04:00
LexManos 5dc944c1c3 Fix Fishing and Mineshaft Minecarts loot tables erroring. #5785
Fix Client block breaking speed not matching the server. #5790
Fix Village Siege event location, and MC-154328 preventing Sieges starting. #5800
Fix EntityJoinWorldEvent not firing on client, or some server code paths. #5786
2019-06-10 14:03:51 -07:00
tterrag da22fd40bf Adjust NetworkEvent#enqueueWork to match vanilla logic
In singleplayer our packet work could get delayed until the next tick,
breaking the expectation of packet read order. Fixes that using
NetworkHooks.openGui would result in missing inventory data on the client
2019-06-10 00:13:27 -04:00
LexManos 1434419e47 Fix gameDir argument error on dedicated server. 2019-06-09 11:19:01 -07:00
tterrag 3385e62aa7 Add forge registries for most vanilla registries
Made all registry names consistent with their vanilla counterparts
Also added a system for legacy registry names, so no data will be lost
Cleaned up formatting in GameData and ForgeRegistries
2019-06-09 04:23:39 -04:00
tterrag 40f2276e88 Add registry flag for syncing 2019-06-09 00:55:42 -04:00
tterrag 35cd89c00c Fix issues preventing test mods loading 2019-06-09 00:19:29 -04:00
tterrag 892fea3df9 Add forge registry for container types, expose ScreenManager.registerFactory 2019-06-09 00:19:17 -04:00
cpw 2d32929dc5 Don't NPE during construction of ModLoadingException..
Signed-off-by: cpw <[email protected]>
2019-06-08 14:30:15 -04:00
LexManos 728b4857c3 Fix misobfed methods due to mapping conflict. 2019-06-08 09:22:03 -07:00
cpw 9fa4641cb0 Update mappings
Signed-off-by: cpw <[email protected]>
2019-06-08 10:45:28 -04:00
tterrag fc04a65a0f Fix block activation not occurring serverside
Missing block of code from the old patch caused it to be skipped
2019-06-08 01:32:53 -04:00
tterrag a93d7d20ee Rework model patches/classes for new bake signature 2019-06-08 01:02:29 -04:00
LexManos b74b72e44c Fix NamespacedWrapper not delegating a new getter. Fixing data loading spam at world start.
Update red/yellow/green tags with new vanilla item names.
Reenabled test source directory in project and made ModelDataTest compile.
2019-06-07 19:34:16 -07:00
cpw 850c73b73f and userdev
Signed-off-by: cpw <[email protected]>
2019-06-07 17:34:25 -04:00
cpw d736e26e0c Fix realms class name
Signed-off-by: cpw <[email protected]>
2019-06-07 17:32:33 -04:00
cpw d97f47141e Fix travis build
Signed-off-by: cpw <[email protected]>
2019-06-07 16:57:18 -04:00
LexManos a7df63e1a1 Update to 1.14.2 2019-06-07 16:50:47 -04:00
1726 changed files with 30716 additions and 28724 deletions

No files matched your search

-4
View File
@@ -1,4 +0,0 @@
<!-- Thank you for reporting! -->
<!-- Please go to the forum first for support with crashes and issues. -->
<!-- http://www.minecraftforge.net/forum/forum/18-support-bug-reports/ -->
+13
View File
@@ -0,0 +1,13 @@
---
name: Feature request
about: Want to request a feature?
title: ''
labels: Feature
assignees: ''
---
<!-- Please note, feature requests that are submitted as GitHub issues here are rarely implemented. -->
<!-- If you'd like to see something in Forge, you should be ready to implement it as a PR. -->
<!-- If you're not sure, open a Draft PR or discuss it in the Discord server. -->
<!-- Discord: https://discord.gg/UvedJ9m -->
+26
View File
@@ -0,0 +1,26 @@
---
name: Issue report
about: Visit the forum first for issues with crashes.
title: ''
labels: Triage
assignees: ''
---
<!-- Thank you for reporting! -->
<!-- For support with crashes and issues, please create a post on the forum instead: -->
<!-- https://www.minecraftforge.net/forum/forum/18-support-bug-reports/ -->
**Minecraft Version:** {Minecraft version}
**Forge Version:** {Forge version. *Version number, not latest/rb*}
**Logs:** {Link(s) to GitHub Gist with full latest.log and/or crash report}
**Steps to Reproduce:**
1. Do this
2. Then do that
3. ...
**Description of issue:**
+8 -1
View File
@@ -19,9 +19,16 @@
/mdk/build
#occupational hazards
/projects/
/projects/mcp/
/projects/clean/
/projects/forge/
/projects/**/build/
/projects/**/out/
/projects/**/run/
/projects/**/*.launch
/repo/
/buildSrc
src/generated/resources/.cache/
#Patch rejects
/patches-/
+2 -1
View File
@@ -29,9 +29,10 @@ script:
notifications:
email: false
# skip building travis on 1.13 - it doesn't work there
# skip building travis on 1.13+ - it doesn't work there
branches:
except:
- 1.13-pre
- 1.13.x
- 1.14.x
- /^noci-.*$/
Vendored
+14 -16
View File
@@ -6,8 +6,8 @@ pipeline {
}
agent {
docker {
image 'gradle:jdk8'
args '-v forgegc:/home/gradle/.gradle/'
image 'gradlewrapper:latest'
args '-v gradlecache:/gradlecache'
}
}
environment {
@@ -18,6 +18,11 @@ pipeline {
}
stages {
stage('fetch') {
steps {
checkout scm
}
}
stage('notify_start') {
when {
not {
@@ -59,22 +64,15 @@ pipeline {
}
}
environment {
FORGE_MAVEN = credentials('forge-maven-forge-user')
CROWDIN = credentials('forge-crowdin')
KEYSTORE = credentials('forge-jenkins-keystore-old')
KEYSTORE_KEYPASS = credentials('forge-jenkins-keystore-old-keypass')
KEYSTORE_STOREPASS = credentials('forge-jenkins-keystore-old-keypass')
}
steps {
withCredentials([usernamePassword(credentialsId: 'maven-forge-user', usernameVariable: 'MAVEN_USER', passwordVariable: 'MAVEN_PASSWORD')]) {
withGradle {
sh './gradlew ${GRADLE_ARGS} :forge:publish -PkeystoreKeyPass=${KEYSTORE_KEYPASS} -PkeystoreStorePass=${KEYSTORE_STOREPASS} -Pkeystore=${KEYSTORE} -PcrowdinKey=${CROWDIN}'
}
}
}
post {
success {
build job: 'filegenerator', parameters: [string(name: 'COMMAND', value: "promote net.minecraftforge:forge ${env.MYVERSION} latest")], propagate: false, wait: false
}
sh './gradlew ${GRADLE_ARGS} :forge:publish -PforgeMavenUser=${FORGE_MAVEN_USR} -PforgeMavenPassword=${FORGE_MAVEN_PSW} -PkeystoreKeyPass=${KEYSTORE_KEYPASS} -PkeystoreStorePass=${KEYSTORE_STOREPASS} -Pkeystore=${KEYSTORE} -PcrowdinKey=${CROWDIN}'
sh 'curl --user ${FORGE_MAVEN} http://files.minecraftforge.net/maven/manage/promote/latest/net.minecraftforge.forge/${MYVERSION}'
}
}
stage('test_publish_pr') { //Publish to local repo to test full process, but don't include credentials so it can't sign/publish to maven
@@ -85,9 +83,7 @@ pipeline {
CROWDIN = credentials('forge-crowdin')
}
steps {
withGradle {
sh './gradlew ${GRADLE_ARGS} :forge:publish -PcrowdinKey=${CROWDIN}'
}
sh './gradlew ${GRADLE_ARGS} :forge:publish -PcrowdinKey=${CROWDIN}'
}
}
}
@@ -95,7 +91,9 @@ pipeline {
always {
script {
archiveArtifacts artifacts: 'projects/forge/build/libs/**/*.*', fingerprint: true, onlyIfSuccessful: true, allowEmptyArchive: true
//junit 'build/test-results/*/*.xml'
//jacoco sourcePattern: '**/src/*/java'
if (env.CHANGE_ID == null) { // This is unset for non-PRs
discordSend(
title: "${DISCORD_PREFIX} Finished ${currentBuild.currentResult}",
-37
View File
@@ -1,37 +0,0 @@
# How to install Forge: For Players
Go to [the Forge website](http://files.minecraftforge.net)
and select the minecraft version you wish to get forge for from the list.
You can download the installer for the *Recommended Build* or the
*Latest build* there. Latest builds may have newer features but may be
more unstable as a result. The installer will attempt to install forge
into your vanilla launcher environment, where you can then create a new
profile using that version and play the game!
For support and questions, visit [the Support Forum](http://www.minecraftforge.net/forum/forum/18-support-bug-reports/).
Here is a short video from Rorax showing how to install and setup Forge:
[![HOWTO Install Forge](https://img.youtube.com/vi/lB3ArN_-3Oc/0.jpg)](https://www.youtube.com/watch?v=lB3ArN_-3Oc)
# How to install Forge: For Modders
[See the "Getting Started" section in the Forge Documentation](http://mcforge.readthedocs.io/en/latest/gettingstarted/).
# How to install Forge: For those wishing to work on Forge itself
If you wish to actually inspect Forge, submit PRs or otherwise work
with Forge itself, you're in the right place!
[See the guide to setting up a Forge workspace](http://mcforge.readthedocs.io/en/latest/forgedev/).
## Pull requests
[See the "Making Changes and Pull Requests" section in the Forge documentation](http://mcforge.readthedocs.io/en/latest/forgedev/#making-changes-and-pull-requests).
### Contributor License Agreement
We require all contributors to acknowledge the [Forge Contributor
License Agreement](https://cla-assistant.io/MinecraftForge/MinecraftForge). Please ensure you have a valid email address
associated with your github account to do this. If you have previously
signed it, you should be OK.
+299 -53
View File
@@ -1,11 +1,14 @@
buildscript {
repositories {
mavenLocal()
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:3.+'
classpath 'org.ow2.asm:asm:7.1'
classpath 'org.ow2.asm:asm-tree:7.1'
}
}
import groovy.json.JsonSlurper
@@ -13,24 +16,33 @@ import groovy.json.JsonBuilder
import java.text.SimpleDateFormat
import java.util.Date
import java.util.LinkedHashMap
import java.util.TreeSet
import java.util.stream.Collectors
import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream
import java.util.zip.ZipOutputStream
import java.security.MessageDigest
import java.net.URL
import net.minecraftforge.gradle.common.task.ArchiveChecksum
import net.minecraftforge.gradle.common.task.DownloadMavenArtifact
import net.minecraftforge.gradle.common.task.ExtractInheritance
import net.minecraftforge.gradle.common.task.SignJar
import net.minecraftforge.gradle.common.util.HashStore
import net.minecraftforge.gradle.mcp.function.MCPFunction
import net.minecraftforge.gradle.mcp.util.MCPEnvironment
import net.minecraftforge.gradle.patcher.task.ApplyBinPatches
import net.minecraftforge.gradle.patcher.task.TaskReobfuscateJar
import net.minecraftforge.gradle.userdev.tasks.RenameJar
import org.apache.tools.ant.filters.ReplaceTokens
import de.undercouch.gradle.tasks.download.Download
import net.minecraftforge.gradle.patcher.task.TaskReobfuscateJar
import org.gradle.plugins.ide.eclipse.model.SourceFolder
import java.util.stream.Collectors
import org.objectweb.asm.ClassReader
plugins {
id 'net.minecrell.licenser' version '0.4'
id 'org.ajoberstar.grgit' version '2.3.0'
id 'org.ajoberstar.grgit' version '3.1.1'
id 'de.undercouch.download' version '3.3.0'
id "com.github.ben-manes.versions" version '0.20.0'
id 'com.github.ben-manes.versions' version '0.22.0'
}
apply plugin: 'eclipse'
@@ -44,13 +56,13 @@ ext {
]
}
MAPPING_CHANNEL = 'snapshot'
MAPPING_VERSION = '20180921-1.13'
MC_VERSION = '1.13.2'
MCP_VERSION = '20190213.203750'
MAPPING_VERSION = '20190719-1.14.3'
MC_VERSION = '1.14.4'
MCP_VERSION = '20190829.143755'
}
project(':mcp') {
apply plugin: 'net.minecraftforge.gradle.forgedev.mcp'
apply plugin: 'net.minecraftforge.gradle.mcp'
mcp {
config = MC_VERSION + '-' + MCP_VERSION
pipeline = 'joined'
@@ -60,11 +72,16 @@ project(':mcp') {
project(':clean') {
evaluationDependsOn(':mcp')
apply plugin: 'eclipse'
apply plugin: 'net.minecraftforge.gradle.forgedev.patcher'
apply plugin: 'net.minecraftforge.gradle.patcher'
compileJava.sourceCompatibility = compileJava.targetCompatibility = sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
repositories {
mavenCentral()
}
dependencies {
implementation 'net.minecraftforge:forgespi:1.1.+'
}
patcher {
parent = project(':mcp')
mcVersion = MC_VERSION
@@ -101,7 +118,7 @@ project(':forge') {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'eclipse'
apply plugin: 'net.minecraftforge.gradle.forgedev.patcher'
apply plugin: 'net.minecraftforge.gradle.patcher'
apply plugin: 'net.minecrell.licenser'
apply plugin: 'de.undercouch.download'
@@ -124,7 +141,10 @@ project(':forge') {
srcDirs = ["$rootDir/src/main/java"]
}
resources {
srcDirs = ["$rootDir/src/main/resources"]
srcDirs = [
"$rootDir/src/main/resources",
"$rootDir/src/generated/resources"
]
}
}
test {
@@ -160,17 +180,19 @@ project(':forge') {
}
ext {
SPEC_VERSION = '25.0' // This is overwritten by git tag, but here so dev time doesnt explode
SPEC_VERSION = '28.1' // This is overwritten by git tag, but here so dev time doesnt explode
// The new versioning sceme is <MCVersion>-<ForgeMC>.<RB>.<CommitsSinceRB>
// ForgeMC is a unique identifier for every MC version we have supported.
// Essentially, the same as the old, except dropping the first number, and the builds are no longer unique.
MCP_ARTIFACT = project(':mcp').mcp.config
SPECIAL_SOURCE = 'net.md-5:SpecialSource:1.8.5'
VERSION_JSON = project(':mcp').file('build/mcp/downloadJson/version.json')
}
def getVersion = {
//TAG-offset-hash
def raw = grgit.describe(longDescr: true)
def desc = (raw == null ? '0.0-0-unknown' : grgit.describe(longDescr: true)).split('-') as List
def raw = grgit.describe(longDescr: true, tags:true)
def desc = (raw == null ? '0.0-0-unknown' : grgit.describe(longDescr: true, tags:true)).split('-') as List
def hash = desc.remove(desc.size() - 1)
def offset = desc.remove(desc.size() - 1)
def tag = desc.join('-')
@@ -192,6 +214,7 @@ project(':forge') {
patchedSrc = file('src/main/java')
srgPatches = true
accessTransformer = file("$rootDir/src/main/resources/META-INF/accesstransformer.cfg")
sideAnnotationStripper = file("$rootDir/src/main/resources/forge.sas")
runs {
forge_client {
@@ -220,6 +243,12 @@ project(':forge') {
source sourceSets.userdev
}
cpw_forge_client {
parent runs.forge_client
taskName 'cpw_forge_client'
property 'forge.logging.noansi', 'false'
}
forge_test_client {
parent runs.forge_client
taskName 'forge_test_client'
@@ -262,6 +291,42 @@ project(':forge') {
TestMods { sources sourceSets.test }
}
}
forge_data {
taskName 'forge_data'
main 'net.minecraftforge.userdev.LaunchTesting'
workingDirectory project.file('run')
environment 'target', 'fmldevdata'
environment 'MC_VERSION', MC_VERSION
environment 'MCP_VERSION', MCP_VERSION
environment 'FORGE_GROUP', project.group
environment 'FORGE_SPEC', SPEC_VERSION
environment 'FORGE_VERSION', project.version.substring(MC_VERSION.length() + 1).toString()
environment 'LAUNCHER_VERSION', SPEC_VERSION
ideaModule "${rootProject.name}.${project.name}.userdev"
source sourceSets.main
source sourceSets.userdev
args '--mod', 'forge', '--all', '--output', rootProject.file('src/generated/resources/')
}
forge_test_data {
parent runs.forge_data
taskName 'forge_test_data'
environment 'MOD_CLASSES', 'dummy' // Needed to work around FG limitation, FG will replace this!
mods {
tests { sources sourceSets.test }
}
args '--mod', 'data_gen_test', '--all', '--output', rootProject.file('src/generated_test/resources/')
}
}
}
@@ -296,6 +361,14 @@ project(':forge') {
'Implementation-Version': SPEC_VERSION,
'Implementation-Vendor': 'Forge'
] as LinkedHashMap,
'net/minecraftforge/fml/mclanguageprovider/': [
'Specification-Title': 'Mod Language Provider',
'Specification-Vendor': 'Forge Development LLC',
'Specification-Version': '1',
'Implementation-Title': 'Minecraft Language Mod Provider',
'Implementation-Version': '1',
'Implementation-Vendor': 'Forge'
] as LinkedHashMap,
'net/minecraftforge/fml/loading/': [
'Specification-Title': 'Launcher',
'Specification-Vendor': 'Forge Development LLC',
@@ -303,6 +376,14 @@ project(':forge') {
'Implementation-Title': 'FML Launcher',
'Implementation-Version': SPEC_VERSION,
'Implementation-Vendor': 'Forge'
] as LinkedHashMap,
'net/minecraftforge/fml/userdev/': [
'Specification-Title': 'Forge User Development',
'Specification-Vendor': 'Forge Development LLC',
'Specification-Version': SPEC_VERSION,
'Implementation-Title': project.group,
'Implementation-Version': project.version.substring(MC_VERSION.length() + 1),
'Implementation-Vendor': 'Forge Development LLC'
] as LinkedHashMap
]
}
@@ -320,34 +401,32 @@ project(':forge') {
fmllauncherImplementation.extendsFrom(installer)
}
dependencies {
api 'net.minecraft:client:${MC_VERSION}:extra'
installer 'com.paulscode:soundsystem:2018+'
installer 'org.ow2.asm:asm:6.2'
installer 'org.ow2.asm:asm-commons:6.2'
installer 'org.ow2.asm:asm-tree:6.2'
installer 'cpw.mods:modlauncher:2.1.+'
installer 'cpw.mods:modlauncher:3.2.+'
installer 'cpw.mods:grossjava9hacks:1.1.+'
installer 'net.minecraftforge:accesstransformers:0.16.+:shadowed'
installer 'net.minecraftforge:eventbus:0.9.+:service'
installer 'net.minecraftforge:forgespi:0.13.+'
installer 'net.minecraftforge:coremods:0.5.+'
installer 'net.minecraftforge:accesstransformers:1.0.+:shadowed'
installer 'net.minecraftforge:eventbus:1.0.+:service'
installer 'net.minecraftforge:forgespi:1.3.+'
installer 'net.minecraftforge:coremods:1.0.+'
installer 'net.minecraftforge:unsafe:0.2.+'
installer 'com.electronwill.night-config:core:3.6.0'
installer 'com.electronwill.night-config:toml:3.6.0'
installer 'org.jline:jline:3.9.0'
installer 'org.jline:jline:3.12.+'
installer 'org.apache.maven:maven-artifact:3.6.0'
installer 'net.jodah:typetools:0.6.0'
installer 'java3d:vecmath:1.5.2'
installer 'org.apache.logging.log4j:log4j-api:2.15.0' //TODO: Unpin in 1.18.1 or when Mojang bumps the Log4J version
installer 'org.apache.logging.log4j:log4j-core:2.15.0' //TODO: Unpin in 1.18.1 or when Mojang bumps the Log4J version
installer 'org.apache.logging.log4j:log4j-slf4j18-impl:2.15.0' //TODO: Unpin in 1.18.1 or when Mojang bumps the Log4J version
installer 'net.minecrell:terminalconsoleappender:1.1.+'
installer 'org.apache.logging.log4j:log4j-api:2.11.2'
installer 'org.apache.logging.log4j:log4j-core:2.11.2'
installer 'net.minecrell:terminalconsoleappender:1.2.+'
installer 'net.sf.jopt-simple:jopt-simple:5.0.4'
fmllauncherImplementation 'com.google.guava:guava:21.0'
fmllauncherImplementation 'com.google.code.gson:gson:2.8.0'
testImplementation "org.junit.jupiter:junit-jupiter-api:5.0.0"
testImplementation "org.opentest4j:opentest4j:1.0.0" // needed for junit 5
testImplementation "org.hamcrest:hamcrest-all:1.3" // needs advanced matching for list order
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.0.0'
testImplementation 'org.junit.vintage:junit-vintage-engine:5.+'
testImplementation 'org.opentest4j:opentest4j:1.0.0' // needed for junit 5
testImplementation 'org.hamcrest:hamcrest-all:1.3' // needs advanced matching for list order
}
def extraTxts = [
@@ -420,6 +499,21 @@ project(':forge') {
clean = { genJoinedBinPatches.cleanJar }
input = genJoinedBinPatches.output
}
// Create SRG named Vanilla jars, using the SpecialSource we have in the installer
task createClientSRG(type: RenameJar, dependsOn: genClientBinPatches) {
tool = SPECIAL_SOURCE + ':shaded'
args = ['--stable', '--in-jar', '{input}', '--out-jar', '{output}', '--srg-in', '{mappings}']
mappings = { genClientBinPatches.srg }
input = { genClientBinPatches.cleanJar }
output = file('build/createClientSRG/output.jar')
}
task createServerSRG(type: RenameJar, dependsOn: genServerBinPatches) {
tool = SPECIAL_SOURCE + ':shaded'
args = ['--stable', '--in-jar', '{input}', '--out-jar', '{output}', '--srg-in', '{mappings}']
mappings = { genServerBinPatches.srg }
input = { genServerBinPatches.cleanJar }
output = file('build/createServerSRG/output.jar')
}
// Checksum tasks so that we can know if the vanilla classes are what we expect them to do!
task clientBaseChecksum(type: ArchiveChecksum, dependsOn: genClientBinPatches) {
input = { genClientBinPatches.cleanJar} //Lazy because Patcher Plugin sets the value afterEvaluate
@@ -463,8 +557,128 @@ project(':forge') {
}
}
task downloadLibraries(dependsOn: ':mcp:setupMCP') {
inputs.file VERSION_JSON
doLast {
def json = new JsonSlurper().parseText(VERSION_JSON.text)
json.libraries.each {lib ->
def artifacts = [lib.downloads.artifact] + lib.downloads.get('classifiers', [:]).values()
artifacts.each{ art ->
def target = file('build/libraries/' + art.path)
if (!target.exists()) {
download {
src art.url
dest target
}
}
}
}
}
}
task extractInheritance(type: ExtractInheritance, dependsOn: [genJoinedBinPatches, downloadLibraries]) {
input { genJoinedBinPatches.cleanJar }
doFirst {
def json = new JsonSlurper().parseText(VERSION_JSON.text)
json.libraries.each {lib ->
def artifacts = [lib.downloads.artifact] + lib.downloads.get('classifiers', [:]).values()
artifacts.each{ art ->
def target = file('build/libraries/' + art.path)
if (target.exists())
addLibrary(target)
}
}
}
}
task checkATs(dependsOn: genJoinedBinPatches) {
inputs.file { genJoinedBinPatches.cleanJar }
inputs.files patcher.accessTransformers
doLast {
def vanilla = [:]
def zip = new java.util.zip.ZipFile(genJoinedBinPatches.cleanJar)
zip.entries().findAll { !it.directory && it.name.endsWith('.class') }.each { entry ->
new ClassReader(zip.getInputStream(entry)).accept(new org.objectweb.asm.ClassVisitor(org.objectweb.asm.Opcodes.ASM7) {
String name
void visit(int version, int access, String name, String sig, String superName, String[] interfaces) {
this.name = name
vanilla[name] = access
}
org.objectweb.asm.FieldVisitor visitField(int access, String name, String desc, String sig, Object value) {
vanilla[this.name + ' ' + name] = access
return null
}
org.objectweb.asm.MethodVisitor visitMethod(int access, String name, String desc, String sig, String[] excs) {
vanilla[this.name + ' ' + name + desc] = access
return null
}
}, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES)
}
patcher.accessTransformers.each { f ->
TreeMap lines = [:]
f.eachLine { line ->
def idx = line.indexOf('#')
if (idx == 0 || line.isEmpty()) return
def comment = idx == -1 ? null : line.substring(idx)
if (idx != -1) line = line.substring(0, idx - 1)
def (modifier, cls, desc) = (line.trim() + ' ').split(' ', -1)
def key = cls + (desc.isEmpty() ? '' : ' ' + desc)
def access = vanilla[key.replace('.', '/')]
if (access == null) {
if ((desc.equals('*') || desc.equals('*()')) && vanilla[cls.replace('.', '/')] != null)
println('Warning: ' + line)
else {
println('Invalid: ' + line)
return
}
}
//TODO: Check access actually changes, and expand inheretence?
lines[key] = [modifier: modifier, comment: comment]
}
f.text = lines.collect{ it.value.modifier + ' ' + it.key + (it.value.comment == null ? '' : ' ' + it.value.comment) }.join('\n')
}
}
}
task checkSAS(dependsOn: extractInheritance) {
inputs.file { extractInheritance.output }
inputs.files patcher.sideAnnotationStrippers
doLast {
def json = new JsonSlurper().parseText(extractInheritance.output.text)
patcher.sideAnnotationStrippers.each { f ->
def lines = []
f.eachLine { line ->
if (line[0] == '\t') return //Skip any tabed lines, those are ones we add
def idx = line.indexOf('#')
if (idx == 0 || line.isEmpty()) {
lines.add(line)
return
}
def comment = idx == -1 ? null : line.substring(idx)
if (idx != -1) line = line.substring(0, idx - 1)
def (cls, desc) = (line.trim() + ' ').split(' ', -1)
cls = cls.replaceAll('\\.', '/')
desc = desc.replace('(', ' (')
if (desc.isEmpty() || json[cls] == null || json[cls]['methods'] == null || json[cls]['methods'][desc] == null) {
println('Invalid: ' + line)
return
}
def mtd = json[cls]['methods'][desc]
lines.add(cls + ' ' + desc.replace(' ', '') + (comment == null ? '' : ' ' + comment))
def children = json.values().findAll{ it.methods != null && it.methods[desc] != null && it.methods[desc].override == cls}
.collect { it.name + ' ' + desc.replace(' ', '') } as TreeSet
children.each { lines.add('\t' + it) }
}
f.text = lines.join('\n')
}
}
}
task launcherJson(dependsOn: ['signUniversalJar', 'signLauncherJar']) {
inputs.file universalJar.archivePath
inputs.file { launcherJar.archivePath }
ext {
output = file('build/version.json')
vanilla = project(':mcp').file('build/mcp/downloadJson/version.json')
@@ -517,11 +731,11 @@ project(':forge') {
output.text = new JsonBuilder(json).toPrettyString()
}
}
task installerJson(dependsOn: [launcherJson, genClientBinPatches, applyClientBinPatches, applyServerBinPatches]) {
task installerJson(dependsOn: [launcherJson, genClientBinPatches, applyClientBinPatches, applyServerBinPatches/*, createClientSRG, createServerSRG*/]) {
ext {
output = file('build/install_profile.json')
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.0.3'
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.1.4'
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.0'
}
doFirst {
@@ -531,6 +745,10 @@ project(':forge') {
inputs.file applyServerBinPatches.output
inputs.file genClientBinPatches.toolJar
inputs.file launcherJson.output
/*
inputs.file createClientSRG.output
inputs.file createServerSRG.output
*/
outputs.file output
doLast {
def libs = [
@@ -585,6 +803,10 @@ project(':forge') {
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:srg]",
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:srg]"
],
/*MC_SRG_SHA: [
client: "'${sha1(createClientSRG.output)}'",
server: "'${sha1(createServerSRG.output)}'"
],*/
PATCHED: [
client: "[${project.group}:${project.name}:${project.version}:client]",
server: "[${project.group}:${project.name}:${project.version}:server]"
@@ -592,6 +814,10 @@ project(':forge') {
PATCHED_SHA: [
client: "'${sha1(applyClientBinPatches.output)}'",
server: "'${sha1(applyServerBinPatches.output)}'"
],
MCP_VERSION: [
client: "'${MCP_VERSION}'",
server: "'${MCP_VERSION}'"
]
],
processors: [
@@ -617,21 +843,19 @@ project(':forge') {
'{MC_SLIM}': '{MC_SLIM_SHA}',
'{MC_EXTRA}': '{MC_EXTRA_SHA}'
]
], [ // SpecialSource has a bug where it won't create the nessasary directories, remove when they fix that.
jar: INSTALLER_TOOLS,
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
args: [
'--task', 'CREATE_PARENTS',
'--target', '{MC_SRG}'
]
], [
jar: 'net.md-5:SpecialSource:1.8.3',
classpath: getClasspath(project, libs, 'net.md-5:SpecialSource:1.8.3'),
jar: SPECIAL_SOURCE,
classpath: getClasspath(project, libs, SPECIAL_SOURCE),
args: [
//'--stable', Java 9 Is borked, https://bugs.openjdk.java.net/browse/JDK-8184940 TODO: find a fix.
'--in-jar', '{MC_SLIM}',
'--out-jar', '{MC_SRG}',
'--srg-in', '{MAPPINGS}'
]/*,
outputs: [
'{MC_SRG}': '{MC_SRG_SHA}'
]
*/
], [
jar: BIN_PATCHER,
classpath: getClasspath(project, libs, BIN_PATCHER),
@@ -674,6 +898,7 @@ project(':forge') {
dependsOn fixAnnotationsJson
*/
/* We do not actually check this anywhere, so it's 400KB of uselless data
// Add checksum files of clean and patched vanilla classes.
['client', 'server'].each { side ->
['Base', 'Patched'].each { type ->
@@ -683,6 +908,7 @@ project(':forge') {
}
}
dependsOn checksums
*/
// add crowdin locales
from { !crowdin.state.skipped ? zipTree(crowdin.archivePath) : null}
@@ -732,7 +958,7 @@ project(':forge') {
}
task downloadInstaller(type: DownloadMavenArtifact) {
artifact = 'net.minecraftforge:installer:2.1.+:shrunk'
artifact = 'net.minecraftforge:installer:2.0.+:shrunk'
changing = true
}
@@ -848,6 +1074,19 @@ project(':forge') {
environment 'MCP_MAPPINGS', '{mcp_mappings}'
environment 'FORGE_VERSION', "${project.version.substring(MC_VERSION.length() + 1)}"
}
data {
main 'net.minecraftforge.userdev.LaunchTesting'
environment 'target', 'fmluserdevdata'
environment 'MC_VERSION', "${MC_VERSION}"
environment 'FORGE_GROUP', "${project.group}"
environment 'MCP_VERSION', "${MCP_VERSION}"
environment 'MOD_CLASSES', '{source_roots}'
environment 'MCP_MAPPINGS', '{mcp_mappings}'
environment 'FORGE_VERSION', "${project.version.substring(MC_VERSION.length() + 1)}"
}
}
}
@@ -905,6 +1144,16 @@ project(':forge') {
tasks.eclipse.dependsOn('genEclipseRuns')
if (project.hasProperty('UPDATE_MAPPINGS')) {
extractRangeMap {
sources sourceSets.test.java.srcDirs
}
applyRangeMap {
sources sourceSets.test.java.srcDirs
}
sourceSets.test.java.srcDirs.each { extractMappedNew.addTarget it }
}
publishing {
publications {
mavenJava(MavenPublication) {
@@ -949,15 +1198,12 @@ project(':forge') {
}
repositories {
maven {
if (System.env.MAVEN_USER) {
url "https://maven.minecraftforge.net/releases/"
authentication {
basic(BasicAuthentication)
}
if (project.hasProperty('forgeMavenPassword')) {
credentials {
username = System.env.MAVEN_USER ?: 'not'
password = System.env.MAVEN_PASSWORD ?: 'set'
username project.properties.forgeMavenUser
password project.properties.forgeMavenPassword
}
url 'https://files.minecraftforge.net/maven/manage/upload'
} else {
url 'file://' + rootProject.file('repo').getAbsolutePath()
}
@@ -1010,7 +1256,7 @@ def getArtifacts(project, config, classifiers) {
def path = "${folder}${filename}"
def url = "https://libraries.minecraft.net/${path}"
if (!checkExists(url)) {
url = "https://maven.minecraftforge.net/${path}"
url = "https://files.minecraftforge.net/maven/${path}"
}
//TODO remove when Mojang launcher is updated
if (!classifiers && art.classifier != null) { //Mojang launcher doesn't currently support classifiers, so... move it to part of the version, and force the extension to 'jar'
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
+65
View File
@@ -0,0 +1,65 @@
<img src="assets/Forge_logo.svg">
MinecraftForge [![Latest Release](https://img.shields.io/maven-metadata/v/https/files.minecraftforge.net/maven/net/minecraftforge/forge/maven-metadata.xml.svg?label=latest)](https://files.minecraftforge.net) [![Discord](https://img.shields.io/discord/313125603924639766.svg?color=%237289da&label=discord&logo=discord&logoColor=%237289da)](https://discord.gg/UvedJ9m) [![Support](https://img.shields.io/badge/patreon-support-orange.svg)](https://www.patreon.com/LexManos) [![Merch](https://img.shields.io/badge/flocker-merch-blueviolet.svg)](https://forgedev.flocker.tv/)
=============
Forge is a free, open-source modding API all of your favourite mods use!
| Version | Support |
| ------------- | ------------- |
| 1.14.x | Active (latest) |
| 1.12.x | Active (stable) |
* [Download]
* [Forum]
* [Discord]
* [Documentation]
#### Notes:
- Introduced in 1.13 was a new FML, information found [here](NewFML.md).
# Installing Forge
Go to [the Forge website](https://files.minecraftforge.net)
and select the Minecraft version you wish to get Forge for from the list.
You can download the installer for the *Recommended Build* or the
*Latest build* there. Latest builds may have newer features but may be
more unstable as a result. The installer will attempt to install Forge
into your vanilla launcher environment, where you can then create a new
profile using that version and play the game!
For support and questions, visit [the Support Forum](https://www.minecraftforge.net/forum/forum/18-support-bug-reports/).
[Here is a short video from Rorax showing how to install and setup Forge.](https://www.youtube.com/watch?v=lB3ArN_-3Oc)
# Creating Mods
[See the "Getting Started" section in the Forge Documentation](https://mcforge.readthedocs.io/en/latest/gettingstarted/).
# Contribute to Forge
If you wish to actually inspect Forge, submit PRs or otherwise work
with Forge itself, you're in the right place!
[See the guide to setting up a Forge workspace](http://mcforge.readthedocs.io/en/latest/forgedev/).
### Pull requests
[See the "Making Changes and Pull Requests" section in the Forge documentation](https://mcforge.readthedocs.io/en/latest/forgedev/#making-changes-and-pull-requests).
Please read the contributing guidelines found [here](CONTRIBUTING.md) before making a pull request.
### Contributor License Agreement
We require all contributors to acknowledge the [Forge Contributor
License Agreement](https://cla-assistant.io/MinecraftForge/MinecraftForge). Please ensure you have a valid email address
associated with your GitHub account to do this. If you have previously
signed it, you should be OK.
#### Donate
*Forge is a large project with many collaborators working on it around the clock. Forge is and will always remain free to use and modify. However, it costs money to run such a large project as this, so please consider [becoming a patron](https://www.patreon.com/LexManos) or buying some [cool merch](https://forgedev.flocker.tv/).*
[Download]: https://files.minecraftforge.net/
[Forum]: https://www.minecraftforge.net/forum/
[Discord]: https://discord.gg/UvedJ9m
[Documentation]: https://mcforge.readthedocs.io
View File
File renamed without changes.
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
<svg enable-background="new 164.072 372.466 294.41 46.56" version="1.1" viewBox="164.072 372.466 294.41 46.56" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
<g fill="#DFA86A">
<polygon points="266.16 417.99 277.12 417.99 277.12 401.05 295.09 401.05 295.09 390.78 277.12 390.78 277.12 383.77 296.18 383.77 296.18 373.5 266.16 373.5"/>
<path d="m337.33 378.7c-2.103-2.057-4.629-3.64-7.51-4.704-2.743-1.015-5.786-1.528-9.041-1.528l-0.356 2e-3c-3.362 0-6.503 0.556-9.338 1.651-2.857 1.106-5.357 2.707-7.434 4.761-2.073 2.052-3.714 4.559-4.877 7.45-1.158 2.876-1.748 6.104-1.748 9.59 0 3.417 0.59 6.582 1.753 9.403 1.163 2.829 2.807 5.297 4.88 7.329 2.073 2.03 4.572 3.621 7.425 4.724 2.834 1.096 5.975 1.651 9.339 1.651h0.023c3.402-0.043 6.57-0.639 9.42-1.772 2.863-1.142 5.375-2.757 7.465-4.804 2.091-2.051 3.742-4.524 4.91-7.358 1.162-2.823 1.75-5.987 1.75-9.402 0-3.487-0.588-6.705-1.748-9.568-1.168-2.874-2.82-5.371-4.913-7.425zm-4.644 16.762c0 1.96-0.302 3.782-0.896 5.413-0.587 1.607-1.42 3.011-2.479 4.167-1.05 1.147-2.335 2.065-3.821 2.728-1.479 0.656-3.164 0.99-5.008 0.99-1.84 0-3.514-0.333-4.973-0.988-1.47-0.662-2.747-1.578-3.799-2.729-1.062-1.156-1.895-2.559-2.479-4.167-0.595-1.63-0.896-3.451-0.896-5.413 0-1.801 0.298-3.497 0.887-5.044 0.584-1.536 1.419-2.894 2.479-4.037 1.048-1.132 2.323-2.03 3.792-2.674 1.465-0.642 3.145-0.968 4.988-0.968 1.848 0 3.539 0.326 5.025 0.971 1.481 0.643 2.766 1.541 3.812 2.671 1.062 1.143 1.896 2.501 2.479 4.036 0.589 1.548 0.889 3.245 0.889 5.044z"/>
<path d="m376.27 395.65c1.902-2.327 2.867-5.221 2.867-8.603 0-2.614-0.508-4.84-1.506-6.613-0.997-1.762-2.354-3.188-4.035-4.234-1.603-0.995-3.445-1.705-5.482-2.114-1.938-0.388-3.969-0.583-6.037-0.583h-16.021v44.487h10.961v-17.282h2.35l9.447 17.282h13.127l-11.199-18.646c2.262-0.728 4.116-1.964 5.528-3.694zm-19.254-12.223h4.426c0.844 0 1.73 0.054 2.636 0.16 0.784 0.094 1.503 0.283 2.132 0.568 0.496 0.225 0.888 0.553 1.193 0.998 0.283 0.415 0.428 1.031 0.428 1.836 0 0.931-0.16 1.643-0.459 2.06-0.34 0.472-0.771 0.813-1.32 1.046-0.686 0.289-1.459 0.477-2.301 0.554-0.975 0.089-1.963 0.136-2.938 0.136h-3.795l-2e-3 -7.358z"/>
<path d="m394.82 386.38c1.05-1.132 2.325-2.03 3.793-2.674 1.464-0.642 3.144-0.968 4.988-0.968 1.843 0 3.611 0.311 5.26 0.921 1.609 0.599 2.992 1.449 4.107 2.531l1.314 1.278 8.019-8.105-1.454-1.298c-2.355-2.103-5.066-3.586-8.058-4.407-2.879-0.789-5.987-1.189-9.247-1.189-3.361 0-6.503 0.556-9.339 1.651-2.856 1.106-5.355 2.707-7.431 4.761-2.074 2.052-3.716 4.559-4.88 7.45-1.158 2.876-1.746 6.104-1.746 9.59 0 3.417 0.59 6.582 1.752 9.403 1.164 2.829 2.807 5.297 4.88 7.329 2.073 2.03 4.572 3.621 7.425 4.724 2.832 1.096 5.975 1.651 9.339 1.651 6.501 0 12.475-1.432 17.751-4.25l0.979-0.522v-23.814h-19.313v10.27h8.354v6.639c-0.871 0.397-1.834 0.709-2.881 0.933-1.5 0.314-3.127 0.478-4.83 0.478-1.841 0-3.514-0.333-4.973-0.988-1.472-0.662-2.748-1.578-3.801-2.729-1.06-1.156-1.893-2.559-2.478-4.167-0.595-1.63-0.896-3.451-0.896-5.413 0-1.801 0.299-3.497 0.887-5.044 0.586-1.54 1.421-2.897 2.479-4.041z"/>
<polygon points="437.69 407.72 437.69 400.36 456.41 400.36 456.41 390.09 437.69 390.09 437.69 383.77 457.44 383.77 457.44 373.5 426.72 373.5 426.72 417.99 458.48 417.99 458.48 407.72"/>
</g>
<path d="m243.63 379.09l-37.842-1.852 46.229-0.034v-3.727h-52.125l-1e-3 7.798v6.201c0 0.115-1.52-9.144-1.87-11.734h-4.098v13.029c0 0.123-1.753-10.888-1.939-12.264h-27.914c1.902 1.648 12.401 10.598 19.865 14.28 3.741 1.846 8.33 1.86 12.414 1.974 2.075 0.06 4.25 0.217 5.803 1.754 2.255 2.236 2.758 5.704 0.814 8.33-1.922 2.594-7.335 3.156-7.335 3.156l-4.509 5.531v6.424h10.251l0.319-6.348 8.863-6.285c-0.946 0.757-3.058 2.783-6.229 7.666-0.717 1.102-1.275 2.306-1.711 3.49 2.238-1.896 6.84-3.194 12.153-3.194 5.307 0 9.903 1.295 12.146 3.188-0.437-1.185-0.994-2.385-1.709-3.483-3.172-4.883-5.284-6.909-6.229-7.666l8.863 6.285 0.32 6.348h9.565v-6.424l-4.507-5.531s-6.675-0.425-8.423-3.156c-5.032-7.869 2.115-20.082 18.836-23.756z" fill="#1E2D41"/>
</svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

+21 -2
View File
@@ -1,6 +1,7 @@
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
}
dependencies {
@@ -27,7 +28,7 @@ minecraft {
mappings channel: '@MAPPING_CHANNEL@', version: '@MAPPING_VERSION@'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
// accessTransformer = file('build/resources/main/META-INF/accesstransformer.cfg')
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
@@ -63,6 +64,24 @@ minecraft {
}
}
}
data {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/')
mods {
examplemod {
source sourceSets.main
}
}
}
}
}
@@ -1,7 +1,7 @@
package com.example.examplemod;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.block.Blocks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
+4 -4
View File
@@ -6,7 +6,7 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[25,)" #mandatory (24 is current forge version)
loaderVersion="[28,)" #mandatory (28 is current forge version)
# A URL to refer people to when problems occur with this mod
issueTrackerURL="http://my.issue.tracker/" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
@@ -42,7 +42,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="[25,)" #mandatory
versionRange="[28,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
@@ -51,6 +51,6 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn
[[dependencies.examplemod]]
modId="minecraft"
mandatory=true
versionRange="[1.13.2]"
versionRange="[1.14.4]"
ordering="NONE"
side="BOTH"
side="BOTH"
@@ -0,0 +1,24 @@
--- a/com/mojang/blaze3d/platform/GLX.java
+++ b/com/mojang/blaze3d/platform/GLX.java
@@ -115,6 +115,10 @@
p_212906_0_.put(1286, "Operation on incomplete framebuffer");
});
+ /* Stores the last values sent into glMultiTexCoord2f */
+ public static float lastBrightnessX = 0.0f;
+ public static float lastBrightnessY = 0.0f;
+
public static void populateSnooperWithOpenGL(IDataHolder p_populateSnooperWithOpenGL_0_) {
p_populateSnooperWithOpenGL_0_.setFixedData("opengl_version", GlStateManager.getString(7938));
p_populateSnooperWithOpenGL_0_.setFixedData("opengl_vendor", GlStateManager.getString(7936));
@@ -913,6 +917,10 @@
GL13.glMultiTexCoord2f(p_glMultiTexCoord2f_0_, p_glMultiTexCoord2f_1_, p_glMultiTexCoord2f_2_);
}
+ if (p_glMultiTexCoord2f_0_ == GL_TEXTURE1) {
+ lastBrightnessX = p_glMultiTexCoord2f_1_;
+ lastBrightnessY = p_glMultiTexCoord2f_2_;
+ }
}
public static void glBlendFuncSeparate(int p_glBlendFuncSeparate_0_, int p_glBlendFuncSeparate_1_, int p_glBlendFuncSeparate_2_, int p_glBlendFuncSeparate_3_) {
@@ -0,0 +1,15 @@
--- a/net/minecraft/advancements/AdvancementManager.java
+++ b/net/minecraft/advancements/AdvancementManager.java
@@ -36,7 +36,11 @@
Map<ResourceLocation, Advancement.Builder> map = Maps.newHashMap();
p_212853_1_.forEach((p_223387_1_, p_223387_2_) -> {
try {
- Advancement.Builder advancement$builder = field_192783_b.fromJson(p_223387_2_, Advancement.Builder.class);
+ Advancement.Builder advancement$builder = net.minecraftforge.common.crafting.ConditionalAdvancement.read(field_192783_b, p_223387_1_, p_223387_2_);
+ if (advancement$builder == null) {
+ field_192782_a.info("Skipping loading advancement {} as it's conditions were not met", p_223387_1_);
+ return;
+ }
map.put(p_223387_1_, advancement$builder);
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
field_192782_a.error("Parsing error loading custom advancement {}: {}", p_223387_1_, jsonparseexception.getMessage());
@@ -1,11 +1,11 @@
--- a/net/minecraft/advancements/AdvancementRewards.java
+++ b/net/minecraft/advancements/AdvancementRewards.java
@@ -41,7 +41,7 @@
@@ -43,7 +43,7 @@
public void func_192113_a(EntityPlayerMP p_192113_1_) {
public void func_192113_a(ServerPlayerEntity p_192113_1_) {
p_192113_1_.func_195068_e(this.field_192115_b);
- LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_186472_a(p_192113_1_).func_204313_a(new BlockPos(p_192113_1_)).func_186471_a();
+ LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_186472_a(p_192113_1_).func_204313_a(new BlockPos(p_192113_1_)).func_186470_a(p_192113_1_).func_186469_a(p_192113_1_.func_184817_da()).func_186471_a(); // FORGE: add player & luck to LootContext
- LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_216015_a(LootParameters.field_216281_a, p_192113_1_).func_216015_a(LootParameters.field_216286_f, new BlockPos(p_192113_1_)).func_216023_a(p_192113_1_.func_70681_au()).func_216022_a(LootParameterSets.field_216265_f);
+ LootContext lootcontext = (new LootContext.Builder(p_192113_1_.func_71121_q())).func_216015_a(LootParameters.field_216281_a, p_192113_1_).func_216015_a(LootParameters.field_216286_f, new BlockPos(p_192113_1_)).func_216023_a(p_192113_1_.func_70681_au()).func_186469_a(p_192113_1_.func_184817_da()).func_216022_a(LootParameterSets.field_216265_f); // FORGE: luck to LootContext
boolean flag = false;
for(ResourceLocation resourcelocation : this.field_192116_c) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/advancements/PlayerAdvancements.java
+++ b/net/minecraft/advancements/PlayerAdvancements.java
@@ -174,6 +174,8 @@
@@ -187,6 +187,8 @@
}
public boolean func_192750_a(Advancement p_192750_1_, String p_192750_2_) {
@@ -9,9 +9,9 @@
boolean flag = false;
AdvancementProgress advancementprogress = this.func_192747_a(p_192750_1_);
boolean flag1 = advancementprogress.func_192105_a();
@@ -186,6 +188,7 @@
if (p_192750_1_.func_192068_c() != null && p_192750_1_.func_192068_c().func_193220_i() && this.field_192762_j.field_70170_p.func_82736_K().func_82766_b("announceAdvancements")) {
this.field_192756_d.func_184103_al().func_148539_a(new TextComponentTranslation("chat.type.advancement." + p_192750_1_.func_192068_c().func_192291_d().func_192307_a(), this.field_192762_j.func_145748_c_(), p_192750_1_.func_193123_j()));
@@ -199,6 +201,7 @@
if (p_192750_1_.func_192068_c() != null && p_192750_1_.func_192068_c().func_193220_i() && this.field_192762_j.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223620_w)) {
this.field_192756_d.func_184103_al().func_148539_a(new TranslationTextComponent("chat.type.advancement." + p_192750_1_.func_192068_c().func_192291_d().func_192307_a(), this.field_192762_j.func_145748_c_(), p_192750_1_.func_193123_j()));
}
+ net.minecraftforge.common.ForgeHooks.onAdvancement(this.field_192762_j, p_192750_1_);
}
@@ -1,7 +1,7 @@
--- a/net/minecraft/advancements/criterion/ItemPredicate.java
+++ b/net/minecraft/advancements/criterion/ItemPredicate.java
@@ -24,6 +24,8 @@
import net.minecraft.util.registry.IRegistry;
@@ -25,6 +25,8 @@
import net.minecraft.util.registry.Registry;
public class ItemPredicate {
+ private static final Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> custom_predicates = new java.util.HashMap<>();
@@ -9,14 +9,14 @@
public static final ItemPredicate field_192495_a = new ItemPredicate();
@Nullable
private final Tag<Item> field_200018_b;
@@ -90,6 +92,11 @@
@@ -93,6 +95,11 @@
public static ItemPredicate func_192492_a(@Nullable JsonElement p_192492_0_) {
if (p_192492_0_ != null && !p_192492_0_.isJsonNull()) {
JsonObject jsonobject = JsonUtils.func_151210_l(p_192492_0_, "item");
JsonObject jsonobject = JSONUtils.func_151210_l(p_192492_0_, "item");
+ if (jsonobject.has("type")) {
+ final ResourceLocation rl = new ResourceLocation(JsonUtils.func_151200_h(jsonobject, "type"));
+ if (custom_predicates.containsKey(rl)) return custom_predicates.get(rl).apply(jsonobject);
+ else throw new JsonSyntaxException("There is no ItemPredicate of type "+rl);
+ final ResourceLocation rl = new ResourceLocation(JSONUtils.func_151200_h(jsonobject, "type"));
+ if (custom_predicates.containsKey(rl)) return custom_predicates.get(rl).apply(jsonobject);
+ else throw new JsonSyntaxException("There is no ItemPredicate of type "+rl);
+ }
MinMaxBounds.IntBound minmaxbounds$intbound = MinMaxBounds.IntBound.func_211344_a(jsonobject.get("count"));
MinMaxBounds.IntBound minmaxbounds$intbound1 = MinMaxBounds.IntBound.func_211344_a(jsonobject.get("durability"));
@@ -30,7 +30,7 @@
+ }
+
+ public static Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> getPredicates() {
+ return unmod_predicates;
+ return unmod_predicates;
+ }
+
public static class Builder {
@@ -0,0 +1,96 @@
--- a/net/minecraft/block/AbstractRailBlock.java
+++ b/net/minecraft/block/AbstractRailBlock.java
@@ -35,7 +35,7 @@
}
public VoxelShape func_220053_a(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) {
- RailShape railshape = p_220053_1_.func_177230_c() == this ? p_220053_1_.func_177229_b(this.func_176560_l()) : null;
+ RailShape railshape = p_220053_1_.func_177230_c() == this ? getRailDirection(p_220053_1_, p_220053_2_, p_220053_3_, null) : null;
return railshape != null && railshape.func_208092_c() ? field_190959_b : field_185590_a;
}
@@ -57,7 +57,7 @@
public void func_220069_a(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_, BlockPos p_220069_5_, boolean p_220069_6_) {
if (!p_220069_2_.field_72995_K) {
- RailShape railshape = p_220069_1_.func_177229_b(this.func_176560_l());
+ RailShape railshape = getRailDirection(p_220069_1_, p_220069_2_, p_220069_3_, null);
boolean flag = false;
BlockPos blockpos = p_220069_3_.func_177977_b();
if (!func_220064_c(p_220069_2_, blockpos)) {
@@ -115,7 +115,7 @@
public void func_196243_a(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_5_) {
super.func_196243_a(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
- if (p_196243_1_.func_177229_b(this.func_176560_l()).func_208092_c()) {
+ if (getRailDirection(p_196243_1_, p_196243_2_, p_196243_3_, null).func_208092_c()) {
p_196243_2_.func_195593_d(p_196243_3_.func_177984_a(), this);
}
@@ -127,5 +127,66 @@
}
}
+ //Forge: Use getRailDirection(IBlockAccess, BlockPos, IBlockState, EntityMinecart) for enhanced ability
public abstract IProperty<RailShape> func_176560_l();
+
+ /* ======================================== FORGE START =====================================*/
+ /**
+ * Return true if the rail can make corners.
+ * Used by placement logic.
+ * @param world The world.
+ * @param pos Block's position in world
+ * @return True if the rail can make corners.
+ */
+ public boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos)
+ {
+ return !this.field_196277_c;
+ }
+
+ /**
+ * Returns true if the rail can make up and down slopes.
+ * Used by placement logic.
+ * @param world The world.
+ * @param pos Block's position in world
+ * @return True if the rail can make slopes.
+ */
+ public boolean canMakeSlopes(BlockState state, IBlockReader world, BlockPos pos) {
+ return true;
+ }
+
+ /**
+ * Return the rail's direction.
+ * Can be used to make the cart think the rail is a different shape,
+ * for example when making diamond junctions or switches.
+ * The cart parameter will often be null unless it it called from EntityMinecart.
+ *
+ * @param world The world.
+ * @param pos Block's position in world
+ * @param state The BlockState
+ * @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
+ * @return The direction.
+ */
+ public RailShape getRailDirection(BlockState state, IBlockReader world, BlockPos pos, @javax.annotation.Nullable net.minecraft.entity.item.minecart.AbstractMinecartEntity cart) {
+ return state.func_177229_b(func_176560_l());
+ }
+
+ /**
+ * Returns the max speed of the rail at the specified position.
+ * @param world The world.
+ * @param cart The cart on the rail, may be null.
+ * @param pos Block's position in world
+ * @return The max speed of the current rail.
+ */
+ public float getRailMaxSpeed(BlockState state, World world, BlockPos pos, net.minecraft.entity.item.minecart.AbstractMinecartEntity cart) {
+ return 0.4f;
+ }
+
+ /**
+ * This function is called by any minecart that passes over this rail.
+ * It is called once per update tick that the minecart is on the rail.
+ * @param world The world.
+ * @param cart The cart on the rail.
+ * @param pos Block's position in world
+ */
+ public void onMinecartPass(BlockState state, World world, BlockPos pos, net.minecraft.entity.item.minecart.AbstractMinecartEntity cart) { }
}
@@ -0,0 +1,13 @@
--- a/net/minecraft/block/BedBlock.java
+++ b/net/minecraft/block/BedBlock.java
@@ -85,7 +85,9 @@
}
}
- if (p_220051_2_.field_73011_w.func_76567_e() && p_220051_2_.func_180494_b(p_220051_3_) != Biomes.field_76778_j) {
+ net.minecraftforge.common.extensions.IForgeDimension.SleepResult sleepResult = p_220051_2_.field_73011_w.canSleepAt(p_220051_4_, p_220051_3_);
+ if (sleepResult != net.minecraftforge.common.extensions.IForgeDimension.SleepResult.BED_EXPLODES) {
+ if (sleepResult == net.minecraftforge.common.extensions.IForgeDimension.SleepResult.DENY) return true;
if (p_220051_1_.func_177229_b(field_176471_b)) {
p_220051_4_.func_146105_b(new TranslationTextComponent("block.minecraft.bed.occupied"), true);
return true;
@@ -7,22 +7,33 @@
-public class Block implements IItemProvider {
+public class Block extends net.minecraftforge.registries.ForgeRegistryEntry<Block> implements IItemProvider, net.minecraftforge.common.extensions.IForgeBlock {
protected static final Logger field_196273_d = LogManager.getLogger();
- public static final ObjectIntIdentityMap<IBlockState> field_176229_d = new ObjectIntIdentityMap<>();
- public static final ObjectIntIdentityMap<BlockState> field_176229_d = new ObjectIntIdentityMap<>();
+ @Deprecated //Forge: Do not use, use GameRegistry
+ public static final ObjectIntIdentityMap<IBlockState> field_176229_d = net.minecraftforge.registries.GameData.getBlockStateIDMap();
private static final EnumFacing[] field_212556_a = new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.DOWN, EnumFacing.UP};
protected final int field_149784_t;
protected final float field_149782_v;
@@ -298,7 +299,7 @@
+ public static final ObjectIntIdentityMap<BlockState> field_176229_d = net.minecraftforge.registries.GameData.getBlockStateIDMap();
private static final Direction[] field_212556_a = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP};
private static final LoadingCache<VoxelShape, Boolean> field_223006_b = CacheBuilder.newBuilder().maximumSize(512L).weakKeys().build(new CacheLoader<VoxelShape, Boolean>() {
public Boolean load(VoxelShape p_load_1_) {
@@ -246,6 +247,10 @@
this.field_149765_K = p_i48440_1_.field_200961_i;
this.field_208621_p = p_i48440_1_.field_208772_j;
this.field_220085_g = p_i48440_1_.field_222381_j;
+ this.harvestLevel = p_i48440_1_.harvestLevel;
+ this.harvestTool = p_i48440_1_.harvestTool;
+ final ResourceLocation lootTableCache = p_i48440_1_.field_222381_j;
+ this.lootTableSupplier = lootTableCache != null ? () -> lootTableCache : p_i48440_1_.lootTableSupplier != null ? p_i48440_1_.lootTableSupplier : () -> new ResourceLocation(this.getRegistryName().func_110624_b(), "blocks/" + this.getRegistryName().func_110623_a());
this.field_176227_L = builder.func_206893_a(BlockState::new);
this.func_180632_j(this.field_176227_L.func_177621_b());
}
@@ -291,7 +296,7 @@
@Deprecated
public boolean func_196253_a(IBlockState p_196253_1_, BlockItemUseContext p_196253_2_) {
- return this.field_149764_J.func_76222_j() && p_196253_2_.func_195996_i().func_77973_b() != this.func_199767_j();
+ return p_196253_1_.func_185904_a().func_76222_j() && p_196253_2_.func_195996_i().func_77973_b() != this.func_199767_j();
public boolean func_196253_a(BlockState p_196253_1_, BlockItemUseContext p_196253_2_) {
- return this.field_149764_J.func_76222_j() && (p_196253_2_.func_195996_i().func_190926_b() || p_196253_2_.func_195996_i().func_77973_b() != this.func_199767_j());
+ return p_196253_1_.func_185904_a().func_76222_j() && (p_196253_2_.func_195996_i().func_190926_b() || p_196253_2_.func_195996_i().func_77973_b() != this.func_199767_j());
}
@Deprecated
@@ -310,8 +311,9 @@
@@ -303,8 +308,9 @@
return this.field_149789_z;
}
@@ -33,39 +44,28 @@
}
@Deprecated
@@ -322,11 +324,11 @@
@@ -315,7 +321,7 @@
@Deprecated
@OnlyIn(Dist.CLIENT)
public int func_185484_c(IBlockState p_185484_1_, IWorldReader p_185484_2_, BlockPos p_185484_3_) {
- int i = p_185484_2_.func_175626_b(p_185484_3_, p_185484_1_.func_185906_d());
+ int i = p_185484_2_.func_175626_b(p_185484_3_, p_185484_1_.getLightValue(p_185484_2_, p_185484_3_));
if (i == 0 && p_185484_1_.func_177230_c() instanceof BlockSlab) {
p_185484_3_ = p_185484_3_.func_177977_b();
p_185484_1_ = p_185484_2_.func_180495_p(p_185484_3_);
- return p_185484_2_.func_175626_b(p_185484_3_, p_185484_1_.func_185906_d());
+ return p_185484_2_.func_175626_b(p_185484_3_, p_185484_1_.getLightValue(p_185484_2_, p_185484_3_));
} else {
return i;
}
@@ -468,8 +470,17 @@
public int func_220058_a(BlockState p_220058_1_, IEnviromentBlockReader p_220058_2_, BlockPos p_220058_3_) {
- return p_220058_2_.func_217338_b(p_220058_3_, p_220058_1_.func_185906_d());
+ return p_220058_2_.func_217338_b(p_220058_3_, p_220058_1_.getLightValue(p_220058_2_, p_220058_3_));
}
@OnlyIn(Dist.CLIENT)
@@ -460,10 +466,9 @@
@Deprecated
public void func_196243_a(IBlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, IBlockState p_196243_4_, boolean p_196243_5_) {
+ // FORGE: Remove modded TEs when the block changes
+ if (hasTileEntity(p_196243_1_) && !(this instanceof BlockContainer // Vanilla ITEP classes, they do this themselves
+ || this instanceof net.minecraft.block.BlockBed
+ || this instanceof net.minecraft.block.BlockRedstoneDiode)) {
+ if (p_196243_1_.func_177230_c() != p_196243_4_.func_177230_c()) {
+ p_196243_2_.func_175713_t(p_196243_3_);
+ }
+ }
public void func_196243_a(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
- if (this.func_149716_u() && p_196243_1_.func_177230_c() != p_196243_4_.func_177230_c()) {
+ if (p_196243_1_.hasTileEntity() && p_196243_1_.func_177230_c() != p_196243_4_.func_177230_c()) {
p_196243_2_.func_175713_t(p_196243_3_);
}
-
}
+ @Deprecated //Forge: Use fortune/location sensitive version
public int func_196264_a(IBlockState p_196264_1_, Random p_196264_2_) {
return 1;
}
@@ -484,30 +495,30 @@
@Deprecated
@@ -472,8 +477,8 @@
if (f == -1.0F) {
return 0.0F;
} else {
@@ -76,41 +76,35 @@
}
}
@Deprecated
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
- if (!p_196255_2_.field_72995_K) {
- int i = this.func_196251_a(p_196255_1_, p_196255_5_, p_196255_2_, p_196255_3_, p_196255_2_.field_73012_v);
-
- for(int j = 0; j < i; ++j) {
- if (!(p_196255_4_ < 1.0F) || !(p_196255_2_.field_73012_v.nextFloat() > p_196255_4_)) {
- Item item = this.func_199769_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_5_).func_199767_j();
- if (item != Items.field_190931_a) {
- func_180635_a(p_196255_2_, p_196255_3_, new ItemStack(item));
- }
- }
+ if (!p_196255_2_.field_72995_K && !p_196255_2_.restoringBlockSnapshots) { // do not drop items while restoring blockstates, prevents item dupe
+ NonNullList<ItemStack> drops = NonNullList.func_191196_a();
+ getDrops(p_196255_1_, drops, p_196255_2_, p_196255_3_, p_196255_5_);
+ p_196255_4_ = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(drops, p_196255_2_, p_196255_3_, p_196255_1_, p_196255_5_, p_196255_4_, false, harvesters.get());
+ for (ItemStack stack : drops) {
+ if (p_196255_2_.field_73012_v.nextFloat() <= p_196255_4_)
+ func_180635_a(p_196255_2_, p_196255_3_, stack);
}
-
@@ -483,8 +488,7 @@
public ResourceLocation func_220068_i() {
if (this.field_220085_g == null) {
- ResourceLocation resourcelocation = Registry.field_212618_g.func_177774_c(this);
- this.field_220085_g = new ResourceLocation(resourcelocation.func_110624_b(), "blocks/" + resourcelocation.func_110623_a());
+ this.field_220085_g = this.lootTableSupplier.get();
}
return this.field_220085_g;
@@ -553,7 +557,7 @@
}
public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) {
- if (!p_180635_0_.field_72995_K && !p_180635_2_.func_190926_b() && p_180635_0_.func_82736_K().func_82766_b("doTileDrops")) {
+ if (!p_180635_0_.field_72995_K && !p_180635_2_.func_190926_b() && p_180635_0_.func_82736_K().func_82766_b("doTileDrops") && !p_180635_0_.restoringBlockSnapshots) {// do not drop items while restoring blockstates, prevents item dupe
+ if (captureDrops.get()) {
+ capturedDrops.get().add(p_180635_2_);
+ return;
+ }
- if (!p_180635_0_.field_72995_K && !p_180635_2_.func_190926_b() && p_180635_0_.func_82736_K().func_223586_b(GameRules.field_223603_f)) {
+ if (!p_180635_0_.field_72995_K && !p_180635_2_.func_190926_b() && p_180635_0_.func_82736_K().func_223586_b(GameRules.field_223603_f) && !p_180635_0_.restoringBlockSnapshots) { // do not drop items while restoring blockstates, prevents item dupe
float f = 0.5F;
double d0 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D;
double d1 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D;
@@ -529,6 +540,7 @@
@@ -565,7 +569,7 @@
}
public void func_180637_b(World p_180637_1_, BlockPos p_180637_2_, int p_180637_3_) {
- if (!p_180637_1_.field_72995_K && p_180637_1_.func_82736_K().func_223586_b(GameRules.field_223603_f)) {
+ if (!p_180637_1_.field_72995_K && p_180637_1_.func_82736_K().func_223586_b(GameRules.field_223603_f) && !p_180637_1_.restoringBlockSnapshots) { // do not drop items while restoring blockstates, prevents item dupe
while(p_180637_3_ > 0) {
int i = ExperienceOrbEntity.func_70527_a(p_180637_3_);
p_180637_3_ -= i;
@@ -575,6 +579,7 @@
}
@@ -118,57 +112,57 @@
public float func_149638_a() {
return this.field_149781_w;
}
@@ -543,7 +555,7 @@
}
}
- return raytraceresult;
+ return p_180636_0_.func_177230_c().getRayTraceResult(p_180636_0_, p_180636_1_, p_180636_2_, p_180636_3_, p_180636_4_, raytraceresult);
}
public void func_180652_a(World p_180652_1_, BlockPos p_180652_2_, Explosion p_180652_3_) {
@@ -597,16 +609,22 @@
public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) {
p_180657_2_.func_71029_a(StatList.field_188065_ae.func_199076_b(this));
p_180657_2_.func_71020_j(0.005F);
- if (this.func_149700_E() && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) {
+ if (this.canSilkHarvest(p_180657_4_, p_180657_1_, p_180657_3_, p_180657_2_) && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) {
+ NonNullList<ItemStack> items = NonNullList.func_191196_a();
ItemStack itemstack = this.func_180643_i(p_180657_4_);
- func_180635_a(p_180657_1_, p_180657_3_, itemstack);
+ if (!itemstack.func_190926_b()) items.add(itemstack);
+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_4_, 0, 1.0f, true, p_180657_2_);
+ items.forEach(e -> func_180635_a(p_180657_1_, p_180657_3_, e));
} else {
+ harvesters.set(p_180657_2_);
int i = EnchantmentHelper.func_77506_a(Enchantments.field_185308_t, p_180657_6_);
p_180657_4_.func_196949_c(p_180657_1_, p_180657_3_, i);
+ harvesters.set(null);
}
}
+ @Deprecated //Use state sensitive version
protected boolean func_149700_E() {
return this.func_176223_P().func_185917_h() && !this.func_149716_u();
}
@@ -663,6 +681,7 @@
p_176216_2_.field_70181_x = 0.0D;
@@ -677,6 +682,7 @@
p_176216_2_.func_213317_d(p_176216_2_.func_213322_ci().func_216372_d(1.0D, 0.0D, 1.0D));
}
+ @Deprecated // Forge: Use more sensitive version below: getPickBlock
public ItemStack func_185473_a(IBlockReader p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) {
public ItemStack func_185473_a(IBlockReader p_185473_1_, BlockPos p_185473_2_, BlockState p_185473_3_) {
return new ItemStack(this);
}
@@ -737,6 +756,7 @@
@@ -690,6 +696,7 @@
return Fluids.field_204541_a.func_207188_f();
}
+ @Deprecated //Forge: Use more sensitive version
public float func_208618_m() {
return this.field_149765_K;
}
@@ -710,6 +717,7 @@
public void func_176224_k(World p_176224_1_, BlockPos p_176224_2_) {
}
+ @Deprecated //Forge: Use more sensitive version
public boolean func_149659_a(Explosion p_149659_1_) {
return true;
}
@@ -754,6 +762,7 @@
}
}
+ @Deprecated //Forge: Use more sensitive version {@link IForgeBlockState#getSoundType(IWorldReader, BlockPos, Entity) }
public SoundType func_185467_w() {
public SoundType func_220072_p(BlockState p_220072_1_) {
return this.field_149762_H;
}
@@ -758,11 +778,11 @@
@@ -763,7 +772,7 @@
this.field_220086_i = Item.func_150898_a(this);
}
- return this.field_220086_i;
+ return this.field_220086_i.delegate.get(); //Forge: Vanilla caches the items, update with registry replacements.
}
public boolean func_208619_r() {
@@ -771,7 +780,7 @@
}
public String toString() {
- return "Block{" + Registry.field_212618_g.func_177774_c(this) + "}";
+ return "Block{" + getRegistryName() + "}";
}
@OnlyIn(Dist.CLIENT)
@@ -779,13 +788,81 @@
}
public static boolean func_196252_e(Block p_196252_0_) {
@@ -181,72 +175,33 @@
+ return net.minecraftforge.common.Tags.Blocks.DIRT.func_199685_a_(p_196245_0_);
}
public static void func_149671_p() {
@@ -1129,7 +1149,7 @@
func_196254_a("chiseled_quartz_block", new Block(Block.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_151677_p).func_200943_b(0.8F)));
func_196254_a("quartz_pillar", new BlockRotatedPillar(Block.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_151677_p).func_200943_b(0.8F)));
func_196254_a("quartz_stairs", new BlockStairs(block42.func_176223_P(), Block.Properties.func_200950_a(block42)));
- func_196254_a("activator_rail", new BlockRailPowered(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e)));
+ func_196254_a("activator_rail", new BlockRailPowered(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e), true));
func_196254_a("dropper", new BlockDropper(Block.Properties.func_200945_a(Material.field_151576_e).func_200943_b(3.5F)));
func_196254_a("white_terracotta", new Block(Block.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_193561_M).func_200948_a(1.25F, 4.2F)));
func_196254_a("orange_terracotta", new Block(Block.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_193562_N).func_200948_a(1.25F, 4.2F)));
@@ -1455,6 +1475,7 @@
func_196254_a("bubble_column", new BlockBubbleColumn(Block.Properties.func_200945_a(Material.field_203244_i).func_200942_a()));
func_196254_a("structure_block", new BlockStructure(Block.Properties.func_200949_a(Material.field_151573_f, MaterialColor.field_197656_x).func_200948_a(-1.0F, 3600000.0F)));
+ if(false) // Processed in GameData.BlockCallbacks#onBake
for(Block block85 : IRegistry.field_212618_g) {
for(IBlockState iblockstate : block85.func_176194_O().func_177619_a()) {
field_176229_d.func_195867_b(iblockstate);
@@ -1594,4 +1615,83 @@
return Objects.hash(this.field_212164_a, this.field_212165_b, this.field_212166_c);
}
}
+ /* ======================================== FORGE START =====================================*/
+ protected Random RANDOM = new Random();
+ protected ThreadLocal<EntityPlayer> harvesters = new ThreadLocal<>();
+ private net.minecraftforge.common.ToolType harvestTool;
+ private int harvestLevel;
+ protected static ThreadLocal<Boolean> captureDrops = ThreadLocal.withInitial(() -> false);
+ protected static ThreadLocal<NonNullList<ItemStack>> capturedDrops = ThreadLocal.withInitial(NonNullList::func_191196_a);
+ protected NonNullList<ItemStack> captureDrops(boolean start)
+ {
+ if (start) {
+ captureDrops.set(true);
+ capturedDrops.get().clear();
+ return NonNullList.func_191196_a();
+ } else {
+ captureDrops.set(false);
+ return capturedDrops.get();
+ }
+ }
+ private final net.minecraftforge.common.util.ReverseTagWrapper<Block> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, BlockTags::getGeneration, BlockTags::func_199896_a);
+ private final java.util.function.Supplier<ResourceLocation> lootTableSupplier;
+
+ @Override
+ public float getSlipperiness(IBlockState state, IWorldReader world, BlockPos pos, @Nullable Entity entity) {
+ public float getSlipperiness(BlockState state, IWorldReader world, BlockPos pos, @Nullable Entity entity) {
+ return this.field_149765_K;
+ }
+
+ @Override
+ public boolean canSilkHarvest(IBlockState state, IWorldReader world, BlockPos pos, EntityPlayer player) {
+ return this.func_149700_E() && !state.hasTileEntity();
+ }
+
+ @Nullable
+ @Override
+ public net.minecraftforge.common.ToolType getHarvestTool(IBlockState state) {
+ public net.minecraftforge.common.ToolType getHarvestTool(BlockState state) {
+ return harvestTool; //TODO: RE-Evaluate
+ }
+
+ @Override
+ public int getHarvestLevel(IBlockState state) {
+ public int getHarvestLevel(BlockState state) {
+ return harvestLevel; //TODO: RE-Evaluate
+ }
+
+ @Override
+ public boolean canSustainPlant(IBlockState state, IBlockReader world, BlockPos pos, EnumFacing facing, net.minecraftforge.common.IPlantable plantable) {
+ IBlockState plant = plantable.getPlant(world, pos.func_177972_a(facing));
+ net.minecraftforge.common.EnumPlantType type = plantable.getPlantType(world, pos.func_177972_a(facing));
+ public boolean canSustainPlant(BlockState state, IBlockReader world, BlockPos pos, Direction facing, net.minecraftforge.common.IPlantable plantable) {
+ BlockState plant = plantable.getPlant(world, pos.func_177972_a(facing));
+ net.minecraftforge.common.PlantType type = plantable.getPlantType(world, pos.func_177972_a(facing));
+
+ if (plant.func_177230_c() == Blocks.field_150434_aF)
+ return this.getBlock() == Blocks.field_150434_aF || this.getBlock() == Blocks.field_150354_m || this.getBlock() == Blocks.field_196611_F;
@@ -254,16 +209,16 @@
+ if (plant.func_177230_c() == Blocks.field_196608_cF && this == Blocks.field_196608_cF)
+ return true;
+
+ if (plantable instanceof BlockBush && ((BlockBush)plantable).func_200014_a_(state, world, pos))
+ if (plantable instanceof BushBlock && ((BushBlock)plantable).func_200014_a_(state, world, pos))
+ return true;
+
+ switch (type) {
+ case Desert: return this.getBlock() == Blocks.field_150354_m || this.getBlock() == Blocks.field_150405_ch || this.getBlock() instanceof BlockGlazedTerracotta;
+ case Desert: return this.getBlock() == Blocks.field_150354_m || this.getBlock() == Blocks.field_150405_ch || this.getBlock() instanceof GlazedTerracottaBlock;
+ case Nether: return this.getBlock() == Blocks.field_150425_aM;
+ case Crop: return this.getBlock() == Blocks.field_150458_ak;
+ case Cave: return state.func_185896_q();
+ case Crop: return this.getBlock() == Blocks.field_150458_ak;
+ case Cave: return Block.func_220056_d(state, world, pos, Direction.UP);
+ case Plains: return this.getBlock() == Blocks.field_196658_i || Block.func_196245_f(this) || this.getBlock() == Blocks.field_150458_ak;
+ case Water: return state.func_185904_a() == Material.field_151586_h; //&& state.getValue(BlockLiquidWrapper)
+ case Water: return state.func_185904_a() == Material.field_151586_h; //&& state.getValue(BlockLiquidWrapper)
+ case Beach:
+ boolean isBeach = this.getBlock() == Blocks.field_196658_i || Block.func_196245_f(this) || this.getBlock() == Blocks.field_150354_m;
+ boolean hasWater = (world.func_180495_p(pos.func_177974_f()).func_185904_a() == Material.field_151586_h ||
@@ -275,6 +230,11 @@
+ return false;
+ }
+
+ @Override
+ public final java.util.Set<ResourceLocation> getTags() {
+ return reverseTags.getTagNames();
+ }
+
+ static {
+ net.minecraftforge.common.ForgeHooks.setBlockToolSetter((block, tool, level) -> {
+ block.harvestTool = tool;
@@ -282,4 +242,51 @@
+ });
+ }
+ /* ========================================= FORGE END ======================================*/
}
+
public static enum OffsetType {
NONE,
XZ,
@@ -804,6 +881,9 @@
private float field_200961_i = 0.6F;
private ResourceLocation field_222381_j;
private boolean field_208772_j;
+ private int harvestLevel = -1;
+ private net.minecraftforge.common.ToolType harvestTool;
+ private java.util.function.Supplier<ResourceLocation> lootTableSupplier;
private Properties(Material p_i48616_1_, MaterialColor p_i48616_2_) {
this.field_200953_a = p_i48616_1_;
@@ -834,6 +914,8 @@
block$properties.field_200956_d = p_200950_0_.field_149762_H;
block$properties.field_200961_i = p_200950_0_.func_208618_m();
block$properties.field_208772_j = p_200950_0_.field_208621_p;
+ block$properties.harvestLevel = p_200950_0_.harvestLevel;
+ block$properties.harvestTool = p_200950_0_.harvestTool;
return block$properties;
}
@@ -882,13 +964,23 @@
return this;
}
+ public Block.Properties harvestLevel(int harvestLevel) {
+ this.harvestLevel = harvestLevel;
+ return this;
+ }
+
+ public Block.Properties harvestTool(net.minecraftforge.common.ToolType harvestTool) {
+ this.harvestTool = harvestTool;
+ return this;
+ }
+
public Block.Properties func_222380_e() {
this.field_222381_j = LootTables.field_186419_a;
return this;
}
public Block.Properties func_222379_b(Block p_222379_1_) {
- this.field_222381_j = p_222379_1_.func_220068_i();
+ this.lootTableSupplier = () -> p_222379_1_.delegate.get().func_220068_i();
return this;
}
}
@@ -1,22 +0,0 @@
--- a/net/minecraft/block/BlockAbstractBanner.java
+++ b/net/minecraft/block/BlockAbstractBanner.java
@@ -51,7 +51,7 @@
}
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
- func_180635_a(p_196255_2_, p_196255_3_, this.func_185473_a(p_196255_2_, p_196255_3_, p_196255_1_));
+ super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_);
}
public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) {
@@ -75,4 +75,10 @@
public EnumDyeColor func_196285_M_() {
return this.field_196286_a;
}
+
+ @Override
+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
+ TileEntity te = world.func_175625_s(pos);
+ drops.add((te instanceof TileEntityBanner) ? ((TileEntityBanner)te).func_190615_l(state) : func_185473_a(world, pos, state));
+ }
}
@@ -1,52 +0,0 @@
--- a/net/minecraft/block/BlockAbstractSkull.java
+++ b/net/minecraft/block/BlockAbstractSkull.java
@@ -38,6 +38,7 @@
}
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
+ super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_);
}
public void func_176208_a(World p_176208_1_, BlockPos p_176208_2_, IBlockState p_176208_3_, EntityPlayer p_176208_4_) {
@@ -45,6 +46,7 @@
TileEntitySkull.func_195486_a(p_176208_1_, p_176208_2_);
}
+ this.func_196255_a(p_176208_3_, p_176208_1_, p_176208_2_, 1.0f, 0);
super.func_176208_a(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
}
@@ -55,7 +57,7 @@
public void func_196243_a(IBlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, IBlockState p_196243_4_, boolean p_196243_5_) {
if (p_196243_1_.func_177230_c() != p_196243_4_.func_177230_c() && !p_196243_2_.field_72995_K) {
TileEntity tileentity = p_196243_2_.func_175625_s(p_196243_3_);
- if (tileentity instanceof TileEntitySkull) {
+ if (false && tileentity instanceof TileEntitySkull) { //Forge: Moved to getDrops
TileEntitySkull tileentityskull = (TileEntitySkull)tileentity;
if (tileentityskull.func_195487_d()) {
ItemStack itemstack = this.func_185473_a(p_196243_2_, p_196243_3_, p_196243_1_);
@@ -74,6 +76,24 @@
}
}
+ @Override
+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
+ TileEntity te = world.func_175625_s(pos);
+ if (te instanceof TileEntitySkull) {
+ TileEntitySkull skull = (TileEntitySkull)te;
+ if (skull.func_195487_d()) {
+ ItemStack ret = func_185473_a(world, pos, state);
+ Block block = skull.func_195044_w().func_177230_c();
+ if ((block == Blocks.field_196710_eS || block == Blocks.field_196709_eR) && skull.func_152108_a() != null) {
+ NBTTagCompound nbt = new NBTTagCompound();
+ NBTUtil.func_180708_a(nbt, skull.func_152108_a());
+ ret.func_196082_o().func_74782_a("SkullOwner", nbt);
+ }
+ drops.add(ret);
+ }
+ }
+ }
+
@OnlyIn(Dist.CLIENT)
public BlockSkull.ISkullType func_196292_N_() {
return this.field_196293_a;
@@ -1,13 +0,0 @@
--- a/net/minecraft/block/BlockBed.java
+++ b/net/minecraft/block/BlockBed.java
@@ -67,7 +67,9 @@
}
}
- if (p_196250_2_.field_73011_w.func_76567_e() && p_196250_2_.func_180494_b(p_196250_3_) != Biomes.field_76778_j) {
+ net.minecraftforge.common.extensions.IForgeDimension.SleepResult sleepResult = p_196250_2_.field_73011_w.canSleepAt(p_196250_4_, p_196250_3_);
+ if (sleepResult != net.minecraftforge.common.extensions.IForgeDimension.SleepResult.BED_EXPLODES) {
+ if (sleepResult == net.minecraftforge.common.extensions.IForgeDimension.SleepResult.DENY) return true;
if (p_196250_1_.func_177229_b(field_176471_b)) {
EntityPlayer entityplayer = this.func_176470_e(p_196250_2_, p_196250_3_);
if (entityplayer != null) {
@@ -1,32 +0,0 @@
--- a/net/minecraft/block/BlockBush.java
+++ b/net/minecraft/block/BlockBush.java
@@ -10,7 +10,7 @@
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReaderBase;
-public class BlockBush extends Block {
+public class BlockBush extends Block implements net.minecraftforge.common.IPlantable {
protected BlockBush(Block.Properties p_i48437_1_) {
super(p_i48437_1_);
}
@@ -26,6 +26,8 @@
public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) {
BlockPos blockpos = p_196260_3_.func_177977_b();
+ if (p_196260_1_.func_177230_c() == this) //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.
+ return p_196260_2_.func_180495_p(blockpos).canSustainPlant(p_196260_2_, blockpos, EnumFacing.UP, this);
return this.func_200014_a_(p_196260_2_.func_180495_p(blockpos), p_196260_2_, blockpos);
}
@@ -44,4 +46,11 @@
public int func_200011_d(IBlockState p_200011_1_, IBlockReader p_200011_2_, BlockPos p_200011_3_) {
return 0;
}
+
+ @Override
+ public IBlockState getPlant(IBlockReader world, BlockPos pos) {
+ IBlockState state = world.func_180495_p(pos);
+ if (state.func_177230_c() != this) return func_176223_P();
+ return state;
+ }
}
@@ -1,20 +0,0 @@
--- a/net/minecraft/block/BlockChorusFlower.java
+++ b/net/minecraft/block/BlockChorusFlower.java
@@ -42,7 +42,7 @@
BlockPos blockpos = p_196267_3_.func_177984_a();
if (p_196267_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < 256) {
int i = p_196267_1_.func_177229_b(field_185607_a);
- if (i < 5) {
+ if (i < 5 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, blockpos, p_196267_1_, true)) {
boolean flag = false;
boolean flag1 = false;
IBlockState iblockstate = p_196267_2_.func_180495_p(p_196267_3_.func_177977_b());
@@ -99,7 +99,7 @@
} else {
this.func_185605_c(p_196267_2_, p_196267_3_);
}
-
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_);
}
}
}
@@ -1,39 +0,0 @@
--- a/net/minecraft/block/BlockCocoa.java
+++ b/net/minecraft/block/BlockCocoa.java
@@ -34,10 +34,11 @@
}
public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
- if (p_196267_2_.field_73012_v.nextInt(5) == 0) {
+ if (true) {
int i = p_196267_1_.func_177229_b(field_176501_a);
- if (i < 2) {
+ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_2_.field_73012_v.nextInt(5) == 0)) {
p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_.func_206870_a(field_176501_a, Integer.valueOf(i + 1)), 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_);
}
}
@@ -90,14 +91,20 @@
}
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
- int i = p_196255_1_.func_177229_b(field_176501_a);
+ super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_);
+ }
+
+ @Override
+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
+ super.getDrops(state, drops, world, pos, fortune);
+ int i = state.func_177229_b(field_176501_a);
int j = 1;
if (i >= 2) {
j = 3;
}
for(int k = 0; k < j; ++k) {
- func_180635_a(p_196255_2_, p_196255_3_, new ItemStack(Items.field_196130_bo));
+ drops.add(new ItemStack(Items.field_196130_bo));
}
}
@@ -1,57 +0,0 @@
--- a/net/minecraft/block/BlockCrops.java
+++ b/net/minecraft/block/BlockCrops.java
@@ -55,12 +55,14 @@
public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_);
+ if (!p_196267_2_.func_205050_e(p_196267_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
if (p_196267_2_.func_201669_a(p_196267_3_.func_177984_a(), 0) >= 9) {
int i = this.func_185527_x(p_196267_1_);
if (i < this.func_185526_g()) {
float f = func_180672_a(this, p_196267_2_, p_196267_3_);
- if (p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0) {
+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0)) {
p_196267_2_.func_180501_a(p_196267_3_, this.func_185528_e(i + 1), 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_);
}
}
}
@@ -89,9 +91,9 @@
for(int j = -1; j <= 1; ++j) {
float f1 = 0.0F;
IBlockState iblockstate = p_180672_1_.func_180495_p(blockpos.func_177982_a(i, 0, j));
- if (iblockstate.func_177230_c() == Blocks.field_150458_ak) {
+ if (iblockstate.canSustainPlant(p_180672_1_, blockpos.func_177982_a(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)p_180672_0_)) {
f1 = 1.0F;
- if (iblockstate.func_177229_b(BlockFarmland.field_176531_a) > 0) {
+ if (iblockstate.isFertile(p_180672_1_, blockpos.func_177982_a(i, 0, j))) {
f1 = 3.0F;
}
}
@@ -135,15 +137,20 @@
}
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
- super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, 0);
- if (!p_196255_2_.field_72995_K) {
- int i = this.func_185527_x(p_196255_1_);
+ super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_);
+ }
+
+ @Override
+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
+ super.getDrops(state, drops, world, pos, 0);
+ {
+ int i = this.func_185527_x(state);
if (i >= this.func_185526_g()) {
- int j = 3 + p_196255_5_;
+ int j = 3 + fortune;
for(int k = 0; k < j; ++k) {
- if (p_196255_2_.field_73012_v.nextInt(2 * this.func_185526_g()) <= i) {
- func_180635_a(p_196255_2_, p_196255_3_, new ItemStack(this.func_199772_f()));
+ if (world.field_73012_v.nextInt(2 * this.func_185526_g()) <= i) {
+ drops.add(new ItemStack(this.func_199772_f()));
}
}
}
@@ -1,22 +0,0 @@
--- a/net/minecraft/block/BlockDeadBush.java
+++ b/net/minecraft/block/BlockDeadBush.java
@@ -14,7 +14,7 @@
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
-public class BlockDeadBush extends BlockBush {
+public class BlockDeadBush extends BlockBush implements net.minecraftforge.common.IShearable {
protected static final VoxelShape field_196397_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D);
protected BlockDeadBush(Block.Properties p_i48418_1_) {
@@ -46,4 +46,10 @@
super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, flag ? Blocks.field_150350_a.func_176223_P() : p_180657_4_, p_180657_5_, p_180657_6_);
}
+
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) {
+ world.func_180501_a(pos, Blocks.field_150350_a.func_176223_P(), 11);
+ return java.util.Arrays.asList(new ItemStack(Blocks.field_196555_aI));
+ }
}
@@ -1,10 +0,0 @@
--- a/net/minecraft/block/BlockDirtSnowySpreadable.java
+++ b/net/minecraft/block/BlockDirtSnowySpreadable.java
@@ -25,6 +25,7 @@
public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
if (!p_196267_2_.field_72995_K) {
+ if (!p_196267_2_.func_205050_e(p_196267_3_, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading
if (!func_196383_a(p_196267_2_, p_196267_3_)) {
p_196267_2_.func_175656_a(p_196267_3_, Blocks.field_150346_d.func_176223_P());
} else {
@@ -1,19 +0,0 @@
--- a/net/minecraft/block/BlockDoublePlant.java
+++ b/net/minecraft/block/BlockDoublePlant.java
@@ -43,7 +43,7 @@
@Nullable
public IBlockState func_196258_a(BlockItemUseContext p_196258_1_) {
BlockPos blockpos = p_196258_1_.func_195995_a();
- return blockpos.func_177956_o() < 255 && p_196258_1_.func_195991_k().func_180495_p(blockpos.func_177984_a()).func_196953_a(p_196258_1_) ? super.func_196258_a(p_196258_1_) : null;
+ return blockpos.func_177956_o() < p_196258_1_.func_195991_k().func_72800_K() - 1 && p_196258_1_.func_195991_k().func_180495_p(blockpos.func_177984_a()).func_196953_a(p_196258_1_) ? super.func_196258_a(p_196258_1_) : null;
}
public void func_180633_a(World p_180633_1_, BlockPos p_180633_2_, IBlockState p_180633_3_, EntityLivingBase p_180633_4_, ItemStack p_180633_5_) {
@@ -51,6 +51,7 @@
}
public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) {
+ if (p_196260_1_.func_177230_c() != this) return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_); //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.
if (p_196260_1_.func_177229_b(field_176492_b) != DoubleBlockHalf.UPPER) {
return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_);
} else {
@@ -1,11 +0,0 @@
--- a/net/minecraft/block/BlockDropper.java
+++ b/net/minecraft/block/BlockDropper.java
@@ -37,7 +37,7 @@
p_176439_1_.func_175718_b(1001, p_176439_2_, 0);
} else {
ItemStack itemstack = tileentitydispenser.func_70301_a(i);
- if (!itemstack.func_190926_b()) {
+ if (!itemstack.func_190926_b() && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(p_176439_1_, p_176439_2_, tileentitydispenser, i, itemstack)) {
EnumFacing enumfacing = p_176439_1_.func_180495_p(p_176439_2_).func_177229_b(field_176441_a);
IInventory iinventory = TileEntityHopper.func_195484_a(p_176439_1_, p_176439_2_.func_177972_a(enumfacing));
ItemStack itemstack1;
@@ -1,21 +0,0 @@
--- a/net/minecraft/block/BlockEnderChest.java
+++ b/net/minecraft/block/BlockEnderChest.java
@@ -81,7 +81,7 @@
InventoryEnderChest inventoryenderchest = p_196250_4_.func_71005_bN();
TileEntity tileentity = p_196250_2_.func_175625_s(p_196250_3_);
if (inventoryenderchest != null && tileentity instanceof TileEntityEnderChest) {
- if (p_196250_2_.func_180495_p(p_196250_3_.func_177984_a()).func_185915_l()) {
+ if (p_196250_2_.func_180495_p(p_196250_3_.func_177984_a()).doesSideBlockChestOpening(p_196250_2_, p_196250_3_.func_177984_a(), EnumFacing.DOWN)) {
return true;
} else if (p_196250_2_.field_72995_K) {
return true;
@@ -173,4 +173,9 @@
public boolean func_196266_a(IBlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
return false;
}
+
+ @Override
+ public boolean canSilkHarvest(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, EntityPlayer player) {
+ return true;
+ }
}
@@ -1,21 +0,0 @@
--- a/net/minecraft/block/BlockFalling.java
+++ b/net/minecraft/block/BlockFalling.java
@@ -48,7 +48,9 @@
p_176503_1_.func_72838_d(entityfallingblock);
}
} else {
+ IBlockState state = func_176223_P();
if (p_176503_1_.func_180495_p(p_176503_2_).func_177230_c() == this) {
+ state = p_176503_1_.func_180495_p(p_176503_2_);
p_176503_1_.func_175698_g(p_176503_2_);
}
@@ -58,7 +60,7 @@
}
if (blockpos.func_177956_o() > 0) {
- p_176503_1_.func_175656_a(blockpos.func_177984_a(), this.func_176223_P());
+ p_176503_1_.func_175656_a(blockpos.func_177984_a(), state); //Forge: Fix loss of state information during world gen.
}
}
@@ -1,50 +0,0 @@
--- a/net/minecraft/block/BlockFence.java
+++ b/net/minecraft/block/BlockFence.java
@@ -64,15 +64,12 @@
IBlockReader iblockreader = p_196258_1_.func_195991_k();
BlockPos blockpos = p_196258_1_.func_195995_a();
IFluidState ifluidstate = p_196258_1_.func_195991_k().func_204610_c(p_196258_1_.func_195995_a());
- BlockPos blockpos1 = blockpos.func_177978_c();
- BlockPos blockpos2 = blockpos.func_177974_f();
- BlockPos blockpos3 = blockpos.func_177968_d();
- BlockPos blockpos4 = blockpos.func_177976_e();
- IBlockState iblockstate = iblockreader.func_180495_p(blockpos1);
- IBlockState iblockstate1 = iblockreader.func_180495_p(blockpos2);
- IBlockState iblockstate2 = iblockreader.func_180495_p(blockpos3);
- IBlockState iblockstate3 = iblockreader.func_180495_p(blockpos4);
- return super.func_196258_a(p_196258_1_).func_206870_a(field_196409_a, Boolean.valueOf(this.func_196416_a(iblockstate, iblockstate.func_193401_d(iblockreader, blockpos1, EnumFacing.SOUTH)))).func_206870_a(field_196411_b, Boolean.valueOf(this.func_196416_a(iblockstate1, iblockstate1.func_193401_d(iblockreader, blockpos2, EnumFacing.WEST)))).func_206870_a(field_196413_c, Boolean.valueOf(this.func_196416_a(iblockstate2, iblockstate2.func_193401_d(iblockreader, blockpos3, EnumFacing.NORTH)))).func_206870_a(field_196414_y, Boolean.valueOf(this.func_196416_a(iblockstate3, iblockstate3.func_193401_d(iblockreader, blockpos4, EnumFacing.EAST)))).func_206870_a(field_204514_u, Boolean.valueOf(ifluidstate.func_206886_c() == Fluids.field_204546_a));
+ return super.func_196258_a(p_196258_1_)
+ .func_206870_a(field_196409_a, canFenceConnectTo(iblockreader, blockpos, EnumFacing.NORTH))
+ .func_206870_a(field_196411_b, canFenceConnectTo(iblockreader, blockpos, EnumFacing.EAST))
+ .func_206870_a(field_196413_c, canFenceConnectTo(iblockreader, blockpos, EnumFacing.SOUTH))
+ .func_206870_a(field_196414_y, canFenceConnectTo(iblockreader, blockpos, EnumFacing.WEST))
+ .func_206870_a(field_204514_u, Boolean.valueOf(ifluidstate.func_206886_c() == Fluids.field_204546_a));
}
public IBlockState func_196271_a(IBlockState p_196271_1_, EnumFacing p_196271_2_, IBlockState p_196271_3_, IWorld p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
@@ -80,7 +77,7 @@
p_196271_4_.func_205219_F_().func_205360_a(p_196271_5_, Fluids.field_204546_a, Fluids.field_204546_a.func_205569_a(p_196271_4_));
}
- return p_196271_2_.func_176740_k().func_176716_d() == EnumFacing.Plane.HORIZONTAL ? p_196271_1_.func_206870_a(field_196415_z.get(p_196271_2_), Boolean.valueOf(this.func_196416_a(p_196271_3_, p_196271_3_.func_193401_d(p_196271_4_, p_196271_6_, p_196271_2_.func_176734_d())))) : super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
+ return p_196271_2_.func_176740_k().func_176716_d() == EnumFacing.Plane.HORIZONTAL ? p_196271_1_.func_206870_a(field_196415_z.get(p_196271_2_), Boolean.valueOf(this.canFenceConnectTo(p_196271_4_, p_196271_5_, p_196271_2_))) : super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
protected void func_206840_a(StateContainer.Builder<Block, IBlockState> p_206840_1_) {
@@ -90,4 +87,16 @@
public BlockFaceShape func_193383_a(IBlockReader p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) {
return p_193383_4_ != EnumFacing.UP && p_193383_4_ != EnumFacing.DOWN ? BlockFaceShape.MIDDLE_POLE : BlockFaceShape.CENTER;
}
+
+ @Override
+ public boolean canBeConnectedTo(IBlockState state, IBlockReader world, BlockPos pos, EnumFacing facing) {
+ IBlockState other = world.func_180495_p(pos.func_177972_a(facing));
+ return func_196416_a(other, other.func_193401_d(world, pos.func_177972_a(facing), facing.func_176734_d()));
+ }
+
+ private boolean canFenceConnectTo(IBlockReader world, BlockPos pos, EnumFacing facing) {
+ BlockPos offset = pos.func_177972_a(facing);
+ IBlockState other = world.func_180495_p(offset);
+ return other.canBeConnectedTo(world, offset, facing.func_176734_d()) || func_176223_P().canBeConnectedTo(world, pos, facing);
+ }
}
@@ -1,26 +0,0 @@
--- a/net/minecraft/block/BlockFenceGate.java
+++ b/net/minecraft/block/BlockFenceGate.java
@@ -100,7 +100,7 @@
}
private boolean func_196380_i(IBlockState p_196380_1_) {
- return p_196380_1_.func_177230_c() == Blocks.field_150463_bK || p_196380_1_.func_177230_c() == Blocks.field_196723_eg;
+ return p_196380_1_.func_177230_c() == Blocks.field_150463_bK || p_196380_1_.func_177230_c() == Blocks.field_196723_eg || p_196380_1_.func_177230_c() instanceof BlockWall;
}
public boolean func_196250_a(IBlockState p_196250_1_, World p_196250_2_, BlockPos p_196250_3_, EntityPlayer p_196250_4_, EnumHand p_196250_5_, EnumFacing p_196250_6_, float p_196250_7_, float p_196250_8_, float p_196250_9_) {
@@ -145,4 +145,14 @@
return BlockFaceShape.UNDEFINED;
}
}
+
+ @Override
+ public boolean canBeConnectedTo(IBlockState state, IBlockReader world, BlockPos pos, EnumFacing facing) {
+ if (state.func_193401_d(world, pos, facing) == BlockFaceShape.MIDDLE_POLE) {
+ Block other = world.func_180495_p(pos.func_177972_a(facing)).func_177230_c();
+ return other instanceof BlockFence || other instanceof BlockWall;
+ }
+ return false;
+ }
+
}
@@ -1,25 +0,0 @@
--- a/net/minecraft/block/BlockIce.java
+++ b/net/minecraft/block/BlockIce.java
@@ -34,8 +34,10 @@
public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) {
p_180657_2_.func_71029_a(StatList.field_188065_ae.func_199076_b(this));
p_180657_2_.func_71020_j(0.005F);
- if (this.func_149700_E() && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) {
- func_180635_a(p_180657_1_, p_180657_3_, this.func_180643_i(p_180657_4_));
+ if (this.canSilkHarvest(p_180657_4_, p_180657_1_, p_180657_3_, p_180657_2_) && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) {
+ net.minecraft.util.NonNullList<ItemStack> items = net.minecraft.util.NonNullList.func_193580_a(ItemStack.field_190927_a, func_180643_i(p_180657_4_));
+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_4_, 0, 1.0f, true, p_180657_2_);
+ items.stream().filter(e -> !e.func_190926_b()).forEach(e -> func_180635_a(p_180657_1_, p_180657_3_, e));
} else {
if (p_180657_1_.field_73011_w.func_177500_n()) {
p_180657_1_.func_175698_g(p_180657_3_);
@@ -43,7 +45,9 @@
}
int i = EnchantmentHelper.func_77506_a(Enchantments.field_185308_t, p_180657_6_);
+ harvesters.set(p_180657_2_);
p_180657_4_.func_196949_c(p_180657_1_, p_180657_3_, i);
+ harvesters.set(null);
Material material = p_180657_1_.func_180495_p(p_180657_3_.func_177977_b()).func_185904_a();
if (material.func_76230_c() || material.func_76224_d()) {
p_180657_1_.func_175656_a(p_180657_3_, Blocks.field_150355_j.func_176223_P());
@@ -1,12 +0,0 @@
--- a/net/minecraft/block/BlockLadder.java
+++ b/net/minecraft/block/BlockLadder.java
@@ -151,4 +151,9 @@
return false;
}
}
+
+ @Override
+ public boolean isLadder(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, net.minecraft.entity.EntityLivingBase entity) {
+ return true;
+ }
}
@@ -1,83 +0,0 @@
--- a/net/minecraft/block/BlockLeaves.java
+++ b/net/minecraft/block/BlockLeaves.java
@@ -26,7 +26,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class BlockLeaves extends Block {
+public class BlockLeaves extends Block implements net.minecraftforge.common.IShearable {
public static final IntegerProperty field_208494_a = BlockStateProperties.field_208514_aa;
public static final BooleanProperty field_208495_b = BlockStateProperties.field_208515_s;
protected static boolean field_196478_c;
@@ -122,28 +122,37 @@
}
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
- if (!p_196255_2_.field_72995_K) {
- int i = this.func_196472_i(p_196255_1_);
- if (p_196255_5_ > 0) {
- i -= 2 << p_196255_5_;
+ super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_);
+ }
+
+ @Override
+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList<ItemStack> drops, World worldIn, BlockPos pos, int fortune) {
+ {
+ int i = this.func_196472_i(state);
+ if (fortune > 0) {
+ i -= 2 << fortune;
if (i < 10) {
i = 10;
}
}
- if (p_196255_2_.field_73012_v.nextInt(i) == 0) {
- func_180635_a(p_196255_2_, p_196255_3_, new ItemStack(this.func_199769_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_5_)));
+ if (worldIn.field_73012_v.nextInt(i) == 0) {
+ ItemStack drop = new ItemStack(this.func_199769_a(state, worldIn, pos, fortune));
+ if (!drop.func_190926_b())
+ drops.add(drop);
}
i = 200;
- if (p_196255_5_ > 0) {
- i -= 10 << p_196255_5_;
+ if (fortune > 0) {
+ i -= 10 << fortune;
if (i < 40) {
i = 40;
}
}
- this.func_196474_a(p_196255_2_, p_196255_3_, p_196255_1_, i);
+ captureDrops(true);
+ this.func_196474_a(worldIn, pos, state, i);
+ drops.addAll(captureDrops(false));
}
}
@@ -173,13 +182,7 @@
}
public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) {
- if (!p_180657_1_.field_72995_K && p_180657_6_.func_77973_b() == Items.field_151097_aZ) {
- p_180657_2_.func_71029_a(StatList.field_188065_ae.func_199076_b(this));
- p_180657_2_.func_71020_j(0.005F);
- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(this));
- } else {
super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_);
- }
}
protected void func_206840_a(StateContainer.Builder<Block, IBlockState> p_206840_1_) {
@@ -189,4 +192,10 @@
public IBlockState func_196258_a(BlockItemUseContext p_196258_1_) {
return func_208493_b(this.func_176223_P().func_206870_a(field_208495_b, Boolean.valueOf(true)), p_196258_1_.func_195991_k(), p_196258_1_.func_195995_a());
}
+
+ @Override
+ public java.util.List<ItemStack> onSheared(@javax.annotation.Nonnull ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) {
+ world.func_180501_a(pos, Blocks.field_150350_a.func_176223_P(), 11);
+ return java.util.Arrays.asList(new ItemStack(this));
+ }
}
@@ -1,27 +0,0 @@
--- a/net/minecraft/block/BlockMobSpawner.java
+++ b/net/minecraft/block/BlockMobSpawner.java
@@ -13,6 +13,8 @@
import net.minecraft.world.World;
public class BlockMobSpawner extends BlockContainer {
+ private static final java.util.Random RAND = new java.util.Random();
+
protected BlockMobSpawner(Block.Properties p_i48364_1_) {
super(p_i48364_1_);
}
@@ -27,10 +29,13 @@
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_);
- int i = 15 + p_196255_2_.field_73012_v.nextInt(15) + p_196255_2_.field_73012_v.nextInt(15);
- this.func_180637_b(p_196255_2_, p_196255_3_, i);
}
+ @Override
+ public int getExpDrop(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, int fortune) {
+ return 15 + RAND.nextInt(15) + RAND.nextInt(15);
+ }
+
public EnumBlockRenderType func_149645_b(IBlockState p_149645_1_) {
return EnumBlockRenderType.MODEL;
}
@@ -1,11 +0,0 @@
--- a/net/minecraft/block/BlockMushroom.java
+++ b/net/minecraft/block/BlockMushroom.java
@@ -64,7 +64,7 @@
IBlockState iblockstate = p_196260_2_.func_180495_p(blockpos);
Block block = iblockstate.func_177230_c();
if (block != Blocks.field_150391_bh && block != Blocks.field_196661_l) {
- return p_196260_2_.func_201669_a(p_196260_3_, 0) < 13 && this.func_200014_a_(iblockstate, p_196260_2_, blockpos);
+ return p_196260_2_.func_201669_a(p_196260_3_, 0) < 13 && iblockstate.canSustainPlant(p_196260_2_, blockpos, net.minecraft.util.EnumFacing.UP, this);
} else {
return true;
}
@@ -1,36 +0,0 @@
--- a/net/minecraft/block/BlockNetherWart.java
+++ b/net/minecraft/block/BlockNetherWart.java
@@ -33,16 +33,22 @@
public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
int i = p_196267_1_.func_177229_b(field_176486_a);
- if (i < 3 && p_196267_4_.nextInt(10) == 0) {
+ if (i < 3 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_.nextInt(10) == 0)) {
p_196267_1_ = p_196267_1_.func_206870_a(field_176486_a, Integer.valueOf(i + 1));
p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_, 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_);
}
super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_);
}
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
- if (!p_196255_2_.field_72995_K) {
+ super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_);
+ }
+
+ @Override
+ public void getDrops(IBlockState p_196255_1_, net.minecraft.util.NonNullList<ItemStack> drops, World p_196255_2_, BlockPos p_196255_3_, int p_196255_5_) {
+ {
int i = 1;
if (p_196255_1_.func_177229_b(field_176486_a) >= 3) {
i = 2 + p_196255_2_.field_73012_v.nextInt(3);
@@ -52,7 +58,7 @@
}
for(int j = 0; j < i; ++j) {
- func_180635_a(p_196255_2_, p_196255_3_, new ItemStack(Items.field_151075_bm));
+ drops.add(new ItemStack(Items.field_151075_bm));
}
}
@@ -1,39 +0,0 @@
--- a/net/minecraft/block/BlockOre.java
+++ b/net/minecraft/block/BlockOre.java
@@ -49,23 +49,27 @@
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_);
- if (this.func_199769_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_5_) != this) {
+ }
+
+ @Override
+ public int getExpDrop(IBlockState state, net.minecraft.world.IWorldReader reader, BlockPos pos, int fortune) {
+ World world = reader instanceof World ? (World)reader : null;
+ if (world == null || this.func_199769_a(state, world, pos, fortune) != this) {
int i = 0;
if (this == Blocks.field_150365_q) {
- i = MathHelper.func_76136_a(p_196255_2_.field_73012_v, 0, 2);
+ i = MathHelper.func_76136_a(RANDOM, 0, 2);
} else if (this == Blocks.field_150482_ag) {
- i = MathHelper.func_76136_a(p_196255_2_.field_73012_v, 3, 7);
+ i = MathHelper.func_76136_a(RANDOM, 3, 7);
} else if (this == Blocks.field_150412_bA) {
- i = MathHelper.func_76136_a(p_196255_2_.field_73012_v, 3, 7);
+ i = MathHelper.func_76136_a(RANDOM, 3, 7);
} else if (this == Blocks.field_150369_x) {
- i = MathHelper.func_76136_a(p_196255_2_.field_73012_v, 2, 5);
+ i = MathHelper.func_76136_a(RANDOM, 2, 5);
} else if (this == Blocks.field_196766_fg) {
- i = MathHelper.func_76136_a(p_196255_2_.field_73012_v, 2, 5);
+ i = MathHelper.func_76136_a(RANDOM, 2, 5);
}
-
- this.func_180637_b(p_196255_2_, p_196255_3_, i);
+ return i;
}
-
+ return 0;
}
public ItemStack func_185473_a(IBlockReader p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) {
@@ -1,50 +0,0 @@
--- a/net/minecraft/block/BlockPane.java
+++ b/net/minecraft/block/BlockPane.java
@@ -25,15 +25,12 @@
IBlockReader iblockreader = p_196258_1_.func_195991_k();
BlockPos blockpos = p_196258_1_.func_195995_a();
IFluidState ifluidstate = p_196258_1_.func_195991_k().func_204610_c(p_196258_1_.func_195995_a());
- BlockPos blockpos1 = blockpos.func_177978_c();
- BlockPos blockpos2 = blockpos.func_177968_d();
- BlockPos blockpos3 = blockpos.func_177976_e();
- BlockPos blockpos4 = blockpos.func_177974_f();
- IBlockState iblockstate = iblockreader.func_180495_p(blockpos1);
- IBlockState iblockstate1 = iblockreader.func_180495_p(blockpos2);
- IBlockState iblockstate2 = iblockreader.func_180495_p(blockpos3);
- IBlockState iblockstate3 = iblockreader.func_180495_p(blockpos4);
- return this.func_176223_P().func_206870_a(field_196409_a, Boolean.valueOf(this.func_196417_a(iblockstate, iblockstate.func_193401_d(iblockreader, blockpos1, EnumFacing.SOUTH)))).func_206870_a(field_196413_c, Boolean.valueOf(this.func_196417_a(iblockstate1, iblockstate1.func_193401_d(iblockreader, blockpos2, EnumFacing.NORTH)))).func_206870_a(field_196414_y, Boolean.valueOf(this.func_196417_a(iblockstate2, iblockstate2.func_193401_d(iblockreader, blockpos3, EnumFacing.EAST)))).func_206870_a(field_196411_b, Boolean.valueOf(this.func_196417_a(iblockstate3, iblockstate3.func_193401_d(iblockreader, blockpos4, EnumFacing.WEST)))).func_206870_a(field_204514_u, Boolean.valueOf(ifluidstate.func_206886_c() == Fluids.field_204546_a));
+ return this.func_176223_P()
+ .func_206870_a(field_196409_a, canPaneConnectTo(iblockreader, blockpos, EnumFacing.NORTH))
+ .func_206870_a(field_196413_c, canPaneConnectTo(iblockreader, blockpos, EnumFacing.SOUTH))
+ .func_206870_a(field_196414_y, canPaneConnectTo(iblockreader, blockpos, EnumFacing.WEST))
+ .func_206870_a(field_196411_b, canPaneConnectTo(iblockreader, blockpos, EnumFacing.EAST))
+ .func_206870_a(field_204514_u, Boolean.valueOf(ifluidstate.func_206886_c() == Fluids.field_204546_a));
}
public IBlockState func_196271_a(IBlockState p_196271_1_, EnumFacing p_196271_2_, IBlockState p_196271_3_, IWorld p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
@@ -41,7 +38,7 @@
p_196271_4_.func_205219_F_().func_205360_a(p_196271_5_, Fluids.field_204546_a, Fluids.field_204546_a.func_205569_a(p_196271_4_));
}
- return p_196271_2_.func_176740_k().func_176722_c() ? p_196271_1_.func_206870_a(field_196415_z.get(p_196271_2_), Boolean.valueOf(this.func_196417_a(p_196271_3_, p_196271_3_.func_193401_d(p_196271_4_, p_196271_6_, p_196271_2_.func_176734_d())))) : super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
+ return p_196271_2_.func_176740_k().func_176722_c() ? p_196271_1_.func_206870_a(field_196415_z.get(p_196271_2_), Boolean.valueOf(this.canPaneConnectTo(p_196271_4_, p_196271_5_, p_196271_2_))) : super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
public boolean func_149686_d(IBlockState p_149686_1_) {
@@ -87,4 +84,16 @@
public BlockFaceShape func_193383_a(IBlockReader p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) {
return p_193383_4_ != EnumFacing.UP && p_193383_4_ != EnumFacing.DOWN ? BlockFaceShape.MIDDLE_POLE_THIN : BlockFaceShape.CENTER_SMALL;
}
+
+ @Override
+ public boolean canBeConnectedTo(IBlockState state, IBlockReader world, BlockPos pos, EnumFacing facing) {
+ IBlockState other = world.func_180495_p(pos.func_177972_a(facing));
+ return func_196417_a(other, other.func_193401_d(world, pos.func_177972_a(facing), facing.func_176734_d()));
+ }
+
+ private boolean canPaneConnectTo(IBlockReader world, BlockPos pos, EnumFacing facing) {
+ BlockPos offset = pos.func_177972_a(facing);
+ IBlockState other = world.func_180495_p(offset);
+ return other.canBeConnectedTo(world, offset, facing.func_176734_d()) || func_176223_P().canBeConnectedTo(world, pos, facing);
+ }
}
@@ -1,33 +0,0 @@
--- a/net/minecraft/block/BlockPistonBase.java
+++ b/net/minecraft/block/BlockPistonBase.java
@@ -244,7 +244,7 @@
return false;
}
- return !block.func_149716_u();
+ return !p_185646_0_.hasTileEntity();
} else {
return false;
}
@@ -280,7 +280,9 @@
for(int j = list2.size() - 1; j >= 0; --j) {
BlockPos blockpos2 = list2.get(j);
IBlockState iblockstate = p_176319_1_.func_180495_p(blockpos2);
- iblockstate.func_196949_c(p_176319_1_, blockpos2, 0);
+ // Forge: With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior.
+ float chance = iblockstate.func_177230_c() instanceof BlockSnow ? -1.0f : 1.0f;
+ iblockstate.func_196941_a(p_176319_1_, blockpos2, chance, 0);
p_176319_1_.func_180501_a(blockpos2, Blocks.field_150350_a.func_176223_P(), 18);
--k;
aiblockstate[k] = iblockstate;
@@ -333,6 +335,10 @@
return p_185499_1_.func_206870_a(field_176387_N, p_185499_2_.func_185831_a(p_185499_1_.func_177229_b(field_176387_N)));
}
+ public IBlockState rotate(IBlockState state, net.minecraft.world.IWorld world, BlockPos pos, Rotation direction) {
+ return state.func_177229_b(field_176320_b) ? state : super.rotate(state, world, pos, direction);
+ }
+
public IBlockState func_185471_a(IBlockState p_185471_1_, Mirror p_185471_2_) {
return p_185471_1_.func_185907_a(p_185471_2_.func_185800_a(p_185471_1_.func_177229_b(field_176387_N)));
}
@@ -1,26 +0,0 @@
--- a/net/minecraft/block/BlockPistonMoving.java
+++ b/net/minecraft/block/BlockPistonMoving.java
@@ -86,14 +86,22 @@
}
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
- if (!p_196255_2_.field_72995_K) {
+ if (false && !p_196255_2_.field_72995_K) { //Forge: Noop this out
TileEntityPiston tileentitypiston = this.func_196342_a(p_196255_2_, p_196255_3_);
if (tileentitypiston != null) {
tileentitypiston.func_200230_i().func_196949_c(p_196255_2_, p_196255_3_, 0);
}
}
+ super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, 1, p_196255_5_); // mimic vanilla behavior from above and ignore chance
}
+ @Override
+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
+ TileEntityPiston te = this.func_196342_a(world, pos);
+ if (te != null)
+ te.func_200230_i().getDrops(drops, world, pos, fortune);
+ }
+
public VoxelShape func_196244_b(IBlockState p_196244_1_, IBlockReader p_196244_2_, BlockPos p_196244_3_) {
return VoxelShapes.func_197880_a();
}
@@ -1,11 +0,0 @@
--- a/net/minecraft/block/BlockPortal.java
+++ b/net/minecraft/block/BlockPortal.java
@@ -76,7 +76,7 @@
public boolean func_176548_d(IWorld p_176548_1_, BlockPos p_176548_2_) {
BlockPortal.Size blockportal$size = this.func_201816_b(p_176548_1_, p_176548_2_);
- if (blockportal$size != null) {
+ if (blockportal$size != null && !net.minecraftforge.event.ForgeEventFactory.onTrySpawnPortal(p_176548_1_, p_176548_2_, blockportal$size)) {
blockportal$size.func_150859_c();
return true;
} else {
@@ -1,25 +0,0 @@
--- a/net/minecraft/block/BlockPotato.java
+++ b/net/minecraft/block/BlockPotato.java
@@ -26,7 +26,7 @@
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_);
- if (!p_196255_2_.field_72995_K) {
+ if (false && !p_196255_2_.field_72995_K) { //Forge: Moved to getDrops
if (this.func_185525_y(p_196255_1_) && p_196255_2_.field_73012_v.nextInt(50) == 0) {
func_180635_a(p_196255_2_, p_196255_3_, new ItemStack(Items.field_151170_bI));
}
@@ -34,6 +34,13 @@
}
}
+ @Override
+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
+ super.getDrops(state, drops, world, pos, fortune);
+ if (this.func_185525_y(state) && world.field_73012_v.nextInt(50) == 0)
+ drops.add(new ItemStack(Items.field_151170_bI));
+ }
+
public VoxelShape func_196244_b(IBlockState p_196244_1_, IBlockReader p_196244_2_, BlockPos p_196244_3_) {
return field_196396_a[p_196244_1_.func_177229_b(this.func_185524_e())];
}
@@ -1,123 +0,0 @@
--- a/net/minecraft/block/BlockRailBase.java
+++ b/net/minecraft/block/BlockRailBase.java
@@ -37,7 +37,7 @@
}
public VoxelShape func_196244_b(IBlockState p_196244_1_, IBlockReader p_196244_2_, BlockPos p_196244_3_) {
- RailShape railshape = p_196244_1_.func_177230_c() == this ? p_196244_1_.func_177229_b(this.func_176560_l()) : null;
+ RailShape railshape = p_196244_1_.func_177230_c() == this ? getRailDirection(p_196244_1_, p_196244_2_, p_196244_3_, null) : null;
return railshape != null && railshape.func_208092_c() ? field_190959_b : field_185590_a;
}
@@ -50,7 +50,8 @@
}
public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) {
- return p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_185896_q();
+ IBlockState down = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
+ return down.func_185896_q() || down.func_193401_d(p_196260_2_, p_196260_3_.func_177977_b(), EnumFacing.UP) == BlockFaceShape.SOLID;
}
public void func_196259_b(IBlockState p_196259_1_, World p_196259_2_, BlockPos p_196259_3_, IBlockState p_196259_4_) {
@@ -67,19 +68,19 @@
public void func_189540_a(IBlockState p_189540_1_, World p_189540_2_, BlockPos p_189540_3_, Block p_189540_4_, BlockPos p_189540_5_) {
if (!p_189540_2_.field_72995_K) {
- RailShape railshape = p_189540_1_.func_177229_b(this.func_176560_l());
+ RailShape railshape = getRailDirection(p_189540_1_, p_189540_2_, p_189540_3_, null);
boolean flag = false;
- if (!p_189540_2_.func_180495_p(p_189540_3_.func_177977_b()).func_185896_q()) {
+ if (!p_189540_1_.func_196955_c(p_189540_2_, p_189540_3_)) {
flag = true;
}
- if (railshape == RailShape.ASCENDING_EAST && !p_189540_2_.func_180495_p(p_189540_3_.func_177974_f()).func_185896_q()) {
+ if (railshape == RailShape.ASCENDING_EAST && !p_189540_1_.func_196955_c(p_189540_2_, p_189540_3_.func_177974_f().func_177984_a())) {
flag = true;
- } else if (railshape == RailShape.ASCENDING_WEST && !p_189540_2_.func_180495_p(p_189540_3_.func_177976_e()).func_185896_q()) {
+ } else if (railshape == RailShape.ASCENDING_WEST && !p_189540_1_.func_196955_c(p_189540_2_, p_189540_3_.func_177976_e().func_177984_a())) {
flag = true;
- } else if (railshape == RailShape.ASCENDING_NORTH && !p_189540_2_.func_180495_p(p_189540_3_.func_177978_c()).func_185896_q()) {
+ } else if (railshape == RailShape.ASCENDING_NORTH && !p_189540_1_.func_196955_c(p_189540_2_, p_189540_3_.func_177978_c().func_177984_a())) {
flag = true;
- } else if (railshape == RailShape.ASCENDING_SOUTH && !p_189540_2_.func_180495_p(p_189540_3_.func_177968_d()).func_185896_q()) {
+ } else if (railshape == RailShape.ASCENDING_SOUTH && !p_189540_1_.func_196955_c(p_189540_2_, p_189540_3_.func_177968_d().func_177984_a())) {
flag = true;
}
@@ -111,7 +112,7 @@
public void func_196243_a(IBlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, IBlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_5_) {
super.func_196243_a(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
- if (p_196243_1_.func_177229_b(this.func_176560_l()).func_208092_c()) {
+ if (getRailDirection(p_196243_1_, p_196243_2_, p_196243_3_, null).func_208092_c()) {
p_196243_2_.func_195593_d(p_196243_3_.func_177984_a(), this);
}
@@ -123,5 +124,66 @@
}
}
+ //Forge: Use getRailDirection(IBlockAccess, BlockPos, IBlockState, EntityMinecart) for enhanced ability
public abstract IProperty<RailShape> func_176560_l();
+
+ /* ======================================== FORGE START =====================================*/
+ /**
+ * Return true if the rail can make corners.
+ * Used by placement logic.
+ * @param world The world.
+ * @param pos Block's position in world
+ * @return True if the rail can make corners.
+ */
+ public boolean isFlexibleRail(IBlockState state, IBlockReader world, BlockPos pos)
+ {
+ return !this.field_196277_c;
+ }
+
+ /**
+ * Returns true if the rail can make up and down slopes.
+ * Used by placement logic.
+ * @param world The world.
+ * @param pos Block's position in world
+ * @return True if the rail can make slopes.
+ */
+ public boolean canMakeSlopes(IBlockState state, IBlockReader world, BlockPos pos) {
+ return true;
+ }
+
+ /**
+ * Return the rail's direction.
+ * Can be used to make the cart think the rail is a different shape,
+ * for example when making diamond junctions or switches.
+ * The cart parameter will often be null unless it it called from EntityMinecart.
+ *
+ * @param world The world.
+ * @param pos Block's position in world
+ * @param state The BlockState
+ * @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
+ * @return The direction.
+ */
+ public RailShape getRailDirection(IBlockState state, IBlockReader world, BlockPos pos, @javax.annotation.Nullable net.minecraft.entity.item.EntityMinecart cart) {
+ return state.func_177229_b(func_176560_l());
+ }
+
+ /**
+ * Returns the max speed of the rail at the specified position.
+ * @param world The world.
+ * @param cart The cart on the rail, may be null.
+ * @param pos Block's position in world
+ * @return The max speed of the current rail.
+ */
+ public float getRailMaxSpeed(IBlockState state, World world, BlockPos pos, net.minecraft.entity.item.EntityMinecart cart) {
+ return 0.4f;
+ }
+
+ /**
+ * This function is called by any minecart that passes over this rail.
+ * It is called once per update tick that the minecart is on the rail.
+ * @param world The world.
+ * @param cart The cart on the rail.
+ * @param pos Block's position in world
+ */
+ public void onMinecartPass(IBlockState state, World world, BlockPos pos, net.minecraft.entity.item.EntityMinecart cart) { }
}
@@ -1,11 +0,0 @@
--- a/net/minecraft/block/BlockRailDetector.java
+++ b/net/minecraft/block/BlockRailDetector.java
@@ -127,6 +127,8 @@
public int func_180641_l(IBlockState p_180641_1_, World p_180641_2_, BlockPos p_180641_3_) {
if (p_180641_1_.func_177229_b(field_176574_M)) {
+ List<EntityMinecart> carts = this.func_200878_a(p_180641_2_, p_180641_3_, EntityMinecart.class, null);
+ if (!carts.isEmpty() && carts.get(0).getComparatorLevel() > -1) return carts.get(0).getComparatorLevel();
List<EntityMinecartCommandBlock> list = this.func_200878_a(p_180641_2_, p_180641_3_, EntityMinecartCommandBlock.class, (Predicate<Entity>)null);
if (!list.isEmpty()) {
return list.get(0).func_145822_e().func_145760_g();
@@ -1,29 +0,0 @@
--- a/net/minecraft/block/BlockRailPowered.java
+++ b/net/minecraft/block/BlockRailPowered.java
@@ -15,10 +15,16 @@
public class BlockRailPowered extends BlockRailBase {
public static final EnumProperty<RailShape> field_176568_b = BlockStateProperties.field_208166_S;
public static final BooleanProperty field_176569_M = BlockStateProperties.field_208194_u;
+ private final boolean isActivator;
protected BlockRailPowered(Block.Properties p_i48349_1_) {
- super(true, p_i48349_1_);
+ this(p_i48349_1_, false);
+ }
+
+ protected BlockRailPowered(Block.Properties builder, boolean isActivator) {
+ super(true, builder);
this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176568_b, RailShape.NORTH_SOUTH).func_206870_a(field_176569_M, Boolean.valueOf(false)));
+ this.isActivator = isActivator;
}
protected boolean func_176566_a(World p_176566_1_, BlockPos p_176566_2_, IBlockState p_176566_3_, boolean p_176566_4_, int p_176566_5_) {
@@ -100,7 +106,7 @@
protected boolean func_208071_a(World p_208071_1_, BlockPos p_208071_2_, boolean p_208071_3_, int p_208071_4_, RailShape p_208071_5_) {
IBlockState iblockstate = p_208071_1_.func_180495_p(p_208071_2_);
- if (iblockstate.func_177230_c() != this) {
+ if (!(iblockstate.func_177230_c() instanceof BlockRailPowered) || isActivator != ((BlockRailPowered)iblockstate.func_177230_c()).isActivator) {
return false;
} else {
RailShape railshape = iblockstate.func_177229_b(field_176568_b);
@@ -1,19 +0,0 @@
--- a/net/minecraft/block/BlockRedstoneComparator.java
+++ b/net/minecraft/block/BlockRedstoneComparator.java
@@ -156,4 +156,16 @@
protected void func_206840_a(StateContainer.Builder<Block, IBlockState> p_206840_1_) {
p_206840_1_.func_206894_a(field_185512_D, field_176463_b, field_196348_c);
}
+
+ @Override
+ public boolean getWeakChanges(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos) {
+ return true;
+ }
+
+ @Override
+ public void onNeighborChange(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, BlockPos neighbor) {
+ if (pos.func_177956_o() == neighbor.func_177956_o() && world instanceof World && !((World)world).func_201670_d()) {
+ func_189540_a(state, (World)world, pos, world.func_180495_p(neighbor).func_177230_c(), neighbor);
+ }
+ }
}
@@ -1,20 +0,0 @@
--- a/net/minecraft/block/BlockRedstoneDiode.java
+++ b/net/minecraft/block/BlockRedstoneDiode.java
@@ -35,7 +35,7 @@
}
public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) {
- return p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_185896_q();
+ return p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_185896_q() || p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_193401_d(p_196260_2_, p_196260_3_.func_177977_b(), EnumFacing.UP) == BlockFaceShape.SOLID;
}
public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
@@ -172,6 +172,8 @@
protected void func_176400_h(World p_176400_1_, BlockPos p_176400_2_, IBlockState p_176400_3_) {
EnumFacing enumfacing = p_176400_3_.func_177229_b(field_185512_D);
BlockPos blockpos = p_176400_2_.func_177972_a(enumfacing.func_176734_d());
+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(p_176400_1_, p_176400_2_, p_176400_1_.func_180495_p(p_176400_2_), java.util.EnumSet.of(enumfacing.func_176734_d()), false).isCanceled())
+ return;
p_176400_1_.func_190524_a(blockpos, this, p_176400_2_);
p_176400_1_.func_175695_a(blockpos, this, enumfacing);
}
@@ -1,21 +0,0 @@
--- a/net/minecraft/block/BlockRedstoneOre.java
+++ b/net/minecraft/block/BlockRedstoneOre.java
@@ -72,11 +72,17 @@
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_);
- if (this.func_199769_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_5_) != this) {
+ if (false && this.func_199769_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_5_) != this) {
int i = 1 + p_196255_2_.field_73012_v.nextInt(5);
this.func_180637_b(p_196255_2_, p_196255_3_, i);
}
+ }
+ @Override
+ public int getExpDrop(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, int fortune) {
+ if (!(world instanceof World) || func_199769_a(state, (World)world, pos, fortune) != this)
+ return 1 + RANDOM.nextInt(5);
+ return 0;
}
@OnlyIn(Dist.CLIENT)
@@ -1,11 +0,0 @@
--- a/net/minecraft/block/BlockRedstoneTorch.java
+++ b/net/minecraft/block/BlockRedstoneTorch.java
@@ -24,7 +24,7 @@
public class BlockRedstoneTorch extends BlockTorch {
public static final BooleanProperty field_196528_a = BlockStateProperties.field_208190_q;
- private static final Map<IBlockReader, List<BlockRedstoneTorch.Toggle>> field_196529_b = Maps.newHashMap();
+ private static final Map<IBlockReader, List<BlockRedstoneTorch.Toggle>> field_196529_b = new java.util.WeakHashMap<IBlockReader, List<BlockRedstoneTorch.Toggle>>(); // FORGE - fix vanilla MC-101233
protected BlockRedstoneTorch(Block.Properties p_i48342_1_) {
super(p_i48342_1_);
@@ -1,71 +0,0 @@
--- a/net/minecraft/block/BlockRedstoneWire.java
+++ b/net/minecraft/block/BlockRedstoneWire.java
@@ -124,8 +124,8 @@
IBlockState iblockstate = p_208074_1_.func_180495_p(p_208074_2_.func_177972_a(p_208074_3_));
IBlockState iblockstate1 = p_208074_1_.func_180495_p(p_208074_2_.func_177984_a());
if (!iblockstate1.func_185915_l()) {
- boolean flag = p_208074_1_.func_180495_p(blockpos).func_185896_q() || p_208074_1_.func_180495_p(blockpos).func_177230_c() == Blocks.field_150426_aN;
- if (flag && func_176346_d(p_208074_1_.func_180495_p(blockpos.func_177984_a()))) {
+ boolean flag = iblockstate.func_193401_d(p_208074_1_, blockpos, EnumFacing.UP) == BlockFaceShape.SOLID || iblockstate.func_177230_c() == Blocks.field_150426_aN;
+ if (flag && canConnectTo(p_208074_1_.func_180495_p(blockpos.func_177984_a()), p_208074_1_, blockpos.func_177984_a(), null)) {
if (iblockstate.func_185898_k()) {
return RedstoneSide.UP;
}
@@ -134,7 +134,7 @@
}
}
- return !func_176343_a(p_208074_1_.func_180495_p(blockpos), p_208074_3_) && (iblockstate.func_185915_l() || !func_176346_d(p_208074_1_.func_180495_p(blockpos.func_177977_b()))) ? RedstoneSide.NONE : RedstoneSide.SIDE;
+ return !canConnectTo(p_208074_1_.func_180495_p(blockpos), p_208074_1_, blockpos, p_208074_3_) && (iblockstate.func_185915_l() || !canConnectTo(p_208074_1_.func_180495_p(blockpos.func_177977_b()), p_208074_1_, blockpos.func_177977_b(), null)) ? RedstoneSide.NONE : RedstoneSide.SIDE;
}
public boolean func_149686_d(IBlockState p_149686_1_) {
@@ -143,7 +143,7 @@
public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) {
IBlockState iblockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
- return iblockstate.func_185896_q() || iblockstate.func_177230_c() == Blocks.field_150426_aN;
+ return iblockstate.func_185896_q() || iblockstate.func_177230_c() == Blocks.field_150426_aN || iblockstate.func_193401_d(p_196260_2_, p_196260_3_.func_177977_b(), EnumFacing.UP) == BlockFaceShape.SOLID;
}
private IBlockState func_176338_e(World p_176338_1_, BlockPos p_176338_2_, IBlockState p_176338_3_) {
@@ -338,26 +338,18 @@
IBlockState iblockstate = p_176339_1_.func_180495_p(blockpos);
boolean flag = iblockstate.func_185915_l();
boolean flag1 = p_176339_1_.func_180495_p(p_176339_2_.func_177984_a()).func_185915_l();
- if (!flag1 && flag && func_176340_e(p_176339_1_, blockpos.func_177984_a())) {
+ if (!flag1 && flag && canConnectTo(p_176339_1_.func_180495_p(blockpos.func_177984_a()), p_176339_1_, blockpos.func_177984_a(), null)) {
return true;
- } else if (func_176343_a(iblockstate, p_176339_3_)) {
+ } else if (canConnectTo(iblockstate, p_176339_1_, blockpos, p_176339_3_)) {
return true;
} else if (iblockstate.func_177230_c() == Blocks.field_196633_cV && iblockstate.func_177229_b(BlockRedstoneDiode.field_196348_c) && iblockstate.func_177229_b(BlockRedstoneDiode.field_185512_D) == p_176339_3_) {
return true;
} else {
- return !flag && func_176340_e(p_176339_1_, blockpos.func_177977_b());
+ return !flag && canConnectTo(p_176339_1_.func_180495_p(blockpos.func_177977_b()), p_176339_1_, blockpos.func_177977_b(), null);
}
}
- protected static boolean func_176340_e(IBlockReader p_176340_0_, BlockPos p_176340_1_) {
- return func_176346_d(p_176340_0_.func_180495_p(p_176340_1_));
- }
-
- protected static boolean func_176346_d(IBlockState p_176346_0_) {
- return func_176343_a(p_176346_0_, (EnumFacing)null);
- }
-
- protected static boolean func_176343_a(IBlockState p_176343_0_, @Nullable EnumFacing p_176343_1_) {
+ protected boolean canConnectTo(IBlockState p_176343_0_, IBlockReader world, BlockPos pos, @Nullable EnumFacing p_176343_1_) {
Block block = p_176343_0_.func_177230_c();
if (block == Blocks.field_150488_af) {
return true;
@@ -367,7 +359,7 @@
} else if (Blocks.field_190976_dk == p_176343_0_.func_177230_c()) {
return p_176343_1_ == p_176343_0_.func_177229_b(BlockObserver.field_176387_N);
} else {
- return p_176343_0_.func_185897_m() && p_176343_1_ != null;
+ return p_176343_0_.canConnectRedstone(world, pos, p_176343_1_) && p_176343_1_ != null;
}
}
@@ -1,40 +0,0 @@
--- a/net/minecraft/block/BlockSeaGrass.java
+++ b/net/minecraft/block/BlockSeaGrass.java
@@ -23,7 +23,7 @@
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
-public class BlockSeaGrass extends BlockBush implements IGrowable, ILiquidContainer {
+public class BlockSeaGrass extends BlockBush implements IGrowable, ILiquidContainer, net.minecraftforge.common.IShearable {
protected static final VoxelShape field_207798_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D);
protected BlockSeaGrass(Block.Properties p_i48780_1_) {
@@ -54,11 +54,7 @@
}
public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) {
- if (!p_180657_1_.field_72995_K && p_180657_6_.func_77973_b() == Items.field_151097_aZ) {
- p_180657_2_.func_71029_a(StatList.field_188065_ae.func_199076_b(this));
- p_180657_2_.func_71020_j(0.005F);
- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(this));
- } else {
+ {
super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_);
}
@@ -102,4 +98,15 @@
public int func_200011_d(IBlockState p_200011_1_, IBlockReader p_200011_2_, BlockPos p_200011_3_) {
return Blocks.field_150355_j.func_176223_P().func_200016_a(p_200011_2_, p_200011_3_);
}
+
+ @Override
+ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) {
+ return true;
+ }
+
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) {
+ world.func_180501_a(pos, Blocks.field_150350_a.func_176223_P(), 11);
+ return java.util.Arrays.asList(new ItemStack(this));
+ }
}
@@ -1,38 +0,0 @@
--- a/net/minecraft/block/BlockShearableDoublePlant.java
+++ b/net/minecraft/block/BlockShearableDoublePlant.java
@@ -11,7 +11,7 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
-public class BlockShearableDoublePlant extends BlockDoublePlant {
+public class BlockShearableDoublePlant extends BlockDoublePlant implements net.minecraftforge.common.IShearable {
public static final EnumProperty<DoubleBlockHalf> field_208063_b = BlockDoublePlant.field_176492_b;
private final Block field_196392_b;
@@ -26,9 +26,7 @@
}
protected void func_196391_a(IBlockState p_196391_1_, World p_196391_2_, BlockPos p_196391_3_, ItemStack p_196391_4_) {
- if (p_196391_4_.func_77973_b() == Items.field_151097_aZ) {
- func_180635_a(p_196391_2_, p_196391_3_, new ItemStack(this.field_196392_b, 2));
- } else {
+ {
super.func_196391_a(p_196391_1_, p_196391_2_, p_196391_3_, p_196391_4_);
}
@@ -37,4 +35,15 @@
public IItemProvider func_199769_a(IBlockState p_199769_1_, World p_199769_2_, BlockPos p_199769_3_, int p_199769_4_) {
return p_199769_1_.func_177229_b(field_208063_b) == DoubleBlockHalf.LOWER && this == Blocks.field_196804_gh && p_199769_2_.field_73012_v.nextInt(8) == 0 ? Items.field_151014_N : Items.field_190931_a;
}
+
+ @Override
+ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) {
+ return true;
+ }
+
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) {
+ world.func_180501_a(pos, Blocks.field_150350_a.func_176223_P(), 11);
+ return java.util.Arrays.asList(new ItemStack(this.field_196392_b, 2));
+ }
}
@@ -1,54 +0,0 @@
--- a/net/minecraft/block/BlockSnowLayer.java
+++ b/net/minecraft/block/BlockSnowLayer.java
@@ -84,30 +84,45 @@
public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) {
Integer integer = p_180657_4_.func_177229_b(field_176315_a);
- if (this.func_149700_E() && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) {
+ net.minecraft.util.NonNullList<ItemStack> items = net.minecraft.util.NonNullList.func_191196_a();
+ int fortune = EnchantmentHelper.func_77506_a(Enchantments.field_185308_t, p_180657_6_);
+ float chance = 1.0f;
+
+ if (this.canSilkHarvest(p_180657_4_, p_180657_1_, p_180657_3_, p_180657_2_) && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) {
if (integer == 8) {
- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_196604_cC));
+ items.add(new ItemStack(Blocks.field_196604_cC));
} else {
for(int i = 0; i < integer; ++i) {
- func_180635_a(p_180657_1_, p_180657_3_, this.func_180643_i(p_180657_4_));
+ items.add(this.func_180643_i(p_180657_4_));
}
}
+ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_4_, 0, 1.0f, true, p_180657_2_);
} else {
- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Items.field_151126_ay, integer));
+ getDrops(p_180657_4_, items, p_180657_1_, p_180657_3_, fortune);
+ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_4_, fortune, 1.0f, false, p_180657_2_);
}
+ for (ItemStack item : items) {
+ if (p_180657_1_.field_73012_v.nextFloat() <= chance)
+ func_180635_a(p_180657_1_, p_180657_3_, item);
+ }
+
p_180657_1_.func_175698_g(p_180657_3_);
p_180657_2_.func_71029_a(StatList.field_188065_ae.func_199076_b(this));
p_180657_2_.func_71020_j(0.005F);
}
public IItemProvider func_199769_a(IBlockState p_199769_1_, World p_199769_2_, BlockPos p_199769_3_, int p_199769_4_) {
- return Items.field_190931_a;
+ return Items.field_151126_ay;
}
+ @Override
+ public int func_196264_a(IBlockState state, Random random) {
+ return state.func_177229_b(field_176315_a) + 1;
+ }
+
public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
if (p_196267_2_.func_175642_b(EnumLightType.BLOCK, p_196267_3_) > 11) {
- p_196267_1_.func_196949_c(p_196267_2_, p_196267_3_, 0);
p_196267_2_.func_175698_g(p_196267_3_);
}
@@ -0,0 +1,26 @@
--- a/net/minecraft/block/BlockState.java
+++ b/net/minecraft/block/BlockState.java
@@ -51,7 +51,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class BlockState extends StateHolder<Block, BlockState> implements IStateHolder<BlockState> {
+public class BlockState extends StateHolder<Block, BlockState> implements IStateHolder<BlockState>, net.minecraftforge.common.extensions.IForgeBlockState {
@Nullable
private BlockState.Cache field_215707_c;
private final int field_215708_d;
@@ -106,10 +106,14 @@
return this.field_215708_d;
}
+ /** @deprecated use {@link BlockState#isAir(IBlockReader, BlockPos) */
+ @Deprecated
public boolean func_196958_f() {
return this.func_177230_c().func_196261_e(this);
}
+ /** @deprecated use {@link BlockState#rotate(IWorld, BlockPos, Rotation) */
+ @Deprecated
public MaterialColor func_185909_g(IBlockReader p_185909_1_, BlockPos p_185909_2_) {
return this.func_177230_c().func_180659_g(this, p_185909_1_, p_185909_2_);
}
@@ -1,55 +0,0 @@
--- a/net/minecraft/block/BlockStem.java
+++ b/net/minecraft/block/BlockStem.java
@@ -39,22 +39,24 @@
public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_);
+ if (!p_196267_2_.func_205050_e(p_196267_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
if (p_196267_2_.func_201669_a(p_196267_3_.func_177984_a(), 0) >= 9) {
float f = BlockCrops.func_180672_a(this, p_196267_2_, p_196267_3_);
- if (p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0) {
+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0)) {
int i = p_196267_1_.func_177229_b(field_176484_a);
if (i < 7) {
- p_196267_1_ = p_196267_1_.func_206870_a(field_176484_a, Integer.valueOf(i + 1));
- p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_, 2);
+ p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_.func_206870_a(field_176484_a, i + 1), 2);
} else {
EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.func_179518_a(p_196267_4_);
BlockPos blockpos = p_196267_3_.func_177972_a(enumfacing);
- Block block = p_196267_2_.func_180495_p(blockpos.func_177977_b()).func_177230_c();
- if (p_196267_2_.func_180495_p(blockpos).func_196958_f() && (block == Blocks.field_150458_ak || block == Blocks.field_150346_d || block == Blocks.field_196660_k || block == Blocks.field_196661_l || block == Blocks.field_196658_i)) {
+ IBlockState soil = p_196267_2_.func_180495_p(blockpos.func_177977_b());
+ Block block = soil.func_177230_c();
+ if (p_196267_2_.func_180495_p(blockpos).isAir(p_196267_2_, blockpos) && (soil.canSustainPlant(p_196267_2_, blockpos.func_177977_b(), EnumFacing.UP, this) || block == Blocks.field_150346_d || block == Blocks.field_196660_k || block == Blocks.field_196661_l || block == Blocks.field_196658_i)) {
p_196267_2_.func_175656_a(blockpos, this.field_149877_a.func_176223_P());
p_196267_2_.func_175656_a(p_196267_3_, this.field_149877_a.func_196523_e().func_176223_P().func_206870_a(BlockHorizontal.field_185512_D, enumfacing));
}
}
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_);
}
}
@@ -62,14 +64,18 @@
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_);
- if (!p_196255_2_.field_72995_K) {
+ }
+
+ @Override
+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
+ {
Item item = this.func_176481_j();
if (item != null) {
- int i = p_196255_1_.func_177229_b(field_176484_a);
+ int i = state.func_177229_b(field_176484_a);
for(int j = 0; j < 3; ++j) {
- if (p_196255_2_.field_73012_v.nextInt(15) <= i) {
- func_180635_a(p_196255_2_, p_196255_3_, new ItemStack(item));
+ if (world.field_73012_v.nextInt(15) <= i) {
+ drops.add(new ItemStack(item));
}
}
@@ -1,39 +0,0 @@
--- a/net/minecraft/block/BlockTallGrass.java
+++ b/net/minecraft/block/BlockTallGrass.java
@@ -15,7 +15,7 @@
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
-public class BlockTallGrass extends BlockBush implements IGrowable {
+public class BlockTallGrass extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable {
protected static final VoxelShape field_196389_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D);
protected BlockTallGrass(Block.Properties p_i48310_1_) {
@@ -27,7 +27,7 @@
}
public IItemProvider func_199769_a(IBlockState p_199769_1_, World p_199769_2_, BlockPos p_199769_3_, int p_199769_4_) {
- return p_199769_2_.field_73012_v.nextInt(8) == 0 ? Items.field_151014_N : Items.field_190931_a;
+ return Items.field_190931_a;
}
public int func_196251_a(IBlockState p_196251_1_, int p_196251_2_, World p_196251_3_, BlockPos p_196251_4_, Random p_196251_5_) {
@@ -64,4 +64,18 @@
public Block.EnumOffsetType func_176218_Q() {
return Block.EnumOffsetType.XYZ;
}
+
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) {
+ world.func_180501_a(pos, Blocks.field_150350_a.func_176223_P(), 11);
+ return java.util.Arrays.asList(new ItemStack(this));
+ }
+
+ @Override
+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
+ if (world.field_73012_v.nextInt(8) != 0) return;
+ ItemStack seed = net.minecraftforge.common.ForgeHooks.getGrassSeed(world.field_73012_v, fortune);
+ if (!seed.func_190926_b())
+ drops.add(seed);
+ }
}
@@ -1,13 +0,0 @@
--- a/net/minecraft/block/BlockTorch.java
+++ b/net/minecraft/block/BlockTorch.java
@@ -37,9 +37,7 @@
public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) {
IBlockState iblockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
- Block block = iblockstate.func_177230_c();
- boolean flag = block instanceof BlockFence || block instanceof BlockStainedGlass || block == Blocks.field_150359_w || block == Blocks.field_150463_bK || block == Blocks.field_196723_eg || iblockstate.func_185896_q();
- return flag && block != Blocks.field_185775_db;
+ return iblockstate.canPlaceTorchOnTop(p_196260_2_, p_196260_3_);
}
@OnlyIn(Dist.CLIENT)
@@ -1,17 +0,0 @@
--- a/net/minecraft/block/BlockTrapDoor.java
+++ b/net/minecraft/block/BlockTrapDoor.java
@@ -186,4 +186,14 @@
return super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
}
+
+ @Override
+ public boolean isLadder(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, net.minecraft.entity.EntityLivingBase entity) {
+ if (state.func_177229_b(field_176283_b)) {
+ IBlockState down = world.func_180495_p(pos.func_177977_b());
+ if (down.func_177230_c() == net.minecraft.init.Blocks.field_150468_ap)
+ return down.func_177229_b(BlockLadder.field_176382_a) == state.func_177229_b(field_185512_D);
+ }
+ return false;
+ }
}
@@ -1,36 +0,0 @@
--- a/net/minecraft/block/BlockVine.java
+++ b/net/minecraft/block/BlockVine.java
@@ -29,7 +29,7 @@
import net.minecraft.world.IWorldReaderBase;
import net.minecraft.world.World;
-public class BlockVine extends Block {
+public class BlockVine extends Block implements net.minecraftforge.common.IShearable {
public static final BooleanProperty field_176277_a = BlockSixWay.field_196496_z;
public static final BooleanProperty field_176273_b = BlockSixWay.field_196488_a;
public static final BooleanProperty field_176278_M = BlockSixWay.field_196490_b;
@@ -171,7 +171,7 @@
p_196267_2_.func_175698_g(p_196267_3_);
}
- } else if (p_196267_2_.field_73012_v.nextInt(4) == 0) {
+ } else if (p_196267_2_.field_73012_v.nextInt(4) == 0 && p_196267_2_.func_205050_e(p_196267_3_, 4)) { // Forge: check area to prevent loading unloaded chunks
EnumFacing enumfacing = EnumFacing.func_176741_a(p_196267_4_);
BlockPos blockpos = p_196267_3_.func_177984_a();
if (enumfacing.func_176740_k().func_176722_c() && !p_196267_1_.func_177229_b(func_176267_a(enumfacing))) {
@@ -365,4 +365,15 @@
public BlockFaceShape func_193383_a(IBlockReader p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) {
return BlockFaceShape.UNDEFINED;
}
+
+ @Override
+ public boolean isLadder(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, net.minecraft.entity.EntityLivingBase entity) {
+ return true;
+ }
+
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) {
+ world.func_180501_a(pos, Blocks.field_150350_a.func_176223_P(), 11);
+ return java.util.Arrays.asList(new ItemStack(this));
+ }
}
@@ -1,44 +0,0 @@
--- a/net/minecraft/block/BlockWall.java
+++ b/net/minecraft/block/BlockWall.java
@@ -51,6 +51,18 @@
return !func_194143_e(block) && p_196421_2_ == BlockFaceShape.SOLID || flag;
}
+ @Override
+ public boolean canBeConnectedTo(IBlockState state, IBlockReader world, BlockPos pos, EnumFacing facing) {
+ IBlockState other = world.func_180495_p(pos.func_177972_a(facing));
+ return func_196421_a(other, other.func_193401_d(world, pos.func_177972_a(facing), facing.func_176734_d()));
+ }
+
+ private boolean canWallConnectTo(IBlockReader world, BlockPos pos, EnumFacing facing) {
+ BlockPos off = pos.func_177972_a(facing);
+ IBlockState other = world.func_180495_p(off);
+ return other.canBeConnectedTo(world, off, facing.func_176734_d()) || func_196421_a(other, other.func_193401_d(world, off, facing.func_176734_d()));
+ }
+
public static boolean func_194143_e(Block p_194143_0_) {
return Block.func_193382_c(p_194143_0_) || p_194143_0_ == Blocks.field_180401_cv || p_194143_0_ == Blocks.field_150440_ba || p_194143_0_ == Blocks.field_150423_aK || p_194143_0_ == Blocks.field_196625_cS || p_194143_0_ == Blocks.field_196628_cT || p_194143_0_ == Blocks.field_185778_de || p_194143_0_ == Blocks.field_150335_W;
}
@@ -59,18 +71,10 @@
IWorldReaderBase iworldreaderbase = p_196258_1_.func_195991_k();
BlockPos blockpos = p_196258_1_.func_195995_a();
IFluidState ifluidstate = p_196258_1_.func_195991_k().func_204610_c(p_196258_1_.func_195995_a());
- BlockPos blockpos1 = blockpos.func_177978_c();
- BlockPos blockpos2 = blockpos.func_177974_f();
- BlockPos blockpos3 = blockpos.func_177968_d();
- BlockPos blockpos4 = blockpos.func_177976_e();
- IBlockState iblockstate = iworldreaderbase.func_180495_p(blockpos1);
- IBlockState iblockstate1 = iworldreaderbase.func_180495_p(blockpos2);
- IBlockState iblockstate2 = iworldreaderbase.func_180495_p(blockpos3);
- IBlockState iblockstate3 = iworldreaderbase.func_180495_p(blockpos4);
- boolean flag = this.func_196421_a(iblockstate, iblockstate.func_193401_d(iworldreaderbase, blockpos1, EnumFacing.SOUTH));
- boolean flag1 = this.func_196421_a(iblockstate1, iblockstate1.func_193401_d(iworldreaderbase, blockpos2, EnumFacing.WEST));
- boolean flag2 = this.func_196421_a(iblockstate2, iblockstate2.func_193401_d(iworldreaderbase, blockpos3, EnumFacing.NORTH));
- boolean flag3 = this.func_196421_a(iblockstate3, iblockstate3.func_193401_d(iworldreaderbase, blockpos4, EnumFacing.EAST));
+ boolean flag = canWallConnectTo(iworldreaderbase, blockpos, EnumFacing.NORTH);
+ boolean flag1 = canWallConnectTo(iworldreaderbase, blockpos, EnumFacing.EAST);
+ boolean flag2 = canWallConnectTo(iworldreaderbase, blockpos, EnumFacing.SOUTH);
+ boolean flag3 = canWallConnectTo(iworldreaderbase, blockpos, EnumFacing.WEST);
boolean flag4 = (!flag || flag1 || !flag2 || flag3) && (flag || !flag1 || flag2 || !flag3);
return this.func_176223_P().func_206870_a(field_176256_a, Boolean.valueOf(flag4 || !iworldreaderbase.func_175623_d(blockpos.func_177984_a()))).func_206870_a(field_196409_a, Boolean.valueOf(flag)).func_206870_a(field_196411_b, Boolean.valueOf(flag1)).func_206870_a(field_196413_c, Boolean.valueOf(flag2)).func_206870_a(field_196414_y, Boolean.valueOf(flag3)).func_206870_a(field_204514_u, Boolean.valueOf(ifluidstate.func_206886_c() == Fluids.field_204546_a));
}
@@ -1,30 +0,0 @@
--- a/net/minecraft/block/BlockWeb.java
+++ b/net/minecraft/block/BlockWeb.java
@@ -5,6 +5,7 @@
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
@@ -16,7 +17,7 @@
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
-public class BlockWeb extends Block {
+public class BlockWeb extends Block implements net.minecraftforge.common.IShearable {
public BlockWeb(Block.Properties p_i48296_1_) {
super(p_i48296_1_);
}
@@ -54,4 +55,10 @@
public BlockFaceShape func_193383_a(IBlockReader p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) {
return BlockFaceShape.UNDEFINED;
}
+
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) {
+ world.func_180501_a(pos, Blocks.field_150350_a.func_176223_P(), 11);
+ return java.util.Arrays.asList(new ItemStack(this));
+ }
}
@@ -0,0 +1,36 @@
--- a/net/minecraft/block/Blocks.java
+++ b/net/minecraft/block/Blocks.java
@@ -13,6 +13,7 @@
import net.minecraft.potion.Effects;
import net.minecraft.util.registry.Registry;
[email protected]("minecraft")
public class Blocks {
public static final Block field_150350_a = func_222382_a("air", new AirBlock(Block.Properties.func_200945_a(Material.field_151579_a).func_200942_a().func_222380_e()));
public static final Block field_150348_b = func_222382_a("stone", new Block(Block.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_151665_m).func_200948_a(1.5F, 6.0F)));
@@ -104,7 +105,7 @@
public static final Block field_196601_az = func_222382_a("green_bed", new BedBlock(DyeColor.GREEN, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F)));
public static final Block field_196550_aA = func_222382_a("red_bed", new BedBlock(DyeColor.RED, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F)));
public static final Block field_196551_aB = func_222382_a("black_bed", new BedBlock(DyeColor.BLACK, Block.Properties.func_200945_a(Material.field_151580_n).func_200947_a(SoundType.field_185848_a).func_200943_b(0.2F)));
- public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e)));
+ public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e), true));
public static final Block field_150319_E = func_222382_a("detector_rail", new DetectorRailBlock(Block.Properties.func_200945_a(Material.field_151594_q).func_200942_a().func_200943_b(0.7F).func_200947_a(SoundType.field_185852_e)));
public static final Block field_150320_F = func_222382_a("sticky_piston", new PistonBlock(true, Block.Properties.func_200945_a(Material.field_76233_E).func_200943_b(0.5F)));
public static final Block field_196553_aF = func_222382_a("cobweb", new WebBlock(Block.Properties.func_200945_a(Material.field_151569_G).func_200942_a().func_200943_b(4.0F)));
@@ -694,16 +695,4 @@
private static Block func_222382_a(String p_222382_0_, Block p_222382_1_) {
return Registry.func_218325_a(Registry.field_212618_g, p_222382_0_, p_222382_1_);
}
-
- static {
- for(Block block : Registry.field_212618_g) {
- for(BlockState blockstate : block.func_176194_O().func_177619_a()) {
- blockstate.func_215692_c();
- Block.field_176229_d.func_195867_b(blockstate);
- }
-
- block.func_220068_i();
- }
-
- }
}
@@ -0,0 +1,32 @@
--- a/net/minecraft/block/BushBlock.java
+++ b/net/minecraft/block/BushBlock.java
@@ -7,7 +7,7 @@
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
-public class BushBlock extends Block {
+public class BushBlock extends Block implements net.minecraftforge.common.IPlantable {
protected BushBlock(Block.Properties p_i48437_1_) {
super(p_i48437_1_);
}
@@ -23,6 +23,8 @@
public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
BlockPos blockpos = p_196260_3_.func_177977_b();
+ if (p_196260_1_.func_177230_c() == this) //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.
+ return p_196260_2_.func_180495_p(blockpos).canSustainPlant(p_196260_2_, blockpos, Direction.UP, this);
return this.func_200014_a_(p_196260_2_.func_180495_p(blockpos), p_196260_2_, blockpos);
}
@@ -33,4 +35,11 @@
public boolean func_200123_i(BlockState p_200123_1_, IBlockReader p_200123_2_, BlockPos p_200123_3_) {
return true;
}
+
+ @Override
+ public BlockState getPlant(IBlockReader world, BlockPos pos) {
+ BlockState state = world.func_180495_p(pos);
+ if (state.func_177230_c() != this) return func_176223_P();
+ return state;
+ }
}
@@ -1,31 +1,31 @@
--- a/net/minecraft/block/BlockCactus.java
+++ b/net/minecraft/block/BlockCactus.java
@@ -21,7 +21,7 @@
import net.minecraft.world.IWorldReaderBase;
--- a/net/minecraft/block/CactusBlock.java
+++ b/net/minecraft/block/CactusBlock.java
@@ -19,7 +19,7 @@
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
-public class BlockCactus extends Block {
+public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable {
-public class CactusBlock extends Block {
+public class CactusBlock extends Block implements net.minecraftforge.common.IPlantable {
public static final IntegerProperty field_176587_a = BlockStateProperties.field_208171_X;
protected static final VoxelShape field_196400_b = Block.func_208617_a(1.0D, 0.0D, 1.0D, 15.0D, 15.0D, 15.0D);
protected static final VoxelShape field_196401_c = Block.func_208617_a(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
@@ -32,6 +32,7 @@
@@ -30,6 +30,7 @@
}
public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
+ if (!p_196267_2_.func_205050_e(p_196267_3_, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update
public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
+ if (!p_196267_2_.isAreaLoaded(p_196267_3_, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update
if (!p_196267_1_.func_196955_c(p_196267_2_, p_196267_3_)) {
p_196267_2_.func_175655_b(p_196267_3_, true);
} else {
@@ -44,6 +45,7 @@
@@ -42,6 +43,7 @@
if (i < 3) {
int j = p_196267_1_.func_177229_b(field_176587_a);
+ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, blockpos, p_196267_1_, true)) {
if (j == 15) {
p_196267_2_.func_175656_a(blockpos, this.func_176223_P());
IBlockState iblockstate = p_196267_1_.func_206870_a(field_176587_a, Integer.valueOf(0));
@@ -52,7 +54,8 @@
BlockState blockstate = p_196267_1_.func_206870_a(field_176587_a, Integer.valueOf(0));
@@ -50,7 +52,8 @@
} else {
p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_.func_206870_a(field_176587_a, Integer.valueOf(j + 1)), 4);
}
@@ -35,29 +35,29 @@
}
}
}
@@ -91,8 +94,8 @@
@@ -85,8 +88,8 @@
}
}
- Block block = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_177230_c();
- return (block == Blocks.field_150434_aF || block == Blocks.field_150354_m || block == Blocks.field_196611_F) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d();
+ IBlockState soil = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
+ return soil.canSustainPlant(p_196260_2_, p_196260_3_.func_177977_b(), EnumFacing.UP, this) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d();
+ BlockState soil = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
+ return soil.canSustainPlant(p_196260_2_, p_196260_3_.func_177977_b(), Direction.UP, this) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d();
}
public void func_196262_a(IBlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) {
@@ -114,4 +117,14 @@
public boolean func_196266_a(IBlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) {
@@ -104,4 +107,14 @@
public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
return false;
}
+
+ @Override
+ public net.minecraftforge.common.EnumPlantType getPlantType(IBlockReader world, BlockPos pos) {
+ return net.minecraftforge.common.EnumPlantType.Desert;
+ public net.minecraftforge.common.PlantType getPlantType(IBlockReader world, BlockPos pos) {
+ return net.minecraftforge.common.PlantType.Desert;
+ }
+
+ @Override
+ public IBlockState getPlant(IBlockReader world, BlockPos pos) {
+ return func_176223_P();
+ public BlockState getPlant(IBlockReader world, BlockPos pos) {
+ return func_176223_P();
+ }
}
@@ -0,0 +1,50 @@
--- a/net/minecraft/block/ChorusFlowerBlock.java
+++ b/net/minecraft/block/ChorusFlowerBlock.java
@@ -30,9 +30,9 @@
p_196267_2_.func_175655_b(p_196267_3_, true);
} else {
BlockPos blockpos = p_196267_3_.func_177984_a();
- if (p_196267_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < 256) {
+ if (p_196267_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < p_196267_2_.func_201675_m().getHeight()) {
int i = p_196267_1_.func_177229_b(field_185607_a);
- if (i < 5) {
+ if (i < 5 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, blockpos, p_196267_1_, true)) {
boolean flag = false;
boolean flag1 = false;
BlockState blockstate = p_196267_2_.func_180495_p(p_196267_3_.func_177977_b());
@@ -57,7 +57,7 @@
if (j < 2 || j <= p_196267_4_.nextInt(flag1 ? 5 : 4)) {
flag = true;
}
- } else if (blockstate.func_196958_f()) {
+ } else if (blockstate.isAir(p_196267_2_, p_196267_3_.func_177977_b())) {
flag = true;
}
@@ -89,7 +89,7 @@
} else {
this.func_185605_c(p_196267_2_, p_196267_3_);
}
-
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_);
}
}
}
@@ -127,7 +127,7 @@
BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
Block block = blockstate.func_177230_c();
if (block != this.field_196405_b && block != Blocks.field_150377_bs) {
- if (!blockstate.func_196958_f()) {
+ if (!blockstate.isAir(p_196260_2_, p_196260_3_.func_177977_b())) {
return false;
} else {
boolean flag = false;
@@ -140,7 +140,7 @@
}
flag = true;
- } else if (!blockstate1.func_196958_f()) {
+ } else if (!blockstate1.isAir(p_196260_2_, p_196260_3_.func_177972_a(direction))) {
return false;
}
}
@@ -0,0 +1,16 @@
--- a/net/minecraft/block/CocoaBlock.java
+++ b/net/minecraft/block/CocoaBlock.java
@@ -30,10 +30,11 @@
}
public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
- if (p_196267_2_.field_73012_v.nextInt(5) == 0) {
+ if (true) {
int i = p_196267_1_.func_177229_b(field_176501_a);
- if (i < 2) {
+ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_2_.field_73012_v.nextInt(5) == 0)) {
p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_.func_206870_a(field_176501_a, Integer.valueOf(i + 1)), 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_);
}
}
@@ -0,0 +1,28 @@
--- a/net/minecraft/block/ComparatorBlock.java
+++ b/net/minecraft/block/ComparatorBlock.java
@@ -66,7 +66,7 @@
blockstate = p_176397_1_.func_180495_p(blockpos);
if (blockstate.func_185912_n()) {
i = blockstate.func_185888_a(p_176397_1_, blockpos);
- } else if (blockstate.func_196958_f()) {
+ } else if (blockstate.isAir(p_176397_1_, blockpos)) {
ItemFrameEntity itemframeentity = this.func_176461_a(p_176397_1_, direction, blockpos);
if (itemframeentity != null) {
i = itemframeentity.func_174866_q();
@@ -152,4 +152,16 @@
protected void func_206840_a(StateContainer.Builder<Block, BlockState> p_206840_1_) {
p_206840_1_.func_206894_a(field_185512_D, field_176463_b, field_196348_c);
}
+
+ @Override
+ public boolean getWeakChanges(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos) {
+ return true;
+ }
+
+ @Override
+ public void onNeighborChange(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, BlockPos neighbor) {
+ if (pos.func_177956_o() == neighbor.func_177956_o() && world instanceof World && !((World)world).func_201670_d()) {
+ state.func_215697_a((World)world, pos, world.func_180495_p(neighbor).func_177230_c(), neighbor, false);
+ }
+ }
}
@@ -0,0 +1,39 @@
--- a/net/minecraft/block/CropsBlock.java
+++ b/net/minecraft/block/CropsBlock.java
@@ -57,12 +57,14 @@
public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_);
+ if (!p_196267_2_.isAreaLoaded(p_196267_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
if (p_196267_2_.func_201669_a(p_196267_3_, 0) >= 9) {
int i = this.func_185527_x(p_196267_1_);
if (i < this.func_185526_g()) {
float f = func_180672_a(this, p_196267_2_, p_196267_3_);
- if (p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0) {
+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0)) {
p_196267_2_.func_180501_a(p_196267_3_, this.func_185528_e(i + 1), 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_);
}
}
}
@@ -91,9 +93,9 @@
for(int j = -1; j <= 1; ++j) {
float f1 = 0.0F;
BlockState blockstate = p_180672_1_.func_180495_p(blockpos.func_177982_a(i, 0, j));
- if (blockstate.func_177230_c() == Blocks.field_150458_ak) {
+ if (blockstate.canSustainPlant(p_180672_1_, blockpos.func_177982_a(i, 0, j), net.minecraft.util.Direction.UP, (net.minecraftforge.common.IPlantable)p_180672_0_)) {
f1 = 1.0F;
- if (blockstate.func_177229_b(FarmlandBlock.field_176531_a) > 0) {
+ if (blockstate.isFertile(p_180672_1_, blockpos.func_177982_a(i, 0, j))) {
f1 = 3.0F;
}
}
@@ -129,7 +131,7 @@
}
public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) {
- if (p_196262_4_ instanceof RavagerEntity && p_196262_2_.func_82736_K().func_223586_b(GameRules.field_223599_b)) {
+ if (p_196262_4_ instanceof RavagerEntity && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_196262_2_, p_196262_4_)) {
p_196262_2_.func_175655_b(p_196262_3_, true);
}
@@ -0,0 +1,11 @@
--- a/net/minecraft/block/DeadBushBlock.java
+++ b/net/minecraft/block/DeadBushBlock.java
@@ -5,7 +5,7 @@
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
-public class DeadBushBlock extends BushBlock {
+public class DeadBushBlock extends BushBlock implements net.minecraftforge.common.IShearable {
protected static final VoxelShape field_196397_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D);
protected DeadBushBlock(Block.Properties p_i48418_1_) {
@@ -0,0 +1,11 @@
--- a/net/minecraft/block/DetectorRailBlock.java
+++ b/net/minecraft/block/DetectorRailBlock.java
@@ -128,6 +128,8 @@
public int func_180641_l(BlockState p_180641_1_, World p_180641_2_, BlockPos p_180641_3_) {
if (p_180641_1_.func_177229_b(field_176574_M)) {
+ List<AbstractMinecartEntity> carts = this.func_200878_a(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, null);
+ if (!carts.isEmpty() && carts.get(0).getComparatorLevel() > -1) return carts.get(0).getComparatorLevel();
List<MinecartCommandBlockEntity> list = this.func_200878_a(p_180641_2_, p_180641_3_, MinecartCommandBlockEntity.class, (Predicate<Entity>)null);
if (!list.isEmpty()) {
return list.get(0).func_145822_e().func_145760_g();
@@ -0,0 +1,19 @@
--- a/net/minecraft/block/DoublePlantBlock.java
+++ b/net/minecraft/block/DoublePlantBlock.java
@@ -39,7 +39,7 @@
@Nullable
public BlockState func_196258_a(BlockItemUseContext p_196258_1_) {
BlockPos blockpos = p_196258_1_.func_195995_a();
- return blockpos.func_177956_o() < 255 && p_196258_1_.func_195991_k().func_180495_p(blockpos.func_177984_a()).func_196953_a(p_196258_1_) ? super.func_196258_a(p_196258_1_) : null;
+ return blockpos.func_177956_o() < p_196258_1_.func_195991_k().func_201675_m().getHeight() - 1 && p_196258_1_.func_195991_k().func_180495_p(blockpos.func_177984_a()).func_196953_a(p_196258_1_) ? super.func_196258_a(p_196258_1_) : null;
}
public void func_180633_a(World p_180633_1_, BlockPos p_180633_2_, BlockState p_180633_3_, LivingEntity p_180633_4_, ItemStack p_180633_5_) {
@@ -51,6 +51,7 @@
return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_);
} else {
BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
+ if (p_196260_1_.func_177230_c() != this) return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_); //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.
return blockstate.func_177230_c() == this && blockstate.func_177229_b(field_176492_b) == DoubleBlockHalf.LOWER;
}
}
@@ -0,0 +1,11 @@
--- a/net/minecraft/block/DropperBlock.java
+++ b/net/minecraft/block/DropperBlock.java
@@ -37,7 +37,7 @@
p_176439_1_.func_217379_c(1001, p_176439_2_, 0);
} else {
ItemStack itemstack = dispensertileentity.func_70301_a(i);
- if (!itemstack.func_190926_b()) {
+ if (!itemstack.func_190926_b() && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(p_176439_1_, p_176439_2_, dispensertileentity, i, itemstack)) {
Direction direction = p_176439_1_.func_180495_p(p_176439_2_).func_177229_b(field_176441_a);
IInventory iinventory = HopperTileEntity.func_195484_a(p_176439_1_, p_176439_2_.func_177972_a(direction));
ItemStack itemstack1;
@@ -1,6 +1,6 @@
--- a/net/minecraft/block/BlockEnchantmentTable.java
+++ b/net/minecraft/block/BlockEnchantmentTable.java
@@ -49,7 +49,7 @@
--- a/net/minecraft/block/EnchantingTableBlock.java
+++ b/net/minecraft/block/EnchantingTableBlock.java
@@ -53,7 +53,7 @@
if (p_180655_4_.nextInt(16) == 0) {
for(int k = 0; k <= 1; ++k) {
BlockPos blockpos = p_180655_3_.func_177982_a(i, k, j);
@@ -0,0 +1,20 @@
--- a/net/minecraft/block/FallingBlock.java
+++ b/net/minecraft/block/FallingBlock.java
@@ -35,7 +35,7 @@
}
private void func_176503_e(World p_176503_1_, BlockPos p_176503_2_) {
- if (func_185759_i(p_176503_1_.func_180495_p(p_176503_2_.func_177977_b())) && p_176503_2_.func_177956_o() >= 0) {
+ if (p_176503_1_.func_175623_d(p_176503_2_.func_177977_b()) || func_185759_i(p_176503_1_.func_180495_p(p_176503_2_.func_177977_b())) && p_176503_2_.func_177956_o() >= 0) {
if (!p_176503_1_.field_72995_K) {
FallingBlockEntity fallingblockentity = new FallingBlockEntity(p_176503_1_, (double)p_176503_2_.func_177958_n() + 0.5D, (double)p_176503_2_.func_177956_o(), (double)p_176503_2_.func_177952_p() + 0.5D, p_176503_1_.func_180495_p(p_176503_2_));
this.func_149829_a(fallingblockentity);
@@ -68,7 +68,7 @@
public void func_180655_c(BlockState p_180655_1_, World p_180655_2_, BlockPos p_180655_3_, Random p_180655_4_) {
if (p_180655_4_.nextInt(16) == 0) {
BlockPos blockpos = p_180655_3_.func_177977_b();
- if (func_185759_i(p_180655_2_.func_180495_p(blockpos))) {
+ if (p_180655_2_.func_175623_d(blockpos) || func_185759_i(p_180655_2_.func_180495_p(blockpos))) {
double d0 = (double)((float)p_180655_3_.func_177958_n() + p_180655_4_.nextFloat());
double d1 = (double)p_180655_3_.func_177956_o() - 0.05D;
double d2 = (double)((float)p_180655_3_.func_177952_p() + p_180655_4_.nextFloat());
@@ -1,28 +1,28 @@
--- a/net/minecraft/block/BlockFarmland.java
+++ b/net/minecraft/block/BlockFarmland.java
@@ -79,7 +79,7 @@
--- a/net/minecraft/block/FarmlandBlock.java
+++ b/net/minecraft/block/FarmlandBlock.java
@@ -73,7 +73,7 @@
}
public void func_180658_a(World p_180658_1_, BlockPos p_180658_2_, Entity p_180658_3_, float p_180658_4_) {
- if (!p_180658_1_.field_72995_K && p_180658_1_.field_73012_v.nextFloat() < p_180658_4_ - 0.5F && p_180658_3_ instanceof EntityLivingBase && (p_180658_3_ instanceof EntityPlayer || p_180658_1_.func_82736_K().func_82766_b("mobGriefing")) && p_180658_3_.field_70130_N * p_180658_3_.field_70130_N * p_180658_3_.field_70131_O > 0.512F) {
- if (!p_180658_1_.field_72995_K && p_180658_1_.field_73012_v.nextFloat() < p_180658_4_ - 0.5F && p_180658_3_ instanceof LivingEntity && (p_180658_3_ instanceof PlayerEntity || p_180658_1_.func_82736_K().func_223586_b(GameRules.field_223599_b)) && p_180658_3_.func_213311_cf() * p_180658_3_.func_213311_cf() * p_180658_3_.func_213302_cg() > 0.512F) {
+ if (!p_180658_1_.field_72995_K && net.minecraftforge.common.ForgeHooks.onFarmlandTrample(p_180658_1_, p_180658_2_, Blocks.field_150346_d.func_176223_P(), p_180658_4_, p_180658_3_)) { // Forge: Move logic to Entity#canTrample
func_199610_d(p_180658_1_.func_180495_p(p_180658_2_), p_180658_1_, p_180658_2_);
}
@@ -90,9 +90,9 @@
@@ -84,9 +84,9 @@
p_199610_1_.func_175656_a(p_199610_2_, func_199601_a(p_199610_0_, Blocks.field_150346_d.func_176223_P(), p_199610_1_, p_199610_2_));
}
- private static boolean func_176529_d(IBlockReader p_176529_0_, BlockPos p_176529_1_) {
- Block block = p_176529_0_.func_180495_p(p_176529_1_.func_177984_a()).func_177230_c();
- return block instanceof BlockCrops || block instanceof BlockStem || block instanceof BlockAttachedStem;
- return block instanceof CropsBlock || block instanceof StemBlock || block instanceof AttachedStemBlock;
+ private boolean func_176529_d(IBlockReader p_176529_0_, BlockPos p_176529_1_) {
+ IBlockState state = p_176529_0_.func_180495_p(p_176529_1_.func_177984_a());
+ return state.func_177230_c() instanceof net.minecraftforge.common.IPlantable && canSustainPlant(state, p_176529_0_, p_176529_1_, EnumFacing.UP, (net.minecraftforge.common.IPlantable)state.func_177230_c());
+ BlockState state = p_176529_0_.func_180495_p(p_176529_1_.func_177984_a());
+ return state.func_177230_c() instanceof net.minecraftforge.common.IPlantable && canSustainPlant(state, p_176529_0_, p_176529_1_, Direction.UP, (net.minecraftforge.common.IPlantable)state.func_177230_c());
}
private static boolean func_176530_e(IWorldReaderBase p_176530_0_, BlockPos p_176530_1_) {
@@ -102,7 +102,7 @@
private static boolean func_176530_e(IWorldReader p_176530_0_, BlockPos p_176530_1_) {
@@ -96,7 +96,7 @@
}
}
@@ -30,4 +30,4 @@
+ return net.minecraftforge.common.FarmlandWaterManager.hasBlockWaterTicket(p_176530_0_, p_176530_1_);
}
public IItemProvider func_199769_a(IBlockState p_199769_1_, World p_199769_2_, BlockPos p_199769_3_, int p_199769_4_) {
protected void func_206840_a(StateContainer.Builder<Block, BlockState> p_206840_1_) {
@@ -1,55 +1,47 @@
--- a/net/minecraft/block/BlockFire.java
+++ b/net/minecraft/block/BlockFire.java
--- a/net/minecraft/block/FireBlock.java
+++ b/net/minecraft/block/FireBlock.java
@@ -64,13 +64,13 @@
public BlockState func_196448_a(IBlockReader p_196448_1_, BlockPos p_196448_2_) {
BlockPos blockpos = p_196448_2_.func_177977_b();
BlockState blockstate = p_196448_1_.func_180495_p(blockpos);
- if (!this.func_196446_i(blockstate) && !blockstate.func_224755_d(p_196448_1_, blockpos, Direction.UP)) {
+ if (!this.canCatchFire(p_196448_1_, p_196448_2_, Direction.UP) && !Block.func_220056_d(blockstate, p_196448_1_, blockpos, Direction.UP)) {
BlockState blockstate1 = this.func_176223_P();
public IBlockState func_196448_a(IBlockReader p_196448_1_, BlockPos p_196448_2_) {
IBlockState iblockstate = p_196448_1_.func_180495_p(p_196448_2_.func_177977_b());
- if (!iblockstate.func_185896_q() && !this.func_196446_i(iblockstate)) {
+ if (!iblockstate.func_185896_q() && !this.canCatchFire(p_196448_1_, p_196448_2_, EnumFacing.UP)) {
IBlockState iblockstate1 = this.func_176223_P();
for(EnumFacing enumfacing : EnumFacing.values()) {
BooleanProperty booleanproperty = field_196449_B.get(enumfacing);
for(Direction direction : Direction.values()) {
BooleanProperty booleanproperty = field_196449_B.get(direction);
if (booleanproperty != null) {
- iblockstate1 = iblockstate1.func_206870_a(booleanproperty, Boolean.valueOf(this.func_196446_i(p_196448_1_.func_180495_p(p_196448_2_.func_177972_a(enumfacing)))));
+ iblockstate1 = iblockstate1.func_206870_a(booleanproperty, Boolean.valueOf(this.canCatchFire(p_196448_1_, p_196448_2_.func_177972_a(enumfacing), enumfacing.func_176734_d())));
- blockstate1 = blockstate1.func_206870_a(booleanproperty, Boolean.valueOf(this.func_196446_i(p_196448_1_.func_180495_p(p_196448_2_.func_177972_a(direction)))));
+ blockstate1 = blockstate1.func_206870_a(booleanproperty, Boolean.valueOf(this.canCatchFire(p_196448_1_, p_196448_2_.func_177972_a(direction), direction.func_176734_d())));
}
}
@@ -98,12 +98,13 @@
@@ -91,12 +91,14 @@
public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
if (p_196267_2_.func_82736_K().func_82766_b("doFireTick")) {
+ if (!p_196267_2_.func_205050_e(p_196267_3_, 2)) return; // Forge: prevent loading unloaded chunks when spreading fire
public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
if (p_196267_2_.func_82736_K().func_223586_b(GameRules.field_223598_a)) {
+ if (!p_196267_2_.isAreaLoaded(p_196267_3_, 2)) return; // Forge: prevent loading unloaded chunks when spreading fire
if (!p_196267_1_.func_196955_c(p_196267_2_, p_196267_3_)) {
p_196267_2_.func_175698_g(p_196267_3_);
p_196267_2_.func_217377_a(p_196267_3_, false);
}
- Block block = p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()).func_177230_c();
Block block = p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()).func_177230_c();
- boolean flag = p_196267_2_.field_73011_w instanceof EndDimension && block == Blocks.field_150357_h || block == Blocks.field_150424_aL || block == Blocks.field_196814_hQ;
+ IBlockState other = p_196267_2_.func_180495_p(p_196267_3_.func_177977_b());
+ boolean flag = other.isFireSource(p_196267_2_, p_196267_3_.func_177977_b(), EnumFacing.UP);
+ BlockState other = p_196267_2_.func_180495_p(p_196267_3_.func_177977_b());
+ boolean flag = other.isFireSource(p_196267_2_, p_196267_3_.func_177977_b(), Direction.UP);
int i = p_196267_1_.func_177229_b(field_176543_a);
if (!flag && p_196267_2_.func_72896_J() && this.func_176537_d(p_196267_2_, p_196267_3_) && p_196267_4_.nextFloat() < 0.2F + (float)i * 0.03F) {
p_196267_2_.func_175698_g(p_196267_3_);
@@ -117,14 +118,14 @@
if (!flag) {
p_196267_2_.func_205220_G_().func_205360_a(p_196267_3_, this, this.func_149738_a(p_196267_2_) + p_196267_4_.nextInt(10));
if (!this.func_196447_a(p_196267_2_, p_196267_3_)) {
- if (!p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()).func_185896_q() || i > 3) {
+ if (p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()).func_193401_d(p_196267_2_, p_196267_3_.func_177977_b(), EnumFacing.UP) != BlockFaceShape.SOLID || i > 3) {
p_196267_2_.func_175698_g(p_196267_3_);
}
p_196267_2_.func_217377_a(p_196267_3_, false);
@@ -118,7 +120,7 @@
return;
}
- if (i == 15 && p_196267_4_.nextInt(4) == 0 && !this.func_196446_i(p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()))) {
+ if (i == 15 && p_196267_4_.nextInt(4) == 0 && !this.canCatchFire(p_196267_2_, p_196267_3_.func_177977_b(), EnumFacing.UP)) {
p_196267_2_.func_175698_g(p_196267_3_);
+ if (i == 15 && p_196267_4_.nextInt(4) == 0 && !this.canCatchFire(p_196267_2_, p_196267_3_.func_177977_b(), Direction.UP)) {
p_196267_2_.func_217377_a(p_196267_3_, false);
return;
}
@@ -132,12 +133,12 @@
@@ -126,12 +128,12 @@
boolean flag1 = p_196267_2_.func_180502_D(p_196267_3_);
int k = flag1 ? -50 : 0;
@@ -59,110 +51,111 @@
- this.func_176536_a(p_196267_2_, p_196267_3_.func_177984_a(), 250 + k, p_196267_4_, i);
- this.func_176536_a(p_196267_2_, p_196267_3_.func_177978_c(), 300 + k, p_196267_4_, i);
- this.func_176536_a(p_196267_2_, p_196267_3_.func_177968_d(), 300 + k, p_196267_4_, i);
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177974_f(), 300 + k, p_196267_4_, i, EnumFacing.WEST);
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177976_e(), 300 + k, p_196267_4_, i, EnumFacing.EAST);
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177977_b(), 250 + k, p_196267_4_, i, EnumFacing.UP);
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177984_a(), 250 + k, p_196267_4_, i, EnumFacing.DOWN);
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177978_c(), 300 + k, p_196267_4_, i, EnumFacing.SOUTH);
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177968_d(), 300 + k, p_196267_4_, i, EnumFacing.NORTH);
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177974_f(), 300 + k, p_196267_4_, i, Direction.WEST);
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177976_e(), 300 + k, p_196267_4_, i, Direction.EAST);
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177977_b(), 250 + k, p_196267_4_, i, Direction.UP);
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177984_a(), 250 + k, p_196267_4_, i, Direction.DOWN);
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177978_c(), 300 + k, p_196267_4_, i, Direction.SOUTH);
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177968_d(), 300 + k, p_196267_4_, i, Direction.NORTH);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for(int l = -1; l <= 1; ++l) {
@@ -175,16 +176,18 @@
@@ -169,16 +171,18 @@
return p_176537_1_.func_175727_C(p_176537_2_) || p_176537_1_.func_175727_C(p_176537_2_.func_177976_e()) || p_176537_1_.func_175727_C(p_176537_2_.func_177974_f()) || p_176537_1_.func_175727_C(p_176537_2_.func_177978_c()) || p_176537_1_.func_175727_C(p_176537_2_.func_177968_d());
}
+ @Deprecated //Forge: Use IForgeBlockState.getFlammability
public int func_176532_c(Block p_176532_1_) {
return this.field_149848_b.getInt(p_176532_1_);
- private int func_220274_q(BlockState p_220274_1_) {
+ @Deprecated //Forge: Use IForgeBlockState.getFlammability, Public for default implementation only.
+ public int func_220274_q(BlockState p_220274_1_) {
return p_220274_1_.func_196959_b(BlockStateProperties.field_208198_y) && p_220274_1_.func_177229_b(BlockStateProperties.field_208198_y) ? 0 : this.field_149848_b.getInt(p_220274_1_.func_177230_c());
}
- private int func_220275_r(BlockState p_220275_1_) {
+ @Deprecated //Forge: Use IForgeBlockState.getFireSpreadSpeed
public int func_176534_d(Block p_176534_1_) {
return this.field_149849_a.getInt(p_176534_1_);
+ public int func_220275_r(BlockState p_220275_1_) {
return p_220275_1_.func_196959_b(BlockStateProperties.field_208198_y) && p_220275_1_.func_177229_b(BlockStateProperties.field_208198_y) ? 0 : this.field_149849_a.getInt(p_220275_1_.func_177230_c());
}
- private void func_176536_a(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_) {
- int i = this.func_176532_c(p_176536_1_.func_180495_p(p_176536_2_).func_177230_c());
+ private void tryCatchFire(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_, EnumFacing face) {
- int i = this.func_220274_q(p_176536_1_.func_180495_p(p_176536_2_));
+ private void tryCatchFire(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_, Direction face) {
+ int i = p_176536_1_.func_180495_p(p_176536_2_).getFlammability(p_176536_1_, p_176536_2_, face);
if (p_176536_4_.nextInt(p_176536_3_) < i) {
IBlockState iblockstate = p_176536_1_.func_180495_p(p_176536_2_);
BlockState blockstate = p_176536_1_.func_180495_p(p_176536_2_);
if (p_176536_4_.nextInt(p_176536_5_ + 10) < 5 && !p_176536_1_.func_175727_C(p_176536_2_)) {
@@ -204,7 +207,7 @@
@@ -199,7 +203,7 @@
private boolean func_196447_a(IBlockReader p_196447_1_, BlockPos p_196447_2_) {
for(EnumFacing enumfacing : EnumFacing.values()) {
- if (this.func_196446_i(p_196447_1_.func_180495_p(p_196447_2_.func_177972_a(enumfacing)))) {
+ if (this.canCatchFire(p_196447_1_, p_196447_2_.func_177972_a(enumfacing), enumfacing.func_176734_d())) {
for(Direction direction : Direction.values()) {
- if (this.func_196446_i(p_196447_1_.func_180495_p(p_196447_2_.func_177972_a(direction)))) {
+ if (this.canCatchFire(p_196447_1_, p_196447_2_.func_177972_a(direction), direction.func_176734_d())) {
return true;
}
}
@@ -219,7 +222,7 @@
int i = 0;
@@ -215,13 +219,14 @@
for(EnumFacing enumfacing : EnumFacing.values()) {
- i = Math.max(this.func_176534_d(p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(enumfacing)).func_177230_c()), i);
+ i = Math.max(p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(enumfacing)).getFlammability(p_176538_1_, p_176538_2_.func_177972_a(enumfacing), enumfacing.func_176734_d()), i);
for(Direction direction : Direction.values()) {
BlockState blockstate = p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(direction));
- i = Math.max(this.func_220275_r(blockstate), i);
+ i = Math.max(blockstate.getFlammability(p_176538_1_, p_176538_2_.func_177972_a(direction), direction.func_176734_d()), i);
}
return i;
@@ -230,6 +233,7 @@
return false;
}
}
+ @Deprecated //Forge: Use canCatchFire with more context
public boolean func_196446_i(IBlockState p_196446_1_) {
return this.func_176534_d(p_196446_1_.func_177230_c()) > 0;
public boolean func_196446_i(BlockState p_196446_1_) {
return this.func_220275_r(p_196446_1_) > 0;
}
@@ -252,8 +256,8 @@
p_180655_2_.func_184134_a((double)((float)p_180655_3_.func_177958_n() + 0.5F), (double)((float)p_180655_3_.func_177956_o() + 0.5F), (double)((float)p_180655_3_.func_177952_p() + 0.5F), SoundEvents.field_187643_bs, SoundCategory.BLOCKS, 1.0F + p_180655_4_.nextFloat(), p_180655_4_.nextFloat() * 0.7F + 0.3F, false);
}
@@ -246,8 +251,8 @@
- if (!p_180655_2_.func_180495_p(p_180655_3_.func_177977_b()).func_185896_q() && !this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177977_b()))) {
BlockPos blockpos = p_180655_3_.func_177977_b();
BlockState blockstate = p_180655_2_.func_180495_p(blockpos);
- if (!this.func_196446_i(blockstate) && !blockstate.func_224755_d(p_180655_2_, blockpos, Direction.UP)) {
- if (this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177976_e()))) {
+ if (p_180655_2_.func_180495_p(p_180655_3_.func_177977_b()).func_193401_d(p_180655_2_, p_180655_3_.func_177977_b(), EnumFacing.UP) != BlockFaceShape.SOLID && !this.canCatchFire(p_180655_2_, p_180655_3_.func_177977_b(), EnumFacing.UP)) {
+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177976_e(), EnumFacing.EAST)) {
+ if (!this.canCatchFire(p_180655_2_, blockpos, Direction.UP) && !Block.func_220056_d(blockstate, p_180655_2_, blockpos, Direction.UP)) {
+ if (this.canCatchFire(p_180655_2_, blockpos.func_177976_e(), Direction.EAST)) {
for(int j = 0; j < 2; ++j) {
double d3 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble() * (double)0.1F;
double d8 = (double)p_180655_3_.func_177956_o() + p_180655_4_.nextDouble();
@@ -262,7 +266,7 @@
@@ -256,7 +261,7 @@
}
}
- if (this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177974_f()))) {
+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177974_f(), EnumFacing.WEST)) {
+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177974_f(), Direction.WEST)) {
for(int k = 0; k < 2; ++k) {
double d4 = (double)(p_180655_3_.func_177958_n() + 1) - p_180655_4_.nextDouble() * (double)0.1F;
double d9 = (double)p_180655_3_.func_177956_o() + p_180655_4_.nextDouble();
@@ -271,7 +275,7 @@
@@ -265,7 +270,7 @@
}
}
- if (this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177978_c()))) {
+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177978_c(), EnumFacing.SOUTH)) {
+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177978_c(), Direction.SOUTH)) {
for(int l = 0; l < 2; ++l) {
double d5 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble();
double d10 = (double)p_180655_3_.func_177956_o() + p_180655_4_.nextDouble();
@@ -280,7 +284,7 @@
@@ -274,7 +279,7 @@
}
}
- if (this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177968_d()))) {
+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177968_d(), EnumFacing.NORTH)) {
+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177968_d(), Direction.NORTH)) {
for(int i1 = 0; i1 < 2; ++i1) {
double d6 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble();
double d11 = (double)p_180655_3_.func_177956_o() + p_180655_4_.nextDouble();
@@ -289,7 +293,7 @@
@@ -283,7 +288,7 @@
}
}
- if (this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177984_a()))) {
+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177984_a(), EnumFacing.DOWN)) {
+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177984_a(), Direction.DOWN)) {
for(int j1 = 0; j1 < 2; ++j1) {
double d7 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble();
double d12 = (double)(p_180655_3_.func_177956_o() + 1) - p_180655_4_.nextDouble() * (double)0.1F;
@@ -321,10 +325,23 @@
@@ -311,10 +316,23 @@
}
public void func_180686_a(Block p_180686_1_, int p_180686_2_, int p_180686_3_) {
@@ -179,10 +172,10 @@
+ * @param face The side the fire is coming from
+ * @return True if the face can catch fire.
+ */
+ public boolean canCatchFire(IBlockReader world, BlockPos pos, EnumFacing face) {
+ public boolean canCatchFire(IBlockReader world, BlockPos pos, Direction face) {
+ return world.func_180495_p(pos).isFlammable(world, pos, face);
+ }
+
public static void func_149843_e() {
BlockFire blockfire = (BlockFire)Blocks.field_150480_ab;
blockfire.func_180686_a(Blocks.field_196662_n, 5, 20);
FireBlock fireblock = (FireBlock)Blocks.field_150480_ab;
fireblock.func_180686_a(Blocks.field_196662_n, 5, 20);
@@ -1,9 +1,9 @@
--- a/net/minecraft/block/BlockFlowerPot.java
+++ b/net/minecraft/block/BlockFlowerPot.java
@@ -22,7 +22,7 @@
--- a/net/minecraft/block/FlowerPotBlock.java
+++ b/net/minecraft/block/FlowerPotBlock.java
@@ -19,7 +19,7 @@
import net.minecraft.world.World;
public class BlockFlowerPot extends Block {
public class FlowerPotBlock extends Block {
- private static final Map<Block, Block> field_196451_b = Maps.newHashMap();
+ private static final Map<Block, Block> field_196451_b = Maps.newHashMap(); //TODO: Delegates
protected static final VoxelShape field_196450_a = Block.func_208617_a(5.0D, 0.0D, 5.0D, 11.0D, 6.0D, 11.0D);
@@ -0,0 +1,84 @@
--- a/net/minecraft/block/FlowingFluidBlock.java
+++ b/net/minecraft/block/FlowingFluidBlock.java
@@ -30,9 +30,11 @@
public class FlowingFluidBlock extends Block implements IBucketPickupHandler {
public static final IntegerProperty field_176367_b = BlockStateProperties.field_208132_ag;
- protected final FlowingFluid field_204517_c;
+ private final FlowingFluid field_204517_c;
private final List<IFluidState> field_212565_c;
+ // Forge: Use the constructor that takes a supplier
+ @Deprecated
protected FlowingFluidBlock(FlowingFluid p_i49014_1_, Block.Properties p_i49014_2_) {
super(p_i49014_2_);
this.field_204517_c = p_i49014_1_;
@@ -45,8 +47,21 @@
this.field_212565_c.add(p_i49014_1_.func_207207_a(8, true));
this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176367_b, Integer.valueOf(0)));
+ fluidStateCacheInitialized = true;
+ supplier = p_i49014_1_.delegate;
}
+ /**
+ * @param supplier A fluid supplier such as {@link net.minecraftforge.fml.RegistryObject<Fluid>}
+ */
+ public FlowingFluidBlock(java.util.function.Supplier<? extends FlowingFluid> supplier, Block.Properties p_i48368_1_) {
+ super(p_i48368_1_);
+ this.field_204517_c = null;
+ this.field_212565_c = Lists.newArrayList();
+ this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176367_b, Integer.valueOf(0)));
+ this.supplier = supplier;
+ }
+
public void func_196265_a(BlockState p_196265_1_, World p_196265_2_, BlockPos p_196265_3_, Random p_196265_4_) {
p_196265_2_.func_204610_c(p_196265_3_).func_206891_b(p_196265_2_, p_196265_3_, p_196265_4_);
}
@@ -61,6 +76,7 @@
public IFluidState func_204507_t(BlockState p_204507_1_) {
int i = p_204507_1_.func_177229_b(field_176367_b);
+ if (!fluidStateCacheInitialized) initFluidStateCache();
return this.field_212565_c.get(Math.min(i, 8));
}
@@ -121,13 +137,13 @@
if (flag) {
IFluidState ifluidstate = p_204515_1_.func_204610_c(p_204515_2_);
if (ifluidstate.func_206889_d()) {
- p_204515_1_.func_175656_a(p_204515_2_, Blocks.field_150343_Z.func_176223_P());
+ p_204515_1_.func_175656_a(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, Blocks.field_150343_Z.func_176223_P()));
this.func_180688_d(p_204515_1_, p_204515_2_);
return false;
}
if (ifluidstate.func_215679_a(p_204515_1_, p_204515_2_) >= 0.44444445F) {
- p_204515_1_.func_175656_a(p_204515_2_, Blocks.field_150347_e.func_176223_P());
+ p_204515_1_.func_175656_a(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, Blocks.field_150347_e.func_176223_P()));
this.func_180688_d(p_204515_1_, p_204515_2_);
return false;
}
@@ -160,4 +176,22 @@
}
}
+
+ // Forge start
+ private final java.util.function.Supplier<? extends Fluid> supplier;
+ public FlowingFluid getFluid() {
+ return (FlowingFluid)supplier.get();
+ }
+
+ private boolean fluidStateCacheInitialized;
+ protected void initFluidStateCache() {
+ this.field_212565_c.add(getFluid().func_207204_a(false));
+
+ for(int i = 1; i < 8; ++i) {
+ this.field_212565_c.add(getFluid().func_207207_a(8 - i, false));
+ }
+
+ this.field_212565_c.add(getFluid().func_207207_a(8, true));
+ fluidStateCacheInitialized = true;
+ }
}
@@ -4,7 +4,7 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
+@Deprecated //Forge: Do not use, use IBlockState.hasTileEntity/Blocks.createTileEntity
+@Deprecated //Forge: Do not use, use BlockState.hasTileEntity/Block.createTileEntity
public interface ITileEntityProvider {
@Nullable
TileEntity func_196283_a_(IBlockReader p_196283_1_);
@@ -0,0 +1,14 @@
--- a/net/minecraft/block/LadderBlock.java
+++ b/net/minecraft/block/LadderBlock.java
@@ -94,6 +94,11 @@
return null;
}
+ @Override
+ public boolean isLadder(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, net.minecraft.entity.LivingEntity entity) {
+ return true;
+ }
+
public BlockRenderLayer func_180664_k() {
return BlockRenderLayer.CUTOUT;
}
@@ -0,0 +1,11 @@
--- a/net/minecraft/block/LeavesBlock.java
+++ b/net/minecraft/block/LeavesBlock.java
@@ -18,7 +18,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class LeavesBlock extends Block {
+public class LeavesBlock extends Block implements net.minecraftforge.common.IShearable {
public static final IntegerProperty field_208494_a = BlockStateProperties.field_208514_aa;
public static final BooleanProperty field_208495_b = BlockStateProperties.field_208515_s;
protected static boolean field_196478_c;
@@ -0,0 +1,11 @@
--- a/net/minecraft/block/MushroomBlock.java
+++ b/net/minecraft/block/MushroomBlock.java
@@ -62,7 +62,7 @@
BlockState blockstate = p_196260_2_.func_180495_p(blockpos);
Block block = blockstate.func_177230_c();
if (block != Blocks.field_150391_bh && block != Blocks.field_196661_l) {
- return p_196260_2_.func_201669_a(p_196260_3_, 0) < 13 && this.func_200014_a_(blockstate, p_196260_2_, blockpos);
+ return p_196260_2_.func_201669_a(p_196260_3_, 0) < 13 && blockstate.canSustainPlant(p_196260_2_, blockpos, net.minecraft.util.Direction.UP, this);
} else {
return true;
}
@@ -0,0 +1,11 @@
--- a/net/minecraft/block/NetherPortalBlock.java
+++ b/net/minecraft/block/NetherPortalBlock.java
@@ -69,7 +69,7 @@
public boolean func_176548_d(IWorld p_176548_1_, BlockPos p_176548_2_) {
NetherPortalBlock.Size netherportalblock$size = this.func_201816_b(p_176548_1_, p_176548_2_);
- if (netherportalblock$size != null) {
+ if (netherportalblock$size != null && !net.minecraftforge.event.ForgeEventFactory.onTrySpawnPortal(p_176548_1_, p_176548_2_, netherportalblock$size)) {
netherportalblock$size.func_150859_c();
return true;
} else {
@@ -0,0 +1,14 @@
--- a/net/minecraft/block/NetherWartBlock.java
+++ b/net/minecraft/block/NetherWartBlock.java
@@ -31,9 +31,10 @@
public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
int i = p_196267_1_.func_177229_b(field_176486_a);
- if (i < 3 && p_196267_4_.nextInt(10) == 0) {
+ if (i < 3 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_.nextInt(10) == 0)) {
p_196267_1_ = p_196267_1_.func_206870_a(field_176486_a, Integer.valueOf(i + 1));
p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_, 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_);
}
super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_);
@@ -1,5 +1,5 @@
--- a/net/minecraft/block/BlockNote.java
+++ b/net/minecraft/block/BlockNote.java
--- a/net/minecraft/block/NoteBlock.java
+++ b/net/minecraft/block/NoteBlock.java
@@ -49,7 +49,7 @@
}
@@ -10,23 +10,23 @@
}
@@ -59,7 +59,9 @@
if (p_196250_2_.field_72995_K) {
if (p_220051_2_.field_72995_K) {
return true;
} else {
- p_196250_1_ = p_196250_1_.func_177231_a(field_196485_c);
+ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(p_196250_2_, p_196250_3_, p_196250_1_, p_196250_1_.func_177229_b(field_196485_c), p_196250_1_.func_177231_a(field_196485_c).func_177229_b(field_196485_c));
- p_220051_1_ = p_220051_1_.func_177231_a(field_196485_c);
+ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(p_220051_2_, p_220051_3_, p_220051_1_, p_220051_1_.func_177229_b(field_196485_c), p_220051_1_.func_177231_a(field_196485_c).func_177229_b(field_196485_c));
+ if (_new == -1) return false;
+ p_196250_1_ = (IBlockState)p_196250_1_.func_206870_a(field_196485_c, _new);
p_196250_2_.func_180501_a(p_196250_3_, p_196250_1_, 3);
this.func_196482_a(p_196250_2_, p_196250_3_);
p_196250_4_.func_195066_a(StatList.field_188087_U);
+ p_220051_1_ = (BlockState)p_220051_1_.func_206870_a(field_196485_c, _new);
p_220051_2_.func_180501_a(p_220051_3_, p_220051_1_, 3);
this.func_196482_a(p_220051_2_, p_220051_3_);
p_220051_4_.func_195066_a(Stats.field_188087_U);
@@ -75,6 +77,9 @@
}
public boolean func_189539_a(IBlockState p_189539_1_, World p_189539_2_, BlockPos p_189539_3_, int p_189539_4_, int p_189539_5_) {
public boolean func_189539_a(BlockState p_189539_1_, World p_189539_2_, BlockPos p_189539_3_, int p_189539_4_, int p_189539_5_) {
+ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(p_189539_2_, p_189539_3_, p_189539_1_, p_189539_1_.func_177229_b(field_196485_c), p_189539_1_.func_177229_b(field_196483_a));
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false;
+ p_189539_1_ = p_189539_1_.func_206870_a(field_196485_c, e.getVanillaNoteId()).func_206870_a(field_196483_a, e.getInstrument());
int i = p_189539_1_.func_177229_b(field_196485_c);
float f = (float)Math.pow(2.0D, (double)(i - 12) / 12.0D);
p_189539_2_.func_184133_a((EntityPlayer)null, p_189539_3_, p_189539_1_.func_177229_b(field_196483_a).func_208088_a(), SoundCategory.RECORDS, 3.0F, f);
p_189539_2_.func_184133_a((PlayerEntity)null, p_189539_3_, p_189539_1_.func_177229_b(field_196483_a).func_208088_a(), SoundCategory.RECORDS, 3.0F, f);
@@ -0,0 +1,19 @@
--- a/net/minecraft/block/OreBlock.java
+++ b/net/minecraft/block/OreBlock.java
@@ -29,12 +29,10 @@
public void func_220062_a(BlockState p_220062_1_, World p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) {
super.func_220062_a(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_);
- if (EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_220062_4_) == 0) {
- int i = this.func_220281_a(p_220062_2_.field_73012_v);
- if (i > 0) {
- this.func_180637_b(p_220062_2_, p_220062_3_, i);
- }
- }
+ }
+ @Override
+ public int getExpDrop(BlockState state, net.minecraft.world.IWorldReader reader, BlockPos pos, int fortune, int silktouch) {
+ return silktouch == 0 ? this.func_220281_a(RANDOM) : 0;
}
}
@@ -0,0 +1,64 @@
--- a/net/minecraft/block/PistonBlock.java
+++ b/net/minecraft/block/PistonBlock.java
@@ -166,6 +166,7 @@
}
if (p_189539_4_ == 0) {
+ if(net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(p_189539_2_, p_189539_3_, direction, true)) return false;
if (!this.func_176319_a(p_189539_2_, p_189539_3_, direction, true)) {
return false;
}
@@ -173,6 +174,7 @@
p_189539_2_.func_180501_a(p_189539_3_, p_189539_1_.func_206870_a(field_176320_b, Boolean.valueOf(true)), 67);
p_189539_2_.func_184133_a((PlayerEntity)null, p_189539_3_, SoundEvents.field_187715_dR, SoundCategory.BLOCKS, 0.5F, p_189539_2_.field_73012_v.nextFloat() * 0.25F + 0.6F);
} else if (p_189539_4_ == 1 || p_189539_4_ == 2) {
+ if(net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(p_189539_2_, p_189539_3_, direction, false)) return false;
TileEntity tileentity1 = p_189539_2_.func_175625_s(p_189539_3_.func_177972_a(direction));
if (tileentity1 instanceof PistonTileEntity) {
((PistonTileEntity)tileentity1).func_145866_f();
@@ -197,7 +199,7 @@
}
if (!flag1) {
- if (p_189539_4_ != 1 || blockstate.func_196958_f() || !func_185646_a(blockstate, p_189539_2_, blockpos, direction.func_176734_d(), false, direction) || blockstate.func_185905_o() != PushReaction.NORMAL && block != Blocks.field_150331_J && block != Blocks.field_150320_F) {
+ if (p_189539_4_ != 1 || blockstate.isAir(p_189539_2_, blockpos) || !func_185646_a(blockstate, p_189539_2_, blockpos, direction.func_176734_d(), false, direction) || blockstate.func_185905_o() != PushReaction.NORMAL && block != Blocks.field_150331_J && block != Blocks.field_150320_F) {
p_189539_2_.func_217377_a(p_189539_3_.func_177972_a(direction), false);
} else {
this.func_176319_a(p_189539_2_, p_189539_3_, direction, false);
@@ -210,6 +212,7 @@
p_189539_2_.func_184133_a((PlayerEntity)null, p_189539_3_, SoundEvents.field_187712_dQ, SoundCategory.BLOCKS, 0.5F, p_189539_2_.field_73012_v.nextFloat() * 0.15F + 0.6F);
}
+ net.minecraftforge.event.ForgeEventFactory.onPistonMovePost(p_189539_2_, p_189539_3_, direction, (p_189539_4_ == 0));
return true;
}
@@ -238,7 +241,7 @@
return false;
}
- return !block.func_149716_u();
+ return !p_185646_0_.hasTileEntity();
} else {
return false;
}
@@ -274,7 +277,7 @@
for(int j = list2.size() - 1; j >= 0; --j) {
BlockPos blockpos2 = list2.get(j);
BlockState blockstate = p_176319_1_.func_180495_p(blockpos2);
- TileEntity tileentity = blockstate.func_177230_c().func_149716_u() ? p_176319_1_.func_175625_s(blockpos2) : null;
+ TileEntity tileentity = blockstate.hasTileEntity() ? p_176319_1_.func_175625_s(blockpos2) : null;
func_220059_a(blockstate, p_176319_1_, blockpos2, tileentity);
p_176319_1_.func_180501_a(blockpos2, Blocks.field_150350_a.func_176223_P(), 18);
--k;
@@ -328,6 +331,10 @@
return p_185499_1_.func_206870_a(field_176387_N, p_185499_2_.func_185831_a(p_185499_1_.func_177229_b(field_176387_N)));
}
+ public BlockState rotate(BlockState state, net.minecraft.world.IWorld world, BlockPos pos, Rotation direction) {
+ return state.func_177229_b(field_176320_b) ? state : super.rotate(state, world, pos, direction);
+ }
+
public BlockState func_185471_a(BlockState p_185471_1_, Mirror p_185471_2_) {
return p_185471_1_.func_185907_a(p_185471_2_.func_185800_a(p_185471_1_.func_177229_b(field_176387_N)));
}
@@ -0,0 +1,37 @@
--- a/net/minecraft/block/PoweredRailBlock.java
+++ b/net/minecraft/block/PoweredRailBlock.java
@@ -14,10 +14,16 @@
public class PoweredRailBlock extends AbstractRailBlock {
public static final EnumProperty<RailShape> field_176568_b = BlockStateProperties.field_208166_S;
public static final BooleanProperty field_176569_M = BlockStateProperties.field_208194_u;
+ private final boolean isActivator;
protected PoweredRailBlock(Block.Properties p_i48349_1_) {
- super(true, p_i48349_1_);
+ this(p_i48349_1_, false);
+ }
+
+ protected PoweredRailBlock(Block.Properties builder, boolean isActivator) {
+ super(true, builder);
this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176568_b, RailShape.NORTH_SOUTH).func_206870_a(field_176569_M, Boolean.valueOf(false)));
+ this.isActivator = isActivator;
}
protected boolean func_176566_a(World p_176566_1_, BlockPos p_176566_2_, BlockState p_176566_3_, boolean p_176566_4_, int p_176566_5_) {
@@ -99,13 +105,13 @@
protected boolean func_208071_a(World p_208071_1_, BlockPos p_208071_2_, boolean p_208071_3_, int p_208071_4_, RailShape p_208071_5_) {
BlockState blockstate = p_208071_1_.func_180495_p(p_208071_2_);
- if (blockstate.func_177230_c() != this) {
+ if (!(blockstate.func_177230_c() instanceof PoweredRailBlock)) {
return false;
} else {
- RailShape railshape = blockstate.func_177229_b(field_176568_b);
+ RailShape railshape = getRailDirection(blockstate, p_208071_1_, p_208071_2_, null);
if (p_208071_5_ != RailShape.EAST_WEST || railshape != RailShape.NORTH_SOUTH && railshape != RailShape.ASCENDING_NORTH && railshape != RailShape.ASCENDING_SOUTH) {
if (p_208071_5_ != RailShape.NORTH_SOUTH || railshape != RailShape.EAST_WEST && railshape != RailShape.ASCENDING_EAST && railshape != RailShape.ASCENDING_WEST) {
- if (blockstate.func_177229_b(field_176569_M)) {
+ if (isActivator == ((PoweredRailBlock)blockstate.func_177230_c()).isActivator) {
return p_208071_1_.func_175640_z(p_208071_2_) ? true : this.func_176566_a(p_208071_1_, p_208071_2_, blockstate, p_208071_3_, p_208071_4_ + 1);
} else {
return false;
@@ -1,16 +1,16 @@
--- a/net/minecraft/block/BlockRailState.java
+++ b/net/minecraft/block/BlockRailState.java
@@ -16,14 +16,16 @@
private IBlockState field_196923_d;
--- a/net/minecraft/block/RailState.java
+++ b/net/minecraft/block/RailState.java
@@ -15,14 +15,16 @@
private BlockState field_196923_d;
private final boolean field_208513_e;
private final List<BlockPos> field_196924_e = Lists.newArrayList();
+ private final boolean canMakeSlopes;
public BlockRailState(World p_i47755_1_, BlockPos p_i47755_2_, IBlockState p_i47755_3_) {
public RailState(World p_i47755_1_, BlockPos p_i47755_2_, BlockState p_i47755_3_) {
this.field_196920_a = p_i47755_1_;
this.field_196921_b = p_i47755_2_;
this.field_196923_d = p_i47755_3_;
this.field_196922_c = (BlockRailBase)p_i47755_3_.func_177230_c();
this.field_196922_c = (AbstractRailBlock)p_i47755_3_.func_177230_c();
- RailShape railshape = p_i47755_3_.func_177229_b(this.field_196922_c.func_176560_l());
- this.field_208513_e = this.field_196922_c.func_208490_b();
+ RailShape railshape = this.field_196922_c.getRailDirection(field_196923_d, p_i47755_1_, p_i47755_2_, null);
@@ -19,39 +19,39 @@
this.func_208509_a(railshape);
}
@@ -179,7 +181,7 @@
@@ -178,7 +180,7 @@
}
}
- if (railshape == RailShape.NORTH_SOUTH) {
+ if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) {
if (BlockRailBase.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) {
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) {
railshape = RailShape.ASCENDING_NORTH;
}
@@ -189,7 +191,7 @@
@@ -188,7 +190,7 @@
}
}
- if (railshape == RailShape.EAST_WEST) {
+ if (railshape == RailShape.EAST_WEST && canMakeSlopes) {
if (BlockRailBase.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) {
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) {
railshape = RailShape.ASCENDING_EAST;
}
@@ -299,7 +301,7 @@
@@ -298,7 +300,7 @@
}
}
- if (railshape == RailShape.NORTH_SOUTH) {
+ if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) {
if (BlockRailBase.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) {
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) {
railshape = RailShape.ASCENDING_NORTH;
}
@@ -309,7 +311,7 @@
@@ -308,7 +310,7 @@
}
}
- if (railshape == RailShape.EAST_WEST) {
+ if (railshape == RailShape.EAST_WEST && canMakeSlopes) {
if (BlockRailBase.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) {
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) {
railshape = RailShape.ASCENDING_EAST;
}
@@ -0,0 +1,28 @@
--- a/net/minecraft/block/RedstoneDiodeBlock.java
+++ b/net/minecraft/block/RedstoneDiodeBlock.java
@@ -65,7 +65,7 @@
if (p_220069_1_.func_196955_c(p_220069_2_, p_220069_3_)) {
this.func_176398_g(p_220069_2_, p_220069_3_, p_220069_1_);
} else {
- TileEntity tileentity = this.func_149716_u() ? p_220069_2_.func_175625_s(p_220069_3_) : null;
+ TileEntity tileentity = p_220069_1_.hasTileEntity() ? p_220069_2_.func_175625_s(p_220069_3_) : null;
func_220059_a(p_220069_1_, p_220069_2_, p_220069_3_, tileentity);
p_220069_2_.func_217377_a(p_220069_3_, false);
@@ -164,6 +164,8 @@
protected void func_176400_h(World p_176400_1_, BlockPos p_176400_2_, BlockState p_176400_3_) {
Direction direction = p_176400_3_.func_177229_b(field_185512_D);
BlockPos blockpos = p_176400_2_.func_177972_a(direction.func_176734_d());
+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(p_176400_1_, p_176400_2_, p_176400_1_.func_180495_p(p_176400_2_), java.util.EnumSet.of(direction.func_176734_d()), false).isCanceled())
+ return;
p_176400_1_.func_190524_a(blockpos, this, p_176400_2_);
p_176400_1_.func_175695_a(blockpos, this, direction);
}
@@ -171,7 +173,6 @@
protected boolean func_185545_A(BlockState p_185545_1_) {
return p_185545_1_.func_185897_m();
}
-
protected int func_176408_a(IBlockReader p_176408_1_, BlockPos p_176408_2_, BlockState p_176408_3_) {
return 15;
}
Loaded 100 of 1726 files, more files were not shown because too many files have changed in this diff. Show more