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.

Codemetry

Members
  • Joined

  • Last visited

  1. How do I check if the chest contents are loaded?
  2. Read the contents of a chest upon opening, and detect its changes. I wanted the packet name to check the source code and see if there is any way I can detect.
  3. Do you know the packet type name? Which event should I handle and access the chest contents inside the event handler?
  4. Firstly, EntityPlayer#openContainer is assigned the container of the opened chest AFTER the initialization (GuiScreen#initGui) of the opened GuiChest (the container is stored in GuiContainer). So, I changed to try to access the chest contents in InitGuiEvent.Post event handler. Secondly, I found that the container stored in GuiContainer is a ContainerChest containing the player inventory AND the chest inventory. Therefore, it is not accurate to access the container and directly get the item stacks via it. Then, I found that ContainerChest#getLowerChestInventory returns the chest inventory (somehow it is called lower inventory). Finally, I checked the runtime type of the inventory returned by ContainerChest#getLowerChestInventory. It turns out to be ContainerLocalMenu. The only place which constructs new ContainerLocalMenus is NetHandlerPlayClient#handleOpenWindow. However, the method accepts a packet that does not store the chest inventory contents. Where did I go wrong? How do I access the chest contents?
  5. It doesn't work. It seems to always access the player inventory.
  6. How do I read the items in an opened chest (chest gui opened), on client side?
  7. How do I intercept chat message before sent from client to server? Is there an event for it?
  8. When inventory opened, KeyInputEvent and MouseEvent do not get fired. How do I detect key inputs and mouse inputs when inventory is opened?
  9. I am working on a client side mod. Sorry I was in a rush and copied from my old java file.
  10. Bump. I have updated to 1.14.4 - 28.1.0. I did some testing and found that: EntityJoinWorldEvent is fired once when joining a server (and a world) from the multiplayer menu EntityJoinWorldEvent is fired multiple times (usually 6 - 10) when switching between worlds on a server or servers on a bungee network The Worlds returned by EntityJoinWorldEvents are not the same instance The EntityJoinWorldEvents are not the same instance (that means I did not register more than once) I have already added the following check into EntityJoinWorldEvent handler mc.thePlayer == event.entity Here is my handler in case: @SubscribeEvent public void onEntityJoinWorld(EntityJoinWorldEvent event) { if (mc.thePlayer == event.entity) { mc.thePlayer.addChatMessage( new ChatComponentText("hello")); } } Does anyone know why this is happening?
  11. When setting up the project, I executed "gradlew genEclipseRuns" and "gradlew eclipse", but there aren't any run configurations (Client / Server).
  12. package com.example.examplemod; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ServerData; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @Mod(modid = ExampleMod.MODID, version = ExampleMod.VERSION) public class ExampleMod { public static final String MODID = "examplemod"; public static final String VERSION = "1.0"; Minecraft mc; @EventHandler public void preInit(FMLPreInitializationEvent event) { mc = Minecraft.getMinecraft(); MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onEntityJoinWorld(EntityJoinWorldEvent event) { if (!event.world.isRemote) { mc.thePlayer.sendChatMessage("hello"); } } }
  13. via the player to the server Minecraft mc; @EventHandler public void preInit(FMLPreInitializationEvent event) { mc = Minecraft.getMinecraft(); MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onEntityJoinWorld(EntityJoinWorldEvent event) { if (!event.world.isRemote) { mc.thePlayer.sendChatMessage("hello"); } }

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.