Compare commits

...
362 Commits
Author SHA1 Message Date
Spectrall b3426008d3 Fix ForgeDev run configs, and bump ForgeGradle (#10613) 2025-08-11 13:09:36 -07:00
embeddedt 54233da14c Generate SRG named redirects for TransformationMatrix methods in userdev (#9883) 2024-03-05 11:11:20 -08:00
embeddedt ed3ac8a122 [1.16.5] Update more parts of the toolchain (#9825)
* ForgeGradle 6, Gradle 8.4, ASM 9.6
* Apply official mappings to patches (still using MCP classnames)
* Remove reference to SpecialSource in reobfJar-like tasks
* Backport modern MDK
* Rename TransformationMatrix methods to prevent reobf, add back vanilla name via coremod
2023-12-20 10:49:06 -08:00
embeddedt 201b0b8695 Add modern TeamCity workflows & checks, backports some gradle stuff from 1.18.x branch (#9821) 2023-12-18 15:11:26 -08:00
Meldexun 09f1b8d438 [1.16] Fix EntityEvent.Size not being fired (#8668) 2022-07-17 15:23:51 +01:00
Aeronica 0403cc8147 [1.16] Allow sound instances to customize stream source (#8595) 2022-06-05 15:48:51 +01:00
Meldexun 9a21260575 [1.16] Fix entity parts being ignored when collecting entities in an AABB (#8606)
Previously entity parts are only taken into consideration when the parent entity is in a chunk that intersects with the AABB
2022-06-05 15:29:23 +01:00
Meldexun a4ca2c69f0 [1.16] Fix inconsistency of multipart entity ids (#8605) 2022-06-05 15:29:07 +01:00
Curle 4e47eab41e Update Licenses 2022-05-03 20:22:56 +01:00
Paint_Ninja fb5f2ea750 Add Gzip support to version checker (partial backport of #8148 from 1.17) (#8567) 2022-04-12 09:39:37 -07:00
ChampionAsh5357 18ca2e9b78 Readd patch (#7125) 2022-03-23 02:02:23 +01:00
Martijn van den Brand ad8bc658bb Account for /forge setdimension command arguments (#7971)
Use the `/forge setdimension` command 'targets' argument and provide a default for the 'pos' argument as it's optional
2022-03-23 01:58:35 +01:00
Gabriel Harris-Rouquette 3b54aea224 Clear local variable table on RuntimeEnumExtender transformation (#8340)
Signed-off-by: Gabriel Harris-Rouquette <[email protected]>
2022-03-13 21:51:40 +01:00
mezz e81a984165 Prevent setting window icon on OSX (#8468) 2022-03-08 00:15:08 +00:00
sciwhiz12 5fc5f15cc6 [1.16] Fix entity type in conversion event to Drowned (#8480) 2022-02-25 01:03:37 +00:00
sciwhiz12 cae822ced9 Fix climbable hook to set lastClimbablePos field. Fixes #8370 (#8373) 2022-02-12 09:30:55 -08:00
sciwhiz12 07aba06d59 Merge values of defaulted optional tags (#8304)
This fixes an error when a defaulted optional tag is defined in multiple places, eventually causing duplicate values in a map collector which then throws an exception.
2022-02-12 09:29:51 -08:00
SizableShrimp 2b6fbf6697 Bump ModLauncher to 8.1.3 (#8423)
Signed-off-by: SizableShrimp <[email protected]>
2022-02-02 10:30:30 -05:00
cpw e23e94ccfe fix to use legacy keystore as java 8 doesn't support newer keystores generated by java 16 by default
Signed-off-by: cpw <[email protected]>
2022-02-02 10:07:23 -05:00
Marc Hermans 83faa98df9 Implement teamcity project building on 1.16.z branch (#8440) 2022-02-01 10:32:28 -08:00
Take Weiland ed1f83047c ALso create parent directories when creating empty config files, 1.16 redux (#8366) 2022-01-08 19:08:42 +00:00
Jared 17522788d7 (1.16) Fixed KeyMappings only checking if they conflict with themselves. (#8257) 2021-12-14 21:02:58 +01:00
Sara Freimer e872587906 Backport #8254 to 1.16.5: Add RenderArmEvent to make overriding just the arm rendering not require copying nearly as much vanilla code (#8299) 2021-12-14 20:50:18 +01:00
Marc Hermans f998289776 [CVE-2021-44228]: Update Log4J to fix the security issue inside it (#8270) 2021-12-10 01:59:45 -08:00
DaemonUmbra 5a2c7aa0a2 Fix potential issue with BackgroundScanHandler for users with slow disc IO (#8211) 2021-11-23 18:13:52 -08:00
Sara Freimer ae7609979e Backport #8207 to 1.16 (#8209) 2021-11-22 22:19:02 +01:00
Dennis C 53873dd3d0 [1.16.x] Add ForgeSpawnEggItem to lazily handle EntityTypes (#8150)
* Add ForgeSpawnEggItem to lazily handle EntityTypes

* Remove OnlyIn

* Surround EntityType#spawn() call with try/catch
2021-11-22 21:46:38 +01:00
Unbekannt1998 6568649965 change the AdvancementProvider to make it possabible for mods to hook into it (#7488)
* back Port changes from #8120
2021-11-20 16:44:54 +01:00
Marc Hermans 111d3ec5d5 Implements Lazy ItemStack Capabilities (#7879) 2021-11-20 16:33:00 +01:00
Dennis C 2c36b306a4 Pass IModelData through IForgeBakedModel#getModelData() before asking the IBakedModel for the particle texture (#8107) 2021-11-20 15:52:26 +01:00
Dennis C 56f4300117 [1.16.x] Fix blocks with flammable material catching fire from lava when they are marked as non-flammable (#8161) 2021-11-20 15:30:05 +01:00
Dennis C 62a4329c7d [1.16] Add accessor to an unmodifiable view of the fullPots map in FlowerPotBlock (#8109)
* Add accessor to an unmodifiable view of the fullPots map in FlowerPotBlock

* Fix non-empty pot check

* Remove exception from getter and add test mod
2021-11-20 15:16:50 +01:00
ChampionAsh5357 38a7ffbc0d Ensure that all render targets in a PostChain use the same format (#8138)
Fixes #6995
2021-11-20 14:56:05 +01:00
ChampionAsh5357 4610784443 Make Broken Blocks Display Associated FluidState (#8129)
Fixes #7253 for 1.16.x
2021-11-20 14:42:38 +01:00
gigaherz 0ecc6c6359 Implement GUI Stacking feature. (#6927)
* Implement GUI Stacking feature.
You can now use `mc.pushGuiLayer` and `mc.popGuiLayer` to manage the layers.
mc.displayGuiScreen behaves such that if called with a non-null screen it replaces the entire stack, and if called with null it closes the entire stack.

* Apply review comment fixes from 1.17 counterpart.

* Revert unintended changes.

* Missed these reverts.
2021-11-04 17:39:38 +10:30
sciwhiz12 9ef34a9f1a Add workaround for pairs of ' being stripped (#8074)
Backport of #8050
2021-10-03 18:51:40 +02:00
iTitus acf871f934 Fix typo in FluidBlockWrapper (#7880) 2021-10-03 18:38:27 +02:00
brandon3055 a8b2ade614 Backport MC-209819 (#7923)
Backport fix for mc bug https://bugs.mojang.com/browse/MC-209819
2021-09-27 22:24:38 +02:00
zml 854f4deb04 [1.16.5] Bump Mixin to 0.8.4 (#8098) 2021-09-19 16:50:00 -07:00
Silver_David 083624fb67 [1.16.5] Backport OnDatapackSyncEvent from 1.17.1 (#7985) 2021-08-31 18:32:27 +02:00
sciwhiz12 c5725d1c61 [1.16.x] Fix all layers of ItemLayerModel being fullbright (#8040)
* Fix all layers of ItemLayerModel being fullbright

Backport of #8039

* Remove duplicate test resources

These resources have corresponding equivalents in the generated tests
resources folder.
2021-08-31 17:34:46 +02:00
OneLemonyBoi a2bd95ca39 Fix rounding related errors with small entity pathfinding. Closes #7730 2021-07-26 14:36:46 -07:00
SuperMartijn642 98bae44a3a Pass the 'includeName' flag to the ItemTossEvent (#7758) 2021-07-24 16:54:24 +02:00
LexManos 064ae6961b New 1.16.5 RB. 2021-07-21 18:25:45 -07:00
SizableShrimp 22d609ed6c ForgeGradle 5.1 and Gradle 7, which allows development on J16. Runtime still targets J8. (#7877) 2021-07-21 14:21:09 -07:00
LexManos 315bbb74ff Work around javac scoping issue. 2021-07-19 21:55:46 -07:00
LexManos 4e4d31b68c Fix LAN worlds where registry entries have been removed. 2021-07-19 21:15:26 -07:00
William Bradford Larcombe 1a17fa6129 Fix FakePlayers having null connection and add FakePlayer test mod (#7733) 2021-07-19 12:54:42 -07:00
AterAnimAvis ca9df21258 Use '{assets_root}' rather than task output path for userdev config (#7873)
Signed-off-by: AterAnimAvis <[email protected]>
2021-07-17 18:23:30 +02:00
Silk 93d7fa54fc Fix missing userdev config for datagen runs (#7871)
Signed-off-by: TheSilkMiner <[email protected]>
2021-07-17 13:14:38 +02:00
Bailey Hollingsworth f235d80d9f Adds a damage float in Lightning Entity and patches Entity to use it. (#7849) 2021-07-16 20:12:40 -07:00
Mike Garay be34dd89a9 Patch several mob classes to let them use modded versions of their ranged weapons (#7845) 2021-07-16 20:12:33 -07:00
AwesomeSyd239 6663f23e13 Add Fishing bobber projectile impact event (#7842) 2021-07-16 19:41:51 -07:00
OneLemonyBoi f9f7ef2580 Removes misapplied patch in Entity (#7841) 2021-07-16 19:38:56 -07:00
OneLemonyBoi 86352e9c19 Removes misleading Nullable annotation from canCreatureSpawn (#7840) 2021-07-16 19:38:06 -07:00
OneLemonyBoi 8c8b31435b Corrects the assigning of mob kills, Fixes MC-121048 (#7836) 2021-07-16 19:37:12 -07:00
OneLemonyBoi 16b3e2780e Updates MouseHelper to allow for Horizontal Scroll to be recognized as Vertical Scroll (#7834) 2021-07-16 19:31:14 -07:00
Take Weiland 1121f18413 Fix entities losing their scoreboard data when they are unloaded (#7826) 2021-07-16 19:24:29 -07:00
Take Weiland 96804fb4df [1.16] Allow blocks other than beds or respawn anchors to act as respawn points (#7824) 2021-07-16 19:23:36 -07:00
LexManos 03a6dbb405 Regen patches 2021-07-16 19:12:38 -07:00
Won-Ton 77e8c72589 Add AT entries for DimensionSettings to make them easier for mods to work with (#7817) 2021-07-16 18:03:56 -07:00
cech12 043e49a694 New hook to allow Trapdoors be climbable for custom ladders (#7816) 2021-07-16 18:01:27 -07:00
King Lemming 5169f1f6fe Convenience change for potion enumeration - does not change patch size in any meaningful way! (#7811) 2021-07-16 17:56:08 -07:00
Mike Garay 2bd83b26aa Adds knockback attribute to players and updated knockback calculation to PlayerEntity#attack (#7806) 2021-07-16 17:52:58 -07:00
Sekwah e6c1814122 Fix mod menu URL click bounds (#7804) 2021-07-16 17:51:11 -07:00
Daniel Houck 7f2892de7e Fix vanilla rotation/mirroring issues (#7803)
Patch minecraft to fix MC-227255 and MC-134110, which are block
rotation and mirroring issues.  I noticed this from problems with
Structurize, but this probably affects any other mods that allow
rotating or mirroring structures (as well as vanilla structure blocks).
2021-07-16 17:50:29 -07:00
PersonTheCat 439ba462d6 Synchronize ResourcePackList#addPackFinder (#7799) 2021-07-16 17:48:10 -07:00
mikewk 7c6ae3e61e Fixes tryFluidTransfer_Internal to respect the FluidStack drainable when draining fluidSource. (#7782) 2021-07-16 17:45:39 -07:00
Take Weiland f9b894ecbf Add IRecipeType parameter to burn time hooks (#7771) 2021-07-16 17:37:41 -07:00
Andy Dingley df53db351e Use MobGriefingEvent for PiglinEntity when determining whether Piglins want to pick up items. (#7762) 2021-07-16 17:35:24 -07:00
Andy Dingley 9aa04c8036 [1.16.x] Remove redundant mobgriefing check in SmallFireaballEntity. (#7761) 2021-07-16 17:33:59 -07:00
Queekusme 626496cec0 Changed AbstractFurnaceTileEntity's canBurn and burn functions to use IRecipe's 'assemble' instead of 'getResultItem' (#7756) 2021-07-16 17:33:02 -07:00
covers1624 022482a3bd Bypass chunk future chain when processing loads and getChunk called. (#7697) 2021-07-16 17:26:45 -07:00
DaemonUmbra dd228a9ac1 Removed sidedness from PacketBuffer methods. (#7236)
Affected methods:
* readLongArray (x2)
* readSectionPos
* readString (no-arg variant)
2021-07-16 17:25:11 -07:00
Silk a6d1646591 Add data generators for sounds.json (#6982) 2021-07-16 17:24:16 -07:00
Take Weiland 39f9f393db Add custom TextureAtlasSprite loaders (#7822)
Adds a system for mods to specify custom texture loaders which can be requested by the resource pack through a metadata section in the .mcmeta file. Due to technical reasons, png file is still required for MC to identify a texture as existing, even if the loader doesn't use it.
2021-07-16 01:55:43 +02:00
Commoble d35784eb14 Fix PlayerGameModeEventTest and ForgeWorldTypeTest so they don't crash the dedicated server when running forge_test_server in forgedev (#7869) 2021-07-15 16:40:07 -07:00
LexManos 31fb15c88d Add userdev to run config. 2021-07-13 18:15:54 -07:00
Take Weiland 29f175743b Add truncation to FMLStatusPing to work around protocol limits (#7818) 2021-06-16 19:23:20 -07:00
SizableShrimp 33499db93f Remove ModelResourceLocation patch for SAS entry (#7813) 2021-06-09 09:35:03 -07:00
Take Weiland 84381553a9 Fix jar file path detection if the path contains a "!" (#7790) 2021-06-08 13:26:01 -07:00
mrp-v2 2a7dde3d2e Add method to get the number of elements in a model builder (#7792) 2021-06-08 12:49:25 -07:00
Take Weiland aa4f24c915 Fix vanilla packet splitter remote detection and add advancement packet splitting (#7802) 2021-06-08 12:47:37 -07:00
Nightenom 1d87831773 Add option for linear filtering of text texture (#7645) 2021-06-08 21:33:31 +02:00
mrp-v2 65e99f9b58 Use empty model instead of missing model for non-existant layers in multilayer models (#7750)
Fixes issues when using multi-layer models as part of composite models
2021-06-08 21:07:33 +02:00
LexManos b98991dc70 Add debug logging to packet compression encoder.
Should make figuring out who is sending large packets easier.
Disable with -Pforge.disablePacketCompressionDebug=true
2021-06-03 10:29:49 -07:00
LexManos 435e65eb18 Removed signature line from mod list screen. #7500 2021-05-23 11:08:45 -07:00
Curle 8211a5048a Reinstate the MinecartCollisionHandler field to AbstractMinecartEntity (#7748) Closes #7506. 2021-05-17 13:51:23 -07:00
Curle 167f14f4a1 Fix PlayerEvent.BreakSpeed's pos being nullable. (#7747) Closes #7615. 2021-05-17 13:46:11 -07:00
Curle f332642409 Fix OBJ Loader data gen string (#7746) Closes #7616 2021-05-17 13:43:37 -07:00
noeppi_noeppi 77d41023b5 Add an event similar to PlayerEvent.NameFormat but for the name shown in the tab list. (#7740) 2021-05-17 13:17:01 -07:00
Curle da2594289c Fix filling buckets with fluids without bucket items consuming the fluid (#7745) Closes #7670 2021-05-17 13:10:27 -07:00
David Quintana 6f3da80b5a Work around crash while loading flatworld with modded structures. (#7764)
* Work around crash while loading flatworld with modded structures.

* Maybe fix issue with gradle daemon leaking memory and slowing down CI builds.
2021-05-14 00:11:46 +02:00
gigaherz 474b47ea51 Update Forge to Gradle 6.9 2021-05-12 23:33:33 +02:00
Trikzon b6ce4fb066 Add barrels and barrels/wooden block and item tag (#7676) 2021-04-30 10:53:19 -07:00
KnightMiner 1406f2bf1f Fix shears not properly breaking tripwire (MC-129055) (#7718) 2021-04-30 10:52:02 -07:00
JoJoModding 5125775992 Fix Line endings in tooltips not handled properly in multiplayer screen Closes #7738 (#7739) 2021-04-30 10:42:15 -07:00
Sydney 929c7b7a0b Fix cats, phantoms and pillagers saying they're at BlockPos.ZERO during LivingSpawnEvent.CheckSpawn (#7722) 2021-04-23 13:27:56 -07:00
mrp-v2 7bf02e7dcd [1.16] Add missing Multipart Blockstate Builder feature: Nested condition groups (#7677) 2021-04-22 22:55:18 -07:00
Dennis C 9d0d249eaf Pass BlockPos to BlockParticleData used for "fall impact" particle (#7705) 2021-04-22 22:53:58 -07:00
sciwhiz12 c4b1df1fc7 Check version ranges of optional dependencies when present (#7710)
If an optional dependency is present, but it does not conform to the version range,
it will now error out in the same fashion as missing required dependencies, instead
of a more cryptic error down the line due to a missing method/class/field/etc.

Implements and closes #7696
2021-04-22 22:52:24 -07:00
Take Weiland b3f253df61 Fix ClientVisualization crashing on systems without monitors (#7719) 2021-04-22 22:45:38 -07:00
atkarimarton dc099069fa Fix Furnace Minecarts going faster then vanilla (#7725) 2021-04-22 22:29:33 -07:00
AterAnimAvis e80c785563 Update for Forge's new maven (#7723) 2021-04-22 22:28:18 -07:00
cpw 1f9611204f A bloody quote FFS
Signed-off-by: cpw <[email protected]>
2021-04-18 11:35:05 -04:00
cpw 0120f6274d Update for new maven
Signed-off-by: cpw <[email protected]>
2021-04-18 11:28:54 -04:00
cpw c0e74bc8a8 Fix broken java9hacks for j16 handling..
Signed-off-by: cpw <[email protected]>
2021-04-02 14:27:25 -04:00
SizableShrimp 80feb0aeb2 Add generic EntityTeleportEvent (#7694) 2021-03-29 18:05:13 -07:00
covers1624 f47429717d Restore SS version, fixes findFieldInstanceChecks 2021-03-22 16:51:53 +10:30
Take Weiland 0239a736ec Fix sign textures being stitched onto every texture atlas (#7690) 2021-03-17 10:04:07 -07:00
LexManos 5c488c9007 Fix AT order, missed exec line and bump for RB. 2021-03-15 15:06:12 -07:00
Take Weiland 53c039680c Fix wrong eye height when entity size changes (esp. baby animals) (#7628) 2021-03-15 14:08:40 -07:00
Take Weiland 7379e8b9a4 Allow ITeleporter to override the vanilla teleport sound (#7682) 2021-03-15 14:02:20 -07:00
SizableShrimp 2a0d9e8dac Fix datapack exception related to EnumArgument with siblings (#7686)
Invalid enum constants are now properly thrown as a CommandSyntaxException
2021-03-15 13:20:08 -07:00
kaydogz aacba8e38e Add support for custom WoodTypes (#7623) 2021-03-15 12:28:45 -07:00
LexManos f4fd1c2f16 Use JGit instead of GrGit now that jcenter is going away.
Update missed mapped name in MDK.
2021-03-15 12:18:51 -07:00
gigaherz 813f3d630d Bump nashorn wrapper version. 2021-03-13 19:56:17 +01:00
gigaherz 76cea5a7da Fix yet another copypasta. 2021-03-13 19:56:17 +01:00
diesieben07 e33f794298 Fix incorrectly replaced SRG names 2021-03-13 19:56:14 +01:00
AterAnimAvis 72d05d17a9 Fix potential Deadlock when using custom Item entities. (#7532)
Be careful when adding Entities during Chunk Load (#7519)
2021-03-12 10:50:05 -08:00
gigaherz 19f9b309a6 Fix copypasta. 2021-03-12 02:54:10 +01:00
Curle 5b53616a47 Automatically fix some issues with configurations deemed invalid for simple reasons (#7671) 2021-03-11 16:11:05 -08:00
gigaherz 5f9e6f3b56 Add coremod that injects bouncer methods to work around name conflicts with official names.
Fixes a binary break.
2021-03-11 21:57:47 +01:00
gigaherz 0ad8e2c27f Bump SpecialSource 2021-03-11 19:29:20 +01:00
David Quintana 55f29764f8 Bulk update license year, and use replacement variable so that the current year is always used. 2021-03-10 23:41:00 +01:00
David Quintana a4f7087b92 Introduce a new feature that lets mods know if optional mods and optional network channels are present in the remote.
Allow connections from forge versions that don't have the vanilla splitter.
2021-03-10 23:40:59 +01:00
LexManos a95b968c13 Regenerate patches with relative headers. This should lower conflicts in future PRs.
Convert Forge to use Official mappings.
Mojang released their obfuscation mappings but we have not used them up until now due to wanting to get their license to be more explicitly permissive.
It is clear that their intent is to allow us to use their names for developing mods like this.
See the full wording, and our interpretation here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
2021-03-09 14:21:48 -08:00
LexManos 802298d99d Update to FG4, and Gradle 6.8. 2021-03-09 13:27:46 -08:00
Take Weiland 5363dc5d99 Support splitting vanilla packets that are too large on forge<->forge connections (#7485)
Currently only for SUpdateRecipesPacket and STagsListPacket that blow up with huge datapacks
2021-03-04 12:14:52 -08:00
Sara Freimer 9602c22083 Fix a few places where the vanilla method was being called instead of the forge one (#7535)
Cleanup javadocs references slightly, fix a couple spots not using the proper forge hooks, and remove a couple unneeded patches
Update deprecation comment on isAir
2021-03-03 12:50:32 -08:00
FireController#1847 17500032ae Add Opacity to ForgeHooksClient#renderMainMenu (#7660) 2021-03-02 21:28:48 -08:00
Marc Hermans 65bc41281f Add support for caching of configuration values. (#7608) 2021-02-24 18:36:51 -08:00
Kovak ba15737fe3 Added entity attribute setup and creation events 2021-02-15 18:40:32 -08:00
KnightMiner 58f93263e2 Fix updateItemStackNBT not properly being called (#7646)
Re-added ItemStack delegate redirect transformer
2021-02-15 17:28:35 -08:00
Sara Freimer d97f28141c Fix a few FluidUtil issues that were causing DispenseFluidContainer to not function properly (#7422) 2021-02-15 17:08:05 -08:00
ichttt 0340664dbf Add a way to specify a custom background texture with namespaces in the Creative GUI. (#7404) 2021-02-15 16:46:23 -08:00
DaemonUmbra d2cfda3fb4 Fixed Configs not correcting when hot-loaded from changes on disk (#7427) 2021-02-15 16:39:59 -08:00
FledgeShiu 48225e1bea Reduce default logging markers in the MDK. Modders can re-enable these for better debugging. (#7432)
Modders PLEASE read your damn log, and fix the errors we point out. Spamming modpacks with stack traces is just lazy programming.
2021-02-15 16:39:02 -08:00
sciwhiz12 37ea725749 Deprecate Forge's setdimension command, vanilla execute command can do this now. (#7459) 2021-02-15 16:19:13 -08:00
LeBossMax2 733b812c7b Fix ItemTextureQuadConverter.convertTexture generating wrong quads, fixes #7620 (#7650) 2021-02-16 00:38:21 +01:00
Sangar 9ab29ea8fe Added MultipartBakedModel.getModelData(). (#7595)
This allows custom IBakedModel implementations to use the IModelData provided by their IBakedModel.getModelData() when used in the context of a multipart model.
2021-02-16 00:22:24 +01:00
Cyborgmas fe26b77e3b fix global cache not being a block render type (#7648) 2021-02-16 00:15:33 +01:00
Alex O'Neill b8eca88f75 Allow mods to use additional custom LootParameter when querying existing loot tables (#7515) 2021-02-15 14:52:00 -08:00
Sydney e039531497 Add ForgeHooks.canEntitySpawn to Cat, Phantom, and Patrol spawners. (#7569) 2021-02-15 13:40:03 -08:00
Max Becker 9017e24b40 Fix/Replace player visibility event (#7573) 2021-02-15 13:25:54 -08:00
AterAnimAvis 75570079ae Fix: Clear the last error from glfwInit to prevent vanilla from throwing an exception later in the chain when glfw errors. (#7587) 2021-02-15 13:16:09 -08:00
seymourimadeit e2167140db Fix MC-181464 persisting for modded shields (#7602) 2021-02-15 12:56:34 -08:00
malte0811 a89ce2d6f1 FIx race condition in LazyOptional (#7611) 2021-02-15 12:11:27 -08:00
Dennis C 007cd42ec6 [1.16.5] Fix shaders breaking almost every overlay that uses textures, fixes #7575 (#7624) 2021-02-14 19:11:46 -08:00
TelepathicGrunt d16a8d6d5d Disable syncing of Feature and Biome registries (#7639) 2021-02-14 19:05:11 -08:00
Drullkus 69321a363e Add IExtensibleEnum to GrassColorModifier (#7641) 2021-02-14 19:04:31 -08:00
Sydney 0e1ee4b1d2 Log stacktraces in NettyPacketEncoder. (#7654) 2021-02-14 18:36:09 -08:00
Dennis C cc1a9be2b4 Lower logging level for datafixer warning to debug (#7636) 2021-02-10 11:05:01 -08:00
Sara Freimer 1d7da4c595 Reintroduce forge's chunk manager to allow mods to force chunks with either a block position or entity (UUID) "owner" and have them properly persist between restarts (#7642) 2021-02-09 14:19:07 -08:00
Sara Freimer 1ac432c594 Fix two places where querying an object for the new "valid" capability from a capability invalidation listener could cause the object to return the old invalid capability. (#7643) 2021-02-09 13:28:02 -08:00
Cyborgmas 276871d5a3 Fix config spec in cases of enum class discrepancies (#7635) 2021-02-09 13:21:23 -08:00
Take Weiland 8460227ddf Fix onBlockAdded being called twice for ItemEntity placing non-TE blocks (#7607) 2021-02-09 13:02:08 -08:00
Jon f450d4025d Prevent NullPointerException when adding new loot pool. (#7605) 2021-02-09 12:59:48 -08:00
brandon3055 93a815957d Added generic multi part entity API (#7554) 2021-02-09 12:53:25 -08:00
Cyborgmas 84b7cdc1cd Fix IAngerable entities crashing when reading nbt on client (#7618) 2021-02-06 19:41:12 -08:00
Silk 83fee0b3d4 [1.16.x] Add loot table ID in Global Loot Modifiers (#7428) 2021-02-02 13:32:02 +01:00
Sara Freimer aeaebf5785 Add a block tag to allow mods to blacklist blocks endermen should not be able to place blocks on top of, similar to how vanilla hardcodes against them being able to place things on bedrock (#7548) 2021-01-29 18:02:08 -08:00
HellFirePvP d88e660cbb Fix translucent model parts of MultiLayerModels rendering as missing models due to differing rendertypes when rendering block model (#7579)
Signed-off-by: HellFirePvP <[email protected]>
2021-01-29 18:01:16 -08:00
Sara Freimer ab949c7cca Fix existing file tag provider support looking in the wrong folder for custom tag types (#7576) 2021-01-29 17:34:54 -08:00
Cyborgmas 7728dde36b Propery re-encode registries (#7629) 2021-01-28 13:07:11 -08:00
Cyborgmas 004ab59e6f Properly encode registries. (#7626) 2021-01-27 17:22:58 -08:00
Cyborgmas 7bfd2b8f34 Inject vanilla dimensions inside worlds missing them (#7599) 2021-01-27 16:00:28 -08:00
LexManos f169c99348 Introduce a new field_to_instanceof transformer to reduce some simple patches. 2021-01-26 16:32:13 -08:00
LexManos d3d3bdc769 Fix broken build. 2021-01-25 18:52:46 -08:00
Max Becker 0a0f3232ea Add modded biomes to overworld biome list (#7360) 2021-01-25 18:36:46 -08:00
LexManos 50d75a27e1 Fix dynamic registries not getting ids assigned correctly from old worlds in specific unordered value insertions. Closes #7586 2021-01-25 18:17:51 -08:00
KnightMiner 19f8d2a793 Optionally add a milk fluid to the vanilla bucket (#7294)
Fixes the previous broken code that was supposed to make mod registered milk returned by the vanilla bucket by allowing mods to enable a milk fluid.
2021-01-17 16:05:24 -05:00
LexManos f173bde812 1.16.5 Initial Update. 2021-01-15 11:33:11 -08:00
LexManos dd10933ab0 Update Coremods, ASM, and include standalone Nashorn to load on J15. 2021-01-14 15:48:53 -08:00
LexManos 9ffa44f254 Introduce a new field_to_instanceof transformer to reduce some simple patches. 2021-01-14 02:52:52 -08:00
LexManos d8f41adf39 Update Coremods, ASM, and include standalone Nashorn to load on J15. 2021-01-12 13:22:13 -08:00
Ian Rehwinkel c3e84646db Added IWeatherParticleRenderHandler to allow a mod to take control over weather particles and sounds. (#7522) 2021-01-07 12:24:40 -08:00
covers1624 2094f99640 Allow Chunk loading Tickets to opt-into forcing chunk ticks. (#7525) 2021-01-07 12:13:47 -08:00
malte0811 94f3bdaa69 Fix crash when mods add goals to skeleton horses (MC-206338) (#7509) 2021-01-07 12:04:50 -08:00
Take Weiland 7220e9d0b0 Set WM_CLASS and WM_INSTANCE_NAME for early progress window (#7534) 2021-01-07 12:03:46 -08:00
Alex O'Neill 020102d87f Make UnboundedMapCodec more lenient in decoding dimensions. Fixes MC-197860 (#7527) 2021-01-05 19:17:24 -08:00
LexManos f101700969 Fix FML's Config Sync packet not allowing same length filenames in encoder and decoder. Closes #7584 2021-01-05 11:50:05 -08:00
LexManos c4b148b84b Prevent NPE and deprecated MissingMappings.getMappings function. Closes #6252 2021-01-05 11:47:00 -08:00
LexManos b6a9274870 Fix entities not correctly being able to be ridden under water. 2021-01-03 03:02:32 -08:00
Jonathan Coates 830d9699e3 Fix crash when beehive is broken by fake player (#7566) 2020-12-28 13:56:44 -08:00
Alex O'Neill fc68b81b21 Add supplier variant to AbstractBlock.Properties#lootFrom (#7563) 2020-12-28 13:42:15 -08:00
Take Weiland 2904772b16 Fix ModFileResourcePack.getAllResourceLocations ignoring resourceNamespace. (#7562)
Fixes #7405
2020-12-28 13:39:44 -08:00
Take Weiland e120b57032 Fix missing serializers when deserializing global loot modifiers (#7561) 2020-12-28 13:37:32 -08:00
Take Weiland b86b56260d Fix VanillaConnectionNetworkFilter sending out invalid entity properties packets without an entity ID (#7560) 2020-12-28 13:34:31 -08:00
Richard Freimer b222b23557 Make shear interactions extend to subclasses (#7544) 2020-12-28 13:10:35 -08:00
sciwhiz12 8ec4253068 Add a SoundType subclass that uses suppliers (#7538) 2020-12-28 13:09:03 -08:00
sciwhiz12 74ca88b7be Fix compound ingredient in shapeless recipes (#7537) Fixes #7530 2020-12-28 13:03:48 -08:00
Alex O'Neill a1119cd77a Fix potential NPE in ForgeHooks.onItemPlaceIntoWorld when passing in null player. (#7505) 2020-12-28 12:18:52 -08:00
mrp-v2 545723dc8c Fix modded PointOfInterestType's not populating blockstate map when registered (#7503) 2020-12-28 12:17:51 -08:00
poopoodice b64f4780c5 Add new LivingConversionEvent to control mobs turning into other mobs. (#7386) 2020-12-28 12:03:11 -08:00
KnightMiner 1c98b29087 Add ItemAttributeModifierEvent (#7484) 2020-12-28 11:59:09 -08:00
Brennan Ward 33880331d2 Fix RightClickBlock ALLOW not being implemented (#7426) 2020-12-28 11:54:30 -08:00
LexManos 74a43877e4 Quiet down errors related to modders not changing their update urls from the default. 2020-12-26 11:39:14 -08:00
LexManos 7542fbea48 Make mod data packs able to be disabled. It'll break things, but that's on you. Closes #6776 2020-12-26 11:38:45 -08:00
tterrag 2d9a1bc6f9 Add generated resource tracking to ExistingFileHelper 2020-12-12 12:33:56 -05:00
tterrag a57a240c13 Fix BlockStateProvider item models not knowing about block models
Add tests for this case
2020-12-10 21:37:13 -05:00
Richard Freimer b7fb6484d7 Override invalidateCaps instead of remove for vanilla TE capability invalidation (#7536)
Properly invalidate patched in vanilla TE caps in invalidateCaps instead of remove so that they get invalidated on chunk unload
2020-12-08 11:54:29 -08:00
Richard Freimer 1a539ffebc Make TEs invalidate capabilities when the chunk they are in unloads (#7529)
Fixed LazyOptional potentially notifying invalidation listeners multiple times.
2020-12-05 12:05:32 -08:00
Kevin G 27220a5ad8 Fixed entity navigation to stop entities spinning - MC-94054 (#7520) 2020-12-05 11:54:03 -08:00
Unbekannt1998 e975fc8252 Fix wrong function call in BlockStateProvider::horizontalFaceBlock (#7514) 2020-12-05 11:52:44 -08:00
tterrag d85ea5a3b0 Fix datagen order of multipart conditions being unstable 2020-11-28 21:10:49 -05:00
Alex O'Neill ccb7345084 Fix forge config option for default world type not applying unless you change the default world type (#7521) 2020-11-28 03:56:44 +01:00
David Quintana 93c00b67d9 Implement feature for mods to define new world types (#7448)
* Mods can now register world types via a new forge registry, and optionally register a settings screen to tweak them.
  * The default world type for dedicated servers and singleplayer world creation is configurable via forge's common config.
2020-11-28 00:57:15 +01:00
IzzelAliz cd393bbfdc Fix dimType not encode to registries (#7513) 2020-11-24 09:14:10 -08:00
Richard Freimer fd045d4628 Add support for referencing forge's resources and specifying existing mods to data generators (#7456) 2020-11-22 22:45:13 -05:00
cpw 47e076071b Fix #6692
Thanks @AterAnimAvis for help and suggestions

Signed-off-by: cpw <[email protected]>
2020-11-22 17:00:48 -05:00
Cyborgmas a73e003dd3 Fix translucent blocks not rendering properly when moved by pistons on fabulous (#7441) 2020-11-21 11:57:33 -08:00
LexManos 949984268d Bump version for RB. 2020-11-20 12:53:44 -08:00
Take Weiland 114acfca3b Fix food bar not rendering when non-living entities are mounted (#7446) 2020-11-20 10:24:43 -08:00
Alex O'Neill 56e538e8a9 Fix MC-194811 - Removing structures causes chunk save errors. 2020-11-20 10:23:50 -08:00
Take Weiland fa46f3dd49 Fix concurrency issue in StartupMessageManager (#7483) 2020-11-20 10:17:00 -08:00
Alex O'Neill 6ec5a8f2c1 Fix forge registry types that have private constructors (BlockStateProviderType, BlockPlacerType, FoliagePlacerType, TreeDecoratorType) (#7482) 2020-11-20 10:11:15 -08:00
cpw 49b596dda3 Fix problem where the absence of forge and MC in later loading triggered a weird crash.
Signed-off-by: cpw <[email protected]>
2020-11-15 11:08:34 -05:00
cpw 0c5ced1bbf Fix NPE problem when modid is mismatched.
Signed-off-by: cpw <[email protected]>
2020-11-13 20:41:20 -05:00
cpw 4a09a2420d Return the processed modlist data to the upstream system, not the raw unprocessed data. Should resolve the problem
that mixin complains about missing info when it's in a "crashed" situation.

Signed-off-by: cpw <[email protected]>
2020-11-13 19:12:43 -05:00
Cyborgmas 0ff8a596fc Fix dims on servers not loading the first run (#7445) 2020-11-11 01:09:35 -08:00
Take Weiland bca20ace4e Allow for custom argument types by filtering them on vanilla connections (#7463) 2020-11-10 12:24:25 -08:00
Brennan Ward f3b53001c9 Add Player context to AnvilUpdateEvent (#7442) 2020-11-10 12:05:47 -08:00
Jonathan Coates 15bac0eeaa Don't overwrite PlayerAdvancement's player with a fake one (#7454)
If a FakePlayer is constructed with the same UUID/GameProfile as a
currently active player, the player object within PlayerAdvancement is
set to the fake player.

As fake players cannot receive advancements (see grantCriterion), this
prevents the actual player from receiving any advancements until they
change dimension/relog.
2020-11-10 11:55:42 -08:00
Curle 1782973a29 Add BannerBlock.forColor to SAS to fix banner.toItem() on servers. 2020-11-10 11:38:20 -08:00
Boy132 9a4a501a95 Call Harvest check event even if the block doesn't require any tool (#7414) 2020-11-10 11:36:32 -08:00
LexManos 9bbfbd5479 Use linked collections to stabilize order when adding new registry entries. 2020-11-10 11:24:57 -08:00
Dennis C 8c68731838 Render local player when the renderViewEntity is not the local player (#7216) 2020-11-10 11:13:49 -08:00
cpw 0d7f507f4e Some help in ExtensionPoint regarding DISPLAYTEST. Let's improve those tick rates!
Signed-off-by: cpw <[email protected]>
2020-11-07 23:11:45 -05:00
cpw f78b943bdf Handle erroring during early mod construction phases, and actually report that into the error UI
by doing armslength exception handling and propagation.

Signed-off-by: cpw <[email protected]>
2020-11-07 22:30:19 -05:00
cpw 160f3f88f9 Support backwards loading 1.16.3 mods in 1.16.4, because we are able to do that. Tweak loading a bit to be smarter about dependency errors of various kinds.
Signed-off-by: cpw <[email protected]>
2020-11-07 20:48:02 -05:00
David Quintana 45e38859ed Add FluidStack codec, and a test mod that verifies its behaviour matches the existing write/read logic.
Add missing license headers.
2020-11-07 21:10:18 +01:00
cpw 38a5400a8c Update event bus version (should be 3.0.5)
Tweak MDK to automatically populate recommended values for things like forge version, loader version and minecraft version.

Signed-off-by: cpw <[email protected]>
2020-11-06 21:11:26 -05:00
diesieben07 acd18455c2 Workaround for modded attributes on vanilla entities logging warnings on vanilla clients
Switch to a handler-based approach per packet class, simplify patch, add some docs

Add license header and docs

Switch to a network handler based approach

Switch to a network handler based approach

revert build gradle change

Simplify Packet patch

Add license header to IForgePacket

Revert ForgeHooks changes

Less hacky and more generic way to filter packets for vanilla connections

_Actually_ Order SAS.
It's early

Order SAS

simplify vanilla connection check

Remove unneeded import change
2020-11-03 18:47:04 -05:00
cpw 5a7facc20f Fix early sorting bug that meant the file deduping was causing an error, to, well, not cause it, so we can get to an error screen.
Signed-off-by: cpw <[email protected]>
2020-11-02 14:57:23 -05:00
LexManos f54998a6b7 1.16.4 Initial Update 2020-11-02 10:42:45 -08:00
LexManos 7d00d015f3 Fix Biomes not properly copying over ids loaded from the save to the new Dynamic Registry. 2020-11-01 20:30:38 -08:00
David Quintana fed7beab89 Introduce custom loader additions to the model data generators. (#7450)
Currently implemented loaders:
* OBJ
* Composite
* Multi-layer
* Item layers (vanilla item/generated but with fullbright texture support)
* Bucket
* Separate Perspective
2020-11-02 02:09:49 +01:00
cpw cf3e9d1e0c actually rollback on error in registry events.
Signed-off-by: cpw <[email protected]>
2020-11-01 19:51:56 -05:00
cpw 749c9063af Fix config parse failure causing crash in building exception message. fixes #7438
Signed-off-by: cpw <[email protected]>
2020-11-01 17:09:00 -05:00
Tobias Hotz 1af6632a29 Auto-detect ansi support for log4j2
move to fml.loading subpackage

Add license header
2020-11-01 17:03:12 -05:00
cpw 7e79243bca Return client resources even if no data pack found on server. Closes #6225 (Pull request)
Signed-off-by: cpw <[email protected]>
2020-11-01 17:02:56 -05:00
cpw 36f9c804d9 Update modlauncher. fixes #7452
Signed-off-by: cpw <[email protected]>
2020-11-01 16:05:02 -05:00
malte0811 06fe9ccda0 Fix (NonNull)Lazy.Concurrent using a global lock (#7403)
* Fix Lazy.Concurrent using a global lock, thus preventing multiple threads from resolving independent Lazy's at the same time
* Use Lazy with an added null check to implement NonNullLazy
2020-10-29 18:09:20 +01:00
David Quintana 53eedb0f10 Update forge mappings to 20201028-1.16.3 (#7435) 2020-10-29 01:11:57 +01:00
Alex O'Neill 6e0e67b14d Fix breaking changes from the Biome rename PR #7434 (#7439) 2020-10-27 09:00:53 -07:00
sciwhiz12 22f7f4649b Reimplement nametag distance attribute, fix attribute translation keys (#7387) 2020-10-26 16:52:36 -07:00
Alex O'Neill 8a77681574 Fix data pack biomes failing to load in SingleBiomeProvider (#7434) 2020-10-26 15:06:53 -07:00
cpw 6982c5dd56 Add in proper handling of equals and hashcode for modjar urls. Fixes very slow loading on windows.
Signed-off-by: cpw <[email protected]>
2020-10-26 18:00:14 -04:00
cpw 7205c30ece Force 8.0.5 ML
Signed-off-by: cpw <[email protected]>
2020-10-26 08:51:05 -04:00
cpw 80baad974e Restore FingerprintViolationEvent with appropriate THIS IS F*CKING DEAD DELET WARNINGS.
Also, notify in UI if using legacy JDK without capability to read out security data from mod jars.

Signed-off-by: cpw <[email protected]>
2020-10-26 07:31:49 -04:00
cpw ae160cad12 Add signature reporting for mods, using new signature capture from ModLauncher. Need to figure out
how to reflect Minecraft's JAR signatures into here.

Signed-off-by: cpw <[email protected]>
2020-10-25 22:26:16 -04:00
cpw 6ff6277efa Rollback registries to vanilla state if something happens during loading, so subsequent activities can still run and not generate false reports..
Signed-off-by: cpw <[email protected]>
2020-10-25 11:33:43 -04:00
LexManos 74f9ef838a Fix mcp_snapshot mapping issue causing unneeded patches. Closes #7424 2020-10-20 12:32:19 -07:00
David Quintana 395f89c973 Fix resource leak in the OBJ loader. 2020-10-20 13:24:12 +02:00
SilverDavid 8536521b7b Fix issue with ITeleporter allowing easier use of vanilla logic. (#7317) 2020-10-16 12:09:53 -07:00
Richard Freimer b1659300e0 Adds tag support for Enchantments, Potions, and TileEntityTypes (#7379) 2020-10-15 12:45:25 -07:00
LexManos 93226bbcff Resuscitate BiomeDictionary using RegistryKeys instead of biome references. 2020-10-15 12:43:18 -07:00
Ocelot 51fa230e7b Add event for player changing game mode (#7355) 2020-10-15 10:15:06 -07:00
cpw 5f292895cb Fix RCON multipacket responses not actually understanding UTF8.
Signed-off-by: cpw <[email protected]>
2020-10-12 14:10:57 -04:00
cpw 9cfe741cea Fix RCON not sending newlines in output for multiline. Fixes https://bugs.mojang.com/browse/MC-7569, a very old bug that is really annoying if you use RCON.
Signed-off-by: cpw <[email protected]>
2020-10-11 21:48:55 -04:00
ChampionAsh5357 bed38d4253 Fix Texture Presence String (#7408) 2020-10-10 09:45:18 -07:00
LexManos 37f226eda5 Fix typo causing potential error in vine growth. Closes #7406
Sort missing registry dumps by name, making it easier to read.
2020-10-09 12:56:26 -07:00
David Quintana 59b4affbe7 Fixed conditional advancement loading when using the "advancements" array.
Added automatic generation of conditional advancements from the criteria in the conditional recipe entries.
Added advancement name calculation from the recipe ID.
2020-10-09 15:47:32 +02:00
Flanks255 5477a36656 Additions to the mdk build.gradle to accommodate datagens. (#7398) 2020-10-08 14:03:41 -07:00
DaemonUmbra 5648336893 Added Basic Class-Level SAS Capability to checkSAS, added Vector4f to SAS (#7385) 2020-10-08 14:02:48 -07:00
Richard Freimer f5b53d5d10 Add hooks to allow modification of structures spawn lists (#7344) 2020-10-07 13:04:03 -07:00
Richard Freimer 10448c1ac9 Add back patches to Screen allowing for item tooltips to be auto wrapped again (#7378)
Only deals with the methods receiving an ItemStack or ITextComponent(s), the methods that take IReorderingProcessor(s) are left alone.
2020-10-06 21:38:27 +02:00
Mumfrey 5243275db2 Bump mixin version to 0.8.2 2020-10-05 15:34:07 +01:00
cpw 3041c2022b Add in extra debug logging
Signed-off-by: cpw <[email protected]>
2020-10-04 17:45:28 -04:00
cpw 09be003d61 Remove redundant call to CrashReport generator - Vanilla is doing a crashreport for itself at startup now.
Add a UUID into crashreport that is also logged in all channels at crash report generation time. This will allow to associate crash reports and the logs.

Signed-off-by: cpw <[email protected]>
2020-10-04 16:40:38 -04:00
cpw 3fe5ddd68f Fix doc README and answer lex's question
Signed-off-by: cpw <[email protected]>
2020-10-04 15:50:58 -04:00
cpw 935cb6782d Modify how ModLoadingStage handles dispatch to Registry Events. Stops the objectholder spam and generally improves performance on larger packs.
Signed-off-by: cpw <[email protected]>
2020-10-04 15:50:15 -04:00
DaemonUmbra 9b421b54a7 Added "Bukkit Plugin" to InvalidModIdentifier (#7384) 2020-10-02 16:40:06 -07:00
Richard Freimer 6e23030595 Fix vanilla Campfire smoke bug. MC-201374 (#7381) 2020-10-02 16:34:17 -07:00
sciwhiz12 78d69db79e Fix toggleable keybindings still being active while in GUI Fixes #7370 (#7373) 2020-10-02 16:28:21 -07:00
Max Becker 9177ac1b2e Fix modded EntityClassifications not being useable in the codec. (#7337) 2020-10-02 15:06:48 -07:00
cech12 248d207dbc Support effective materials of vanilla AxeItem (#7351) 2020-09-28 11:01:59 -07:00
LexManos 03082c361a Prep new RB. 2020-09-23 23:48:57 -07:00
ichttt 65372e3123 Fix grass disappearing when alwaysSetupTerrainOffThread is true (#7291) 2020-09-23 23:43:07 -07:00
Alex O'Neill 0f923fa51f Accessors for inspecting and removal of biome generation settings. Fixed carvers still being immutable. (#7339) 2020-09-23 23:39:25 -07:00
LexManos d1e3567c6b Revive BiomeManager and BiomeLayer hooks. 2020-09-23 23:35:40 -07:00
Richard Freimer af75547d37 Fix a few minor issues with custom tag types and fix OptionalNamedTags (#7316) 2020-09-23 20:12:11 -07:00
Take Weiland 37be3aff2d Fix ToggleableKeyBinding differences to vanilla. (#7338) 2020-09-23 15:10:01 -07:00
Take Weiland b9b17d8331 Fix forge light pipeline applying block offsets twice (#7323) 2020-09-23 14:34:38 -07:00
Yunus 2a433a5c8c Updated build badge versions to 1.16.3 in readme (#7325) 2020-09-23 14:25:59 -07:00
ichttt e344fd08a5 Add a better license error screen (#7350) 2020-09-23 14:16:36 -07:00
Tyler Hancock 0484f695fb Fixed container item being consumed in brewing stand. #7307 (#7314) 2020-09-22 12:14:08 -07:00
sciwhiz12 e55bd86dff Fix parse results of CommandEvent being disregarded (#7303) 2020-09-22 12:06:01 -07:00
Nightenom b1247df4dc [1.16] Fix possible crash when using rendering regionCache (#7207) 2020-09-22 11:58:19 -07:00
Alex O'Neill 91dda36b08 [1.16] Reimplement ICloudRenderHandler, ISkyRenderHandler and IWeatherRenderHandler (#6994) 2020-09-22 11:41:07 -07:00
Alex O'Neill ac19d1bf2b Make Biome.Climate and BiomeAmbiance fields accessible (#7336) 2020-09-17 17:57:58 -07:00
cpw e0e0302ece Use mixin 0.8.1. Should fix problems with mixin not working properly with latest modlauncher.
Signed-off-by: cpw <[email protected]>
2020-09-17 16:41:46 -04:00
Sebastian Hartte 6eb3e20abb Sets the empty/fill sounds for vanilla fluids.
Use Fluid's fillSound rather than emptySound when filling buckets.
2020-09-15 22:06:17 +02:00
Cyborgmas 738491c25d Add MatrixStack-aware alternatives to the methods in GuiUtils (#7127) 2020-09-15 21:46:58 +02:00
Justin Wiblin 2686b7a9ab Fix json biomes not setting registry name correctly for the BiomeLoadingEvent. (#7329) 2020-09-15 09:51:45 -07:00
David Quintana 4b93e3a224 Fix inconsistencies in how the values from the model are passed into the baked model.
This puts them in line with vanilla, as intended.
2020-09-15 16:17:57 +02:00
Yunus 873c490470 Reimplemented drawHoveringText (#7268) 2020-09-15 15:22:50 +02:00
LexManos 11e3281b3f New BiomeLoadingEvent that allows modders to edit biomes as they are being deserialized. 2020-09-14 17:43:01 -07:00
LexManos ce6c664acd Bump MCP version for lambda issue. 2020-09-11 08:55:13 -07:00
LexManos c75eb9e7cf 1.16.3 Update
Also included a bunch of warning cleanups.
2020-09-10 12:01:45 -07:00
Redstone_Dubstep 2353cd982a Fix tile entities being replaced when not needed. (#7318) 2020-09-10 11:54:48 -07:00
malte0811 dbcf8bd075 Fix exception when getting rendering box for tile entities with no collision boxes. (#7301) 2020-09-10 11:02:06 -07:00
cpw 9f3141ea16 More crash reporting tweaks. Don't crash when trying to show warnings. Also, put the exception name in the error screen on the second line!
Signed-off-by: cpw <[email protected]>
2020-09-09 19:04:19 -04:00
Take Weiland c382527ba2 Fix Minecart speed cap on rail being initialized to 0 (#7315) 2020-09-09 10:09:00 -07:00
Richard Freimer 45f8dc5245 Add support for custom tag types (#7289) 2020-09-08 19:10:36 -07:00
cpw 43391c009c More crash report tweaks. Put a button to open the generated crash report on the error screen, tweak formatting of crash report, and add the enhanced stack trace data (transformers et al)
Signed-off-by: cpw <[email protected]>
2020-09-08 20:05:45 -04:00
ChampionAsh5357 15733a18e4 New hook for better custom scaffolding movement (#7261) 2020-09-08 14:00:09 -07:00
Cyborgmas f68344cd7c Fixed crash with zip paths (#7300) 2020-09-08 13:47:39 -07:00
mrp-v2 e421ea164c Fix custom teleporters NPE (#7296) 2020-09-08 13:29:07 -07:00
Cyborgmas 178e3d244a Prevent duplicate wrapper tags from crashing (#7283) 2020-09-08 13:25:23 -07:00
Tschipp bd5e107628 Add partialTicks to RenderNameplateEvent (#7277) 2020-09-08 13:24:02 -07:00
NoahBeech a477671c03 Fixing logic in getCurrentRailPosition to correctly identify the rail… (#7276) 2020-09-08 13:23:18 -07:00
Edwin Mindcraft 887bc37209 [1.16.x] Fixes for Bamboo, Enchantments and Conduits, small adjustments to bring some patches closer to the vanilla code. (#7239) 2020-09-08 13:03:36 -07:00
sciwhiz12 47f05a4fcd Bump resource pack version to 6 (#7299) 2020-09-08 13:02:28 -07:00
sciwhiz12 47ba5b7a89 Remove dead ForgeHooks.canToolHarvestBlock function. (#7262) 2020-09-08 13:01:26 -07:00
ChampionAsh5357 05480843cd Re-implement DrawHighlightEvent$HighlightEntity Firing (#7233) 2020-09-08 12:50:06 -07:00
ichttt 0e1ed8c936 Reimplement FarmlandWaterManager (#7213) 2020-09-08 12:25:48 -07:00
Cyborgmas edf41bda19 Add dataprovider for Global Loot Modifiers (#6960) 2020-09-08 12:11:08 -07:00
ichttt 051416b823 Fix crash when dumping crash report for an exception that has a null cause (#7308) 2020-09-08 12:00:55 -07:00
cpw 84fe2cbcc4 Tweak crash report dump to visit all the causes up to the top.
Signed-off-by: cpw <[email protected]>
2020-09-06 21:29:21 -04:00
cpw 4ff0d246ce Fix ExplodedDirectoryLocator visiting non-existent paths. Closes #7203
Also, bump modlauncher to 7.0.1 to fix resources.

Signed-off-by: cpw <[email protected]>
2020-09-06 19:38:58 -04:00
cpw 9051021474 Fix some potential issues in crash dumping during mod loading
Signed-off-by: cpw <[email protected]>
2020-09-06 18:07:53 -04:00
cpw cc473be332 Park the polling thread for a bit, if we're not the one driving the task list forwards. This allows for the actual driver to work on low cpu count machines.
Signed-off-by: cpw <[email protected]>
2020-09-06 17:55:03 -04:00
cpw b1f73a0760 Use new enumeration mechanism in ModLauncher, to allow getResources to work. This enables serviceloader-in-mods, and other stuff that might need to visit multiple mod jars. Also, tweaked the visitor code slightly, may result in a trivial performance change. Closing #7302 as it's not really relevant any more.
Signed-off-by: cpw <[email protected]>
2020-09-06 17:54:05 -04:00
cpw de03eb6e3c Fix compiler issue in eclipse properly
Signed-off-by: cpw <[email protected]>
2020-09-03 12:09:29 -04:00
sciwhiz12 bef8c2da3d Fix crash caused by previous commit (#7298) 2020-09-03 08:40:40 -04:00
LexManos 3820d1b66f Dirty casting hacks to fix eclipse compiler inference issue. I'm sorry cpw. 2020-09-02 21:15:16 -07:00
tterrag 7dbae7ea4a Fix broken ExistingFileHelper import
Add licenses to some new files
2020-09-02 23:37:46 -04:00
tterrag be5885155c Add validation via resources for tag providers (#7271)
BREAKING CHANGE: Moved ExistingFileHelper to common package
Remove various workarounds from forge tag providers
2020-09-02 23:18:22 -04:00
cpw 5dac065994 Move the "modloading" thread activity onto _our_ worker pool. It turns out that the vanilla worker pool can deadlock during stitching if it's insufficiently large, if modloader "waitForTransition" is also a worker member of that pool.
Closes #7293 (to reproduce issue easily, modify Util.func_240979_a_ and change the values in the MathHelper.clamp call). I've verified that 3 and below for "max" cause the problem. (I didn't test a whole range of values, just sufficient to reproduce problem and verify fix). Note that setting it to zero (and using the "direct executor" that's inaccessible in normal operation) works as well with this fix.

Signed-off-by: cpw <[email protected]>
2020-09-01 14:36:02 -04:00
cpw 1d7db95539 Fix missed debugging code. Read the config from the config.
Signed-off-by: cpw <[email protected]>
2020-08-31 22:26:53 -04:00
cpw de24783152 Fix up slight registry change and other 1.16.2 stuffs.
Signed-off-by: cpw <[email protected]>
2020-08-31 21:30:53 -04:00
cpw bfeec0c7bd Merge branch '1.16.1' into 1.16.x
# Conflicts:
#	patches/minecraft/net/minecraft/client/Minecraft.java.patch
#	patches/minecraft/net/minecraft/item/crafting/Ingredient.java.patch
#	src/main/java/net/minecraftforge/fml/client/ClientModLoader.java
#	src/main/java/net/minecraftforge/registries/GameData.java
2020-08-31 21:15:56 -04:00
cpw 2e42340dfa Fix up all the things. Removed SidedProvider because it served no real purpose anymore.
Signed-off-by: cpw <[email protected]>
2020-08-31 21:00:44 -04:00
cpw 16b82bb97b Merge branch '1.16.x' into 1.16.1
# Conflicts:
#	src/main/java/net/minecraftforge/fml/ModList.java
#	src/main/java/net/minecraftforge/fml/client/ClientModLoader.java
2020-08-30 21:44:51 -04:00
cpw d76ee4edd7 Redo event dispatch, removes a bunch of nonsense, and tries to integrate with the vanilla CF system where possible
Signed-off-by: cpw <[email protected]>
2020-08-30 21:39:06 -04:00
ichttt cf09f3eeb9 Add particle culling (#6981) 2020-08-30 16:05:16 -07:00
LexManos d8eaeabf3c Wrap vanilla's 'default' biome registry in ForgeRegistry.
This should allow registering mod dimensions like in 1.16.1, while the data driven system is fleshed out.
2020-08-26 09:49:41 -07:00
David Quintana 600e68cace Clarify in the LazyOptional which methods carry the lazyness over to the returned value and which don't. (#6750)
For consistency, this meant making a few changes:
- Renamed the existing lazy mapping method to lazyMap, to indicate that it doesn't run the mapping immediately.
- Added a new implementation of map(), which returns Optional<T>, and resolves the value in the process.
- Changed filter() to return Optional, since there's no way to filter lazily.
- Added a new method resolve(), which helps convert the custom LazyOptional class into a standard Optional, for use
with library methods that expect Optional<T>.

* Update License headers.
2020-08-25 03:11:28 +02:00
sciwhiz12 625cd746ef Add user-friendly exceptions when config loading fails (#7214) 2020-08-21 14:27:12 -07:00
Max Becker fc000fe913 Replace EntityHeight event with EntitySize event (#6858) 2020-08-21 11:53:37 -07:00
Davide Albiero e3db429763 [1.16] ForgeEventFactory#canCreateFluidSource reintroduced (#7181) 2020-08-21 11:37:43 -07:00
Cyborgmas e803006360 Cleanup and expand Forge tags (#7004) 2020-08-21 11:30:21 -07:00
sciwhiz12 07ffc890e5 Fix modproperties property in mods.toml causing exception (#7192) 2020-08-21 11:25:40 -07:00
Philip T 5a20705f05 Log info about server list warning (#7209)
Make it easier to figure out what mods are missing or have to be marked as client/server side only.
2020-08-21 11:15:44 -07:00
mcenderdragon aaa1deeef2 Fix ItemStack#isDamageable is not calling Item#isDamagable (#7221) 2020-08-21 11:06:38 -07:00
Take Weiland 50197b1fa5 Improve performance and cleanup code for DelegatingResourcePack (#7228) 2020-08-21 10:48:48 -07:00
Cyborgmas 797791c2af Fix small logging issues with loading pack.png for mods (#7265) 2020-08-21 10:24:49 -07:00
Take Weiland c2de232703 Fix config iteration order (#7230) 2020-08-21 10:23:20 -07:00
LexManos 9118c3dd24 Cleanup Forge's build script, fix some unneeded patches.
Add checkExcscheckAll tasks.
2020-08-21 02:47:04 -07:00
ChampionAsh5357 c6d512afe8 Readding DifficultyChangeEvent hooks (#7240) 2020-08-20 21:35:09 -07:00
malte0811 5037adede9 Improve startup time by caching the manifest data for mod jars (#7256) 2020-08-20 21:29:02 -07:00
Yunus a5aca97e31 Removed HarvestDropsEvent (#7193) 2020-08-18 22:47:38 -07:00
Cyborgmas edca0c7293 Remove forge optional tags in favor of Vanilla's new system. (#7246) 2020-08-18 22:22:34 -07:00
LexManos 132cc3659d New method for creating modded tag references, fix connecting to vanilla servers. 2020-08-14 12:04:55 -07:00
LexManos 680c4062f4 Fix creating nether portals. 2020-08-14 12:04:17 -07:00
sean e1efab0452 Print mod file name on InvalidModFileException (#7241) 2020-08-13 19:16:53 -07:00
Yunus bd428de4fa Updated MDK and README for 1.16.2 (#7243) 2020-08-13 12:22:58 -07:00
Cyborgmas 978b3c7fb1 Fix server connection, misapplied patch (#7245) 2020-08-13 12:22:17 -07:00
cpw ff752ab14b Revert "Properly shutdown FMLModContainer's event bus when an error in a lifecycle event is detected."
This reverts commit 30bad1e2

Signed-off-by: cpw <[email protected]>
2020-07-28 19:17:35 -04:00
cpw 19a38f5cb9 Revert "Shut down all other mod handlers if the loading cycle errors. This prevents other mods from throwing errors and being blamed for initial cause. This is a temporary hack until cpw re-writes the mod event dispatcher."
This reverts commit 7592bbe8

Signed-off-by: cpw <[email protected]>
2020-07-28 19:17:29 -04:00
1519 changed files with 35582 additions and 27193 deletions

No files matched your search

-2
View File
@@ -39,8 +39,6 @@ changelog.txt
*.7z
/logs/
gradle.properties
!/mdk/gradle.properties
/projects/forge/rejects/
# Srg2Source causes import bugs on these patches. If you intentionnally change these, remove the ignore.
+104
View File
@@ -0,0 +1,104 @@
<?xml version="1.0"?>
<project>
<modelVersion>4.0.0</modelVersion>
<name>MinecraftForge_Forge Config DSL Script</name>
<groupId>MinecraftForge_Forge</groupId>
<artifactId>MinecraftForge_Forge_dsl</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<repositories>
<repository>
<id>jetbrains-all</id>
<url>https://download.jetbrains.com/teamcity-repository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>teamcity-server</id>
<url>https://teamcity.minecraftforge.net/app/dsl-plugins-repository</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>JetBrains</id>
<url>https://download.jetbrains.com/teamcity-repository</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>${basedir}</sourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<configuration/>
<executions>
<execution>
<id>compile</id>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>process-test-sources</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>teamcity-configs-maven-plugin</artifactId>
<version>${teamcity.dsl.version}</version>
<configuration>
<format>kotlin</format>
<dstDir>target/generated-configs</dstDir>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin</artifactId>
<version>${teamcity.dsl.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.teamcity</groupId>
<artifactId>configs-dsl-kotlin-plugins</artifactId>
<version>1.0-SNAPSHOT</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-script-runtime</artifactId>
<version>${kotlin.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
+185
View File
@@ -0,0 +1,185 @@
import jetbrains.buildServer.configs.kotlin.v2019_2.*
import jetbrains.buildServer.configs.kotlin.v2019_2.projectFeatures.githubIssues
import jetbrains.buildServer.configs.kotlin.*
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
/*
The settings script is an entry point for defining a TeamCity
project hierarchy. The script should contain a single call to the
project() function with a Project instance or an init function as
an argument.
VcsRoots, BuildTypes, Templates, and subprojects can be
registered inside the project using the vcsRoot(), buildType(),
template(), and subProject() methods respectively.
To debug settings scripts in command-line, run the
mvnDebug org.jetbrains.teamcity:teamcity-configs-maven-plugin:generate
command and attach your debugger to the port 8000.
To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View
-> Tool Windows -> Maven Projects), find the generate task node
(Plugins -> teamcity-configs -> teamcity-configs:generate), the
'Debug' option is available in the context menu for the task.
*/
version = "2021.2"
project {
buildType(Build)
buildType(BuildSecondaryBranches)
buildType(PullRequests)
buildType(PullRequestChecks)
buildType(PullRequestCompatibility)
params {
text("docker_jdk_version", "8", label = "Gradle version", description = "The version of the JDK to use during execution of tasks in a JDK.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
text("docker_gradle_version", "7.3.3", label = "Gradle version", description = "The version of Gradle to use during execution of Gradle tasks.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
text("git_main_branch", "1.20.x", label = "Git Main Branch", description = "The git main or default branch to use in VCS operations.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
text("git_branch_spec", """
+:refs/heads/(main*)
+:refs/heads/(master*)
+:refs/heads/(develop|release|staging|main|master)
+:refs/heads/(1.*)
""".trimIndent(), label = "The branch specification of the repository", description = "By default all main branches are build by the configuration. Modify this value to adapt the branches build.", display = ParameterDisplay.HIDDEN, allowEmpty = true)
text("github_repository_name", "MinecraftForge", label = "The github repository name. Used to connect to it in VCS Roots.", description = "This is the repository slug on github. So for example `MinecraftForge` or `MinecraftForge`. It is interpolated into the global VCS Roots.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
text("env.PUBLISHED_JAVA_ARTIFACT_ID", "forge", label = "Published artifact id", description = "The maven coordinate artifact id that has been published by this build. Can not be empty.", allowEmpty = false)
text("env.PUBLISHED_JAVA_GROUP", "net.minecraftforge", label = "Published group", description = "The maven coordinate group that has been published by this build. Can not be empty.", allowEmpty = false)
//These are references and not actually keys
password("env.CROWDIN_KEY", "credentialsJSON:a3102dbe-805d-4177-9f54-3d2c2eb08fd5", display = ParameterDisplay.HIDDEN)
password("env.LEGACY_KEYSTORE_URL", "credentialsJSON:a2d2efc7-4492-47b6-9826-d14b2c1243a0", display = ParameterDisplay.HIDDEN)
password("env.LEGACY_KEYSTORE_PASSWORD", "credentialsJSON:9f9a1a9e-f91b-40d5-b888-8ebc79a99ded", display = ParameterDisplay.HIDDEN)
text("additional_publishing_gradle_parameters", "-PcrowdinKey=%env.CROWDIN_KEY% -PkeystoreKeyPass=%env.LEGACY_KEYSTORE_PASSWORD% -PkeystoreStorePass=%env.LEGACY_KEYSTORE_PASSWORD% -Pkeystore=%env.LEGACY_KEYSTORE_URL%", label = "Additional gradle parameters for publish", description = "Contains the additional gradle parameters used during publishing.", display = ParameterDisplay.HIDDEN, allowEmpty = true)
checkbox("should_execute_build", "false", label = "Should build", description = "Indicates if the build task should be executed.", display = ParameterDisplay.HIDDEN,
checked = "true", unchecked = "false")
checkbox("should_execute_test", "false", label = "Should build", description = "Indicates if the build task should be executed.", display = ParameterDisplay.HIDDEN,
checked = "true", unchecked = "false")
}
features {
githubIssues {
id = "MinecraftForge_MinecraftForge__IssueTracker"
displayName = "MinecraftForge/MinecraftForge"
repositoryURL = "https://github.com/MinecraftForge/MinecraftForge"
}
}
}
object Build : BuildType({
templates(AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_BuildMainBranches"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"), AbsoluteId("MinecraftForge_BuildUsingGradle"), AbsoluteId("MinecraftForge_PublishProjectUsingGradle"), AbsoluteId("MinecraftForge_TriggersStaticFilesWebpageGenerator"))
id("MinecraftForge_MinecraftForge__Build")
name = "Build"
description = "Builds and Publishes the main branches of the project."
})
object BuildSecondaryBranches : BuildType({
templates(AbsoluteId("MinecraftForge_ExcludesBuildingDefaultBranch"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_BuildMainBranches"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"), AbsoluteId("MinecraftForge_BuildUsingGradle"))
id("MinecraftForge_MinecraftForge__BuildSecondaryBranches")
name = "Build - Secondary Branches"
description = "Builds and Publishes the secondary branches of the project."
params {
text("git_branch_spec", """
+:refs/heads/(*)
-:refs/heads/noci*
""".trimIndent(), label = "The branch specification of the repository", description = "By default all main branches are build by the configuration. Modify this value to adapt the branches build.", display = ParameterDisplay.HIDDEN, allowEmpty = true)
}
vcs {
branchFilter = """
+:*
-:1.*
-:<default>
""".trimIndent()
}
})
object PullRequests : BuildType({
templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"), AbsoluteId("MinecraftForge_BuildUsingGradle"))
id("MinecraftForge_MinecraftForge__PullRequests")
name = "Pull Requests"
description = "Builds pull requests for the project"
params {
checkbox("should_execute_build", "true", label = "Should build", description = "Indicates if the build task should be executed.", display = ParameterDisplay.HIDDEN,
checked = "true", unchecked = "false")
text(
"gradle_build_task",
"assemble",
label = "Gradle build task to execute during build",
description = "Determines the build task that is executed to build the project.",
display = ParameterDisplay.HIDDEN,
allowEmpty = false
)
}
})
object PullRequestChecks : BuildType({
templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"))
id("MinecraftForge_MinecraftForge__PullRequestChecks")
name = "Pull Requests (Checks)"
description = "Checks pull requests for the project"
steps {
gradle {
name = "Check"
id = "RUNNER_10_Check"
tasks = "checkAll"
gradleParams = "--continue %gradle_custom_args%"
enableStacktrace = true
dockerImage = "%docker_gradle_image%"
dockerRunParameters = """
-v "/opt/cache/agent/gradle:/home/gradle/.gradle"
-v "/opt/cache/shared/gradle:/home/gradle/rocache:ro"
--network=host
-u 1000:1000
%docker_additional_args%
""".trimIndent()
}
}
vcs {
branchFilter = """
+:*
-:1.*
-:<default>
""".trimIndent()
}
})
object PullRequestCompatibility : BuildType({
templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"))
id("MinecraftForge_MinecraftForge__PullRequestCompatibility")
name = "Pull Requests (Compatibility)"
description = "Validates binary compatibility for pull requests made to the project"
steps {
gradle {
name = "Validate"
id = "RUNNER_10_Compatibility"
tasks = "checkJarCompatibility"
gradleParams = "--continue %gradle_custom_args%"
enableStacktrace = true
dockerImage = "%docker_gradle_image%"
dockerRunParameters = """
-v "/opt/cache/agent/gradle:/home/gradle/.gradle"
-v "/opt/cache/shared/gradle:/home/gradle/rocache:ro"
--network=host
-u 1000:1000
%docker_additional_args%
""".trimIndent()
}
}
vcs {
branchFilter = """
+:*
-:1.*
-:<default>
""".trimIndent()
}
})
Vendored
+17 -6
View File
@@ -36,9 +36,11 @@ pipeline {
}
stage('setup') {
steps {
sh './gradlew ${GRADLE_ARGS} --refresh-dependencies --continue setup'
withGradle {
sh './gradlew ${GRADLE_ARGS} --refresh-dependencies --continue setup'
}
script {
env.MYVERSION = sh(returnStdout: true, script: './gradlew :forge:properties -q | grep "version:" | awk \'{print $2}\'').trim()
env.MYVERSION = sh(returnStdout: true, script: './gradlew :forge:properties -q | grep "^version:" | cut -d" " -f2').trim()
}
}
}
@@ -59,15 +61,22 @@ 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 {
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}'
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
}
}
}
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
@@ -78,7 +87,9 @@ pipeline {
CROWDIN = credentials('forge-crowdin')
}
steps {
sh './gradlew ${GRADLE_ARGS} :forge:publish -PcrowdinKey=${CROWDIN}'
withGradle {
sh './gradlew ${GRADLE_ARGS} :forge:publish -PcrowdinKey=${CROWDIN}'
}
}
}
}
+2 -16
View File
@@ -1,16 +1,2 @@
Minecraft Forge
Copyright (c) 2016-2020.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation version 2.1
of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Copyright (c) Forge Development LLC and contributors
SPDX-License-Identifier: LGPL-2.1-only
+448 -714
View File
File diff suppressed because it is too large. Load diff
+11
View File
@@ -0,0 +1,11 @@
repositories {
maven { url = 'https://maven.minecraftforge.net/' }
mavenCentral()
}
dependencies {
implementation 'org.ow2.asm:asm:9.6'
implementation 'org.ow2.asm:asm-tree:9.6'
implementation 'net.minecraftforge:srgutils:0.4.+'
implementation 'commons-io:commons-io:2.12.0'
implementation 'com.google.code.gson:gson:2.10'
}
@@ -0,0 +1,66 @@
package net.minecraftforge.forge.tasks
import groovy.json.JsonBuilder
import org.gradle.api.DefaultTask
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.TaskAction
import org.objectweb.asm.ClassReader
import org.objectweb.asm.Opcodes
import org.objectweb.asm.tree.ClassNode
import org.objectweb.asm.tree.FieldNode
import org.objectweb.asm.tree.MethodNode
import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream
abstract class BytecodeFinder extends DefaultTask {
@InputFile abstract RegularFileProperty getJar()
// It should be fine to mark the output as internal as we want to control when we run it anyways.
// This also shuts Gradle 8 up about implicit task dependencies.
@Internal abstract RegularFileProperty getOutput()
BytecodeFinder() {
output.convention(project.layout.buildDirectory.dir(name).map { it.file("output.json") })
}
@TaskAction
protected void exec() {
Util.init()
def outputFile = output.get().asFile
if (outputFile.exists())
outputFile.delete()
pre()
jar.get().asFile.withInputStream { i ->
new ZipInputStream(i).withCloseable { zin ->
ZipEntry zein
while ((zein = zin.nextEntry) != null) {
if (zein.name.endsWith('.class')) {
def node = new ClassNode(Opcodes.ASM9)
new ClassReader(zin).accept(node, 0)
process(node)
}
}
}
}
post()
outputFile.text = new JsonBuilder(getData()).toPrettyString()
}
protected process(ClassNode node) {
if (node.fields != null) node.fields.each { process(node, it) }
if (node.methods != null) node.methods.each { process(node, it) }
}
protected pre() {}
protected process(ClassNode parent, FieldNode node) {}
protected process(ClassNode parent, MethodNode node) {}
protected post() {}
protected abstract Object getData()
}
@@ -1,218 +0,0 @@
package net.minecraftforge.forge.tasks
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.TaskAction
import java.nio.file.Files
import java.nio.file.Paths
import java.util.regex.Pattern
public class CheckPatches extends DefaultTask {
@InputDirectory File patchDir
@Input boolean autoFix = false
@TaskAction
protected void exec() {
def hasS2SArtifact = [
Paths.get("patches/minecraft/net/minecraft/client/renderer/ViewFrustum.java.patch"),
Paths.get("patches/minecraft/net/minecraft/data/BlockModelDefinition.java.patch")
]
def verified = true;
project.fileTree(patchDir).each { patch ->
def patchPath = project.rootDir.toPath().relativize(patch.toPath())
verified &= verifyPatch(patch, autoFix, patchPath.toString(), hasS2SArtifact.contains(patchPath))
}
if (!verified)
throw new RuntimeException('One or more patches failed verification. Check the log for errors.')
}
def verifyPatch(patch, fix, patchPath, hasS2SArtifact) {
def hunk_start_pattern = Pattern.compile('^@@ -[0-9,]* \\+[0-9,]* @@$')
def white_space_pattern = Pattern.compile('^[+\\-]\\s*$')
def import_pattern = Pattern.compile('^[+\\-]\\s*import.*')
def field_pattern = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^=;]*)(=.*)?;\\s*$')
def method_pattern = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^(]*)[(]([^)]*)?[)]\\s*[{]\\s*$')
def class_pattern = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final[\\s]*)?(class|interface)([^{]*)[{]\\s*$')
def accessMap = [("private"):0, (null):1, ("protected"):2, ("public"):3]
def hasProblem = false;
def lines = patch.readLines()
def hunksStart = 0
def onlyWhiteSpace = false
def didFix = false
def newLines = []
def whiteSpaceErrors = []
// First two lines are file name ++/-- and we do not care
newLines.add(lines[0] + '\n')
newLines.add(lines[1] + '\n')
int i = 2
for (; i < lines.size(); ++i) {
def line = lines[i]
newLines.add(line + '\n')
if (hunk_start_pattern.matcher(line).find()) {
if (onlyWhiteSpace) {
if (fix || hasS2SArtifact) {
logger.lifecycle("Removing white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
def toRemove = i - hunksStart;
while (toRemove-- > 0)
newLines.remove(newLines.size() - 1)
didFix = true
}
else {
logger.lifecycle("Patch contains only white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
hasProblem = true
}
}
else {
if (!whiteSpaceErrors.empty)
hasProblem = true
whiteSpaceErrors.each { error -> logger.lifecycle(error) }
whiteSpaceErrors.clear()
}
hunksStart = i
onlyWhiteSpace = true
continue
}
if (line.startsWithAny('+','-')) {
def prefixChange = false
def prevLine = lines[i - 1]
if (line.charAt(0) == (char)'+' && prevLine.charAt(0) == (char)'-') {
def prevTrim = prevLine.substring(1).replaceAll("\\s", "")
def currTrim = line.substring(1).replaceAll("\\s", "")
if (prevTrim.equals(currTrim)) {
prefixChange = true
}
def pMatcher = field_pattern.matcher(prevLine)
def cMatcher = field_pattern.matcher(line)
if (pMatcher.find() && cMatcher.find() &&
pMatcher.group(6) == cMatcher.group(6) && // = ...
pMatcher.group(5) == cMatcher.group(5) && // field name
pMatcher.group(3) == cMatcher.group(3) && // static
(accessMap[pMatcher.group(2)] < accessMap[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
logger.lifecycle("Patch contains access changes or final removal at line {}, file: {}", i + 1, patchPath)
hasProblem = true
}
pMatcher = method_pattern.matcher(prevLine)
cMatcher = method_pattern.matcher(line)
if (pMatcher.find() && cMatcher.find() &&
pMatcher.group(6) == cMatcher.group(6) && // params
pMatcher.group(5) == cMatcher.group(5) && // <T> void name
pMatcher.group(3) == cMatcher.group(3) && // static
(accessMap[pMatcher.group(2)] < accessMap[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
logger.lifecycle("Patch contains access changes or final removal at line {}, file: {}", i + 1, patchPath)
hasProblem = true
}
pMatcher = class_pattern.matcher(prevLine)
cMatcher = class_pattern.matcher(line)
if (pMatcher.find() && cMatcher.find() &&
pMatcher.group(6) == cMatcher.group(6) && // ClassName<> extends ...
pMatcher.group(5) == cMatcher.group(5) && // class | interface
pMatcher.group(3) == cMatcher.group(3) && // static
(accessMap[pMatcher.group(2)] < accessMap[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
logger.lifecycle("Patch contains access changes or final removal at line {}, file: {}", i + 1, patchPath)
hasProblem = true
}
}
if (line.charAt(0) == (char)'-' && i + 1 < lines.size()) {
def nextLine = lines[i + 1]
if (nextLine.charAt(0) == (char)'+') {
def nextTrim = nextLine.substring(1).replaceAll("\\s", "")
def currTrim = line.substring(1).replaceAll("\\s", "")
if (nextTrim.equals(currTrim)) {
prefixChange = true
}
}
}
def isWhiteSpaceChange = white_space_pattern.matcher(line).find()
if (!prefixChange && !isWhiteSpaceChange) {
onlyWhiteSpace = hasS2SArtifact && import_pattern.matcher(line).find()
}
else if (isWhiteSpaceChange) {
def prevLineChange = prevLine.startsWithAny('+','-')
def nextLineChange = i + 1 < lines.size() && lines[i + 1].startsWithAny('+','-')
if (!prevLineChange && !nextLineChange) {
whiteSpaceErrors.add(String.format("Patch contains white space change in valid hunk at line %d (cannot auto fix), file: %s", i + 1, patchPath))
}
}
if (line.contains("\t")) {
if (!fix) {
logger.lifecycle("Patch contains tabs on line {}, file: {}", i + 1, patchPath)
hasProblem = true
}
else {
logger.lifecycle("Fixing tabs on line {}, file: {}", i + 1, patchPath)
line = line.replaceAll('\t', ' ')
newLines.remove(newLines.size() - 1)
newLines.add(line + '\n')
didFix = true
}
}
if (import_pattern.matcher(line).find() && !hasS2SArtifact) {
logger.lifecycle("Patch contains import change on line {}, file: {}", i + 1, patchPath)
hasProblem = true
}
}
}
if (onlyWhiteSpace) {
if (fix || hasS2SArtifact) {
logger.lifecycle("Removing white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
def toRemove = i - hunksStart;
while (toRemove-- > 0)
newLines.remove(newLines.size() - 1)
didFix = true
}
else {
logger.lifecycle("Patch contains only white space hunk starting at line {}, file: {}", hunksStart + 1, patchPath)
hasProblem = true
}
}
else {
if (!whiteSpaceErrors.empty)
hasProblem = true
whiteSpaceErrors.each { error -> logger.lifecycle(error) }
}
if (didFix) {
if (newLines.size() <= 2) {
logger.lifecycle("Patch is now empty removing, file: {}", patchPath)
Files.delete(patch.toPath())
}
else {
if (!hasS2SArtifact)
logger.lifecycle("*** Updating patch file. Please run setup then genPatches again. ***")
patch.withWriter('UTF-8') { writer ->
newLines.each { l -> writer.write(l) }
}
}
}
return !hasProblem
}
}
@@ -0,0 +1,31 @@
package net.minecraftforge.forge.tasks
import java.util.function.BiConsumer
public class ClosureHelper {
BiConsumer<String, Closure> callback
public ClosureHelper(Closure cl, BiConsumer<String, Closure> callback) {
this.callback = callback
apply(this, cl)
}
def methodMissing(String name, Object args) {
if (!args.class.isArray()) return
Object[] aargs = (Object[])args
if (aargs.length == 1 && aargs[0] instanceof Closure) {
this.callback.accept(name, (Closure)aargs[0])
} else {
throw new IllegalArgumentException('Unknown method: "' + name + '" with arguments ' + args + ' for ' + this)
}
}
static <T> T apply(T obj, Closure cl) {
cl.delegate = obj
cl.resolveStrategy = Closure.DELEGATE_FIRST
cl()
return obj
}
}
@@ -0,0 +1,73 @@
package net.minecraftforge.forge.tasks
import org.gradle.api.DefaultTask
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream
import java.util.zip.ZipOutputStream
abstract class Crowdin extends DefaultTask {
@Input abstract Property<String> getId()
@Input @Optional abstract Property<String> getKey()
@Input boolean json = true
@OutputFile abstract RegularFileProperty getOutput()
@OutputFile abstract RegularFileProperty getExport()
Crowdin() {
outputs.upToDateWhen{ false }
id.convention('minecraft-forge')
output.convention(project.layout.buildDirectory.dir(name).map {it.file("output.zip") })
export.convention(project.layout.buildDirectory.dir(name).map {it.file("export.json") })
}
@TaskAction
def run() {
File outputFile = output.get().asFile
File exportFile = export.get().asFile
if (outputFile.exists())
outputFile.delete()
if (!key.isPresent())
return
String key = this.key.get()
String id = this.id.get()
// Force an export
new URL("https://api.crowdin.com/api/project/${id}/export?key=${key}").withInputStream { i ->
exportFile.withOutputStream { it << i }
}
if (!exportFile.text.contains('success')) {
throw new RuntimeException("Crowdin export failed, see ${exportFile} for more info")
}
new URL("https://api.crowdin.com/api/project/${id}/download/all.zip?key=${key}").withInputStream { i ->
new ZipInputStream(i).withCloseable { zin ->
outputFile.withOutputStream { out ->
new ZipOutputStream(out).withCloseable { zout ->
ZipEntry zein
while ((zein = zin.nextEntry) != null) {
if (zein.isDirectory()) {
zout.putNextEntry(new ZipEntry(zein.name))
} else {
// 1.13+ uses json
if (zein.name.endsWith('.json') == json) {
ZipEntry zeout = new ZipEntry(json ? zein.name.toLowerCase() : zein.name)
zeout.time = 1
zout.putNextEntry(zeout)
zout << zin
}
}
}
}
}
}
}
}
}
@@ -0,0 +1,51 @@
package net.minecraftforge.forge.tasks
import org.gradle.api.DefaultTask
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.nio.file.Files
abstract class DownloadLibraries extends DefaultTask {
@InputFile abstract RegularFileProperty getInput()
@OutputDirectory abstract DirectoryProperty getOutput()
@OutputFile abstract RegularFileProperty getLibrariesOutput()
DownloadLibraries() {
output.convention(project.layout.buildDirectory.dir(name))
librariesOutput.convention(project.layout.buildDirectory.dir(name).map(d -> d.file('libraries.txt')))
}
@TaskAction
def run() {
Util.init()
File outputDir = output.get().asFile
def libraries = new ArrayList()
def json = input.get().asFile.json().libraries.each { lib ->
//TODO: Thread?
def artifacts = [lib.downloads.artifact] + lib.downloads.get('classifiers', [:]).values()
artifacts.each{ art ->
def target = new File(outputDir, art.path)
libraries.add(target.absolutePath)
if (!target.exists() || !art.sha1.equals(target.sha1())) {
project.logger.lifecycle("Downloading ${art.url}")
if (!target.parentFile.exists()) {
target.parentFile.mkdirs()
}
new URL(art.url).withInputStream { i ->
target.withOutputStream { it << i }
}
if (!art.sha1.equals(target.sha1())) {
throw new IllegalStateException("Failed to download ${art.url} to ${target.canonicalPath} SHA Mismatch")
}
}
}
}
Files.write(librariesOutput.get().asFile.toPath(), libraries)
}
}
@@ -0,0 +1,100 @@
package net.minecraftforge.forge.tasks
import groovy.transform.EqualsAndHashCode
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.Nested
import org.gradle.api.tasks.Optional
import org.objectweb.asm.tree.ClassNode
import org.objectweb.asm.tree.MethodNode
import static org.objectweb.asm.Opcodes.*
abstract class FieldCompareFinder extends BytecodeFinder {
@Nested
Map<String, Search> fields = [:] as HashMap
@Internal
Map<Search, String> fieldsReverse = [:] as HashMap
@Internal
Map<String, Set<ObjectTarget>> targets = [:] as TreeMap
@Override
protected pre() {
//fields.each{ k,v -> logger.lifecycle("Fields: " + k + ' ' + v) }
}
@Override
protected process(ClassNode parent, MethodNode node) {
def last = null
def parentInstance = new ObjectTarget(owner: parent.name, name: '', desc: '')
for (int x = 0; x < node.instructions.size(); x++) {
def current = node.instructions.get(x)
if (current.opcode == IF_ACMPEQ || current.opcode == IF_ACMPNE) {
if (last != null && (last.opcode == GETSTATIC || last.opcode == GETFIELD)) {
def target = new Search(cls: last.owner, name: last.name)
def wanted = fieldsReverse.get(target)
def original = fields.get(wanted)
def instance = new ObjectTarget(owner: parent.name, name: node.name, desc: node.desc)
if (wanted != null && (original.blacklist == null || (!original.blacklist.contains(instance) && !original.blacklist.contains(parentInstance)))) {
targets.computeIfAbsent(wanted, { k -> new TreeSet() }).add(instance)
}
}
}
last = current
}
}
@Internal
@Override
protected Object getData() {
def ret = [:] as HashMap
targets.forEach{ k, v ->
def e = fields.get(k)
ret[k] = [
cls: e.cls,
name: e.name,
replacement: e.replacement,
targets: v
]
}
return ret
}
@EqualsAndHashCode(excludes = ['replacement', 'blacklist'])
public static class Search {
@Input
String cls
@Input
String name
@Input
String replacement
@Nested
@Optional
Set<ObjectTarget> blacklist
@Override
String toString() {
return cls + '.' + name
}
def blacklist(def owner, def name, def desc) {
if (blacklist == null)
blacklist = new HashSet()
blacklist.add(new ObjectTarget(owner: owner, name: name, desc: desc))
}
def blacklist(def owner) {
blacklist(owner, '', '')
}
}
def fields(Closure cl) {
new ClosureHelper(cl, {name, ccl ->
def search = ClosureHelper.apply(new Search(), ccl)
this.fields.put(name, search)
this.fieldsReverse.put(search, name)
})
}
}
@@ -0,0 +1,49 @@
package net.minecraftforge.forge.tasks
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import groovy.transform.CompileStatic
import groovy.transform.TupleConstructor
@CompileStatic
@TupleConstructor
final class InheritanceData implements Annotatable {
String name
int access
String superName
List<String> interfaces = []
Map<String, Method> methods = [:]
Map<String, Field> fields = [:]
List<Annotation> annotations = []
@TupleConstructor
static final class Method implements Annotatable {
int access
String override
List<Annotation> annotations = []
}
@TupleConstructor
static final class Field implements Annotatable {
int access
String desc
List<Annotation> annotations = []
}
@TupleConstructor
static final class Annotation {
String desc
}
private static final Gson GSON = new Gson()
static Map<String, InheritanceData> parse(File file) {
try (final reader = file.newReader()) {
return GSON.fromJson(reader, new TypeToken<Map<String, InheritanceData>>() {})
}
}
}
@CompileStatic
interface Annotatable {
List<InheritanceData.Annotation> getAnnotations()
}
@@ -0,0 +1,44 @@
package net.minecraftforge.forge.tasks
import org.apache.commons.io.IOUtils
import org.gradle.api.DefaultTask
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream
import java.util.zip.ZipOutputStream
abstract class MergeJars extends DefaultTask {
MergeJars() {
output.convention(project.layout.buildDirectory.dir(name).map { it.file('output.jar') })
}
@TaskAction
void run() {
def jars = inputJars.files
try (ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(output.get().asFile))) {
for (def jar : jars) {
try (ZipInputStream zin = new ZipInputStream(new FileInputStream(jar))) {
def entry
while ((entry = zin.getNextEntry()) != null) {
ZipEntry _new = new ZipEntry(entry.getName())
_new.setTime(0) //SHOULD be the same time as the main entry, but NOOOO _new.setTime(entry.getTime()) throws DateTimeException, so you get 0, screw you!
zout.putNextEntry(_new)
IOUtils.copy(zin, zout)
}
}
}
}
}
@InputFiles
abstract ConfigurableFileCollection getInputJars()
@OutputFile
abstract RegularFileProperty getOutput()
}
@@ -0,0 +1,32 @@
package net.minecraftforge.forge.tasks
import groovy.transform.EqualsAndHashCode
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Nested
import org.gradle.api.tasks.Optional
@EqualsAndHashCode
public class ObjectTarget implements Comparable<ObjectTarget> {
@Input
String owner
@Input
String name
@Input
@Optional
String desc
@Override
String toString() {
if (desc == null)
return owner + '.' + name
return owner + '.' + name + desc
}
@Override
int compareTo(ObjectTarget o) {
return toString().compareTo(o.toString())
}
}
@@ -0,0 +1,47 @@
package net.minecraftforge.forge.tasks
import org.gradle.api.DefaultTask
import org.gradle.api.artifacts.Dependency
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.nio.file.Files
import java.nio.file.StandardCopyOption
abstract class SetupCheckJarCompatibility extends DefaultTask {
SetupCheckJarCompatibility() {
group = 'jar compatibility'
onlyIf {
inputVersion.getOrNull() != null
}
outputs.upToDateWhen { false } // Never up to date, because this setup task should always run
baseBinPatchesOutput.convention(project.layout.buildDirectory.dir(name).map { it.file('joined.lzma') })
}
@TaskAction
void run() {
def inputVersion = inputVersion.get()
def baseForgeUserdev = project.layout.buildDirectory.dir(name).map { it.file("forge-${inputVersion}-userdev.jar") }.get().asFile
project.rootProject.extensions.download.run {
src "https://maven.minecraftforge.net/net/minecraftforge/forge/${inputVersion}/forge-${inputVersion}-userdev.jar"
dest baseForgeUserdev
}
def joinedLzma = project.zipTree(baseForgeUserdev).matching { it.include('joined.lzma') }.singleFile
Files.copy(joinedLzma.toPath(), baseBinPatchesOutput.get().asFile.toPath(), StandardCopyOption.REPLACE_EXISTING)
}
@Input
@Optional
abstract Property<String> getInputVersion()
@OutputFile
abstract RegularFileProperty getBaseBinPatchesOutput()
}
@@ -0,0 +1,133 @@
package net.minecraftforge.forge.tasks
import groovy.json.JsonSlurper
import java.security.MessageDigest
import java.text.SimpleDateFormat
public class Util {
static void init() {
File.metaClass.sha1 = { ->
MessageDigest md = MessageDigest.getInstance('SHA-1')
delegate.eachByte 4096, {bytes, size ->
md.update(bytes, 0, size)
}
return md.digest().collect {String.format "%02x", it}.join()
}
File.metaClass.json = { -> new JsonSlurper().parseText(delegate.text) }
Date.metaClass.iso8601 = { ->
def format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
def result = format.format(delegate)
return result[0..21] + ':' + result[22..-1]
}
String.metaClass.rsplit = { String del, int limit = -1 ->
def lst = new ArrayList()
def x = 0, idx
def tmp = delegate
while ((idx = tmp.lastIndexOf(del)) != -1 && (limit == -1 || x++ < limit)) {
lst.add(0, tmp.substring(idx + del.length(), tmp.length()))
tmp = tmp.substring(0, idx)
}
lst.add(0, tmp)
return lst
}
}
public static String[] getClasspath(project, libs, artifact) {
def ret = []
artifactTree(project, artifact).each { key, lib ->
libs[lib.name] = lib
if (lib.name != artifact)
ret.add(lib.name)
}
return ret
}
public static def getArtifacts(project, config, classifiers) {
def ret = [:]
config.resolvedConfiguration.resolvedArtifacts.each {
def art = [
group: it.moduleVersion.id.group,
name: it.moduleVersion.id.name,
version: it.moduleVersion.id.version,
classifier: it.classifier,
extension: it.extension,
file: it.file
]
def key = art.group + ':' + art.name
def folder = "${art.group.replace('.', '/')}/${art.name}/${art.version}/"
def filename = "${art.name}-${art.version}"
if (art.classifier != null)
filename += "-${art.classifier}"
filename += ".${art.extension}"
def path = "${folder}${filename}"
def url = "https://libraries.minecraft.net/${path}"
if (!checkExists(url)) {
url = "https://maven.minecraftforge.net/${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'
// However, keep the path normal so that our mirror system works.
art.version = "${art.version}-${art.classifier}"
art.classifier = null
art.extension = 'jar'
}
ret[key] = [
name: "${art.group}:${art.name}:${art.version}" + (art.classifier == null ? '' : ":${art.classifier}") + (art.extension == 'jar' ? '' : "@${art.extension}"),
downloads: [
artifact: [
path: path,
url: url,
sha1: sha1(art.file),
size: art.file.length()
]
]
]
}
return ret
}
public static def iso8601Now() { new Date().iso8601() }
public static def sha1(file) {
MessageDigest md = MessageDigest.getInstance('SHA-1')
file.eachByte 4096, {bytes, size ->
md.update(bytes, 0, size)
}
return md.digest().collect {String.format "%02x", it}.join()
}
private static def artifactTree(project, artifact) {
if (!project.ext.has('tree_resolver'))
project.ext.tree_resolver = 1
def cfg = project.configurations.create('tree_resolver_' + project.ext.tree_resolver++)
def dep = project.dependencies.create(artifact)
cfg.dependencies.add(dep)
def files = cfg.resolve()
return getArtifacts(project, cfg, true)
}
private static boolean checkExists(url) {
try {
def code = new URL(url).openConnection().with {
requestMethod = 'HEAD'
connect()
responseCode
}
return code == 200
} catch (Exception e) {
if (e.toString().contains('unable to find valid certification path to requested target'))
throw new RuntimeException('Failed to connect to ' + url + ': Missing certificate root authority, try updating java')
throw e
}
}
public static String getLatestForgeVersion(mcVersion) {
def json = new JsonSlurper().parseText(new URL("https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json").getText("UTF-8"))
return json.promos["$mcVersion-latest"]
}
}
@@ -0,0 +1,310 @@
package net.minecraftforge.forge.tasks.checks
import groovy.transform.CompileStatic
import groovy.transform.TupleConstructor
import net.minecraftforge.forge.tasks.InheritanceData
import net.minecraftforge.srgutils.IMappingFile
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.RegularFile
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.Optional
import org.objectweb.asm.Opcodes
@CompileStatic
abstract class CheckATs extends CheckTask {
@InputFile abstract RegularFileProperty getInheritance()
@InputFiles abstract ConfigurableFileCollection getAts()
@InputFile @Optional abstract RegularFileProperty getMappings()
@Override
void check(Reporter reporter, boolean fix) {
final IMappingFile mappings = mappings.map { RegularFile it -> IMappingFile.load(it.asFile) }.getOrNull()
final inheritance = InheritanceData.parse(this.inheritance.get().asFile)
ats.each {
final lines = process(it, reporter, inheritance)
if (fix) {
it.text = joinBack(lines, inheritance, mappings).join('\n')
}
}
}
private static TreeMap<String, ATParser.Entry> process(File file, Reporter reporter, Map<String, InheritanceData> inheritance) {
final TreeMap<String, ATParser.Entry> lines = ATParser.parse(file.readLines(), reporter)
final Map<String, ATParser.Entry> constructorGroups = [:]
final itr = lines.entrySet().iterator()
final toRemove = []
while (itr.hasNext()) {
final next = itr.next()
String key = next.key
final entry = next.value
if (entry === null) continue
final binaryName = entry.cls.replaceAll('\\.', '/')
// Process Groups, this will remove any entries outside the group that is covered by the group
if (entry.group) {
final jcls = inheritance[binaryName]
if (jcls === null) {
itr.remove()
reporter.report("Invalid group: $key")
} else if ('*' == entry.desc) {
if (!jcls.fields) {
itr.remove()
reporter.report("Invalid group, class has no fields: $key")
} else {
jcls.fields.each { field, value ->
final fkey = entry.cls + ' ' + field
if (accessLevel(value.access) < accessStr(entry.modifier)) {
if (lines.containsKey(fkey)) {
toRemove.add(fkey)
} else if (!entry.existing.contains(fkey)) {
reporter.report("Missing group entry: $fkey")
}
entry.children.add(fkey)
} else if (lines.containsKey(fkey)) {
toRemove.add(fkey)
reporter.report("Found invalid group entry: $fkey")
}
}
entry.existing.findAll { it !in entry.children }.each { println('Removed: ' + it) }
}
} else if ('*()' == entry.desc) {
if (!jcls.methods) {
itr.remove()
reporter.report("Invalid group, class has no methods: $key")
} else {
jcls.methods.each { mtd, value ->
if (mtd.startsWith('<clinit>') || mtd.startsWith('lambda$')) return
key = entry.cls + ' ' + mtd.replace(' ', '')
if (accessLevel(value.access) < accessStr(entry.modifier)) {
if (lines.containsKey(key)) {
toRemove.add(key)
} else if (!entry.existing.contains(key)) {
reporter.report("Missing group entry: $key")
}
entry.children.add(key)
} else if (lines.containsKey(key)) {
toRemove.add(key)
reporter.report("Found invalid group entry: $key")
}
}
entry.existing.findAll { it !in entry.children }.each { println('Removed: ' + it) }
}
} else if ('<init>' == entry.desc) { //Make all public non-abstract subclasses
constructorGroups.put(binaryName, entry)
}
}
// Process normal lines, remove invalid and remove narrowing
else {
def jcls = inheritance.get(binaryName)
if (jcls === null) {
itr.remove()
reporter.report("Invalid: $key")
} else if (entry.desc == '') {
if (accessLevel(jcls.access) > accessStr(entry.modifier) && (entry.comment === null || !entry.comment.startsWith('#force '))) {
itr.remove()
reporter.report("Invalid Narrowing: $key")
}
} else if (!entry.desc.contains('(')) {
if (!jcls.fields || !jcls.fields.containsKey(entry.desc)) {
itr.remove()
reporter.report("Invalid: $key")
} else {
final value = jcls.fields[entry.desc]
if (accessLevel(value.access) > accessStr(entry.modifier) && (entry.comment === null || !entry.comment.startsWith('#force '))) {
itr.remove()
reporter.report("Invalid Narrowing: $key - ${entry.comment}")
}
}
} else {
final jdesc = entry.desc.replace('(', ' (')
if (!jcls.methods || !jcls.methods.containsKey(jdesc)) {
itr.remove()
reporter.report("Invalid: $key")
} else {
final value = jcls.methods[jdesc]
if (accessLevel(value.access) > accessStr(entry.modifier) && (entry.comment === null || !entry.comment.startsWith('#force '))) {
itr.remove()
reporter.report("Invalid Narrowing: $key")
}
}
}
}
}
inheritance.each { tcls, value ->
if (!value.methods || ((value.access & Opcodes.ACC_ABSTRACT) !== 0)) return
String parent = tcls
while (parent !== null) {
constructorGroups[parent]?.tap { entry ->
value.methods.each { mtd, v ->
if (mtd.startsWith('<init>')) {
final child = tcls.replaceAll('/', '\\.') + ' ' + mtd.replace(' ', '')
if (accessLevel(v.access) < 3) {
if (lines.containsKey(child)) {
toRemove.add(child)
} else if (child !in entry.existing) {
reporter.report("Missing group entry: $child")
}
entry.children.add(child)
} else if (lines.containsKey(child)) {
toRemove.add(child)
reporter.report("Found invalid group entry: $child")
}
}
}
}
parent = inheritance[parent]?.superName
}
}
constructorGroups.values().each { entry -> entry.existing.findAll { it !in entry.children }.each{ reporter.report("Found invalid group entry: $it") } }
toRemove.each(lines.&remove)
return lines
}
private static List<String> joinBack(TreeMap<String, ATParser.Entry> lines, Map<String, InheritanceData> inheritance, IMappingFile mappings) {
final List<String> data = []
final remapComment = { ATParser.Entry entry ->
if (!mappings || !entry || !entry.desc) return null
final comment = entry.comment?.substring(1)?.trim()
final jsonCls = inheritance.get(entry.cls.replaceAll('\\.', '/'))
final mappingsClass = mappings?.getClass(jsonCls.name)
if (mappingsClass === null) return entry.comment
final idx = entry.desc.indexOf('(')
String mappedName = idx == -1
? mappingsClass.remapField(entry.desc)
: mappingsClass.remapMethod(entry.desc.substring(0, idx), entry.desc.substring(idx))
if (!mappedName) return entry.comment
if (mappedName == '<init>')
mappedName = 'constructor'
if (comment?.startsWith(mappedName))
return '# ' + comment
if (comment && comment.indexOf(' ') !== -1) {
def split = comment.split(' - ').toList()
if (split[0].indexOf(' ') !== -1)
// The first string is more than one word, so append before it
return "# ${mappedName} - ${comment}"
split.remove(0)
return "# ${mappedName} - ${String.join(' - ', split)}"
}
return '# ' + mappedName
}
lines.each { key, value ->
if (!value.group) {
def comment = remapComment.call(value)
data.add(value.modifier + ' ' + key + (comment ? ' ' + comment : ''))
} else {
data.add(('#group ' + value.modifier + ' ' + key + ' ' + (value.comment ?: '')).trim())
value.children.each {
final line = value.modifier + ' ' + it
final entry = ATParser.parseEntry(line)
final comment = remapComment(entry)
data.add(line + (comment ? ' ' + comment : ''))
}
data.add('#endgroup')
}
}
return data
}
static int accessStr(String access) {
if (access.endsWith('-f') || access.endsWith('+f')) return 4
switch (access.toLowerCase()) {
case 'public': return 3
case 'protected': return 2
case 'default': return 1
case 'private': return 0
default: return -1
}
}
static int accessLevel(int access) {
if ((access & Opcodes.ACC_PUBLIC) !== 0) return 3
if ((access & Opcodes.ACC_PROTECTED) !== 0) return 2
if ((access & Opcodes.ACC_PRIVATE) !== 0) return 0
return 1
}
}
@CompileStatic
class ATParser {
static TreeMap<String, Entry> parse(List<String> lines, CheckTask.Reporter reporter) {
TreeMap<String, Entry> outLines = new TreeMap<>()
Entry group = null
for (final line : lines) {
if (line.isEmpty()) continue
if (line.startsWith('#group ')) {
final entry = parseEntry(line.substring(7))
if (entry.desc != '*' && entry.desc != '*()' && entry.desc != '<init>') {
reporter.report("Invalid group: $line", false)
}
entry.group = true
entry.children = []
entry.existing = []
group = entry
if (outLines.containsKey(entry.key)) {
reporter.report("Duplicate group: $line", false)
}
outLines[entry.key] = group
} else if (group !== null) {
if (line.startsWith('#endgroup')) {
group = null
} else {
final key = parseEntry(line).key
group.existing.add(key)
}
} else if (line.startsWith('#endgroup')) {
reporter.report("Invalid group ending: $line", false)
} else if (line.startsWith('#')) {
//Nom
} else {
final entry = parseEntry(line)
if (outLines.containsKey(entry.key)) {
reporter.report("Found duplicate: $line")
continue
}
outLines[entry.key] = entry
}
}
return outLines
}
static Entry parseEntry(String line) {
final idx = line.indexOf('#')
final String comment = idx === -1 ? null : line.substring(idx)
if (idx !== -1) line = line.substring(0, idx - 1)
final data = (line.trim() + ' ').split(' ', -1)
new Entry(data[0], data[1], data[2], comment)
}
@TupleConstructor
static final class Entry {
String modifier, cls, desc, comment
Set<String> existing
TreeSet<String> children
boolean group = false
@Lazy
String key = {cls + (desc.isEmpty() ? '' : ' ' + desc)}()
Object getAt(String key) {
return getProperty(key)
}
}
}
@@ -0,0 +1,93 @@
package net.minecraftforge.forge.tasks.checks
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.InputFiles
import org.objectweb.asm.ClassReader
import org.objectweb.asm.ClassVisitor
import org.objectweb.asm.MethodVisitor
import org.objectweb.asm.Opcodes
import org.objectweb.asm.Type
import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream
abstract class CheckExcs extends CheckTask {
@InputFile abstract RegularFileProperty getBinary()
@InputFiles abstract ConfigurableFileCollection getExcs()
@Override
void check(Reporter reporter, boolean fix) {
final Set<String> known = []
collectKnown(known)
excs.each { f ->
final lines = []
f.eachLine { line ->
def idx = line.indexOf('#')
if (idx == 0 || line.isEmpty()) {
return
}
if (idx != -1) line = line.substring(0, idx - 1)
if (!line.contains('=')) {
reporter.report("Invalid: $line")
return
}
def (String key, String value) = line.split('=', 2)
if (!known.contains(key)) {
reporter.report("Unknown: $line")
return
}
String desc = key.split('\\.', 2)[1]
if (!desc.contains('(')) {
reporter.report("Invalid: $line")
return
}
desc = '(' + desc.split('\\(', 2)[1]
def (exceptions, String args) = value.contains('|') ? value.split('|', 2) : [value, '']
if (args.split(',').length !== Type.getArgumentTypes(desc).length) {
reporter.report("Invalid: $line")
return
}
lines.add(line)
}
if (fix) f.text = lines.sort().join('\n')
}
}
private void collectKnown(Collection<String> known) {
binary.get().asFile.withInputStream { i ->
new ZipInputStream(i).withCloseable { zin ->
final visitor = new ClassVisitor(Opcodes.ASM9) {
private String cls
@Override
void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
this.cls = name
}
@Override
MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
known.add(this.cls + '.' + name + descriptor)
super.visitMethod(access, name, descriptor, signature, exceptions)
}
}
ZipEntry zein
while ((zein = zin.nextEntry) !== null) {
if (zein.name.endsWith('.class')) {
ClassReader reader = new ClassReader(zin)
reader.accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES)
}
}
}
}
}
}
@@ -0,0 +1,9 @@
package net.minecraftforge.forge.tasks.checks
import groovy.transform.CompileStatic
@CompileStatic
enum CheckMode {
CHECK,
FIX
}
@@ -0,0 +1,177 @@
package net.minecraftforge.forge.tasks.checks
import groovy.transform.CompileStatic
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.provider.ListProperty
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.Optional
import java.nio.file.Files
import java.nio.file.Path
import java.util.regex.Pattern
@CompileStatic
abstract class CheckPatches extends CheckTask {
private static final Pattern HUNK_START_PATTERN = Pattern.compile('^@@ -[0-9,]* \\+[0-9,_]* @@$')
private static final Pattern WHITESPACE_PATTERN = Pattern.compile('^[+\\-]\\s*$')
private static final Pattern IMPORT_PATTERN = Pattern.compile('^[+\\-]\\s*import.*')
private static final Pattern FIELD_PATTERN = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^=;]*)(=.*)?;\\s*$')
private static final Pattern METHOD_PATTERN = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^(]*)[(]([^)]*)?[)]\\s*[{]\\s*$')
private static final Pattern CLASS_PATTERN = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final[\\s]*)?(class|interface)([^{]*)[{]\\s*$')
private static final Map<String, Integer> ACCESS_MAP = [private: 0, protected: 2, public: 3].tap { it.put(null, 1) }
@InputDirectory abstract DirectoryProperty getPatchDir()
@Input @Optional abstract ListProperty<String> getPatchesWithS2SArtifact()
@Override
void check(Reporter reporter, boolean fix) {
final patchDir = getPatchDir().get().asFile.toPath()
Files.walk(patchDir).withCloseable {
it.filter(Files.&isRegularFile).forEach { path ->
final String relativeName = patchDir.relativize(path).toString()
verifyPatch(path, reporter, fix, relativeName, patchesWithS2SArtifact.get().contains(relativeName.replace('\\', '/')))
}
}
}
void verifyPatch(Path patch, Reporter reporter, boolean fix, String patchPath, boolean hasS2SArtifact) {
final oldFixedErrors = reporter.fixed.size()
final lines = Files.readAllLines(patch)
int hunksStart = 0
boolean onlyWhiteSpace = false
final List<String> newLines = []
// First two lines are file name ++/-- and we do not care
newLines.add(lines[0] + '\n')
newLines.add(lines[1] + '\n')
int i
for (i = 2; i < lines.size(); ++i) {
def line = lines[i]
newLines.add(line + '\n')
if (HUNK_START_PATTERN.matcher(line).find()) {
if (onlyWhiteSpace) {
if (!hasS2SArtifact)
reporter.report("Patch contains only white space hunk starting at line ${hunksStart + 1}, file: $patchPath")
int toRemove = i - hunksStart
while (toRemove-- > 0)
newLines.remove(newLines.size() - 1)
}
hunksStart = i
onlyWhiteSpace = true
continue
}
if (line.startsWithAny('+','-')) {
def prefixChange = false
def prevLine = lines[i - 1]
if (line.charAt(0) == (char)'+' && prevLine.charAt(0) == (char)'-') {
def prevTrim = prevLine.substring(1).replaceAll("\\s", "")
def currTrim = line.substring(1).replaceAll("\\s", "")
if (prevTrim == currTrim) {
prefixChange = true
}
def pMatcher = FIELD_PATTERN.matcher(prevLine)
def cMatcher = FIELD_PATTERN.matcher(line)
if (pMatcher.find() && cMatcher.find() &&
pMatcher.group(6) == cMatcher.group(6) && // = ...
pMatcher.group(5) == cMatcher.group(5) && // field name
pMatcher.group(3) == cMatcher.group(3) && // static
(ACCESS_MAP[pMatcher.group(2)] < ACCESS_MAP[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false)
}
pMatcher = METHOD_PATTERN.matcher(prevLine)
cMatcher = METHOD_PATTERN.matcher(line)
if (pMatcher.find() && cMatcher.find() &&
pMatcher.group(6) == cMatcher.group(6) && // params
pMatcher.group(5) == cMatcher.group(5) && // <T> void name
pMatcher.group(3) == cMatcher.group(3) && // static
(ACCESS_MAP[pMatcher.group(2)] < ACCESS_MAP[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false)
}
pMatcher = CLASS_PATTERN.matcher(prevLine)
cMatcher = CLASS_PATTERN.matcher(line)
if (pMatcher.find() && cMatcher.find() &&
pMatcher.group(6) == cMatcher.group(6) && // ClassName<> extends ...
pMatcher.group(5) == cMatcher.group(5) && // class | interface
pMatcher.group(3) == cMatcher.group(3) && // static
(ACCESS_MAP[pMatcher.group(2)] < ACCESS_MAP[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false)
}
}
if (line.charAt(0) == (char)'-' && i + 1 < lines.size()) {
final nextLine = lines[i + 1]
if (nextLine.charAt(0) == (char)'+') {
final nextTrim = nextLine.substring(1).replaceAll("\\s", "")
final currTrim = line.substring(1).replaceAll("\\s", "")
if (nextTrim == currTrim) {
prefixChange = true
}
}
}
final isWhiteSpaceChange = WHITESPACE_PATTERN.matcher(line).find()
if (!prefixChange && !isWhiteSpaceChange) {
onlyWhiteSpace = hasS2SArtifact && IMPORT_PATTERN.matcher(line).find()
} else if (isWhiteSpaceChange) {
final prevLineChange = prevLine.startsWithAny('+','-')
final nextLineChange = i + 1 < lines.size() && lines[i + 1].startsWithAny('+','-')
if (!prevLineChange && !nextLineChange) {
reporter.report("Patch contains white space change in valid hunk at line ${i + 1}, file: $patchPath", false)
}
}
if (line.contains('\t')) {
reporter.report("Patch contains tabs on line ${i + 1}, file: $patchPath")
line = line.replaceAll('\t', ' ')
newLines.remove(newLines.size() - 1)
newLines.add(line + '\n')
}
if (IMPORT_PATTERN.matcher(line).find() && !hasS2SArtifact) {
reporter.report("Patch contains import change on line ${i + 1}, file: $patchPath", false)
}
}
}
if (onlyWhiteSpace) {
if (!hasS2SArtifact)
reporter.report("Patch contains only white space hunk starting at line ${hunksStart + 1}, file: $patchPath")
def toRemove = i - hunksStart;
while (toRemove-- > 0)
newLines.remove(newLines.size() - 1)
}
if ((reporter.fixed.size() > oldFixedErrors && fix) || hasS2SArtifact) {
if (newLines.size() <= 2) {
logger.lifecycle("Patch is now empty removing, file: {}", patchPath)
Files.delete(patch)
}
else {
if (!hasS2SArtifact)
logger.lifecycle("*** Updating patch file. Please run setup then genPatches again. ***")
Files.newBufferedWriter(patch).withCloseable {
newLines.each { l -> it.write(l) }
}
}
}
}
}
@@ -0,0 +1,110 @@
package net.minecraftforge.forge.tasks.checks
import groovy.transform.CompileStatic
import net.minecraftforge.forge.tasks.Annotatable
import net.minecraftforge.forge.tasks.InheritanceData
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.InputFiles
@CompileStatic
abstract class CheckSAS extends CheckTask {
@InputFile abstract RegularFileProperty getInheritance()
@InputFiles abstract ConfigurableFileCollection getSass()
@Override
void check(Reporter reporter, boolean fix) {
final inheritance = InheritanceData.parse(this.inheritance.get().asFile)
sass.each { f ->
final lines = []
f.eachLine { line ->
if (line[0] == '\t') return // Skip any tabbed lines, those are ones we add
final 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)
final spl = (line.trim().replace('(', ' (') + ' ').split(' ', -1)
def (String cls, String name, String desc) = [spl[0], spl[1], spl[2]]
cls = cls.replaceAll('\\.', '/')
if (inheritance[cls] === null) {
reporter.report("Invalid: $line")
} else if (name.isEmpty()) { //Class SAS
final toAdd = []
final clsSided = isSided(inheritance[cls])
boolean sided = clsSided
/* TODO: MergeTool doesn't do fields
if (json[cls]['fields'] != null) {
for (entry in json[cls]['fields']) {
if (isSided(entry.value)) {
sided = true
toAdd.add('\t' + cls + ' ' + entry.key)
}
}
} */
final clsInh = inheritance[cls]
if (clsInh.methods) {
for (entry in clsInh.methods) {
if (isSided(entry.value)) {
sided = true
toAdd.add('\t' + cls + ' ' + entry.key.replaceAll(' ', ''))
findChildMethods(inheritance, cls, entry.key).each { lines.add('\t' + it) }
findChildMethods(inheritance, cls, entry.key).each { println(line + ' -- ' + it) }
} else if (clsSided) {
findChildMethods(inheritance, cls, entry.key).each { lines.add('\t' + it) }
findChildMethods(inheritance, cls, entry.key).each { println(line + ' -- ' + it) }
}
}
}
if (sided) {
lines.add(cls + (comment == null ? '' : ' ' + comment))
lines.addAll(toAdd.sort())
} else {
reporter.report("Invalid: $line")
}
} else if (desc.isEmpty()) { // Fields
/* TODO: MergeTool doesn't do fields
if (json[cls]['fields'] != null && isSided(json[cls]['fields'][name]))
lines.add(cls + ' ' + name + (comment == null ? '' : ' ' + comment))
else */
reporter.report("Invalid: $line")
} else { // Methods
final clsInh = inheritance[cls]
if (clsInh.methods === null || !isSided(clsInh.methods[name + ' ' + desc]))
reporter.report("Invalid: $line")
else {
lines.add(cls + ' ' + name + desc + (comment == null ? '' : ' ' + comment))
findChildMethods(inheritance, cls, name + ' ' + desc).each { println(line + ' -- ' + it) }
findChildMethods(inheritance, cls, name + ' ' + desc).each { lines.add('\t' + it) }
}
}
}
if (fix) f.text = lines.join('\n')
}
}
protected static isSided(Annotatable annotatable) {
if (annotatable === null) return false
for (ann in annotatable.annotations) {
if ('Lnet/minecraftforge/api/distmarker/OnlyIn;' == ann.desc)
return true
}
return false
}
protected static findChildMethods(Map<String, InheritanceData> json, String cls, String desc) {
return json.values().findAll{ it.methods != null && it.methods[desc] != null && it.methods[desc].override == cls && isSided(it.methods[desc]) }
.collect { it.name + ' ' + desc.replace(' ', '') } as TreeSet
}
}
@@ -0,0 +1,109 @@
package net.minecraftforge.forge.tasks.checks
import groovy.transform.CompileStatic
import net.minecraftforge.forge.tasks.Util
import org.gradle.api.Action
import org.gradle.api.DefaultTask
import org.gradle.api.logging.LogLevel
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.TaskContainer
import org.gradle.api.tasks.VerificationTask
@CompileStatic
abstract class CheckTask extends DefaultTask implements VerificationTask {
@Input
abstract Property<CheckMode> getMode()
private boolean ignoreFailures = false
@Input
@Override
boolean getIgnoreFailures() {
return ignoreFailures
}
@Override
void setIgnoreFailures(boolean ignoreFailures) {
this.ignoreFailures = ignoreFailures
}
@TaskAction
void run() {
Util.init()
final doFix = getMode().get() === CheckMode.FIX
final Reporter reporter = new Reporter(doFix)
check(reporter, doFix)
if (reporter.messages) {
if (getMode().get() === CheckMode.CHECK) {
logger.error("Check task '{}' found errors:\n{}", name, reporter.messages.join('\n'))
if (!ignoreFailures) {
throw new IllegalArgumentException("${reporter.messages.size()} errors were found!")
}
} else {
if (logger.isEnabled(LogLevel.DEBUG)) {
logger.warn("Check task '{}' found {} errors and fixed {}:\n{}", name, reporter.messages.size(), reporter.fixed.size(), reporter.fixed.join('\n'))
} else {
logger.warn("Check task '{}' found {} errors and fixed {}.", name, reporter.messages.size(), reporter.fixed.size())
}
if (reporter.notFixed) {
logger.error('{} errors could not be fixed:\n{}', reporter.notFixed.size(), reporter.notFixed.join('\n'))
if (!ignoreFailures) {
throw new IllegalArgumentException("${reporter.notFixed.size()} errors which cannot be fixed were found!")
}
}
}
}
}
abstract void check(Reporter reporter, boolean fix)
@CompileStatic
static final class Reporter {
final boolean trackFixed
Reporter(boolean trackFixed) {
this.trackFixed = trackFixed
}
public final List<String> messages = []
public final List<String> fixed = []
public final List<String> notFixed = []
void report(String message, boolean canBeFixed = true) {
messages.add(message)
if (trackFixed) {
if (canBeFixed) {
fixed.add(message)
} else {
notFixed.add(message)
}
}
}
}
static <T extends CheckTask> void registerTask(TaskContainer tasks, String taskName, @DelegatesTo.Target('type') Class<T> clazz,
@DelegatesTo(genericTypeIndex = 0, target = 'type') Closure configuration) {
taskName = taskName.capitalize()
tasks.register("check$taskName", clazz) { CheckTask task ->
configuration.setDelegate((T) task)
configuration.call(task)
task.mode.set(CheckMode.CHECK)
task.group = 'checks'
}
tasks.named('checkAll').configure { it.dependsOn("check$taskName") }
tasks.register("checkAndFix$taskName", clazz) { CheckTask task ->
configuration.setDelegate((T) task)
configuration.call(task)
task.mode.set(CheckMode.FIX)
task.group = 'checks'
}
tasks.named('checkAllAndFix').configure { it.dependsOn("checkAndFix$taskName") }
}
}
+3 -3
View File
@@ -1,9 +1,9 @@
<img src="assets/Forge_logo.svg">
![Forge Logo](assets/Forge_logo.svg)
MinecraftForge
=============
[![Stable Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json&label=Stable&prefix=1.16.1-&query=$.promos["1.16.1-recommended"]&color=brightgreen&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtc3RhciBmYS13LTE4IiBhcmlhLWhpZGRlbj0idHJ1ZSIgZGF0YS1pY29uPSJzdGFyIiBkYXRhLXByZWZpeD0iZmFzIiBmb2N1c2FibGU9ImZhbHNlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCA1NzYgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjU5LjMgMTcuOEwxOTQgMTUwLjIgNDcuOSAxNzEuNWMtMjYuMiAzLjgtMzYuNyAzNi4xLTE3LjcgNTQuNmwxMDUuNyAxMDMtMjUgMTQ1LjVjLTQuNSAyNi4zIDIzLjIgNDYgNDYuNCAzMy43TDI4OCA0MzkuNmwxMzAuNyA2OC43YzIzLjIgMTIuMiA1MC45LTcuNCA0Ni40LTMzLjdsLTI1LTE0NS41IDEwNS43LTEwM2MxOS0xOC41IDguNS01MC44LTE3LjctNTQuNkwzODIgMTUwLjIgMzE2LjcgMTcuOGMtMTEuNy0yMy42LTQ1LjYtMjMuOS01Ny40IDB6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)](https://files.minecraftforge.net)
[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=1.16.1-&query=$.promos["1.16.1-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=
[![Stable Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Stable&prefix=1.16.5-&query=$.promos["1.16.5-recommended"]&color=brightgreen&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtc3RhciBmYS13LTE4IiBhcmlhLWhpZGRlbj0idHJ1ZSIgZGF0YS1pY29uPSJzdGFyIiBkYXRhLXByZWZpeD0iZmFzIiBmb2N1c2FibGU9ImZhbHNlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCA1NzYgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjU5LjMgMTcuOEwxOTQgMTUwLjIgNDcuOSAxNzEuNWMtMjYuMiAzLjgtMzYuNyAzNi4xLTE3LjcgNTQuNmwxMDUuNyAxMDMtMjUgMTQ1LjVjLTQuNSAyNi4zIDIzLjIgNDYgNDYuNCAzMy43TDI4OCA0MzkuNmwxMzAuNyA2OC43YzIzLjIgMTIuMiA1MC45LTcuNCA0Ni40LTMzLjdsLTI1LTE0NS41IDEwNS43LTEwM2MxOS0xOC41IDguNS01MC44LTE3LjctNTQuNkwzODIgMTUwLjIgMzE2LjcgMTcuOGMtMTEuNy0yMy42LTQ1LjYtMjMuOS01Ny40IDB6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)](https://files.minecraftforge.net)
[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=1.16.5-&query=$.promos["1.16.5-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=
)](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?logo=Patreon)](https://www.patreon.com/LexManos)
Forge is a free, open-source modding API all of your favourite mods use!
+4
View File
@@ -0,0 +1,4 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
Binary file not shown.
+1 -1
View File
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
Vendored
+33 -20
View File
@@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -66,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -109,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
@@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
@@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
Vendored
+24 -19
View File
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -35,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -45,28 +64,14 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
+22 -29
View File
@@ -1,53 +1,46 @@
-------------------------------------------
Source installation information for modders
-------------------------------------------
This code follows the Minecraft Forge installation methodology. It will apply
some small patches to the vanilla MCP source code, giving you and it access
to some of the data and functions you need to build a successful mod.
Note also that the patches are built against "unrenamed" MCP source code (aka
srgnames) - this means that you will not be able to read them directly against
Note also that the patches are built against "un-renamed" MCP source code (aka
SRG Names) - this means that you will not be able to read them directly against
normal code.
Source pack installation information:
Standalone source installation
Setup Process:
==============================
See the Forge Documentation online for more detailed instructions:
http://mcforge.readthedocs.io/en/latest/gettingstarted/
Step 1: Open your command-line and browse to the folder where you extracted the zip file.
Step 2: You're left with a choice.
If you prefer to use Eclipse:
1. Run the following command: "gradlew genEclipseRuns" (./gradlew genEclipseRuns if you are on Mac/Linux)
1. Run the following command: `./gradlew genEclipseRuns`
2. Open Eclipse, Import > Existing Gradle Project > Select Folder
or run "gradlew eclipse" to generate the project.
(Current Issue)
4. Open Project > Run/Debug Settings > Edit runClient and runServer > Environment
5. Edit MOD_CLASSES to show [modid]%%[Path]; 2 times rather then the generated 4.
or run `gradlew eclipse` to generate the project.
If you prefer to use IntelliJ:
1. Open IDEA, and import project.
2. Select your build.gradle file and have it import.
3. Run the following command: "gradlew genIntellijRuns" (./gradlew genIntellijRuns if you are on Mac/Linux)
3. Run the following command: `./gradlew genIntellijRuns`
4. Refresh the Gradle Project in IDEA if required.
If at any point you are missing libraries in your IDE, or you've run into problems you can run "gradlew --refresh-dependencies" to refresh the local cache. "gradlew clean" to reset everything {this does not affect your code} and then start the processs again.
If at any point you are missing libraries in your IDE, or you've run into problems you can
run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything
{this does not affect your code} and then start the process again.
Should it still not work,
Refer to #ForgeGradle on EsperNet for more information about the gradle environment.
or the Forge Project Discord discord.gg/UvedJ9m
Mapping Names:
=============================
By default, the MDK is configured to use the official mapping names from Mojang for methods and fields
in the Minecraft codebase. These names are covered by a specific license. All modders should be aware of this
license, if you do not agree with it you can change your mapping names to other crowdsourced names in your
build.gradle. For the latest license text, refer to the mapping file itself, or the reference copy here:
https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
Forge source installation
Additional Resources:
=========================
MinecraftForge ships with this code and installs it as part of the forge
installation process, no further action is required on your part.
LexManos' Install Video
=======================
https://www.youtube.com/watch?v=8VEdtQLuLO0&feature=youtu.be
For more details update more often refer to the Forge Forums:
http://www.minecraftforge.net/forum/index.php/topic,14048.0.html
Community Documentation: https://docs.minecraftforge.net/en/1.16.x/gettingstarted/
LexManos' Install Video: https://youtu.be/8VEdtQLuLO0
Forge Forums: https://forums.minecraftforge.net/
Forge Discord: https://discord.minecraftforge.net/
+143 -95
View File
@@ -1,147 +1,195 @@
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
version = mod_version
group = mod_group_id
base {
archivesName = mod_id
}
}
apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version = '1.0'
group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'modid'
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft {
// The mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD Snapshot are built nightly.
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// The mappings can be changed at any time and must be in the following format.
// Channel: Version:
// official MCVersion Official field/method names from Mojang mapping files
// parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
//
// You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
//
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
// Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started
//
// Use non-default mappings at your own risk. They may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: '@MAPPING_CHANNEL@', version: '@MAPPING_VERSION@'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
mappings channel: mapping_channel, version: mapping_version
// When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
// In most cases, it is not necessary to enable.
// enableEclipsePrepareRuns = true
// enableIdeaPrepareRuns = true
// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
// It is REQUIRED to be set to true for this template to function.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
copyIdeResources = true
// When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
// The folder name can be set on a run configuration using the "folderName" property.
// By default, the folder name of a run configuration is the name of the Gradle project containing it.
// generateRunFolders = true
// This property enables access transformers for use in development.
// They will be applied to the Minecraft artifact.
// The access transformer file can be anywhere in the project.
// However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
// This default location is a best practice to automatically put the file in the right place in the final jar.
// See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
// applies to all the run configs below
configureEach {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
property 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug'
mods {
examplemod {
"${mod_id}" {
source sourceSets.main
}
}
}
client {
// this block needs to be here for runClient to exist
}
server {
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'
mods {
examplemod {
source sourceSets.main
}
}
args '--nogui'
}
data {
workingDirectory project.file('run')
// example of overriding the workingDirectory set in configureEach above
workingDirectory project.file('run-data')
// 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
}
}
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
}
}
}
dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft '@FORGE_GROUP@:@FORGE_NAME@:@FORGE_VERSION@'
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"
// compile "some.group:artifact:version"
// Real examples
// compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
// compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
// The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
// provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// These dependencies get remapped to your current MCP mappings
// deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// For more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
repositories {
// Put repositories for dependencies here
// ForgeGradle automatically adds the Forge maven and Maven Central for you
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
// flatDir {
// dir 'libs'
// }
}
// Example for how to get properties into the manifest for reading by the runtime..
jar {
manifest {
attributes([
"Specification-Title": "examplemod",
"Specification-Vendor": "examplemodsareus",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"examplemodsareus",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
dependencies {
// Specify the version of Minecraft to use.
// Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact.
// The "userdev" classifier will be requested and setup by ForgeGradle.
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
// Real mod deobf dependency examples - these get remapped to your current mappings
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
// implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency
// Example mod dependency using a mod jar from ./libs with a flat dir repository
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
// The group id is ignored when searching -- in this case, it is "blank"
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
// For more info:
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}
// This block of code expands all declared replace properties in the specified resource targets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
tasks.named('processResources', ProcessResources).configure {
var replaceProperties = [
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version: forge_version, forge_version_range: forge_version_range,
loader_version_range: loader_version_range,
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors: mod_authors, mod_description: mod_description,
]
inputs.properties replaceProperties
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
expand replaceProperties + [project: project]
}
}
// Example configuration to allow publishing using the maven-publish task
// Example for how to get properties into the manifest for reading at runtime.
tasks.named('jar', Jar).configure {
manifest {
attributes([
'Specification-Title' : mod_id,
'Specification-Vendor' : mod_authors,
'Specification-Version' : '1', // We are version 1 of ourselves
'Implementation-Title' : project.name,
'Implementation-Version' : project.jar.archiveVersion,
'Implementation-Vendor' : mod_authors,
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
// This is the preferred method to reobfuscate your jar file
jar.finalizedBy('reobfJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
//publish.dependsOn('reobfJar')
finalizedBy 'reobfJar'
}
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing:
// tasks.named('publish').configure {
// dependsOn 'reobfJar'
// }
publishing {
publications {
mavenJava(MavenPublication) {
register('mavenJava', MavenPublication) {
artifact jar
}
}
repositories {
maven {
url "file:///${project.projectDir}/mcmodsrepo"
url "file://${project.projectDir}/mcmodsrepo"
}
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
+56 -1
View File
@@ -1,4 +1,59 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
org.gradle.daemon=false
## Environment Properties
# The Minecraft version must agree with the Forge version to get a valid artifact
minecraft_version=@MC_VERSION@
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[@MC_VERSION@,@MC_NEXT_VERSION@)
# The Forge version must agree with the Minecraft version to get a valid artifact
forge_version=@FORGE_VERSION@
# The Forge version range can use any version of Forge as bounds or match the loader version range
forge_version_range=[@FORGE_SPEC_VERSION@,)
# The loader version range can only use the major version of Forge/FML as bounds
loader_version_range=[@FORGE_SPEC_VERSION@,)
# The mapping channel to use for mappings.
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
#
# | Channel | Version | |
# |-----------|----------------------|--------------------------------------------------------------------------------|
# | official | MCVersion | Official field/method names from Mojang mapping files |
# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official |
#
# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
#
# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge.
# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started
mapping_channel=@MAPPING_CHANNEL@
# The mapping version to query from the mapping channel.
# This must match the format required by the mapping channel.
mapping_version=@MAPPING_VERSION@
## Mod Properties
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
# Must match the String constant located in the main mod class annotated with @Mod.
mod_id=examplemod
# The human-readable display name for the mod.
mod_name=Example Mod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
mod_version=1.0.0
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
mod_group_id=com.example.examplemod
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=YourNameHere, OtherNameHere
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.
+14
View File
@@ -0,0 +1,14 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = 'https://maven.minecraftforge.net/' }
maven {
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
}
}
}
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
}
@@ -48,7 +48,7 @@ public class ExampleMod
private void doClientStuff(final FMLClientSetupEvent event) {
// do something that can only be done on the client
LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings);
LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().options);
}
private void enqueueIMC(final InterModEnqueueEvent event)
+36 -38
View File
@@ -6,54 +6,52 @@
# 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="[32,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
loaderVersion="${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license="All rights reserved"
license="${mod_license}"
# A URL to refer people to when problems occur with this mod
issueTrackerURL="http://my.issue.tracker/" #optional
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId="examplemod" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
version="${file.jarVersion}" #mandatory
# A display name for the mod
displayName="Example Mod" #mandatory
# A URL to query for updates for this mod. See the JSON update specification <here>
updateJSONURL="http://myurl.me/" #optional
modId="${mod_id}" #mandatory
# The version number of the mod
version="${mod_version}" #mandatory
# A display name for the mod
displayName="${mod_name}" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
displayURL="http://example.com/" #optional
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
# A file name (in the root of the mod JAR) containing a logo for display
logoFile="examplemod.png" #optional
#logoFile="examplemod.png" #optional
# A text field displayed in the mod UI
credits="Thanks for this example mod goes to Java" #optional
#credits="" #optional
# A text field displayed in the mod UI
authors="Love, Cheese and small house plants" #optional
authors="${mod_authors}" #optional
# The description text for the mod (multi line!) (#mandatory)
description='''
This is a long form description of the mod. You can write whatever you want here
Have some lorem ipsum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed sagittis luctus odio eu tempus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque volutpat ligula eget lacus auctor sagittis. In hac habitasse platea dictumst. Nunc gravida elit vitae sem vehicula efficitur. Donec mattis ipsum et arcu lobortis, eleifend sagittis sem rutrum. Cras pharetra quam eget posuere fermentum. Sed id tincidunt justo. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
'''
description='''${mod_description}'''
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.examplemod]] #optional
# the modid of the dependency
modId="forge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="[32,)" #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
side="BOTH"
[[dependencies.${mod_id}]] #optional
# the modid of the dependency
modId="forge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="${forge_version_range}" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory
# BEFORE - This mod is loaded BEFORE the dependency
# AFTER - This mod is loaded AFTER the dependency
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
side="BOTH"
# Here's another dependency
[[dependencies.examplemod]]
modId="minecraft"
mandatory=true
versionRange="[1.16.1]"
ordering="NONE"
side="BOTH"
[[dependencies.${mod_id}]]
modId="minecraft"
mandatory=true
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="${minecraft_version_range}"
ordering="NONE"
side="BOTH"
+3 -3
View File
@@ -1,7 +1,7 @@
{
"pack": {
"description": "examplemod resources",
"pack_format": 5,
"_comment": "A pack_format of 5 requires json lang files and some texture changes from 1.15. Note: we require v5 pack meta for all mods."
"description": "${mod_id} resources",
"pack_format": 6,
"_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods."
}
}
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/platform/GlStateManager.java
+++ b/com/mojang/blaze3d/platform/GlStateManager.java
@@ -556,10 +556,17 @@
@@ -572,10 +_,17 @@
GL13.glClientActiveTexture(p_227747_0_);
}
@@ -8,7 +8,7 @@
+ public static float lastBrightnessX = 0.0f;
+ public static float lastBrightnessY = 0.0f;
@Deprecated
public static void func_227640_a_(int p_227640_0_, float p_227640_1_, float p_227640_2_) {
public static void _glMultiTexCoord2f(int p_227640_0_, float p_227640_1_, float p_227640_2_) {
RenderSystem.assertThread(RenderSystem::isOnRenderThread);
GL13.glMultiTexCoord2f(p_227640_0_, p_227640_1_, p_227640_2_);
+ if (p_227640_0_ == GL13.GL_TEXTURE1) {
@@ -17,4 +17,4 @@
+ }
}
public static void func_227706_d_(int p_227706_0_, int p_227706_1_, int p_227706_2_, int p_227706_3_) {
public static void glBlendFuncSeparate(int p_227706_0_, int p_227706_1_, int p_227706_2_, int p_227706_3_) {
@@ -1,15 +1,15 @@
--- a/com/mojang/blaze3d/vertex/IVertexBuilder.java
+++ b/com/mojang/blaze3d/vertex/IVertexBuilder.java
@@ -18,7 +18,7 @@
@@ -18,7 +_,7 @@
import org.lwjgl.system.MemoryStack;
@OnlyIn(Dist.CLIENT)
-public interface IVertexBuilder {
+public interface IVertexBuilder extends net.minecraftforge.client.extensions.IForgeVertexBuilder {
Logger field_227884_f_ = LogManager.getLogger();
Logger LOGGER = LogManager.getLogger();
IVertexBuilder func_225582_a_(double p_225582_1_, double p_225582_3_, double p_225582_5_);
@@ -96,11 +96,12 @@
IVertexBuilder vertex(double p_225582_1_, double p_225582_3_, double p_225582_5_);
@@ -96,11 +_,12 @@
f5 = p_227890_3_[k] * p_227890_6_;
}
@@ -18,8 +18,8 @@
float f9 = bytebuffer.getFloat(16);
float f10 = bytebuffer.getFloat(20);
Vector4f vector4f = new Vector4f(f, f1, f2, 1.0F);
vector4f.func_229372_a_(matrix4f);
+ applyBakedNormals(vector3f, bytebuffer, p_227890_1_.func_227872_b_());
this.func_225588_a_(vector4f.func_195910_a(), vector4f.func_195913_b(), vector4f.func_195914_c(), f3, f4, f5, 1.0F, f9, f10, p_227890_8_, l, vector3f.func_195899_a(), vector3f.func_195900_b(), vector3f.func_195902_c());
vector4f.transform(matrix4f);
+ applyBakedNormals(vector3f, bytebuffer, p_227890_1_.normal());
this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, 1.0F, f9, f10, p_227890_8_, l, vector3f.x(), vector3f.y(), vector3f.z());
}
}
@@ -1,18 +1,18 @@
--- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
+++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
@@ -63,6 +63,15 @@
@@ -63,6 +_,15 @@
}));
}
+ @Override
+ public boolean func_231046_a_(int key, int scanCode, int modifiers) {
+ public boolean keyPressed(int key, int scanCode, int modifiers) {
+ if (key == org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE) {
+ field_230706_i_.func_147108_a(this.field_224228_a);
+ minecraft.setScreen(this.nextScreen);
+ return true;
+ }
+ return super.func_231046_a_(key, scanCode, modifiers);
+ return super.keyPressed(key, scanCode, modifiers);
+ }
+
public void func_230430_a_(MatrixStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) {
this.func_230446_a_(p_230430_1_);
func_238472_a_(p_230430_1_, this.field_230712_o_, this.field_224229_b, this.field_230708_k_ / 2, 80, 16777215);
public void render(MatrixStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) {
this.renderBackground(p_230430_1_);
drawCenteredString(p_230430_1_, this.font, this.line1, this.width / 2, 80, 16777215);
@@ -1,10 +1,19 @@
--- a/net/minecraft/advancements/Advancement.java
+++ b/net/minecraft/advancements/Advancement.java
@@ -309,6 +309,7 @@
@@ -130,7 +_,7 @@
return this.chatComponent;
}
- public static class Builder {
+ public static class Builder implements net.minecraftforge.common.extensions.IForgeAdvancementBuilder {
private ResourceLocation parentId;
private Advancement parent;
private DisplayInfo display;
@@ -309,6 +_,7 @@
}
public static Advancement.Builder func_241043_a_(JsonObject p_241043_0_, ConditionArrayParser p_241043_1_) {
+ if (!net.minecraftforge.common.crafting.ConditionalAdvancement.processConditions(p_241043_0_)) return null;
ResourceLocation resourcelocation = p_241043_0_.has("parent") ? new ResourceLocation(JSONUtils.func_151200_h(p_241043_0_, "parent")) : null;
DisplayInfo displayinfo = p_241043_0_.has("display") ? DisplayInfo.func_192294_a(JSONUtils.func_152754_s(p_241043_0_, "display")) : null;
AdvancementRewards advancementrewards = p_241043_0_.has("rewards") ? AdvancementRewards.func_241096_a_(JSONUtils.func_152754_s(p_241043_0_, "rewards")) : AdvancementRewards.field_192114_a;
public static Advancement.Builder fromJson(JsonObject p_241043_0_, ConditionArrayParser p_241043_1_) {
+ if ((p_241043_0_ = net.minecraftforge.common.crafting.ConditionalAdvancement.processConditional(p_241043_0_)) == null) return null;
ResourceLocation resourcelocation = p_241043_0_.has("parent") ? new ResourceLocation(JSONUtils.getAsString(p_241043_0_, "parent")) : null;
DisplayInfo displayinfo = p_241043_0_.has("display") ? DisplayInfo.fromJson(JSONUtils.getAsJsonObject(p_241043_0_, "display")) : null;
AdvancementRewards advancementrewards = p_241043_0_.has("rewards") ? AdvancementRewards.deserialize(JSONUtils.getAsJsonObject(p_241043_0_, "rewards")) : AdvancementRewards.EMPTY;
@@ -1,10 +1,10 @@
--- a/net/minecraft/advancements/AdvancementList.java
+++ b/net/minecraft/advancements/AdvancementList.java
@@ -96,6 +96,7 @@
@@ -96,6 +_,7 @@
}
}
+ net.minecraftforge.common.AdvancementLoadFix.buildSortedTrees(this.field_192093_c);
field_192091_a.info("Loaded {} advancements", (int)this.field_192092_b.size());
+ net.minecraftforge.common.AdvancementLoadFix.buildSortedTrees(this.roots);
LOGGER.info("Loaded {} advancements", (int)this.advancements.size());
}
@@ -1,13 +1,13 @@
--- a/net/minecraft/advancements/AdvancementManager.java
+++ b/net/minecraft/advancements/AdvancementManager.java
@@ -36,6 +36,10 @@
@@ -36,6 +_,10 @@
try {
JsonObject jsonobject = JSONUtils.func_151210_l(p_240923_3_, "advancement");
Advancement.Builder advancement$builder = Advancement.Builder.func_241043_a_(jsonobject, new ConditionArrayParser(p_240923_2_, this.field_240922_d_));
JsonObject jsonobject = JSONUtils.convertToJsonObject(p_240923_3_, "advancement");
Advancement.Builder advancement$builder = Advancement.Builder.fromJson(jsonobject, new ConditionArrayParser(p_240923_2_, this.predicateManager));
+ if (advancement$builder == null) {
+ field_192782_a.debug("Skipping loading advancement {} as it's conditions were not met", p_240923_2_);
+ LOGGER.debug("Skipping loading advancement {} as it's conditions were not met", p_240923_2_);
+ return;
+ }
map.put(p_240923_2_, advancement$builder);
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
field_192782_a.error("Parsing error loading custom advancement {}: {}", p_240923_2_, jsonparseexception.getMessage());
LOGGER.error("Parsing error loading custom advancement {}: {}", p_240923_2_, jsonparseexception.getMessage());
@@ -1,11 +1,11 @@
--- a/net/minecraft/advancements/AdvancementRewards.java
+++ b/net/minecraft/advancements/AdvancementRewards.java
@@ -39,7 +39,7 @@
@@ -39,7 +_,7 @@
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_216015_a(LootParameters.field_216281_a, p_192113_1_).func_216015_a(LootParameters.field_237457_g_, p_192113_1_.func_213303_ch()).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_237457_g_, p_192113_1_.func_213303_ch()).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
public void grant(ServerPlayerEntity p_192113_1_) {
p_192113_1_.giveExperiencePoints(this.experience);
- LootContext lootcontext = (new LootContext.Builder(p_192113_1_.getLevel())).withParameter(LootParameters.THIS_ENTITY, p_192113_1_).withParameter(LootParameters.ORIGIN, p_192113_1_.position()).withRandom(p_192113_1_.getRandom()).create(LootParameterSets.ADVANCEMENT_REWARD);
+ LootContext lootcontext = (new LootContext.Builder(p_192113_1_.getLevel())).withParameter(LootParameters.THIS_ENTITY, p_192113_1_).withParameter(LootParameters.ORIGIN, p_192113_1_.position()).withRandom(p_192113_1_.getRandom()).withLuck(p_192113_1_.getLuck()).create(LootParameterSets.ADVANCEMENT_REWARD); // FORGE: luck to LootContext
boolean flag = false;
for(ResourceLocation resourcelocation : this.field_192116_c) {
for(ResourceLocation resourcelocation : this.loot) {
@@ -1,30 +1,30 @@
--- a/net/minecraft/advancements/PlayerAdvancements.java
+++ b/net/minecraft/advancements/PlayerAdvancements.java
@@ -159,6 +159,10 @@
@@ -159,6 +_,10 @@
}
this.func_240920_c_(p_240921_1_);
this.checkForAutomaticTriggers(p_240921_1_);
+
+ if (net.minecraftforge.common.ForgeConfig.SERVER.fixAdvancementLoading.get())
+ net.minecraftforge.common.AdvancementLoadFix.loadVisibility(this, this.field_192759_g, this.field_192760_h, this.field_192758_f, this.field_192761_i, this::func_192738_c);
+ net.minecraftforge.common.AdvancementLoadFix.loadVisibility(this, this.visible, this.visibilityChanged, this.advancements, this.progressChanged, this::shouldBeVisible);
+ else
this.func_192752_d();
this.func_240919_b_(p_240921_1_);
this.ensureAllVisible();
this.registerListeners(p_240921_1_);
}
@@ -192,6 +196,8 @@
@@ -192,6 +_,8 @@
}
public boolean func_192750_a(Advancement p_192750_1_, String p_192750_2_) {
public boolean award(Advancement p_192750_1_, String p_192750_2_) {
+ // Forge: don't grant advancements for fake players
+ if (this.field_192762_j instanceof net.minecraftforge.common.util.FakePlayer) return false;
+ if (this.player instanceof net.minecraftforge.common.util.FakePlayer) return false;
boolean flag = false;
AdvancementProgress advancementprogress = this.func_192747_a(p_192750_1_);
boolean flag1 = advancementprogress.func_192105_a();
@@ -204,6 +210,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_240917_e_.func_232641_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()), ChatType.SYSTEM, Util.field_240973_b_);
AdvancementProgress advancementprogress = this.getOrStartProgress(p_192750_1_);
boolean flag1 = advancementprogress.isDone();
@@ -204,6 +_,7 @@
if (p_192750_1_.getDisplay() != null && p_192750_1_.getDisplay().shouldAnnounceChat() && this.player.level.getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
this.playerList.broadcastMessage(new TranslationTextComponent("chat.type.advancement." + p_192750_1_.getDisplay().getFrame().getName(), this.player.getDisplayName(), p_192750_1_.getChatComponent()), ChatType.SYSTEM, Util.NIL_UUID);
}
+ net.minecraftforge.common.ForgeHooks.onAdvancement(this.field_192762_j, p_192750_1_);
+ net.minecraftforge.common.ForgeHooks.onAdvancement(this.player, p_192750_1_);
}
}
@@ -1,38 +1,38 @@
--- a/net/minecraft/advancements/criterion/ItemPredicate.java
+++ b/net/minecraft/advancements/criterion/ItemPredicate.java
@@ -26,6 +26,8 @@
@@ -26,6 +_,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<>();
+ private static final Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> unmod_predicates = java.util.Collections.unmodifiableMap(custom_predicates);
public static final ItemPredicate field_192495_a = new ItemPredicate();
public static final ItemPredicate ANY = new ItemPredicate();
@Nullable
private final ITag<Item> field_200018_b;
@@ -105,6 +107,11 @@
public static ItemPredicate func_192492_a(@Nullable JsonElement p_192492_0_) {
private final ITag<Item> tag;
@@ -105,6 +_,11 @@
public static ItemPredicate fromJson(@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.convertToJsonObject(p_192492_0_, "item");
+ if (jsonobject.has("type")) {
+ final ResourceLocation rl = new ResourceLocation(JSONUtils.func_151200_h(jsonobject, "type"));
+ final ResourceLocation rl = new ResourceLocation(JSONUtils.getAsString(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"));
MinMaxBounds.IntBound minmaxbounds$intbound = MinMaxBounds.IntBound.fromJson(jsonobject.get("count"));
MinMaxBounds.IntBound minmaxbounds$intbound1 = MinMaxBounds.IntBound.fromJson(jsonobject.get("durability"));
if (jsonobject.has("data")) {
@@ -204,6 +211,14 @@
@@ -202,6 +_,14 @@
} else {
return new ItemPredicate[0];
}
}
+ }
+
+ public static void register(ResourceLocation name, java.util.function.Function<JsonObject, ItemPredicate> deserializer) {
+ custom_predicates.put(name, deserializer);
+ }
+
+ public static Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> getPredicates() {
+ return unmod_predicates;
+ }
+
}
public static class Builder {
private final List<EnchantmentPredicate> field_200312_a = Lists.newArrayList();
private final List<EnchantmentPredicate> field_226657_b_ = Lists.newArrayList();
@@ -1,119 +1,134 @@
--- a/net/minecraft/block/AbstractBlock.java
+++ b/net/minecraft/block/AbstractBlock.java
@@ -60,7 +60,8 @@
@@ -60,7 +_,8 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public abstract class AbstractBlock {
+//TODO, Delegates are weird here now, because Block extends this.
+public abstract class AbstractBlock extends net.minecraftforge.registries.ForgeRegistryEntry<Block> {
protected static final Direction[] field_212556_a = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP};
protected final Material field_149764_J;
protected final boolean field_235688_at_;
@@ -87,6 +88,8 @@
this.field_226887_g_ = p_i241196_1_.field_226894_k_;
this.field_208621_p = p_i241196_1_.field_208772_j;
this.field_235684_aB_ = p_i241196_1_;
+ final ResourceLocation lootTableCache = p_i241196_1_.field_222381_j;
+ this.lootTableSupplier = lootTableCache != null ? () -> lootTableCache : p_i241196_1_.lootTableSupplier != null ? p_i241196_1_.lootTableSupplier : () -> new ResourceLocation(this.getRegistryName().func_110624_b(), "blocks/" + this.getRegistryName().func_110623_a());
protected static final Direction[] UPDATE_SHAPE_ORDER = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP};
protected final Material material;
protected final boolean hasCollision;
@@ -87,6 +_,8 @@
this.jumpFactor = p_i241196_1_.jumpFactor;
this.dynamicShape = p_i241196_1_.dynamicShape;
this.properties = p_i241196_1_;
+ final ResourceLocation lootTableCache = p_i241196_1_.drops;
+ this.lootTableSupplier = lootTableCache != null ? () -> lootTableCache : p_i241196_1_.lootTableSupplier != null ? p_i241196_1_.lootTableSupplier : () -> new ResourceLocation(this.getRegistryName().getNamespace(), "blocks/" + this.getRegistryName().getPath());
}
@Deprecated
@@ -129,7 +132,7 @@
@@ -129,7 +_,7 @@
@Deprecated
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_235695_q_() && !p_196243_1_.func_203425_a(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_4_.hasTileEntity())) {
p_196243_2_.func_175713_t(p_196243_3_);
public void onRemove(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
- if (this.isEntityBlock() && !p_196243_1_.is(p_196243_4_.getBlock())) {
+ if (p_196243_1_.hasTileEntity() && (!p_196243_1_.is(p_196243_4_.getBlock()) || !p_196243_4_.hasTileEntity())) {
p_196243_2_.removeBlockEntity(p_196243_3_);
}
@@ -191,7 +194,7 @@
@@ -191,7 +_,7 @@
@Deprecated
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());
public boolean canBeReplaced(BlockState p_196253_1_, BlockItemUseContext p_196253_2_) {
- return this.material.isReplaceable() && (p_196253_2_.getItemInHand().isEmpty() || p_196253_2_.getItemInHand().getItem() != this.asItem());
+ return p_196253_1_.getMaterial().isReplaceable() && (p_196253_2_.getItemInHand().isEmpty() || p_196253_2_.getItemInHand().getItem() != this.asItem());
}
@Deprecated
@@ -294,8 +297,8 @@
@@ -294,8 +_,8 @@
if (f == -1.0F) {
return 0.0F;
} else {
- int i = p_180647_2_.func_234569_d_(p_180647_1_) ? 30 : 100;
- return p_180647_2_.func_184813_a(p_180647_1_) / f / (float)i;
- int i = p_180647_2_.hasCorrectToolForDrops(p_180647_1_) ? 30 : 100;
- return p_180647_2_.getDestroySpeed(p_180647_1_) / f / (float)i;
+ int i = net.minecraftforge.common.ForgeHooks.canHarvestBlock(p_180647_1_, p_180647_2_, p_180647_3_, p_180647_4_) ? 30 : 100;
+ return p_180647_2_.getDigSpeed(p_180647_1_, p_180647_4_) / f / (float)i;
}
}
@@ -321,14 +324,14 @@
@@ -321,14 +_,14 @@
return 0;
}
+ @Deprecated //Forge: Use state.hasTileEntity()
public final boolean func_235695_q_() {
public final boolean isEntityBlock() {
return this instanceof ITileEntityProvider;
}
public final ResourceLocation func_220068_i() {
if (this.field_220085_g == null) {
- ResourceLocation resourcelocation = Registry.field_212618_g.func_177774_c(this.func_230328_p_());
- this.field_220085_g = new ResourceLocation(resourcelocation.func_110624_b(), "blocks/" + resourcelocation.func_110623_a());
+ this.field_220085_g = this.lootTableSupplier.get();
public final ResourceLocation getLootTable() {
if (this.drops == null) {
- ResourceLocation resourcelocation = Registry.BLOCK.getKey(this.asBlock());
- this.drops = new ResourceLocation(resourcelocation.getNamespace(), "blocks/" + resourcelocation.getPath());
+ this.drops = this.lootTableSupplier.get();
}
return this.field_220085_g;
@@ -346,6 +349,10 @@
return this.field_235684_aB_.field_235800_b_.apply(this.func_230328_p_().func_176223_P());
return this.drops;
@@ -346,6 +_,14 @@
return this.properties.materialColor.apply(this.asBlock().defaultBlockState());
}
+ protected boolean isAir(BlockState state) {
+ return ((AbstractBlockState)state).isAir;
+ }
+
+ /* ======================================== FORGE START ===================================== */
+ private final java.util.function.Supplier<ResourceLocation> lootTableSupplier;
+ /* ========================================= FORGE END ====================================== */
+
public abstract static class AbstractBlockState extends StateHolder<Block, BlockState> {
private final int field_215708_d;
private final boolean field_215709_e;
@@ -428,6 +435,8 @@
return this.field_215708_d;
private final int lightEmission;
private final boolean useShapeForLightOcclusion;
@@ -424,18 +_,24 @@
return this.useShapeForLightOcclusion;
}
+ /** @deprecated use {@link BlockState#isAir(IBlockReader, BlockPos) */
+ /** @deprecated use {@link BlockState#getLightValue(IBlockReader, BlockPos)} */
+ @Deprecated
public boolean func_196958_f() {
return this.field_235702_f_;
}
@@ -436,6 +445,8 @@
return this.field_235704_h_;
public int getLightEmission() {
return this.lightEmission;
}
+ /** @deprecated use {@link BlockState#rotate(IWorld, BlockPos, Rotation) */
+ /** @deprecated use {@link BlockState#isAir(IBlockReader, BlockPos)} until 1.17, at which point this method will be undreprecated. See https://github.com/MinecraftForge/MinecraftForge/issues/7409 for more details */
+ @Deprecated
public BlockState func_185907_a(Rotation p_185907_1_) {
return this.func_177230_c().func_185499_a(this.func_230340_p_(), p_185907_1_);
public boolean isAir() {
- return this.isAir;
+ return this.getBlock().isAir((BlockState)this);
}
@@ -802,6 +813,9 @@
private ResourceLocation field_222381_j;
private boolean field_226895_m_ = true;
private boolean field_235813_o_;
public MaterialColor getMapColor(IBlockReader p_185909_1_, BlockPos p_185909_2_) {
return this.materialColor;
}
+ /** @deprecated use {@link BlockState#rotate(IWorld, BlockPos, Rotation)} */
+ @Deprecated
public BlockState rotate(Rotation p_185907_1_) {
return this.getBlock().rotate(this.asState(), p_185907_1_);
}
@@ -802,8 +_,11 @@
private ResourceLocation drops;
private boolean canOcclude = true;
private boolean isAir;
+ private int harvestLevel = -1;
+ private net.minecraftforge.common.ToolType harvestTool;
+ private java.util.function.Supplier<ResourceLocation> lootTableSupplier;
private AbstractBlock.IExtendedPositionPredicate<EntityType<?>> field_235814_p_ = (p_235832_0_, p_235832_1_, p_235832_2_, p_235832_3_) -> {
return p_235832_0_.func_224755_d(p_235832_1_, p_235832_2_, Direction.UP) && p_235832_0_.func_185906_d() < 14;
private AbstractBlock.IExtendedPositionPredicate<EntityType<?>> isValidSpawn = (p_235832_0_, p_235832_1_, p_235832_2_, p_235832_3_) -> {
- return p_235832_0_.isFaceSturdy(p_235832_1_, p_235832_2_, Direction.UP) && p_235832_0_.getLightEmission() < 14;
+ return p_235832_0_.isFaceSturdy(p_235832_1_, p_235832_2_, Direction.UP) && p_235832_0_.getLightValue(p_235832_1_, p_235832_2_) < 14;
};
@@ -863,6 +877,8 @@
abstractblock$properties.field_226895_m_ = p_200950_0_.field_235684_aB_.field_226895_m_;
abstractblock$properties.field_235813_o_ = p_200950_0_.field_235684_aB_.field_235813_o_;
abstractblock$properties.field_235806_h_ = p_200950_0_.field_235684_aB_.field_235806_h_;
+ abstractblock$properties.harvestLevel = p_200950_0_.field_235684_aB_.harvestLevel;
+ abstractblock$properties.harvestTool = p_200950_0_.field_235684_aB_.harvestTool;
private AbstractBlock.IPositionPredicate isRedstoneConductor = (p_235853_0_, p_235853_1_, p_235853_2_) -> {
return p_235853_0_.getMaterial().isSolidBlocking() && p_235853_0_.isCollisionShapeFullBlock(p_235853_1_, p_235853_2_);
@@ -863,6 +_,8 @@
abstractblock$properties.canOcclude = p_200950_0_.properties.canOcclude;
abstractblock$properties.isAir = p_200950_0_.properties.isAir;
abstractblock$properties.requiresCorrectToolForDrops = p_200950_0_.properties.requiresCorrectToolForDrops;
+ abstractblock$properties.harvestLevel = p_200950_0_.properties.harvestLevel;
+ abstractblock$properties.harvestTool = p_200950_0_.properties.harvestTool;
return abstractblock$properties;
}
@@ -877,6 +893,24 @@
@@ -877,6 +_,24 @@
return this;
}
@@ -135,15 +150,23 @@
+ return this.harvestTool;
+ }
+
public AbstractBlock.Properties func_200941_a(float p_200941_1_) {
this.field_200961_i = p_200941_1_;
public AbstractBlock.Properties friction(float p_200941_1_) {
this.friction = p_200941_1_;
return this;
@@ -933,7 +967,7 @@
}
public AbstractBlock.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();
@@ -932,9 +_,15 @@
return this;
}
+ @Deprecated // FORGE: Use the variant that takes a Supplier below
public AbstractBlock.Properties dropsLike(Block p_222379_1_) {
- this.drops = p_222379_1_.getLootTable();
+ this.lootTableSupplier = () -> p_222379_1_.delegate.get().getLootTable();
return this;
+ }
+
+ public AbstractBlock.Properties lootFrom(java.util.function.Supplier<? extends Block> blockIn) {
+ this.lootTableSupplier = () -> blockIn.get().getLootTable();
+ return this;
}
public AbstractBlock.Properties air() {
@@ -1,10 +1,10 @@
--- a/net/minecraft/block/AbstractFireBlock.java
+++ b/net/minecraft/block/AbstractFireBlock.java
@@ -124,6 +124,7 @@
if (!p_220082_4_.func_203425_a(p_220082_1_.func_177230_c())) {
if (func_242649_a(p_220082_2_)) {
Optional<PortalSize> optional = PortalSize.func_242964_a(p_220082_2_, p_220082_3_, Direction.Axis.X);
@@ -124,6 +_,7 @@
if (!p_220082_4_.is(p_220082_1_.getBlock())) {
if (inPortalDimension(p_220082_2_)) {
Optional<PortalSize> optional = PortalSize.findEmptyPortalShape(p_220082_2_, p_220082_3_, Direction.Axis.X);
+ optional = net.minecraftforge.event.ForgeEventFactory.onTrySpawnPortal(p_220082_2_, p_220082_3_, optional);
if (optional.isPresent()) {
optional.get().func_150859_c();
optional.get().createPortalBlocks();
return;
@@ -1,58 +1,58 @@
--- a/net/minecraft/block/AbstractRailBlock.java
+++ b/net/minecraft/block/AbstractRailBlock.java
@@ -13,7 +13,7 @@
@@ -13,7 +_,7 @@
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
-public abstract class AbstractRailBlock extends Block {
+public abstract class AbstractRailBlock extends Block implements net.minecraftforge.common.extensions.IAbstractRailBlock {
protected static final VoxelShape field_185590_a = Block.func_208617_a(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
protected static final VoxelShape field_190959_b = Block.func_208617_a(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
private final boolean field_196277_c;
@@ -37,6 +37,7 @@
protected static final VoxelShape FLAT_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
protected static final VoxelShape HALF_BLOCK_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
private final boolean isStraight;
@@ -37,6 +_,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_203425_a(this) ? p_220053_1_.func_177229_b(this.func_176560_l()) : null;
+ RailShape railShape2 = 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;
public VoxelShape getShape(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) {
RailShape railshape = p_220053_1_.is(this) ? p_220053_1_.getValue(this.getShapeProperty()) : null;
+ RailShape railShape2 = p_220053_1_.is(this) ? getRailDirection(p_220053_1_, p_220053_2_, p_220053_3_, null) : null;
return railshape != null && railshape.isAscending() ? HALF_BLOCK_AABB : FLAT_AABB;
}
@@ -61,7 +62,7 @@
@@ -61,7 +_,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 && p_220069_2_.func_180495_p(p_220069_3_).func_203425_a(this)) {
- RailShape railshape = p_220069_1_.func_177229_b(this.func_176560_l());
public void neighborChanged(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_.isClientSide && p_220069_2_.getBlockState(p_220069_3_).is(this)) {
- RailShape railshape = p_220069_1_.getValue(this.getShapeProperty());
+ RailShape railshape = getRailDirection(p_220069_1_, p_220069_2_, p_220069_3_, null);
if (func_235328_a_(p_220069_3_, p_220069_2_, railshape)) {
func_220075_c(p_220069_1_, p_220069_2_, p_220069_3_);
p_220069_2_.func_217377_a(p_220069_3_, p_220069_6_);
@@ -110,7 +111,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 (shouldBeRemoved(p_220069_3_, p_220069_2_, railshape)) {
dropResources(p_220069_1_, p_220069_2_, p_220069_3_);
p_220069_2_.removeBlock(p_220069_3_, p_220069_6_);
@@ -110,7 +_,7 @@
public void onRemove(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);
super.onRemove(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
- if (p_196243_1_.getValue(this.getShapeProperty()).isAscending()) {
+ if (getRailDirection(p_196243_1_, p_196243_2_, p_196243_3_, null).isAscending()) {
p_196243_2_.updateNeighborsAt(p_196243_3_.above(), this);
}
@@ -129,5 +130,20 @@
return blockstate.func_206870_a(this.func_176560_l(), flag ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH);
@@ -129,5 +_,20 @@
return blockstate.setValue(this.getShapeProperty(), flag ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH);
}
+ @Deprecated //Forge: Use getRailDirection(IBlockAccess, BlockPos, IBlockState, EntityMinecart) for enhanced ability
public abstract Property<RailShape> func_176560_l();
public abstract Property<RailShape> getShapeProperty();
+
+ /* ======================================== FORGE START =====================================*/
+
+ @Override
+ public boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos)
+ {
+ return !this.field_196277_c;
+ return !this.isStraight;
+ }
+
+ @Override
+ 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());
+ return state.getValue(getShapeProperty());
+ }
+ /* ========================================= FORGE END ======================================*/
}
@@ -1,15 +1,15 @@
--- a/net/minecraft/block/AbstractTopPlantBlock.java
+++ b/net/minecraft/block/AbstractTopPlantBlock.java
@@ -32,10 +32,11 @@
@@ -32,10 +_,11 @@
}
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
- if (p_225542_1_.func_177229_b(field_235502_d_) < 25 && p_225542_4_.nextDouble() < this.field_235503_e_) {
+ if (p_225542_1_.func_177229_b(field_235502_d_) < 25 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_.func_177972_a(this.field_235498_a_), p_225542_2_.func_180495_p(p_225542_3_.func_177972_a(this.field_235498_a_)),p_225542_4_.nextDouble() < this.field_235503_e_)) {
BlockPos blockpos = p_225542_3_.func_177972_a(this.field_235498_a_);
if (this.func_230334_h_(p_225542_2_.func_180495_p(blockpos))) {
p_225542_2_.func_175656_a(blockpos, p_225542_1_.func_235896_a_(field_235502_d_));
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, blockpos, p_225542_2_.func_180495_p(blockpos));
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
- if (p_225542_1_.getValue(AGE) < 25 && p_225542_4_.nextDouble() < this.growPerTickProbability) {
+ if (p_225542_1_.getValue(AGE) < 25 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_.relative(this.growthDirection), p_225542_2_.getBlockState(p_225542_3_.relative(this.growthDirection)),p_225542_4_.nextDouble() < this.growPerTickProbability)) {
BlockPos blockpos = p_225542_3_.relative(this.growthDirection);
if (this.canGrowInto(p_225542_2_.getBlockState(blockpos))) {
p_225542_2_.setBlockAndUpdate(blockpos, p_225542_1_.cycle(AGE));
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, blockpos, p_225542_2_.getBlockState(blockpos));
}
}
@@ -1,12 +1,15 @@
--- a/net/minecraft/block/BambooBlock.java
+++ b/net/minecraft/block/BambooBlock.java
@@ -102,8 +102,9 @@
if (p_225542_1_.func_177229_b(field_220266_f) == 0) {
if (p_225542_4_.nextInt(3) == 0 && p_225542_2_.func_175623_d(p_225542_3_.func_177984_a()) && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9) {
int i = this.func_220260_b(p_225542_2_, p_225542_3_) + 1;
@@ -100,10 +_,11 @@
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
if (p_225542_1_.getValue(STAGE) == 0) {
- if (p_225542_4_.nextInt(3) == 0 && p_225542_2_.isEmptyBlock(p_225542_3_.above()) && p_225542_2_.getRawBrightness(p_225542_3_.above(), 0) >= 9) {
+ if (p_225542_2_.isEmptyBlock(p_225542_3_.above()) && p_225542_2_.getRawBrightness(p_225542_3_.above(), 0) >= 9) {
int i = this.getHeightBelowUpToMax(p_225542_2_, p_225542_3_) + 1;
- if (i < 16) {
+ if (i < 16 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt(3) == 0 && p_225542_2_.func_175623_d(p_225542_3_.func_177984_a()) && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9)) {
this.func_220258_a(p_225542_1_, p_225542_2_, p_225542_3_, p_225542_4_, i);
+ if (i < 16 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt(3) == 0)) {
this.growBamboo(p_225542_1_, p_225542_2_, p_225542_3_, p_225542_4_, i);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
}
}
@@ -0,0 +1,20 @@
--- a/net/minecraft/block/BeehiveBlock.java
+++ b/net/minecraft/block/BeehiveBlock.java
@@ -65,6 +_,9 @@
public int getAnalogOutputSignal(BlockState p_180641_1_, World p_180641_2_, BlockPos p_180641_3_) {
return p_180641_1_.getValue(HONEY_LEVEL);
}
+ // Forge: Fixed MC-227255 Beehives and bee nests do not rotate/mirror correctly in structure blocks
+ @Override public BlockState rotate(BlockState blockState, net.minecraft.util.Rotation rotation) { return (BlockState)blockState.setValue(FACING, rotation.rotate(blockState.getValue(FACING))); }
+ @Override public BlockState mirror(BlockState blockState, net.minecraft.util.Mirror mirror) { return blockState.rotate(mirror.getRotation(blockState.getValue(FACING))); }
public void playerDestroy(World p_180657_1_, PlayerEntity p_180657_2_, BlockPos p_180657_3_, BlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) {
super.playerDestroy(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_);
@@ -85,6 +_,7 @@
List<BeeEntity> list = p_226881_1_.getEntitiesOfClass(BeeEntity.class, (new AxisAlignedBB(p_226881_2_)).inflate(8.0D, 6.0D, 8.0D));
if (!list.isEmpty()) {
List<PlayerEntity> list1 = p_226881_1_.getEntitiesOfClass(PlayerEntity.class, (new AxisAlignedBB(p_226881_2_)).inflate(8.0D, 6.0D, 8.0D));
+ if (list1.isEmpty()) return; //Forge: Prevent Error when no players are around.
int i = list1.size();
for(BeeEntity beeentity : list) {
@@ -1,109 +1,105 @@
--- a/net/minecraft/block/Block.java
+++ b/net/minecraft/block/Block.java
@@ -54,9 +54,10 @@
@@ -54,9 +_,10 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-public class Block extends AbstractBlock implements IItemProvider {
+public class Block extends AbstractBlock implements IItemProvider, net.minecraftforge.common.extensions.IForgeBlock {
protected static final Logger field_196273_d = LogManager.getLogger();
- public static final ObjectIntIdentityMap<BlockState> field_176229_d = new ObjectIntIdentityMap<>();
protected static final Logger LOGGER = LogManager.getLogger();
- public static final ObjectIntIdentityMap<BlockState> BLOCK_STATE_REGISTRY = new ObjectIntIdentityMap<>();
+ @Deprecated //Forge: Do not use, use GameRegistry
+ public static final ObjectIntIdentityMap<BlockState> field_176229_d = net.minecraftforge.registries.GameData.getBlockStateIDMap();
private static final LoadingCache<VoxelShape, Boolean> field_223006_b = CacheBuilder.newBuilder().maximumSize(512L).weakKeys().build(new CacheLoader<VoxelShape, Boolean>() {
+ public static final ObjectIntIdentityMap<BlockState> BLOCK_STATE_REGISTRY = net.minecraftforge.registries.GameData.getBlockStateIDMap();
private static final LoadingCache<VoxelShape, Boolean> SHAPE_FULL_BLOCK_CACHE = CacheBuilder.newBuilder().maximumSize(512L).weakKeys().build(new CacheLoader<VoxelShape, Boolean>() {
public Boolean load(VoxelShape p_load_1_) {
return !VoxelShapes.func_197879_c(VoxelShapes.func_197868_b(), p_load_1_, IBooleanFunction.field_223236_g_);
@@ -151,6 +152,8 @@
return !VoxelShapes.joinIsNotEmpty(VoxelShapes.block(), p_load_1_, IBooleanFunction.NOT_SAME);
@@ -151,6 +_,8 @@
super(p_i48440_1_);
StateContainer.Builder<Block, BlockState> builder = new StateContainer.Builder<>(this);
this.func_206840_a(builder);
this.createBlockStateDefinition(builder);
+ this.harvestLevel = p_i48440_1_.getHarvestLevel();
+ this.harvestTool = p_i48440_1_.getHarvestTool();
this.field_176227_L = builder.func_235882_a_(Block::func_176223_P, BlockState::new);
this.func_180632_j(this.field_176227_L.func_177621_b());
this.stateDefinition = builder.create(Block::defaultBlockState, BlockState::new);
this.registerDefaultState(this.stateDefinition.any());
}
@@ -261,7 +264,7 @@
@@ -261,7 +_,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_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) {
public static void popResource(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) {
- if (!p_180635_0_.isClientSide && !p_180635_2_.isEmpty() && p_180635_0_.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) {
+ if (!p_180635_0_.isClientSide && !p_180635_2_.isEmpty() && p_180635_0_.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS) && !p_180635_0_.restoringBlockSnapshots) {
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;
@@ -273,7 +276,7 @@
double d0 = (double)(p_180635_0_.random.nextFloat() * 0.5F) + 0.25D;
double d1 = (double)(p_180635_0_.random.nextFloat() * 0.5F) + 0.25D;
@@ -273,7 +_,7 @@
}
public void func_180637_b(ServerWorld p_180637_1_, BlockPos p_180637_2_, int p_180637_3_) {
- if (p_180637_1_.func_82736_K().func_223586_b(GameRules.field_223603_f)) {
+ if (p_180637_1_.func_82736_K().func_223586_b(GameRules.field_223603_f) && !p_180637_1_.restoringBlockSnapshots) {
public void popExperience(ServerWorld p_180637_1_, BlockPos p_180637_2_, int p_180637_3_) {
- if (p_180637_1_.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) {
+ if (p_180637_1_.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS) && !p_180637_1_.restoringBlockSnapshots) {
while(p_180637_3_ > 0) {
int i = ExperienceOrbEntity.func_70527_a(p_180637_3_);
int i = ExperienceOrbEntity.getExperienceValue(p_180637_3_);
p_180637_3_ -= i;
@@ -283,6 +286,7 @@
@@ -283,6 +_,7 @@
}
+ @Deprecated //Forge: Use more sensitive version
public float func_149638_a() {
return this.field_235689_au_;
public float getExplosionResistance() {
return this.explosionResistance;
}
@@ -332,6 +336,7 @@
p_176216_2_.func_213317_d(p_176216_2_.func_213322_ci().func_216372_d(1.0D, 0.0D, 1.0D));
@@ -332,6 +_,7 @@
p_176216_2_.setDeltaMovement(p_176216_2_.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D));
}
+ @Deprecated //Forge: Use more sensitive version
public ItemStack func_185473_a(IBlockReader p_185473_1_, BlockPos p_185473_2_, BlockState p_185473_3_) {
public ItemStack getCloneItemStack(IBlockReader p_185473_1_, BlockPos p_185473_2_, BlockState p_185473_3_) {
return new ItemStack(this);
}
@@ -363,6 +368,7 @@
public void func_176224_k(World p_176224_1_, BlockPos p_176224_2_) {
@@ -363,6 +_,7 @@
public void handleRain(World p_176224_1_, BlockPos p_176224_2_) {
}
+ @Deprecated //Forge: Use more sensitive version
public boolean func_149659_a(Explosion p_149659_1_) {
public boolean dropFromExplosion(Explosion p_149659_1_) {
return true;
}
@@ -382,6 +388,7 @@
return this.field_196275_y;
@@ -382,6 +_,7 @@
return this.defaultBlockState;
}
+ @Deprecated //Forge: Use more sensitive version {@link IForgeBlockState#getSoundType(IWorldReader, BlockPos, Entity) }
public SoundType func_220072_p(BlockState p_220072_1_) {
return this.field_149762_H;
public SoundType getSoundType(BlockState p_220072_1_) {
return this.soundType;
}
@@ -391,7 +398,7 @@
this.field_220086_i = Item.func_150898_a(this);
@@ -391,7 +_,7 @@
this.item = Item.byBlock(this);
}
- return this.field_220086_i;
+ return this.field_220086_i.delegate.get(); //Forge: Vanilla caches the items, update with registry replacements.
- return this.item;
+ return this.item.delegate.get(); //Forge: Vanilla caches the items, update with registry replacements.
}
public boolean func_208619_r() {
@@ -399,7 +406,7 @@
public boolean hasDynamicShape() {
@@ -399,7 +_,7 @@
}
public String toString() {
- return "Block{" + Registry.field_212618_g.func_177774_c(this) + "}";
- return "Block{" + Registry.BLOCK.getKey(this) + "}";
+ return "Block{" + getRegistryName() + "}";
}
@OnlyIn(Dist.CLIENT)
@@ -410,6 +417,83 @@
@@ -409,6 +_,78 @@
protected Block asBlock() {
return this;
}
+
+ /* ======================================== FORGE START =====================================*/
+ protected Random RANDOM = new Random();
+ private net.minecraftforge.common.ToolType harvestTool;
+ private int harvestLevel;
+ private final net.minecraftforge.common.util.ReverseTagWrapper<Block> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, BlockTags::func_199896_a);
+
+ @Override
+ public float getSlipperiness(BlockState state, IWorldReader world, BlockPos pos, @Nullable Entity entity) {
+ return this.field_149765_K;
+ }
+ private final net.minecraftforge.common.util.ReverseTagWrapper<Block> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, BlockTags::getAllTags);
+
+ @Nullable
+ @Override
@@ -118,38 +114,38 @@
+
+ @Override
+ 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));
+ BlockState plant = plantable.getPlant(world, pos.relative(facing));
+ net.minecraftforge.common.PlantType type = plantable.getPlantType(world, pos.relative(facing));
+
+ if (plant.func_177230_c() == Blocks.field_150434_aF)
+ return state.func_203425_a(Blocks.field_150434_aF) || state.func_203425_a(Blocks.field_150354_m) || state.func_203425_a(Blocks.field_196611_F);
+ if (plant.getBlock() == Blocks.CACTUS)
+ return state.is(Blocks.CACTUS) || state.is(Blocks.SAND) || state.is(Blocks.RED_SAND);
+
+ if (plant.func_177230_c() == Blocks.field_196608_cF && this == Blocks.field_196608_cF)
+ if (plant.getBlock() == Blocks.SUGAR_CANE && this == Blocks.SUGAR_CANE)
+ return true;
+
+ if (plantable instanceof BushBlock && ((BushBlock)plantable).func_200014_a_(state, world, pos))
+ if (plantable instanceof BushBlock && ((BushBlock)plantable).mayPlaceOn(state, world, pos))
+ return true;
+
+ if (net.minecraftforge.common.PlantType.DESERT.equals(type)) {
+ return this.getBlock() == Blocks.field_150354_m || this.getBlock() == Blocks.field_150405_ch || this.getBlock() instanceof GlazedTerracottaBlock;
+ return this.getBlock() == Blocks.SAND || this.getBlock() == Blocks.TERRACOTTA || this.getBlock() instanceof GlazedTerracottaBlock;
+ } else if (net.minecraftforge.common.PlantType.NETHER.equals(type)) {
+ return this.getBlock() == Blocks.field_150425_aM;
+ return this.getBlock() == Blocks.SOUL_SAND;
+ } else if (net.minecraftforge.common.PlantType.CROP.equals(type)) {
+ return state.func_203425_a(Blocks.field_150458_ak);
+ return state.is(Blocks.FARMLAND);
+ } else if (net.minecraftforge.common.PlantType.CAVE.equals(type)) {
+ return state.func_224755_d(world, pos, Direction.UP);
+ return state.isFaceSturdy(world, pos, Direction.UP);
+ } else if (net.minecraftforge.common.PlantType.PLAINS.equals(type)) {
+ return this.getBlock() == Blocks.field_196658_i || net.minecraftforge.common.Tags.Blocks.DIRT.func_230235_a_(this) || this.getBlock() == Blocks.field_150458_ak;
+ return this.getBlock() == Blocks.GRASS_BLOCK || net.minecraftforge.common.Tags.Blocks.DIRT.contains(this) || this.getBlock() == Blocks.FARMLAND;
+ } else if (net.minecraftforge.common.PlantType.WATER.equals(type)) {
+ return state.func_185904_a() == net.minecraft.block.material.Material.field_151586_h; //&& state.getValue(BlockLiquidWrapper)
+ return state.getMaterial() == net.minecraft.block.material.Material.WATER; //&& state.getValue(BlockLiquidWrapper)
+ } else if (net.minecraftforge.common.PlantType.BEACH.equals(type)) {
+ boolean isBeach = state.func_203425_a(Blocks.field_196658_i) || net.minecraftforge.common.Tags.Blocks.DIRT.func_230235_a_(this) || state.func_203425_a(Blocks.field_150354_m) || state.func_203425_a(Blocks.field_196611_F);
+ boolean isBeach = state.is(Blocks.GRASS_BLOCK) || net.minecraftforge.common.Tags.Blocks.DIRT.contains(this) || state.is(Blocks.SAND) || state.is(Blocks.RED_SAND);
+ boolean hasWater = false;
+ for (Direction face : Direction.Plane.HORIZONTAL) {
+ BlockState blockState = world.func_180495_p(pos.func_177972_a(face));
+ net.minecraft.fluid.FluidState fluidState = world.func_204610_c(pos.func_177972_a(face));
+ hasWater |= blockState.func_203425_a(Blocks.field_185778_de);
+ hasWater |= fluidState.func_206884_a(net.minecraft.tags.FluidTags.field_206959_a);
+ BlockState blockState = world.getBlockState(pos.relative(face));
+ net.minecraft.fluid.FluidState fluidState = world.getFluidState(pos.relative(face));
+ hasWater |= blockState.is(Blocks.FROSTED_ICE);
+ hasWater |= fluidState.is(net.minecraft.tags.FluidTags.WATER);
+ if (hasWater)
+ break; //No point continuing.
+ }
@@ -170,7 +166,6 @@
+ });
+ }
+ /* ========================================= FORGE END ======================================*/
+
public static final class RenderSideCacheKey {
private final BlockState field_212164_a;
private final BlockState field_212165_b;
private final BlockState first;
@@ -1,11 +1,11 @@
--- a/net/minecraft/block/BlockState.java
+++ b/net/minecraft/block/BlockState.java
@@ -6,7 +6,7 @@
@@ -6,7 +_,7 @@
import net.minecraft.state.Property;
import net.minecraft.util.registry.Registry;
-public class BlockState extends AbstractBlock.AbstractBlockState {
+public class BlockState extends AbstractBlock.AbstractBlockState implements net.minecraftforge.common.extensions.IForgeBlockState {
public static final Codec<BlockState> field_235877_b_ = func_235897_a_(Registry.field_212618_g, Block::func_176223_P).stable();
public static final Codec<BlockState> CODEC = codec(Registry.BLOCK, Block::defaultBlockState).stable();
public BlockState(Block p_i231876_1_, ImmutableMap<Property<?>, Comparable<?>> p_i231876_2_, MapCodec<BlockState> p_i231876_3_) {
@@ -1,35 +1,36 @@
--- a/net/minecraft/block/Blocks.java
+++ b/net/minecraft/block/Blocks.java
@@ -25,6 +25,7 @@
@@ -25,6 +_,7 @@
import net.minecraft.world.IBlockReader;
import net.minecraft.world.gen.feature.Features;
[email protected]("minecraft")
public class Blocks {
public static final Block field_150350_a = func_222382_a("air", new AirBlock(AbstractBlock.Properties.func_200945_a(Material.field_151579_a).func_200942_a().func_222380_e().func_235859_g_()));
public static final Block field_150348_b = func_222382_a("stone", new Block(AbstractBlock.Properties.func_200949_a(Material.field_151576_e, MaterialColor.field_151665_m).func_235861_h_().func_200948_a(1.5F, 6.0F)));
@@ -119,7 +120,7 @@
public static final Block field_196601_az = func_222382_a("green_bed", func_235422_a_(DyeColor.GREEN));
public static final Block field_196550_aA = func_222382_a("red_bed", func_235422_a_(DyeColor.RED));
public static final Block field_196551_aB = func_222382_a("black_bed", func_235422_a_(DyeColor.BLACK));
- public static final Block field_196552_aC = func_222382_a("powered_rail", new PoweredRailBlock(AbstractBlock.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(AbstractBlock.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(AbstractBlock.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", func_235432_a_(true));
public static final Block field_196553_aF = func_222382_a("cobweb", new WebBlock(AbstractBlock.Properties.func_200945_a(Material.field_151569_G).func_200942_a().func_235861_h_().func_200943_b(4.0F)));
@@ -937,15 +938,4 @@
public static void func_235419_a_() {
Block.field_176229_d.forEach(AbstractBlock.AbstractBlockState::func_215692_c);
}
public static final Block AIR = register("air", new AirBlock(AbstractBlock.Properties.of(Material.AIR).noCollission().noDrops().air()));
public static final Block STONE = register("stone", new Block(AbstractBlock.Properties.of(Material.STONE, MaterialColor.STONE).requiresCorrectToolForDrops().strength(1.5F, 6.0F)));
@@ -119,7 +_,7 @@
public static final Block GREEN_BED = register("green_bed", bed(DyeColor.GREEN));
public static final Block RED_BED = register("red_bed", bed(DyeColor.RED));
public static final Block BLACK_BED = register("black_bed", bed(DyeColor.BLACK));
- public static final Block POWERED_RAIL = register("powered_rail", new PoweredRailBlock(AbstractBlock.Properties.of(Material.DECORATION).noCollission().strength(0.7F).sound(SoundType.METAL)));
+ public static final Block POWERED_RAIL = register("powered_rail", new PoweredRailBlock(AbstractBlock.Properties.of(Material.DECORATION).noCollission().strength(0.7F).sound(SoundType.METAL), true));
public static final Block DETECTOR_RAIL = register("detector_rail", new DetectorRailBlock(AbstractBlock.Properties.of(Material.DECORATION).noCollission().strength(0.7F).sound(SoundType.METAL)));
public static final Block STICKY_PISTON = register("sticky_piston", pistonBase(true));
public static final Block COBWEB = register("cobweb", new WebBlock(AbstractBlock.Properties.of(Material.WEB).noCollission().requiresCorrectToolForDrops().strength(4.0F)));
@@ -936,16 +_,5 @@
public static void rebuildCache() {
Block.BLOCK_STATE_REGISTRY.forEach(AbstractBlock.AbstractBlockState::initCache);
- }
-
- static {
- for(Block block : Registry.field_212618_g) {
- for(BlockState blockstate : block.func_176194_O().func_177619_a()) {
- Block.field_176229_d.func_195867_b(blockstate);
- for(Block block : Registry.BLOCK) {
- for(BlockState blockstate : block.getStateDefinition().getPossibleStates()) {
- Block.BLOCK_STATE_REGISTRY.add(blockstate);
- }
-
- block.func_220068_i();
- block.getLootTable();
- }
-
- }
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/block/BushBlock.java
+++ b/net/minecraft/block/BushBlock.java
@@ -7,7 +7,7 @@
@@ -7,7 +_,7 @@
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
@@ -9,24 +9,25 @@
public BushBlock(AbstractBlock.Properties p_i48437_1_) {
super(p_i48437_1_);
}
@@ -22,6 +22,8 @@
@@ -22,6 +_,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);
public boolean canSurvive(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
BlockPos blockpos = p_196260_3_.below();
+ if (p_196260_1_.getBlock() == 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_.getBlockState(blockpos).canSustainPlant(p_196260_2_, blockpos, Direction.UP, this);
return this.mayPlaceOn(p_196260_2_.getBlockState(blockpos), p_196260_2_, blockpos);
}
@@ -32,4 +34,11 @@
public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
return p_196266_4_ == PathType.AIR && !this.field_235688_at_ ? true : super.func_196266_a(p_196266_1_, p_196266_2_, p_196266_3_, p_196266_4_);
}
@@ -31,5 +_,12 @@
public boolean isPathfindable(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
return p_196266_4_ == PathType.AIR && !this.hasCollision ? true : super.isPathfindable(p_196266_1_, p_196266_2_, p_196266_3_, p_196266_4_);
+ }
+
+ @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();
+ BlockState state = world.getBlockState(pos);
+ if (state.getBlock() != this) return defaultBlockState();
+ return state;
+ }
}
}
@@ -1,33 +1,33 @@
--- a/net/minecraft/block/CactusBlock.java
+++ b/net/minecraft/block/CactusBlock.java
@@ -19,7 +19,7 @@
@@ -19,7 +_,7 @@
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
-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);
@@ -30,6 +30,7 @@
public static final IntegerProperty AGE = BlockStateProperties.AGE_15;
protected static final VoxelShape COLLISION_SHAPE = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 15.0D, 15.0D);
protected static final VoxelShape OUTLINE_SHAPE = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
@@ -30,6 +_,7 @@
}
public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) {
public void tick(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) {
+ if (!p_225534_2_.isAreaLoaded(p_225534_3_, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update
if (!p_225534_1_.func_196955_c(p_225534_2_, p_225534_3_)) {
p_225534_2_.func_175655_b(p_225534_3_, true);
if (!p_225534_1_.canSurvive(p_225534_2_, p_225534_3_)) {
p_225534_2_.destroyBlock(p_225534_3_, true);
}
@@ -45,6 +46,7 @@
@@ -45,6 +_,7 @@
if (i < 3) {
int j = p_225542_1_.func_177229_b(field_176587_a);
int j = p_225542_1_.getValue(AGE);
+ if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, blockpos, p_225542_1_, true)) {
if (j == 15) {
p_225542_2_.func_175656_a(blockpos, this.func_176223_P());
BlockState blockstate = p_225542_1_.func_206870_a(field_176587_a, Integer.valueOf(0));
@@ -53,7 +55,8 @@
p_225542_2_.setBlockAndUpdate(blockpos, this.defaultBlockState());
BlockState blockstate = p_225542_1_.setValue(AGE, Integer.valueOf(0));
@@ -53,7 +_,8 @@
} else {
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176587_a, Integer.valueOf(j + 1)), 4);
p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(j + 1)), 4);
}
-
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
@@ -35,19 +35,20 @@
}
}
}
@@ -84,7 +87,7 @@
@@ -84,7 +_,7 @@
}
BlockState blockstate1 = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
- return (blockstate1.func_203425_a(Blocks.field_150434_aF) || blockstate1.func_203425_a(Blocks.field_150354_m) || blockstate1.func_203425_a(Blocks.field_196611_F)) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d();
+ return blockstate1.canSustainPlant(p_196260_2_, p_196260_3_, Direction.UP, this) && !p_196260_2_.func_180495_p(p_196260_3_.func_177984_a()).func_185904_a().func_76224_d();
BlockState blockstate1 = p_196260_2_.getBlockState(p_196260_3_.below());
- return (blockstate1.is(Blocks.CACTUS) || blockstate1.is(Blocks.SAND) || blockstate1.is(Blocks.RED_SAND)) && !p_196260_2_.getBlockState(p_196260_3_.above()).getMaterial().isLiquid();
+ return blockstate1.canSustainPlant(p_196260_2_, p_196260_3_, Direction.UP, this) && !p_196260_2_.getBlockState(p_196260_3_.above()).getMaterial().isLiquid();
}
public void func_196262_a(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) {
@@ -98,4 +101,14 @@
public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
public void entityInside(BlockState p_196262_1_, World p_196262_2_, BlockPos p_196262_3_, Entity p_196262_4_) {
@@ -97,5 +_,15 @@
public boolean isPathfindable(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
return false;
}
+ }
+
+ @Override
+ public net.minecraftforge.common.PlantType getPlantType(IBlockReader world, BlockPos pos) {
@@ -56,6 +57,6 @@
+
+ @Override
+ public BlockState getPlant(IBlockReader world, BlockPos pos) {
+ return func_176223_P();
+ }
+ return defaultBlockState();
}
}
@@ -1,11 +1,20 @@
--- a/net/minecraft/block/CampfireBlock.java
+++ b/net/minecraft/block/CampfireBlock.java
@@ -181,7 +181,7 @@
public void func_220066_a(World p_220066_1_, BlockState p_220066_2_, BlockRayTraceResult p_220066_3_, ProjectileEntity p_220066_4_) {
if (!p_220066_1_.field_72995_K && p_220066_4_.func_70027_ad()) {
Entity entity = p_220066_4_.func_234616_v_();
- boolean flag = entity == null || entity instanceof PlayerEntity || p_220066_1_.func_82736_K().func_223586_b(GameRules.field_223599_b);
@@ -181,7 +_,7 @@
public void onProjectileHit(World p_220066_1_, BlockState p_220066_2_, BlockRayTraceResult p_220066_3_, ProjectileEntity p_220066_4_) {
if (!p_220066_1_.isClientSide && p_220066_4_.isOnFire()) {
Entity entity = p_220066_4_.getOwner();
- boolean flag = entity == null || entity instanceof PlayerEntity || p_220066_1_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
+ boolean flag = entity == null || entity instanceof PlayerEntity || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_220066_1_, entity);
if (flag && !p_220066_2_.func_177229_b(field_220101_b) && !p_220066_2_.func_177229_b(field_220103_d)) {
BlockPos blockpos = p_220066_3_.func_216350_a();
p_220066_1_.func_180501_a(blockpos, p_220066_2_.func_206870_a(BlockStateProperties.field_208190_q, Boolean.valueOf(true)), 11);
if (flag && !p_220066_2_.getValue(LIT) && !p_220066_2_.getValue(WATERLOGGED)) {
BlockPos blockpos = p_220066_3_.getBlockPos();
p_220066_1_.setBlock(blockpos, p_220066_2_.setValue(BlockStateProperties.LIT, Boolean.valueOf(true)), 11);
@@ -208,7 +_,7 @@
return true;
}
- boolean flag = VoxelShapes.joinIsNotEmpty(VIRTUAL_FENCE_POST, blockstate.getCollisionShape(p_235474_0_, p_235474_1_, ISelectionContext.empty()), IBooleanFunction.AND);
+ boolean flag = VoxelShapes.joinIsNotEmpty(VIRTUAL_FENCE_POST, blockstate.getCollisionShape(p_235474_0_, blockpos, ISelectionContext.empty()), IBooleanFunction.AND);//Forge fix: MC-201374
if (flag) {
BlockState blockstate1 = p_235474_0_.getBlockState(blockpos.below());
return isLitCampfire(blockstate1);
@@ -0,0 +1,12 @@
--- a/net/minecraft/block/ChestBlock.java
+++ b/net/minecraft/block/ChestBlock.java
@@ -325,7 +_,8 @@
}
public BlockState mirror(BlockState p_185471_1_, Mirror p_185471_2_) {
- return p_185471_1_.rotate(p_185471_2_.getRotation(p_185471_1_.getValue(FACING)));
+ BlockState rotated = p_185471_1_.rotate(p_185471_2_.getRotation(p_185471_1_.getValue(FACING)));
+ return p_185471_2_ == Mirror.NONE ? rotated : rotated.setValue(TYPE, rotated.getValue(TYPE).getOpposite()); // Forge: Fixed MC-134110 Structure mirroring breaking apart double chests
}
protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> p_206840_1_) {
@@ -1,47 +1,47 @@
--- a/net/minecraft/block/ChorusFlowerBlock.java
+++ b/net/minecraft/block/ChorusFlowerBlock.java
@@ -40,7 +40,7 @@
BlockPos blockpos = p_225542_3_.func_177984_a();
if (p_225542_2_.func_175623_d(blockpos) && blockpos.func_177956_o() < 256) {
int i = p_225542_1_.func_177229_b(field_185607_a);
@@ -40,7 +_,7 @@
BlockPos blockpos = p_225542_3_.above();
if (p_225542_2_.isEmptyBlock(blockpos) && blockpos.getY() < 256) {
int i = p_225542_1_.getValue(AGE);
- if (i < 5) {
+ if (i < 5 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, blockpos, p_225542_1_, true)) {
boolean flag = false;
boolean flag1 = false;
BlockState blockstate = p_225542_2_.func_180495_p(p_225542_3_.func_177977_b());
@@ -65,7 +65,7 @@
BlockState blockstate = p_225542_2_.getBlockState(p_225542_3_.below());
@@ -65,7 +_,7 @@
if (j < 2 || j <= p_225542_4_.nextInt(flag1 ? 5 : 4)) {
flag = true;
}
- } else if (blockstate.func_196958_f()) {
+ } else if (blockstate.isAir(p_225542_2_, p_225542_3_.func_177977_b())) {
- } else if (blockstate.isAir()) {
+ } else if (blockstate.isAir(p_225542_2_, p_225542_3_.below())) {
flag = true;
}
@@ -97,7 +97,7 @@
@@ -97,7 +_,7 @@
} else {
this.func_185605_c(p_225542_2_, p_225542_3_);
this.placeDeadFlower(p_225542_2_, p_225542_3_);
}
-
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
}
}
}
@@ -133,7 +133,7 @@
public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
if (blockstate.func_177230_c() != this.field_196405_b && !blockstate.func_203425_a(Blocks.field_150377_bs)) {
- if (!blockstate.func_196958_f()) {
+ if (!blockstate.isAir(p_196260_2_, p_196260_3_.func_177977_b())) {
@@ -133,7 +_,7 @@
public boolean canSurvive(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
BlockState blockstate = p_196260_2_.getBlockState(p_196260_3_.below());
if (blockstate.getBlock() != this.plant && !blockstate.is(Blocks.END_STONE)) {
- if (!blockstate.isAir()) {
+ if (!blockstate.isAir(p_196260_2_, p_196260_3_.below())) {
return false;
} else {
boolean flag = false;
@@ -146,7 +146,7 @@
@@ -146,7 +_,7 @@
}
flag = true;
- } else if (!blockstate1.func_196958_f()) {
+ } else if (!blockstate1.isAir(p_196260_2_, p_196260_3_.func_177972_a(direction))) {
- } else if (!blockstate1.isAir()) {
+ } else if (!blockstate1.isAir(p_196260_2_, p_196260_3_.relative(direction))) {
return false;
}
}
@@ -1,15 +1,15 @@
--- a/net/minecraft/block/CocoaBlock.java
+++ b/net/minecraft/block/CocoaBlock.java
@@ -35,10 +35,11 @@
@@ -35,10 +_,11 @@
}
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
- if (p_225542_2_.field_73012_v.nextInt(5) == 0) {
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
- if (p_225542_2_.random.nextInt(5) == 0) {
+ if (true) {
int i = p_225542_1_.func_177229_b(field_176501_a);
int i = p_225542_1_.getValue(AGE);
- if (i < 2) {
+ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_2_.field_73012_v.nextInt(5) == 0)) {
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176501_a, Integer.valueOf(i + 1)), 2);
+ if (i < 2 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_2_.random.nextInt(5) == 0)) {
p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(i + 1)), 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
}
}
@@ -1,19 +1,19 @@
--- a/net/minecraft/block/ComparatorBlock.java
+++ b/net/minecraft/block/ComparatorBlock.java
@@ -154,4 +154,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);
@@ -154,4 +_,16 @@
protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> p_206840_1_) {
p_206840_1_.add(FACING, MODE, POWERED);
}
+
+ @Override
+ public boolean getWeakChanges(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos) {
+ return state.func_203425_a(Blocks.field_196762_fd);
+ return state.is(Blocks.COMPARATOR);
+ }
+
+ @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);
+ if (pos.getY() == neighbor.getY() && world instanceof World && !((World)world).isClientSide()) {
+ state.neighborChanged((World)world, pos, world.getBlockState(neighbor).getBlock(), neighbor, false);
+ }
+ }
}
@@ -1,39 +1,39 @@
--- a/net/minecraft/block/CropsBlock.java
+++ b/net/minecraft/block/CropsBlock.java
@@ -61,12 +61,14 @@
@@ -61,12 +_,14 @@
}
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
+ if (!p_225542_2_.isAreaLoaded(p_225542_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
if (p_225542_2_.func_226659_b_(p_225542_3_, 0) >= 9) {
int i = this.func_185527_x(p_225542_1_);
if (i < this.func_185526_g()) {
float f = func_180672_a(this, p_225542_2_, p_225542_3_);
if (p_225542_2_.getRawBrightness(p_225542_3_, 0) >= 9) {
int i = this.getAge(p_225542_1_);
if (i < this.getMaxAge()) {
float f = getGrowthSpeed(this, p_225542_2_, p_225542_3_);
- if (p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0) {
+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0)) {
p_225542_2_.func_180501_a(p_225542_3_, this.func_185528_e(i + 1), 2);
p_225542_2_.setBlock(p_225542_3_, this.getStateForAge(i + 1), 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
}
}
}
@@ -95,9 +97,9 @@
@@ -95,9 +_,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_203425_a(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_)) {
BlockState blockstate = p_180672_1_.getBlockState(blockpos.offset(i, 0, j));
- if (blockstate.is(Blocks.FARMLAND)) {
+ if (blockstate.canSustainPlant(p_180672_1_, blockpos.offset(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_, p_180672_2_.func_177982_a(i, 0, j))) {
- if (blockstate.getValue(FarmlandBlock.MOISTURE) > 0) {
+ if (blockstate.isFertile(p_180672_1_, p_180672_2_.offset(i, 0, j))) {
f1 = 3.0F;
}
}
@@ -133,7 +135,7 @@
@@ -133,7 +_,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)) {
public void entityInside(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_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+ if (p_196262_4_ instanceof RavagerEntity && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(p_196262_2_, p_196262_4_)) {
p_196262_2_.func_225521_a_(p_196262_3_, true, p_196262_4_);
p_196262_2_.destroyBlock(p_196262_3_, true, p_196262_4_);
}
@@ -1,11 +1,11 @@
--- a/net/minecraft/block/DeadBushBlock.java
+++ b/net/minecraft/block/DeadBushBlock.java
@@ -5,7 +5,7 @@
@@ -5,7 +_,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.IForgeShearable {
protected static final VoxelShape field_196397_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D);
protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D);
public DeadBushBlock(AbstractBlock.Properties p_i48418_1_) {
@@ -1,11 +1,11 @@
--- a/net/minecraft/block/DetectorRailBlock.java
+++ b/net/minecraft/block/DetectorRailBlock.java
@@ -131,6 +131,8 @@
@@ -131,6 +_,8 @@
}
List<AbstractMinecartEntity> list1 = this.func_200878_a(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, EntityPredicates.field_96566_b);
+ List<AbstractMinecartEntity> carts = this.func_200878_a(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, null);
List<AbstractMinecartEntity> list1 = this.getInteractingMinecartOfType(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, EntityPredicates.CONTAINER_ENTITY_SELECTOR);
+ List<AbstractMinecartEntity> carts = this.getInteractingMinecartOfType(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, null);
+ if (!carts.isEmpty() && carts.get(0).getComparatorLevel() > -1) return carts.get(0).getComparatorLevel();
if (!list1.isEmpty()) {
return Container.func_94526_b((IInventory)list1.get(0));
return Container.getRedstoneSignalFromContainer((IInventory)list1.get(0));
}
@@ -1,10 +1,10 @@
--- a/net/minecraft/block/DoublePlantBlock.java
+++ b/net/minecraft/block/DoublePlantBlock.java
@@ -51,6 +51,7 @@
return super.func_196260_a(p_196260_1_, p_196260_2_, p_196260_3_);
@@ -51,6 +_,7 @@
return super.canSurvive(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_203425_a(this) && blockstate.func_177229_b(field_176492_b) == DoubleBlockHalf.LOWER;
BlockState blockstate = p_196260_2_.getBlockState(p_196260_3_.below());
+ if (p_196260_1_.getBlock() != this) return super.canSurvive(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.is(this) && blockstate.getValue(HALF) == DoubleBlockHalf.LOWER;
}
}
@@ -1,11 +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);
@@ -37,7 +_,7 @@
p_176439_1_.levelEvent(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 itemstack = dispensertileentity.getItem(i);
- if (!itemstack.isEmpty()) {
+ if (!itemstack.isEmpty() && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(p_176439_1_, p_176439_2_, dispensertileentity, i, itemstack)) {
Direction direction = p_176439_1_.getBlockState(p_176439_2_).getValue(FACING);
IInventory iinventory = HopperTileEntity.getContainerAt(p_176439_1_, p_176439_2_.relative(direction));
ItemStack itemstack1;
@@ -1,11 +1,11 @@
--- a/net/minecraft/block/EnchantingTableBlock.java
+++ b/net/minecraft/block/EnchantingTableBlock.java
@@ -54,7 +54,7 @@
@@ -54,7 +_,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);
- if (p_180655_2_.func_180495_p(blockpos).func_203425_a(Blocks.field_150342_X)) {
+ if (p_180655_2_.func_180495_p(blockpos).getEnchantPowerBonus(p_180655_2_, blockpos) > 0) {
if (!p_180655_2_.func_175623_d(p_180655_3_.func_177982_a(i / 2, 0, j / 2))) {
BlockPos blockpos = p_180655_3_.offset(i, k, j);
- if (p_180655_2_.getBlockState(blockpos).is(Blocks.BOOKSHELF)) {
+ if (p_180655_2_.getBlockState(blockpos).getEnchantPowerBonus(p_180655_2_, blockpos) > 0) {
if (!p_180655_2_.isEmptyBlock(p_180655_3_.offset(i / 2, 0, j / 2))) {
break;
}
@@ -1,20 +1,20 @@
--- a/net/minecraft/block/FallingBlock.java
+++ b/net/minecraft/block/FallingBlock.java
@@ -30,7 +30,7 @@
@@ -30,7 +_,7 @@
}
public void func_225534_a_(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) {
- if (func_185759_i(p_225534_2_.func_180495_p(p_225534_3_.func_177977_b())) && p_225534_3_.func_177956_o() >= 0) {
+ if (p_225534_2_.func_175623_d(p_225534_3_.func_177977_b()) || func_185759_i(p_225534_2_.func_180495_p(p_225534_3_.func_177977_b())) && p_225534_3_.func_177956_o() >= 0) {
FallingBlockEntity fallingblockentity = new FallingBlockEntity(p_225534_2_, (double)p_225534_3_.func_177958_n() + 0.5D, (double)p_225534_3_.func_177956_o(), (double)p_225534_3_.func_177952_p() + 0.5D, p_225534_2_.func_180495_p(p_225534_3_));
this.func_149829_a(fallingblockentity);
p_225534_2_.func_217376_c(fallingblockentity);
@@ -59,7 +59,7 @@
public void func_180655_c(BlockState p_180655_1_, World p_180655_2_, BlockPos p_180655_3_, Random p_180655_4_) {
public void tick(BlockState p_225534_1_, ServerWorld p_225534_2_, BlockPos p_225534_3_, Random p_225534_4_) {
- if (isFree(p_225534_2_.getBlockState(p_225534_3_.below())) && p_225534_3_.getY() >= 0) {
+ if (p_225534_2_.isEmptyBlock(p_225534_3_.below()) || isFree(p_225534_2_.getBlockState(p_225534_3_.below())) && p_225534_3_.getY() >= 0) {
FallingBlockEntity fallingblockentity = new FallingBlockEntity(p_225534_2_, (double)p_225534_3_.getX() + 0.5D, (double)p_225534_3_.getY(), (double)p_225534_3_.getZ() + 0.5D, p_225534_2_.getBlockState(p_225534_3_));
this.falling(fallingblockentity);
p_225534_2_.addFreshEntity(fallingblockentity);
@@ -59,7 +_,7 @@
public void animateTick(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)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble();
double d1 = (double)p_180655_3_.func_177956_o() - 0.05D;
double d2 = (double)p_180655_3_.func_177952_p() + p_180655_4_.nextDouble();
BlockPos blockpos = p_180655_3_.below();
- if (isFree(p_180655_2_.getBlockState(blockpos))) {
+ if (p_180655_2_.isEmptyBlock(blockpos) || isFree(p_180655_2_.getBlockState(blockpos))) {
double d0 = (double)p_180655_3_.getX() + p_180655_4_.nextDouble();
double d1 = (double)p_180655_3_.getY() - 0.05D;
double d2 = (double)p_180655_3_.getZ() + p_180655_4_.nextDouble();
@@ -1,29 +1,29 @@
--- a/net/minecraft/block/FarmlandBlock.java
+++ b/net/minecraft/block/FarmlandBlock.java
@@ -77,7 +77,7 @@
@@ -77,7 +_,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 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_);
public void fallOn(World p_180658_1_, BlockPos p_180658_2_, Entity p_180658_3_, float p_180658_4_) {
- if (!p_180658_1_.isClientSide && p_180658_1_.random.nextFloat() < p_180658_4_ - 0.5F && p_180658_3_ instanceof LivingEntity && (p_180658_3_ instanceof PlayerEntity || p_180658_1_.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && p_180658_3_.getBbWidth() * p_180658_3_.getBbWidth() * p_180658_3_.getBbHeight() > 0.512F) {
+ if (!p_180658_1_.isClientSide && net.minecraftforge.common.ForgeHooks.onFarmlandTrample(p_180658_1_, p_180658_2_, Blocks.DIRT.defaultBlockState(), p_180658_4_, p_180658_3_)) { // Forge: Move logic to Entity#canTrample
turnToDirt(p_180658_1_.getBlockState(p_180658_2_), p_180658_1_, p_180658_2_);
}
@@ -88,9 +88,10 @@
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_));
@@ -88,9 +_,10 @@
p_199610_1_.setBlockAndUpdate(p_199610_2_, pushEntitiesUp(p_199610_0_, Blocks.DIRT.defaultBlockState(), 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();
- private static boolean isUnderCrops(IBlockReader p_176529_0_, BlockPos p_176529_1_) {
- Block block = p_176529_0_.getBlockState(p_176529_1_.above()).getBlock();
- return block instanceof CropsBlock || block instanceof StemBlock || block instanceof AttachedStemBlock;
+ private boolean func_176529_d(IBlockReader p_176529_0_, BlockPos p_176529_1_) {
+ BlockState plant = p_176529_0_.func_180495_p(p_176529_1_.func_177984_a());
+ BlockState state = p_176529_0_.func_180495_p(p_176529_1_);
+ return plant.func_177230_c() instanceof net.minecraftforge.common.IPlantable && state.canSustainPlant(p_176529_0_, p_176529_1_, Direction.UP, (net.minecraftforge.common.IPlantable)plant.func_177230_c());
+ private boolean isUnderCrops(IBlockReader p_176529_0_, BlockPos p_176529_1_) {
+ BlockState plant = p_176529_0_.getBlockState(p_176529_1_.above());
+ BlockState state = p_176529_0_.getBlockState(p_176529_1_);
+ return plant.getBlock() instanceof net.minecraftforge.common.IPlantable && state.canSustainPlant(p_176529_0_, p_176529_1_, Direction.UP, (net.minecraftforge.common.IPlantable)plant.getBlock());
}
private static boolean func_176530_e(IWorldReader p_176530_0_, BlockPos p_176530_1_) {
@@ -100,7 +101,7 @@
private static boolean isNearWater(IWorldReader p_176530_0_, BlockPos p_176530_1_) {
@@ -100,7 +_,7 @@
}
}
@@ -31,4 +31,4 @@
+ return net.minecraftforge.common.FarmlandWaterManager.hasBlockWaterTicket(p_176530_0_, p_176530_1_);
}
protected void func_206840_a(StateContainer.Builder<Block, BlockState> p_206840_1_) {
protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> p_206840_1_) {
@@ -1,107 +1,107 @@
--- a/net/minecraft/block/FireBlock.java
+++ b/net/minecraft/block/FireBlock.java
@@ -92,13 +92,13 @@
protected 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) && !blockstate.func_224755_d(p_196448_1_, blockpos, Direction.UP)) {
BlockState blockstate1 = this.func_176223_P();
@@ -92,13 +_,13 @@
protected BlockState getStateForPlacement(IBlockReader p_196448_1_, BlockPos p_196448_2_) {
BlockPos blockpos = p_196448_2_.below();
BlockState blockstate = p_196448_1_.getBlockState(blockpos);
- if (!this.canBurn(blockstate) && !blockstate.isFaceSturdy(p_196448_1_, blockpos, Direction.UP)) {
+ if (!this.canCatchFire(p_196448_1_, p_196448_2_, Direction.UP) && !blockstate.isFaceSturdy(p_196448_1_, blockpos, Direction.UP)) {
BlockState blockstate1 = this.defaultBlockState();
for(Direction direction : Direction.values()) {
BooleanProperty booleanproperty = field_196449_B.get(direction);
BooleanProperty booleanproperty = PROPERTY_BY_DIRECTION.get(direction);
if (booleanproperty != null) {
- 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())));
- blockstate1 = blockstate1.setValue(booleanproperty, Boolean.valueOf(this.canBurn(p_196448_1_.getBlockState(p_196448_2_.relative(direction)))));
+ blockstate1 = blockstate1.setValue(booleanproperty, Boolean.valueOf(this.canCatchFire(p_196448_1_, p_196448_2_.relative(direction), direction.getOpposite())));
}
}
@@ -121,7 +121,7 @@
@@ -121,7 +_,7 @@
}
BlockState blockstate = p_225534_2_.func_180495_p(p_225534_3_.func_177977_b());
- boolean flag = blockstate.func_235714_a_(p_225534_2_.func_230315_m_().func_241515_q_());
BlockState blockstate = p_225534_2_.getBlockState(p_225534_3_.below());
- boolean flag = blockstate.is(p_225534_2_.dimensionType().infiniburn());
+ boolean flag = blockstate.isFireSource(p_225534_2_, p_225534_3_, Direction.UP);
int i = p_225534_1_.func_177229_b(field_176543_a);
if (!flag && p_225534_2_.func_72896_J() && this.func_176537_d(p_225534_2_, p_225534_3_) && p_225534_4_.nextFloat() < 0.2F + (float)i * 0.03F) {
p_225534_2_.func_217377_a(p_225534_3_, false);
@@ -142,7 +142,7 @@
int i = p_225534_1_.getValue(AGE);
if (!flag && p_225534_2_.isRaining() && this.isNearRain(p_225534_2_, p_225534_3_) && p_225534_4_.nextFloat() < 0.2F + (float)i * 0.03F) {
p_225534_2_.removeBlock(p_225534_3_, false);
@@ -142,7 +_,7 @@
return;
}
- if (i == 15 && p_225534_4_.nextInt(4) == 0 && !this.func_196446_i(p_225534_2_.func_180495_p(p_225534_3_.func_177977_b()))) {
+ if (i == 15 && p_225534_4_.nextInt(4) == 0 && !this.canCatchFire(p_225534_2_, p_225534_3_.func_177977_b(), Direction.UP)) {
p_225534_2_.func_217377_a(p_225534_3_, false);
- if (i == 15 && p_225534_4_.nextInt(4) == 0 && !this.canBurn(p_225534_2_.getBlockState(p_225534_3_.below()))) {
+ if (i == 15 && p_225534_4_.nextInt(4) == 0 && !this.canCatchFire(p_225534_2_, p_225534_3_.below(), Direction.UP)) {
p_225534_2_.removeBlock(p_225534_3_, false);
return;
}
@@ -150,12 +150,12 @@
@@ -150,12 +_,12 @@
boolean flag1 = p_225534_2_.func_180502_D(p_225534_3_);
boolean flag1 = p_225534_2_.isHumidAt(p_225534_3_);
int k = flag1 ? -50 : 0;
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177974_f(), 300 + k, p_225534_4_, i);
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177976_e(), 300 + k, p_225534_4_, i);
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177977_b(), 250 + k, p_225534_4_, i);
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177984_a(), 250 + k, p_225534_4_, i);
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177978_c(), 300 + k, p_225534_4_, i);
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177968_d(), 300 + k, p_225534_4_, i);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177974_f(), 300 + k, p_225534_4_, i, Direction.WEST);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177976_e(), 300 + k, p_225534_4_, i, Direction.EAST);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177977_b(), 250 + k, p_225534_4_, i, Direction.UP);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177984_a(), 250 + k, p_225534_4_, i, Direction.DOWN);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177978_c(), 300 + k, p_225534_4_, i, Direction.SOUTH);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177968_d(), 300 + k, p_225534_4_, i, Direction.NORTH);
- this.checkBurnOut(p_225534_2_, p_225534_3_.east(), 300 + k, p_225534_4_, i);
- this.checkBurnOut(p_225534_2_, p_225534_3_.west(), 300 + k, p_225534_4_, i);
- this.checkBurnOut(p_225534_2_, p_225534_3_.below(), 250 + k, p_225534_4_, i);
- this.checkBurnOut(p_225534_2_, p_225534_3_.above(), 250 + k, p_225534_4_, i);
- this.checkBurnOut(p_225534_2_, p_225534_3_.north(), 300 + k, p_225534_4_, i);
- this.checkBurnOut(p_225534_2_, p_225534_3_.south(), 300 + k, p_225534_4_, i);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.east(), 300 + k, p_225534_4_, i, Direction.WEST);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.west(), 300 + k, p_225534_4_, i, Direction.EAST);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.below(), 250 + k, p_225534_4_, i, Direction.UP);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.above(), 250 + k, p_225534_4_, i, Direction.DOWN);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.north(), 300 + k, p_225534_4_, i, Direction.SOUTH);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.south(), 300 + k, p_225534_4_, i, Direction.NORTH);
BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable();
for(int l = -1; l <= 1; ++l) {
@@ -193,16 +193,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());
@@ -193,16 +_,18 @@
return p_176537_1_.isRainingAt(p_176537_2_) || p_176537_1_.isRainingAt(p_176537_2_.west()) || p_176537_1_.isRainingAt(p_176537_2_.east()) || p_176537_1_.isRainingAt(p_176537_2_.north()) || p_176537_1_.isRainingAt(p_176537_2_.south());
}
+ @Deprecated //Forge: Use IForgeBlockState.getFlammability, Public for default implementation only.
public int func_220274_q(BlockState p_220274_1_) {
return p_220274_1_.func_235901_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());
public int getBurnOdd(BlockState p_220274_1_) {
return p_220274_1_.hasProperty(BlockStateProperties.WATERLOGGED) && p_220274_1_.getValue(BlockStateProperties.WATERLOGGED) ? 0 : this.burnOdds.getInt(p_220274_1_.getBlock());
}
+ @Deprecated //Forge: Use IForgeBlockState.getFireSpreadSpeed
public int func_220275_r(BlockState p_220275_1_) {
return p_220275_1_.func_235901_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());
public int getFlameOdds(BlockState p_220275_1_) {
return p_220275_1_.hasProperty(BlockStateProperties.WATERLOGGED) && p_220275_1_.getValue(BlockStateProperties.WATERLOGGED) ? 0 : this.flameOdds.getInt(p_220275_1_.getBlock());
}
- 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_220274_q(p_176536_1_.func_180495_p(p_176536_2_));
- private void checkBurnOut(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_) {
- int i = this.getBurnOdd(p_176536_1_.getBlockState(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);
+ int i = p_176536_1_.getBlockState(p_176536_2_).getFlammability(p_176536_1_, p_176536_2_, face);
if (p_176536_4_.nextInt(p_176536_3_) < i) {
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_)) {
@@ -212,11 +214,7 @@
p_176536_1_.func_217377_a(p_176536_2_, false);
BlockState blockstate = p_176536_1_.getBlockState(p_176536_2_);
if (p_176536_4_.nextInt(p_176536_5_ + 10) < 5 && !p_176536_1_.isRainingAt(p_176536_2_)) {
@@ -212,11 +_,7 @@
p_176536_1_.removeBlock(p_176536_2_, false);
}
- Block block = blockstate.func_177230_c();
- Block block = blockstate.getBlock();
- if (block instanceof TNTBlock) {
- TNTBlock tntblock = (TNTBlock)block;
- TNTBlock.func_196534_a(p_176536_1_, p_176536_2_);
- TNTBlock.explode(p_176536_1_, p_176536_2_);
- }
+ blockstate.catchFire(p_176536_1_, p_176536_2_, face, null);
}
}
@@ -228,7 +226,7 @@
@@ -228,7 +_,7 @@
private boolean func_196447_a(IBlockReader p_196447_1_, BlockPos p_196447_2_) {
private boolean isValidFireLocation(IBlockReader p_196447_1_, BlockPos p_196447_2_) {
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())) {
- if (this.canBurn(p_196447_1_.getBlockState(p_196447_2_.relative(direction)))) {
+ if (this.canCatchFire(p_196447_1_, p_196447_2_.relative(direction), direction.getOpposite())) {
return true;
}
}
@@ -244,13 +242,14 @@
@@ -244,13 +_,14 @@
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.getFireSpreadSpeed(p_176538_1_, p_176538_2_.func_177972_a(direction), direction.func_176734_d()), i);
BlockState blockstate = p_176538_1_.getBlockState(p_176538_2_.relative(direction));
- i = Math.max(this.getFlameOdds(blockstate), i);
+ i = Math.max(blockstate.getFireSpreadSpeed(p_176538_1_, p_176538_2_.relative(direction), direction.getOpposite()), i);
}
return i;
@@ -109,18 +109,18 @@
}
+ @Deprecated //Forge: Use canCatchFire with more context
protected boolean func_196446_i(BlockState p_196446_1_) {
return this.func_220275_r(p_196446_1_) > 0;
protected boolean canBurn(BlockState p_196446_1_) {
return this.getFlameOdds(p_196446_1_) > 0;
}
@@ -269,10 +268,23 @@
}
private void func_180686_a(Block p_180686_1_, int p_180686_2_, int p_180686_3_) {
+ if (p_180686_1_ == Blocks.field_150350_a) throw new IllegalArgumentException("Tried to set air on fire... This is bad.");
this.field_149849_a.put(p_180686_1_, p_180686_2_);
this.field_149848_b.put(p_180686_1_, p_180686_3_);
@@ -269,8 +_,21 @@
}
private void setFlammable(Block p_180686_1_, int p_180686_2_, int p_180686_3_) {
+ if (p_180686_1_ == Blocks.AIR) throw new IllegalArgumentException("Tried to set air on fire... This is bad.");
this.flameOdds.put(p_180686_1_, p_180686_2_);
this.burnOdds.put(p_180686_1_, p_180686_3_);
+ }
+
+ /**
+ * Side sensitive version that calls the block function.
+ *
@@ -130,9 +130,7 @@
+ * @return True if the face can catch fire.
+ */
+ 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() {
FireBlock fireblock = (FireBlock)Blocks.field_150480_ab;
fireblock.func_180686_a(Blocks.field_196662_n, 5, 20);
+ return world.getBlockState(pos).isFlammable(world, pos, face);
}
public static void bootStrap() {
@@ -1,31 +1,31 @@
--- a/net/minecraft/block/FlowerPotBlock.java
+++ b/net/minecraft/block/FlowerPotBlock.java
@@ -24,12 +24,35 @@
protected static final VoxelShape field_196450_a = Block.func_208617_a(5.0D, 0.0D, 5.0D, 11.0D, 6.0D, 11.0D);
private final Block field_196452_c;
@@ -24,10 +_,33 @@
protected static final VoxelShape SHAPE = Block.box(5.0D, 0.0D, 5.0D, 11.0D, 6.0D, 11.0D);
private final Block content;
+ @Deprecated // Mods should use the constructor below
public FlowerPotBlock(Block p_i48395_1_, AbstractBlock.Properties p_i48395_2_) {
- super(p_i48395_2_);
- this.field_196452_c = p_i48395_1_;
- field_196451_b.put(p_i48395_1_, this);
+ this(Blocks.field_150457_bL == null ? null : () -> (FlowerPotBlock) Blocks.field_150457_bL.delegate.get(), () -> p_i48395_1_.delegate.get(), p_i48395_2_);
+ if (Blocks.field_150457_bL != null) {
+ ((FlowerPotBlock)Blocks.field_150457_bL).addPlant(p_i48395_1_.getRegistryName(), () -> this);
- this.content = p_i48395_1_;
- POTTED_BY_CONTENT.put(p_i48395_1_, this);
+ this(Blocks.FLOWER_POT == null ? null : () -> (FlowerPotBlock) Blocks.FLOWER_POT.delegate.get(), () -> p_i48395_1_.delegate.get(), p_i48395_2_);
+ if (Blocks.FLOWER_POT != null) {
+ ((FlowerPotBlock)Blocks.FLOWER_POT).addPlant(p_i48395_1_.getRegistryName(), () -> this);
+ }
}
+ }
+
+ /**
+ * For mod use, eliminates the need to extend this class, and prevents modded
+ * flower pots from altering vanilla behavior.
+ *
+ * @param emptyPot The empty pot for this pot, or null for self.
+ * @param p_i48395_1_ The flower block.
+ * @param block The flower block.
+ * @param properties
+ */
+ public FlowerPotBlock(@javax.annotation.Nullable java.util.function.Supplier<FlowerPotBlock> emptyPot, java.util.function.Supplier<? extends Block> p_i48395_1_, AbstractBlock.Properties properties) {
+ super(properties);
+ this.field_196452_c = null; // Unused, redirected by coremod
+ this.content = null; // Unused, redirected by coremod
+ this.flowerDelegate = p_i48395_1_;
+ if (emptyPot == null) {
+ this.fullPots = Maps.newHashMap();
@@ -34,38 +34,36 @@
+ this.fullPots = java.util.Collections.emptyMap();
+ this.emptyPot = emptyPot;
+ }
+ }
+
public VoxelShape func_220053_a(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) {
return field_196450_a;
}
@@ -41,7 +64,7 @@
public ActionResultType func_225533_a_(BlockState p_225533_1_, World p_225533_2_, BlockPos p_225533_3_, PlayerEntity p_225533_4_, Hand p_225533_5_, BlockRayTraceResult p_225533_6_) {
ItemStack itemstack = p_225533_4_.func_184586_b(p_225533_5_);
Item item = itemstack.func_77973_b();
- Block block = item instanceof BlockItem ? field_196451_b.getOrDefault(((BlockItem)item).func_179223_d(), Blocks.field_150350_a) : Blocks.field_150350_a;
+ Block block = item instanceof BlockItem ? getEmptyPot().fullPots.getOrDefault(((BlockItem)item).func_179223_d().getRegistryName(), Blocks.field_150350_a.delegate).get() : Blocks.field_150350_a;
boolean flag = block == Blocks.field_150350_a;
boolean flag1 = this.field_196452_c == Blocks.field_150350_a;
public VoxelShape getShape(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) {
@@ -41,7 +_,7 @@
public ActionResultType use(BlockState p_225533_1_, World p_225533_2_, BlockPos p_225533_3_, PlayerEntity p_225533_4_, Hand p_225533_5_, BlockRayTraceResult p_225533_6_) {
ItemStack itemstack = p_225533_4_.getItemInHand(p_225533_5_);
Item item = itemstack.getItem();
- Block block = item instanceof BlockItem ? POTTED_BY_CONTENT.getOrDefault(((BlockItem)item).getBlock(), Blocks.AIR) : Blocks.AIR;
+ Block block = item instanceof BlockItem ? getEmptyPot().fullPots.getOrDefault(((BlockItem)item).getBlock().getRegistryName(), Blocks.AIR.delegate).get() : Blocks.AIR;
boolean flag = block == Blocks.AIR;
boolean flag1 = this.content == Blocks.AIR;
if (flag != flag1) {
@@ -59,7 +82,7 @@
p_225533_4_.func_71019_a(itemstack1, false);
@@ -59,7 +_,7 @@
p_225533_4_.drop(itemstack1, false);
}
- p_225533_2_.func_180501_a(p_225533_3_, Blocks.field_150457_bL.func_176223_P(), 3);
+ p_225533_2_.func_180501_a(p_225533_3_, getEmptyPot().func_176223_P(), 3);
- p_225533_2_.setBlock(p_225533_3_, Blocks.FLOWER_POT.defaultBlockState(), 3);
+ p_225533_2_.setBlock(p_225533_3_, getEmptyPot().defaultBlockState(), 3);
}
return ActionResultType.func_233537_a_(p_225533_2_.field_72995_K);
@@ -77,10 +100,27 @@
return ActionResultType.sidedSuccess(p_225533_2_.isClientSide);
@@ -77,10 +_,31 @@
}
public Block func_220276_d() {
- return this.field_196452_c;
public Block getContent() {
- return this.content;
+ return flowerDelegate.get();
}
public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
public boolean isPathfindable(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
return false;
}
+
@@ -84,5 +82,9 @@
+ }
+ fullPots.put(flower, fullPot);
+ }
+
+ public Map<net.minecraft.util.ResourceLocation, java.util.function.Supplier<? extends Block>> getFullPotsView() {
+ return java.util.Collections.unmodifiableMap(fullPots);
+ }
+ //Forge End
}
@@ -1,68 +1,68 @@
--- a/net/minecraft/block/FlowingFluidBlock.java
+++ b/net/minecraft/block/FlowingFluidBlock.java
@@ -29,10 +29,11 @@
@@ -29,10 +_,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<FluidState> field_212565_c;
public static final VoxelShape field_235510_c_ = Block.func_208617_a(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL;
- protected final FlowingFluid fluid;
+ private final FlowingFluid fluid;
private final List<FluidState> stateCache;
public static final VoxelShape STABLE_SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
+ @Deprecated // Forge: Use the constructor that takes a supplier
public FlowingFluidBlock(FlowingFluid p_i49014_1_, AbstractBlock.Properties p_i49014_2_) {
super(p_i49014_2_);
this.field_204517_c = p_i49014_1_;
@@ -45,8 +46,21 @@
this.fluid = p_i49014_1_;
@@ -45,6 +_,19 @@
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)));
this.stateCache.add(p_i49014_1_.getFlowing(8, true));
this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, 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, AbstractBlock.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.fluid = null;
+ this.stateCache = Lists.newArrayList();
+ this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0)));
+ this.supplier = supplier;
+ }
+
public VoxelShape func_220071_b(BlockState p_220071_1_, IBlockReader p_220071_2_, BlockPos p_220071_3_, ISelectionContext p_220071_4_) {
return p_220071_4_.func_216378_a(field_235510_c_, p_220071_3_, true) && p_220071_1_.func_177229_b(field_176367_b) == 0 && p_220071_4_.func_230426_a_(p_220071_2_.func_204610_c(p_220071_3_.func_177984_a()), this.field_204517_c) ? field_235510_c_ : VoxelShapes.func_197880_a();
}
@@ -69,6 +83,7 @@
public FluidState func_204507_t(BlockState p_204507_1_) {
int i = p_204507_1_.func_177229_b(field_176367_b);
public VoxelShape getCollisionShape(BlockState p_220071_1_, IBlockReader p_220071_2_, BlockPos p_220071_3_, ISelectionContext p_220071_4_) {
@@ -69,6 +_,7 @@
public FluidState getFluidState(BlockState p_204507_1_) {
int i = p_204507_1_.getValue(LEVEL);
+ if (!fluidStateCacheInitialized) initFluidStateCache();
return this.field_212565_c.get(Math.min(i, 8));
return this.stateCache.get(Math.min(i, 8));
}
@@ -120,13 +135,13 @@
BlockPos blockpos = p_204515_2_.func_177972_a(direction);
if (p_204515_1_.func_204610_c(blockpos).func_206884_a(FluidTags.field_206959_a)) {
Block block = p_204515_1_.func_204610_c(p_204515_2_).func_206889_d() ? Blocks.field_150343_Z : Blocks.field_150347_e;
- p_204515_1_.func_175656_a(p_204515_2_, block.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_, block.func_176223_P()));
this.func_180688_d(p_204515_1_, p_204515_2_);
@@ -120,13 +_,13 @@
BlockPos blockpos = p_204515_2_.relative(direction);
if (p_204515_1_.getFluidState(blockpos).is(FluidTags.WATER)) {
Block block = p_204515_1_.getFluidState(p_204515_2_).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE;
- p_204515_1_.setBlockAndUpdate(p_204515_2_, block.defaultBlockState());
+ p_204515_1_.setBlockAndUpdate(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, block.defaultBlockState()));
this.fizz(p_204515_1_, p_204515_2_);
return false;
}
if (flag && p_204515_1_.func_180495_p(blockpos).func_203425_a(Blocks.field_205164_gk)) {
- p_204515_1_.func_175656_a(p_204515_2_, Blocks.field_235337_cO_.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_235337_cO_.func_176223_P()));
this.func_180688_d(p_204515_1_, p_204515_2_);
if (flag && p_204515_1_.getBlockState(blockpos).is(Blocks.BLUE_ICE)) {
- p_204515_1_.setBlockAndUpdate(p_204515_2_, Blocks.BASALT.defaultBlockState());
+ p_204515_1_.setBlockAndUpdate(p_204515_2_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_204515_1_, p_204515_2_, p_204515_2_, Blocks.BASALT.defaultBlockState()));
this.fizz(p_204515_1_, p_204515_2_);
return false;
}
@@ -153,4 +168,23 @@
return Fluids.field_204541_a;
}
}
@@ -151,6 +_,25 @@
return this.fluid;
} else {
return Fluids.EMPTY;
+ }
+ }
+
+ // Forge start
+ private final java.util.function.Supplier<? extends Fluid> supplier;
@@ -73,13 +73,13 @@
+ private boolean fluidStateCacheInitialized = false;
+ protected synchronized void initFluidStateCache() {
+ if (fluidStateCacheInitialized == false) {
+ this.field_212565_c.add(getFluid().func_207204_a(false));
+ this.stateCache.add(getFluid().getSource(false));
+
+ for (int i = 1; i < 8; ++i)
+ this.field_212565_c.add(getFluid().func_207207_a(8 - i, false));
+ this.stateCache.add(getFluid().getFlowing(8 - i, false));
+
+ this.field_212565_c.add(getFluid().func_207207_a(8, true));
+ this.stateCache.add(getFluid().getFlowing(8, true));
+ fluidStateCacheInitialized = true;
+ }
+ }
}
}
}
@@ -1,10 +1,10 @@
--- a/net/minecraft/block/ITileEntityProvider.java
+++ b/net/minecraft/block/ITileEntityProvider.java
@@ -4,6 +4,7 @@
@@ -4,6 +_,7 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
+@Deprecated //Forge: Do not use, use BlockState.hasTileEntity/Block.createTileEntity
public interface ITileEntityProvider {
@Nullable
TileEntity func_196283_a_(IBlockReader p_196283_1_);
TileEntity newBlockEntity(IBlockReader p_196283_1_);
@@ -1,14 +0,0 @@
--- a/net/minecraft/block/LadderBlock.java
+++ b/net/minecraft/block/LadderBlock.java
@@ -93,6 +93,11 @@
return null;
}
+ @Override
+ public boolean isLadder(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, net.minecraft.entity.LivingEntity entity) {
+ return true;
+ }
+
public BlockState func_185499_a(BlockState p_185499_1_, Rotation p_185499_2_) {
return p_185499_1_.func_206870_a(field_176382_a, p_185499_2_.func_185831_a(p_185499_1_.func_177229_b(field_176382_a)));
}
@@ -1,11 +1,11 @@
--- a/net/minecraft/block/LeavesBlock.java
+++ b/net/minecraft/block/LeavesBlock.java
@@ -19,7 +19,7 @@
@@ -19,7 +_,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.IForgeShearable {
public static final IntegerProperty field_208494_a = BlockStateProperties.field_208514_aa;
public static final BooleanProperty field_208495_b = BlockStateProperties.field_208515_s;
public static final IntegerProperty DISTANCE = BlockStateProperties.DISTANCE;
public static final BooleanProperty PERSISTENT = BlockStateProperties.PERSISTENT;
@@ -1,11 +1,11 @@
--- a/net/minecraft/block/MushroomBlock.java
+++ b/net/minecraft/block/MushroomBlock.java
@@ -64,7 +64,7 @@
if (blockstate.func_235714_a_(BlockTags.field_242171_aD)) {
@@ -64,7 +_,7 @@
if (blockstate.is(BlockTags.MUSHROOM_GROW_BLOCK)) {
return true;
} else {
- return p_196260_2_.func_226659_b_(p_196260_3_, 0) < 13 && this.func_200014_a_(blockstate, p_196260_2_, blockpos);
+ return p_196260_2_.func_226659_b_(p_196260_3_, 0) < 13 && blockstate.canSustainPlant(p_196260_2_, blockpos, net.minecraft.util.Direction.UP, this);
- return p_196260_2_.getRawBrightness(p_196260_3_, 0) < 13 && this.mayPlaceOn(blockstate, p_196260_2_, blockpos);
+ return p_196260_2_.getRawBrightness(p_196260_3_, 0) < 13 && blockstate.canSustainPlant(p_196260_2_, blockpos, net.minecraft.util.Direction.UP, this);
}
}
@@ -1,13 +1,13 @@
--- a/net/minecraft/block/NetherWartBlock.java
+++ b/net/minecraft/block/NetherWartBlock.java
@@ -35,9 +35,10 @@
@@ -35,9 +_,10 @@
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
int i = p_225542_1_.func_177229_b(field_176486_a);
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
int i = p_225542_1_.getValue(AGE);
- if (i < 3 && p_225542_4_.nextInt(10) == 0) {
+ if (i < 3 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt(10) == 0)) {
p_225542_1_ = p_225542_1_.func_206870_a(field_176486_a, Integer.valueOf(i + 1));
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_, 2);
p_225542_1_ = p_225542_1_.setValue(AGE, Integer.valueOf(i + 1));
p_225542_2_.setBlock(p_225542_3_, p_225542_1_, 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
}
@@ -1,32 +1,32 @@
--- a/net/minecraft/block/NoteBlock.java
+++ b/net/minecraft/block/NoteBlock.java
@@ -50,7 +50,7 @@
@@ -50,7 +_,7 @@
}
private void func_196482_a(World p_196482_1_, BlockPos p_196482_2_) {
- if (p_196482_1_.func_180495_p(p_196482_2_.func_177984_a()).func_196958_f()) {
+ if (p_196482_1_.func_175623_d(p_196482_2_.func_177984_a())) {
p_196482_1_.func_175641_c(p_196482_2_, this, 0, 0);
private void playNote(World p_196482_1_, BlockPos p_196482_2_) {
- if (p_196482_1_.getBlockState(p_196482_2_.above()).isAir()) {
+ if (p_196482_1_.isEmptyBlock(p_196482_2_.above())) {
p_196482_1_.blockEvent(p_196482_2_, this, 0, 0);
}
@@ -60,7 +60,9 @@
if (p_225533_2_.field_72995_K) {
@@ -60,7 +_,9 @@
if (p_225533_2_.isClientSide) {
return ActionResultType.SUCCESS;
} else {
- p_225533_1_ = p_225533_1_.func_235896_a_(field_196485_c);
+ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(p_225533_2_, p_225533_3_, p_225533_1_, p_225533_1_.func_177229_b(field_196485_c), p_225533_1_.func_235896_a_(field_196485_c).func_177229_b(field_196485_c));
- p_225533_1_ = p_225533_1_.cycle(NOTE);
+ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(p_225533_2_, p_225533_3_, p_225533_1_, p_225533_1_.getValue(NOTE), p_225533_1_.cycle(NOTE).getValue(NOTE));
+ if (_new == -1) return ActionResultType.FAIL;
+ p_225533_1_ = p_225533_1_.func_206870_a(field_196485_c, _new);
p_225533_2_.func_180501_a(p_225533_3_, p_225533_1_, 3);
this.func_196482_a(p_225533_2_, p_225533_3_);
p_225533_4_.func_195066_a(Stats.field_188087_U);
@@ -76,6 +78,9 @@
+ p_225533_1_ = p_225533_1_.setValue(NOTE, _new);
p_225533_2_.setBlock(p_225533_3_, p_225533_1_, 3);
this.playNote(p_225533_2_, p_225533_3_);
p_225533_4_.awardStat(Stats.TUNE_NOTEBLOCK);
@@ -76,6 +_,9 @@
}
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));
public boolean triggerEvent(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_.getValue(NOTE), p_189539_1_.getValue(INSTRUMENT));
+ 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);
+ p_189539_1_ = p_189539_1_.setValue(NOTE, e.getVanillaNoteId()).setValue(INSTRUMENT, e.getInstrument());
int i = p_189539_1_.getValue(NOTE);
float f = (float)Math.pow(2.0D, (double)(i - 12) / 12.0D);
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);
p_189539_2_.playSound((PlayerEntity)null, p_189539_3_, p_189539_1_.getValue(INSTRUMENT).getSoundEvent(), SoundCategory.RECORDS, 3.0F, f);
@@ -1,19 +1,19 @@
--- a/net/minecraft/block/OreBlock.java
+++ b/net/minecraft/block/OreBlock.java
@@ -31,12 +31,10 @@
@@ -31,12 +_,10 @@
public void func_220062_a(BlockState p_220062_1_, ServerWorld 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);
public void spawnAfterBreak(BlockState p_220062_1_, ServerWorld p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) {
super.spawnAfterBreak(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_);
- if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, p_220062_4_) == 0) {
- int i = this.xpOnDrop(p_220062_2_.random);
- if (i > 0) {
- this.func_180637_b(p_220062_2_, p_220062_3_, i);
- this.popExperience(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;
+ return silktouch == 0 ? this.xpOnDrop(RANDOM) : 0;
}
}
@@ -1,55 +1,55 @@
--- a/net/minecraft/block/PistonBlock.java
+++ b/net/minecraft/block/PistonBlock.java
@@ -158,6 +158,7 @@
@@ -158,6 +_,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)) {
if (!this.moveBlocks(p_189539_2_, p_189539_3_, direction, true)) {
return false;
}
@@ -165,6 +166,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);
@@ -165,6 +_,7 @@
p_189539_2_.setBlock(p_189539_3_, p_189539_1_.setValue(EXTENDED, Boolean.valueOf(true)), 67);
p_189539_2_.playSound((PlayerEntity)null, p_189539_3_, SoundEvents.PISTON_EXTEND, SoundCategory.BLOCKS, 0.5F, p_189539_2_.random.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));
TileEntity tileentity1 = p_189539_2_.getBlockEntity(p_189539_3_.relative(direction));
if (tileentity1 instanceof PistonTileEntity) {
((PistonTileEntity)tileentity1).func_145866_f();
@@ -204,6 +206,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);
((PistonTileEntity)tileentity1).finalTick();
@@ -204,6 +_,7 @@
p_189539_2_.playSound((PlayerEntity)null, p_189539_3_, SoundEvents.PISTON_CONTRACT, SoundCategory.BLOCKS, 0.5F, p_189539_2_.random.nextFloat() * 0.15F + 0.6F);
}
+ net.minecraftforge.event.ForgeEventFactory.onPistonMovePost(p_189539_2_, p_189539_3_, direction, (p_189539_4_ == 0));
return true;
}
@@ -234,7 +237,7 @@
@@ -234,7 +_,7 @@
return false;
}
- return !p_185646_0_.func_177230_c().func_235695_q_();
- return !p_185646_0_.getBlock().isEntityBlock();
+ return !p_185646_0_.hasTileEntity();
}
} else {
return false;
@@ -273,7 +276,7 @@
@@ -273,7 +_,7 @@
for(int k = list2.size() - 1; k >= 0; --k) {
BlockPos blockpos2 = list2.get(k);
BlockState blockstate1 = p_176319_1_.func_180495_p(blockpos2);
- TileEntity tileentity = blockstate1.func_177230_c().func_235695_q_() ? p_176319_1_.func_175625_s(blockpos2) : null;
+ TileEntity tileentity = blockstate1.hasTileEntity() ? p_176319_1_.func_175625_s(blockpos2) : null;
func_220059_a(blockstate1, p_176319_1_, blockpos2, tileentity);
p_176319_1_.func_180501_a(blockpos2, Blocks.field_150350_a.func_176223_P(), 18);
BlockState blockstate1 = p_176319_1_.getBlockState(blockpos2);
- TileEntity tileentity = blockstate1.getBlock().isEntityBlock() ? p_176319_1_.getBlockEntity(blockpos2) : null;
+ TileEntity tileentity = blockstate1.hasTileEntity() ? p_176319_1_.getBlockEntity(blockpos2) : null;
dropResources(blockstate1, p_176319_1_, blockpos2, tileentity);
p_176319_1_.setBlock(blockpos2, Blocks.AIR.defaultBlockState(), 18);
ablockstate[j++] = blockstate1;
@@ -337,6 +340,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)));
}
@@ -335,6 +_,10 @@
+ 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 rotate(BlockState p_185499_1_, Rotation p_185499_2_) {
return p_185499_1_.setValue(FACING, p_185499_2_.rotate(p_185499_1_.getValue(FACING)));
+ }
+
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)));
+ public BlockState rotate(BlockState state, net.minecraft.world.IWorld world, BlockPos pos, Rotation direction) {
+ return state.getValue(EXTENDED) ? state : super.rotate(state, world, pos, direction);
}
public BlockState mirror(BlockState p_185471_1_, Mirror p_185471_2_) {
@@ -1,81 +1,81 @@
--- a/net/minecraft/block/PistonBlockStructureHelper.java
+++ b/net/minecraft/block/PistonBlockStructureHelper.java
@@ -48,7 +48,7 @@
@@ -48,7 +_,7 @@
} else {
for(int i = 0; i < this.field_177258_e.size(); ++i) {
BlockPos blockpos = this.field_177258_e.get(i);
- if (func_227029_a_(this.field_177261_a.func_180495_p(blockpos).func_177230_c()) && !this.func_177250_b(blockpos)) {
+ if (this.field_177261_a.func_180495_p(blockpos).isStickyBlock() && !this.func_177250_b(blockpos)) {
for(int i = 0; i < this.toPush.size(); ++i) {
BlockPos blockpos = this.toPush.get(i);
- if (isSticky(this.level.getBlockState(blockpos).getBlock()) && !this.addBranchingBlocks(blockpos)) {
+ if (this.level.getBlockState(blockpos).isStickyBlock() && !this.addBranchingBlocks(blockpos)) {
return false;
}
}
@@ -57,24 +57,9 @@
@@ -57,24 +_,9 @@
}
}
- private static boolean func_227029_a_(Block p_227029_0_) {
- return p_227029_0_ == Blocks.field_180399_cE || p_227029_0_ == Blocks.field_226907_mc_;
- private static boolean isSticky(Block p_227029_0_) {
- return p_227029_0_ == Blocks.SLIME_BLOCK || p_227029_0_ == Blocks.HONEY_BLOCK;
- }
-
- private static boolean func_227030_a_(Block p_227030_0_, Block p_227030_1_) {
- if (p_227030_0_ == Blocks.field_226907_mc_ && p_227030_1_ == Blocks.field_180399_cE) {
- private static boolean canStickToEachOther(Block p_227030_0_, Block p_227030_1_) {
- if (p_227030_0_ == Blocks.HONEY_BLOCK && p_227030_1_ == Blocks.SLIME_BLOCK) {
- return false;
- } else if (p_227030_0_ == Blocks.field_180399_cE && p_227030_1_ == Blocks.field_226907_mc_) {
- } else if (p_227030_0_ == Blocks.SLIME_BLOCK && p_227030_1_ == Blocks.HONEY_BLOCK) {
- return false;
- } else {
- return func_227029_a_(p_227030_0_) || func_227029_a_(p_227030_1_);
- return isSticky(p_227030_0_) || isSticky(p_227030_1_);
- }
- }
-
private boolean func_177251_a(BlockPos p_177251_1_, Direction p_177251_2_) {
BlockState blockstate = this.field_177261_a.func_180495_p(p_177251_1_);
- Block block = blockstate.func_177230_c();
- if (blockstate.func_196958_f()) {
+ if (field_177261_a.func_175623_d(p_177251_1_)) {
private boolean addBlockLine(BlockPos p_177251_1_, Direction p_177251_2_) {
BlockState blockstate = this.level.getBlockState(p_177251_1_);
- Block block = blockstate.getBlock();
- if (blockstate.isAir()) {
+ if (level.isEmptyBlock(p_177251_1_)) {
return true;
} else if (!PistonBlock.func_185646_a(blockstate, this.field_177261_a, p_177251_1_, this.field_177257_d, false, p_177251_2_)) {
} else if (!PistonBlock.isPushable(blockstate, this.level, p_177251_1_, this.pushDirection, false, p_177251_2_)) {
return true;
@@ -87,12 +72,12 @@
if (i + this.field_177258_e.size() > 12) {
@@ -87,12 +_,12 @@
if (i + this.toPush.size() > 12) {
return false;
} else {
- while(func_227029_a_(block)) {
- while(isSticky(block)) {
+ BlockState oldState;
+ while(blockstate.isStickyBlock()) {
BlockPos blockpos = p_177251_1_.func_177967_a(this.field_177257_d.func_176734_d(), i);
BlockPos blockpos = p_177251_1_.relative(this.pushDirection.getOpposite(), i);
- Block block1 = block;
+ oldState = blockstate;
blockstate = this.field_177261_a.func_180495_p(blockpos);
- block = blockstate.func_177230_c();
- if (blockstate.func_196958_f() || !func_227030_a_(block1, block) || !PistonBlock.func_185646_a(blockstate, this.field_177261_a, blockpos, this.field_177257_d, false, this.field_177257_d.func_176734_d()) || blockpos.equals(this.field_177259_b)) {
+ if (blockstate.isAir(this.field_177261_a, blockpos) || !oldState.canStickTo(blockstate) || !PistonBlock.func_185646_a(blockstate, this.field_177261_a, blockpos, this.field_177257_d, false, this.field_177257_d.func_176734_d()) || blockpos.equals(this.field_177259_b)) {
blockstate = this.level.getBlockState(blockpos);
- block = blockstate.getBlock();
- if (blockstate.isAir() || !canStickToEachOther(block1, block) || !PistonBlock.isPushable(blockstate, this.level, blockpos, this.pushDirection, false, this.pushDirection.getOpposite()) || blockpos.equals(this.pistonPos)) {
+ if (blockstate.isAir(this.level, blockpos) || !oldState.canStickTo(blockstate) || !PistonBlock.isPushable(blockstate, this.level, blockpos, this.pushDirection, false, this.pushDirection.getOpposite()) || blockpos.equals(this.pistonPos)) {
break;
}
@@ -119,7 +104,7 @@
@@ -119,7 +_,7 @@
for(int k = 0; k <= j + l; ++k) {
BlockPos blockpos2 = this.field_177258_e.get(k);
- if (func_227029_a_(this.field_177261_a.func_180495_p(blockpos2).func_177230_c()) && !this.func_177250_b(blockpos2)) {
+ if (this.field_177261_a.func_180495_p(blockpos2).isStickyBlock() && !this.func_177250_b(blockpos2)) {
BlockPos blockpos2 = this.toPush.get(k);
- if (isSticky(this.level.getBlockState(blockpos2).getBlock()) && !this.addBranchingBlocks(blockpos2)) {
+ if (this.level.getBlockState(blockpos2).isStickyBlock() && !this.addBranchingBlocks(blockpos2)) {
return false;
}
}
@@ -128,7 +113,7 @@
@@ -128,7 +_,7 @@
}
blockstate = this.field_177261_a.func_180495_p(blockpos1);
- if (blockstate.func_196958_f()) {
+ if (blockstate.isAir(field_177261_a, blockpos1)) {
blockstate = this.level.getBlockState(blockpos1);
- if (blockstate.isAir()) {
+ if (blockstate.isAir(level, blockpos1)) {
return true;
}
@@ -173,7 +158,7 @@
if (direction.func_176740_k() != this.field_177257_d.func_176740_k()) {
BlockPos blockpos = p_177250_1_.func_177972_a(direction);
BlockState blockstate1 = this.field_177261_a.func_180495_p(blockpos);
- if (func_227030_a_(blockstate1.func_177230_c(), blockstate.func_177230_c()) && !this.func_177251_a(blockpos, direction)) {
+ if (blockstate1.canStickTo(blockstate) && !this.func_177251_a(blockpos, direction)) {
@@ -173,7 +_,7 @@
if (direction.getAxis() != this.pushDirection.getAxis()) {
BlockPos blockpos = p_177250_1_.relative(direction);
BlockState blockstate1 = this.level.getBlockState(blockpos);
- if (canStickToEachOther(blockstate1.getBlock(), blockstate.getBlock()) && !this.addBlockLine(blockpos, direction)) {
+ if (blockstate1.canStickTo(blockstate) && !this.addBlockLine(blockpos, direction)) {
return false;
}
}
@@ -1,11 +1,11 @@
--- a/net/minecraft/block/PortalSize.java
+++ b/net/minecraft/block/PortalSize.java
@@ -16,7 +16,7 @@
@@ -16,7 +_,7 @@
public class PortalSize {
private static final AbstractBlock.IPositionPredicate field_242962_a = (p_242966_0_, p_242966_1_, p_242966_2_) -> {
- return p_242966_0_.func_203425_a(Blocks.field_150343_Z);
private static final AbstractBlock.IPositionPredicate FRAME = (p_242966_0_, p_242966_1_, p_242966_2_) -> {
- return p_242966_0_.is(Blocks.OBSIDIAN);
+ return p_242966_0_.isPortalFrame(p_242966_1_, p_242966_2_);
};
private final IWorld field_150867_a;
private final Direction.Axis field_150865_b;
private final IWorld level;
private final Direction.Axis axis;
@@ -1,9 +1,9 @@
--- a/net/minecraft/block/PoweredRailBlock.java
+++ b/net/minecraft/block/PoweredRailBlock.java
@@ -14,10 +14,16 @@
@@ -14,10 +_,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;
public static final EnumProperty<RailShape> SHAPE = BlockStateProperties.RAIL_SHAPE_STRAIGHT;
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
+ private final boolean isActivator; // TRUE for an Activator Rail, FALSE for Powered Rail
public PoweredRailBlock(AbstractBlock.Properties p_i48349_1_) {
@@ -13,44 +13,45 @@
+
+ protected PoweredRailBlock(AbstractBlock.Properties builder, boolean isPoweredRail) {
+ 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.registerDefaultState(this.stateDefinition.any().setValue(SHAPE, RailShape.NORTH_SOUTH).setValue(POWERED, Boolean.valueOf(false)));
+ this.isActivator = !isPoweredRail;
}
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 findPoweredRailSignal(World p_176566_1_, BlockPos p_176566_2_, BlockState p_176566_3_, boolean p_176566_4_, int p_176566_5_) {
@@ -99,13 +_,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_203425_a(this)) {
+ if (!(blockstate.func_177230_c() instanceof PoweredRailBlock)) {
protected boolean isSameRailWithPower(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_.getBlockState(p_208071_2_);
- if (!blockstate.is(this)) {
+ if (!(blockstate.getBlock() instanceof PoweredRailBlock)) {
return false;
} else {
- RailShape railshape = blockstate.func_177229_b(field_176568_b);
- RailShape railshape = blockstate.getValue(SHAPE);
+ 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);
- if (blockstate.getValue(POWERED)) {
+ if (isActivator == (((PoweredRailBlock) blockstate.getBlock()).isActivator)) {
return p_208071_1_.hasNeighborSignal(p_208071_2_) ? true : this.findPoweredRailSignal(p_208071_1_, p_208071_2_, blockstate, p_208071_3_, p_208071_4_ + 1);
} else {
return false;
@@ -156,6 +162,9 @@
return p_185499_1_.func_206870_a(field_176568_b, RailShape.SOUTH_EAST);
@@ -156,6 +_,9 @@
return p_185499_1_.setValue(SHAPE, RailShape.SOUTH_EAST);
case NORTH_EAST:
return p_185499_1_.func_206870_a(field_176568_b, RailShape.SOUTH_WEST);
return p_185499_1_.setValue(SHAPE, RailShape.SOUTH_WEST);
+ case NORTH_SOUTH: //Forge fix: MC-196102
+ case EAST_WEST:
+ return p_185499_1_;
}
case COUNTERCLOCKWISE_90:
switch((RailShape)p_185499_1_.func_177229_b(field_176568_b)) {
@@ -255,4 +264,8 @@
protected void func_206840_a(StateContainer.Builder<Block, BlockState> p_206840_1_) {
p_206840_1_.func_206894_a(field_176568_b, field_176569_M);
}
switch((RailShape)p_185499_1_.getValue(SHAPE)) {
@@ -254,5 +_,9 @@
protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> p_206840_1_) {
p_206840_1_.add(SHAPE, POWERED);
+ }
+
+ public boolean isActivatorRail() {
+ return isActivator;
+ }
}
}
@@ -1,12 +1,12 @@
--- a/net/minecraft/block/RailBlock.java
+++ b/net/minecraft/block/RailBlock.java
@@ -49,6 +49,9 @@
return p_185499_1_.func_206870_a(field_176565_b, RailShape.SOUTH_EAST);
@@ -49,6 +_,9 @@
return p_185499_1_.setValue(SHAPE, RailShape.SOUTH_EAST);
case NORTH_EAST:
return p_185499_1_.func_206870_a(field_176565_b, RailShape.SOUTH_WEST);
return p_185499_1_.setValue(SHAPE, RailShape.SOUTH_WEST);
+ case NORTH_SOUTH: //Forge fix: MC-196102
+ case EAST_WEST:
+ return p_185499_1_;
}
case COUNTERCLOCKWISE_90:
switch((RailShape)p_185499_1_.func_177229_b(field_176565_b)) {
switch((RailShape)p_185499_1_.getValue(SHAPE)) {
@@ -1,57 +1,57 @@
--- 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();
@@ -15,14 +_,16 @@
private BlockState state;
private final boolean isStraight;
private final List<BlockPos> connections = Lists.newArrayList();
+ private final boolean canMakeSlopes;
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 = (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);
+ this.field_208513_e = !this.field_196922_c.isFlexibleRail(field_196923_d, p_i47755_1_, p_i47755_2_);
+ this.canMakeSlopes = this.field_196922_c.canMakeSlopes(field_196923_d, p_i47755_1_, p_i47755_2_);
this.func_208509_a(railshape);
this.level = p_i47755_1_;
this.pos = p_i47755_2_;
this.state = p_i47755_3_;
this.block = (AbstractRailBlock)p_i47755_3_.getBlock();
- RailShape railshape = p_i47755_3_.getValue(this.block.getShapeProperty());
- this.isStraight = this.block.isStraight();
+ RailShape railshape = this.block.getRailDirection(state, p_i47755_1_, p_i47755_2_, null);
+ this.isStraight = !this.block.isFlexibleRail(state, p_i47755_1_, p_i47755_2_);
+ this.canMakeSlopes = this.block.canMakeSlopes(state, p_i47755_1_, p_i47755_2_);
this.updateConnections(railshape);
}
@@ -178,7 +180,7 @@
@@ -178,7 +_,7 @@
}
}
- if (railshape == RailShape.NORTH_SOUTH) {
+ if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) {
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) {
if (AbstractRailBlock.isRail(this.level, blockpos.above())) {
railshape = RailShape.ASCENDING_NORTH;
}
@@ -188,7 +190,7 @@
@@ -188,7 +_,7 @@
}
}
- if (railshape == RailShape.EAST_WEST) {
+ if (railshape == RailShape.EAST_WEST && canMakeSlopes) {
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) {
if (AbstractRailBlock.isRail(this.level, blockpos3.above())) {
railshape = RailShape.ASCENDING_EAST;
}
@@ -304,7 +306,7 @@
@@ -304,7 +_,7 @@
}
}
- if (railshape == RailShape.NORTH_SOUTH) {
+ if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) {
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) {
if (AbstractRailBlock.isRail(this.level, blockpos.above())) {
railshape = RailShape.ASCENDING_NORTH;
}
@@ -314,7 +316,7 @@
@@ -314,7 +_,7 @@
}
}
- if (railshape == RailShape.EAST_WEST) {
+ if (railshape == RailShape.EAST_WEST && canMakeSlopes) {
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) {
if (AbstractRailBlock.isRail(this.level, blockpos3.above())) {
railshape = RailShape.ASCENDING_EAST;
}
@@ -1,20 +1,20 @@
--- 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_);
@@ -65,7 +_,7 @@
if (p_220069_1_.canSurvive(p_220069_2_, p_220069_3_)) {
this.checkTickOnNeighbor(p_220069_2_, p_220069_3_, p_220069_1_);
} else {
- TileEntity tileentity = this.func_235695_q_() ? 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);
- TileEntity tileentity = this.isEntityBlock() ? p_220069_2_.getBlockEntity(p_220069_3_) : null;
+ TileEntity tileentity = p_220069_1_.hasTileEntity() ? p_220069_2_.getBlockEntity(p_220069_3_) : null;
dropResources(p_220069_1_, p_220069_2_, p_220069_3_, tileentity);
p_220069_2_.removeBlock(p_220069_3_, false);
@@ -163,6 +163,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())
@@ -163,6 +_,8 @@
protected void updateNeighborsInFront(World p_176400_1_, BlockPos p_176400_2_, BlockState p_176400_3_) {
Direction direction = p_176400_3_.getValue(FACING);
BlockPos blockpos = p_176400_2_.relative(direction.getOpposite());
+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(p_176400_1_, p_176400_2_, p_176400_1_.getBlockState(p_176400_2_), java.util.EnumSet.of(direction.getOpposite()), false).isCanceled())
+ return;
p_176400_1_.func_190524_a(blockpos, this, p_176400_2_);
p_176400_1_.func_175695_a(blockpos, this, direction);
p_176400_1_.neighborChanged(blockpos, this, p_176400_2_);
p_176400_1_.updateNeighborsAtExceptFromFacing(blockpos, this, direction);
}
@@ -1,12 +1,12 @@
--- a/net/minecraft/block/RedstoneOreBlock.java
+++ b/net/minecraft/block/RedstoneOreBlock.java
@@ -71,11 +71,11 @@
@@ -71,11 +_,11 @@
public void func_220062_a(BlockState p_220062_1_, ServerWorld 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 = 1 + p_220062_2_.field_73012_v.nextInt(5);
- this.func_180637_b(p_220062_2_, p_220062_3_, i);
public void spawnAfterBreak(BlockState p_220062_1_, ServerWorld p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) {
super.spawnAfterBreak(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_);
- if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, p_220062_4_) == 0) {
- int i = 1 + p_220062_2_.random.nextInt(5);
- this.popExperience(p_220062_2_, p_220062_3_, i);
- }
+ }
@@ -1,41 +1,41 @@
--- a/net/minecraft/block/RedstoneWireBlock.java
+++ b/net/minecraft/block/RedstoneWireBlock.java
@@ -184,7 +184,7 @@
BlockState blockstate = p_235545_1_.func_180495_p(blockpos);
@@ -184,7 +_,7 @@
BlockState blockstate = p_235545_1_.getBlockState(blockpos);
if (p_235545_4_) {
boolean flag = this.func_235552_b_(p_235545_1_, blockpos, blockstate);
- if (flag && func_176346_d(p_235545_1_.func_180495_p(blockpos.func_177984_a()))) {
+ if (flag && canConnectTo(p_235545_1_.func_180495_p(blockpos.func_177984_a()), p_235545_1_, blockpos.func_177984_a(), null) ) {
if (blockstate.func_224755_d(p_235545_1_, blockpos, p_235545_3_.func_176734_d())) {
boolean flag = this.canSurviveOn(p_235545_1_, blockpos, blockstate);
- if (flag && shouldConnectTo(p_235545_1_.getBlockState(blockpos.above()))) {
+ if (flag && canConnectTo(p_235545_1_.getBlockState(blockpos.above()), p_235545_1_, blockpos.above(), null) ) {
if (blockstate.isFaceSturdy(p_235545_1_, blockpos, p_235545_3_.getOpposite())) {
return RedstoneSide.UP;
}
@@ -193,7 +193,7 @@
@@ -193,7 +_,7 @@
}
}
- return !func_176343_a(blockstate, p_235545_3_) && (blockstate.func_215686_e(p_235545_1_, blockpos) || !func_176346_d(p_235545_1_.func_180495_p(blockpos.func_177977_b()))) ? RedstoneSide.NONE : RedstoneSide.SIDE;
+ return !canConnectTo(blockstate, p_235545_1_, blockpos, p_235545_3_) && (blockstate.func_215686_e(p_235545_1_, blockpos) || !canConnectTo(p_235545_1_.func_180495_p(blockpos.func_177977_b()), p_235545_1_, blockpos.func_177977_b(), null)) ? RedstoneSide.NONE : RedstoneSide.SIDE;
- return !shouldConnectTo(blockstate, p_235545_3_) && (blockstate.isRedstoneConductor(p_235545_1_, blockpos) || !shouldConnectTo(p_235545_1_.getBlockState(blockpos.below()))) ? RedstoneSide.NONE : RedstoneSide.SIDE;
+ return !canConnectTo(blockstate, p_235545_1_, blockpos, p_235545_3_) && (blockstate.isRedstoneConductor(p_235545_1_, blockpos) || !canConnectTo(p_235545_1_.getBlockState(blockpos.below()), p_235545_1_, blockpos.below(), null)) ? RedstoneSide.NONE : RedstoneSide.SIDE;
}
public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
@@ -335,11 +335,7 @@
public boolean canSurvive(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
@@ -335,11 +_,7 @@
}
}
- protected static boolean func_176346_d(BlockState p_176346_0_) {
- return func_176343_a(p_176346_0_, (Direction)null);
- protected static boolean shouldConnectTo(BlockState p_176346_0_) {
- return shouldConnectTo(p_176346_0_, (Direction)null);
- }
-
- protected static boolean func_176343_a(BlockState p_176343_0_, @Nullable Direction p_176343_1_) {
- protected static boolean shouldConnectTo(BlockState p_176343_0_, @Nullable Direction p_176343_1_) {
+ protected static boolean canConnectTo(BlockState p_176343_0_, IBlockReader world, BlockPos pos, @Nullable Direction p_176343_1_) {
if (p_176343_0_.func_203425_a(Blocks.field_150488_af)) {
if (p_176343_0_.is(Blocks.REDSTONE_WIRE)) {
return true;
} else if (p_176343_0_.func_203425_a(Blocks.field_196633_cV)) {
@@ -348,7 +344,7 @@
} else if (p_176343_0_.func_203425_a(Blocks.field_190976_dk)) {
return p_176343_1_ == p_176343_0_.func_177229_b(ObserverBlock.field_176387_N);
} else if (p_176343_0_.is(Blocks.REPEATER)) {
@@ -348,7 +_,7 @@
} else if (p_176343_0_.is(Blocks.OBSERVER)) {
return p_176343_1_ == p_176343_0_.getValue(ObserverBlock.FACING);
} else {
- return p_176343_0_.func_185897_m() && p_176343_1_ != null;
- return p_176343_0_.isSignalSource() && p_176343_1_ != null;
+ return p_176343_0_.canConnectRedstone(world, pos, p_176343_1_) && p_176343_1_ != null;
}
}
@@ -1,18 +1,18 @@
--- a/net/minecraft/block/SaplingBlock.java
+++ b/net/minecraft/block/SaplingBlock.java
@@ -29,6 +29,7 @@
@@ -29,6 +_,7 @@
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
if (p_225542_2_.func_201696_r(p_225542_3_.func_177984_a()) >= 9 && p_225542_4_.nextInt(7) == 0) {
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
if (p_225542_2_.getMaxLocalRawBrightness(p_225542_3_.above()) >= 9 && p_225542_4_.nextInt(7) == 0) {
+ if (!p_225542_2_.isAreaLoaded(p_225542_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
this.func_226942_a_(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_);
this.advanceTree(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_);
}
@@ -38,6 +39,7 @@
if (p_226942_3_.func_177229_b(field_176479_b) == 0) {
p_226942_1_.func_180501_a(p_226942_2_, p_226942_3_.func_235896_a_(field_176479_b), 4);
@@ -38,6 +_,7 @@
if (p_226942_3_.getValue(STAGE) == 0) {
p_226942_1_.setBlock(p_226942_2_, p_226942_3_.cycle(STAGE), 4);
} else {
+ if (!net.minecraftforge.event.ForgeEventFactory.saplingGrowTree(p_226942_1_, p_226942_4_, p_226942_2_)) return;
this.field_196387_c.func_230339_a_(p_226942_1_, p_226942_1_.func_72863_F().func_201711_g(), p_226942_2_, p_226942_3_, p_226942_4_);
this.treeGrower.growTree(p_226942_1_, p_226942_1_.getChunkSource().getGenerator(), p_226942_2_, p_226942_3_, p_226942_4_);
}
@@ -1,11 +0,0 @@
--- a/net/minecraft/block/ScaffoldingBlock.java
+++ b/net/minecraft/block/ScaffoldingBlock.java
@@ -138,6 +138,8 @@
return i;
}
+ @Override public boolean isLadder(BlockState state, IWorldReader world, BlockPos pos, net.minecraft.entity.LivingEntity entity) { return true; }
+
static {
VoxelShape voxelshape = Block.func_208617_a(0.0D, 14.0D, 0.0D, 16.0D, 16.0D, 16.0D);
VoxelShape voxelshape1 = Block.func_208617_a(0.0D, 0.0D, 0.0D, 2.0D, 16.0D, 2.0D);
@@ -1,11 +1,11 @@
--- a/net/minecraft/block/SeaGrassBlock.java
+++ b/net/minecraft/block/SeaGrassBlock.java
@@ -17,7 +17,7 @@
@@ -17,7 +_,7 @@
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
-public class SeaGrassBlock extends BushBlock implements IGrowable, ILiquidContainer {
+public class SeaGrassBlock extends BushBlock implements IGrowable, ILiquidContainer, net.minecraftforge.common.IForgeShearable {
protected static final VoxelShape field_207798_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D);
protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D);
public SeaGrassBlock(AbstractBlock.Properties p_i48780_1_) {
@@ -0,0 +1,10 @@
--- a/net/minecraft/block/SoundType.java
+++ b/net/minecraft/block/SoundType.java
@@ -59,6 +_,7 @@
private final SoundEvent hitSound;
private final SoundEvent fallSound;
+ @Deprecated // Forge: Use {@link net.minecraftforge.common.util.ForgeSoundType} instead for suppliers
public SoundType(float p_i46679_1_, float p_i46679_2_, SoundEvent p_i46679_3_, SoundEvent p_i46679_4_, SoundEvent p_i46679_5_, SoundEvent p_i46679_6_, SoundEvent p_i46679_7_) {
this.volume = p_i46679_1_;
this.pitch = p_i46679_2_;
@@ -1,18 +1,16 @@
--- a/net/minecraft/block/SpawnerBlock.java
+++ b/net/minecraft/block/SpawnerBlock.java
@@ -18,10 +18,13 @@
public void func_220062_a(BlockState p_220062_1_, ServerWorld 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_);
- int i = 15 + p_220062_2_.field_73012_v.nextInt(15) + p_220062_2_.field_73012_v.nextInt(15);
- this.func_180637_b(p_220062_2_, p_220062_3_, i);
}
@@ -18,8 +_,11 @@
public void spawnAfterBreak(BlockState p_220062_1_, ServerWorld p_220062_2_, BlockPos p_220062_3_, ItemStack p_220062_4_) {
super.spawnAfterBreak(p_220062_1_, p_220062_2_, p_220062_3_, p_220062_4_);
- int i = 15 + p_220062_2_.random.nextInt(15) + p_220062_2_.random.nextInt(15);
- this.popExperience(p_220062_2_, p_220062_3_, i);
+ }
+
+ @Override
+ public int getExpDrop(BlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, int fortune, int silktouch) {
+ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15);
+ }
+
public BlockRenderType func_149645_b(BlockState p_149645_1_) {
return BlockRenderType.MODEL;
}
public BlockRenderType getRenderShape(BlockState p_149645_1_) {
@@ -1,11 +1,11 @@
--- a/net/minecraft/block/SpongeBlock.java
+++ b/net/minecraft/block/SpongeBlock.java
@@ -64,7 +64,7 @@
@@ -64,7 +_,7 @@
queue.add(new Tuple<>(blockpos1, j + 1));
}
} else if (material == Material.field_203243_f || material == Material.field_204868_h) {
- TileEntity tileentity = blockstate.func_177230_c().func_235695_q_() ? p_176312_1_.func_175625_s(blockpos1) : null;
+ TileEntity tileentity = blockstate.hasTileEntity() ? p_176312_1_.func_175625_s(blockpos1) : null;
func_220059_a(blockstate, p_176312_1_, blockpos1, tileentity);
p_176312_1_.func_180501_a(blockpos1, Blocks.field_150350_a.func_176223_P(), 3);
} else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) {
- TileEntity tileentity = blockstate.getBlock().isEntityBlock() ? p_176312_1_.getBlockEntity(blockpos1) : null;
+ TileEntity tileentity = blockstate.hasTileEntity() ? p_176312_1_.getBlockEntity(blockpos1) : null;
dropResources(blockstate, p_176312_1_, blockpos1, tileentity);
p_176312_1_.setBlock(blockpos1, Blocks.AIR.defaultBlockState(), 3);
++i;
@@ -1,10 +1,10 @@
--- a/net/minecraft/block/SpreadableSnowyDirtBlock.java
+++ b/net/minecraft/block/SpreadableSnowyDirtBlock.java
@@ -33,6 +33,7 @@
@@ -33,6 +_,7 @@
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
if (!func_220257_b(p_225542_1_, p_225542_2_, p_225542_3_)) {
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
if (!canBeGrass(p_225542_1_, p_225542_2_, p_225542_3_)) {
+ if (!p_225542_2_.isAreaLoaded(p_225542_3_, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading
p_225542_2_.func_175656_a(p_225542_3_, Blocks.field_150346_d.func_176223_P());
p_225542_2_.setBlockAndUpdate(p_225542_3_, Blocks.DIRT.defaultBlockState());
} else {
if (p_225542_2_.func_201696_r(p_225542_3_.func_177984_a()) >= 9) {
if (p_225542_2_.getMaxLocalRawBrightness(p_225542_3_.above()) >= 9) {
@@ -1,38 +1,36 @@
--- a/net/minecraft/block/StairsBlock.java
+++ b/net/minecraft/block/StairsBlock.java
@@ -83,13 +83,23 @@
@@ -83,11 +_,21 @@
return voxelshape;
}
+ @Deprecated // Forge: Use the other constructor that takes a Supplier
public StairsBlock(BlockState p_i48321_1_, AbstractBlock.Properties p_i48321_2_) {
super(p_i48321_2_);
this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176309_a, Direction.NORTH).func_206870_a(field_176308_b, Half.BOTTOM).func_206870_a(field_176310_M, StairsShape.STRAIGHT).func_206870_a(field_204513_t, Boolean.valueOf(false)));
this.field_150149_b = p_i48321_1_.func_177230_c();
this.field_150151_M = p_i48321_1_;
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(HALF, Half.BOTTOM).setValue(SHAPE, StairsShape.STRAIGHT).setValue(WATERLOGGED, Boolean.valueOf(false)));
this.base = p_i48321_1_.getBlock();
this.baseState = p_i48321_1_;
+ this.stateSupplier = () -> p_i48321_1_;
}
+ public StairsBlock(java.util.function.Supplier<BlockState> state, AbstractBlock.Properties properties) {
+ super(properties);
+ this.func_180632_j(this.field_176227_L.func_177621_b().func_206870_a(field_176309_a, Direction.NORTH).func_206870_a(field_176308_b, Half.BOTTOM).func_206870_a(field_176310_M, StairsShape.STRAIGHT).func_206870_a(field_204513_t, Boolean.valueOf(false)));
+ this.field_150149_b = Blocks.field_150350_a; // These are unused, fields are redirected
+ this.field_150151_M = Blocks.field_150350_a.func_176223_P();
+ this.stateSupplier = state;
+ }
+
public boolean func_220074_n(BlockState p_220074_1_) {
return true;
+ public StairsBlock(java.util.function.Supplier<BlockState> state, AbstractBlock.Properties properties) {
+ super(properties);
+ this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(HALF, Half.BOTTOM).setValue(SHAPE, StairsShape.STRAIGHT).setValue(WATERLOGGED, Boolean.valueOf(false)));
+ this.base = Blocks.AIR; // These are unused, fields are redirected
+ this.baseState = Blocks.AIR.defaultBlockState();
+ this.stateSupplier = state;
}
@@ -265,4 +275,14 @@
public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
public boolean useShapeForLightOcclusion(BlockState p_220074_1_) {
@@ -265,4 +_,14 @@
public boolean isPathfindable(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
return false;
}
+
+ // Forge Start
+ private final java.util.function.Supplier<BlockState> stateSupplier;
+ private Block getModelBlock() {
+ return getModelState().func_177230_c();
+ return getModelState().getBlock();
+ }
+ private BlockState getModelState() {
+ return stateSupplier.get();
@@ -1,42 +1,43 @@
--- a/net/minecraft/block/StemBlock.java
+++ b/net/minecraft/block/StemBlock.java
@@ -37,22 +37,24 @@
@@ -37,22 +_,24 @@
}
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
+ if (!p_225542_2_.isAreaLoaded(p_225542_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
if (p_225542_2_.func_226659_b_(p_225542_3_, 0) >= 9) {
float f = CropsBlock.func_180672_a(this, p_225542_2_, p_225542_3_);
if (p_225542_2_.getRawBrightness(p_225542_3_, 0) >= 9) {
float f = CropsBlock.getGrowthSpeed(this, p_225542_2_, p_225542_3_);
- if (p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0) {
+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, p_225542_4_.nextInt((int)(25.0F / f) + 1) == 0)) {
int i = p_225542_1_.func_177229_b(field_176484_a);
int i = p_225542_1_.getValue(AGE);
if (i < 7) {
- p_225542_1_ = p_225542_1_.func_206870_a(field_176484_a, Integer.valueOf(i + 1));
- p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_, 2);
+ p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176484_a, Integer.valueOf(i + 1)), 2);
- p_225542_1_ = p_225542_1_.setValue(AGE, Integer.valueOf(i + 1));
- p_225542_2_.setBlock(p_225542_3_, p_225542_1_, 2);
+ p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(i + 1)), 2);
} else {
Direction direction = Direction.Plane.HORIZONTAL.func_179518_a(p_225542_4_);
BlockPos blockpos = p_225542_3_.func_177972_a(direction);
BlockState blockstate = p_225542_2_.func_180495_p(blockpos.func_177977_b());
- if (p_225542_2_.func_180495_p(blockpos).func_196958_f() && (blockstate.func_203425_a(Blocks.field_150458_ak) || blockstate.func_203425_a(Blocks.field_150346_d) || blockstate.func_203425_a(Blocks.field_196660_k) || blockstate.func_203425_a(Blocks.field_196661_l) || blockstate.func_203425_a(Blocks.field_196658_i))) {
+ Block block = blockstate.func_177230_c();
+ if (p_225542_2_.func_175623_d(blockpos) && (blockstate.canSustainPlant(p_225542_2_, blockpos.func_177977_b(), Direction.UP, this) || 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)) {
p_225542_2_.func_175656_a(blockpos, this.field_149877_a.func_176223_P());
p_225542_2_.func_175656_a(p_225542_3_, this.field_149877_a.func_196523_e().func_176223_P().func_206870_a(HorizontalBlock.field_185512_D, direction));
Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(p_225542_4_);
BlockPos blockpos = p_225542_3_.relative(direction);
BlockState blockstate = p_225542_2_.getBlockState(blockpos.below());
- if (p_225542_2_.getBlockState(blockpos).isAir() && (blockstate.is(Blocks.FARMLAND) || blockstate.is(Blocks.DIRT) || blockstate.is(Blocks.COARSE_DIRT) || blockstate.is(Blocks.PODZOL) || blockstate.is(Blocks.GRASS_BLOCK))) {
+ Block block = blockstate.getBlock();
+ if (p_225542_2_.isEmptyBlock(blockpos) && (blockstate.canSustainPlant(p_225542_2_, blockpos.below(), Direction.UP, this) || block == Blocks.FARMLAND || block == Blocks.DIRT || block == Blocks.COARSE_DIRT || block == Blocks.PODZOL || block == Blocks.GRASS_BLOCK)) {
p_225542_2_.setBlockAndUpdate(blockpos, this.fruit.defaultBlockState());
p_225542_2_.setBlockAndUpdate(p_225542_3_, this.fruit.getAttachedStem().defaultBlockState().setValue(HorizontalBlock.FACING, direction));
}
}
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
}
}
@@ -97,4 +99,10 @@
public StemGrownBlock func_208486_d() {
return this.field_149877_a;
}
@@ -96,5 +_,11 @@
public StemGrownBlock getFruit() {
return this.fruit;
+ }
+
+ //FORGE START
+ @Override
+ public net.minecraftforge.common.PlantType getPlantType(IBlockReader world, BlockPos pos) {
+ return net.minecraftforge.common.PlantType.CROP;
+ }
}
}
@@ -1,42 +1,43 @@
--- a/net/minecraft/block/SugarCaneBlock.java
+++ b/net/minecraft/block/SugarCaneBlock.java
@@ -15,7 +15,7 @@
@@ -15,7 +_,7 @@
import net.minecraft.world.IWorldReader;
import net.minecraft.world.server.ServerWorld;
-public class SugarCaneBlock extends Block {
+public class SugarCaneBlock extends Block implements net.minecraftforge.common.IPlantable {
public static final IntegerProperty field_176355_a = BlockStateProperties.field_208171_X;
protected static final VoxelShape field_196503_b = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 16.0D, 14.0D);
public static final IntegerProperty AGE = BlockStateProperties.AGE_15;
protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 16.0D, 14.0D);
@@ -43,12 +43,14 @@
@@ -43,12 +_,14 @@
if (i < 3) {
int j = p_225542_1_.func_177229_b(field_176355_a);
int j = p_225542_1_.getValue(AGE);
+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_, true)) {
if (j == 15) {
p_225542_2_.func_175656_a(p_225542_3_.func_177984_a(), this.func_176223_P());
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176355_a, Integer.valueOf(0)), 4);
p_225542_2_.setBlockAndUpdate(p_225542_3_.above(), this.defaultBlockState());
p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(0)), 4);
} else {
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_176355_a, Integer.valueOf(j + 1)), 4);
p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(j + 1)), 4);
}
+ }
}
}
@@ -63,6 +65,8 @@
@@ -63,6 +_,8 @@
}
public boolean func_196260_a(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
+ BlockState soil = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
+ if (soil.canSustainPlant(p_196260_2_, p_196260_3_.func_177977_b(), Direction.UP, this)) return true;
BlockState blockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
if (blockstate.func_177230_c() == this) {
public boolean canSurvive(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
+ BlockState soil = p_196260_2_.getBlockState(p_196260_3_.below());
+ if (soil.canSustainPlant(p_196260_2_, p_196260_3_.below(), Direction.UP, this)) return true;
BlockState blockstate = p_196260_2_.getBlockState(p_196260_3_.below());
if (blockstate.getBlock() == this) {
return true;
@@ -86,4 +90,14 @@
protected void func_206840_a(StateContainer.Builder<Block, BlockState> p_206840_1_) {
p_206840_1_.func_206894_a(field_176355_a);
}
@@ -85,5 +_,15 @@
protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> p_206840_1_) {
p_206840_1_.add(AGE);
+ }
+
+ @Override
+ public net.minecraftforge.common.PlantType getPlantType(IBlockReader world, BlockPos pos) {
@@ -45,6 +46,6 @@
+
+ @Override
+ public BlockState getPlant(IBlockReader world, BlockPos pos) {
+ return func_176223_P();
+ }
+ return defaultBlockState();
}
}
@@ -1,12 +1,12 @@
--- a/net/minecraft/block/SweetBerryBushBlock.java
+++ b/net/minecraft/block/SweetBerryBushBlock.java
@@ -52,8 +52,9 @@
@@ -52,8 +_,9 @@
public void func_225542_b_(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
int i = p_225542_1_.func_177229_b(field_220125_a);
- if (i < 3 && p_225542_4_.nextInt(5) == 0 && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9) {
+ if (i < 3 && p_225542_2_.func_226659_b_(p_225542_3_.func_177984_a(), 0) >= 9 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_,p_225542_4_.nextInt(5) == 0)) {
p_225542_2_.func_180501_a(p_225542_3_, p_225542_1_.func_206870_a(field_220125_a, Integer.valueOf(i + 1)), 2);
public void randomTick(BlockState p_225542_1_, ServerWorld p_225542_2_, BlockPos p_225542_3_, Random p_225542_4_) {
int i = p_225542_1_.getValue(AGE);
- if (i < 3 && p_225542_4_.nextInt(5) == 0 && p_225542_2_.getRawBrightness(p_225542_3_.above(), 0) >= 9) {
+ if (i < 3 && p_225542_2_.getRawBrightness(p_225542_3_.above(), 0) >= 9 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_225542_2_, p_225542_3_, p_225542_1_,p_225542_4_.nextInt(5) == 0)) {
p_225542_2_.setBlock(p_225542_3_, p_225542_1_.setValue(AGE, Integer.valueOf(i + 1)), 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_225542_2_, p_225542_3_, p_225542_1_);
}
Loaded 100 of 1519 files, more files were not shown because too many files have changed in this diff. Show more