Jump to content

Wen Li

Members
  • Posts

    18
  • Joined

  • Last visited

Everything posted by Wen Li

  1. As title, I only find PlayerLoggedInEvent when I tried this. But, this is called after player has logged-in. Is there any way to prevent player from kicking by the same name player logged-in?
  2. In ItemTooltipEvent, it seemed that I can only add the instance of Component to the List<Component>. So how to render image in tooltip?
  3. I have a block and its blockentity. When player click the block, blockentity will provide menu to player. But I want to make only one player can open GUI at the same time. How to do it?
  4. I didn't use renderer for my custom arrow. Should I code renderer class to it and then override shouldRender method?
  5. I tried to use setInvisible method to make it invisible, but it didn't affect. How should I do to make it invisible?
  6. Thanks. But could you tell me which channel in forge discord should I use to chat with robot? I'm lost in finding where the robot in. And how to interact with the robot.
  7. Sorry for late. Just search it in your IDEA.
  8. For spawning an entity, you can search SummonCommand and see how minecraft do that.
  9. As the title, I'm using AccessTransformer but can't find the runtime fields and methods name. How to get that?
  10. Solved! I found that when the items in your hand, the items would be sent a mod's nbt tag automatically. That caused one slot item had tag, and another slot not. So, the solution is: Before sending items to player, use itemstack.getOrCreateTagElement method to add tag to items firstly. And then all the items have same tags, they can be merged into one slot!
  11. Additionally, I use player.addItem(Moditem.TestItem.get().getDefaultInstance()) to send items.
  12. When player killed mob, my mod will send some item into inventory of player directly. But I find that sometimes the same type items can't merge into one slot. But after put them in mainhand, these items can be merge into one slot. The item be sent is mod custom item, and they have some HoverText added by mod. How to solve it?
  13. Solve! Thanks for helping again!๐Ÿ˜€ It's phase problem.
  14. Share. This is a possible way. PlayerList list = player.getServer().getPlayerList(); List<ServerPlayer> list1 = list.getPlayers(); ListIterator<ServerPlayer> iterator = list1.listIterator(); while(true) { if(iterator.hasNext()) { Player TmpPlayer = iterator.next(); TmpPlayer.sendSystemMessage(Component.literal(" ")); } else break; }
  15. The event will send message to player every five seconds, but it seemed that it will send message twice, how to solve it? public static void TickEvent(TickEvent.PlayerTickEvent event) { Player player = event.player; CompoundTag data = player.getPersistentData(); int TmpNum = player.tickCount; if(data.contains("Green") && (data.getInt("Green") == 0) && (!player.getLevel().isClientSide()) && (TmpNum % 100 == 0) && player instanceof ServerPlayer) { player.sendSystemMessage(Component.literal("test!")); } }
  16. As the title, I'm trying to send message to all players (Not a specific player) after something triggered. I just want to know the methods.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.