Skip to content

Commit

Permalink
Update minigame to Minecraft 1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
haykam821 committed Dec 8, 2024
1 parent 50de441 commit c321bcf
Show file tree
Hide file tree
Showing 52 changed files with 181 additions and 136 deletions.
18 changes: 6 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,18 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Cache
uses: actions/cache@v2
with:
path: |
~/.gradle/loom-cache
~/.gradle/caches
key: gradle-${{hashFiles('**/*.gradle*')}}
restore-keys: gradle-
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 17
cache: gradle
distribution: microsoft
java-version: 21
- name: Build with Gradle
run: gradle build
- name: Upload Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: artifacts
path: build/libs
11 changes: 7 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
plugins {
id "fabric-loom" version "1.5.7"
id "fabric-loom" version "1.9.2"
id "maven-publish"
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
Expand Down Expand Up @@ -46,7 +43,13 @@ processResources {
}
}

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

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

Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ mod_version = 1.0.0
org.gradle.jvmargs = -Xmx1G

# Versions
minecraft_version = 1.20.4
yarn_mappings = 1.20.4+build.3
loader_version = 0.15.6
fabric_version = 0.96.0+1.20.4
minecraft_version = 1.21.3
yarn_mappings = 1.21.3+build.2
loader_version = 0.16.9
fabric_version = 0.110.0+1.21.3

plasmid_version = 0.5.102-SNAPSHOT+1.20.4
plasmid_version = 0.6.1+1.21.3
12 changes: 8 additions & 4 deletions src/main/java/io/github/haykam821/beaconbreakers/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,23 @@
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
import xyz.nucleoid.plasmid.game.GameType;
import xyz.nucleoid.plasmid.api.game.GameType;

