有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何生成自定义暴徒?

我正试图从我的类中生成一个实体来定制EntityZombie

World bukkit; // ...
CraftWorld craft = (CraftWorld)bukkit;
net.minecraft.server.v1_7_R3.World world = craft.getHandle();
Boss boss = new Boss(world);
Location spawn; // ...
boss.setLocation(spawn.getX(), spawn.getY(), spawn.getZ(), spawn.getYaw(), spawn.getPitch());
world.addEntity(boss);

public class Boss extends EntityZombie {
    public Boss(World world) {
        super(world);
    }
    // Empty right now, nothing more than the normal zombie
}

输出为:

  • 如果我通过远离来运行上面的代码,当我回来时,我什么也看不到
  • 如果我靠得很近运行它,客户端就会崩溃

控制台中没有相关内容,这是完整的坠机报告

---- Minecraft Crash Report ----
// Who set us up the TNT?

Time: 06/03/15 14.57
Description: Ticking screen

java.lang.NullPointerException: Ticking screen
    at bjb.a(SourceFile:514)
    at fz.a(SourceFile:97)
    at fz.a(SourceFile:15)
    at ej.a(SourceFile:174)
    at bcx.e(SourceFile:78)
    at bao.p(SourceFile:1343)
    at bao.ak(SourceFile:774)
    at bao.f(SourceFile:728)
    at net.minecraft.client.main.Main.main(SourceFile:148)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
    at bjb.a(SourceFile:514)
    at fz.a(SourceFile:97)
    at fz.a(SourceFile:15)
    at ej.a(SourceFile:174)
    at bcx.e(SourceFile:78)

-- Affected screen --
Details:
    Screen name: ~~ERROR~~ NullPointerException: null

-- Affected level --
Details:
    Level name: MpServer
    All players: 1 total; [bjk['System_'/1, l='MpServer', x=-518,50, y=5,62, z=754,50]]
    Chunk stats: MultiplayerChunkCache: 10, 10
    Level seed: 0
    Level generator: ID 01 - flat, ver 0. Features enabled: false
    Level generator options: 
    Level spawn location: World: (-519,4,756), Chunk: (at 9,0,4 in -33,47; contains blocks -528,0,752 to -513,255,767), Region: (-2,1; contains chunks -64,32 to -33,63, blocks -1024,0,512 to -513,255,1023)
    Level time: 45 game time, 45 day time
    Level dimension: 0
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false
    Forced entities: 1 total; [bjk['System_'/1, l='MpServer', x=-518,50, y=5,62, z=754,50]]
    Retry entities: 0 total; []
    Server brand: Spigot
    Server type: Non-integrated multiplayer server
Stacktrace:
    at bjf.a(SourceFile:289)
    at bao.b(SourceFile:1972)
    at bao.f(SourceFile:737)
    at net.minecraft.client.main.Main.main(SourceFile:148)

-- System Details --
Details:
    Minecraft Version: 1.7.10
    Operating System: Windows 7 (amd64) version 6.1
    Java Version: 1.8.0_25, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 136194320 bytes (129 MB) / 186380288 bytes (177 MB) up to 1060372480 bytes (1011 MB)
    JVM Flags: 6 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M
    AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    Launched Version: 1.7.10
    LWJGL: 2.9.1
    OpenGL: GeForce GT 440/PCIe/SSE2 GL version 4.4.0, NVIDIA Corporation
    GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.

    Is Modded: Probably not. Jar signature remains and client brand is untouched.
    Type: Client (map_client.txt)
    Resource Packs: []
    Current Language: English (US)
    Profiler Position: N/A (disabled)
    Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    Anisotropic Filtering: On (2)

也许,我需要先为每个生物群落注册任何定制暴徒吗?如果是,怎么做


共 (1) 个答案

  1. # 1 楼答案

    您可以从以下位置下载RemoteEntities Api: HERE

    如果你想的话,你可以下载其他定制的mob api,但我建议你使用它