Skip to content

Commit

Permalink
Update to 1.21.4
Browse files Browse the repository at this point in the history
  • Loading branch information
senseiwells committed Dec 4, 2024
1 parent d122596 commit 879faac
Show file tree
Hide file tree
Showing 41 changed files with 96 additions and 100 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repositories {
}

dependencies {
include(modImplementation("net.casual-championships:arcade:0.3.1-alpha.46+1.21.3")!!)
include(modImplementation("net.casual-championships:arcade:0.3.1-alpha.47+1.21.4")!!)
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package net.casual.arcade.datagen.utils

import net.casual.arcade.resources.font.spacing.SpacingFontResources
import net.casual.arcade.resources.lang.LanguageEntry
import net.casual.arcade.utils.ComponentUtils
import net.casual.arcade.utils.ComponentUtils.getTranslationKeyOf
import net.minecraft.client.gui.Font
import net.minecraft.network.chat.Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
import net.minecraft.network.protocol.game.CommonPlayerSpawnInfo;
import net.minecraft.world.level.dimension.BuiltinDimensionTypes;
import net.minecraft.world.level.dimension.DimensionType;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(CommonPlayerSpawnInfo.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.players.PlayerList;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.dimension.DimensionType;
import net.minecraft.world.level.levelgen.WorldOptions;
Expand All @@ -23,8 +22,6 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import java.util.function.Supplier;

@Mixin(ServerLevel.class)
public abstract class ServerLevelMixin extends Level {
@Shadow @Final private ServerLevelData serverLevelData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.TickTask;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.dimension.BuiltinDimensionTypes;
import net.minecraft.world.level.dimension.DimensionType;
Expand All @@ -23,8 +22,6 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.function.Supplier;

@Mixin(ServerLevel.class)
public abstract class ServerLevelMixin extends Level {
@Shadow @Nullable private EndDragonFight dragonFight;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@ import net.minecraft.server.level.ServerLevel
import net.minecraft.server.level.WorldGenRegion
import net.minecraft.util.random.WeightedRandomList
import net.minecraft.world.entity.MobCategory
import net.minecraft.world.level.LevelHeightAccessor
import net.minecraft.world.level.NoiseColumn
import net.minecraft.world.level.StructureManager
import net.minecraft.world.level.WorldGenLevel
import net.minecraft.world.level.*
import net.minecraft.world.level.biome.*
import net.minecraft.world.level.chunk.ChunkAccess
import net.minecraft.world.level.chunk.ChunkGenerator
import net.minecraft.world.level.chunk.ChunkGeneratorStructureState
import net.minecraft.world.level.levelgen.GenerationStep
import net.minecraft.world.level.levelgen.Heightmap
import net.minecraft.world.level.levelgen.RandomState
import net.minecraft.world.level.levelgen.blending.Blender
Expand Down Expand Up @@ -90,8 +86,8 @@ public class VoidChunkGenerator(biome: BiomeSource): ChunkGenerator(biome) {
return WeightedRandomList.create()
}

override fun createStructures(registryAccess: RegistryAccess, structureState: ChunkGeneratorStructureState, structureManager: StructureManager, chunk: ChunkAccess, structureTemplateManager: StructureTemplateManager) {

override fun createStructures(registryAccess: RegistryAccess, structureState: ChunkGeneratorStructureState, structureManager: StructureManager, chunk: ChunkAccess, structureTemplateManager: StructureTemplateManager, dimension: ResourceKey<Level>) {
super.createStructures(registryAccess, structureState, structureManager, chunk, structureTemplateManager, dimension)
}

override fun createReferences(level: WorldGenLevel, structureManager: StructureManager, chunk: ChunkAccess) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.FlowingFluid;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
package net.casual.arcade.events.mixins;

import com.llamalad7.mixinextras.sugar.Local;
import com.mojang.serialization.Decoder;
import net.casual.arcade.events.GlobalEventHandler;
import net.casual.arcade.events.registry.RegistryEventHandler;
import net.casual.arcade.events.registry.RegistryLoadedFromResourcesEvent;
import net.minecraft.core.RegistryAccess;
import net.minecraft.core.WritableRegistry;
import net.minecraft.resources.RegistryDataLoader;
import net.minecraft.resources.RegistryOps;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.packs.resources.ResourceManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.Map;

@Mixin(RegistryDataLoader.class)
public class RegistryDataLoaderMixin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.llamalad7.mixinextras.sugar.Cancellable;
import com.mojang.authlib.GameProfile;
import net.casual.arcade.events.GlobalEventHandler;
import net.casual.arcade.events.core.CancellableEvent;
import net.casual.arcade.events.network.ClientboundPacketEvent;
import net.casual.arcade.events.network.PlayerDisconnectEvent;
import net.casual.arcade.events.player.PlayerClientboundPacketEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ private void onChangeDimension(
}

@Inject(
method = "doCheckFallDamage",
method = "checkFallDamage",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/entity/player/Player;checkFallDamage(DZLnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;)V"
)
)
private void onFall(double movementX, double movementY, double movementZ, boolean onGround, CallbackInfo ci) {
PlayerFallEvent event = new PlayerFallEvent((ServerPlayer) (Object) this, movementY, onGround);
private void onFall(double y, boolean onGround, BlockState state, BlockPos pos, CallbackInfo ci) {
PlayerFallEvent event = new PlayerFallEvent((ServerPlayer) (Object) this, y, onGround);
GlobalEventHandler.broadcast(event);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,6 @@ public object GlobalEventHandler {
this.recursion = true
}

internal fun suppressNextEvent(type: Class<out Event>) {
if (!this.suppressed.add(type)) {
this.logger.warn("Adding suppressed event (type: {}) twice", type)
}
}

private fun checkRecursive(type: Class<out Event>): Boolean {
val count = this.stack.getInt(type)
if (count >= MAX_RECURSIONS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import net.minecraft.core.BlockPos
import net.minecraft.core.Direction
import net.minecraft.server.level.ServerLevel
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.material.Fluid
import net.minecraft.world.level.material.FluidState

public class LevelFluidTrySpreadEvent(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package net.casual.arcade.events.player

import com.mojang.authlib.GameProfile
import net.casual.arcade.events.core.CancellableEvent
import net.casual.arcade.events.core.Event
import net.minecraft.network.chat.Component
import net.minecraft.server.MinecraftServer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package net.casual.arcade.events.registry

import com.google.common.collect.HashMultimap
import net.casual.arcade.events.BuiltInEventPhases.DEFAULT
import net.casual.arcade.events.EventListener
import net.casual.arcade.events.GlobalEventHandler
import net.casual.arcade.events.ListenerProvider
import net.casual.arcade.events.core.Event
import net.minecraft.core.Registry
import net.minecraft.resources.ResourceKey
import org.jetbrains.annotations.ApiStatus.Internal
import java.util.function.Consumer

public object RegistryEventHandler: EventListener<RegistryLoadedFromResourcesEvent<*>>, ListenerProvider {
private val listeners = HashMultimap.create<ResourceKey<*>, EventListener<*>>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private void onHandleVehicleMovement(ServerboundMoveVehiclePacket packet, Callba
ci.cancel();
Entity entity = this.player.getRootVehicle();
if (entity != this.player && entity.getControllingPassenger() == this.player && entity == this.lastVehicle) {
this.send(new ClientboundMoveVehiclePacket(entity));
this.send(ClientboundMoveVehiclePacket.fromEntity(entity));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.casual.arcade.minigame.mixins.bugfixes;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import com.mojang.datafixers.util.Either;
import net.minecraft.core.BlockPos;
Expand All @@ -12,27 +14,27 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.Optional;

@Mixin(Leashable.class)
public interface LeashableMixin {
@Inject(
@WrapOperation(
method = "readLeashData",
at = @At("HEAD"),
cancellable = true
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/entity/Leashable;readLeashDataInternal(Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/world/entity/Leashable$LeashData;"
)
)
private void onReadLeashData(CompoundTag compound, CallbackInfoReturnable<Leashable.LeashData> cir) {
private Leashable.LeashData onReadLeashData(CompoundTag compound, Operation<Leashable.LeashData> original) {
if (this instanceof Entity entity && compound.contains("LeashRelative", CompoundTag.TAG_INT_ARRAY)) {
Optional<BlockPos> optional = NbtUtils.readBlockPos(compound, "LeashRelative");
if (optional.isEmpty()) {
return;
if (optional.isPresent()) {
BlockPos position = entity.blockPosition().offset(optional.get());
return LeashDataInvoker.construct(Either.right(position));
}

BlockPos position = entity.blockPosition().offset(optional.get());
cir.setReturnValue(LeashDataInvoker.construct(Either.right(position)));
}
return original.call(compound);
}

@Inject(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import net.casual.arcade.minigame.gamemode.ExtendedGameMode;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.block.state.BlockState;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -30,11 +32,11 @@ private void shouldBroadcastTo(ServerPlayer player, CallbackInfoReturnable<Boole
}

@Inject(
method = "doCheckFallDamage",
method = "checkFallDamage",
at = @At("HEAD"),
cancellable = true
)
private void onCheckFallDamage(double movementX, double movementY, double movementZ, boolean onGround, CallbackInfo ci) {
private void onCheckFallDamage(double y, boolean onGround, BlockState state, BlockPos pos, CallbackInfo ci) {
// Prevent fall damage particles if in AdventureSpectator
if (getExtendedGameMode((ServerPlayer) (Object) this) == ExtendedGameMode.AdventureSpectator) {
ci.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,18 @@ public class MinigameMusicManager(
val biomes = level.chunkSource.generator.biomeSource.possibleBiomes()
val packets = ArrayList<ClientboundStopSoundPacket>()
for (biome in biomes) {
val key = biome.value().backgroundMusic.flatMap { it.event.unwrapKey() }?.getOrNull() ?: continue
packets.add(ClientboundStopSoundPacket(key.location(), SoundSource.MUSIC))
val entries = biome.value().backgroundMusic.getOrNull()?.unwrap()
if (entries.isNullOrEmpty()) {
continue
}
for (entry in entries) {
val music = entry.data()
val key = music.event.unwrapKey()
if (key.isEmpty) {
continue
}
packets.add(ClientboundStopSoundPacket(key.get().location(), SoundSource.MUSIC))
}
}
packets
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import net.casual.arcade.visuals.core.TickableUI
import net.casual.arcade.visuals.countdown.Countdown
import net.casual.arcade.visuals.countdown.TitledCountdown
import net.casual.arcade.visuals.nametag.PlayerNameTag
import net.casual.arcade.visuals.sidebar.FixedSidebar
import net.casual.arcade.visuals.sidebar.Sidebar
import net.casual.arcade.visuals.tab.PlayerListDisplay
import net.minecraft.network.protocol.Packet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import net.casual.arcade.minigame.settings.display.DisplayableSettings
import net.casual.arcade.minigame.settings.display.DisplayableSettingsDefaults
import net.casual.arcade.minigame.settings.display.MenuGameSettingBuilder.Companion.bool
import net.casual.arcade.minigame.settings.display.MenuGameSettingBuilder.Companion.int32
import net.casual.arcade.utils.ComponentUtils.literal
import net.casual.arcade.utils.ItemUtils
import net.casual.arcade.utils.ItemUtils.named
import net.casual.arcade.utils.ItemUtils.styledLore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,6 @@ public object ArcadeResourcePacks: ModInitializer {
}
}

public val NO_SHADOW_PACK: NamedResourcePackCreator by lazy {
NamedResourcePackCreator.named("no_shadow") {
addAssetSource(path("packs/NoShadow"))
packDescription = Component.literal("Utilities for removing text shadows")
}
}

public val PLAYER_HEADS_PACK: NamedResourcePackCreator by lazy {
NamedResourcePackCreator.named("player_heads") {
val location = path("packs/PlayerHeads")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package net.casual.arcade.resources.font.padding
import net.casual.arcade.resources.font.IndexedFontResources
import net.casual.arcade.utils.ResourceUtils
import net.minecraft.network.chat.Component
import net.minecraft.network.chat.MutableComponent

private val SPLIT_TEXTURE = ResourceUtils.arcade("font/split.png")
private val NO_SPLIT_TEXTURE = ResourceUtils.arcade("font/no_split.png")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ public object ResourcePackUtils {
}

@JvmStatic
@OptIn(ExperimentalPathApi::class)
private fun ResourcePackCreator.addMissingItemModelsInternal(namespace: String, assets: Path) {
val itemTextures = assets.resolve(namespace).resolve("textures").resolve("item")
val itemModels = assets.resolve(namespace).resolve("models")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package net.casual.arcade.scheduler.task

import net.casual.arcade.scheduler.TickedScheduler
import net.casual.arcade.scheduler.task.impl.CancellableTask
import java.io.Serializable

/**
* This interface represents a [Task] used in the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import net.casual.arcade.scheduler.task.Task
* when creating a task using a [TaskFactory].
*
* It provides any custom data written by the task,
* see [getCustomData].
* see [data].
*
* It also provides the ability to create subtasks using the
* [createTask] method.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.casual.arcade.scheduler.task.utils

import com.mojang.serialization.MapCodec
import net.casual.arcade.scheduler.task.serialization.TaskFactory
import net.casual.arcade.utils.ArcadeUtils
import net.casual.arcade.utils.registries.RegistryKeySupplier
Expand Down
Loading

0 comments on commit 879faac

Please sign in to comment.