public class Main implements ModInitializer {
public static final String MOD_ID = "beaconbreakers";
private static final String MOD_ID = "beaconbreakers";

private static final Identifier RESPAWN_BEACONS_ID = new Identifier(MOD_ID, "respawn_beacons");
private static final Identifier RESPAWN_BEACONS_ID = Main.identifier("respawn_beacons");
public static final TagKey<Block> RESPAWN_BEACONS = TagKey.of(RegistryKeys.BLOCK, RESPAWN_BEACONS_ID);

private static final Identifier BEACON_BREAKERS_ID = new Identifier(MOD_ID, "beacon_breakers");
private static final Identifier BEACON_BREAKERS_ID = Main.identifier("beacon_breakers");
public static final GameType<BeaconBreakersConfig> BEACON_BREAKERS_TYPE = GameType.register(BEACON_BREAKERS_ID, BeaconBreakersConfig.CODEC, BeaconBreakersWaitingPhase::open);

@Override
public void onInitialize() {
return;
}

public static Identifier identifier(String path) {
return Identifier.of(MOD_ID, path);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
import java.util.Optional;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;

import io.github.haykam821.beaconbreakers.game.map.BeaconBreakersMapConfig;
import net.minecraft.SharedConstants;
import net.minecraft.util.math.intprovider.ConstantIntProvider;
import net.minecraft.util.math.intprovider.IntProvider;
import xyz.nucleoid.plasmid.game.common.config.PlayerConfig;
import xyz.nucleoid.plasmid.game.common.team.GameTeamList;
import xyz.nucleoid.plasmid.api.game.common.config.WaitingLobbyConfig;
import xyz.nucleoid.plasmid.api.game.common.team.GameTeamList;

public class BeaconBreakersConfig {
public static final Codec<BeaconBreakersConfig> CODEC = RecordCodecBuilder.create(instance -> {
public static final MapCodec<BeaconBreakersConfig> CODEC = RecordCodecBuilder.mapCodec(instance -> {
return instance.group(
PlayerConfig.CODEC.fieldOf("players").forGetter(BeaconBreakersConfig::getPlayerConfig),
WaitingLobbyConfig.CODEC.fieldOf("players").forGetter(BeaconBreakersConfig::getPlayerConfig),
BeaconBreakersMapConfig.CODEC.fieldOf("map").forGetter(BeaconBreakersConfig::getMapConfig),
GameTeamList.CODEC.optionalFieldOf("teams").forGetter(BeaconBreakersConfig::getTeams),
IntProvider.NON_NEGATIVE_CODEC.optionalFieldOf("ticks_until_close", ConstantIntProvider.create(SharedConstants.TICKS_PER_SECOND * 10)).forGetter(BeaconBreakersConfig::getTicksUntilClose),
Expand All @@ -25,15 +26,15 @@ public class BeaconBreakersConfig {
).apply(instance, BeaconBreakersConfig::new);
});

private final PlayerConfig playerConfig;
private final WaitingLobbyConfig playerConfig;
private final BeaconBreakersMapConfig mapConfig;
private final Optional<GameTeamList> teams;
private final IntProvider ticksUntilClose;
private final int invulnerability;
private final boolean keepInventory;
private final boolean allowSelfBreaking;

public BeaconBreakersConfig(PlayerConfig playerConfig, BeaconBreakersMapConfig mapConfig, Optional<GameTeamList> teams, IntProvider ticksUntilClose, int invulnerability, boolean keepInventory, boolean allowSelfBreaking) {
public BeaconBreakersConfig(WaitingLobbyConfig playerConfig, BeaconBreakersMapConfig mapConfig, Optional<GameTeamList> teams, IntProvider ticksUntilClose, int invulnerability, boolean keepInventory, boolean allowSelfBreaking) {
this.playerConfig = playerConfig;
this.mapConfig = mapConfig;
this.teams = teams;
Expand All @@ -43,7 +44,7 @@ public BeaconBreakersConfig(PlayerConfig playerConfig, BeaconBreakersMapConfig m
this.allowSelfBreaking = allowSelfBreaking;
}

public PlayerConfig getPlayerConfig() {
public WaitingLobbyConfig getPlayerConfig() {
return this.playerConfig;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import io.github.haykam821.beaconbreakers.game.phase.BeaconBreakersActivePhase;
import io.github.haykam821.beaconbreakers.game.player.team.TeamEntry;
import net.minecraft.text.Text;
import xyz.nucleoid.plasmid.game.common.GlobalWidgets;
import xyz.nucleoid.plasmid.game.common.widget.SidebarWidget;
import xyz.nucleoid.plasmid.api.game.common.GlobalWidgets;
import xyz.nucleoid.plasmid.api.game.common.widget.SidebarWidget;

public class BeaconBreakersSidebar {
private final SidebarWidget widget;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import io.github.haykam821.beaconbreakers.game.phase.BeaconBreakersActivePhase;
import net.minecraft.entity.boss.BossBar;
import net.minecraft.text.Text;
import xyz.nucleoid.plasmid.game.common.GlobalWidgets;
import xyz.nucleoid.plasmid.game.common.widget.BossBarWidget;
import xyz.nucleoid.plasmid.api.game.common.GlobalWidgets;
import xyz.nucleoid.plasmid.api.game.common.widget.BossBarWidget;

public class InvulnerabilityTimerBar {
private static final Text TITLE = Text.translatable("text.beaconbreakers.invulnerability.title");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.haykam821.beaconbreakers.game.map;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;

import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
Expand All @@ -15,7 +14,6 @@
import net.minecraft.world.biome.source.BiomeAccess;
import net.minecraft.world.biome.source.BiomeSource;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.gen.GenerationStep.Carver;
import net.minecraft.world.gen.StructureAccessor;
import net.minecraft.world.gen.chunk.Blender;
import net.minecraft.world.gen.chunk.ChunkGenerator;
Expand All @@ -24,7 +22,7 @@
import net.minecraft.world.gen.chunk.VerticalBlockSample;
import net.minecraft.world.gen.noise.NoiseConfig;
import xyz.nucleoid.fantasy.util.ChunkGeneratorSettingsProvider;
import xyz.nucleoid.plasmid.game.world.generator.GameChunkGenerator;
import xyz.nucleoid.plasmid.api.game.world.generator.GameChunkGenerator;

public final class BeaconBreakersChunkGenerator extends GameChunkGenerator implements ChunkGeneratorSettingsProvider {
private static final BlockState BARRIER = Blocks.BARRIER.getDefaultState();
Expand Down Expand Up @@ -57,20 +55,20 @@ private boolean isChunkWithinArea(Chunk chunk) {
}

@Override
public CompletableFuture<Chunk> populateBiomes(Executor executor, NoiseConfig noiseConfig, Blender blender, StructureAccessor structures, Chunk chunk) {
public CompletableFuture<Chunk> populateBiomes(NoiseConfig noiseConfig, Blender blender, StructureAccessor structures, Chunk chunk) {
if (this.isChunkWithinArea(chunk)) {
return this.chunkGenerator.populateBiomes(executor, noiseConfig, blender, structures, chunk);
return this.chunkGenerator.populateBiomes(noiseConfig, blender, structures, chunk);
} else {
return super.populateBiomes(executor, noiseConfig, blender, structures, chunk);
return super.populateBiomes(noiseConfig, blender, structures, chunk);
}
}

@Override
public CompletableFuture<Chunk> populateNoise(Executor executor, Blender blender, NoiseConfig noiseConfig, StructureAccessor structures, Chunk chunk) {
public CompletableFuture<Chunk> populateNoise(Blender blender, NoiseConfig noiseConfig, StructureAccessor structures, Chunk chunk) {
if (this.isChunkWithinArea(chunk)) {
return this.chunkGenerator.populateNoise(executor, blender, noiseConfig, structures, chunk);
return this.chunkGenerator.populateNoise(blender, noiseConfig, structures, chunk);
}
return super.populateNoise(executor, blender, noiseConfig, structures, chunk);
return super.populateNoise(blender, noiseConfig, structures, chunk);
}

@Override
Expand Down Expand Up @@ -99,7 +97,7 @@ public void generateFeatures(StructureWorldAccess world, Chunk chunk, StructureA
BlockPos.Mutable mutablePos = new BlockPos.Mutable();

int bottomY = chunk.getBottomY();
int topY = chunk.getTopY() - 1;
int topY = chunk.getTopYInclusive();

// Top
for (int x = 0; x < 16; x++) {
Expand Down Expand Up @@ -151,9 +149,9 @@ public void generateFeatures(StructureWorldAccess world, Chunk chunk, StructureA
}

@Override
public void carve(ChunkRegion region, long seed, NoiseConfig noiseConfig, BiomeAccess access, StructureAccessor structures, Chunk chunk, Carver carver) {
public void carve(ChunkRegion region, long seed, NoiseConfig noiseConfig, BiomeAccess access, StructureAccessor structures, Chunk chunk) {
if (this.isChunkWithinArea(chunk)) {
this.chunkGenerator.carve(region, seed, noiseConfig, access, structures, chunk, carver);
this.chunkGenerator.carve(region, seed, noiseConfig, access, structures, chunk);
}
}

Expand Down
Loading

0 comments on commit c321bcf

Please sign in to comment.