Skip to content

Commit

Permalink
Merge branch 'legacy/1.12.2' into legacy/1.8.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Grayray75 committed Aug 26, 2023
2 parents f516ed0 + 8783eb2 commit 941c84b
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 33 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# https://grayray75.github.io/LegacyFabric-Versions/
minecraft_version=1.8.9
yarn_mappings_build=524
yarn_mappings_build=529
loader_version=0.14.22

# Mod Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(ChunkDataS2CPacket.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ private boolean setBlockStateInjectGenerateSkylightMapVanilla(boolean generateSk
slice = @Slice(
from = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/chunk/Chunk;method_3917(III)V",
target = "Lnet/minecraft/world/chunk/Chunk;lightBlock(III)V",
ordinal = 1
),
to = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/chunk/Chunk;method_3911(II)V"
target = "Lnet/minecraft/world/chunk/Chunk;setColumnLightOutdated(II)V"
)

),
Expand All @@ -125,12 +125,12 @@ private int setBlockStatePreventPropagateSkylightOcclusion1(int generateSkylight
slice = @Slice(
from = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/chunk/Chunk;method_3917(III)V",
target = "Lnet/minecraft/world/chunk/Chunk;lightBlock(III)V",
ordinal = 1
),
to = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/chunk/Chunk;method_3911(II)V"
target = "Lnet/minecraft/world/chunk/Chunk;setColumnLightOutdated(II)V"
)

),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import me.jellysquid.mods.phosphor.mod.PhosphorMod;
import me.jellysquid.mods.phosphor.mod.world.WorldChunkSlice;
import me.jellysquid.mods.phosphor.mod.world.lighting.LightingHooks;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.LightType;
Expand Down Expand Up @@ -52,7 +50,7 @@ public abstract class ChunkMixin implements IChunkLighting, IChunkLightingData,

@Final
@Shadow
private boolean[] field_4726;
private boolean[] columnSkyLightOutdated;

@Final
@Shadow
Expand All @@ -63,7 +61,7 @@ public abstract class ChunkMixin implements IChunkLighting, IChunkLightingData,
public int chunkZ;

@Shadow
private boolean field_4742;
private boolean isSkyLightOutdated;

