robodude Posted July 30, 2013 Posted July 30, 2013 When I create an explosion it sometimes leaves behind invisible blocks, when I reload the world the invisible blocks reappear. Code: event.entityPlayer.worldObj.createExplosion(event.entityLiving.worldObj.getClosestPlayerToEntity(event.entityLiving, 50), pos.blockX, pos.blockY, pos.blockZ, 3.0F, true); Extra Info: This code is within a PlayerInteractEvent method Quote
hydroflame Posted July 30, 2013 Posted July 30, 2013 are you calling this from server side ? Quote how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
robodude Posted July 30, 2013 Author Posted July 30, 2013 I have no clue here is the entire class. package com.fredtech.tutorial.wuppy; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; public class SmiteEventHandle { public SmiteEventHandle() { // TODO Auto-generated constructor stub } @ForgeSubscribe public void onInteract(PlayerInteractEvent event){ long id = 0; try{ id = event.entityPlayer.getHeldItem().itemID; }catch(Exception e){} if(event.action == Action.RIGHT_CLICK_AIR && id == Wuppy.smiter.itemID) { Vec3 loc = event.entityPlayer.getLookVec(); MovingObjectPosition pos = event.entityPlayer.rayTrace(100, 2.0F); //try{ try{ //event.entityPlayer.worldObj.spawnEntityInWorld(new net.minecraft.entity.effect.EntityLightningBolt(event.entityPlayer.worldObj, pos.blockX, pos.blockY, pos.blockZ)); }catch(Exception e){} try{ event.entityPlayer.worldObj.createExplosion(event.entityLiving.worldObj.getClosestPlayerToEntity(event.entityLiving, 50), pos.blockX, pos.blockY, pos.blockZ, 3.0F, true); }catch(Exception e){} //}catch(Exception e){} try{ EntityLiving mob = (EntityLiving) pos.entityHit; mob.setEntityHealth(mob.getHealth() - 20); }catch(Exception e){} event.entityPlayer.sendChatToPlayer(pos.blockX + ", " + pos.blockY + ", " + pos.blockZ); } } } Quote
hydroflame Posted July 30, 2013 Posted July 30, 2013 1 why so many try catch ? 2 is this class registered in your main mod class ? (if yes good) 3 try if(!event.player.worldObj.isRemote){ //code to spawn wtv you want } Quote how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.