在继承猪这一实体遇到以下问题:'net.minecraft.world.entity.EntityInsentient' 中的 'x()' 与 'net.minecraft.world.entity.EntityLiving' 中的 'x()' 冲突; 尝试使用不兼容的返回值类型
复制代码这是EntityInsentient中的字段
复制代码这是EntityLiving中的字段
这是很离谱的 一个类怎么可能与其父类同样名字而返回值不同,访问权限不同的方法(: EntityInsentient extends EntityLiving
有人遇到过这个问题并解决了吗?(如果不解决我似乎没有办法继承/复制nms中的任何实体)
- protected boolean x() {
- return false;
- }
- public void x() {
- Map<EnumItemSlot, ItemStack> map = this.y();
- if (map != null) {
- this.a(map);
- if (!map.isEmpty()) {
- this.b(map);
- }
- }
- }
这是很离谱的 一个类怎么可能与其父类同样名字而返回值不同,访问权限不同的方法(: EntityInsentient extends EntityLiving
有人遇到过这个问题并解决了吗?(如果不解决我似乎没有办法继承/复制nms中的任何实体)
方法:使用mojang 映射
雨 发表于 2023-2-24 13:19
遇到了同样的问题 能麻烦给个具体的解决方法嘛
使用BuildTools运行java -jar BuildTools.jar --rev 版本 --remapped
本帖最后由 Toame 于 2023-2-25 09:53 编辑
记得必须使用映射重新转换你的代码请在maven添加(示例为1.19.2)
复制代码与复制代码
雨 发表于 2023-2-24 13:19
遇到了同样的问题 能麻烦给个具体的解决方法嘛
记得必须使用映射重新转换你的代码请在maven添加(示例为1.19.2)
- <dependency>
- <groupId>org.spigotmc</groupId>
- <artifactId>spigot</artifactId>
- <version>1.19.2-R0.1-SNAPSHOT</version>
- <classifier>remapped-mojang</classifier>
- <scope>provided</scope>
- </dependency>
- <plugin>
- <groupId>net.md-5</groupId>
- <artifactId>specialsource-maven-plugin</artifactId>
- <version>1.2.4</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>remap</goal>
- </goals>
- <id>remap-obf</id>
- <configuration>
- <srgIn>org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
- <reverse>true</reverse>
- <remappedDependencies>org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
- <remappedArtifactAttached>true</remappedArtifactAttached>
- <remappedClassifierName>remapped-obf</remappedClassifierName>
- <!-- <outputDirectory>C:\Users\super\Desktop\Pyrite\Java</outputDirectory>-->
- </configuration>
- </execution>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>remap</goal>
- </goals>
- <id>remap-spigot</id>
- <configuration>
- <inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
- <srgIn>org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
- <remappedDependencies>org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
- </configuration>
- </execution>
- </executions>
- </plugin>