@Shadow
protected abstract int getBlockOpacity(int x, int y, int z);
Expand Down Expand Up @@ -125,7 +123,7 @@ private void setLightForRedirectGenerateSkylightMap(Chunk chunk, LightType light
* @author JellySquid
*/
@Overwrite
private void method_3917(int x, int y, int z) {
private void lightBlock(int x, int y, int z) {
int i = this.heightmap[z << 4 | x] & 255;
int j = i;

Expand All @@ -140,7 +138,7 @@ private void method_3917(int x, int y, int z) {
if (j != i) {
this.heightmap[z << 4 | x] = j;

if (!this.world.dimension.isNether()) {
if (!this.world.dimension.hasNoSkylight()) {
LightingHooks.relightSkylightColumn(this.world, (Chunk) (Object) this, x, z, i, j);
}

Expand Down Expand Up @@ -180,7 +178,7 @@ public void populate() {
* @author JellySquid
*/
@Overwrite
private void method_6534(boolean onlyOne) {
private void recheckSkyLightGaps(boolean onlyOne) {
this.world.profiler.push("recheckGaps");

WorldChunkSlice slice = new WorldChunkSlice(this.world, this.chunkX, this.chunkZ);
Expand All @@ -198,7 +196,7 @@ private void method_6534(boolean onlyOne) {
}
}

this.field_4742 = false;
this.isSkyLightOutdated = false;
}

this.world.profiler.pop();
Expand All @@ -207,8 +205,8 @@ private void method_6534(boolean onlyOne) {
private boolean recheckGapsForColumn(WorldChunkSlice slice, int x, int z) {
int i = x + z * 16;

if (this.field_4726[i]) {
this.field_4726[i] = false;
if (this.columnSkyLightOutdated[i]) {
this.columnSkyLightOutdated[i] = false;

int height = this.getHighestBlockY(x, z);

Expand Down Expand Up @@ -276,7 +274,7 @@ else if (i < maxValue) {
private void updateSkylightNeighborHeight(WorldChunkSlice slice, int x, int z, int startY, int endY) {
if (endY > startY) {
for (int i = startY; i < endY; ++i) {
this.world.method_8539(LightType.SKY, new BlockPos(x, i, z));
this.world.calculateLightAtPos(LightType.SKY, new BlockPos(x, i, z));
}

this.modified = true;
Expand Down Expand Up @@ -344,14 +342,7 @@ public int getCachedLightFor(LightType lightType, BlockPos pos) {
}
}
else if (lightType == LightType.SKY) {
// In Minecraft there is no dimension.hasSkyLight() function, I guess it was added by forge
// Because this checks if the dimension can see the sky, I guess it looks for the nether and end?
//
// 1.8.9 Note: isOverworld() doesn't exist here so i'm using !isNether()
// It should be noted that isNether() is named wrong it should be hasNoSky (MCP) or so
//
//if (!this.world.dimension.hasSkyLight()) {
if (this.world.dimension.isNether()) {
if (this.world.dimension.hasNoSkylight()) {
return 0;
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

@Mixin(ServerChunkProvider.class)
public interface ServerChunkProviderAccessor {
@Accessor("chunkMap")
@Accessor("chunkStorage")
LongObjectStorage<Chunk> getChunkStorage();
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private void onConstructed(CallbackInfo ci) {
*
* @author JellySquid
*/
@Inject(method = "method_8539", at = @At("HEAD"), cancellable = true)
@Inject(method = "calculateLightAtPos", at = @At("HEAD"), cancellable = true)
private void checkLightFor(LightType lightType, BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
this.lightingEngine.scheduleLightUpdate(lightType, pos);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ private static int getCachedLightFor(Chunk chunk, ChunkSection section, BlockPos
}
}
else if (lightType == LightType.SKY) {
if (chunk.getWorld().dimension.isNether()) {
if (chunk.getWorld().dimension.hasNoSkylight()) {
return 0;
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static void relightSkylightColumn(final World world, final Chunk chunk, f
scheduleRelightChecksForColumn(world, LightType.SKY, xBase, zBase, yMin, yMax);

if (sections[yMin >> 4] == null && yMin > 0) {
world.method_8539(LightType.SKY, new BlockPos(xBase, yMin - 1, zBase));
world.calculateLightAtPos(LightType.SKY, new BlockPos(xBase, yMin - 1, zBase));
}

short emptySections = 0;
Expand Down Expand Up @@ -85,7 +85,7 @@ private static void scheduleRelightChecksForColumn(final World world, final Ligh
BlockPos.Mutable pos = new BlockPos.Mutable();

for (int y = yMin; y <= yMax; ++y) {
world.method_8539(lightType, pos.setPosition(x, y, z));
world.calculateLightAtPos(lightType, pos.setPosition(x, y, z));
}
}

Expand Down Expand Up @@ -324,7 +324,7 @@ public static void initChunkLighting(final Chunk chunk, final World world) {
if (light > 0) {
pos.setPosition(xBase + x, yBase + y, zBase + z);

world.method_8539(LightType.BLOCK, pos);
world.calculateLightAtPos(LightType.BLOCK, pos);
}
}
}
Expand All @@ -333,7 +333,7 @@ public static void initChunkLighting(final Chunk chunk, final World world) {
}
}

if (!world.dimension.isNether()) {
if (!world.dimension.hasNoSkylight()) {
((IChunkLightingData) chunk).setSkylightUpdatedPublic();
}

Expand Down Expand Up @@ -362,7 +362,7 @@ public static void checkChunkLighting(final Chunk chunk, final World world) {
}

public static void initSkylightForSection(final World world, final Chunk chunk, final ChunkSection section) {
if (!world.dimension.isNether()) {
if (!world.dimension.hasNoSkylight()) {
for (int x = 0; x < 16; ++x) {
for (int z = 0; z < 16; ++z) {
if (chunk.getHighestBlockY(x, z) <= section.getYOffset()) {
Expand Down

0 comments on commit 941c84b

Please sign in to comment.