Posted July 16, 201411 yr I basically have an item, that when right clicked summonses a lightning bolt entity. I have been trying a variety of methods but none seem to work. The latest method I used was this: http://pastebin.com/bP4iY1j7 (Used a link as spoilers wouldn't work) What am I doing wrong? Is it the method, a parameter, or am I just messing up?
July 17, 201411 yr Author Lighting bolts are handled differently from normal entities. Use addWeatherEffect instead of spawnEntity. Ah thanks for your help!
July 17, 201411 yr Author Sorry to be a bother, but I am still having issues. The problem is, I cannot summon lightning unless it is raining (I checked the code). Is there a way to override this?
July 18, 201411 yr float f = 1.0f; float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f; float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f; double d = (double)f; double d1 = player.prevPosX + (player.posX - player.prevPosX) * d; double d2 = (player.prevPosY + (player.posY - player.prevPosY) * d + 1.6200000000000001d) - (double)player.yOffset; double d3 = player.prevPosZ + (player.posZ - player.prevPosZ) * d; Vec3 vec1 = Vec3.createVectorHelper(d1, d2, d3); float f11 = MathHelper.cos(-f2 * 0.01745329f - 3.141593f); float f12 = MathHelper.sin(-f2 * 0.01745329f - 3.141593f); float f13 = -MathHelper.cos(-f1 * 0.01745329f); float f14 = MathHelper.sin(-f1 * 0.01745329f); float f15 = f12 * f13; float f16 = f14; float f17 = f11 * f13; double d11 = 5000d; Vec3 vec2 = vec1.addVector((double)f15 * d11, (double)f16 * d11, (double)f17 * d11); MovingObjectPosition position = world.func_147447_a(vec1, vec2, false, true, true); if(position != null && position.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int x = position.blockX; int y = position.blockY; int z = position.blockZ; EntityLightningBolt lightning = new EntityLightningBolt(world, x, y, z); world.spawnEntityInWorld(lightning); } This is the code I use in my mod and it works just fine world is a World and player is an EntityPlayer
August 15, 20196 yr On 7/17/2014 at 9:05 PM, kenoba10 said: float f = 1.0f; float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f; float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f; double d = (double)f; double d1 = player.prevPosX + (player.posX - player.prevPosX) * d; double d2 = (player.prevPosY + (player.posY - player.prevPosY) * d + 1.6200000000000001d) - (double)player.yOffset; double d3 = player.prevPosZ + (player.posZ - player.prevPosZ) * d; Vec3 vec1 = Vec3.createVectorHelper(d1, d2, d3); float f11 = MathHelper.cos(-f2 * 0.01745329f - 3.141593f); float f12 = MathHelper.sin(-f2 * 0.01745329f - 3.141593f); float f13 = -MathHelper.cos(-f1 * 0.01745329f); float f14 = MathHelper.sin(-f1 * 0.01745329f); float f15 = f12 * f13; float f16 = f14; float f17 = f11 * f13; double d11 = 5000d; Vec3 vec2 = vec1.addVector((double)f15 * d11, (double)f16 * d11, (double)f17 * d11); MovingObjectPosition position = world.func_147447_a(vec1, vec2, false, true, true); if(position != null && position.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int x = position.blockX; int y = position.blockY; int z = position.blockZ; EntityLightningBolt lightning = new EntityLightningBolt(world, x, y, z); world.spawnEntityInWorld(lightning); } I know this is old but I couldn't find any new threads but I was wondering if anyone knows why mine crashes my game it is a java.lang.ExceptionInInitializerError
August 15, 20196 yr 19 minutes ago, jgp22805 said: I know this is old but I couldn't find any new threads but I was wondering if anyone knows why mine crashes my game it is a java.lang.ExceptionInInitializerError Make a new thread dont necro. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
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.