improved text
This commit is contained in:
@@ -5,9 +5,13 @@ import com.mojang.brigadier.Command
|
||||
import com.mojang.brigadier.CommandDispatcher
|
||||
import com.mojang.brigadier.arguments.StringArgumentType
|
||||
import net.minecraft.command.argument.ItemStackArgumentType
|
||||
import net.minecraft.item.Items
|
||||
import net.minecraft.server.command.CommandManager
|
||||
import net.minecraft.server.command.ServerCommandSource
|
||||
import net.minecraft.text.Style
|
||||
import net.minecraft.text.Text
|
||||
import net.minecraft.text.TextColor
|
||||
import java.awt.Color
|
||||
|
||||
object GiveParticleEmitter {
|
||||
fun register(dispatcher: CommandDispatcher<ServerCommandSource>) {
|
||||
@@ -15,12 +19,19 @@ object GiveParticleEmitter {
|
||||
CommandManager.literal("giveParticleEmitter")
|
||||
.requires { source -> source.hasPermissionLevel(2) }
|
||||
.then(CommandManager.argument("item name", StringArgumentType.string()))
|
||||
.then(CommandManager.argument("item type", ItemStackArgumentType.itemStack()))) // error here
|
||||
.then(CommandManager.argument("item type", /*ItemStackArgumentType.itemStack()*/ StringArgumentType.string()))
|
||||
.then(CommandManager.argument("particle id", StringArgumentType.string()))
|
||||
|
||||
.executes { context ->
|
||||
context.source.player?.inventory?.insertStack(ParticleEmitter().makeData()) // error here
|
||||
context.source.sendFeedback({ Text.literal("Gave you 500Kg bomb. Don\'t get too silly with it :3") }, false)
|
||||
val name = StringArgumentType.getString(context, "item name")
|
||||
val item = Items.AMETHYST_SHARD // ItemStackArgumentType.getItemStackArgument(context, "item type")
|
||||
val particleId = StringArgumentType.getString(context, "particle id")
|
||||
|
||||
val feedback = Text.literal("BPS - You like fancy particles. Don't you?\nBPS - [gave particle emitter, bound to id: \"${context}\"]")
|
||||
.setStyle(Style.EMPTY.withColor(TextColor.fromRgb(Color(0, 125, 0).rgb)).withItalic(true))
|
||||
|
||||
context.source.player?.inventory?.insertStack(ParticleEmitter().makeData(item, name, particleId))
|
||||
context.source.sendFeedback({ feedback }, false)
|
||||
Command.SINGLE_SUCCESS
|
||||
}
|
||||
)
|
||||
|
||||
@@ -27,12 +27,10 @@ class ParticleEmitter {
|
||||
val displayName = Text.literal(name)
|
||||
.setStyle(Style.EMPTY.withColor(TextColor.fromRgb(Color(0, 125, 0).rgb)).withItalic(true))
|
||||
|
||||
val loreLines = listOf(
|
||||
Text.literal("BPS").setStyle(Style.EMPTY.withColor(TextColor.fromRgb(Color(0, 125, 0).rgb)).withItalic(true)),
|
||||
Text.literal("Bound to id \"$particleId\"").setStyle(Style.EMPTY.withColor(TextColor.fromRgb(Color(0, 125, 0).rgb)).withItalic(true))
|
||||
)
|
||||
val loreLines = Text.literal("BPS - Bound to id \"$particleId\"")
|
||||
.setStyle(Style.EMPTY.withColor(TextColor.fromRgb(Color(0, 125, 0).rgb)).withItalic(true))
|
||||
|
||||
val lore = LoreComponent(loreLines)
|
||||
val lore = LoreComponent(listOf(loreLines))
|
||||
|
||||
i.set(DataComponentTypes.ITEM_NAME, displayName)
|
||||
i.set(DataComponentTypes.CUSTOM_DATA, component)
|
||||
@@ -44,6 +42,6 @@ class ParticleEmitter {
|
||||
fun onRightCLick(player: ServerPlayerEntity) {
|
||||
val hitResult = raycastFromPlayer(player, 4.5) ?: return
|
||||
|
||||
// spawn particle at hitresult
|
||||
// spawn particle at hitResult
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user