diff --git a/build.gradle b/build.gradle index 0258e66..4568644 100644 --- a/build.gradle +++ b/build.gradle @@ -1,15 +1,15 @@ plugins { - id "fabric-loom" version "1.10.+" + id "fabric-loom" version "1.15.+" id 'maven-publish' } -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 - -archivesBaseName = project.archives_base_name version = project.mod_version group = project.maven_group +base { + archivesName = project.archives_base_name +} + repositories { maven { url = "https://maven.nucleoid.xyz/" } maven { url = "https://maven.gegy.dev/" } @@ -44,10 +44,15 @@ tasks.withType(JavaCompile).configureEach { java { withSourcesJar() + + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } jar { from("LICENSE") { - rename { "${it}_${project.archivesBaseName}" } + inputs.property "archivesName", project.base.archivesName + + rename { "${it}_${inputs.properties.archivesName}" } } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 52ea53e..0c4aab8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,10 +8,10 @@ archives_base_name=build_rush # Fabric Properties # check these on https://fabricmc.net/develop/ -minecraft_version=1.21.5 -yarn_mappings=1.21.5+build.1 -loader_version=0.16.13 -fabric_version=0.119.0+1.21.5 +minecraft_version=1.21.11 +yarn_mappings=1.21.11+build.4 +loader_version=0.18.4 +fabric_version=0.141.3+1.21.11 # check this on https://nucleoid.xyz/use/ -plasmid_version=0.6.4+1.21.5 \ No newline at end of file +plasmid_version=0.6.7-SNAPSHOT+1.21.11 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2733ed5..f50f69e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/fr/hugman/build_rush/BuildRush.java b/src/main/java/fr/hugman/build_rush/BuildRush.java index a0292ed..924db56 100644 --- a/src/main/java/fr/hugman/build_rush/BuildRush.java +++ b/src/main/java/fr/hugman/build_rush/BuildRush.java @@ -5,13 +5,13 @@ import net.fabricmc.api.ModInitializer; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.util.Identifier; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import xyz.nucleoid.plasmid.api.game.GameType; public class BuildRush implements ModInitializer { public static final String ID = "build_rush"; - public static final Logger LOGGER = LogManager.getLogger(ID); + public static final Logger LOGGER = LoggerFactory.getLogger(ID); @Override public void onInitialize() { diff --git a/src/main/java/fr/hugman/build_rush/build/BuildItemCollector.java b/src/main/java/fr/hugman/build_rush/build/BuildItemCollector.java index 39d2fcb..de99480 100644 --- a/src/main/java/fr/hugman/build_rush/build/BuildItemCollector.java +++ b/src/main/java/fr/hugman/build_rush/build/BuildItemCollector.java @@ -19,6 +19,9 @@ import net.minecraft.state.property.IntProperty; import net.minecraft.state.property.Properties; import net.minecraft.state.property.Property; +import net.minecraft.storage.NbtReadView; +import net.minecraft.storage.NbtWriteView; +import net.minecraft.util.ErrorReporter; import net.minecraft.util.Unit; import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.Nullable; @@ -231,7 +234,10 @@ private static void setUnbreakable(ItemStack stack) { public static void addBlockEntityNbt(ServerWorld world, ItemStack stack, BlockEntity blockEntity) { NbtCompound nbt = blockEntity.createNbtWithIdentifyingData(world.getRegistryManager()); - BlockItem.setBlockEntityData(stack, blockEntity.getType(), nbt); - stack.applyComponentsFrom(blockEntity.createComponentMap()); + try (ErrorReporter.Logging errorReporter = new ErrorReporter.Logging(blockEntity.getReporterContext(), BuildRush.LOGGER)) { + var view = NbtWriteView.create(errorReporter, world.getRegistryManager()); + BlockItem.setBlockEntityData(stack, blockEntity.getType(), view); + stack.applyComponentsFrom(blockEntity.createComponentMap()); + } } } diff --git a/src/main/java/fr/hugman/build_rush/game/state/BRActive.java b/src/main/java/fr/hugman/build_rush/game/state/BRActive.java index 5515d2d..955861a 100644 --- a/src/main/java/fr/hugman/build_rush/game/state/BRActive.java +++ b/src/main/java/fr/hugman/build_rush/game/state/BRActive.java @@ -271,7 +271,7 @@ public void tick() { if (otherData != data && otherData.plot != null && otherData.plot.safeZone().contains(player.getBlockPos())) { resetPlayer(player, true); player.sendMessage(TextUtil.translatable(TextUtil.WARNING, TextUtil.DANGER, "text.build_rush.do_not_disturb")); - player.playSoundToPlayer(SoundEvents.BLOCK_NOTE_BLOCK_DIDGERIDOO.value(), SoundCategory.PLAYERS, 1, 1); + player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_DIDGERIDOO.value(), 1, 1); break; } } @@ -303,18 +303,18 @@ public void tick() { } if (stateSeconds == 30 || stateSeconds == 15 || stateSeconds == 10) { TextUtil.sendSubtitle(player, Text.literal(String.valueOf(stateSeconds)).setStyle(Style.EMPTY.withColor(Formatting.YELLOW)), 0, 30, 10); - player.playSoundToPlayer(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), SoundCategory.PLAYERS, 1, 1.3f); + player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), 1, 1.3f); } if (stateSeconds <= 5) { TextUtil.sendSubtitle(player, Text.literal(String.valueOf(stateSeconds)).setStyle(Style.EMPTY.withColor(Formatting.RED)), 0, 20, 0); - player.playSoundToPlayer(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), SoundCategory.PLAYERS, 1, 1.6f); + player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), 1, 1.6f); } } else { data.bar.setColor(BossBar.Color.GREEN); } if (stateSeconds == 0 && (stateMinutes == 1 || stateMinutes == 2)) { TextUtil.sendSubtitle(player, Text.literal(String.valueOf(60)).setStyle(Style.EMPTY.withColor(Formatting.GREEN)), 0, 40, 20); - player.playSoundToPlayer(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), SoundCategory.PLAYERS, 1, 1); + player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_BELL.value(), 1, 1); } } data.bar.setPercent(statePercent); @@ -394,7 +394,7 @@ public void eliminate(PlayerData data) { player.sendMessage(TextUtil.translatable(TextUtil.SKULL, TextUtil.DANGER, "text.build_rush.eliminated.self", player.getName().getString())); TextUtil.clearSubtitle(player); TextUtil.sendTitle(player, TextUtil.translatable(TextUtil.DANGER, "title.build_rush.eliminated"), 0, 5 * 20, 20); - player.playSoundToPlayer(SoundEvents.ENTITY_BLAZE_DEATH, SoundCategory.PLAYERS, 1, 2f); + player.playSound(SoundEvents.ENTITY_BLAZE_DEATH, 1, 2f); } this.refreshSidebar(); @@ -691,7 +691,7 @@ public void onBlockPlaced(ServerPlayerEntity player) { data.score = this.maxScore; //TODO: store and send time player.sendMessage(TextUtil.translatable(TextUtil.CHECKMARK, TextUtil.SUCCESS, "text.build_rush.finished"), false); - player.playSoundToPlayer(SoundEvents.ENTITY_PLAYER_LEVELUP, SoundCategory.PLAYERS, 1.0f, 1.0f); + player.playSound(SoundEvents.ENTITY_PLAYER_LEVELUP, 1.0f, 1.0f); resetPlayer(player, false); TextUtil.clearTitle(player); } @@ -926,7 +926,7 @@ public void startElimination() { if (data.score == this.maxScore) { TextUtil.sendSubtitle(player, Text.translatable("title.build_rush.perfect").setStyle(Style.EMPTY.withColor(TextUtil.LEGENDARY).withBold(true)), 0, 3 * 20, 10); - player.playSoundToPlayer(SoundEvents.ENTITY_PLAYER_LEVELUP, SoundCategory.PLAYERS, 1.0f, 1.0f); + player.playSound(SoundEvents.ENTITY_PLAYER_LEVELUP, 1.0f, 1.0f); } else { float scorePercentage = data.score / (float) this.maxScore; String scoreAsPercent = String.format("%.2f", scorePercentage * 100).replaceAll("0*$", "").replaceAll("[,.]$", ""); @@ -935,7 +935,7 @@ public void startElimination() { player.sendMessage(TextUtil.translatable(TextUtil.DASH, TextUtil.NEUTRAL, "text.build_rush.score", scoreText), false); TextUtil.sendSubtitle(player, scoreText, 0, 2 * 20, 5); - player.playSoundToPlayer(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.PLAYERS, 1.0f, 1.0f); + player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 1.0f); } } diff --git a/src/main/java/fr/hugman/build_rush/map/BRMap.java b/src/main/java/fr/hugman/build_rush/map/BRMap.java index 31ff834..8db70fa 100644 --- a/src/main/java/fr/hugman/build_rush/map/BRMap.java +++ b/src/main/java/fr/hugman/build_rush/map/BRMap.java @@ -3,7 +3,7 @@ import fr.hugman.build_rush.BRConfig; import net.minecraft.server.world.ServerWorld; import net.minecraft.text.Text; -import net.minecraft.world.GameRules; +import net.minecraft.world.rule.GameRules; import xyz.nucleoid.fantasy.RuntimeWorldConfig; import xyz.nucleoid.map_templates.BlockBounds; import xyz.nucleoid.map_templates.MapTemplateSerializer; @@ -24,7 +24,7 @@ public static BRMap from(GameOpenContext context) throws IOException { var metadata = template.getMetadata(); var worldConfig = new RuntimeWorldConfig().setGenerator(new TemplateChunkGenerator(server, template)) - .setGameRule(GameRules.DO_FIRE_TICK, false) + .setGameRule(GameRules.FIRE_SPREAD_RADIUS_AROUND_PLAYER, -1) .setGameRule(GameRules.FIRE_DAMAGE, false) .setGameRule(GameRules.FREEZE_DAMAGE, false) .setGameRule(GameRules.DO_MOB_GRIEFING, false) diff --git a/src/main/java/fr/hugman/build_rush/misc/CachedBlocks.java b/src/main/java/fr/hugman/build_rush/misc/CachedBlocks.java index f038977..d133c5b 100644 --- a/src/main/java/fr/hugman/build_rush/misc/CachedBlocks.java +++ b/src/main/java/fr/hugman/build_rush/misc/CachedBlocks.java @@ -1,8 +1,12 @@ package fr.hugman.build_rush.misc; +import fr.hugman.build_rush.BuildRush; import net.minecraft.block.BlockState; import net.minecraft.nbt.NbtCompound; import net.minecraft.server.world.ServerWorld; +import net.minecraft.storage.NbtReadView; +import net.minecraft.storage.NbtWriteView; +import net.minecraft.util.ErrorReporter; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import xyz.nucleoid.map_templates.BlockBounds; @@ -55,7 +59,10 @@ public void place(ServerWorld world, BlockPos origin) { var nbt = entry.getValue(); var entity = world.getBlockEntity(targetPos); if (entity != null) { - entity.read(nbt, world.getRegistryManager()); + try (ErrorReporter.Logging errorReporter = new ErrorReporter.Logging(entity.getReporterContext(), BuildRush.LOGGER)) { + var view = NbtReadView.create(errorReporter, world.getRegistryManager(), nbt); + entity.read(view); + } } } }