Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
Add NoRender (fr1kin#103)
Browse files Browse the repository at this point in the history
Add NoRender
  • Loading branch information
thelampgod authored and fr1kin committed Aug 7, 2019
1 parent d4ef828 commit ffce080
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/main/java/com/matt/forgehax/mods/NoRender.java
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);
}
}

0 comments on commit ffce080

Please sign in to comment.