Skip to content

Commit

Permalink
Update to 1.18.1
Browse files Browse the repository at this point in the history
skyrising committed Jan 8, 2022

Verified

This commit was signed with the committer’s verified signature.
Saelmala Sandra Larsson
1 parent bc4aeb5 commit 992f26b
Showing 8 changed files with 49 additions and 44 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -9,10 +9,10 @@ jobs:

steps:
- uses: actions/checkout@v1
- name: Set up JDK 16
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 16
java-version: 17
- name: Build with Gradle
run: ./gradlew build
- name: Upload JARs
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import java.text.SimpleDateFormat

plugins {
id 'fabric-loom' version '0.9-SNAPSHOT'
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'io.github.juuxel.loom-quiltflower-mini' version '1.2.1'
}

sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

def buildDate = new Date()
def branch = GitHelper.getBranch(rootDir)
@@ -85,7 +86,7 @@ processResources {

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
it.options.release = 16
it.options.release = 17
}

// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -4,14 +4,14 @@ org.gradle.jvmargs=-Xmx1G


# Mod Properties
mod_version = 3.1.0
mod_version = 3.2.0
maven_group = quickcarpet
archives_base_name = skyblock

minecraft_version=1.17.1
yarn_mappings=1.17.1+build.61:v2
loader_version=0.11.3
minecraft_version=1.18.1
yarn_mappings=1.18.1+build.18:v2
loader_version=0.12.12

fabric_resource_loader_v0_version=0.4.8+a00e834b18
fabric_resource_loader_v0_version=0.4.11+3ac43d95c8

quickcarpet_api_version=1.0.0
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.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 4 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
pluginManagement {
repositories {
jcenter()
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'Cotton'
url = 'https://server.bbkr.space/artifactory/libs-release/'
}
gradlePluginPortal()
}
}
40 changes: 21 additions & 19 deletions src/main/java/skyblock/SkyBlockUtils.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package skyblock;

import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.EndPortalFrameBlock;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.MobSpawnerBlockEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtList;
import net.minecraft.server.world.ServerLightingProvider;
@@ -15,8 +16,11 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.Heightmap;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.ChunkSection;
import net.minecraft.world.chunk.ChunkStatus;
import net.minecraft.world.chunk.ProtoChunk;
@@ -33,13 +37,17 @@

