Toame
在继承猪这一实体遇到以下问题:'net.minecraft.world.entity.EntityInsentient' 中的 'x()' 与 'net.minecraft.world.entity.EntityLiving' 中的 'x()' 冲突; 尝试使用不兼容的返回值类型
  1. protected boolean x() {
  2.         return false;
  3.     }
复制代码
这是EntityInsentient中的字段
  1.     public void x() {
  2.         Map<EnumItemSlot, ItemStack> map = this.y();
  3.         if (map != null) {
  4.             this.a(map);
  5.             if (!map.isEmpty()) {
  6.                 this.b(map);
  7.             }
  8.         }

  9.     }
复制代码
这是EntityLiving中的字段
这是很离谱的 一个类怎么可能与其父类同样名字而返回值不同,访问权限不同的方法(: EntityInsentient extends EntityLiving
有人遇到过这个问题并解决了吗?(如果不解决我似乎没有办法继承/复制nms中的任何实体)

Toame
方法:使用mojang 映射

Toame 发表于 2023-2-23 19:16
方法:使用mojang 映射

遇到了同样的问题 能麻烦给个具体的解决方法嘛

Toame
雨 发表于 2023-2-24 13:19
遇到了同样的问题 能麻烦给个具体的解决方法嘛

使用BuildTools运行java -jar BuildTools.jar --rev 版本 --remapped

Toame
本帖最后由 Toame 于 2023-2-25 09:53 编辑
雨 发表于 2023-2-24 13:19
遇到了同样的问题 能麻烦给个具体的解决方法嘛

记得必须使用映射重新转换你的代码请在maven添加(示例为1.19.2)
  1. <dependency>
  2.             <groupId>org.spigotmc</groupId>
  3.             <artifactId>spigot</artifactId>
  4.             <version>1.19.2-R0.1-SNAPSHOT</version>
  5.             <classifier>remapped-mojang</classifier>
  6.             <scope>provided</scope>
  7. </dependency>
复制代码
  1. <plugin>
  2.                 <groupId>net.md-5</groupId>
  3.                 <artifactId>specialsource-maven-plugin</artifactId>
  4.                 <version>1.2.4</version>
  5.                 <executions>
  6.                     <execution>
  7.                         <phase>package</phase>
  8.                         <goals>
  9.                             <goal>remap</goal>
  10.                         </goals>
  11.                         <id>remap-obf</id>
  12.                         <configuration>
  13.                             <srgIn>org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
  14.                             <reverse>true</reverse>
  15.                             <remappedDependencies>org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
  16.                             <remappedArtifactAttached>true</remappedArtifactAttached>
  17.                             <remappedClassifierName>remapped-obf</remappedClassifierName>
  18.                             <!--                            <outputDirectory>C:\Users\super\Desktop\Pyrite\Java</outputDirectory>-->
  19.                         </configuration>
  20.                     </execution>
  21.                     <execution>
  22.                         <phase>package</phase>
  23.                         <goals>
  24.                             <goal>remap</goal>
  25.                         </goals>
  26.                         <id>remap-spigot</id>
  27.                         <configuration>
  28.                             <inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
  29.                             <srgIn>org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
  30.                             <remappedDependencies>org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
  31.                         </configuration>
  32.                     </execution>
  33.                 </executions>
  34.             </plugin>
复制代码