use of net.minecraft.util.text.TextComponentTranslation in project BloodMagic by WayofTime.
the class SubCommandBind method execute.
@Override
public void execute(MinecraftServer server, ICommandSender commandSender, String[] args) throws CommandException {
if (commandSender.getEntityWorld().isRemote)
return;
try {
EntityPlayer player = CommandBase.getCommandSenderAsPlayer(commandSender);
ItemStack held = player.getHeldItemMainhand();
boolean bind = true;
if (held.getItem() instanceof IBindable) {
if (args.length > 0) {
if (args[0].equalsIgnoreCase("help"))
return;
if (isBoolean(args[0])) {
bind = Boolean.parseBoolean(args[0]);
if (args.length > 2)
player = CommandBase.getPlayer(server, commandSender, args[1]);
} else {
player = CommandBase.getPlayer(server, commandSender, args[0]);
}
}
if (bind) {
Binding binding = new Binding(player.getGameProfile().getId(), player.getGameProfile().getName());
BindableHelper.applyBinding(held, binding);
commandSender.sendMessage(new TextComponentTranslation("commands.bind.success"));
} else {
Binding binding = ((IBindable) held.getItem()).getBinding(held);
if (binding != null) {
held.getTagCompound().removeTag("binding");
commandSender.sendMessage(new TextComponentTranslation("commands.bind.remove.success"));
}
}
}
} catch (PlayerNotFoundException e) {
commandSender.sendMessage(new TextComponentTranslation(TextHelper.localizeEffect("commands.error.404")));
}
}
use of net.minecraft.util.text.TextComponentTranslation in project BloodMagic by WayofTime.
the class BlockAltar method getDocumentation.
// IDocumentedBlock
@Override
public List<ITextComponent> getDocumentation(EntityPlayer player, World world, BlockPos pos, IBlockState state) {
List<ITextComponent> docs = new ArrayList<>();
IBloodAltar altar = ((IBloodAltar) world.getTileEntity(pos));
Pair<BlockPos, ComponentType> missingBlock = AltarUtil.getFirstMissingComponent(world, pos, altar.getTier().toInt());
if (missingBlock != null)
docs.add(new TextComponentTranslation("chat.bloodmagic.altar.nextTier", new TextComponentTranslation(missingBlock.getRight().getKey()), Utils.prettifyBlockPosString(missingBlock.getLeft())));
return docs;
}
use of net.minecraft.util.text.TextComponentTranslation in project BloodMagic by WayofTime.
the class ItemNodeRouter method onItemUseFirst.
@Override
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if (world.isRemote) {
return EnumActionResult.PASS;
}
TileEntity tileHit = world.getTileEntity(pos);
if (!(tileHit instanceof IRoutingNode)) {
// TODO: Remove contained position?
BlockPos containedPos = getBlockPos(stack);
if (!containedPos.equals(BlockPos.ORIGIN)) {
this.setBlockPos(stack, BlockPos.ORIGIN);
player.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.routing.remove"), true);
return EnumActionResult.FAIL;
}
return EnumActionResult.FAIL;
}
IRoutingNode node = (IRoutingNode) tileHit;
BlockPos containedPos = getBlockPos(stack);
if (containedPos.equals(BlockPos.ORIGIN)) {
this.setBlockPos(stack, pos);
player.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.routing.set"), true);
return EnumActionResult.SUCCESS;
} else {
TileEntity pastTile = world.getTileEntity(containedPos);
if (pastTile instanceof IRoutingNode) {
IRoutingNode pastNode = (IRoutingNode) pastTile;
if (pastNode instanceof IMasterRoutingNode) {
IMasterRoutingNode master = (IMasterRoutingNode) pastNode;
if (!node.isMaster(master)) {
if (// If the node is not the master and it is receptive
node.getMasterPos().equals(BlockPos.ORIGIN)) {
node.connectMasterToRemainingNode(world, new LinkedList<>(), master);
master.addConnection(pos, containedPos);
master.addNodeToList(node);
node.addConnection(containedPos);
player.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.routing.link.master"), true);
this.setBlockPos(stack, BlockPos.ORIGIN);
return EnumActionResult.SUCCESS;
}
} else {
master.addConnection(pos, containedPos);
node.addConnection(containedPos);
player.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.routing.link.master"), true);
this.setBlockPos(stack, BlockPos.ORIGIN);
return EnumActionResult.SUCCESS;
}
} else if (node instanceof IMasterRoutingNode) {
IMasterRoutingNode master = (IMasterRoutingNode) node;
if (!pastNode.isMaster(master)) {
if (// TODO: This is where the issue is
pastNode.getMasterPos().equals(BlockPos.ORIGIN)) {
pastNode.connectMasterToRemainingNode(world, new LinkedList<>(), master);
master.addConnection(pos, containedPos);
pastNode.addConnection(pos);
master.addNodeToList(pastNode);
player.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.routing.link.master"), true);
this.setBlockPos(stack, BlockPos.ORIGIN);
return EnumActionResult.SUCCESS;
}
} else {
master.addConnection(pos, containedPos);
pastNode.addConnection(pos);
player.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.routing.link.master"), true);
this.setBlockPos(stack, BlockPos.ORIGIN);
return EnumActionResult.SUCCESS;
}
} else {
// Both nodes are not master nodes, so normal linking
if (pastNode.getMasterPos().equals(node.getMasterPos())) {
if (!pastNode.getMasterPos().equals(BlockPos.ORIGIN)) {
TileEntity testTile = world.getTileEntity(pastNode.getMasterPos());
if (testTile instanceof IMasterRoutingNode) {
IMasterRoutingNode master = (IMasterRoutingNode) testTile;
master.addConnection(pos, containedPos);
}
}
pastNode.addConnection(pos);
node.addConnection(containedPos);
player.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.routing.link.master"), true);
this.setBlockPos(stack, BlockPos.ORIGIN);
return EnumActionResult.SUCCESS;
} else if (// pastNode is not connected to a master, but node is
pastNode.getMasterPos().equals(BlockPos.ORIGIN)) {
TileEntity tile = world.getTileEntity(node.getMasterPos());
if (tile instanceof IMasterRoutingNode) {
IMasterRoutingNode master = (IMasterRoutingNode) tile;
master.addConnection(pos, containedPos);
master.addNodeToList(pastNode);
pastNode.connectMasterToRemainingNode(world, new LinkedList<>(), master);
}
pastNode.addConnection(pos);
node.addConnection(containedPos);
player.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.routing.link"), true);
this.setBlockPos(stack, BlockPos.ORIGIN);
return EnumActionResult.SUCCESS;
} else if (// node is not connected to a master, but pastNode is
node.getMasterPos().equals(BlockPos.ORIGIN)) {
TileEntity tile = world.getTileEntity(pastNode.getMasterPos());
if (tile instanceof IMasterRoutingNode) {
IMasterRoutingNode master = (IMasterRoutingNode) tile;
master.addConnection(pos, containedPos);
master.addNodeToList(node);
node.connectMasterToRemainingNode(world, new LinkedList<>(), master);
}
pastNode.addConnection(pos);
node.addConnection(containedPos);
player.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.routing.link"), true);
this.setBlockPos(stack, BlockPos.ORIGIN);
return EnumActionResult.SUCCESS;
} else {
this.setBlockPos(stack, BlockPos.ORIGIN);
return EnumActionResult.SUCCESS;
}
}
}
}
return EnumActionResult.FAIL;
}
use of net.minecraft.util.text.TextComponentTranslation in project BloodMagic by WayofTime.
the class ModRecipes method addLivingArmourDowngradeRecipes.
public static void addLivingArmourDowngradeRecipes() {
String messageBase = "ritual.bloodmagic.downgradeRitual.dialogue.";
ItemStack bowStack = new ItemStack(Items.BOW);
ItemStack bottleStack = new ItemStack(Items.POTIONITEM, 1, 0);
ItemStack swordStack = new ItemStack(Items.STONE_SWORD);
ItemStack goldenAppleStack = new ItemStack(Items.GOLDEN_APPLE);
ItemStack fleshStack = new ItemStack(Items.ROTTEN_FLESH);
ItemStack shieldStack = new ItemStack(Items.SHIELD);
ItemStack pickStack = new ItemStack(Items.STONE_PICKAXE);
ItemStack minecartStack = new ItemStack(Items.MINECART);
ItemStack stringStack = new ItemStack(Items.STRING);
Map<ItemStack, Pair<String, int[]>> dialogueMap = new HashMap<>();
dialogueMap.put(bowStack, Pair.of("bow", new int[] { 1, 100, 300, 500 }));
dialogueMap.put(bottleStack, Pair.of("quenched", new int[] { 1, 100, 300, 500 }));
dialogueMap.put(swordStack, Pair.of("dulledBlade", new int[] { 1, 100, 300, 500, 700 }));
dialogueMap.put(goldenAppleStack, Pair.of("slowHeal", new int[] { 1, 100, 300, 500, 700 }));
for (Entry<ItemStack, Pair<String, int[]>> entry : dialogueMap.entrySet()) {
ItemStack keyStack = entry.getKey();
String str = entry.getValue().getKey();
Map<Integer, List<ITextComponent>> textMap = new HashMap<>();
for (int tick : entry.getValue().getValue()) {
List<ITextComponent> textList = new ArrayList<>();
textList.add(new TextComponentTranslation("\u00A74%s", new TextComponentTranslation(messageBase + str + "." + tick)));
textMap.put(tick, textList);
}
LivingArmourDowngradeRecipeRegistry.registerDialog(keyStack, textMap);
}
LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeStormTrooper(0), bowStack, Items.ARROW, "string", "ingotIron", "ingotIron");
LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeStormTrooper(1), bowStack, Items.SPECTRAL_ARROW, "ingotGold", "dustRedstone", "dustGlowstone", "gemLapis");
LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeStormTrooper(2), bowStack, "gemDiamond", Items.FIRE_CHARGE, Items.BLAZE_ROD, "feather");
LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeStormTrooper(3), bowStack, Items.PRISMARINE_SHARD, Items.BLAZE_ROD, "feather", "feather");
LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeStormTrooper(4), bowStack, new ItemStack(Items.TIPPED_ARROW, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.TIPPED_ARROW, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.TIPPED_ARROW, 1, OreDictionary.WILDCARD_VALUE));
// LivingArmourDowngradeRecipeRegistry.registerDialog(bowStack, bowMap);
LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeQuenched(0), bottleStack, Items.DRAGON_BREATH);
LivingArmourDowngradeRecipeRegistry.registerRecipe(new LivingArmourUpgradeCrippledArm(0), shieldStack, "gemDiamond");
for (int i = 0; i < 10; i++) {
addRecipeForTieredDowngrade(new LivingArmourUpgradeMeleeDecrease(i), swordStack, i);
addRecipeForTieredDowngrade(new LivingArmourUpgradeSlowHeal(i), goldenAppleStack, i);
addRecipeForTieredDowngrade(new LivingArmourUpgradeBattleHungry(i), fleshStack, i);
addRecipeForTieredDowngrade(new LivingArmourUpgradeDigSlowdown(i), pickStack, i);
addRecipeForTieredDowngrade(new LivingArmourUpgradeDisoriented(i), minecartStack, i);
addRecipeForTieredDowngrade(new LivingArmourUpgradeSlowness(i), stringStack, i);
}
}
use of net.minecraft.util.text.TextComponentTranslation in project BloodMagic by WayofTime.
the class Ritual method getErrorForBlockRangeOnFail.
public ITextComponent getErrorForBlockRangeOnFail(EntityPlayer player, String range, IMasterRitualStone master, BlockPos offset1, BlockPos offset2) {
AreaDescriptor descriptor = this.getBlockRange(range);
if (descriptor == null) {
return new TextComponentTranslation("ritual.bloodmagic.blockRange.tooBig", "?");
}
List<EnumDemonWillType> willConfig = master.getActiveWillConfig();
DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(master.getWorldObj(), master.getBlockPos());
int maxVolume = this.getMaxVolumeForRange(range, willConfig, holder);
int maxVertical = this.getMaxVerticalRadiusForRange(range, willConfig, holder);
int maxHorizontal = this.getMaxHorizontalRadiusForRange(range, willConfig, holder);
if (maxVolume > 0 && descriptor.getVolumeForOffsets(offset1, offset2) > maxVolume) {
return new TextComponentTranslation("ritual.bloodmagic.blockRange.tooBig", maxVolume);
} else {
return new TextComponentTranslation("ritual.bloodmagic.blockRange.tooFar", maxVertical, maxHorizontal);
}
}
Aggregations