public class SkyBlockUtils {
public static void deleteBlocks(ProtoChunk chunk, WorldAccess world) {
Registry<Biome> biomes = world.getRegistryManager().get(Registry.BIOME_KEY);
ChunkSection[] sections = chunk.getSectionArray();
Arrays.fill(sections, WorldChunk.EMPTY_SECTION);
for (int i = 0; i < sections.length; i++) {
sections[i] = new ChunkSection(world.sectionIndexToCoord(i), biomes);
}
for (BlockPos bePos : chunk.getBlockEntityPositions()) {
chunk.removeBlockEntity(bePos);
}
((ProtoChunkAccessor) chunk).getLightSources().clear();
long[] emptyHeightmap = new PackedIntegerArray(9, 256).getStorage();
int bits = MathHelper.ceilLog2(chunk.getHeight() + 1);
long[] emptyHeightmap = new PackedIntegerArray(bits, 256).getData();
for (Map.Entry<Heightmap.Type, Heightmap> heightmapEntry : chunk.getHeightmaps()) {
heightmapEntry.getValue().setTo(chunk, heightmapEntry.getKey(), emptyHeightmap);
}
@@ -53,7 +61,7 @@ private static void processStronghold(ProtoChunk chunk, WorldAccess world) {
ProtoChunk startChunk = (ProtoChunk) world.getChunk(startPos.x, startPos.z, ChunkStatus.STRUCTURE_STARTS);
StructureStart<?> stronghold = startChunk.getStructureStart(StructureFeature.STRONGHOLD);
ChunkPos pos = chunk.getPos();
if (stronghold != null && stronghold.setBoundingBoxFromChildren().intersectsXZ(pos.getStartX(), pos.getStartZ(), pos.getEndX(), pos.getEndZ())) {
if (stronghold != null && stronghold.getBoundingBox().intersectsXZ(pos.getStartX(), pos.getStartZ(), pos.getEndX(), pos.getEndZ())) {
for (StructurePiece piece : stronghold.getChildren()) {
if (piece instanceof StrongholdGenerator.PortalRoom) {
if (piece.getBoundingBox().intersectsXZ(pos.getStartX(), pos.getStartZ(), pos.getEndX(), pos.getEndZ())) {
@@ -135,19 +143,13 @@ private static void generateStrongholdPortal(ProtoChunk chunk, StrongholdGenerat
setBlockInStructure(room, chunk, portal, 6, 3, 11);
}
BlockPos spawnerPos = getBlockInStructurePiece(room, 5, 3, 6);
setBlockInChunk(chunk, spawnerPos, Blocks.SPAWNER.getDefaultState());
NbtCompound spawnerTag = new NbtCompound();
spawnerTag.putString("id", "minecraft:mob_spawner");
NbtList spawnPotentials = new NbtList();
spawnerTag.put("SpawnPotentials", spawnPotentials);
NbtCompound spawnEntry = new NbtCompound();
spawnPotentials.add(0, spawnEntry);
NbtCompound entity = new NbtCompound();
spawnEntry.put("Entity", entity);
entity.putString("id", "minecraft:silverfish");
spawnEntry.putInt("Weight", 1);
spawnerTag.put("SpawnData", entity.copy());
setBlockEntityInChunk(chunk, spawnerPos, spawnerTag);
BlockState spawnerState = Blocks.SPAWNER.getDefaultState();
setBlockInChunk(chunk, spawnerPos, spawnerState);
BlockEntity blockEntity = ((BlockEntityProvider) spawnerState.getBlock()).createBlockEntity(spawnerPos, spawnerState);
if (blockEntity instanceof MobSpawnerBlockEntity) {
((MobSpawnerBlockEntity)blockEntity).getLogic().setEntityId(EntityType.SILVERFISH);
}
chunk.setBlockEntity(blockEntity);
}

private static void clearChunk(ProtoChunk chunk, WorldAccess world) {
8 changes: 4 additions & 4 deletions src/main/java/skyblock/mixin/ChunkStatusMixin.java
Original file line number Diff line number Diff line change
@@ -24,14 +24,14 @@
@Mixin(ChunkStatus.class)
public class ChunkStatusMixin {
// LIGHT
@Inject(method = "method_20613", at = @At("HEAD"))
private static void onLighting(ChunkStatus chunkStatus, Executor executor, ServerWorld world, ChunkGenerator generator, StructureManager manager, ServerLightingProvider lightingProvider, Function<Chunk, CompletableFuture<Either<Chunk, ChunkHolder.Unloaded>>> function, List<Chunk> list, Chunk chunk, CallbackInfoReturnable<CompletableFuture<Either<Chunk, ChunkHolder.Unloaded>>> info) {
@Inject(method = "method_20614", at = @At("HEAD"))
private static void onLighting(ChunkStatus chunkStatus, Executor executor, ServerWorld world, ChunkGenerator generator, StructureManager manager, ServerLightingProvider lightingProvider, Function<Chunk, CompletableFuture<Either<Chunk, ChunkHolder.Unloaded>>> function, List<Chunk> list, Chunk chunk, boolean bl, CallbackInfoReturnable<CompletableFuture<Either<Chunk, ChunkHolder.Unloaded>>> info) {
if(!chunk.getStatus().isAtLeast(chunkStatus)) SkyBlockUtils.deleteBlocks((ProtoChunk) chunk, world);
}

// SPAWN -> populateEntities
@Inject(method = "method_16566", at = @At("RETURN"))
@Inject(method = "method_17033", at = @At("RETURN"))
private static void afterPopulation(ChunkStatus chunkStatus, ServerWorld world, ChunkGenerator generator, List<Chunk> list, Chunk chunk, CallbackInfo info) {
((ProtoChunk) chunk).getEntities().clear();
}
}
}
Original file line number Diff line number Diff line change
@@ -31,20 +31,19 @@ public void toggleBlockLightDetection() {
}

@Override
public void readNbt(NbtCompound compoundTag_1) {
super.readNbt(compoundTag_1);
public void readNbt(NbtCompound nbt) {
super.readNbt(nbt);

if (SkyBlockSettings.blockLightDetector && compoundTag_1.contains("blockLightMode", 99 /* NUMBER */)) {
this.detectsBlockLight = compoundTag_1.getInt("blockLightMode") > 0;
if (SkyBlockSettings.blockLightDetector && nbt.contains("blockLightMode", 99 /* NUMBER */)) {
this.detectsBlockLight = nbt.getInt("blockLightMode") > 0;
}
}

@Override
public NbtCompound writeNbt(NbtCompound compoundTag_1) {
compoundTag_1 = super.writeNbt(compoundTag_1);
public void writeNbt(NbtCompound nbt) {
super.writeNbt(nbt);
if (SkyBlockSettings.blockLightDetector) {
compoundTag_1.putInt("blockLightMode", this.detectsBlockLight ? 1 : 0);
nbt.putInt("blockLightMode", this.detectsBlockLight ? 1 : 0);
}
return compoundTag_1;
}
}

0 comments on commit 992f26b

Please sign in to comment.