use of net.minecraft.text.TranslatableText in project LevelZ by Globox1997.
the class EnchantingTableBlockMixin method onUseMixin.
@Inject(method = "onUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;openHandledScreen(Lnet/minecraft/screen/NamedScreenHandlerFactory;)Ljava/util/OptionalInt;"), cancellable = true)
private void onUseMixin(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable<ActionResult> info) {
ArrayList<Object> levelList = LevelLists.enchantingTableList;
if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, true)) {
player.sendMessage(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)), true);
info.setReturnValue(ActionResult.FAIL);
}
}
use of net.minecraft.text.TranslatableText in project LevelZ by Globox1997.
the class GrindstoneBlockMixin method onUseMixin.
@Inject(method = "onUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;openHandledScreen(Lnet/minecraft/screen/NamedScreenHandlerFactory;)Ljava/util/OptionalInt;"), cancellable = true)
private void onUseMixin(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable<ActionResult> info) {
ArrayList<Object> levelList = LevelLists.grindstoneList;
if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, true)) {
player.sendMessage(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)), true);
info.setReturnValue(ActionResult.FAIL);
}
}
use of net.minecraft.text.TranslatableText in project LevelZ by Globox1997.
the class LecternBlockMixin method onUseMixin.
@Inject(method = "onUse", at = @At(value = "HEAD"), cancellable = true)
private void onUseMixin(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable<ActionResult> info) {
ArrayList<Object> levelList = LevelLists.lecternList;
if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, true)) {
player.sendMessage(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)), true);
info.setReturnValue(ActionResult.FAIL);
}
}
use of net.minecraft.text.TranslatableText in project LevelZ by Globox1997.
the class PumpkinBlockMixin method onUseMixin.
@Inject(method = "onUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;playSound(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/sound/SoundEvent;Lnet/minecraft/sound/SoundCategory;FF)V"), cancellable = true)
private void onUseMixin(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable<ActionResult> info) {
ArrayList<Object> levelList = LevelLists.pumpkinList;
if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, true)) {
player.sendMessage(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)), true);
info.setReturnValue(ActionResult.FAIL);
}
}
use of net.minecraft.text.TranslatableText in project LevelZ by Globox1997.
the class SmokerBlockMixin method openScreenMixin.
@Inject(method = "openScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;openHandledScreen(Lnet/minecraft/screen/NamedScreenHandlerFactory;)Ljava/util/OptionalInt;"), cancellable = true)
protected void openScreenMixin(World world, BlockPos pos, PlayerEntity player, CallbackInfo info) {
ArrayList<Object> levelList = LevelLists.smokerList;
if (!PlayerStatsManager.playerLevelisHighEnough(player, levelList, null, true)) {
player.sendMessage(new TranslatableText("item.levelz." + levelList.get(0) + ".tooltip", levelList.get(1)), true);
info.cancel();
}
}
Aggregations