Skip to content
Open
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
17 changes: 11 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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/" }
Expand Down Expand Up @@ -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}" }
}
}
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
plasmid_version=0.6.7-SNAPSHOT+1.21.11
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-8.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 3 additions & 3 deletions src/main/java/fr/hugman/build_rush/BuildRush.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/fr/hugman/build_rush/build/BuildItemCollector.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
}
}
16 changes: 8 additions & 8 deletions src/main/java/fr/hugman/build_rush/game/state/BRActive.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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("[,.]$", "");
Expand All @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/fr/hugman/build_rush/map/BRMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -24,7 +24,7 @@ public static BRMap from(GameOpenContext<BRConfig> 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)
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/fr/hugman/build_rush/misc/CachedBlocks.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
}
}
}
}
Expand Down