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.

TupidaMC

Members
  • Joined

  • Last visited

Everything posted by TupidaMC

  1. Fixed it. I used w.setBlock(x, z, z, ...) *stupid*
  2. Yes I know the thing about world.isRemote. When I test it, it returns always true. How do I have to go on?
  3. Hey Forge-Modders, how can I set a block server side?
  4. I don't now what you mean I removed the updateSpawner and changed the comparation stuff. But how can I fix the world.setBlock() ? This has not to do with the MobSpawner. I tested the world.setBlock() with an other block and it dissapears at all when I click on it What do you mean with "Also make sure to only do this on the server" ?
  5. @SubscribeEvent public void onPlayerInteract(PlayerInteractEvent e){ if(e.action == Action.RIGHT_CLICK_BLOCK){ EntityPlayer p = e.entityPlayer; ItemStack items = p.inventory.getCurrentItem(); if(items == null) return; Item item = items.getItem(); String name = item.getUnlocalizedName(); if(name.equals(Blocks.mob_spawner.getUnlocalizedName())){ World w = e.world; int x = e.x; int y = e.y; int z = e.z; Block b = e.world.getBlock(x, y, z); if(!b.getUnlocalizedName().equalsIgnoreCase(Blocks.tallgrass.getUnlocalizedName())){ switch(e.face){ case 0: y--; break; case 1: y++; break; case 2: z--; break; case 3: z++; break; case 4: x--; break; case 5: x++; break; } } w.setBlock(x, y, z, Blocks.mob_spawner); TileEntityMobSpawner spawner = (TileEntityMobSpawner) w.getTileEntity(x, y, z); MobSpawnerBaseLogic logic = spawner.func_145881_a(); logic.setEntityName("Witch"); logic.updateSpawner(); } } }
  6. w.setBlock(x, y, z, Blocks.mob_spawner); TileEntityMobSpawner spawner = (TileEntityMobSpawner) w.getTileEntity(x, y, z); MobSpawnerBaseLogic logic = spawner.func_145881_a(); logic.setEntityName("Witch"); logic.updateSpawner(); This (used in the PlayerInteractEvent) works, but when I right click on the spawner, it dissapers. Looks like, Minecraft doesn't accept the "setBlock()"...
  7. Can I use NBTTagCompound at blocks? I wan't to change the spawning entity in a monster spawner. How can I do that?
  8. Yes, but I want to replace the placed block with an other block. So I have to get the location of the block, right?
  9. But how can I get the block that is placed? @EventHandler public void onPlayerInteract(PlayerInteractEvent e){ if(e.action == Action.RIGHT_CLICK_BLOCK){ if(e.isCancelable()) e.setCanceled(true); } }
  10. Ok thanks! Dankeschön
  11. Hey guys, how can I excecute some code when a player places a block? Is there a block place event? I haven't found anything likethis. Would be nice if you could help me!

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.