Search in sources :

Example 6 with TranslationTextComponent

use of net.minecraft.util.text.TranslationTextComponent in project Geolosys by oitsjustjose.

the class PacketStackSurface method sendProspectingMessage.

@OnlyIn(Dist.CLIENT)
private static void sendProspectingMessage(PlayerEntity player, Object... messageDecorators) {
    TranslationTextComponent msg = new TranslationTextComponent("geolosys.pro_pick.tooltip.found_surface", messageDecorators);
    player.sendStatusMessage(msg, true);
}
Also used : TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 7 with TranslationTextComponent

use of net.minecraft.util.text.TranslationTextComponent in project Geolosys by oitsjustjose.

the class PacketStackUnderground method sendProspectingMessage.

@OnlyIn(Dist.CLIENT)
private static void sendProspectingMessage(PlayerEntity player, Object... messageDecorators) {
    TranslationTextComponent msg = new TranslationTextComponent("geolosys.pro_pick.tooltip.found", messageDecorators);
    player.sendStatusMessage(msg, true);
}
Also used : TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 8 with TranslationTextComponent

use of net.minecraft.util.text.TranslationTextComponent in project Bookshelf by Darkhax-Minecraft.

the class CommandHand method hand.

private int hand(CommandContext<CommandSource> context) throws CommandSyntaxException {
    final OutputType type = context.getArgument("type", OutputType.class);
    final ServerPlayerEntity player = context.getSource().getPlayerOrException();
    final String outputText = type.converter.apply(player.getMainHandItem());
    final ITextComponent component = TextComponentUtils.wrapInSquareBrackets(new StringTextComponent(outputText).withStyle((style) -> {
        return style.withColor(TextFormatting.GREEN).withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, outputText)).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TranslationTextComponent("chat.copy.click"))).withInsertion(outputText);
    }));
    context.getSource().sendSuccess(component, false);
    return 0;
}
Also used : JsonObject(com.google.gson.JsonObject) VanillaIngredientSerializer(net.minecraftforge.common.crafting.VanillaIngredientSerializer) Serializers(net.darkhax.bookshelf.serialization.Serializers) ClickEvent(net.minecraft.util.text.event.ClickEvent) Function(java.util.function.Function) ITextComponent(net.minecraft.util.text.ITextComponent) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) LazyOptional(net.minecraftforge.common.util.LazyOptional) ItemStack(net.minecraft.item.ItemStack) StringTextComponent(net.minecraft.util.text.StringTextComponent) CapabilityFluidHandler(net.minecraftforge.fluids.capability.CapabilityFluidHandler) CommandContext(com.mojang.brigadier.context.CommandContext) TextFormatting(net.minecraft.util.text.TextFormatting) NBTIngredient(net.minecraftforge.common.crafting.NBTIngredient) LiteralArgumentBuilder(com.mojang.brigadier.builder.LiteralArgumentBuilder) CommandSource(net.minecraft.command.CommandSource) TextComponentUtils(net.minecraft.util.text.TextComponentUtils) HoverEvent(net.minecraft.util.text.event.HoverEvent) StringJoiner(java.util.StringJoiner) ResourceLocation(net.minecraft.util.ResourceLocation) IFluidHandlerItem(net.minecraftforge.fluids.capability.IFluidHandlerItem) FluidStack(net.minecraftforge.fluids.FluidStack) CommandSyntaxException(com.mojang.brigadier.exceptions.CommandSyntaxException) Commands(net.minecraft.command.Commands) CraftingHelper(net.minecraftforge.common.crafting.CraftingHelper) ServerPlayerEntity(net.minecraft.entity.player.ServerPlayerEntity) HoverEvent(net.minecraft.util.text.event.HoverEvent) ClickEvent(net.minecraft.util.text.event.ClickEvent) ITextComponent(net.minecraft.util.text.ITextComponent) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) ServerPlayerEntity(net.minecraft.entity.player.ServerPlayerEntity) StringTextComponent(net.minecraft.util.text.StringTextComponent)

Example 9 with TranslationTextComponent

use of net.minecraft.util.text.TranslationTextComponent in project Bookshelf by Darkhax-Minecraft.

the class CommandTranslate method translate.

private int translate(CommandContext<CommandSource> context) throws CommandSyntaxException {
    final String translationKey = StringArgumentType.getString(context, "key");
    context.getSource().sendSuccess(new TranslationTextComponent(translationKey), false);
    return 0;
}
Also used : TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent)

Example 10 with TranslationTextComponent

use of net.minecraft.util.text.TranslationTextComponent in project BluePower by Qmunity.

the class JEIPlugin method getMicroblockRecipes.

