Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Draconwolver

Members
  • Joined

  • Last visited

Everything posted by Draconwolver

  1. Quite simply, I am trying to create a client-side only mod that will allow the user to hide certain entities from their view by preventing them from being rendered. Is there one specific event within Forge that would allow me to cancel the rendering of any entity? RenderPlayerEvent::Pre appears to be able to be used to prevent the rendering of players, but I am unsure of how to use RenderLivingEvent, and I see no event relating to the rendering of nonliving entities such as items. RenderTickEvent seems to not have any way of getting the entities that will be/were rendered in that tick. Any help is much appreciated. Thank you!
  2. Would there be another way, such as just tossing out incoming packets that update the chunk?
  3. It's just for recreational purposes, I want a way to artificially lag myself.
  4. This works to an extent, but I don't think it is what I was looking for. The chunk unloads, but my client is still able to stand on the unloaded blocks and select them: Is there a way to mimic the effect of "lagging out" on servers where chunks are unloaded and all the blocks in them?
  5. This may be an odd request, but how would I make a clientside mod that keeps chunks unloaded (prevents them from loading)? Since ChunkEvent.Load cannot be cancelled, I tried using Chunk#setChunkLoaded(false) from within, but that doesn't do anything.
  6. Thank you for your continued support! From your example I realized that perhaps I was using the wrong event. I was trying to change the player's rotation while in a KeyInputEvent, so I used some workarounds and got it working in a ClientTickEvent. Although it's strange that the player's direction can't be set in a KeyInputEvent... My original question has been answered, but on a side note, is there any benefit to checking that event.phase == TickEvent.Phase.END in the ClientTickEvent?
  7. Thanks, but after just trying the Entity#setAngles way, I have the same issue: My screen only shows me changing pitch/yaw when I move or press a key on my keyboard. If I am stationary in-game and have a pitch/yaw updater every tick, nothing happens. I think your block method works because the player has to move to touch the block. UPDATE: I am currently working around this by using a robot to hold down a generally unused key like KeyEvent.VK_BACK_SLASH. Of course, this would make the mod incompatible with users or mods who have the backslash key in their controls.
  8. Is there a way to prevent the player from being kicked on a multiplayer server for being AFK? For clarity and organizational purposes, let's assume that AFK is defined as "pitch and yaw not changing for two minutes." I have tried using a loop called every tick to change player.rotationPitch and player.rotationYaw, but these don't force my screen to look in that direction like they should. They only change the pitch and yaw when I press a key on my keyboard. So again, is there a way to let the server know that my pitch and yaw are changing? Would this require packets? Thanks!
  9. Hello, I am trying to use keybinds to make the player walk, something that I thought would be quite simple. I have tried the following: [spoiler=MovementTask] public class MovementTask extends TimerTask { private final GameSettings gameSettings; private final long period; private final long walkingTime; public MovementTask(Minecraft minecraft, long period, long walkingTime) { this.gameSettings = minecraft.gameSettings; this.period = period; this.walkingTime = walkingTime; } @Override public void run() { int forward = gameSettings.keyBindForward.getKeyCode(); int right = gameSettings.keyBindRight.getKeyCode(); int back = gameSettings.keyBindBack.getKeyCode(); int left = gameSettings.keyBindLeft.getKeyCode(); int[] keyCodes = {forward, right, back, left}; for (int keyCode : keyCodes) { long oldTime = System.currentTimeMillis(); while (System.currentTimeMillis() - oldTime < walkingTime) { KeyBinding.setKeyBindState(keyCode, true); } KeyBinding.setKeyBindState(keyCode, false); } try { Thread.sleep(period); } catch (InterruptedException e) { e.printStackTrace(); } } } However, when I initiate this code properly with a Timer, the player's movement is not affected at all. I have tried other key bindings such as "key.use" and that seems to work fine. Any help is much appreciated, Draconwolver
  10. I'm not on my modding computer at the moment, so my apologies, but are you suggesting that CommandEvent works on multiplayer servers and can be cancelled to prevent sending the command?
  11. Are you saying that the world name, like the seed, is not available to clients by default?
  12. I would like to know if it is possible to obtain the current world's name in multiplayer (probably something to do with packets). I know that in singleplayer the server code handles world data and information about the world, but how would I receive/interpret data from a multiplayer server to get the world name? Thank you!
  13. I am trying to develop a mod that takes input from a user through chat, therefore cancelling the chat message and doing whatever with what they said. I have tried using the ServerChatEvent, but cancelling it only works in singleplayer. Any help is much appreciated!
  14. I'm sorry, I don't really understand what you're trying to say. Doesn't running code from server-side only work in singleplayer worlds when the server is also local? I thought that when using a mod on a multiplayer server hosted elsewhere server code doesn't work.
  15. Hello, I am currently working on a simple mod which gathers data about mobs in the world and says it in chat to the player. The way I am going about this is by using Minecraft.getMinecraft().theWorld.getLoadedEntityList() and then calling Entity#getCustomNameTag() to get the entity's name. This works perfectly on singleplayer and multiplayer, except when the server uses packets to fake mobs. Is there any way to detect packet-mobs and then gather data on them?
  16. I was wondering how to hide a mob from the player (client-side). I don't mean giving it an invisibility effect, but I mean preventing the player from rendering it in the first place. I have some code below which is supposed to hide pigs when the player presses M, but doesn't do anything at all: [spoiler=Hidden]Main Class: package draconwolver.main; import net.minecraft.client.settings.KeyBinding; import org.lwjgl.input.Keyboard; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLPreInitializationEvent; @Mod(modid = Mod.ID, name = Mod.NAME, version = Mod.VERSION) public class Mod { public static final String ID = "mod"; public static final String NAME = "Mod"; public static final String VERSION = "1.7.10-1.0"; public static KeyBinding key; @EventHandler public static void PreLoad(FMLPreInitializationEvent PreEvent) { key = new KeyBinding("Mod", Keyboard.KEY_M, "key.categories.misc"); ClientRegistry.registerKeyBinding(key); FMLCommonHandler.instance().bus().register(new KeyInputHandler()); } } Event Class: package draconwolver.main; import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraftforge.client.event.RenderLivingEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class KeyInputHandler { private static KeyBinding key = Mod.key; private static boolean bool = false; @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent event) { if(key.isPressed()) bool = !bool; } @SubscribeEvent public void onRenderLiving(RenderLivingEvent.Pre event) { if(bool && event.entity instanceof EntityPig) { event.setCanceled(true); Minecraft.getMinecraft().thePlayer.sendChatMessage("It works!"); } } } All help is appreciated, thank you!

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.