Compare commits

..
119 Commits
Author SHA1 Message Date
LexManos 220cb1fd81 Update binpatcher version to decrease installer download size. 2020-02-03 13:41:18 -08:00
FenixFyreX 19abf0cb9a [1.14.4] Fix NPE on java 8u242 backport of PR #6473 (#6495) 2020-02-03 12:44:21 -08:00
DaemonUmbra 508d872ef3 Fixed Brown Mooshrooms dropping Red Mushrooms when sheared (#6476)
Backports 1.15.x code to 1.14.x
2020-01-29 09:16:25 -08:00
Wyn Price b67c37fd6c Fixed rounding issue with entity navigation fix (#6455) 2020-01-22 12:24:07 -07:00
KnightMiner d4a3762f21 [1.14] Add support for custom nether portal frame blocks (#6417) 2020-01-15 16:22:57 -08:00
tterrag 4c7f1096e5 Add constructor for FishBucketItem that accepts suppliers 2020-01-09 17:32:45 -05:00
Choonster TheMage 4ff65feb63 Deprecate ElementBuilder#rotation(BlockPartRotation) and add zero-parameter overload (fixes #6321) (#6338) 2020-01-07 12:02:08 -08:00
tterrag dbec9b3d5a Fix dyes tag containing dye items instead of tags
Update generated data
2020-01-05 19:05:09 -05:00
Richard Freimer 28515d7c59 Fix capabilities becoming inaccessible on returning from end (#6359) 2019-12-31 16:09:21 -08:00
David Quintana ca819e09f2 Revert one of the hunks of #6216, which was actually correct as it was. (#6337) 2019-12-31 16:09:07 -08:00
King Lemming d28cd0352b Make Minecarts work with modded powered/activator rails.
Re-adds functionality for rails to have different maximum speeds.
2019-12-23 19:34:43 -08:00
King Lemming a436118e39 Add FluidStack support to the Forge packet buffer. (#6353) 2019-12-22 22:21:38 -08:00
King Lemming 9e5ecaaf75 Added a couple of raytraceresult.getType() != MISS checks in places where they were absent. This corrects a couple of vanilla oversights and also greatly reduces Forge bus event spam for arrows and llama spit. (#6355)
Signed-off-by: King Lemming <[email protected]>
2019-12-15 14:39:41 -08:00
Luke Tonon 3701ec06d0 Restored canRiderInteract boolean in IForgeEntity (#6347) 2019-12-10 11:56:07 -08:00
Daniël Goossens 5d0fb2967c Split DrawBlockHighlightEvent into subevents to make usage clearer, addresses #2190 (#6269) 2019-12-10 11:46:01 -08:00
tterrag 5c88451f6f Allow classpath locator to discover jars via FMLModType attribute 2019-12-05 22:56:05 -05:00
cpw cfc53c939e Tidy up some output and also add libraries from the modfile detection into the transforming classloader.
Signed-off-by: cpw <[email protected]>
2019-12-05 22:47:39 -05:00
tterrag 3ba78225c3 Fix swapped yaw/pitch in camera setup event 2019-12-02 19:10:59 -05:00
liach d8e6181058 Restore camera setup render event (#6335) 2019-12-02 14:54:46 -08:00
DaemonUmbra bb4e78da90 Fixed invocation of Vanilla spawn logic (#6334)
Forge's replacement of the Vanilla logic gets inverted, so the Vanilla logic inside that replacement must be inverted to correct for this.
(Fixes #6332)
2019-12-02 14:54:00 -08:00
bl4ckscor3 4dd32d6f72 Add item tag 'beacon_payment' for items that can activate a beacon (#6328) 2019-12-02 14:52:45 -08:00
Luke Tonon 68b0075fe6 Added FENCES_WOODEN and FENCE_GATES_WOODEN tags as fuels in AbstractFurnaceTileEntity (#6327) 2019-12-02 14:36:30 -08:00
Paul Becker f9686cf098 New SleepFinishedTimeEvent allowing control of world time when waking up. (#6043) 2019-12-02 14:08:14 -08:00
tterrag ca28877fd5 Fix EntityLootTables not calling addTables 2019-11-25 01:49:24 -05:00
tterrag c18d26c7d8 Make EntityLootTables reusable for modders 2019-11-25 01:03:24 -05:00
nikita488 241db39cea Fix emissive items not working 2019-11-24 19:08:46 -05:00
cpw 31da9a4878 Fix the hang on startup problem when windows' broken device enumeration
causes a huge glfwInit slowdown. Log a message too when this is detected.

See https://github.com/glfw/glfw/issues/1284, https://stackoverflow.com/questions/10967795/directinput8-enumdevices-sometimes-painfully-slow,
https://discourse.libsdl.org/t/win-10-initing-joystick-causes-45s-hang-in-sdl-dinput-joystickdetect/23293

Signed-off-by: cpw <[email protected]>
2019-11-23 15:37:56 -05:00
Richard Freimer 0e65f20f22 Add hooks to make it easier to add custom TNT blocks (#6290) 2019-11-20 19:19:34 -08:00
DaemonUmbra d8d70e8b35 Add tags supports_beacon and supports_conduit and modify Beacon and Conduit to use these tags (#6266) 2019-11-20 19:15:13 -08:00
bl4ckscor3 5d62261082 Fix RawMouseEvent not being cancelable (#6310) 2019-11-12 15:12:25 -08:00
Richard Freimer a72b774acf Fix DyeColor referencing incorrect Tag path. Fixes #6301 (#6303) 2019-11-12 15:11:43 -08:00
DaemonUmbra b1042f2c3c Modify StonecutterContainer to allow shift-click insertion of any block with a valid recipe rather than limiting to blocks in an Immutable List (#6268) 2019-11-12 15:10:52 -08:00
tterrag 124c78b926 Fix #6305 lighting optimization using the wrong method 2019-11-07 16:56:54 -05:00
tterrag 7332bf91d5 Add support for modded warm ocean biomes in bonemeal code 2019-11-07 10:39:33 -05:00
tterrag 33307fb1bd Optimize SectionLightStorage#cancelSectionUpdates loop 2019-11-05 14:55:43 -05:00
Daniël Goossens 1ef8b75cbb Add LeftClickEvent trigger to onPlayerDamageBlock (#6046) 2019-11-05 11:12:02 -08:00
DaemonUmbra f4a85e5f03 Fixed an NPE caused by missing registries. (#6292)
Missing registries in this case being registries renamed without proper remapping or created by mods that were removed.
2019-11-05 11:10:32 -08:00
DaemonUmbra 7f8b30aed3 Made the slash optional in fml confirm/cancel. (#6282) 2019-11-05 11:10:19 -08:00
LexManos b8ea220925 Fix registry snapshots not reading aliases correctly. Closes #6298 2019-11-05 11:10:03 -08:00
cpw 1e1644f6d4 A few tweaks to things. Make the mods command a bit better, make the
IndexedMessageCodec actually log which network channel it got back packets
on. Also, improve the custom directorymodlocator with actual custom names,
finally, allow up to 99 log rollovers, up from 7 default (this means a
repeatedly crashing server is less likely to roll out the log of the first
crash).

Signed-off-by: cpw <[email protected]>
2019-11-03 12:33:07 -05:00
tterrag fab4ce894a Fix BlockStateProvider#horizontalBlock emitting rotations >=360 2019-11-01 17:10:06 -04:00
Camilo f2f7ab80f6 Added some more biome types to BiomeDictionary (#6250) 2019-11-01 11:26:08 -07:00
DaemonUmbra c044f3b0c4 Replaced getTypes invocation in ensureHasTypes with a direct reference to types, preventing infinite recursion (#6284)
The direct reference is checked via ternary and reports if the set is empty, this is likely to result in log spam if modders don't assign types to their biomes
2019-11-01 11:24:00 -07:00
tterrag ebd463e92f Fix lang generator escaping newlines, add lang generator test 2019-10-30 15:25:03 -04:00
tterrag 69ba974960 Escape control chars and unicode when writing out lang datagen 2019-10-30 15:01:25 -04:00
tterrag dbee8a24d8 Allow LanguageProvider helpers to accept suppliers of subtypes 2019-10-28 21:23:01 -04:00
tterrag 2373dab982 Expose private helper methods in BlockLootTables to subclasses 2019-10-28 19:28:16 -04:00
Wyn Price 1ebfef5ec9 Fixed vanilla bug in entity navigation to stop entities spinning (MC-94054) (#6091) 2019-10-28 14:13:14 -07:00
Paul Becker ff7a2fe4d6 Reimplement usage of Item#doesSneakBypassUse() (#6114) 2019-10-28 13:24:15 -07:00
cpw 862289cf56 Handle logging during shutdown better on the server, by not
closing the logfile before the server itself has shutdown.

Signed-off-by: cpw <[email protected]>
2019-10-26 16:55:15 -04:00
cpw e3068d7db2 Fix NPE in modlauncher when there is no mods dir yet.
Signed-off-by: cpw <[email protected]>
2019-10-25 07:27:55 -04:00
DaemonUmbra 29ad7a39de Fixed NPEs caused by uninitialized lists in ModDirTransformerDiscoverer (#6277) 2019-10-24 23:06:27 -07:00
LexManos 3484200f80 Make Loot Table data generators more reusable for modders. 2019-10-24 22:09:08 -07:00
tterrag acaa470dea Add Blockstate and Model data providers (#6241) 2019-10-24 22:33:24 -04:00
cpw 3bf6c17bb8 Allow pack locators to load from the mods folder.
Regular mods are now automatically de-duped based on the version number -
the highest version file of a "root mod id" is now selected automatically.

Signed-off-by: cpw <[email protected]>
2019-10-23 21:30:17 -04:00
AfterRebelion ca8a418364 Exclude Cobblestone slabs and wall recipes (#6230) 2019-10-22 15:31:35 -07:00
Wyn Price 6422310453 Fixed forge rendering pipeline and shape based light occulsion. (#6178) 2019-10-22 15:29:27 -07:00
Wyn Price ebf489be8c Fix shouldCauseReequipAnimation not affecting anything (#6256) 2019-10-22 15:08:06 -04:00
cpw c8967fa176 Expose the registrationchange event to simple channel (not that anyone should care, but who knows?)
Also, Context.getNetworkManager should have been public. Derp.

Signed-off-by: cpw <[email protected]>
2019-10-18 09:32:44 -04:00
cpw 51d08ad8ab Fix clientside chunk load event spam. Was an offset patch.. Also fire unload on the client side too.
Signed-off-by: cpw <[email protected]>
2019-10-18 00:03:09 -04:00
cpw dc664ba597 Add in an event to expose the standard MC channel stuff to network
event channels that care about such things. Mods using simplechannel
don't need to care.

Also, put a sync wrapper around crashreportextender, so it doesn't
die sometimes randomly during startup.

Signed-off-by: cpw <[email protected]>
2019-10-17 20:28:39 -04:00
Daniël Goossens 8e74ba8c24 Fix #6244 RightClickBlock#getUseBlock and #getUseItem being ignored (#6246) 2019-10-17 19:13:16 -04:00
David Quintana ec3e8c2039 Fix vanilla models with parents not loading properly from forge blockstates. 2019-10-16 23:11:23 +02:00
ichttt 6cbd418703 Include a profile icon for the launcher json (#6222) 2019-10-15 15:00:03 -07:00
ichttt 6c8342b74e Fixed loading error/warning screen not showing (#6218) 2019-10-15 14:59:41 -07:00
James Mitchell c345dfb0c6 Fixed MC-162953 bounds checks in NativeImage (#6216) 2019-10-15 14:58:16 -07:00
JoJoModding 8adc546d92 Allow mods actually to have their own usable config gui (#6208) 2019-10-15 14:56:27 -07:00
iChun 25a9e477cb Fix error logging in FMLUserdevLaunchProvider.setup (#6206) 2019-10-15 14:55:45 -07:00
bl4ckscor3 886de4ee43 Fix shear sound not playing (#6202) 2019-10-15 14:55:26 -07:00
ichttt c98abaaa42 Fix some config checks still using the old fields (#6193) 2019-10-15 14:54:47 -07:00
Philipp a8bd5e7ece Add onCropsGrow event to KelpTopBlock (#6171) 2019-10-15 14:33:07 -07:00
Justin a328364999 Fix mod info panel rendering incorrectly on some systems with HiDPI displays (pesky macs) (#6170) 2019-10-15 14:31:41 -07:00
FireController1847 94cbf72e39 Re-add PlayerGiveXpEvent & PlayerChangeLevelEvent (#6165) 2019-10-14 10:37:44 -07:00
Max Becker 8248eb6ea1 Skip background for hidden effect instances (#6197) 2019-10-14 10:33:45 -07:00
cpw 408104dbaf Bump modlauncher version to 4.1
Signed-off-by: cpw <[email protected]>
2019-10-13 14:21:24 -04:00
Wyn Price 5978670897 Fixed IModelData not being cleared when tile entity is removed (#6115) 2019-10-10 23:07:52 -04:00
Vincent Lee 01d14004a9 Allow modded IParticleRenderTypes to be rendered (#6221) 2019-10-10 23:05:16 -04:00
tterrag 940bbc4e91 Better sanity checks in ModelDataManager 2019-10-10 16:02:36 -04:00
Vincent Lee 7070bd0340 Make customClientFactory optional again (#6191) 2019-10-10 11:23:27 -07:00
David Quintana 5e9380ab85 Fix forge blockstates and custom model loading (#6154)
* Reimplement forge blockstates variant through the use of a pseudo-model that handles the model loading, retexturing, custom data, etc. on behalf of the blockstates loader. This model gets injected into the model registry with an autogenerated unique name, to not collide with other model locations.
* Fix model loaders not being properly initialized by calling the reload method from the loader register function. In 1.12, registering a reload listener caused the listener to be called right away from the register method. This is not true anymore.
2019-10-08 00:18:29 +02:00
cpw 9c759294c6 Add a super early GUI for showing pre-game launch messages from FML. NOTE: this cannot show on MAC because MAC can't handle
off-thread GUIs in any way shape or form, and we need the main thread to do real work.

Fix forge fading in wrongly.

Signed-off-by: cpw <[email protected]>
2019-10-05 17:03:02 -04:00
David Quintana b294f4d894 New round of fluid system fixes: (#6175)
- Fix race condition lazy-initializing flowing fluid block data.
- Fix typo in ItemTextureQuadConverter that prevents certain animated textures from being used in the fluid bucket.
- Fix calls to onContentsChanged in FluidTank.
- Fix FluidUtil.tryEmptyContainer logic when simulating.
- Fix EmptyFluidHandler.fill returning the wrong number.
2019-10-05 19:49:26 +02:00
tterrag ca980a56bc Combine all hidden mod resource packs into a single sortable pack
Fix mod datapacks sorting under vanilla
2019-10-04 18:36:33 -04:00
cpw 8482293b40 Split server and client side pack locators apart and move them to their
respective behavioural components. This should facilitate fixing the
server pack data pack ordering, as well as other new features of mod
resource packs.

Signed-off-by: cpw <[email protected]>
2019-10-04 15:24:15 -04:00
LexManos dc5a06aab4 Fix dimension types being incorrect when connecting to a non-Forge server. Closes #6203 2019-10-04 10:36:50 -07:00
cpw 35bd69808c Fix the stupid derp that broke singleplayer dims. Don't send the dim packet
to the local client - it is not needed because obviously not. Seems to have
fixed the problem. Probably infinity new bugs by this.

Signed-off-by: cpw <[email protected]>
2019-10-04 07:27:11 -04:00
tterrag 4f12261080 Move OnlyIn patches on DyeColor to SAS file
Also fix broken cobblestone stairs recipe
2019-10-04 02:26:54 -04:00
tterrag fbdfc0f95c Expose DyeColor#colorValue, remove OnlyIn from all DyeColor methods 2019-10-04 01:40:28 -04:00
cpw 48735c3946 Properly propagate the DimensionType information from server to client
at client connection time. This means the client now knows about the
dimensiontype properly and can access the ModDimension information on
the client.

Signed-off-by: cpw <[email protected]>
2019-10-02 21:54:02 -04:00
Ruben Taelman c985225d0c Fix FluidTank with empty contents throwing error if drained (#6196) 2019-10-01 19:57:05 -07:00
Matthew Messinger 48ff897ed1 Move opening initial screen to after startup and events are enabled (#6139)
This allows events to be fired for the initial opening of the main menu
Also fixes MC-145102
2019-10-01 19:56:03 -07:00
Wyn Price 9db568d49d Changed all calls of BlockState#getSoundType to use the sensitive version. (#6120) 2019-10-01 19:54:23 -07:00
Draco18s 896e785994 Patch Sweet Berry Bush to have Crop Growth Event Hook (#6094) 2019-10-01 19:52:24 -07:00
tterrag 78cdb705d4 Allow structure processors to process entities 2019-09-28 18:18:24 -04:00
cpw 136452840d Remove forced ANSI terminal - it breaks the Eclipse terminal output.
As a result, we can now support coloured log output again, by default.

Regen run configs to get the change (you should do this every update, you
know :D)

Signed-off-by: cpw <[email protected]>
2019-09-28 16:05:50 -04:00
tterrag b3631b707c Make patched-in StairsBlock constructor public
Also fix supplier generic being too narrow in DeferredRegister#register
2019-09-27 17:56:30 -04:00
cpw f4bab8b8c1 Integrate modlauncher changes for mixin.
Signed-off-by: cpw <[email protected]>
2019-09-27 17:42:24 -04:00
tterrag 2392a4c184 Fix new flower pot ctor not being usable with deferred register 2019-09-25 18:01:43 -04:00
tterrag 476b7056fb Usability improvements to RegistryObject/DeferredRegister 2019-09-25 18:01:39 -04:00
tterrag d510978446 Add constructor to StairsBlock that accepts a state supplier 2019-09-24 21:05:23 -04:00
LexManos 583ff81dba Fix server jar manifest path. 2019-09-23 18:42:54 -07:00
tterrag 01a862db30 Fix sea level not being available on client, move hook to Dimension 2019-09-23 13:08:26 -04:00
tterrag dfbd61436b Add template arg to StructureProcessor#process 2019-09-22 23:35:12 -04:00
LexManos f03745ce45 Fix timezone issue with the installer. 2019-09-23 02:46:43 +00:00
LexManos 48cf910626 Bump binpatcher and jarsplitter versions to address Java differences on older JDKs. 2019-09-22 17:30:29 -07:00
tterrag 0492b25335 Allow modded dimensions to customise World#getSeaLevel 2019-09-22 16:47:56 -04:00
tterrag 6d9cb0a646 Fix jigsaw blocks not mirroring properly 2019-09-22 16:47:44 -04:00
tterrag 571ecafdbc Fix type bound on GameRegistry.findRegistry being too narrow 2019-09-21 16:19:23 -04:00
tterrag dee844e232 Add IExtensibleEnum#init, extend FillerBlockType/PlacementBehaviour 2019-09-21 15:57:32 -04:00
cpw 07bcff5067 Tag the deprecation of DeferredWorkQueue. I think this is causing confusion
as to scope. Its functionality will be tied to the events in future -
so mods can request the deferred work through methods on the Mod Lifecycle
events directly. The API will be coming soon.

Signed-off-by: cpw <[email protected]>
2019-09-17 21:41:08 -04:00
cpw 7fa3594c04 Fixed the problem where an error would cause the main thread to continue
even though there were still parallel threads running. Also, handle exceptions
in the AutomaticEventSubscriber rather than leaking them to the Parallel processor.

Actually closes #6148
Signed-off-by: cpw <[email protected]>
2019-09-17 21:41:08 -04:00
tterrag 6fda1e968d Make FlowerPotBlock extensible and reusable for mods
- Change static lookup map to an instance variable
- Add an instance variable for the "empty pot" for the current block
- Keep one instance of the lookup map between the empty pot and all its full versions
- Convert everything to use delegates
2019-09-17 19:57:58 -04:00
Brennan Ward af8074cc39 Post tag event directly from reloader thread (#6164) 2019-09-17 14:39:36 -07:00
cpw 71a4828809 Some tweaks around the code base. A functional consumer for networking - return a bool from your consumer function, rather than setPacketHandled.
Tweak the server modloading behaviour to try and be a bit clearer that a mod errored.

Signed-off-by: cpw <[email protected]>
2019-09-16 20:14:25 -04:00
Brennan Ward 79ce18ac3e Update furnace fuels to not recreate it's list every query, and update when tags are reloaded. Add Tag update events. (#6140) 2019-09-16 14:04:32 -07:00
Nightenom bb83e11a7c Maintain default behavior for Item#canPlayerBreakBlockWhileHolding() (#6128) 2019-09-16 13:36:43 -07:00
Unnoen 0f888dde49 Update README badges to fix wrong version. (#6141) 2019-09-16 13:21:17 -07:00
MrCrayfish f4215d121c Reimplemented "MouseEvent" as RawMouseEvent for 1.14.X (#6144) 2019-09-16 13:03:10 -07:00
Take Weiland 60eecb98a6 Fix patch for vanilla spawning in WorldEntitySpawner (#6130) 2019-09-12 11:10:51 -07:00
290 changed files with 9162 additions and 1400 deletions

No files matched your search

+32 -20
View File
@@ -13,6 +13,8 @@ buildscript {
}
import groovy.json.JsonSlurper
import groovy.json.JsonBuilder
import java.nio.file.Files
import java.text.SimpleDateFormat
import java.util.Date
import java.util.LinkedHashMap
@@ -157,7 +159,10 @@ project(':forge') {
]
}
resources {
srcDirs = ["$rootDir/src/test/resources"]
srcDirs = [
"$rootDir/src/test/resources",
"$rootDir/src/generated_test/resources"
]
}
}
userdev {
@@ -187,6 +192,7 @@ project(':forge') {
MCP_ARTIFACT = project(':mcp').mcp.config
SPECIAL_SOURCE = 'net.md-5:SpecialSource:1.8.5'
VERSION_JSON = project(':mcp').file('build/mcp/downloadJson/version.json')
BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.0.12:fatjar'
}
def getVersion = {
@@ -234,7 +240,6 @@ project(':forge') {
environment 'FORGE_SPEC', SPEC_VERSION
environment 'FORGE_VERSION', project.version.substring(MC_VERSION.length() + 1).toString()
environment 'LAUNCHER_VERSION', SPEC_VERSION
property 'terminal.ansi', 'true'
property 'org.lwjgl.system.SharedLibraryExtractDirectory', 'lwjgl_dll'
ideaModule "${rootProject.name}.${project.name}.userdev"
@@ -243,12 +248,6 @@ project(':forge') {
source sourceSets.userdev
}
cpw_forge_client {
parent runs.forge_client
taskName 'cpw_forge_client'
property 'forge.logging.noansi', 'false'
}
forge_test_client {
parent runs.forge_client
taskName 'forge_test_client'
@@ -312,7 +311,8 @@ project(':forge') {
source sourceSets.main
source sourceSets.userdev
args '--mod', 'forge', '--all', '--output', rootProject.file('src/generated/resources/')
args '--mod', 'forge', '--all', '--output', rootProject.file('src/generated/resources/'), '--validate',
'--existing', sourceSets.main.resources.srcDirs[0]
}
forge_test_data {
@@ -325,7 +325,8 @@ project(':forge') {
tests { sources sourceSets.test }
}
args '--mod', 'data_gen_test', '--all', '--output', rootProject.file('src/generated_test/resources/')
args '--mod', 'data_gen_test', '--all', '--output', rootProject.file('src/generated_test/resources/'), '--validate',
'--existing', sourceSets.main.resources.srcDirs[0]
}
}
}
@@ -404,11 +405,11 @@ project(':forge') {
installer 'org.ow2.asm:asm:6.2'
installer 'org.ow2.asm:asm-commons:6.2'
installer 'org.ow2.asm:asm-tree:6.2'
installer 'cpw.mods:modlauncher:3.2.+'
installer 'cpw.mods:modlauncher:4.1.+'
installer 'cpw.mods:grossjava9hacks:1.1.+'
installer 'net.minecraftforge:accesstransformers:1.0.+:shadowed'
installer 'net.minecraftforge:eventbus:1.0.+:service'
installer 'net.minecraftforge:forgespi:1.3.+'
installer 'net.minecraftforge:forgespi:1.5.+'
installer 'net.minecraftforge:coremods:1.0.+'
installer 'net.minecraftforge:unsafe:0.2.+'
installer 'com.electronwill.night-config:core:3.6.0'
@@ -423,6 +424,10 @@ project(':forge') {
installer 'net.sf.jopt-simple:jopt-simple:5.0.4'
fmllauncherImplementation 'com.google.guava:guava:21.0'
fmllauncherImplementation 'com.google.code.gson:gson:2.8.0'
fmllauncherImplementation "org.lwjgl:lwjgl:3.2.2"
fmllauncherImplementation "org.lwjgl:lwjgl-glfw:3.2.2"
fmllauncherImplementation "org.lwjgl:lwjgl-opengl:3.2.2"
fmllauncherImplementation "org.lwjgl:lwjgl-stb:3.2.2"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.0.0'
testImplementation 'org.junit.vintage:junit-vintage-engine:5.+'
testImplementation 'org.opentest4j:opentest4j:1.0.0' // needed for junit 5
@@ -487,17 +492,23 @@ project(':forge') {
}
// We apply the bin patches we just created to make a jar that is JUST our changes
genClientBinPatches.tool = BINPATCH_TOOL
task applyClientBinPatches(type: ApplyBinPatches, dependsOn: genClientBinPatches) {
clean = { genClientBinPatches.cleanJar }
input = genClientBinPatches.output
tool = BINPATCH_TOOL
}
genServerBinPatches.tool = BINPATCH_TOOL
task applyServerBinPatches(type: ApplyBinPatches, dependsOn: genServerBinPatches) {
clean = { genServerBinPatches.cleanJar }
input = genServerBinPatches.output
tool = BINPATCH_TOOL
}
genJoinedBinPatches.tool = BINPATCH_TOOL
task applyJoinedBinPatches(type: ApplyBinPatches, dependsOn: genJoinedBinPatches) {
clean = { genJoinedBinPatches.cleanJar }
input = genJoinedBinPatches.output
tool = BINPATCH_TOOL
}
// Create SRG named Vanilla jars, using the SpecialSource we have in the installer
task createClientSRG(type: RenameJar, dependsOn: genClientBinPatches) {
@@ -736,10 +747,10 @@ project(':forge') {
ext {
output = file('build/install_profile.json')
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.1.4'
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.0'
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.2'
}
doFirst {
ext.BIN_PATCHER = 'net.minecraftforge:binarypatcher:' + genClientBinPatches.resolvedVersion
ext.BIN_PATCHER = BINPATCH_TOOL.substring(0, BINPATCH_TOOL.length() - 1 - BINPATCH_TOOL.split(':')[3].length())
}
inputs.file applyClientBinPatches.output
inputs.file applyServerBinPatches.output
@@ -769,6 +780,7 @@ project(':forge') {
spec: 0,
profile: project.name,
version: launcherJson.id,
icon: "data:image/png;base64," + new String(Base64.getEncoder().encode(Files.readAllBytes(rootProject.file("icon.ico").toPath()))),
json: '/version.json',
path: "${project.group}:${project.name}:${project.version}",
logo: '/big_logo.png',
@@ -784,16 +796,16 @@ project(':forge') {
server: '/data/server.lzma'
],
MC_SLIM: [
client: "[net.minecraft:client:${MC_VERSION}:slim]",
server: "[net.minecraft:server:${MC_VERSION}:slim]"
client: "[net.minecraft:client:${MC_VERSION}:slim${MC_VERSION == '1.14.4' ? '-stable' : ''}]",
server: "[net.minecraft:server:${MC_VERSION}:slim${MC_VERSION == '1.14.4' ? '-stable' : ''}]"
],
MC_SLIM_SHA: [
client: "'${sha1(tasks.getByName('downloadClientSlim').output)}'",
server: "'${sha1(tasks.getByName('downloadServerSlim').output)}'"
],
MC_EXTRA: [
client: "[net.minecraft:client:${MC_VERSION}:extra]",
server: "[net.minecraft:server:${MC_VERSION}:extra]"
client: "[net.minecraft:client:${MC_VERSION}:extra${MC_VERSION == '1.14.4' ? '-stable' : ''}]",
server: "[net.minecraft:server:${MC_VERSION}:extra${MC_VERSION == '1.14.4' ? '-stable' : ''}]"
],
MC_EXTRA_SHA: [
client: "'${sha1(tasks.getByName('downloadClientExtra').output)}'",
@@ -881,7 +893,7 @@ project(':forge') {
['slim', 'extra'].each { type ->
def name = "download${side.capitalize()}${type.capitalize()}"
task "${name}"(type: DownloadMavenArtifact) {
artifact = "net.minecraft:${side}:${MC_VERSION}:${type}"
artifact = "net.minecraft:${side}:${MC_VERSION}${MC_VERSION == '1.14.4' ? '-stable' : ''}:${type}"
}
installerJson.dependsOn(name)
installerJson.inputs.file(tasks.getByName(name).output)
@@ -934,7 +946,7 @@ project(':forge') {
artifacts.each { key, lib ->
classpath += "libraries/${lib.downloads.artifact.path} "
}
classpath += "libraries/net/minecraft/server/${MC_VERSION}/server-${MC_VERSION}-extra.jar"
classpath += "libraries/net/minecraft/server/${MC_VERSION}/server-${MC_VERSION}-extra${MC_VERSION == '1.14.4' ? '-stable' : ''}.jar"
MANIFESTS.each{ pkg, values ->
if (pkg == '/') {
+6 -3
View File
@@ -1,14 +1,17 @@
<img src="assets/Forge_logo.svg">
MinecraftForge [![Latest Release](https://img.shields.io/maven-metadata/v/https/files.minecraftforge.net/maven/net/minecraftforge/forge/maven-metadata.xml.svg?label=latest)](https://files.minecraftforge.net) [![Discord](https://img.shields.io/discord/313125603924639766.svg?color=%237289da&label=discord&logo=discord&logoColor=%237289da)](https://discord.gg/UvedJ9m) [![Support](https://img.shields.io/badge/patreon-support-orange.svg)](https://www.patreon.com/LexManos) [![Merch](https://img.shields.io/badge/flocker-merch-blueviolet.svg)](https://forgedev.flocker.tv/)
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.14.4-&query=$.promos["1.14.4-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.14.4-&query=$.promos["1.14.4-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) [![Merch](https://img.shields.io/badge/Flocker-Merch-blueviolet.svg)](https://forgedev.flocker.tv/)
Forge is a free, open-source modding API all of your favourite mods use!
| Version | Support |
| ------------- | ------------- |
| 1.14.x | Active (latest) |
| 1.12.x | Active (stable) |
| 1.14.x | Active |
| 1.12.x | Legacy |
* [Download]
* [Forum]
@@ -83,7 +83,19 @@
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_)) {
@@ -199,7 +203,7 @@
@@ -188,18 +192,14 @@
p_176536_1_.func_217377_a(p_176536_2_, false);
}
- Block block = blockstate.func_177230_c();
- if (block instanceof TNTBlock) {
- TNTBlock tntblock = (TNTBlock)block;
- TNTBlock.func_196534_a(p_176536_1_, p_176536_2_);
- }
+ blockstate.catchFire(p_176536_1_, p_176536_2_, face, null);
}
}
private boolean func_196447_a(IBlockReader p_196447_1_, BlockPos p_196447_2_) {
for(Direction direction : Direction.values()) {
@@ -92,7 +104,7 @@
return true;
}
}
@@ -215,13 +219,14 @@
@@ -215,13 +215,14 @@
for(Direction direction : Direction.values()) {
BlockState blockstate = p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(direction));
@@ -108,7 +120,7 @@
public boolean func_196446_i(BlockState p_196446_1_) {
return this.func_220275_r(p_196446_1_) > 0;
}
@@ -246,8 +251,8 @@
@@ -246,8 +247,8 @@
BlockPos blockpos = p_180655_3_.func_177977_b();
BlockState blockstate = p_180655_2_.func_180495_p(blockpos);
@@ -119,7 +131,7 @@
for(int j = 0; j < 2; ++j) {
double d3 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble() * (double)0.1F;
double d8 = (double)p_180655_3_.func_177956_o() + p_180655_4_.nextDouble();
@@ -256,7 +261,7 @@
@@ -256,7 +257,7 @@
}
}
@@ -128,7 +140,7 @@
for(int k = 0; k < 2; ++k) {
double d4 = (double)(p_180655_3_.func_177958_n() + 1) - p_180655_4_.nextDouble() * (double)0.1F;
double d9 = (double)p_180655_3_.func_177956_o() + p_180655_4_.nextDouble();
@@ -265,7 +270,7 @@
@@ -265,7 +266,7 @@
}
}
@@ -137,7 +149,7 @@
for(int l = 0; l < 2; ++l) {
double d5 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble();
double d10 = (double)p_180655_3_.func_177956_o() + p_180655_4_.nextDouble();
@@ -274,7 +279,7 @@
@@ -274,7 +275,7 @@
}
}
@@ -146,7 +158,7 @@
for(int i1 = 0; i1 < 2; ++i1) {
double d6 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble();
double d11 = (double)p_180655_3_.func_177956_o() + p_180655_4_.nextDouble();
@@ -283,7 +288,7 @@
@@ -283,7 +284,7 @@
}
}
@@ -155,7 +167,7 @@
for(int j1 = 0; j1 < 2; ++j1) {
double d7 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble();
double d12 = (double)(p_180655_3_.func_177956_o() + 1) - p_180655_4_.nextDouble() * (double)0.1F;
@@ -311,10 +316,23 @@
@@ -311,10 +312,23 @@
}
public void func_180686_a(Block p_180686_1_, int p_180686_2_, int p_180686_3_) {
@@ -1,11 +1,79 @@
--- a/net/minecraft/block/FlowerPotBlock.java
+++ b/net/minecraft/block/FlowerPotBlock.java
@@ -19,7 +19,7 @@
import net.minecraft.world.World;
public class FlowerPotBlock extends Block {
- private static final Map<Block, Block> field_196451_b = Maps.newHashMap();
+ private static final Map<Block, Block> field_196451_b = Maps.newHashMap(); //TODO: Delegates
@@ -23,10 +23,37 @@
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;
+ private final Map<net.minecraft.util.ResourceLocation, java.util.function.Supplier<? extends Block>> fullPots;
+ private final java.util.function.Supplier<FlowerPotBlock> emptyPot;
+ private final java.util.function.Supplier<? extends Block> flowerDelegate;
+
+ @Deprecated // Mods should use the constructor below
public FlowerPotBlock(Block p_i48395_1_, Block.Properties p_i48395_2_) {
+ 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);
+ }
+ }
+
+ /**
+ * 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 p_i48395_2_
+ */
+ public FlowerPotBlock(@javax.annotation.Nullable java.util.function.Supplier<FlowerPotBlock> emptyPot, java.util.function.Supplier<? extends Block> p_i48395_1_, Block.Properties p_i48395_2_) {
super(p_i48395_2_);
- this.field_196452_c = p_i48395_1_;
- field_196451_b.put(p_i48395_1_, this);
+ this.field_196452_c = null; // Unused, redirected by coremod
+ this.flowerDelegate = p_i48395_1_;
+ if (emptyPot == null) {
+ this.fullPots = Maps.newHashMap();
+ this.emptyPot = null;
+ } else {
+ 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_) {
@@ -40,7 +67,7 @@
public boolean func_220051_a(BlockState p_220051_1_, World p_220051_2_, BlockPos p_220051_3_, PlayerEntity p_220051_4_, Hand p_220051_5_, BlockRayTraceResult p_220051_6_) {
ItemStack itemstack = p_220051_4_.func_184586_b(p_220051_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;
if (flag != flag1) {
@@ -58,7 +85,7 @@
p_220051_4_.func_71019_a(itemstack1, false);
}
- p_220051_2_.func_180501_a(p_220051_3_, Blocks.field_150457_bL.func_176223_P(), 3);
+ p_220051_2_.func_180501_a(p_220051_3_, getEmptyPot().func_176223_P(), 3);
}
}
@@ -78,6 +105,17 @@
}
public Block func_220276_d() {
- return this.field_196452_c;
+ return flowerDelegate.get();
}
+
+ public FlowerPotBlock getEmptyPot() {
+ return emptyPot == null ? this : emptyPot.get();
+ }
+
+ public void addPlant(net.minecraft.util.ResourceLocation flower, java.util.function.Supplier<? extends Block> fullPot) {
+ if (getEmptyPot() != this) {
+ throw new IllegalArgumentException("Cannot add plant to non-empty pot: " + this);
+ }
+ fullPots.put(flower, fullPot);
+ }
}
@@ -59,7 +59,7 @@
this.func_180688_d(p_204515_1_, p_204515_2_);
return false;
}
@@ -160,4 +176,22 @@
@@ -160,4 +176,27 @@
}
}
@@ -70,15 +70,20 @@
+ return (FlowingFluid)supplier.get();
+ }
+
+ private boolean fluidStateCacheInitialized;
+ protected void initFluidStateCache() {
+ this.field_212565_c.add(getFluid().func_207204_a(false));
+ private boolean fluidStateCacheInitialized = false;
+ protected synchronized void initFluidStateCache() {
+ if (fluidStateCacheInitialized == false)
+ {
+ this.field_212565_c.add(getFluid().func_207204_a(false));
+
+ for(int i = 1; i < 8; ++i) {
+ this.field_212565_c.add(getFluid().func_207207_a(8 - i, false));
+ for (int i = 1; i < 8; ++i)
+ {
+ this.field_212565_c.add(getFluid().func_207207_a(8 - i, false));
+ }
+
+ this.field_212565_c.add(getFluid().func_207207_a(8, true));
+
+ fluidStateCacheInitialized = true;
+ }
+
+ this.field_212565_c.add(getFluid().func_207207_a(8, true));
+ fluidStateCacheInitialized = true;
+ }
}
@@ -0,0 +1,16 @@
--- a/net/minecraft/block/JigsawBlock.java
+++ b/net/minecraft/block/JigsawBlock.java
@@ -29,6 +29,13 @@
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)));
}
+ // FORGE: Fix jigsaw blocks not mirroring properly
+ @Override
+ @Deprecated
+ public BlockState func_185471_a(BlockState state, net.minecraft.util.Mirror mirrorIn) {
+ return state.func_206870_a(field_176387_N, mirrorIn.func_185803_b(state.func_177229_b(field_176387_N)));
+ }
+
public BlockState func_196258_a(BlockItemUseContext p_196258_1_) {
return this.func_176223_P().func_206870_a(field_176387_N, p_196258_1_.func_196000_l());
}
@@ -0,0 +1,13 @@
--- a/net/minecraft/block/KelpTopBlock.java
+++ b/net/minecraft/block/KelpTopBlock.java
@@ -57,8 +57,9 @@
} else {
BlockPos blockpos = p_196267_3_.func_177984_a();
BlockState blockstate = p_196267_2_.func_180495_p(blockpos);
- if (blockstate.func_177230_c() == Blocks.field_150355_j && p_196267_1_.func_177229_b(field_203163_a) < 25 && p_196267_4_.nextDouble() < 0.14D) {
+ if (blockstate.func_177230_c() == Blocks.field_150355_j && p_196267_1_.func_177229_b(field_203163_a) < 25 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, blockpos, p_196267_1_, p_196267_4_.nextDouble() < 0.14D)) {
p_196267_2_.func_175656_a(blockpos, p_196267_1_.func_177231_a(field_203163_a));
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_);
}
}
@@ -9,3 +9,48 @@
netherportalblock$size.func_150859_c();
return true;
} else {
@@ -245,13 +245,13 @@
int i;
for(i = 0; i < 22; ++i) {
BlockPos blockpos = p_180120_1_.func_177967_a(p_180120_2_, i);
- if (!this.func_196900_a(this.field_150867_a.func_180495_p(blockpos)) || this.field_150867_a.func_180495_p(blockpos.func_177977_b()).func_177230_c() != Blocks.field_150343_Z) {
+ if (!this.func_196900_a(this.field_150867_a.func_180495_p(blockpos)) || !this.field_150867_a.func_180495_p(blockpos.func_177977_b()).isPortalFrame(this.field_150867_a, blockpos.func_177977_b())) {
break;
}
}
- Block block = this.field_150867_a.func_180495_p(p_180120_1_.func_177967_a(p_180120_2_, i)).func_177230_c();
- return block == Blocks.field_150343_Z ? i : 0;
+ BlockPos framePos = p_180120_1_.func_177967_a(p_180120_2_, i);
+ return this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos) ? i : 0;
}
public int func_181100_a() {
@@ -278,13 +278,13 @@
}
if (i == 0) {
- block = this.field_150867_a.func_180495_p(blockpos.func_177972_a(this.field_150863_d)).func_177230_c();
- if (block != Blocks.field_150343_Z) {
+ BlockPos framePos = blockpos.func_177972_a(this.field_150863_d);
+ if (!this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos)) {
break label56;
}
} else if (i == this.field_150868_h - 1) {
- block = this.field_150867_a.func_180495_p(blockpos.func_177972_a(this.field_150866_c)).func_177230_c();
- if (block != Blocks.field_150343_Z) {
+ BlockPos framePos = blockpos.func_177972_a(this.field_150866_c);
+ if (!this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos)) {
break label56;
}
}
@@ -292,7 +292,8 @@
}
for(int j = 0; j < this.field_150868_h; ++j) {
- if (this.field_150867_a.func_180495_p(this.field_150861_f.func_177967_a(this.field_150866_c, j).func_177981_b(this.field_150862_g)).func_177230_c() != Blocks.field_150343_Z) {
+ BlockPos framePos = this.field_150861_f.func_177967_a(this.field_150866_c, j).func_177981_b(this.field_150862_g);
+ if (!this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos)) {
this.field_150862_g = 0;
break;
}
@@ -4,17 +4,17 @@
public class PoweredRailBlock extends AbstractRailBlock {
public static final EnumProperty<RailShape> field_176568_b = BlockStateProperties.field_208166_S;
public static final BooleanProperty field_176569_M = BlockStateProperties.field_208194_u;
+ private final boolean isActivator;
+ private final boolean isActivator; // TRUE for an Activator Rail, FALSE for Powered Rail
protected PoweredRailBlock(Block.Properties p_i48349_1_) {
- super(true, p_i48349_1_);
+ this(p_i48349_1_, false);
+ }
+
+ protected PoweredRailBlock(Block.Properties builder, boolean isActivator) {
+ protected PoweredRailBlock(Block.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.isActivator = isActivator;
+ 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_) {
@@ -35,3 +35,12 @@
return p_208071_1_.func_175640_z(p_208071_2_) ? true : this.func_176566_a(p_208071_1_, p_208071_2_, blockstate, p_208071_3_, p_208071_4_ + 1);
} else {
return false;
@@ -255,4 +261,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);
}
+
+ public boolean isActivatorRail() {
+ return isActivator;
+ }
}
@@ -0,0 +1,40 @@
--- a/net/minecraft/block/StairsBlock.java
+++ b/net/minecraft/block/StairsBlock.java
@@ -83,13 +83,24 @@
return voxelshape;
}
+ // Forge: Use the other constructor that takes a Supplier
+ @Deprecated
protected StairsBlock(BlockState p_i48321_1_, Block.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.stateSupplier = () -> p_i48321_1_;
}
+ public StairsBlock(java.util.function.Supplier<BlockState> state, Block.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;
}
@@ -265,4 +276,12 @@
public boolean func_196266_a(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
return false;
}
+
+ private final java.util.function.Supplier<BlockState> stateSupplier;
+ private Block getModelBlock() {
+ return getModelState().func_177230_c();
+ }
+ private BlockState getModelState() {
+ return stateSupplier.get();
+ }
}
@@ -0,0 +1,13 @@
--- a/net/minecraft/block/SweetBerryBushBlock.java
+++ b/net/minecraft/block/SweetBerryBushBlock.java
@@ -47,8 +47,9 @@
public void func_196267_b(BlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_);
int i = p_196267_1_.func_177229_b(field_220125_a);
- if (i < 3 && p_196267_4_.nextInt(5) == 0 && p_196267_2_.func_201669_a(p_196267_3_.func_177984_a(), 0) >= 9) {
+ if (i < 3 && p_196267_2_.func_201669_a(p_196267_3_.func_177984_a(), 0) >= 9 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_.nextInt(5) == 0)) {
p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_.func_206870_a(field_220125_a, Integer.valueOf(i + 1)), 2);
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_);
}
}
@@ -0,0 +1,67 @@
--- a/net/minecraft/block/TNTBlock.java
+++ b/net/minecraft/block/TNTBlock.java
@@ -28,10 +28,14 @@
this.func_180632_j(this.func_176223_P().func_206870_a(field_212569_a, Boolean.valueOf(false)));
}
+ public void catchFire(BlockState state, World world, BlockPos pos, @Nullable net.minecraft.util.Direction face, @Nullable LivingEntity igniter) {
+ func_196535_a(world, pos, igniter);
+ }
+
public void func_220082_b(BlockState p_220082_1_, World p_220082_2_, BlockPos p_220082_3_, BlockState p_220082_4_, boolean p_220082_5_) {
if (p_220082_4_.func_177230_c() != p_220082_1_.func_177230_c()) {
if (p_220082_2_.func_175640_z(p_220082_3_)) {
- func_196534_a(p_220082_2_, p_220082_3_);
+ catchFire(p_220082_1_, p_220082_2_, p_220082_3_, null, null);
p_220082_2_.func_217377_a(p_220082_3_, false);
}
@@ -40,7 +44,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_.func_175640_z(p_220069_3_)) {
- func_196534_a(p_220069_2_, p_220069_3_);
+ catchFire(p_220069_1_, p_220069_2_, p_220069_3_, null, null);
p_220069_2_.func_217377_a(p_220069_3_, false);
}
@@ -48,7 +52,7 @@
public void func_176208_a(World p_176208_1_, BlockPos p_176208_2_, BlockState p_176208_3_, PlayerEntity p_176208_4_) {
if (!p_176208_1_.func_201670_d() && !p_176208_4_.func_184812_l_() && p_176208_3_.func_177229_b(field_212569_a)) {
- func_196534_a(p_176208_1_, p_176208_2_);
+ catchFire(p_176208_3_, p_176208_1_, p_176208_2_, null, null);
}
super.func_176208_a(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
@@ -62,10 +66,12 @@
}
}
+ @Deprecated //Forge: Prefer using IForgeBlock#catchFire
public static void func_196534_a(World p_196534_0_, BlockPos p_196534_1_) {
func_196535_a(p_196534_0_, p_196534_1_, (LivingEntity)null);
}
+ @Deprecated //Forge: Prefer using IForgeBlock#catchFire
private static void func_196535_a(World p_196535_0_, BlockPos p_196535_1_, @Nullable LivingEntity p_196535_2_) {
if (!p_196535_0_.field_72995_K) {
TNTEntity tntentity = new TNTEntity(p_196535_0_, (double)((float)p_196535_1_.func_177958_n() + 0.5F), (double)p_196535_1_.func_177956_o(), (double)((float)p_196535_1_.func_177952_p() + 0.5F), p_196535_2_);
@@ -80,7 +86,7 @@
if (item != Items.field_151033_d && item != Items.field_151059_bz) {
return super.func_220051_a(p_220051_1_, p_220051_2_, p_220051_3_, p_220051_4_, p_220051_5_, p_220051_6_);
} else {
- func_196535_a(p_220051_2_, p_220051_3_, p_220051_4_);
+ catchFire(p_220051_1_, p_220051_2_, p_220051_3_, p_220051_6_.func_216354_b(), p_220051_4_);
p_220051_2_.func_180501_a(p_220051_3_, Blocks.field_150350_a.func_176223_P(), 11);
if (item == Items.field_151033_d) {
itemstack.func_222118_a(1, p_220051_4_, (p_220287_1_) -> {
@@ -100,7 +106,7 @@
Entity entity = abstractarrowentity.func_212360_k();
if (abstractarrowentity.func_70027_ad()) {
BlockPos blockpos = p_220066_3_.func_216350_a();
- func_196535_a(p_220066_1_, blockpos, entity instanceof LivingEntity ? (LivingEntity)entity : null);
+ catchFire(p_220066_2_, p_220066_1_, blockpos, null, entity instanceof LivingEntity ? (LivingEntity)entity : null);
p_220066_1_.func_217377_a(blockpos, false);
}
}
@@ -25,7 +25,15 @@
this.field_71459_aj = p_i45547_1_.field_178741_d.field_178756_a;
this.field_147129_ai = func_147122_X();
this.field_71437_Z = null;
@@ -442,7 +442,6 @@
@@ -423,6 +423,7 @@
screensize = new ScreenSize(this.field_71474_y.field_92118_B, this.field_71474_y.field_92119_C, screensize.field_216496_c, screensize.field_216497_d, screensize.field_216498_e);
}
+ net.minecraftforge.fml.loading.progress.EarlyProgressVisualization.INSTANCE.join();
LongSupplier longsupplier = GLX.initGlfw();
if (longsupplier != null) {
Util.field_211180_a = longsupplier;
@@ -442,7 +443,6 @@
this.field_195558_d.func_216526_a(this.field_71474_y.field_74350_i);
this.field_71417_B = new MouseHelper(this);
@@ -33,7 +41,7 @@
this.field_195559_v = new KeyboardListener(this);
this.field_195559_v.func_197968_a(this.field_195558_d.func_198092_i());
GLX.init();
@@ -451,6 +450,7 @@
@@ -451,6 +451,7 @@
this.field_147124_at.func_147604_a(0.0F, 0.0F, 0.0F, 0.0F);
this.field_110451_am = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES, this.field_152352_aC);
this.field_71474_y.func_198017_a(this.field_110448_aq);
@@ -41,7 +49,7 @@
this.field_110448_aq.func_198983_a();
List<IResourcePack> list = this.field_110448_aq.func_198980_d().stream().map(ResourcePackInfo::func_195796_e).collect(Collectors.toList());
@@ -516,12 +516,14 @@
@@ -516,12 +517,14 @@
this.field_110451_am.func_219534_a(this.field_193995_ae);
GlStateManager.viewport(0, 0, this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l());
this.field_71452_i = new ParticleManager(this.field_71441_e, this.field_71446_o);
@@ -57,16 +65,34 @@
this.field_184132_p = new DebugRenderer(this);
GLX.setGlfwErrorCallback(this::func_195545_a);
if (this.field_71474_y.field_74353_u && !this.field_195558_d.func_198113_j()) {
@@ -543,7 +545,7 @@
@@ -532,18 +535,20 @@
this.field_195558_d.func_216523_b(this.field_71474_y.field_74352_v);
this.field_195558_d.func_224798_d(this.field_71474_y.field_225307_E);
this.field_195558_d.func_198112_b();
- if (this.field_71475_ae != null) {
- this.func_147108_a(new ConnectingScreen(new MainMenuScreen(), this, this.field_71475_ae, this.field_71477_af));
- } else {
- this.func_147108_a(new MainMenuScreen(true));
- }
ResourceLoadProgressGui.func_212970_a(this);
this.func_213268_a(new ResourceLoadProgressGui(this, this.field_110451_am.func_219535_a(Util.func_215072_e(), this, field_223714_G), () -> {
if (SharedConstants.field_206244_b) {
this.func_213256_aB();
}
-
+ net.minecraftforge.fml.client.ClientModLoader.complete();
+ if (net.minecraftforge.fml.client.ClientModLoader.completeModLoading()) return; // Do not overwrite the error sceen
+ // FORGE: Move opening initial screen to after startup and events are enabled.
+ // Also Fixes MC-145102
+ if (this.field_71475_ae != null) {
+ this.func_147108_a(new ConnectingScreen(new MainMenuScreen(), this, this.field_71475_ae, this.field_71477_af));
+ } else {
+ this.func_147108_a(new MainMenuScreen(true));
+ }
}, false));
}
@@ -558,7 +560,7 @@
@@ -558,7 +563,7 @@
return Stream.of(Registry.field_212630_s.func_177774_c(p_213251_0_.func_77973_b()));
});
SearchTreeReloadable<ItemStack> searchtreereloadable = new SearchTreeReloadable<>((p_213235_0_) -> {
@@ -75,7 +101,7 @@
});
NonNullList<ItemStack> nonnulllist = NonNullList.func_191196_a();
@@ -647,7 +649,7 @@
@@ -647,7 +652,7 @@
Bootstrap.func_179870_a(p_71377_1_.func_71502_e());
if (p_71377_1_.func_71497_f() != null) {
Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_1_.func_71497_f());
@@ -84,7 +110,7 @@
} else if (p_71377_1_.func_147149_a(file2)) {
Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath());
System.exit(-1);
@@ -662,6 +664,7 @@
@@ -662,6 +667,7 @@
return this.field_71474_y.field_211842_aO;
}
@@ -92,7 +118,7 @@
public CompletableFuture<Void> func_213237_g() {
if (this.field_213276_aV != null) {
return this.field_213276_aV;
@@ -741,16 +744,20 @@
@@ -741,16 +747,20 @@
}
public void func_147108_a(@Nullable Screen p_147108_1_) {
@@ -117,7 +143,7 @@
if (p_147108_1_ instanceof MainMenuScreen || p_147108_1_ instanceof MultiplayerScreen) {
this.field_71474_y.field_74330_P = false;
this.field_71456_v.func_146158_b().func_146231_a(true);
@@ -875,11 +882,13 @@
@@ -875,11 +885,13 @@
GlStateManager.enableTexture();
this.field_71424_I.func_76319_b();
if (!this.field_71454_w) {
@@ -131,7 +157,7 @@
}
this.field_71424_I.func_219897_b();
@@ -1147,10 +1156,10 @@
@@ -1147,10 +1159,10 @@
if (p_147115_1_ && this.field_71476_x != null && this.field_71476_x.func_216346_c() == RayTraceResult.Type.BLOCK) {
BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x;
BlockPos blockpos = blockraytraceresult.func_216350_a();
@@ -144,7 +170,7 @@
this.field_71439_g.func_184609_a(Hand.MAIN_HAND);
}
}
@@ -1177,7 +1186,7 @@
@@ -1177,7 +1189,7 @@
case BLOCK:
BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x;
BlockPos blockpos = blockraytraceresult.func_216350_a();
@@ -153,7 +179,7 @@
this.field_71442_b.func_180511_b(blockpos, blockraytraceresult.func_216354_b());
break;
}
@@ -1187,6 +1196,7 @@
@@ -1187,6 +1199,7 @@
}
this.field_71439_g.func_184821_cY();
@@ -161,7 +187,7 @@
}
this.field_71439_g.func_184609_a(Hand.MAIN_HAND);
@@ -1236,6 +1246,9 @@
@@ -1236,6 +1249,9 @@
}
}
@@ -171,7 +197,7 @@
if (!itemstack.func_190926_b() && this.field_71442_b.func_187101_a(this.field_71439_g, this.field_71441_e, hand) == ActionResultType.SUCCESS) {
this.field_71460_t.field_78516_c.func_187460_a(hand);
return;
@@ -1255,6 +1268,8 @@
@@ -1255,6 +1271,8 @@
--this.field_71467_ac;
}
@@ -180,7 +206,7 @@
this.field_71424_I.func_76320_a("gui");
if (!this.field_71445_n) {
this.field_71456_v.func_73831_a();
@@ -1373,6 +1388,8 @@
@@ -1373,6 +1391,8 @@
this.field_71424_I.func_219895_b("keyboard");
this.field_195559_v.func_204870_b();
this.field_71424_I.func_76319_b();
@@ -189,7 +215,7 @@
}
private void func_184117_aA() {
@@ -1527,6 +1544,12 @@
@@ -1527,6 +1547,12 @@
this.func_147108_a(worldloadprogressscreen);
while(!this.field_71437_Z.func_71200_ad()) {
@@ -202,7 +228,7 @@
worldloadprogressscreen.tick();
this.func_195542_b(false);
@@ -1547,11 +1570,17 @@
@@ -1547,11 +1573,17 @@
networkmanager.func_150719_a(new ClientLoginNetHandler(networkmanager, this, (Screen)null, (p_213261_0_) -> {
}));
networkmanager.func_179290_a(new CHandshakePacket(socketaddress.toString(), 0, ProtocolType.LOGIN));
@@ -221,7 +247,7 @@
WorkingScreen workingscreen = new WorkingScreen();
workingscreen.func_200210_a(new TranslationTextComponent("connect.joining"));
this.func_213241_c(workingscreen);
@@ -1583,10 +1612,12 @@
@@ -1583,10 +1615,12 @@
IntegratedServer integratedserver = this.field_71437_Z;
this.field_71437_Z = null;
this.field_71460_t.func_190564_k();
@@ -234,7 +260,7 @@
if (integratedserver != null) {
while(!integratedserver.func_213201_w()) {
this.func_195542_b(false);
@@ -1624,6 +1655,7 @@
@@ -1624,6 +1658,7 @@
}
TileEntityRendererDispatcher.field_147556_a.func_147543_a(p_213257_1_);
@@ -242,7 +268,7 @@
}
public final boolean func_71355_q() {
@@ -1649,112 +1681,8 @@
@@ -1649,112 +1684,8 @@
private void func_147112_ai() {
if (this.field_71476_x != null && this.field_71476_x.func_216346_c() != RayTraceResult.Type.MISS) {
@@ -357,7 +383,7 @@
}
}
@@ -1826,6 +1754,7 @@
@@ -1826,6 +1757,7 @@
return field_71432_P;
}
@@ -365,7 +391,7 @@
public CompletableFuture<Void> func_213245_w() {
return this.func_213169_a(this::func_213237_g).thenCompose((p_213240_0_) -> {
return p_213240_0_;
@@ -1972,6 +1901,8 @@
@@ -1972,6 +1904,8 @@
}
public MusicTicker.MusicType func_147109_W() {
@@ -374,7 +400,7 @@
if (this.field_71462_r instanceof WinGameScreen) {
return MusicTicker.MusicType.CREDITS;
} else if (this.field_71439_g == null) {
@@ -2128,4 +2059,12 @@
@@ -2128,4 +2062,12 @@
public LoadingGui func_213250_au() {
return this.field_213279_p;
}
@@ -1,6 +1,13 @@
--- a/net/minecraft/client/MouseHelper.java
+++ b/net/minecraft/client/MouseHelper.java
@@ -77,11 +77,15 @@
@@ -71,17 +71,22 @@
if (!this.field_198051_p && flag) {
this.func_198034_i();
}
+ if (net.minecraftforge.client.ForgeHooksClient.onRawMouseClicked(p_198023_3_, p_198023_4_, p_198023_5_)) return;
} else {
double d0 = this.field_198040_e * (double)this.field_198036_a.field_195558_d.func_198107_o() / (double)this.field_198036_a.field_195558_d.func_198105_m();
double d1 = this.field_198041_f * (double)this.field_198036_a.field_195558_d.func_198087_p() / (double)this.field_198036_a.field_195558_d.func_198083_n();
int p_198023_3_f = p_198023_3_;
if (flag) {
Screen.wrapScreenError(() -> {
@@ -18,7 +25,7 @@
}, "mouseReleased event handler", this.field_198036_a.field_71462_r.getClass().getCanonicalName());
}
}
@@ -105,7 +109,7 @@
@@ -105,7 +110,7 @@
}
}
}
@@ -27,7 +34,7 @@
}
}
@@ -116,7 +120,9 @@
@@ -116,7 +121,9 @@
if (this.field_198036_a.field_71462_r != null) {
double d1 = this.field_198040_e * (double)this.field_198036_a.field_195558_d.func_198107_o() / (double)this.field_198036_a.field_195558_d.func_198105_m();
double d2 = this.field_198041_f * (double)this.field_198036_a.field_195558_d.func_198087_p() / (double)this.field_198036_a.field_195558_d.func_198083_n();
@@ -38,7 +45,7 @@
} else if (this.field_198036_a.field_71439_g != null) {
if (this.field_200542_o != 0.0D && Math.signum(d0) != Math.signum(this.field_200542_o)) {
this.field_200542_o = 0.0D;
@@ -129,6 +135,7 @@
@@ -129,6 +136,7 @@
}
this.field_200542_o -= (double)f1;
@@ -46,7 +53,7 @@
if (this.field_198036_a.field_71439_g.func_175149_v()) {
if (this.field_198036_a.field_71456_v.func_175187_g().func_175262_a()) {
this.field_198036_a.field_71456_v.func_175187_g().func_195621_a((double)(-f1));
@@ -168,7 +175,9 @@
@@ -168,7 +176,9 @@
double d2 = (p_198022_3_ - this.field_198040_e) * (double)this.field_198036_a.field_195558_d.func_198107_o() / (double)this.field_198036_a.field_195558_d.func_198105_m();
double d3 = (p_198022_5_ - this.field_198041_f) * (double)this.field_198036_a.field_195558_d.func_198087_p() / (double)this.field_198036_a.field_195558_d.func_198083_n();
Screen.wrapScreenError(() -> {
@@ -57,7 +64,7 @@
}, "mouseDragged event handler", iguieventlistener.getClass().getCanonicalName());
}
}
@@ -233,6 +242,10 @@
@@ -233,6 +243,10 @@
return this.field_198039_d;
}
@@ -68,7 +75,7 @@
public double func_198024_e() {
return this.field_198040_e;
}
@@ -241,6 +254,14 @@
@@ -241,6 +255,14 @@
return this.field_198041_f;
}
@@ -8,19 +8,19 @@
this.field_147003_i = 160 + (this.width - this.field_146999_f - 200) / 2;
this.field_147045_u = true;
}
@@ -84,6 +85,7 @@
int i = this.field_147009_r;
@@ -59,7 +60,7 @@
j = 132 / (collection.size() - 1);
}
for(EffectInstance effectinstance : p_214077_3_) {
+ if (!effectinstance.func_188419_a().shouldRender(effectinstance)) continue;
Effect effect = effectinstance.func_188419_a();
blit(p_214077_1_ + 6, i + 7, this.blitOffset, 18, 18, potionspriteuploader.func_215288_a(effect));
i += p_214077_2_;
@@ -95,6 +97,9 @@
- Iterable<EffectInstance> iterable = Ordering.<EffectInstance>natural().sortedCopy(collection);
+ Iterable<EffectInstance> iterable = collection.stream().filter( effectInstance -> effectInstance.func_188419_a().shouldRender(effectInstance)).sorted().collect(java.util.stream.Collectors.toList());
this.func_214079_a(i, j, iterable);
this.func_214077_b(i, j, iterable);
this.func_214078_c(i, j, iterable);
@@ -95,6 +96,8 @@
int i = this.field_147009_r;
for(EffectInstance effectinstance : p_214078_3_) {
+ if (!effectinstance.func_188419_a().shouldRender(effectinstance)) continue;
+ effectinstance.func_188419_a().renderInventoryEffect(effectinstance, this, p_214078_1_, i, this.blitOffset);
+ if (!effectinstance.func_188419_a().shouldRenderInvText(effectinstance)) { i += p_214078_2_; continue; }
String s = I18n.func_135052_a(effectinstance.func_188419_a().func_76393_a());
@@ -48,7 +48,7 @@
if (this.field_73975_c != null) {
GlStateManager.pushMatrix();
GlStateManager.translatef((float)(this.width / 2 + 90), 70.0F, 0.0F);
@@ -222,7 +229,10 @@
@@ -222,7 +229,13 @@
s = s + ("release".equalsIgnoreCase(this.minecraft.func_184123_d()) ? "" : "/" + this.minecraft.func_184123_d());
}
@@ -57,10 +57,13 @@
+ this.drawString(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.field_78288_b + 1)), 16777215 | l)
+ );
+
+ net.minecraftforge.fml.BrandingControl.forEachAboveCopyrightLine((brdline, brd) ->
+ this.drawString(this.font, brd, this.width - font.func_78256_a(brd), this.height - (10 + (brdline + 1) * ( this.font.field_78288_b + 1)), 16777215 | l)
+ );
this.drawString(this.font, "Copyright Mojang AB. Do not distribute!", this.field_193979_N, this.height - 10, 16777215 | l);
if (p_render_1_ > this.field_193979_N && p_render_1_ < this.field_193979_N + this.field_193978_M && p_render_2_ > this.height - 10 && p_render_2_ < this.height) {
fill(this.field_193979_N, this.height - 1, this.field_193979_N + this.field_193978_M, this.height, 16777215 | l);
@@ -240,6 +250,7 @@
@@ -240,6 +253,7 @@
if (this.func_183501_a() && f1 >= 1.0F) {
this.field_183503_M.render(p_render_1_, p_render_2_, p_render_3_);
}
@@ -1,10 +1,18 @@
--- a/net/minecraft/client/multiplayer/ClientChunkProvider.java
+++ b/net/minecraft/client/multiplayer/ClientChunkProvider.java
@@ -72,6 +72,7 @@
if (this.field_217256_d.func_217183_b(p_212849_1_, p_212849_2_)) {
Chunk chunk = this.field_217256_d.func_217192_a(this.field_217256_d.func_217191_a(p_212849_1_, p_212849_2_));
if (func_217249_a(chunk, p_212849_1_, p_212849_2_)) {
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk));
return chunk;
@@ -61,6 +61,7 @@
int i = this.field_217256_d.func_217191_a(p_73234_1_, p_73234_2_);
Chunk chunk = this.field_217256_d.func_217192_a(i);
if (func_217249_a(chunk, p_73234_1_, p_73234_2_)) {
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Unload(chunk));
this.field_217256_d.func_217190_a(i, chunk, (Chunk)null);
}
@@ -113,6 +114,7 @@
worldlightmanager.func_215566_a(SectionPos.func_218154_a(p_217250_2_, j, p_217250_3_), ChunkSection.func_222628_a(chunksection));
}
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk));
return chunk;
}
}
@@ -37,7 +37,12 @@
if (flag && blockstate1.func_185903_a(this.field_78776_a.field_71439_g, this.field_78776_a.field_71439_g.field_70170_p, p_180511_1_) >= 1.0F) {
this.func_187103_a(p_180511_1_);
} else {
@@ -187,13 +193,13 @@
@@ -183,22 +189,24 @@
BlockState blockstate1 = this.field_78776_a.field_71441_e.func_180495_p(p_180512_1_);
this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180512_1_, blockstate1, 1.0F);
this.func_225324_a(CPlayerDiggingPacket.Action.START_DESTROY_BLOCK, p_180512_1_, p_180512_2_);
+ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180512_1_, p_180512_2_).isCanceled())
func_178891_a(this.field_78776_a, this, p_180512_1_, p_180512_2_);
return true;
} else if (this.func_178893_a(p_180512_1_)) {
BlockState blockstate = this.field_78776_a.field_71441_e.func_180495_p(p_180512_1_);
@@ -53,7 +58,13 @@
this.field_78776_a.func_147118_V().func_147682_a(new SimpleSound(soundtype.func_185846_f(), SoundCategory.NEUTRAL, (soundtype.func_185843_a() + 1.0F) / 8.0F, soundtype.func_185847_b() * 0.5F, p_180512_1_));
}
@@ -217,7 +223,8 @@
++this.field_78780_h;
this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180512_1_, blockstate, MathHelper.func_76131_a(this.field_78770_f, 0.0F, 1.0F));
+ if (net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180512_1_, p_180512_2_).getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true;
if (this.field_78770_f >= 1.0F) {
this.field_78778_j = false;
this.func_225324_a(CPlayerDiggingPacket.Action.STOP_DESTROY_BLOCK, p_180512_1_, p_180512_2_);
@@ -217,7 +225,8 @@
}
public float func_78757_d() {
@@ -63,7 +74,7 @@
}
public void func_78765_e() {
@@ -234,7 +241,7 @@
@@ -234,7 +243,7 @@
ItemStack itemstack = this.field_78776_a.field_71439_g.func_184614_ca();
boolean flag = this.field_85183_f.func_190926_b() && itemstack.func_190926_b();
if (!this.field_85183_f.func_190926_b() && !itemstack.func_190926_b()) {
@@ -72,7 +83,7 @@
}
return p_178893_1_.equals(this.field_178895_c) && flag;
@@ -257,6 +264,12 @@
@@ -257,17 +266,24 @@
return ActionResultType.FAIL;
} else {
ItemStack itemstack = p_217292_1_.func_184586_b(p_217292_3_);
@@ -85,7 +96,21 @@
if (this.field_78779_k == GameType.SPECTATOR) {
this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_));
return ActionResultType.SUCCESS;
@@ -298,11 +311,14 @@
} else {
boolean flag = !p_217292_1_.func_184614_ca().func_190926_b() || !p_217292_1_.func_184592_cb().func_190926_b();
- boolean flag1 = p_217292_1_.func_70093_af() && flag;
- if (!flag1 && p_217292_2_.func_180495_p(blockpos).func_215687_a(p_217292_2_, p_217292_1_, p_217292_3_, p_217292_4_)) {
+ boolean flag1 = !(p_217292_1_.func_70093_af() && flag) || (p_217292_1_.func_184614_ca().doesSneakBypassUse(p_217292_2_,blockpos,p_217292_1_) && p_217292_1_.func_184592_cb().doesSneakBypassUse(p_217292_2_,blockpos,p_217292_1_));
+ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && flag1 && p_217292_2_.func_180495_p(blockpos).func_215687_a(p_217292_2_, p_217292_1_, p_217292_3_, p_217292_4_)) {
this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_));
return ActionResultType.SUCCESS;
} else {
this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_));
+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return ActionResultType.PASS;
if (!itemstack.func_190926_b() && !p_217292_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) {
ItemUseContext itemusecontext = new ItemUseContext(p_217292_1_, p_217292_3_, p_217292_4_);
ActionResultType actionresulttype;
@@ -298,11 +314,14 @@
if (p_187101_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) {
return ActionResultType.PASS;
} else {
@@ -100,7 +125,7 @@
}
return actionresult.func_188397_a();
@@ -327,6 +343,9 @@
@@ -327,6 +346,9 @@
public ActionResultType func_187097_a(PlayerEntity p_187097_1_, Entity p_187097_2_, Hand p_187097_3_) {
this.func_78750_j();
this.field_78774_b.func_147297_a(new CUseEntityPacket(p_187097_2_, p_187097_3_));
@@ -110,7 +135,7 @@
return this.field_78779_k == GameType.SPECTATOR ? ActionResultType.PASS : p_187097_1_.func_190775_a(p_187097_2_, p_187097_3_);
}
@@ -334,6 +353,9 @@
@@ -334,6 +356,9 @@
this.func_78750_j();
Vec3d vec3d = p_187102_3_.func_216347_e().func_178786_a(p_187102_2_.field_70165_t, p_187102_2_.field_70163_u, p_187102_2_.field_70161_v);
this.field_78774_b.func_147297_a(new CUseEntityPacket(p_187102_2_, p_187102_4_, vec3d));
@@ -64,7 +64,7 @@
clientrecipebook.func_199644_c();
clientrecipebook.func_199642_d().forEach(imutablesearchtree::func_217872_a);
imutablesearchtree.func_194040_a();
+ net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated();
+ net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(this.field_199528_o);
}
public void func_200232_a(SPlayerLookPacket p_200232_1_) {
@@ -77,7 +77,15 @@
if (effect != null) {
EffectInstance effectinstance = new EffectInstance(effect, p_147260_1_.func_180755_e(), p_147260_1_.func_149428_f(), p_147260_1_.func_186984_g(), p_147260_1_.func_179707_f(), p_147260_1_.func_205527_h());
effectinstance.func_100012_b(p_147260_1_.func_149429_c());
@@ -1766,10 +1779,12 @@
@@ -1353,6 +1366,7 @@
}
this.field_147299_f.func_213253_a(SearchTreeManager.field_215360_b).func_194040_a();
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this.field_199725_m));
}
public void func_175098_a(SCombatPacket p_175098_1_) {
@@ -1766,10 +1780,12 @@
this.field_147299_f.field_184132_p.field_217741_m.func_217692_a(pointofinterestdebugrenderer$braininfo);
} else {
@@ -91,7 +99,7 @@
packetbuffer.release();
}
@@ -1909,7 +1924,7 @@
@@ -1909,7 +1925,7 @@
for(SEntityPropertiesPacket.Snapshot sentitypropertiespacket$snapshot : p_147290_1_.func_149441_d()) {
IAttributeInstance iattributeinstance = abstractattributemap.func_111152_a(sentitypropertiespacket$snapshot.func_151409_a());
if (iattributeinstance == null) {
@@ -39,7 +39,17 @@
this.field_187241_h.add(p_78873_1_);
}
@@ -342,7 +343,7 @@
@@ -306,7 +307,8 @@
Particle.field_70554_ao = p_215233_1_.func_216785_c().field_72448_b;
Particle.field_70555_ap = p_215233_1_.func_216785_c().field_72449_c;
- for(IParticleRenderType iparticlerendertype : field_215241_b) {
+ for(IParticleRenderType iparticlerendertype : this.field_78876_b.keySet()) { // Forge: allow custom IParticleRenderType's
+ if(iparticlerendertype == IParticleRenderType.field_217606_f) continue;
Iterable<Particle> iterable = this.field_78876_b.get(iparticlerendertype);
if (iterable != null) {
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
@@ -342,7 +344,7 @@
}
public void func_180533_a(BlockPos p_180533_1_, BlockState p_180533_2_) {
@@ -48,7 +58,7 @@
VoxelShape voxelshape = p_180533_2_.func_196954_c(this.field_78878_a, p_180533_1_);
double d0 = 0.25D;
voxelshape.func_197755_b((p_199284_3_, p_199284_5_, p_199284_7_, p_199284_9_, p_199284_11_, p_199284_13_) -> {
@@ -414,6 +415,12 @@
@@ -414,6 +416,12 @@
return String.valueOf(this.field_78876_b.values().stream().mapToInt(Collection::size).sum());
}
@@ -1,6 +1,17 @@
--- a/net/minecraft/client/renderer/ActiveRenderInfo.java
+++ b/net/minecraft/client/renderer/ActiveRenderInfo.java
@@ -172,4 +172,11 @@
@@ -53,6 +53,10 @@
this.func_216776_a(direction != null ? direction.func_185119_l() - 180.0F : 0.0F, 0.0F);
this.func_216782_a(0.0D, 0.3D, 0.0D);
}
+ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup cameraSetup = net.minecraftforge.client.ForgeHooksClient.onCameraSetup(net.minecraft.client.Minecraft.func_71410_x().field_71460_t, this, p_216772_5_, this.field_216798_j, this.field_216797_i, 0f);
+ this.field_216797_i = cameraSetup.getPitch();
+ this.field_216798_j = cameraSetup.getYaw();
+ GlStateManager.rotatef(cameraSetup.getRoll(), 0, 0, 1);
GlStateManager.rotatef(this.field_216797_i, 1.0F, 0.0F, 0.0F);
GlStateManager.rotatef(this.field_216798_j + 180.0F, 0.0F, 1.0F, 0.0F);
@@ -172,4 +176,11 @@
this.field_216791_c = null;
this.field_216789_a = false;
}
@@ -97,10 +97,12 @@
GlStateManager.popMatrix();
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
@@ -600,6 +608,15 @@
@@ -600,8 +608,17 @@
this.field_187471_h = MathHelper.func_76131_a(this.field_187471_h - 0.4F, 0.0F, 1.0F);
} else {
float f = clientplayerentity.func_184825_o(1.0F);
- this.field_187469_f += MathHelper.func_76131_a((Objects.equals(this.field_187467_d, itemstack) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F);
- this.field_187471_h += MathHelper.func_76131_a((float)(Objects.equals(this.field_187468_e, itemstack1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F);
+
+ boolean requipM = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187467_d, itemstack, clientplayerentity.field_71071_by.field_70461_c);
+ boolean requipO = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187468_e, itemstack1, -1);
@@ -110,6 +112,8 @@
+ if (!requipO && !Objects.equals(this.field_187468_e, itemstack1))
+ this.field_187468_e = itemstack1;
+
this.field_187469_f += MathHelper.func_76131_a((Objects.equals(this.field_187467_d, itemstack) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F);
this.field_187471_h += MathHelper.func_76131_a((float)(Objects.equals(this.field_187468_e, itemstack1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F);
+ this.field_187469_f += MathHelper.func_76131_a((!requipM ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F);
+ this.field_187471_h += MathHelper.func_76131_a((float)(!requipO ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F);
}
if (this.field_187469_f < 0.1F) {
@@ -47,7 +47,7 @@
BlockPos blockpos2 = chunkrender4.func_178568_j().func_177982_a(8, 8, 8);
boolean flag3 = blockpos2.func_177951_i(blockpos1) < 768.0D;
- if (!chunkrender4.func_188281_o() && !flag3) {
+ if (net.minecraftforge.common.ForgeMod.alwaysSetupTerrainOffThread || !chunkrender4.func_188281_o() && !flag3) {
+ if (net.minecraftforge.common.ForgeConfig.CLIENT.alwaysSetupTerrainOffThread.get() || !chunkrender4.func_188281_o() && !flag3) {
this.field_175009_l.add(chunkrender4);
} else {
this.field_72777_q.func_213239_aq().func_76320_a("build near");
@@ -102,15 +102,17 @@
GlStateManager.enableBlend();
GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.lineWidth(Math.max(2.5F, (float)this.field_72777_q.field_195558_d.func_198109_k() / 1920.0F * 2.5F));
@@ -1994,7 +2008,7 @@
@@ -1994,8 +2008,8 @@
break;
case 2001:
BlockState blockstate = Block.func_196257_b(p_180439_4_);
- if (!blockstate.func_196958_f()) {
- SoundType soundtype = blockstate.func_215695_r();
+ if (!blockstate.isAir(this.field_72769_h, p_180439_3_)) {
SoundType soundtype = blockstate.func_215695_r();
+ SoundType soundtype = blockstate.getSoundType(field_72769_h, p_180439_3_, null);
this.field_72769_h.func_184156_a(p_180439_3_, soundtype.func_185845_c(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F, false);
}
@@ -2118,6 +2132,11 @@
}
}
@@ -7,11 +7,11 @@
+ @Deprecated
public static BlockModelDefinition func_209577_a(BlockModelDefinition.ContainerHolder p_209577_0_, Reader p_209577_1_) {
- return JSONUtils.func_193839_a(p_209577_0_.field_209575_a, p_209577_1_, BlockModelDefinition.class);
+ return fromJson(p_209577_0_, p_209577_1_, null);
+ return fromJson(p_209577_0_, p_209577_1_, null, null, null);
}
+ public static BlockModelDefinition fromJson(BlockModelDefinition.ContainerHolder containerHolderIn, Reader readerIn, @Nullable net.minecraft.util.ResourceLocation location) {
+ return net.minecraftforge.client.model.BlockStateLoader.load(readerIn, location, containerHolderIn.field_209575_a);
+ public static BlockModelDefinition fromJson(BlockModelDefinition.ContainerHolder containerHolderIn, Reader readerIn, @Nullable net.minecraft.util.ResourceLocation location, @Nullable ModelBakery bakery, @Nullable java.util.function.BiConsumer<net.minecraft.util.ResourceLocation, IUnbakedModel> modelConsumer) {
+ return net.minecraftforge.client.model.BlockStateLoader.load(readerIn, location, containerHolderIn.field_209575_a, bakery, modelConsumer);
+ }
+
public BlockModelDefinition(Map<String, VariantList> p_i46572_1_, Multipart p_i46572_2_) {
@@ -8,8 +8,26 @@
+ private final Map<Triple<ResourceLocation, net.minecraftforge.common.model.IModelState, Boolean>, IBakedModel> field_217850_G = Maps.newHashMap();
private final Map<ResourceLocation, IUnbakedModel> field_217851_H = Maps.newHashMap();
private final Map<ResourceLocation, IBakedModel> field_217852_I = Maps.newHashMap();
private final AtlasTexture.SheetData field_217853_J;
@@ -142,12 +142,19 @@
private AtlasTexture.SheetData field_217853_J;
@@ -107,9 +107,17 @@
});
public ModelBakery(IResourceManager p_i51735_1_, AtlasTexture p_i51735_2_, BlockColors p_i51735_3_, IProfiler p_i51735_4_) {
+ this(p_i51735_1_, p_i51735_2_, p_i51735_3_, true);
+ processLoading(p_i51735_4_);
+ }
+
+ protected ModelBakery(IResourceManager p_i51735_1_, AtlasTexture p_i51735_2_, BlockColors p_i51735_3_, boolean vanillaBakery) {
this.field_177598_f = p_i51735_1_;
this.field_177609_j = p_i51735_2_;
this.field_225365_D = p_i51735_3_;
+ }
+
+ protected void processLoading(IProfiler p_i51735_4_) {
p_i51735_4_.func_76320_a("missing_model");
try {
@@ -142,12 +150,19 @@
p_i51735_4_.func_219895_b("special");
this.func_217843_a(new ModelResourceLocation("minecraft:trident_in_hand#inventory"));
@@ -29,16 +47,16 @@
set.forEach((p_217833_0_) -> {
field_177603_c.warn("Unable to resolve texture reference: {}", (Object)p_217833_0_);
});
@@ -288,7 +295,7 @@
@@ -288,7 +303,7 @@
{
lvt_13_5_ = this.field_177598_f.func_199004_b(resourcelocation1).stream().map((p_217839_1_) -> {
try (InputStream inputstream = p_217839_1_.func_199027_b()) {
- Pair<String, BlockModelDefinition> pair2 = Pair.of(p_217839_1_.func_199026_d(), BlockModelDefinition.func_209577_a(this.field_209610_F, new InputStreamReader(inputstream, StandardCharsets.UTF_8)));
+ Pair<String, BlockModelDefinition> pair2 = Pair.of(p_217839_1_.func_199026_d(), BlockModelDefinition.fromJson(this.field_209610_F, new InputStreamReader(inputstream, StandardCharsets.UTF_8), p_209598_1_));
+ Pair<String, BlockModelDefinition> pair2 = Pair.of(p_217839_1_.func_199026_d(), BlockModelDefinition.fromJson(this.field_209610_F, new InputStreamReader(inputstream, StandardCharsets.UTF_8), p_209598_1_, this, this::func_209593_a));
return pair2;
} catch (Exception exception1) {
throw new ModelBakery.BlockStateDefinitionException(String.format("Exception loading blockstate definition: '%s' in resourcepack: '%s': %s", p_217839_1_.func_199029_a(), p_217839_1_.func_199026_d(), exception1.getMessage()));
@@ -404,7 +411,12 @@
@@ -404,7 +419,12 @@
@Nullable
public IBakedModel func_217845_a(ResourceLocation p_217845_1_, ISprite p_217845_2_) {
@@ -52,7 +70,7 @@
if (this.field_217850_G.containsKey(triple)) {
return this.field_217850_G.get(triple);
} else {
@@ -412,11 +424,11 @@
@@ -412,11 +432,11 @@
if (iunbakedmodel instanceof BlockModel) {
BlockModel blockmodel = (BlockModel)iunbakedmodel;
if (blockmodel.func_178310_f() == field_177606_o) {
@@ -66,7 +84,7 @@
this.field_217850_G.put(triple, ibakedmodel);
return ibakedmodel;
}
@@ -471,6 +483,10 @@
@@ -471,6 +491,10 @@
return this.field_225367_M;
}
@@ -9,7 +9,7 @@
private final ResourceLocation field_188050_a;
private final ModelRotation field_188051_b;
private final boolean field_188052_c;
@@ -30,10 +30,16 @@
@@ -30,6 +30,7 @@
return this.field_188050_a;
}
@@ -17,12 +17,3 @@
public ModelRotation func_188048_b() {
return this.field_188051_b;
}
+ @Override
+ public net.minecraftforge.common.model.IModelState getState() {
+ return this.field_188051_b;
+ }
+
public boolean func_188049_c() {
return this.field_188052_c;
}
@@ -0,0 +1,29 @@
--- a/net/minecraft/client/renderer/texture/NativeImage.java
+++ b/net/minecraft/client/renderer/texture/NativeImage.java
@@ -172,7 +172,7 @@
public int func_195709_a(int p_195709_1_, int p_195709_2_) {
if (this.field_211680_b != NativeImage.PixelFormat.RGBA) {
throw new IllegalArgumentException(String.format("getPixelRGBA only works on RGBA images; have %s", this.field_211680_b));
- } else if (p_195709_1_ <= this.field_195719_a && p_195709_2_ <= this.field_195720_b) {
+ } else if (p_195709_1_ >= 0 && p_195709_2_ >= 0 && p_195709_1_ < this.field_195719_a && p_195709_2_ < this.field_195720_b) { //Fix MC-162953 bounds checks in `NativeImage`
this.func_195696_g();
return MemoryUtil.memIntBuffer(this.field_195722_d, this.field_195723_e).get(p_195709_1_ + p_195709_2_ * this.field_195719_a);
} else {
@@ -183,7 +183,7 @@
public void func_195700_a(int p_195700_1_, int p_195700_2_, int p_195700_3_) {
if (this.field_211680_b != NativeImage.PixelFormat.RGBA) {
throw new IllegalArgumentException(String.format("getPixelRGBA only works on RGBA images; have %s", this.field_211680_b));
- } else if (p_195700_1_ <= this.field_195719_a && p_195700_2_ <= this.field_195720_b) {
+ } else if (p_195700_1_ >= 0 && p_195700_2_ >= 0 && p_195700_1_ < this.field_195719_a && p_195700_2_ < this.field_195720_b) { //Fix MC-162953 bounds checks in `NativeImage`
this.func_195696_g();
MemoryUtil.memIntBuffer(this.field_195722_d, this.field_195723_e).put(p_195700_1_ + p_195700_2_ * this.field_195719_a, p_195700_3_);
} else {
@@ -194,7 +194,7 @@
public byte func_211675_e(int p_211675_1_, int p_211675_2_) {
if (!this.field_211680_b.func_211653_r()) {
throw new IllegalArgumentException(String.format("no luminance or alpha in %s", this.field_211680_b));
- } else if (p_211675_1_ <= this.field_195719_a && p_211675_2_ <= this.field_195720_b) {
+ } else if (p_211675_1_ >= 0 && p_211675_2_ >= 0 && p_211675_1_ < this.field_195719_a && p_211675_2_ < this.field_195720_b) { //Fix MC-162953 bounds checks in `NativeImage`
return MemoryUtil.memByteBuffer(this.field_195722_d, this.field_195723_e).get((p_211675_1_ + p_211675_2_ * this.field_195719_a) * this.field_211680_b.func_211651_a() + this.field_211680_b.func_211647_v() / 8);
} else {
throw new IllegalArgumentException(String.format("(%s, %s) outside of image bounds (%s, %s)", p_211675_1_, p_211675_2_, this.field_195719_a, this.field_195720_b));
@@ -0,0 +1,47 @@
--- a/net/minecraft/data/LootTableProvider.java
+++ b/net/minecraft/data/LootTableProvider.java
@@ -42,7 +42,7 @@
public void func_200398_a(DirectoryCache p_200398_1_) {
Path path = this.field_218443_d.func_200391_b();
Map<ResourceLocation, LootTable> map = Maps.newHashMap();
- this.field_218444_e.forEach((p_218438_1_) -> {
+ this.getTables().forEach((p_218438_1_) -> {
p_218438_1_.getFirst().get().accept((p_218437_2_, p_218437_3_) -> {
if (map.put(p_218437_2_, p_218437_3_.func_216039_a(p_218438_1_.getSecond()).func_216038_b()) != null) {
throw new IllegalStateException("Duplicate loot table " + p_218437_2_);
@@ -51,13 +51,8 @@
});
ValidationResults validationresults = new ValidationResults();
- for(ResourceLocation resourcelocation : Sets.difference(LootTables.func_215796_a(), map.keySet())) {
- validationresults.func_216105_a("Missing built-in table: " + resourcelocation);
- }
+ validate(map, validationresults);
- map.forEach((p_218436_2_, p_218436_3_) -> {
- LootTableManager.func_215302_a(validationresults, p_218436_2_, p_218436_3_, map::get);
- });
Multimap<String, String> multimap = validationresults.func_216106_a();
if (!multimap.isEmpty()) {
multimap.forEach((p_218435_0_, p_218435_1_) -> {
@@ -78,6 +73,20 @@
}
}
+ protected List<Pair<Supplier<Consumer<BiConsumer<ResourceLocation, LootTable.Builder>>>, LootParameterSet>> getTables() {
+ return field_218444_e;
+ }
+
+ protected void validate(Map<ResourceLocation, LootTable> map, ValidationResults validationresults) {
+ for(ResourceLocation resourcelocation : Sets.difference(LootTables.func_215796_a(), map.keySet())) {
+ validationresults.func_216105_a("Missing built-in table: " + resourcelocation);
+ }
+
+ map.forEach((p_218436_2_, p_218436_3_) -> {
+ LootTableManager.func_215302_a(validationresults, p_218436_2_, p_218436_3_, map::get);
+ });
+ }
+
private static Path func_218439_a(Path p_218439_0_, ResourceLocation p_218439_1_) {
return p_218439_0_.resolve("data/" + p_218439_1_.func_110624_b() + "/loot_tables/" + p_218439_1_.func_110623_a() + ".json");
}
@@ -7,10 +7,11 @@
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -21,8 +22,10 @@
@@ -21,8 +22,11 @@
OptionSpec<Void> optionspec6 = optionparser.accepts("all", "Include all generators");
OptionSpec<String> optionspec7 = optionparser.accepts("output", "Output folder").withRequiredArg().defaultsTo("generated");
OptionSpec<String> optionspec8 = optionparser.accepts("input", "Input folder").withRequiredArg();
+ OptionSpec<String> existing = optionparser.accepts("existing", "Existing resource packs that generated resources can reference").withRequiredArg();
+ OptionSpec<File> gameDir = optionparser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File(".")).required();
+ OptionSpec<String> mod = optionparser.accepts("mod", "A modid to dump").withRequiredArg().withValuesSeparatedBy(",");
OptionSet optionset = optionparser.parse(p_main_0_);
@@ -19,7 +20,7 @@
Path path = Paths.get(optionspec7.value(optionset));
boolean flag = optionset.has(optionspec6);
boolean flag1 = flag || optionset.has(optionspec2);
@@ -30,10 +33,11 @@
@@ -30,10 +34,12 @@
boolean flag3 = flag || optionset.has(optionspec3);
boolean flag4 = flag || optionset.has(optionspec4);
boolean flag5 = flag || optionset.has(optionspec5);
@@ -28,8 +29,9 @@
- }).collect(Collectors.toList()), flag1, flag2, flag3, flag4, flag5);
- datagenerator.func_200392_c();
+ Collection<Path> inputs = optionset.valuesOf(optionspec8).stream().map(Paths::get).collect(Collectors.toList());
+ Collection<Path> existingPacks = optionset.valuesOf(existing).stream().map(Paths::get).collect(Collectors.toList());
+ java.util.Set<String> mods = new java.util.HashSet<>(optionset.valuesOf(mod));
+ net.minecraftforge.fml.ModLoader.get().runDataGenerator(mods, path, inputs, flag2, flag1, flag3, flag4, flag5);
+ net.minecraftforge.fml.ModLoader.get().runDataGenerator(mods, path, inputs, existingPacks, flag2, flag1, flag3, flag4, flag5);
+ if (mods.contains("minecraft") || mods.isEmpty())
+ func_200264_a(mods.isEmpty() ? path : path.resolve("minecraft"), inputs, flag1, flag2, flag3, flag4, flag5).func_200392_c();
} else {
@@ -0,0 +1,37 @@
--- a/net/minecraft/data/loot/BlockLootTables.java
+++ b/net/minecraft/data/loot/BlockLootTables.java
@@ -188,7 +188,7 @@
return LootTable.func_216119_b();
}
- public void accept(BiConsumer<ResourceLocation, LootTable.Builder> p_accept_1_) {
+ protected void addTables() {
this.func_218492_c(Blocks.field_196650_c);
this.func_218492_c(Blocks.field_196652_d);
this.func_218492_c(Blocks.field_196654_e);
@@ -962,9 +962,13 @@
this.func_218507_a(Blocks.field_196713_dt, func_218482_a());
this.func_218507_a(Blocks.field_185778_de, func_218482_a());
this.func_218507_a(Blocks.field_150474_ac, func_218482_a());
+ }
+
+ public void accept(BiConsumer<ResourceLocation, LootTable.Builder> p_accept_1_) {
+ this.addTables();
Set<ResourceLocation> set = Sets.newHashSet();
- for(Block block : Registry.field_212618_g) {
+ for(Block block : getKnownBlocks()) {
ResourceLocation resourcelocation = block.func_220068_i();
if (resourcelocation != LootTables.field_186419_a && set.add(resourcelocation)) {
LootTable.Builder loottable$builder = this.field_218581_i.remove(resourcelocation);
@@ -981,6 +985,10 @@
}
}
+ protected Iterable<Block> getKnownBlocks() {
+ return Registry.field_212618_g;
+ }
+
public void func_218547_a(Block p_218547_1_) {
this.func_218522_a(p_218547_1_, (p_218524_0_) -> {
return func_218523_c(((FlowerPotBlock)p_218524_0_).func_220276_d());
@@ -0,0 +1,49 @@
--- a/net/minecraft/data/loot/EntityLootTables.java
+++ b/net/minecraft/data/loot/EntityLootTables.java
@@ -51,7 +51,7 @@
return LootTable.func_216119_b().func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(p_218583_0_))).func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(TableLootEntry.func_216171_a(EntityType.field_200737_ac.func_220348_g())));
}
- public void accept(BiConsumer<ResourceLocation, LootTable.Builder> p_accept_1_) {
+ protected void addTables() {
this.func_218582_a(EntityType.field_200789_c, LootTable.func_216119_b());
this.func_218582_a(EntityType.field_200791_e, LootTable.func_216119_b());
this.func_218582_a(EntityType.field_200792_f, LootTable.func_216119_b().func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151072_bj).func_212841_b_(SetCount.func_215932_a(RandomValueRange.func_215837_a(0.0F, 1.0F))).func_212841_b_(LootingEnchantBonus.func_215915_a(RandomValueRange.func_215837_a(0.0F, 1.0F)))).func_212840_b_(KilledByPlayer.func_215994_b())));
@@ -136,8 +136,12 @@
this.func_218582_a(EntityType.field_200726_aE, LootTable.func_216119_b().func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151078_bh).func_212841_b_(SetCount.func_215932_a(RandomValueRange.func_215837_a(0.0F, 2.0F))).func_212841_b_(LootingEnchantBonus.func_215915_a(RandomValueRange.func_215837_a(0.0F, 1.0F))))));
this.func_218582_a(EntityType.field_200785_Y, LootTable.func_216119_b().func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151078_bh).func_212841_b_(SetCount.func_215932_a(RandomValueRange.func_215837_a(0.0F, 1.0F))).func_212841_b_(LootingEnchantBonus.func_215915_a(RandomValueRange.func_215837_a(0.0F, 1.0F))))).func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151074_bl).func_212841_b_(SetCount.func_215932_a(RandomValueRange.func_215837_a(0.0F, 1.0F))).func_212841_b_(LootingEnchantBonus.func_215915_a(RandomValueRange.func_215837_a(0.0F, 1.0F))))).func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151043_k)).func_212840_b_(KilledByPlayer.func_215994_b()).func_212840_b_(RandomChanceWithLooting.func_216003_a(0.025F, 0.01F))));
this.func_218582_a(EntityType.field_200727_aF, LootTable.func_216119_b().func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151078_bh).func_212841_b_(SetCount.func_215932_a(RandomValueRange.func_215837_a(0.0F, 2.0F))).func_212841_b_(LootingEnchantBonus.func_215915_a(RandomValueRange.func_215837_a(0.0F, 1.0F))))).func_216040_a(LootPool.func_216096_a().func_216046_a(ConstantRange.func_215835_a(1)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151042_j)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151172_bF)).func_216045_a(ItemLootEntry.func_216168_a(Items.field_151174_bG)).func_212840_b_(KilledByPlayer.func_215994_b()).func_212840_b_(RandomChanceWithLooting.func_216003_a(0.025F, 0.01F))));
+ }
+
+ public void accept(BiConsumer<ResourceLocation, LootTable.Builder> p_accept_1_) {
+ this.addTables();
Set<ResourceLocation> set = Sets.newHashSet();
- Iterator iterator = Registry.field_212629_r.iterator();
+ Iterator iterator = getKnownEntities().iterator();
EntityType<?> entitytype;
ResourceLocation resourcelocation;
@@ -149,7 +153,7 @@
entitytype = (EntityType)iterator.next();
resourcelocation = entitytype.func_220348_g();
- if (!field_222944_b.contains(entitytype) && entitytype.func_220339_d() == EntityClassification.MISC) {
+ if (isNonLiving(entitytype)) {
if (resourcelocation != LootTables.field_186419_a && this.field_218587_b.remove(resourcelocation) != null) {
break;
}
@@ -166,6 +170,14 @@
throw new IllegalStateException(String.format("Weird loottable '%s' for '%s', not a LivingEntity so should not have loot", resourcelocation, Registry.field_212629_r.func_177774_c(entitytype)));
}
+ protected Iterable<EntityType<?>> getKnownEntities() {
+ return Registry.field_212629_r;
+ }
+
+ protected boolean isNonLiving(EntityType<?> entitytype) {
+ return !field_222944_b.contains(entitytype) && entitytype.func_220339_d() == EntityClassification.MISC;
+ }
+
protected void func_218582_a(EntityType<?> p_218582_1_, LootTable.Builder p_218582_2_) {
this.func_218585_a(p_218582_1_.func_220348_g(), p_218582_2_);
}
@@ -1,6 +1,18 @@
--- a/net/minecraft/dispenser/IDispenseItemBehavior.java
+++ b/net/minecraft/dispenser/IDispenseItemBehavior.java
@@ -370,15 +370,23 @@
@@ -270,8 +270,9 @@
world.func_175656_a(blockpos, Blocks.field_150480_ab.func_176223_P());
} else if (FlintAndSteelItem.func_219997_a(blockstate)) {
world.func_175656_a(blockpos, blockstate.func_206870_a(BlockStateProperties.field_208190_q, Boolean.valueOf(true)));
- } else if (blockstate.func_177230_c() instanceof TNTBlock) {
- TNTBlock.func_196534_a(world, blockpos);
+ } else if (blockstate.isFlammable(world, blockpos, p_82487_1_.func_189992_e().func_177229_b(DispenserBlock.field_176441_a).func_176734_d())) {
+ blockstate.catchFire(world, blockpos, p_82487_1_.func_189992_e().func_177229_b(DispenserBlock.field_176441_a).func_176734_d(), null);
+ if (blockstate.func_177230_c() instanceof TNTBlock)
world.func_217377_a(blockpos, false);
} else {
this.field_218407_b = false;
@@ -370,15 +371,23 @@
}
DispenserBlock.func_199774_a(Items.field_151097_aZ.func_199767_j(), new OptionalDispenseBehavior() {
@@ -109,7 +109,7 @@
if (!p_180429_2_.func_185904_a().func_76224_d()) {
BlockState blockstate = this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a());
- SoundType soundtype = blockstate.func_177230_c() == Blocks.field_150433_aE ? blockstate.func_215695_r() : p_180429_2_.func_215695_r();
+ SoundType soundtype = blockstate.func_177230_c() == Blocks.field_150433_aE ? blockstate.func_215695_r() : p_180429_2_.getSoundType(field_70170_p, p_180429_1_, this);
+ SoundType soundtype = blockstate.func_177230_c() == Blocks.field_150433_aE ? blockstate.getSoundType(field_70170_p, p_180429_1_, this) : p_180429_2_.getSoundType(field_70170_p, p_180429_1_, this);
this.func_184185_a(soundtype.func_185844_d(), soundtype.func_185843_a() * 0.15F, soundtype.func_185847_b());
}
}
@@ -85,7 +85,7 @@
}
+ public T customClientSpawn(net.minecraftforge.fml.network.FMLPlayMessages.SpawnEntity packet, World world) {
+ if (customClientFactory == null) throw new RuntimeException("Missing custom spawn data for entity type "+this);
+ if (customClientFactory == null) return this.func_200721_a(world);
+ return customClientFactory.apply(packet, world);
+ }
+
@@ -111,7 +111,7 @@
private boolean field_225436_f;
private EntitySize field_220326_f = EntitySize.func_220314_b(0.6F, 1.8F);
@@ -553,11 +591,31 @@
@@ -553,11 +591,35 @@
return this;
}
@@ -130,6 +130,10 @@
+ return this;
+ }
+
+ /**
+ * By default, entities are spawned clientside via {@link EntityType#create(World)}.
+ * If you need finer control over the spawning process, use this to get read access to the spawn packet.
+ */
+ public EntityType.Builder<T> setCustomClientFactory(java.util.function.BiFunction<net.minecraftforge.fml.network.FMLPlayMessages.SpawnEntity, World, T> customClientFactory) {
+ this.customClientFactory = customClientFactory;
+ return this;
@@ -144,7 +148,7 @@
if (SharedConstants.field_206244_b) {
throw illegalstateexception;
}
@@ -566,7 +624,7 @@
@@ -566,7 +628,7 @@
}
}
@@ -31,15 +31,18 @@
}
public double func_70042_X() {
@@ -214,7 +216,7 @@
@@ -214,9 +216,9 @@
BlockPos blockpos = new BlockPos(i, j, k);
BlockState blockstate = this.field_70170_p.func_180495_p(blockpos);
- if (blockstate.func_203425_a(BlockTags.field_203437_y)) {
+ if (canUseRail() && blockstate.func_203425_a(BlockTags.field_203437_y)) {
this.func_180460_a(blockpos, blockstate);
if (blockstate.func_177230_c() == Blocks.field_150408_cc) {
- if (blockstate.func_177230_c() == Blocks.field_150408_cc) {
+ if (blockstate.func_177230_c() instanceof PoweredRailBlock && ((PoweredRailBlock)blockstate.func_177230_c()).isActivatorRail()) {
this.func_96095_a(i, j, k, blockstate.func_177229_b(PoweredRailBlock.field_176569_M));
}
} else {
@@ -241,8 +243,11 @@
}
@@ -98,7 +101,13 @@
}
}
@@ -299,24 +313,24 @@
@@ -294,29 +308,29 @@
boolean flag = false;
boolean flag1 = false;
AbstractRailBlock abstractrailblock = (AbstractRailBlock)p_180460_2_.func_177230_c();
- if (abstractrailblock == Blocks.field_196552_aC) {
+ if (abstractrailblock instanceof PoweredRailBlock && !((PoweredRailBlock)abstractrailblock).isActivatorRail()) {
flag = p_180460_2_.func_177229_b(PoweredRailBlock.field_176569_M);
flag1 = !flag;
}
@@ -239,7 +248,7 @@
+ public void moveMinecartOnRail(BlockPos pos) { //Non-default because getMaximumSpeed is protected
+ AbstractMinecartEntity mc = getMinecart();
+ double d21 = mc.func_184207_aI() ? 0.75D : 1.0D;
+ double d22 = mc.func_174898_m();
+ double d22 = mc.getMaxSpeedWithRail();
+ Vec3d vec3d1 = mc.func_213322_ci();
+ mc.func_213315_a(MoverType.SELF, new Vec3d(MathHelper.func_151237_a(d21 * vec3d1.field_72450_a, -d22, d22), 0.0D, MathHelper.func_151237_a(d21 * vec3d1.field_72449_c, -d22, d22)));
+ }
@@ -1,6 +1,19 @@
--- a/net/minecraft/entity/passive/FoxEntity.java
+++ b/net/minecraft/entity/passive/FoxEntity.java
@@ -767,7 +767,7 @@
@@ -573,9 +573,10 @@
}
}
- BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(this.field_70165_t, this.field_70163_u - 0.2D - (double)this.field_70126_B, this.field_70161_v));
+ BlockPos pos = new BlockPos(this.field_70165_t, this.field_70163_u - 0.2D - (double)this.field_70126_B, this.field_70161_v);
+ BlockState blockstate = this.field_70170_p.func_180495_p(pos);
if (!blockstate.func_196958_f() && !this.func_174814_R()) {
- SoundType soundtype = blockstate.func_215695_r();
+ SoundType soundtype = blockstate.getSoundType(field_70170_p, pos, this);
this.field_70170_p.func_184148_a((PlayerEntity)null, this.field_70165_t, this.field_70163_u, this.field_70161_v, soundtype.func_185844_d(), this.func_184176_by(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F);
}
@@ -767,7 +768,7 @@
}
protected void func_220730_m() {
@@ -42,7 +42,7 @@
+ }
+ this.field_70170_p.func_217376_c(entitycow);
+ for(int i = 0; i < 5; ++i) {
+ ret.add(new ItemStack(Blocks.field_150337_Q));
+ ret.add(new ItemStack(this.func_213444_dV().field_221099_d.func_177230_c()));
+ }
+ this.func_184185_a(SoundEvents.field_187784_dt, 1.0F, 1.0F);
+ }
@@ -26,7 +26,7 @@
public void func_213612_dV() {
if (!this.field_70170_p.field_72995_K) {
this.func_70893_e(true);
@@ -353,4 +354,23 @@
@@ -353,4 +354,24 @@
protected float func_213348_b(Pose p_213348_1_, EntitySize p_213348_2_) {
return 0.95F * p_213348_2_.field_220316_b;
}
@@ -47,6 +47,7 @@
+ ret.add(new ItemStack(field_200206_bz.get(this.func_175509_cj())));
+ }
+ }
+ this.func_184185_a(SoundEvents.field_187763_eJ, 1.0F, 1.0F);
+ return ret;
+ }
}
@@ -1,6 +1,19 @@
--- a/net/minecraft/entity/passive/horse/AbstractHorseEntity.java
+++ b/net/minecraft/entity/passive/horse/AbstractHorseEntity.java
@@ -260,6 +260,7 @@
@@ -230,9 +230,10 @@
}
}
- BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(this.field_70165_t, this.field_70163_u - 0.2D - (double)this.field_70126_B, this.field_70161_v));
+ BlockPos pos = new BlockPos(this.field_70165_t, this.field_70163_u - 0.2D - (double) this.field_70126_B, this.field_70161_v);
+ BlockState blockstate = this.field_70170_p.func_180495_p(pos);
if (!blockstate.func_196958_f() && !this.func_174814_R()) {
- SoundType soundtype = blockstate.func_215695_r();
+ SoundType soundtype = blockstate.getSoundType(field_70170_p, pos, this);
this.field_70170_p.func_184148_a((PlayerEntity)null, this.field_70165_t, this.field_70163_u, this.field_70161_v, soundtype.func_185844_d(), this.func_184176_by(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F);
}
@@ -260,6 +261,7 @@
this.field_110296_bG.func_110134_a(this);
this.func_110232_cE();
@@ -8,7 +21,19 @@
}
protected void func_110232_cE() {
@@ -944,4 +945,22 @@
@@ -321,9 +323,9 @@
protected void func_180429_a(BlockPos p_180429_1_, BlockState p_180429_2_) {
if (!p_180429_2_.func_185904_a().func_76224_d()) {
BlockState blockstate = this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a());
- SoundType soundtype = p_180429_2_.func_215695_r();
+ SoundType soundtype = p_180429_2_.getSoundType(field_70170_p, p_180429_1_, this);
if (blockstate.func_177230_c() == Blocks.field_150433_aE) {
- soundtype = blockstate.func_215695_r();
+ soundtype = blockstate.getSoundType(field_70170_p, p_180429_1_, this);
}
if (this.func_184207_aI() && this.field_190688_bE) {
@@ -944,4 +946,22 @@
return p_213386_4_;
}
@@ -0,0 +1,15 @@
--- a/net/minecraft/entity/passive/horse/LlamaEntity.java
+++ b/net/minecraft/entity/passive/horse/LlamaEntity.java
@@ -364,9 +364,10 @@
}
}
- BlockState blockstate = this.field_70170_p.func_180495_p(new BlockPos(this.field_70165_t, this.field_70163_u - 0.2D - (double)this.field_70126_B, this.field_70161_v));
+ BlockPos pos = new BlockPos(this.field_70165_t, this.field_70163_u - 0.2D - (double)this.field_70126_B, this.field_70161_v);
+ BlockState blockstate = this.field_70170_p.func_180495_p(pos);
if (!blockstate.func_196958_f() && !this.func_174814_R()) {
- SoundType soundtype = blockstate.func_215695_r();
+ SoundType soundtype = blockstate.getSoundType(field_70170_p, pos, this);
this.field_70170_p.func_184148_a((PlayerEntity)null, this.field_70165_t, this.field_70163_u, this.field_70161_v, soundtype.func_185844_d(), this.func_184176_by(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F);
}
@@ -425,7 +425,29 @@
}
}
@@ -1703,7 +1818,10 @@
@@ -1462,6 +1577,10 @@
}
public void func_195068_e(int p_195068_1_) {
+ net.minecraftforge.event.entity.player.PlayerXpEvent.XpChange event = new net.minecraftforge.event.entity.player.PlayerXpEvent.XpChange(this, p_195068_1_);
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
+ p_195068_1_ = event.getAmount();
+
this.func_85039_t(p_195068_1_);
this.field_71106_cc += (float)p_195068_1_ / (float)this.func_71050_bK();
this.field_71067_cb = MathHelper.func_76125_a(this.field_71067_cb + p_195068_1_, 0, Integer.MAX_VALUE);
@@ -1501,6 +1620,10 @@
}
public void func_82242_a(int p_82242_1_) {
+ net.minecraftforge.event.entity.player.PlayerXpEvent.LevelChange event = new net.minecraftforge.event.entity.player.PlayerXpEvent.LevelChange(this, p_82242_1_);
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
+ p_82242_1_ = event.getLevels();
+
this.field_71068_ca += p_82242_1_;
if (this.field_71068_ca < 0) {
this.field_71068_ca = 0;
@@ -1703,7 +1826,10 @@
}
public ITextComponent func_145748_c_() {
@@ -437,7 +459,7 @@
return this.func_208016_c(itextcomponent);
}
@@ -1939,4 +2057,44 @@
@@ -1939,4 +2065,44 @@
return this.field_221260_g;
}
}
@@ -17,7 +17,7 @@
BlockPos blockpos = new BlockPos(this.field_70165_t, this.field_70163_u, this.field_70161_v);
BlockState blockstate = Blocks.field_222388_bz.func_176223_P();
if (this.field_70170_p.func_180495_p(blockpos).func_196958_f() && blockstate.func_196955_c(this.field_70170_p, blockpos)) {
@@ -568,8 +569,10 @@
@@ -568,13 +569,15 @@
return this.field_71133_b.func_71219_W();
}
@@ -28,7 +28,18 @@
this.field_184851_cj = true;
DimensionType dimensiontype = this.field_71093_bK;
if (dimensiontype == DimensionType.field_223229_c_ && p_212321_1_ == DimensionType.field_223227_a_) {
@@ -591,8 +594,8 @@
this.func_213319_R();
- this.func_71121_q().func_217434_e(this);
+ this.func_71121_q().removePlayer(this, true); //Forge: The player entity is cloned so keep the data until after cloning calls copyFrom
if (!this.field_71136_j) {
this.field_71136_j = true;
this.field_71135_a.func_147359_a(new SChangeGameStatePacket(4, this.field_192040_cp ? 0.0F : 1.0F));
@@ -587,12 +590,13 @@
this.field_71093_bK = p_212321_1_;
ServerWorld serverworld1 = this.field_71133_b.func_71218_a(p_212321_1_);
WorldInfo worldinfo = this.field_70170_p.func_72912_H();
+ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(this.field_71135_a.field_147371_a, this);
this.field_71135_a.func_147359_a(new SRespawnPacket(p_212321_1_, worldinfo.func_76067_t(), this.field_71134_c.func_73081_b()));
this.field_71135_a.func_147359_a(new SServerDifficultyPacket(worldinfo.func_176130_y(), worldinfo.func_176123_z()));
PlayerList playerlist = this.field_71133_b.func_184103_al();
playerlist.func_187243_f(this);
@@ -39,7 +50,7 @@
double d0 = this.field_70165_t;
double d1 = this.field_70163_u;
double d2 = this.field_70161_v;
@@ -601,13 +604,11 @@
@@ -601,13 +605,11 @@
double d3 = 8.0D;
float f2 = f1;
serverworld.func_217381_Z().func_76320_a("moving");
@@ -56,7 +67,7 @@
} else if (dimensiontype == DimensionType.field_223227_a_ && p_212321_1_ == DimensionType.field_223229_c_) {
BlockPos blockpos = serverworld1.func_180504_m();
d0 = (double)blockpos.func_177958_n();
@@ -671,6 +672,7 @@
@@ -671,6 +673,7 @@
this.field_71144_ck = -1;
this.field_71149_ch = -1.0F;
this.field_71146_ci = -1;
@@ -64,7 +75,7 @@
return this;
}
}
@@ -776,11 +778,11 @@
@@ -776,11 +779,11 @@
BlockPos blockpos = new BlockPos(i, j, k);
if (this.field_70170_p.func_175667_e(blockpos)) {
BlockState blockstate = this.field_70170_p.func_180495_p(blockpos);
@@ -78,7 +89,7 @@
blockpos = blockpos1;
blockstate = blockstate1;
}
@@ -819,6 +821,7 @@
@@ -819,6 +822,7 @@
this.field_71135_a.func_147359_a(new SOpenWindowPacket(container.field_75152_c, container.func_216957_a(), p_213829_1_.func_145748_c_()));
container.func_75132_a(this);
this.field_71070_bA = container;
@@ -86,7 +97,7 @@
return OptionalInt.of(this.field_71139_cq);
}
}
@@ -837,6 +840,7 @@
@@ -837,6 +841,7 @@
this.field_71135_a.func_147359_a(new SOpenHorseWindowPacket(this.field_71139_cq, p_184826_2_.func_70302_i_(), p_184826_1_.func_145782_y()));
this.field_71070_bA = new HorseInventoryContainer(this.field_71139_cq, this.field_71071_by, p_184826_2_, p_184826_1_);
this.field_71070_bA.func_75132_a(this);
@@ -94,7 +105,7 @@
}
public void func_184814_a(ItemStack p_184814_1_, Hand p_184814_2_) {
@@ -894,6 +898,7 @@
@@ -894,6 +899,7 @@
public void func_71128_l() {
this.field_71070_bA.func_75134_a(this);
@@ -102,7 +113,7 @@
this.field_71070_bA = this.field_71069_bz;
}
@@ -1020,6 +1025,20 @@
@@ -1020,6 +1026,20 @@
this.field_193110_cw = p_193104_1_.field_193110_cw;
this.func_192029_h(p_193104_1_.func_192023_dk());
this.func_192031_i(p_193104_1_.func_192025_dl());
@@ -123,7 +134,7 @@
}
protected void func_70670_a(EffectInstance p_70670_1_) {
@@ -1242,15 +1261,15 @@
@@ -1242,15 +1262,16 @@
this.func_184210_p();
if (p_200619_1_ == this.field_70170_p) {
this.field_71135_a.func_147364_a(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_);
@@ -132,6 +143,7 @@
ServerWorld serverworld = this.func_71121_q();
this.field_71093_bK = p_200619_1_.field_73011_w.func_186058_p();
WorldInfo worldinfo = p_200619_1_.func_72912_H();
+ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(this.field_71135_a.field_147371_a, this);
this.field_71135_a.func_147359_a(new SRespawnPacket(this.field_71093_bK, worldinfo.func_76067_t(), this.field_71134_c.func_73081_b()));
this.field_71135_a.func_147359_a(new SServerDifficultyPacket(worldinfo.func_176130_y(), worldinfo.func_176123_z()));
this.field_71133_b.func_184103_al().func_187243_f(this);
@@ -142,7 +154,7 @@
this.func_70012_b(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_);
this.func_70029_a(p_200619_1_);
p_200619_1_.func_217446_a(this);
@@ -1259,6 +1278,7 @@
@@ -1259,6 +1280,7 @@
this.field_71134_c.func_73080_a(p_200619_1_);
this.field_71133_b.func_184103_al().func_72354_b(this, p_200619_1_);
this.field_71133_b.func_184103_al().func_72385_f(this);
@@ -150,7 +162,7 @@
}
}
@@ -1293,6 +1313,8 @@
@@ -1293,6 +1315,8 @@
if (itementity == null) {
return null;
} else {
@@ -14,7 +14,7 @@
}
- if (raytraceresult != null && !flag) {
+ if (raytraceresult != null && !flag && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) {
+ if (raytraceresult != null && raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !flag && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) {
this.func_184549_a(raytraceresult);
this.field_70160_al = true;
}
@@ -5,7 +5,7 @@
return !p_213879_1_.func_175149_v() && p_213879_1_ != this.field_190539_a;
}, RayTraceContext.BlockMode.OUTLINE, true);
- if (raytraceresult != null) {
+ if (raytraceresult != null && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) {
+ if (raytraceresult != null && raytraceresult.func_216346_c() != RayTraceResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) {
this.func_190536_a(raytraceresult);
}
@@ -0,0 +1,11 @@
--- a/net/minecraft/entity/projectile/ProjectileHelper.java
+++ b/net/minecraft/entity/projectile/ProjectileHelper.java
@@ -89,7 +89,7 @@
Vec3d vec3d1 = optional.get();
double d1 = p_221273_1_.func_72436_e(vec3d1);
if (d1 < d0 || d0 == 0.0D) {
- if (entity1.func_184208_bv() == p_221273_0_.func_184208_bv()) {
+ if (entity1.func_184208_bv() == p_221273_0_.func_184208_bv() && !entity1.canRiderInteract()) {
if (d0 == 0.0D) {
entity = entity1;
vec3d = vec3d1;
@@ -0,0 +1,11 @@
--- a/net/minecraft/inventory/container/StonecutterContainer.java
+++ b/net/minecraft/inventory/container/StonecutterContainer.java
@@ -183,7 +183,7 @@
if (!this.func_75135_a(itemstack1, 2, 38, false)) {
return ItemStack.field_190927_a;
}
- } else if (field_217084_c.contains(item)) {
+ } else if (!this.field_217090_i.func_199532_z().func_215370_b(IRecipeType.field_222154_f, new Inventory(itemstack1), this.field_217090_i).isEmpty()) {
if (!this.func_75135_a(itemstack1, 0, 1, false)) {
return ItemStack.field_190927_a;
}
@@ -1,15 +1,34 @@
--- a/net/minecraft/item/BlockItem.java
+++ b/net/minecraft/item/BlockItem.java
@@ -69,7 +69,7 @@
@@ -69,8 +69,8 @@
}
}
- SoundType soundtype = blockstate1.func_215695_r();
- world.func_184133_a(playerentity, blockpos, this.func_219983_a(blockstate1), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F);
+ SoundType soundtype = blockstate1.getSoundType(world, blockpos, p_195942_1_.func_195999_j());
world.func_184133_a(playerentity, blockpos, this.func_219983_a(blockstate1), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F);
+ world.func_184133_a(playerentity, blockpos, this.getPlaceSound(blockstate1, world, blockpos, p_195942_1_.func_195999_j()), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F);
itemstack.func_190918_g(1);
return ActionResultType.SUCCESS;
@@ -189,10 +189,18 @@
}
@@ -78,10 +78,16 @@
}
}
+ @Deprecated //Forge: Use more sensitive version {@link BlockItem#getPlaceSound(BlockState, IBlockReader, BlockPos, Entity) }
protected SoundEvent func_219983_a(BlockState p_219983_1_) {
return p_219983_1_.func_215695_r().func_185841_e();
}
+ //Forge: Sensitive version of BlockItem#getPlaceSound
+ protected SoundEvent getPlaceSound(BlockState state, World world, BlockPos pos, PlayerEntity entity) {
+ return state.getSoundType(world, pos, entity).func_185841_e();
+ }
+
@Nullable
public BlockItemUseContext func_219984_b(BlockItemUseContext p_219984_1_) {
return p_219984_1_;
@@ -189,10 +195,18 @@
}
public Block func_179223_d() {
@@ -27,7 +27,18 @@
if (blockstate.func_177230_c() instanceof IGrowable) {
IGrowable igrowable = (IGrowable)blockstate.func_177230_c();
if (igrowable.func_176473_a(p_195966_1_, p_195966_2_, blockstate, p_195966_1_.field_72995_K)) {
@@ -124,7 +133,7 @@
@@ -84,7 +93,9 @@
}
}
- if (biome == Biomes.field_203614_T || biome == Biomes.field_203617_W) {
+ // FORGE: Use BiomeDictionary here to allow modded warm ocean biomes to spawn coral from bonemeal
+ if (net.minecraftforge.common.BiomeDictionary.hasType(biome, net.minecraftforge.common.BiomeDictionary.Type.OCEAN)
+ && net.minecraftforge.common.BiomeDictionary.hasType(biome, net.minecraftforge.common.BiomeDictionary.Type.HOT)) {
if (i == 0 && p_203173_3_ != null && p_203173_3_.func_176740_k().func_176722_c()) {
blockstate = BlockTags.field_211922_B.func_205596_a(p_203173_1_.field_73012_v).func_176223_P().func_206870_a(DeadCoralWallFanBlock.field_211884_b, p_203173_3_);
} else if (field_77697_d.nextInt(4) == 0) {
@@ -124,7 +135,7 @@
}
BlockState blockstate = p_195965_0_.func_180495_p(p_195965_1_);
@@ -1,6 +1,6 @@
--- a/net/minecraft/item/DyeColor.java
+++ b/net/minecraft/item/DyeColor.java
@@ -43,6 +43,7 @@
@@ -41,6 +41,7 @@
private final int field_196066_w;
private final float[] field_193352_x;
private final int field_196067_y;
@@ -8,19 +8,23 @@
private final int field_218390_z;
private DyeColor(int p_i50049_3_, String p_i50049_4_, int p_i50049_5_, MaterialColor p_i50049_6_, int p_i50049_7_, int p_i50049_8_) {
@@ -55,6 +56,7 @@
@@ -53,6 +54,7 @@
int j = (p_i50049_5_ & '\uff00') >> 8;
int k = (p_i50049_5_ & 255) >> 0;
this.field_196066_w = k << 16 | j << 8 | i << 0;
+ this.tag = new net.minecraft.tags.ItemTags.Wrapper(new net.minecraft.util.ResourceLocation("minecraft", "dyes_" + p_i50049_4_));
+ this.tag = new net.minecraft.tags.ItemTags.Wrapper(new net.minecraft.util.ResourceLocation("forge", "dyes/" + p_i50049_4_));
this.field_193352_x = new float[]{(float)i / 255.0F, (float)j / 255.0F, (float)k / 255.0F};
this.field_196067_y = p_i50049_7_;
}
@@ -120,4 +122,21 @@
@@ -115,4 +117,25 @@
public String func_176610_l() {
return this.field_176785_v;
}
+
+ public int getColorValue() {
+ return field_193351_w;
+ }
+
+ public net.minecraft.tags.Tag<Item> getTag() {
+ return tag;
+ }
@@ -0,0 +1,32 @@
--- a/net/minecraft/item/FishBucketItem.java
+++ b/net/minecraft/item/FishBucketItem.java
@@ -25,11 +25,19 @@
public class FishBucketItem extends BucketItem {
private final EntityType<?> field_203794_a;
+ @Deprecated
public FishBucketItem(EntityType<?> p_i49022_1_, Fluid p_i49022_2_, Item.Properties p_i49022_3_) {
super(p_i49022_2_, p_i49022_3_);
this.field_203794_a = p_i49022_1_;
+ this.fishTypeSupplier = () -> p_i49022_1_;
}
+ public FishBucketItem(java.util.function.Supplier<? extends EntityType<?>> fishTypeIn, java.util.function.Supplier<? extends Fluid> p_i49022_2_, Item.Properties builder) {
+ super(p_i49022_2_, builder);
+ this.field_203794_a = null;
+ this.fishTypeSupplier = fishTypeIn;
+ }
+
public void func_203792_a(World p_203792_1_, ItemStack p_203792_2_, BlockPos p_203792_3_) {
if (!p_203792_1_.field_72995_K) {
this.func_205357_b(p_203792_1_, p_203792_2_, p_203792_3_);
@@ -78,4 +86,9 @@
}
}
+
+ private final java.util.function.Supplier<? extends EntityType<?>> fishTypeSupplier;
+ protected EntityType<?> getFishType() {
+ return fishTypeSupplier.get();
+ }
}
@@ -0,0 +1,12 @@
--- a/net/minecraft/item/FlintAndSteelItem.java
+++ b/net/minecraft/item/FlintAndSteelItem.java
@@ -65,7 +65,8 @@
boolean flag = false;
for(Direction direction : Direction.Plane.HORIZONTAL) {
- if (p_219996_1_.func_180495_p(p_219996_2_.func_177972_a(direction)).func_177230_c() == Blocks.field_150343_Z && ((NetherPortalBlock)Blocks.field_150427_aO).func_201816_b(p_219996_1_, p_219996_2_) != null) {
+ BlockPos framePos = p_219996_2_.func_177972_a(direction);
+ if (p_219996_1_.func_180495_p(framePos).isPortalFrame(p_219996_1_, framePos) && ((NetherPortalBlock)Blocks.field_150427_aO).func_201816_b(p_219996_1_, p_219996_2_) != null) {
flag = true;
}
}
@@ -0,0 +1,28 @@
--- a/net/minecraft/network/play/server/SJoinGamePacket.java
+++ b/net/minecraft/network/play/server/SJoinGamePacket.java
@@ -19,6 +19,7 @@
private WorldType field_149201_g;
private int field_218729_g;
private boolean field_179745_h;
+ private int dimensionInt;
public SJoinGamePacket() {
}
@@ -40,7 +41,7 @@
this.field_149204_b = (i & 8) == 8;
i = i & -9;
this.field_149205_c = GameType.func_77146_a(i);
- this.field_149202_d = DimensionType.func_186069_a(p_148837_1_.readInt());
+ this.dimensionInt = p_148837_1_.readInt();
this.field_149200_f = p_148837_1_.readUnsignedByte();
this.field_149201_g = WorldType.func_77130_a(p_148837_1_.func_150789_c(16));
if (this.field_149201_g == null) {
@@ -87,7 +88,7 @@
@OnlyIn(Dist.CLIENT)
public DimensionType func_212642_e() {
- return this.field_149202_d;
+ return this.field_149202_d == null ? this.field_149202_d = net.minecraftforge.fml.network.NetworkHooks.getDummyDimType(this.dimensionInt) : this.field_149202_d;
}
@OnlyIn(Dist.CLIENT)
@@ -0,0 +1,28 @@
--- a/net/minecraft/network/play/server/SRespawnPacket.java
+++ b/net/minecraft/network/play/server/SRespawnPacket.java
@@ -14,6 +14,7 @@
private DimensionType field_149088_a;
private GameType field_149087_c;
private WorldType field_149085_d;
+ private int dimensionInt;
public SRespawnPacket() {
}
@@ -29,7 +30,7 @@
}
public void func_148837_a(PacketBuffer p_148837_1_) throws IOException {
- this.field_149088_a = DimensionType.func_186069_a(p_148837_1_.readInt());
+ this.dimensionInt = p_148837_1_.readInt();
this.field_149087_c = GameType.func_77146_a(p_148837_1_.readUnsignedByte());
this.field_149085_d = WorldType.func_77130_a(p_148837_1_.func_150789_c(16));
if (this.field_149085_d == null) {
@@ -46,7 +47,7 @@
@OnlyIn(Dist.CLIENT)
public DimensionType func_212643_b() {
- return this.field_149088_a;
+ return this.field_149088_a == null ? this.field_149088_a = net.minecraftforge.fml.network.NetworkHooks.getDummyDimType(this.dimensionInt) : this.field_149088_a;
}
@OnlyIn(Dist.CLIENT)
@@ -0,0 +1,12 @@
--- a/net/minecraft/pathfinding/PathNavigator.java
+++ b/net/minecraft/pathfinding/PathNavigator.java
@@ -195,7 +195,8 @@
Vec3d vec3d = this.func_75502_i();
this.field_188561_o = this.field_75515_a.func_213311_cf() > 0.75F ? this.field_75515_a.func_213311_cf() / 2.0F : 0.75F - this.field_75515_a.func_213311_cf() / 2.0F;
Vec3d vec3d1 = this.field_75514_c.func_186310_f();
- if (Math.abs(this.field_75515_a.field_70165_t - (vec3d1.field_72450_a + 0.5D)) < (double)this.field_188561_o && Math.abs(this.field_75515_a.field_70161_v - (vec3d1.field_72449_c + 0.5D)) < (double)this.field_188561_o && Math.abs(this.field_75515_a.field_70163_u - vec3d1.field_72448_b) < 1.0D) {
+ // Forge: fix MC-94054
+ if (Math.abs(this.field_75515_a.field_70165_t - (vec3d1.field_72450_a + (int)(this.field_75515_a.func_213311_cf() + 1) / 2D)) < (double)this.field_188561_o && Math.abs(this.field_75515_a.field_70161_v - (vec3d1.field_72449_c + (int)(this.field_75515_a.func_213311_cf() + 1) / 2D)) < (double)this.field_188561_o && Math.abs(this.field_75515_a.field_70163_u - vec3d1.field_72448_b) < 1.0D) {
this.field_75514_c.func_75872_c(this.field_75514_c.func_75873_e() + 1);
}
@@ -0,0 +1,12 @@
--- a/net/minecraft/pathfinding/SwimmerPathNavigator.java
+++ b/net/minecraft/pathfinding/SwimmerPathNavigator.java
@@ -68,7 +68,8 @@
int i = 6;
Vec3d vec3d2 = this.field_75514_c.func_186310_f();
- if (Math.abs(this.field_75515_a.field_70165_t - (vec3d2.field_72450_a + 0.5D)) < (double)f1 && Math.abs(this.field_75515_a.field_70161_v - (vec3d2.field_72449_c + 0.5D)) < (double)f1 && Math.abs(this.field_75515_a.field_70163_u - vec3d2.field_72448_b) < (double)(f1 * 2.0F)) {
+ // Forge: fix MC-94054
+ if (Math.abs(this.field_75515_a.field_70165_t - (vec3d2.field_72450_a + (int)(this.field_75515_a.func_213311_cf() + 1) / 2D)) < (double)f1 && Math.abs(this.field_75515_a.field_70161_v - (vec3d2.field_72449_c + (int)(this.field_75515_a.func_213311_cf() + 1) / 2D)) < (double)f1 && Math.abs(this.field_75515_a.field_70163_u - vec3d2.field_72448_b) < (double)(f1 * 2.0F)) {
this.field_75514_c.func_75875_a();
}
@@ -167,7 +167,15 @@
final DedicatedServer dedicatedserver = new DedicatedServer(new File(s), serverpropertiesprovider, DataFixesManager.func_210901_a(), yggdrasilauthenticationservice, minecraftsessionservice, gameprofilerepository, playerprofilecache, LoggingChunkStatusListener::new, s1);
dedicatedserver.func_71224_l(optionset.valueOf(optionspec7));
dedicatedserver.func_71208_b(optionset.valueOf(optionspec10));
@@ -948,7 +975,7 @@
@@ -904,6 +931,7 @@
Thread thread = new Thread("Server Shutdown Thread") {
public void run() {
dedicatedserver.func_71263_m(true);
+ LogManager.shutdown(); // we're manually managing the logging shutdown on the server. Make sure we do it here at the end.
}
};
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(field_147145_h));
@@ -948,7 +976,7 @@
}
public ServerWorld func_71218_a(DimensionType p_71218_1_) {
@@ -176,7 +184,7 @@
}
public Iterable<ServerWorld> func_212370_w() {
@@ -987,7 +1014,7 @@
@@ -987,7 +1015,7 @@
}
public String getServerModName() {
@@ -185,7 +193,7 @@
}
public CrashReport func_71230_b(CrashReport p_71230_1_) {
@@ -1529,6 +1556,31 @@
@@ -1529,6 +1557,31 @@
public abstract boolean func_213199_b(GameProfile p_213199_1_);
@@ -122,7 +122,7 @@
int i = p_187250_3_.func_190916_E();
int j = p_187250_3_.func_77952_i();
ActionResult<ItemStack> actionresult = p_187250_3_.func_77957_a(p_187250_2_, p_187250_1_, p_187250_4_);
@@ -285,12 +310,18 @@
@@ -285,12 +310,19 @@
return ActionResultType.PASS;
}
} else {
@@ -134,11 +134,14 @@
+ if (result != ActionResultType.PASS) return result;
+ }
boolean flag = !p_219441_1_.func_184614_ca().func_190926_b() || !p_219441_1_.func_184592_cb().func_190926_b();
boolean flag1 = p_219441_1_.func_70093_af() && flag;
if (!flag1 && blockstate.func_215687_a(p_219441_2_, p_219441_1_, p_219441_4_, p_219441_5_)) {
- boolean flag1 = p_219441_1_.func_70093_af() && flag;
- if (!flag1 && blockstate.func_215687_a(p_219441_2_, p_219441_1_, p_219441_4_, p_219441_5_)) {
+ boolean flag1 = !(p_219441_1_.func_70093_af() && flag) || (p_219441_1_.func_184614_ca().doesSneakBypassUse(p_219441_2_,blockpos,p_219441_1_) && p_219441_1_.func_184592_cb().doesSneakBypassUse(p_219441_2_,blockpos,p_219441_1_));
+ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && flag1 && blockstate.func_215687_a(p_219441_2_, p_219441_1_, p_219441_4_, p_219441_5_)) {
return ActionResultType.SUCCESS;
} else if (!p_219441_3_.func_190926_b() && !p_219441_1_.func_184811_cZ().func_185141_a(p_219441_3_.func_77973_b())) {
- ItemUseContext itemusecontext = new ItemUseContext(p_219441_1_, p_219441_4_, p_219441_5_);
+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return ActionResultType.PASS;
if (this.func_73083_d()) {
int i = p_219441_3_.func_190916_E();
ActionResultType actionresulttype = p_219441_3_.func_196084_a(itemusecontext);
@@ -23,15 +23,16 @@
p_72355_2_.func_70029_a(serverworld);
p_72355_2_.field_71134_c.func_73080_a((ServerWorld)p_72355_2_.field_70170_p);
String s1 = "local";
@@ -121,6 +130,7 @@
@@ -121,6 +130,8 @@
WorldInfo worldinfo = serverworld.func_72912_H();
this.func_72381_a(p_72355_2_, (ServerPlayerEntity)null, serverworld);
ServerPlayNetHandler serverplaynethandler = new ServerPlayNetHandler(this.field_72400_f, p_72355_1_, p_72355_2_);
+ net.minecraftforge.fml.network.NetworkHooks.sendMCRegistryPackets(p_72355_1_, "PLAY_TO_CLIENT");
+ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(p_72355_1_, p_72355_2_);
serverplaynethandler.func_147359_a(new SJoinGamePacket(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), serverworld.field_73011_w.func_186058_p(), this.func_72352_l(), worldinfo.func_76067_t(), this.field_72402_d, serverworld.func_82736_K().func_223586_b(GameRules.field_223612_o)));
serverplaynethandler.func_147359_a(new SCustomPayloadPlayPacket(SCustomPayloadPlayPacket.field_209911_b, (new PacketBuffer(Unpooled.buffer())).func_180714_a(this.func_72365_p().getServerModName())));
serverplaynethandler.func_147359_a(new SServerDifficultyPacket(worldinfo.func_176130_y(), worldinfo.func_176123_z()));
@@ -142,7 +152,7 @@
@@ -142,7 +153,7 @@
this.func_148539_a(itextcomponent.func_211708_a(TextFormatting.YELLOW));
serverplaynethandler.func_147364_a(p_72355_2_.field_70165_t, p_72355_2_.field_70163_u, p_72355_2_.field_70161_v, p_72355_2_.field_70177_z, p_72355_2_.field_70125_A);
@@ -40,7 +41,7 @@
this.field_177454_f.put(p_72355_2_.func_110124_au(), p_72355_2_);
this.func_148540_a(new SPlayerListItemPacket(SPlayerListItemPacket.Action.ADD_PLAYER, p_72355_2_));
@@ -163,8 +173,9 @@
@@ -163,8 +174,9 @@
if (compoundnbt != null && compoundnbt.func_150297_b("RootVehicle", 10)) {
CompoundNBT compoundnbt1 = compoundnbt.func_74775_l("RootVehicle");
@@ -51,7 +52,7 @@
});
if (entity1 != null) {
UUID uuid = compoundnbt1.func_186857_a("Attach");
@@ -191,6 +202,7 @@
@@ -191,6 +203,7 @@
}
p_72355_2_.func_71116_b();
@@ -59,7 +60,7 @@
}
protected void func_96456_a(ServerScoreboard p_96456_1_, ServerPlayerEntity p_96456_2_) {
@@ -252,6 +264,7 @@
@@ -252,6 +265,7 @@
compoundnbt1 = compoundnbt;
p_72380_1_.func_70020_e(compoundnbt);
field_148546_d.debug("loading single player");
@@ -67,7 +68,7 @@
} else {
compoundnbt1 = this.field_72412_k.func_75752_b(p_72380_1_);
}
@@ -260,6 +273,7 @@
@@ -260,6 +274,7 @@
}
protected void func_72391_b(ServerPlayerEntity p_72391_1_) {
@@ -75,7 +76,7 @@
this.field_72412_k.func_75753_a(p_72391_1_);
ServerStatisticsManager serverstatisticsmanager = this.field_148547_k.get(p_72391_1_.func_110124_au());
if (serverstatisticsmanager != null) {
@@ -274,6 +288,7 @@
@@ -274,6 +289,7 @@
}
public void func_72367_e(ServerPlayerEntity p_72367_1_) {
@@ -83,7 +84,7 @@
ServerWorld serverworld = p_72367_1_.func_71121_q();
p_72367_1_.func_195066_a(Stats.field_75947_j);
this.func_72391_b(p_72367_1_);
@@ -295,7 +310,7 @@
@@ -295,7 +311,7 @@
p_72367_1_.func_213319_R();
serverworld.func_217434_e(p_72367_1_);
p_72367_1_.func_192039_O().func_192745_a();
@@ -92,7 +93,7 @@
this.field_72400_f.func_201300_aS().func_201382_b(p_72367_1_);
UUID uuid = p_72367_1_.func_110124_au();
ServerPlayerEntity serverplayerentity = this.field_177454_f.get(uuid);
@@ -364,10 +379,18 @@
@@ -364,10 +380,18 @@
}
public ServerPlayerEntity func_72368_a(ServerPlayerEntity p_72368_1_, DimensionType p_72368_2_, boolean p_72368_3_) {
@@ -115,7 +116,7 @@
p_72368_1_.field_71093_bK = p_72368_2_;
PlayerInteractionManager playerinteractionmanager;
if (this.field_72400_f.func_71242_L()) {
@@ -379,6 +402,8 @@
@@ -379,6 +403,8 @@
ServerPlayerEntity serverplayerentity = new ServerPlayerEntity(this.field_72400_f, this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), p_72368_1_.func_146103_bH(), playerinteractionmanager);
serverplayerentity.field_71135_a = p_72368_1_.field_71135_a;
serverplayerentity.func_193104_a(p_72368_1_, p_72368_3_);
@@ -124,7 +125,7 @@
serverplayerentity.func_145769_d(p_72368_1_.func_145782_y());
serverplayerentity.func_184819_a(p_72368_1_.func_184591_cq());
@@ -393,7 +418,7 @@
@@ -393,7 +419,7 @@
if (optional.isPresent()) {
Vec3d vec3d = optional.get();
serverplayerentity.func_70012_b(vec3d.field_72450_a, vec3d.field_72448_b, vec3d.field_72449_c, 0.0F, 0.0F);
@@ -133,7 +134,15 @@
} else {
serverplayerentity.field_71135_a.func_147359_a(new SChangeGameStatePacket(0, 0.0F));
}
@@ -413,10 +438,11 @@
@@ -404,6 +430,7 @@
}
WorldInfo worldinfo = serverplayerentity.field_70170_p.func_72912_H();
+ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(serverplayerentity.field_71135_a.field_147371_a, serverplayerentity);
serverplayerentity.field_71135_a.func_147359_a(new SRespawnPacket(serverplayerentity.field_71093_bK, worldinfo.func_76067_t(), serverplayerentity.field_71134_c.func_73081_b()));
BlockPos blockpos1 = serverworld.func_175694_M();
serverplayerentity.field_71135_a.func_147364_a(serverplayerentity.field_70165_t, serverplayerentity.field_70163_u, serverplayerentity.field_70161_v, serverplayerentity.field_70177_z, serverplayerentity.field_70125_A);
@@ -413,10 +440,11 @@
this.func_72354_b(serverplayerentity, serverworld);
this.func_187243_f(serverplayerentity);
serverworld.func_217433_d(serverplayerentity);
@@ -146,7 +155,7 @@
return serverplayerentity;
}
@@ -736,7 +762,7 @@
@@ -736,7 +764,7 @@
}
public List<ServerPlayerEntity> func_181057_v() {
@@ -155,7 +164,7 @@
}
@Nullable
@@ -766,4 +792,12 @@
@@ -766,4 +794,12 @@
public boolean func_206257_x() {
return this.field_72407_n;
}
@@ -0,0 +1,10 @@
--- a/net/minecraft/tags/NetworkTagManager.java
+++ b/net/minecraft/tags/NetworkTagManager.java
@@ -69,6 +69,7 @@
ItemTags.func_199902_a(this.field_199720_b);
FluidTags.func_206953_a(this.field_205705_c);
EntityTypeTags.func_219759_a(this.field_215299_d);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this));
}, p_215226_6_);
}
@@ -1,6 +1,35 @@
--- a/net/minecraft/tileentity/AbstractFurnaceTileEntity.java
+++ b/net/minecraft/tileentity/AbstractFurnaceTileEntity.java
@@ -169,9 +169,9 @@
@@ -85,6 +85,7 @@
this.field_214014_c = p_i49964_2_;
}
+ @Deprecated //Forge - get burn times by calling ForgeHooks#getBurnTime(ItemStack)
public static Map<Item, Integer> func_214001_f() {
Map<Item, Integer> map = Maps.newLinkedHashMap();
func_213996_a(map, Items.field_151129_at, 20000);
@@ -98,18 +99,8 @@
func_213992_a(map, ItemTags.field_202899_i, 150);
func_213992_a(map, ItemTags.field_212188_k, 300);
func_213992_a(map, ItemTags.field_202900_j, 300);
- func_213996_a(map, Blocks.field_180407_aO, 300);
- func_213996_a(map, Blocks.field_180404_aQ, 300);
- func_213996_a(map, Blocks.field_180408_aP, 300);
- func_213996_a(map, Blocks.field_180403_aR, 300);
- func_213996_a(map, Blocks.field_180406_aS, 300);
- func_213996_a(map, Blocks.field_180405_aT, 300);
- func_213996_a(map, Blocks.field_180390_bo, 300);
- func_213996_a(map, Blocks.field_180392_bq, 300);
- func_213996_a(map, Blocks.field_180391_bp, 300);
- func_213996_a(map, Blocks.field_180386_br, 300);
- func_213996_a(map, Blocks.field_180385_bs, 300);
- func_213996_a(map, Blocks.field_180387_bt, 300);
+ func_213992_a(map, net.minecraftforge.common.Tags.Items.FENCES_WOODEN, 300);
+ func_213992_a(map, net.minecraftforge.common.Tags.Items.FENCE_GATES_WOODEN, 300);
func_213996_a(map, Blocks.field_196586_al, 300);
func_213996_a(map, Blocks.field_150342_X, 300);
func_213996_a(map, Blocks.field_222428_lQ, 300);
@@ -169,9 +160,9 @@
super.func_145839_a(p_145839_1_);
this.field_214012_a = NonNullList.func_191197_a(this.func_70302_i_(), ItemStack.field_190927_a);
ItemStackHelper.func_191283_b(p_145839_1_, this.field_214012_a);
@@ -13,7 +42,7 @@
this.field_214019_k = this.func_213997_a(this.field_214012_a.get(1));
int i = p_145839_1_.func_74765_d("RecipesUsedSize");
@@ -185,9 +185,9 @@
@@ -185,9 +176,9 @@
public CompoundNBT func_189515_b(CompoundNBT p_189515_1_) {
super.func_189515_b(p_189515_1_);
@@ -26,7 +55,7 @@
ItemStackHelper.func_191282_a(p_189515_1_, this.field_214012_a);
p_189515_1_.func_74777_a("RecipesUsedSize", (short)this.field_214022_n.size());
int i = 0;
@@ -217,12 +217,14 @@
@@ -217,12 +208,14 @@
this.field_214019_k = this.field_214018_j;
if (this.func_214006_r()) {
flag1 = true;
@@ -43,7 +72,7 @@
}
}
}
@@ -266,10 +268,10 @@
@@ -266,10 +259,10 @@
return true;
} else if (!itemstack1.func_77969_a(itemstack)) {
return false;
@@ -56,7 +85,7 @@
}
}
} else {
@@ -285,7 +287,7 @@
@@ -285,7 +278,7 @@
if (itemstack2.func_190926_b()) {
this.field_214012_a.set(2, itemstack1.func_77946_l());
} else if (itemstack2.func_77973_b() == itemstack1.func_77973_b()) {
@@ -65,27 +94,25 @@
}
if (!this.field_145850_b.field_72995_K) {
@@ -305,7 +307,8 @@
@@ -305,7 +298,7 @@
return 0;
} else {
Item item = p_213997_1_.func_77973_b();
- return func_214001_f().getOrDefault(item, 0);
+ int ret = p_213997_1_.getBurnTime();
+ return net.minecraftforge.event.ForgeEventFactory.getItemBurnTime(p_213997_1_, ret == -1 ? func_214001_f().getOrDefault(item, 0) : ret);
+ return net.minecraftforge.common.ForgeHooks.getBurnTime(p_213997_1_);
}
}
@@ -314,7 +317,8 @@
@@ -314,7 +307,7 @@
}
public static boolean func_213991_b(ItemStack p_213991_0_) {
- return func_214001_f().containsKey(p_213991_0_.func_77973_b());
+ int ret = p_213991_0_.getBurnTime();
+ return net.minecraftforge.event.ForgeEventFactory.getItemBurnTime(p_213991_0_, ret == -1 ? func_214001_f().getOrDefault(p_213991_0_.func_77973_b(), 0) : ret) > 0;
+ return net.minecraftforge.common.ForgeHooks.getBurnTime(p_213991_0_) > 0;
}
public int[] func_180463_a(Direction p_180463_1_) {
@@ -462,4 +466,27 @@
@@ -462,4 +455,27 @@
}
}
@@ -0,0 +1,11 @@
--- a/net/minecraft/tileentity/ConduitTileEntity.java
+++ b/net/minecraft/tileentity/ConduitTileEntity.java
@@ -131,7 +131,7 @@
BlockPos blockpos1 = this.field_174879_c.func_177982_a(j1, k1, l1);
BlockState blockstate = this.field_145850_b.func_180495_p(blockpos1);
- for(Block block : field_205042_e) {
+ for(Block block : net.minecraftforge.common.Tags.Blocks.SUPPORTS_CONDUIT.func_199885_a()) {
if (blockstate.func_177230_c() == block) {
this.field_205046_i.add(blockpos1);
}
@@ -49,15 +49,16 @@
this.field_145850_b.func_175666_e(this.field_174879_c, this.field_195045_e.func_177230_c());
}
}
@@ -139,6 +146,7 @@
@@ -139,6 +146,8 @@
public void func_145843_s() {
this.field_145846_f = true;
+ this.invalidateCaps();
+ requestModelDataUpdate();
}
public void func_145829_t() {
@@ -181,6 +189,13 @@
@@ -181,6 +190,13 @@
return this.field_200663_e;
}
@@ -448,7 +448,17 @@
List<T> list = Lists.newArrayList();
AbstractChunkProvider abstractchunkprovider = this.func_72863_F();
@@ -1000,7 +1092,7 @@
@@ -952,7 +1044,8 @@
}
public int func_181545_F() {
- return 63;
+ // FORGE: Allow modded dimensions to customize this value via Dimension
+ return this.func_201675_m().getSeaLevel();
}
public World func_201672_e() {
@@ -1000,7 +1093,7 @@
public int func_175651_c(BlockPos p_175651_1_, Direction p_175651_2_) {
BlockState blockstate = this.func_180495_p(p_175651_1_);
@@ -457,7 +467,7 @@
}
public boolean func_175640_z(BlockPos p_175640_1_) {
@@ -1045,7 +1137,7 @@
@@ -1045,7 +1138,7 @@
}
public long func_72905_C() {
@@ -466,7 +476,7 @@
}
public long func_82737_E() {
@@ -1053,11 +1145,11 @@
@@ -1053,11 +1146,11 @@
}
public long func_72820_D() {
@@ -480,7 +490,7 @@
}
protected void func_217389_a() {
@@ -1069,7 +1161,7 @@
@@ -1069,7 +1162,7 @@
}
public BlockPos func_175694_M() {
@@ -489,7 +499,7 @@
if (!this.func_175723_af().func_177746_a(blockpos)) {
blockpos = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, new BlockPos(this.func_175723_af().func_177731_f(), 0.0D, this.func_175723_af().func_177721_g()));
}
@@ -1078,10 +1170,14 @@
@@ -1078,10 +1171,14 @@
}
public void func_175652_B(BlockPos p_175652_1_) {
@@ -505,7 +515,7 @@
return true;
}
@@ -1149,8 +1245,7 @@
@@ -1149,8 +1246,7 @@
}
public boolean func_180502_D(BlockPos p_180502_1_) {
@@ -515,7 +525,7 @@
}
@Nullable
@@ -1164,11 +1259,11 @@
@@ -1164,11 +1260,11 @@
}
public int func_72940_L() {
@@ -529,7 +539,7 @@
}
public CrashReportCategory func_72914_a(CrashReport p_72914_1_) {
@@ -1199,16 +1294,15 @@
@@ -1199,16 +1295,15 @@
public abstract Scoreboard func_96441_U();
public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) {
@@ -550,7 +560,7 @@
blockstate.func_215697_a(this, blockpos, p_175666_2_, p_175666_1_, false);
}
}
@@ -1287,4 +1381,16 @@
@@ -1287,4 +1382,16 @@
public BlockPos func_205770_a(Heightmap.Type p_205770_1_, BlockPos p_205770_2_) {
return new BlockPos(p_205770_2_.func_177958_n(), this.func_201676_a(p_205770_1_, p_205770_2_.func_177958_n(), p_205770_2_.func_177952_p()), p_205770_2_.func_177952_p());
}
@@ -0,0 +1,11 @@
--- a/net/minecraft/world/gen/ChunkGenerator.java
+++ b/net/minecraft/world/gen/ChunkGenerator.java
@@ -195,7 +195,7 @@
public abstract void func_222537_b(IWorld p_222537_1_, IChunk p_222537_2_);
public int func_222530_f() {
- return 63;
+ return field_222540_a.func_201675_m().getSeaLevel();
}
public abstract int func_222529_a(int p_222529_1_, int p_222529_2_, Heightmap.Type p_222529_3_);
@@ -0,0 +1,27 @@
--- a/net/minecraft/world/gen/feature/OreFeatureConfig.java
+++ b/net/minecraft/world/gen/feature/OreFeatureConfig.java
@@ -34,7 +34,7 @@
return new OreFeatureConfig(orefeatureconfig$fillerblocktype, blockstate, i);
}
- public static enum FillerBlockType {
+ public static enum FillerBlockType implements net.minecraftforge.common.IExtensibleEnum {
NATURAL_STONE("natural_stone", (p_214739_0_) -> {
if (p_214739_0_ == null) {
return false;
@@ -67,5 +67,15 @@
public Predicate<BlockState> func_214738_b() {
return this.field_214743_e;
}
+
+ public static FillerBlockType create(String enumName, String p_i50618_3_, Predicate<BlockState> p_i50618_4_) {
+ throw new IllegalStateException("Enum not extended");
+ }
+
+ @Override
+ @Deprecated
+ public void init() {
+ field_214741_c.put(func_214737_a(), this);
+ }
}
}
@@ -0,0 +1,27 @@
--- a/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java
+++ b/net/minecraft/world/gen/feature/jigsaw/JigsawPattern.java
@@ -72,7 +72,7 @@
return this.field_214953_e.size();
}
- public static enum PlacementBehaviour {
+ public static enum PlacementBehaviour implements net.minecraftforge.common.IExtensibleEnum {
TERRAIN_MATCHING("terrain_matching", ImmutableList.of(new GravityStructureProcessor(Heightmap.Type.WORLD_SURFACE_WG, -1))),
RIGID("rigid", ImmutableList.of());
@@ -98,5 +98,15 @@
public ImmutableList<StructureProcessor> func_214937_b() {
return this.field_214941_e;
}
+
+ public static PlacementBehaviour create(String enumName, String p_i50487_3_, ImmutableList<StructureProcessor> p_i50487_4_) {
+ throw new IllegalStateException("Enum not extended");
+ }
+
+ @Override
+ @Deprecated
+ public void init() {
+ field_214939_c.put(func_214936_a(), this);
+ }
}
}
@@ -0,0 +1,11 @@
--- a/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java
+++ b/net/minecraft/world/gen/feature/jigsaw/SingleJigsawPiece.java
@@ -88,7 +88,7 @@
if (!template.func_189962_a(p_214848_2_, p_214848_3_, placementsettings, 18)) {
return false;
} else {
- for(Template.BlockInfo template$blockinfo : Template.func_215387_a(p_214848_2_, p_214848_3_, placementsettings, this.func_214857_a(p_214848_1_, p_214848_3_, p_214848_4_, false))) {
+ for(Template.BlockInfo template$blockinfo : Template.processBlockInfos(template, p_214848_2_, p_214848_3_, placementsettings, this.func_214857_a(p_214848_1_, p_214848_3_, p_214848_4_, false))) {
this.func_214846_a(p_214848_2_, template$blockinfo, p_214848_3_, p_214848_4_, p_214848_6_, p_214848_5_);
}
@@ -0,0 +1,57 @@
--- a/net/minecraft/world/gen/feature/template/StructureProcessor.java
+++ b/net/minecraft/world/gen/feature/template/StructureProcessor.java
@@ -9,8 +9,53 @@
public abstract class StructureProcessor {
@Nullable
- public abstract Template.BlockInfo func_215194_a(IWorldReader p_215194_1_, BlockPos p_215194_2_, Template.BlockInfo p_215194_3_, Template.BlockInfo p_215194_4_, PlacementSettings p_215194_5_);
+ @Deprecated
+ public Template.BlockInfo func_215194_a(IWorldReader p_215194_1_, BlockPos p_215194_2_, Template.BlockInfo p_215194_3_, Template.BlockInfo p_215194_4_, PlacementSettings p_215194_5_) {
+ return p_215194_4_;
+ }
+ /**
+ * FORGE: Add template parameter
+ *
+ * @param p_215194_1_
+ * @param p_215194_2_
+ * @param p_215194_3_
+ * @param p_215194_4_
+ * @param p_215194_5_
+ * @param template The template being placed, can be null due to deprecated
+ * method calls.
+ * @see #process(IWorldReader, BlockPos,
+ * net.minecraft.world.gen.feature.template.Template.BlockInfo,
+ * net.minecraft.world.gen.feature.template.Template.BlockInfo,
+ * PlacementSettings)
+ */
+ @Nullable
+ public Template.BlockInfo process(IWorldReader p_215194_1_, BlockPos p_215194_2_, Template.BlockInfo p_215194_3_, Template.BlockInfo p_215194_4_, PlacementSettings p_215194_5_, @Nullable Template template) {
+ return func_215194_a(p_215194_1_, p_215194_2_, p_215194_3_, p_215194_4_, p_215194_5_);
+ }
+
+ /**
+ * FORGE: Add entity processing.
+ * <p>
+ * Use this method to process entities from a structure in much the same way as
+ * blocks, parameters are analogous.
+ *
+ * @param world
+ * @param seedPos
+ * @param rawEntityInfo
+ * @param entityInfo
+ * @param placementSettings
+ * @param template
+ *
+ * @see #process(IWorldReader, BlockPos,
+ * net.minecraft.world.gen.feature.template.Template.BlockInfo,
+ * net.minecraft.world.gen.feature.template.Template.BlockInfo,
+ * PlacementSettings)
+ */
+ public Template.EntityInfo processEntity(IWorldReader world, BlockPos seedPos, Template.EntityInfo rawEntityInfo, Template.EntityInfo entityInfo, PlacementSettings placementSettings, Template template) {
+ return entityInfo;
+ }
+
protected abstract IStructureProcessorType func_215192_a();
protected abstract <T> Dynamic<T> func_215193_a(DynamicOps<T> p_215193_1_);
@@ -0,0 +1,97 @@
--- a/net/minecraft/world/gen/feature/template/Template.java
+++ b/net/minecraft/world/gen/feature/template/Template.java
@@ -152,6 +152,11 @@
return func_207669_a(p_186266_1_, p_186266_0_.func_186212_b(), p_186266_0_.func_186215_c(), p_186266_0_.func_207664_d());
}
+ // FORGE: Add overload accepting Vec3d
+ public static Vec3d transformedVec3d(PlacementSettings p_186266_0_, Vec3d p_186266_1_) {
+ return func_207667_a(p_186266_1_, p_186266_0_.func_186212_b(), p_186266_0_.func_186215_c(), p_186266_0_.func_207664_d());
+ }
+
public void func_186260_a(IWorld p_186260_1_, BlockPos p_186260_2_, PlacementSettings p_186260_3_) {
p_186260_3_.func_186224_i();
this.func_186253_b(p_186260_1_, p_186260_2_, p_186260_3_);
@@ -177,7 +182,7 @@
int i1 = Integer.MIN_VALUE;
int j1 = Integer.MIN_VALUE;
- for(Template.BlockInfo template$blockinfo : func_215387_a(p_189962_1_, p_189962_2_, p_189962_3_, list)) {
+ for(Template.BlockInfo template$blockinfo : processBlockInfos(this, p_189962_1_, p_189962_2_, p_189962_3_, list)) {
BlockPos blockpos = template$blockinfo.field_186242_a;
if (mutableboundingbox == null || mutableboundingbox.func_175898_b(blockpos)) {
IFluidState ifluidstate = p_189962_3_.func_204763_l() ? p_189962_1_.func_204610_c(blockpos) : null;
@@ -288,7 +293,7 @@
}
if (!p_189962_3_.func_186221_e()) {
- this.func_207668_a(p_189962_1_, p_189962_2_, p_189962_3_.func_186212_b(), p_189962_3_.func_186215_c(), p_189962_3_.func_207664_d(), mutableboundingbox);
+ this.addEntitiesToWorld(p_189962_1_, p_189962_2_, p_189962_3_, p_189962_3_.func_186212_b(), p_189962_3_.func_186215_c(), p_189962_3_.func_207664_d(), p_189962_3_.func_186213_g());
}
return true;
@@ -317,14 +322,19 @@
});
}
+ @Deprecated // FORGE: Add template parameter
public static List<Template.BlockInfo> func_215387_a(IWorld p_215387_0_, BlockPos p_215387_1_, PlacementSettings p_215387_2_, List<Template.BlockInfo> p_215387_3_) {
+ return processBlockInfos(null, p_215387_0_, p_215387_1_, p_215387_2_, p_215387_3_);
+ }
+
+ public static List<Template.BlockInfo> processBlockInfos(@Nullable Template template, IWorld p_215387_0_, BlockPos p_215387_1_, PlacementSettings p_215387_2_, List<Template.BlockInfo> p_215387_3_) {
List<Template.BlockInfo> list = Lists.newArrayList();
for(Template.BlockInfo template$blockinfo : p_215387_3_) {
BlockPos blockpos = func_186266_a(p_215387_2_, template$blockinfo.field_186242_a).func_177971_a(p_215387_1_);
Template.BlockInfo template$blockinfo1 = new Template.BlockInfo(blockpos, template$blockinfo.field_186243_b, template$blockinfo.field_186244_c);
- for(Iterator<StructureProcessor> iterator = p_215387_2_.func_215221_j().iterator(); template$blockinfo1 != null && iterator.hasNext(); template$blockinfo1 = iterator.next().func_215194_a(p_215387_0_, p_215387_1_, template$blockinfo, template$blockinfo1, p_215387_2_)) {
+ for(Iterator<StructureProcessor> iterator = p_215387_2_.func_215221_j().iterator(); template$blockinfo1 != null && iterator.hasNext(); template$blockinfo1 = iterator.next().process(p_215387_0_, p_215387_1_, template$blockinfo, template$blockinfo1, p_215387_2_, template)) {
;
}
@@ -336,13 +346,41 @@
return list;
}
+ // FORGE: Add processing for entities
+ public static List<Template.EntityInfo> processEntityInfos(@Nullable Template template, IWorld p_215387_0_, BlockPos p_215387_1_, PlacementSettings p_215387_2_, List<Template.EntityInfo> p_215387_3_) {
+ List<Template.EntityInfo> list = Lists.newArrayList();
+
+ for(Template.EntityInfo entityInfo : p_215387_3_) {
+ Vec3d pos = transformedVec3d(p_215387_2_, entityInfo.field_186247_a).func_178787_e(new Vec3d(p_215387_1_));
+ BlockPos blockpos = func_186266_a(p_215387_2_, entityInfo.field_186248_b).func_177971_a(p_215387_1_);
+ Template.EntityInfo entityInfo1 = new Template.EntityInfo(pos, blockpos, entityInfo.field_186249_c);
+
+ for(Iterator<StructureProcessor> iterator = p_215387_2_.func_215221_j().iterator(); entityInfo1 != null && iterator.hasNext(); entityInfo1 = iterator.next().processEntity(p_215387_0_, p_215387_1_, entityInfo, entityInfo1, p_215387_2_, template)) {
+ ;
+ }
+
+ if (entityInfo1 != null) {
+ list.add(entityInfo1);
+ }
+ }
+
+ return list;
+ }
+
+ @Deprecated // FORGE: Add PlacementSettings parameter (below) to pass to entity processors
private void func_207668_a(IWorld p_207668_1_, BlockPos p_207668_2_, Mirror p_207668_3_, Rotation p_207668_4_, BlockPos p_207668_5_, @Nullable MutableBoundingBox p_207668_6_) {
- for(Template.EntityInfo template$entityinfo : this.field_186271_b) {
+ addEntitiesToWorld(p_207668_1_, p_207668_2_, new PlacementSettings().func_186214_a(p_207668_3_).func_186220_a(p_207668_4_).func_207665_a(p_207668_5_).func_186223_a(p_207668_6_), p_207668_3_, p_207668_4_, p_207668_2_, p_207668_6_);
+ }
+
+ private void addEntitiesToWorld(IWorld p_207668_1_, BlockPos p_207668_2_, PlacementSettings placementIn, Mirror p_207668_3_, Rotation p_207668_4_, BlockPos p_207668_5_, @Nullable MutableBoundingBox p_207668_6_) {
+ for(Template.EntityInfo template$entityinfo : processEntityInfos(this, p_207668_1_, p_207668_2_, placementIn, this.field_186271_b)) {
BlockPos blockpos = func_207669_a(template$entityinfo.field_186248_b, p_207668_3_, p_207668_4_, p_207668_5_).func_177971_a(p_207668_2_);
+ blockpos = template$entityinfo.field_186248_b; // FORGE: Position will have already been transformed by processEntityInfos
if (p_207668_6_ == null || p_207668_6_.func_175898_b(blockpos)) {
CompoundNBT compoundnbt = template$entityinfo.field_186249_c;
Vec3d vec3d = func_207667_a(template$entityinfo.field_186247_a, p_207668_3_, p_207668_4_, p_207668_5_);
- Vec3d vec3d1 = vec3d.func_72441_c((double)p_207668_2_.func_177958_n(), (double)p_207668_2_.func_177956_o(), (double)p_207668_2_.func_177952_p());
+ vec3d = vec3d.func_72441_c((double)p_207668_2_.func_177958_n(), (double)p_207668_2_.func_177956_o(), (double)p_207668_2_.func_177952_p());
+ Vec3d vec3d1 = template$entityinfo.field_186247_a; // FORGE: Position will have already been transformed by processEntityInfos
ListNBT listnbt = new ListNBT();
listnbt.add(new DoubleNBT(vec3d1.field_72450_a));
listnbt.add(new DoubleNBT(vec3d1.field_72448_b));
@@ -0,0 +1,14 @@
--- a/net/minecraft/world/lighting/BlockLightEngine.java
+++ b/net/minecraft/world/lighting/BlockLightEngine.java
@@ -117,4 +117,11 @@
this.field_215627_c.func_215532_c();
this.func_215469_a(Long.MAX_VALUE, p_215623_1_.func_218275_a(), 15 - p_215623_2_, true);
}
+
+ // FORGE START
+
+ @Override
+ public int queuedUpdateSize() {
+ return field_215627_c.queuedUpdateSize();
+ }
}
@@ -0,0 +1,21 @@
--- a/net/minecraft/world/lighting/LevelBasedGraph.java
+++ b/net/minecraft/world/lighting/LevelBasedGraph.java
@@ -210,4 +210,18 @@
protected abstract void func_215476_a(long p_215476_1_, int p_215476_3_);
protected abstract int func_215480_b(long p_215480_1_, long p_215480_3_, int p_215480_5_);
+
+ // FORGE START
+
+ protected int queuedUpdateSize() {
+ return field_215488_c.size();
+ }
+
+ public final void bulkCancel(java.util.function.LongPredicate pred) {
+ ((Long2ByteOpenHashMap)field_215488_c).keySet().forEach((long l) -> {
+ if (pred.test(l)) {
+ func_215479_e(l);
+ }
+ });
+ }
}
@@ -0,0 +1,11 @@
--- a/net/minecraft/world/lighting/LightEngine.java
+++ b/net/minecraft/world/lighting/LightEngine.java
@@ -216,4 +216,8 @@
long i = SectionPos.func_218169_f(SectionPos.func_218166_b(p_223129_1_.field_77276_a, 0, p_223129_1_.field_77275_b));
this.field_215627_c.func_223113_c(i, p_223129_2_);
}
+
+ // FORGE START
+
+ public abstract int queuedUpdateSize();
}
@@ -0,0 +1,14 @@
--- a/net/minecraft/world/lighting/SectionLightStorage.java
+++ b/net/minecraft/world/lighting/SectionLightStorage.java
@@ -154,6 +154,11 @@
int j = SectionPos.func_218142_c(SectionPos.func_218144_c(p_215528_2_));
int k = SectionPos.func_218142_c(SectionPos.func_218153_d(p_215528_2_));
+ // FORGE: Optimize loop when lighting update count is lower than section size
+ if (p_215528_1_.queuedUpdateSize() < 16 * 16 * 16) {
+ p_215528_1_.bulkCancel(l -> SectionPos.func_218162_e(l) == p_215528_2_);
+ return;
+ }
for(int l = 0; l < 16; ++l) {
for(int i1 = 0; i1 < 16; ++i1) {
for(int j1 = 0; j1 < 16; ++j1) {
@@ -0,0 +1,14 @@
--- a/net/minecraft/world/lighting/SkyLightEngine.java
+++ b/net/minecraft/world/lighting/SkyLightEngine.java
@@ -229,4 +229,11 @@
public String func_215614_b(long p_215614_1_) {
return super.func_215614_b(p_215614_1_) + (this.field_215627_c.func_215549_m(p_215614_1_) ? "*" : "");
}
+
+ // FORGE START
+
+ @Override
+ public int queuedUpdateSize() {
+ return 0;
+ }
}
@@ -73,15 +73,17 @@
}
if (this.func_72912_H().func_76093_s() && this.func_175659_aa() != Difficulty.HARD) {
@@ -280,7 +291,7 @@
@@ -280,8 +291,8 @@
})) {
this.field_73068_P = false;
if (this.func_82736_K().func_223586_b(GameRules.field_223607_j)) {
- long l = this.field_72986_A.func_76073_f() + 24000L;
- this.func_72877_b(l - l % 24000L);
+ long l = this.func_72820_D() + 24000L;
this.func_72877_b(l - l % 24000L);
+ this.func_72877_b(net.minecraftforge.event.ForgeEventFactory.onSleepFinished(this, l - l % 24000L, this.func_72820_D()));
}
this.field_217491_A.stream().filter(LivingEntity::func_70608_bn).forEach((p_217444_0_) -> {
@@ -304,6 +315,7 @@
iprofiler.func_219895_b("portalForcer");
@@ -24,7 +24,7 @@
mobentity.func_70012_b((double)f, (double)k, (double)f1, p_222263_1_.field_73012_v.nextFloat() * 360.0F, 0.0F);
- if (d0 > 16384.0D && mobentity.func_213397_c(d0) || !mobentity.func_213380_a(p_222263_1_, SpawnReason.NATURAL) || !mobentity.func_205019_a(p_222263_1_)) {
+ int canSpawn = net.minecraftforge.common.ForgeHooks.canEntitySpawn(mobentity, p_222263_1_, f, k, f1, null, SpawnReason.NATURAL);
+ if (canSpawn == -1 || (canSpawn == 0 && d0 > 16384.0D && (mobentity.func_213397_c(d0) || !mobentity.func_213380_a(p_222263_1_, SpawnReason.NATURAL) || !mobentity.func_205019_a(p_222263_1_)))) {
+ if (canSpawn == -1 || (canSpawn == 0 && (d0 > 16384.0D && mobentity.func_213397_c(d0) || !mobentity.func_213380_a(p_222263_1_, SpawnReason.NATURAL) || !mobentity.func_205019_a(p_222263_1_)))) {
break label115;
}
@@ -215,6 +215,9 @@ public class RuntimeEnumExtender implements ILaunchPluginService {
//EnumHelper.cleanEnumCache(ThisType.class)
ins.visitLdcInsn(classType);
ins.invokestatic(UNSAFE_HACKS.getInternalName(), "cleanEnumCache", CLEAN_DESC, false);
//init ret
ins.load(vars, classType);
ins.invokeinterface(MARKER_IFACE.getInternalName(), "init", "()V");
//return ret
ins.load(vars, classType);
ins.areturn(classType);
@@ -83,4 +83,9 @@ public class FMLClientLaunchProvider extends FMLCommonLaunchHandler implements I
protected String getNaming() {
return "srg";
}
@Override
public Path[] getPaths() {
return FMLLoader.getMCPaths();
}
}
@@ -23,6 +23,7 @@ import cpw.mods.modlauncher.api.IEnvironment;
import cpw.mods.modlauncher.api.ITransformingClassLoader;
import cpw.mods.modlauncher.api.ITransformingClassLoaderBuilder;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -41,6 +42,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import static net.minecraftforge.fml.loading.LogMarkers.CORE;
import static net.minecraftforge.fml.loading.LogMarkers.LOADING;
public abstract class FMLCommonLaunchHandler
{
@@ -54,6 +56,8 @@ public abstract class FMLCommonLaunchHandler
"net.minecraftforge.eventbus.", "net.minecraftforge.api.", "com.mojang.util.QueueLogAppender"
);
private final List<Path> additionalLibraries = new ArrayList<>();
protected Predicate<String> getPackagePredicate() {
return cn -> SKIPPACKAGES.stream().noneMatch(cn::startsWith);
}
@@ -69,6 +73,7 @@ public abstract class FMLCommonLaunchHandler
public void configureTransformationClassLoader(final ITransformingClassLoaderBuilder builder) {
builder.addTransformationPath(FMLLoader.getForgePath());
Arrays.stream(FMLLoader.getMCPaths()).forEach(builder::addTransformationPath);
additionalLibraries.forEach(builder::addTransformationPath);
FMLLoader.getLanguageLoadingProvider().getLibraries().forEach(builder::addTransformationPath);
builder.setClassBytesLocator(getClassLoaderLocatorFunction());
builder.setManifestLocator(getClassLoaderManifestLocatorFunction());
@@ -137,4 +142,12 @@ public abstract class FMLCommonLaunchHandler
}
protected abstract String getNaming();
void addLibraries(final List<ModFile> libraries) {
libraries
.stream()
.map(ModFile::getFilePath)
.peek(p->LOGGER.debug(LOADING, "Adding {} as a library to the transforming classloader", p))
.forEach(additionalLibraries::add);
}
}
@@ -20,9 +20,12 @@
package net.minecraftforge.fml.loading;
import cpw.mods.modlauncher.api.IEnvironment;
import cpw.mods.modlauncher.api.TypesafeMap;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.forgespi.Environment;
import java.util.function.Supplier;
public class FMLEnvironment
{
public static final Dist dist = FMLLoader.getDist();
@@ -32,4 +35,8 @@ public class FMLEnvironment
environment.computePropertyIfAbsent(IEnvironment.Keys.NAMING.get(), v->naming);
environment.computePropertyIfAbsent(Environment.Keys.DIST.get(), v->dist);
}
public static class Keys {
public static final Supplier<TypesafeMap.Key<ClassLoader>> LOCATORCLASSLOADER = IEnvironment.buildKey("LOCATORCLASSLOADER",ClassLoader.class);
}
}
@@ -34,8 +34,11 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.loading.moddiscovery.BackgroundScanHandler;
import net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer;
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
import net.minecraftforge.fml.loading.progress.EarlyProgressVisualization;
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
import net.minecraftforge.forgespi.Environment;
import net.minecraftforge.forgespi.coremod.ICoreModProvider;
import net.minecraftforge.forgespi.locating.IModFile;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -78,6 +81,7 @@ public class FMLLoader
private static String forgeGroup;
private static Predicate<String> classLoaderExclusions;
private static String launchHandlerName;
private static FMLCommonLaunchHandler commonLaunchHandler;
static void onInitialLoad(IEnvironment environment, Set<String> otherServices) throws IncompatibleEnvironmentException
{
@@ -85,7 +89,7 @@ public class FMLLoader
LOGGER.debug(CORE,"FML {} loading", version);
final Package modLauncherPackage = ITransformationService.class.getPackage();
LOGGER.debug(CORE,"FML found ModLauncher version : {}", modLauncherPackage.getImplementationVersion());
if (!modLauncherPackage.isCompatibleWith("2.0")) {
if (!modLauncherPackage.isCompatibleWith("4.0")) {
LOGGER.fatal(CORE,"Found incompatible ModLauncher specification : {}, version {} from {}", modLauncherPackage.getSpecificationVersion(), modLauncherPackage.getImplementationVersion(), modLauncherPackage.getImplementationVendor());
throw new IncompatibleEnvironmentException("Incompatible modlauncher found "+modLauncherPackage.getSpecificationVersion());
}
@@ -172,9 +176,11 @@ public class FMLLoader
launchHandlerName = launchHandler.get().name();
gamePath = environment.getProperty(IEnvironment.Keys.GAMEDIR.get()).orElse(Paths.get(".").toAbsolutePath());
FMLCommonLaunchHandler commonLaunchHandler = (FMLCommonLaunchHandler)launchHandler.get();
commonLaunchHandler = (FMLCommonLaunchHandler)launchHandler.get();
naming = commonLaunchHandler.getNaming();
dist = commonLaunchHandler.getDist();
EarlyProgressVisualization.INSTANCE.accept(dist);
StartupMessageManager.modLoaderConsumer().ifPresent(c->c.accept("Early Loading!"));
accessTransformer.getExtension().accept(Pair.of(naming, "srg"));
mcVersion = (String) arguments.get("mcVersion");
@@ -195,12 +201,14 @@ public class FMLLoader
runtimeDistCleaner.getExtension().accept(dist);
}
public static void beginModScan(final Map<String,?> arguments)
public static Map<IModFile.Type, List<ModFile>> beginModScan(final Map<String,?> arguments)
{
LOGGER.debug(SCAN,"Scanning for Mod Locators");
modDiscoverer = new ModDiscoverer(arguments);
final BackgroundScanHandler backgroundScanHandler = modDiscoverer.discoverMods();
loadingModList = backgroundScanHandler.getLoadingModList();
commonLaunchHandler.addLibraries(backgroundScanHandler.getModFiles().getOrDefault(IModFile.Type.LIBRARY, Collections.emptyList()));
return backgroundScanHandler.getModFiles();
}
public static ICoreModProvider getCoreModProvider() {
@@ -230,13 +238,12 @@ public class FMLLoader
public static void beforeStart(ITransformingClassLoader launchClassLoader)
{
FMLLoader.launchClassLoader = (TransformingClassLoader) launchClassLoader.getInstance();
StartupMessageManager.modLoaderConsumer().ifPresent(c->c.accept("Launching minecraft"));
}
public static LoadingModList getLoadingModList()
{
return loadingModList;
}
public static TransformingClassLoader getLaunchClassLoader()
@@ -26,6 +26,7 @@ import net.minecraftforge.api.distmarker.Dist;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -78,4 +79,8 @@ public class FMLServerLaunchProvider extends FMLCommonLaunchHandler implements I
return "srg";
}
@Override
public Path[] getPaths() {
return FMLLoader.getMCPaths();
}
}
@@ -25,13 +25,23 @@ import cpw.mods.modlauncher.api.ITransformer;
import cpw.mods.modlauncher.api.IncompatibleEnvironmentException;
import joptsimple.ArgumentAcceptingOptionSpec;
import joptsimple.OptionSpecBuilder;
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
import net.minecraftforge.forgespi.Environment;
import net.minecraftforge.forgespi.locating.IModFile;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.annotation.Nonnull;
import java.util.*;
import java.nio.file.Path;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
import static net.minecraftforge.fml.loading.LogMarkers.CORE;
@@ -86,8 +96,19 @@ public class FMLServiceProvider implements ITransformationService
@Override
public void beginScanning(final IEnvironment environment) {
throw new IllegalStateException("WHY ARE YOU HERE??????");
}
@Override
public List<Map.Entry<String, Path>> runScan(final IEnvironment environment) {
LOGGER.debug(CORE,"Initiating mod scan");
FMLLoader.beginModScan(arguments);
final Map<IModFile.Type, List<ModFile>> foundFiles = FMLLoader.beginModScan(arguments);
return foundFiles
.values()
.stream()
.flatMap(Collection::stream)
.map(modFile -> new AbstractMap.SimpleImmutableEntry<>(modFile.getFileName(), modFile.getFilePath()))
.collect(Collectors.toList());
}
@Override
@@ -19,7 +19,9 @@
package net.minecraftforge.fml.loading;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collector;
import java.util.stream.Stream;
@@ -40,4 +42,12 @@ public class Java9BackportUtils
downstream.combiner(), downstream.finisher(),
downstream.characteristics().toArray(new Collector.Characteristics[0]));
}
public static <T> void ifPresentOrElse(Optional<T> optional, Consumer<? super T> action, Runnable emptyAction) {
if (optional.isPresent()) {
action.accept(optional.get());
} else {
emptyAction.run();
}
}
}
@@ -20,6 +20,7 @@
package net.minecraftforge.fml.loading;
import cpw.mods.modlauncher.ServiceLoaderStreamUtils;
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
import net.minecraftforge.forgespi.language.IModLanguageProvider;
import net.minecraftforge.fml.loading.moddiscovery.ExplodedDirectoryLocator;
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
@@ -127,6 +128,7 @@ public class LanguageLoadingProvider
throw new RuntimeException("Failed to find implementation version for language provider "+ lp.name());
}
LOGGER.debug(CORE, "Found language provider {}, version {}", lp.name(), impl);
StartupMessageManager.modLoaderConsumer().ifPresent(c->c.accept("Loaded language provider "+lp.name()+ " " + impl));
languageProviderMap.put(lp.name(), new ModLanguageWrapper(lp, new DefaultArtifactVersion(impl)));
});
}
@@ -79,7 +79,7 @@ public class LibraryFinder {
static Path[] getMCPaths(final String mcVersion, final String mcpVersion, final String forgeVersion, final String forgeGroup, final String type) {
Path srgMcPath = findLibsPath().resolve(MavenCoordinateResolver.get("net.minecraft", type, "", "srg", mcVersion+"-"+mcpVersion));
Path mcExtrasPath = findLibsPath().resolve(MavenCoordinateResolver.get("net.minecraft", type, "", "extra", mcVersion));
Path mcExtrasPath = findLibsPath().resolve(MavenCoordinateResolver.get("net.minecraft", type, "", "1.14.4".equals(mcVersion) ? "extra-stable" : "extra", mcVersion));
Path patchedBinariesPath = findLibsPath().resolve(MavenCoordinateResolver.get(forgeGroup, "forge", "", type, mcVersion+"-"+forgeVersion));
LOGGER.debug(CORE,"SRG MC at {} is {}", srgMcPath.toString(), pathStatus(srgMcPath));
LOGGER.debug(CORE,"MC Extras at {} is {}", mcExtrasPath.toString(), pathStatus(mcExtrasPath));
@@ -51,13 +51,18 @@ public class LoadingModList
private LoadingModList(final List<ModFile> modFiles, final List<ModInfo> sortedList)
{
this.modFiles = modFiles.stream().map(ModFile::getModFileInfo).map(ModFileInfo.class::cast).collect(Collectors.toList());
this.sortedList = sortedList.stream().
map(ModInfo.class::cast).
collect(Collectors.toList());
this.fileById = this.modFiles.stream().map(ModFileInfo::getMods).flatMap(Collection::stream).
map(ModInfo.class::cast).
collect(Collectors.toMap(ModInfo::getModId, ModInfo::getOwningFile));
this.modFiles = modFiles.stream()
.map(ModFile::getModFileInfo)
.map(ModFileInfo.class::cast)
.collect(Collectors.toList());
this.sortedList = sortedList.stream()
.map(ModInfo.class::cast)
.collect(Collectors.toList());
this.fileById = this.modFiles.stream()
.map(ModFileInfo::getMods)
.flatMap(Collection::stream)
.map(ModInfo.class::cast)
.collect(Collectors.toMap(ModInfo::getModId, ModInfo::getOwningFile));
this.preLoadErrors = new ArrayList<>();
}
@@ -76,19 +81,27 @@ public class LoadingModList
}
public void addCoreMods()
{
modFiles.stream().map(ModFileInfo::getFile).map(ModFile::getCoreMods).flatMap(List::stream).forEach(FMLLoader.getCoreModProvider()::addCoreMod);
modFiles.stream()
.map(ModFileInfo::getFile)
.map(ModFile::getCoreMods)
.flatMap(List::stream)
.forEach(FMLLoader.getCoreModProvider()::addCoreMod);
}
public void addAccessTransformers()
{
modFiles.stream().map(ModFileInfo::getFile).forEach(mod -> mod.getAccessTransformer().ifPresent(path -> FMLLoader.addAccessTransformer(path, mod)));
modFiles.stream()
.map(ModFileInfo::getFile)
.forEach(mod -> mod.getAccessTransformer().ifPresent(path -> FMLLoader.addAccessTransformer(path, mod)));
}
public void addForScanning(BackgroundScanHandler backgroundScanHandler)
{
this.scanner = backgroundScanHandler;
backgroundScanHandler.setLoadingModList(this);
modFiles.stream().map(ModFileInfo::getFile).forEach(backgroundScanHandler::submitForScanning);
modFiles.stream()
.map(ModFileInfo::getFile)
.forEach(backgroundScanHandler::submitForScanning);
}
public List<ModFileInfo> getModFiles()
@@ -28,36 +28,58 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.zip.ZipFile;
public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService {
@Override
public List<Path> candidates(final Path gameDirectory) {
ModDirTransformerDiscoverer.scan(gameDirectory);
return ModDirTransformerDiscoverer.transformers;
}
private static List<Path> transformers = new ArrayList<>();
private static List<Path> locators = new ArrayList<>();
public static List<Path> allExcluded() {
ArrayList<Path> paths = new ArrayList<>();
paths.addAll(transformers);
paths.addAll(locators);
return paths;
}
public static List<Path> getExtraLocators() {
return locators;
}
private static void scan(final Path gameDirectory) {
final Path modsDir = gameDirectory.resolve(FMLPaths.MODSDIR.relative());
transformers = new ArrayList<>();
locators = new ArrayList<>();
if (!Files.exists(modsDir)) {
// Skip if the mods dir doesn't exist yet.
return Collections.emptyList();
return;
}
List<Path> paths = new ArrayList<>();
try {
Files.createDirectories(modsDir);
Files.walk(modsDir, 1).forEach(p -> {
if (!Files.isRegularFile(p)) return;
if (!p.toString().endsWith(".jar")) return;
if (LamdbaExceptionUtils.uncheck(()->Files.size(p)) == 0) return;
try (ZipFile zf = new ZipFile(new File(p.toUri()))) {
if (zf.getEntry("META-INF/services/cpw.mods.modlauncher.api.ITransformationService") != null) {
paths.add(p);
}
} catch (IOException ioe) {
LogManager.getLogger().error("Zip Error when loading jar file {}", p, ioe);
}
});
Files.walk(modsDir, 1).forEach(ModDirTransformerDiscoverer::visitFile);
} catch (IOException | IllegalStateException ioe) {
LogManager.getLogger().error("Error during early discovery", ioe);
}
return paths;
}
private static void visitFile(Path path) {
if (!Files.isRegularFile(path)) return;
if (!path.toString().endsWith(".jar")) return;
if (LamdbaExceptionUtils.uncheck(() -> Files.size(path)) == 0) return;
try (ZipFile zf = new ZipFile(new File(path.toUri()))) {
if (zf.getEntry("META-INF/services/cpw.mods.modlauncher.api.ITransformationService") != null) {
transformers.add(path.toRealPath());
} else if (zf.getEntry("META-INF/services/net.minecraftforge.forgespi.locating.IModLocator") != null) {
locators.add(path.toRealPath());
}
} catch (IOException ioe) {
LogManager.getLogger().error("Zip Error when loading jar file {}", path, ioe);
}
}
}
@@ -30,12 +30,14 @@ import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import net.minecraftforge.fml.loading.toposort.CyclePresentException;
import net.minecraftforge.fml.loading.toposort.TopologicalSort;
import net.minecraftforge.forgespi.locating.IModFile;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.util.StringBuilderFormattable;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import java.util.AbstractMap;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
@@ -45,7 +47,6 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static net.minecraftforge.fml.loading.LogMarkers.LOADING;
@@ -87,11 +88,19 @@ public class ModSorter
// lambdas are identity based, so sorting them is impossible unless you hold reference to them
final MutableGraph<ModFileInfo> graph = GraphBuilder.directed().build();
AtomicInteger counter = new AtomicInteger();
Map<IModFileInfo, Integer> infos = modFiles.stream().map(ModFile::getModFileInfo).collect(Collectors.toMap(Function.identity(), (e) -> counter.incrementAndGet()));
Map<IModFileInfo, Integer> infos = modFiles
.stream()
.map(ModFile::getModFileInfo)
.collect(Collectors.toMap(Function.identity(), e -> counter.incrementAndGet()));
infos.keySet().forEach(i -> graph.addNode((ModFileInfo) i));
modFiles.stream().map(ModFile::getModInfos).flatMap(Collection::stream).
map(IModInfo::getDependencies).flatMap(Collection::stream).
forEach(dep -> addDependency(graph, dep));
modFiles
.stream()
.map(ModFile::getModInfos)
.flatMap(Collection::stream)
.map(IModInfo::getDependencies)
.flatMap(Collection::stream)
.forEach(dep -> addDependency(graph, dep));
final List<ModFileInfo> sorted;
try
{
@@ -109,15 +118,24 @@ public class ModSorter
List<ExceptionData> dataList = cycles.stream()
.map(Set::stream)
.map(stream -> stream
.flatMap(modFileInfo -> modFileInfo.getMods().stream()
.map(IModInfo::getModId)).collect(Collectors.toList()))
.flatMap(modFileInfo -> modFileInfo.getMods()
.stream()
.map(IModInfo::getModId))
.collect(Collectors.toList()))
.map(list -> new ExceptionData("fml.modloading.cycle", list))
.collect(Collectors.toList());
throw new EarlyLoadingException("Sorting error", e, dataList);
}
this.sortedList = sorted.stream().map(ModFileInfo::getMods).
flatMap(Collection::stream).map(ModInfo.class::cast).collect(Collectors.toList());
this.modFiles = sorted.stream().map(ModFileInfo::getFile).collect(Collectors.toList());
this.sortedList = sorted
.stream()
.map(ModFileInfo::getMods)
.flatMap(Collection::stream)
.map(ModInfo.class::cast)
.collect(Collectors.toList());
this.modFiles = sorted
.stream()
.map(ModFileInfo::getFile)
.collect(Collectors.toList());
}
@SuppressWarnings("UnstableApiUsage")
@@ -144,46 +162,99 @@ public class ModSorter
private void buildUniqueList()
{
final Stream<ModInfo> modInfos = modFiles.stream().map(ModFile::getModInfos).flatMap(Collection::stream).map(ModInfo.class::cast);
final Map<String, List<ModInfo>> modIds = modInfos.collect(Collectors.groupingBy(IModInfo::getModId));
// Collect mod files by first modid in the file. This will be used for deduping purposes
final Map<String, List<IModFile>> modFilesByFirstId = modFiles
.stream()
.collect(Collectors.groupingBy(mf -> mf.getModInfos().get(0).getModId()));
// TODO: make this figure out dupe handling better
final List<Map.Entry<String, List<ModInfo>>> dupedMods = modIds.entrySet().stream().filter(e -> e.getValue().size() > 1).collect(Collectors.toList());
// Select the newest by artifact version sorting of non-unique files thus identified
this.modFiles = modFilesByFirstId.entrySet().stream()
.map(this::selectNewestModInfo)
.map(Map.Entry::getValue)
.map(ModFile.class::cast)
.collect(Collectors.toList());
// Transform to the full mod id list
final Map<String, List<ModInfo>> modIds = modFiles.stream()
.map(ModFile::getModInfos)
.flatMap(Collection::stream)
.map(ModInfo.class::cast)
.collect(Collectors.groupingBy(IModInfo::getModId));
// Its theoretically possible that some mod has somehow moved an id to a secondary place, thus causing a dupe.
// We can't handle this
final List<Map.Entry<String, List<ModInfo>>> dupedMods = modIds
.entrySet()
.stream()
.filter(e -> e.getValue().size() > 1)
.collect(Collectors.toList());
if (!dupedMods.isEmpty()) {
final List<EarlyLoadingException.ExceptionData> duplicateModErrors = dupedMods.stream().
map(dm -> new EarlyLoadingException.ExceptionData("fml.modloading.dupedmod", dm.getValue().get(0))).
collect(Collectors.toList());
final List<EarlyLoadingException.ExceptionData> duplicateModErrors = dupedMods
.stream()
.map(dm -> new EarlyLoadingException.ExceptionData("fml.modloading.dupedmod", dm.getValue().get(0)))
.collect(Collectors.toList());
throw new EarlyLoadingException("Duplicate mods found", null, duplicateModErrors);
}
modIdNameLookup = modIds.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().get(0)));
modIdNameLookup = modIds
.entrySet()
.stream()
.collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().get(0)));
}
private Map.Entry<String, IModFile> selectNewestModInfo(Map.Entry<String, List<IModFile>> fullList) {
List<IModFile> modInfoList = fullList.getValue();
if (modInfoList.size() > 1) {
LOGGER.debug("Found {} mods for first modid {}, selecting most recent based on version data", modInfoList.size(), fullList.getKey());
modInfoList.sort(Comparator.<IModFile, ArtifactVersion>comparing(mf -> mf.getModInfos().get(0).getVersion()).reversed());
LOGGER.debug("Selected file {} for modid {} with version {}", modInfoList.get(0).getFileName(), fullList.getKey(), modInfoList.get(0).getModInfos().get(0).getVersion());
}
return new AbstractMap.SimpleImmutableEntry<>(fullList.getKey(), modInfoList.get(0));
}
private void verifyDependencyVersions()
{
final Map<String, ArtifactVersion> modVersions = modFiles.stream().map(ModFile::getModInfos).
flatMap(Collection::stream).collect(Collectors.toMap(IModInfo::getModId, IModInfo::getVersion));
final Map<IModInfo, List<IModInfo.ModVersion>> modVersionDependencies = modFiles.stream().
map(ModFile::getModInfos).flatMap(Collection::stream).
collect(Collectors.groupingBy(Function.identity(), Java9BackportUtils.flatMapping(e -> e.getDependencies().stream(), Collectors.toList())));
final Set<IModInfo.ModVersion> mandatoryModVersions = modVersionDependencies.values().stream().flatMap(Collection::stream).
filter(mv -> mv.isMandatory() && mv.getSide().isCorrectSide()).collect(Collectors.toSet());
final Map<String, ArtifactVersion> modVersions = modFiles
.stream()
.map(ModFile::getModInfos)
.flatMap(Collection::stream)
.collect(Collectors.toMap(IModInfo::getModId, IModInfo::getVersion));
final Map<IModInfo, List<IModInfo.ModVersion>> modVersionDependencies = modFiles
.stream()
.map(ModFile::getModInfos)
.flatMap(Collection::stream)
.collect(Collectors.groupingBy(Function.identity(), Java9BackportUtils.flatMapping(e -> e.getDependencies().stream(), Collectors.toList())));
final Set<IModInfo.ModVersion> mandatoryModVersions = modVersionDependencies
.values()
.stream()
.flatMap(Collection::stream)
.filter(mv -> mv.isMandatory() && mv.getSide().isCorrectSide())
.collect(Collectors.toSet());
LOGGER.debug(LOADING, "Found {} mandatory requirements", mandatoryModVersions.size());
final Set<IModInfo.ModVersion> missingVersions = mandatoryModVersions.stream().filter(mv->this.modVersionMatches(mv, modVersions)).collect(Collectors.toSet());
final Set<IModInfo.ModVersion> missingVersions = mandatoryModVersions
.stream()
.filter(mv->this.modVersionMatches(mv, modVersions))
.collect(Collectors.toSet());
LOGGER.debug(LOADING, "Found {} mandatory mod requirements missing", missingVersions.size());
if (!missingVersions.isEmpty()) {
final List<EarlyLoadingException.ExceptionData> exceptionData = missingVersions.stream().map(mv ->
new EarlyLoadingException.ExceptionData("fml.modloading.missingdependency", mv.getModId(),
mv.getOwner().getModId(), mv.getVersionRange(), modVersions.getOrDefault(mv.getModId(), new DefaultArtifactVersion("null")))).
collect(Collectors.toList());
final List<EarlyLoadingException.ExceptionData> exceptionData = missingVersions
.stream()
.map(mv -> new EarlyLoadingException.ExceptionData("fml.modloading.missingdependency",
mv.getModId(), mv.getOwner().getModId(), mv.getVersionRange(),
modVersions.getOrDefault(mv.getModId(), new DefaultArtifactVersion("null"))))
.collect(Collectors.toList());
throw new EarlyLoadingException("Missing mods", null, exceptionData);
}
}
private boolean modVersionMatches(final IModInfo.ModVersion mv, final Map<String, ArtifactVersion> modVersions)
{
return !modVersions.containsKey(mv.getModId()) || !mv.getVersionRange().containsVersion(modVersions.get(mv.getModId()));
return !(modVersions.containsKey(mv.getModId()) &&
(mv.getVersionRange().containsVersion(modVersions.get(mv.getModId())) || modVersions.get(mv.getModId()).toString().equals("NONE")));
}
}
@@ -21,11 +21,13 @@ package net.minecraftforge.fml.loading.moddiscovery;
import net.minecraftforge.forgespi.language.ModFileScanData;
import net.minecraftforge.fml.loading.LoadingModList;
import net.minecraftforge.forgespi.locating.IModFile;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -40,9 +42,11 @@ public class BackgroundScanHandler
private final List<ModFile> pendingFiles;
private final List<ModFile> scannedFiles;
private final List<ModFile> allFiles;
private final Map<IModFile.Type, List<ModFile>> modFiles;
private LoadingModList loadingModList;
public BackgroundScanHandler() {
public BackgroundScanHandler(final Map<IModFile.Type, List<ModFile>> modFiles) {
this.modFiles = modFiles;
modContentScanner = Executors.newSingleThreadExecutor(r -> {
final Thread thread = Executors.defaultThreadFactory().newThread(r);
thread.setDaemon(true);
@@ -53,6 +57,10 @@ public class BackgroundScanHandler
allFiles = new ArrayList<>();
}
public Map<IModFile.Type, List<ModFile>> getModFiles() {
return modFiles;
}
public void submitForScanning(final ModFile file) {
if (modContentScanner.isShutdown()) {
throw new IllegalStateException("Scanner has shutdown");
@@ -19,11 +19,16 @@
package net.minecraftforge.fml.loading.moddiscovery;
import cpw.mods.gross.Java9ClassLoaderUtil;
import cpw.mods.modlauncher.Launcher;
import cpw.mods.modlauncher.ServiceLoaderStreamUtils;
import cpw.mods.modlauncher.api.LamdbaExceptionUtils;
import net.minecraftforge.fml.loading.FMLEnvironment;
import net.minecraftforge.fml.loading.FMLLoader;
import net.minecraftforge.fml.loading.LoadingModList;
import net.minecraftforge.fml.loading.ModDirTransformerDiscoverer;
import net.minecraftforge.fml.loading.ModSorter;
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
import net.minecraftforge.forgespi.Environment;
import net.minecraftforge.forgespi.locating.IModFile;
import net.minecraftforge.forgespi.locating.IModLocator;
@@ -33,6 +38,8 @@ import org.apache.logging.log4j.Logger;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
@@ -63,10 +70,19 @@ public class ModDiscoverer {
private static final Logger LOGGER = LogManager.getLogger();
private final ServiceLoader<IModLocator> locators;
private final List<IModLocator> locatorList;
private final LocatorClassLoader locatorClassLoader;
public ModDiscoverer(Map<String, ?> arguments) {
Launcher.INSTANCE.environment().computePropertyIfAbsent(Environment.Keys.MODFOLDERFACTORY.get(), v->ModsFolderLocator::new);
locators = ServiceLoader.load(IModLocator.class);
Launcher.INSTANCE.environment().computePropertyIfAbsent(Environment.Keys.MODDIRECTORYFACTORY.get(), v->ModsFolderLocator::new);
Launcher.INSTANCE.environment().computePropertyIfAbsent(Environment.Keys.PROGRESSMESSAGE.get(), v->StartupMessageManager.locatorConsumer().orElseGet(()->s->{}));
locatorClassLoader = new LocatorClassLoader();
Launcher.INSTANCE.environment().computePropertyIfAbsent(FMLEnvironment.Keys.LOCATORCLASSLOADER.get(), v->locatorClassLoader);
ModDirTransformerDiscoverer.getExtraLocators()
.stream()
.map(LamdbaExceptionUtils.rethrowFunction(p->p.toUri().toURL()))
.forEach(locatorClassLoader::addURL);
locators = ServiceLoader.load(IModLocator.class, locatorClassLoader);
locatorList = ServiceLoaderStreamUtils.toList(this.locators);
locatorList.forEach(l->l.initArguments(arguments));
locatorList.add(new MinecraftLocator());
@@ -75,6 +91,7 @@ public class ModDiscoverer {
ModDiscoverer(List<IModLocator> locatorList) {
this.locatorList = locatorList;
this.locatorClassLoader = null;
this.locators = null;
}
@@ -85,11 +102,12 @@ public class ModDiscoverer {
.map(IModLocator::scanMods)
.flatMap(Collection::stream)
.peek(mf -> LOGGER.debug(SCAN,"Found mod file {} of type {} with locator {}", mf.getFileName(), mf.getType(), mf.getLocator()))
.peek(mf -> StartupMessageManager.modLoaderConsumer().ifPresent(c->c.accept("Found mod file "+mf.getFileName()+" of type "+mf.getType())))
.map(ModFile.class::cast)
.collect(Collectors.groupingBy(IModFile::getType));
FMLLoader.getLanguageLoadingProvider().addAdditionalLanguages(modFiles.get(IModFile.Type.LANGPROVIDER));
BackgroundScanHandler backgroundScanHandler = new BackgroundScanHandler();
BackgroundScanHandler backgroundScanHandler = new BackgroundScanHandler(modFiles);
final List<ModFile> mods = modFiles.getOrDefault(IModFile.Type.MOD, Collections.emptyList());
final List<ModFile> brokenFiles = new ArrayList<>();
for (Iterator<ModFile> iterator = mods.iterator(); iterator.hasNext(); )
@@ -102,6 +120,7 @@ public class ModDiscoverer {
}
}
LOGGER.debug(SCAN,"Found {} mod files with {} mods", mods::size, ()->mods.stream().mapToInt(mf -> mf.getModInfos().size()).sum());
StartupMessageManager.modLoaderConsumer().ifPresent(c->c.accept("Found "+mods.size()+" modfiles to load"));
final LoadingModList loadingModList = ModSorter.sort(mods);
loadingModList.addCoreMods();
loadingModList.addAccessTransformers();
@@ -110,6 +129,16 @@ public class ModDiscoverer {
return backgroundScanHandler;
}
private static class LocatorClassLoader extends URLClassLoader {
LocatorClassLoader() {
super(Java9ClassLoaderUtil.getSystemClassPathURLs(), getSystemClassLoader());
}
@Override
protected void addURL(final URL url) {
super.addURL(url);
}
}
private static class MinecraftLocator implements IModLocator {
private final Path mcJar = FMLLoader.getMCPaths()[0];
private final FileSystem fileSystem;
@@ -20,6 +20,7 @@
package net.minecraftforge.fml.loading.moddiscovery;
import com.google.common.collect.ImmutableMap;
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
import net.minecraftforge.forgespi.language.IModFileInfo;
import net.minecraftforge.forgespi.language.IModInfo;
import net.minecraftforge.forgespi.language.ModFileScanData;
@@ -91,7 +92,7 @@ public class ModFile implements IModFile {
private List<CoreModFile> coreMods;
private Path accessTransformer;
private static final Attributes.Name TYPE = new Attributes.Name("FMLModType");
public static final Attributes.Name TYPE = new Attributes.Name("FMLModType");
public ModFile(final Path file, final IModLocator locator) {
this.locator = locator;
@@ -178,6 +179,7 @@ public class ModFile implements IModFile {
if (throwable != null) {
this.scanError = throwable;
}
StartupMessageManager.modLoaderConsumer().ifPresent(c->c.accept("Completed deep scan of "+this.getFileName()));
}
@Override
@@ -24,6 +24,8 @@ import net.minecraftforge.forgespi.language.MavenVersionAdapter;
import net.minecraftforge.forgespi.language.IModFileInfo;
import net.minecraftforge.forgespi.language.IModInfo;
import net.minecraftforge.fml.loading.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.maven.artifact.versioning.VersionRange;
import java.net.URL;
@@ -31,8 +33,11 @@ import java.util.*;
import java.util.jar.Manifest;
import java.util.stream.Collectors;
import static net.minecraftforge.fml.loading.LogMarkers.LOADING;
public class ModFileInfo implements IModFileInfo
{
private static final Logger LOGGER = LogManager.getLogger();
private final UnmodifiableConfig config;
private final ModFile modFile;
private final URL issueURL;
@@ -64,6 +69,10 @@ public class ModFileInfo implements IModFileInfo
}
this.mods = modConfigs.stream().map(mi-> new ModInfo(this, mi)).collect(Collectors.toList());
this.issueURL = config.<String>getOptional("issueTrackerURL").map(StringUtils::toURL).orElse(null);
LOGGER.debug(LOADING, "Found valid mod file {} with {} mods - versions {}",
this.modFile::getFileName,
() -> mods.stream().map(IModInfo::getModId).collect(Collectors.joining(",", "{", "}")),
() -> mods.stream().map(IModInfo::getVersion).map(Objects::toString).collect(Collectors.joining(",", "{", "}")));
}
@Override
@@ -42,7 +42,7 @@ public class ModFileParser {
private static final Logger LOGGER = LogManager.getLogger();
public static IModFileInfo readModList(final ModFile modFile) {
LOGGER.debug(LOADING,"Parsing mod file candidate {}", modFile.getFilePath());
LOGGER.debug(LOADING,"Considering mod file candidate {}", modFile.getFilePath());
final Path modsjson = modFile.getLocator().findPath(modFile, "META-INF", "mods.toml");
if (!Files.exists(modsjson)) {
LOGGER.warn(LOADING, "Mod file {} is missing mods.toml file", modFile);
@@ -151,6 +151,10 @@ public class ModInfo implements IModInfo
return this.logoFile;
}
/**
* This is no longer used. The Mods List GUI currently directly checks whether there is an EntryPoint registered.
*/
@Deprecated
public boolean hasConfigUI()
{
return false;
@@ -19,9 +19,9 @@
package net.minecraftforge.fml.loading.moddiscovery;
import net.minecraftforge.fml.loading.FMLPaths;
import net.minecraftforge.fml.loading.ModDirTransformerDiscoverer;
import net.minecraftforge.fml.loading.StringUtils;
import net.minecraftforge.fml.loading.FMLPaths;
import net.minecraftforge.forgespi.locating.IModFile;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -43,41 +43,44 @@ public class ModsFolderLocator extends AbstractJarFileLocator {
private static final String SUFFIX = ".jar";
private static final Logger LOGGER = LogManager.getLogger();
private final Path modFolder;
private final String customName;
public ModsFolderLocator() {
this(FMLPaths.MODSDIR.get());
}
ModsFolderLocator(Path modFolder) {
super();
this.modFolder = modFolder;
this(modFolder, "mods folder");
}
ModsFolderLocator(Path modFolder, String name) {
this.modFolder = modFolder;
this.customName = name;
}
@Override
public List<IModFile> scanMods() {
LOGGER.debug(SCAN,"Scanning mods dir {} for mods", this.modFolder);
List<Path> excluded = new ModDirTransformerDiscoverer().candidates(FMLPaths.GAMEDIR.get());
return uncheck(()-> Files.list(this.modFolder)).
filter(p->!excluded.contains(p)).
sorted(Comparator.comparing(path-> StringUtils.toLowerCase(path.getFileName().toString()))).
filter(p->StringUtils.toLowerCase(p.getFileName().toString()).endsWith(SUFFIX)).
map(p->new ModFile(p, this)).
peek(f->modJars.compute(f, (mf, fs)->createFileSystem(mf))).
collect(Collectors.toList());
List<Path> excluded = ModDirTransformerDiscoverer.allExcluded();
return uncheck(()-> Files.list(this.modFolder))
.filter(p->!excluded.contains(p))
.sorted(Comparator.comparing(path-> StringUtils.toLowerCase(path.getFileName().toString())))
.filter(p->StringUtils.toLowerCase(p.getFileName().toString()).endsWith(SUFFIX))
.map(p->new ModFile(p, this))
.peek(f->modJars.compute(f, (mf, fs)->createFileSystem(mf)))
.collect(Collectors.toList());
}
@Override
public String name() {
return "mods folder";
return customName;
}
@Override
public String toString() {
return "{ModJarsFolder locator at "+this.modFolder+"}";
return "{"+customName+" locator at "+this.modFolder+"}";
}
@Override
public void initArguments(final Map<String, ?> arguments) {
}
}
@@ -45,8 +45,10 @@ public class Scanner {
result.addModFileInfo(fileToScan.getModFileInfo());
fileToScan.scanFile(p -> fileVisitor(p, result));
final IModLanguageProvider loader = fileToScan.getLoader();
LOGGER.debug(SCAN, "Scanning {} with language loader {}", fileToScan.getFilePath(), loader.name());
loader.getFileVisitor().accept(result);
if (loader != null) {
LOGGER.debug(SCAN, "Scanning {} with language loader {}", fileToScan.getFilePath(), loader.name());
loader.getFileVisitor().accept(result);
}
return result;
}
@@ -0,0 +1,267 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* 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
*/
package net.minecraftforge.fml.loading.progress;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;
import org.lwjgl.glfw.GLFWErrorCallback;
import org.lwjgl.glfw.GLFWVidMode;
import org.lwjgl.opengl.GL;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
import org.lwjgl.stb.STBEasyFont;
import org.lwjgl.system.MemoryStack;
import org.lwjgl.system.MemoryUtil;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryUsage;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.List;
import static org.lwjgl.glfw.Callbacks.glfwFreeCallbacks;
import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.glfw.GLFW.glfwCreateWindow;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.system.MemoryStack.stackPush;
import static org.lwjgl.system.MemoryUtil.NULL;
class ClientVisualization implements EarlyProgressVisualization.Visualization {
private final int screenWidth = 800;
private final int screenHeight = 400;
private long window;
private Thread thread;
private boolean running;
private void initWindow() {
GLFWErrorCallback.createPrint(System.err).set();
long glfwInitBegin = System.nanoTime();
if (!glfwInit()) {
throw new IllegalStateException("Unable to initialize GLFW");
}
long glfwInitEnd = System.nanoTime();
if (glfwInitEnd - glfwInitBegin > 1e9) {
LogManager.getLogger().fatal("WARNING : glfwInit took {} seconds to start.", (glfwInitEnd-glfwInitBegin) / 1.0e9);
}
glfwDefaultWindowHints();
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
window = glfwCreateWindow(screenWidth, screenHeight, "FML early loading progress", NULL, NULL);
if (window == NULL) {
throw new RuntimeException("Failed to create the GLFW window"); // ignore it and make the GUI optional?
}
try (MemoryStack stack = stackPush()) {
IntBuffer pWidth = stack.mallocInt(1);
IntBuffer pHeight = stack.mallocInt(1);
IntBuffer monPosLeft = stack.mallocInt(1);
IntBuffer monPosTop = stack.mallocInt(1);
glfwGetWindowSize(window, pWidth, pHeight);
GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());
glfwGetMonitorPos(glfwGetPrimaryMonitor(), monPosLeft, monPosTop);
// Center the window
glfwSetWindowPos(
window,
(vidmode.width() - pWidth.get(0)) / 2 + monPosLeft.get(0),
(vidmode.height() - pHeight.get(0)) / 2 + monPosTop.get(0)
);
}
glfwMakeContextCurrent(window);
glfwSwapInterval(1);
glfwShowWindow(window);
GL.createCapabilities();
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
}
private void renderProgress() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0D, screenWidth, screenHeight, 0.0D, -1000.0D, 1000.0D);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// // replace with more modern opengl?
// glBegin(GL_QUADS);
// glColor3f(0.1f, 0.1f, 0.9f);
// glVertex2f(0, 0);
// glVertex2f(0, screenHeight);
// glVertex2f(screenWidth * progress, screenHeight);
// glVertex2f(screenWidth * progress, 0);
// glEnd();
glEnableClientState(GL11.GL_VERTEX_ARRAY);
glEnable(GL_BLEND);
renderMessages();
glfwSwapBuffers(window);
glfwPollEvents();
}
private static float clamp(float num, float min, float max) {
if (num < min) {
return min;
} else {
return num > max ? max : num;
}
}
private static int clamp(int num, int min, int max) {
if (num < min) {
return min;
} else {
return num > max ? max : num;
}
}
private static int hsvToRGB(float hue, float saturation, float value) {
int i = (int)(hue * 6.0F) % 6;
float f = hue * 6.0F - (float)i;
float f1 = value * (1.0F - saturation);
float f2 = value * (1.0F - f * saturation);
float f3 = value * (1.0F - (1.0F - f) * saturation);
float f4;
float f5;
float f6;
switch(i) {
case 0:
f4 = value;
f5 = f3;
f6 = f1;
break;
case 1:
f4 = f2;
f5 = value;
f6 = f1;
break;
case 2:
f4 = f1;
f5 = value;
f6 = f3;
break;
case 3:
f4 = f1;
f5 = f2;
f6 = value;
break;
case 4:
f4 = f3;
f5 = f1;
f6 = value;
break;
case 5:
f4 = value;
f5 = f1;
f6 = f2;
break;
default:
throw new RuntimeException("Something went wrong when converting from HSV to RGB. Input was " + hue + ", " + saturation + ", " + value);
}
int j = clamp((int)(f4 * 255.0F), 0, 255);
int k = clamp((int)(f5 * 255.0F), 0, 255);
int l = clamp((int)(f6 * 255.0F), 0, 255);
return j << 16 | k << 8 | l;
}
private void renderMessages() {
List<Pair<Integer, StartupMessageManager.Message>> messages = StartupMessageManager.getMessages();
for (int i = 0; i < messages.size(); i++) {
final Pair<Integer, StartupMessageManager.Message> pair = messages.get(i);
final float fade = clamp((4000.0f - (float) pair.getLeft() - ( i - 4 ) * 1000.0f) / 5000.0f, 0.0f, 1.0f);
if (fade <0.01f) continue;
StartupMessageManager.Message msg = pair.getRight();
renderMessage(msg.getText(), msg.getTypeColour(), ((screenHeight - 15) / 20) - i, fade);
}
renderMemoryInfo();
}
private static final float[] memorycolour = new float[] { 0.0f, 0.0f, 0.0f};
private void renderMemoryInfo() {
final MemoryUsage heapusage = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
final MemoryUsage offheapusage = ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage();
final float pctmemory = (float) heapusage.getUsed() / heapusage.getMax();
String memory = String.format("Memory Heap: %d / %d MB (%.1f%%) OffHeap: %d MB", heapusage.getUsed() >> 20, heapusage.getMax() >> 20, pctmemory * 100.0, offheapusage.getUsed() >> 20);
final int i = hsvToRGB((1.0f - (float)Math.pow(pctmemory, 1.5f)) / 3f, 1.0f, 0.5f);
memorycolour[2] = ((i) & 0xFF) / 255.0f;
memorycolour[1] = ((i >> 8 ) & 0xFF) / 255.0f;
memorycolour[0] = ((i >> 16 ) & 0xFF) / 255.0f;
renderMessage(memory, memorycolour, 1, 1.0f);
}
private void renderMessage(final String message, final float[] colour, int row, float alpha) {
ByteBuffer charBuffer = MemoryUtil.memAlloc(message.length() * 270);
int quads = STBEasyFont.stb_easy_font_print(0, 0, message, null, charBuffer);
glVertexPointer(3, GL11.GL_FLOAT, 16, charBuffer);
glEnable(GL_BLEND);
GL14.glBlendColor(0,0,0, alpha);
glBlendFunc(GL14.GL_CONSTANT_ALPHA, GL14.GL_ONE_MINUS_CONSTANT_ALPHA);
glColor3f(colour[0], colour[1], colour[2]);
glPushMatrix();
glTranslatef(10, row * 20, 0);
glScalef(2, 2, 1);
glDrawArrays(GL11.GL_QUADS, 0, quads * 4);
glPopMatrix();
MemoryUtil.memFree(charBuffer);
}
private void closeWindow() {
glfwFreeCallbacks(window);
glfwDestroyWindow(window);
glfwTerminate();
glfwSetErrorCallback(null).free();
}
@Override
public void start() {
thread = new Thread(this::run);
thread.setDaemon(true);
thread.start();
}
private void run() {
running = true;
initWindow();
while (running) {
renderProgress();
try {
Thread.sleep(50);
} catch (InterruptedException e) {
}
}
closeWindow();
}
@Override
public void join() {
running = false;
try {
thread.join();
} catch (InterruptedException e) {
}
}
}
@@ -0,0 +1,59 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* 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
*/
package net.minecraftforge.fml.loading.progress;
import net.minecraftforge.api.distmarker.Dist;
import java.util.Locale;
public enum EarlyProgressVisualization {
INSTANCE;
private Visualization visualization;
public void accept(final Dist dist) {
if (visualization != null) return;
// We don't show the window on Mac because mac is super mega triple shit and can't handle anything out of the ordinary
final boolean ismac = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("mac");
visualization = dist.isClient() && !ismac && Boolean.parseBoolean(System.getProperty("fml.earlyprogresswindow", "true")) ? new ClientVisualization() : new NoVisualization();
visualization.start();
}
public void join() {
visualization.join();
}
interface Visualization {
void start();
void join();
}
private static class NoVisualization implements Visualization {
@Override
public void start() {
}
@Override
public void join() {
}
}
}
@@ -0,0 +1,108 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* 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
*/
package net.minecraftforge.fml.loading.progress;
import com.google.common.base.Ascii;
import com.google.common.base.CharMatcher;
import org.apache.commons.lang3.tuple.Pair;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Consumer;
import java.util.stream.Collectors;
public class StartupMessageManager {
private static final EnumMap<MessageType, List<Message>> messages = new EnumMap<>(MessageType.class);
static {
Arrays.stream(MessageType.values()).forEach(mt->messages.computeIfAbsent(mt, k->new CopyOnWriteArrayList<>()));
}
public static List<Pair<Integer,Message>> getMessages() {
final long ts = System.nanoTime();
return messages.values().stream().flatMap(Collection::stream).
sorted(Comparator.comparingLong(Message::getTimestamp).thenComparing(Message::getText).reversed()).
map(m -> Pair.of((int) ((ts - m.timestamp) / 1e6), m)).
collect(Collectors.toList());
}
public static class Message {
private final String text;
private final MessageType type;
private final long timestamp;
public Message(final String text, final MessageType type) {
this.text = text;
this.type = type;
this.timestamp = System.nanoTime();
}
public String getText() {
return text;
}
MessageType getType() {
return type;
}
long getTimestamp() {
return timestamp;
}
public float[] getTypeColour() {
return type.colour();
}
}
enum MessageType {
MC(0.0f, 0.0f, 0.0f),
ML(0.0f, 0.0f, 0.5f),
LOC(0.0f, 0.5f, 0.0f),
MOD(0.5f, 0.0f, 0.0f);
private final float[] colour;
MessageType(final float r, final float g, final float b) {
colour = new float[] {r,g,b};
}
public float[] colour() {
return colour;
}
}
public static void addModMessage(final String message) {
final String safeMessage = Ascii.truncate(CharMatcher.ascii().retainFrom(message),80,"~");
final List<Message> messages = StartupMessageManager.messages.get(MessageType.MOD);
messages.subList(0, Math.max(0, messages.size() - 20)).clear();
messages.add(new Message(safeMessage, MessageType.MOD));
}
public static Optional<Consumer<String>> modLoaderConsumer() {
return Optional.of(s-> messages.get(MessageType.ML).add(new Message(s, MessageType.ML)));
}
public static Optional<Consumer<String>> locatorConsumer() {
return Optional.of(s -> messages.get(MessageType.LOC).add(new Message(s, MessageType.LOC)));
}
static Optional<Consumer<String>> mcLoaderConsumer() {
return Optional.of(s-> messages.get(MessageType.MC).add(new Message(s, MessageType.MC)));
}
}
Loaded 100 of 290 files, more files were not shown because too many files have changed in this diff. Show more