kyazuki Posted January 27, 2020 Posted January 27, 2020 (edited) I call onDeath method, and the game is crashed. The game is crashed in LivingEntity.dropLoot method. protected void dropLoot(DamageSource damageSourceIn, boolean p_213354_2_) { ResourceLocation resourcelocation = this.getLootTableResourceLocation(); LootTable loottable = this.world.getServer().getLootTableManager().getLootTableFromLocation(resourcelocation); LootContext.Builder lootcontext$builder = this.getLootContextBuilder(p_213354_2_, damageSourceIn); loottable.generate(lootcontext$builder.build(LootParameterSets.ENTITY), this::entityDropItem); } getServer method always returns null. @Nullable public MinecraftServer getServer() { return null; } This causes NullPointerException. Edited January 27, 2020 by kyazuki Quote
Draco18s Posted January 27, 2020 Posted January 27, 2020 Show your code. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
kyazuki Posted January 27, 2020 Author Posted January 27, 2020 Can I check Client or Server Thread by isRemote()? @SubscribeEvent public static void killPlayer(TickEvent.PlayerTickEvent event) { if (event.player.world.isRemote()) { if (/* check player */) { event.player.onDeath(DamageSource.OUT_OF_WORLD); } } } Quote
kyazuki Posted January 27, 2020 Author Posted January 27, 2020 I assume that I must call onDeath in Server Thread... Thanks!! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.