Skip to content

Commit

Permalink
feat
Browse files Browse the repository at this point in the history
  • Loading branch information
zly2006 committed Oct 21, 2024
1 parent 9596ab8 commit 9af2bfd
Show file tree
Hide file tree
Showing 5 changed files with 219 additions and 86 deletions.
13 changes: 6 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "fabric-loom" version "1.7-SNAPSHOT" apply false
id "fabric-loom" version "1.7.3" apply false
id "maven-publish"
id "org.ajoberstar.grgit" version "5.2.2"
id "org.jetbrains.kotlin.jvm" version "2.0.0"
Expand All @@ -19,10 +19,10 @@ allprojects {
}
maven { url "https://maven.shedaniel.me" }

maven {
name = "Reden"
url = ("https://maven.starlight.cool/artifactory/reden")
}
// maven {
// name = "Reden"
// url = ("https://maven.starlight.cool/artifactory/reden")
// }
}

base {
Expand Down Expand Up @@ -95,12 +95,11 @@ loom {
dependencies {
// todo
// modRuntimeOnly "maven.modrinth:luckperms:v5.4.113-fabric"
// include(implementation("com.redenmc:brigadier-kotlin-dsl:1.0-SNAPSHOT"))

// SnakeYAML. To convert the old config
include(modImplementation("org.yaml:snakeyaml:1.33"))

include(implementation("com.redenmc:brigadier-kotlin-dsl:1.0-SNAPSHOT"))

// Fabric Permissions API. To check the permissions
include(modImplementation('me.lucko:fabric-permissions-api:0.2-SNAPSHOT'))
// REI. To avoid the REI GUI overlap with the Enclosure GUI
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
org.gradle.jvmargs=-Xmx5G
org.gradle.parallel=true
# Mod Properties
mod_version=0.4.5
mod_version=0.4.6
archices_preview_version=

maven_group=com.github.zly2006
Expand All @@ -13,7 +13,7 @@ rei_version = 9.1.550
# check these on https://fabricmc.net/develop
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.2
loader_version=0.16.7

# Fabric API
fabric_version=0.102.1+1.21.1
fabric_version=0.106.0+1.21.1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.ElementListWidget;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableTextContent;
Expand Down Expand Up @@ -105,7 +104,7 @@ public void render(DrawContext context, int index, int y, int x, int entryWidth,
context.drawText(client.textRenderer, permission.getName(), x + 20, y + 3, 0xFFFFFF, false);
context.drawText(client.textRenderer, permission.getDescription(), x + 140, y + 3, 0x999999, false);
permission.getIcon();
context.drawItem(new ItemStack(permission.getIcon()), x, y);
context.drawItem(permission.getIcon(), x, y);
if (buttonWidget.isHovered()) {
context.drawTooltip(client.textRenderer, List.of(
Text.translatable("enclosure.widget.click.left").styled(style -> style.withColor(Formatting.GREEN)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.zly2006.enclosure.EnclosureArea;
import com.github.zly2006.enclosure.ServerMain;
import com.github.zly2006.enclosure.utils.Permission;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.village.raid.Raid;
Expand All @@ -18,14 +19,26 @@
public class MixinRaidManager {
@Unique
private final static Logger LOGGER = LoggerFactory.getLogger("Enclosure Raid Alert");
@Inject(method = "startRaid", at = @At("RETURN"))

@Inject(
method = "startRaid",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/village/raid/Raid;start(Lnet/minecraft/server/network/ServerPlayerEntity;)Z"
),
cancellable = true
)
private void onStart(ServerPlayerEntity player, BlockPos p, CallbackInfoReturnable<Raid> cir) {
Raid raid = cir.getReturnValue();
if (raid != null) {
BlockPos pos = raid.getCenter();
EnclosureArea area = ServerMain.INSTANCE.getSmallestEnclosure(player.getServerWorld(), pos);
if (area != null) {
LOGGER.info("Raid {} started by {} in enclosure {} at {} {} {}.", raid.getRaidId(), player.getNameForScoreboard(), area.getName(), pos.getX(), pos.getY(), pos.getZ());
if (!area.hasPubPerm(Permission.RAID)) {
player.sendMessage(Permission.RAID.getNoPermissionMsg(player));
cir.setReturnValue(null);
}
}
}
}
Expand Down
Loading

0 comments on commit 9af2bfd

Please sign in to comment.