Skip to content

Commit

Permalink
NO NO NO, it's "notplace"
Browse files Browse the repository at this point in the history
Signed-off-by: Taskeren <nitu2003@126.com>
  • Loading branch information
Taskeren committed Jan 28, 2021
1 parent e867274 commit 735bc75
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 42 deletions.
4 changes: 2 additions & 2 deletions src/main/java/cn/taskeren/minequery/MineQueryMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import cn.taskeren.minequery.feature.HarvestCheck;
import cn.taskeren.minequery.feature.NotHitIronGolem;
import cn.taskeren.minequery.feature.NotHitVillager;
import cn.taskeren.minequery.feature.NotPlacingOnFace;
import cn.taskeren.minequery.feature.NotPlaceOnFace;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.event.player.AttackBlockCallback;
import net.fabricmc.fabric.api.event.player.AttackEntityCallback;
Expand All @@ -17,7 +17,7 @@ public void onInitializeClient() {
AttackBlockCallback.EVENT.register(new HarvestCheck());
AttackEntityCallback.EVENT.register(new NotHitVillager());
AttackEntityCallback.EVENT.register(new NotHitIronGolem());
UseBlockCallback.EVENT.register(new NotPlacingOnFace());
UseBlockCallback.EVENT.register(new NotPlaceOnFace());
}

}
30 changes: 15 additions & 15 deletions src/main/java/cn/taskeren/minequery/command/NotPlacingCommand.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cn.taskeren.minequery.command;

