diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java index 7ebb909ce8..398bf19ad3 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java @@ -19,12 +19,14 @@ package net.minecraftforge.client.model.pipeline; +import java.util.List; +import java.util.Objects; + import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.block.BlockState; -import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.color.BlockColors; @@ -35,14 +37,18 @@ import net.minecraft.client.renderer.vertex.VertexFormatElement; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.ILightReader; -import net.minecraft.world.IWorldReader; - -import java.util.List; -import java.util.Objects; public class VertexLighterFlat extends QuadGatheringTransformer { protected static final VertexFormatElement NORMAL_4F = new VertexFormatElement(0, VertexFormatElement.Type.FLOAT, VertexFormatElement.Usage.NORMAL, 4); + + // TODO 1.16/1.17 possibly refactor out the need for the "unpacked" format entirely. It's creating more headaches than solutions. + // This mess reverses the conversion to float bits done in LightUtil.unpack + private static final int LIGHTMAP_PACKING_FACTOR = ((256 << (8 * (DefaultVertexFormats.TEX_2SB.getType().getSize() - 1))) - 1) >>> 1; + // Max lightmap value, for rescaling + private static final int LIGHTMAP_MAX = 0xF0; + // Inlined factor for rescaling input lightmap values, "rounded" up to the next float value to avoid precision loss when result is truncated to int + private static final float LIGHTMAP_RESCALE = Math.nextAfter((float) LIGHTMAP_PACKING_FACTOR / LIGHTMAP_MAX, LIGHTMAP_PACKING_FACTOR); protected final BlockInfo blockInfo; private int tint = -1; @@ -198,7 +204,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer z += normal[v][2] * .5f; } - float blockLight = lightmap[v][0], skyLight = lightmap[v][1]; + float blockLight = lightmap[v][0] * LIGHTMAP_RESCALE, skyLight = lightmap[v][1] * LIGHTMAP_RESCALE; updateLightmap(normal[v], lightmap[v], x, y, z); if(dataLength[lightmapIndex] > 1) { diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 86e9e0b698..190031a266 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -107,7 +107,7 @@ public net.minecraft.entity.ai.brain.schedule.Activity (Ljava/lang/String; public net.minecraft.entity.ai.brain.sensor.SensorType (Ljava/util/function/Supplier;)V public net.minecraft.entity.item.ExperienceOrbEntity field_70530_e # xpValue protected net.minecraft.entity.item.TNTEntity func_70515_d()V # explode - make it easier to extend TNTEntity with custom explosion logic -public net.minecraft.entity.merchant.villager.VillagerProcession (Ljava/lang/String;Lnet/minecraft/village/PointOfInterestType;Lcom/google/common/collect/ImmutableSet;Lcom/google/common/collect/ImmutableSet;Lnet/minecraft/util/SoundEvent;)V +public net.minecraft.entity.merchant.villager.VillagerProfession (Ljava/lang/String;Lnet/minecraft/village/PointOfInterestType;Lcom/google/common/collect/ImmutableSet;Lcom/google/common/collect/ImmutableSet;Lnet/minecraft/util/SoundEvent;)V protected net.minecraft.entity.monster.AbstractSkeletonEntity func_190727_o()Lnet/minecraft/util/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable protected net.minecraft.entity.monster.SkeletonEntity func_190727_o()Lnet/minecraft/util/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable protected net.minecraft.entity.monster.StrayEntity func_190727_o()Lnet/minecraft/util/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable