Jump to content

TupidaMC

Members
  • Posts

    13
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

TupidaMC's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  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. 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!
×
×
  • Create New...

Important Information

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