Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Get block the player is looking at


matthew123
 Share

Recommended Posts

You could calculate it from the player's eyePos and his looking angle. I'm pretty sure you can get both on the server. But if you need to do this like every tick it could be resource intensive and lag the game

Sorry if my Posts are weird sometimes, I just try to help and learn as much as I can :D

Also: PLEASE use SPOILERS for logs!

Link to comment
Share on other sites

1 hour ago, OutCraft said:

You could calculate it from the player's eyePos and his looking angle. I'm pretty sure you can get both on the server. But if you need to do this like every tick it could be resource intensive and lag the game

How so? A couple of trigonometric functions can't possibly affect performance.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Hello I'm running minecraft server 1.18.1 with forge 39.0.36 in ubuntu and tried to remove a mod, even thou the server starts it throws a bunch of  "Found a missing id from the world", I did the -Dfml.queryResult=confirm but it shows also tried to run the command directly like fml confirm and it throws ¿Which is the correct solution to get rid of all the "Found a missing id from the world" in 39.0.36?
    • Game crashes as soon as i load a chunk with my MineColonies City. https://pastebin.com/VNKgTV4T With forge-39.0.7 works well. Tested on 39.0.20 with the same behaviour (crash).
    • also there is a program called bearded octo nemesis that deobfuscate any .class files(is made for minecraft) but it doesnt work
    • I was intending to port it to 1.16.5 anyways, so yes. I am just porting my base to 1.16.5. All i am here for is to collect a few approaches on how you could achieve this.
    • oh i know that the mod didnt obfuscated the methods, maybe minecraft did, an example is: world.func_numbers or player.func_numbers, this is from a mod called deathnote mod public class DeathNoteGUIGui extends DeathnoteModElements.ModElement { public static HashMap guistate = new HashMap<>(); private static ContainerType<GuiContainerMod> containerType = null; public DeathNoteGUIGui(DeathnoteModElements instance) { super(instance, 5); this.elements.addNetworkMessage(ButtonPressedMessage.class, ButtonPressedMessage::buffer, net.neio.deathnote.gui.DeathNoteGUIGui.ButtonPressedMessage::new, ButtonPressedMessage::handler); this.elements.addNetworkMessage(GUISlotChangedMessage.class, GUISlotChangedMessage::buffer, net.neio.deathnote.gui.DeathNoteGUIGui.GUISlotChangedMessage::new, GUISlotChangedMessage::handler); containerType = new ContainerType((ContainerType.IFactory)new GuiContainerModFactory()); FMLJavaModLoadingContext.get().getModEventBus().register(this); } @OnlyIn(Dist.CLIENT) public void initElements() { DeferredWorkQueue.runLater(() -> ScreenManager.func_216911_a(containerType, net.neio.deathnote.gui.DeathNoteGUIGui.GuiWindow::new)); } @SubscribeEvent public void registerContainer(RegistryEvent.Register<ContainerType<?>> event) { event.getRegistry().register(containerType.setRegistryName("death_note_gui")); } private static void handleButtonAction(PlayerEntity entity, int buttonID, int x, int y, int z) { World world = entity.field_70170_p; if (!world.func_175667_e(new BlockPos(x, y, z))) return; if (buttonID == 0) { Map<String, Object> $_dependencies = new HashMap<>(); $_dependencies.put("entity", entity); $_dependencies.put("guistate", guistate); $_dependencies.put("x", Integer.valueOf(x)); $_dependencies.put("y", Integer.valueOf(y)); $_dependencies.put("z", Integer.valueOf(z)); $_dependencies.put("world", world); WriteProcedureProcedure.executeProcedure($_dependencies); } } private static void handleSlotAction(PlayerEntity entity, int slotID, int changeType, int meta, int x, int y, int z) { World world = entity.field_70170_p; if (!world.func_175667_e(new BlockPos(x, y, z))) return; } } as you can see func_numbers is seen after "something."
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.