Automatically registers SpectatorRenderer Objects in constructor to avoid forgetting them

This commit is contained in:
CrushedPixel
2015-06-01 15:17:13 +02:00
parent e04496f74d
commit 5f4cddcfbc
2 changed files with 5 additions and 2 deletions

View File

@@ -113,8 +113,6 @@ public class ReplayMod {
MinecraftForge.EVENT_BUS.register(tarl);
spectatorRenderer = new SpectatorRenderer();
FMLCommonHandler.instance().bus().register(spectatorRenderer);
MinecraftForge.EVENT_BUS.register(spectatorRenderer);
KeybindRegistry.initialize();

View File

@@ -21,6 +21,7 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import net.minecraft.world.storage.MapData;
import net.minecraftforge.client.event.RenderHandEvent;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.lwjgl.opengl.GL11;
@@ -31,6 +32,10 @@ public class SpectatorRenderer {
private final Minecraft mc = Minecraft.getMinecraft();
private EntityPlayer currentPlayer;
public SpectatorRenderer() {
FMLCommonHandler.instance().bus().register(this);
}
private EntityPlayer getSpectatedPlayer() {
Entity current = ReplayHandler.getCurrentEntity();
if(!(current instanceof EntityPlayer)) return null;