NoClip for Riding Entities
@@ -4,10 +4,10 @@ import com.matt.forgehax.events.LocalPlayerUpdateEvent;
import com.matt.forgehax.util.mod.Category;
import com.matt.forgehax.util.mod.ToggleMod;
import com.matt.forgehax.util.mod.loader.RegisterMod;
-import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.Entity;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import static com.matt.forgehax.Helper.getLocalPlayer;
+import static com.matt.forgehax.Helper.*;
@RegisterMod
public class NoclipMod extends ToggleMod {
@@ -17,15 +17,16 @@ public class NoclipMod extends ToggleMod {
@Override
public void onDisabled() {
- if(getLocalPlayer() != null)
- getLocalPlayer().noClip = false;
+ Entity local = getRidingOrPlayer();
+ if (local != null)
+ local.noClip = false;
}
@SubscribeEvent
public void onLocalPlayerUpdate(LocalPlayerUpdateEvent event) {
- EntityPlayer localPlayer = getLocalPlayer();
- localPlayer.noClip = true;
- localPlayer.onGround = false;
- localPlayer.fallDistance = 0;
+ Entity local = getRidingOrPlayer();
+ local.noClip = true;
+ local.onGround = false;
+ local.fallDistance = 0;
}
}
