Jump to content

Slastic

Members
  • Posts

    24
  • Joined

  • Last visited

Everything posted by Slastic

  1. How to modify all swords in the game ex: making it say hi when you right-click (any sword)
  2. Use onBlockActivated() to dectect when the user right-clicks a block For example in the class which you put your block properties What GUI? What is it supposed to be, just a simple gui with buttons? Or a container example your inventory. I'm also new, but I help when I know I can
  3. I will try using the capabilities system
  4. There is a totem block, when you right click it - onBlockActivated() - it will show a gui with a button that says bind totem. If they bind it, it will show another gui, this gui will show a list of all bound totems Lastly when you press totem 1 for example it will tp you to the first one you bounded. Hopefully that made sense Here is what adds buttons to teleport to totems And onBlockActivated I'm aware my code properly has issues keep in mind that I'm new to this so don't expect this to be perfect Thanks you have been great help
  5. How would you use Capabilities for this? I looked through the forum but have no clue where to start
  6. TotemPos.get(playerIn).add(pos.getX(), pos.getY(), pos.getZ()); So I would add to it like this, right? The list HashMap is registered as told public static HashMap<PlayerEntity, BlockPos> TotemPos = new HashMap<>();
  7. Thanks much I will try this out, may need help though One question is how would you put data into the list, for example (onBlockActivated) data like pos. Then how would you be able to select a specific item (using the index value, from it) I have a UI that has 10 buttons, click the first button it will select the first index from the hashmap Hope that made some sense, and that I'm not mistaken
  8. How can I store a list of coordinates (BlockPos) and String name, for each individual player globally. What would be a simple way of doing this? Does this require The Capability System, if so -- how would you use it for this? https://mcforge.readthedocs.io/en/latest/datastorage/capabilities/ I'm newbie, Help is appreciated
  9. public TotemSelectorScreen(ITextComponent titleIn) { super(titleIn); } private static final ResourceLocation TOTEM_GUI_TEXTURE = new ResourceLocation(Main.MOD_ID, "textures/gui/totem_selector.png"); int xSize = 176; int ySize = 125; @Override public void init() { super.init(); this.buttons.clear(); this.addButton(new Button (this.width / 2 - 100, this.height - (this.height / 4) + 10, 200, 20, "totembutton", (button) -> { System.out.println("button testing"); })); } @Override public void render(int mouseX, int mouseY, float partialTicks) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); this.renderBackground(); this.minecraft.getTextureManager().bindTexture(TOTEM_GUI_TEXTURE); int x = (this.width - this.xSize) / 2; int y = (this.height - this.ySize) / 2; this.blit(x, y, 0, 0, this.xSize, this.ySize); } @Override public boolean isPauseScreen() { return false; } Why does GUI button not display? I'm sorry I started recently and I am not so good at this stuff, still learning
  10. That's not where i got the idea from, now I understand.
  11. DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> { Minecraft.getInstance().gameRenderer.displayItemActivation(new ItemStack(RegistryHandler.MAGIC_MIRROR.get())); }); Did I do this correctly?
  12. Ok, sorry about that I will learn to use them if you have an example or a forum you can give it would be a great help. Like, https://mcforge.readthedocs.io/en/1.15.x/networking/; Draco18s gave me https://mcforge.readthedocs.io/en/latest/concepts/sides/ also looking through this
  13. ok it works with if(worldIn.isRemote) { } if there is something wrong with this tell me
  14. !worldIn.isRemote it didn't work with it
  15. You fixed it if(!worldIn.isRemote) { - my mistake i didn't know that Thanks!
  16. Minecraft.getInstance().gameRenderer.displayItemActivation(new ItemStack(RegistryHandler.MAGIC_MIRROR.get())); I need to make this work with server So how to send server-to-client packets? Couldn't figure this out Thanks
  17. Multiplayer: Send player action bar message. Additionally, is it possible to do the Totem Of Undying animation in multiplayer with a custom item. Thanks Still learning --new ?
  18. BlockPos spawn = worldIn.getSpawnPoint(); @Nullable BlockPos bed = playerIn.getBedLocation(DimensionType.OVERWORLD); if(bed != null && worldIn.getBlockState(bed).getBlock().toString().contains("bed")) { playerIn.setPositionAndUpdate(bed.getX(), bed.getY(), bed.getZ()); } else { playerIn.setPositionAndUpdate(spawn.getX(), spawn.getY(), spawn.getZ()); } Make sure when getting your bed it's nullable or you can get an error This may not be the best solution but it works
  19. Does anyone know a reliable way to get players spawn point (coordinates)? I have tried to do this myself but ran into issues. Does anyone have suggestions? I tried to get the coordinates of where they would respawn if they died. I am new to Java, I tried my best to do this myself
×
×
  • Create New...

Important Information

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