This repository has been archived by the owner on Feb 27, 2023. It is now read-only.
forked from fr1kin/ForgeHax
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.matt.forgehax.mods; | ||
|
||
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.Entity; | ||
import net.minecraft.entity.item.EntityItem; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
import net.minecraftforge.fml.common.gameevent.TickEvent; | ||
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; | ||
|
||
import static com.matt.forgehax.Helper.getLocalPlayer; | ||
import static com.matt.forgehax.Helper.getWorld; | ||
|
||
@RegisterMod | ||
public class NoRender extends ToggleMod { | ||
|
||
public NoRender() { | ||
super(Category.RENDER, "NoRender", false, "Stops rendering items on ground"); | ||
} | ||
|
||
@SubscribeEvent | ||
public void onClientTick(ClientTickEvent event) { | ||
if (getWorld() == null || getLocalPlayer() == null) return; | ||
|
||
if(event.phase == TickEvent.Phase.START) | ||
getWorld() | ||
.loadedEntityList | ||
.stream() | ||
.filter(EntityItem.class::isInstance) | ||
.map(EntityItem.class::cast) | ||
.forEach(Entity::setDead); | ||
} | ||
} | ||
|