TupidaMC
Members-
Posts
13 -
Joined
-
Last visited
Converted
-
Gender
Undisclosed
-
Personal Text
I am new!
TupidaMC's Achievements
Tree Puncher (2/8)
0
Reputation
-
Fixed it. I used w.setBlock(x, z, z, ...) *stupid*
-
Yes I know the thing about world.isRemote. When I test it, it returns always true. How do I have to go on?
-
Hey Forge-Modders, how can I set a block server side?
-
Change spawning entity in a monster spawner | NBTTagCompound at blocks
TupidaMC replied to TupidaMC's topic in Modder Support
#push -
Change spawning entity in a monster spawner | NBTTagCompound at blocks
TupidaMC replied to TupidaMC's topic in Modder Support
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" ? -
Change spawning entity in a monster spawner | NBTTagCompound at blocks
TupidaMC replied to TupidaMC's topic in Modder Support
@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(); } } } -
Change spawning entity in a monster spawner | NBTTagCompound at blocks
TupidaMC replied to TupidaMC's topic in Modder Support
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()"... -
Change spawning entity in a monster spawner | NBTTagCompound at blocks
TupidaMC replied to TupidaMC's topic in Modder Support
How do I get the TileEntityMobSpawner? -
Yes, but I want to replace the placed block with an other block. So I have to get the location of the block, right?
-
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); } }
-
Ok thanks! Dankeschön
-
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!