数据system
本帖最后由 数据system 于 2019-9-13 20:21 编辑
  1.     @SideOnly(Side.CLIENT)
  2.     @SubscribeEvent
  3.     public void onKeyInput(InputEvent.KeyInputEvent event)
  4.     {
  5.         if (KeyLoader.V.isPressed())
  6.         {
  7.             EntityPlayer player = Minecraft.getMinecraft().thePlayer;
  8.             World world = Minecraft.getMinecraft().theWorld;

  9.             ItemStack item =player.getHeldItem();
  10.             if(item!=null)
  11.             {
  12.                     if (!(item.getTagCompound()==null))
  13.                     {
  14.                             if(item.getTagCompound().getIntArray("Data") != null)
  15.                             {
  16.                                     int[] i=item.getTagCompound().getIntArray("Data");
  17.                                     double x=player.posX;double y=player.posY;double z=player.posZ;
  18.                                     world.getEntitiesWithinAABB(EntityLiving.class,new AxisAlignedBB(-10, -10, -10, 10, 10, 10).offset(x,y,z));
  19.                             }
  20.                     }
  21.             }
  22.         }
  23.     }
  24. }
复制代码

为什么这样写会提示构造函数 AxisAlignedBB(double, double, double, double, double, double)不可视?


2021.12 数据,可能有更多内容 本帖最后由 数据system 于 2019-9-13 20:21 编辑

代码:

  1.     @SideOnly(Side.CLIENT)
  2.     @SubscribeEvent
  3.     public void onKeyInput(InputEvent.KeyInputEvent event)
  4.     {
  5.   if (KeyLoader.V.isPressed())
  6.   {
  7.    EntityPlayer player = Minecraft.getMinecraft().thePlayer;
  8.    World world = Minecraft.getMinecraft().theWorld;

  9.    ItemStack item =player.getHeldItem();
  10.    if(item!=null)
  11.    {
  12.   if (!(item.getTagCompound()==null))
  13.   {
  14.     if(item.getTagCompound().getIntArray("Data") != null)
  15.     {
  16.    int[] i=item.getTagCompound().getIntArray("Data");
  17.    double x=player.posX;double y=player.posY;double z=player.posZ;
  18.    world.getEntitiesWithinAABB(EntityLiving.class,new AxisAlignedBB(-10, -10, -10, 10, 10, 10).offset(x,y,z));
  19.     }
  20.   }
  21.    }
  22.   }
  23.     }
  24. }

为什么这样写会提示构造函数 AxisAlignedBB(double, double, double, double, double, double)不可视?



森林蝙蝠
world.getEntitiesWithinAABB(EntityLiving.class,new AxisAlignedBB(-10, -10, -10, 10, 10, 10).offset(x,y,z));
如果不是你在编辑的时候打错,那就是你这行代码里有个中文括号。

数据system
森林蝙蝠 发表于 2019-9-13 16:35
world.getEntitiesWithinAABB(EntityLiving.class,new AxisAlignedBB(-10, -10, -10, 10, 10, 10).offset( ...

括号应该是编辑时打错了,不是括号的问题

森林蝙蝠
数据system 发表于 2019-9-13 20:20
括号应该是编辑时打错了,不是括号的问题

那么什么是“构造函数不可视”呢,能不能截个图来?

数据system
森林蝙蝠 发表于 2019-9-13 20:57
那么什么是“构造函数不可视”呢,能不能截个图来?

就是这样(电脑截图按下Ctrl这条提示就没了,只好用手机截图)

数据system
森林蝙蝠 发表于 2019-9-13 20:57
那么什么是“构造函数不可视”呢,能不能截个图来?

或者大佬我想请问一下1.7.10版本除了用world.getEntitiesWithinAABB(EntityLiving.class,new AxisAlignedBB(-10, -10, -10, 10, 10, 10).offset(x,y,z));这个方法来获取周围实体,还有别的方法来获取吗?

森林蝙蝠
数据system 发表于 2019-9-13 21:07
就是这样(电脑截图按下Ctrl这条提示就没了,只好用手机截图)

printscreen也能截图,我建议你跳转到那个类,看看构造器是不是public的。

第一页 上一页 下一页 最后一页