Skip to content

Commit

Permalink
Check if world is remote so event isn't fired for single player entit…
Browse files Browse the repository at this point in the history
…y tick
  • Loading branch information
fr1kin committed Aug 21, 2019
1 parent 710c0a6 commit ba21f91
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.matt.forgehax.mods.services;

import static com.matt.forgehax.Helper.getLocalPlayer;
import static com.matt.forgehax.Helper.getWorld;

import com.matt.forgehax.events.LocalPlayerUpdateEvent;
import com.matt.forgehax.util.mod.ServiceMod;
import com.matt.forgehax.util.mod.loader.RegisterMod;
Expand All @@ -17,7 +20,9 @@ public LocalPlayerUpdateEventService() {

@SubscribeEvent
public void onUpdate(LivingEvent.LivingUpdateEvent event) {
if (MC.world != null && event.getEntityLiving().equals(MC.player)) {
if (getWorld() != null
&& !getWorld().isRemote
&& event.getEntityLiving().equals(getLocalPlayer())) {
Event ev = new LocalPlayerUpdateEvent(event.getEntityLiving());
MinecraftForge.EVENT_BUS.post(ev);
event.setCanceled(ev.isCanceled());
Expand Down

0 comments on commit ba21f91

Please sign in to comment.