From 58d9678c40e9d2815bc3d356b37b82586c837d7b Mon Sep 17 00:00:00 2001 From: Nicholas Ignoffo Date: Fri, 23 Mar 2018 16:50:17 -0700 Subject: [PATCH] Switch some more instances of chat spam to the action bar --- .../WayofTime/bloodmagic/item/ItemAltarMaker.java | 14 +++++++------- .../bloodmagic/item/ItemRitualDiviner.java | 2 +- .../bloodmagic/item/ItemRitualReader.java | 2 +- .../bloodmagic/item/ItemSanguineBook.java | 3 ++- .../util/handler/event/GenericHandler.java | 3 ++- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemAltarMaker.java b/src/main/java/WayofTime/bloodmagic/item/ItemAltarMaker.java index b299b030..e1da3b10 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemAltarMaker.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemAltarMaker.java @@ -5,7 +5,6 @@ import WayofTime.bloodmagic.altar.*; import WayofTime.bloodmagic.api.impl.BloodMagicAPI; import WayofTime.bloodmagic.block.BlockAltar; import WayofTime.bloodmagic.client.IVariantProvider; -import WayofTime.bloodmagic.util.ChatUtil; import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.util.helper.NBTHelper; import WayofTime.bloodmagic.util.helper.NumeralHelper; @@ -21,6 +20,7 @@ import net.minecraft.util.ActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -54,7 +54,7 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP return super.onItemRightClick(world, player, hand); if (!player.capabilities.isCreativeMode) { - ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.bloodmagic.altarMaker.creativeOnly")); + player.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.altarMaker.creativeOnly"), true); return super.onItemRightClick(world, player, hand); } @@ -67,18 +67,18 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP stack.getTagCompound().setInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER, stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1); setTierToBuild(AltarTier.values()[stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER)]); - ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.bloodmagic.altarMaker.setTier", NumeralHelper.toRoman(stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1))); + player.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.altarMaker.setTier", NumeralHelper.toRoman(stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1)), true); return super.onItemRightClick(world, player, hand); } RayTraceResult rayTrace = rayTrace(world, player, false); - if (rayTrace == null || rayTrace.typeOfHit == RayTraceResult.Type.MISS || rayTrace.typeOfHit == RayTraceResult.Type.ENTITY) + if (rayTrace == null || rayTrace.typeOfHit != RayTraceResult.Type.BLOCK) return super.onItemRightClick(world, player, hand); - if (rayTrace.typeOfHit == RayTraceResult.Type.BLOCK && world.getBlockState(rayTrace.getBlockPos()).getBlock() instanceof BlockAltar) { - ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.bloodmagic.altarMaker.building", NumeralHelper.toRoman(tierToBuild.toInt()))); + IBlockState state = world.getBlockState(rayTrace.getBlockPos()); + if (state.getBlock() instanceof BlockAltar) { + player.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.altarMaker.building", NumeralHelper.toRoman(tierToBuild.toInt())), true); buildAltar(world, rayTrace.getBlockPos()); - IBlockState state = world.getBlockState(rayTrace.getBlockPos()); world.notifyBlockUpdate(rayTrace.getBlockPos(), state, state, 3); } diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemRitualDiviner.java b/src/main/java/WayofTime/bloodmagic/item/ItemRitualDiviner.java index 1de11784..e55a482d 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemRitualDiviner.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemRitualDiviner.java @@ -366,7 +366,7 @@ public class ItemRitualDiviner extends Item implements IVariantProvider { } public void notifyDirectionChange(EnumFacing direction, EntityPlayer player) { - ChatUtil.sendNoSpam(player, TextHelper.localize(tooltipBase + "currentDirection", Utils.toFancyCasing(direction.getName()))); + player.sendStatusMessage(new TextComponentTranslation(tooltipBase + "currentDirection", Utils.toFancyCasing(direction.name())), true); } public void setDirection(ItemStack stack, EnumFacing direction) { diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemRitualReader.java b/src/main/java/WayofTime/bloodmagic/item/ItemRitualReader.java index 9cc9c6df..cdabfa3a 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemRitualReader.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemRitualReader.java @@ -136,7 +136,7 @@ public class ItemRitualReader extends Item implements IVariantProvider { BlockPos containedPos = getBlockPos(stack); if (containedPos.equals(BlockPos.ORIGIN)) { this.setBlockPos(stack, pos.subtract(masterPos)); - ChatUtil.sendNoSpam(player, new TextComponentTranslation("ritual.bloodmagic.blockRange.firstBlock")); + player.sendStatusMessage(new TextComponentTranslation("ritual.bloodmagic.blockRange.firstBlock"), true); //TODO: Notify player. } else { tile = world.getTileEntity(masterPos); diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemSanguineBook.java b/src/main/java/WayofTime/bloodmagic/item/ItemSanguineBook.java index ec2457d6..ca2d37f9 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemSanguineBook.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemSanguineBook.java @@ -25,6 +25,7 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -79,7 +80,7 @@ public class ItemSanguineBook extends Item implements IVariantProvider, IAltarMa stack.getTagCompound().setInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER, stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1); currentDisplayedTier = AltarTier.values()[stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER)]; - ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.bloodmagic.altarMaker.setTier", NumeralHelper.toRoman(stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1))); + player.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.altarMaker.setTier", NumeralHelper.toRoman(stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1)), true); return super.onItemRightClick(world, player, hand); } diff --git a/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java b/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java index 8ba5b079..0dff68cc 100644 --- a/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java +++ b/src/main/java/WayofTime/bloodmagic/util/handler/event/GenericHandler.java @@ -59,6 +59,7 @@ import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.Explosion; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; @@ -298,7 +299,7 @@ public class GenericHandler { Block block = state.getBlock(); if (block instanceof BlockAltar && event.getEntityPlayer() != null && event.getEntityPlayer() instanceof EntityPlayerMP && !event.getEntityPlayer().getHeldItemMainhand().isEmpty() && event.getEntityPlayer().getHeldItemMainhand().getItem() instanceof ItemAltarMaker) { ItemAltarMaker altarMaker = (ItemAltarMaker) event.getEntityPlayer().getHeldItemMainhand().getItem(); - ChatUtil.sendNoSpam(event.getEntityPlayer(), TextHelper.localizeEffect("chat.bloodmagic.altarMaker.destroy", altarMaker.destroyAltar(event.getEntityPlayer()))); + event.getEntityPlayer().sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.altarMaker.destroy", altarMaker.destroyAltar(event.getEntityPlayer())), true); } }