Posted January 27, 20205 yr 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, 20205 yr by kyazuki
January 27, 20205 yr Show your code. 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.
January 27, 20205 yr Author 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); } } }
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.