From 686f776b38e26b612900ce8d1fc504d3607740e3 Mon Sep 17 00:00:00 2001 From: thelampgod Date: Mon, 5 Aug 2019 14:59:33 +0200 Subject: [PATCH 1/6] Add NoRender --- src/main/java/com/matt/forgehax/mods/NoRender | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/main/java/com/matt/forgehax/mods/NoRender diff --git a/src/main/java/com/matt/forgehax/mods/NoRender b/src/main/java/com/matt/forgehax/mods/NoRender new file mode 100644 index 000000000..0076aa0ff --- /dev/null +++ b/src/main/java/com/matt/forgehax/mods/NoRender @@ -0,0 +1,33 @@ +package com.matt.forgehax.mods; + +import com.matt.forgehax.events.Render2DEvent; +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.item.EntityItem; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +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 onRender2D(Render2DEvent event){ + getWorld() + .loadedEntityList + .stream() + .filter(EntityItem.class::isInstance) + .map(EntityItem.class::cast) + .filter(entity -> entity.ticksExisted > 1) + .forEach( + entity -> { + entity.setDead(); + }); + } +} + From c2c403460d8da18623c9b2dd1d6f2ed26c30a333 Mon Sep 17 00:00:00 2001 From: thelampgod Date: Mon, 5 Aug 2019 15:03:04 +0200 Subject: [PATCH 2/6] Add NoRender --- src/main/java/com/matt/forgehax/mods/{NoRender => NoRender.java} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/java/com/matt/forgehax/mods/{NoRender => NoRender.java} (100%) diff --git a/src/main/java/com/matt/forgehax/mods/NoRender b/src/main/java/com/matt/forgehax/mods/NoRender.java similarity index 100% rename from src/main/java/com/matt/forgehax/mods/NoRender rename to src/main/java/com/matt/forgehax/mods/NoRender.java From 8d16674336ca48e03272c8028e614b38b27d3d84 Mon Sep 17 00:00:00 2001 From: thelampgod Date: Tue, 6 Aug 2019 09:24:02 +0200 Subject: [PATCH 3/6] fix small issues (tabbing, spacing, etc.) this works for now. can be improved upon to add "hide" setting, but i couldn't figure out how to do that --- .../java/com/matt/forgehax/mods/NoRender.java | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/matt/forgehax/mods/NoRender.java b/src/main/java/com/matt/forgehax/mods/NoRender.java index 0076aa0ff..a4e933bda 100644 --- a/src/main/java/com/matt/forgehax/mods/NoRender.java +++ b/src/main/java/com/matt/forgehax/mods/NoRender.java @@ -1,10 +1,11 @@ package com.matt.forgehax.mods; -import com.matt.forgehax.events.Render2DEvent; 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.client.event.RenderLivingEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import static com.matt.forgehax.Helper.getWorld; @@ -17,17 +18,12 @@ public NoRender() { } @SubscribeEvent - public void onRender2D(Render2DEvent event){ - getWorld() - .loadedEntityList - .stream() - .filter(EntityItem.class::isInstance) - .map(EntityItem.class::cast) - .filter(entity -> entity.ticksExisted > 1) - .forEach( - entity -> { - entity.setDead(); - }); + public void onRenderLiving(RenderLivingEvent.Pre event) { + getWorld() + .loadedEntityList + .stream() + .filter(EntityItem.class::isInstance) + .map(EntityItem.class::cast) + .forEach(Entity::setDead); } } - From 54d4fd61126872b6f2f16e4ae4dd6c9ffe06df6e Mon Sep 17 00:00:00 2001 From: thelampgod Date: Wed, 7 Aug 2019 02:22:00 +0200 Subject: [PATCH 4/6] Update NoRender.java --- src/main/java/com/matt/forgehax/mods/NoRender.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/matt/forgehax/mods/NoRender.java b/src/main/java/com/matt/forgehax/mods/NoRender.java index a4e933bda..1400cd096 100644 --- a/src/main/java/com/matt/forgehax/mods/NoRender.java +++ b/src/main/java/com/matt/forgehax/mods/NoRender.java @@ -5,9 +5,10 @@ import com.matt.forgehax.util.mod.loader.RegisterMod; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; -import net.minecraftforge.client.event.RenderLivingEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; +import static com.matt.forgehax.Helper.getLocalPlayer; import static com.matt.forgehax.Helper.getWorld; @RegisterMod @@ -18,7 +19,8 @@ public NoRender() { } @SubscribeEvent - public void onRenderLiving(RenderLivingEvent.Pre event) { + public void onClientTick(ClientTickEvent event) { + if (getWorld() == null || getLocalPlayer() == null) return; getWorld() .loadedEntityList .stream() From 9f40323f21c8af8bf8f633f10155cb8ffc93d2c0 Mon Sep 17 00:00:00 2001 From: thelampgod Date: Wed, 7 Aug 2019 02:32:50 +0200 Subject: [PATCH 5/6] i think i might be retarded --- src/main/java/com/matt/forgehax/mods/NoRender.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/matt/forgehax/mods/NoRender.java b/src/main/java/com/matt/forgehax/mods/NoRender.java index 1400cd096..6f721569b 100644 --- a/src/main/java/com/matt/forgehax/mods/NoRender.java +++ b/src/main/java/com/matt/forgehax/mods/NoRender.java @@ -6,6 +6,7 @@ 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; @@ -21,6 +22,8 @@ public NoRender() { @SubscribeEvent public void onClientTick(ClientTickEvent event) { if (getWorld() == null || getLocalPlayer() == null) return; + + if(event.phase == TickEvent.Phase.START) getWorld() .loadedEntityList .stream() @@ -29,3 +32,4 @@ public void onClientTick(ClientTickEvent event) { .forEach(Entity::setDead); } } + From 3a7732b5036645663d74d04bd83132f7f709ff02 Mon Sep 17 00:00:00 2001 From: Matthew C Date: Tue, 6 Aug 2019 19:37:07 -0500 Subject: [PATCH 6/6] tabbing --- src/main/java/com/matt/forgehax/mods/NoRender.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/matt/forgehax/mods/NoRender.java b/src/main/java/com/matt/forgehax/mods/NoRender.java index 6f721569b..7b2b0966e 100644 --- a/src/main/java/com/matt/forgehax/mods/NoRender.java +++ b/src/main/java/com/matt/forgehax/mods/NoRender.java @@ -24,12 +24,12 @@ 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); + getWorld() + .loadedEntityList + .stream() + .filter(EntityItem.class::isInstance) + .map(EntityItem.class::cast) + .forEach(Entity::setDead); } }