Jump to content

Qplay123

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Qplay123

  1. Maybe this will work as replacement for default rayTrace method: import net.minecraft.entity.effect.LightningBoltEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.math.*; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; public class CustomItem extends Item { public CustomItem() { super(new Item.Properties().group(ItemGroup.TOOLS)); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { if (worldIn instanceof ServerWorld) { ServerWorld world = (ServerWorld) worldIn; RayTraceResult raytraceresult = rayTrace(worldIn, playerIn, RayTraceContext.FluidMode.ANY); double posX = raytraceresult.getHitVec().x; double posY = Math.floor(raytraceresult.getHitVec().y); double posZ = raytraceresult.getHitVec().z; System.out.println(posX); System.out.println(posY); System.out.println(posZ); BlockPos pos = new BlockPos(posX, posY, posZ); LightningBoltEntity l = new LightningBoltEntity(worldIn, posX, posY, posZ, false); world.addLightningBolt(l); } return super.onItemRightClick(worldIn, playerIn, handIn); } protected static RayTraceResult rayTrace(World worldIn, PlayerEntity player, RayTraceContext.FluidMode fluidMode) { float f = player.rotationPitch; float f1 = player.rotationYaw; Vec3d vec3d = player.getEyePosition(1.0F); float f2 = MathHelper.cos(-f1 * ((float)Math.PI / 180F) - (float)Math.PI); float f3 = MathHelper.sin(-f1 * ((float)Math.PI / 180F) - (float)Math.PI); float f4 = -MathHelper.cos(-f * ((float)Math.PI / 180F)); float f5 = MathHelper.sin(-f * ((float)Math.PI / 180F)); float f6 = f3 * f4; float f7 = f2 * f4; double d0 = 8192; Vec3d vec3d1 = vec3d.add((double)f6 * d0, (double)f5 * d0, (double)f7 * d0); return worldIn.rayTraceBlocks(new RayTraceContext(vec3d, vec3d1, RayTraceContext.BlockMode.OUTLINE, fluidMode, player)); } } I just got it from Item.rayTrace and changed this line: double d0 = double d0 = player.getAttribute(PlayerEntity.REACH_DISTANCE).getValue();; to: double d0 = 8192d; You can change the value if you want.
  2. Yes It's also working with minecraft 1.12.2
  3. My Minecraft no longer works by Forge on Ubuntu 18.10. And I am really serious. And I do not have a crash report. So it is difficult to gather information. I do have an nVidia GeForce 390 series GPU 4 GB Video Ram 8 GB of Ram OS: Ubuntu 18.10 (No LTS) Java version OpenJDK 8 (JRE and JDK) Intel Core i7 8th Gen. EDIT: I found a log where possible good information. launcher_log.txt
×
×
  • Create New...

Important Information

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