Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.17.1 port #59

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 16
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 16
- name: Build with Gradle
run: ./gradlew build
- name: Upload build artifacts
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 16
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 16
- name: Build with Gradle
run: ./gradlew build
- name: Upload assets to GitHub
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ plugins {
id 'fabric-loom' version '0.6-SNAPSHOT'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id 'fabric-loom' version '0.8-SNAPSHOT'

}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16

archivesBaseName = "${project.archives_base_name}-mc${project.minecraft_version}"
group = project.maven_group
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.16.3
yarn_mappings=1.16.3+build.11
loader_version=0.9.3+build.207
minecraft_version=1.17.1
yarn_mappings=1.17.1+build.1
loader_version=0.11.6

# Mod Properties
mod_version=0.7.2
mod_version=0.8.0
maven_group=me.jellysquid.mods
archives_base_name=phosphor-fabric
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ public SkyLightChunkNibbleArray(final ChunkNibbleArray inheritedLightmap) {
super(inheritedLightmap.asByteArray());
}

@Override
protected int getIndex(final int x, final int y, final int z) {
return super.getIndex(x, 0, z);
}
// @Override // Commented out because this function seems to have changed, maybe implementing this optimization?
// protected int getIndex(final int x, final int y, final int z) {
// return super.getIndex(x, 0, z);
// }

@Override
public byte[] asByteArray() {
byte[] byteArray = new byte[2048];

for(int i = 0; i < 16; ++i) {
System.arraycopy(this.byteArray, 0, byteArray, i * 128, 128);
System.arraycopy(this.bytes, 0, byteArray, i * 128, 128);
}

return byteArray;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private void onCleanup(CallbackInfo ci) {
// [VanillaCopy] method_20479
@Override
public BlockState getBlockStateForLighting(int x, int y, int z) {
if (World.isHeightInvalid(y)) {
if (this.chunkProvider.getWorld().isOutOfHeightLimit(y)) {
return DEFAULT_STATE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtList;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.structure.StructureManager;
import net.minecraft.util.math.ChunkPos;
Expand All @@ -20,29 +20,29 @@
@Mixin(ChunkSerializer.class)
public abstract class MixinChunkSerializer {
@Inject(
method = "deserialize(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/structure/StructureManager;Lnet/minecraft/world/poi/PointOfInterestStorage;Lnet/minecraft/util/math/ChunkPos;Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/world/chunk/ProtoChunk;",
method = "deserialize(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/structure/StructureManager;Lnet/minecraft/world/poi/PointOfInterestStorage;Lnet/minecraft/util/math/ChunkPos;Lnet/minecraft/nbt/NbtCompound;)Lnet/minecraft/world/chunk/ProtoChunk;",
at = @At(
value = "INVOKE_ASSIGN",
target = "Lnet/minecraft/world/chunk/ChunkManager;getLightingProvider()Lnet/minecraft/world/chunk/light/LightingProvider;",
ordinal = 0
)
)
private static void loadLightmaps(final ServerWorld world, final StructureManager structureManager, final PointOfInterestStorage poiStorage, final ChunkPos pos, final CompoundTag tag, final CallbackInfoReturnable<ProtoChunk> ci) {
final CompoundTag levelTag = tag.getCompound("Level");
private static void loadLightmaps(final ServerWorld world, final StructureManager structureManager, final PointOfInterestStorage poiStorage, final ChunkPos pos, final NbtCompound tag, final CallbackInfoReturnable<ProtoChunk> ci) {
final NbtCompound levelTag = tag.getCompound("Level");

// Load lightmaps of pre_light chunks unless erasing cached data
if (levelTag.getBoolean("isLightOn") || !levelTag.contains("Heightmaps", 10)) {
return;
}

final ListTag sections = levelTag.getList("Sections", 10);
final NbtList sections = levelTag.getList("Sections", 10);
final LightingProvider lightingProvider = world.getChunkManager().getLightingProvider();
final boolean hasSkyLight = world.getDimension().hasSkyLight();

lightingProvider.setRetainData(pos, true);

for(int i = 0; i < sections.size(); ++i) {
final CompoundTag section = sections.getCompound(i);
final NbtCompound section = sections.getCompound(i);
final int y = section.getByte("Y");

if (section.contains("BlockLight", 7)) {
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/phosphor.accesswidener
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ accessible class net/minecraft/block/AbstractBlock$AbstractBlockState$ShapeCache
accessible class net/minecraft/world/chunk/ChunkStatus$GenerationTask
accessible class net/minecraft/world/chunk/ChunkStatus$LoadTask

accessible class net/minecraft/world/chunk/light/BlockLightStorage$Data
accessible class net/minecraft/world/chunk/light/SkyLightStorage$Data

accessible class net/minecraft/server/world/ServerLightingProvider$Stage

accessible method net/minecraft/world/chunk/light/LightStorage hasSection (J)Z
accessible method net/minecraft/world/chunk/light/SkyLightStorage method_15565 (J)Z
accessible method net/minecraft/world/chunk/light/SkyLightStorage isAboveMinHeight (I)Z

extendable class net/minecraft/world/chunk/ChunkNibbleArray