import cn.taskeren.minequery.feature.NotPlacingOnFace;
import cn.taskeren.minequery.feature.NotPlaceOnFace;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.BoolArgumentType;
Expand All @@ -18,7 +18,7 @@ public class NotPlacingCommand implements ClientCommandPlugin {

@Override
public void registerCommands(CommandDispatcher<CottonClientCommandSource> commandDispatcher) {
LiteralArgumentBuilder<CottonClientCommandSource> root = literal("notplacing")
LiteralArgumentBuilder<CottonClientCommandSource> root = literal("notplace")
.then(argument("direction", StringArgumentType.word()).then(argument("enable", BoolArgumentType.bool()).executes(NotPlacingCommand::run)));
commandDispatcher.register(root);
}
Expand All @@ -28,31 +28,31 @@ private static int run(CommandContext<CottonClientCommandSource> ctx) {
final Boolean b = BoolArgumentType.getBool(ctx, "enable");

if(d.equalsIgnoreCase("u") || d.equalsIgnoreCase("up")) {
NotPlacingOnFace.notUp = b;
ctx.getSource().sendFeedback(new TranslatableText("minequery.feature.not-placing-on-face.set."+b, d), false);
NotPlaceOnFace.notUp = b;
ctx.getSource().sendFeedback(new TranslatableText("minequery.feature.not-place-on-face.set."+b, d), false);
}
else if(d.equalsIgnoreCase("d") || d.equalsIgnoreCase("down")) {
NotPlacingOnFace.notDown = b;
ctx.getSource().sendFeedback(new TranslatableText("minequery.feature.not-placing-on-face.set."+b, d), false);
NotPlaceOnFace.notDown = b;
ctx.getSource().sendFeedback(new TranslatableText("minequery.feature.not-place-on-face.set."+b, d), false);
}
else if(d.equalsIgnoreCase("n") || d.equalsIgnoreCase("north")) {
NotPlacingOnFace.notNorth = b;
ctx.getSource().sendFeedback(new TranslatableText("minequery.feature.not-placing-on-face.set."+b, d), false);
NotPlaceOnFace.notNorth = b;
ctx.getSource().sendFeedback(new TranslatableText("minequery.feature.not-place-on-face.set."+b, d), false);
}
else if(d.equalsIgnoreCase("s") || d.equalsIgnoreCase("south")) {
NotPlacingOnFace.notSouth = b;
ctx.getSource().sendFeedback(new TranslatableText("minequery.feature.not-placing-on-face.set."+b, d), false);
NotPlaceOnFace.notSouth = b;
ctx.getSource().sendFeedback(new TranslatableText("minequery.feature.not-place-on-face.set."+b, d), false);
}
else if(d.equalsIgnoreCase("e") || d.equalsIgnoreCase("east")) {
NotPlacingOnFace.notEast = b;
ctx.getSource().sendFeedback(new TranslatableText("minequery.feature.not-placing-on-face.set."+b, d), false);
NotPlaceOnFace.notEast = b;
ctx.getSource().sendFeedback(new TranslatableText("minequery.feature.not-place-on-face.set."+b, d), false);
}
else if(d.equalsIgnoreCase("w") || d.equalsIgnoreCase("west")) {
NotPlacingOnFace.notWest = b;
ctx.getSource().sendFeedback(new TranslatableText("minequery.feature.not-placing-on-face.set."+b, d), false);
NotPlaceOnFace.notWest = b;
ctx.getSource().sendFeedback(new TranslatableText("minequery.feature.not-place-on-face.set."+b, d), false);
}
else {
ctx.getSource().sendFeedback(new TranslatableText("minequery.not-placing-on-face.direction-not-found"), false);
ctx.getSource().sendFeedback(new TranslatableText("minequery.not-place-on-face.direction-not-found"), false);
}

return Command.SINGLE_SUCCESS;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/cn/taskeren/minequery/config/I.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ private Property fufGetProp(Configuration c) {
true
);

static final I<Boolean> ITEM_FEATURE_NOT_PLACING_ON_FACE = ofBool(
"not-placing-on-face",
"Placing on Face: prevent placing the block on wrong direction",
static final I<Boolean> ITEM_FEATURE_NOT_PLACE_ON_FACE = ofBool(
"not-place-on-face",
"NotPlaceOnFace: prevent placing the block on wrong direction",
"feature",
true
);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cn/taskeren/minequery/config/MineConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public static boolean boolFeatureReSeeding() {
return ITEM_FEATURE_RESEEDING.getValue();
}

public static boolean boolFeatureNotPlacingOnFace() {
return ITEM_FEATURE_NOT_PLACING_ON_FACE.getValue();
public static boolean boolFeatureNotPlaceOnFace() {
return ITEM_FEATURE_NOT_PLACE_ON_FACE.getValue();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;

public class NotPlacingOnFace implements UseBlockCallback {
public class NotPlaceOnFace implements UseBlockCallback {

public static boolean notUp, notDown, notNorth, notSouth, notEast, notWest;

Expand Down Expand Up @@ -49,33 +49,33 @@ public static void reset() {
@Override
public ActionResult interact(PlayerEntity playerEntity, World world, Hand hand, BlockHitResult blockHitResult) {

if(!MineConfig.boolFeatureNotPlacingOnFace())
if(!MineConfig.boolFeatureNotPlaceOnFace())
return ActionResult.PASS;

final Direction d = blockHitResult.getSide();
if(notUp || notDown || notNorth || notSouth || notEast || notWest) {
if(d == Direction.UP && notUp) {
playerEntity.sendMessage(new TranslatableText("minequery.feature.not-placing-on-face.prevented"), true);
playerEntity.sendMessage(new TranslatableText("minequery.feature.not-place-on-face.prevented"), true);
return ActionResult.FAIL;
}
else if(d == Direction.DOWN && notDown) {
playerEntity.sendMessage(new TranslatableText("minequery.feature.not-placing-on-face.prevented"), true);
playerEntity.sendMessage(new TranslatableText("minequery.feature.not-place-on-face.prevented"), true);
return ActionResult.FAIL;
}
else if(d == Direction.NORTH && notNorth) {
playerEntity.sendMessage(new TranslatableText("minequery.feature.not-placing-on-face.prevented"), true);
playerEntity.sendMessage(new TranslatableText("minequery.feature.not-place-on-face.prevented"), true);
return ActionResult.FAIL;
}
else if(d == Direction.SOUTH && notSouth) {
playerEntity.sendMessage(new TranslatableText("minequery.feature.not-placing-on-face.prevented"), true);
playerEntity.sendMessage(new TranslatableText("minequery.feature.not-place-on-face.prevented"), true);
return ActionResult.FAIL;
}
else if(d == Direction.EAST && notEast) {
playerEntity.sendMessage(new TranslatableText("minequery.feature.not-placing-on-face.prevented"), true);
playerEntity.sendMessage(new TranslatableText("minequery.feature.not-place-on-face.prevented"), true);
return ActionResult.FAIL;
}
else if(d == Direction.WEST && notWest) {
playerEntity.sendMessage(new TranslatableText("minequery.feature.not-placing-on-face.prevented"), true);
playerEntity.sendMessage(new TranslatableText("minequery.feature.not-place-on-face.prevented"), true);
return ActionResult.FAIL;
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/resources/assets/minequery/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
"minequery.feature.not-hit-iron-golem.3": "§6[NotHitIronGolem] §bHit None",
"minequery.calculator.done": "%s §7=> %s",
"minequery.calculator.error": "§6[Calculator] §cError: %s",
"minequery.feature.not-placing-on-face.enabled": "§6[NotPlacingOnFace] §bEnabled",
"minequery.feature.not-placing-on-face.disabled": "§6[NotPlacingOnFace] §bDisabled",
"minequery.feature.not-placing-on-face.set.true": "§6[NotPlacingOnFace] §bPreventing placing on §6%s",
"minequery.feature.not-placing-on-face.set.false": "§6[NotPlacingOnFace] §bAllowing placing on §6%s",
"minequery.feature.not-placing-on-face.prevented": "§6[NotPlacingOnFace] §bPrevented Placement",
"minequery.feature.not-placing-on-face.direction-not-found": "§6[NotPlacingOnFace] §bWrong Direction [up(u), down(d), north(n), south(s), east(e), west(w)]"
"minequery.feature.not-place-on-face.enabled": "§6[NotPlaceOnFace] §bEnabled",
"minequery.feature.not-place-on-face.disabled": "§6[NotPlaceOnFace] §bDisabled",
"minequery.feature.not-place-on-face.set.true": "§6[NotPlaceOnFace] §bPreventing placing on §6%s",
"minequery.feature.not-place-on-face.set.false": "§6[NotPlaceOnFace] §bAllowing placing on §6%s",
"minequery.feature.not-place-on-face.prevented": "§6[NotPlaceOnFace] §bPrevented Placement",
"minequery.feature.not-place-on-face.direction-not-found": "§6[NotPlaceOnFace] §bWrong Direction [up(u), down(d), north(n), south(s), east(e), west(w)]"
}
12 changes: 6 additions & 6 deletions src/main/resources/assets/minequery/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
"minequery.feature.not-hit-iron-golem.3": "§6[不打铁傀儡] §b全部不打",
"minequery.calculator.done": "%s §7=> %s",
"minequery.calculator.error": "§6[计算器] §c错误:%s",
"minequery.feature.not-placing-on-face.enabled": "§6[不放这个面] §b开启",
"minequery.feature.not-placing-on-face.disabled": "§6[不放这个面] §b关闭",
"minequery.feature.not-placing-on-face.set.true": "§6[不放这个面] §b阻止§6%s§b的放置",
"minequery.feature.not-placing-on-face.set.false": "§6[不放这个面] §b允许§6%s§b的放置",
"minequery.feature.not-placing-on-face.prevented": "§6[不放这个面] §b已阻止放置",
"minequery.feature.not-placing-on-face.direction-not-found": "§6[不放这个面] §b错误的方向 [up(u), down(d), north(n), south(s), east(e), west(w)]"
"minequery.feature.not-place-on-face.enabled": "§6[不放这个面] §b开启",
"minequery.feature.not-place-on-face.disabled": "§6[不放这个面] §b关闭",
"minequery.feature.not-place-on-face.set.true": "§6[不放这个面] §b阻止§6%s§b的放置",
"minequery.feature.not-place-on-face.set.false": "§6[不放这个面] §b允许§6%s§b的放置",
"minequery.feature.not-place-on-face.prevented": "§6[不放这个面] §b已阻止放置",
"minequery.feature.not-place-on-face.direction-not-found": "§6[不放这个面] §b错误的方向 [up(u), down(d), north(n), south(s), east(e), west(w)]"
}

0 comments on commit 735bc75

Please sign in to comment.