private static List<IRecipe<?>> getMicroblockRecipes() {
    List<IRecipe<?>> recipes = new ArrayList<>();
    for (Block block : ForgeRegistries.BLOCKS.getValues().stream().filter(b -> !b.hasTileEntity(b.defaultBlockState())).collect(Collectors.toList())) {
        VoxelShape shape = null;
        try {
            shape = block.defaultBlockState().getShape(null, null);
        } catch (NullPointerException ignored) {
        // Shulker Boxes try to query the Tile Entity
        }
        if (block.getRegistryName() != null && shape == VoxelShapes.block()) {
            ItemStack output = ItemStack.EMPTY;
            for (Block mb : BPBlocks.microblocks) {
                NonNullList<Ingredient> input = NonNullList.create();
                input.add(Ingredient.of(ItemTags.createOptional(new ResourceLocation("bluepower:saw"))));
                if (mb == BPBlocks.half_block) {
                    input.add(Ingredient.of(new ItemStack(block)));
                } else {
                    input.add(Ingredient.of(output));
                }
                CompoundNBT nbt = new CompoundNBT();
                nbt.putString("block", block.getRegistryName().toString());
                ItemStack stack = new ItemStack(mb);
                stack.setTag(nbt);
                stack.setHoverName(new TranslationTextComponent(block.getDescriptionId()).append(new StringTextComponent(" ")).append(new TranslationTextComponent(mb.getDescriptionId())));
                output = stack;
                recipes.add(new ShapelessRecipe(new ResourceLocation("bluepower:" + mb.getDescriptionId() + block.getDescriptionId()), "", output, input));
            }
        }
    }
    return recipes;
}
Also used : Refs(com.bluepowermod.reference.Refs) java.util(java.util) ContainerBlulectricAlloyFurnace(com.bluepowermod.container.ContainerBlulectricAlloyFurnace) GuiBlulectricAlloyFurnace(com.bluepowermod.client.gui.GuiBlulectricAlloyFurnace) Item(net.minecraft.item.Item) BPBlocks(com.bluepowermod.init.BPBlocks) CompoundNBT(net.minecraft.nbt.CompoundNBT) AlloyFurnaceRegistry(com.bluepowermod.recipe.AlloyFurnaceRegistry) net.minecraft.item.crafting(net.minecraft.item.crafting) IGuiHelper(mezz.jei.api.helpers.IGuiHelper) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) ContainerBlulectricFurnace(com.bluepowermod.container.ContainerBlulectricFurnace) ItemStack(net.minecraft.item.ItemStack) IAlloyFurnaceRecipe(com.bluepowermod.api.recipe.IAlloyFurnaceRecipe) Block(net.minecraft.block.Block) Minecraft(net.minecraft.client.Minecraft) IRecipeCategory(mezz.jei.api.recipe.category.IRecipeCategory) mezz.jei.api(mezz.jei.api) VoxelShape(net.minecraft.util.math.shapes.VoxelShape) StringTextComponent(net.minecraft.util.text.StringTextComponent) NonNullList(net.minecraft.util.NonNullList) VanillaRecipeCategoryUid(mezz.jei.api.constants.VanillaRecipeCategoryUid) ContainerAlloyFurnace(com.bluepowermod.container.ContainerAlloyFurnace) ItemTags(net.minecraft.tags.ItemTags) ContainerProjectTable(com.bluepowermod.container.ContainerProjectTable) ItemStackUtils(com.bluepowermod.util.ItemStackUtils) mezz.jei.api.registration(mezz.jei.api.registration) Collectors(java.util.stream.Collectors) IJeiHelpers(mezz.jei.api.helpers.IJeiHelpers) GuiBlulectricFurnace(com.bluepowermod.client.gui.GuiBlulectricFurnace) ResourceLocation(net.minecraft.util.ResourceLocation) VoxelShapes(net.minecraft.util.math.shapes.VoxelShapes) BluePower(com.bluepowermod.BluePower) ForgeRegistries(net.minecraftforge.registries.ForgeRegistries) GuiAlloyFurnace(com.bluepowermod.client.gui.GuiAlloyFurnace) CompoundNBT(net.minecraft.nbt.CompoundNBT) VoxelShape(net.minecraft.util.math.shapes.VoxelShape) ResourceLocation(net.minecraft.util.ResourceLocation) Block(net.minecraft.block.Block) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) StringTextComponent(net.minecraft.util.text.StringTextComponent) ItemStack(net.minecraft.item.ItemStack)

Aggregations

TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)13 ItemStack (net.minecraft.item.ItemStack)6 CompoundNBT (net.minecraft.nbt.CompoundNBT)6 BlockPos (net.minecraft.util.math.BlockPos)4 StringTextComponent (net.minecraft.util.text.StringTextComponent)4 ResourceLocation (net.minecraft.util.ResourceLocation)3 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)3 TileBPMicroblock (com.bluepowermod.tile.TileBPMicroblock)2 TileBPMultipart (com.bluepowermod.tile.TileBPMultipart)2 BlockState (net.minecraft.block.BlockState)2 ServerPlayerEntity (net.minecraft.entity.player.ServerPlayerEntity)2 DimensionType (net.minecraft.world.dimension.DimensionType)2 BluePower (com.bluepowermod.BluePower)1 IAlloyFurnaceRecipe (com.bluepowermod.api.recipe.IAlloyFurnaceRecipe)1 GuiAlloyFurnace (com.bluepowermod.client.gui.GuiAlloyFurnace)1 GuiBlulectricAlloyFurnace (com.bluepowermod.client.gui.GuiBlulectricAlloyFurnace)1 GuiBlulectricFurnace (com.bluepowermod.client.gui.GuiBlulectricFurnace)1 ContainerAlloyFurnace (com.bluepowermod.container.ContainerAlloyFurnace)1 ContainerBlulectricAlloyFurnace (com.bluepowermod.container.ContainerBlulectricAlloyFurnace)1 ContainerBlulectricFurnace (com.bluepowermod.container.ContainerBlulectricFurnace)1