Skip to content

Commit

Permalink
Add disableEndermanGriefing rule
Browse files Browse the repository at this point in the history
  • Loading branch information
alikindsys committed Jan 14, 2024
1 parent 1c1a49e commit ed9d4ed
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 6 deletions.
7 changes: 7 additions & 0 deletions src/main/java/org/blocovermelho/bvextension/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,11 @@ public class Settings {
categories = {SURVIVAL, "PROTOCOL", "bv-extension" }
)
public static boolean botPlayerListPrefix = false;

@Rule(
categories = {SURVIVAL, "bv-extension" }
)
public static boolean disableEndermanGriefing = false;


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.blocovermelho.bvextension.mixin;

import net.minecraft.entity.ai.goal.Goal;
import net.minecraft.entity.ai.goal.GoalSelector;
import net.minecraft.entity.mob.EndermanEntity;
import org.blocovermelho.bvextension.Settings;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(EndermanEntity.class)
public abstract class DisableEndermanGriefing {
@Redirect(method = "initGoals", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/ai/goal/GoalSelector;add(ILnet/minecraft/entity/ai/goal/Goal;)V", ordinal = 7))
public void bvext$noop_endermanGriefingPick(GoalSelector instance, int priority, Goal goal) {
if(Settings.disableEndermanGriefing) {
return;
} else {
instance.add(priority, goal);
}
}

@Redirect(method = "initGoals", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/ai/goal/GoalSelector;add(ILnet/minecraft/entity/ai/goal/Goal;)V", ordinal = 6))
public void bvext$noop_endermanGriefingPlace(GoalSelector instance, int priority, Goal goal) {
if(Settings.disableEndermanGriefing) {
return;
} else {
instance.add(priority, goal);
}
}
}
3 changes: 2 additions & 1 deletion src/main/resources/assets/bv-extension/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"carpet.rule.carefulBreak.desc": "Places the mined block in the player inventory when sneaking",
"carpet.rule.botsDontSleep.desc" : "Makes carpet bots don't count towards playersSleepingPercentage",
"carpet.rule.botPlayerListPrefix.desc": "Adds a prefix to bots on the player list"
"carpet.rule.botPlayerListPrefix.desc": "Adds a prefix to bots on the player list",
"carpet.rule.disableEndermanGriefing.desc" : "Removes the hability for enderman to pick and place blocks"
}
3 changes: 2 additions & 1 deletion src/main/resources/assets/bv-extension/lang/pt_br.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"carpet.rule.carefulBreak.desc": "Coloca o bloco minerado direto no inventário quando o jogador está agachado",
"carpet.rule.botsDontSleep.desc" : "Faz com que bots do carpet não contem para a gamerule playersSleepingPercentage",
"carpet.rule.botPlayerListPrefix.desc": "Adiciona um prefixo aos bots na lista de jogadores"
"carpet.rule.botPlayerListPrefix.desc": "Adiciona um prefixo aos bots na lista de jogadores",
"carpet.rule.disableEndermanGriefing.desc" : "Desabilita os endermans de pegar/colocar blocos"
}
9 changes: 5 additions & 4 deletions src/main/resources/bv-extension.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
"package": "org.blocovermelho.bvextension.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
"BotPrefixPlayerList",
"BotsDontSleep",
"DisableEndermanGriefing",
"carefulBreak.BedMixin",
"carefulBreak.BlockMixin",
"carefulBreak.TallBlockMixin",
"carefulBreak.PistonHeadMixin",
"carefulBreak.BedMixin",
"BotsDontSleep",
"BotPrefixPlayerList"
"carefulBreak.TallBlockMixin"
],
"client": [
],
Expand Down

0 comments on commit ed9d4ed

Please sign in to comment.