Compare commits

...
114 Commits
Author SHA1 Message Date
Philipp adb4a1953f dimesnion -> dimension typos (#5684) 2019-04-09 22:34:34 -04:00
ben-mkiv 34e6cf6f6a FENCES_NETHER_BRRICK => FENCES_NETHER_BRICK (#5681) 2019-04-08 22:19:08 -04:00
Hugman 65233abea5 GEMS_QUARRTZ -> GEMS_QUARTZ (#5635) 2019-04-08 22:19:08 -04:00
Cadiboo e508096af9 Small comment typo fixes for ObfuscationReflectionHelper (#5583) 2019-04-08 22:19:08 -04:00
cpw aa7380acc6 Actually parse the i18n exception message into the super constructor,
so the exception has a useful text message, even in crash logs and
on the server.

Signed-off-by: cpw <[email protected]>
2019-04-06 14:22:24 -04:00
cpw cdbd842494 Refactor to use naming service, and provide an MCP naming service when
in userdev. Step 1 to supporting loading SRG mods in userdev.

Signed-off-by: cpw <[email protected]>
2019-04-06 12:10:54 -04:00
Vincent Lee 323fdb014d Fix respawnevent being fired with old player instead of new. Fixes #5658 (#5668) 2019-04-04 19:41:27 -07:00
cpw 3f735b715b Implement API for mods to control their server status response..
Signed-off-by: cpw <[email protected]>
2019-03-31 16:36:49 -04:00
cpw 4ecb04ed9f Merge branch 'pull/5636' into 1.13.x 2019-03-30 15:03:48 -04:00
cpw e0361047f7 Fix StartupQuery to run properly on dedicated server.. Closes #5649
Signed-off-by: cpw <[email protected]>
2019-03-30 14:46:30 -04:00
tterrag 37016ca77f Remove remaining deprecations, improve a few patch comments 2019-03-29 16:58:33 -04:00
tterrag 98ef5049f4 Fix BrandingControl caching text through resource reload 2019-03-29 16:29:26 -04:00
tterrag 98a470d813 Add back EntityPlayer patch to return main inventory in IItemHandler
Fixes #5638
2019-03-26 01:22:58 -04:00
cpw 944d760855 Fire the ModIdRemappingEvent on the Forge Event bus. Closes #5632
Signed-off-by: cpw <[email protected]>
2019-03-25 21:55:34 -04:00
cpw e0e999da0d Remove redundant method call in Minecraft patch. Also fix a translation
string error (closes #5643)

Signed-off-by: cpw <[email protected]>
2019-03-25 21:55:33 -04:00
tterrag 2f486f2bdd Add method to IResourcePack to hide it entirely from the UI (#5525) 2019-03-25 17:24:37 -04:00
JoJoDeveloping 7e4101b3ad Remove game registry comparsion from list ping
Signed-off-by: JoJoDeveloping <[email protected]>
2019-03-25 22:22:29 +01:00
cpw d8d30e1f82 Defer configuration of channel until it is actually available during
connection. Closes #5626

Signed-off-by: cpw <[email protected]>
2019-03-25 17:20:44 -04:00
Brennan Ward 36470f69ad Add class to wrap IItemHandler as IInventory for easier recipe interaction. (#5522) 2019-03-25 12:31:54 -07:00
mezz 5fa732d223 Remove uses of java.awt (#5591)
`java.awt` will statically load itself when `java.awt.Color`, `java.awt.Dimension`, etc are loaded.
This conflicts with lwjgl3 and must be avoided (except for in mojang's server gui).
2019-03-25 12:06:20 -07:00
Vincent Lee 5e7279b0a2 Fix PlayerInteractEvent using Dist when it should be using LogicalSide (#5611) 2019-03-25 11:41:08 -07:00
JoJoDeveloping 4764136d47 Re-Add the list ping compatibility checker
Signed-off-by: JoJoDeveloping <[email protected]>
2019-03-25 15:15:25 +01:00
tterrag 10a06157aa Update Night-Config to 3.5.0, improve defineEnum methods
Closes #5537
2019-03-23 00:12:48 -04:00
tterrag d7ba9a50df Fix loading errors GUI crashing when errors occur during construction 2019-03-22 20:58:10 -04:00
LexManos 18400e8457 Revive CapabilityProvider on entity revive. Madders should NOT need this, as caps are copied via NBT. 2019-03-19 21:21:37 -07:00
LexManos f5375783c6 Do not invalidate caps when entity is being moved across worlds. Should fix #5500 2019-03-19 14:10:29 -07:00
LexManos 8045e48952 Fix NPE in TileEntityPistonRender when class is created to early. 2019-03-17 22:15:52 -07:00
Ben Staddon be18bdee88 Fix getDefaultCreatorModId for enchanted books (#5534) 2019-03-17 13:51:10 -07:00
tterrag 1e34f331da Handle null return from ResourcePackInfo.createResourcePack 2019-03-16 01:52:37 -04:00
cpw d99a55a7d1 Allow login packets to only generate on server based connections
Run injectSnapshot on the client thread, wait for result and
disconnect when injectSnapshot fails.
Fix DevServer to load MOD_CLASSES
Fix LaunchTesting to properly load log4j2 markers (don't use a
static variable in that class!)

Signed-off-by: cpw <[email protected]>
2019-03-15 23:22:28 -04:00
tterrag 0141a959eb Exclude PR builds from discord and changelog 2019-03-14 19:33:50 -04:00
tterrag d04c849a23 Exclude noci branches from travis 2019-03-14 19:02:08 -04:00
Ben Staddon 329e04b068 Fix being unable to plant nether wart (#5572) 2019-03-13 22:37:37 -07:00
LexManos d0c7a496f7 Fix silk touch not working on Ender Chests. 2019-03-13 15:55:18 -07:00
its_meow ff6fa31b1d Fix entity spawn packet pitch (reversed yaw/pitch) (#5603) 2019-03-13 12:53:48 -07:00
LexManos 554952e02a Fix invalid inventory being sent to ItemCraftedEvent Closes #5580
Fixed custom ingredient network serialization by removing unneeded mark. Closes #5577
Changed HorseArmorType constructor to not prefix vanilla paths to custom armors. Closes #5574
Fix removeBlock being called with invalid canHarvest value. Closes #5570
2019-03-11 16:40:59 -07:00
ichttt 00845d5252 Add UI for warnings that occurred during loading (#5530) 2019-03-11 15:32:37 -07:00
LexManos 7113f4400c Fix max entity radius not being settable by making it a instance method on world. Closes #5601
Fix VoidFluidHandler.INSTANCE not being a instance of VoidFluidHandler. Closes #5602
Remove backwards compat code and make IItemHandler.isItemValid non-default. Closes #5598
2019-03-11 15:04:04 -07:00
cpw 7292b63052 Add way to publish the reobf Jar with the maven-publish
task. The standard way does not publish reobfuscated
artifacts.

Signed-off-by: cpw <[email protected]>
2019-03-09 18:43:20 -05:00
cpw 7cfc5c3316 Add in the ability to load modlists from a file.
This is simple: <modfile>.list is a newline separated list
of maven-like coordinates for mods to load into the game.
They are searched for in all known maven roots.

Signed-off-by: cpw <[email protected]>
2019-03-09 17:51:37 -05:00
LexManos 1d0c67d67b Fix rails not being able to be placed on hoppers. 2019-03-08 11:50:41 -08:00
LexManos 47e6b34d2b DimensionManager.registerDimension now returns the DimensionType instance for convienance.
You can still access others in DimensionType.getByName()
Fixed ForgeRegistry rappers not forwarding isEmpty.
2019-03-06 21:01:12 -08:00
LexManos 3003e33074 Refactor Userdev and Forgedev launching.
Locating mods on the classpath in dev should solve linked MC sources when debugging.
As well as loading deobfed mods.
Rewrote how arguments are handled in dev, so users can overwrite any defaults we provide.
Added basic Yggdrasil auth support. Passing in --username and --password arguments.
ONLY USE IF NECESSARY. Forge is NOT responsible for your login information.
2019-03-06 20:59:32 -08:00
LexManos 7bd7b059c4 Make userdev parse out the classifier for the Forge jar that is on the classpath.
Should fix debugging Minecraft at dev time.
2019-03-06 12:06:49 -08:00
cpw 230d69b772 Tidy up network initialization, and force it to classload early in
modloading lifecycle. Closes #5576

Signed-off-by: cpw <[email protected]>
2019-03-04 08:22:46 -05:00
cpw cbfa572acb Tweak log4j2 config and allow access to classdump functionality from
modlauncher.

Signed-off-by: cpw <[email protected]>
2019-03-02 15:31:35 -05:00
cpw 8f5a2be6fd Fix #5584 by copying the zipped resource to a temporary directory if
paulscode is requesting it. This is so icky.

Signed-off-by: cpw <[email protected]>
2019-03-01 22:07:11 -05:00
cpw 45f5f0904a Log a message as well, when we crash.
Signed-off-by: cpw <[email protected]>
2019-03-01 19:48:25 -05:00
cpw 6db8b3c26d Try writing a temporary file to disk when a paulscode thread requests
a resource, because even zipfilesystems return interruptible file channels.

Signed-off-by: cpw <[email protected]>
2019-03-01 19:46:59 -05:00
cpw b4ccafe718 Enforce specversion number for forgeSPI so we don't crash with weird errors later.
Signed-off-by: cpw <[email protected]>
2019-03-01 19:27:22 -05:00
cpw 3c73dc2d0b Put both LogicalSides on NetworkDirection:
Origination (where it came from) and Reception (where it arrived at).

Signed-off-by: cpw <[email protected]>
2019-02-28 21:39:36 -05:00
LexManos 58494f8878 Rewrite the FML Handshake packet formats to include actually syncing the registry data and introduce the concept of caching it locally.
Snapshots are not injected yet due top threading issues.
2019-02-27 23:56:31 -08:00
cpw cb70702ab5 Handle differing network versions for FML gracefully?
Signed-off-by: cpw <[email protected]>
2019-02-28 00:59:27 -05:00
cpw 7f1ea578d6 Fix problem with duplicate mods caused by duplicate classes found during scan.
File Scan results are now sets.

Signed-off-by: cpw <[email protected]>
2019-02-27 23:34:23 -05:00
cpw dd7e7fc122 Try to fix #5573 by peeling the worldclient fetch into a separate handler.
Signed-off-by: cpw <[email protected]>
2019-02-27 13:45:51 -05:00
cpw 0bcc60fbe3 Tidy up server launch. The JAR will resolve it's libraries from a relative
path. We just need to verify what we need is on the classpath, and
try and handle when it's not, cleanly (by recommending running the
installer).

The manifest now embeds the correct launch arguments to allow FML to
resolve - these were _never_ editable, and belong somewhere out of
the way.

Signed-off-by: cpw <[email protected]>
2019-02-26 10:28:48 -05:00
kashike 7766eed754 Add missing constructors in KeyBinding to match existing vanilla constructors. (#5480) 2019-02-25 19:57:11 -08:00
John Hannan 5fa02f53d9 Update MDK Readme to describe new FG3 procedures. (#5553) 2019-02-25 18:11:41 -08:00
LexManos 176e331fc4 Fix Custom Entity Data not persisting between world loads. Closes #5562
Fix BlockRailState inverting flexibility flag. Closes #5550
Disable Forge's hooks on dispensing Buckets until Fluid system re-write. Closes #5545
Fix modifier only keybinds. Closes #5544
2019-02-25 17:06:37 -08:00
Ben Staddon d846f23e80 Fix entity shearing logic (#5566) 2019-02-25 10:41:37 -08:00
Ben Staddon af717ad788 Fix droppers not spawning items in world (#5559) 2019-02-25 00:47:37 -05:00
cpw 2a4e05c982 Allow vanilla connections properly, and allow mods to decide.
Signed-off-by: cpw <[email protected]>
2019-02-24 13:52:26 -05:00
cpw c219416bb8 Patch DimensionSavedDataManager to not spam FS mkdirs requests for
empty files that don't exist yet, and don't contain data. Should
result in a significant performance improvement for those with slower disks.

Signed-off-by: cpw <[email protected]>
2019-02-24 13:03:11 -05:00
cpw 8d1ff45c71 Fix GUI packet dispatch, add additional blockpos helper for common usecase.
Signed-off-by: cpw <[email protected]>
2019-02-24 11:51:53 -05:00
cpw 245d0b6282 Fix startup Query to actually display (fixed commit).
Signed-off-by: cpw <[email protected]>
2019-02-23 20:42:45 -05:00
cpw bbdf52e038 Update to 0.10 modlauncher API with performance improvements..
Signed-off-by: cpw <[email protected]>
2019-02-23 14:36:05 -05:00
LexManos 237f9dec5a Hide the webhook address so people don't spam it. 2019-02-22 01:01:09 -08:00
LexManos d6dc438859 Remove debug leftovers from Jenkinsfile. 2019-02-21 21:30:01 -08:00
LexManos 1469df26db Delete old OreDictionary file, fix type in NUGGETS_IRON field name, and ping discord from jenkins. 2019-02-21 21:26:45 -08:00
LexManos b7f6fbcfcb Merge extra and data jars. As Log4j has issues with it's config being in a different jar then the custom logger. 2019-02-21 04:24:39 -08:00
tterrag 329f26ee20 Add GuiUtils.drawInscribedRect, use in mod list GUI to fix logo rendering 2019-02-19 21:48:34 -05:00
tterrag 57cd8324dc Fix reference to UnsafeHacks in RuntimeEnumExtender 2019-02-19 19:28:17 -05:00
tterrag 8aafbb9441 Fix double tall plants not being shearable, add IShearable to seagrass
Closes #5524
2019-02-19 13:24:22 -05:00
SquidDev e4c2d0a779 Add back missing ItemColors patch (#5474) 2019-02-19 12:46:41 -05:00
mariaum 59a213bdaa Fix entities being killed in one hit. Closes #5511
Fix unloc pattern for tps output
2019-02-19 12:35:32 -05:00
tterrag 4b564b91bf Fix MinecraftForge.initialize not being called.
Fixes UsernameCache and harvest tools
Closes #5529
2019-02-19 12:33:41 -05:00
tterrag 4abfedea68 Make BannerPattern extensible (#5464) 2019-02-19 12:14:14 -05:00
Ben Staddon 7d971a3262 Remove EnumFacing internal ID maps from AT file (#5526) 2019-02-18 23:16:28 -08:00
Merlin Addams b4474a4882 Fix GuiEnchantment using wrong value to index enchantClue array (#5452) 2019-02-18 20:22:53 -08:00
Ben Staddon d1ac90bb3e Fix some minor patch regressions (#5490) 2019-02-18 20:21:03 -08:00
Katrina Swales 785d9b8deb Altered EntityType registry to use a Forge based registry (#5493) 2019-02-18 14:19:25 -08:00
Cadiboo ab92801740 Fix bug with ObfuscationReflectionHelper (#5509) 2019-02-18 14:12:07 -08:00
cpw 1d6536a53b Move unsafehacks to separate JAR built separately..
Signed-off-by: cpw <[email protected]>
2019-02-18 15:54:36 -05:00
tterrag 60315d079b Clean up Entity patches, remove extra method. Closes #5494 2019-02-18 15:52:01 -05:00
tterrag 1a833a9267 Remove now defunct eclipse files from MDK 2019-02-18 15:14:42 -05:00
cpw 70be790b2a Add a simple network API..
Signed-off-by: cpw <[email protected]>
2019-02-18 15:09:03 -05:00
Jack Taylor 2e2c57dbd1 Refactor forge and example run configs based on MinecraftForge/ForgeGradle#546
- Updated run config formats based on the refactored setup
- Removed old 'runclient' and 'runserver' JavaExec tasks, replacing them by creating the run configs using the refactored setup.
- Set 'assetIndex' environment variable from FG
- Updated MDK for new run config setup
2019-02-18 14:39:05 -05:00
tterrag 3fa507d6d1 Make SpawnPlacementType extensible, remove from ArmorMaterial 2019-02-18 12:03:02 -05:00
cpw e47fa70279 Fix connection to vanilla servers. Generate a default mod server config
for mods connecting to servers.

Signed-off-by: cpw <[email protected]>
2019-02-17 16:07:47 -05:00
cpw e248503b0a Fix TPS string
Signed-off-by: cpw <[email protected]>
2019-02-17 15:03:25 -05:00
Vincent Lee 3f2c66dca5 Change openGui to take a Consumer<PacketBuffer> 2019-02-17 20:02:29 +00:00
cpw bd1769b11f Fix author and other strings in the mdk mods toml file, update coremods to 0.3.+
Signed-off-by: cpw <[email protected]>
2019-02-17 14:08:20 -05:00
Jack Taylor af98088d04 Fix World crashing on load Fixes #5499 (#5503) 2019-02-17 00:15:35 -08:00
cpw aa076695b9 Actually dispatch handleWorldDataSave. Closes #5492
Signed-off-by: cpw <[email protected]>
2019-02-16 17:38:12 -05:00
cpw 869964cb2f Merge branch 'pull/5483' into 1.13.x 2019-02-16 17:19:27 -05:00
cpw 579c3ecc0e Fix assetIndexes for 1.13.1
Signed-off-by: cpw <[email protected]>
2019-02-16 17:16:34 -05:00
cpw 63b2ad36e1 Fix travis build for 1.13.x branch
Signed-off-by: cpw <[email protected]>
2019-02-16 17:00:50 -05:00
cpw ae01194a5e Merge branch 'pull/5484' into 1.13.x 2019-02-16 16:59:13 -05:00
gegy1000 3c006c4ca4 Fix lazy ModContainer evaluation skipping thrown loadingExceptions
Fix formatting
2019-02-16 16:58:54 -05:00
cpw 738d54ff4c Fixes #5446 Listening for the same registry event in two different mods fails
Tell the mod event bus not to track phasing for events.

Signed-off-by: cpw <[email protected]>
2019-02-16 16:45:05 -05:00
SquidDev 044bb1c395 Add back missing patch for Item.BLOCK_TO_ITEM 2019-02-16 08:14:33 +00:00
cpw 180f16161c Fix the MDK..
Signed-off-by: cpw <[email protected]>
2019-02-15 21:56:54 -05:00
cpw 7f9e8d059b Fix network syncing of SERVER config. Enable COMMON Config. Fix network
login handling.

Signed-off-by: cpw <[email protected]>
2019-02-15 21:45:28 -05:00
cpw 36ccb3bbfe Fix serverlang loading issue, by frontloading MC and Forge langs,
so error messaging works.

Signed-off-by: cpw <[email protected]>
2019-02-15 20:00:41 -05:00
cpw 1e6f3fc893 Use MC VERSION in the dependencies string for the extra jar
Signed-off-by: cpw <[email protected]>
2019-02-15 01:11:31 -05:00
cpw b4d0ee9b3b Publish to mainline
Signed-off-by: cpw <[email protected]>
2019-02-14 23:15:40 -05:00
cpw 3e516e54b2 Remove Forge ChunkLoader - vanilla has a new system. API will follow.
Signed-off-by: cpw <[email protected]>
2019-02-14 23:15:40 -05:00
tterrag 3baa00decb Fix Block$Properties AT for new class name 2019-02-14 23:13:37 -05:00
cpw 09a96670e6 Fix VillagerRegistry
Signed-off-by: cpw <[email protected]>
2019-02-14 22:20:59 -05:00
cpw 78455ac3c0 Add the language providers to the main classloader as well, so
their resources are available to other classes..

Signed-off-by: cpw <[email protected]>
2019-02-14 21:43:56 -05:00
tterrag 2ec74e5c22 Fix RegistryManager#getRegistry not working for generic registry entries 2019-02-14 18:50:15 -05:00
tterrag 9d56309a05 Fix license headers 2019-02-14 18:49:40 -05:00
tterrag 4139504202 Fix GlowstoneFeature patch name 2019-02-14 18:35:39 -05:00
LexManos 2f547c8c56 Fix javac compile issues. 2019-02-14 15:21:28 -08:00
226 changed files with 4650 additions and 3381 deletions

No files matched your search

+2
View File
@@ -33,3 +33,5 @@ notifications:
branches:
except:
- 1.13-pre
- 1.13.x
- /^noci-.*$/
Vendored
+45 -8
View File
@@ -12,6 +12,9 @@ pipeline {
}
environment {
GRADLE_ARGS = '--no-daemon --console=plain' // No daemon for now as FG3 kinda derps. //'-Dorg.gradle.daemon.idletimeout=5000'
DISCORD_WEBHOOK = credentials('forge-discord-jenkins-webhook')
DISCORD_PREFIX = "Job: Forge Branch: ${BRANCH_NAME} Build: #${BUILD_NUMBER}"
JENKINS_HEAD = 'https://wiki.jenkins-ci.org/download/attachments/2916393/headshot.png'
}
stages {
@@ -20,6 +23,22 @@ pipeline {
checkout scm
}
}
stage('notify_start') {
when {
not {
changeRequest()
}
}
steps {
discordSend(
title: "${DISCORD_PREFIX} Started",
successful: true,
result: 'ABORTED', //White border
thumbnail: JENKINS_HEAD,
webhookURL: DISCORD_WEBHOOK
)
}
}
stage('setup') {
steps {
sh './gradlew ${GRADLE_ARGS} --refresh-dependencies --continue setup'
@@ -27,11 +46,16 @@ pipeline {
env.MYVERSION = sh(returnStdout: true, script: './gradlew :forge:properties -q | grep "version:" | awk \'{print $2}\'').trim()
}
}
post {
success {
writeChangelog(currentBuild, 'build/changelog.txt')
}
stage('changelog') {
when {
not {
changeRequest()
}
}
steps {
writeChangelog(currentBuild, 'build/changelog.txt')
}
}
stage('publish') {
when {
@@ -52,8 +76,8 @@ pipeline {
]){
sh './gradlew ${GRADLE_ARGS} :forge:publish -PforgeMavenUser=${FORGE_MAVEN_USR} -PforgeMavenPassword=${FORGE_MAVEN_PSW} -PkeystoreKeyPass=${KEYSTORE_KEYPASS} -PkeystoreStorePass=${KEYSTORE_STOREPASS} -Pkeystore=${KEYSTORE} -PcrowdinKey=${CROWDIN}'
}
//We're testing so use the test group
sh 'curl --user ${FORGE_MAVEN} http://files.minecraftforge.net/maven/manage/promote/latest/net.minecraftforge.test.forge/${MYVERSION}'
//We're not testing anymore so don't use the test group
sh 'curl --user ${FORGE_MAVEN} http://files.minecraftforge.net/maven/manage/promote/latest/net.minecraftforge.forge/${MYVERSION}'
}
}
stage('test_publish_pr') { //Publish to local repo to test full process, but don't include credentials so it can't sign/publish to maven
@@ -74,9 +98,22 @@ pipeline {
}
post {
always {
archiveArtifacts artifacts: 'projects/forge/build/libs/**/*.*', fingerprint: true
//junit 'build/test-results/*/*.xml'
//jacoco sourcePattern: '**/src/*/java'
script {
archiveArtifacts artifacts: 'projects/forge/build/libs/**/*.*', fingerprint: true, onlyIfSuccessful: true, allowEmptyArchive: true
//junit 'build/test-results/*/*.xml'
//jacoco sourcePattern: '**/src/*/java'
if (env.CHANGE_ID == null) { // This is unset for non-PRs
discordSend(
title: "${DISCORD_PREFIX} Finished ${currentBuild.currentResult}",
description: '```\n' + getChanges(currentBuild) + '\n```',
successful: currentBuild.resultIsBetterOrEqualTo("SUCCESS"),
result: currentBuild.currentResult,
thumbnail: JENKINS_HEAD,
webhookURL: DISCORD_WEBHOOK
)
}
}
}
}
}
+105 -141
View File
@@ -64,20 +64,35 @@ project(':clean') {
repositories {
mavenCentral()
}
patcher {
parent = project(':mcp')
patchedSrc = file('src/main/java')
mappings channel: MAPPING_CHANNEL, version: MAPPING_VERSION
mcVersion = MC_VERSION
}
task runclient(type: JavaExec) {
doFirst {
mkdir 'runclient'
patchedSrc = file('src/main/java')
mappings channel: MAPPING_CHANNEL, version: MAPPING_VERSION
runs {
clean_client {
taskName 'clean_client'
main 'net.minecraft.client.main.Main'
workingDirectory project.file('run')
args '--gameDir', '.'
args '--version', MC_VERSION
args '--assetsDir', downloadAssets.output
args '--assetIndex', '{asset_index}'
args '--accessToken', '0'
}
clean_server {
taskName 'clean_server'
main 'net.minecraft.server.MinecraftServer'
workingDirectory project.file('run')
}
}
classpath sourceSets.main.runtimeClasspath
args = ['--accessToken', '0', '--version', MC_VERSION]
main 'net.minecraft.client.main.Main'
workingDir 'runclient'
}
}
@@ -91,7 +106,7 @@ project(':forge') {
apply plugin: 'de.undercouch.download'
compileJava.sourceCompatibility = compileJava.targetCompatibility = sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
group = 'net.minecraftforge.test' //TODO: remove test when we finish patches and want users to find it
group = 'net.minecraftforge' //TODO: remove test when we finish patches and want users to find it
sourceSets {
fmllauncher {
@@ -166,46 +181,49 @@ project(':forge') {
version = getVersion()
patcher {
exc = file("$rootDir/src/main/resources/forge.exc")
parent = project(':clean')
patches = file("$rootDir/patches/minecraft")
patchedSrc = file('src/main/java')
accessTransformer = file("$rootDir/src/main/resources/META-INF/accesstransformer.cfg")
exc = file("$rootDir/src/main/resources/forge.exc")
srgPatches = true
accessTransformer = file("$rootDir/src/main/resources/META-INF/accesstransformer.cfg")
runs {
forge_client = {
main 'net.minecraftforge.fml.LaunchTesting'
environment = [
target: 'fmldevclient',
assetDirectory: downloadAssets.output,
nativesDirectory: extractNatives.output
]
properties = [
// 'org.lwjgl.util.Debug': 'true',
// 'org.lwjgl.util.DebugLoader': 'true',
'org.lwjgl.system.SharedLibraryExtractDirectory': 'lwjgl_dll',
'mc.version': MC_VERSION,
'mcp.version': MCP_VERSION,
'forge.version': project.version.substring(MC_VERSION.length() + 1),
'forge.spec': SPEC_VERSION,
'forge.group': project.group,
'fmllauncher.version': SPEC_VERSION,
'terminal.ansi': 'true'
]
forge_client {
taskName 'forge_client'
main 'net.minecraftforge.userdev.LaunchTesting'
workingDirectory project.file('run')
environment 'target', 'fmldevclient'
environment 'assetIndex', '{asset_index}'
environment 'assetDirectory', downloadAssets.output
environment 'nativesDirectory', extractNatives.output
environment 'MC_VERSION', MC_VERSION
environment 'MCP_VERSION', MCP_VERSION
environment 'FORGE_GROUP', project.group
environment 'FORGE_SPEC', SPEC_VERSION
environment 'FORGE_VERSION', project.version.substring(MC_VERSION.length() + 1).toString()
environment 'LAUNCHER_VERSION', SPEC_VERSION
property 'terminal.ansi', 'true'
property 'org.lwjgl.system.SharedLibraryExtractDirectory', 'lwjgl_dll'
}
forge_server = {
main 'net.minecraftforge.fml.LaunchTesting'
environment = [
target: 'fmldevserver'
]
properties = [
'mc.version': MC_VERSION,
'mcp.version': MCP_VERSION,
'forge.version': "${project.version.substring(MC_VERSION.length() + 1)}".toString(),
'forge.spec': SPEC_VERSION,
'forge.group': project.group,
'fmllauncher.version': SPEC_VERSION
]
forge_server {
taskName 'forge_server'
main 'net.minecraftforge.userdev.LaunchTesting'
workingDirectory project.file('run')
environment 'target', 'fmldevserver'
environment 'MC_VERSION', MC_VERSION
environment 'MCP_VERSION', MCP_VERSION
environment 'FORGE_GROUP', project.group
environment 'FORGE_SPEC', SPEC_VERSION
environment 'FORGE_VERSION', project.version.substring(MC_VERSION.length() + 1).toString()
environment 'LAUNCHER_VERSION', SPEC_VERSION
}
}
}
@@ -265,18 +283,19 @@ project(':forge') {
fmllauncherImplementation.extendsFrom(installer)
}
dependencies {
api 'net.minecraft:client:1.13:extra'
api 'net.minecraft:client:${MC_VERSION}:extra'
installer 'com.paulscode:soundsystem:2018+'
installer 'org.ow2.asm:asm:6.2'
installer 'org.ow2.asm:asm-commons:6.2'
installer 'org.ow2.asm:asm-tree:6.2'
installer 'cpw.mods:modlauncher:0.9.+'
installer 'net.minecraftforge:accesstransformers:0.14.+:shadowed'
installer 'net.minecraftforge:eventbus:0.6.+:service'
installer 'net.minecraftforge:forgespi:0.6.+'
installer 'net.minecraftforge:coremods:0.2.+'
installer 'com.electronwill.night-config:core:3.4.2'
installer 'com.electronwill.night-config:toml:3.4.2'
installer 'cpw.mods:modlauncher:1.0.+'
installer 'net.minecraftforge:accesstransformers:0.16.+:shadowed'
installer 'net.minecraftforge:eventbus:0.8.+:service'
installer 'net.minecraftforge:forgespi:0.11.+'
installer 'net.minecraftforge:coremods:0.4.+'
installer 'net.minecraftforge:unsafe:0.2.+'
installer 'com.electronwill.night-config:core:3.5.0'
installer 'com.electronwill.night-config:toml:3.5.0'
installer 'org.jline:jline:3.9.0'
installer 'org.apache.maven:maven-artifact:3.6.0'
installer 'net.jodah:typetools:0.6.0'
@@ -284,49 +303,13 @@ project(':forge') {
installer 'org.apache.logging.log4j:log4j-api:2.11.1'
installer 'org.apache.logging.log4j:log4j-core:2.11.1'
installer 'net.minecrell:terminalconsoleappender:1.1.+'
installer 'net.sf.jopt-simple:jopt-simple:5.0.4'
fmllauncherImplementation 'com.google.guava:guava:21.0'
fmllauncherImplementation 'com.google.code.gson:gson:2.8.0'
testImplementation "org.junit.jupiter:junit-jupiter-api:5.0.0"
testImplementation "org.opentest4j:opentest4j:1.0.0" // needed for junit 5
testImplementation "org.hamcrest:hamcrest-all:1.3" // needs advanced matching for list order
}
task runclient(type: JavaExec, dependsOn: [":forge:downloadAssets", ":forge:extractNatives"]) {
doFirst {
mkdir 'runclient'
}
doFirst {
copy {
from sourceSets.main.resources
into "$buildDir/classes/java/main"
}
}
//jvmArgs = ['-verbose:class']
classpath sourceSets.main.runtimeClasspath
main patcher.runs.forge_client.main
systemProperties = patcher.runs.forge_client.properties
environment += patcher.runs.forge_client.environment
workingDir 'runclient'
}
task runserver(type: JavaExec) {
doFirst {
mkdir 'runserver'
}
doFirst {
copy {
from sourceSets.main.resources
into "$buildDir/classes/java/main"
}
}
classpath sourceSets.main.runtimeClasspath
main patcher.runs.forge_server.main
args 'nogui'
systemProperties = patcher.runs.forge_server.properties
environment += patcher.runs.forge_server.environment
workingDir 'runserver'
standardInput = System.in
}
def extraTxts = [
rootProject.file('CREDITS.txt'),
@@ -511,7 +494,7 @@ project(':forge') {
ext {
output = file('build/install_profile.json')
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.0.3'
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.0.4'
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.0'
}
doFirst {
ext.BIN_PATCHER = 'net.minecraftforge:binarypatcher:' + genClientBinPatches.resolvedVersion
@@ -562,14 +545,6 @@ project(':forge') {
client: "'${sha1(tasks.getByName('downloadClientSlim').output)}'",
server: "'${sha1(tasks.getByName('downloadServerSlim').output)}'"
],
MC_DATA: [
client: "[net.minecraft:client:${MC_VERSION}:data]",
server: "[net.minecraft:server:${MC_VERSION}:data]"
],
MC_DATA_SHA: [
client: "'${sha1(tasks.getByName('downloadClientData').output)}'",
server: "'${sha1(tasks.getByName('downloadServerData').output)}'"
],
MC_EXTRA: [
client: "[net.minecraft:client:${MC_VERSION}:extra]",
server: "[net.minecraft:server:${MC_VERSION}:extra]"
@@ -607,13 +582,11 @@ project(':forge') {
args: [
'--input', '{MINECRAFT_JAR}',
'--slim', '{MC_SLIM}',
'--data', '{MC_DATA}',
'--extra', '{MC_EXTRA}',
'--srg', '{MAPPINGS}'
],
outputs: [
'{MC_SLIM}': '{MC_SLIM_SHA}',
'{MC_DATA}': '{MC_DATA_SHA}',
'{MC_EXTRA}': '{MC_EXTRA_SHA}'
]
], [ // SpecialSource has a bug where it won't create the nessasary directories, remove when they fix that.
@@ -653,7 +626,7 @@ project(':forge') {
}
['client', 'server'].each { side ->
['slim', 'extra', 'data'].each { type ->
['slim', 'extra'].each { type ->
def name = "download${side.capitalize()}${type.capitalize()}"
task "${name}"(type: DownloadMavenArtifact) {
artifact = "net.minecraft:${side}:${MC_VERSION}:${type}"
@@ -698,47 +671,30 @@ project(':forge') {
}
}
task fmllauncherConfig(type: WriteProperties) {
outputFile file('build/server_launcher.properties')
encoding 'UTF8'
doFirst {
def artifacts = getArtifacts(project, project.configurations.installer, false).values().stream().map{a -> a.downloads.artifact.path}.sorted().collect() + [
"net/minecraft/server/${MC_VERSION}/server-${MC_VERSION}-data.jar",
"net/minecraft/server/${MC_VERSION}/server-${MC_VERSION}-extra.jar"
]
for (int x = 0; x < artifacts.size(); x++) {
property 'library.' + x.toString().padLeft(3, '0'), "libraries/${artifacts.get(x)}"
}
property 'library.count', artifacts.size()
property 'args', [
'--gameDir', '.',
'--launchTarget', 'fmlserver',
'--fml.forgeVersion', "${project.version.substring(MC_VERSION.length() + 1)}".toString(),
'--fml.mcpVersion', MCP_VERSION,
'--fml.mcVersion', MC_VERSION,
'--fml.forgeGroup', project.group
].join(' ')
}
}
task launcherJar(type: Jar, dependsOn: [fmllauncherConfig]) {
task launcherJar(type: Jar) {
classifier 'launcher'
from sourceSets.fmllauncher.output
from fmllauncherConfig.outputFile
doFirst {
def classpath = new StringBuilder()
def artifacts = getArtifacts(project, project.configurations.installer, false)
artifacts.each { key, lib ->
classpath += "libraries/${lib.downloads.artifact.path} "
}
classpath += "libraries/net/minecraft/server/${MC_VERSION}/server-${MC_VERSION}-data.jar "
classpath += "libraries/net/minecraft/server/${MC_VERSION}/server-${MC_VERSION}-extra.jar"
MANIFESTS.each{ pkg, values ->
if (pkg == '/') {
manifest.attributes(values += [
'Main-Class': 'net.minecraftforge.server.ServerMain',
'Class-Path': classpath.toString()
'Class-Path': classpath.toString(),
'ServerLaunchArgs': [
'--gameDir', '.',
'--launchTarget', 'fmlserver',
'--fml.forgeVersion', "${project.version.substring(MC_VERSION.length() + 1)}".toString(),
'--fml.mcpVersion', MCP_VERSION,
'--fml.mcVersion', MC_VERSION,
'--fml.forgeGroup', project.group
].join(' ')
])
} else {
manifest.attributes(values, pkg)
@@ -836,27 +792,33 @@ project(':forge') {
}
addLibrary("${project.group}:${project.name}:${project.version}:launcher")
runs {
client = {
main 'net.minecraftforge.userdev.UserdevLauncher'
client {
main 'net.minecraftforge.userdev.LaunchTesting'
environment 'target', 'fmluserdevclient'
environment 'assetIndex', '{asset_index}'
environment 'assetDirectory', '{assets_root}'
environment 'nativesDirectory', '{natives}'
environment 'FORGE_VERSION', project.version.substring(MC_VERSION.length() + 1)
environment 'FORGE_GROUP', project.group
environment 'MCP_VERSION', MCP_VERSION
environment 'MC_VERSION', MC_VERSION
environment 'MC_VERSION', "${MC_VERSION}"
environment 'FORGE_GROUP', "${project.group}"
environment 'MCP_VERSION', "${MCP_VERSION}"
environment 'MOD_CLASSES', '{source_roots}'
environment 'MCP_MAPPINGS', '{mcp_mappings}'
environment 'FORGE_VERSION', "${project.version.substring(MC_VERSION.length() + 1)}"
}
server = {
main 'net.minecraftforge.userdev.UserdevLauncher'
server {
main 'net.minecraftforge.userdev.LaunchTesting'
environment 'target', 'fmluserdevserver'
environment 'FORGE_VERSION', project.version.substring(MC_VERSION.length() + 1)
environment 'FORGE_GROUP', project.group
environment 'MCP_VERSION', MCP_VERSION
environment 'MC_VERSION', MC_VERSION
environment 'MC_VERSION', "${MC_VERSION}"
environment 'FORGE_GROUP', "${project.group}"
environment 'MCP_VERSION', "${MCP_VERSION}"
environment 'MOD_CLASSES', '{source_roots}'
environment 'MCP_MAPPINGS', '{mcp_mappings}'
environment 'FORGE_VERSION', "${project.version.substring(MC_VERSION.length() + 1)}"
}
}
}
@@ -909,6 +871,8 @@ project(':forge') {
setSources sourceSets.userdev.java.srcDirs.findAll({f -> (f != patcher.patchedSrc) })
}
tasks.eclipse.dependsOn('genEclipseRuns')
publishing {
publications {
mavenJava(MavenPublication) {
+12 -21
View File
@@ -19,35 +19,26 @@ http://mcforge.readthedocs.io/en/latest/gettingstarted/
Step 1: Open your command-line and browse to the folder where you extracted the zip file.
Step 2: Once you have a command window up in the folder that the downloaded material was placed, type:
Step 2: You're left with a choice.
If you prefer to use Eclipse:
1. Run the following command: "gradlew genEclipseRuns" (./gradlew genEclipseRuns if you are on Mac/Linux)
2. Open Eclipse, Import > Existing Gradle Project > Select Folder
or run "gradlew eclipse" to generate the project.
(Current Issue)
4. Open Project > Run/Debug Settings > Edit runClient and runServer > Environment
5. Edit MOD_CLASSES to show [modid]%%[Path]; 2 times rather then the generated 4.
Windows: "gradlew setupDecompWorkspace"
Linux/Mac OS: "./gradlew setupDecompWorkspace"
Step 3: After all that finished, you're left with a choice.
For eclipse, run "gradlew eclipse" (./gradlew eclipse if you are on Mac/Linux)
If you prefer to use IntelliJ, steps are a little different.
If you prefer to use IntelliJ:
1. Open IDEA, and import project.
2. Select your build.gradle file and have it import.
3. Once it's finished you must close IntelliJ and run the following command:
"gradlew genIntellijRuns" (./gradlew genIntellijRuns if you are on Mac/Linux)
Step 4: The final step is to open Eclipse and switch your workspace to /eclipse/ (if you use IDEA, it should automatically start on your project)
3. Run the following command: "gradlew genIntellijRuns" (./gradlew genIntellijRuns if you are on Mac/Linux)
4. Refresh the Gradle Project in IDEA if required.
If at any point you are missing libraries in your IDE, or you've run into problems you can run "gradlew --refresh-dependencies" to refresh the local cache. "gradlew clean" to reset everything {this does not affect your code} and then start the processs again.
Should it still not work,
Refer to #ForgeGradle on EsperNet for more information about the gradle environment.
Tip:
If you do not care about seeing Minecraft's source code you can replace "setupDecompWorkspace" with one of the following:
"setupDevWorkspace": Will patch, deobfuscate, and gather required assets to run minecraft, but will not generate human readable source code.
"setupCIWorkspace": Same as Dev but will not download any assets. This is useful in build servers as it is the fastest because it does the least work.
Tip:
When using Decomp workspace, the Minecraft source code is NOT added to your workspace in a editable way. Minecraft is treated like a normal Library. Sources are there for documentation and research purposes and usually can be accessed under the 'referenced libraries' section of your IDE.
or the Forge Project Discord discord.gg/UvedJ9m
Forge source installation
=========================
+79 -40
View File
@@ -9,8 +9,9 @@ buildscript {
}
}
apply plugin: 'net.minecraftforge.gradle'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version = '1.0'
group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
@@ -19,34 +20,49 @@ archivesBaseName = 'modid'
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
minecraft {
// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
// The mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD Snapshot are built nightly.
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// simply re-run your setup task after changing the mappings to update your workspace.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: '@MAPPING_CHANNEL@', version: '@MAPPING_VERSION@'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
//accessTransformer = file('my_at.cfg')
// accessTransformer = file('build/resources/main/META-INF/accesstransformer.cfg')
// default run configurations.
// these can be tweaked, removed, or duplicated as needed.
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client = {
// recommended logging data for a userdev environment
properties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP'
// recommended logging level for the console
properties 'forge.logging.console.level': 'debug'
workingDirectory project.file('run').canonicalPath
source sourceSets.main
client {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
mods {
examplemod {
source sourceSets.main
}
}
}
server = {
// recommended logging data for a userdev environment
properties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP'
// recommended logging level for the console
properties 'forge.logging.console.level': 'debug'
workingDirectory project.file('run').canonicalPath
source sourceSets.main
server {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
mods {
examplemod {
source sourceSets.main
}
}
}
}
}
@@ -57,22 +73,21 @@ dependencies {
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft '@FORGE_GROUP@:@FORGE_NAME@:@FORGE_VERSION@'
// you may put jars on which you depend on in ./libs
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"
// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"
// compile "some.group:artifact:version"
// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
// Real examples
// compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
// compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
// the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
// provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// These dependencies get remapped to your current MCP mappings
//deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// for more info...
// For more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
@@ -81,12 +96,36 @@ dependencies {
// Example for how to get properties into the manifest for reading by the runtime..
jar {
manifest {
attributes(["Specification-Title": "examplemod",
"Specification-Vendor": "examplemodsareus",
"Specification-Version": "24.0", // We are version 1 of the modlauncher specification
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"examplemodsareus",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],)
attributes([
"Specification-Title": "examplemod",
"Specification-Vendor": "examplemodsareus",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"examplemodsareus",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
// Example configuration to allow publishing using the maven-publish task
// we define a custom artifact that is sourced from the reobfJar output task
// and then declare that to be published
// Note you'll need to add a repository here
def reobfFile = file("$buildDir/reobfJar/output.jar")
def reobfArtifact = artifacts.add('default', reobfFile) {
type 'jar'
builtBy 'reobfJar'
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact reobfArtifact
}
}
repositories {
maven {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}
@@ -1,4 +0,0 @@
#Sun Jun 05 18:58:07 CEST 2011
version=1
eclipse.preferences.version=1
refresh.enabled=true
@@ -1,7 +0,0 @@
#Sun Jun 05 19:03:53 CEST 2011
eclipse.preferences.version=1
org.eclipse.debug.ui.UseContextualLaunch=false
Console.highWaterMark=88000
org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\r\n<launchPerspectives/>\r\n
org.eclipse.debug.ui.user_view_bindings=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\r\n<viewBindings>\r\n<view id\="org.eclipse.ui.console.ConsoleView">\r\n<perspective id\="org.eclipse.jdt.ui.JavaPerspective" userAction\="opened"/>\r\n</view>\r\n</viewBindings>\r\n
StringVariablePreferencePage=130,107,107,86,
@@ -1,3 +0,0 @@
#Sun Jun 05 18:58:07 CEST 2011
eclipse.preferences.version=1
org.eclipse.epp.usagedata.gathering.enabled=false
@@ -1,14 +0,0 @@
#Sun Sep 18 16:44:39 NZST 2011
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=ignore
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=ignore
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.source=1.6
@@ -1,4 +0,0 @@
#Sun Jun 05 18:58:05 CEST 2011
spacesForTabs=true
eclipse.preferences.version=1
overviewRuler_migration=migrated_3.1
@@ -1,9 +0,0 @@
#Sun Jun 05 18:58:07 CEST 2011
IMPORT_FILES_AND_FOLDERS_MODE=prompt
IMPORT_FILES_AND_FOLDERS_VIRTUAL_FOLDER_MODE=prompt
SAVE_ALL_BEFORE_BUILD=true
eclipse.preferences.version=1
tipsAndTricks=true
platformState=1287081747687
quickStart=false
PROBLEMS_FILTERS_MIGRATE=true
@@ -1,3 +0,0 @@
#Sun Jun 05 18:50:08 CEST 2011
eclipse.preferences.version=1
showIntro=false
@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/MDKExample"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="GradleStart"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="MDKExample"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xincgc -Xmx1024M -Xms1024M"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc}/run"/>
</launchConfiguration>
@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/MDKExample"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="GradleStartServer"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="MDKExample"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xincgc -Xmx1024M -Xms1024M"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc}/run"/>
</launchConfiguration>
@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchHistory>
<launchGroup id="org.eclipse.ui.externaltools.launchGroup">
<mruHistory/>
<favorites/>
</launchGroup>
<launchGroup id="org.eclipse.debug.ui.launchGroup.profile">
<mruHistory/>
<favorites/>
</launchGroup>
<launchGroup id="org.eclipse.debug.ui.launchGroup.debug">
<mruHistory>
<launch memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;launchConfiguration local=&quot;true&quot; path=&quot;Client&quot;/&gt;&#13;&#10;"/>
<launch memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;launchConfiguration local=&quot;true&quot; path=&quot;Server&quot;/&gt;&#13;&#10;"/>
</mruHistory>
<favorites/>
</launchGroup>
<launchGroup id="org.eclipse.debug.ui.launchGroup.run">
<mruHistory>
<launch memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;launchConfiguration local=&quot;true&quot; path=&quot;Client&quot;/&gt;&#13;&#10;"/>
<launch memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;launchConfiguration local=&quot;true&quot; path=&quot;Server&quot;/&gt;&#13;&#10;"/>
</mruHistory>
<favorites/>
</launchGroup>
</launchHistory>
@@ -35,7 +35,7 @@ public class ExampleMod
// Register the doClientStuff method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
// Register ourselves for server, registry and other game events we are interested in
// Register ourselves for server and other game events we are interested in
MinecraftForge.EVENT_BUS.register(this);
}
@@ -54,28 +54,29 @@ public class ExampleMod
private void enqueueIMC(final InterModEnqueueEvent event)
{
// some example code to dispatch IMC to another mod
InterModComms.sendTo("forge", "helloworld", () -> { LOGGER.info("Hello world"); return "Hello world";});
InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";});
}
private void processIMC(final InterModProcessEvent event)
{
// some example code to receive and process InterModComms from other mods
LOGGER.info("Got IMC", event.getIMCStream().
LOGGER.info("Got IMC {}", event.getIMCStream().
map(m->m.getMessageSupplier().get()).
collect(Collectors.toList()));
}
// You can use SubscribeEvent and let the Event Bus discover methods to call
@SubscribeEvent
public static void onServerStarting(FMLServerStartingEvent event) {
public void onServerStarting(FMLServerStartingEvent event) {
// do something when the server starts
LOGGER.info("HELLO from server starting");
}
// You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD event bus
// You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD
// Event bus for receiving Registry Events)
@Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
public static class RegistryEvents {
@SubscribeEvent
public void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) {
public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) {
// register a new block here
LOGGER.info("HELLO from Register Block");
}
+11 -11
View File
@@ -6,17 +6,9 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[24,)" #mandatory (24 is current forge version)
loaderVersion="[25,)" #mandatory (24 is current forge version)
# A URL to refer people to when problems occur with this mod
issueTrackerURL="http://my.issue.tracker/" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
displayURL="http://example.com/" #optional
# A file name (in the root of the mod JAR) containing a logo for display
logoFile="examplemod.png" #optional
# A text field displayed in the mod UI
credits="Thanks for this example mod goes to Java" #optional
# A text field displayed in the mod UI
authors="Love, Cheese and small house plants" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
@@ -27,6 +19,14 @@ version="${file.jarVersion}" #mandatory
displayName="Example Mod" #mandatory
# A URL to query for updates for this mod. See the JSON update specification <here>
updateJSONURL="http://myurl.me/" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
displayURL="http://example.com/" #optional
# A file name (in the root of the mod JAR) containing a logo for display
logoFile="examplemod.png" #optional
# A text field displayed in the mod UI
credits="Thanks for this example mod goes to Java" #optional
# A text field displayed in the mod UI
authors="Love, Cheese and small house plants" #optional
# The description text for the mod (multi line!) (#mandatory)
description='''
This is a long form description of the mod. You can write whatever you want here
@@ -42,7 +42,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="[24,)" #mandatory
versionRange="[25,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
@@ -51,6 +51,6 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn
[[dependencies.examplemod]]
modId="minecraft"
mandatory=true
versionRange="[1.13]"
versionRange="[1.13.2]"
ordering="NONE"
side="BOTH"
@@ -28,7 +28,7 @@
f1 = 3.0F;
}
}
@@ -135,15 +137,19 @@
@@ -135,15 +137,20 @@
}
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
@@ -40,6 +40,7 @@
+
+ @Override
+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
+ super.getDrops(state, drops, world, pos, 0);
+ {
+ int i = this.func_185527_x(state);
if (i >= this.func_185526_g()) {
@@ -9,3 +9,13 @@
return true;
} else if (p_196250_2_.field_72995_K) {
return true;
@@ -173,4 +173,9 @@
public boolean func_196266_a(IBlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
return false;
}
+
+ @Override
+ public boolean canSilkHarvest(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, EntityPlayer player) {
+ return true;
+ }
}
@@ -9,16 +9,17 @@
return railshape != null && railshape.func_208092_c() ? field_190959_b : field_185590_a;
}
@@ -50,7 +50,7 @@
@@ -50,7 +50,8 @@
}
public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) {
- return p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_185896_q();
+ return p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_193401_d(p_196260_2_, p_196260_3_.func_177977_b(), EnumFacing.UP) == BlockFaceShape.SOLID;
+ IBlockState down = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
+ return down.func_185896_q() || down.func_193401_d(p_196260_2_, p_196260_3_.func_177977_b(), EnumFacing.UP) == BlockFaceShape.SOLID;
}
public void func_196259_b(IBlockState p_196259_1_, World p_196259_2_, BlockPos p_196259_3_, IBlockState p_196259_4_) {
@@ -67,19 +67,19 @@
@@ -67,19 +68,19 @@
public void func_189540_a(IBlockState p_189540_1_, World p_189540_2_, BlockPos p_189540_3_, Block p_189540_4_, BlockPos p_189540_5_) {
if (!p_189540_2_.field_72995_K) {
@@ -26,25 +27,25 @@
+ RailShape railshape = getRailDirection(p_189540_1_, p_189540_2_, p_189540_3_, null);
boolean flag = false;
- if (!p_189540_2_.func_180495_p(p_189540_3_.func_177977_b()).func_185896_q()) {
+ if (p_189540_2_.func_180495_p(p_189540_3_.func_177977_b()).func_193401_d(p_189540_2_, p_189540_3_.func_177977_b(), EnumFacing.UP) != BlockFaceShape.SOLID) {
+ if (!p_189540_1_.func_196955_c(p_189540_2_, p_189540_3_)) {
flag = true;
}
- if (railshape == RailShape.ASCENDING_EAST && !p_189540_2_.func_180495_p(p_189540_3_.func_177974_f()).func_185896_q()) {
+ if (railshape == RailShape.ASCENDING_EAST && p_189540_2_.func_180495_p(p_189540_3_.func_177974_f()).func_193401_d(p_189540_2_, p_189540_3_.func_177974_f(), EnumFacing.UP) != BlockFaceShape.SOLID) {
+ if (railshape == RailShape.ASCENDING_EAST && !p_189540_1_.func_196955_c(p_189540_2_, p_189540_3_.func_177974_f().func_177984_a())) {
flag = true;
- } else if (railshape == RailShape.ASCENDING_WEST && !p_189540_2_.func_180495_p(p_189540_3_.func_177976_e()).func_185896_q()) {
+ } else if (railshape == RailShape.ASCENDING_WEST && p_189540_2_.func_180495_p(p_189540_3_.func_177976_e()).func_193401_d(p_189540_2_, p_189540_3_.func_177976_e(), EnumFacing.UP) != BlockFaceShape.SOLID) {
+ } else if (railshape == RailShape.ASCENDING_WEST && !p_189540_1_.func_196955_c(p_189540_2_, p_189540_3_.func_177976_e().func_177984_a())) {
flag = true;
- } else if (railshape == RailShape.ASCENDING_NORTH && !p_189540_2_.func_180495_p(p_189540_3_.func_177978_c()).func_185896_q()) {
+ } else if (railshape == RailShape.ASCENDING_NORTH && p_189540_2_.func_180495_p(p_189540_3_.func_177978_c()).func_193401_d(p_189540_2_, p_189540_3_.func_177978_c(), EnumFacing.UP) != BlockFaceShape.SOLID) {
+ } else if (railshape == RailShape.ASCENDING_NORTH && !p_189540_1_.func_196955_c(p_189540_2_, p_189540_3_.func_177978_c().func_177984_a())) {
flag = true;
- } else if (railshape == RailShape.ASCENDING_SOUTH && !p_189540_2_.func_180495_p(p_189540_3_.func_177968_d()).func_185896_q()) {
+ } else if (railshape == RailShape.ASCENDING_SOUTH && p_189540_2_.func_180495_p(p_189540_3_.func_177968_d()).func_193401_d(p_189540_2_, p_189540_3_.func_177968_d(), EnumFacing.UP) != BlockFaceShape.SOLID) {
+ } else if (railshape == RailShape.ASCENDING_SOUTH && !p_189540_1_.func_196955_c(p_189540_2_, p_189540_3_.func_177968_d().func_177984_a())) {
flag = true;
}
@@ -111,7 +111,7 @@
@@ -111,7 +112,7 @@
public void func_196243_a(IBlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, IBlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_5_) {
super.func_196243_a(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
@@ -53,7 +54,7 @@
p_196243_2_.func_195593_d(p_196243_3_.func_177984_a(), this);
}
@@ -123,5 +123,66 @@
@@ -123,5 +124,66 @@
}
}
@@ -14,7 +14,7 @@
- RailShape railshape = p_i47755_3_.func_177229_b(this.field_196922_c.func_176560_l());
- this.field_208513_e = this.field_196922_c.func_208490_b();
+ RailShape railshape = this.field_196922_c.getRailDirection(field_196923_d, p_i47755_1_, p_i47755_2_, null);
+ this.field_208513_e = this.field_196922_c.isFlexibleRail(field_196923_d, p_i47755_1_, p_i47755_2_);
+ this.field_208513_e = !this.field_196922_c.isFlexibleRail(field_196923_d, p_i47755_1_, p_i47755_2_);
+ this.canMakeSlopes = this.field_196922_c.canMakeSlopes(field_196923_d, p_i47755_1_, p_i47755_2_);
this.func_208509_a(railshape);
}
@@ -0,0 +1,40 @@
--- a/net/minecraft/block/BlockSeaGrass.java
+++ b/net/minecraft/block/BlockSeaGrass.java
@@ -23,7 +23,7 @@
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
-public class BlockSeaGrass extends BlockBush implements IGrowable, ILiquidContainer {
+public class BlockSeaGrass extends BlockBush implements IGrowable, ILiquidContainer, net.minecraftforge.common.IShearable {
protected static final VoxelShape field_207798_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D);
protected BlockSeaGrass(Block.Properties p_i48780_1_) {
@@ -54,11 +54,7 @@
}
public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) {
- if (!p_180657_1_.field_72995_K && p_180657_6_.func_77973_b() == Items.field_151097_aZ) {
- p_180657_2_.func_71029_a(StatList.field_188065_ae.func_199076_b(this));
- p_180657_2_.func_71020_j(0.005F);
- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(this));
- } else {
+ {
super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_, p_180657_6_);
}
@@ -102,4 +98,15 @@
public int func_200011_d(IBlockState p_200011_1_, IBlockReader p_200011_2_, BlockPos p_200011_3_) {
return Blocks.field_150355_j.func_176223_P().func_200016_a(p_200011_2_, p_200011_3_);
}
+
+ @Override
+ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) {
+ return true;
+ }
+
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) {
+ world.func_180501_a(pos, Blocks.field_150350_a.func_176223_P(), 11);
+ return java.util.Arrays.asList(new ItemStack(this));
+ }
}
@@ -27,7 +27,7 @@
+
+ @Override
+ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) {
+ return false;
+ return true;
+ }
+
+ @Override
@@ -9,19 +9,21 @@
ThreadLocal<Object2ByteMap<IBlockState>> field_208776_a = ThreadLocal.withInitial(() -> {
Object2ByteOpenHashMap<IBlockState> object2byteopenhashmap = new Object2ByteOpenHashMap<>();
object2byteopenhashmap.defaultReturnValue((byte)127);
@@ -97,6 +97,7 @@
@@ -97,6 +97,8 @@
return this.func_177230_c().func_149750_m(this);
}
+ @Deprecated //Forge: Use position sensitive version
+ /** @deprecated use {@link IBlockState#isAir(IBlockReader, BlockPos) */
+ @Deprecated
default boolean func_196958_f() {
return this.func_177230_c().func_196261_e(this);
}
@@ -109,6 +110,7 @@
@@ -109,6 +111,8 @@
return this.func_177230_c().func_180659_g(this, p_185909_1_, p_185909_2_);
}
+ @Deprecated //Forge: Use position sensitive version
+ /** @deprecated use {@link IBlockState#rotate(IWorld, BlockPos, Rotation) */
+ @Deprecated
default IBlockState func_185907_a(Rotation p_185907_1_) {
return this.func_177230_c().func_185499_a(this, p_185907_1_);
}
@@ -1,6 +1,25 @@
--- a/net/minecraft/client/KeyboardListener.java
+++ b/net/minecraft/client/KeyboardListener.java
@@ -271,10 +271,14 @@
@@ -246,7 +246,8 @@
}
IGuiEventListener iguieventlistener = this.field_197972_a.field_71462_r;
- if (p_197961_5_ == 1 && (!(this.field_197972_a.field_71462_r instanceof GuiControls) || ((GuiControls)iguieventlistener).field_152177_g <= Util.func_211177_b() - 20L)) {
+ if ((!(this.field_197972_a.field_71462_r instanceof GuiControls) || ((GuiControls)iguieventlistener).field_152177_g <= Util.func_211177_b() - 20L)) {
+ if (p_197961_5_ == 1) {
if (this.field_197972_a.field_71474_y.field_152395_am.func_197976_a(p_197961_3_, p_197961_4_)) {
this.field_197972_a.field_195558_d.func_198077_g();
return;
@@ -264,6 +265,8 @@
});
return;
}
+ } else if (p_197961_5_ == 0 /*GLFW_RELEASE*/ && this.field_197972_a.field_71462_r instanceof GuiControls)
+ ((GuiControls)this.field_197972_a.field_71462_r).field_146491_f = null; //Forge: Unset pure modifiers.
}
if (iguieventlistener != null) {
@@ -271,10 +274,14 @@
GuiScreen.func_195121_a(() -> {
if (p_197961_5_ != 1 && (p_197961_5_ != 2 || !this.field_197973_b)) {
if (p_197961_5_ == 0) {
@@ -17,7 +36,7 @@
}
}, "keyPressed event handler", iguieventlistener.getClass().getCanonicalName());
@@ -351,12 +355,16 @@
@@ -351,12 +358,16 @@
if (iguieventlistener != null) {
if (Character.charCount(p_197963_3_) == 1) {
GuiScreen.func_195121_a(() -> {
@@ -1,5 +1,14 @@
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -314,7 +314,7 @@
supplier = p_211818_2_;
}
- return new ResourcePackInfoClient(p_211818_0_, p_211818_1_, supplier, p_211818_3_, p_211818_4_, p_211818_5_);
+ return new ResourcePackInfoClient(p_211818_0_, p_211818_1_, supplier, p_211818_3_, p_211818_4_, p_211818_5_, p_211818_3_.isHidden());
});
this.field_110448_aq.func_198982_a(this.field_195554_ax);
this.field_110448_aq.func_198982_a(new FolderPackFinder(this.field_130070_K));
@@ -322,7 +322,6 @@
this.field_152355_az = (new YggdrasilAuthenticationService(this.field_110453_aa, UUID.randomUUID().toString())).createMinecraftSessionService();
this.field_71449_j = p_i45547_1_.field_178745_a.field_178752_a;
@@ -213,11 +222,24 @@
}
private void func_184117_aA() {
@@ -1396,8 +1423,14 @@
NetworkManager networkmanager = NetworkManager.func_150722_a(socketaddress);
@@ -1378,6 +1405,14 @@
guiscreenworking.func_200209_c(new TextComponentString(""));
}
+ if (!net.minecraftforge.fml.StartupQuery.check()) {
+ this.func_147108_a(null);
+ return;
+ } else {
+ // if we're showing nothing, put the working screen back again
+ if (this.field_71462_r == null)
+ this.func_147108_a(guiscreenworking);
+ }
this.func_195542_b(false);
try {
@@ -1397,7 +1432,12 @@
networkmanager.func_150719_a(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null, (p_209507_0_) -> {
}));
+ net.minecraftforge.fml.network.NetworkHooks.registerClientLoginChannel(networkmanager);
networkmanager.func_179290_a(new CPacketHandshake(socketaddress.toString(), 0, EnumConnectionState.LOGIN));
- networkmanager.func_179290_a(new CPacketLoginStart(this.func_110432_I().func_148256_e()));
+ com.mojang.authlib.GameProfile gameProfile = this.func_110432_I().func_148256_e();
@@ -229,7 +251,7 @@
this.field_71453_ak = networkmanager;
}
@@ -1411,6 +1444,7 @@
@@ -1411,6 +1451,7 @@
}
public void func_205055_a(@Nullable WorldClient p_205055_1_, GuiScreen p_205055_2_) {
@@ -237,7 +259,7 @@
if (p_205055_1_ == null) {
NetHandlerPlayClient nethandlerplayclient = this.func_147114_u();
if (nethandlerplayclient != null) {
@@ -1447,6 +1481,7 @@
@@ -1447,6 +1488,7 @@
}
TileEntityRendererDispatcher.field_147556_a.func_147543_a(p_205055_1_);
@@ -245,7 +267,7 @@
if (p_205055_1_ != null) {
if (!this.field_71455_al) {
AuthenticationService authenticationservice = new YggdrasilAuthenticationService(this.field_110453_aa, UUID.randomUUID().toString());
@@ -1493,6 +1528,7 @@
@@ -1493,6 +1535,7 @@
EntityPlayerSP entityplayersp = this.field_71439_g;
this.field_71439_g = this.field_71442_b.func_199681_a(this.field_71441_e, this.field_71439_g == null ? new StatisticsManager() : this.field_71439_g.func_146107_m(), this.field_71439_g == null ? new RecipeBookClient(new RecipeManager()) : this.field_71439_g.func_199507_B());
this.field_71439_g.func_184212_Q().func_187218_a(entityplayersp.func_184212_Q().func_187231_c());
@@ -253,7 +275,7 @@
this.field_71439_g.field_71093_bK = p_212315_1_;
this.field_175622_Z = this.field_71439_g;
this.field_71439_g.func_70065_x();
@@ -1532,110 +1568,8 @@
@@ -1532,110 +1575,8 @@
private void func_147112_ai() {
if (this.field_71476_x != null && this.field_71476_x.field_72313_a != RayTraceResult.Type.MISS) {
@@ -366,7 +388,7 @@
}
}
@@ -1712,6 +1646,7 @@
@@ -1712,6 +1653,7 @@
return field_71432_P;
}
@@ -374,7 +396,7 @@
public ListenableFuture<Object> func_175603_A() {
return this.func_152344_a(this::func_110436_a);
}
@@ -1871,6 +1806,8 @@
@@ -1871,6 +1813,8 @@
}
public MusicTicker.MusicType func_147109_W() {
@@ -383,7 +405,7 @@
if (this.field_71462_r instanceof GuiWinGame) {
return MusicTicker.MusicType.CREDITS;
} else if (this.field_71439_g == null) {
@@ -2010,4 +1947,12 @@
@@ -2010,4 +1954,12 @@
public FontResourceManager func_211500_ak() {
return this.field_211501_aD;
}
@@ -1,10 +0,0 @@
--- a/net/minecraft/client/gui/GuiConnecting.java
+++ b/net/minecraft/client/gui/GuiConnecting.java
@@ -62,6 +62,7 @@
GuiConnecting.this.field_146371_g.func_150719_a(new NetHandlerLoginClient(GuiConnecting.this.field_146371_g, GuiConnecting.this.field_146297_k, GuiConnecting.this.field_146374_i, (p_209549_1_) -> {
GuiConnecting.this.func_209514_a(p_209549_1_);
}));
+ net.minecraftforge.fml.network.NetworkHooks.registerClientLoginChannel(GuiConnecting.this.field_146371_g);
GuiConnecting.this.field_146371_g.func_179290_a(new CPacketHandshake(p_146367_1_, p_146367_2_, EnumConnectionState.LOGIN));
GuiConnecting.this.field_146371_g.func_179290_a(new CPacketLoginStart(GuiConnecting.this.field_146297_k.func_110432_I().func_148256_e()));
} catch (UnknownHostException unknownhostexception) {
@@ -5,7 +5,7 @@
FontRenderer fontrenderer = this.field_146297_k.func_211500_ak().func_211504_a(Minecraft.field_71464_q);
int j2 = 6839882;
- if ((l < i1 + 1 || this.field_146297_k.field_71439_g.field_71068_ca < l1) && !this.field_146297_k.field_71439_g.field_71075_bZ.field_75098_d) {
+ if (((l < i1 + 1 || this.field_146297_k.field_71439_g.field_71068_ca < l1) && !this.field_146297_k.field_71439_g.field_71075_bZ.field_75098_d) || this.field_147075_G.field_185001_h[l] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels
+ if (((l < i1 + 1 || this.field_146297_k.field_71439_g.field_71068_ca < l1) && !this.field_146297_k.field_71439_g.field_71075_bZ.field_75098_d) || this.field_147075_G.field_185001_h[i1] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels
this.func_73729_b(j1, j + 14 + 19 * i1, 0, 185, 108, 19);
this.func_73729_b(j1 + 1, j + 15 + 19 * i1, 16 * i1, 239, 16, 16);
fontrenderer.func_78279_b(s1, k1, j + 16 + 19 * i1, i2, (j2 & 16711422) >> 1);
@@ -0,0 +1,19 @@
--- a/net/minecraft/client/gui/GuiScreenResourcePacks.java
+++ b/net/minecraft/client/gui/GuiScreenResourcePacks.java
@@ -84,12 +84,15 @@
resourcepacklist.func_198983_a();
List<ResourcePackInfoClient> list = Lists.newArrayList(resourcepacklist.func_198978_b());
list.removeAll(resourcepacklist.func_198980_d());
+ list.removeIf(net.minecraft.resources.ResourcePackInfo::isHidden); // Forge: Hide some resource packs from the UI entirely
for(ResourcePackInfoClient resourcepackinfoclient : list) {
this.field_146970_i.func_195095_a(new ResourcePackListEntryFound(this, resourcepackinfoclient));
}
- for(ResourcePackInfoClient resourcepackinfoclient1 : Lists.reverse(Lists.newArrayList(resourcepacklist.func_198980_d()))) {
+ java.util.Collection<ResourcePackInfoClient> enabledList = resourcepacklist.func_198980_d();
+ enabledList.removeIf(net.minecraft.resources.ResourcePackInfo::isHidden); // Forge: Hide some resource packs from the UI entirely
+ for(ResourcePackInfoClient resourcepackinfoclient1 : Lists.reverse(Lists.newArrayList(enabledList))) {
this.field_146967_r.func_195095_a(new ResourcePackListEntryFound(this, resourcepackinfoclient1));
}
}
@@ -0,0 +1,10 @@
--- a/net/minecraft/client/gui/ServerListEntryNormal.java
+++ b/net/minecraft/client/gui/ServerListEntryNormal.java
@@ -143,6 +143,7 @@
} else if (k1 >= p_194999_1_ - l - 15 - 2 && k1 <= p_194999_1_ - 15 - 2 && l1 >= 0 && l1 <= 8) {
this.field_148303_c.func_146793_a(s);
}
+ net.minecraftforge.fml.client.ClientHooks.drawForgePingInfo(this.field_148303_c, field_148301_e, j, i, p_194999_1_, k1, l1);
if (this.field_148300_d.field_71474_y.field_85185_A || p_194999_5_) {
this.field_148300_d.func_110434_K().func_110577_a(field_178014_d);
@@ -148,7 +148,7 @@
+ boolean rendered = false;
+
+ for(ItemGroup itemgroup : java.util.Arrays.copyOfRange(ItemGroup.field_78032_a, start, end)) {
+ if (itemgroup != null) continue;
+ if (itemgroup == null) continue;
if (this.func_147052_b(itemgroup, p_73863_1_, p_73863_2_)) {
+ rendered = true;
break;
@@ -0,0 +1,10 @@
--- a/net/minecraft/client/multiplayer/ServerData.java
+++ b/net/minecraft/client/multiplayer/ServerData.java
@@ -20,6 +20,7 @@
private ServerData.ServerResourceMode field_152587_j = ServerData.ServerResourceMode.PROMPT;
private String field_147411_m;
private boolean field_181042_l;
+ public net.minecraftforge.fml.client.ExtendedServerListData forgeData = null;
public ServerData(String p_i46420_1_, String p_i46420_2_, boolean p_i46420_3_) {
this.field_78847_a = p_i46420_1_;
@@ -15,3 +15,15 @@
}
public void func_72835_b(BooleanSupplier p_72835_1_) {
@@ -179,6 +181,11 @@
public void func_72900_e(Entity p_72900_1_) {
super.func_72900_e(p_72900_1_);
+ }
+
+ @Override
+ public void removeEntity(Entity p_72900_1_, boolean keepData) {
+ super.removeEntity(p_72900_1_, keepData);
this.field_73032_d.remove(p_72900_1_);
}
@@ -1,6 +1,14 @@
--- a/net/minecraft/client/network/NetHandlerLoginClient.java
+++ b/net/minecraft/client/network/NetHandlerLoginClient.java
@@ -122,6 +122,7 @@
@@ -98,6 +98,7 @@
this.field_209525_d.accept(new TextComponentTranslation("connect.joining"));
this.field_175091_e = p_147390_1_.func_179730_a();
this.field_147393_d.func_150723_a(EnumConnectionState.PLAY);
+ net.minecraftforge.fml.network.NetworkHooks.handleClientLoginSuccess(this.field_147393_d);
this.field_147393_d.func_150719_a(new NetHandlerPlayClient(this.field_147394_b, this.field_147395_c, this.field_147393_d, this.field_175091_e));
}
@@ -122,6 +123,7 @@
}
public void func_209521_a(SPacketCustomPayloadLogin p_209521_1_) {
@@ -0,0 +1,11 @@
--- a/net/minecraft/client/network/ServerPinger.java
+++ b/net/minecraft/client/network/ServerPinger.java
@@ -120,6 +120,8 @@
p_147224_1_.func_147407_a((String)null);
}
+ net.minecraftforge.fml.client.ClientHooks.processForgeListPingData(serverstatusresponse, p_147224_1_);
+
this.field_175092_e = Util.func_211177_b();
networkmanager.func_179290_a(new CPacketPing(this.field_175092_e));
this.field_147403_d = true;
@@ -0,0 +1,33 @@
--- a/net/minecraft/client/renderer/color/ItemColors.java
+++ b/net/minecraft/client/renderer/color/ItemColors.java
@@ -22,7 +22,8 @@
@OnlyIn(Dist.CLIENT)
public class ItemColors {
- private final ObjectIntIdentityMap<IItemColor> field_186732_a = new ObjectIntIdentityMap<>(32);
+ // FORGE: Use RegistryDelegates as non-Vanilla item ids are not constant
+ private final java.util.Map<net.minecraftforge.registries.IRegistryDelegate<Item>, IItemColor> field_186732_a = new java.util.HashMap<>();
public static ItemColors func_186729_a(BlockColors p_186729_0_) {
ItemColors itemcolors = new ItemColors();
@@ -80,17 +81,18 @@
itemcolors.func_199877_a((p_210237_0_, p_210237_1_) -> {
return p_210237_1_ == 0 ? -1 : ItemMap.func_190907_h(p_210237_0_);
}, Items.field_151098_aY);
+ net.minecraftforge.client.ForgeHooksClient.onItemColorsInit(itemcolors, p_186729_0_);
return itemcolors;
}
public int func_186728_a(ItemStack p_186728_1_, int p_186728_2_) {
- IItemColor iitemcolor = this.field_186732_a.func_148745_a(IRegistry.field_212630_s.func_148757_b(p_186728_1_.func_77973_b()));
+ IItemColor iitemcolor = this.field_186732_a.get(p_186728_1_.func_77973_b().delegate);
return iitemcolor == null ? -1 : iitemcolor.getColor(p_186728_1_, p_186728_2_);
}
public void func_199877_a(IItemColor p_199877_1_, IItemProvider... p_199877_2_) {
for(IItemProvider iitemprovider : p_199877_2_) {
- this.field_186732_a.func_148746_a(p_199877_1_, Item.func_150891_b(iitemprovider.func_199767_j()));
+ this.field_186732_a.put(iitemprovider.func_199767_j().delegate, p_199877_1_);
}
}
@@ -0,0 +1,10 @@
--- a/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java
+++ b/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java
@@ -67,6 +67,7 @@
}
private boolean func_188186_a(BlockPos p_188186_1_, IBlockState p_188186_2_, BufferBuilder p_188186_3_, World p_188186_4_, boolean p_188186_5_) {
+ if (field_178462_c == null) field_178462_c = Minecraft.func_71410_x().func_175602_ab();
return this.field_178462_c.func_175019_b().func_199324_a(p_188186_4_, this.field_178462_c.func_184389_a(p_188186_2_), p_188186_2_, p_188186_1_, p_188186_3_, p_188186_5_, new Random(), p_188186_2_.func_209533_a(p_188186_1_));
}
}
@@ -0,0 +1,32 @@
--- a/net/minecraft/client/resources/ResourcePackInfoClient.java
+++ b/net/minecraft/client/resources/ResourcePackInfoClient.java
@@ -23,8 +23,13 @@
@Nullable
private ResourceLocation field_195810_b;
+ @Deprecated
public ResourcePackInfoClient(String p_i48113_1_, boolean p_i48113_2_, Supplier<IResourcePack> p_i48113_3_, IResourcePack p_i48113_4_, PackMetadataSection p_i48113_5_, ResourcePackInfo.Priority p_i48113_6_) {
- super(p_i48113_1_, p_i48113_2_, p_i48113_3_, p_i48113_4_, p_i48113_5_, p_i48113_6_);
+ this(p_i48113_1_, p_i48113_2_, p_i48113_3_, p_i48113_4_, p_i48113_5_, p_i48113_6_, false);
+ }
+
+ public ResourcePackInfoClient(String p_i48113_1_, boolean p_i48113_2_, Supplier<IResourcePack> p_i48113_3_, IResourcePack p_i48113_4_, PackMetadataSection p_i48113_5_, ResourcePackInfo.Priority p_i48113_6_, boolean hidden) {
+ super(p_i48113_1_, p_i48113_2_, p_i48113_3_, p_i48113_4_, p_i48113_5_, p_i48113_6_, hidden);
NativeImage nativeimage = null;
try (InputStream inputstream = p_i48113_4_.func_195763_b("pack.png")) {
@@ -36,8 +41,13 @@
this.field_195809_a = nativeimage;
}
+ @Deprecated
public ResourcePackInfoClient(String p_i48114_1_, boolean p_i48114_2_, Supplier<IResourcePack> p_i48114_3_, ITextComponent p_i48114_4_, ITextComponent p_i48114_5_, PackCompatibility p_i48114_6_, ResourcePackInfo.Priority p_i48114_7_, boolean p_i48114_8_, @Nullable NativeImage p_i48114_9_) {
- super(p_i48114_1_, p_i48114_2_, p_i48114_3_, p_i48114_4_, p_i48114_5_, p_i48114_6_, p_i48114_7_, p_i48114_8_);
+ this(p_i48114_1_, p_i48114_2_, p_i48114_3_, p_i48114_4_, p_i48114_5_, p_i48114_6_, p_i48114_7_, p_i48114_8_, p_i48114_9_, false);
+ }
+
+ public ResourcePackInfoClient(String p_i48114_1_, boolean p_i48114_2_, Supplier<IResourcePack> p_i48114_3_, ITextComponent p_i48114_4_, ITextComponent p_i48114_5_, PackCompatibility p_i48114_6_, ResourcePackInfo.Priority p_i48114_7_, boolean p_i48114_8_, @Nullable NativeImage p_i48114_9_, boolean hidden) {
+ super(p_i48114_1_, p_i48114_2_, p_i48114_3_, p_i48114_4_, p_i48114_5_, p_i48114_6_, p_i48114_7_, p_i48114_8_, hidden);
this.field_195809_a = p_i48114_9_;
}
@@ -94,7 +94,7 @@
return this.field_74512_d.equals(p_197983_1_.field_74512_d);
}
@@ -153,14 +173,94 @@
@@ -153,14 +173,110 @@
}
public String func_197978_k() {
@@ -120,6 +120,14 @@
+ /**
+ * Convenience constructor for creating KeyBindings with keyConflictContext set.
+ */
+ public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, final InputMappings.Type inputType, final int keyCode, String category)
+ {
+ this(description, keyConflictContext, inputType.func_197944_a(keyCode), category);
+ }
+
+ /**
+ * Convenience constructor for creating KeyBindings with keyConflictContext set.
+ */
+ public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, InputMappings.Input keyCode, String category)
+ {
+ this(description, keyConflictContext, net.minecraftforge.client.settings.KeyModifier.NONE, keyCode, category);
@@ -128,6 +136,14 @@
+ /**
+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set.
+ */
+ public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, final InputMappings.Type inputType, final int keyCode, String category)
+ {
+ this(description, keyConflictContext, keyModifier, inputType.func_197944_a(keyCode), category);
+ }
+
+ /**
+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set.
+ */
+ public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, InputMappings.Input keyCode, String category)
+ {
+ this.field_74515_c = description;
@@ -0,0 +1,23 @@
--- a/net/minecraft/command/impl/TeleportCommand.java
+++ b/net/minecraft/command/impl/TeleportCommand.java
@@ -135,9 +135,9 @@
p_201127_1_.func_70034_d(f);
} else {
WorldServer worldserver = (WorldServer)p_201127_1_.field_70170_p;
- worldserver.func_72900_e(p_201127_1_);
+ worldserver.removeEntity(p_201127_1_, true); //Forge: Delay invalidating caps until we copy.
p_201127_1_.field_71093_bK = p_201127_2_.field_73011_w.func_186058_p();
- p_201127_1_.field_70128_L = false;
+ p_201127_1_.revive();
Entity entity = p_201127_1_;
p_201127_1_ = p_201127_1_.func_200600_R().func_200721_a(p_201127_2_);
if (p_201127_1_ == null) {
@@ -152,7 +152,7 @@
p_201127_2_.func_72838_d(p_201127_1_);
p_201127_1_.field_98038_p = flag;
p_201127_2_.func_72866_a(p_201127_1_, false);
- entity.field_70128_L = true;
+ entity.remove(false); //Forge: now invalidate everything.
}
}
@@ -15,7 +15,15 @@
private final EntityType<?> field_200606_g;
private int field_145783_c;
public boolean field_70156_m;
@@ -192,6 +193,7 @@
@@ -132,6 +133,7 @@
public boolean field_70133_I;
protected boolean field_70134_J;
private boolean field_174835_g;
+ @Deprecated //Forge: Use isAlive, remove(boolean) and revive() instead of directly accessing this field. To allow the entity to react to and better control this information.
public boolean field_70128_L;
public float field_70130_N;
public float field_70131_O;
@@ -192,6 +194,7 @@
private long field_191506_aJ;
public Entity(EntityType<?> p_i48580_1_, World p_i48580_2_) {
@@ -23,7 +31,7 @@
this.field_145783_c = field_70152_a++;
this.field_184244_h = Lists.newArrayList();
this.field_70121_D = field_174836_a;
@@ -221,6 +223,8 @@
@@ -221,6 +224,8 @@
this.field_70180_af.func_187214_a(field_184234_aB, false);
this.field_70180_af.func_187214_a(field_189655_aD, false);
this.func_70088_a();
@@ -32,15 +40,21 @@
}
public EntityType<?> func_200600_R() {
@@ -290,6 +294,7 @@
@@ -289,7 +294,13 @@
}
public void func_70106_y() {
+ this.remove(false);
+ }
+
+ public void remove(boolean keepData) {
this.field_70128_L = true;
+ this.invalidateCaps();
+ if (!keepData)
+ this.invalidateCaps();
}
public void func_184174_b(boolean p_184174_1_) {
@@ -324,6 +329,7 @@
@@ -324,6 +335,7 @@
this.field_70165_t = p_70107_1_;
this.field_70163_u = p_70107_3_;
this.field_70161_v = p_70107_5_;
@@ -48,7 +62,7 @@
float f = this.field_70130_N / 2.0F;
float f1 = this.field_70131_O;
this.func_174826_a(new AxisAlignedBB(p_70107_1_ - (double)f, p_70107_3_, p_70107_5_ - (double)f, p_70107_1_ + (double)f, p_70107_3_ + (double)f1, p_70107_5_ + (double)f));
@@ -697,7 +703,7 @@
@@ -697,7 +709,7 @@
int k1 = MathHelper.func_76128_c(this.field_70161_v);
BlockPos blockpos = new BlockPos(j1, k, k1);
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos);
@@ -57,7 +71,7 @@
BlockPos blockpos1 = blockpos.func_177977_b();
IBlockState iblockstate1 = this.field_70170_p.func_180495_p(blockpos1);
Block block1 = iblockstate1.func_177230_c();
@@ -735,7 +741,7 @@
@@ -735,7 +747,7 @@
this.field_70140_Q = (float)((double)this.field_70140_Q + (double)MathHelper.func_76133_a(d21 * d21 + d23 * d23) * 0.6D);
this.field_82151_R = (float)((double)this.field_82151_R + (double)MathHelper.func_76133_a(d21 * d21 + d22 * d22 + d23 * d23) * 0.6D);
@@ -66,7 +80,7 @@
this.field_70150_b = this.func_203009_ad();
if (this.func_70090_H()) {
Entity entity = this.func_184207_aI() && this.func_184179_bs() != null ? this.func_184179_bs() : this;
@@ -749,7 +755,7 @@
@@ -749,7 +761,7 @@
} else {
this.func_180429_a(blockpos, iblockstate);
}
@@ -75,7 +89,7 @@
this.field_191959_ay = this.func_191954_d(this.field_82151_R);
}
}
@@ -795,6 +801,7 @@
@@ -795,6 +807,7 @@
this.field_70165_t = (axisalignedbb.field_72340_a + axisalignedbb.field_72336_d) / 2.0D;
this.field_70163_u = axisalignedbb.field_72338_b;
this.field_70161_v = (axisalignedbb.field_72339_c + axisalignedbb.field_72334_f) / 2.0D;
@@ -83,7 +97,7 @@
}
protected SoundEvent func_184184_Z() {
@@ -846,7 +853,7 @@
@@ -846,7 +859,7 @@
protected void func_180429_a(BlockPos p_180429_1_, IBlockState p_180429_2_) {
if (!p_180429_2_.func_185904_a().func_76224_d()) {
@@ -92,7 +106,7 @@
this.func_184185_a(soundtype.func_185844_d(), soundtype.func_185843_a() * 0.15F, soundtype.func_185847_b());
}
}
@@ -1041,6 +1048,7 @@
@@ -1041,6 +1054,7 @@
int k = MathHelper.func_76128_c(this.field_70161_v);
BlockPos blockpos = new BlockPos(i, j, k);
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos);
@@ -100,7 +114,7 @@
if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE) {
this.field_70170_p.func_195594_a(new BlockParticleData(Particles.field_197611_d, iblockstate), this.field_70165_t + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_70130_N, this.func_174813_aQ().field_72338_b + 0.1D, this.field_70161_v + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_70130_N, -this.field_70159_w * 4.0D, 1.5D, -this.field_70179_y * 4.0D);
}
@@ -1054,7 +1062,7 @@
@@ -1054,7 +1068,7 @@
double d0 = this.field_70163_u + (double)this.func_70047_e();
BlockPos blockpos = new BlockPos(this.field_70165_t, d0, this.field_70161_v);
IFluidState ifluidstate = this.field_70170_p.func_204610_c(blockpos);
@@ -109,7 +123,7 @@
}
}
@@ -1123,6 +1131,7 @@
@@ -1123,6 +1137,7 @@
this.field_70126_B -= 360.0F;
}
@@ -117,7 +131,7 @@
this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v);
this.func_70101_b(p_70080_7_, p_70080_8_);
}
@@ -1371,6 +1380,7 @@
@@ -1371,6 +1386,7 @@
if (this.field_184238_ar) {
p_189511_1_.func_74757_a("Glowing", this.field_184238_ar);
}
@@ -125,26 +139,28 @@
if (!this.field_184236_aF.isEmpty()) {
NBTTagList nbttaglist = new NBTTagList();
@@ -1382,6 +1392,9 @@
@@ -1382,6 +1398,10 @@
p_189511_1_.func_74782_a("Tags", nbttaglist);
}
+ NBTTagCompound caps = serializeCaps();
+ if (caps != null) p_189511_1_.func_74782_a("ForgeCaps", caps);
+ if (entityData != null) p_189511_1_.func_74782_a("ForgeData", entityData);
+
this.func_70014_b(p_189511_1_);
if (this.func_184207_aI()) {
NBTTagList nbttaglist1 = new NBTTagList();
@@ -1467,6 +1480,8 @@
@@ -1467,6 +1487,9 @@
this.func_174810_b(p_70020_1_.func_74767_n("Silent"));
this.func_189654_d(p_70020_1_.func_74767_n("NoGravity"));
this.func_184195_f(p_70020_1_.func_74767_n("Glowing"));
+ if (p_70020_1_.func_150297_b("ForgeData", 10)) entityData = p_70020_1_.func_74775_l("ForgeData");
+ if (p_70020_1_.func_150297_b("CanUpdate", 99)) this.canUpdate(p_70020_1_.func_74767_n("CanUpdate"));
+ if (p_70020_1_.func_150297_b("ForgeCaps", 10)) deserializeCaps(p_70020_1_.func_74775_l("ForgeCaps"));
if (p_70020_1_.func_150297_b("Tags", 9)) {
this.field_184236_aF.clear();
NBTTagList nbttaglist1 = p_70020_1_.func_150295_c("Tags", 8);
@@ -1547,6 +1562,8 @@
@@ -1547,6 +1570,8 @@
} else {
EntityItem entityitem = new EntityItem(this.field_70170_p, this.field_70165_t, this.field_70163_u + (double)p_70099_2_, this.field_70161_v, p_70099_1_);
entityitem.func_174869_p();
@@ -153,7 +169,7 @@
this.field_70170_p.func_72838_d(entityitem);
return entityitem;
}
@@ -1596,6 +1613,7 @@
@@ -1596,6 +1621,7 @@
this.field_70159_w = 0.0D;
this.field_70181_x = 0.0D;
this.field_70179_y = 0.0D;
@@ -161,7 +177,7 @@
this.func_70071_h_();
if (this.func_184218_aH()) {
entity.func_184232_k(this);
@@ -1637,6 +1655,7 @@
@@ -1637,6 +1663,7 @@
}
}
@@ -169,7 +185,7 @@
if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) {
if (this.func_184218_aH()) {
this.func_184210_p();
@@ -1664,6 +1683,7 @@
@@ -1664,6 +1691,7 @@
public void func_184210_p() {
if (this.field_184239_as != null) {
Entity entity = this.field_184239_as;
@@ -177,7 +193,7 @@
this.field_184239_as = null;
entity.func_184225_p(this);
}
@@ -1790,10 +1810,15 @@
@@ -1790,6 +1818,7 @@
return !this.func_184188_bt().isEmpty();
}
@@ -185,15 +201,7 @@
public boolean func_205710_ba() {
return true;
}
+ public boolean canBeRiddenInWater(Entity rider) {
+ return func_205710_ba();
+ }
+
public boolean func_70093_af() {
return this.func_70083_f(1);
}
@@ -1991,7 +2016,7 @@
@@ -1991,7 +2020,7 @@
func_207712_c(itextcomponent1);
return itextcomponent1;
} else {
@@ -202,7 +210,7 @@
}
}
@@ -2054,6 +2079,14 @@
@@ -2054,6 +2083,14 @@
@Nullable
public Entity func_212321_a(DimensionType p_212321_1_) {
@@ -210,14 +218,14 @@
+ return changeDimension(p_212321_1_, this.func_184102_h().func_71218_a(p_212321_1_).func_85176_s());
+ }
+
+ @Nullable // Forge: Entities that require custom handling should override this method, not the other
+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter)
+ {
+ @Nullable
+ @Override
+ public Entity changeDimension(DimensionType p_212321_1_, net.minecraftforge.common.util.ITeleporter teleporter) {
+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_212321_1_)) return null;
if (!this.field_70170_p.field_72995_K && !this.field_70128_L) {
this.field_70170_p.field_72984_F.func_76320_a("changeDimension");
MinecraftServer minecraftserver = this.func_184102_h();
@@ -2061,7 +2094,7 @@
@@ -2061,25 +2098,25 @@
WorldServer worldserver = minecraftserver.func_71218_a(dimensiontype);
WorldServer worldserver1 = minecraftserver.func_71218_a(p_212321_1_);
this.field_71093_bK = p_212321_1_;
@@ -226,8 +234,11 @@
worldserver1 = minecraftserver.func_71218_a(DimensionType.OVERWORLD);
this.field_71093_bK = DimensionType.OVERWORLD;
}
@@ -2070,16 +2103,16 @@
this.field_70128_L = false;
- this.field_70170_p.func_72900_e(this);
- this.field_70128_L = false;
+ this.field_70170_p.removeEntity(this, true); //Forge: Keep data until we copy.
+ this.revive();
this.field_70170_p.field_72984_F.func_76320_a("reposition");
BlockPos blockpos;
- if (p_212321_1_ == DimensionType.THE_END) {
@@ -249,7 +260,7 @@
d0 = MathHelper.func_151237_a(d0 * 8.0D, worldserver1.func_175723_af().func_177726_b() + 16.0D, worldserver1.func_175723_af().func_177728_d() - 16.0D);
d1 = MathHelper.func_151237_a(d1 * 8.0D, worldserver1.func_175723_af().func_177736_c() + 16.0D, worldserver1.func_175723_af().func_177733_e() - 16.0D);
}
@@ -2088,8 +2121,7 @@
@@ -2088,8 +2125,7 @@
d1 = (double)MathHelper.func_76125_a((int)d1, -29999872, 29999872);
float f = this.field_70177_z;
this.func_70012_b(d0, this.field_70163_u, d1, 90.0F, 0.0F);
@@ -259,7 +270,7 @@
blockpos = new BlockPos(this);
}
@@ -2098,7 +2130,7 @@
@@ -2098,7 +2134,7 @@
Entity entity = this.func_200600_R().func_200721_a(worldserver1);
if (entity != null) {
entity.func_180432_n(this);
@@ -268,11 +279,22 @@
BlockPos blockpos1 = worldserver1.func_205770_a(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.func_175694_M());
entity.func_174828_a(blockpos1, entity.field_70177_z, entity.field_70125_A);
} else {
@@ -2592,4 +2624,56 @@
@@ -2112,7 +2148,7 @@
worldserver1.func_72866_a(entity, false);
}
- this.field_70128_L = true;
+ this.remove(false); //Forge: now invalidate old entity
this.field_70170_p.field_72984_F.func_76319_b();
worldserver.func_82742_i();
worldserver1.func_82742_i();
@@ -2592,4 +2628,63 @@
public double func_212107_bY() {
return this.field_211517_W;
}
+
+ /* ================================== Forge Start =====================================*/
+
+ private boolean canUpdate = true;
+ @Override
+ public void canUpdate(boolean value) {
@@ -308,7 +330,6 @@
+ && this.field_70130_N * this.field_70130_N * this.field_70131_O > 0.512F;
+ }
+
+ /* ================================== Forge Start =====================================*/
+ /**
+ * Internal use for keeping track of entities that are tracked by a world, to
+ * allow guarantees that entity position changes will force a chunk load, avoiding
@@ -324,4 +345,10 @@
+
+ @Override
+ public void onRemovedFromWorld() { this.isAddedToWorld = false; }
+
+ @Override
+ public void revive() {
+ this.field_70128_L = false;
+ this.reviveCaps();
+ }
}
@@ -220,7 +220,7 @@
float f2 = this.func_110143_aJ();
- this.func_70606_j(f2 - p_70665_2_);
this.func_110142_aN().func_94547_a(p_70665_1_, f2, p_70665_2_);
+ this.func_70606_j(f1 - p_70665_2_); // Forge: moved to fix MC-121048
+ this.func_70606_j(f2 - p_70665_2_); // Forge: moved to fix MC-121048
this.func_110149_m(this.func_110139_bj() - p_70665_2_);
}
}
@@ -371,7 +371,7 @@
this.field_184627_bm.func_77974_b(this.field_70170_p, this, this.func_184605_cv());
}
@@ -2363,4 +2423,60 @@
@@ -2363,4 +2423,62 @@
@OnlyIn(Dist.CLIENT)
public void func_191987_a(BlockPos p_191987_1_, boolean p_191987_2_) {
}
@@ -417,7 +417,7 @@
+
+ @Override
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable EnumFacing facing) {
+ if (!this.field_70128_L && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
+ if (this.func_70089_S() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
+ if (facing == null) return handlers[2].cast();
+ else if (facing.func_176740_k().func_200128_b()) return handlers[0].cast();
+ else if (facing.func_176740_k().func_176722_c()) return handlers[1].cast();
@@ -426,9 +426,11 @@
+ }
+
+ @Override
+ public void func_70106_y() {
+ super.func_70106_y();
+ for (int x = 0; x < handlers.length; x++)
+ handlers[x].invalidate();
+ public void remove(boolean keepData) {
+ super.remove(keepData);
+ if (!keepData) {
+ for (int x = 0; x < handlers.length; x++)
+ handlers[x].invalidate();
+ }
+ }
}
@@ -8,13 +8,17 @@
field_209347_a.put(p_209346_0_, new EntitySpawnPlacementRegistry.Entry(p_209346_2_, p_209346_1_, p_209346_3_));
}
@@ -109,5 +110,20 @@
public static enum SpawnPlacementType {
@@ -106,8 +107,23 @@
}
}
- public static enum SpawnPlacementType {
+ public static enum SpawnPlacementType implements net.minecraftforge.common.IExtensibleEnum {
ON_GROUND,
IN_WATER;
+
+ public static SpawnPlacementType create(String name, net.minecraftforge.common.util.TriPredicate<net.minecraft.world.IWorldReaderBase, net.minecraft.util.math.BlockPos, EntityType<? extends EntityLiving>> predicate) {
+ return null;
+ throw new IllegalStateException("Enum not extended");
+ }
+
+ private net.minecraftforge.common.util.TriPredicate<net.minecraft.world.IWorldReaderBase, net.minecraft.util.math.BlockPos, EntityType<? extends EntityLiving>> predicate;
@@ -1,6 +1,6 @@
--- a/net/minecraft/entity/item/EntityMinecartContainer.java
+++ b/net/minecraft/entity/item/EntityMinecartContainer.java
@@ -120,10 +120,11 @@
@@ -120,18 +120,26 @@
return 64;
}
@@ -14,15 +14,23 @@
}
public void func_70106_y() {
@@ -132,6 +133,7 @@
+ super.func_70106_y();
+ }
+
+ @Override
+ public void remove(boolean keepData) {
if (this.field_94112_b) {
InventoryHelper.func_180176_a(this.field_70170_p, this, this);
}
super.func_70106_y();
+ itemHandler.invalidate();
- super.func_70106_y();
+ super.remove(keepData);
+ if (!keepData)
+ itemHandler.invalidate();
}
public void func_184174_b(boolean p_184174_1_) {
@@ -164,6 +166,7 @@
@@ -164,6 +172,7 @@
}
public boolean func_184230_a(EntityPlayer p_184230_1_, EnumHand p_184230_2_) {
@@ -30,7 +38,7 @@
if (!this.field_70170_p.field_72995_K) {
p_184230_1_.func_71007_a(this);
}
@@ -216,9 +219,9 @@
@@ -216,9 +225,9 @@
random = new Random(this.field_184291_d);
}
@@ -42,7 +50,7 @@
}
loottable.func_186460_a(this, random, lootcontext$builder.func_186471_a());
@@ -239,4 +242,13 @@
@@ -239,4 +248,13 @@
public ResourceLocation func_184276_b() {
return this.field_184290_c;
}
@@ -51,7 +59,7 @@
+
+ @Override
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.util.EnumFacing facing) {
+ if (!this.field_70128_L && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
+ if (this.func_70089_S() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
+ return itemHandler.cast();
+ return super.getCapability(capability, facing);
+ }
@@ -1,5 +1,14 @@
--- a/net/minecraft/entity/monster/EntitySlime.java
+++ b/net/minecraft/entity/monster/EntitySlime.java
@@ -113,7 +113,7 @@
public void func_70071_h_() {
if (!this.field_70170_p.field_72995_K && this.field_70170_p.func_175659_aa() == EnumDifficulty.PEACEFUL && this.func_70809_q() > 0) {
- this.field_70128_L = true;
+ this.func_70106_y(); //Forge: Kill entity with notification to caps/subclasses.
}
this.field_70811_b += (this.field_70813_a - this.field_70811_b) * 0.5F;
@@ -122,6 +122,7 @@
if (this.field_70122_E && !this.field_175452_bi) {
int i = this.func_70809_q();
@@ -27,12 +27,17 @@
this.func_184747_a(false);
itemstack.func_77972_a(1, p_184645_1_);
}
@@ -166,4 +166,10 @@
@@ -166,4 +166,15 @@
public void func_184724_a(boolean p_184724_1_) {
}
+
+ @Override
+ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) {
+ return this.func_184748_o();
+ }
+
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorld world, BlockPos pos, int fortune) {
+ this.func_184747_a(false);
+ return new java.util.ArrayList<>();
@@ -8,7 +8,7 @@
}
protected void func_110232_cE() {
@@ -960,4 +961,19 @@
@@ -960,4 +961,22 @@
return p_204210_2_;
}
@@ -17,14 +17,17 @@
+
+ @Override
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.util.EnumFacing facing) {
+ if (!this.field_70128_L && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && itemHandler != null)
+ if (this.func_70089_S() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && itemHandler != null)
+ return itemHandler.cast();
+ return super.getCapability(capability, facing);
+ }
+
+ @Override
+ public void func_70106_y() {
+ super.func_70106_y();
+ itemHandler.invalidate();
+ public void remove(boolean keepData) {
+ super.remove(keepData);
+ if (!keepData && itemHandler != null) {
+ itemHandler.invalidate();
+ itemHandler = null;
+ }
+ }
}
@@ -34,7 +34,7 @@
+
+ @Override
+ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) {
+ return !this.func_70631_g_();
+ return !this.func_70892_o() && !this.func_70631_g_();
+ }
+
+ @Override
@@ -17,12 +17,14 @@
private HorseArmorType(int p_i46799_3_) {
this.field_188588_g = p_i46799_3_;
@@ -29,6 +30,15 @@
@@ -29,6 +30,17 @@
this.field_188587_f = p_i46800_5_;
}
+ private HorseArmorType(int strength, String texture, String hash, Item item) {
+ this(strength, texture, hash);
+ this.field_188588_g = strength;
+ this.field_188586_e = texture;
+ this.field_188587_f = hash;
+ this.item = item;
+ }
+
@@ -33,7 +35,7 @@
public int func_188579_a() {
return this.ordinal();
}
@@ -48,25 +58,38 @@
@@ -48,25 +60,38 @@
return this.field_188586_e;
}
@@ -498,7 +498,7 @@
if (this.func_70608_bn()) {
f = 0.2F;
} else if (!this.func_203007_ba() && !this.func_184613_cA() && this.field_70131_O != 0.6F) {
@@ -1973,6 +2100,30 @@
@@ -1973,6 +2100,54 @@
return this.field_71075_bZ.field_75098_d && this.func_184840_I() >= 2;
}
@@ -525,6 +525,30 @@
+ public Collection<ITextComponent> getSuffixes() {
+ return this.suffixes;
+ }
+
+ private final net.minecraftforge.common.util.LazyOptional<net.minecraftforge.items.IItemHandler>
+ playerMainHandler = net.minecraftforge.common.util.LazyOptional.of(
+ () -> new net.minecraftforge.items.wrapper.PlayerMainInvWrapper(field_71071_by));
+
+ private final net.minecraftforge.common.util.LazyOptional<net.minecraftforge.items.IItemHandler>
+ playerEquipmentHandler = net.minecraftforge.common.util.LazyOptional.of(
+ () -> new net.minecraftforge.items.wrapper.CombinedInvWrapper(
+ new net.minecraftforge.items.wrapper.PlayerArmorInvWrapper(field_71071_by),
+ new net.minecraftforge.items.wrapper.PlayerOffhandInvWrapper(field_71071_by)));
+
+ private final net.minecraftforge.common.util.LazyOptional<net.minecraftforge.items.IItemHandler>
+ playerJoinedHandler = net.minecraftforge.common.util.LazyOptional.of(
+ () -> new net.minecraftforge.items.wrapper.PlayerInvWrapper(field_71071_by));
+
+ @Override
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable EnumFacing facing) {
+ if (this.func_70089_S() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
+ if (facing == null) return playerJoinedHandler.cast();
+ else if (facing.func_176740_k().func_200128_b()) return playerMainHandler.cast();
+ else if (facing.func_176740_k().func_176722_c()) return playerEquipmentHandler.cast();
+ }
+ return super.getCapability(capability, facing);
+ }
+
public static enum EnumChatVisibility {
FULL(0, "options.chat.visibility.full"),
@@ -119,3 +119,14 @@
}
protected void func_70670_a(PotionEffect p_70670_1_) {
@@ -1179,8 +1203,8 @@
this.field_71093_bK = p_200619_1_.field_73011_w.func_186058_p();
this.field_71135_a.func_147359_a(new SPacketRespawn(this.field_71093_bK, worldserver.func_175659_aa(), worldserver.func_72912_H().func_76067_t(), this.field_71134_c.func_73081_b()));
this.field_71133_b.func_184103_al().func_187243_f(this);
- worldserver.func_72973_f(this);
- this.field_70128_L = false;
+ worldserver.removeEntityDangerously(this, true); //Forge: The player entity itself is moved, and not cloned. So we need to keep the data alive with no matching invalidate call later.
+ this.revive();
this.func_70012_b(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_);
if (this.func_70089_S()) {
worldserver.func_72866_a(this, false);
@@ -12,13 +12,21 @@
BlockDispenser.func_199774_a(Items.field_203797_aN, ibehaviordispenseitem);
BlockDispenser.func_199774_a(Items.field_203795_aL, ibehaviordispenseitem);
BlockDispenser.func_199774_a(Items.field_204272_aO, ibehaviordispenseitem);
+ BlockDispenser.func_199774_a(Items.field_151117_aB, net.minecraftforge.fluids.DispenseFluidContainer.getInstance());
+ BlockDispenser.func_199774_a(Items.field_151133_ar, net.minecraftforge.fluids.DispenseFluidContainer.getInstance());
+ if (false)
+ /*BlockDispenser.registerDispenseBehavior(Items.MILK_BUCKET, net.minecraftforge.fluids.DispenseFluidContainer.getInstance());
+ BlockDispenser.registerDispenseBehavior(Items.BUCKET, net.minecraftforge.fluids.DispenseFluidContainer.getInstance());
+ if (false)*/
BlockDispenser.func_199774_a(Items.field_151133_ar, new BehaviorDefaultDispenseItem() {
private final BehaviorDefaultDispenseItem field_150840_b = new BehaviorDefaultDispenseItem();
@@ -429,6 +433,7 @@
@@ -420,6 +424,7 @@
PaintingType.func_200831_a();
StatList.func_212734_a();
IRegistry.func_212613_e();
+ net.minecraftforge.fml.common.registry.VillagerRegistry.instance();
if (SharedConstants.field_206244_b) {
func_210839_a("block", IRegistry.field_212618_g, Block::func_149739_a);
func_210839_a("biome", IRegistry.field_212624_m, Biome::func_210773_k);
@@ -429,6 +434,7 @@
func_210839_a("entity", IRegistry.field_212629_r, EntityType::func_210760_d);
}
@@ -4,7 +4,7 @@
protected void func_75208_c(ItemStack p_75208_1_) {
if (this.field_75237_g > 0) {
p_75208_1_.func_77980_a(this.field_75238_b.field_70170_p, this.field_75238_b, this.field_75237_g);
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerCraftingEvent(this.field_75238_b, p_75208_1_, this.field_75224_c);
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerCraftingEvent(this.field_75238_b, p_75208_1_, this.field_75239_a);
}
((IRecipeHolder)this.field_75224_c).func_201560_d(this.field_75238_b);
@@ -1,20 +0,0 @@
--- a/net/minecraft/item/ArmorMaterial.java
+++ b/net/minecraft/item/ArmorMaterial.java
@@ -10,7 +10,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public enum ArmorMaterial implements IArmorMaterial {
+public enum ArmorMaterial implements IArmorMaterial, net.minecraftforge.common.IExtensibleEnum {
LEATHER("leather", 5, new int[]{1, 2, 3, 1}, 15, SoundEvents.field_187728_s, 0.0F, () -> {
return Ingredient.func_199804_a(Items.field_151116_aA);
}),
@@ -77,4 +77,8 @@
public float func_200901_e() {
return this.field_189417_k;
}
+
+ public static ArmorMaterial create(String name, String p_i48533_3_, int p_i48533_4_, int[] p_i48533_5_, int p_i48533_6_, SoundEvent p_i48533_7_, float p_i48533_8_, Supplier<Ingredient> p_i48533_9_) {
+ throw new IllegalStateException("Enum not extended");
+ }
}
@@ -1,14 +1,16 @@
--- a/net/minecraft/item/Item.java
+++ b/net/minecraft/item/Item.java
@@ -48,7 +48,7 @@
@@ -48,8 +48,8 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class Item implements IItemProvider {
- public static final Map<Block, Item> field_179220_a = Maps.newHashMap();
+public class Item extends net.minecraftforge.registries.ForgeRegistryEntry<Item> implements IItemProvider, net.minecraftforge.common.extensions.IForgeItem {
public static final Map<Block, Item> field_179220_a = Maps.newHashMap();
+ public static final Map<Block, Item> field_179220_a = net.minecraftforge.registries.GameData.getBlockItemMap();
private static final IItemPropertyGetter field_185046_b = (p_210306_0_, p_210306_1_, p_210306_2_) -> {
return p_210306_0_.func_77951_h() ? 1.0F : 0.0F;
};
@@ -96,6 +96,10 @@
this.field_77700_c = p_i48487_1_.field_200922_c;
this.field_77699_b = p_i48487_1_.field_200921_b;
@@ -25,7 +25,7 @@
+
+ @Override
+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockReader world, BlockPos pos) {
+ return net.minecraftforge.common.EnumPlantType.Crop;
+ return this.field_195978_a.func_177230_c() == net.minecraft.init.Blocks.field_150388_bm ? net.minecraftforge.common.EnumPlantType.Nether : net.minecraftforge.common.EnumPlantType.Crop;
+ }
+
+ @Override
@@ -80,20 +80,17 @@
public static Ingredient func_193369_a(ItemStack... p_193369_0_) {
return func_209357_a(Arrays.stream(p_193369_0_).map((p_209356_0_) -> {
return new Ingredient.SingleItemList(p_209356_0_);
@@ -145,7 +173,12 @@
}
@@ -146,6 +174,9 @@
public static Ingredient func_199566_b(PacketBuffer p_199566_0_) {
+ p_199566_0_.markReaderIndex();
int i = p_199566_0_.func_150792_a();
+ if (i == -1) {
+ p_199566_0_.resetReaderIndex();
+ return net.minecraftforge.common.crafting.CraftingHelper.getIngredient(p_199566_0_.func_192575_l(), p_199566_0_);
+ }
return func_209357_a(Stream.generate(() -> {
return new Ingredient.SingleItemList(p_199566_0_.func_150791_c());
}).limit((long)i));
@@ -153,6 +186,8 @@
@@ -153,6 +184,8 @@
public static Ingredient func_199802_a(@Nullable JsonElement p_199802_0_) {
if (p_199802_0_ != null && !p_199802_0_.isJsonNull()) {
@@ -102,7 +99,7 @@
if (p_199802_0_.isJsonObject()) {
return func_209357_a(Stream.of(func_199803_a(p_199802_0_.getAsJsonObject())));
} else if (p_199802_0_.isJsonArray()) {
@@ -173,6 +208,11 @@
@@ -173,6 +206,11 @@
}
public static Ingredient.IItemList func_199803_a(JsonObject p_199803_0_) {
@@ -114,7 +111,7 @@
if (p_199803_0_.has("item") && p_199803_0_.has("tag")) {
throw new JsonParseException("An ingredient entry is either a tag or an item, not both");
} else if (p_199803_0_.has("item")) {
@@ -196,6 +236,12 @@
@@ -196,6 +234,12 @@
}
}
@@ -1,14 +1,40 @@
--- a/net/minecraft/network/NetworkManager.java
+++ b/net/minecraft/network/NetworkManager.java
@@ -264,6 +264,7 @@
@@ -75,6 +75,7 @@
private float field_211397_t;
private int field_211398_u;
private boolean field_211399_v;
+ private java.util.function.Consumer<NetworkManager> activationHandler;
public NetworkManager(EnumPacketDirection p_i46004_1_) {
this.field_179294_g = p_i46004_1_;
@@ -84,6 +85,7 @@
super.channelActive(p_channelActive_1_);
this.field_150746_k = p_channelActive_1_.channel();
this.field_150743_l = this.field_150746_k.remoteAddress();
+ if (activationHandler != null) activationHandler.accept(this);
try {
this.func_150723_a(EnumConnectionState.HANDSHAKING);
@@ -264,7 +266,9 @@
@OnlyIn(Dist.CLIENT)
public static NetworkManager func_181124_a(InetAddress p_181124_0_, int p_181124_1_, boolean p_181124_2_) {
+ if (p_181124_0_ instanceof java.net.Inet6Address) System.setProperty("java.net.preferIPv4Stack", "false");
final NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.CLIENTBOUND);
+ networkmanager.activationHandler = net.minecraftforge.fml.network.NetworkHooks::registerClientLoginChannel;
Class<? extends SocketChannel> oclass;
LazyLoadBase<? extends EventLoopGroup> lazyloadbase;
@@ -383,6 +384,14 @@
if (Epoll.isAvailable() && p_181124_2_) {
@@ -292,6 +296,7 @@
@OnlyIn(Dist.CLIENT)
public static NetworkManager func_150722_a(SocketAddress p_150722_0_) {
final NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.CLIENTBOUND);
+ networkmanager.activationHandler = net.minecraftforge.fml.network.NetworkHooks::registerClientLoginChannel;
(new Bootstrap()).group(field_179296_e.func_179281_c()).handler(new ChannelInitializer<Channel>() {
protected void initChannel(Channel p_initChannel_1_) throws Exception {
p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager);
@@ -383,6 +388,14 @@
return this.field_211397_t;
}
@@ -1,6 +1,23 @@
--- a/net/minecraft/network/ServerStatusResponse.java
+++ b/net/minecraft/network/ServerStatusResponse.java
@@ -26,6 +26,7 @@
@@ -19,13 +19,24 @@
private ServerStatusResponse.Players field_151324_b;
private ServerStatusResponse.Version field_151325_c;
private String field_151323_d;
+ private transient net.minecraftforge.fml.network.FMLStatusPing forgeData;
+ public net.minecraftforge.fml.network.FMLStatusPing getForgeData() {
+ return this.forgeData;
+ }
+
+ public void setForgeData(net.minecraftforge.fml.network.FMLStatusPing data){
+ this.forgeData = data;
+ invalidateJson();
+ }
+
public ITextComponent func_151317_a() {
return this.field_151326_a;
}
public void func_151315_a(ITextComponent p_151315_1_) {
this.field_151326_a = p_151315_1_;
@@ -8,7 +25,7 @@
}
public ServerStatusResponse.Players func_151318_b() {
@@ -34,6 +35,7 @@
@@ -34,6 +45,7 @@
public void func_151319_a(ServerStatusResponse.Players p_151319_1_) {
this.field_151324_b = p_151319_1_;
@@ -16,7 +33,7 @@
}
public ServerStatusResponse.Version func_151322_c() {
@@ -42,16 +44,51 @@
@@ -42,16 +54,51 @@
public void func_151321_a(ServerStatusResponse.Version p_151321_1_) {
this.field_151325_c = p_151321_1_;
@@ -68,3 +85,25 @@
public static class Players {
private final int field_151336_a;
private final int field_151334_b;
@@ -143,6 +190,10 @@
serverstatusresponse.func_151320_a(JsonUtils.func_151200_h(jsonobject, "favicon"));
}
+ if (jsonobject.has("forgeData")) {
+ serverstatusresponse.setForgeData(net.minecraftforge.fml.network.FMLStatusPing.Serializer.deserialize(JsonUtils.func_152754_s(jsonobject, "forgeData"), p_deserialize_3_));
+ }
+
return serverstatusresponse;
}
@@ -164,6 +215,10 @@
jsonobject.addProperty("favicon", p_serialize_1_.func_151316_d());
}
+ if(p_serialize_1_.getForgeData() != null){
+ jsonobject.add("forgeData", net.minecraftforge.fml.network.FMLStatusPing.Serializer.serialize(p_serialize_1_.getForgeData(), p_serialize_3_));
+ }
+
return jsonobject;
}
}
@@ -4,7 +4,7 @@
private String field_149598_b;
private int field_149599_c;
private EnumConnectionState field_149597_d;
+ private String fmlVersion = net.minecraftforge.fml.network.NetworkHooks.NETVERSION;
+ private String fmlVersion = net.minecraftforge.fml.network.FMLNetworkConstants.NETVERSION;
public CPacketHandshake() {
}
@@ -19,7 +19,7 @@
public void func_148840_b(PacketBuffer p_148840_1_) throws IOException {
p_148840_1_.func_150787_b(this.field_149600_a);
- p_148840_1_.func_180714_a(this.field_149598_b);
+ p_148840_1_.func_180714_a(this.field_149598_b + "\0"+net.minecraftforge.fml.network.NetworkHooks.NETVERSION+"\0");
+ p_148840_1_.func_180714_a(this.field_149598_b + "\0"+net.minecraftforge.fml.network.FMLNetworkConstants.NETVERSION+"\0");
p_148840_1_.writeShort(this.field_149599_c);
p_148840_1_.func_150787_b(this.field_149597_d.func_150759_c());
}
@@ -0,0 +1,11 @@
--- a/net/minecraft/resources/IResourcePack.java
+++ b/net/minecraft/resources/IResourcePack.java
@@ -12,7 +12,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public interface IResourcePack extends Closeable {
+public interface IResourcePack extends Closeable, net.minecraftforge.client.extensions.IForgeResourcePack {
@OnlyIn(Dist.CLIENT)
InputStream func_195763_b(String p_195763_1_) throws IOException;
@@ -0,0 +1,52 @@
--- a/net/minecraft/resources/ResourcePackInfo.java
+++ b/net/minecraft/resources/ResourcePackInfo.java
@@ -29,6 +29,7 @@
private final ResourcePackInfo.Priority field_195805_g;
private final boolean field_195806_h;
private final boolean field_195807_i;
+ private final boolean hidden; // Forge: Allow packs to be hidden from the UI entirely
@Nullable
public static <T extends ResourcePackInfo> T func_195793_a(String p_195793_0_, boolean p_195793_1_, Supplier<IResourcePack> p_195793_2_, ResourcePackInfo.IFactory<T> p_195793_3_, ResourcePackInfo.Priority p_195793_4_) {
@@ -52,7 +53,12 @@
return (T)null;
}
+ @Deprecated
public ResourcePackInfo(String p_i47907_1_, boolean p_i47907_2_, Supplier<IResourcePack> p_i47907_3_, ITextComponent p_i47907_4_, ITextComponent p_i47907_5_, PackCompatibility p_i47907_6_, ResourcePackInfo.Priority p_i47907_7_, boolean p_i47907_8_) {
+ this(p_i47907_1_, p_i47907_2_, p_i47907_3_, p_i47907_4_, p_i47907_5_, p_i47907_6_, p_i47907_7_, p_i47907_8_, false);
+ }
+
+ public ResourcePackInfo(String p_i47907_1_, boolean p_i47907_2_, Supplier<IResourcePack> p_i47907_3_, ITextComponent p_i47907_4_, ITextComponent p_i47907_5_, PackCompatibility p_i47907_6_, ResourcePackInfo.Priority p_i47907_7_, boolean p_i47907_8_, boolean hidden) {
this.field_195800_b = p_i47907_1_;
this.field_195801_c = p_i47907_3_;
this.field_195802_d = p_i47907_4_;
@@ -61,12 +67,18 @@
this.field_195806_h = p_i47907_2_;
this.field_195805_g = p_i47907_7_;
this.field_195807_i = p_i47907_8_;
+ this.hidden = hidden;
}
+ @Deprecated
public ResourcePackInfo(String p_i47908_1_, boolean p_i47908_2_, Supplier<IResourcePack> p_i47908_3_, IResourcePack p_i47908_4_, PackMetadataSection p_i47908_5_, ResourcePackInfo.Priority p_i47908_6_) {
- this(p_i47908_1_, p_i47908_2_, p_i47908_3_, new TextComponentString(p_i47908_4_.func_195762_a()), p_i47908_5_.func_198963_a(), PackCompatibility.func_198969_a(p_i47908_5_.func_198962_b()), p_i47908_6_, false);
+ this(p_i47908_1_, p_i47908_2_, p_i47908_3_, p_i47908_4_, p_i47908_5_, p_i47908_6_, false);
}
+ public ResourcePackInfo(String p_i47908_1_, boolean p_i47908_2_, Supplier<IResourcePack> p_i47908_3_, IResourcePack p_i47908_4_, PackMetadataSection p_i47908_5_, ResourcePackInfo.Priority p_i47908_6_, boolean hidden) {
+ this(p_i47908_1_, p_i47908_2_, p_i47908_3_, new TextComponentString(p_i47908_4_.func_195762_a()), p_i47908_5_.func_198963_a(), PackCompatibility.func_198969_a(p_i47908_5_.func_198962_b()), p_i47908_6_, hidden, hidden);
+ }
+
@OnlyIn(Dist.CLIENT)
public ITextComponent func_195789_b() {
return this.field_195802_d;
@@ -106,6 +118,8 @@
public ResourcePackInfo.Priority func_195792_i() {
return this.field_195805_g;
}
+
+ public boolean isHidden() { return hidden; }
public boolean equals(Object p_equals_1_) {
if (this == p_equals_1_) {
@@ -138,7 +138,7 @@
+ if (itemstack2.func_190926_b() && !copy.func_190926_b()) {
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_73090_b, copy, EnumHand.MAIN_HAND);
+ }
+ flag1 = this.func_180235_c(p_180237_1_);
+ flag1 = this.removeBlock(p_180237_1_, flag);
if (flag1 && flag) {
ItemStack itemstack1 = itemstack2.func_190926_b() ? ItemStack.field_190927_a : itemstack2.func_77946_l();
iblockstate.func_177230_c().func_180657_a(this.field_73092_a, this.field_73090_b, p_180237_1_, iblockstate, tileentity, itemstack1);
@@ -111,7 +111,7 @@
this.field_177454_f.put(entityplayermp.func_110124_au(), entityplayermp);
entityplayermp.func_71116_b();
entityplayermp.func_70606_j(entityplayermp.func_110143_aJ());
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerRespawnEvent( p_72368_1_, p_72368_3_ );
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerRespawnEvent(entityplayermp, p_72368_3_);
return entityplayermp;
}
@@ -130,9 +130,11 @@
- p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, p_187242_1_.field_70170_p.func_175659_aa(), p_187242_1_.field_70170_p.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b()));
+ p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, worldserver1.func_175659_aa(), worldserver1.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b()));
this.func_187243_f(p_187242_1_);
worldserver.func_72973_f(p_187242_1_);
p_187242_1_.field_70128_L = false;
- worldserver.func_72973_f(p_187242_1_);
- p_187242_1_.field_70128_L = false;
- this.func_82448_a(p_187242_1_, dimensiontype, worldserver, worldserver1);
+ worldserver.removeEntityDangerously(p_187242_1_, true); //Forge: the player entity is moved to the new world, NOT cloned. So keep the data alive with no matching invalidate call.
+ p_187242_1_.revive();
+ this.transferEntityToWorld(p_187242_1_, dimensiontype, worldserver, worldserver1, teleporter);
this.func_72375_a(p_187242_1_, worldserver);
p_187242_1_.field_71135_a.func_147364_a(p_187242_1_.field_70165_t, p_187242_1_.field_70163_u, p_187242_1_.field_70161_v, p_187242_1_.field_70177_z, p_187242_1_.field_70125_A);
@@ -0,0 +1,24 @@
--- a/net/minecraft/tileentity/BannerPattern.java
+++ b/net/minecraft/tileentity/BannerPattern.java
@@ -7,7 +7,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public enum BannerPattern {
+public enum BannerPattern implements net.minecraftforge.common.IExtensibleEnum {
BASE("base", "b"),
SQUARE_BOTTOM_LEFT("square_bottom_left", "bl", " ", " ", "# "),
SQUARE_BOTTOM_RIGHT("square_bottom_right", "br", " ", " ", " #"),
@@ -106,4 +106,12 @@
return null;
}
+
+ public static BannerPattern create(String enumName, String p_i47246_3_, String p_i47246_4_, ItemStack p_i47246_5_) {
+ throw new IllegalStateException("Enum not extended");
+ }
+
+ public static BannerPattern create(String enumName, String p_i47247_3_, String p_i47247_4_, String p_i47247_5_, String p_i47247_6_, String p_i47247_7_) {
+ throw new IllegalStateException("Enum not extended");
+ }
}
@@ -32,7 +32,7 @@
for(int j1 = k - k1; j1 <= k + k1; ++j1) {
- Block block1 = this.field_145850_b.func_180495_p(new BlockPos(i2, l1, j1)).func_177230_c();
- if (block1 != Blocks.field_150475_bE && block1 != Blocks.field_150340_R && block1 != Blocks.field_150484_ah && block1 != Blocks.field_150339_S) {
+ if (this.field_145850_b.func_180495_p(new BlockPos(i2, l1, j1)).isBeaconBase(this.field_145850_b, new BlockPos(i2, l1, j1), this.func_174877_v())) {
+ if (!this.field_145850_b.func_180495_p(new BlockPos(i2, l1, j1)).isBeaconBase(this.field_145850_b, new BlockPos(i2, l1, j1), this.func_174877_v())) {
flag1 = false;
break;
}
@@ -27,10 +27,11 @@
+ @Deprecated IRegistry<TileEntityType<?>> field_212626_o = func_212610_a("block_entity_type", (IRegistry<TileEntityType<?>>)net.minecraftforge.registries.GameData.getWrapper(TileEntityType.class));
IRegistry<ChunkGeneratorType<?, ?>> field_212627_p = func_212610_a("chunk_generator_type", new RegistryNamespaced<>());
- IRegistry<Enchantment> field_212628_q = func_212610_a("enchantment", new RegistryNamespaced<>());
+ @Deprecated IRegistry<Enchantment> field_212628_q = func_212610_a("enchantment", net.minecraftforge.registries.GameData.getWrapper(Enchantment.class));
IRegistry<EntityType<?>> field_212629_r = func_212610_a("entity_type", new RegistryNamespaced<>());
- IRegistry<EntityType<?>> field_212629_r = func_212610_a("entity_type", new RegistryNamespaced<>());
- IRegistry<Item> field_212630_s = func_212610_a("item", new RegistryNamespaced<>());
- IRegistry<Potion> field_212631_t = func_212610_a("mob_effect", new RegistryNamespaced<>());
+ @Deprecated IRegistry<Enchantment> field_212628_q = func_212610_a("enchantment", net.minecraftforge.registries.GameData.getWrapper(Enchantment.class));
+ @Deprecated IRegistry<EntityType<?>> field_212629_r = func_212610_a("entity_type", (IRegistry<EntityType<?>>) net.minecraftforge.registries.GameData.getWrapper(EntityType.class));
+ @Deprecated IRegistry<Item> field_212630_s = func_212610_a("item", net.minecraftforge.registries.GameData.getWrapper(Item.class));
+ @Deprecated IRegistry<Potion> field_212631_t = func_212610_a("mob_effect", net.minecraftforge.registries.GameData.getWrapper(Potion.class));
IRegistry<ParticleType<? extends IParticleData>> field_212632_u = func_212610_a("particle_type", new RegistryNamespaced<>());
@@ -194,7 +194,7 @@
}
public void func_72847_b(Entity p_72847_1_) {
@@ -777,6 +828,7 @@
@@ -777,9 +828,14 @@
this.field_73021_x.get(i).func_72709_b(p_72847_1_);
}
@@ -202,7 +202,37 @@
}
public void func_72900_e(Entity p_72900_1_) {
@@ -819,24 +871,31 @@
+ this.removeEntity(p_72900_1_, false);
+ }
+
+ public void removeEntity(Entity p_72900_1_, boolean keepData) {
if (p_72900_1_.func_184207_aI()) {
p_72900_1_.func_184226_ay();
}
@@ -788,7 +844,7 @@
p_72900_1_.func_184210_p();
}
- p_72900_1_.func_70106_y();
+ p_72900_1_.remove(keepData);
if (p_72900_1_ instanceof EntityPlayer) {
this.field_73010_i.remove(p_72900_1_);
this.func_72854_c();
@@ -798,8 +854,12 @@
}
public void func_72973_f(Entity p_72973_1_) {
+ this.removeEntityDangerously(p_72973_1_, false);
+ }
+
+ public void removeEntityDangerously(Entity p_72973_1_, boolean keepData) {
p_72973_1_.func_184174_b(false);
- p_72973_1_.func_70106_y();
+ p_72973_1_.remove(keepData);
if (p_72973_1_ instanceof EntityPlayer) {
this.field_73010_i.remove(p_72973_1_);
this.func_72854_c();
@@ -819,24 +879,31 @@
this.field_73021_x.add(p_72954_1_);
}
@@ -237,7 +267,7 @@
float f = this.func_72826_c(p_72971_1_);
float f1 = 1.0F - (MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.2F);
f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F);
@@ -848,6 +907,11 @@
@@ -848,6 +915,11 @@
@OnlyIn(Dist.CLIENT)
public Vec3d func_72833_a(Entity p_72833_1_, float p_72833_2_) {
@@ -249,7 +279,7 @@
float f = this.func_72826_c(p_72833_2_);
float f1 = MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F;
f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F);
@@ -855,9 +919,7 @@
@@ -855,9 +927,7 @@
int j = MathHelper.func_76128_c(p_72833_1_.field_70163_u);
int k = MathHelper.func_76128_c(p_72833_1_.field_70161_v);
BlockPos blockpos = new BlockPos(i, j, k);
@@ -260,7 +290,7 @@
float f3 = (float)(l >> 16 & 255) / 255.0F;
float f4 = (float)(l >> 8 & 255) / 255.0F;
float f5 = (float)(l & 255) / 255.0F;
@@ -904,6 +966,10 @@
@@ -904,6 +974,10 @@
@OnlyIn(Dist.CLIENT)
public Vec3d func_72824_f(float p_72824_1_) {
@@ -271,7 +301,7 @@
float f = this.func_72826_c(p_72824_1_);
float f1 = MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F;
f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F);
@@ -942,10 +1008,7 @@
@@ -942,10 +1016,7 @@
@OnlyIn(Dist.CLIENT)
public float func_72880_h(float p_72880_1_) {
@@ -283,7 +313,7 @@
}
public void func_72939_s() {
@@ -957,6 +1020,7 @@
@@ -957,6 +1028,7 @@
try {
++entity.field_70173_aa;
@@ -291,7 +321,7 @@
entity.func_70071_h_();
} catch (Throwable throwable2) {
CrashReport crashreport = CrashReport.func_85055_a(throwable2, "Ticking entity");
@@ -967,6 +1031,10 @@
@@ -967,6 +1039,10 @@
entity.func_85029_a(crashreportcategory);
}
@@ -302,7 +332,7 @@
throw new ReportedException(crashreport);
}
@@ -1009,11 +1077,17 @@
@@ -1009,11 +1085,17 @@
this.field_72984_F.func_76320_a("tick");
if (!entity2.field_70128_L && !(entity2 instanceof EntityPlayerMP)) {
try {
@@ -320,7 +350,7 @@
throw new ReportedException(crashreport1);
}
}
@@ -1035,30 +1109,41 @@
@@ -1035,30 +1117,41 @@
}
this.field_72984_F.func_76318_c("blockEntities");
@@ -366,7 +396,7 @@
throw new ReportedException(crashreport2);
}
}
@@ -1068,7 +1153,10 @@
@@ -1068,7 +1161,10 @@
iterator.remove();
this.field_147482_g.remove(tileentity);
if (this.func_175667_e(tileentity.func_174877_v())) {
@@ -378,7 +408,7 @@
}
}
}
@@ -1103,10 +1191,15 @@
@@ -1103,10 +1199,15 @@
}
public boolean func_175700_a(TileEntity p_175700_1_) {
@@ -394,7 +424,7 @@
if (this.field_72995_K) {
BlockPos blockpos = p_175700_1_.func_174877_v();
@@ -1119,6 +1212,11 @@
@@ -1119,6 +1220,11 @@
public void func_147448_a(Collection<TileEntity> p_147448_1_) {
if (this.field_147481_N) {
@@ -406,7 +436,7 @@
this.field_147484_a.addAll(p_147448_1_);
} else {
for(TileEntity tileentity : p_147448_1_) {
@@ -1137,9 +1235,10 @@
@@ -1137,9 +1243,10 @@
int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t);
int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v);
int k = 32;
@@ -420,7 +450,7 @@
}
p_72866_1_.field_70142_S = p_72866_1_.field_70165_t;
@@ -1153,7 +1252,7 @@
@@ -1153,7 +1260,7 @@
p_72866_1_.func_70098_U();
} else {
this.field_72984_F.func_194340_a(() -> {
@@ -429,7 +459,7 @@
});
p_72866_1_.func_70071_h_();
this.field_72984_F.func_76319_b();
@@ -1200,6 +1299,7 @@
@@ -1200,6 +1307,7 @@
if (p_72866_2_ && p_72866_1_.field_70175_ag) {
for(Entity entity : p_72866_1_.func_184188_bt()) {
if (!entity.field_70128_L && entity.func_184187_bx() == p_72866_1_) {
@@ -437,7 +467,7 @@
this.func_72870_g(entity);
} else {
entity.func_184210_p();
@@ -1239,7 +1339,7 @@
@@ -1239,7 +1347,7 @@
for(int l1 = k; l1 < l; ++l1) {
for(int i2 = i1; i2 < j1; ++i2) {
IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(k1, l1, i2));
@@ -446,7 +476,7 @@
boolean flag = true;
return flag;
}
@@ -1263,10 +1363,13 @@
@@ -1263,10 +1371,13 @@
for(int k1 = i; k1 < j; ++k1) {
for(int l1 = k; l1 < l; ++l1) {
for(int i2 = i1; i2 < j1; ++i2) {
@@ -461,7 +491,7 @@
}
}
}
@@ -1346,6 +1449,7 @@
@@ -1346,6 +1457,7 @@
if (p_211529_2_ != null) {
explosion.func_199592_a(p_211529_2_);
}
@@ -469,7 +499,7 @@
explosion.func_77278_a();
explosion.func_77279_a(true);
@@ -1439,10 +1543,13 @@
@@ -1439,10 +1551,13 @@
}
public void func_175690_a(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_) {
@@ -483,7 +513,7 @@
Iterator<TileEntity> iterator = this.field_147484_a.iterator();
while(iterator.hasNext()) {
@@ -1455,7 +1562,8 @@
@@ -1455,7 +1570,8 @@
this.field_147484_a.add(p_175690_2_);
} else {
@@ -493,7 +523,7 @@
this.func_175700_a(p_175690_2_);
}
}
@@ -1468,6 +1576,8 @@
@@ -1468,6 +1584,8 @@
if (tileentity != null && this.field_147481_N) {
tileentity.func_145843_s();
this.field_147484_a.remove(tileentity);
@@ -502,7 +532,7 @@
} else {
if (tileentity != null) {
this.field_147484_a.remove(tileentity);
@@ -1477,6 +1587,7 @@
@@ -1477,6 +1595,7 @@
this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_);
}
@@ -510,7 +540,7 @@
}
@@ -1498,7 +1609,7 @@
@@ -1498,7 +1617,7 @@
}
public boolean func_195595_w(BlockPos p_195595_1_) {
@@ -519,7 +549,7 @@
}
public void func_72966_v() {
@@ -1512,6 +1623,7 @@
@@ -1512,6 +1631,7 @@
public void func_72891_a(boolean p_72891_1_, boolean p_72891_2_) {
this.field_72985_G = p_72891_1_;
this.field_72992_H = p_72891_2_;
@@ -527,7 +557,7 @@
}
public void func_72835_b(BooleanSupplier p_72835_1_) {
@@ -1520,6 +1632,10 @@
@@ -1520,6 +1640,10 @@
}
protected void func_72947_a() {
@@ -538,7 +568,7 @@
if (this.field_72986_A.func_76059_o()) {
this.field_73004_o = 1.0F;
if (this.field_72986_A.func_76061_m()) {
@@ -1534,6 +1650,10 @@
@@ -1534,6 +1658,10 @@
}
protected void func_72979_l() {
@@ -549,7 +579,7 @@
if (this.field_73011_w.func_191066_m()) {
if (!this.field_72995_K) {
boolean flag = this.func_82736_K().func_82766_b("doWeatherCycle");
@@ -1620,9 +1740,9 @@
@@ -1620,9 +1748,9 @@
return 15;
} else {
IBlockState iblockstate = this.func_180495_p(p_175638_1_);
@@ -561,7 +591,7 @@
j = 1;
}
@@ -1631,7 +1751,7 @@
@@ -1631,7 +1759,7 @@
}
if (j >= 15) {
@@ -570,7 +600,7 @@
} else if (i >= 14) {
return i;
} else {
@@ -1656,11 +1776,12 @@
@@ -1656,11 +1784,12 @@
}
public boolean func_180500_c(EnumLightType p_180500_1_, BlockPos p_180500_2_) {
@@ -584,7 +614,7 @@
this.field_72984_F.func_76320_a("getBrightness");
int k = this.func_175642_b(p_180500_1_, p_180500_2_);
int l = this.func_175638_a(p_180500_2_, p_180500_1_);
@@ -1686,7 +1807,7 @@
@@ -1686,7 +1815,7 @@
int j3 = MathHelper.func_76130_a(i2 - i1);
int k3 = MathHelper.func_76130_a(j2 - j1);
int l3 = MathHelper.func_76130_a(k2 - k1);
@@ -593,7 +623,7 @@
try (BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.func_185346_s()) {
for(EnumFacing enumfacing : field_200007_a) {
int i4 = i2 + enumfacing.func_82601_c();
@@ -1726,7 +1847,7 @@
@@ -1726,7 +1855,7 @@
int l6 = Math.abs(k5 - j1);
int i7 = Math.abs(l5 - k1);
boolean flag = j < this.field_72994_J.length - 6;
@@ -602,7 +632,7 @@
if (this.func_175642_b(p_180500_1_, blockpos1.func_177976_e()) < j6) {
this.field_72994_J[j++] = j5 - 1 - i1 + 32 + (k5 - j1 + 32 << 6) + (l5 - k1 + 32 << 12);
}
@@ -1767,10 +1888,10 @@
@@ -1767,10 +1896,10 @@
public List<Entity> func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate<? super Entity> p_175674_3_) {
List<Entity> list = Lists.newArrayList();
@@ -610,14 +640,14 @@
- int j = MathHelper.func_76128_c((p_175674_2_.field_72336_d + 2.0D) / 16.0D);
- int k = MathHelper.func_76128_c((p_175674_2_.field_72339_c - 2.0D) / 16.0D);
- int l = MathHelper.func_76128_c((p_175674_2_.field_72334_f + 2.0D) / 16.0D);
+ int i = MathHelper.func_76128_c((p_175674_2_.field_72340_a - MAX_ENTITY_RADIUS) / 16.0D);
+ int j = MathHelper.func_76128_c((p_175674_2_.field_72336_d + MAX_ENTITY_RADIUS) / 16.0D);
+ int k = MathHelper.func_76128_c((p_175674_2_.field_72339_c - MAX_ENTITY_RADIUS) / 16.0D);
+ int l = MathHelper.func_76128_c((p_175674_2_.field_72334_f + MAX_ENTITY_RADIUS) / 16.0D);
+ int i = MathHelper.func_76128_c((p_175674_2_.field_72340_a - getMaxEntityRadius()) / 16.0D);
+ int j = MathHelper.func_76128_c((p_175674_2_.field_72336_d + getMaxEntityRadius()) / 16.0D);
+ int k = MathHelper.func_76128_c((p_175674_2_.field_72339_c - getMaxEntityRadius()) / 16.0D);
+ int l = MathHelper.func_76128_c((p_175674_2_.field_72334_f + getMaxEntityRadius()) / 16.0D);
for(int i1 = i; i1 <= j; ++i1) {
for(int j1 = k; j1 <= l; ++j1) {
@@ -1812,10 +1933,10 @@
@@ -1812,10 +1941,10 @@
}
public <T extends Entity> List<T> func_175647_a(Class<? extends T> p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate<? super T> p_175647_3_) {
@@ -625,14 +655,14 @@
- int j = MathHelper.func_76143_f((p_175647_2_.field_72336_d + 2.0D) / 16.0D);
- int k = MathHelper.func_76128_c((p_175647_2_.field_72339_c - 2.0D) / 16.0D);
- int l = MathHelper.func_76143_f((p_175647_2_.field_72334_f + 2.0D) / 16.0D);
+ int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - MAX_ENTITY_RADIUS) / 16.0D);
+ int j = MathHelper.func_76143_f((p_175647_2_.field_72336_d + MAX_ENTITY_RADIUS) / 16.0D);
+ int k = MathHelper.func_76128_c((p_175647_2_.field_72339_c - MAX_ENTITY_RADIUS) / 16.0D);
+ int l = MathHelper.func_76143_f((p_175647_2_.field_72334_f + MAX_ENTITY_RADIUS) / 16.0D);
+ int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - getMaxEntityRadius()) / 16.0D);
+ int j = MathHelper.func_76143_f((p_175647_2_.field_72336_d + getMaxEntityRadius()) / 16.0D);
+ int k = MathHelper.func_76128_c((p_175647_2_.field_72339_c - getMaxEntityRadius()) / 16.0D);
+ int l = MathHelper.func_76143_f((p_175647_2_.field_72334_f + getMaxEntityRadius()) / 16.0D);
List<T> list = Lists.newArrayList();
for(int i1 = i; i1 < j; ++i1) {
@@ -1891,7 +2012,7 @@
@@ -1891,7 +2020,7 @@
}
public void func_212420_a(Stream<Entity> p_212420_1_) {
@@ -641,7 +671,7 @@
this.field_72996_f.add(p_212418_1_);
this.func_72923_a(p_212418_1_);
});
@@ -1958,7 +2079,7 @@
@@ -1958,7 +2087,7 @@
public int func_175651_c(BlockPos p_175651_1_, EnumFacing p_175651_2_) {
IBlockState iblockstate = this.func_180495_p(p_175651_1_);
@@ -650,7 +680,7 @@
}
public boolean func_175640_z(BlockPos p_175640_1_) {
@@ -2096,6 +2217,8 @@
@@ -2096,6 +2225,8 @@
d2 *= MoreObjects.firstNonNull(p_184150_11_.apply(entityplayer1), 1.0D);
}
@@ -659,7 +689,7 @@
if ((p_184150_9_ < 0.0D || Math.abs(entityplayer1.field_70163_u - p_184150_3_) < p_184150_9_ * p_184150_9_) && (p_184150_7_ < 0.0D || d1 < d2 * d2) && (d0 == -1.0D || d1 < d0)) {
d0 = d1;
entityplayer = entityplayer1;
@@ -2144,7 +2267,7 @@
@@ -2144,7 +2275,7 @@
}
public long func_72905_C() {
@@ -668,7 +698,7 @@
}
public long func_82737_E() {
@@ -2152,15 +2275,15 @@
@@ -2152,15 +2283,15 @@
}
public long func_72820_D() {
@@ -687,7 +717,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()));
}
@@ -2169,7 +2292,7 @@
@@ -2169,7 +2300,7 @@
}
public void func_175652_B(BlockPos p_175652_1_) {
@@ -696,7 +726,7 @@
}
@OnlyIn(Dist.CLIENT)
@@ -2185,12 +2308,17 @@
@@ -2185,12 +2316,17 @@
}
if (!this.field_72996_f.contains(p_72897_1_)) {
@@ -714,7 +744,7 @@
return true;
}
@@ -2265,8 +2393,7 @@
@@ -2265,8 +2401,7 @@
}
public boolean func_180502_D(BlockPos p_180502_1_) {
@@ -724,7 +754,7 @@
}
@Nullable
@@ -2303,16 +2430,15 @@
@@ -2303,16 +2438,15 @@
}
public int func_72800_K() {
@@ -744,7 +774,7 @@
}
public CrashReportCategory func_72914_a(CrashReport p_72914_1_) {
@@ -2349,16 +2475,16 @@
@@ -2349,16 +2483,16 @@
public abstract Scoreboard func_96441_U();
public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) {
@@ -766,7 +796,7 @@
iblockstate.func_189546_a(this, blockpos, p_175666_2_, p_175666_1_);
}
}
@@ -2464,4 +2590,28 @@
@@ -2464,4 +2598,40 @@
public abstract RecipeManager func_199532_z();
public abstract NetworkTagManager func_205772_D();
@@ -793,5 +823,17 @@
+ }
+ }
+ return ret;
+ }
+
+ private double maxEntityRadius = 2.0D;
+ @Override
+ public double getMaxEntityRadius() {
+ return maxEntityRadius;
+ }
+ @Override
+ public double increaseMaxEntityRadius(double value) {
+ if (value > maxEntityRadius)
+ maxEntityRadius = value;
+ return maxEntityRadius;
+ }
}
@@ -56,7 +56,7 @@
default:
IBlockState iblockstate1 = p_209382_1_.func_180495_p(p_209382_2_.func_177977_b());
- if (iblockstate1.func_185896_q() || p_209382_3_ != null && EntitySpawnPlacementRegistry.func_209345_a(p_209382_3_, iblockstate1)) {
+ if (iblockstate.canCreatureSpawn(p_209382_1_, p_209382_2_, p_209382_0_, p_209382_3_)) {
+ if (iblockstate1.canCreatureSpawn(p_209382_1_, p_209382_2_.func_177977_b(), p_209382_0_, p_209382_3_)) {
Block block = iblockstate1.func_177230_c();
boolean flag = block != Blocks.field_150357_h && block != Blocks.field_180401_cv;
return flag && func_206851_a(iblockstate, ifluidstate) && func_206851_a(p_209382_1_.func_180495_p(p_209382_2_.func_177984_a()), p_209382_1_.func_204610_c(p_209382_2_.func_177984_a()));
@@ -12,7 +12,7 @@
@@ -322,11 +322,11 @@
}
public void func_201866_a(EnumCreatureType p_201866_1_, Biome.SpawnListEntry p_201866_2_) {
protected void func_201866_a(EnumCreatureType p_201866_1_, Biome.SpawnListEntry p_201866_2_) {
- this.field_201880_ax.get(p_201866_1_).add(p_201866_2_);
+ this.field_201880_ax.computeIfAbsent(p_201866_1_, k -> Lists.newArrayList()).add(p_201866_2_);
}
@@ -165,8 +165,8 @@
public void func_177414_a(@Nullable Entity p_177414_1_, AxisAlignedBB p_177414_2_, List<Entity> p_177414_3_, Predicate<? super Entity> p_177414_4_) {
- int i = MathHelper.func_76128_c((p_177414_2_.field_72338_b - 2.0D) / 16.0D);
- int j = MathHelper.func_76128_c((p_177414_2_.field_72337_e + 2.0D) / 16.0D);
+ int i = MathHelper.func_76128_c((p_177414_2_.field_72338_b - net.minecraftforge.common.extensions.IForgeWorld.MAX_ENTITY_RADIUS) / 16.0D);
+ int j = MathHelper.func_76128_c((p_177414_2_.field_72337_e + net.minecraftforge.common.extensions.IForgeWorld.MAX_ENTITY_RADIUS) / 16.0D);
+ int i = MathHelper.func_76128_c((p_177414_2_.field_72338_b - this.field_76637_e.getMaxEntityRadius()) / 16.0D);
+ int j = MathHelper.func_76128_c((p_177414_2_.field_72337_e + this.field_76637_e.getMaxEntityRadius()) / 16.0D);
i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1);
j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1);
@@ -176,8 +176,8 @@
public <T extends Entity> void func_177430_a(Class<? extends T> p_177430_1_, AxisAlignedBB p_177430_2_, List<T> p_177430_3_, @Nullable Predicate<? super T> p_177430_4_) {
- int i = MathHelper.func_76128_c((p_177430_2_.field_72338_b - 2.0D) / 16.0D);
- int j = MathHelper.func_76128_c((p_177430_2_.field_72337_e + 2.0D) / 16.0D);
+ int i = MathHelper.func_76128_c((p_177430_2_.field_72338_b - net.minecraftforge.common.extensions.IForgeWorld.MAX_ENTITY_RADIUS) / 16.0D);
+ int j = MathHelper.func_76128_c((p_177430_2_.field_72337_e + net.minecraftforge.common.extensions.IForgeWorld.MAX_ENTITY_RADIUS) / 16.0D);
+ int i = MathHelper.func_76128_c((p_177430_2_.field_72338_b - this.field_76637_e.getMaxEntityRadius()) / 16.0D);
+ int j = MathHelper.func_76128_c((p_177430_2_.field_72337_e + this.field_76637_e.getMaxEntityRadius()) / 16.0D);
i = MathHelper.func_76125_a(i, 0, this.field_76645_j.length - 1);
j = MathHelper.func_76125_a(j, 0, this.field_76645_j.length - 1);
@@ -1,16 +1,15 @@
--- a/net/minecraft/world/chunk/storage/AnvilChunkLoader.java
+++ b/net/minecraft/world/chunk/storage/AnvilChunkLoader.java
@@ -225,6 +225,9 @@
@@ -225,6 +225,8 @@
this.func_202156_a((ChunkPrimer)p_75816_2_, p_75816_1_, nbttagcompound1);
}
+ net.minecraftforge.common.ForgeChunkManager.storeChunkNBT(p_75816_1_, p_75816_2_, nbttagcompound1);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(p_75816_2_, nbttagcompound));
+
this.func_75824_a(chunkpos, nbttagcompound);
} catch (Exception exception) {
field_151505_a.error("Failed to save chunk", (Throwable)exception);
@@ -388,10 +391,14 @@
@@ -388,10 +390,14 @@
for(int j = 0; j < p_75820_1_.func_177429_s().length; ++j) {
for(Entity entity : p_75820_1_.func_177429_s()[j]) {
NBTTagCompound nbttagcompound = new NBTTagCompound();
@@ -25,7 +24,7 @@
}
}
@@ -402,7 +409,11 @@
@@ -402,7 +408,11 @@
TileEntity tileentity = p_75820_1_.func_175625_s(blockpos);
if (tileentity != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
@@ -38,7 +37,7 @@
nbttagcompound1.func_74757_a("keepPacked", false);
nbttaglist2.add((INBTBase)nbttagcompound1);
} else {
@@ -442,6 +453,16 @@
@@ -442,6 +452,16 @@
p_75820_3_.func_74782_a("Heightmaps", nbttagcompound2);
p_75820_3_.func_74782_a("Structures", this.func_202160_a(p_75820_1_.field_76635_g, p_75820_1_.field_76647_h, p_75820_1_.func_201609_c(), p_75820_1_.func_201604_d()));
@@ -55,7 +54,7 @@
}
private Chunk func_75823_a(IWorld p_75823_1_, NBTTagCompound p_75823_2_) {
@@ -508,6 +529,10 @@
@@ -508,6 +528,10 @@
chunk.func_177427_f(true);
}
@@ -66,7 +65,7 @@
return chunk;
}
@@ -809,4 +834,8 @@
@@ -809,4 +833,8 @@
return flag;
}
@@ -52,7 +52,7 @@
}
public File func_212679_a(File p_212679_1_) {
@@ -47,7 +59,7 @@
@@ -47,11 +59,11 @@
}
public Dimension func_186070_d() {
@@ -61,6 +61,11 @@
}
public String toString() {
- return func_212678_a(this).toString();
+ return "DimensionType{" + func_212678_a(this) + "}";
}
@Nullable
@@ -59,7 +71,21 @@
return IRegistry.field_212622_k.func_148754_a(p_186069_0_ - -1);
}
@@ -1,14 +1,6 @@
--- a/net/minecraft/world/gen/ChunkProviderServer.java
+++ b/net/minecraft/world/gen/ChunkProviderServer.java
@@ -239,6 +239,7 @@
Chunk chunk = this.field_73244_f.get(olong);
if (chunk != null) {
chunk.func_76623_d();
+ net.minecraftforge.common.ForgeChunkManager.putDormantChunk(ChunkPos.func_77272_a(chunk.field_76635_g, chunk.field_76647_h), chunk);
this.func_73242_b(chunk);
this.field_73244_f.remove(olong);
this.field_212472_f = null;
@@ -250,6 +251,7 @@
@@ -250,6 +250,7 @@
this.field_201723_f.func_208484_a(p_73156_1_);
}
@@ -0,0 +1,20 @@
--- a/net/minecraft/world/storage/DimensionSavedDataManager.java
+++ b/net/minecraft/world/storage/DimensionSavedDataManager.java
@@ -38,6 +38,7 @@
@Nullable
public <T extends WorldSavedData> T func_201067_a(Function<String, T> p_201067_1_, String p_201067_2_) {
WorldSavedData worldsaveddata = this.field_212778_c.get(p_201067_2_);
+ if (worldsaveddata == net.minecraftforge.common.util.DummyWorldSaveData.DUMMY) return null;
if (worldsaveddata == null && this.field_212780_e != null) {
try {
File file1 = this.field_212780_e.func_212423_a(this.field_212777_b, p_201067_2_);
@@ -45,6 +46,9 @@
worldsaveddata = (WorldSavedData)p_201067_1_.apply(p_201067_2_);
worldsaveddata.func_76184_a(func_212774_a(this.field_212780_e, this.field_212777_b, p_201067_2_, 1631).func_74775_l("data"));
this.field_212778_c.put(p_201067_2_, worldsaveddata);
+ } else {
+ this.field_212778_c.put(p_201067_2_, net.minecraftforge.common.util.DummyWorldSaveData.DUMMY);
+ return null;
}
} catch (Exception exception) {
field_212776_a.error("Error loading saved data: {}", p_201067_2_, exception);
@@ -17,7 +17,16 @@
}
public void func_75755_a(WorldInfo p_75755_1_, @Nullable NBTTagCompound p_75755_2_) {
@@ -148,6 +148,7 @@
@@ -109,6 +109,8 @@
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.func_74782_a("Data", nbttagcompound);
+ net.minecraftforge.fml.WorldPersistenceHooks.handleWorldDataSave(this, p_75755_1_, nbttagcompound1);
+
try {
File file1 = new File(this.field_75770_b, "level.dat_new");
File file2 = new File(this.field_75770_b, "level.dat_old");
@@ -148,6 +150,7 @@
}
file1.renameTo(file2);
@@ -25,7 +34,7 @@
} catch (Exception var5) {
field_151478_a.warn("Failed to save player data for {}", (Object)p_75753_1_.func_200200_C_().getString());
}
@@ -171,6 +172,7 @@
@@ -171,6 +174,7 @@
int i = nbttagcompound.func_150297_b("DataVersion", 3) ? nbttagcompound.func_74762_e("DataVersion") : -1;
p_75752_1_.func_70020_e(NBTUtil.func_210822_a(this.field_186341_a, DataFixTypes.PLAYER, nbttagcompound, i));
}
@@ -33,7 +42,7 @@
return nbttagcompound;
}
@@ -210,4 +212,20 @@
@@ -210,4 +214,20 @@
public DataFixer func_197718_i() {
return this.field_186341_a;
}
@@ -20,7 +20,9 @@
package net.minecraftforge.common.asm;
import java.nio.file.Path;
import java.util.EnumSet;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
@@ -41,14 +43,13 @@ public class CapabilityInjectDefinalize implements ILaunchPluginService {
return "capability_inject_definalize";
}
@Override public void addResource(Path resource, String name) { }
@Override public <T> T getExtension() { return null; } // ?
private static final EnumSet<Phase> YAY = EnumSet.of(Phase.AFTER);
private static final EnumSet<Phase> NAY = EnumSet.noneOf(Phase.class);
@Override
public boolean handlesClass(Type classType, boolean isEmpty)
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty)
{
return !isEmpty; //Check for annotations?
return isEmpty ? NAY : YAY;
}
private boolean hasHolder(List<AnnotationNode> lst)
@@ -57,17 +58,19 @@ public class CapabilityInjectDefinalize implements ILaunchPluginService {
}
@Override
public ClassNode processClass(ClassNode classNode, Type classType)
public boolean processClass(Phase phase, ClassNode classNode, Type classType)
{
final int flags = Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL;
AtomicBoolean changed = new AtomicBoolean();
classNode.fields.stream().filter(f -> ((f.access & flags) == flags) && f.desc.equals(CAP) && hasHolder(f.visibleAnnotations)).forEach(f ->
{
f.access &= ~Opcodes.ACC_FINAL; //Strip final
f.access |= Opcodes.ACC_SYNTHETIC; //Add Synthetic so we can check in runtime.
int prev = f.access;
f.access &= ~Opcodes.ACC_FINAL; //Strip final
f.access |= Opcodes.ACC_SYNTHETIC; //Add Synthetic so we can check in runtime.
changed.compareAndSet(false, prev != f.access);
});
return classNode;
return changed.get();
}
}
@@ -20,7 +20,9 @@
package net.minecraftforge.common.asm;
import java.nio.file.Path;
import java.util.EnumSet;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
@@ -41,14 +43,14 @@ public class ObjectHolderDefinalize implements ILaunchPluginService {
return "object_holder_definalize";
}
@Override public void addResource(Path resource, String name) { }
@Override public <T> T getExtension() { return null; } // ?
private static final EnumSet<Phase> YAY = EnumSet.of(Phase.AFTER);
private static final EnumSet<Phase> NAY = EnumSet.noneOf(Phase.class);
@Override
public boolean handlesClass(Type classType, boolean isEmpty)
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty)
{
return !isEmpty; //Check for annotations?
return isEmpty ? NAY : YAY;
}
private boolean hasHolder(List<AnnotationNode> lst)
@@ -71,16 +73,19 @@ public class ObjectHolderDefinalize implements ILaunchPluginService {
}
@Override
public ClassNode processClass(ClassNode classNode, Type classType)
public boolean processClass(Phase phase, ClassNode classNode, Type classType)
{
AtomicBoolean changes = new AtomicBoolean();
//Must be public static finals, and non-array objects
final int flags = Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL;
//Fix Annotated Fields before injecting from class level
classNode.fields.stream().filter(f -> ((f.access & flags) == flags) && f.desc.startsWith("L") && hasHolder(f.visibleAnnotations)).forEach(f ->
{
f.access &= ~Opcodes.ACC_FINAL; //Strip final
f.access |= Opcodes.ACC_SYNTHETIC; //Add Synthetic so we can check in runtime. ? Good idea?
int prev = f.access;
f.access &= ~Opcodes.ACC_FINAL; //Strip final
f.access |= Opcodes.ACC_SYNTHETIC; //Add Synthetic so we can check in runtime. ? Good idea?
changes.compareAndSet(false, prev != f.access);
});
if (hasHolder(classNode.visibleAnnotations)) //Class level, de-finalize all fields and add @ObjectHolder to them!
@@ -89,18 +94,20 @@ public class ObjectHolderDefinalize implements ILaunchPluginService {
String value = getValue(classNode.visibleAnnotations);
classNode.fields.stream().filter(f -> ((f.access & flags) == flags) && f.desc.startsWith("L")).forEach(f ->
{
f.access &= ~Opcodes.ACC_FINAL;
f.access |= Opcodes.ACC_SYNTHETIC;
/*if (!hasHolder(f.visibleAnnotations)) //Add field level annotation, doesn't do anything until after we figure out how ASMDataTable is gatherered
{
int prev = f.access;
f.access &= ~Opcodes.ACC_FINAL;
f.access |= Opcodes.ACC_SYNTHETIC;
/*if (!hasHolder(f.visibleAnnotations)) //Add field level annotation, doesn't do anything until after we figure out how ASMDataTable is gatherered
{
if (value == null)
f.visitAnnotation(OBJECT_HOLDER, true);
else
f.visitAnnotation(OBJECT_HOLDER, true).visit("value", value + ":" + f.name.toLowerCase());
}*/
}*/
changes.compareAndSet(false, prev != f.access);
});
}
return classNode;
return changes.get();
}
}
@@ -20,6 +20,7 @@
package net.minecraftforge.common.asm;
import java.nio.file.Path;
import java.util.EnumSet;
import java.util.List;
import java.util.stream.Collectors;
@@ -48,7 +49,7 @@ public class RuntimeEnumExtender implements ILaunchPluginService {
private final Type MARKER_IFACE = Type.getType("Lnet/minecraftforge/common/IExtensibleEnum;");
private final Type ARRAY_UTILS = Type.getType("Lorg/apache/commons/lang3/ArrayUtils;"); //Don't directly reference this to prevent class loading.
private final String ADD_DESC = Type.getMethodDescriptor(Type.getType(Object[].class), Type.getType(Object[].class), Type.getType(Object.class));
private final Type UNSAFE_HACKS = Type.getType("Lnet/minecraftforge/fml/UnsafeHacks;"); //Again, not direct reference to prevent class loading.
private final Type UNSAFE_HACKS = Type.getType("Lnet/minecraftforge/fml/unsafe/UnsafeHacks;"); //Again, not direct reference to prevent class loading.
private final String CLEAN_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, Type.getType(Class.class));
private final String NAME_DESC = Type.getMethodDescriptor(STRING);
private final String EQUALS_DESC = Type.getMethodDescriptor(Type.BOOLEAN_TYPE, STRING);
@@ -58,21 +59,20 @@ public class RuntimeEnumExtender implements ILaunchPluginService {
return "runtime_enum_extender";
}
@Override public void addResource(Path resource, String name) { }
@Override public <T> T getExtension() { return null; } // ?
private static final EnumSet<Phase> YAY = EnumSet.of(Phase.AFTER);
private static final EnumSet<Phase> NAY = EnumSet.noneOf(Phase.class);
@Override
public boolean handlesClass(Type classType, boolean isEmpty)
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty)
{
return !isEmpty; //Any way to determine if its a enum at this level?
return isEmpty ? NAY : YAY;
}
@Override
public ClassNode processClass(ClassNode classNode, Type classType)
public boolean processClass(Phase phase, ClassNode classNode, Type classType)
{
if ((classNode.access & Opcodes.ACC_ENUM) == 0)
return classNode;
return false;
Type array = Type.getType("[" + classType.getDescriptor());
final int flags = Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL | Opcodes.ACC_SYNTHETIC;
@@ -80,7 +80,7 @@ public class RuntimeEnumExtender implements ILaunchPluginService {
FieldNode values = classNode.fields.stream().filter(f -> f.desc.contentEquals(array.getDescriptor()) && ((f.access & flags) == flags)).findFirst().orElse(null);
if (!classNode.interfaces.contains(MARKER_IFACE.getInternalName())) {
return classNode;
return false;
}
//Static methods named "create", with first argument as a string, and returning this type
@@ -205,7 +205,7 @@ public class RuntimeEnumExtender implements ILaunchPluginService {
ins.areturn(classType);
}
});
return classNode;
return true;
}
}
@@ -80,4 +80,9 @@ public class FMLClientLaunchProvider extends FMLCommonLaunchHandler implements I
{
return Dist.CLIENT;
}
@Override
protected String getNaming() {
return "srg";
}
}
@@ -68,8 +68,8 @@ public abstract class FMLCommonLaunchHandler
public void configureTransformationClassLoader(final ITransformingClassLoaderBuilder builder) {
builder.addTransformationPath(FMLLoader.getForgePath());
for (Path path : FMLLoader.getMCPaths())
builder.addTransformationPath(path);
Arrays.stream(FMLLoader.getMCPaths()).forEach(builder::addTransformationPath);
FMLLoader.getLanguageLoadingProvider().getLibraries().forEach(builder::addTransformationPath);
builder.setClassBytesLocator(getClassLoaderLocatorFunction());
builder.setManifestLocator(getClassLoaderManifestLocatorFunction());
}
@@ -135,4 +135,6 @@ public abstract class FMLCommonLaunchHandler
return Optional.empty();
};
}
protected abstract String getNaming();
}
@@ -26,8 +26,10 @@ import net.minecraftforge.forgespi.Environment;
public class FMLEnvironment
{
public static final Dist dist = FMLLoader.getDist();
public static final String naming = FMLLoader.getNaming();
static void setupInteropEnvironment(IEnvironment environment) {
environment.computePropertyIfAbsent(IEnvironment.Keys.NAMING.get(), v->naming);
environment.computePropertyIfAbsent(Environment.Keys.DIST.get(), v->dist);
}
}
@@ -19,25 +19,35 @@
package net.minecraftforge.fml.loading;
import cpw.mods.modlauncher.Launcher;
import cpw.mods.modlauncher.ServiceLoaderStreamUtils;
import cpw.mods.modlauncher.TransformingClassLoader;
import cpw.mods.modlauncher.api.IEnvironment;
import cpw.mods.modlauncher.api.ILaunchHandlerService;
import cpw.mods.modlauncher.api.INameMappingService;
import cpw.mods.modlauncher.api.ITransformationService;
import cpw.mods.modlauncher.api.ITransformingClassLoader;
import cpw.mods.modlauncher.api.IncompatibleEnvironmentException;
import cpw.mods.modlauncher.serviceapi.ILaunchPluginService;
import net.minecraftforge.accesstransformer.service.AccessTransformerService;
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.forgespi.Environment;
import net.minecraftforge.forgespi.coremod.ICoreModProvider;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.ArrayList;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.BiFunction;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@@ -47,12 +57,13 @@ import static net.minecraftforge.fml.loading.LogMarkers.SCAN;
public class FMLLoader
{
private static final Logger LOGGER = LogManager.getLogger();
private static ILaunchPluginService accessTransformer;
private static AccessTransformerService accessTransformer;
private static ModDiscoverer modDiscoverer;
private static ICoreModProvider coreModProvider;
private static ILaunchPluginService eventBus;
private static LanguageLoadingProvider languageLoadingProvider;
private static Dist dist;
private static String naming;
private static LoadingModList loadingModList;
private static TransformingClassLoader launchClassLoader;
private static RuntimeDistCleaner runtimeDistCleaner;
@@ -71,14 +82,17 @@ 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("1.0")) {
if (!modLauncherPackage.isCompatibleWith("2.0")) {
LOGGER.fatal(CORE,"Found incompatible ModLauncher specification : {}, version {} from {}", modLauncherPackage.getSpecificationVersion(), modLauncherPackage.getImplementationVersion(), modLauncherPackage.getImplementationVendor());
throw new IncompatibleEnvironmentException("Incompatible modlauncher found "+modLauncherPackage.getSpecificationVersion());
}
LOGGER.debug(CORE, "Initializing modjar URL handler");
URL.setURLStreamHandlerFactory(p->p.equals("modjar") ? new ModJarURLHandler() : null);
accessTransformer = environment.findLaunchPlugin("accesstransformer").orElseThrow(()-> new IncompatibleEnvironmentException("Missing AccessTransformer, cannot run"));
accessTransformer = (AccessTransformerService) environment.findLaunchPlugin("accesstransformer").orElseThrow(()-> {
LOGGER.fatal(CORE,"Access Transformer library is missing, we need this to run");
return new IncompatibleEnvironmentException("Missing AccessTransformer, cannot run");
});
final Package atPackage = accessTransformer.getClass().getPackage();
LOGGER.debug(CORE,"FML found AccessTransformer version : {}", atPackage.getImplementationVersion());
@@ -87,7 +101,10 @@ public class FMLLoader
throw new IncompatibleEnvironmentException("Incompatible accesstransformer found "+atPackage.getSpecificationVersion());
}
eventBus = environment.findLaunchPlugin("eventbus").orElseThrow(()-> new IncompatibleEnvironmentException("Missing EventBus, cannot run"));
eventBus = environment.findLaunchPlugin("eventbus").orElseThrow(()-> {
LOGGER.fatal(CORE,"Event Bus library is missing, we need this to run");
return new IncompatibleEnvironmentException("Missing EventBus, cannot run");
});
final Package eventBusPackage = eventBus.getClass().getPackage();
LOGGER.debug(CORE,"FML found EventBus version : {}", eventBusPackage.getImplementationVersion());
@@ -96,11 +113,14 @@ public class FMLLoader
throw new IncompatibleEnvironmentException("Incompatible eventbus found "+eventBusPackage.getSpecificationVersion());
}
runtimeDistCleaner = (RuntimeDistCleaner)environment.findLaunchPlugin("runtimedistcleaner").orElseThrow(()->new IncompatibleEnvironmentException("Missing RuntimeDistCleaner, cannot run!"));
runtimeDistCleaner = (RuntimeDistCleaner)environment.findLaunchPlugin("runtimedistcleaner").orElseThrow(()-> {
LOGGER.fatal(CORE,"Dist Cleaner is missing, we need this to run");
return new IncompatibleEnvironmentException("Missing DistCleaner, cannot run!");
});
LOGGER.debug(CORE, "Found Runtime Dist Cleaner");
final ArrayList<ICoreModProvider> coreModProviders = new ArrayList<>();
ServiceLoader.load(ICoreModProvider.class).forEach(coreModProviders::add);
ServiceLoaderStreamUtils.errorHandlingServiceLoader(ICoreModProvider.class, serviceConfigurationError -> LOGGER.fatal(CORE, "Failed to load a coremod library, expect problems", serviceConfigurationError)).forEach(coreModProviders::add);
if (coreModProviders.isEmpty()) {
LOGGER.fatal(CORE, "Found no coremod provider. Cannot run");
@@ -114,6 +134,21 @@ public class FMLLoader
final Package coremodPackage = coreModProvider.getClass().getPackage();
LOGGER.debug(CORE,"FML found CoreMod version : {}", coremodPackage.getImplementationVersion());
LOGGER.debug(CORE, "Found ForgeSPI package implementation version {}", Environment.class.getPackage().getImplementationVersion());
LOGGER.debug(CORE, "Found ForgeSPI package specification {}", Environment.class.getPackage().getSpecificationVersion());
if (Integer.parseInt(Environment.class.getPackage().getSpecificationVersion()) < 2) {
LOGGER.fatal(CORE, "Found an out of date ForgeSPI implementation: {}, loading cannot continue", Environment.class.getPackage().getSpecificationVersion());
throw new IncompatibleEnvironmentException("ForgeSPI is out of date, we cannot continue");
}
try {
Class.forName("com.electronwill.nightconfig.core.Config", false, environment.getClass().getClassLoader());
Class.forName("com.electronwill.nightconfig.toml.TomlFormat", false, environment.getClass().getClassLoader());
} catch (ClassNotFoundException e) {
LOGGER.fatal(CORE, "Failed to load NightConfig");
throw new IncompatibleEnvironmentException("Missing NightConfig");
}
FixSSL.fixup();
}
@@ -134,7 +169,9 @@ public class FMLLoader
gamePath = environment.getProperty(IEnvironment.Keys.GAMEDIR.get()).orElse(Paths.get(".").toAbsolutePath());
FMLCommonLaunchHandler commonLaunchHandler = (FMLCommonLaunchHandler)launchHandler.get();
naming = commonLaunchHandler.getNaming();
dist = commonLaunchHandler.getDist();
accessTransformer.getExtension().accept(Pair.of(naming, "srg"));
mcVersion = (String) arguments.get("mcVersion");
mcpVersion = (String) arguments.get("mcpVersion");
@@ -219,4 +256,12 @@ public class FMLLoader
public static Predicate<String> getClassLoaderExclusions() {
return classLoaderExclusions;
}
public static String getNaming() {
return naming;
}
public static Optional<BiFunction<INameMappingService.Domain, String, String>> getNameFunction(final String naming) {
return Launcher.INSTANCE.environment().findNameMapping(naming);
}
}
@@ -19,7 +19,6 @@
package net.minecraftforge.fml.loading;
import com.google.common.collect.ObjectArrays;
import cpw.mods.modlauncher.api.IEnvironment;
import cpw.mods.modlauncher.api.ILaunchHandlerService;
import cpw.mods.modlauncher.api.ITransformingClassLoader;
@@ -27,7 +26,6 @@ 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;
@@ -74,4 +72,10 @@ public class FMLServerLaunchProvider extends FMLCommonLaunchHandler implements I
{
return Dist.DEDICATED_SERVER;
}
@Override
protected String getNaming() {
return "srg";
}
}
@@ -55,6 +55,7 @@ public class FMLServiceProvider implements ITransformationService
private String targetMcpVersion;
private String targetMcpMappings;
private String targetForgeGroup;
private Map<String, Object> arguments;
@Override
public String name()
@@ -63,13 +64,12 @@ public class FMLServiceProvider implements ITransformationService
}
@Override
public void initialize(IEnvironment environment)
{
LOGGER.debug(CORE,"Setting up basic FML game directories");
public void initialize(IEnvironment environment) {
LOGGER.debug(CORE, "Setting up basic FML game directories");
FMLPaths.setup(environment);
LOGGER.debug(CORE,"Loading configuration");
LOGGER.debug(CORE, "Loading configuration");
FMLConfig.load();
final Map<String, Object> arguments = new HashMap<>();
arguments = new HashMap<>();
arguments.put("modLists", modListsArgumentList);
arguments.put("mods", modsArgumentList);
arguments.put("mavenRoots", mavenRootsArgumentList);
@@ -82,6 +82,10 @@ public class FMLServiceProvider implements ITransformationService
FMLLoader.setupLaunchHandler(environment, arguments);
FMLEnvironment.setupInteropEnvironment(environment);
Environment.build(environment);
}
@Override
public void beginScanning(final IEnvironment environment) {
LOGGER.debug(CORE,"Initiating mod scan");
FMLLoader.beginModScan(arguments);
}
@@ -56,4 +56,15 @@ public class FileUtils
}
return dirPath;
}
public static String fileExtension(final Path path) {
String fileName = path.getFileName().toString();
int idx = fileName.lastIndexOf('.');
if (idx > -1) {
return fileName.substring(idx+1);
} else {
return "";
}
}
}
@@ -51,6 +51,7 @@ public class LanguageLoadingProvider
private final List<IModLanguageProvider> languageProviders = new ArrayList<>();
private final ServiceLoader<IModLanguageProvider> serviceLoader;
private final Map<String, ModLanguageWrapper> languageProviderMap = new HashMap<>();
private List<Path> languagePaths = new ArrayList<>();
public void forEach(final Consumer<IModLanguageProvider> consumer)
{
@@ -60,13 +61,13 @@ public class LanguageLoadingProvider
private static class ModLanguageWrapper {
private final IModLanguageProvider modLanguageProvider;
private final ArtifactVersion version;
public ModLanguageWrapper(IModLanguageProvider modLanguageProvider, ArtifactVersion version)
{
this.modLanguageProvider = modLanguageProvider;
this.version = version;
}
public ArtifactVersion getVersion()
{
return version;
@@ -77,14 +78,15 @@ public class LanguageLoadingProvider
return modLanguageProvider;
}
}
private static class LanguageClassLoader extends URLClassLoader
{
public LanguageClassLoader() {
super(new URL[0]);
}
@Override
@Override
public void addURL(final URL url) {
LOGGER.debug(CORE, "Adding {} to languageloader classloader", url);
super.addURL(url);
@@ -96,7 +98,6 @@ public class LanguageLoadingProvider
serviceLoader = ServiceLoader.load(IModLanguageProvider.class, languageClassLoader);
loadLanguageProviders();
}
private void loadLanguageProviders() {
LOGGER.debug(CORE, "Found {} language providers", ServiceLoaderStreamUtils.toList(serviceLoader).size());
serviceLoader.forEach(languageProviders::add);
@@ -133,7 +134,7 @@ public class LanguageLoadingProvider
private void addLanguagePaths(final Stream<Path> langPaths) {
languageProviders.clear();
languageProviderMap.clear();
langPaths.map(Path::toFile).map(File::toURI).map(rethrowFunction(URI::toURL)).forEach(languageClassLoader::addURL);
langPaths.peek(languagePaths::add).map(Path::toFile).map(File::toURI).map(rethrowFunction(URI::toURL)).forEach(languageClassLoader::addURL);
}
public void addAdditionalLanguages(List<ModFile> modFiles)
@@ -145,6 +146,10 @@ public class LanguageLoadingProvider
loadLanguageProviders();
}
Stream<Path> getLibraries() {
return languagePaths.stream();
}
public IModLanguageProvider findLanguage(ModFile mf, String modLoader, VersionRange modLoaderVersion) {
final String languageFileName = mf.getLocator() instanceof ExplodedDirectoryLocator ? "in-development" : mf.getFileName();
final ModLanguageWrapper mlw = languageProviderMap.get(modLoader);
@@ -29,7 +29,7 @@ public class LauncherVersion {
private static final String launcherVersion;
static {
String vers = JarVersionLookupHandler.getImplementationVersion(LauncherVersion.class).orElse(System.getProperty("fmllauncher.version"));
String vers = JarVersionLookupHandler.getImplementationVersion(LauncherVersion.class).orElse(System.getenv("LAUNCHER_VERSION"));
if (vers == null) throw new RuntimeException("Missing FMLLauncher version, cannot continue");
launcherVersion = vers;
LOGGER.debug(CORE, "Found FMLLauncher version {}", launcherVersion);
@@ -19,11 +19,9 @@
package net.minecraftforge.fml.loading;
import com.google.common.collect.ObjectArrays;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -81,13 +79,11 @@ 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 mcDataPath = findLibsPath().resolve(MavenCoordinateResolver.get("net.minecraft", type, "", "data", mcVersion));
Path mcExtrasPath = findLibsPath().resolve(MavenCoordinateResolver.get("net.minecraft", type, "", "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 Data at {} is {}", mcDataPath.toString(), pathStatus(mcDataPath));
LOGGER.debug(CORE,"MC Extras at {} is {}", mcExtrasPath.toString(), pathStatus(mcExtrasPath));
LOGGER.debug(CORE,"Forge patches at {} is {}", patchedBinariesPath.toString(), pathStatus(patchedBinariesPath));
return new Path[] { patchedBinariesPath, mcDataPath, mcExtrasPath, srgMcPath };
return new Path[] { patchedBinariesPath, mcExtrasPath, srgMcPath };
}
}
@@ -105,8 +105,11 @@ public class LoadingModList
return null;
}
public URL findURLForResource(final String resourceName) {
public URL findURLForResource(String resourceName) {
for (ModFileInfo mf : modFiles) {
// strip a leading slash
if (resourceName.startsWith("/")) resourceName = resourceName.substring(1);
final Path resource = mf.getFile().findResource(resourceName);
if (Files.exists(resource)) {
try {
@@ -136,4 +139,8 @@ public class LoadingModList
public void setBrokenFiles(final List<ModFile> brokenFiles) {
this.brokenFiles = brokenFiles;
}
public List<ModFile> getBrokenFiles() {
return this.brokenFiles;
}
}
@@ -19,11 +19,12 @@
package net.minecraftforge.fml.loading;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import com.google.common.collect.Streams;
@@ -57,17 +58,12 @@ public class RuntimeDistCleaner implements ILaunchPluginService
}
@Override
public void addResource(Path resource, String name)
{
}
@Override
public ClassNode processClass(ClassNode classNode, Type classType)
public boolean processClass(Phase phase, ClassNode classNode, Type classType)
{
AtomicBoolean changes = new AtomicBoolean();
if (remove(classNode.visibleAnnotations, DIST))
{
LOGGER.debug(DISTXFORM, "Attempted to load class {} for invalid dist {}", classNode.name, DIST);
LOGGER.fatal(DISTXFORM, "Attempted to load class {} for invalid dist {}", classNode.name, DIST);
throw new RuntimeException("Attempted to load class "+ classNode.name + " for invalid dist "+ DIST);
}
@@ -79,6 +75,7 @@ public class RuntimeDistCleaner implements ILaunchPluginService
{
LOGGER.debug(DISTXFORM,"Removing field: {}.{}", classNode.name, field.name);
fields.remove();
changes.compareAndSet(false, true);
}
}
@@ -92,6 +89,7 @@ public class RuntimeDistCleaner implements ILaunchPluginService
LOGGER.debug(DISTXFORM,"Removing method: {}.{}{}", classNode.name, method.name, method.desc);
methods.remove();
lambdaGatherer.accept(method);
changes.compareAndSet(false, true);
}
}
@@ -109,11 +107,12 @@ public class RuntimeDistCleaner implements ILaunchPluginService
{
LOGGER.debug(DISTXFORM,"Removing lambda method: {}.{}{}", classNode.name, method.name, method.desc);
methods.remove();
changes.compareAndSet(false, true);
}
}
}
}
return classNode;
return changes.get();
}
private boolean remove(final List<AnnotationNode> anns, final String side)
@@ -133,10 +132,13 @@ public class RuntimeDistCleaner implements ILaunchPluginService
};
}
private static final EnumSet<Phase> YAY = EnumSet.of(Phase.AFTER);
private static final EnumSet<Phase> NAY = EnumSet.noneOf(Phase.class);
@Override
public boolean handlesClass(Type classType, boolean isEmpty)
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty)
{
return !isEmpty;
return isEmpty ? NAY : YAY;
}
private static class LambdaGatherer extends MethodVisitor {
@@ -27,6 +27,7 @@ import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class MavenDirectoryLocator extends AbstractJarFileLocator {
private List<Path> modCoords;
@@ -54,7 +55,9 @@ public class MavenDirectoryLocator extends AbstractJarFileLocator {
final List<String> mavenRoots = (List<String>) arguments.get("mavenRoots");
final List<Path> mavenRootPaths = mavenRoots.stream().map(n -> FMLPaths.GAMEDIR.get().resolve(n)).collect(Collectors.toList());
final List<String> mods = (List<String>) arguments.get("mods");
List<Path> localModCoords = mods.stream().map(MavenCoordinateResolver::get).collect(Collectors.toList());
final List<String> listedMods = ModListHandler.processModLists((List<String>) arguments.get("modLists"), mavenRootPaths);
List<Path> localModCoords = Stream.concat(mods.stream(),listedMods.stream()).map(MavenCoordinateResolver::get).collect(Collectors.toList());
// find the modCoords path in each supplied maven path, and turn it into a mod file. (skips not found files)
this.modCoords = localModCoords.stream().map(mc -> mavenRootPaths.stream().map(root -> root.resolve(mc)).filter(path -> Files.exists(path)).findFirst().orElseThrow(() -> new IllegalArgumentException("Failed to locate requested mod coordinate " + mc))).collect(Collectors.toList());
@@ -75,7 +75,7 @@ public class ModClassVisitor extends ClassVisitor
return new ModMethodVisitor(name, desc, annotations);
}
public void buildData(final List<ModFileScanData.ClassData> classes, final List<ModFileScanData.AnnotationData> annotations) {
public void buildData(final Set<ModFileScanData.ClassData> classes, final Set<ModFileScanData.AnnotationData> annotations) {
classes.add(new ModFileScanData.ClassData(this.asmType, this.asmSuperType, this.interfaces));
final List<ModFileScanData.AnnotationData> collect = this.annotations.stream().
filter(ma->ModFileScanData.interestingAnnotations().test(ma.asmType)).
@@ -36,6 +36,7 @@ import java.util.Map;
import java.util.ServiceLoader;
import java.util.stream.Collectors;
import static net.minecraftforge.fml.loading.LogMarkers.CORE;
import static net.minecraftforge.fml.loading.LogMarkers.SCAN;
@@ -48,7 +49,7 @@ public class ModDiscoverer {
locators = ServiceLoader.load(IModLocator.class);
locatorList = ServiceLoaderStreamUtils.toList(this.locators);
locatorList.forEach(l->l.initArguments(arguments));
LOGGER.debug(SCAN,"Found Mod Locators : {}", ()->locatorList.stream().map(iModLocator -> "("+iModLocator.name() + ":" + iModLocator.getClass().getPackage().getImplementationVersion()+")").collect(Collectors.joining(",")));
LOGGER.debug(CORE,"Found Mod Locators : {}", ()->locatorList.stream().map(iModLocator -> "("+iModLocator.name() + ":" + iModLocator.getClass().getPackage().getImplementationVersion()+")").collect(Collectors.joining(",")));
}
ModDiscoverer(List<IModLocator> locatorList) {
@@ -57,6 +57,7 @@ public class ModFile
private final String jarVersion;
private Map<String, Object> fileProperties;
private IModLanguageProvider loader;
private Throwable scanError;
public void setFileProperties(Map<String, Object> fileProperties)
{
@@ -159,12 +160,18 @@ public class ModFile
e.printStackTrace();
}
}
if (this.scanError != null) {
throw new RuntimeException(this.scanError);
}
return this.fileModFileScanData;
}
public void setScanResult(final ModFileScanData modFileScanData, final Throwable throwable) {
this.futureScanResult = null;
this.fileModFileScanData = modFileScanData;
if (throwable != null) {
this.scanError = throwable;
}
}
@Override
@@ -38,6 +38,7 @@ public class ModFileInfo implements IModFileInfo
private final URL issueURL;
private final String modLoader;
private final VersionRange modLoaderVersion;
private final boolean showAsResourcePack;
private final List<IModInfo> mods;
private final Map<String,Object> properties;
@@ -50,6 +51,7 @@ public class ModFileInfo implements IModFileInfo
this.modLoaderVersion = config.<String>getOptional("loaderVersion").
map(MavenVersionAdapter::createFromVersionSpec).
orElseThrow(()->new InvalidModFileException("Missing ModLoader version in file", this));
this.showAsResourcePack = config.<Boolean>getOrElse("showAsResourcePack", false);
this.properties = config.<UnmodifiableConfig>getOptional("properties").
map(UnmodifiableConfig::valueMap).orElse(Collections.emptyMap());
this.modFile.setFileProperties(this.properties);
@@ -98,4 +100,9 @@ public class ModFileInfo implements IModFileInfo
public Optional<Manifest> getManifest() {
return modFile.getLocator().findManifest(modFile.getFilePath());
}
@Override
public boolean showAsResourcePack() {
return this.showAsResourcePack;
}
}
@@ -0,0 +1,103 @@
/*
* 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.moddiscovery;
import net.minecraftforge.fml.loading.FMLPaths;
import net.minecraftforge.fml.loading.FileUtils;
import net.minecraftforge.fml.loading.MavenCoordinateResolver;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import static net.minecraftforge.fml.loading.LogMarkers.CORE;
public class ModListHandler {
private static final Logger LOGGER = LogManager.getLogger();
/**
* Reads the modList paths specified, and searches each maven root for mods matching. Returns a list of mods
* found.
*
* @param modListPaths Paths to search for mod file lists
* @param mavenRootPaths Roots to look for mods listed
* @return list of found mod coordinates
*/
public static List<String> processModLists(final List<String> modListPaths, final List<Path> mavenRootPaths) {
final List<String> modCoordinates = modListPaths.stream().map(ModListHandler::transformPathToList).
flatMap(Collection::stream).
collect(Collectors.toList());
List<Pair<Path,String>> localModCoords = modCoordinates.stream().map(mc->Pair.of(MavenCoordinateResolver.get(mc), mc)).collect(Collectors.toList());
final List<Pair<Path, String>> foundCoordinates = localModCoords.stream().
map(mc -> mavenRootPaths.stream().
map(root -> Pair.of(root.resolve(mc.getLeft()), mc.getRight())).
filter(path -> Files.exists(path.getLeft())).
findFirst().
orElseGet(()->{
LOGGER.warn(CORE, "Failed to find coordinate {}", mc);
return null;
})).
filter(Objects::nonNull).
collect(Collectors.toList());
final List<String> found = foundCoordinates.stream().map(Pair::getRight).collect(Collectors.toList());
LOGGER.debug(CORE, "Found mod coordinates from lists: {}", found);
return found;
}
private static List<String> transformPathToList(final String path) {
LOGGER.debug(CORE, "Reading mod list {}", path);
Path filePath = FMLPaths.GAMEDIR.get().resolve(path);
if (!Files.exists(filePath)) {
LOGGER.warn(CORE, "Failed to find modlist file at {}", filePath);
return Collections.emptyList();
}
String extension = FileUtils.fileExtension(filePath);
if (Objects.equals("list",extension)) {
return readListFile(filePath).stream().filter(s -> !s.isEmpty()).collect(Collectors.toList());
} else {
LOGGER.warn(CORE, "Failed to read unknown file list type {} for file {}", extension, filePath);
}
return Collections.emptyList();
}
/**
* Simple list file, ending in ".list" with one mod coordinate per line
* @param filePath path
* @return list
*/
private static List<String> readListFile(final Path filePath) {
try {
return Files.readAllLines(filePath);
} catch (IOException e) {
LOGGER.warn(CORE, "Failed to read file list {}", filePath, e);
return Collections.emptyList();
}
}
}
Loaded 100 of 226 files, more files were not shown because too many files have changed in this diff. Show more