Compare commits

..
52 Commits
Author SHA1 Message Date
LexManos c4e000dbe7 1.15.2 Initial Update 2020-01-22 13:44:03 -08:00
ichttt 0bcc2e3fbd Cleanup fml packages removing old deprecated classes related to GUIs/Configs and fix HoverChecker (#6437)
Fixed ModListWidget name to avoid confusion and collision.
Delete CheckBox, as vanilla has it's own CheckBox now which looks much better
Rename ModConfigEvent.ConfigReloading to ModConfigEvent.Reloading
2020-01-22 14:09:58 -07:00
Daniël Goossens e6c440a4f7 Fixed parameter name issue in ISTER rename. #6461 (#6468) 2020-01-22 13:38:13 -07:00
LexManos 575af22cee Fix default widget foreground color. 2020-01-22 11:56:05 -08:00
Daniël Goossens dea08be906 Updated method names referencing ItemStackTileEntityRenderer (#6461) 2020-01-22 12:26:34 -07:00
Cadiboo 0f27975f77 Fix Widget Foreground Color not allowing pure black (#6460) 2020-01-22 12:25:35 -07:00
Wyn Price 2d30419a31 Fixed rounding issue with entity navigation fix (#6455) (#6456) 2020-01-22 12:24:20 -07:00
Brennan Ward 68ce113c5b Fixed RenderTypeLookup loosing mappings for registry replacements. (#6452) 2020-01-22 12:23:42 -07:00
Take Weiland ad7e4e95ae Use extended version of getLightValue in all places (#6433) 2020-01-22 12:22:35 -07:00
Scotteh 345387645e [1.15.x] Added entity nameplate rendering event hook (#6416) 2020-01-22 12:22:04 -07:00
tterrag 380366e25f Remove emissive items hook, add small utility for bakedquad lighting 2020-01-20 22:44:26 -05:00
David Quintana 1936eb1f36 Fix breaking overlay weirdness. applyBakedNormals was not transforming the baked normals when applying them. Fixes #6432 2020-01-16 03:29:46 +01:00
Daniël Goossens 088fc6b67f [1.15] Add new InputEvent.ClickInputEvent, addresses #5802 (#6047) 2020-01-15 16:30:01 -08:00
David Quintana 983a47a7d6 Fix dark spots in fullbright quad rendering.
Fix multi-layer model not declaring dependency on the particle texture.
Fix mistake in 2c054fca which I didn't intend to push when I did.
2020-01-13 23:20:46 +01:00
David Quintana c1840abb0a Fix multi-layer model loader to actually work in a sane way. No more "base" model involved, and now transforms and overrides work as expected. 2020-01-13 19:38:52 +01:00
David Quintana 2c054fca76 Attempt to fix fullbright lighting.
Fix lightmap value calculation.
2020-01-13 13:19:36 +01:00
tterrag d5b94aa9c8 Add constructor for FishBucketItem that accepts suppliers 2020-01-09 17:26:11 -05:00
David Quintana c4c760bfb3 Fix QuadTransformer normal processing. 2020-01-07 23:52:51 +01:00
Choonster TheMage dd0260c476 Fix validation in RotationBuilder#angle (fixes #6323) (#6408) 2020-01-07 14:21:12 -08:00
Richard Freimer ca62702ff9 Add support for custom nether portal frame blocks (#6389) 2020-01-07 14:20:37 -08:00
RANKSHANK 0d50b4c39f InputEvent.RawMouseEvent fix (#6395) 2020-01-07 13:19:46 -08:00
DaemonUmbra c37e44efb6 Fixed Big Mushrooms not generating (#6390)
Removed vanilla negation from Forge logic that negated the vanilla logic it was replacing
also ran datagen to update the dirt tag to reflect changes that were previously made in the datagen code
2020-01-07 13:15:11 -08:00
tterrag df04ae11ef Fix dyes tag containing dye items instead of tags
Update generated data
2020-01-05 19:03:49 -05:00
Choonster TheMage 6e8b976089 [1.15.x] Remove unused parameter from ElementBuilder#rotation (fixes #6321) (#6407) 2020-01-05 14:29:45 -05:00
tterrag bc878ddf19 Refactor BlockStateProvider to encapsulate a BlockModelProvider
Make most protected methods of data generators public
2020-01-05 14:27:20 -05:00
tterrag 3096608d4a Fix crash when building BakedQuadBuilder
Add javadocs and move sprite to constructor where possible
2020-01-05 13:36:06 -05:00
tterrag 7c99b756f9 Fix incorrect check for missing texture in DynamicBucketModel 2020-01-04 23:50:17 -05:00
tterrag 90035ab084 Remove custom vertex format from BakedQuad 2020-01-04 23:36:56 -05:00
David Quintana b6c12f5fff A few more binary-breaking changes, before it's too late:
- Move CompositeModel out of its package.
- Move a few inner classes from the OBJ loader.
- Rename the bucket model and fluid model classes to match the naming convention.
- Remove BiomeEvent.* and WorldTypeEvent.InitBiomeGens as they are not currently implemented and they haven't been in the previous version either.
2020-01-04 17:18:28 +01:00
David Quintana 4b9920bcb3 Cherry-pick ca819e09 from the 1.14.x branch. Removes a patch from NativeImage which was invalid. 2020-01-04 17:18:27 +01:00
LexManos 1e053298be Fix the particle renderer not setting GL state between each type. MC-168672 2020-01-02 19:02:42 -08:00
David Quintana ca031ca33f Fix CompositeModel not respecting "display" transforms.
Remove leftovers from discarded feature.
2020-01-02 06:21:43 +01:00
David Quintana ecb56054bc Allow model jsons to override the material library used by OBJ models.
Fix model loader test mod resources.
Update licenses.
2020-01-01 17:15:49 +01:00
tterrag 53747b0cb5 Apply baked-in lightmap data to rendering
- Fix ForgeHooksClient.fillNormal injecting data to lightmap
- Fix OBJModel not filling lightmap data
- Fix NewModelLoaderTest blockitem not linking with block
2019-12-30 16:12:14 -05:00
David Quintana e1b0a8c153 Fix LightUtil.unpack to set the 4th component to 1 when expanding an xyz position into a 4-component vector.
Add TRSRTransformer test mod.
Fix signature of the bindTileEntityRenderer method, to account for covariance.
2019-12-29 17:16:27 +01:00
David Quintana fc189c9aaf More model/rendering fixes:
- Breaking change: Change ClientRegistry.bindTileEntityRenderer to a factory, so mods don't have to manually specify the dispatcher.
- Breaking change: Delete obsolete SimpleModelState (the class was duplicated by mistake, see SimpleModelTransform) and ICustomModelState (part of the old loader API).
- Breaking change: Rename getTextureDependencies to getTextures, for consistency.
- Reinstate the getRenderLayer method, fixed appropriately to return the new RenderType value.
- Fix OBJ loader applying the model transform in the wrong reference frame.
- Fix vanilla bug in TransformationMatrix#func_227986_a_
- Fix QuadTransformer logic.
- Added new method to IModelConfiguration to retrieve the owner IUnbakedModel, needed in order to construct ItemOverrideLists when baking custom models.
- Reintroduce multi-layer model through the new model loader system.
2019-12-29 02:13:58 +01:00
David Quintana e8ce61d4cd New batch of Model/rendering fixes:
- PerspectiveMapWrapper did not pass IModelData through to the wrapped model.
- CompositeModel did not store the returned textures from getTextureDependencies.
- VertexFormat used COLOR instead of UV to detect UV presence.
- QuadTransformer would crash due to index out of bounds.
- Small cleanup of TransformationHelper
2019-12-24 13:12:38 +01:00
David Quintana ac61018806 Fix obj models having all faces in the same mesh, breaking material assignments and visibility in the process.
Reintroduce lost patch from the model loader, which would cause the custom values to be missing from generated models.
2019-12-20 18:14:09 +01:00
tterrag 18e97a487d Fix diffuse lighting being baked into models, fixes dark items 2019-12-19 23:13:28 -05:00
David Quintana c3b1f47754 Fix item quads not using the existing vertex color when applying tint colors. 2019-12-20 04:50:40 +01:00
David Quintana 503d277033 Fix bucket model. Some mask textures were not added to the repository, and the bucket override generation was broken.
Fix OBJ loading crash due to a float value being parsed as int.
Fixes 6377
2019-12-20 02:44:27 +01:00
bl4ckscor3 40de19f16e Fix game crashing when modded entities are present (#6364) 2019-12-19 00:56:01 -05:00
ichttt 83ebdcd8f2 Fix warning screen about missing minecraft registry entries (#6363) 2019-12-18 21:02:20 -08:00
Richard Freimer 47a1f7529a Fix capabilities becoming inaccessible on returning from end (#6368) 2019-12-18 20:40:36 -08:00
ichttt 747cb0f151 Some code cleanup for 1.15 (#6362) 2019-12-18 20:39:41 -08:00
tterrag 30b530836a Fix MainMenuScreen patch 2019-12-17 21:10:49 -05:00
tterrag 49596dcacc Mod list GUI detail pass
- Make padding consistent on all elements
- Properly horizontally center the "Search" text
- Update and resize forge/mcp logos
- Enable linear filtering on logo rendering by default
  - Can be disabled with the "logoBlur" mods.toml property
2019-12-17 20:58:26 -05:00
ichttt 5df687dddc Fix mod list screen (#6367) 2019-12-17 20:03:11 -05:00
David Quintana 599a754b60 Fix items in ground being too small, we were applying perspectives twice.
Restore forge patch and fix a tiny mistake in it.
2019-12-18 00:46:29 +01:00
Tobias Hotz eaac0c17a4 Fix keybinds not loading/saving correctly 2019-12-17 18:30:51 -05:00
tterrag faaebe7a07 Remove uvlock hook, fixes broken stair/fence/etc models 2019-12-17 17:37:39 -05:00
tterrag 6256ba336e Update fallback spec version 2019-12-17 17:15:09 -05:00
194 changed files with 2943 additions and 4741 deletions

No files matched your search

+1
View File
@@ -35,4 +35,5 @@ branches:
- 1.13-pre - 1.13-pre
- 1.13.x - 1.13.x
- 1.14.x - 1.14.x
- 1.15.x
- /^noci-.*$/ - /^noci-.*$/
+25 -13
View File
@@ -3,7 +3,11 @@ buildscript {
mavenLocal() mavenLocal()
maven { url = 'https://files.minecraftforge.net/maven' } maven { url = 'https://files.minecraftforge.net/maven' }
jcenter() jcenter()
mavenCentral() //mavenCentral() //TODO: Update Gradle to use HTTPS by default
maven {
name 'maven_central'
url 'https://repo.maven.apache.org/maven2/'
}
} }
dependencies { dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:3.+' classpath 'net.minecraftforge.gradle:ForgeGradle:3.+'
@@ -59,8 +63,8 @@ ext {
} }
MAPPING_CHANNEL = 'snapshot' MAPPING_CHANNEL = 'snapshot'
MAPPING_VERSION = '20190719-1.14.3' MAPPING_VERSION = '20190719-1.14.3'
MC_VERSION = '1.15.1' MC_VERSION = '1.15.2'
MCP_VERSION = '20191217.105819' MCP_VERSION = '20200122.131323'
} }
project(':mcp') { project(':mcp') {
@@ -78,7 +82,11 @@ project(':clean') {
compileJava.sourceCompatibility = compileJava.targetCompatibility = sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. compileJava.sourceCompatibility = compileJava.targetCompatibility = sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
repositories { repositories {
mavenCentral() //mavenCentral() //TODO: Update Gradle to use HTTPS by default
maven {
name 'maven_central'
url 'https://repo.maven.apache.org/maven2/'
}
} }
dependencies { dependencies {
@@ -181,11 +189,15 @@ project(':forge') {
repositories { repositories {
mavenLocal() mavenLocal()
mavenCentral() //mavenCentral() //TODO: Update Gradle to use HTTPS by default
maven {
name 'maven_central'
url 'https://repo.maven.apache.org/maven2/'
}
} }
ext { ext {
SPEC_VERSION = '29.0' // This is overwritten by git tag, but here so dev time doesnt explode SPEC_VERSION = '30.0' // This is overwritten by git tag, but here so dev time doesnt explode
// The new versioning sceme is <MCVersion>-<ForgeMC>.<RB>.<CommitsSinceRB> // The new versioning sceme is <MCVersion>-<ForgeMC>.<RB>.<CommitsSinceRB>
// ForgeMC is a unique identifier for every MC version we have supported. // ForgeMC is a unique identifier for every MC version we have supported.
// Essentially, the same as the old, except dropping the first number, and the builds are no longer unique. // Essentially, the same as the old, except dropping the first number, and the builds are no longer unique.
@@ -795,16 +807,16 @@ project(':forge') {
server: '/data/server.lzma' server: '/data/server.lzma'
], ],
MC_SLIM: [ MC_SLIM: [
client: "[net.minecraft:client:${MC_VERSION}:slim${MC_VERSION == '1.14.4' ? '-stable' : ''}]", client: "[net.minecraft:client:${MC_VERSION}:slim]",
server: "[net.minecraft:server:${MC_VERSION}:slim${MC_VERSION == '1.14.4' ? '-stable' : ''}]" server: "[net.minecraft:server:${MC_VERSION}:slim]"
], ],
MC_SLIM_SHA: [ MC_SLIM_SHA: [
client: "'${sha1(tasks.getByName('downloadClientSlim').output)}'", client: "'${sha1(tasks.getByName('downloadClientSlim').output)}'",
server: "'${sha1(tasks.getByName('downloadServerSlim').output)}'" server: "'${sha1(tasks.getByName('downloadServerSlim').output)}'"
], ],
MC_EXTRA: [ MC_EXTRA: [
client: "[net.minecraft:client:${MC_VERSION}:extra${MC_VERSION == '1.14.4' ? '-stable' : ''}]", client: "[net.minecraft:client:${MC_VERSION}:extra]",
server: "[net.minecraft:server:${MC_VERSION}:extra${MC_VERSION == '1.14.4' ? '-stable' : ''}]" server: "[net.minecraft:server:${MC_VERSION}:extra]"
], ],
MC_EXTRA_SHA: [ MC_EXTRA_SHA: [
client: "'${sha1(tasks.getByName('downloadClientExtra').output)}'", client: "'${sha1(tasks.getByName('downloadClientExtra').output)}'",
@@ -892,7 +904,7 @@ project(':forge') {
['slim', 'extra'].each { type -> ['slim', 'extra'].each { type ->
def name = "download${side.capitalize()}${type.capitalize()}" def name = "download${side.capitalize()}${type.capitalize()}"
task "${name}"(type: DownloadMavenArtifact) { task "${name}"(type: DownloadMavenArtifact) {
artifact = "net.minecraft:${side}:${MC_VERSION}${MC_VERSION == '1.14.4' ? '-stable' : ''}:${type}" artifact = "net.minecraft:${side}:${MC_VERSION}:${type}"
} }
installerJson.dependsOn(name) installerJson.dependsOn(name)
installerJson.inputs.file(tasks.getByName(name).output) installerJson.inputs.file(tasks.getByName(name).output)
@@ -945,7 +957,7 @@ project(':forge') {
artifacts.each { key, lib -> artifacts.each { key, lib ->
classpath += "libraries/${lib.downloads.artifact.path} " classpath += "libraries/${lib.downloads.artifact.path} "
} }
classpath += "libraries/net/minecraft/server/${MC_VERSION}/server-${MC_VERSION}-extra${MC_VERSION == '1.14.4' ? '-stable' : ''}.jar" classpath += "libraries/net/minecraft/server/${MC_VERSION}/server-${MC_VERSION}-extra.jar"
MANIFESTS.each{ pkg, values -> MANIFESTS.each{ pkg, values ->
if (pkg == '/') { if (pkg == '/') {
@@ -978,7 +990,7 @@ project(':forge') {
extension = 'jar' //Needs to be Zip task to not override Manifest, so set extension extension = 'jar' //Needs to be Zip task to not override Manifest, so set extension
destinationDir = file('build/libs') destinationDir = file('build/libs')
from(extraTxts) from(extraTxts)
from(rootProject.file('/src/main/resources/forge_logo.png')) { from(rootProject.file('/installer_logo.png')) {
rename{'big_logo.png'} rename{'big_logo.png'}
} }
from(rootProject.file('/src/main/resources/url.png')) from(rootProject.file('/src/main/resources/url.png'))
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

+3 -3
View File
@@ -6,7 +6,7 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version # A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[30,)" #mandatory (28 is current forge version) loaderVersion="[31,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# A URL to refer people to when problems occur with this mod # A URL to refer people to when problems occur with this mod
issueTrackerURL="http://my.issue.tracker/" #optional issueTrackerURL="http://my.issue.tracker/" #optional
# A list of mods - how many allowed here is determined by the individual mod loader # A list of mods - how many allowed here is determined by the individual mod loader
@@ -42,7 +42,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magn
# Does this dependency have to exist - if not, ordering below must be specified # Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory mandatory=true #mandatory
# The version range of the dependency # The version range of the dependency
versionRange="[30,)" #mandatory versionRange="[31,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE" ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER # 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]] [[dependencies.examplemod]]
modId="minecraft" modId="minecraft"
mandatory=true mandatory=true
versionRange="[1.15.1]" versionRange="[1.15.2]"
ordering="NONE" ordering="NONE"
side="BOTH" side="BOTH"
@@ -9,3 +9,17 @@
Logger field_227884_f_ = LogManager.getLogger(); Logger field_227884_f_ = LogManager.getLogger();
IVertexBuilder func_225582_a_(double p_225582_1_, double p_225582_3_, double p_225582_5_); IVertexBuilder func_225582_a_(double p_225582_1_, double p_225582_3_, double p_225582_5_);
@@ -95,11 +95,12 @@
f5 = p_227890_3_[k] * p_227890_6_;
}
- int l = p_227890_7_[k];
+ int l = applyBakedLighting(p_227890_7_[k], bytebuffer);
float f9 = bytebuffer.getFloat(16);
float f10 = bytebuffer.getFloat(20);
Vector4f vector4f = new Vector4f(f, f1, f2, 1.0F);
vector4f.func_229372_a_(matrix4f);
+ applyBakedNormals(vector3f, bytebuffer, p_227890_1_.func_227872_b_());
this.func_225588_a_(vector4f.func_195910_a(), vector4f.func_195913_b(), vector4f.func_195914_c(), f3, f4, f5, 1.0F, f9, f10, p_227890_8_, l, vector3f.func_195899_a(), vector3f.func_195900_b(), vector3f.func_195902_c());
}
}
@@ -13,6 +13,15 @@
private static final Direction[] field_212556_a = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP}; private static final Direction[] field_212556_a = new Direction[]{Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH, Direction.DOWN, Direction.UP};
private static final LoadingCache<VoxelShape, Boolean> field_223006_b = CacheBuilder.newBuilder().maximumSize(512L).weakKeys().build(new CacheLoader<VoxelShape, Boolean>() { private static final LoadingCache<VoxelShape, Boolean> field_223006_b = CacheBuilder.newBuilder().maximumSize(512L).weakKeys().build(new CacheLoader<VoxelShape, Boolean>() {
public Boolean load(VoxelShape p_load_1_) { public Boolean load(VoxelShape p_load_1_) {
@@ -151,7 +152,7 @@
@Deprecated
public boolean func_220067_a(BlockState p_220067_1_, IBlockReader p_220067_2_, BlockPos p_220067_3_, EntityType<?> p_220067_4_) {
- return p_220067_1_.func_224755_d(p_220067_2_, p_220067_3_, Direction.UP) && this.field_149784_t < 14;
+ return p_220067_1_.func_224755_d(p_220067_2_, p_220067_3_, Direction.UP) && p_220067_1_.getLightValue(p_220067_2_, p_220067_3_) < 14;
}
@Deprecated
@@ -246,6 +247,10 @@ @@ -246,6 +247,10 @@
this.field_149781_w = p_i48440_1_.field_200958_f; this.field_149781_w = p_i48440_1_.field_200958_f;
this.field_149782_v = p_i48440_1_.field_200959_g; this.field_149782_v = p_i48440_1_.field_200959_g;
@@ -9,3 +9,48 @@
netherportalblock$size.func_150859_c(); netherportalblock$size.func_150859_c();
return true; return true;
} else { } else {
@@ -241,13 +241,13 @@
int i;
for(i = 0; i < 22; ++i) {
BlockPos blockpos = p_180120_1_.func_177967_a(p_180120_2_, i);
- if (!this.func_196900_a(this.field_150867_a.func_180495_p(blockpos)) || this.field_150867_a.func_180495_p(blockpos.func_177977_b()).func_177230_c() != Blocks.field_150343_Z) {
+ if (!this.func_196900_a(this.field_150867_a.func_180495_p(blockpos)) || !this.field_150867_a.func_180495_p(blockpos.func_177977_b()).isPortalFrame(this.field_150867_a, blockpos.func_177977_b())) {
break;
}
}
- Block block = this.field_150867_a.func_180495_p(p_180120_1_.func_177967_a(p_180120_2_, i)).func_177230_c();
- return block == Blocks.field_150343_Z ? i : 0;
+ BlockPos framePos = p_180120_1_.func_177967_a(p_180120_2_, i);
+ return this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos) ? i : 0;
}
public int func_181100_a() {
@@ -274,13 +274,13 @@
}
if (i == 0) {
- block = this.field_150867_a.func_180495_p(blockpos.func_177972_a(this.field_150863_d)).func_177230_c();
- if (block != Blocks.field_150343_Z) {
+ BlockPos framePos = blockpos.func_177972_a(this.field_150863_d);
+ if (!this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos)) {
break label56;
}
} else if (i == this.field_150868_h - 1) {
- block = this.field_150867_a.func_180495_p(blockpos.func_177972_a(this.field_150866_c)).func_177230_c();
- if (block != Blocks.field_150343_Z) {
+ BlockPos framePos = blockpos.func_177972_a(this.field_150866_c);
+ if (!this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos)) {
break label56;
}
}
@@ -288,7 +288,8 @@
}
for(int j = 0; j < this.field_150868_h; ++j) {
- if (this.field_150867_a.func_180495_p(this.field_150861_f.func_177967_a(this.field_150866_c, j).func_177981_b(this.field_150862_g)).func_177230_c() != Blocks.field_150343_Z) {
+ BlockPos framePos = this.field_150861_f.func_177967_a(this.field_150866_c, j).func_177981_b(this.field_150862_g);
+ if (!this.field_150867_a.func_180495_p(framePos).isPortalFrame(this.field_150867_a, framePos)) {
this.field_150862_g = 0;
break;
}
@@ -3,7 +3,7 @@
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
public class JungleTree extends BigTree { public class JungleTree extends BigTree {
@Nullable @Nullable
protected ConfiguredFeature<TreeFeatureConfig, ?> func_225546_b_(Random p_225546_1_) { protected ConfiguredFeature<TreeFeatureConfig, ?> func_225546_b_(Random p_225546_1_, boolean p_225546_2_) {
- return (new TreeFeature(TreeFeatureConfig::func_227338_a_)).func_225566_b_(DefaultBiomeFeatures.field_226808_c_); - return (new TreeFeature(TreeFeatureConfig::func_227338_a_)).func_225566_b_(DefaultBiomeFeatures.field_226808_c_);
+ return (new TreeFeature(TreeFeatureConfig::deserializeJungle)).func_225566_b_(DefaultBiomeFeatures.field_226808_c_); + return (new TreeFeature(TreeFeatureConfig::deserializeJungle)).func_225566_b_(DefaultBiomeFeatures.field_226808_c_);
} }
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/GameSettings.java --- a/net/minecraft/client/GameSettings.java
+++ b/net/minecraft/client/GameSettings.java +++ b/net/minecraft/client/GameSettings.java
@@ -170,6 +170,7 @@ @@ -171,6 +171,7 @@
public String field_74363_ab = "en_us"; public String field_74363_ab = "en_us";
public GameSettings(Minecraft p_i46326_1_, File p_i46326_2_) { public GameSettings(Minecraft p_i46326_1_, File p_i46326_2_) {
@@ -8,20 +8,20 @@
this.field_74317_L = p_i46326_1_; this.field_74317_L = p_i46326_1_;
this.field_74354_ai = new File(p_i46326_2_, "options.txt"); this.field_74354_ai = new File(p_i46326_2_, "options.txt");
if (p_i46326_1_.func_147111_S() && Runtime.getRuntime().maxMemory() >= 1000000000L) { if (p_i46326_1_.func_147111_S() && Runtime.getRuntime().maxMemory() >= 1000000000L) {
@@ -485,7 +486,11 @@ @@ -490,7 +491,11 @@
for(KeyBinding keybinding : this.field_74324_K) { for(KeyBinding keybinding : this.field_74324_K) {
if (s.equals("key_" + keybinding.func_151464_g())) { if (s.equals("key_" + keybinding.func_151464_g())) {
- keybinding.func_197979_b(InputMappings.func_197955_a(s1)); - keybinding.func_197979_b(InputMappings.func_197955_a(s1));
+ if (s.indexOf(':') != -1) { + if (s1.indexOf(':') != -1) {
+ String[] pts = s.split(":"); + String[] pts = s1.split(":");
+ keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputMappings.func_197955_a(pts[0])); + keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputMappings.func_197955_a(pts[0]));
+ } else + } else
+ keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputMappings.func_197955_a(s)); + keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputMappings.func_197955_a(s1));
} }
} }
@@ -533,6 +538,7 @@ @@ -538,6 +543,7 @@
} }
public void func_74303_b() { public void func_74303_b() {
@@ -29,8 +29,8 @@
try (PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.field_74354_ai), StandardCharsets.UTF_8))) { try (PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.field_74354_ai), StandardCharsets.UTF_8))) {
printwriter.println("version:" + SharedConstants.func_215069_a().getWorldVersion()); printwriter.println("version:" + SharedConstants.func_215069_a().getWorldVersion());
printwriter.println("autoJump:" + AbstractOption.field_216719_z.func_216741_b(this)); printwriter.println("autoJump:" + AbstractOption.field_216719_z.func_216741_b(this));
@@ -609,7 +615,7 @@ @@ -615,7 +621,7 @@
printwriter.println("glDebugVerbosity:" + this.field_209231_W); printwriter.println("skipMultiplayerWarning:" + this.field_230152_Z_);
for(KeyBinding keybinding : this.field_74324_K) { for(KeyBinding keybinding : this.field_74324_K) {
- printwriter.println("key_" + keybinding.func_151464_g() + ":" + keybinding.func_197982_m()); - printwriter.println("key_" + keybinding.func_151464_g() + ":" + keybinding.func_197982_m());
@@ -38,7 +38,7 @@
} }
for(SoundCategory soundcategory : SoundCategory.values()) { for(SoundCategory soundcategory : SoundCategory.values()) {
@@ -706,6 +712,25 @@ @@ -712,6 +718,25 @@
} }
} }
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Minecraft.java --- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java +++ b/net/minecraft/client/Minecraft.java
@@ -321,6 +321,7 @@ @@ -322,6 +322,7 @@
public Minecraft(GameConfiguration p_i45547_1_) { public Minecraft(GameConfiguration p_i45547_1_) {
super("Client"); super("Client");
field_71432_P = this; field_71432_P = this;
@@ -8,7 +8,7 @@
this.field_71412_D = p_i45547_1_.field_178744_c.field_178760_a; this.field_71412_D = p_i45547_1_.field_178744_c.field_178760_a;
File file1 = p_i45547_1_.field_178744_c.field_178759_c; File file1 = p_i45547_1_.field_178744_c.field_178759_c;
this.field_130070_K = p_i45547_1_.field_178744_c.field_178758_b; this.field_130070_K = p_i45547_1_.field_178744_c.field_178758_b;
@@ -335,7 +336,6 @@ @@ -336,7 +337,6 @@
this.field_152355_az = (new YggdrasilAuthenticationService(this.field_110453_aa, UUID.randomUUID().toString())).createMinecraftSessionService(); 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; this.field_71449_j = p_i45547_1_.field_178745_a.field_178752_a;
field_147123_G.info("Setting user: {}", (Object)this.field_71449_j.func_111285_a()); field_147123_G.info("Setting user: {}", (Object)this.field_71449_j.func_111285_a());
@@ -16,15 +16,15 @@
this.field_71459_aj = p_i45547_1_.field_178741_d.field_178756_a; this.field_71459_aj = p_i45547_1_.field_178741_d.field_178756_a;
this.field_147129_ai = func_147122_X(); this.field_147129_ai = func_147122_X();
this.field_71437_Z = null; this.field_71437_Z = null;
@@ -367,6 +367,7 @@ @@ -368,6 +368,7 @@
screensize = p_i45547_1_.field_178743_b; screensize = p_i45547_1_.field_178743_b;
} }
+ net.minecraftforge.fml.loading.progress.EarlyProgressVisualization.INSTANCE.join(); + net.minecraftforge.fml.loading.progress.EarlyProgressVisualization.INSTANCE.join();
Util.field_211180_a = RenderSystem.initBackendSystem(); Util.field_211180_a = RenderSystem.initBackendSystem();
this.field_195557_T = new VirtualScreen(this); this.field_195557_T = new VirtualScreen(this);
this.field_195558_d = this.field_195557_T.func_217626_a(screensize, this.field_71474_y.field_198019_u, "Minecraft " + SharedConstants.func_215069_a().getName()); this.field_195558_d = this.field_195557_T.func_217626_a(screensize, this.field_71474_y.field_198019_u, this.func_230149_ax_());
@@ -382,7 +383,6 @@ @@ -383,7 +384,6 @@
this.field_195558_d.func_216526_a(this.field_71474_y.field_74350_i); this.field_195558_d.func_216526_a(this.field_71474_y.field_74350_i);
this.field_71417_B = new MouseHelper(this); this.field_71417_B = new MouseHelper(this);
@@ -32,7 +32,7 @@
this.field_195559_v = new KeyboardListener(this); this.field_195559_v = new KeyboardListener(this);
this.field_195559_v.func_197968_a(this.field_195558_d.func_198092_i()); this.field_195559_v.func_197968_a(this.field_195558_d.func_198092_i());
RenderSystem.initRenderer(this.field_71474_y.field_209231_W, false); RenderSystem.initRenderer(this.field_71474_y.field_209231_W, false);
@@ -390,6 +390,7 @@ @@ -391,6 +391,7 @@
this.field_147124_at.func_147604_a(0.0F, 0.0F, 0.0F, 0.0F); this.field_147124_at.func_147604_a(0.0F, 0.0F, 0.0F, 0.0F);
this.field_110451_am = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES, this.field_152352_aC); this.field_110451_am = new SimpleReloadableResourceManager(ResourcePackType.CLIENT_RESOURCES, this.field_152352_aC);
this.field_71474_y.func_198017_a(this.field_110448_aq); this.field_71474_y.func_198017_a(this.field_110448_aq);
@@ -40,7 +40,7 @@
this.field_110448_aq.func_198983_a(); this.field_110448_aq.func_198983_a();
this.field_135017_as = new LanguageManager(this.field_71474_y.field_74363_ab); this.field_135017_as = new LanguageManager(this.field_71474_y.field_74363_ab);
this.field_110451_am.func_219534_a(this.field_135017_as); this.field_110451_am.func_219534_a(this.field_135017_as);
@@ -433,12 +434,14 @@ @@ -434,12 +435,14 @@
this.func_193986_ar(); this.func_193986_ar();
this.field_110451_am.func_219534_a(this.field_193995_ae); this.field_110451_am.func_219534_a(this.field_193995_ae);
this.field_71452_i = new ParticleManager(this.field_71441_e, this.field_71446_o); this.field_71452_i = new ParticleManager(this.field_71441_e, this.field_71446_o);
@@ -56,7 +56,7 @@
this.field_184132_p = new DebugRenderer(this); this.field_184132_p = new DebugRenderer(this);
RenderSystem.setErrorCallback(this::func_195545_a); RenderSystem.setErrorCallback(this::func_195545_a);
if (this.field_71474_y.field_74353_u && !this.field_195558_d.func_198113_j()) { if (this.field_71474_y.field_74353_u && !this.field_195558_d.func_198113_j()) {
@@ -450,12 +453,11 @@ @@ -451,12 +454,11 @@
this.field_195558_d.func_224798_d(this.field_71474_y.field_225307_E); this.field_195558_d.func_224798_d(this.field_71474_y.field_225307_E);
this.field_195558_d.func_227801_c_(); this.field_195558_d.func_227801_c_();
this.func_213226_a(); this.func_213226_a();
@@ -73,7 +73,7 @@
ResourceLoadProgressGui.func_212970_a(this); ResourceLoadProgressGui.func_212970_a(this);
List<IResourcePack> list = this.field_110448_aq.func_198980_d().stream().map(ResourcePackInfo::func_195796_e).collect(Collectors.toList()); List<IResourcePack> list = this.field_110448_aq.func_198980_d().stream().map(ResourcePackInfo::func_195796_e).collect(Collectors.toList());
this.func_213268_a(new ResourceLoadProgressGui(this, this.field_110451_am.func_219537_a(Util.func_215072_e(), this, field_223714_G, list), (p_229990_2_) -> { this.func_213268_a(new ResourceLoadProgressGui(this, this.field_110451_am.func_219537_a(Util.func_215072_e(), this, field_223714_G, list), (p_229990_2_) -> {
@@ -465,6 +467,14 @@ @@ -466,6 +468,14 @@
this.func_213256_aB(); this.func_213256_aB();
} }
@@ -88,7 +88,7 @@
}); });
}, false)); }, false));
} }
@@ -545,7 +555,7 @@ @@ -579,7 +589,7 @@
return Stream.of(Registry.field_212630_s.func_177774_c(p_213251_0_.func_77973_b())); return Stream.of(Registry.field_212630_s.func_177774_c(p_213251_0_.func_77973_b()));
}); });
SearchTreeReloadable<ItemStack> searchtreereloadable = new SearchTreeReloadable<>((p_213235_0_) -> { SearchTreeReloadable<ItemStack> searchtreereloadable = new SearchTreeReloadable<>((p_213235_0_) -> {
@@ -97,7 +97,7 @@
}); });
NonNullList<ItemStack> nonnulllist = NonNullList.func_191196_a(); NonNullList<ItemStack> nonnulllist = NonNullList.func_191196_a();
@@ -633,13 +643,13 @@ @@ -667,13 +677,13 @@
Bootstrap.func_179870_a(p_71377_0_.func_71502_e()); Bootstrap.func_179870_a(p_71377_0_.func_71502_e());
if (p_71377_0_.func_71497_f() != null) { if (p_71377_0_.func_71497_f() != null) {
Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_0_.func_71497_f()); Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_0_.func_71497_f());
@@ -114,7 +114,7 @@
} }
} }
@@ -648,6 +658,7 @@ @@ -682,6 +692,7 @@
return this.field_71474_y.field_211842_aO; return this.field_71474_y.field_211842_aO;
} }
@@ -122,7 +122,7 @@
public CompletableFuture<Void> func_213237_g() { public CompletableFuture<Void> func_213237_g() {
if (this.field_213276_aV != null) { if (this.field_213276_aV != null) {
return this.field_213276_aV; return this.field_213276_aV;
@@ -726,10 +737,6 @@ @@ -760,10 +771,6 @@
} }
public void func_147108_a(@Nullable Screen p_147108_1_) { public void func_147108_a(@Nullable Screen p_147108_1_) {
@@ -133,7 +133,7 @@
if (p_147108_1_ == null && this.field_71441_e == null) { if (p_147108_1_ == null && this.field_71441_e == null) {
p_147108_1_ = new MainMenuScreen(); p_147108_1_ = new MainMenuScreen();
} else if (p_147108_1_ == null && this.field_71439_g.func_110143_aJ() <= 0.0F) { } else if (p_147108_1_ == null && this.field_71439_g.func_110143_aJ() <= 0.0F) {
@@ -740,6 +747,14 @@ @@ -774,6 +781,14 @@
} }
} }
@@ -148,7 +148,7 @@
if (p_147108_1_ instanceof MainMenuScreen || p_147108_1_ instanceof MultiplayerScreen) { if (p_147108_1_ instanceof MainMenuScreen || p_147108_1_ instanceof MultiplayerScreen) {
this.field_71474_y.field_74330_P = false; this.field_71474_y.field_74330_P = false;
this.field_71456_v.func_146158_b().func_146231_a(true); this.field_71456_v.func_146158_b().func_146231_a(true);
@@ -862,11 +877,13 @@ @@ -905,11 +920,13 @@
RenderSystem.enableTexture(); RenderSystem.enableTexture();
this.field_71424_I.func_76319_b(); this.field_71424_I.func_76319_b();
if (!this.field_71454_w) { if (!this.field_71454_w) {
@@ -162,20 +162,40 @@
} }
this.field_71424_I.func_219897_b(); this.field_71424_I.func_219897_b();
@@ -1121,10 +1138,10 @@ @@ -1164,11 +1181,21 @@
if (p_147115_1_ && this.field_71476_x != null && this.field_71476_x.func_216346_c() == RayTraceResult.Type.BLOCK) { if (p_147115_1_ && this.field_71476_x != null && this.field_71476_x.func_216346_c() == RayTraceResult.Type.BLOCK) {
BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x; BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x;
BlockPos blockpos = blockraytraceresult.func_216350_a(); BlockPos blockpos = blockraytraceresult.func_216350_a();
- if (!this.field_71441_e.func_180495_p(blockpos).func_196958_f()) { - if (!this.field_71441_e.func_180495_p(blockpos).func_196958_f()) {
+ if (!this.field_71441_e.func_175623_d(blockpos)) { + if (!this.field_71441_e.func_175623_d(blockpos)) {
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.field_71474_y.field_74312_F, Hand.MAIN_HAND);
+ if (inputEvent.isCanceled()) {
+ if (inputEvent.shouldSwingHand()) {
+ this.field_71452_i.addBlockHitEffects(blockpos, blockraytraceresult);
+ this.field_71439_g.func_184609_a(Hand.MAIN_HAND);
+ }
+ return;
+ }
Direction direction = blockraytraceresult.func_216354_b(); Direction direction = blockraytraceresult.func_216354_b();
if (this.field_71442_b.func_180512_c(blockpos, direction)) { if (this.field_71442_b.func_180512_c(blockpos, direction)) {
- this.field_71452_i.func_180532_a(blockpos, direction); - this.field_71452_i.func_180532_a(blockpos, direction);
+ if (inputEvent.shouldSwingHand()) {
+ this.field_71452_i.addBlockHitEffects(blockpos, blockraytraceresult); + this.field_71452_i.addBlockHitEffects(blockpos, blockraytraceresult);
this.field_71439_g.func_184609_a(Hand.MAIN_HAND); this.field_71439_g.func_184609_a(Hand.MAIN_HAND);
+ }
} }
} }
@@ -1151,7 +1168,7 @@
@@ -1187,6 +1214,8 @@
}
} else if (!this.field_71439_g.func_184838_M()) {
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.field_71474_y.field_74312_F, Hand.MAIN_HAND);
+ if (!inputEvent.isCanceled())
switch(this.field_71476_x.func_216346_c()) {
case ENTITY:
this.field_71442_b.func_78764_a(this.field_71439_g, ((EntityRayTraceResult)this.field_71476_x).func_216348_a());
@@ -1194,7 +1223,7 @@
case BLOCK: case BLOCK:
BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x; BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x;
BlockPos blockpos = blockraytraceresult.func_216350_a(); BlockPos blockpos = blockraytraceresult.func_216350_a();
@@ -184,15 +204,46 @@
this.field_71442_b.func_180511_b(blockpos, blockraytraceresult.func_216354_b()); this.field_71442_b.func_180511_b(blockpos, blockraytraceresult.func_216354_b());
break; break;
} }
@@ -1161,6 +1178,7 @@ @@ -1204,8 +1233,10 @@
} }
this.field_71439_g.func_184821_cY(); this.field_71439_g.func_184821_cY();
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.field_71439_g); + net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.field_71439_g);
} }
+ if (inputEvent.shouldSwingHand())
this.field_71439_g.func_184609_a(Hand.MAIN_HAND); this.field_71439_g.func_184609_a(Hand.MAIN_HAND);
@@ -1217,6 +1235,9 @@ }
}
@@ -1220,6 +1251,11 @@
}
for(Hand hand : Hand.values()) {
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(1, this.field_71474_y.field_74313_G, hand);
+ if (inputEvent.isCanceled()) {
+ if (inputEvent.shouldSwingHand()) this.field_71439_g.func_184609_a(hand);
+ return;
+ }
ItemStack itemstack = this.field_71439_g.func_184586_b(hand);
if (this.field_71476_x != null) {
switch(this.field_71476_x.func_216346_c()) {
@@ -1233,6 +1269,7 @@
if (actionresulttype.func_226246_a_()) {
if (actionresulttype.func_226247_b_()) {
+ if (inputEvent.shouldSwingHand())
this.field_71439_g.func_184609_a(hand);
}
@@ -1245,6 +1282,7 @@
ActionResultType actionresulttype1 = this.field_71442_b.func_217292_a(this.field_71439_g, this.field_71441_e, hand, blockraytraceresult);
if (actionresulttype1.func_226246_a_()) {
if (actionresulttype1.func_226247_b_()) {
+ if (inputEvent.shouldSwingHand())
this.field_71439_g.func_184609_a(hand);
if (!itemstack.func_190926_b() && (itemstack.func_190916_E() != i || this.field_71442_b.func_78758_h())) {
this.field_71460_t.field_78516_c.func_187460_a(hand);
@@ -1260,6 +1298,9 @@
} }
} }
@@ -202,7 +253,7 @@
if (!itemstack.func_190926_b()) { if (!itemstack.func_190926_b()) {
ActionResultType actionresulttype2 = this.field_71442_b.func_187101_a(this.field_71439_g, this.field_71441_e, hand); ActionResultType actionresulttype2 = this.field_71442_b.func_187101_a(this.field_71439_g, this.field_71441_e, hand);
if (actionresulttype2.func_226246_a_()) { if (actionresulttype2.func_226246_a_()) {
@@ -1243,6 +1264,8 @@ @@ -1286,6 +1327,8 @@
--this.field_71467_ac; --this.field_71467_ac;
} }
@@ -211,7 +262,7 @@
this.field_71424_I.func_76320_a("gui"); this.field_71424_I.func_76320_a("gui");
if (!this.field_71445_n) { if (!this.field_71445_n) {
this.field_71456_v.func_73831_a(); this.field_71456_v.func_73831_a();
@@ -1360,6 +1383,8 @@ @@ -1403,6 +1446,8 @@
this.field_71424_I.func_219895_b("keyboard"); this.field_71424_I.func_219895_b("keyboard");
this.field_195559_v.func_204870_b(); this.field_195559_v.func_204870_b();
this.field_71424_I.func_76319_b(); this.field_71424_I.func_76319_b();
@@ -220,7 +271,7 @@
} }
private void func_184117_aA() { private void func_184117_aA() {
@@ -1514,6 +1539,12 @@ @@ -1557,6 +1602,12 @@
this.func_147108_a(worldloadprogressscreen); this.func_147108_a(worldloadprogressscreen);
while(!this.field_71437_Z.func_71200_ad()) { while(!this.field_71437_Z.func_71200_ad()) {
@@ -233,7 +284,7 @@
worldloadprogressscreen.tick(); worldloadprogressscreen.tick();
this.func_195542_b(false); this.func_195542_b(false);
@@ -1534,11 +1565,17 @@ @@ -1577,11 +1628,17 @@
networkmanager.func_150719_a(new ClientLoginNetHandler(networkmanager, this, (Screen)null, (p_229998_0_) -> { networkmanager.func_150719_a(new ClientLoginNetHandler(networkmanager, this, (Screen)null, (p_229998_0_) -> {
})); }));
networkmanager.func_179290_a(new CHandshakePacket(socketaddress.toString(), 0, ProtocolType.LOGIN)); networkmanager.func_179290_a(new CHandshakePacket(socketaddress.toString(), 0, ProtocolType.LOGIN));
@@ -252,7 +303,13 @@
WorkingScreen workingscreen = new WorkingScreen(); WorkingScreen workingscreen = new WorkingScreen();
workingscreen.func_200210_a(new TranslationTextComponent("connect.joining")); workingscreen.func_200210_a(new TranslationTextComponent("connect.joining"));
this.func_213241_c(workingscreen); this.func_213241_c(workingscreen);
@@ -1570,10 +1607,12 @@ @@ -1608,15 +1665,18 @@
if (clientplaynethandler != null) {
this.func_213159_be();
clientplaynethandler.func_147296_c();
+ net.minecraftforge.client.MinecraftForgeClient.clearRenderCache();
}
IntegratedServer integratedserver = this.field_71437_Z; IntegratedServer integratedserver = this.field_71437_Z;
this.field_71437_Z = null; this.field_71437_Z = null;
this.field_71460_t.func_190564_k(); this.field_71460_t.func_190564_k();
@@ -265,15 +322,7 @@
if (integratedserver != null) { if (integratedserver != null) {
while(!integratedserver.func_213201_w()) { while(!integratedserver.func_213201_w()) {
this.func_195542_b(false); this.func_195542_b(false);
@@ -1605,6 +1644,7 @@ @@ -1674,112 +1734,9 @@
this.field_71438_f.func_72732_a(p_213257_1_);
this.field_71452_i.func_78870_a(p_213257_1_);
TileEntityRendererDispatcher.field_147556_a.func_147543_a(p_213257_1_);
+ net.minecraftforge.client.MinecraftForgeClient.clearRenderCache();
}
public final boolean func_71355_q() {
@@ -1630,112 +1670,8 @@
private void func_147112_ai() { private void func_147112_ai() {
if (this.field_71476_x != null && this.field_71476_x.func_216346_c() != RayTraceResult.Type.MISS) { if (this.field_71476_x != null && this.field_71476_x.func_216346_c() != RayTraceResult.Type.MISS) {
@@ -383,12 +432,13 @@
- } - }
- -
- } - }
+ if (!net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.field_71474_y.field_74322_I, Hand.MAIN_HAND).isCanceled())
+ net.minecraftforge.common.ForgeHooks.onPickBlock(this.field_71476_x, this.field_71439_g, this.field_71441_e); + net.minecraftforge.common.ForgeHooks.onPickBlock(this.field_71476_x, this.field_71439_g, this.field_71441_e);
+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions + // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions
} }
} }
@@ -1817,6 +1753,7 @@ @@ -1861,6 +1818,7 @@
return field_71432_P; return field_71432_P;
} }
@@ -396,7 +446,7 @@
public CompletableFuture<Void> func_213245_w() { public CompletableFuture<Void> func_213245_w() {
return this.func_213169_a(this::func_213237_g).thenCompose((p_229993_0_) -> { return this.func_213169_a(this::func_213237_g).thenCompose((p_229993_0_) -> {
return p_229993_0_; return p_229993_0_;
@@ -1944,6 +1881,8 @@ @@ -1988,6 +1946,8 @@
} }
public MusicTicker.MusicType func_147109_W() { public MusicTicker.MusicType func_147109_W() {
@@ -405,7 +455,7 @@
if (this.field_71462_r instanceof WinGameScreen) { if (this.field_71462_r instanceof WinGameScreen) {
return MusicTicker.MusicType.CREDITS; return MusicTicker.MusicType.CREDITS;
} else if (this.field_71439_g == null) { } else if (this.field_71439_g == null) {
@@ -2120,7 +2059,7 @@ @@ -2164,7 +2124,7 @@
supplier = func_228022_c_(supplier); supplier = func_228022_c_(supplier);
} }
@@ -414,7 +464,7 @@
} }
private static Supplier<IResourcePack> func_228021_b_(Supplier<IResourcePack> p_228021_0_) { private static Supplier<IResourcePack> func_228021_b_(Supplier<IResourcePack> p_228021_0_) {
@@ -2138,4 +2077,12 @@ @@ -2182,4 +2142,12 @@
public void func_228020_b_(int p_228020_1_) { public void func_228020_b_(int p_228020_1_) {
this.field_175617_aL.func_229355_a_(p_228020_1_); this.field_175617_aL.func_229355_a_(p_228020_1_);
} }
@@ -1,12 +1,14 @@
--- a/net/minecraft/client/MouseHelper.java --- a/net/minecraft/client/MouseHelper.java
+++ b/net/minecraft/client/MouseHelper.java +++ b/net/minecraft/client/MouseHelper.java
@@ -72,16 +72,21 @@ @@ -66,6 +66,7 @@
if (!this.field_198051_p && flag) { this.field_198042_g = -1;
this.func_198034_i(); }
}
+ if (net.minecraftforge.client.ForgeHooksClient.onRawMouseClicked(p_198023_3_, p_198023_4_, p_198023_5_)) return; + if (net.minecraftforge.client.ForgeHooksClient.onRawMouseClicked(p_198023_3_, p_198023_4_, p_198023_5_)) return;
} else { boolean[] aboolean = new boolean[]{false};
double d0 = this.field_198040_e * (double)this.field_198036_a.func_228018_at_().func_198107_o() / (double)this.field_198036_a.func_228018_at_().func_198105_m(); if (this.field_198036_a.field_213279_p == null) {
if (this.field_198036_a.field_71462_r == null) {
@@ -77,11 +78,15 @@
double d1 = this.field_198041_f * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n(); double d1 = this.field_198041_f * (double)this.field_198036_a.func_228018_at_().func_198087_p() / (double)this.field_198036_a.func_228018_at_().func_198083_n();
if (flag) { if (flag) {
Screen.wrapScreenError(() -> { Screen.wrapScreenError(() -> {
@@ -18,7 +18,7 @@
} else { } else {
this.func_73969_a(j, 24); this.func_73969_a(j, 24);
+ modbutton = this.addButton(new Button(this.width / 2 - 100, j + 24 * 2, 98, 20, I18n.func_135052_a("fml.menu.mods"), button -> { + modbutton = this.addButton(new Button(this.width / 2 - 100, j + 24 * 2, 98, 20, I18n.func_135052_a("fml.menu.mods"), button -> {
+ this.minecraft.func_147108_a(new net.minecraftforge.fml.client.gui.GuiModList(this)); + this.minecraft.func_147108_a(new net.minecraftforge.fml.client.gui.screen.ModListScreen(this));
+ })); + }));
} }
@@ -31,16 +31,16 @@
} }
@@ -126,7 +132,7 @@ @@ -131,7 +137,7 @@
this.addButton(new Button(this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, 200, 20, I18n.func_135052_a("menu.multiplayer"), (p_213086_1_) -> { }
this.minecraft.func_147108_a(new MultiplayerScreen(this));
})); }));
- this.addButton(new Button(this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 200, 20, I18n.func_135052_a("menu.online"), (p_213095_1_) -> { - this.addButton(new Button(this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 200, 20, I18n.func_135052_a("menu.online"), (p_213095_1_) -> {
+ this.addButton(new Button(this.width / 2 + 2, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.func_135052_a("menu.online"), (p_213095_1_) -> { + this.addButton(new Button(this.width / 2 + 2, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.func_135052_a("menu.online"), (p_213095_1_) -> {
this.func_140005_i(); this.func_140005_i();
})); }));
} }
@@ -190,6 +196,7 @@ @@ -195,6 +201,7 @@
this.minecraft.func_110434_K().func_110577_a(field_194400_H); this.minecraft.func_110434_K().func_110577_a(field_194400_H);
blit(j + 88, 67, 0.0F, 0.0F, 98, 14, 128, 16); blit(j + 88, 67, 0.0F, 0.0F, 98, 14, 128, 16);
@@ -48,8 +48,8 @@
if (this.field_73975_c != null) { if (this.field_73975_c != null) {
RenderSystem.pushMatrix(); RenderSystem.pushMatrix();
RenderSystem.translatef((float)(this.width / 2 + 90), 70.0F, 0.0F); RenderSystem.translatef((float)(this.width / 2 + 90), 70.0F, 0.0F);
@@ -208,7 +215,13 @@ @@ -217,7 +224,13 @@
s = s + ("release".equalsIgnoreCase(this.minecraft.func_184123_d()) ? "" : "/" + this.minecraft.func_184123_d()); s = s + I18n.func_135052_a("menu.modded");
} }
- this.drawString(this.font, s, 2, this.height - 10, 16777215 | l); - this.drawString(this.font, s, 2, this.height - 10, 16777215 | l);
@@ -63,7 +63,7 @@
this.drawString(this.font, "Copyright Mojang AB. Do not distribute!", this.field_193979_N, this.height - 10, 16777215 | l); this.drawString(this.font, "Copyright Mojang AB. Do not distribute!", this.field_193979_N, this.height - 10, 16777215 | l);
if (p_render_1_ > this.field_193979_N && p_render_1_ < this.field_193979_N + this.field_193978_M && p_render_2_ > this.height - 10 && p_render_2_ < this.height) { if (p_render_1_ > this.field_193979_N && p_render_1_ < this.field_193979_N + this.field_193978_M && p_render_2_ > this.height - 10 && p_render_2_ < this.height) {
fill(this.field_193979_N, this.height - 1, this.field_193979_N + this.field_193978_M, this.height, 16777215 | l); fill(this.field_193979_N, this.height - 1, this.field_193979_N + this.field_193978_M, this.height, 16777215 | l);
@@ -222,6 +235,7 @@ @@ -231,6 +244,7 @@
if (this.func_183501_a() && f1 >= 1.0F) { if (this.func_183501_a() && f1 >= 1.0F) {
this.field_183503_M.render(p_render_1_, p_render_2_, p_render_3_); this.field_183503_M.render(p_render_1_, p_render_2_, p_render_3_);
} }
@@ -6,9 +6,9 @@
protected void renderTooltip(ItemStack p_renderTooltip_1_, int p_renderTooltip_2_, int p_renderTooltip_3_) { protected void renderTooltip(ItemStack p_renderTooltip_1_, int p_renderTooltip_2_, int p_renderTooltip_3_) {
- this.renderTooltip(this.getTooltipFromItem(p_renderTooltip_1_), p_renderTooltip_2_, p_renderTooltip_3_); - this.renderTooltip(this.getTooltipFromItem(p_renderTooltip_1_), p_renderTooltip_2_, p_renderTooltip_3_);
+ FontRenderer font = p_renderTooltip_1_.func_77973_b().getFontRenderer(p_renderTooltip_1_); + FontRenderer font = p_renderTooltip_1_.func_77973_b().getFontRenderer(p_renderTooltip_1_);
+ net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(p_renderTooltip_1_); + net.minecraftforge.fml.client.gui.GuiUtils.preItemToolTip(p_renderTooltip_1_);
+ this.renderTooltip(this.getTooltipFromItem(p_renderTooltip_1_), p_renderTooltip_2_, p_renderTooltip_3_, (font == null ? this.font : font)); + this.renderTooltip(this.getTooltipFromItem(p_renderTooltip_1_), p_renderTooltip_2_, p_renderTooltip_3_, (font == null ? this.font : font));
+ net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip(); + net.minecraftforge.fml.client.gui.GuiUtils.postItemToolTip();
} }
public List<String> getTooltipFromItem(ItemStack p_getTooltipFromItem_1_) { public List<String> getTooltipFromItem(ItemStack p_getTooltipFromItem_1_) {
@@ -20,7 +20,7 @@
+ renderTooltip(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_, font); + renderTooltip(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_, font);
+ } + }
+ public void renderTooltip(List<String> p_renderTooltip_1_, int p_renderTooltip_2_, int p_renderTooltip_3_, FontRenderer font) { + public void renderTooltip(List<String> p_renderTooltip_1_, int p_renderTooltip_2_, int p_renderTooltip_3_, FontRenderer font) {
+ net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_, width, height, -1, font); + net.minecraftforge.fml.client.gui.GuiUtils.drawHoveringText(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_, width, height, -1, font);
+ if (false && !p_renderTooltip_1_.isEmpty()) { + if (false && !p_renderTooltip_1_.isEmpty()) {
RenderSystem.disableRescaleNormal(); RenderSystem.disableRescaleNormal();
RenderSystem.disableDepthTest(); RenderSystem.disableDepthTest();
@@ -180,9 +180,9 @@
- this.renderTooltip(list1, p_renderTooltip_2_, p_renderTooltip_3_); - this.renderTooltip(list1, p_renderTooltip_2_, p_renderTooltip_3_);
+ net.minecraft.client.gui.FontRenderer font = p_renderTooltip_1_.func_77973_b().getFontRenderer(p_renderTooltip_1_); + net.minecraft.client.gui.FontRenderer font = p_renderTooltip_1_.func_77973_b().getFontRenderer(p_renderTooltip_1_);
+ net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(p_renderTooltip_1_); + net.minecraftforge.fml.client.gui.GuiUtils.preItemToolTip(p_renderTooltip_1_);
+ this.renderTooltip(list1, p_renderTooltip_2_, p_renderTooltip_3_, (font == null ? this.font : font)); + this.renderTooltip(list1, p_renderTooltip_2_, p_renderTooltip_3_, (font == null ? this.font : font));
+ net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip(); + net.minecraftforge.fml.client.gui.GuiUtils.postItemToolTip();
} else { } else {
super.renderTooltip(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_); super.renderTooltip(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_);
} }
@@ -24,17 +24,21 @@
public void setAlpha(float p_setAlpha_1_) { public void setAlpha(float p_setAlpha_1_) {
this.alpha = p_setAlpha_1_; this.alpha = p_setAlpha_1_;
} }
@@ -233,4 +241,13 @@ @@ -233,4 +241,17 @@
protected void setFocused(boolean p_setFocused_1_) { protected void setFocused(boolean p_setFocused_1_) {
this.focused = p_setFocused_1_; this.focused = p_setFocused_1_;
} }
+ +
+ protected int packedFGColor = 0; + public static final int UNSET_FG_COLOR = -1;
+ protected int packedFGColor = UNSET_FG_COLOR;
+ public int getFGColor() { + public int getFGColor() {
+ if (packedFGColor != 0) return packedFGColor; + if (packedFGColor != UNSET_FG_COLOR) return packedFGColor;
+ return this.active ? 16777215 : 10526880; + return this.active ? 16777215 : 10526880; // White : Light Grey
+ } + }
+ public void setFGColor(int color) { + public void setFGColor(int color) {
+ this.packedFGColor = color; + this.packedFGColor = color;
+ }
+ public void clearFGColor() {
+ this.packedFGColor = UNSET_FG_COLOR;
+ } + }
} }
@@ -39,17 +39,27 @@
this.field_187241_h.add(p_78873_1_); this.field_187241_h.add(p_78873_1_);
} }
@@ -312,7 +313,8 @@ @@ -305,14 +306,18 @@
public void func_228345_a_(MatrixStack p_228345_1_, IRenderTypeBuffer.Impl p_228345_2_, LightTexture p_228345_3_, ActiveRenderInfo p_228345_4_, float p_228345_5_) {
p_228345_3_.func_205109_c();
+ Runnable enable = () -> {
RenderSystem.enableAlphaTest();
RenderSystem.defaultAlphaFunc();
RenderSystem.enableDepthTest();
RenderSystem.enableFog();
+ };
RenderSystem.pushMatrix(); RenderSystem.pushMatrix();
RenderSystem.multMatrix(p_228345_1_.func_227866_c_().func_227870_a_()); RenderSystem.multMatrix(p_228345_1_.func_227866_c_().func_227870_a_());
- for(IParticleRenderType iparticlerendertype : field_215241_b) { - for(IParticleRenderType iparticlerendertype : field_215241_b) {
+ for(IParticleRenderType iparticlerendertype : this.field_78876_b.keySet()) { // Forge: allow custom IParticleRenderType's + for(IParticleRenderType iparticlerendertype : this.field_78876_b.keySet()) { // Forge: allow custom IParticleRenderType's
+ if (iparticlerendertype == IParticleRenderType.field_217606_f) continue; + if (iparticlerendertype == IParticleRenderType.field_217606_f) continue;
+ enable.run(); //Forge: MC-168672 Make sure all render types have the correct GL state.
Iterable<Particle> iterable = this.field_78876_b.get(iparticlerendertype); Iterable<Particle> iterable = this.field_78876_b.get(iparticlerendertype);
if (iterable != null) { if (iterable != null) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
@@ -351,7 +353,7 @@ @@ -351,7 +356,7 @@
} }
public void func_180533_a(BlockPos p_180533_1_, BlockState p_180533_2_) { public void func_180533_a(BlockPos p_180533_1_, BlockState p_180533_2_) {
@@ -58,7 +68,7 @@
VoxelShape voxelshape = p_180533_2_.func_196954_c(this.field_78878_a, p_180533_1_); VoxelShape voxelshape = p_180533_2_.func_196954_c(this.field_78878_a, p_180533_1_);
double d0 = 0.25D; double d0 = 0.25D;
voxelshape.func_197755_b((p_228348_3_, p_228348_5_, p_228348_7_, p_228348_9_, p_228348_11_, p_228348_13_) -> { voxelshape.func_197755_b((p_228348_3_, p_228348_5_, p_228348_7_, p_228348_9_, p_228348_11_, p_228348_13_) -> {
@@ -423,6 +425,12 @@ @@ -423,6 +428,12 @@
return String.valueOf(this.field_78876_b.values().stream().mapToInt(Collection::size).sum()); return String.valueOf(this.field_78876_b.values().stream().mapToInt(Collection::size).sum());
} }
@@ -6,10 +6,11 @@
+ @Deprecated //Forge: Model data argument + @Deprecated //Forge: Model data argument
public boolean func_228802_a_(ILightReader p_228802_1_, IBakedModel p_228802_2_, BlockState p_228802_3_, BlockPos p_228802_4_, MatrixStack p_228802_5_, IVertexBuilder p_228802_6_, boolean p_228802_7_, Random p_228802_8_, long p_228802_9_, int p_228802_11_) { public boolean func_228802_a_(ILightReader p_228802_1_, IBakedModel p_228802_2_, BlockState p_228802_3_, BlockPos p_228802_4_, MatrixStack p_228802_5_, IVertexBuilder p_228802_6_, boolean p_228802_7_, Random p_228802_8_, long p_228802_9_, int p_228802_11_) {
- boolean flag = Minecraft.func_71379_u() && p_228802_3_.func_185906_d() == 0 && p_228802_2_.func_177555_b();
+ return renderModel(p_228802_1_, p_228802_2_, p_228802_3_, p_228802_4_, p_228802_5_, p_228802_6_, p_228802_7_, p_228802_8_, p_228802_9_, p_228802_11_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE); + return renderModel(p_228802_1_, p_228802_2_, p_228802_3_, p_228802_4_, p_228802_5_, p_228802_6_, p_228802_7_, p_228802_8_, p_228802_9_, p_228802_11_, net.minecraftforge.client.model.data.EmptyModelData.INSTANCE);
+ } + }
+ public boolean renderModel(ILightReader p_228802_1_, IBakedModel p_228802_2_, BlockState p_228802_3_, BlockPos p_228802_4_, MatrixStack p_228802_5_, IVertexBuilder p_228802_6_, boolean p_228802_7_, Random p_228802_8_, long p_228802_9_, int p_228802_11_, net.minecraftforge.client.model.data.IModelData modelData) { + public boolean renderModel(ILightReader p_228802_1_, IBakedModel p_228802_2_, BlockState p_228802_3_, BlockPos p_228802_4_, MatrixStack p_228802_5_, IVertexBuilder p_228802_6_, boolean p_228802_7_, Random p_228802_8_, long p_228802_9_, int p_228802_11_, net.minecraftforge.client.model.data.IModelData modelData) {
boolean flag = Minecraft.func_71379_u() && p_228802_3_.func_185906_d() == 0 && p_228802_2_.func_177555_b(); + boolean flag = Minecraft.func_71379_u() && p_228802_3_.getLightValue(p_228802_1_, p_228802_4_) == 0 && p_228802_2_.func_177555_b();
Vec3d vec3d = p_228802_3_.func_191059_e(p_228802_1_, p_228802_4_); Vec3d vec3d = p_228802_3_.func_191059_e(p_228802_1_, p_228802_4_);
p_228802_5_.func_227861_a_(vec3d.field_72450_a, vec3d.field_72448_b, vec3d.field_72449_c); p_228802_5_.func_227861_a_(vec3d.field_72450_a, vec3d.field_72448_b, vec3d.field_72449_c);
+ modelData = p_228802_2_.getModelData(p_228802_1_, p_228802_4_, p_228802_3_, modelData); + modelData = p_228802_2_.getModelData(p_228802_1_, p_228802_4_, p_228802_3_, modelData);
@@ -79,7 +80,22 @@
if (!list1.isEmpty()) { if (!list1.isEmpty()) {
this.func_228798_a_(p_228806_1_, p_228806_3_, p_228806_4_, -1, p_228806_11_, true, p_228806_5_, p_228806_6_, list1, bitset); this.func_228798_a_(p_228806_1_, p_228806_3_, p_228806_4_, -1, p_228806_11_, true, p_228806_5_, p_228806_6_, list1, bitset);
flag = true; flag = true;
@@ -208,7 +222,11 @@ @@ -125,6 +139,14 @@
f1 = 1.0F;
f2 = 1.0F;
}
+ // FORGE: Apply diffuse lighting at render-time instead of baking it in
+ if (p_228800_6_.shouldApplyDiffuseLighting()) {
+ // TODO this should be handled by the forge lighting pipeline
+ float l = net.minecraftforge.client.model.pipeline.LightUtil.diffuseLight(p_228800_6_.func_178210_d());
+ f *= l;
+ f1 *= l;
+ f2 *= l;
+ }
p_228800_4_.func_227890_a_(p_228800_5_, p_228800_6_, new float[]{p_228800_7_, p_228800_8_, p_228800_9_, p_228800_10_}, f, f1, f2, new int[]{p_228800_11_, p_228800_12_, p_228800_13_, p_228800_14_}, p_228800_15_, true);
}
@@ -208,7 +230,11 @@
} }
@@ -9,36 +9,34 @@
for(Item item : Registry.field_212630_s) { for(Item item : Registry.field_212630_s) {
if (!field_195411_c.contains(item)) { if (!field_195411_c.contains(item)) {
@@ -70,6 +70,10 @@ @@ -91,7 +91,7 @@
}
private void func_229114_a_(IBakedModel p_229114_1_, ItemStack p_229114_2_, int p_229114_3_, int p_229114_4_, MatrixStack p_229114_5_, IVertexBuilder p_229114_6_) {
+ if (false && net.minecraftforge.common.ForgeConfig.CLIENT.allowEmissiveItems.get()) { //TODO: Find way to re-introduce emissive items.
+ net.minecraftforge.client.ForgeHooksClient.renderLitItem(this, p_229114_5_, p_229114_6_, p_229114_1_, p_229114_2_);
+ return;
+ }
Random random = new Random();
long i = 42L;
@@ -91,7 +95,7 @@
p_229111_8_ = this.field_175059_m.func_178083_a().func_174953_a(new ModelResourceLocation("minecraft:trident#inventory")); p_229111_8_ = this.field_175059_m.func_178083_a().func_174953_a(new ModelResourceLocation("minecraft:trident#inventory"));
} }
- p_229111_8_.func_177552_f().func_181688_b(p_229111_2_).func_228830_a_(p_229111_3_, p_229111_4_); - p_229111_8_.func_177552_f().func_181688_b(p_229111_2_).func_228830_a_(p_229111_3_, p_229111_4_);
+ net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_229111_4_, p_229111_8_, p_229111_2_, p_229111_3_); + p_229111_8_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_229111_4_, p_229111_8_, p_229111_2_, p_229111_3_);
p_229111_4_.func_227861_a_(-0.5D, -0.5D, -0.5D); p_229111_4_.func_227861_a_(-0.5D, -0.5D, -0.5D);
if (!p_229111_8_.func_188618_c() && (p_229111_1_.func_77973_b() != Items.field_203184_eO || flag1)) { if (!p_229111_8_.func_188618_c() && (p_229111_1_.func_77973_b() != Items.field_203184_eO || flag1)) {
RenderType rendertype = RenderTypeLookup.func_228389_a_(p_229111_1_); RenderType rendertype = RenderTypeLookup.func_228389_a_(p_229111_1_);
@@ -105,7 +109,7 @@ @@ -105,7 +105,7 @@
IVertexBuilder ivertexbuilder = func_229113_a_(p_229111_5_, rendertype1, true, p_229111_1_.func_77962_s()); IVertexBuilder ivertexbuilder = func_229113_a_(p_229111_5_, rendertype1, true, p_229111_1_.func_77962_s());
this.func_229114_a_(p_229111_8_, p_229111_1_, p_229111_6_, p_229111_7_, p_229111_4_, ivertexbuilder); this.func_229114_a_(p_229111_8_, p_229111_1_, p_229111_6_, p_229111_7_, p_229111_4_, ivertexbuilder);
} else { } else {
- ItemStackTileEntityRenderer.field_147719_a.func_228364_a_(p_229111_1_, p_229111_4_, p_229111_5_, p_229111_6_, p_229111_7_); - ItemStackTileEntityRenderer.field_147719_a.func_228364_a_(p_229111_1_, p_229111_4_, p_229111_5_, p_229111_6_, p_229111_7_);
+ p_229111_1_.func_77973_b().getTileEntityItemStackRenderer().func_228364_a_(p_229111_1_, p_229111_4_, p_229111_5_, p_229111_6_, p_229111_7_); + p_229111_1_.func_77973_b().getItemStackTileEntityRenderer().func_228364_a_(p_229111_1_, p_229111_4_, p_229111_5_, p_229111_6_, p_229111_7_);
} }
p_229111_4_.func_227865_b_(); p_229111_4_.func_227865_b_();
@@ -216,6 +220,7 @@ @@ -129,7 +129,7 @@
float f = (float)(i >> 16 & 255) / 255.0F;
float f1 = (float)(i >> 8 & 255) / 255.0F;
float f2 = (float)(i & 255) / 255.0F;
- p_229112_2_.func_227889_a_(matrixstack$entry, bakedquad, f, f1, f2, p_229112_5_, p_229112_6_);
+ p_229112_2_.addVertexData(matrixstack$entry, bakedquad, f, f1, f2, p_229112_5_, p_229112_6_, true);
}
}
@@ -215,6 +215,7 @@
crashreportcategory.func_189529_a("Item Type", () -> { crashreportcategory.func_189529_a("Item Type", () -> {
return String.valueOf((Object)p_184391_2_.func_77973_b()); return String.valueOf((Object)p_184391_2_.func_77973_b());
}); });
@@ -46,7 +44,7 @@
crashreportcategory.func_189529_a("Item Damage", () -> { crashreportcategory.func_189529_a("Item Damage", () -> {
return String.valueOf(p_184391_2_.func_77952_i()); return String.valueOf(p_184391_2_.func_77952_i());
}); });
@@ -247,18 +252,16 @@ @@ -246,18 +247,16 @@
irendertypebuffer$impl.func_228461_a_(); irendertypebuffer$impl.func_228461_a_();
} }
@@ -69,7 +67,7 @@
this.func_181565_a(bufferbuilder, p_180453_3_ + 2, p_180453_4_ + 13, 13, 2, 0, 0, 0, 255); this.func_181565_a(bufferbuilder, p_180453_3_ + 2, p_180453_4_ + 13, 13, 2, 0, 0, 0, 255);
this.func_181565_a(bufferbuilder, p_180453_3_ + 2, p_180453_4_ + 13, i, 1, j >> 16 & 255, j >> 8 & 255, j & 255, 255); this.func_181565_a(bufferbuilder, p_180453_3_ + 2, p_180453_4_ + 13, i, 1, j >> 16 & 255, j >> 8 & 255, j & 255, 255);
RenderSystem.enableBlend(); RenderSystem.enableBlend();
@@ -296,4 +299,9 @@ @@ -295,4 +294,9 @@
public void func_195410_a(IResourceManager p_195410_1_) { public void func_195410_a(IResourceManager p_195410_1_) {
this.field_175059_m.func_178085_b(); this.field_175059_m.func_178085_b();
} }
@@ -9,3 +9,12 @@
vector3f1.func_195901_a(0.0F, 1.0F); vector3f1.func_195901_a(0.0F, 1.0F);
if (f2 > 0.0F) { if (f2 > 0.0F) {
float f10 = Math.max(vector3f1.func_195899_a(), Math.max(vector3f1.func_195900_b(), vector3f1.func_195902_c())); float f10 = Math.max(vector3f1.func_195899_a(), Math.max(vector3f1.func_195900_b(), vector3f1.func_195902_c()));
@@ -169,7 +171,7 @@
}
public static int func_228450_a_(int p_228450_0_) {
- return p_228450_0_ >> 4 & '\uffff';
+ return (p_228450_0_ & 0xFFFF) >> 4; // Forge: Fix fullbright quads showing dark artifacts. Reported as MC-169806
}
public static int func_228454_b_(int p_228454_0_) {
@@ -46,8 +46,8 @@
+ // FORGE START + // FORGE START
+ +
+ private static final Map<Block, java.util.function.Predicate<RenderType>> blockRenderChecks = Maps.newHashMap(); + private static final Map<net.minecraftforge.registries.IRegistryDelegate<Block>, java.util.function.Predicate<RenderType>> blockRenderChecks = Maps.newHashMap();
+ private static final Map<Fluid, java.util.function.Predicate<RenderType>> fluidRenderChecks = Maps.newHashMap(); + private static final Map<net.minecraftforge.registries.IRegistryDelegate<Fluid>, java.util.function.Predicate<RenderType>> fluidRenderChecks = Maps.newHashMap();
+ static { + static {
+ field_228386_a_.forEach(RenderTypeLookup::setRenderLayer); + field_228386_a_.forEach(RenderTypeLookup::setRenderLayer);
+ field_228387_b_.forEach(RenderTypeLookup::setRenderLayer); + field_228387_b_.forEach(RenderTypeLookup::setRenderLayer);
@@ -60,7 +60,7 @@
+ } else { + } else {
+ java.util.function.Predicate<RenderType> rendertype; + java.util.function.Predicate<RenderType> rendertype;
+ synchronized (RenderTypeLookup.class) { + synchronized (RenderTypeLookup.class) {
+ rendertype = blockRenderChecks.get(block); + rendertype = blockRenderChecks.get(block.delegate);
+ } + }
+ return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_(); + return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_();
+ } + }
@@ -69,7 +69,7 @@
+ public static boolean canRenderInLayer(IFluidState fluid, RenderType type) { + public static boolean canRenderInLayer(IFluidState fluid, RenderType type) {
+ java.util.function.Predicate<RenderType> rendertype; + java.util.function.Predicate<RenderType> rendertype;
+ synchronized (RenderTypeLookup.class) { + synchronized (RenderTypeLookup.class) {
+ rendertype = fluidRenderChecks.get(fluid.func_206886_c()); + rendertype = fluidRenderChecks.get(fluid.func_206886_c().delegate);
+ } + }
+ return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_(); + return rendertype != null ? rendertype.test(type) : type == RenderType.func_228639_c_();
+ } + }
@@ -80,7 +80,7 @@
+ } + }
+ +
+ public static synchronized void setRenderLayer(Block block, java.util.function.Predicate<RenderType> predicate) { + public static synchronized void setRenderLayer(Block block, java.util.function.Predicate<RenderType> predicate) {
+ blockRenderChecks.put(block, predicate); + blockRenderChecks.put(block.delegate, predicate);
+ } + }
+ +
+ public static void setRenderLayer(Fluid fluid, RenderType type) { + public static void setRenderLayer(Fluid fluid, RenderType type) {
@@ -89,7 +89,7 @@
+ } + }
+ +
+ public static synchronized void setRenderLayer(Fluid fluid, java.util.function.Predicate<RenderType> predicate) { + public static synchronized void setRenderLayer(Fluid fluid, java.util.function.Predicate<RenderType> predicate) {
+ fluidRenderChecks.put(fluid, predicate); + fluidRenderChecks.put(fluid.delegate, predicate);
+ } + }
+ +
public static void func_228393_a_(boolean p_228393_0_) { public static void func_228393_a_(boolean p_228393_0_) {
@@ -96,6 +96,15 @@
this.field_72769_h.func_184156_a(p_180439_3_, soundtype.func_185845_c(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F, false); this.field_72769_h.func_184156_a(p_180439_3_, soundtype.func_185845_c(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F, false);
} }
@@ -2432,7 +2447,7 @@
} else {
int i = p_228420_0_.func_226658_a_(LightType.SKY, p_228420_2_);
int j = p_228420_0_.func_226658_a_(LightType.BLOCK, p_228420_2_);
- int k = p_228420_1_.func_185906_d();
+ int k = p_228420_1_.getLightValue(p_228420_0_, p_228420_2_);
if (j < k) {
j = k;
}
@@ -2445,6 +2460,11 @@ @@ -2445,6 +2460,11 @@
return this.field_175015_z; return this.field_175015_z;
} }
@@ -0,0 +1,15 @@
--- a/net/minecraft/client/renderer/entity/EntityRenderer.java
+++ b/net/minecraft/client/renderer/entity/EntityRenderer.java
@@ -54,8 +54,10 @@
}
public void func_225623_a_(T p_225623_1_, float p_225623_2_, float p_225623_3_, MatrixStack p_225623_4_, IRenderTypeBuffer p_225623_5_, int p_225623_6_) {
- if (this.func_177070_b(p_225623_1_)) {
- this.func_225629_a_(p_225623_1_, p_225623_1_.func_145748_c_().func_150254_d(), p_225623_4_, p_225623_5_, p_225623_6_);
+ net.minecraftforge.client.event.RenderNameplateEvent renderNameplateEvent = new net.minecraftforge.client.event.RenderNameplateEvent(p_225623_1_,p_225623_1_.func_145748_c_().func_150254_d(), p_225623_4_, p_225623_5_);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(renderNameplateEvent);
+ if (renderNameplateEvent.getResult() != net.minecraftforge.eventbus.api.Event.Result.DENY && (renderNameplateEvent.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || this.func_177070_b(p_225623_1_))) {
+ this.func_225629_a_(p_225623_1_, renderNameplateEvent.getContent(), p_225623_4_, p_225623_5_, p_225623_6_);
}
}
@@ -1,6 +1,23 @@
--- a/net/minecraft/client/renderer/entity/EntityRendererManager.java --- a/net/minecraft/client/renderer/entity/EntityRendererManager.java
+++ b/net/minecraft/client/renderer/entity/EntityRendererManager.java +++ b/net/minecraft/client/renderer/entity/EntityRendererManager.java
@@ -445,4 +445,8 @@ @@ -183,13 +183,15 @@
this.field_178637_m = new PlayerRenderer(this);
this.field_178636_l.put("default", this.field_178637_m);
this.field_178636_l.put("slim", new PlayerRenderer(this, true));
+ }
+ //FORGE: Validate the existence of a renderer for each entity type after modded entity renderers have been added
+ public void validateRendererExistence() {
for(EntityType<?> entitytype : Registry.field_212629_r) {
if (entitytype != EntityType.field_200729_aH && !this.field_78729_o.containsKey(entitytype)) {
throw new IllegalStateException("No renderer registered for " + Registry.field_212629_r.func_177774_c(entitytype));
}
}
-
}
public <T extends Entity> EntityRenderer<? super T> func_78713_a(T p_78713_1_) {
@@ -445,4 +447,8 @@
public FontRenderer func_78716_a() { public FontRenderer func_78716_a() {
return this.field_78736_p; return this.field_78736_p;
} }
@@ -23,7 +23,7 @@
p_225623_4_.func_227861_a_((double)f7, (double)f8, (double)f9); p_225623_4_.func_227861_a_((double)f7, (double)f8, (double)f9);
} }
@@ -75,18 +72,19 @@ @@ -75,18 +72,18 @@
float f11 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; float f11 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
float f13 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; float f13 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
float f10 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; float f10 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
@@ -37,9 +37,7 @@
} }
} }
- this.field_177080_a.func_229111_a_(itemstack, ItemCameraTransforms.TransformType.GROUND, false, p_225623_4_, p_225623_5_, p_225623_6_, OverlayTexture.field_229196_a_, ibakedmodel); this.field_177080_a.func_229111_a_(itemstack, ItemCameraTransforms.TransformType.GROUND, false, p_225623_4_, p_225623_5_, p_225623_6_, OverlayTexture.field_229196_a_, ibakedmodel);
+ IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_225623_4_, ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false);
+ this.field_177080_a.func_229111_a_(itemstack, ItemCameraTransforms.TransformType.GROUND, false, p_225623_4_, p_225623_5_, p_225623_6_, OverlayTexture.field_229196_a_, transformedModel);
p_225623_4_.func_227865_b_(); p_225623_4_.func_227865_b_();
if (!flag) { if (!flag) {
- p_225623_4_.func_227861_a_((double)(0.0F * f4), (double)(0.0F * f5), (double)(0.09375F * f6)); - p_225623_4_.func_227861_a_((double)(0.0F * f4), (double)(0.0F * f5), (double)(0.09375F * f6));
@@ -47,7 +45,7 @@
} }
} }
@@ -97,4 +95,21 @@ @@ -97,4 +94,21 @@
public ResourceLocation func_110775_a(ItemEntity p_110775_1_) { public ResourceLocation func_110775_a(ItemEntity p_110775_1_) {
return AtlasTexture.field_110575_b; return AtlasTexture.field_110575_b;
} }
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/entity/LivingRenderer.java --- a/net/minecraft/client/renderer/entity/LivingRenderer.java
+++ b/net/minecraft/client/renderer/entity/LivingRenderer.java +++ b/net/minecraft/client/renderer/entity/LivingRenderer.java
@@ -47,14 +47,17 @@ @@ -48,14 +48,17 @@
} }
public void func_225623_a_(T p_225623_1_, float p_225623_2_, float p_225623_3_, MatrixStack p_225623_4_, IRenderTypeBuffer p_225623_5_, int p_225623_6_) { public void func_225623_a_(T p_225623_1_, float p_225623_2_, float p_225623_3_, MatrixStack p_225623_4_, IRenderTypeBuffer p_225623_5_, int p_225623_6_) {
@@ -20,7 +20,7 @@
LivingEntity livingentity = (LivingEntity)p_225623_1_.func_184187_bx(); LivingEntity livingentity = (LivingEntity)p_225623_1_.func_184187_bx();
f = MathHelper.func_219805_h(p_225623_3_, livingentity.field_70760_ar, livingentity.field_70761_aq); f = MathHelper.func_219805_h(p_225623_3_, livingentity.field_70760_ar, livingentity.field_70761_aq);
f2 = f1 - f; f2 = f1 - f;
@@ -91,7 +94,7 @@ @@ -92,7 +95,7 @@
p_225623_4_.func_227861_a_(0.0D, (double)-1.501F, 0.0D); p_225623_4_.func_227861_a_(0.0D, (double)-1.501F, 0.0D);
float f8 = 0.0F; float f8 = 0.0F;
float f5 = 0.0F; float f5 = 0.0F;
@@ -29,11 +29,11 @@
f8 = MathHelper.func_219799_g(p_225623_3_, p_225623_1_.field_184618_aE, p_225623_1_.field_70721_aZ); f8 = MathHelper.func_219799_g(p_225623_3_, p_225623_1_.field_184618_aE, p_225623_1_.field_70721_aZ);
f5 = p_225623_1_.field_184619_aG - p_225623_1_.field_70721_aZ * (1.0F - p_225623_3_); f5 = p_225623_1_.field_184619_aG - p_225623_1_.field_70721_aZ * (1.0F - p_225623_3_);
if (p_225623_1_.func_70631_g_()) { if (p_225623_1_.func_70631_g_()) {
@@ -132,6 +135,7 @@ @@ -123,6 +126,7 @@
p_225623_4_.func_227865_b_(); p_225623_4_.func_227865_b_();
super.func_225623_a_(p_225623_1_, p_225623_2_, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_); super.func_225623_a_(p_225623_1_, p_225623_2_, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post<T, M>(p_225623_1_, this, p_225623_3_, p_225623_4_)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post<T, M>(p_225623_1_, this, p_225623_3_, p_225623_4_));
} }
public static int func_229117_c_(LivingEntity p_229117_0_, float p_229117_1_) { @Nullable
@@ -1,6 +1,13 @@
--- a/net/minecraft/client/renderer/model/BakedQuad.java --- a/net/minecraft/client/renderer/model/BakedQuad.java
+++ b/net/minecraft/client/renderer/model/BakedQuad.java +++ b/net/minecraft/client/renderer/model/BakedQuad.java
@@ -12,7 +12,17 @@ @@ -6,13 +6,22 @@
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
-public class BakedQuad {
+public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer {
protected final int[] field_178215_a;
protected final int field_178213_b;
protected final Direction field_178214_c; protected final Direction field_178214_c;
protected final TextureAtlasSprite field_187509_d; protected final TextureAtlasSprite field_187509_d;
@@ -9,25 +16,25 @@
+ */ + */
+ @Deprecated + @Deprecated
public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, Direction p_i46574_3_, TextureAtlasSprite p_i46574_4_) { public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, Direction p_i46574_3_, TextureAtlasSprite p_i46574_4_) {
+ this(p_i46574_1_, p_i46574_2_, p_i46574_3_, p_i46574_4_, true, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176600_a); + this(p_i46574_1_, p_i46574_2_, p_i46574_3_, p_i46574_4_, true);
+ } + }
+ +
+ public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, Direction p_i46574_3_, TextureAtlasSprite p_i46574_4_, boolean applyDiffuseLighting, net.minecraft.client.renderer.vertex.VertexFormat format) { + public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, Direction p_i46574_3_, TextureAtlasSprite p_i46574_4_, boolean applyDiffuseLighting) {
+ this.format = format;
+ this.applyDiffuseLighting = applyDiffuseLighting; + this.applyDiffuseLighting = applyDiffuseLighting;
this.field_178215_a = p_i46574_1_; this.field_178215_a = p_i46574_1_;
this.field_178213_b = p_i46574_2_; this.field_178213_b = p_i46574_2_;
this.field_178214_c = p_i46574_3_; this.field_178214_c = p_i46574_3_;
@@ -34,4 +44,19 @@ @@ -34,4 +43,20 @@
public Direction func_178210_d() { public Direction func_178210_d() {
return this.field_178214_c; return this.field_178214_c;
} }
+ +
+ protected final net.minecraft.client.renderer.vertex.VertexFormat format; + // Forge start
+ protected final boolean applyDiffuseLighting; + protected final boolean applyDiffuseLighting;
+ +
+ public net.minecraft.client.renderer.vertex.VertexFormat getFormat() { + @Override
+ return format; + public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) {
+ net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this);
+ } + }
+ +
+ public TextureAtlasSprite func_187508_a() { + public TextureAtlasSprite func_187508_a() {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/model/BlockModel.java --- a/net/minecraft/client/renderer/model/BlockModel.java
+++ b/net/minecraft/client/renderer/model/BlockModel.java +++ b/net/minecraft/client/renderer/model/BlockModel.java
@@ -56,9 +56,10 @@ @@ -57,9 +57,10 @@
public BlockModel field_178315_d; public BlockModel field_178315_d;
@Nullable @Nullable
protected ResourceLocation field_178316_e; protected ResourceLocation field_178316_e;
@@ -12,8 +12,8 @@
} }
public static BlockModel func_178294_a(String p_178294_0_) { public static BlockModel func_178294_a(String p_178294_0_) {
@@ -75,10 +76,15 @@ @@ -76,10 +77,15 @@
this.field_187968_k = p_i46573_7_; this.field_187968_k = p_i230056_7_;
} }
+ @Deprecated + @Deprecated
@@ -28,7 +28,7 @@
public boolean func_178309_b() { public boolean func_178309_b() {
return this.field_178315_d != null ? this.field_178315_d.func_178309_b() : this.field_178322_i; return this.field_178315_d != null ? this.field_178315_d.func_178309_b() : this.field_178322_i;
} }
@@ -95,6 +101,10 @@ @@ -100,6 +106,10 @@
return this.field_187968_k.isEmpty() ? ItemOverrideList.field_188022_a : new ItemOverrideList(p_217646_1_, p_217646_2_, p_217646_1_::func_209597_a, this.field_187968_k); return this.field_187968_k.isEmpty() ? ItemOverrideList.field_188022_a : new ItemOverrideList(p_217646_1_, p_217646_2_, p_217646_1_::func_209597_a, this.field_187968_k);
} }
@@ -39,7 +39,7 @@
public Collection<ResourceLocation> func_187965_e() { public Collection<ResourceLocation> func_187965_e() {
Set<ResourceLocation> set = Sets.newHashSet(); Set<ResourceLocation> set = Sets.newHashSet();
@@ -138,6 +148,9 @@ @@ -143,6 +153,9 @@
Set<Material> set1 = Sets.newHashSet(this.func_228816_c_("particle")); Set<Material> set1 = Sets.newHashSet(this.func_228816_c_("particle"));
@@ -49,20 +49,25 @@
for(BlockPart blockpart : this.func_178298_a()) { for(BlockPart blockpart : this.func_178298_a()) {
for(BlockPartFace blockpartface : blockpart.field_178240_c.values()) { for(BlockPartFace blockpartface : blockpart.field_178240_c.values()) {
Material material = this.func_228816_c_(blockpartface.field_178242_d); Material material = this.func_228816_c_(blockpartface.field_178242_d);
@@ -168,7 +181,11 @@ @@ -169,11 +182,17 @@
return this.func_228813_a_(p_225613_1_, this, p_225613_2_, p_225613_3_, p_225613_4_); return set1;
} }
- public IBakedModel func_228813_a_(ModelBakery p_228813_1_, BlockModel p_228813_2_, Function<Material, TextureAtlasSprite> p_228813_3_, IModelTransform p_228813_4_, ResourceLocation p_228813_5_) { + @Deprecated //Forge: Use Boolean variant
+ public IBakedModel func_228813_a_(ModelBakery p_228813_1_, BlockModel p_228813_2_, Function<Material, TextureAtlasSprite> p_228813_3_, IModelTransform p_228813_4_, ResourceLocation p_228813_5_) public IBakedModel func_225613_a_(ModelBakery p_225613_1_, Function<Material, TextureAtlasSprite> p_225613_2_, IModelTransform p_225613_3_, ResourceLocation p_225613_4_) {
+ { return this.func_228813_a_(p_225613_1_, this, p_225613_2_, p_225613_3_, p_225613_4_, true);
+ return net.minecraftforge.client.model.ModelLoaderRegistry.bakeHelper(this, p_228813_1_, p_228813_2_, p_228813_3_, p_228813_4_, p_228813_5_); }
public IBakedModel func_228813_a_(ModelBakery p_228813_1_, BlockModel p_228813_2_, Function<Material, TextureAtlasSprite> p_228813_3_, IModelTransform p_228813_4_, ResourceLocation p_228813_5_, boolean p_228813_6_) {
+ return net.minecraftforge.client.model.ModelLoaderRegistry.bakeHelper(this, p_228813_1_, p_228813_2_, p_228813_3_, p_228813_4_, p_228813_5_, p_228813_6_);
+ } + }
+ public IBakedModel bakeVanilla(ModelBakery p_228813_1_, BlockModel p_228813_2_, Function<Material, TextureAtlasSprite> p_228813_3_, IModelTransform p_228813_4_, ResourceLocation p_228813_5_) { +
+ @Deprecated //Forge: exposed for our callbacks only. Use the above function.
+ public IBakedModel bakeVanilla(ModelBakery p_228813_1_, BlockModel p_228813_2_, Function<Material, TextureAtlasSprite> p_228813_3_, IModelTransform p_228813_4_, ResourceLocation p_228813_5_, boolean p_228813_6_) {
TextureAtlasSprite textureatlassprite = p_228813_3_.apply(this.func_228816_c_("particle")); TextureAtlasSprite textureatlassprite = p_228813_3_.apply(this.func_228816_c_("particle"));
if (this.func_178310_f() == ModelBakery.field_177616_r) { if (this.func_178310_f() == ModelBakery.field_177616_r) {
return new BuiltInModel(this.func_181682_g(), this.func_217646_a(p_228813_1_, p_228813_2_), textureatlassprite); return new BuiltInModel(this.func_181682_g(), this.func_217646_a(p_228813_1_, p_228813_2_), textureatlassprite, this.func_230176_c_().func_230178_a_());
@@ -195,6 +212,10 @@ @@ -200,6 +219,10 @@
return field_217647_g.func_228824_a_(p_228812_0_.field_178241_a, p_228812_0_.field_178239_b, p_228812_1_, p_228812_2_, p_228812_3_, p_228812_4_, p_228812_0_.field_178237_d, p_228812_0_.field_178238_e, p_228812_5_); return field_217647_g.func_228824_a_(p_228812_0_.field_178241_a, p_228812_0_.field_178239_b, p_228812_1_, p_228812_2_, p_228812_3_, p_228812_4_, p_228812_0_.field_178237_d, p_228812_0_.field_178238_e, p_228812_5_);
} }
@@ -1,28 +1,30 @@
--- a/net/minecraft/client/renderer/model/FaceBakery.java --- a/net/minecraft/client/renderer/model/FaceBakery.java
+++ b/net/minecraft/client/renderer/model/FaceBakery.java +++ b/net/minecraft/client/renderer/model/FaceBakery.java
@@ -24,7 +24,7 @@ @@ -36,14 +36,16 @@
public BakedQuad func_228824_a_(Vector3f p_228824_1_, Vector3f p_228824_2_, BlockPartFace p_228824_3_, TextureAtlasSprite p_228824_4_, Direction p_228824_5_, IModelTransform p_228824_6_, @Nullable BlockPartRotation p_228824_7_, boolean p_228824_8_, ResourceLocation p_228824_9_) { blockfaceuv.field_178351_a[2] = MathHelper.func_219799_g(f, blockfaceuv.field_178351_a[2], f1);
BlockFaceUV blockfaceuv = p_228824_3_.field_178243_e; blockfaceuv.field_178351_a[1] = MathHelper.func_219799_g(f, blockfaceuv.field_178351_a[1], f2);
if (p_228824_6_.func_188049_c()) { blockfaceuv.field_178351_a[3] = MathHelper.func_219799_g(f, blockfaceuv.field_178351_a[3], f2);
- blockfaceuv = func_228821_a_(p_228824_3_.field_178243_e, p_228824_5_, p_228824_6_.func_225615_b_(), p_228824_9_); - int[] aint = this.func_228820_a_(blockfaceuv, p_228824_4_, p_228824_5_, this.func_199337_a(p_228824_1_, p_228824_2_), p_228824_6_.func_225615_b_(), p_228824_7_, p_228824_8_);
+ blockfaceuv = net.minecraftforge.client.ForgeHooksClient.applyUVLock(p_228824_3_.field_178243_e, p_228824_5_, p_228824_6_.func_225615_b_(), p_228824_9_); + // FORGE: Apply diffuse lighting at render-time instead of baking it in
} + int[] aint = this.func_228820_a_(blockfaceuv, p_228824_4_, p_228824_5_, this.func_199337_a(p_228824_1_, p_228824_2_), p_228824_6_.func_225615_b_(), p_228824_7_, false);
Direction direction = func_178410_a(aint);
float[] afloat = new float[blockfaceuv.field_178351_a.length]; System.arraycopy(afloat, 0, blockfaceuv.field_178351_a, 0, afloat.length);
@@ -43,7 +43,8 @@ if (p_228824_7_ == null) {
this.func_178408_a(aint, direction); this.func_178408_a(aint, direction);
} }
- return new BakedQuad(aint, p_228824_3_.field_178245_c, direction, p_228824_4_); - return new BakedQuad(aint, p_228824_3_.field_178245_c, direction, p_228824_4_);
+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, direction); + net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, direction);
+ return new BakedQuad(aint, p_228824_3_.field_178245_c, direction, p_228824_4_, p_228824_8_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176600_a); + return new BakedQuad(aint, p_228824_3_.field_178245_c, direction, p_228824_4_, p_228824_8_);
} }
public static BlockFaceUV func_228821_a_(BlockFaceUV p_228821_0_, Direction p_228821_1_, TransformationMatrix p_228821_2_, ResourceLocation p_228821_3_) { public static BlockFaceUV func_228821_a_(BlockFaceUV p_228821_0_, Direction p_228821_1_, TransformationMatrix p_228821_2_, ResourceLocation p_228821_3_) {
@@ -152,6 +153,8 @@ @@ -150,8 +152,8 @@
p_228826_1_[i + 1] = Float.floatToRawIntBits(p_228826_3_.func_195900_b());
p_228826_1_[i + 2] = Float.floatToRawIntBits(p_228826_3_.func_195902_c());
p_228826_1_[i + 3] = p_228826_4_; p_228826_1_[i + 3] = p_228826_4_;
p_228826_1_[i + 4] = Float.floatToRawIntBits(p_228826_5_.func_94214_a((double)p_228826_6_.func_178348_a(p_228826_2_))); - p_228826_1_[i + 4] = Float.floatToRawIntBits(p_228826_5_.func_94214_a((double)p_228826_6_.func_178348_a(p_228826_2_)));
p_228826_1_[i + 4 + 1] = Float.floatToRawIntBits(p_228826_5_.func_94207_b((double)p_228826_6_.func_178346_b(p_228826_2_))); - p_228826_1_[i + 4 + 1] = Float.floatToRawIntBits(p_228826_5_.func_94207_b((double)p_228826_6_.func_178346_b(p_228826_2_)));
+ p_228826_1_[i + 4] = Float.floatToRawIntBits(p_228826_5_.func_94214_a((double)p_228826_6_.func_178348_a(p_228826_2_) * .999 + p_228826_6_.func_178348_a((p_228826_2_ + 2) % 4) * .001)); + p_228826_1_[i + 4] = Float.floatToRawIntBits(p_228826_5_.func_94214_a((double)p_228826_6_.func_178348_a(p_228826_2_) * .999 + p_228826_6_.func_178348_a((p_228826_2_ + 2) % 4) * .001));
+ p_228826_1_[i + 4 + 1] = Float.floatToRawIntBits(p_228826_5_.func_94207_b((double)p_228826_6_.func_178346_b(p_228826_2_) * .999 + p_228826_6_.func_178346_b((p_228826_2_ + 2) % 4) * .001)); + p_228826_1_[i + 4 + 1] = Float.floatToRawIntBits(p_228826_5_.func_94207_b((double)p_228826_6_.func_178346_b(p_228826_2_) * .999 + p_228826_6_.func_178346_b((p_228826_2_ + 2) % 4) * .001));
} }
@@ -11,7 +11,7 @@
List<BakedQuad> func_200117_a(@Nullable BlockState p_200117_1_, @Nullable Direction p_200117_2_, Random p_200117_3_); List<BakedQuad> func_200117_a(@Nullable BlockState p_200117_1_, @Nullable Direction p_200117_2_, Random p_200117_3_);
boolean func_177555_b(); boolean func_177555_b();
@@ -19,9 +21,12 @@ @@ -21,9 +23,12 @@
boolean func_188618_c(); boolean func_188618_c();
@@ -0,0 +1,10 @@
--- a/net/minecraft/client/renderer/model/ItemModelGenerator.java
+++ b/net/minecraft/client/renderer/model/ItemModelGenerator.java
@@ -36,6 +36,7 @@
map.put("particle", p_209579_2_.func_178300_b("particle") ? Either.left(p_209579_2_.func_228816_c_("particle")) : map.get("layer0"));
BlockModel blockmodel = new BlockModel((ResourceLocation)null, list, map, false, p_209579_2_.func_230176_c_(), p_209579_2_.func_181682_g(), p_209579_2_.func_187966_f());
blockmodel.field_178317_b = p_209579_2_.field_178317_b;
+ blockmodel.customData.copyFrom(p_209579_2_.customData);
return blockmodel;
}
@@ -46,7 +46,7 @@
field_177603_c.warn("Unable to bake model: '{}': {}", p_229350_1_, exception); field_177603_c.warn("Unable to bake model: '{}': {}", p_229350_1_, exception);
} }
@@ -447,6 +462,13 @@ @@ -443,6 +458,13 @@
this.field_217848_D.addAll(p_209593_2_.func_187965_e()); this.field_217848_D.addAll(p_209593_2_.func_187965_e());
} }
@@ -60,7 +60,7 @@
private void func_217843_a(ModelResourceLocation p_217843_1_) { private void func_217843_a(ModelResourceLocation p_217843_1_) {
IUnbakedModel iunbakedmodel = this.func_209597_a(p_217843_1_); IUnbakedModel iunbakedmodel = this.func_209597_a(p_217843_1_);
this.field_217849_F.put(p_217843_1_, iunbakedmodel); this.field_217849_F.put(p_217843_1_, iunbakedmodel);
@@ -461,7 +483,13 @@ @@ -457,7 +479,13 @@
} }
@Nullable @Nullable
@@ -74,12 +74,12 @@
Triple<ResourceLocation, TransformationMatrix, Boolean> triple = Triple.of(p_217845_1_, p_217845_2_.func_225615_b_(), p_217845_2_.func_188049_c()); Triple<ResourceLocation, TransformationMatrix, Boolean> triple = Triple.of(p_217845_1_, p_217845_2_.func_225615_b_(), p_217845_2_.func_188049_c());
if (this.field_217850_G.containsKey(triple)) { if (this.field_217850_G.containsKey(triple)) {
return this.field_217850_G.get(triple); return this.field_217850_G.get(triple);
@@ -472,11 +500,11 @@ @@ -468,11 +496,11 @@
if (iunbakedmodel instanceof BlockModel) { if (iunbakedmodel instanceof BlockModel) {
BlockModel blockmodel = (BlockModel)iunbakedmodel; BlockModel blockmodel = (BlockModel)iunbakedmodel;
if (blockmodel.func_178310_f() == field_177606_o) { if (blockmodel.func_178310_f() == field_177606_o) {
- return field_217854_z.func_209579_a(this.field_229322_z_::func_229151_a_, blockmodel).func_228813_a_(this, blockmodel, this.field_229322_z_::func_229151_a_, p_217845_2_, p_217845_1_); - return field_217854_z.func_209579_a(this.field_229322_z_::func_229151_a_, blockmodel).func_228813_a_(this, blockmodel, this.field_229322_z_::func_229151_a_, p_217845_2_, p_217845_1_, false);
+ return field_217854_z.func_209579_a(textureGetter, blockmodel).func_228813_a_(this, blockmodel, textureGetter, p_217845_2_, p_217845_1_); + return field_217854_z.func_209579_a(textureGetter, blockmodel).func_228813_a_(this, blockmodel, this.field_229322_z_::func_229151_a_, p_217845_2_, p_217845_1_, false);
} }
} }
@@ -88,7 +88,7 @@
this.field_217850_G.put(triple, ibakedmodel); this.field_217850_G.put(triple, ibakedmodel);
return ibakedmodel; return ibakedmodel;
} }
@@ -530,6 +558,10 @@ @@ -526,6 +554,10 @@
return this.field_225367_M; return this.field_225367_M;
} }
@@ -99,7 +99,7 @@
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
static class BlockStateDefinitionException extends RuntimeException { static class BlockStateDefinitionException extends RuntimeException {
public BlockStateDefinitionException(String p_i49526_1_) { public BlockStateDefinitionException(String p_i49526_1_) {
@@ -537,6 +569,10 @@ @@ -533,6 +565,10 @@
} }
} }
@@ -29,7 +29,7 @@
p_212854_2_.func_219897_b(); p_212854_2_.func_219897_b();
return modelbakery; return modelbakery;
} }
@@ -60,6 +64,7 @@ @@ -64,6 +68,7 @@
this.field_174958_a = p_212853_1_.func_217846_a(); this.field_174958_a = p_212853_1_.func_217846_a();
this.field_224744_f = p_212853_1_.func_225354_b(); this.field_224744_f = p_212853_1_.func_225354_b();
this.field_174955_d = this.field_174958_a.get(ModelBakery.field_177604_a); this.field_174955_d = this.field_174958_a.get(ModelBakery.field_177604_a);
@@ -37,7 +37,7 @@
p_212853_3_.func_219895_b("cache"); p_212853_3_.func_219895_b("cache");
this.field_174957_c.func_178124_c(); this.field_174957_c.func_178124_c();
p_212853_3_.func_76319_b(); p_212853_3_.func_76319_b();
@@ -85,6 +90,7 @@ @@ -89,6 +94,7 @@
} }
public AtlasTexture func_229356_a_(ResourceLocation p_229356_1_) { public AtlasTexture func_229356_a_(ResourceLocation p_229356_1_) {
@@ -45,7 +45,7 @@
return this.field_229352_b_.func_229152_a_(p_229356_1_); return this.field_229352_b_.func_229152_a_(p_229356_1_);
} }
@@ -95,4 +101,10 @@ @@ -99,4 +105,10 @@
public void func_229355_a_(int p_229355_1_) { public void func_229355_a_(int p_229355_1_) {
this.field_229354_f_ = p_229355_1_; this.field_229354_f_ = p_229355_1_;
} }
@@ -1,13 +1,13 @@
--- a/net/minecraft/client/renderer/model/SimpleBakedModel.java --- a/net/minecraft/client/renderer/model/SimpleBakedModel.java
+++ b/net/minecraft/client/renderer/model/SimpleBakedModel.java +++ b/net/minecraft/client/renderer/model/SimpleBakedModel.java
@@ -74,6 +74,10 @@ @@ -77,6 +77,10 @@
this(p_i46988_1_.func_178309_b(), p_i46988_1_.func_178311_c(), p_i46988_1_.func_181682_g(), p_i46988_2_); private final boolean field_177653_e;
} private final ItemCameraTransforms field_177651_f;
+ public Builder(net.minecraftforge.client.model.IModelConfiguration model, ItemOverrideList overrides) { + public Builder(net.minecraftforge.client.model.IModelConfiguration model, ItemOverrideList overrides) {
+ this(model.useSmoothLighting(), model.isShadedInGui(), model.getCameraTransforms(), overrides); + this(model.useSmoothLighting(), model.isShadedInGui(), true/*TODO: Forge*/, model.getCameraTransforms(), overrides);
+ } + }
+ +
private Builder(boolean p_i46990_1_, boolean p_i46990_2_, ItemCameraTransforms p_i46990_3_, ItemOverrideList p_i46990_4_) { public Builder(BlockModel p_i230060_1_, ItemOverrideList p_i230060_2_, boolean p_i230060_3_) {
for(Direction direction : Direction.values()) { this(p_i230060_1_.func_178309_b(), p_i230060_1_.func_230176_c_().func_230178_a_(), p_i230060_3_, p_i230060_1_.func_181682_g(), p_i230060_2_);
this.field_177654_b.put(direction, Lists.newArrayList()); }
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/texture/NativeImage.java --- a/net/minecraft/client/renderer/texture/NativeImage.java
+++ b/net/minecraft/client/renderer/texture/NativeImage.java +++ b/net/minecraft/client/renderer/texture/NativeImage.java
@@ -178,7 +178,7 @@ @@ -179,7 +179,7 @@
public int func_195709_a(int p_195709_1_, int p_195709_2_) { public int func_195709_a(int p_195709_1_, int p_195709_2_) {
if (this.field_211680_b != NativeImage.PixelFormat.RGBA) { if (this.field_211680_b != NativeImage.PixelFormat.RGBA) {
throw new IllegalArgumentException(String.format("getPixelRGBA only works on RGBA images; have %s", this.field_211680_b)); throw new IllegalArgumentException(String.format("getPixelRGBA only works on RGBA images; have %s", this.field_211680_b));
@@ -9,7 +9,7 @@
this.func_195696_g(); this.func_195696_g();
long i = (long)((p_195709_1_ + p_195709_2_ * this.field_195719_a) * 4); long i = (long)((p_195709_1_ + p_195709_2_ * this.field_195719_a) * 4);
return MemoryUtil.memGetInt(this.field_195722_d + i); return MemoryUtil.memGetInt(this.field_195722_d + i);
@@ -190,7 +190,7 @@ @@ -191,7 +191,7 @@
public void func_195700_a(int p_195700_1_, int p_195700_2_, int p_195700_3_) { public void func_195700_a(int p_195700_1_, int p_195700_2_, int p_195700_3_) {
if (this.field_211680_b != NativeImage.PixelFormat.RGBA) { if (this.field_211680_b != NativeImage.PixelFormat.RGBA) {
throw new IllegalArgumentException(String.format("getPixelRGBA only works on RGBA images; have %s", this.field_211680_b)); throw new IllegalArgumentException(String.format("getPixelRGBA only works on RGBA images; have %s", this.field_211680_b));
@@ -18,7 +18,7 @@
this.func_195696_g(); this.func_195696_g();
long i = (long)((p_195700_1_ + p_195700_2_ * this.field_195719_a) * 4); long i = (long)((p_195700_1_ + p_195700_2_ * this.field_195719_a) * 4);
MemoryUtil.memPutInt(this.field_195722_d + i, p_195700_3_); MemoryUtil.memPutInt(this.field_195722_d + i, p_195700_3_);
@@ -202,7 +202,7 @@ @@ -203,7 +203,7 @@
public byte func_211675_e(int p_211675_1_, int p_211675_2_) { public byte func_211675_e(int p_211675_1_, int p_211675_2_) {
if (!this.field_211680_b.func_211653_r()) { if (!this.field_211680_b.func_211653_r()) {
throw new IllegalArgumentException(String.format("no luminance or alpha in %s", this.field_211680_b)); throw new IllegalArgumentException(String.format("no luminance or alpha in %s", this.field_211680_b));
@@ -27,12 +27,3 @@
int i = (p_211675_1_ + p_211675_2_ * this.field_195719_a) * this.field_211680_b.func_211651_a() + this.field_211680_b.func_211647_v() / 8; int i = (p_211675_1_ + p_211675_2_ * this.field_195719_a) * this.field_211680_b.func_211651_a() + this.field_211680_b.func_211647_v() / 8;
return MemoryUtil.memGetByte(this.field_195722_d + (long)i); return MemoryUtil.memGetByte(this.field_195722_d + (long)i);
} else { } else {
@@ -336,7 +336,7 @@
}
public void func_211676_a(STBTTFontinfo p_211676_1_, int p_211676_2_, int p_211676_3_, int p_211676_4_, float p_211676_5_, float p_211676_6_, float p_211676_7_, float p_211676_8_, int p_211676_9_, int p_211676_10_) {
- if (p_211676_9_ >= 0 && p_211676_9_ + p_211676_3_ <= this.func_195702_a() && p_211676_10_ >= 0 && p_211676_10_ + p_211676_4_ <= this.func_195714_b()) {
+ if (p_211676_9_ >= 0 && p_211676_9_ + p_211676_3_ < this.func_195702_a() && p_211676_10_ >= 0 && p_211676_10_ + p_211676_4_ < this.func_195714_b()) { //Fix MC-162953 bounds checks in `NativeImage`
if (this.field_211680_b.func_211651_a() != 1) {
throw new IllegalArgumentException("Can only write fonts into 1-component images.");
} else {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/texture/TextureManager.java --- a/net/minecraft/client/renderer/texture/TextureManager.java
+++ b/net/minecraft/client/renderer/texture/TextureManager.java +++ b/net/minecraft/client/renderer/texture/TextureManager.java
@@ -140,6 +140,7 @@ @@ -145,6 +145,7 @@
public void func_147645_c(ResourceLocation p_147645_1_) { public void func_147645_c(ResourceLocation p_147645_1_) {
Texture texture = this.func_229267_b_(p_147645_1_); Texture texture = this.func_229267_b_(p_147645_1_);
if (texture != null) { if (texture != null) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java --- a/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java
+++ b/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java +++ b/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java
@@ -141,4 +141,9 @@ @@ -134,4 +134,9 @@
public FontRenderer func_147548_a() { public FontRenderer func_147548_a() {
return this.field_147557_n; return this.field_147557_n;
} }
@@ -10,5 +10,5 @@
+ public boolean hasPosition() { return field_177355_b.stream().anyMatch(e -> e.func_177374_g()); } + public boolean hasPosition() { return field_177355_b.stream().anyMatch(e -> e.func_177374_g()); }
+ public boolean hasNormal() { return field_177355_b.stream().anyMatch(e -> e.func_177375_c() == VertexFormatElement.Usage.NORMAL); } + public boolean hasNormal() { return field_177355_b.stream().anyMatch(e -> e.func_177375_c() == VertexFormatElement.Usage.NORMAL); }
+ public boolean hasColor() { return field_177355_b.stream().anyMatch(e -> e.func_177375_c() == VertexFormatElement.Usage.COLOR); } + public boolean hasColor() { return field_177355_b.stream().anyMatch(e -> e.func_177375_c() == VertexFormatElement.Usage.COLOR); }
+ public boolean hasUV(int which) { return field_177355_b.stream().anyMatch(e -> e.func_177375_c() == VertexFormatElement.Usage.COLOR && e.func_177369_e() == which); } + public boolean hasUV(int which) { return field_177355_b.stream().anyMatch(e -> e.func_177375_c() == VertexFormatElement.Usage.UV && e.func_177369_e() == which); }
} }
@@ -53,16 +53,16 @@
for(int i = 0; i < 20; ++i) { for(int i = 0; i < 20; ++i) {
double d0 = this.field_70146_Z.nextGaussian() * 0.02D; double d0 = this.field_70146_Z.nextGaussian() * 0.02D;
@@ -571,7 +580,7 @@ @@ -573,7 +582,7 @@
Effect effect = iterator.next(); if (!effectinstance.func_76455_a(this, () -> {
EffectInstance effectinstance = this.field_70713_bf.get(effect); this.func_70695_b(effectinstance, true);
if (!effectinstance.func_76455_a(this)) { })) {
- if (!this.field_70170_p.field_72995_K) { - if (!this.field_70170_p.field_72995_K) {
+ if (!this.field_70170_p.field_72995_K && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionExpiryEvent(this, effectinstance))) { + if (!this.field_70170_p.field_72995_K && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.PotionEvent.PotionExpiryEvent(this, effectinstance))) {
iterator.remove(); iterator.remove();
this.func_70688_c(effectinstance); this.func_70688_c(effectinstance);
} }
@@ -621,8 +630,10 @@ @@ -623,8 +632,10 @@
this.func_82142_c(false); this.func_82142_c(false);
} else { } else {
Collection<EffectInstance> collection = this.field_70713_bf.values(); Collection<EffectInstance> collection = this.field_70713_bf.values();
@@ -75,7 +75,7 @@
this.func_82142_c(this.func_70644_a(Effects.field_76441_p)); this.func_82142_c(this.func_70644_a(Effects.field_76441_p));
} }
@@ -686,7 +697,9 @@ @@ -688,7 +699,9 @@
boolean flag; boolean flag;
for(flag = false; iterator.hasNext(); flag = true) { for(flag = false; iterator.hasNext(); flag = true) {
@@ -86,7 +86,7 @@
iterator.remove(); iterator.remove();
} }
@@ -716,6 +729,7 @@ @@ -718,6 +731,7 @@
return false; return false;
} else { } else {
EffectInstance effectinstance = this.field_70713_bf.get(p_195064_1_.func_188419_a()); EffectInstance effectinstance = this.field_70713_bf.get(p_195064_1_.func_188419_a());
@@ -94,7 +94,7 @@
if (effectinstance == null) { if (effectinstance == null) {
this.field_70713_bf.put(p_195064_1_.func_188419_a(), p_195064_1_); this.field_70713_bf.put(p_195064_1_.func_188419_a(), p_195064_1_);
this.func_70670_a(p_195064_1_); this.func_70670_a(p_195064_1_);
@@ -730,6 +744,9 @@ @@ -732,6 +746,9 @@
} }
public boolean func_70687_e(EffectInstance p_70687_1_) { public boolean func_70687_e(EffectInstance p_70687_1_) {
@@ -104,7 +104,7 @@
if (this.func_70668_bt() == CreatureAttribute.field_223223_b_) { if (this.func_70668_bt() == CreatureAttribute.field_223223_b_) {
Effect effect = p_70687_1_.func_188419_a(); Effect effect = p_70687_1_.func_188419_a();
if (effect == Effects.field_76428_l || effect == Effects.field_76436_u) { if (effect == Effects.field_76428_l || effect == Effects.field_76436_u) {
@@ -750,6 +767,7 @@ @@ -752,6 +769,7 @@
} }
public boolean func_195063_d(Effect p_195063_1_) { public boolean func_195063_d(Effect p_195063_1_) {
@@ -112,7 +112,7 @@
EffectInstance effectinstance = this.func_184596_c(p_195063_1_); EffectInstance effectinstance = this.func_184596_c(p_195063_1_);
if (effectinstance != null) { if (effectinstance != null) {
this.func_70688_c(effectinstance); this.func_70688_c(effectinstance);
@@ -786,6 +804,8 @@ @@ -788,6 +806,8 @@
} }
public void func_70691_i(float p_70691_1_) { public void func_70691_i(float p_70691_1_) {
@@ -121,7 +121,7 @@
float f = this.func_110143_aJ(); float f = this.func_110143_aJ();
if (f > 0.0F) { if (f > 0.0F) {
this.func_70606_j(f + p_70691_1_); this.func_70606_j(f + p_70691_1_);
@@ -802,6 +822,7 @@ @@ -804,6 +824,7 @@
} }
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) {
@@ -129,7 +129,7 @@
if (this.func_180431_b(p_70097_1_)) { if (this.func_180431_b(p_70097_1_)) {
return false; return false;
} else if (this.field_70170_p.field_72995_K) { } else if (this.field_70170_p.field_72995_K) {
@@ -868,8 +889,8 @@ @@ -870,8 +891,8 @@
if (entity1 instanceof PlayerEntity) { if (entity1 instanceof PlayerEntity) {
this.field_70718_bc = 100; this.field_70718_bc = 100;
this.field_70717_bb = (PlayerEntity)entity1; this.field_70717_bb = (PlayerEntity)entity1;
@@ -140,15 +140,15 @@
if (wolfentity.func_70909_n()) { if (wolfentity.func_70909_n()) {
this.field_70718_bc = 100; this.field_70718_bc = 100;
LivingEntity livingentity = wolfentity.func_70902_q(); LivingEntity livingentity = wolfentity.func_70902_q();
@@ -1051,6 +1072,7 @@ @@ -1053,6 +1074,7 @@
} }
public void func_70645_a(DamageSource p_70645_1_) { public void func_70645_a(DamageSource p_70645_1_) {
+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; + if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return;
if (!this.field_70729_aU) { if (!this.field_70128_L && !this.field_70729_aU) {
Entity entity = p_70645_1_.func_76346_g(); Entity entity = p_70645_1_.func_76346_g();
LivingEntity livingentity = this.func_94060_bK(); LivingEntity livingentity = this.func_94060_bK();
@@ -1082,10 +1104,10 @@ @@ -1084,10 +1106,10 @@
if (!this.field_70170_p.field_72995_K) { if (!this.field_70170_p.field_72995_K) {
boolean flag = false; boolean flag = false;
if (p_226298_1_ instanceof WitherEntity) { if (p_226298_1_ instanceof WitherEntity) {
@@ -161,7 +161,7 @@
this.field_70170_p.func_180501_a(blockpos, blockstate, 3); this.field_70170_p.func_180501_a(blockpos, blockstate, 3);
flag = true; flag = true;
} }
@@ -1102,13 +1124,10 @@ @@ -1104,13 +1126,10 @@
protected void func_213345_d(DamageSource p_213345_1_) { protected void func_213345_d(DamageSource p_213345_1_) {
Entity entity = p_213345_1_.func_76346_g(); Entity entity = p_213345_1_.func_76346_g();
@@ -178,7 +178,7 @@
boolean flag = this.field_70718_bc > 0; boolean flag = this.field_70718_bc > 0;
if (this.func_146066_aG() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223602_e)) { if (this.func_146066_aG() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223602_e)) {
this.func_213354_a(p_213345_1_, flag); this.func_213354_a(p_213345_1_, flag);
@@ -1117,6 +1136,10 @@ @@ -1119,6 +1138,10 @@
this.func_213337_cE(); this.func_213337_cE();
this.func_226294_cV_(); this.func_226294_cV_();
@@ -189,7 +189,7 @@
} }
protected void func_213337_cE() { protected void func_213337_cE() {
@@ -1126,6 +1149,7 @@ @@ -1128,6 +1151,7 @@
if (!this.field_70170_p.field_72995_K && (this.func_70684_aJ() || this.field_70718_bc > 0 && this.func_146066_aG() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223602_e))) { if (!this.field_70170_p.field_72995_K && (this.func_70684_aJ() || this.field_70718_bc > 0 && this.func_146066_aG() && this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223602_e))) {
int i = this.func_70693_a(this.field_70717_bb); int i = this.func_70693_a(this.field_70717_bb);
@@ -197,7 +197,7 @@
while(i > 0) { while(i > 0) {
int j = ExperienceOrbEntity.func_70527_a(i); int j = ExperienceOrbEntity.func_70527_a(i);
i -= j; i -= j;
@@ -1133,6 +1157,7 @@ @@ -1135,6 +1159,7 @@
} }
} }
@@ -205,7 +205,7 @@
} }
protected void func_213333_a(DamageSource p_213333_1_, int p_213333_2_, boolean p_213333_3_) { protected void func_213333_a(DamageSource p_213333_1_, int p_213333_2_, boolean p_213333_3_) {
@@ -1159,6 +1184,9 @@ @@ -1161,6 +1186,9 @@
} }
public void func_70653_a(Entity p_70653_1_, float p_70653_2_, double p_70653_3_, double p_70653_5_) { public void func_70653_a(Entity p_70653_1_, float p_70653_2_, double p_70653_3_, double p_70653_5_) {
@@ -215,7 +215,7 @@
if (!(this.field_70146_Z.nextDouble() < this.func_110148_a(SharedMonsterAttributes.field_111266_c).func_111126_e())) { if (!(this.field_70146_Z.nextDouble() < this.func_110148_a(SharedMonsterAttributes.field_111266_c).func_111126_e())) {
this.field_70160_al = true; this.field_70160_al = true;
Vec3d vec3d = this.func_213322_ci(); Vec3d vec3d = this.func_213322_ci();
@@ -1194,12 +1222,7 @@ @@ -1196,12 +1224,7 @@
return false; return false;
} else { } else {
BlockState blockstate = this.func_213339_cH(); BlockState blockstate = this.func_213339_cH();
@@ -229,7 +229,7 @@
} }
} }
@@ -1223,6 +1246,11 @@ @@ -1225,6 +1248,11 @@
} }
public boolean func_225503_b_(float p_225503_1_, float p_225503_2_) { public boolean func_225503_b_(float p_225503_1_, float p_225503_2_) {
@@ -241,7 +241,7 @@
boolean flag = super.func_225503_b_(p_225503_1_, p_225503_2_); boolean flag = super.func_225503_b_(p_225503_1_, p_225503_2_);
int i = this.func_225508_e_(p_225503_1_, p_225503_2_); int i = this.func_225508_e_(p_225503_1_, p_225503_2_);
if (i > 0) { if (i > 0) {
@@ -1246,9 +1274,10 @@ @@ -1248,9 +1276,10 @@
int i = MathHelper.func_76128_c(this.func_226277_ct_()); int i = MathHelper.func_76128_c(this.func_226277_ct_());
int j = MathHelper.func_76128_c(this.func_226278_cu_() - (double)0.2F); int j = MathHelper.func_76128_c(this.func_226278_cu_() - (double)0.2F);
int k = MathHelper.func_76128_c(this.func_226281_cx_()); int k = MathHelper.func_76128_c(this.func_226281_cx_());
@@ -255,7 +255,7 @@
this.func_184185_a(soundtype.func_185842_g(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F); this.func_184185_a(soundtype.func_185842_g(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F);
} }
@@ -1317,6 +1346,8 @@ @@ -1319,6 +1348,8 @@
protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) { protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) {
if (!this.func_180431_b(p_70665_1_)) { if (!this.func_180431_b(p_70665_1_)) {
@@ -264,7 +264,7 @@
p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_); p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_);
p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_);
float f2 = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F); float f2 = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F);
@@ -1326,10 +1357,11 @@ @@ -1328,10 +1359,11 @@
((ServerPlayerEntity)p_70665_1_.func_76346_g()).func_195067_a(Stats.field_212735_F, Math.round(f * 10.0F)); ((ServerPlayerEntity)p_70665_1_.func_76346_g()).func_195067_a(Stats.field_212735_F, Math.round(f * 10.0F));
} }
@@ -277,7 +277,7 @@
this.func_110149_m(this.func_110139_bj() - f2); this.func_110149_m(this.func_110139_bj() - f2);
} }
} }
@@ -1383,6 +1415,8 @@ @@ -1385,6 +1417,8 @@
} }
public void func_226292_a_(Hand p_226292_1_, boolean p_226292_2_) { public void func_226292_a_(Hand p_226292_1_, boolean p_226292_2_) {
@@ -286,7 +286,7 @@
if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0) { if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0) {
this.field_110158_av = -1; this.field_110158_av = -1;
this.field_82175_bq = true; this.field_82175_bq = true;
@@ -1769,15 +1803,16 @@ @@ -1771,15 +1805,16 @@
} }
this.field_70160_al = true; this.field_70160_al = true;
@@ -305,7 +305,7 @@
} }
protected float func_189749_co() { protected float func_189749_co() {
@@ -1787,11 +1822,15 @@ @@ -1789,11 +1824,15 @@
public void func_213352_e(Vec3d p_213352_1_) { public void func_213352_e(Vec3d p_213352_1_) {
if (this.func_70613_aW() || this.func_184186_bw()) { if (this.func_70613_aW() || this.func_184186_bw()) {
double d0 = 0.08D; double d0 = 0.08D;
@@ -322,7 +322,7 @@
if (!this.func_70090_H() || this instanceof PlayerEntity && ((PlayerEntity)this).field_71075_bZ.field_75100_b) { if (!this.func_70090_H() || this instanceof PlayerEntity && ((PlayerEntity)this).field_71075_bZ.field_75100_b) {
if (!this.func_180799_ab() || this instanceof PlayerEntity && ((PlayerEntity)this).field_71075_bZ.field_75100_b) { if (!this.func_180799_ab() || this instanceof PlayerEntity && ((PlayerEntity)this).field_71075_bZ.field_75100_b) {
@@ -1840,7 +1879,7 @@ @@ -1842,7 +1881,7 @@
} }
} else { } else {
BlockPos blockpos = this.func_226270_aj_(); BlockPos blockpos = this.func_226270_aj_();
@@ -331,7 +331,7 @@
float f7 = this.field_70122_E ? f5 * 0.91F : 0.91F; float f7 = this.field_70122_E ? f5 * 0.91F : 0.91F;
this.func_213309_a(this.func_213335_r(f5), p_213352_1_); this.func_213309_a(this.func_213335_r(f5), p_213352_1_);
this.func_213317_d(this.func_213362_f(this.func_213322_ci())); this.func_213317_d(this.func_213362_f(this.func_213322_ci()));
@@ -1902,6 +1941,7 @@ @@ -1904,6 +1943,7 @@
f = 0.96F; f = 0.96F;
} }
@@ -339,7 +339,7 @@
this.func_213309_a(f1, p_213352_1_); this.func_213309_a(f1, p_213352_1_);
this.func_213315_a(MoverType.SELF, this.func_213322_ci()); this.func_213315_a(MoverType.SELF, this.func_213322_ci());
Vec3d vec3d1 = this.func_213322_ci(); Vec3d vec3d1 = this.func_213322_ci();
@@ -1977,6 +2017,7 @@ @@ -1979,6 +2019,7 @@
} }
public void func_70071_h_() { public void func_70071_h_() {
@@ -347,7 +347,7 @@
super.func_70071_h_(); super.func_70071_h_();
this.func_184608_ct(); this.func_184608_ct();
this.func_205014_p(); this.func_205014_p();
@@ -2020,7 +2061,9 @@ @@ -2022,7 +2063,9 @@
ItemStack itemstack1 = this.func_184582_a(equipmentslottype); ItemStack itemstack1 = this.func_184582_a(equipmentslottype);
if (!ItemStack.func_77989_b(itemstack1, itemstack)) { if (!ItemStack.func_77989_b(itemstack1, itemstack)) {
@@ -357,7 +357,7 @@
if (!itemstack.func_190926_b()) { if (!itemstack.func_190926_b()) {
this.func_110140_aT().func_111148_a(itemstack.func_111283_C(equipmentslottype)); this.func_110140_aT().func_111148_a(itemstack.func_111283_C(equipmentslottype));
} }
@@ -2472,13 +2515,22 @@ @@ -2474,13 +2517,22 @@
private void func_184608_ct() { private void func_184608_ct() {
if (this.func_184587_cr()) { if (this.func_184587_cr()) {
@@ -382,7 +382,7 @@
this.func_71036_o(); this.func_71036_o();
} }
} else { } else {
@@ -2520,8 +2572,10 @@ @@ -2522,8 +2574,10 @@
public void func_184598_c(Hand p_184598_1_) { public void func_184598_c(Hand p_184598_1_) {
ItemStack itemstack = this.func_184586_b(p_184598_1_); ItemStack itemstack = this.func_184586_b(p_184598_1_);
if (!itemstack.func_190926_b() && !this.func_184587_cr()) { if (!itemstack.func_190926_b() && !this.func_184587_cr()) {
@@ -394,7 +394,7 @@
if (!this.field_70170_p.field_72995_K) { if (!this.field_70170_p.field_72995_K) {
this.func_204802_c(1, true); this.func_204802_c(1, true);
this.func_204802_c(2, p_184598_1_ == Hand.OFF_HAND); this.func_204802_c(2, p_184598_1_ == Hand.OFF_HAND);
@@ -2581,6 +2635,9 @@ @@ -2583,6 +2637,9 @@
vec3d1 = vec3d1.func_178789_a(-this.field_70125_A * ((float)Math.PI / 180F)); vec3d1 = vec3d1.func_178789_a(-this.field_70125_A * ((float)Math.PI / 180F));
vec3d1 = vec3d1.func_178785_b(-this.field_70177_z * ((float)Math.PI / 180F)); vec3d1 = vec3d1.func_178785_b(-this.field_70177_z * ((float)Math.PI / 180F));
vec3d1 = vec3d1.func_72441_c(this.func_226277_ct_(), this.func_226280_cw_(), this.func_226281_cx_()); vec3d1 = vec3d1.func_72441_c(this.func_226277_ct_(), this.func_226280_cw_(), this.func_226281_cx_());
@@ -404,7 +404,7 @@
this.field_70170_p.func_195594_a(new ItemParticleData(ParticleTypes.field_197591_B, p_195062_1_), vec3d1.field_72450_a, vec3d1.field_72448_b, vec3d1.field_72449_c, vec3d.field_72450_a, vec3d.field_72448_b + 0.05D, vec3d.field_72449_c); this.field_70170_p.func_195594_a(new ItemParticleData(ParticleTypes.field_197591_B, p_195062_1_), vec3d1.field_72450_a, vec3d1.field_72448_b, vec3d1.field_72449_c, vec3d.field_72450_a, vec3d.field_72448_b + 0.05D, vec3d.field_72449_c);
} }
@@ -2592,7 +2649,9 @@ @@ -2594,7 +2651,9 @@
} else { } else {
if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr()) { if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr()) {
this.func_226293_b_(this.field_184627_bm, 16); this.func_226293_b_(this.field_184627_bm, 16);
@@ -415,7 +415,7 @@
this.func_184602_cy(); this.func_184602_cy();
} }
@@ -2613,7 +2672,11 @@ @@ -2615,7 +2674,11 @@
public void func_184597_cx() { public void func_184597_cx() {
if (!this.field_184627_bm.func_190926_b()) { if (!this.field_184627_bm.func_190926_b()) {
@@ -427,7 +427,7 @@
if (this.field_184627_bm.func_222122_m()) { if (this.field_184627_bm.func_222122_m()) {
this.func_184608_ct(); this.func_184608_ct();
} }
@@ -2770,16 +2833,16 @@ @@ -2772,16 +2835,16 @@
private boolean func_213359_p() { private boolean func_213359_p() {
return this.func_213374_dv().map((p_213347_1_) -> { return this.func_213374_dv().map((p_213347_1_) -> {
@@ -448,7 +448,7 @@
BlockPos blockpos = p_213368_1_.func_177984_a(); BlockPos blockpos = p_213368_1_.func_177984_a();
return new Vec3d((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.1D, (double)blockpos.func_177952_p() + 0.5D); return new Vec3d((double)blockpos.func_177958_n() + 0.5D, (double)blockpos.func_177956_o() + 0.1D, (double)blockpos.func_177952_p() + 0.5D);
}); });
@@ -2795,7 +2858,9 @@ @@ -2797,7 +2860,9 @@
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public Direction func_213376_dz() { public Direction func_213376_dz() {
BlockPos blockpos = this.func_213374_dv().orElse((BlockPos)null); BlockPos blockpos = this.func_213374_dv().orElse((BlockPos)null);
@@ -459,7 +459,7 @@
} }
public boolean func_70094_T() { public boolean func_70094_T() {
@@ -2864,4 +2929,58 @@ @@ -2866,4 +2931,58 @@
public void func_213334_d(Hand p_213334_1_) { public void func_213334_d(Hand p_213334_1_) {
this.func_213361_c(p_213334_1_ == Hand.MAIN_HAND ? EquipmentSlotType.MAINHAND : EquipmentSlotType.OFFHAND); this.func_213361_c(p_213334_1_ == Hand.MAIN_HAND ? EquipmentSlotType.MAINHAND : EquipmentSlotType.OFFHAND);
} }
@@ -1,6 +1,6 @@
--- a/net/minecraft/entity/item/FallingBlockEntity.java --- a/net/minecraft/entity/item/FallingBlockEntity.java
+++ b/net/minecraft/entity/item/FallingBlockEntity.java +++ b/net/minecraft/entity/item/FallingBlockEntity.java
@@ -152,7 +152,7 @@ @@ -153,7 +153,7 @@
((FallingBlock)block).func_176502_a_(this.field_70170_p, blockpos1, this.field_175132_d, blockstate); ((FallingBlock)block).func_176502_a_(this.field_70170_p, blockpos1, this.field_175132_d, blockstate);
} }
@@ -1,6 +1,6 @@
--- a/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java --- a/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java
+++ b/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java +++ b/net/minecraft/entity/item/minecart/FurnaceMinecartEntity.java
@@ -114,6 +114,7 @@ @@ -110,6 +110,7 @@
} }
public boolean func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) { public boolean func_184230_a(PlayerEntity p_184230_1_, Hand p_184230_2_) {
@@ -304,24 +304,23 @@
this.func_226560_a_(p_213819_1_, false, true); this.func_226560_a_(p_213819_1_, false, true);
return Either.left(PlayerEntity.SleepResult.NOT_POSSIBLE_NOW); return Either.left(PlayerEntity.SleepResult.NOT_POSSIBLE_NOW);
} }
@@ -1274,6 +1341,8 @@ @@ -1273,6 +1340,7 @@
private boolean func_190774_a(BlockPos p_190774_1_, Direction p_190774_2_) {
if (Math.abs(this.func_226277_ct_() - (double)p_190774_1_.func_177958_n()) <= 3.0D && Math.abs(this.func_226278_cu_() - (double)p_190774_1_.func_177956_o()) <= 2.0D && Math.abs(this.func_226281_cx_() - (double)p_190774_1_.func_177952_p()) <= 3.0D) {
return true;
+ } else if (p_190774_2_ == null) {
+ return false;
} else {
BlockPos blockpos = p_190774_1_.func_177972_a(p_190774_2_.func_176734_d());
return Math.abs(this.func_226277_ct_() - (double)blockpos.func_177958_n()) <= 3.0D && Math.abs(this.func_226278_cu_() - (double)blockpos.func_177956_o()) <= 2.0D && Math.abs(this.func_226281_cx_() - (double)blockpos.func_177952_p()) <= 3.0D;
@@ -1286,6 +1355,7 @@
} }
private boolean func_190774_a(BlockPos p_190774_1_, Direction p_190774_2_) {
+ if (p_190774_2_ == null) return false;
return this.func_230126_g_(p_190774_1_) || this.func_230126_g_(p_190774_1_.func_177972_a(p_190774_2_.func_176734_d()));
}
@@ -1289,6 +1357,7 @@
public void func_225652_a_(boolean p_225652_1_, boolean p_225652_2_) { public void func_225652_a_(boolean p_225652_1_, boolean p_225652_2_) {
+ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_225652_1_, p_225652_2_);
super.func_213366_dy(); super.func_213366_dy();
if (this.field_70170_p instanceof ServerWorld && p_225652_2_) { if (this.field_70170_p instanceof ServerWorld && p_225652_2_) {
+ net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_225652_1_, p_225652_2_);
((ServerWorld)this.field_70170_p).func_72854_c(); ((ServerWorld)this.field_70170_p).func_72854_c();
@@ -1299,17 +1369,17 @@ }
@@ -1300,17 +1369,17 @@
} }
public static Optional<Vec3d> func_213822_a(IWorldReader p_213822_0_, BlockPos p_213822_1_, boolean p_213822_2_) { public static Optional<Vec3d> func_213822_a(IWorldReader p_213822_0_, BlockPos p_213822_1_, boolean p_213822_2_) {
@@ -343,7 +342,7 @@
} }
} }
@@ -1324,15 +1394,62 @@ @@ -1325,15 +1394,62 @@
public void func_146105_b(ITextComponent p_146105_1_, boolean p_146105_2_) { public void func_146105_b(ITextComponent p_146105_1_, boolean p_146105_2_) {
} }
@@ -408,7 +407,7 @@
if (p_226560_1_ != null) { if (p_226560_1_ != null) {
if (p_226560_3_ && !p_226560_1_.equals(this.field_71077_c)) { if (p_226560_3_ && !p_226560_1_.equals(this.field_71077_c)) {
this.func_145747_a(new TranslationTextComponent("block.minecraft.bed.set_spawn")); this.func_145747_a(new TranslationTextComponent("block.minecraft.bed.set_spawn"));
@@ -1505,6 +1622,7 @@ @@ -1506,6 +1622,7 @@
public boolean func_225503_b_(float p_225503_1_, float p_225503_2_) { public boolean func_225503_b_(float p_225503_1_, float p_225503_2_) {
if (this.field_71075_bZ.field_75101_c) { if (this.field_71075_bZ.field_75101_c) {
@@ -416,7 +415,7 @@
return false; return false;
} else { } else {
if (p_225503_1_ >= 2.0F) { if (p_225503_1_ >= 2.0F) {
@@ -1559,6 +1677,10 @@ @@ -1560,6 +1677,10 @@
} }
public void func_195068_e(int p_195068_1_) { public void func_195068_e(int p_195068_1_) {
@@ -427,7 +426,7 @@
this.func_85039_t(p_195068_1_); this.func_85039_t(p_195068_1_);
this.field_71106_cc += (float)p_195068_1_ / (float)this.func_71050_bK(); this.field_71106_cc += (float)p_195068_1_ / (float)this.func_71050_bK();
this.field_71067_cb = MathHelper.func_76125_a(this.field_71067_cb + p_195068_1_, 0, Integer.MAX_VALUE); this.field_71067_cb = MathHelper.func_76125_a(this.field_71067_cb + p_195068_1_, 0, Integer.MAX_VALUE);
@@ -1598,6 +1720,10 @@ @@ -1599,6 +1720,10 @@
} }
public void func_82242_a(int p_82242_1_) { public void func_82242_a(int p_82242_1_) {
@@ -438,7 +437,7 @@
this.field_71068_ca += p_82242_1_; this.field_71068_ca += p_82242_1_;
if (this.field_71068_ca < 0) { if (this.field_71068_ca < 0) {
this.field_71068_ca = 0; this.field_71068_ca = 0;
@@ -1788,7 +1914,10 @@ @@ -1789,7 +1914,10 @@
} }
public ITextComponent func_145748_c_() { public ITextComponent func_145748_c_() {
@@ -450,7 +449,7 @@
return this.func_208016_c(itextcomponent); return this.func_208016_c(itextcomponent);
} }
@@ -2028,4 +2157,45 @@ @@ -2029,4 +2157,45 @@
return this.field_221260_g; return this.field_221260_g;
} }
} }
@@ -8,7 +8,7 @@
boolean flag = this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223609_l); boolean flag = this.field_70170_p.func_82736_K().func_223586_b(GameRules.field_223609_l);
if (flag) { if (flag) {
ITextComponent itextcomponent = this.func_110142_aN().func_151521_b(); ITextComponent itextcomponent = this.func_110142_aN().func_151521_b();
@@ -550,8 +551,10 @@ @@ -550,13 +551,15 @@
return this.field_71133_b.func_71219_W(); return this.field_71133_b.func_71219_W();
} }
@@ -19,6 +19,12 @@
this.field_184851_cj = true; this.field_184851_cj = true;
DimensionType dimensiontype = this.field_71093_bK; DimensionType dimensiontype = this.field_71093_bK;
if (dimensiontype == DimensionType.field_223229_c_ && p_212321_1_ == DimensionType.field_223227_a_) { if (dimensiontype == DimensionType.field_223229_c_ && p_212321_1_ == DimensionType.field_223227_a_) {
this.func_213319_R();
- this.func_71121_q().func_217434_e(this);
+ this.func_71121_q().removePlayer(this, true); //Forge: The player entity is cloned so keep the data until after cloning calls copyFrom
if (!this.field_71136_j) {
this.field_71136_j = true;
this.field_71135_a.func_147359_a(new SChangeGameStatePacket(4, this.field_192040_cp ? 0.0F : 1.0F));
@@ -569,12 +572,13 @@ @@ -569,12 +572,13 @@
this.field_71093_bK = p_212321_1_; this.field_71093_bK = p_212321_1_;
ServerWorld serverworld1 = this.field_71133_b.func_71218_a(p_212321_1_); ServerWorld serverworld1 = this.field_71133_b.func_71218_a(p_212321_1_);
@@ -0,0 +1,32 @@
--- a/net/minecraft/item/FishBucketItem.java
+++ b/net/minecraft/item/FishBucketItem.java
@@ -25,11 +25,19 @@
public class FishBucketItem extends BucketItem {
private final EntityType<?> field_203794_a;
+ @Deprecated
public FishBucketItem(EntityType<?> p_i49022_1_, Fluid p_i49022_2_, Item.Properties p_i49022_3_) {
super(p_i49022_2_, p_i49022_3_);
this.field_203794_a = p_i49022_1_;
+ this.fishTypeSupplier = () -> p_i49022_1_;
}
+ public FishBucketItem(java.util.function.Supplier<? extends EntityType<?>> fishTypeIn, java.util.function.Supplier<? extends Fluid> p_i49022_2_, Item.Properties builder) {
+ super(p_i49022_2_, builder);
+ this.field_203794_a = null;
+ this.fishTypeSupplier = fishTypeIn;
+ }
+
public void func_203792_a(World p_203792_1_, ItemStack p_203792_2_, BlockPos p_203792_3_) {
if (!p_203792_1_.field_72995_K) {
this.func_205357_b(p_203792_1_, p_203792_2_, p_203792_3_);
@@ -78,4 +86,9 @@
}
}
+
+ private final java.util.function.Supplier<? extends EntityType<?>> fishTypeSupplier;
+ protected EntityType<?> getFishType() {
+ return fishTypeSupplier.get();
+ }
}
@@ -0,0 +1,12 @@
--- a/net/minecraft/item/FlintAndSteelItem.java
+++ b/net/minecraft/item/FlintAndSteelItem.java
@@ -65,7 +65,8 @@
boolean flag = false;
for(Direction direction : Direction.Plane.HORIZONTAL) {
- if (p_219996_1_.func_180495_p(p_219996_2_.func_177972_a(direction)).func_177230_c() == Blocks.field_150343_Z && ((NetherPortalBlock)Blocks.field_150427_aO).func_201816_b(p_219996_1_, p_219996_2_) != null) {
+ BlockPos framePos = p_219996_2_.func_177972_a(direction);
+ if (p_219996_1_.func_180495_p(framePos).isPortalFrame(p_219996_1_, framePos) && ((NetherPortalBlock)Blocks.field_150427_aO).func_201816_b(p_219996_1_, p_219996_2_) != null) {
flag = true;
}
}
@@ -17,8 +17,8 @@
} }
+ this.canRepair = p_i48487_1_.canRepair; + this.canRepair = p_i48487_1_.canRepair;
+ this.toolClasses.putAll(p_i48487_1_.toolClasses); + this.toolClasses.putAll(p_i48487_1_.toolClasses);
+ Object tmp = p_i48487_1_.teisr == null ? null : net.minecraftforge.fml.DistExecutor.callWhenOn(Dist.CLIENT, p_i48487_1_.teisr); + Object tmp = p_i48487_1_.ister == null ? null : net.minecraftforge.fml.DistExecutor.callWhenOn(Dist.CLIENT, p_i48487_1_.ister);
+ this.teisr = tmp == null ? null : () -> (net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer) tmp; + this.ister = tmp == null ? null : () -> (net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer) tmp;
} }
@@ -86,7 +86,7 @@
} }
+ @Nullable + @Nullable
+ private final java.util.function.Supplier<net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer> teisr; + private final java.util.function.Supplier<net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer> ister;
+ private final java.util.Map<net.minecraftforge.common.ToolType, Integer> toolClasses = Maps.newHashMap(); + private final java.util.Map<net.minecraftforge.common.ToolType, Integer> toolClasses = Maps.newHashMap();
+ private final net.minecraftforge.common.util.ReverseTagWrapper<Item> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.ItemTags::getGeneration, net.minecraft.tags.ItemTags::func_199903_a); + private final net.minecraftforge.common.util.ReverseTagWrapper<Item> reverseTags = new net.minecraftforge.common.util.ReverseTagWrapper<>(this, net.minecraft.tags.ItemTags::getGeneration, net.minecraft.tags.ItemTags::func_199903_a);
+ protected final boolean canRepair; + protected final boolean canRepair;
@@ -108,8 +108,8 @@
+ +
+ @OnlyIn(Dist.CLIENT) + @OnlyIn(Dist.CLIENT)
+ @Override + @Override
+ public final net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer getTileEntityItemStackRenderer() { + public final net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer getItemStackTileEntityRenderer() {
+ net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer renderer = teisr != null ? teisr.get() : null; + net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer renderer = ister != null ? ister.get() : null;
+ return renderer != null ? renderer : net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer.field_147719_a; + return renderer != null ? renderer : net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer.field_147719_a;
+ } + }
+ +
@@ -127,7 +127,7 @@
private Food field_221541_f; private Food field_221541_f;
+ private boolean canRepair = true; + private boolean canRepair = true;
+ private java.util.Map<net.minecraftforge.common.ToolType, Integer> toolClasses = Maps.newHashMap(); + private java.util.Map<net.minecraftforge.common.ToolType, Integer> toolClasses = Maps.newHashMap();
+ private java.util.function.Supplier<java.util.concurrent.Callable<net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer>> teisr; + private java.util.function.Supplier<java.util.concurrent.Callable<net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer>> ister;
public Item.Properties func_221540_a(Food p_221540_1_) { public Item.Properties func_221540_a(Food p_221540_1_) {
this.field_221541_f = p_221540_1_; this.field_221541_f = p_221540_1_;
@@ -146,8 +146,8 @@
+ return this; + return this;
+ } + }
+ +
+ public Item.Properties setTEISR(java.util.function.Supplier<java.util.concurrent.Callable<net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer>> teisr) { + public Item.Properties setISTER(java.util.function.Supplier<java.util.concurrent.Callable<net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer>> ister) {
+ this.teisr = teisr; + this.ister = ister;
+ return this; + return this;
+ } + }
} }
@@ -6,7 +6,7 @@
Vec3d vec3d1 = this.field_75514_c.func_186310_f(); Vec3d vec3d1 = this.field_75514_c.func_186310_f();
- if (Math.abs(this.field_75515_a.func_226277_ct_() - (vec3d1.field_72450_a + 0.5D)) < (double)this.field_188561_o && Math.abs(this.field_75515_a.func_226281_cx_() - (vec3d1.field_72449_c + 0.5D)) < (double)this.field_188561_o && Math.abs(this.field_75515_a.func_226278_cu_() - vec3d1.field_72448_b) < 1.0D) { - if (Math.abs(this.field_75515_a.func_226277_ct_() - (vec3d1.field_72450_a + 0.5D)) < (double)this.field_188561_o && Math.abs(this.field_75515_a.func_226281_cx_() - (vec3d1.field_72449_c + 0.5D)) < (double)this.field_188561_o && Math.abs(this.field_75515_a.func_226278_cu_() - vec3d1.field_72448_b) < 1.0D) {
+ // Forge: fix MC-94054 + // Forge: fix MC-94054
+ if (Math.abs(this.field_75515_a.func_226277_ct_() - (vec3d1.field_72450_a + ((this.field_75515_a.func_213311_cf() + 1) / 2D))) < (double)this.field_188561_o && Math.abs(this.field_75515_a.func_226281_cx_() - (vec3d1.field_72449_c + ((this.field_75515_a.func_213311_cf() + 1) / 2D))) < (double)this.field_188561_o && Math.abs(this.field_75515_a.func_226278_cu_() - vec3d1.field_72448_b) < 1.0D) { + if (Math.abs(this.field_75515_a.func_226277_ct_() - (vec3d1.field_72450_a + ((int)(this.field_75515_a.func_213311_cf() + 1) / 2D))) < (double)this.field_188561_o && Math.abs(this.field_75515_a.func_226281_cx_() - (vec3d1.field_72449_c + ((int)(this.field_75515_a.func_213311_cf() + 1) / 2D))) < (double)this.field_188561_o && Math.abs(this.field_75515_a.func_226278_cu_() - vec3d1.field_72448_b) < 1.0D) {
this.field_75514_c.func_75872_c(this.field_75514_c.func_75873_e() + 1); this.field_75514_c.func_75872_c(this.field_75514_c.func_75873_e() + 1);
} }
@@ -6,7 +6,7 @@
Vec3d vec3d2 = this.field_75514_c.func_186310_f(); Vec3d vec3d2 = this.field_75514_c.func_186310_f();
- if (Math.abs(this.field_75515_a.func_226277_ct_() - (vec3d2.field_72450_a + 0.5D)) < (double)f1 && Math.abs(this.field_75515_a.func_226281_cx_() - (vec3d2.field_72449_c + 0.5D)) < (double)f1 && Math.abs(this.field_75515_a.func_226278_cu_() - vec3d2.field_72448_b) < (double)(f1 * 2.0F)) { - if (Math.abs(this.field_75515_a.func_226277_ct_() - (vec3d2.field_72450_a + 0.5D)) < (double)f1 && Math.abs(this.field_75515_a.func_226281_cx_() - (vec3d2.field_72449_c + 0.5D)) < (double)f1 && Math.abs(this.field_75515_a.func_226278_cu_() - vec3d2.field_72448_b) < (double)(f1 * 2.0F)) {
+ // Forge: fix MC-94054 + // Forge: fix MC-94054
+ if (Math.abs(this.field_75515_a.func_226277_ct_() - (vec3d2.field_72450_a + ((this.field_75515_a.func_213311_cf() + 1) / 2D))) < (double)f1 && Math.abs(this.field_75515_a.func_226281_cx_() - (vec3d2.field_72449_c + ((this.field_75515_a.func_213311_cf() + 1) / 2D))) < (double)f1 && Math.abs(this.field_75515_a.func_226278_cu_() - vec3d2.field_72448_b) < (double)(f1 * 2.0F)) { + if (Math.abs(this.field_75515_a.func_226277_ct_() - (vec3d2.field_72450_a + ((int)(this.field_75515_a.func_213311_cf() + 1) / 2D))) < (double)f1 && Math.abs(this.field_75515_a.func_226281_cx_() - (vec3d2.field_72449_c + ((int)(this.field_75515_a.func_213311_cf() + 1) / 2D))) < (double)f1 && Math.abs(this.field_75515_a.func_226278_cu_() - vec3d2.field_72448_b) < (double)(f1 * 2.0F)) {
this.field_75514_c.func_75875_a(); this.field_75514_c.func_75875_a();
} }
@@ -1,6 +1,6 @@
--- a/net/minecraft/potion/EffectInstance.java --- a/net/minecraft/potion/EffectInstance.java
+++ b/net/minecraft/potion/EffectInstance.java +++ b/net/minecraft/potion/EffectInstance.java
@@ -8,7 +8,7 @@ @@ -9,7 +9,7 @@
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@@ -9,15 +9,15 @@
private static final Logger field_180155_a = LogManager.getLogger(); private static final Logger field_180155_a = LogManager.getLogger();
private final Effect field_188420_b; private final Effect field_188420_b;
private int field_76460_b; private int field_76460_b;
@@ -52,6 +52,7 @@ @@ -64,6 +64,7 @@
this.field_82724_e = p_i1577_1_.field_82724_e; this.field_82724_e = p_230117_1_.field_82724_e;
this.field_188421_h = p_i1577_1_.field_188421_h; this.field_188421_h = p_230117_1_.field_188421_h;
this.field_205349_i = p_i1577_1_.field_205349_i; this.field_205349_i = p_230117_1_.field_205349_i;
+ this.curativeItems = p_i1577_1_.curativeItems == null ? null : new java.util.ArrayList<net.minecraft.item.ItemStack>(p_i1577_1_.curativeItems); + this.curativeItems = p_230117_1_.curativeItems == null ? null : new java.util.ArrayList<net.minecraft.item.ItemStack>(p_230117_1_.curativeItems);
} }
public boolean func_199308_a(EffectInstance p_199308_1_) { public boolean func_199308_a(EffectInstance p_199308_1_) {
@@ -88,7 +89,7 @@ @@ -112,7 +113,7 @@
} }
public Effect func_188419_a() { public Effect func_188419_a() {
@@ -26,30 +26,30 @@
} }
public int func_76459_b() { public int func_76459_b() {
@@ -188,11 +189,12 @@ @@ -231,11 +232,12 @@
p_82719_1_.func_74757_a("Ambient", this.func_82720_e()); this.field_230115_j_.func_82719_a(compoundnbt);
p_82719_1_.func_74757_a("ShowParticles", this.func_188418_e()); p_230119_1_.func_218657_a("HiddenEffect", compoundnbt);
p_82719_1_.func_74757_a("ShowIcon", this.func_205348_f()); }
+ writeCurativeItems(p_82719_1_); + writeCurativeItems(p_230119_1_);
return p_82719_1_;
} }
public static EffectInstance func_82722_b(CompoundNBT p_82722_0_) { public static EffectInstance func_82722_b(CompoundNBT p_82722_0_) {
- int i = p_82722_0_.func_74771_c("Id"); - int i = p_82722_0_.func_74771_c("Id");
+ int i = p_82722_0_.func_74771_c("Id") & 0xFF; + int i = p_82722_0_.func_74771_c("Id") & 0xFF;
Effect effect = Effect.func_188412_a(i); Effect effect = Effect.func_188412_a(i);
if (effect == null) { return effect == null ? null : func_230116_a_(effect, p_82722_0_);
return null; }
@@ -210,7 +212,7 @@ @@ -259,7 +261,7 @@
flag2 = p_82722_0_.func_74767_n("ShowIcon"); effectinstance = func_230116_a_(p_230116_0_, p_230116_1_.func_74775_l("HiddenEffect"));
}
- return new EffectInstance(effect, k, j < 0 ? 0 : j, flag, flag1, flag2);
+ return readCurativeItems(new EffectInstance(effect, k, j < 0 ? 0 : j, flag, flag1, flag2), p_82722_0_);
} }
- return new EffectInstance(p_230116_0_, j, i < 0 ? 0 : i, flag, flag1, flag2, effectinstance);
+ return readCurativeItems(new EffectInstance(p_230116_0_, j, i < 0 ? 0 : i, flag, flag1, flag2, effectinstance), p_230116_1_);
} }
@@ -226,6 +228,32 @@ @OnlyIn(Dist.CLIENT)
@@ -274,6 +276,32 @@
public int compareTo(EffectInstance p_compareTo_1_) { public int compareTo(EffectInstance p_compareTo_1_) {
int i = 32147; int i = 32147;
@@ -18,9 +18,9 @@
WorldInfo worldinfo = savehandler.func_75757_d(); WorldInfo worldinfo = savehandler.func_75757_d();
WorldSettings worldsettings; WorldSettings worldsettings;
if (worldinfo == null) { if (worldinfo == null) {
@@ -356,13 +358,13 @@ @@ -357,13 +359,13 @@
}
worldinfo.func_230145_a_(this.getServerModName(), this.func_230045_q_().isPresent());
this.func_195560_a(savehandler.func_75765_b(), worldinfo); this.func_195560_a(savehandler.func_75765_b(), worldinfo);
- IChunkStatusListener ichunkstatuslistener = this.field_213220_d.create(11); - IChunkStatusListener ichunkstatuslistener = this.field_213220_d.create(11);
this.func_213194_a(savehandler, worldinfo, worldsettings, ichunkstatuslistener); this.func_213194_a(savehandler, worldinfo, worldsettings, ichunkstatuslistener);
@@ -33,7 +33,7 @@
if (this.func_71242_L()) { if (this.func_71242_L()) {
p_213194_2_.func_176127_a(field_213219_c); p_213194_2_.func_176127_a(field_213219_c);
} }
@@ -406,6 +408,7 @@ @@ -407,6 +409,7 @@
if (dimensiontype != DimensionType.field_223227_a_) { if (dimensiontype != DimensionType.field_223227_a_) {
this.field_71305_c.put(dimensiontype, new ServerMultiWorld(serverworld1, this, this.field_213217_au, p_213194_1_, dimensiontype, this.field_71304_b, p_213194_4_)); this.field_71305_c.put(dimensiontype, new ServerMultiWorld(serverworld1, this, this.field_213217_au, p_213194_1_, dimensiontype, this.field_71304_b, p_213194_4_));
} }
@@ -41,7 +41,7 @@
} }
} }
@@ -564,6 +567,7 @@ @@ -565,6 +568,7 @@
for(ServerWorld serverworld1 : this.func_212370_w()) { for(ServerWorld serverworld1 : this.func_212370_w()) {
if (serverworld1 != null) { if (serverworld1 != null) {
try { try {
@@ -49,7 +49,7 @@
serverworld1.close(); serverworld1.close();
} catch (IOException ioexception) { } catch (IOException ioexception) {
field_147145_h.error("Exception closing the level", (Throwable)ioexception); field_147145_h.error("Exception closing the level", (Throwable)ioexception);
@@ -604,6 +608,7 @@ @@ -605,6 +609,7 @@
public void run() { public void run() {
try { try {
if (this.func_71197_b()) { if (this.func_71197_b()) {
@@ -57,7 +57,7 @@
this.field_211151_aa = Util.func_211177_b(); this.field_211151_aa = Util.func_211177_b();
this.field_147147_p.func_151315_a(new StringTextComponent(this.field_71286_C)); this.field_147147_p.func_151315_a(new StringTextComponent(this.field_71286_C));
this.field_147147_p.func_151321_a(new ServerStatusResponse.Version(SharedConstants.func_215069_a().getName(), SharedConstants.func_215069_a().getProtocolVersion())); this.field_147147_p.func_151321_a(new ServerStatusResponse.Version(SharedConstants.func_215069_a().getName(), SharedConstants.func_215069_a().getProtocolVersion()));
@@ -635,9 +640,15 @@ @@ -636,9 +641,15 @@
this.field_71304_b.func_219897_b(); this.field_71304_b.func_219897_b();
this.field_71296_Q = true; this.field_71296_Q = true;
} }
@@ -73,7 +73,7 @@
} catch (Throwable throwable1) { } catch (Throwable throwable1) {
field_147145_h.error("Encountered an unexpected exception", throwable1); field_147145_h.error("Encountered an unexpected exception", throwable1);
CrashReport crashreport; CrashReport crashreport;
@@ -654,6 +665,7 @@ @@ -655,6 +666,7 @@
field_147145_h.error("We were unable to save this crash report to disk."); field_147145_h.error("We were unable to save this crash report to disk.");
} }
@@ -81,7 +81,7 @@
this.func_71228_a(crashreport); this.func_71228_a(crashreport);
} finally { } finally {
try { try {
@@ -662,6 +674,7 @@ @@ -663,6 +675,7 @@
} catch (Throwable throwable) { } catch (Throwable throwable) {
field_147145_h.error("Exception stopping the server", throwable); field_147145_h.error("Exception stopping the server", throwable);
} finally { } finally {
@@ -89,7 +89,7 @@
this.func_71240_o(); this.func_71240_o();
} }
@@ -758,6 +771,7 @@ @@ -764,6 +777,7 @@
protected void func_71217_p(BooleanSupplier p_71217_1_) { protected void func_71217_p(BooleanSupplier p_71217_1_) {
long i = Util.func_211178_c(); long i = Util.func_211178_c();
@@ -97,7 +97,7 @@
++this.field_71315_w; ++this.field_71315_w;
this.func_71190_q(p_71217_1_); this.func_71190_q(p_71217_1_);
if (i - this.field_147142_T >= 5000000000L) { if (i - this.field_147142_T >= 5000000000L) {
@@ -772,6 +786,7 @@ @@ -778,6 +792,7 @@
Collections.shuffle(Arrays.asList(agameprofile)); Collections.shuffle(Arrays.asList(agameprofile));
this.field_147147_p.func_151318_b().func_151330_a(agameprofile); this.field_147147_p.func_151318_b().func_151330_a(agameprofile);
@@ -105,7 +105,7 @@
} }
if (this.field_71315_w % 6000 == 0) { if (this.field_71315_w % 6000 == 0) {
@@ -799,6 +814,7 @@ @@ -805,6 +820,7 @@
long i1 = Util.func_211178_c(); long i1 = Util.func_211178_c();
this.field_213215_ap.func_181747_a(i1 - i); this.field_213215_ap.func_181747_a(i1 - i);
this.field_71304_b.func_76319_b(); this.field_71304_b.func_76319_b();
@@ -113,7 +113,7 @@
} }
protected void func_71190_q(BooleanSupplier p_71190_1_) { protected void func_71190_q(BooleanSupplier p_71190_1_) {
@@ -806,7 +822,8 @@ @@ -812,7 +828,8 @@
this.func_193030_aL().func_73660_a(); this.func_193030_aL().func_73660_a();
this.field_71304_b.func_219895_b("levels"); this.field_71304_b.func_219895_b("levels");
@@ -123,7 +123,7 @@
if (serverworld.field_73011_w.func_186058_p() == DimensionType.field_223227_a_ || this.func_71255_r()) { if (serverworld.field_73011_w.func_186058_p() == DimensionType.field_223227_a_ || this.func_71255_r()) {
this.field_71304_b.func_194340_a(() -> { this.field_71304_b.func_194340_a(() -> {
return serverworld.func_72912_H().func_76065_j() + " " + Registry.field_212622_k.func_177774_c(serverworld.field_73011_w.func_186058_p()); return serverworld.func_72912_H().func_76065_j() + " " + Registry.field_212622_k.func_177774_c(serverworld.field_73011_w.func_186058_p());
@@ -818,6 +835,7 @@ @@ -824,6 +841,7 @@
} }
this.field_71304_b.func_76320_a("tick"); this.field_71304_b.func_76320_a("tick");
@@ -131,7 +131,7 @@
try { try {
serverworld.func_72835_b(p_71190_1_); serverworld.func_72835_b(p_71190_1_);
@@ -826,12 +844,16 @@ @@ -832,12 +850,16 @@
serverworld.func_72914_a(crashreport); serverworld.func_72914_a(crashreport);
throw new ReportedException(crashreport); throw new ReportedException(crashreport);
} }
@@ -148,7 +148,7 @@
this.field_71304_b.func_219895_b("connection"); this.field_71304_b.func_219895_b("connection");
this.func_147137_ag().func_151269_c(); this.func_147137_ag().func_151269_c();
this.field_71304_b.func_219895_b("players"); this.field_71304_b.func_219895_b("players");
@@ -872,6 +894,7 @@ @@ -878,6 +900,7 @@
OptionSpec<Integer> optionspec10 = optionparser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(-1); OptionSpec<Integer> optionspec10 = optionparser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(-1);
OptionSpec<String> optionspec11 = optionparser.accepts("serverId").withRequiredArg(); OptionSpec<String> optionspec11 = optionparser.accepts("serverId").withRequiredArg();
OptionSpec<String> optionspec12 = optionparser.nonOptions(); OptionSpec<String> optionspec12 = optionparser.nonOptions();
@@ -156,7 +156,7 @@
try { try {
OptionSet optionset = optionparser.parse(p_main_0_); OptionSet optionset = optionparser.parse(p_main_0_);
@@ -903,6 +926,10 @@ @@ -910,6 +933,10 @@
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(s, field_152367_a.getName())); PlayerProfileCache playerprofilecache = new PlayerProfileCache(gameprofilerepository, new File(s, field_152367_a.getName()));
String s1 = Optional.ofNullable(optionset.valueOf(optionspec9)).orElse(serverpropertiesprovider.func_219034_a().field_219021_o); String s1 = Optional.ofNullable(optionset.valueOf(optionspec9)).orElse(serverpropertiesprovider.func_219034_a().field_219021_o);
@@ -167,7 +167,7 @@
final DedicatedServer dedicatedserver = new DedicatedServer(new File(s), serverpropertiesprovider, DataFixesManager.func_210901_a(), yggdrasilauthenticationservice, minecraftsessionservice, gameprofilerepository, playerprofilecache, LoggingChunkStatusListener::new, s1); final DedicatedServer dedicatedserver = new DedicatedServer(new File(s), serverpropertiesprovider, DataFixesManager.func_210901_a(), yggdrasilauthenticationservice, minecraftsessionservice, gameprofilerepository, playerprofilecache, LoggingChunkStatusListener::new, s1);
dedicatedserver.func_71224_l(optionset.valueOf(optionspec7)); dedicatedserver.func_71224_l(optionset.valueOf(optionspec7));
dedicatedserver.func_71208_b(optionset.valueOf(optionspec10)); dedicatedserver.func_71208_b(optionset.valueOf(optionspec10));
@@ -920,6 +947,7 @@ @@ -927,6 +954,7 @@
Thread thread = new Thread("Server Shutdown Thread") { Thread thread = new Thread("Server Shutdown Thread") {
public void run() { public void run() {
dedicatedserver.func_71263_m(true); dedicatedserver.func_71263_m(true);
@@ -175,7 +175,7 @@
} }
}; };
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(field_147145_h)); thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(field_147145_h));
@@ -964,7 +992,7 @@ @@ -971,7 +999,7 @@
} }
public ServerWorld func_71218_a(DimensionType p_71218_1_) { public ServerWorld func_71218_a(DimensionType p_71218_1_) {
@@ -184,7 +184,7 @@
} }
public Iterable<ServerWorld> func_212370_w() { public Iterable<ServerWorld> func_212370_w() {
@@ -1003,7 +1031,7 @@ @@ -1010,7 +1038,7 @@
} }
public String getServerModName() { public String getServerModName() {
@@ -193,7 +193,7 @@
} }
public CrashReport func_71230_b(CrashReport p_71230_1_) { public CrashReport func_71230_b(CrashReport p_71230_1_) {
@@ -1558,6 +1586,31 @@ @@ -1567,6 +1595,31 @@
public abstract boolean func_213199_b(GameProfile p_213199_1_); public abstract boolean func_213199_b(GameProfile p_213199_1_);
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/dedicated/DedicatedServer.java --- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -96,6 +96,7 @@ @@ -97,6 +97,7 @@
public boolean func_71197_b() throws IOException { public boolean func_71197_b() throws IOException {
Thread thread = new Thread("Server console handler") { Thread thread = new Thread("Server console handler") {
public void run() { public void run() {
@@ -8,7 +8,7 @@
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)); BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
String s3; String s3;
@@ -117,6 +118,7 @@ @@ -118,6 +119,7 @@
field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
} }
@@ -16,7 +16,7 @@
field_155771_h.info("Loading properties"); field_155771_h.info("Loading properties");
ServerProperties serverproperties = this.field_71340_o.func_219034_a(); ServerProperties serverproperties = this.field_71340_o.func_219034_a();
if (this.func_71264_H()) { if (this.func_71264_H()) {
@@ -174,6 +176,7 @@ @@ -175,6 +177,7 @@
if (!PreYggdrasilConverter.func_219587_e(this)) { if (!PreYggdrasilConverter.func_219587_e(this)) {
return false; return false;
} else { } else {
@@ -24,7 +24,7 @@
this.func_184105_a(new DedicatedPlayerList(this)); this.func_184105_a(new DedicatedPlayerList(this));
long i = Util.func_211178_c(); long i = Util.func_211178_c();
String s = serverproperties.field_219022_p; String s = serverproperties.field_219022_p;
@@ -195,6 +198,7 @@ @@ -196,6 +199,7 @@
SkullTileEntity.func_184293_a(this.func_152358_ax()); SkullTileEntity.func_184293_a(this.func_152358_ax());
SkullTileEntity.func_184294_a(this.func_147130_as()); SkullTileEntity.func_184294_a(this.func_147130_as());
PlayerProfileCache.func_187320_a(this.func_71266_T()); PlayerProfileCache.func_187320_a(this.func_71266_T());
@@ -32,7 +32,7 @@
field_155771_h.info("Preparing level \"{}\"", (Object)this.func_71270_I()); field_155771_h.info("Preparing level \"{}\"", (Object)this.func_71270_I());
JsonObject jsonobject = new JsonObject(); JsonObject jsonobject = new JsonObject();
if (worldtype == WorldType.field_77138_c) { if (worldtype == WorldType.field_77138_c) {
@@ -207,6 +211,7 @@ @@ -208,6 +212,7 @@
long l = Util.func_211178_c() - i; long l = Util.func_211178_c() - i;
String s2 = String.format(Locale.ROOT, "%.3fs", (double)l / 1.0E9D); String s2 = String.format(Locale.ROOT, "%.3fs", (double)l / 1.0E9D);
field_155771_h.info("Done ({})! For help, type \"help\"", (Object)s2); field_155771_h.info("Done ({})! For help, type \"help\"", (Object)s2);
@@ -40,7 +40,7 @@
if (serverproperties.field_219027_u != null) { if (serverproperties.field_219027_u != null) {
this.func_200252_aR().func_223585_a(GameRules.field_223620_w).func_223570_a(serverproperties.field_219027_u, this); this.func_200252_aR().func_223585_a(GameRules.field_223620_w).func_223570_a(serverproperties.field_219027_u, this);
} }
@@ -232,7 +237,8 @@ @@ -233,7 +238,8 @@
} }
Items.field_190931_a.func_150895_a(ItemGroup.field_78027_g, NonNullList.func_191196_a()); Items.field_190931_a.func_150895_a(ItemGroup.field_78027_g, NonNullList.func_191196_a());
@@ -50,7 +50,7 @@
} }
} }
@@ -542,4 +548,9 @@ @@ -547,4 +553,9 @@
public boolean func_213199_b(GameProfile p_213199_1_) { public boolean func_213199_b(GameProfile p_213199_1_) {
return false; return false;
} }
@@ -1,6 +1,6 @@
--- a/net/minecraft/server/integrated/IntegratedServer.java --- a/net/minecraft/server/integrated/IntegratedServer.java
+++ b/net/minecraft/server/integrated/IntegratedServer.java +++ b/net/minecraft/server/integrated/IntegratedServer.java
@@ -63,6 +63,8 @@ @@ -64,6 +64,8 @@
this.func_71237_c(p_71247_1_); this.func_71237_c(p_71247_1_);
SaveHandler savehandler = this.func_71254_M().func_197715_a(p_71247_1_, this); SaveHandler savehandler = this.func_71254_M().func_197715_a(p_71247_1_, this);
this.func_175584_a(this.func_71270_I(), savehandler); this.func_175584_a(this.func_71270_I(), savehandler);
@@ -9,15 +9,15 @@
WorldInfo worldinfo = savehandler.func_75757_d(); WorldInfo worldinfo = savehandler.func_75757_d();
if (worldinfo == null) { if (worldinfo == null) {
worldinfo = new WorldInfo(this.field_71350_m, p_71247_2_); worldinfo = new WorldInfo(this.field_71350_m, p_71247_2_);
@@ -71,7 +73,6 @@ @@ -73,7 +75,6 @@
}
worldinfo.func_230145_a_(this.getServerModName(), this.func_230045_q_().isPresent());
this.func_195560_a(savehandler.func_75765_b(), worldinfo); this.func_195560_a(savehandler.func_75765_b(), worldinfo);
- IChunkStatusListener ichunkstatuslistener = this.field_213220_d.create(11); - IChunkStatusListener ichunkstatuslistener = this.field_213220_d.create(11);
this.func_213194_a(savehandler, worldinfo, this.field_71350_m, ichunkstatuslistener); this.func_213194_a(savehandler, worldinfo, this.field_71350_m, ichunkstatuslistener);
if (this.func_71218_a(DimensionType.field_223227_a_).func_72912_H().func_176130_y() == null) { if (this.func_71218_a(DimensionType.field_223227_a_).func_72912_H().func_176130_y() == null) {
this.func_147139_a(this.field_71349_l.field_71474_y.field_74318_M, true); this.func_147139_a(this.field_71349_l.field_71474_y.field_74318_M, true);
@@ -89,9 +90,10 @@ @@ -91,9 +92,10 @@
this.func_71245_h(true); this.func_71245_h(true);
field_147148_h.info("Generating keypair"); field_147148_h.info("Generating keypair");
this.func_71253_a(CryptManager.func_75891_b()); this.func_71253_a(CryptManager.func_75891_b());
@@ -29,7 +29,7 @@
} }
public void func_71217_p(BooleanSupplier p_71217_1_) { public void func_71217_p(BooleanSupplier p_71217_1_) {
@@ -126,6 +128,7 @@ @@ -128,6 +130,7 @@
} }
public Difficulty func_147135_j() { public Difficulty func_147135_j() {
@@ -37,7 +37,7 @@
return this.field_71349_l.field_71441_e.func_72912_H().func_176130_y(); return this.field_71349_l.field_71441_e.func_72912_H().func_176130_y();
} }
@@ -213,6 +216,7 @@ @@ -219,6 +222,7 @@
} }
public void func_71263_m(boolean p_71263_1_) { public void func_71263_m(boolean p_71263_1_) {
@@ -0,0 +1,11 @@
--- a/net/minecraft/world/IBlockReader.java
+++ b/net/minecraft/world/IBlockReader.java
@@ -23,7 +23,7 @@
IFluidState func_204610_c(BlockPos p_204610_1_);
default int func_217298_h(BlockPos p_217298_1_) {
- return this.func_180495_p(p_217298_1_).func_185906_d();
+ return this.func_180495_p(p_217298_1_).getLightValue(this, p_217298_1_);
}
default int func_201572_C() {
@@ -331,9 +331,9 @@
if (this.field_72986_A.func_76059_o()) { if (this.field_72986_A.func_76059_o()) {
this.field_73004_o = 1.0F; this.field_73004_o = 1.0F;
if (this.field_72986_A.func_76061_m()) { if (this.field_72986_A.func_76061_m()) {
@@ -739,10 +807,10 @@ @@ -740,10 +808,10 @@
public List<Entity> func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate<? super Entity> p_175674_3_) { public List<Entity> func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate<? super Entity> p_175674_3_) {
this.func_217381_Z().func_230035_c_("getEntities");
List<Entity> list = Lists.newArrayList(); List<Entity> list = Lists.newArrayList();
- int i = MathHelper.func_76128_c((p_175674_2_.field_72340_a - 2.0D) / 16.0D); - int i = MathHelper.func_76128_c((p_175674_2_.field_72340_a - 2.0D) / 16.0D);
- int j = MathHelper.func_76128_c((p_175674_2_.field_72336_d + 2.0D) / 16.0D); - int j = MathHelper.func_76128_c((p_175674_2_.field_72336_d + 2.0D) / 16.0D);
@@ -346,10 +346,10 @@
for(int i1 = i; i1 <= j; ++i1) { for(int i1 = i; i1 <= j; ++i1) {
for(int j1 = k; j1 <= l; ++j1) { for(int j1 = k; j1 <= l; ++j1) {
@@ -757,10 +825,10 @@ @@ -759,10 +827,10 @@
}
public <T extends Entity> List<T> func_217394_a(@Nullable EntityType<T> p_217394_1_, AxisAlignedBB p_217394_2_, Predicate<? super T> p_217394_3_) { public <T extends Entity> List<T> func_217394_a(@Nullable EntityType<T> p_217394_1_, AxisAlignedBB p_217394_2_, Predicate<? super T> p_217394_3_) {
this.func_217381_Z().func_230035_c_("getEntities");
- int i = MathHelper.func_76128_c((p_217394_2_.field_72340_a - 2.0D) / 16.0D); - int i = MathHelper.func_76128_c((p_217394_2_.field_72340_a - 2.0D) / 16.0D);
- int j = MathHelper.func_76143_f((p_217394_2_.field_72336_d + 2.0D) / 16.0D); - int j = MathHelper.func_76143_f((p_217394_2_.field_72336_d + 2.0D) / 16.0D);
- int k = MathHelper.func_76128_c((p_217394_2_.field_72339_c - 2.0D) / 16.0D); - int k = MathHelper.func_76128_c((p_217394_2_.field_72339_c - 2.0D) / 16.0D);
@@ -361,10 +361,10 @@
List<T> list = Lists.newArrayList(); List<T> list = Lists.newArrayList();
for(int i1 = i; i1 < j; ++i1) { for(int i1 = i; i1 < j; ++i1) {
@@ -776,10 +844,10 @@ @@ -779,10 +847,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_) { 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_) {
this.func_217381_Z().func_230035_c_("getEntities");
- int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - 2.0D) / 16.0D); - int i = MathHelper.func_76128_c((p_175647_2_.field_72340_a - 2.0D) / 16.0D);
- int j = MathHelper.func_76143_f((p_175647_2_.field_72336_d + 2.0D) / 16.0D); - 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 k = MathHelper.func_76128_c((p_175647_2_.field_72339_c - 2.0D) / 16.0D);
@@ -376,10 +376,10 @@
List<T> list = Lists.newArrayList(); List<T> list = Lists.newArrayList();
AbstractChunkProvider abstractchunkprovider = this.func_72863_F(); AbstractChunkProvider abstractchunkprovider = this.func_72863_F();
@@ -796,10 +864,10 @@ @@ -800,10 +868,10 @@
}
public <T extends Entity> List<T> func_225316_b(Class<? extends T> p_225316_1_, AxisAlignedBB p_225316_2_, @Nullable Predicate<? super T> p_225316_3_) { public <T extends Entity> List<T> func_225316_b(Class<? extends T> p_225316_1_, AxisAlignedBB p_225316_2_, @Nullable Predicate<? super T> p_225316_3_) {
this.func_217381_Z().func_230035_c_("getLoadedEntities");
- int i = MathHelper.func_76128_c((p_225316_2_.field_72340_a - 2.0D) / 16.0D); - int i = MathHelper.func_76128_c((p_225316_2_.field_72340_a - 2.0D) / 16.0D);
- int j = MathHelper.func_76143_f((p_225316_2_.field_72336_d + 2.0D) / 16.0D); - int j = MathHelper.func_76143_f((p_225316_2_.field_72336_d + 2.0D) / 16.0D);
- int k = MathHelper.func_76128_c((p_225316_2_.field_72339_c - 2.0D) / 16.0D); - int k = MathHelper.func_76128_c((p_225316_2_.field_72339_c - 2.0D) / 16.0D);
@@ -391,7 +391,7 @@
List<T> list = Lists.newArrayList(); List<T> list = Lists.newArrayList();
AbstractChunkProvider abstractchunkprovider = this.func_72863_F(); AbstractChunkProvider abstractchunkprovider = this.func_72863_F();
@@ -826,7 +894,8 @@ @@ -830,7 +898,8 @@
} }
public int func_181545_F() { public int func_181545_F() {
@@ -401,7 +401,7 @@
} }
public World func_201672_e() { public World func_201672_e() {
@@ -874,7 +943,7 @@ @@ -878,7 +947,7 @@
public int func_175651_c(BlockPos p_175651_1_, Direction p_175651_2_) { public int func_175651_c(BlockPos p_175651_1_, Direction p_175651_2_) {
BlockState blockstate = this.func_180495_p(p_175651_1_); BlockState blockstate = this.func_180495_p(p_175651_1_);
@@ -410,7 +410,7 @@
} }
public boolean func_175640_z(BlockPos p_175640_1_) { public boolean func_175640_z(BlockPos p_175640_1_) {
@@ -919,7 +988,7 @@ @@ -923,7 +992,7 @@
} }
public long func_72905_C() { public long func_72905_C() {
@@ -419,7 +419,7 @@
} }
public long func_82737_E() { public long func_82737_E() {
@@ -927,11 +996,11 @@ @@ -931,11 +1000,11 @@
} }
public long func_72820_D() { public long func_72820_D() {
@@ -433,7 +433,7 @@
} }
protected void func_217389_a() { protected void func_217389_a() {
@@ -943,7 +1012,7 @@ @@ -947,7 +1016,7 @@
} }
public BlockPos func_175694_M() { public BlockPos func_175694_M() {
@@ -442,7 +442,7 @@
if (!this.func_175723_af().func_177746_a(blockpos)) { 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())); 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()));
} }
@@ -952,10 +1021,14 @@ @@ -956,10 +1025,14 @@
} }
public void func_175652_B(BlockPos p_175652_1_) { public void func_175652_B(BlockPos p_175652_1_) {
@@ -458,7 +458,7 @@
return true; return true;
} }
@@ -1023,8 +1096,7 @@ @@ -1027,8 +1100,7 @@
} }
public boolean func_180502_D(BlockPos p_180502_1_) { public boolean func_180502_D(BlockPos p_180502_1_) {
@@ -468,7 +468,7 @@
} }
@Nullable @Nullable
@@ -1038,7 +1110,7 @@ @@ -1042,7 +1114,7 @@
} }
public int func_72940_L() { public int func_72940_L() {
@@ -477,7 +477,7 @@
} }
public CrashReportCategory func_72914_a(CrashReport p_72914_1_) { public CrashReportCategory func_72914_a(CrashReport p_72914_1_) {
@@ -1069,16 +1141,15 @@ @@ -1073,16 +1145,15 @@
public abstract Scoreboard func_96441_U(); public abstract Scoreboard func_96441_U();
public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) { public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) {
@@ -498,7 +498,7 @@
blockstate.func_215697_a(this, blockpos, p_175666_2_, p_175666_1_, false); blockstate.func_215697_a(this, blockpos, p_175666_2_, p_175666_1_, false);
} }
} }
@@ -1146,4 +1217,16 @@ @@ -1150,4 +1221,16 @@
public BiomeManager func_225523_d_() { public BiomeManager func_225523_d_() {
return this.field_226689_w_; return this.field_226689_w_;
} }
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/biome/DefaultBiomeFeatures.java --- a/net/minecraft/world/biome/DefaultBiomeFeatures.java
+++ b/net/minecraft/world/biome/DefaultBiomeFeatures.java +++ b/net/minecraft/world/biome/DefaultBiomeFeatures.java
@@ -132,26 +132,26 @@ @@ -132,30 +132,30 @@
private static final BlockState field_226805_bm_ = Blocks.field_150419_aX.func_176223_P().func_206870_a(HugeMushroomBlock.field_196460_A, Boolean.valueOf(false)); private static final BlockState field_226805_bm_ = Blocks.field_150419_aX.func_176223_P().func_206870_a(HugeMushroomBlock.field_196460_A, Boolean.valueOf(false));
private static final BlockState field_226806_bn_ = Blocks.field_150420_aW.func_176223_P().func_206870_a(HugeMushroomBlock.field_196465_z, Boolean.valueOf(true)).func_206870_a(HugeMushroomBlock.field_196460_A, Boolean.valueOf(false)); private static final BlockState field_226806_bn_ = Blocks.field_150420_aW.func_176223_P().func_206870_a(HugeMushroomBlock.field_196465_z, Boolean.valueOf(true)).func_206870_a(HugeMushroomBlock.field_196460_A, Boolean.valueOf(false));
private static final BlockState field_226807_bo_ = Blocks.field_196706_do.func_176223_P().func_206870_a(HugeMushroomBlock.field_196465_z, Boolean.valueOf(false)).func_206870_a(HugeMushroomBlock.field_196460_A, Boolean.valueOf(false)); private static final BlockState field_226807_bo_ = Blocks.field_196706_do.func_176223_P().func_206870_a(HugeMushroomBlock.field_196465_z, Boolean.valueOf(false)).func_206870_a(HugeMushroomBlock.field_196460_A, Boolean.valueOf(false));
@@ -11,14 +11,18 @@
- public static final TreeFeatureConfig field_226810_e_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_), new SpruceFoliagePlacer(2, 1))).func_225569_d_(6).func_227354_b_(3).func_227356_e_(1).func_227357_f_(1).func_227359_h_(2).func_227352_a_().func_225568_b_(); - public static final TreeFeatureConfig field_226810_e_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_), new SpruceFoliagePlacer(2, 1))).func_225569_d_(6).func_227354_b_(3).func_227356_e_(1).func_227357_f_(1).func_227359_h_(2).func_227352_a_().func_225568_b_();
- public static final TreeFeatureConfig field_226811_f_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226778_am_), new SimpleBlockStateProvider(field_226779_an_), new AcaciaFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227355_c_(2).func_227356_e_(0).func_227352_a_().func_225568_b_(); - public static final TreeFeatureConfig field_226811_f_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226778_am_), new SimpleBlockStateProvider(field_226779_an_), new AcaciaFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227355_c_(2).func_227356_e_(0).func_227352_a_().func_225568_b_();
- public static final TreeFeatureConfig field_226812_g_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_225568_b_(); - public static final TreeFeatureConfig field_226812_g_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_225568_b_();
- public static final TreeFeatureConfig field_226813_h_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227355_c_(6).func_227360_i_(3).func_227352_a_().func_225568_b_(); - public static final TreeFeatureConfig field_230129_h_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.002F))).func_225568_b_();
- public static final TreeFeatureConfig field_230130_i_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227355_c_(6).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.002F))).func_225568_b_();
- public static final TreeFeatureConfig field_226814_i_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(3, 0))).func_225569_d_(5).func_227354_b_(3).func_227360_i_(3).func_227362_k_(1).func_227353_a_(ImmutableList.of(new LeaveVineTreeDecorator())).func_225568_b_(); - public static final TreeFeatureConfig field_226814_i_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(3, 0))).func_225569_d_(5).func_227354_b_(3).func_227360_i_(3).func_227362_k_(1).func_227353_a_(ImmutableList.of(new LeaveVineTreeDecorator())).func_225568_b_();
- public static final TreeFeatureConfig field_226815_j_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).func_225568_b_(); - public static final TreeFeatureConfig field_226815_j_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).func_225568_b_();
- public static final TreeFeatureConfig field_226816_k_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.05F))).func_225568_b_(); - public static final TreeFeatureConfig field_226816_k_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.05F))).func_225568_b_();
- public static final TreeFeatureConfig field_230131_m_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.002F))).func_225568_b_();
- public static final TreeFeatureConfig field_226817_l_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.05F))).func_225568_b_(); - public static final TreeFeatureConfig field_226817_l_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.05F))).func_225568_b_();
- public static final TreeFeatureConfig field_226818_m_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.01F))).func_225568_b_(); - public static final TreeFeatureConfig field_230132_o_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.002F))).func_225568_b_();
- public static final TreeFeatureConfig field_226819_n_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.01F))).func_225568_b_(); - public static final TreeFeatureConfig field_230133_p_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.02F))).func_225568_b_();
- public static final TreeFeatureConfig field_226820_o_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.01F))).func_225568_b_(); - public static final TreeFeatureConfig field_230134_q_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.02F))).func_225568_b_();
- public static final TreeFeatureConfig field_230135_r_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.02F))).func_225568_b_();
- public static final TreeFeatureConfig field_230136_s_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.05F))).func_225568_b_();
- public static final BaseTreeFeatureConfig field_226821_p_ = (new BaseTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226774_ai_), new SimpleBlockStateProvider(field_226773_ah_))).func_225569_d_(4).func_225568_b_(); - public static final BaseTreeFeatureConfig field_226821_p_ = (new BaseTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226774_ai_), new SimpleBlockStateProvider(field_226773_ah_))).func_225569_d_(4).func_225568_b_();
- public static final HugeTreeFeatureConfig field_226822_q_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226782_aq_), new SimpleBlockStateProvider(field_226783_ar_))).func_225569_d_(6).func_225568_b_(); - public static final HugeTreeFeatureConfig field_226822_q_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226782_aq_), new SimpleBlockStateProvider(field_226783_ar_))).func_225569_d_(6).func_225568_b_();
- public static final HugeTreeFeatureConfig field_226823_r_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_))).func_225569_d_(13).func_227283_b_(15).func_227284_c_(13).func_227282_a_(ImmutableList.of(new AlterGroundTreeDecorator(new SimpleBlockStateProvider(field_226771_af_)))).func_225568_b_(); - public static final HugeTreeFeatureConfig field_226823_r_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_))).func_225569_d_(13).func_227283_b_(15).func_227284_c_(13).func_227282_a_(ImmutableList.of(new AlterGroundTreeDecorator(new SimpleBlockStateProvider(field_226771_af_)))).func_225568_b_();
@@ -31,15 +35,19 @@
+ public static final TreeFeatureConfig field_226810_e_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_), new SpruceFoliagePlacer(2, 1))).func_225569_d_(6).func_227354_b_(3).func_227356_e_(1).func_227357_f_(1).func_227359_h_(2).func_227352_a_().setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196675_u).func_225568_b_(); + public static final TreeFeatureConfig field_226810_e_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_), new SpruceFoliagePlacer(2, 1))).func_225569_d_(6).func_227354_b_(3).func_227356_e_(1).func_227357_f_(1).func_227359_h_(2).func_227352_a_().setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196675_u).func_225568_b_();
+ public static final TreeFeatureConfig field_226811_f_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226778_am_), new SimpleBlockStateProvider(field_226779_an_), new AcaciaFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227355_c_(2).func_227356_e_(0).func_227352_a_().setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196679_x).func_225568_b_(); + public static final TreeFeatureConfig field_226811_f_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226778_am_), new SimpleBlockStateProvider(field_226779_an_), new AcaciaFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227355_c_(2).func_227356_e_(0).func_227352_a_().setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196679_x).func_225568_b_();
+ public static final TreeFeatureConfig field_226812_g_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227360_i_(3).func_227352_a_().setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196676_v).func_225568_b_(); + public static final TreeFeatureConfig field_226812_g_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227360_i_(3).func_227352_a_().setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196676_v).func_225568_b_();
+ public static final TreeFeatureConfig field_226813_h_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227355_c_(6).func_227360_i_(3).func_227352_a_().setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196676_v).func_225568_b_(); + public static final TreeFeatureConfig field_230129_h_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.002F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196676_v).func_225568_b_();
+ public static final TreeFeatureConfig field_230130_i_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227355_c_(6).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.002F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196676_v).func_225568_b_();
+ public static final TreeFeatureConfig field_226814_i_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(3, 0))).func_225569_d_(5).func_227354_b_(3).func_227360_i_(3).func_227362_k_(1).func_227353_a_(ImmutableList.of(new LeaveVineTreeDecorator())).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_(); + public static final TreeFeatureConfig field_226814_i_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(3, 0))).func_225569_d_(5).func_227354_b_(3).func_227360_i_(3).func_227362_k_(1).func_227353_a_(ImmutableList.of(new LeaveVineTreeDecorator())).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_();
+ public static final TreeFeatureConfig field_226815_j_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_(); + public static final TreeFeatureConfig field_226815_j_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_();
+ public static final TreeFeatureConfig field_226816_k_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.05F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_(); + public static final TreeFeatureConfig field_226816_k_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.05F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_();
+ public static final TreeFeatureConfig field_230131_m_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.002F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_();
+ public static final TreeFeatureConfig field_226817_l_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.05F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_(); + public static final TreeFeatureConfig field_226817_l_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.05F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_();
+ public static final TreeFeatureConfig field_226818_m_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.01F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_(); + public static final TreeFeatureConfig field_230132_o_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.002F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_();
+ public static final TreeFeatureConfig field_226819_n_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.01F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_(); + public static final TreeFeatureConfig field_230133_p_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(2, 0))).func_225569_d_(4).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.02F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_();
+ public static final TreeFeatureConfig field_226820_o_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.01F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196676_v).func_225568_b_(); + public static final TreeFeatureConfig field_230134_q_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226772_ag_), new SimpleBlockStateProvider(field_226773_ah_), new BlobFoliagePlacer(0, 0))).func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.02F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_();
+ public static final BaseTreeFeatureConfig field_226821_p_ = (new BaseTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226774_ai_), new SimpleBlockStateProvider(field_226773_ah_))).func_225569_d_(4).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196674_t).func_225568_b_(); + public static final TreeFeatureConfig field_230135_r_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.02F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196676_v).func_225568_b_();
+ public static final TreeFeatureConfig field_230136_s_ = (new TreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226780_ao_), new SimpleBlockStateProvider(field_226781_ap_), new BlobFoliagePlacer(2, 0))).func_225569_d_(5).func_227354_b_(2).func_227360_i_(3).func_227352_a_().func_227353_a_(ImmutableList.of(new BeehiveTreeDecorator(0.05F))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196676_v).func_225568_b_();
+ public static final BaseTreeFeatureConfig field_226821_p_ = (new BaseTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226774_ai_), new SimpleBlockStateProvider(field_226773_ah_))).func_225569_d_(4).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196678_w).func_225568_b_();
+ public static final HugeTreeFeatureConfig field_226822_q_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226782_aq_), new SimpleBlockStateProvider(field_226783_ar_))).func_225569_d_(6).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196680_y).func_225568_b_(); + public static final HugeTreeFeatureConfig field_226822_q_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226782_aq_), new SimpleBlockStateProvider(field_226783_ar_))).func_225569_d_(6).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196680_y).func_225568_b_();
+ public static final HugeTreeFeatureConfig field_226823_r_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_))).func_225569_d_(13).func_227283_b_(15).func_227284_c_(13).func_227282_a_(ImmutableList.of(new AlterGroundTreeDecorator(new SimpleBlockStateProvider(field_226771_af_)))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196675_u).func_225568_b_(); + public static final HugeTreeFeatureConfig field_226823_r_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_))).func_225569_d_(13).func_227283_b_(15).func_227284_c_(13).func_227282_a_(ImmutableList.of(new AlterGroundTreeDecorator(new SimpleBlockStateProvider(field_226771_af_)))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196675_u).func_225568_b_();
+ public static final HugeTreeFeatureConfig field_226824_s_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_))).func_225569_d_(13).func_227283_b_(15).func_227284_c_(3).func_227282_a_(ImmutableList.of(new AlterGroundTreeDecorator(new SimpleBlockStateProvider(field_226771_af_)))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196675_u).func_225568_b_(); + public static final HugeTreeFeatureConfig field_226824_s_ = (new HugeTreeFeatureConfig.Builder(new SimpleBlockStateProvider(field_226776_ak_), new SimpleBlockStateProvider(field_226777_al_))).func_225569_d_(13).func_227283_b_(15).func_227284_c_(3).func_227282_a_(ImmutableList.of(new AlterGroundTreeDecorator(new SimpleBlockStateProvider(field_226771_af_)))).setSapling((net.minecraftforge.common.IPlantable)Blocks.field_196675_u).func_225568_b_();
@@ -0,0 +1,18 @@
--- a/net/minecraft/world/chunk/ChunkPrimer.java
+++ b/net/minecraft/world/chunk/ChunkPrimer.java
@@ -136,13 +136,13 @@
if (this.field_201661_i[j >> 4] == Chunk.field_186036_a && p_177436_2_.func_177230_c() == Blocks.field_150350_a) {
return p_177436_2_;
} else {
- if (p_177436_2_.func_185906_d() > 0) {
+ if (p_177436_2_.getLightValue(this, p_177436_1_) > 0) {
this.field_201663_k.add(new BlockPos((i & 15) + this.func_76632_l().func_180334_c(), j, (k & 15) + this.func_76632_l().func_180333_d()));
}
ChunkSection chunksection = this.func_217332_a(j >> 4);
BlockState blockstate = chunksection.func_222629_a(i & 15, j & 15, k & 15, p_177436_2_);
- if (this.field_201658_f.func_209003_a(ChunkStatus.field_222613_i) && p_177436_2_ != blockstate && (p_177436_2_.func_200016_a(this, p_177436_1_) != blockstate.func_200016_a(this, p_177436_1_) || p_177436_2_.func_185906_d() != blockstate.func_185906_d() || p_177436_2_.func_215691_g() || blockstate.func_215691_g())) {
+ if (this.field_201658_f.func_209003_a(ChunkStatus.field_222613_i) && p_177436_2_ != blockstate && (p_177436_2_.func_200016_a(this, p_177436_1_) != blockstate.func_200016_a(this, p_177436_1_) || p_177436_2_.getLightValue(this, p_177436_1_) != blockstate.getLightValue(this, p_177436_1_) || p_177436_2_.func_215691_g() || blockstate.func_215691_g())) {
WorldLightManager worldlightmanager = this.func_217307_e();
worldlightmanager.func_215568_a(p_177436_1_);
}
@@ -8,6 +8,15 @@
} else { } else {
ChunkPrimer chunkprimer = new ChunkPrimer(p_222656_3_, upgradedata, achunksection, chunkprimerticklist, chunkprimerticklist1); ChunkPrimer chunkprimer = new ChunkPrimer(p_222656_3_, upgradedata, achunksection, chunkprimerticklist, chunkprimerticklist1);
chunkprimer.func_225548_a_(biomecontainer); chunkprimer.func_225548_a_(biomecontainer);
@@ -143,7 +144,7 @@
if (!flag && chunkprimer.func_201589_g().func_209003_a(ChunkStatus.field_222614_j)) {
for(BlockPos blockpos : BlockPos.func_191531_b(p_222656_3_.func_180334_c(), 0, p_222656_3_.func_180333_d(), p_222656_3_.func_180332_e(), 255, p_222656_3_.func_180330_f())) {
- if (ichunk.func_180495_p(blockpos).func_185906_d() != 0) {
+ if (ichunk.func_180495_p(blockpos).getLightValue(ichunk, blockpos) != 0) {
chunkprimer.func_201637_h(blockpos);
}
}
@@ -294,12 +295,22 @@ @@ -294,12 +295,22 @@
for(int k = 0; k < chunk.func_177429_s().length; ++k) { for(int k = 0; k < chunk.func_177429_s().length; ++k) {
for(Entity entity : chunk.func_177429_s()[k]) { for(Entity entity : chunk.func_177429_s()[k]) {
@@ -0,0 +1,13 @@
--- a/net/minecraft/world/gen/NoiseChunkGenerator.java
+++ b/net/minecraft/world/gen/NoiseChunkGenerator.java
@@ -378,8 +378,8 @@
}
if (blockstate != field_222562_i) {
- if (blockstate.func_185906_d() != 0) {
- blockpos$mutable.func_181079_c(j3, j2, i4);
+ blockpos$mutable.func_181079_c(j3, j2, i4);
+ if (blockstate.getLightValue(chunkprimer, blockpos$mutable) != 0) {
chunkprimer.func_201637_h(blockpos$mutable);
}
@@ -5,7 +5,7 @@
for(int i = 0; i < p_227210_5_; ++i) { for(int i = 0; i < p_227210_5_; ++i) {
p_227210_6_.func_189533_g(p_227210_3_).func_189534_c(Direction.UP, i); p_227210_6_.func_189533_g(p_227210_3_).func_189534_c(Direction.UP, i);
- if (!p_227210_1_.func_180495_p(p_227210_6_).func_200015_d(p_227210_1_, p_227210_6_)) { - if (!p_227210_1_.func_180495_p(p_227210_6_).func_200015_d(p_227210_1_, p_227210_6_)) {
+ if (!p_227210_1_.func_180495_p(p_227210_6_).canBeReplacedByLeaves(p_227210_1_, p_227210_6_)) { + if (p_227210_1_.func_180495_p(p_227210_6_).canBeReplacedByLogs(p_227210_1_, p_227210_6_)) {
this.func_202278_a(p_227210_1_, p_227210_6_, p_227210_4_.field_227273_b_.func_225574_a_(p_227210_2_, p_227210_3_)); this.func_202278_a(p_227210_1_, p_227210_6_, p_227210_4_.field_227273_b_.func_225574_a_(p_227210_2_, p_227210_3_));
} }
} }
@@ -5,7 +5,7 @@
if (!flag4 || !flag5) { if (!flag4 || !flag5) {
p_225564_5_.func_189533_g(p_225564_3_).func_196234_d(j, p_225564_4_, k); p_225564_5_.func_189533_g(p_225564_3_).func_196234_d(j, p_225564_4_, k);
- if (!p_225564_1_.func_180495_p(p_225564_5_).func_200015_d(p_225564_1_, p_225564_5_)) { - if (!p_225564_1_.func_180495_p(p_225564_5_).func_200015_d(p_225564_1_, p_225564_5_)) {
+ if (!p_225564_1_.func_180495_p(p_225564_5_).canBeReplacedByLeaves(p_225564_1_, p_225564_5_)) { + if (p_225564_1_.func_180495_p(p_225564_5_).canBeReplacedByLeaves(p_225564_1_, p_225564_5_)) {
boolean flag6 = flag || flag5 && j == 1 - i; boolean flag6 = flag || flag5 && j == 1 - i;
boolean flag7 = flag1 || flag5 && j == i - 1; boolean flag7 = flag1 || flag5 && j == i - 1;
boolean flag8 = flag2 || flag4 && k == 1 - i; boolean flag8 = flag2 || flag4 && k == 1 - i;
@@ -5,7 +5,7 @@
if (i >= p_225564_4_ || flag4 != flag5) { if (i >= p_225564_4_ || flag4 != flag5) {
p_225564_5_.func_189533_g(p_225564_3_).func_196234_d(l, i, i1); p_225564_5_.func_189533_g(p_225564_3_).func_196234_d(l, i, i1);
- if (!p_225564_1_.func_180495_p(p_225564_5_).func_200015_d(p_225564_1_, p_225564_5_)) { - if (!p_225564_1_.func_180495_p(p_225564_5_).func_200015_d(p_225564_1_, p_225564_5_)) {
+ if (!p_225564_1_.func_180495_p(p_225564_5_).canBeReplacedByLeaves(p_225564_1_, p_225564_5_)) { + if (p_225564_1_.func_180495_p(p_225564_5_).canBeReplacedByLeaves(p_225564_1_, p_225564_5_)) {
this.func_202278_a(p_225564_1_, p_225564_5_, p_225564_6_.field_227272_a_.func_225574_a_(p_225564_2_, p_225564_3_).func_206870_a(HugeMushroomBlock.field_196465_z, Boolean.valueOf(i >= p_225564_4_ - 1)).func_206870_a(HugeMushroomBlock.field_196464_y, Boolean.valueOf(l < -k)).func_206870_a(HugeMushroomBlock.field_196461_b, Boolean.valueOf(l > k)).func_206870_a(HugeMushroomBlock.field_196459_a, Boolean.valueOf(i1 < -k)).func_206870_a(HugeMushroomBlock.field_196463_c, Boolean.valueOf(i1 > k))); this.func_202278_a(p_225564_1_, p_225564_5_, p_225564_6_.field_227272_a_.func_225574_a_(p_225564_2_, p_225564_3_).func_206870_a(HugeMushroomBlock.field_196465_z, Boolean.valueOf(i >= p_225564_4_ - 1)).func_206870_a(HugeMushroomBlock.field_196464_y, Boolean.valueOf(l < -k)).func_206870_a(HugeMushroomBlock.field_196461_b, Boolean.valueOf(l > k)).func_206870_a(HugeMushroomBlock.field_196459_a, Boolean.valueOf(i1 < -k)).func_206870_a(HugeMushroomBlock.field_196463_c, Boolean.valueOf(i1 > k)));
} }
} }
@@ -16,7 +16,7 @@
} }
this.func_219229_a(p_219185_5_); this.func_219229_a(p_219185_5_);
@@ -481,6 +483,7 @@ @@ -482,6 +484,7 @@
if (flag) { if (flag) {
IChunk ichunk = ChunkSerializer.func_222656_a(this.field_219255_i, this.field_219269_w, this.field_219260_n, p_223172_1_, compoundnbt); IChunk ichunk = ChunkSerializer.func_222656_a(this.field_219255_i, this.field_219269_w, this.field_219260_n, p_223172_1_, compoundnbt);
ichunk.func_177432_b(this.field_219255_i.func_82737_E()); ichunk.func_177432_b(this.field_219255_i.func_82737_E());
@@ -24,7 +24,7 @@
return Either.left(ichunk); return Either.left(ichunk);
} }
@@ -590,6 +593,7 @@ @@ -594,6 +597,7 @@
if (list != null) { if (list != null) {
list.forEach(chunk::func_76622_b); list.forEach(chunk::func_76622_b);
} }
@@ -32,15 +32,15 @@
} }
return chunk; return chunk;
@@ -674,6 +678,7 @@ @@ -679,6 +683,7 @@
}
this.field_219255_i.func_217381_Z().func_230035_c_("chunkSave");
CompoundNBT compoundnbt1 = ChunkSerializer.func_222645_a(this.field_219255_i, p_219229_1_); CompoundNBT compoundnbt1 = ChunkSerializer.func_222645_a(this.field_219255_i, p_219229_1_);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(p_219229_1_, compoundnbt1)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkDataEvent.Save(p_219229_1_, compoundnbt1));
this.func_219100_a(chunkpos, compoundnbt1); this.func_219100_a(chunkpos, compoundnbt1);
return true; return true;
} catch (Exception exception) { } catch (Exception exception) {
@@ -810,6 +815,7 @@ @@ -815,6 +820,7 @@
for(int l = i - this.field_219247_A; l <= i + this.field_219247_A; ++l) { for(int l = i - this.field_219247_A; l <= i + this.field_219247_A; ++l) {
for(int k = j - this.field_219247_A; k <= j + this.field_219247_A; ++k) { for(int k = j - this.field_219247_A; k <= j + this.field_219247_A; ++k) {
ChunkPos chunkpos = new ChunkPos(l, k); ChunkPos chunkpos = new ChunkPos(l, k);
@@ -143,18 +143,18 @@
i += this.field_73012_v.nextInt(8) - this.field_73012_v.nextInt(8); i += this.field_73012_v.nextInt(8) - this.field_73012_v.nextInt(8);
j += this.field_73012_v.nextInt(8) - this.field_73012_v.nextInt(8); j += this.field_73012_v.nextInt(8) - this.field_73012_v.nextInt(8);
++k; ++k;
@@ -583,8 +592,9 @@ @@ -584,8 +593,9 @@
if (p_217479_1_.field_70175_ag) {
++p_217479_1_.field_70173_aa; ++p_217479_1_.field_70173_aa;
this.func_217381_Z().func_194340_a(() -> { IProfiler iprofiler = this.func_217381_Z();
iprofiler.func_194340_a(() -> {
- return Registry.field_212629_r.func_177774_c(p_217479_1_.func_200600_R()).toString(); - return Registry.field_212629_r.func_177774_c(p_217479_1_.func_200600_R()).toString();
+ return p_217479_1_.func_200600_R().getRegistryName() == null ? p_217479_1_.func_200600_R().toString() : p_217479_1_.func_200600_R().getRegistryName().toString(); + return p_217479_1_.func_200600_R().getRegistryName() == null ? p_217479_1_.func_200600_R().toString() : p_217479_1_.func_200600_R().getRegistryName().toString();
}); });
+ if (p_217479_1_.canUpdate()) + if (p_217479_1_.canUpdate())
iprofiler.func_230035_c_("tickNonPassenger");
p_217479_1_.func_70071_h_(); p_217479_1_.func_70071_h_();
this.func_217381_Z().func_76319_b(); iprofiler.func_76319_b();
} @@ -652,6 +662,11 @@
@@ -644,6 +654,11 @@
} }
public boolean func_175660_a(PlayerEntity p_175660_1_, BlockPos p_175660_2_) { public boolean func_175660_a(PlayerEntity p_175660_1_, BlockPos p_175660_2_) {
@@ -166,7 +166,7 @@
return !this.field_73061_a.func_175579_a(this, p_175660_2_, p_175660_1_) && this.func_175723_af().func_177746_a(p_175660_2_); return !this.field_73061_a.func_175579_a(this, p_175660_2_, p_175660_1_) && this.func_175723_af().func_177746_a(p_175660_2_);
} }
@@ -653,6 +668,7 @@ @@ -661,6 +676,7 @@
} else if (this.field_72986_A.func_76067_t() == WorldType.field_180272_g) { } else if (this.field_72986_A.func_76067_t() == WorldType.field_180272_g) {
this.field_72986_A.func_176143_a(BlockPos.field_177992_a.func_177984_a()); this.field_72986_A.func_176143_a(BlockPos.field_177992_a.func_177984_a());
} else { } else {
@@ -174,7 +174,7 @@
BiomeProvider biomeprovider = this.func_72863_F().func_201711_g().func_202090_b(); BiomeProvider biomeprovider = this.func_72863_F().func_201711_g().func_202090_b();
List<Biome> list = biomeprovider.func_76932_a(); List<Biome> list = biomeprovider.func_76932_a();
Random random = new Random(this.func_72905_C()); Random random = new Random(this.func_72905_C());
@@ -726,6 +742,7 @@ @@ -734,6 +750,7 @@
p_217445_1_.func_200209_c(new TranslationTextComponent("menu.savingChunks")); p_217445_1_.func_200209_c(new TranslationTextComponent("menu.savingChunks"));
} }
@@ -182,7 +182,7 @@
serverchunkprovider.func_217210_a(p_217445_2_); serverchunkprovider.func_217210_a(p_217445_2_);
} }
} }
@@ -801,7 +818,7 @@ @@ -809,7 +826,7 @@
} }
} }
@@ -191,7 +191,7 @@
if (entityclassification != EntityClassification.MISC && this.func_72863_F().func_223435_b(entity)) { if (entityclassification != EntityClassification.MISC && this.func_72863_F().func_223435_b(entity)) {
object2intmap.mergeInt(entityclassification, 1, Integer::sum); object2intmap.mergeInt(entityclassification, 1, Integer::sum);
} }
@@ -843,6 +860,7 @@ @@ -851,6 +868,7 @@
} }
private void func_217448_f(ServerPlayerEntity p_217448_1_) { private void func_217448_f(ServerPlayerEntity p_217448_1_) {
@@ -199,7 +199,7 @@
Entity entity = this.field_175741_N.get(p_217448_1_.func_110124_au()); Entity entity = this.field_175741_N.get(p_217448_1_.func_110124_au());
if (entity != null) { if (entity != null) {
field_147491_a.warn("Force-added player with duplicate UUID {}", (Object)p_217448_1_.func_110124_au().toString()); field_147491_a.warn("Force-added player with duplicate UUID {}", (Object)p_217448_1_.func_110124_au().toString());
@@ -867,6 +885,7 @@ @@ -875,6 +893,7 @@
} else if (this.func_217478_l(p_72838_1_)) { } else if (this.func_217478_l(p_72838_1_)) {
return false; return false;
} else { } else {
@@ -207,7 +207,7 @@
IChunk ichunk = this.func_217353_a(MathHelper.func_76128_c(p_72838_1_.func_226277_ct_() / 16.0D), MathHelper.func_76128_c(p_72838_1_.func_226281_cx_() / 16.0D), ChunkStatus.field_222617_m, p_72838_1_.field_98038_p); IChunk ichunk = this.func_217353_a(MathHelper.func_76128_c(p_72838_1_.func_226277_ct_() / 16.0D), MathHelper.func_76128_c(p_72838_1_.func_226281_cx_() / 16.0D), ChunkStatus.field_222617_m, p_72838_1_.field_98038_p);
if (!(ichunk instanceof Chunk)) { if (!(ichunk instanceof Chunk)) {
return false; return false;
@@ -882,6 +901,7 @@ @@ -890,6 +909,7 @@
if (this.func_217478_l(p_217440_1_)) { if (this.func_217478_l(p_217440_1_)) {
return false; return false;
} else { } else {
@@ -215,7 +215,7 @@
this.func_217465_m(p_217440_1_); this.func_217465_m(p_217440_1_);
return true; return true;
} }
@@ -917,12 +937,17 @@ @@ -925,12 +945,17 @@
} }
@@ -234,7 +234,7 @@
this.field_175741_N.remove(p_217484_1_.func_110124_au()); this.field_175741_N.remove(p_217484_1_.func_110124_au());
this.func_72863_F().func_217226_b(p_217484_1_); this.func_72863_F().func_217226_b(p_217484_1_);
@@ -936,6 +961,7 @@ @@ -944,6 +969,7 @@
this.field_217495_I.remove(((MobEntity)p_217484_1_).func_70661_as()); this.field_217495_I.remove(((MobEntity)p_217484_1_).func_70661_as());
} }
@@ -242,7 +242,7 @@
} }
private void func_217465_m(Entity p_217465_1_) { private void func_217465_m(Entity p_217465_1_) {
@@ -956,15 +982,19 @@ @@ -964,15 +990,19 @@
} }
} }
@@ -263,7 +263,7 @@
} }
} }
@@ -977,8 +1007,11 @@ @@ -985,8 +1015,11 @@
} }
public void func_217434_e(ServerPlayerEntity p_217434_1_) { public void func_217434_e(ServerPlayerEntity p_217434_1_) {
@@ -277,7 +277,7 @@
this.func_72854_c(); this.func_72854_c();
} }
@@ -1002,10 +1035,20 @@ @@ -1010,10 +1043,20 @@
} }
public void func_184148_a(@Nullable PlayerEntity p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_) { public void func_184148_a(@Nullable PlayerEntity p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_) {
@@ -298,7 +298,7 @@
this.field_73061_a.func_184103_al().func_148543_a(p_217384_1_, p_217384_2_.func_226277_ct_(), p_217384_2_.func_226278_cu_(), p_217384_2_.func_226281_cx_(), p_217384_5_ > 1.0F ? (double)(16.0F * p_217384_5_) : 16.0D, this.field_73011_w.func_186058_p(), new SSpawnMovingSoundEffectPacket(p_217384_3_, p_217384_4_, p_217384_2_, p_217384_5_, p_217384_6_)); this.field_73061_a.func_184103_al().func_148543_a(p_217384_1_, p_217384_2_.func_226277_ct_(), p_217384_2_.func_226278_cu_(), p_217384_2_.func_226281_cx_(), p_217384_5_ > 1.0F ? (double)(16.0F * p_217384_5_) : 16.0D, this.field_73011_w.func_186058_p(), new SSpawnMovingSoundEffectPacket(p_217384_3_, p_217384_4_, p_217384_2_, p_217384_5_, p_217384_6_));
} }
@@ -1041,6 +1084,7 @@ @@ -1049,6 +1092,7 @@
public Explosion func_217401_a(@Nullable Entity p_217401_1_, @Nullable DamageSource p_217401_2_, double p_217401_3_, double p_217401_5_, double p_217401_7_, float p_217401_9_, boolean p_217401_10_, Explosion.Mode p_217401_11_) { public Explosion func_217401_a(@Nullable Entity p_217401_1_, @Nullable DamageSource p_217401_2_, double p_217401_3_, double p_217401_5_, double p_217401_7_, float p_217401_9_, boolean p_217401_10_, Explosion.Mode p_217401_11_) {
Explosion explosion = new Explosion(this, p_217401_1_, p_217401_3_, p_217401_5_, p_217401_7_, p_217401_9_, p_217401_10_, p_217401_11_); Explosion explosion = new Explosion(this, p_217401_1_, p_217401_3_, p_217401_5_, p_217401_7_, p_217401_9_, p_217401_10_, p_217401_11_);
@@ -306,7 +306,7 @@
if (p_217401_2_ != null) { if (p_217401_2_ != null) {
explosion.func_199592_a(p_217401_2_); explosion.func_199592_a(p_217401_2_);
} }
@@ -1369,4 +1413,15 @@ @@ -1377,4 +1421,15 @@
return p_229854_1_.func_175898_b(p_229855_1_.func_180328_a()); return p_229854_1_.func_175898_b(p_229855_1_.func_180328_a());
}); });
} }
@@ -1,6 +1,6 @@
--- a/net/minecraft/world/storage/WorldInfo.java --- a/net/minecraft/world/storage/WorldInfo.java
+++ b/net/minecraft/world/storage/WorldInfo.java +++ b/net/minecraft/world/storage/WorldInfo.java
@@ -349,6 +349,7 @@ @@ -362,6 +362,7 @@
CompoundNBT compoundnbt1 = new CompoundNBT(); CompoundNBT compoundnbt1 = new CompoundNBT();
for(Entry<DimensionType, CompoundNBT> entry : this.field_186348_N.entrySet()) { for(Entry<DimensionType, CompoundNBT> entry : this.field_186348_N.entrySet()) {
@@ -79,7 +79,7 @@ public class LibraryFinder {
static Path[] getMCPaths(final String mcVersion, final String mcpVersion, final String forgeVersion, final String forgeGroup, final String type) { 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 srgMcPath = findLibsPath().resolve(MavenCoordinateResolver.get("net.minecraft", type, "", "srg", mcVersion+"-"+mcpVersion));
Path mcExtrasPath = findLibsPath().resolve(MavenCoordinateResolver.get("net.minecraft", type, "", "1.14.4".equals(mcVersion) ? "extra-stable" : "extra", mcVersion)); Path mcExtrasPath = findLibsPath().resolve(MavenCoordinateResolver.get("net.minecraft", type, "", "extra", mcVersion));
Path patchedBinariesPath = findLibsPath().resolve(MavenCoordinateResolver.get(forgeGroup, "forge", "", type, mcVersion+"-"+forgeVersion)); 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,"SRG MC at {} is {}", srgMcPath.toString(), pathStatus(srgMcPath));
LOGGER.debug(CORE,"MC Extras at {} is {}", mcExtrasPath.toString(), pathStatus(mcExtrasPath)); LOGGER.debug(CORE,"MC Extras at {} is {}", mcExtrasPath.toString(), pathStatus(mcExtrasPath));
@@ -51,6 +51,7 @@ public class ModInfo implements IModInfo
private final String displayName; private final String displayName;
private final String description; private final String description;
private final Optional<String> logoFile; private final Optional<String> logoFile;
private final boolean logoBlur;
private final URL updateJSONURL; private final URL updateJSONURL;
private final List<IModInfo.ModVersion> dependencies; private final List<IModInfo.ModVersion> dependencies;
private final Map<String,Object> properties; private final Map<String,Object> properties;
@@ -81,6 +82,10 @@ public class ModInfo implements IModInfo
tmp = this.owningFile.getConfig().getOptional("logoFile"); tmp = this.owningFile.getConfig().getOptional("logoFile");
} }
this.logoFile = tmp; this.logoFile = tmp;
this.logoBlur = modConfig.<Boolean>getOptional("logoBlur").
orElseGet(() -> Optional.ofNullable(this.owningFile).
flatMap(f -> f.getConfig().<Boolean>getOptional("logoBlur")).
orElse(true));
this.updateJSONURL = modConfig.<String>getOptional("updateJSONURL").map(StringUtils::toURL).orElse(null); this.updateJSONURL = modConfig.<String>getOptional("updateJSONURL").map(StringUtils::toURL).orElse(null);
if (owningFile != null) { if (owningFile != null) {
@@ -151,6 +156,11 @@ public class ModInfo implements IModInfo
return this.logoFile; return this.logoFile;
} }
public boolean getLogoBlur()
{
return this.logoBlur;
}
/** /**
* This is no longer used. The Mods List GUI currently directly checks whether there is an EntryPoint registered. * This is no longer used. The Mods List GUI currently directly checks whether there is an EntryPoint registered.
*/ */
@@ -2,7 +2,9 @@
"replace": false, "replace": false,
"values": [ "values": [
"minecraft:dirt", "minecraft:dirt",
"minecraft:grass_block",
"minecraft:coarse_dirt", "minecraft:coarse_dirt",
"minecraft:podzol" "minecraft:podzol",
"minecraft:mycelium"
] ]
} }
@@ -1,21 +1,21 @@
{ {
"replace": false, "replace": false,
"values": [ "values": [
"minecraft:white_dye", "#forge:dyes/white",
"minecraft:orange_dye", "#forge:dyes/orange",
"minecraft:magenta_dye", "#forge:dyes/magenta",
"minecraft:light_blue_dye", "#forge:dyes/light_blue",
"minecraft:yellow_dye", "#forge:dyes/yellow",
"minecraft:lime_dye", "#forge:dyes/lime",
"minecraft:pink_dye", "#forge:dyes/pink",
"minecraft:gray_dye", "#forge:dyes/gray",
"minecraft:light_gray_dye", "#forge:dyes/light_gray",
"minecraft:cyan_dye", "#forge:dyes/cyan",
"minecraft:purple_dye", "#forge:dyes/purple",
"minecraft:blue_dye", "#forge:dyes/blue",
"minecraft:brown_dye", "#forge:dyes/brown",
"minecraft:green_dye", "#forge:dyes/green",
"minecraft:red_dye", "#forge:dyes/red",
"minecraft:black_dye" "#forge:dyes/black"
] ]
} }
+1 -1
View File
@@ -60,6 +60,6 @@ acbf9f921b05785d49d8526870ba13aee1a322f7 assets\minecraft\blockstates\cobbleston
bf2e445b48b024354a69138b20a4a4a8aa5d15d1 assets\minecraft\blockstates\oak_trapdoor.json bf2e445b48b024354a69138b20a4a4a8aa5d15d1 assets\minecraft\blockstates\oak_trapdoor.json
9c4cc92efb78811e8d70a383a1a89eb75b69db04 assets\minecraft\blockstates\stone.json 9c4cc92efb78811e8d70a383a1a89eb75b69db04 assets\minecraft\blockstates\stone.json
570fdd86046df75a073b759ff7aaf4c4caf43115 assets\minecraft\blockstates\torch.json 570fdd86046df75a073b759ff7aaf4c4caf43115 assets\minecraft\blockstates\torch.json
16f12628d0c23a4ca66961b0a1c837c3b1e4457d assets\minecraft\blockstates\wall_torch.json a012d6d92bab1c91913bd0f2dc0492a0fce916f2 assets\minecraft\blockstates\wall_torch.json
4fbaf6f4a3ea05cc071076e27f44ac81f9cc50e3 data\data_gen_test\advancements\conditional.json 4fbaf6f4a3ea05cc071076e27f44ac81f9cc50e3 data\data_gen_test\advancements\conditional.json
ed4cbf1a3a2f5d8969f6346fdc9acdbe81d0c919 data\data_gen_test\recipes\conditional.json ed4cbf1a3a2f5d8969f6346fdc9acdbe81d0c919 data\data_gen_test\recipes\conditional.json
@@ -13,8 +13,7 @@
"y": 180 "y": 180
}, },
"facing=east": { "facing=east": {
"model": "data_gen_test:block/wall_torch", "model": "data_gen_test:block/wall_torch"
"y": 360
} }
} }
} }
@@ -51,6 +51,7 @@ import java.util.stream.Stream;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.*;
import net.minecraft.client.settings.KeyBinding;
import net.minecraftforge.client.model.pipeline.LightUtil; import net.minecraftforge.client.model.pipeline.LightUtil;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@@ -116,7 +117,7 @@ import net.minecraft.world.ILightReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraftforge.client.event.ColorHandlerEvent; import net.minecraftforge.client.event.ColorHandlerEvent;
import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.client.event.DrawHighlightEvent;
import net.minecraftforge.client.event.EntityViewRenderEvent; import net.minecraftforge.client.event.EntityViewRenderEvent;
import net.minecraftforge.client.event.FOVUpdateEvent; import net.minecraftforge.client.event.FOVUpdateEvent;
import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.client.event.GuiScreenEvent;
@@ -164,12 +165,12 @@ public class ForgeHooksClient
switch (target.getType()) { switch (target.getType()) {
case BLOCK: case BLOCK:
if (!(target instanceof BlockRayTraceResult)) return false; if (!(target instanceof BlockRayTraceResult)) return false;
return MinecraftForge.EVENT_BUS.post(new DrawBlockHighlightEvent.HighlightBlock(context, info, target, subID, partialTicks)); return MinecraftForge.EVENT_BUS.post(new DrawHighlightEvent.HighlightBlock(context, info, target, subID, partialTicks));
case ENTITY: case ENTITY:
if (!(target instanceof EntityRayTraceResult)) return false; if (!(target instanceof EntityRayTraceResult)) return false;
return MinecraftForge.EVENT_BUS.post(new DrawBlockHighlightEvent.HighlightEntity(context, info, target, subID, partialTicks)); return MinecraftForge.EVENT_BUS.post(new DrawHighlightEvent.HighlightEntity(context, info, target, subID, partialTicks));
} }
return MinecraftForge.EVENT_BUS.post(new DrawBlockHighlightEvent(context, info, target, subID, partialTicks)); return MinecraftForge.EVENT_BUS.post(new DrawHighlightEvent(context, info, target, subID, partialTicks));
} }
public static void dispatchRenderLast(WorldRenderer context, MatrixStack mat, float partialTicks) public static void dispatchRenderLast(WorldRenderer context, MatrixStack mat, float partialTicks)
@@ -556,172 +557,10 @@ public class ForgeHooksClient
return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, loc); return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, loc);
} }
private static class LightGatheringTransformer extends QuadGatheringTransformer {
private static final VertexFormat FORMAT = new VertexFormat(ImmutableList.of(DefaultVertexFormats.TEX_2F, DefaultVertexFormats.TEX_2S));
int blockLight, skyLight;
{ setVertexFormat(FORMAT); }
boolean hasLighting()
{
return dataLength[1] >= 2;
}
@Override
protected void processQuad()
{
// Reset light data
blockLight = 0;
skyLight = 0;
// Compute average light for all 4 vertices
for (int i = 0; i < 4; i++)
{
blockLight += (int) ((quadData[1][i][0] * 0xFFFF) / 0x20);
skyLight += (int) ((quadData[1][i][1] * 0xFFFF) / 0x20);
}
// Values must be multiplied by 16, divided by 4 for average => x4
blockLight *= 4;
skyLight *= 4;
}
// Dummy overrides
@Override
public void setQuadTint(int tint) {}
@Override
public void setQuadOrientation(Direction orientation) {}
@Override
public void setApplyDiffuseLighting(boolean diffuse) {}
@Override
public void setTexture(TextureAtlasSprite texture) {}
}
private static final LightGatheringTransformer lightGatherer = new LightGatheringTransformer();
// TODO: Fix: Vanilla now batches rendering items, so our hack of forcing the GL lighting state does not work.
public static void renderLitItem(ItemRenderer ri, MatrixStack mat, IVertexBuilder consumer, IBakedModel model, ItemStack stack)
{
List<BakedQuad> allquads = new ArrayList<>();
Random random = new Random();
long seed = 42L;
for (Direction enumfacing : Direction.values())
{
random.setSeed(seed);
allquads.addAll(model.getQuads(null, enumfacing, random, EmptyModelData.INSTANCE));
}
random.setSeed(seed);
allquads.addAll(model.getQuads(null, null, random, EmptyModelData.INSTANCE));
if (allquads.isEmpty()) return;
// Current list of consecutive quads with the same lighting
List<BakedQuad> segment = new ArrayList<>();
// Lighting of the current segment
int segmentBlockLight = 0;
int segmentSkyLight = 0;
// Diffuse lighting state
boolean segmentShading = true;
// State changed by the current segment
boolean segmentLightingDirty = false;
boolean segmentShadingDirty = false;
// If the current segment contains lighting data
boolean hasLighting = false;
for (int i = 0; i < allquads.size(); i++)
{
BakedQuad q = allquads.get(i);
// Lighting of the current quad
int bl = 0;
int sl = 0;
if (q.getFormat().hasUV(1))
{
LightUtil.putBakedQuad(lightGatherer, q);
if (lightGatherer.hasLighting())
{
bl = lightGatherer.blockLight;
sl = lightGatherer.skyLight;
}
}
boolean shade = q.shouldApplyDiffuseLighting();
boolean lightingDirty = segmentBlockLight != bl || segmentSkyLight != sl;
boolean shadeDirty = shade != segmentShading;
// If lighting or color data has changed, draw the segment and flush it
if (lightingDirty || shadeDirty)
{
if (i > 0) // Make sure this isn't the first quad being processed
drawSegment(ri, mat, consumer, stack, segment, segmentBlockLight, segmentSkyLight, segmentShading, segmentLightingDirty && (hasLighting || segment.size() < i), segmentShadingDirty);
segmentBlockLight = bl;
segmentSkyLight = sl;
segmentShading = shade;
segmentLightingDirty = lightingDirty;
segmentShadingDirty = shadeDirty;
hasLighting = segmentBlockLight > 0 || segmentSkyLight > 0 || !segmentShading;
}
segment.add(q);
}
drawSegment(ri, mat, consumer, stack, segment, segmentBlockLight, segmentSkyLight, segmentShading, segmentLightingDirty && (hasLighting || segment.size() < allquads.size()), segmentShadingDirty);
// Clean up render state if necessary
if (hasLighting)
{
RenderSystem.glMultiTexCoord2f(GL13.GL_TEXTURE1, GlStateManager.lastBrightnessX, GlStateManager.lastBrightnessY);
RenderSystem.enableLighting();
}
}
private static void drawSegment(ItemRenderer ir, MatrixStack mat, IVertexBuilder cons, ItemStack stack, List<BakedQuad> segment, int bl, int sl, boolean shade, boolean updateLighting, boolean updateShading)
{
float lastBl = GlStateManager.lastBrightnessX;
float lastSl = GlStateManager.lastBrightnessY;
if (updateShading)
{
if (shade)
{
// (Re-)enable lighting for normal look with shading
RenderSystem.enableLighting();
}
else
{
// Disable lighting to simulate a lack of diffuse lighting
RenderSystem.disableLighting();
}
}
if (updateLighting)
{
// Force lightmap coords to simulate synthetic lighting
RenderSystem.glMultiTexCoord2f(GL13.GL_TEXTURE1, Math.max(bl, lastBl), Math.max(sl, lastSl));
}
// TODO can we just use this light value ??
ir.func_229112_a_(mat, cons, segment, stack, (bl << 16) | sl, OverlayTexture.field_229196_a_);
// Preserve this as it represents the "world" lighting
GlStateManager.lastBrightnessX = lastBl;
GlStateManager.lastBrightnessY = lastSl;
segment.clear();
}
/** /**
* internal, relies on fixed format of FaceBakery * internal, relies on fixed format of FaceBakery
*/ */
// TODO Do we need this?
public static void fillNormal(int[] faceData, Direction facing) public static void fillNormal(int[] faceData, Direction facing)
{ {
Vector3f v1 = getVertexPos(faceData, 3); Vector3f v1 = getVertexPos(faceData, 3);
@@ -741,7 +580,7 @@ public class ForgeHooksClient
for(int i = 0; i < 4; i++) for(int i = 0; i < 4; i++)
{ {
faceData[i * 8 + 6] = normal; faceData[i * 8 + 7] = normal;
} }
} }
@@ -787,42 +626,6 @@ public class ForgeHooksClient
return from.getItem().shouldCauseReequipAnimation(from, to, changed); return from.getItem().shouldCauseReequipAnimation(from, to, changed);
} }
public static BlockFaceUV applyUVLock(BlockFaceUV blockFaceUV, Direction originalSide, TransformationMatrix rotation, ResourceLocation p_228824_9_)
{
TransformationMatrix global = new TransformationMatrix(rotation.func_227988_c_());
Matrix4f uv = TransformationHelper.getUVLockTransform(global, originalSide).func_227988_c_();
float u0 = blockFaceUV.getVertexU(blockFaceUV.getVertexRotatedRev(0));
float v0 = blockFaceUV.getVertexV(blockFaceUV.getVertexRotatedRev(0));
Vector4f vec = new Vector4f(u0 / 16, v0 / 16, 0, 1);
vec.func_229372_a_(uv);
float uMin = 16 * vec.getX(); // / vec.w;
float vMin = 16 * vec.getY(); // / vec.w;
float u1 = blockFaceUV.getVertexU(blockFaceUV.getVertexRotatedRev(2));
float v1 = blockFaceUV.getVertexV(blockFaceUV.getVertexRotatedRev(2));
vec.set(u1 / 16,v1 / 16,0,1);
vec.func_229372_a_(uv);
float uMax = 16 * vec.getX(); // / vec.w;
float vMax = 16 * vec.getY(); // / vec.w;
if (uMin > uMax && u0 < u1 || uMin < uMax && u0 > u1)
{
float t = uMin;
uMin = uMax;
uMax = t;
}
if (vMin > vMax && v0 < v1 || vMin < vMax && v0 > v1)
{
float t = vMin;
vMin = vMax;
vMax = t;
}
float a = (float)Math.toRadians(blockFaceUV.rotation);
Vector3f rv = new Vector3f(MathHelper.cos(a), MathHelper.sin(a), 0);
Matrix3f rot = new Matrix3f(uv);
rv.func_229188_a_(rot);
int angle = MathHelper.normalizeAngle(-(int)Math.round(Math.toDegrees(Math.atan2(rv.getY(), rv.getX())) / 90) * 90, 360);
return new BlockFaceUV(new float[]{ uMin, vMin, uMax, vMax }, angle);
}
public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(MainWindow res, ClientBossInfo bossInfo, int x, int y, int increment) public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(MainWindow res, ClientBossInfo bossInfo, int x, int y, int increment)
{ {
RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res), RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res),
@@ -846,11 +649,9 @@ public class ForgeHooksClient
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static IBakedModel handlePerspective(IBakedModel model, ItemCameraTransforms.TransformType type, MatrixStack stack) public static IBakedModel handlePerspective(IBakedModel model, ItemCameraTransforms.TransformType type, MatrixStack stack)
{ {
if (!model.getItemCameraTransforms().getTransform(type).equals(ItemTransformVec3f.DEFAULT)) TransformationMatrix tr = TransformationHelper.toTransformation(model.getItemCameraTransforms().getTransform(type));
{ if(!tr.isIdentity()) {
// Push to the matrix to make it not empty and indicate that we want to transform things tr.push(stack);
stack.func_227860_a_();
model.getItemCameraTransforms().getTransform(type).func_228830_a_(false, stack);
} }
return model; return model;
} }
@@ -1002,4 +803,11 @@ public class ForgeHooksClient
{ {
return MinecraftForge.EVENT_BUS.post(new InputEvent.RawMouseEvent(button, action, mods)); return MinecraftForge.EVENT_BUS.post(new InputEvent.RawMouseEvent(button, action, mods));
} }
public static InputEvent.ClickInputEvent onClickInput(int button, KeyBinding keyBinding, Hand hand)
{
InputEvent.ClickInputEvent event = new InputEvent.ClickInputEvent(button, keyBinding, hand);
MinecraftForge.EVENT_BUS.post(event);
return event;
}
} }
@@ -34,6 +34,7 @@ import java.util.function.Supplier;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import net.minecraft.client.renderer.RenderType;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import com.google.common.cache.Cache; import com.google.common.cache.Cache;
@@ -52,11 +53,10 @@ import net.minecraft.world.World;
public class MinecraftForgeClient public class MinecraftForgeClient
{ {
/* TODO: reimplement public static RenderType getRenderLayer()
public static BlockRenderLayer getRenderLayer()
{ {
return ForgeHooksClient.renderLayer.get(); return ForgeHooksClient.renderLayer.get();
}*/ }
/** /**
* returns the Locale set by the player in Minecraft. * returns the Locale set by the player in Minecraft.
@@ -31,9 +31,8 @@ import net.minecraft.client.renderer.WorldRenderer;
* An event called whenever the selection highlight around blocks is about to be rendered. * An event called whenever the selection highlight around blocks is about to be rendered.
* Canceling this event stops the selection highlight from being rendered. * Canceling this event stops the selection highlight from being rendered.
*/ */
//TODO: in 1.15 rename to DrawHighlightEvent
@Cancelable @Cancelable
public class DrawBlockHighlightEvent extends Event public class DrawHighlightEvent extends Event
{ {
private final WorldRenderer context; private final WorldRenderer context;
private final ActiveRenderInfo info; private final ActiveRenderInfo info;
@@ -41,7 +40,7 @@ public class DrawBlockHighlightEvent extends Event
private final int subID; private final int subID;
private final float partialTicks; private final float partialTicks;
public DrawBlockHighlightEvent(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks) public DrawHighlightEvent(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks)
{ {
this.context = context; this.context = context;
this.info = info; this.info = info;
@@ -60,7 +59,7 @@ public class DrawBlockHighlightEvent extends Event
* A variant of the DrawBlockHighlightEvent only called when a block is highlighted. * A variant of the DrawBlockHighlightEvent only called when a block is highlighted.
*/ */
@Cancelable @Cancelable
public static class HighlightBlock extends DrawBlockHighlightEvent public static class HighlightBlock extends DrawHighlightEvent
{ {
public HighlightBlock(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks) public HighlightBlock(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks)
{ {
@@ -79,7 +78,7 @@ public class DrawBlockHighlightEvent extends Event
* Canceling this event has no effect. * Canceling this event has no effect.
*/ */
@Cancelable @Cancelable
public static class HighlightEntity extends DrawBlockHighlightEvent public static class HighlightEntity extends DrawHighlightEvent
{ {
public HighlightEntity(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks) public HighlightEntity(WorldRenderer context, ActiveRenderInfo info, RayTraceResult target, int subID, float partialTicks)
{ {
@@ -19,7 +19,9 @@
package net.minecraftforge.client.event; package net.minecraftforge.client.event;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.client.util.InputMappings; import net.minecraft.client.util.InputMappings;
import net.minecraft.util.Hand;
import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.Event;
@@ -253,4 +255,71 @@ public class InputEvent extends Event
return this.modifiers; return this.modifiers;
} }
} }
/**
* This event fires when one of the keybindings that by default involves clicking the mouse buttons
* is triggered.
*
* These key bindings are use item, pick block and attack keybindings. (right, middle and left mouse click)
* In the case that these key bindings are re-bound to a keyboard key the event will still be fired as normal.
*/
@Cancelable
public static class ClickInputEvent extends InputEvent
{
private final int button;
private final KeyBinding keyBinding;
private final Hand hand;
private boolean handSwing = true;
public ClickInputEvent(int button, KeyBinding keyBinding, Hand hand)
{
this.button = button;
this.keyBinding = keyBinding;
this.hand = hand;
}
/**
* Set to false to disable the hand swing animation.
* Has no effect if this is a pick block input.
*/
public void setSwingHand(boolean value)
{
handSwing = value;
}
public boolean shouldSwingHand()
{
return handSwing;
}
/**
* The hand which is causing the event to get triggered.
* The event will be called for both hands if this is a use item input regardless
* of if either gets canceled.
* Will always be MAIN_HAND if this is an attack or pick block input.
*/
public Hand getHand()
{
return hand;
}
public boolean isAttack()
{
return button == 0;
}
public boolean isUseItem()
{
return button == 1;
}
public boolean isPickBlock()
{
return button == 2;
}
public KeyBinding getKeyBinding()
{
return keyBinding;
}
}
} }
@@ -28,6 +28,7 @@ import net.minecraft.entity.LivingEntity;
public abstract class RenderLivingEvent<T extends LivingEntity, M extends EntityModel<T>> extends Event public abstract class RenderLivingEvent<T extends LivingEntity, M extends EntityModel<T>> extends Event
{ {
private final LivingEntity entity; private final LivingEntity entity;
private final LivingRenderer<T, M> renderer; private final LivingRenderer<T, M> renderer;
private final float partialRenderTick; private final float partialRenderTick;
@@ -51,24 +52,10 @@ public abstract class RenderLivingEvent<T extends LivingEntity, M extends Entity
{ {
public Pre(LivingEntity entity, LivingRenderer<T, M> renderer, float partialRenderTick, MatrixStack matrixStack){ super(entity, renderer, partialRenderTick, matrixStack); } public Pre(LivingEntity entity, LivingRenderer<T, M> renderer, float partialRenderTick, MatrixStack matrixStack){ super(entity, renderer, partialRenderTick, matrixStack); }
} }
public static class Post<T extends LivingEntity, M extends EntityModel<T>> extends RenderLivingEvent<T, M> public static class Post<T extends LivingEntity, M extends EntityModel<T>> extends RenderLivingEvent<T, M>
{ {
public Post(LivingEntity entity, LivingRenderer<T, M> renderer, float partialRenderTick, MatrixStack matrixStack){ super(entity, renderer, partialRenderTick, matrixStack); } public Post(LivingEntity entity, LivingRenderer<T, M> renderer, float partialRenderTick, MatrixStack matrixStack){ super(entity, renderer, partialRenderTick, matrixStack); }
} }
// TODO: 1.15 moved all name rendering to EntityRenderer, such that there's not a Living-specific feature anymore
public abstract static class Specials<T extends LivingEntity, M extends EntityModel<T>> extends RenderLivingEvent<T, M>
{
public Specials(LivingEntity entity, LivingRenderer<T, M> renderer, MatrixStack matrixStack){ super(entity, renderer, 0, matrixStack); }
@Cancelable
public static class Pre<T extends LivingEntity, M extends EntityModel<T>> extends Specials<T, M>
{
public Pre(LivingEntity entity, LivingRenderer<T, M> renderer, MatrixStack matrixStack){ super(entity, renderer, matrixStack); }
}
public static class Post<T extends LivingEntity, M extends EntityModel<T>> extends Specials<T, M>
{
public Post(LivingEntity entity, LivingRenderer<T, M> renderer, MatrixStack matrixStack){ super(entity, renderer, matrixStack); }
}
}
} }
@@ -0,0 +1,84 @@
package net.minecraftforge.client.event;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.entity.Entity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.eventbus.api.Event;
/**
* RenderNameplateEvent is fired whenever the entity renderer attempts to render a name plate/tag of an entity.
* <br>
* {@link #nameplateContent} contains the content being rendered on the name plate/tag. This can be changed by mods.<br>
* {@link #originalContent} contains the original content being rendered on the name plate/tag. This cannot be
* changed by mods.<br>
* {@link #matrixStack} contains the matrix stack instance involved in rendering the name plate/tag. This cannot
* be changed by mods.<br>
* {@link #renderTypeBuffer} contains the render type buffer instance involved in rendering the name plate/tag.
* This cannot be changed by mods.<br>
* <br>
* This event has a result. {@link HasResult}. <br>
* ALLOW will force-render name plate/tag, DEFAULT will ignore the hook and continue using the vanilla check
* & DENY will prevent name plate/tag from rendering<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Event.HasResult
public class RenderNameplateEvent extends EntityEvent
{
private String nameplateContent;
private final String originalContent;
private final MatrixStack matrixStack;
private final IRenderTypeBuffer renderTypeBuffer;
public RenderNameplateEvent(Entity entity, String content, MatrixStack matrixStack, IRenderTypeBuffer renderTypeBuffer)
{
super(entity);
this.originalContent = content;
this.setContent(this.originalContent);
this.matrixStack = matrixStack;
this.renderTypeBuffer = renderTypeBuffer;
}
/**
* Sets the content that is to be rendered on the name plate/tag
*/
public void setContent(String contents)
{
this.nameplateContent = contents;
}
/**
* The content being rendered on the name plate/tag
*/
public String getContent()
{
return this.nameplateContent;
}
/**
* The original content being rendered on the name plate/tag
*/
public String getOriginalContent()
{
return this.originalContent;
}
/**
* The matrix stack used during the rendering of the name plate/tag
*/
public MatrixStack getMatrixStack()
{
return this.matrixStack;
}
/**
* The render type buffer used during the rendering of the name plate/tag
*/
public IRenderTypeBuffer getRenderTypeBuffer()
{
return this.renderTypeBuffer;
}
}
@@ -42,12 +42,17 @@ public interface IForgeTransformationMatrix
default void push(MatrixStack stack) default void push(MatrixStack stack)
{ {
stack.func_227860_a_(); stack.func_227860_a_();
stack.func_227863_a_(getTransformaion().func_227989_d_());
Vector3f trans = getTransformaion().getTranslation(); Vector3f trans = getTransformaion().getTranslation();
stack.func_227861_a_(trans.getX(), trans.getY(), trans.getZ()); stack.func_227861_a_(trans.getX(), trans.getY(), trans.getZ());
stack.func_227863_a_(getTransformaion().getRightRot());
stack.func_227863_a_(getTransformaion().func_227989_d_());
Vector3f scale = getTransformaion().getScale(); Vector3f scale = getTransformaion().getScale();
stack.func_227861_a_(scale.getX(), scale.getY(), scale.getZ()); stack.func_227862_a_(scale.getX(), scale.getY(), scale.getZ());
stack.func_227863_a_(getTransformaion().getRightRot());
} }
default TransformationMatrix compose(TransformationMatrix other) default TransformationMatrix compose(TransformationMatrix other)
@@ -21,12 +21,17 @@ package net.minecraftforge.client.extensions;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder; import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.Matrix3f;
import net.minecraft.client.renderer.Matrix4f; import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.Vector4f; import net.minecraft.client.renderer.Vector4f;
import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.math.Vec3i; import net.minecraft.util.math.Vec3i;
import net.minecraftforge.client.model.pipeline.LightUtil;
import org.lwjgl.system.MemoryStack; import org.lwjgl.system.MemoryStack;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
@@ -34,13 +39,25 @@ import java.nio.IntBuffer;
public interface IForgeVertexBuilder public interface IForgeVertexBuilder
{ {
default IVertexBuilder getVertexBuilder() { return (IVertexBuilder)this; }
// Copy of func_227889_a_, but enables tinting
default void addVertexData(MatrixStack.Entry matrixStack, BakedQuad bakedQuad, float red, float green, float blue, int lightmapCoord, int overlayColor, boolean readExistingColor) {
getVertexBuilder().func_227890_a_(matrixStack, bakedQuad, new float[]{1.0F, 1.0F, 1.0F, 1.0F}, red, green, blue, new int[]{lightmapCoord, lightmapCoord, lightmapCoord, lightmapCoord}, overlayColor, readExistingColor);
}
// Copy of func_227889_a_ with alpha support // Copy of func_227889_a_ with alpha support
default void addVertexData(MatrixStack.Entry matrixEntry, BakedQuad bakedQuad, float red, float green, float blue, float alpha, int lightmapCoord, int overlayColkor) { default void addVertexData(MatrixStack.Entry matrixEntry, BakedQuad bakedQuad, float red, float green, float blue, float alpha, int lightmapCoord, int overlayColor) {
addVertexData(matrixEntry, bakedQuad, new float[]{1.0F, 1.0F, 1.0F, 1.0F}, red, green, blue, alpha, new int[]{lightmapCoord, lightmapCoord, lightmapCoord, lightmapCoord}, overlayColkor, false); addVertexData(matrixEntry, bakedQuad, new float[]{1.0F, 1.0F, 1.0F, 1.0F}, red, green, blue, alpha, new int[]{lightmapCoord, lightmapCoord, lightmapCoord, lightmapCoord}, overlayColor, false);
}
// Copy of func_227889_a_ with alpha support
default void addVertexData(MatrixStack.Entry matrixEntry, BakedQuad bakedQuad, float red, float green, float blue, float alpha, int lightmapCoord, int overlayColor, boolean readExistingColor) {
addVertexData(matrixEntry, bakedQuad, new float[]{1.0F, 1.0F, 1.0F, 1.0F}, red, green, blue, alpha, new int[]{lightmapCoord, lightmapCoord, lightmapCoord, lightmapCoord}, overlayColor, readExistingColor);
} }
// Copy of func_227890_a_ with alpha support // Copy of func_227890_a_ with alpha support
default void addVertexData(MatrixStack.Entry matrixEntry, BakedQuad bakedQuad, float[] baseBrightness, float red, float green, float blue, float alpha, int[] lightmapCoords, int overlayCoords, boolean p_227890_9_) { default void addVertexData(MatrixStack.Entry matrixEntry, BakedQuad bakedQuad, float[] baseBrightness, float red, float green, float blue, float alpha, int[] lightmapCoords, int overlayCoords, boolean readExistingColor) {
int[] aint = bakedQuad.getVertexData(); int[] aint = bakedQuad.getVertexData();
Vec3i faceNormal = bakedQuad.getFace().getDirectionVec(); Vec3i faceNormal = bakedQuad.getFace().getDirectionVec();
Vector3f normal = new Vector3f((float)faceNormal.getX(), (float)faceNormal.getY(), (float)faceNormal.getZ()); Vector3f normal = new Vector3f((float)faceNormal.getX(), (float)faceNormal.getY(), (float)faceNormal.getZ());
@@ -63,7 +80,7 @@ public interface IForgeVertexBuilder
float cg; float cg;
float cb; float cb;
float ca; float ca;
if (p_227890_9_) { if (readExistingColor) {
float r = (float)(bytebuffer.get(12) & 255) / 255.0F; float r = (float)(bytebuffer.get(12) & 255) / 255.0F;
float g = (float)(bytebuffer.get(13) & 255) / 255.0F; float g = (float)(bytebuffer.get(13) & 255) / 255.0F;
float b = (float)(bytebuffer.get(14) & 255) / 255.0F; float b = (float)(bytebuffer.get(14) & 255) / 255.0F;
@@ -79,14 +96,35 @@ public interface IForgeVertexBuilder
ca = alpha; ca = alpha;
} }
int lightmapCoord = lightmapCoords[v]; int lightmapCoord = applyBakedLighting(lightmapCoords[v], bytebuffer);
float f9 = bytebuffer.getFloat(16); float f9 = bytebuffer.getFloat(16);
float f10 = bytebuffer.getFloat(20); float f10 = bytebuffer.getFloat(20);
Vector4f pos = new Vector4f(f, f1, f2, 1.0F); Vector4f pos = new Vector4f(f, f1, f2, 1.0F);
pos.func_229372_a_(matrix4f); pos.func_229372_a_(matrix4f);
applyBakedNormals(normal, bytebuffer, matrixEntry.func_227872_b_());
((IVertexBuilder)this).func_225588_a_(pos.getX(), pos.getY(), pos.getZ(), cr, cg, cb, ca, f9, f10, overlayCoords, lightmapCoord, normal.getX(), normal.getY(), normal.getZ()); ((IVertexBuilder)this).func_225588_a_(pos.getX(), pos.getY(), pos.getZ(), cr, cg, cb, ca, f9, f10, overlayCoords, lightmapCoord, normal.getX(), normal.getY(), normal.getZ());
} }
} }
}
default int applyBakedLighting(int lightmapCoord, ByteBuffer data) {
int bl = LightTexture.func_228450_a_(lightmapCoord);
int sl = LightTexture.func_228454_b_(lightmapCoord);
int offset = LightUtil.getLightOffset(0) * 4; // int offset for vertex 0 * 4 bytes per int
int blBaked = Short.toUnsignedInt(data.getShort(offset)) >> 4;
int slBaked = Short.toUnsignedInt(data.getShort(offset + 2)) >> 4;
bl = Math.max(bl, blBaked);
sl = Math.max(sl, slBaked);
return LightTexture.func_228451_a_(bl, sl);
}
default void applyBakedNormals(Vector3f generated, ByteBuffer data, Matrix3f normalTransform) {
byte nx = data.get(28);
byte ny = data.get(29);
byte nz = data.get(30);
if (nx != 0 || ny != 0 || nz != 0) {
generated.set(nx / 127f, ny / 127f, nz / 127f);
generated.func_229188_a_(normalTransform);
}
} }
} }
@@ -24,7 +24,6 @@ import java.util.List;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@@ -35,7 +34,7 @@ import net.minecraft.client.gui.IRenderable;
import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.client.gui.GuiUtils;
public abstract class ScrollPanel extends FocusableGui implements IRenderable public abstract class ScrollPanel extends FocusableGui implements IRenderable
{ {
@@ -1,83 +0,0 @@
/*
* 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.client.model;
import com.google.common.collect.ImmutableList;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.client.renderer.vertex.VertexFormatElement.Type;
import net.minecraft.client.renderer.vertex.VertexFormatElement.Usage;
public class Attributes
{
/*
* Default format of the data in IBakedModel
*/
public static final VertexFormat DEFAULT_BAKED_FORMAT = DefaultVertexFormats.BLOCK;
/*
* Can first format be used where second is expected
*/
public static boolean moreSpecific(VertexFormat first, VertexFormat second)
{
int size = first.getSize();
if(size != second.getSize()) return false;
int padding = 0;
int j = 0;
ImmutableList<VertexFormatElement> elementsFirst = first.func_227894_c_();
ImmutableList<VertexFormatElement> elementsSecond = second.func_227894_c_();
for(VertexFormatElement firstAttr : elementsFirst)
{
while(j < elementsSecond.size() && elementsSecond.get(j).getUsage() == Usage.PADDING)
{
padding += elementsSecond.get(j++).getSize();
}
if(j >= elementsSecond.size() && padding == 0)
{
// if no padding is left, but there are still elements in first (we're processing one) - it doesn't fit
return false;
}
if(padding == 0)
{
// no padding - attributes have to match
VertexFormatElement secondAttr = elementsSecond.get(j++);
if(
firstAttr.getIndex() != secondAttr.getIndex() ||
firstAttr.getElementCount() != secondAttr.getElementCount() ||
firstAttr.getType() != secondAttr.getType() ||
firstAttr.getUsage() != secondAttr.getUsage())
{
return false;
}
}
else
{
// padding - attribute should fit in it
padding -= firstAttr.getSize();
if(padding < 0) return false;
}
}
if(padding != 0 || j != elementsSecond.size()) return false;
return true;
}
}
@@ -61,6 +61,7 @@ public class BakedItemModel implements IBakedModel
@Override public boolean isAmbientOcclusion() { return true; } @Override public boolean isAmbientOcclusion() { return true; }
@Override public boolean isGui3d() { return false; } @Override public boolean isGui3d() { return false; }
@Override public boolean func_230044_c_() { return false; }
@Override public boolean isBuiltInRenderer() { return false; } @Override public boolean isBuiltInRenderer() { return false; }
@Override public TextureAtlasSprite getParticleTexture() { return particle; } @Override public TextureAtlasSprite getParticleTexture() { return particle; }
@Override public ItemOverrideList getOverrides() { return overrides; } @Override public ItemOverrideList getOverrides() { return overrides; }
@@ -69,6 +69,12 @@ public abstract class BakedModelWrapper<T extends IBakedModel> implements IBaked
return originalModel.isGui3d(); return originalModel.isGui3d();
} }
@Override
public boolean func_230044_c_()
{
return originalModel.func_230044_c_();
}
@Override @Override
public boolean isBuiltInRenderer() public boolean isBuiltInRenderer()
{ {
@@ -44,6 +44,13 @@ public class BlockModelConfiguration implements IModelConfiguration
this.owner = owner; this.owner = owner;
} }
@Nullable
@Override
public IUnbakedModel getOwnerModel()
{
return owner;
}
@Override @Override
public String getModelName() public String getModelName()
{ {
@@ -99,7 +106,7 @@ public class BlockModelConfiguration implements IModelConfiguration
@Override @Override
public boolean isShadedInGui() { public boolean isShadedInGui() {
return owner.isGui3d(); return owner.func_230176_c_() == BlockModel.GuiLight.SIDE;
} }
@Override @Override
@@ -138,12 +145,12 @@ public class BlockModelConfiguration implements IModelConfiguration
geometry.getTextures(this, modelGetter, missingTextureErrors); geometry.getTextures(this, modelGetter, missingTextureErrors);
} }
public IBakedModel bake(ModelBakery bakery, Function<Material, TextureAtlasSprite> bakedTextureGetter, IModelTransform sprite, ItemOverrideList overrides, ResourceLocation modelLocation) public IBakedModel bake(ModelBakery bakery, Function<Material, TextureAtlasSprite> bakedTextureGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
{ {
IModelGeometry<?> geometry = getCustomGeometry(); IModelGeometry<?> geometry = getCustomGeometry();
if (geometry == null) if (geometry == null)
throw new IllegalStateException("Can not use custom baking without custom geometry"); throw new IllegalStateException("Can not use custom baking without custom geometry");
return geometry.bake(this, bakery, bakedTextureGetter, sprite, overrides, modelLocation); return geometry.bake(this, bakery, bakedTextureGetter, modelTransform, overrides, modelLocation);
} }
public static class VisibilityData public static class VisibilityData
@@ -17,22 +17,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
package net.minecraftforge.client.model.composite; package net.minecraftforge.client.model;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.datafixers.util.Pair; import com.mojang.datafixers.util.Pair;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.resources.IResourceManager; import net.minecraft.resources.IResourceManager;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.*;
import net.minecraftforge.client.model.data.EmptyModelData; import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.client.model.data.IDynamicBakedModel;
import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.data.ModelProperty; import net.minecraftforge.client.model.data.ModelProperty;
import net.minecraftforge.client.model.geometry.IModelGeometryPart; import net.minecraftforge.client.model.geometry.IModelGeometryPart;
@@ -43,7 +43,7 @@ import javax.annotation.Nullable;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
public class CompositeModel implements IBakedModel public class CompositeModel implements IDynamicBakedModel
{ {
public static final ModelProperty<SubmodelModelData> SUBMODEL_DATA = new ModelProperty<>(); public static final ModelProperty<SubmodelModelData> SUBMODEL_DATA = new ModelProperty<>();
@@ -52,14 +52,16 @@ public class CompositeModel implements IBakedModel
private final boolean isGui3d; private final boolean isGui3d;
private final TextureAtlasSprite particle; private final TextureAtlasSprite particle;
private final ItemOverrideList overrides; private final ItemOverrideList overrides;
private final IModelTransform transforms;
public CompositeModel(boolean isGui3d, boolean isAmbientOcclusion, TextureAtlasSprite particle, ImmutableMap<String, IBakedModel> bakedParts, ItemOverrideList overrides) public CompositeModel(boolean isGui3d, boolean isAmbientOcclusion, TextureAtlasSprite particle, ImmutableMap<String, IBakedModel> bakedParts, IModelTransform combinedTransform, ItemOverrideList overrides)
{ {
this.bakedParts = bakedParts; this.bakedParts = bakedParts;
this.isAmbientOcclusion = isAmbientOcclusion; this.isAmbientOcclusion = isAmbientOcclusion;
this.isGui3d = isGui3d; this.isGui3d = isGui3d;
this.particle = particle; this.particle = particle;
this.overrides = overrides; this.overrides = overrides;
this.transforms = combinedTransform;
} }
@Nonnull @Nonnull
@@ -75,18 +77,6 @@ public class CompositeModel implements IBakedModel
return quads; return quads;
} }
@Deprecated
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand)
{
List<BakedQuad> quads = new ArrayList<>();
for(IBakedModel part : bakedParts.values())
{
quads.addAll(part.getQuads(state, side, rand, EmptyModelData.INSTANCE));
}
return null;
}
@Override @Override
public boolean isAmbientOcclusion() public boolean isAmbientOcclusion()
{ {
@@ -99,6 +89,13 @@ public class CompositeModel implements IBakedModel
return isGui3d; return isGui3d;
} }
@Override
public boolean func_230044_c_()
{
// TODO: Forge: Auto-generated method stub
return false;
}
@Override @Override
public boolean isBuiltInRenderer() public boolean isBuiltInRenderer()
{ {
@@ -117,6 +114,18 @@ public class CompositeModel implements IBakedModel
return overrides; return overrides;
} }
@Override
public boolean doesHandlePerspectives()
{
return true;
}
@Override
public IBakedModel handlePerspective(ItemCameraTransforms.TransformType cameraTransformType, MatrixStack mat)
{
return PerspectiveMapWrapper.handlePerspective(this, transforms, cameraTransformType, mat);
}
@Nullable @Nullable
public IBakedModel getPart(String name) public IBakedModel getPart(String name)
{ {
@@ -150,13 +159,13 @@ public class CompositeModel implements IBakedModel
{ {
private final String name; private final String name;
private final BlockModel model; private final BlockModel model;
private final IModelTransform sprite; private final IModelTransform modelTransform;
private Submodel(String name, BlockModel model, IModelTransform sprite) private Submodel(String name, BlockModel model, IModelTransform modelTransform)
{ {
this.name = name; this.name = name;
this.model = model; this.model = model;
this.sprite = sprite; this.modelTransform = modelTransform;
} }
@Override @Override
@@ -166,19 +175,19 @@ public class CompositeModel implements IBakedModel
} }
@Override @Override
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform sprite, ResourceLocation modelLocation) public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
{ {
throw new UnsupportedOperationException("Attempted to call adQuads on a Submodel instance. Please don't."); throw new UnsupportedOperationException("Attempted to call adQuads on a Submodel instance. Please don't.");
} }
public IBakedModel func_225613_a_(ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform sprite, ResourceLocation modelLocation) public IBakedModel func_225613_a_(ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
{ {
return model.func_225613_a_(bakery, spriteGetter, new ModelTransformComposition(this.sprite, sprite, return model.func_225613_a_(bakery, spriteGetter, new ModelTransformComposition(this.modelTransform, modelTransform,
this.sprite.isUvLock() || sprite.isUvLock()), modelLocation); this.modelTransform.isUvLock() || modelTransform.isUvLock()), modelLocation);
} }
@Override @Override
public Collection<Material> getTextureDependencies(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
{ {
return model.func_225614_a_(modelGetter, missingTextureErrors); return model.func_225614_a_(modelGetter, missingTextureErrors);
} }
@@ -206,7 +215,7 @@ public class CompositeModel implements IBakedModel
} }
@Override @Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform sprite, ItemOverrideList overrides, ResourceLocation modelLocation) public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
{ {
Material particleLocation = owner.resolveTexture("particle"); Material particleLocation = owner.resolveTexture("particle");
TextureAtlasSprite particle = spriteGetter.apply(particleLocation); TextureAtlasSprite particle = spriteGetter.apply(particleLocation);
@@ -217,9 +226,9 @@ public class CompositeModel implements IBakedModel
Submodel submodel = part.getValue(); Submodel submodel = part.getValue();
if (!owner.getPartVisibility(submodel)) if (!owner.getPartVisibility(submodel))
continue; continue;
bakedParts.put(part.getKey(), submodel.func_225613_a_(bakery, spriteGetter, sprite, modelLocation)); bakedParts.put(part.getKey(), submodel.func_225613_a_(bakery, spriteGetter, modelTransform, modelLocation));
} }
return new CompositeModel(owner.isShadedInGui(), owner.useSmoothLighting(), particle, bakedParts.build(), overrides); return new CompositeModel(owner.isShadedInGui(), owner.useSmoothLighting(), particle, bakedParts.build(), owner.getCombinedTransform(), overrides);
} }
@Override @Override
@@ -228,7 +237,7 @@ public class CompositeModel implements IBakedModel
Set<Material> textures = new HashSet<>(); Set<Material> textures = new HashSet<>();
for(Submodel part : parts.values()) for(Submodel part : parts.values())
{ {
part.getTextureDependencies(owner, modelGetter, missingTextureErrors); textures.addAll(part.getTextures(owner, modelGetter, missingTextureErrors));
} }
return textures; return textures;
} }
@@ -255,11 +264,11 @@ public class CompositeModel implements IBakedModel
for(Map.Entry<String, JsonElement> part : modelContents.get("parts").getAsJsonObject().entrySet()) for(Map.Entry<String, JsonElement> part : modelContents.get("parts").getAsJsonObject().entrySet())
{ {
// TODO: Allow customizing state? If so, how? // TODO: Allow customizing state? If so, how?
IModelTransform sprite = SimpleModelTransform.IDENTITY; IModelTransform modelTransform = SimpleModelTransform.IDENTITY;
parts.put(part.getKey(), new Submodel( parts.put(part.getKey(), new Submodel(
part.getKey(), part.getKey(),
ModelLoaderRegistry.ExpandedBlockModelDeserializer.INSTANCE.fromJson(part.getValue(), BlockModel.class), deserializationContext.deserialize(part.getValue(), BlockModel.class),
sprite)); modelTransform));
} }
return new Geometry(parts.build()); return new Geometry(parts.build());
} }
@@ -0,0 +1,318 @@
/*
* 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.client.model;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonObject;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.renderer.Quaternion;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.texture.MissingTextureSprite;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.LivingEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import net.minecraftforge.fluids.FluidUtil;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.resource.IResourceType;
import net.minecraftforge.resource.VanillaResourceType;
import net.minecraftforge.versions.forge.ForgeVersion;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
public final class DynamicBucketModel implements IModelGeometry<DynamicBucketModel>
{
private static final Logger LOGGER = LogManager.getLogger();
public static final ModelResourceLocation LOCATION = new ModelResourceLocation(new ResourceLocation(ForgeVersion.MOD_ID, "dynbucket"), "inventory");
// minimal Z offset to prevent depth-fighting
private static final float NORTH_Z_COVER = 7.496f / 16f;
private static final float SOUTH_Z_COVER = 8.504f / 16f;
private static final float NORTH_Z_FLUID = 7.498f / 16f;
private static final float SOUTH_Z_FLUID = 8.502f / 16f;
@Nonnull
private final Fluid fluid;
private final boolean flipGas;
private final boolean tint;
private final boolean coverIsMask;
public DynamicBucketModel(Fluid fluid, boolean flipGas, boolean tint, boolean coverIsMask)
{
this.fluid = fluid;
this.flipGas = flipGas;
this.tint = tint;
this.coverIsMask = coverIsMask;
}
/**
* Returns a new ModelDynBucket representing the given fluid, but with the same
* other properties (flipGas, tint, coverIsMask).
*/
public DynamicBucketModel withFluid(Fluid newFluid)
{
return new DynamicBucketModel(newFluid, flipGas, tint, coverIsMask);
}
@Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
{
Material particleLocation = owner.resolveTexture("particle");
if (MissingTextureSprite.getLocation().equals(particleLocation.func_229313_b_()))
{
particleLocation = null;
}
Material baseLocation = owner.resolveTexture("base");
if (MissingTextureSprite.getLocation().equals(baseLocation.func_229313_b_()))
{
baseLocation = null;
}
Material fluidMaskLocation = owner.resolveTexture("fluid");
if (MissingTextureSprite.getLocation().equals(fluidMaskLocation.func_229313_b_()))
{
fluidMaskLocation = null;
}
Material coverLocation = owner.resolveTexture("cover");
if (!MissingTextureSprite.getLocation().equals(coverLocation.func_229313_b_()))
{
// cover (the actual item around the other two)
coverLocation = null;
}
IModelTransform transformsFromModel = owner.getCombinedTransform();
ImmutableMap<TransformType, TransformationMatrix> transformMap = transformsFromModel != null ?
PerspectiveMapWrapper.getTransforms(new ModelTransformComposition(transformsFromModel, modelTransform)) :
PerspectiveMapWrapper.getTransforms(modelTransform);
TextureAtlasSprite particleSprite = particleLocation != null ? spriteGetter.apply(particleLocation) : null;
// if the fluid is lighter than air, will manipulate the initial state to be rotated 180deg to turn it upside down
if (flipGas && fluid != Fluids.EMPTY && fluid.getAttributes().isLighterThanAir())
{
modelTransform = new ModelTransformComposition(modelTransform, new SimpleModelTransform(new TransformationMatrix(null, new Quaternion(0, 0, 1, 0), null, null)));
}
TransformationMatrix transform = modelTransform.func_225615_b_();
TextureAtlasSprite fluidSprite = fluid != Fluids.EMPTY ? spriteGetter.apply(ForgeHooksClient.getBlockMaterial(fluid.getAttributes().getStillTexture())) : null;
if (particleSprite == null) particleSprite = fluidSprite;
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
if (baseLocation != null)
{
// build base (insidest)
builder.addAll(ItemLayerModel.getQuadsForSprites(ImmutableList.of(baseLocation), transform, spriteGetter));
}
if (fluidMaskLocation != null && fluidSprite != null)
{
TextureAtlasSprite templateSprite = spriteGetter.apply(fluidMaskLocation);
if (templateSprite != null)
{
// build liquid layer (inside)
builder.addAll(ItemTextureQuadConverter.convertTexture(transform, templateSprite, fluidSprite, NORTH_Z_FLUID, Direction.NORTH, tint ? fluid.getAttributes().getColor() : 0xFFFFFFFF, 1));
builder.addAll(ItemTextureQuadConverter.convertTexture(transform, templateSprite, fluidSprite, SOUTH_Z_FLUID, Direction.SOUTH, tint ? fluid.getAttributes().getColor() : 0xFFFFFFFF, 1));
}
}
if (coverLocation != null && (!coverIsMask || baseLocation != null))
{
// cover (the actual item around the other two)
TextureAtlasSprite coverSprite = spriteGetter.apply(coverLocation);
if (coverSprite != null)
{
if (coverIsMask)
{
TextureAtlasSprite baseSprite = spriteGetter.apply(baseLocation);
builder.addAll(ItemTextureQuadConverter.convertTexture(transform, coverSprite, baseSprite, NORTH_Z_COVER, Direction.NORTH, 0xFFFFFFFF, 1));
builder.addAll(ItemTextureQuadConverter.convertTexture(transform, coverSprite, baseSprite, SOUTH_Z_COVER, Direction.SOUTH, 0xFFFFFFFF, 1));
}
else
{
builder.add(ItemTextureQuadConverter.genQuad(transform, 0, 0, 16, 16, NORTH_Z_COVER, coverSprite, Direction.NORTH, 0xFFFFFFFF, 2));
builder.add(ItemTextureQuadConverter.genQuad(transform, 0, 0, 16, 16, SOUTH_Z_COVER, coverSprite, Direction.SOUTH, 0xFFFFFFFF, 2));
if (particleSprite == null)
{
particleSprite = coverSprite;
}
}
}
}
return new BakedModel(bakery, owner, this, builder.build(), particleSprite, Maps.immutableEnumMap(transformMap), Maps.newHashMap(), transform.isIdentity(), modelTransform);
}
@Override
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
{
Set<Material> texs = Sets.newHashSet();
texs.add(owner.resolveTexture("particle"));
texs.add(owner.resolveTexture("base"));
texs.add(owner.resolveTexture("fluid"));
texs.add(owner.resolveTexture("cover"));
return texs;
}
public enum Loader implements IModelLoader<DynamicBucketModel>
{
INSTANCE;
@Override
public IResourceType getResourceType()
{
return VanillaResourceType.MODELS;
}
@Override
public void onResourceManagerReload(IResourceManager resourceManager)
{
// no need to clear cache since we create a new model instance
}
@Override
public void onResourceManagerReload(IResourceManager resourceManager, Predicate<IResourceType> resourcePredicate)
{
// no need to clear cache since we create a new model instance
}
@Override
public DynamicBucketModel read(JsonDeserializationContext deserializationContext, JsonObject modelContents)
{
if (!modelContents.has("fluid"))
throw new RuntimeException("Bucket model requires 'fluid' value.");
ResourceLocation fluidName = new ResourceLocation(modelContents.get("fluid").getAsString());
Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidName);
boolean flip = false;
if (modelContents.has("flipGas"))
{
flip = modelContents.get("flipGas").getAsBoolean();
}
boolean tint = true;
if (modelContents.has("applyTint"))
{
tint = modelContents.get("applyTint").getAsBoolean();
}
boolean coverIsMask = true;
if (modelContents.has("coverIsMask"))
{
coverIsMask = modelContents.get("coverIsMask").getAsBoolean();
}
// create new model with correct liquid
return new DynamicBucketModel(fluid, flip, tint, coverIsMask);
}
}
private static final class ContainedFluidOverrideHandler extends ItemOverrideList
{
private final ModelBakery bakery;
private ContainedFluidOverrideHandler(ModelBakery bakery)
{
this.bakery = bakery;
}
@Override
public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable LivingEntity entity)
{
return FluidUtil.getFluidContained(stack)
.map(fluidStack -> {
BakedModel model = (BakedModel)originalModel;
Fluid fluid = fluidStack.getFluid();
String name = fluid.getRegistryName().toString();
if (!model.cache.containsKey(name))
{
DynamicBucketModel parent = model.parent.withFluid(fluid);
IBakedModel bakedModel = parent.bake(model.owner, bakery, ModelLoader.defaultTextureGetter(), model.originalTransform, model.getOverrides(), new ResourceLocation("forge:bucket_override"));
model.cache.put(name, bakedModel);
return bakedModel;
}
return model.cache.get(name);
})
// not a fluid item apparently
.orElse(originalModel); // empty bucket
}
}
// the dynamic bucket is based on the empty bucket
private static final class BakedModel extends BakedItemModel
{
private final IModelConfiguration owner;
private final DynamicBucketModel parent;
private final Map<String, IBakedModel> cache; // contains all the baked models since they'll never change
private final IModelTransform originalTransform;
BakedModel(ModelBakery bakery,
IModelConfiguration owner, DynamicBucketModel parent,
ImmutableList<BakedQuad> quads,
TextureAtlasSprite particle,
ImmutableMap<TransformType, TransformationMatrix> transforms,
Map<String, IBakedModel> cache,
boolean untransformed,
IModelTransform originalTransform)
{
super(quads, particle, transforms, new ContainedFluidOverrideHandler(bakery), untransformed);
this.owner = owner;
this.parent = parent;
this.cache = cache;
this.originalTransform = originalTransform;
}
}
}
@@ -40,6 +40,7 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Util;
import net.minecraftforge.common.ForgeConfig; import net.minecraftforge.common.ForgeConfig;
import net.minecraftforge.common.model.TransformationHelper; import net.minecraftforge.common.model.TransformationHelper;
@@ -56,34 +57,28 @@ final class FancyMissingModel implements IUnbakedModel
private static final Material font2 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("minecraft", "font/ascii")); private static final Material font2 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("minecraft", "font/ascii"));
private static final TransformationMatrix smallTransformation = new TransformationMatrix(null, null, new Vector3f(.25f, .25f, .25f), null) private static final TransformationMatrix smallTransformation = new TransformationMatrix(null, null, new Vector3f(.25f, .25f, .25f), null)
.blockCenterToCorner(); .blockCenterToCorner();
private static final LoadingCache<VertexFormat, SimpleModelFontRenderer> fontCache = CacheBuilder.newBuilder().maximumSize(3).build(new CacheLoader<VertexFormat, SimpleModelFontRenderer>() private static final SimpleModelFontRenderer fontRenderer = Util.make(() -> {
{ float [] mv = new float[16];
@Override mv[2*4+0] = 1f / 128f;
public SimpleModelFontRenderer load(VertexFormat format) throws Exception mv[0*4+1] =mv[1*4+2] = -mv[2*4+0];
{ mv[3*4+3] = 1;
float [] mv = new float[16]; mv[0*4+3] = 1;
mv[2*4+0] = 1f / 128f; mv[0*4+3] = 1 + 1f / 0x100;
mv[0*4+1] =mv[1*4+2] = -mv[2*4+0]; mv[0*4+3] = 0;
mv[3*4+3] = 1; Matrix4f m = new Matrix4f(mv);
mv[0*4+3] = 1; return new SimpleModelFontRenderer(
mv[0*4+3] = 1 + 1f / 0x100; Minecraft.getInstance().gameSettings,
mv[0*4+3] = 0; font,
Matrix4f m = new Matrix4f(mv); Minecraft.getInstance().getTextureManager(),
return new SimpleModelFontRenderer( false,
Minecraft.getInstance().gameSettings, m
font, ) {/* TODO Implement once SimpleModelFontRenderer is fixed
Minecraft.getInstance().getTextureManager(), @Override
false, protected float renderUnicodeChar(char c, boolean italic)
m, {
format return super.renderDefaultChar(126, italic);
) {/* TODO Implement once SimpleModelFontRenderer is fixed }
@Override */};
protected float renderUnicodeChar(char c, boolean italic)
{
return super.renderDefaultChar(126, italic);
}
*/};
}
}); });
private final IUnbakedModel missingModel; private final IUnbakedModel missingModel;
@@ -109,12 +104,12 @@ final class FancyMissingModel implements IUnbakedModel
@Nullable @Nullable
@Override @Override
public IBakedModel func_225613_a_(ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform sprite, ResourceLocation modelLocation) public IBakedModel func_225613_a_(ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
{ {
IBakedModel bigMissing = missingModel.func_225613_a_(bakery, spriteGetter, sprite, modelLocation); IBakedModel bigMissing = missingModel.func_225613_a_(bakery, spriteGetter, modelTransform, modelLocation);
ModelTransformComposition smallState = new ModelTransformComposition(sprite, new SimpleModelTransform(smallTransformation)); ModelTransformComposition smallState = new ModelTransformComposition(modelTransform, new SimpleModelTransform(smallTransformation));
IBakedModel smallMissing = missingModel.func_225613_a_(bakery, spriteGetter, smallState, modelLocation); IBakedModel smallMissing = missingModel.func_225613_a_(bakery, spriteGetter, smallState, modelLocation);
return new BakedModel(bigMissing, smallMissing, fontCache.getUnchecked(DefaultVertexFormats.BLOCK), message, spriteGetter.apply(font2)); return new BakedModel(bigMissing, smallMissing, fontRenderer, message, spriteGetter.apply(font2));
} }
static final class BakedModel implements IBakedModel static final class BakedModel implements IBakedModel
@@ -182,6 +177,9 @@ final class FancyMissingModel implements IUnbakedModel
@Override @Override
public boolean isGui3d() { return false; } public boolean isGui3d() { return false; }
@Override
public boolean func_230044_c_() { return false; } // TODO: Forge: Auto-generated method stub
@Override @Override
public boolean isBuiltInRenderer() { return false; } public boolean isBuiltInRenderer() { return false; }
@@ -47,9 +47,9 @@ import net.minecraft.util.math.MathHelper;
import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.geometry.IModelGeometry; import net.minecraftforge.client.model.geometry.IModelGeometry;
import net.minecraftforge.client.model.pipeline.BakedQuadBuilder;
import net.minecraftforge.client.model.pipeline.IVertexConsumer; import net.minecraftforge.client.model.pipeline.IVertexConsumer;
import net.minecraftforge.client.model.pipeline.TRSRTransformer; import net.minecraftforge.client.model.pipeline.TRSRTransformer;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidAttributes;
import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheBuilder;
@@ -57,18 +57,17 @@ import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache; import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
public final class ModelFluid implements IModelGeometry<ModelFluid> public final class FluidModel implements IModelGeometry<FluidModel>
{ {
public static final ModelFluid WATER = new ModelFluid(Fluids.WATER); public static final FluidModel WATER = new FluidModel(Fluids.WATER);
public static final ModelFluid LAVA = new ModelFluid(Fluids.LAVA); public static final FluidModel LAVA = new FluidModel(Fluids.LAVA);
private final Fluid fluid; private final Fluid fluid;
public ModelFluid(Fluid fluid) public FluidModel(Fluid fluid)
{ {
this.fluid = fluid; this.fluid = fluid;
} }
@@ -80,12 +79,12 @@ public final class ModelFluid implements IModelGeometry<ModelFluid>
} }
@Override @Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform sprite, ItemOverrideList overrides, ResourceLocation modelLocation) public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
{ {
FluidAttributes attrs = fluid.getAttributes(); FluidAttributes attrs = fluid.getAttributes();
return new CachingBakedFluid( return new CachingBakedFluid(
sprite.func_225615_b_(), modelTransform.func_225615_b_(),
PerspectiveMapWrapper.getTransforms(sprite), PerspectiveMapWrapper.getTransforms(modelTransform),
modelLocation, modelLocation,
attrs.getColor(), attrs.getColor(),
spriteGetter.apply(ForgeHooksClient.getBlockMaterial(attrs.getStillTexture())), spriteGetter.apply(ForgeHooksClient.getBlockMaterial(attrs.getStillTexture())),
@@ -365,10 +364,9 @@ public final class ModelFluid implements IModelGeometry<ModelFluid>
private BakedQuad buildQuad(Direction side, TextureAtlasSprite texture, boolean flip, boolean offset, VertexParameter x, VertexParameter y, VertexParameter z, VertexParameter u, VertexParameter v) private BakedQuad buildQuad(Direction side, TextureAtlasSprite texture, boolean flip, boolean offset, VertexParameter x, VertexParameter y, VertexParameter z, VertexParameter u, VertexParameter v)
{ {
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(DefaultVertexFormats.BLOCK); BakedQuadBuilder builder = new BakedQuadBuilder(texture);
builder.setQuadOrientation(side); builder.setQuadOrientation(side);
builder.setTexture(texture);
builder.setQuadTint(0); builder.setQuadTint(0);
boolean hasTransform = !transformation.isIdentity(); boolean hasTransform = !transformation.isIdentity();
@@ -441,6 +439,13 @@ public final class ModelFluid implements IModelGeometry<ModelFluid>
return false; return false;
} }
@Override
public boolean func_230044_c_()
{
// TODO: Forge: Auto-generated method stub
return false;
}
@Override @Override
public boolean isBuiltInRenderer() public boolean isBuiltInRenderer()
{ {
@@ -477,20 +482,4 @@ public final class ModelFluid implements IModelGeometry<ModelFluid>
return PerspectiveMapWrapper.handlePerspective(this, transforms, type, mat); return PerspectiveMapWrapper.handlePerspective(this, transforms, type, mat);
} }
} }
public ModelFluid process(ImmutableMap<String, String> customData)
{
if(!customData.containsKey("fluid")) return this;
String fluidStr = customData.get("fluid");
JsonElement e = new JsonParser().parse(fluidStr);
String fluid = e.getAsString();/* TODO fluids
if(!FluidRegistry.isFluidRegistered(fluid))
{
LOGGER.fatal("fluid '{}' not found", fluid);
return WATER;
}
return new ModelFluid(FluidRegistry.getFluid(fluid));*/
return this;
}
} }
@@ -1,64 +0,0 @@
/*
* 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.client.model;
import java.util.function.Predicate;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.resource.IResourceType;
import net.minecraftforge.resource.ISelectiveResourceReloadListener;
import net.minecraftforge.resource.VanillaResourceType;
public interface ICustomModelLoader extends ISelectiveResourceReloadListener
{
@Override
void onResourceManagerReload(IResourceManager resourceManager);
@Override
default void onResourceManagerReload(IResourceManager resourceManager, Predicate<IResourceType> resourcePredicate)
{
if (resourcePredicate.test(VanillaResourceType.MODELS))
{
onResourceManagerReload(resourceManager);
}
}
/**
* Checks if given model should be loaded by this loader.
* Reading file contents is inadvisable, if possible decision should be made based on the location alone.
* @param modelLocation The path, either to an actual file or a {@link net.minecraft.client.renderer.model.ModelResourceLocation}.
*/
boolean accepts(ResourceLocation modelLocation);
/**
* @param modelLocation The model to (re)load, either path to an
* actual file or a {@link net.minecraft.client.renderer.model.ModelResourceLocation}.
*/
IUnbakedModel loadModel(ResourceLocation modelLocation) throws Exception;
@Override
default IResourceType getResourceType()
{
return VanillaResourceType.MODELS;
}
}
@@ -20,15 +20,25 @@
package net.minecraftforge.client.model; package net.minecraftforge.client.model;
import net.minecraft.client.renderer.model.IModelTransform; import net.minecraft.client.renderer.model.IModelTransform;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.model.Material; import net.minecraft.client.renderer.model.Material;
import net.minecraftforge.client.model.geometry.IModelGeometryPart; import net.minecraftforge.client.model.geometry.IModelGeometryPart;
import javax.annotation.Nullable;
/* /*
* Interface that provides generic access to the data within BlockModel, * Interface that provides generic access to the data within BlockModel,
* while allowing non-blockmodel usage of models * while allowing non-blockmodel usage of models
*/ */
public interface IModelConfiguration { public interface IModelConfiguration {
/**
* If available, gets the owning model (usually BlockModel) of this configuration
*/
@Nullable
IUnbakedModel getOwnerModel();
/** /**
* @return The name of the model being baked, for logging and cache purposes. * @return The name of the model being baked, for logging and cache purposes.
*/ */
@@ -19,31 +19,30 @@
package net.minecraftforge.client.model; package net.minecraftforge.client.model;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.mojang.datafixers.util.Pair; import com.mojang.datafixers.util.Pair;
import net.minecraft.client.renderer.TransformationMatrix; import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import net.minecraftforge.client.model.pipeline.BakedQuadBuilder;
import net.minecraftforge.client.model.pipeline.IVertexConsumer; import net.minecraftforge.client.model.pipeline.IVertexConsumer;
import net.minecraftforge.client.model.pipeline.TRSRTransformer; import net.minecraftforge.client.model.pipeline.TRSRTransformer;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import java.util.Arrays; import java.util.Arrays;
import java.util.BitSet; import java.util.BitSet;
import java.util.Collection; import java.util.Collection;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
/** /**
* Forge reimplementation of vanilla {@link ItemModelGenerator}, i.e. builtin/generated models, * Forge reimplementation of vanilla {@link ItemModelGenerator}, i.e. builtin/generated models,
* with the following changes: * with the following changes:
@@ -83,25 +82,30 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
} }
@Override @Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform sprite, ItemOverrideList overrides, ResourceLocation modelLocation) public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
{ {
//TODO: Verify //TODO: Verify
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder(); TransformationMatrix transform = modelTransform.func_225615_b_();
TransformationMatrix transform = sprite.func_225615_b_(); ImmutableList<BakedQuad> quads = getQuadsForSprites(textures, transform, spriteGetter);
boolean identity = transform.isIdentity();
for(int i = 0; i < textures.size(); i++)
{
TextureAtlasSprite tas = spriteGetter.apply(textures.get(i));
builder.addAll(getQuadsForSprite(i, tas, DefaultVertexFormats.BLOCK, transform));
}
TextureAtlasSprite particle = spriteGetter.apply( TextureAtlasSprite particle = spriteGetter.apply(
owner.isTexturePresent("particle") ? owner.resolveTexture("particle") : textures.get(0) owner.isTexturePresent("particle") ? owner.resolveTexture("particle") : textures.get(0)
); );
ImmutableMap<TransformType, TransformationMatrix> map = PerspectiveMapWrapper.getTransforms(sprite); ImmutableMap<TransformType, TransformationMatrix> map = PerspectiveMapWrapper.getTransforms(modelTransform);
return new BakedItemModel(builder.build(), particle, map, overrides, identity); return new BakedItemModel(quads, particle, map, overrides, transform.isIdentity());
} }
public static ImmutableList<BakedQuad> getQuadsForSprite(int tint, TextureAtlasSprite sprite, VertexFormat format, TransformationMatrix transform) public static ImmutableList<BakedQuad> getQuadsForSprites(List<Material> textures, TransformationMatrix transform, Function<Material, TextureAtlasSprite> spriteGetter)
{
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
for(int i = 0; i < textures.size(); i++)
{
TextureAtlasSprite tas = spriteGetter.apply(textures.get(i));
builder.addAll(getQuadsForSprite(i, tas, transform));
}
return builder.build();
}
public static ImmutableList<BakedQuad> getQuadsForSprite(int tint, TextureAtlasSprite sprite, TransformationMatrix transform)
{ {
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder(); ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
@@ -192,7 +196,7 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
{ {
// make quad [uStart, u] // make quad [uStart, u]
int off = facing == Direction.DOWN ? 1 : 0; int off = facing == Direction.DOWN ? 1 : 0;
builder.add(buildSideQuad(format, transform, facing, tint, sprite, uStart, v+off, u-uStart)); builder.add(buildSideQuad(transform, facing, tint, sprite, uStart, v+off, u-uStart));
building = false; building = false;
} }
else if (!building && face) // start new quad else if (!building && face) // start new quad
@@ -206,7 +210,7 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
{ {
// make quad [uStart, uEnd] // make quad [uStart, uEnd]
int off = facing == Direction.DOWN ? 1 : 0; int off = facing == Direction.DOWN ? 1 : 0;
builder.add(buildSideQuad(format, transform, facing, tint, sprite, uStart, v+off, uEnd-uStart)); builder.add(buildSideQuad(transform, facing, tint, sprite, uStart, v+off, uEnd-uStart));
} }
} }
} }
@@ -239,7 +243,7 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
{ {
// make quad [vStart, v] // make quad [vStart, v]
int off = facing == Direction.EAST ? 1 : 0; int off = facing == Direction.EAST ? 1 : 0;
builder.add(buildSideQuad(format, transform, facing, tint, sprite, u+off, vStart, v-vStart)); builder.add(buildSideQuad(transform, facing, tint, sprite, u+off, vStart, v-vStart));
building = false; building = false;
} }
else if (!building && face) // start new quad else if (!building && face) // start new quad
@@ -253,20 +257,20 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
{ {
// make quad [vStart, vEnd] // make quad [vStart, vEnd]
int off = facing == Direction.EAST ? 1 : 0; int off = facing == Direction.EAST ? 1 : 0;
builder.add(buildSideQuad(format, transform, facing, tint, sprite, u+off, vStart, vEnd-vStart)); builder.add(buildSideQuad(transform, facing, tint, sprite, u+off, vStart, vEnd-vStart));
} }
} }
} }
// front // front
builder.add(buildQuad(format, transform, Direction.NORTH, sprite, tint, builder.add(buildQuad(transform, Direction.NORTH, sprite, tint,
0, 0, 7.5f / 16f, sprite.getMinU(), sprite.getMaxV(), 0, 0, 7.5f / 16f, sprite.getMinU(), sprite.getMaxV(),
0, 1, 7.5f / 16f, sprite.getMinU(), sprite.getMinV(), 0, 1, 7.5f / 16f, sprite.getMinU(), sprite.getMinV(),
1, 1, 7.5f / 16f, sprite.getMaxU(), sprite.getMinV(), 1, 1, 7.5f / 16f, sprite.getMaxU(), sprite.getMinV(),
1, 0, 7.5f / 16f, sprite.getMaxU(), sprite.getMaxV() 1, 0, 7.5f / 16f, sprite.getMaxU(), sprite.getMaxV()
)); ));
// back // back
builder.add(buildQuad(format, transform, Direction.SOUTH, sprite, tint, builder.add(buildQuad(transform, Direction.SOUTH, sprite, tint,
0, 0, 8.5f / 16f, sprite.getMinU(), sprite.getMaxV(), 0, 0, 8.5f / 16f, sprite.getMinU(), sprite.getMaxV(),
1, 0, 8.5f / 16f, sprite.getMaxU(), sprite.getMaxV(), 1, 0, 8.5f / 16f, sprite.getMaxU(), sprite.getMaxV(),
1, 1, 8.5f / 16f, sprite.getMaxU(), sprite.getMinV(), 1, 1, 8.5f / 16f, sprite.getMaxU(), sprite.getMinV(),
@@ -315,7 +319,7 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
} }
} }
private static BakedQuad buildSideQuad(VertexFormat format, TransformationMatrix transform, Direction side, int tint, TextureAtlasSprite sprite, int u, int v, int size) private static BakedQuad buildSideQuad(TransformationMatrix transform, Direction side, int tint, TextureAtlasSprite sprite, int u, int v, int size)
{ {
final float eps = 1e-2f; final float eps = 1e-2f;
@@ -354,7 +358,7 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
float v1 = 16f * (1f - y1 - dy); float v1 = 16f * (1f - y1 - dy);
return buildQuad( return buildQuad(
format, transform, remap(side), sprite, tint, transform, remap(side), sprite, tint,
x0, y0, z0, sprite.getInterpolatedU(u0), sprite.getInterpolatedV(v0), x0, y0, z0, sprite.getInterpolatedU(u0), sprite.getInterpolatedV(v0),
x1, y1, z0, sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v1), x1, y1, z0, sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v1),
x1, y1, z1, sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v1), x1, y1, z1, sprite.getInterpolatedU(u1), sprite.getInterpolatedV(v1),
@@ -368,32 +372,31 @@ public final class ItemLayerModel implements IModelGeometry<ItemLayerModel>
return side.getAxis() == Direction.Axis.Y ? side.getOpposite() : side; return side.getAxis() == Direction.Axis.Y ? side.getOpposite() : side;
} }
private static BakedQuad buildQuad( private static BakedQuad buildQuad(TransformationMatrix transform, Direction side, TextureAtlasSprite sprite, int tint,
VertexFormat format, TransformationMatrix transform, Direction side, TextureAtlasSprite sprite, int tint,
float x0, float y0, float z0, float u0, float v0, float x0, float y0, float z0, float u0, float v0,
float x1, float y1, float z1, float u1, float v1, float x1, float y1, float z1, float u1, float v1,
float x2, float y2, float z2, float u2, float v2, float x2, float y2, float z2, float u2, float v2,
float x3, float y3, float z3, float u3, float v3) float x3, float y3, float z3, float u3, float v3)
{ {
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); BakedQuadBuilder builder = new BakedQuadBuilder(sprite);
builder.setQuadTint(tint); builder.setQuadTint(tint);
builder.setQuadOrientation(side); builder.setQuadOrientation(side);
builder.setTexture(sprite);
boolean hasTransform = !transform.isIdentity(); boolean hasTransform = !transform.isIdentity();
IVertexConsumer consumer = hasTransform ? new TRSRTransformer(builder, transform) : builder; IVertexConsumer consumer = hasTransform ? new TRSRTransformer(builder, transform) : builder;
putVertex(consumer, format, side, x0, y0, z0, u0, v0); putVertex(consumer, side, x0, y0, z0, u0, v0);
putVertex(consumer, format, side, x1, y1, z1, u1, v1); putVertex(consumer, side, x1, y1, z1, u1, v1);
putVertex(consumer, format, side, x2, y2, z2, u2, v2); putVertex(consumer, side, x2, y2, z2, u2, v2);
putVertex(consumer, format, side, x3, y3, z3, u3, v3); putVertex(consumer, side, x3, y3, z3, u3, v3);
return builder.build(); return builder.build();
} }
private static void putVertex(IVertexConsumer consumer, VertexFormat format, Direction side, float x, float y, float z, float u, float v) private static void putVertex(IVertexConsumer consumer, Direction side, float x, float y, float z, float u, float v)
{ {
VertexFormat format = consumer.getVertexFormat();
for(int e = 0; e < format.func_227894_c_().size(); e++) for(int e = 0; e < format.func_227894_c_().size(); e++)
{ {
switch(format.func_227894_c_().get(e).getUsage()) switch(format.func_227894_c_().get(e).getUsage())
@@ -22,12 +22,13 @@ package net.minecraftforge.client.model;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.minecraft.client.renderer.TransformationMatrix; import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraftforge.client.model.pipeline.BakedQuadBuilder;
import net.minecraftforge.client.model.pipeline.IVertexConsumer; import net.minecraftforge.client.model.pipeline.IVertexConsumer;
import net.minecraftforge.client.model.pipeline.TRSRTransformer; import net.minecraftforge.client.model.pipeline.TRSRTransformer;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import java.util.List; import java.util.List;
@@ -51,10 +52,10 @@ public final class ItemTextureQuadConverter
* @param sprite The texture whose UVs shall be used * @param sprite The texture whose UVs shall be used
* @return The generated quads. * @return The generated quads.
*/ */
public static List<UnpackedBakedQuad> convertTexture(VertexFormat format, TransformationMatrix transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint) public static List<BakedQuad> convertTexture(TransformationMatrix transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint)
{ {
List<UnpackedBakedQuad> horizontal = convertTextureHorizontal(format, transform, template, sprite, z, facing, color, tint); List<BakedQuad> horizontal = convertTextureHorizontal(transform, template, sprite, z, facing, color, tint);
List<UnpackedBakedQuad> vertical = convertTextureVertical(format, transform, template, sprite, z, facing, color, tint); List<BakedQuad> vertical = convertTextureVertical(transform, template, sprite, z, facing, color, tint);
return horizontal.size() <= vertical.size() ? horizontal : vertical; return horizontal.size() <= vertical.size() ? horizontal : vertical;
} }
@@ -63,13 +64,13 @@ public final class ItemTextureQuadConverter
* Scans a texture and converts it into a list of horizontal strips stacked on top of each other. * Scans a texture and converts it into a list of horizontal strips stacked on top of each other.
* The height of the strips is as big as possible. * The height of the strips is as big as possible.
*/ */
public static List<UnpackedBakedQuad> convertTextureHorizontal(VertexFormat format, TransformationMatrix transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint) public static List<BakedQuad> convertTextureHorizontal(TransformationMatrix transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint)
{ {
int w = template.getWidth(); int w = template.getWidth();
int h = template.getHeight(); int h = template.getHeight();
float wScale = 16f / (float)w; float wScale = 16f / (float)w;
float hScale = 16f / (float)h; float hScale = 16f / (float)h;
List<UnpackedBakedQuad> quads = Lists.newArrayList(); List<BakedQuad> quads = Lists.newArrayList();
// the upper left x-position of the current quad // the upper left x-position of the current quad
int start = -1; int start = -1;
@@ -109,7 +110,7 @@ public final class ItemTextureQuadConverter
} }
// create the quad // create the quad
quads.add(genQuad(format, transform, quads.add(genQuad(transform,
(float)start * wScale, (float)start * wScale,
(float)y * hScale, (float)y * hScale,
(float)x * wScale, (float)x * wScale,
@@ -134,13 +135,13 @@ public final class ItemTextureQuadConverter
* Scans a texture and converts it into a list of vertical strips stacked next to each other from left to right. * Scans a texture and converts it into a list of vertical strips stacked next to each other from left to right.
* The width of the strips is as big as possible. * The width of the strips is as big as possible.
*/ */
public static List<UnpackedBakedQuad> convertTextureVertical(VertexFormat format, TransformationMatrix transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint) public static List<BakedQuad> convertTextureVertical(TransformationMatrix transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint)
{ {
int w = template.getWidth(); int w = template.getWidth();
int h = template.getHeight(); int h = template.getHeight();
float wScale = 16f / (float)w; float wScale = 16f / (float)w;
float hScale = 16f / (float)h; float hScale = 16f / (float)h;
List<UnpackedBakedQuad> quads = Lists.newArrayList(); List<BakedQuad> quads = Lists.newArrayList();
// the upper left y-position of the current quad // the upper left y-position of the current quad
int start = -1; int start = -1;
@@ -180,7 +181,7 @@ public final class ItemTextureQuadConverter
} }
// create the quad // create the quad
quads.add(genQuad(format, transform, quads.add(genQuad(transform,
(float)x * wScale, (float)x * wScale,
(float)start * hScale, (float)start * hScale,
(float)endX * wScale, (float)endX * wScale,
@@ -210,7 +211,7 @@ public final class ItemTextureQuadConverter
* Generates a Front/Back quad for an itemmodel. Therefore only supports facing NORTH and SOUTH. * Generates a Front/Back quad for an itemmodel. Therefore only supports facing NORTH and SOUTH.
* Coordinates are [0,16] to match the usual coordinates used in TextureAtlasSprites * Coordinates are [0,16] to match the usual coordinates used in TextureAtlasSprites
*/ */
public static UnpackedBakedQuad genQuad(VertexFormat format, TransformationMatrix transform, float x1, float y1, float x2, float y2, float z, TextureAtlasSprite sprite, Direction facing, int color, int tint) public static BakedQuad genQuad(TransformationMatrix transform, float x1, float y1, float x2, float y2, float z, TextureAtlasSprite sprite, Direction facing, int color, int tint)
{ {
float u1 = sprite.getInterpolatedU(x1); float u1 = sprite.getInterpolatedU(x1);
float v1 = sprite.getInterpolatedV(y1); float v1 = sprite.getInterpolatedV(y1);
@@ -226,18 +227,17 @@ public final class ItemTextureQuadConverter
y1 = 1f - y2; y1 = 1f - y2;
y2 = 1f - tmp; y2 = 1f - tmp;
return putQuad(format, transform, facing, sprite, color, tint, x1, y1, x2, y2, z, u1, v1, u2, v2); return putQuad(transform, facing, sprite, color, tint, x1, y1, x2, y2, z, u1, v1, u2, v2);
} }
private static UnpackedBakedQuad putQuad(VertexFormat format, TransformationMatrix transform, Direction side, TextureAtlasSprite sprite, int color, int tint, private static BakedQuad putQuad(TransformationMatrix transform, Direction side, TextureAtlasSprite sprite, int color, int tint,
float x1, float y1, float x2, float y2, float z, float x1, float y1, float x2, float y2, float z,
float u1, float v1, float u2, float v2) float u1, float v1, float u2, float v2)
{ {
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); BakedQuadBuilder builder = new BakedQuadBuilder(sprite);
builder.setQuadTint(tint); builder.setQuadTint(tint);
builder.setQuadOrientation(side); builder.setQuadOrientation(side);
builder.setTexture(sprite);
// only apply the transform if it's not identity // only apply the transform if it's not identity
boolean hasTransform = !transform.isIdentity(); boolean hasTransform = !transform.isIdentity();
@@ -245,24 +245,25 @@ public final class ItemTextureQuadConverter
if (side == Direction.SOUTH) if (side == Direction.SOUTH)
{ {
putVertex(consumer, format, side, x1, y1, z, u1, v2, color); putVertex(consumer, side, x1, y1, z, u1, v2, color);
putVertex(consumer, format, side, x2, y1, z, u2, v2, color); putVertex(consumer, side, x2, y1, z, u2, v2, color);
putVertex(consumer, format, side, x2, y2, z, u2, v1, color); putVertex(consumer, side, x2, y2, z, u2, v1, color);
putVertex(consumer, format, side, x1, y2, z, u1, v1, color); putVertex(consumer, side, x1, y2, z, u1, v1, color);
} }
else else
{ {
putVertex(consumer, format, side, x1, y1, z, u1, v2, color); putVertex(consumer, side, x1, y1, z, u1, v2, color);
putVertex(consumer, format, side, x1, y2, z, u1, v1, color); putVertex(consumer, side, x1, y2, z, u1, v1, color);
putVertex(consumer, format, side, x2, y2, z, u2, v1, color); putVertex(consumer, side, x2, y2, z, u2, v1, color);
putVertex(consumer, format, side, x2, y1, z, u2, v2, color); putVertex(consumer, side, x2, y1, z, u2, v2, color);
} }
return builder.build(); return builder.build();
} }
private static void putVertex(IVertexConsumer consumer, VertexFormat format, Direction side, private static void putVertex(IVertexConsumer consumer, Direction side,
float x, float y, float z, float u, float v, int color) float x, float y, float z, float u, float v, int color)
{ {
VertexFormat format = consumer.getVertexFormat();
for (int e = 0; e < format.func_227894_c_().size(); e++) for (int e = 0; e < format.func_227894_c_().size(); e++)
{ {
switch (format.func_227894_c_().get(e).getUsage()) switch (format.func_227894_c_().get(e).getUsage())
@@ -1,458 +0,0 @@
/*
* 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.client.model;
import java.io.IOException;
import java.util.*;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.collect.*;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonObject;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Quaternion;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.texture.*;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.entity.LivingEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack;
import net.minecraft.resources.IResource;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.resource.IResourceType;
import net.minecraftforge.resource.VanillaResourceType;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraftforge.common.model.TransformationHelper;
import net.minecraftforge.fluids.FluidUtil;
import java.util.function.Function;
import java.util.function.Predicate;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public final class ModelDynBucket implements IModelGeometry<ModelDynBucket>
{
private static final Logger LOGGER = LogManager.getLogger();
public static final ModelResourceLocation LOCATION = new ModelResourceLocation(new ResourceLocation(ForgeVersion.MOD_ID, "dynbucket"), "inventory");
// minimal Z offset to prevent depth-fighting
private static final float NORTH_Z_COVER = 7.496f / 16f;
private static final float SOUTH_Z_COVER = 8.504f / 16f;
private static final float NORTH_Z_FLUID = 7.498f / 16f;
private static final float SOUTH_Z_FLUID = 8.502f / 16f;
@Nonnull
private final Fluid fluid;
private final boolean flipGas;
private final boolean tint;
private final boolean coverIsMask;
public ModelDynBucket(Fluid fluid, boolean flipGas, boolean tint, boolean coverIsMask)
{
this.fluid = fluid;
this.flipGas = flipGas;
this.tint = tint;
this.coverIsMask = coverIsMask;
}
/**
* Returns a new ModelDynBucket representing the given fluid, but with the same
* other properties (flipGas, tint, coverIsMask).
*/
public ModelDynBucket withFluid(Fluid newFluid)
{
return new ModelDynBucket(newFluid, flipGas, tint, coverIsMask);
}
@Nullable
protected static IResource getResource(ResourceLocation resourceLocation)
{
try
{
return Minecraft.getInstance().getResourceManager().getResource(resourceLocation);
}
catch (IOException ignored)
{
return null;
}
}
@Nullable
protected static PngSizeInfo getSizeInfo(IResource resource)
{
try
{
return new PngSizeInfo(resource.toString(), resource.getInputStream());
}
catch (IOException e)
{
throw new RuntimeException(e);
}
}
@Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform sprite, ItemOverrideList overrides, ResourceLocation modelLocation)
{
Material particleLocation = owner.resolveTexture("particle");
if (MissingTextureSprite.getLocation().toString().equals(particleLocation))
{
particleLocation = null;
}
Material baseLocation = owner.resolveTexture("base");
if (MissingTextureSprite.getLocation().toString().equals(baseLocation))
{
baseLocation = null;
}
Material fluidMaskLocation = owner.resolveTexture("fluid");
if (MissingTextureSprite.getLocation().toString().equals(fluidMaskLocation))
{
fluidMaskLocation = null;
}
Material coverLocation = owner.resolveTexture("cover");
if (!MissingTextureSprite.getLocation().toString().equals(coverLocation))
{
// cover (the actual item around the other two)
coverLocation = null;
}
IModelTransform transformsFromModel = owner.getCombinedTransform();
IModelTransform state = sprite;
ImmutableMap<TransformType, TransformationMatrix> transformMap = transformsFromModel != null ?
PerspectiveMapWrapper.getTransforms(new ModelTransformComposition(transformsFromModel, state)) :
PerspectiveMapWrapper.getTransforms(state);
TextureAtlasSprite particleSprite = particleLocation != null ? spriteGetter.apply(particleLocation) : null;
// if the fluid is lighter than air, will manipulate the initial state to be rotated 180deg to turn it upside down
if (flipGas && fluid != Fluids.EMPTY && fluid.getAttributes().isLighterThanAir())
{
sprite = new ModelTransformComposition(state, new SimpleModelTransform(new TransformationMatrix(null, new Quaternion(0, 0, 1, 0), null, null).blockCenterToCorner()));
state = sprite;
}
TransformationMatrix transform = state.func_225615_b_();
TextureAtlasSprite fluidSprite = fluid != Fluids.EMPTY ? spriteGetter.apply(ForgeHooksClient.getBlockMaterial(fluid.getAttributes().getStillTexture())) : null;
if (particleSprite == null) particleSprite = fluidSprite;
Random random = new Random();
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
if (baseLocation != null)
{
// build base (insidest)
IBakedModel model = new ItemLayerModel(ImmutableList.of(baseLocation)).bake(owner, bakery, spriteGetter, sprite, ItemOverrideList.EMPTY, modelLocation);
random.setSeed(42);
builder.addAll(model.getQuads(null, null, random));
}
if (fluidMaskLocation != null && fluidSprite != null)
{
TextureAtlasSprite templateSprite = spriteGetter.apply(fluidMaskLocation);
if (templateSprite != null)
{
// build liquid layer (inside)
builder.addAll(ItemTextureQuadConverter.convertTexture(DefaultVertexFormats.BLOCK, transform, templateSprite, fluidSprite, NORTH_Z_FLUID, Direction.NORTH, tint ? fluid.getAttributes().getColor() : 0xFFFFFFFF, 1));
builder.addAll(ItemTextureQuadConverter.convertTexture(DefaultVertexFormats.BLOCK, transform, templateSprite, fluidSprite, SOUTH_Z_FLUID, Direction.SOUTH, tint ? fluid.getAttributes().getColor() : 0xFFFFFFFF, 1));
}
}
if (coverLocation != null && (!coverIsMask || baseLocation != null))
{
// cover (the actual item around the other two)
TextureAtlasSprite coverSprite = spriteGetter.apply(coverLocation);
if (coverSprite != null)
{
if (coverIsMask)
{
TextureAtlasSprite baseSprite = spriteGetter.apply(baseLocation);
builder.addAll(ItemTextureQuadConverter.convertTexture(DefaultVertexFormats.BLOCK, transform, coverSprite, baseSprite, NORTH_Z_COVER, Direction.NORTH, 0xFFFFFFFF, 1));
builder.addAll(ItemTextureQuadConverter.convertTexture(DefaultVertexFormats.BLOCK, transform, coverSprite, baseSprite, SOUTH_Z_COVER, Direction.SOUTH, 0xFFFFFFFF, 1));
}
else
{
builder.add(ItemTextureQuadConverter.genQuad(DefaultVertexFormats.BLOCK, transform, 0, 0, 16, 16, NORTH_Z_COVER, coverSprite, Direction.NORTH, 0xFFFFFFFF, 2));
builder.add(ItemTextureQuadConverter.genQuad(DefaultVertexFormats.BLOCK, transform, 0, 0, 16, 16, SOUTH_Z_COVER, coverSprite, Direction.SOUTH, 0xFFFFFFFF, 2));
if (particleSprite == null)
{
particleSprite = coverSprite;
}
}
}
}
return new BakedDynBucket(bakery, owner, this, builder.build(), particleSprite, DefaultVertexFormats.BLOCK, Maps.immutableEnumMap(transformMap), Maps.newHashMap(), transform.isIdentity());
}
@Override
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
{
Set<Material> texs = Sets.newHashSet();
texs.add(owner.resolveTexture("particle"));
texs.add(owner.resolveTexture("base"));
texs.add(owner.resolveTexture("fluid"));
texs.add(owner.resolveTexture("cover"));
return texs;
}
public enum LoaderDynBucket2 implements IModelLoader<ModelDynBucket>
{
INSTANCE;
@Override
public IResourceType getResourceType()
{
return VanillaResourceType.MODELS;
}
@Override
public void onResourceManagerReload(IResourceManager resourceManager)
{
// no need to clear cache since we create a new model instance
}
@Override
public void onResourceManagerReload(IResourceManager resourceManager, Predicate<IResourceType> resourcePredicate)
{
// no need to clear cache since we create a new model instance
}
@Override
public ModelDynBucket read(JsonDeserializationContext deserializationContext, JsonObject modelContents)
{
if (!modelContents.has("fluid"))
throw new RuntimeException("Bucket model requires 'fluid' value.");
ResourceLocation fluidName = new ResourceLocation(modelContents.get("fluid").getAsString());
Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidName);
boolean flip = false;
if (modelContents.has("flipGas"))
{
flip = modelContents.get("flipGas").getAsBoolean();
}
boolean tint = true;
if (modelContents.has("applyTint"))
{
tint = modelContents.get("applyTint").getAsBoolean();
}
boolean coverIsMask = true;
if (modelContents.has("coverIsMask"))
{
coverIsMask = modelContents.get("coverIsMask").getAsBoolean();
}
// create new model with correct liquid
return new ModelDynBucket(fluid, flip, tint, coverIsMask);
}
}
/* TODO Custom TAS
private static final class BucketBaseSprite extends TextureAtlasSprite
{
private final ResourceLocation bucket = new ResourceLocation("item/bucket");
private final ImmutableList<ResourceLocation> dependencies = ImmutableList.of(bucket);
private BucketBaseSprite(ResourceLocation res)
{
super(res, getSizeInfo(getResource(new ResourceLocation("textures/item/bucket.png"))), getResource(new ResourceLocation("textures/item/bucket.png")).getMetadata(AnimationMetadataSection.SERIALIZER));
}
@Override
public boolean hasCustomLoader(@Nonnull IResourceManager manager, @Nonnull ResourceLocation location)
{
return true;
}
@Override
public Collection<ResourceLocation> getDependencies()
{
return dependencies;
}
@Override
public boolean load(@Nonnull IResourceManager manager, @Nonnull ResourceLocation location, @Nonnull Function<ResourceLocation, TextureAtlasSprite> textureGetter)
{
final TextureAtlasSprite sprite = textureGetter.apply(bucket);
// TODO custom sprites are gonna be a PITA, these are final
width = sprite.getIconWidth();
height = sprite.getIconHeight();
// TODO No easy way to dump pixels of one sprite into another without n^2 for loop, investigate patch?
final int[][] pixels = sprite.getFrameTextureData(0);
this.clearFramesTextureData();
this.framesTextureData.add(pixels);
return false;
}
}*/
/**
* Creates a bucket cover sprite from the vanilla resource.
*/
/* TODO Custom TAS
private static final class BucketCoverSprite extends TextureAtlasSprite
{
private final ResourceLocation bucket = new ResourceLocation("item/bucket");
private final ResourceLocation bucketCoverMask = new ResourceLocation(ForgeVersion.MOD_ID, "item/vanilla_bucket_cover_mask");
private final ImmutableList<ResourceLocation> dependencies = ImmutableList.of(bucket, bucketCoverMask);
private BucketCoverSprite(ResourceLocation res)
{
super(res, getSizeInfo(getResource(new ResourceLocation("textures/item/bucket.png"))), getResource(new ResourceLocation("textures/item/bucket.png")).getMetadata(AnimationMetadataSection.SERIALIZER));
}
@Override
public boolean hasCustomLoader(@Nonnull IResourceManager manager, @Nonnull ResourceLocation location)
{
return true;
}
@Override
public Collection<ResourceLocation> getDependencies()
{
return dependencies;
}
@Override
public boolean load(@Nonnull IResourceManager manager, @Nonnull ResourceLocation location, @Nonnull Function<ResourceLocation, TextureAtlasSprite> textureGetter)
{
final TextureAtlasSprite sprite = textureGetter.apply(bucket);
final TextureAtlasSprite alphaMask = textureGetter.apply(bucketCoverMask);
width = sprite.getIconWidth();
height = sprite.getIconHeight();
final int[][] pixels = new int[Minecraft.getMinecraft().gameSettings.mipmapLevels + 1][];
pixels[0] = new int[width * height];
try (
IResource empty = getResource(new ResourceLocation("textures/items/bucket_empty.png"));
IResource mask = getResource(new ResourceLocation(ForgeVersion.MOD_ID, "textures/items/vanilla_bucket_cover_mask.png"))
) {
// use the alpha mask if it fits, otherwise leave the cover texture blank
if (empty != null && mask != null && Objects.equals(empty.getPackName(), mask.getPackName()) &&
alphaMask.getIconWidth() == width && alphaMask.getIconHeight() == height)
{
final int[][] oldPixels = sprite.getFrameTextureData(0);
final int[][] alphaPixels = alphaMask.getFrameTextureData(0);
for (int p = 0; p < width * height; p++)
{
final int alphaMultiplier = alphaPixels[0][p] >>> 24;
final int oldPixel = oldPixels[0][p];
final int oldPixelAlpha = oldPixel >>> 24;
final int newAlpha = oldPixelAlpha * alphaMultiplier / 0xFF;
pixels[0][p] = (oldPixel & 0xFFFFFF) + (newAlpha << 24);
}
}
}
catch (IOException e)
{
LOGGER.error("Failed to close resource", e);
}
this.clearFramesTextureData();
this.framesTextureData.add(pixels);
return false;
}
}*/
private static final class BakedDynBucketOverrideHandler extends ItemOverrideList
{
private final ModelBakery bakery;
private BakedDynBucketOverrideHandler(ModelBakery bakery)
{
this.bakery = bakery;
}
@Override
public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable LivingEntity entity)
{
return FluidUtil.getFluidContained(stack)
.map(fluidStack -> {
BakedDynBucket model = (BakedDynBucket)originalModel;
Fluid fluid = fluidStack.getFluid();
String name = fluid.getRegistryName().toString();
if (!model.cache.containsKey(name))
{
ModelDynBucket parent = model.parent.withFluid(fluid);
IBakedModel bakedModel = parent.bake(model.owner, bakery, ModelLoader.defaultTextureGetter(), new SimpleModelTransform(model.transforms), model.getOverrides(), new ResourceLocation("forge:bucket_override"));
model.cache.put(name, bakedModel);
return bakedModel;
}
return model.cache.get(name);
})
// not a fluid item apparently
.orElse(originalModel); // empty bucket
}
}
// the dynamic bucket is based on the empty bucket
private static final class BakedDynBucket extends BakedItemModel
{
private final IModelConfiguration owner;
private final ModelDynBucket parent;
private final Map<String, IBakedModel> cache; // contains all the baked models since they'll never change
private final VertexFormat format;
BakedDynBucket(ModelBakery bakery,
IModelConfiguration owner, ModelDynBucket parent,
ImmutableList<BakedQuad> quads,
TextureAtlasSprite particle,
VertexFormat format,
ImmutableMap<TransformType, TransformationMatrix> transforms,
Map<String, IBakedModel> cache,
boolean untransformed)
{
super(quads, particle, transforms, new BakedDynBucketOverrideHandler(bakery), untransformed);
this.owner = owner;
this.format = format;
this.parent = parent;
this.cache = cache;
}
}
}
@@ -36,7 +36,6 @@ import net.minecraft.resources.IResourceManager;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.JSONUtils; import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.composite.CompositeModel;
import net.minecraftforge.client.model.geometry.IModelGeometry; import net.minecraftforge.client.model.geometry.IModelGeometry;
import net.minecraftforge.client.model.geometry.ISimpleModelGeometry; import net.minecraftforge.client.model.geometry.ISimpleModelGeometry;
import net.minecraftforge.client.model.obj.OBJLoader; import net.minecraftforge.client.model.obj.OBJLoader;
@@ -60,14 +59,14 @@ public class ModelLoaderRegistry
public static void init() public static void init()
{ {
registerLoader(new ResourceLocation("forge:obj"), OBJLoader.INSTANCE); registerLoader(new ResourceLocation("forge:obj"), OBJLoader.INSTANCE);
registerLoader(new ResourceLocation("forge:bucket"), ModelDynBucket.LoaderDynBucket2.INSTANCE); registerLoader(new ResourceLocation("forge:bucket"), DynamicBucketModel.Loader.INSTANCE);
registerLoader(new ResourceLocation("forge:composite"), CompositeModel.Loader.INSTANCE); registerLoader(new ResourceLocation("forge:composite"), CompositeModel.Loader.INSTANCE);
registerLoader(new ResourceLocation("minecraft:elements"), VanillaProxy.Loader.INSTANCE); registerLoader(new ResourceLocation("minecraft:elements"), VanillaProxy.Loader.INSTANCE);
registerLoader(new ResourceLocation("forge:multi-layer"), MultiLayerModel.Loader.INSTANCE);
// TODO: Implement as new model loaders // TODO: Implement as new model loaders
//registerLoader(new ResourceLocation("forge:b3d"), new ModelLoaderAdapter(B3DLoader.INSTANCE)); //registerLoader(new ResourceLocation("forge:b3d"), new ModelLoaderAdapter(B3DLoader.INSTANCE));
//registerLoader(new ResourceLocation("forge:fluid"), new ModelLoaderAdapter(ModelFluid.FluidLoader.INSTANCE)); //registerLoader(new ResourceLocation("forge:fluid"), new ModelLoaderAdapter(ModelFluid.FluidLoader.INSTANCE));
//registerLoader(new ResourceLocation("forge:multi-layer"), new ModelLoaderAdapter(MultiLayerModel.Loader.INSTANCE));
} }
/** /**
@@ -212,28 +211,21 @@ public class ModelLoaderRegistry
} }
} }
public static IBakedModel bakeHelper(BlockModel blockModel, ModelBakery modelBakery, BlockModel otherModel, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform sprite, ResourceLocation modelLocation) public static IBakedModel bakeHelper(BlockModel blockModel, ModelBakery modelBakery, BlockModel otherModel, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation, boolean guiLight3d)
{ {
IBakedModel model; IBakedModel model;
IModelGeometry<?> customModel = blockModel.customData.getCustomGeometry(); IModelGeometry<?> customModel = blockModel.customData.getCustomGeometry();
IModelTransform customModelState = blockModel.customData.getCustomModelState(); IModelTransform customModelState = blockModel.customData.getCustomModelState();
if (customModelState != null) if (customModelState != null)
{ modelTransform = new ModelTransformComposition(customModelState, modelTransform, modelTransform.isUvLock());
sprite = new ModelTransformComposition(customModelState, sprite, sprite.isUvLock());
}
if (customModel != null) if (customModel != null)
{ model = customModel.bake(blockModel.customData, modelBakery, spriteGetter, modelTransform, blockModel.getOverrides(modelBakery, otherModel, spriteGetter), modelLocation);
model = customModel.bake(blockModel.customData, modelBakery, spriteGetter, sprite, blockModel.getOverrides(modelBakery, otherModel, spriteGetter), modelLocation);
}
else else
{ model = blockModel.bakeVanilla(modelBakery, otherModel, spriteGetter, modelTransform, modelLocation, guiLight3d);
model = blockModel.bakeVanilla(modelBakery, otherModel, spriteGetter, sprite, modelLocation);
}
if (customModelState != null && !model.doesHandlePerspectives()) if (customModelState != null && !model.doesHandlePerspectives())
{
model = new PerspectiveMapWrapper(model, customModelState); model = new PerspectiveMapWrapper(model, customModelState);
}
return model; return model;
} }
@@ -248,18 +240,18 @@ public class ModelLoaderRegistry
} }
@Override @Override
public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform sprite, ResourceLocation modelLocation) public void addQuads(IModelConfiguration owner, IModelBuilder<?> modelBuilder, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
{ {
for(BlockPart blockpart : elements) { for(BlockPart blockpart : elements) {
for(Direction direction : blockpart.mapFaces.keySet()) { for(Direction direction : blockpart.mapFaces.keySet()) {
BlockPartFace blockpartface = blockpart.mapFaces.get(direction); BlockPartFace blockpartface = blockpart.mapFaces.get(direction);
TextureAtlasSprite textureatlassprite1 = spriteGetter.apply(owner.resolveTexture(blockpartface.texture)); TextureAtlasSprite textureatlassprite1 = spriteGetter.apply(owner.resolveTexture(blockpartface.texture));
if (blockpartface.cullFace == null) { if (blockpartface.cullFace == null) {
modelBuilder.addGeneralQuad(BlockModel.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, direction, sprite, modelLocation)); modelBuilder.addGeneralQuad(BlockModel.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, direction, modelTransform, modelLocation));
} else { } else {
modelBuilder.addFaceQuad( modelBuilder.addFaceQuad(
sprite.func_225615_b_().rotateTransform(blockpartface.cullFace), modelTransform.func_225615_b_().rotateTransform(blockpartface.cullFace),
BlockModel.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, direction, sprite, modelLocation)); BlockModel.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, direction, modelTransform, modelLocation));
} }
} }
} }
@@ -19,138 +19,120 @@
package net.minecraftforge.client.model; package net.minecraftforge.client.model;
import java.util.Collection; import java.util.*;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.google.common.collect.Sets;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonObject;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.datafixers.util.Pair;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.TransformationMatrix; import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import java.util.function.Function; import java.util.function.Function;
import java.util.Optional;
import java.util.Random;
import java.util.Set;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
/** /**
* A model that can be rendered in multiple {@link BlockRenderLayer}. * A model that can be rendered in multiple {@link RenderType}.
*/ */
/* TODO: reimplement public final class MultiLayerModel implements IModelGeometry<MultiLayerModel>
public final class MultiLayerModel implements IUnbakedModel
{ {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOGGER = LogManager.getLogger();
public static final MultiLayerModel INSTANCE = new MultiLayerModel(ImmutableMap.of());
private final ImmutableMap<Optional<BlockRenderLayer>, ResourceLocation> models; private final ImmutableMap<RenderType, IUnbakedModel> models;
public MultiLayerModel(ImmutableMap<Optional<BlockRenderLayer>, ResourceLocation> models) public MultiLayerModel(ImmutableMap<RenderType, IUnbakedModel> models)
{ {
this.models = models; this.models = models;
} }
@Override
public Collection<ResourceLocation> getDependencies()
{
return ImmutableList.copyOf(models.values());
}
@Override @Override
public Collection<Material> func_225614_a_(Function<ResourceLocation, IUnbakedModel> p_225614_1_, Set<com.mojang.datafixers.util.Pair<String, String>> p_225614_2_) public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors)
{ {
return Collections.emptyList(); Set<Material> materials = Sets.newHashSet();
materials.add(owner.resolveTexture("particle"));
for (IUnbakedModel m : models.values())
materials.addAll(m.func_225614_a_(modelGetter, missingTextureErrors));
return materials;
} }
private static ImmutableMap<RenderType, IBakedModel> buildModels(ImmutableMap<RenderType, IUnbakedModel> models, IModelTransform modelTransform, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, ResourceLocation modelLocation)
private static ImmutableMap<Optional<BlockRenderLayer>, IBakedModel> buildModels(ImmutableMap<Optional<BlockRenderLayer>, ResourceLocation> models, IModelTransform sprite, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, ResourceLocation p_225613_4_)
{ {
ImmutableMap.Builder<Optional<BlockRenderLayer>, IBakedModel> builder = ImmutableMap.builder(); ImmutableMap.Builder<RenderType, IBakedModel> builder = ImmutableMap.builder();
for(Optional<BlockRenderLayer> key : models.keySet()) for(Map.Entry<RenderType, IUnbakedModel> entry : models.entrySet())
{ {
IUnbakedModel model = ModelLoader.defaultModelGetter().apply(models.get(key)); builder.put(entry.getKey(), entry.getValue().func_225613_a_(bakery, spriteGetter, modelTransform, modelLocation));
builder.put(key, model.func_225613_a_(bakery, spriteGetter, sprite, p_225613_4_));
} }
return builder.build(); return builder.build();
} }
@Nullable
@Override @Override
public IBakedModel func_225613_a_(ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform sprite, ResourceLocation p_225613_4_) public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation)
{ {
IUnbakedModel missing = ModelLoader.instance().getMissingModel(); IUnbakedModel missing = ModelLoader.instance().getMissingModel();
return new MultiLayerBakedModel( return new MultiLayerBakedModel(
buildModels(models, sprite, bakery, spriteGetter, p_225613_4_), owner.useSmoothLighting(), owner.isShadedInGui(),
missing.func_225613_a_(bakery, spriteGetter, sprite, p_225613_4_), spriteGetter.apply(owner.resolveTexture("particle")), overrides,
PerspectiveMapWrapper.getTransforms(sprite) buildModels(models, modelTransform, bakery, spriteGetter, modelLocation),
); missing.func_225613_a_(bakery, spriteGetter, modelTransform, modelLocation),
} PerspectiveMapWrapper.getTransforms(new ModelTransformComposition(owner.getCombinedTransform(), modelTransform)));
public MultiLayerModel process(ImmutableMap<String, String> customData)
{
ImmutableMap.Builder<Optional<BlockRenderLayer>, ResourceLocation> builder = ImmutableMap.builder();
for(String key : customData.keySet())
{
if("base".equals(key))
{
builder.put(Optional.empty(), getLocation(customData.get(key)));
}
for(BlockRenderLayer layer : BlockRenderLayer.values())
{
if(layer.toString().equals(key))
{
builder.put(Optional.of(layer), getLocation(customData.get(key)));
}
}
}
ImmutableMap<Optional<BlockRenderLayer>, ResourceLocation> models = builder.build();
if(models.isEmpty()) return INSTANCE;
return new MultiLayerModel(models);
}
private ResourceLocation getLocation(String json)
{
JsonElement e = new JsonParser().parse(json);
if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isString())
{
return new ModelResourceLocation(e.getAsString());
}
LOGGER.fatal("Expect ModelResourceLocation, got: {}", json);
return new ModelResourceLocation("builtin/missing", "missing");
} }
private static final class MultiLayerBakedModel implements IBakedModel private static final class MultiLayerBakedModel implements IBakedModel
{ {
private final ImmutableMap<Optional<BlockRenderLayer>, IBakedModel> models; private final ImmutableMap<RenderType, IBakedModel> models;
private final ImmutableMap<TransformType, TransformationMatrix> cameraTransforms; private final ImmutableMap<TransformType, TransformationMatrix> cameraTransforms;
private final IBakedModel base; protected final boolean ambientOcclusion;
protected final boolean gui3d;
protected final TextureAtlasSprite particle;
protected final ItemOverrideList overrides;
private final IBakedModel missing; private final IBakedModel missing;
public MultiLayerBakedModel(ImmutableMap<Optional<BlockRenderLayer>, IBakedModel> models, IBakedModel missing, ImmutableMap<TransformType, TransformationMatrix> cameraTransforms) public MultiLayerBakedModel(
boolean ambientOcclusion, boolean isGui3d, TextureAtlasSprite particle, ItemOverrideList overrides,
ImmutableMap<RenderType, IBakedModel> models, IBakedModel missing, ImmutableMap<TransformType, TransformationMatrix> cameraTransforms)
{ {
this.models = models; this.models = models;
this.cameraTransforms = cameraTransforms; this.cameraTransforms = cameraTransforms;
this.missing = missing; this.missing = missing;
this.base = models.getOrDefault(Optional.empty(), missing); this.ambientOcclusion = ambientOcclusion;
this.gui3d = isGui3d;
this.particle = particle;
this.overrides = overrides;
} }
@Override @Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand)
{ {
BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer(); return getQuads(state, side, rand, EmptyModelData.INSTANCE);
}
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData)
{
RenderType layer = MinecraftForgeClient.getRenderLayer();
if (layer == null) if (layer == null)
{ {
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder(); ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
@@ -161,37 +143,44 @@ public final class MultiLayerModel implements IUnbakedModel
return builder.build(); return builder.build();
} }
// assumes that child model will handle this state properly. FIXME? // assumes that child model will handle this state properly. FIXME?
return models.getOrDefault(Optional.of(layer), missing).getQuads(state, side, rand); return models.getOrDefault(layer, missing).getQuads(state, side, rand, extraData);
} }
@Override @Override
public boolean isAmbientOcclusion() public boolean isAmbientOcclusion()
{ {
return base.isAmbientOcclusion(); return ambientOcclusion;
} }
@Override @Override
public boolean isAmbientOcclusion(BlockState state) public boolean isAmbientOcclusion(BlockState state)
{ {
return base.isAmbientOcclusion(state); return ambientOcclusion;
} }
@Override @Override
public boolean isGui3d() public boolean isGui3d()
{ {
return base.isGui3d(); return gui3d;
}
@Override
public boolean func_230044_c_()
{
// TODO: Forge: Auto-generated method stub
return false;
} }
@Override @Override
public boolean isBuiltInRenderer() public boolean isBuiltInRenderer()
{ {
return base.isBuiltInRenderer(); return false;
} }
@Override @Override
public TextureAtlasSprite getParticleTexture() public TextureAtlasSprite getParticleTexture()
{ {
return base.getParticleTexture(); return particle;
} }
@Override @Override
@@ -201,9 +190,9 @@ public final class MultiLayerModel implements IUnbakedModel
} }
@Override @Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) public IBakedModel handlePerspective(TransformType cameraTransformType, MatrixStack mat)
{ {
return PerspectiveMapWrapper.handlePerspective(this, cameraTransforms, cameraTransformType); return PerspectiveMapWrapper.handlePerspective(this, cameraTransforms, cameraTransformType, mat);
} }
@Override @Override
@@ -212,5 +201,34 @@ public final class MultiLayerModel implements IUnbakedModel
return ItemOverrideList.EMPTY; return ItemOverrideList.EMPTY;
} }
} }
public static final class Loader implements IModelLoader<MultiLayerModel>
{
public static final Loader INSTANCE = new Loader();
private Loader() {}
@Override
public void onResourceManagerReload(IResourceManager resourceManager)
{
}
@Override
public MultiLayerModel read(JsonDeserializationContext deserializationContext, JsonObject modelContents)
{
ImmutableMap.Builder<RenderType, IUnbakedModel> builder = ImmutableMap.builder();
JsonObject layersObject = JSONUtils.getJsonObject(modelContents, "layers");
for(RenderType layer : RenderType.func_228661_n_()) // block layers
{
String layerName = layer.toString(); // mc overrides toString to return the ID for the layer
if(layersObject.has(layerName))
{
builder.put(layer, deserializationContext.deserialize(JSONUtils.getJsonObject(layersObject, layerName), BlockModel.class));
}
}
ImmutableMap<RenderType, IUnbakedModel> models = builder.build();
return new MultiLayerModel(models);
}
}
} }
*/
@@ -33,12 +33,14 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.client.model.data.IDynamicBakedModel;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.common.model.TransformationHelper; import net.minecraftforge.common.model.TransformationHelper;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
public class PerspectiveMapWrapper implements IBakedModel public class PerspectiveMapWrapper implements IDynamicBakedModel
{ {
private final IBakedModel parent; private final IBakedModel parent;
private final ImmutableMap<ItemCameraTransforms.TransformType, TransformationMatrix> transforms; private final ImmutableMap<ItemCameraTransforms.TransformType, TransformationMatrix> transforms;
@@ -77,7 +79,7 @@ public class PerspectiveMapWrapper implements IBakedModel
{ {
if (transforms.hasCustomTransform(type)) if (transforms.hasCustomTransform(type))
{ {
map.put(type, TransformationHelper.toTransformation(transforms.getTransform(type)).blockCenterToCorner()); map.put(type, TransformationHelper.toTransformation(transforms.getTransform(type)));
} }
} }
return ImmutableMap.copyOf(map); return ImmutableMap.copyOf(map);
@@ -96,7 +98,7 @@ public class PerspectiveMapWrapper implements IBakedModel
} }
else if (transforms.hasCustomTransform(type)) else if (transforms.hasCustomTransform(type))
{ {
map.put(type, TransformationHelper.toTransformation(transforms.getTransform(type)).blockCenterToCorner()); map.put(type, TransformationHelper.toTransformation(transforms.getTransform(type)));
} }
} }
return ImmutableMap.copyOf(map); return ImmutableMap.copyOf(map);
@@ -107,9 +109,7 @@ public class PerspectiveMapWrapper implements IBakedModel
TransformationMatrix tr = transforms.getOrDefault(cameraTransformType, TransformationMatrix.func_227983_a_()); TransformationMatrix tr = transforms.getOrDefault(cameraTransformType, TransformationMatrix.func_227983_a_());
if (!tr.isIdentity()) if (!tr.isIdentity())
{ {
// Push to the matrix to make it not empty and indicate that we want to transform things tr.push(mat);
mat.func_227860_a_();
mat.func_227866_c_().func_227870_a_().func_226595_a_(tr.blockCornerToCenter().func_227988_c_());
} }
return model; return model;
} }
@@ -119,9 +119,7 @@ public class PerspectiveMapWrapper implements IBakedModel
TransformationMatrix tr = state.getPartTransformation(cameraTransformType); TransformationMatrix tr = state.getPartTransformation(cameraTransformType);
if (!tr.isIdentity()) if (!tr.isIdentity())
{ {
// Push to the matrix to make it not empty and indicate that we want to transform things tr.push(mat);
mat.func_227860_a_();
mat.func_227866_c_().func_227870_a_().func_226595_a_(tr.blockCornerToCenter().func_227988_c_());
} }
return model; return model;
} }
@@ -129,12 +127,15 @@ public class PerspectiveMapWrapper implements IBakedModel
@Override public boolean isAmbientOcclusion() { return parent.isAmbientOcclusion(); } @Override public boolean isAmbientOcclusion() { return parent.isAmbientOcclusion(); }
@Override public boolean isAmbientOcclusion(BlockState state) { return parent.isAmbientOcclusion(state); } @Override public boolean isAmbientOcclusion(BlockState state) { return parent.isAmbientOcclusion(state); }
@Override public boolean isGui3d() { return parent.isGui3d(); } @Override public boolean isGui3d() { return parent.isGui3d(); }
@Override public boolean func_230044_c_() { return parent.func_230044_c_(); }
@Override public boolean isBuiltInRenderer() { return parent.isBuiltInRenderer(); } @Override public boolean isBuiltInRenderer() { return parent.isBuiltInRenderer(); }
@Override public TextureAtlasSprite getParticleTexture() { return parent.getParticleTexture(); } @Override public TextureAtlasSprite getParticleTexture() { return parent.getParticleTexture(); }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override public ItemCameraTransforms getItemCameraTransforms() { return parent.getItemCameraTransforms(); } @Override public ItemCameraTransforms getItemCameraTransforms() { return parent.getItemCameraTransforms(); }
@Override public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) { return parent.getQuads(state, side, rand); } @Override public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand, IModelData extraData)
{
return parent.getQuads(state, side, rand, extraData);
}
@Override @Override
public ItemOverrideList getOverrides() public ItemOverrideList getOverrides()
@@ -19,77 +19,108 @@
package net.minecraftforge.client.model; package net.minecraftforge.client.model;
import com.google.common.collect.Lists;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.Vector4f;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import com.google.common.collect.Lists;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.Vector4f;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
public class QuadTransformer public class QuadTransformer
{ {
private final VertexFormat format; private static final int POSITION = findPositionOffset(DefaultVertexFormats.BLOCK);
private final int positionOffset; private static final int NORMAL = findNormalOffset(DefaultVertexFormats.BLOCK);
private final int normalOffset;
private final TransformationMatrix transform; private final TransformationMatrix transform;
public QuadTransformer(VertexFormat format, TransformationMatrix transform) public QuadTransformer(TransformationMatrix transform)
{ {
this.format = format;
this.positionOffset = findPositionOffset(format);
this.normalOffset = findNormalOffset(format);
this.transform = transform; this.transform = transform;
} }
private void processVertices(int[] inData, int[] outData) private void processVertices(int[] inData, int[] outData)
{ {
// TODO: Extract rotation matrix and fix NORMALs if present. int stride = DefaultVertexFormats.BLOCK.getSize();
int stride = format.getSize() / 4; int count = (inData.length * 4) / stride;
for (int i=0;i<4;i++) for (int i=0;i<count;i++)
{ {
int offset = positionOffset + i * stride; int offset = POSITION + i * stride;
float x = Float.intBitsToFloat(inData[offset ]); float x = Float.intBitsToFloat(getAtByteOffset(inData, offset ));
float y = Float.intBitsToFloat(inData[offset + 1]); float y = Float.intBitsToFloat(getAtByteOffset(inData, offset + 4));
float z = Float.intBitsToFloat(inData[offset + 2]); float z = Float.intBitsToFloat(getAtByteOffset(inData, offset + 8));
Vector4f pos = new Vector4f(x, y, z, 1); Vector4f pos = new Vector4f(x, y, z, 1);
transform.transformPosition(pos); transform.transformPosition(pos);
pos.func_229374_e_(); pos.func_229375_f_();
outData[offset] = Float.floatToRawIntBits(pos.getX()); putAtByteOffset(outData, offset, Float.floatToRawIntBits(pos.getX()));
outData[offset + 1] = Float.floatToRawIntBits(pos.getY()); putAtByteOffset(outData,offset + 4, Float.floatToRawIntBits(pos.getY()));
outData[offset + 2] = Float.floatToRawIntBits(pos.getZ()); putAtByteOffset(outData,offset + 8, Float.floatToRawIntBits(pos.getZ()));
} }
if (normalOffset >= 0) for (int i=0;i<count;i++)
{ {
for (int i=0;i<4;i++) int offset = NORMAL + i * stride;
int normalIn = getAtByteOffset(inData,offset);
if (normalIn != 0)
{ {
int offset = normalOffset + i * stride;
int normalIn = inData[offset]; float x = ((byte)((normalIn) >> 24)) / 127.0f;
float x = (((normalIn)>>24)&0xFF)/255.0f; float y = ((byte)((normalIn << 8) >> 24)) / 127.0f;
float y = (((normalIn<<8)>>24)&0xFF)/255.0f; float z = ((byte)((normalIn << 16) >> 24)) / 127.0f;
float z = (((normalIn<<16)>>24)&0xFF)/255.0f;
Vector3f pos = new Vector3f(x, y, z); Vector3f pos = new Vector3f(x, y, z);
transform.transformNormal(pos); transform.transformNormal(pos);
pos.func_229194_d_();
int normalOut = int normalOut = ((((byte)(x / 127.0f)) & 0xFF) << 24) |
(((int)(x/255.0)&0xFF)<<24) | ((((byte)(y / 127.0f)) & 0xFF) << 16) |
(((int)(y/255.0)&0xFF)<<16) | ((((byte)(z / 127.0f)) & 0xFF) << 8) |
(((int)(z/255.0)&0xFF)<<8) | (normalIn & 0xFF);
(normalIn&0xFF);
outData[offset] = normalOut; putAtByteOffset(outData, offset, normalOut);
} }
} }
} }
private static int getAtByteOffset(int[] inData, int offset)
{
int index = offset / 4;
int lsb = inData[index];
int shift = (offset % 4) * 8;
if (shift == 0)
return inData[index];
int msb = inData[index+1];
return (lsb >>> shift) | (msb << (32-shift));
}
private static void putAtByteOffset(int[] outData, int offset, int value)
{
int index = offset / 4;
int shift = (offset % 4) * 8;
if (shift == 0)
{
outData[index] = value;
return;
}
int lsbMask = 0xFFFFFFFF >>> (32-shift);
int msbMask = 0xFFFFFFFF << shift;
outData[index] = (outData[index] & lsbMask) | (value << shift);
outData[index+1] = (outData[index+1] & msbMask) | (value >>> (32-shift));
}
private static int findPositionOffset(VertexFormat fmt) private static int findPositionOffset(VertexFormat fmt)
{ {
int index; int index;
@@ -126,7 +157,7 @@ public class QuadTransformer
} }
} }
if (index == fmt.func_227894_c_().size() || element == null) if (index == fmt.func_227894_c_().size() || element == null)
return -1; throw new IllegalStateException("BLOCK format does not have normals?");
if (element.getType() != VertexFormatElement.Type.BYTE) if (element.getType() != VertexFormatElement.Type.BYTE)
throw new RuntimeException("Expected NORMAL attribute to have data type BYTE"); throw new RuntimeException("Expected NORMAL attribute to have data type BYTE");
if (element.getSize() < 3) if (element.getSize() < 3)
@@ -145,7 +176,7 @@ public class QuadTransformer
int[] outData = Arrays.copyOf(inData, inData.length); int[] outData = Arrays.copyOf(inData, inData.length);
processVertices(inData, outData); processVertices(inData, outData);
return new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.getSprite(), input.shouldApplyDiffuseLighting(), format); return new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.getSprite(), input.shouldApplyDiffuseLighting());
} }
/** /**
@@ -177,7 +208,7 @@ public class QuadTransformer
int[] outData = Arrays.copyOf(inData, inData.length); int[] outData = Arrays.copyOf(inData, inData.length);
processVertices(inData, outData); processVertices(inData, outData);
outputs.add(new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.getSprite(), input.shouldApplyDiffuseLighting(), format)); outputs.add(new BakedQuad(outData, input.getTintIndex(), input.getFace(), input.getSprite(), input.shouldApplyDiffuseLighting()));
} }
return outputs; return outputs;
} }
@@ -19,41 +19,38 @@
package net.minecraftforge.client.model; package net.minecraftforge.client.model;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.Vector4f;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import net.minecraft.client.GameSettings; import net.minecraft.client.GameSettings;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.Vector4f;
import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.pipeline.BakedQuadBuilder;
public abstract class SimpleModelFontRenderer extends FontRenderer { public abstract class SimpleModelFontRenderer extends FontRenderer {
private float r, g, b, a; private float r, g, b, a;
private final TransformationMatrix transform; private final TransformationMatrix transform;
private ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder(); private ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
private final VertexFormat format;
private final Vector3f normal = new Vector3f(0, 0, 1); private final Vector3f normal = new Vector3f(0, 0, 1);
private final Direction orientation; private final Direction orientation;
private boolean fillBlanks = false; private boolean fillBlanks = false;
private TextureAtlasSprite sprite; private TextureAtlasSprite sprite;
public SimpleModelFontRenderer(GameSettings settings, ResourceLocation font, TextureManager manager, boolean isUnicode, Matrix4f matrix, VertexFormat format) public SimpleModelFontRenderer(GameSettings settings, ResourceLocation font, TextureManager manager, boolean isUnicode, Matrix4f matrix)
{ {
super(manager, null); super(manager, null);
this.transform = new TransformationMatrix(matrix); this.transform = new TransformationMatrix(matrix);
this.format = format;
transform.transformNormal(normal); transform.transformNormal(normal);
orientation = Direction.getFacingFromVector(normal.getX(), normal.getY(), normal.getZ()); orientation = Direction.getFacingFromVector(normal.getX(), normal.getY(), normal.getZ());
} }
@@ -70,9 +67,9 @@ public abstract class SimpleModelFontRenderer extends FontRenderer {
private final Vector4f vec = new Vector4f(); private final Vector4f vec = new Vector4f();
private void addVertex(UnpackedBakedQuad.Builder quadBuilder, float x, float y, float u, float v) private void addVertex(BakedQuadBuilder quadBuilder, float x, float y, float u, float v)
{ {
ImmutableList<VertexFormatElement> elements = format.func_227894_c_(); ImmutableList<VertexFormatElement> elements = quadBuilder.getVertexFormat().func_227894_c_();
for(int e = 0; e < elements.size(); e++) for(int e = 0; e < elements.size(); e++)
{ {
VertexFormatElement element = elements.get(e); VertexFormatElement element = elements.get(e);
@@ -1,57 +0,0 @@
/*
* 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.client.model;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.model.IModelTransform;
import com.google.common.collect.ImmutableMap;
/**
* Simple implementation of IModelState via a map and a default value.
*/
public final class SimpleModelState implements IModelTransform
{
private final ImmutableMap<? extends Object, TransformationMatrix> map;
private final TransformationMatrix def;
public SimpleModelState(ImmutableMap<? extends Object, TransformationMatrix> map)
{
this(map, TransformationMatrix.func_227983_a_());
}
public SimpleModelState(ImmutableMap<? extends Object, TransformationMatrix> map, TransformationMatrix def)
{
this.map = map;
this.def = def;
}
@Override
public TransformationMatrix func_225615_b_()
{
return def;
}
@Override
public TransformationMatrix getPartTransformation(Object part)
{
return map.getOrDefault(part, TransformationMatrix.func_227983_a_());
}
}
@@ -27,7 +27,6 @@ import javax.annotation.Nullable;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.model.*; import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@@ -68,7 +68,6 @@ import com.google.gson.JsonParser;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.resources.IResource; import net.minecraft.resources.IResource;
import net.minecraft.resources.IResourceManager; import net.minecraft.resources.IResourceManager;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
@@ -83,7 +82,8 @@ import net.minecraftforge.client.model.b3d.B3DModel.Texture;
import net.minecraftforge.client.model.b3d.B3DModel.Vertex; import net.minecraftforge.client.model.b3d.B3DModel.Vertex;
import net.minecraftforge.client.model.data.IDynamicBakedModel; import net.minecraftforge.client.model.data.IDynamicBakedModel;
import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; import net.minecraftforge.client.model.pipeline.BakedQuadBuilder;
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
import net.minecraftforge.common.model.animation.IClip; import net.minecraftforge.common.model.animation.IClip;
import net.minecraftforge.common.model.animation.IJoint; import net.minecraftforge.common.model.animation.IJoint;
import net.minecraftforge.common.property.Properties; import net.minecraftforge.common.property.Properties;
@@ -460,7 +460,7 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
@Nullable @Nullable
@Override @Override
public IBakedModel func_225613_a_(ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform sprite, ResourceLocation modelLocation) public IBakedModel func_225613_a_(ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ResourceLocation modelLocation)
{ {
ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder(); ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder();
TextureAtlasSprite missing = spriteGetter.apply(new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, MissingTextureSprite.getLocation())); TextureAtlasSprite missing = spriteGetter.apply(new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, MissingTextureSprite.getLocation()));
@@ -477,7 +477,7 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
} }
} }
builder.put("missingno", missing); builder.put("missingno", missing);
return new BakedWrapper(model.getRoot(), sprite, smooth, gui3d, DefaultVertexFormats.BLOCK, meshes, builder.build()); return new BakedWrapper(model.getRoot(), modelTransform, smooth, gui3d, meshes, builder.build());
} }
public ModelWrapper retexture(ImmutableMap<String, String> textures) public ModelWrapper retexture(ImmutableMap<String, String> textures)
@@ -597,16 +597,15 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
private final IModelTransform state; private final IModelTransform state;
private final boolean smooth; private final boolean smooth;
private final boolean gui3d; private final boolean gui3d;
private final VertexFormat format;
private final ImmutableSet<String> meshes; private final ImmutableSet<String> meshes;
private final ImmutableMap<String, TextureAtlasSprite> textures; private final ImmutableMap<String, TextureAtlasSprite> textures;
private final LoadingCache<Integer, B3DState> cache; private final LoadingCache<Integer, B3DState> cache;
private ImmutableList<BakedQuad> quads; private ImmutableList<BakedQuad> quads;
public BakedWrapper(final Node<?> node, final IModelTransform state, final boolean smooth, final boolean gui3d, final VertexFormat format, final ImmutableSet<String> meshes, final ImmutableMap<String, TextureAtlasSprite> textures) public BakedWrapper(final Node<?> node, final IModelTransform state, final boolean smooth, final boolean gui3d, final ImmutableSet<String> meshes, final ImmutableMap<String, TextureAtlasSprite> textures)
{ {
this(node, state, smooth, gui3d, format, meshes, textures, CacheBuilder.newBuilder() this(node, state, smooth, gui3d, meshes, textures, CacheBuilder.newBuilder()
.maximumSize(128) .maximumSize(128)
.expireAfterAccess(2, TimeUnit.MINUTES) .expireAfterAccess(2, TimeUnit.MINUTES)
.build(new CacheLoader<Integer, B3DState>() .build(new CacheLoader<Integer, B3DState>()
@@ -626,13 +625,12 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
})); }));
} }
public BakedWrapper(Node<?> node, IModelTransform state, boolean smooth, boolean gui3d, VertexFormat format, ImmutableSet<String> meshes, ImmutableMap<String, TextureAtlasSprite> textures, LoadingCache<Integer, B3DState> cache) public BakedWrapper(Node<?> node, IModelTransform state, boolean smooth, boolean gui3d, ImmutableSet<String> meshes, ImmutableMap<String, TextureAtlasSprite> textures, LoadingCache<Integer, B3DState> cache)
{ {
this.node = node; this.node = node;
this.state = state; this.state = state;
this.smooth = smooth; this.smooth = smooth;
this.gui3d = gui3d; this.gui3d = gui3d;
this.format = format;
this.meshes = meshes; this.meshes = meshes;
this.textures = textures; this.textures = textures;
this.cache = cache; this.cache = cache;
@@ -713,16 +711,15 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
}); });
for(Face f : faces) for(Face f : faces)
{ {
UnpackedBakedQuad.Builder quadBuilder = new UnpackedBakedQuad.Builder(format);
quadBuilder.setContractUVs(true);
quadBuilder.setQuadOrientation(Direction.getFacingFromVector(f.getNormal().getX(), f.getNormal().getY(), f.getNormal().getZ()));
List<Texture> textures = null; List<Texture> textures = null;
if(f.getBrush() != null) textures = f.getBrush().getTextures(); if(f.getBrush() != null) textures = f.getBrush().getTextures();
TextureAtlasSprite sprite; TextureAtlasSprite sprite;
if(textures == null || textures.isEmpty()) sprite = this.textures.get("missingno"); if(textures == null || textures.isEmpty()) sprite = this.textures.get("missingno");
else if(textures.get(0) == B3DModel.Texture.White) sprite = ModelLoader.White.instance(); else if(textures.get(0) == B3DModel.Texture.White) sprite = ModelLoader.White.instance();
else sprite = this.textures.get(textures.get(0).getPath()); else sprite = this.textures.get(textures.get(0).getPath());
quadBuilder.setTexture(sprite); BakedQuadBuilder quadBuilder = new BakedQuadBuilder(sprite);
quadBuilder.setContractUVs(true);
quadBuilder.setQuadOrientation(Direction.getFacingFromVector(f.getNormal().getX(), f.getNormal().getY(), f.getNormal().getZ()));
putVertexData(quadBuilder, f.getV1(), f.getNormal(), sprite); putVertexData(quadBuilder, f.getV1(), f.getNormal(), sprite);
putVertexData(quadBuilder, f.getV2(), f.getNormal(), sprite); putVertexData(quadBuilder, f.getV2(), f.getNormal(), sprite);
putVertexData(quadBuilder, f.getV3(), f.getNormal(), sprite); putVertexData(quadBuilder, f.getV3(), f.getNormal(), sprite);
@@ -732,32 +729,32 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
} }
} }
private final void putVertexData(UnpackedBakedQuad.Builder builder, Vertex v, Vector3f faceNormal, TextureAtlasSprite sprite) private final void putVertexData(IVertexConsumer consumer, Vertex v, Vector3f faceNormal, TextureAtlasSprite sprite)
{ {
// TODO handle everything not handled (texture transformations, bones, transformations, normals, e.t.c) // TODO handle everything not handled (texture transformations, bones, transformations, normals, e.t.c)
ImmutableList<VertexFormatElement> vertexFormatElements = format.func_227894_c_(); ImmutableList<VertexFormatElement> vertexFormatElements = consumer.getVertexFormat().func_227894_c_();
for(int e = 0; e < vertexFormatElements.size(); e++) for(int e = 0; e < vertexFormatElements.size(); e++)
{ {
switch(vertexFormatElements.get(e).getUsage()) switch(vertexFormatElements.get(e).getUsage())
{ {
case POSITION: case POSITION:
builder.put(e, v.getPos().getX(), v.getPos().getY(), v.getPos().getZ(), 1); consumer.put(e, v.getPos().getX(), v.getPos().getY(), v.getPos().getZ(), 1);
break; break;
case COLOR: case COLOR:
if(v.getColor() != null) if(v.getColor() != null)
{ {
builder.put(e, v.getColor().getX(), v.getColor().getY(), v.getColor().getZ(), v.getColor().getW()); consumer.put(e, v.getColor().getX(), v.getColor().getY(), v.getColor().getZ(), v.getColor().getW());
} }
else else
{ {
builder.put(e, 1, 1, 1, 1); consumer.put(e, 1, 1, 1, 1);
} }
break; break;
case UV: case UV:
// TODO handle more brushes // TODO handle more brushes
if(vertexFormatElements.get(e).getIndex() < v.getTexCoords().length) if(vertexFormatElements.get(e).getIndex() < v.getTexCoords().length)
{ {
builder.put(e, consumer.put(e,
sprite.getInterpolatedU(v.getTexCoords()[0].getX() * 16), sprite.getInterpolatedU(v.getTexCoords()[0].getX() * 16),
sprite.getInterpolatedV(v.getTexCoords()[0].getY() * 16), sprite.getInterpolatedV(v.getTexCoords()[0].getY() * 16),
0, 0,
@@ -766,21 +763,21 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
} }
else else
{ {
builder.put(e, 0, 0, 0, 1); consumer.put(e, 0, 0, 0, 1);
} }
break; break;
case NORMAL: case NORMAL:
if(v.getNormal() != null) if(v.getNormal() != null)
{ {
builder.put(e, v.getNormal().getX(), v.getNormal().getY(), v.getNormal().getZ(), 0); consumer.put(e, v.getNormal().getX(), v.getNormal().getY(), v.getNormal().getZ(), 0);
} }
else else
{ {
builder.put(e, faceNormal.getX(), faceNormal.getY(), faceNormal.getZ(), 0); consumer.put(e, faceNormal.getX(), faceNormal.getY(), faceNormal.getZ(), 0);
} }
break; break;
default: default:
builder.put(e); consumer.put(e);
} }
} }
} }
@@ -797,6 +794,13 @@ public enum B3DLoader implements ISelectiveResourceReloadListener
return gui3d; return gui3d;
} }
@Override
public boolean func_230044_c_()
{
// TODO: Forge: Auto-generated method stub
return false;
}
@Override @Override
public boolean isBuiltInRenderer() public boolean isBuiltInRenderer()
{ {
@@ -1,26 +0,0 @@
/*
* 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
*/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package net.minecraftforge.client.model.composite;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;
Loaded 100 of 194 files, more files were not shown because too many files have changed in this diff. Show more