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.

robbo

Members
  • Joined

  • Last visited

Everything posted by robbo

  1. Nevermind, figured out a workaround and it works now, using packets Code: import java.util.HashMap; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedOutEvent; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.ContainerWorkbench; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.network.play.server.S2FPacketSetSlot; public class CustomRecipes { public static void register() { GameRegistry.addRecipe(new ItemStack(Blocks.dropper), "AAA", "A A", "ABA", 'A', Blocks.cobblestone, 'B', LOTRItems.rope ); GameRegistry.addRecipe(new ItemStack(Blocks.dispenser), "AAA", "ACA", "ABA", 'A', Blocks.cobblestone, 'B', LOTRItems.rope, 'C', Items.bow ); GameRegistry.addRecipe(new ItemStack(Blocks.piston), "AAA", "BCB", "BDB", 'A', Blocks.planks, 'B', Blocks.cobblestone, 'C', Items.iron_ingot, 'D', LOTRItems.rope ); } private static HashMap<EntityPlayerMP, int[]> synced = new HashMap<EntityPlayerMP, int[]>(); public static void tick(EntityPlayerMP player) { if (player.openContainer instanceof ContainerWorkbench) { final ContainerWorkbench crafting = (ContainerWorkbench) player.openContainer; final ItemStack result = CraftingManager.getInstance().findMatchingRecipe(crafting.craftMatrix, player.worldObj); if (result != null) { if (synced.containsKey(player)) { final int[] info = synced.get(player); if (info[0] == player.currentWindowId && info[1] == Item.getIdFromItem(result.getItem())) { return; } } player.playerNetServerHandler.sendPacket(new S2FPacketSetSlot(crafting.windowId, 0, result)); synced.put(player, new int[] {player.currentWindowId, Item.getIdFromItem(result.getItem())}); } } } @SubscribeEvent public void logOut(PlayerLoggedOutEvent event) { synced.remove(event.player); } }
  2. I am attempting to register a few custom crafting recipes in a server sided mod in 1.7.10 When putting the items in the crafting table, no item appears in the result slot. However when the seemingly empty result slot is clicked, the crafting happens successfully. Is there any way I can fix this solely on the server side? Maybe using packets or something? CustomRecipes class: The register() method is called in the FMLServerStartingEvent The LOTRItems references are non-vanilla items from another mod import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; public class CustomRecipes { public static void register() { GameRegistry.addRecipe(new ItemStack(Blocks.dropper), "AAA", "A A", "ABA", 'A', Blocks.cobblestone, 'B', LOTRItems.rope ); GameRegistry.addRecipe(new ItemStack(Blocks.dispenser), "AAA", "ACA", "ABA", 'A', Blocks.cobblestone, 'B', LOTRItems.rope, 'C', Items.bow ); GameRegistry.addRecipe(new ItemStack(Blocks.piston), "AAA", "BCB", "BDB", 'A', Blocks.planks, 'B', Blocks.cobblestone, 'C', Items.iron_ingot, 'D', LOTRItems.rope ); } }

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.