Build local release artifacts and prepare Compose deployment [skip ci]
This commit is contained in:
1 parent
6deff62a3a
commit
52de8c3031
25 files changed
+137
-23
No files matched your search
@@ -0,0 +1,13 @@
|
||||
package net.scopenet.minecraft;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public final class Compat {
|
||||
private Compat() {}
|
||||
|
||||
public static ServerLevel level(ServerPlayer player) { return player.serverLevel(); }
|
||||
public static String dimension(ServerPlayer player) { return level(player).dimension().location().toString(); }
|
||||
public static void actionbar(ServerPlayer player, Component message) { player.displayClientMessage(message, true); }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package net.scopenet.minecraft;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public final class Compat {
|
||||
private Compat() {}
|
||||
|
||||
public static ServerLevel level(ServerPlayer player) { return player.serverLevel(); }
|
||||
public static String dimension(ServerPlayer player) { return level(player).dimension().location().toString(); }
|
||||
public static void actionbar(ServerPlayer player, Component message) { player.displayClientMessage(message, true); }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package net.scopenet.minecraft;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public final class Compat {
|
||||
private Compat() {}
|
||||
|
||||
public static ServerLevel level(ServerPlayer player) { return player.level(); }
|
||||
public static String dimension(ServerPlayer player) { return level(player).dimension().identifier().toString(); }
|
||||
public static void actionbar(ServerPlayer player, Component message) { player.sendSystemMessage(message, true); }
|
||||
}
|
||||
@@ -78,10 +78,10 @@ public final class Bridge {
|
||||
Integration current = integration;
|
||||
if (current == null) return false;
|
||||
if (!current.settings().guildsEnabled() || !current.settings().landClaimingEnabled()) return true;
|
||||
String dimension = player.serverLevel().dimension().location().toString();
|
||||
String dimension = Compat.dimension(player);
|
||||
ChunkCheckResult check = current.checkChunk(dimension, pos.getX() >> 4, pos.getZ() >> 4, player.getUUID());
|
||||
if (check.allowed()) return true;
|
||||
player.displayClientMessage(Component.literal("This chunk is protected by a guild or the claim check is unavailable."), true);
|
||||
Compat.actionbar(player, Component.literal("This chunk is protected by a guild or the claim check is unavailable."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@ import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.scopenet.minecraft.Bridge;
|
||||
import net.scopenet.minecraft.Compat;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.*;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
@@ -25,7 +26,7 @@ public abstract class BlockItemMixin {
|
||||
Bridge.stat(player, "blocks_placed", 1);
|
||||
String material = BuiltInRegistries.BLOCK.getKey(context.getLevel().getBlockState(context.getClickedPos()).getBlock())
|
||||
.getPath().toUpperCase(java.util.Locale.ROOT);
|
||||
Bridge.action(player, "block_placed:" + material + "@" + player.serverLevel().dimension().location(), 1);
|
||||
Bridge.action(player, "block_placed:" + material + "@" + Compat.dimension(player), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.scopenet.minecraft.Bridge;
|
||||
import net.scopenet.minecraft.Compat;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.*;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@@ -20,7 +21,7 @@ public abstract class PlayerMixin {
|
||||
key = "blocks_broken";
|
||||
String material = BuiltInRegistries.BLOCK.getKey((Block) stat.getValue()).getPath().toUpperCase(java.util.Locale.ROOT);
|
||||
Bridge.action((ServerPlayer) (Object) this, "block_broken:" + material + "@"
|
||||
+ ((ServerPlayer) (Object) this).serverLevel().dimension().location(), amount);
|
||||
+ Compat.dimension((ServerPlayer) (Object) this), amount);
|
||||
} else if (stat.getType() == Stats.ENTITY_KILLED) {
|
||||
String entity = BuiltInRegistries.ENTITY_TYPE.getKey((EntityType<?>) stat.getValue()).getPath().toUpperCase(java.util.Locale.ROOT);
|
||||
Bridge.action((ServerPlayer) (Object) this, "mob_kills:" + entity, amount);
|
||||
|
||||
Reference in new issue
Block a user