Use callback-style events throughout all versions
Removes the need for //#if statements on each and every event handler. Instead we now always use the equivalent Callback and have one central 1.12.2 class which forwards Forge events to the callbacks.
This commit is contained in:
@@ -2,6 +2,7 @@ package com.replaymod.extras.playeroverview;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.replaymod.core.ReplayMod;
|
||||
import com.replaymod.core.events.PreRenderHandCallback;
|
||||
import com.replaymod.core.utils.Utils;
|
||||
import com.replaymod.extras.Extra;
|
||||
import com.replaymod.replay.ReplayHandler;
|
||||
@@ -14,23 +15,11 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
//#if MC>=11400
|
||||
import com.replaymod.core.events.PreRenderHandCallback;
|
||||
import java.util.stream.Collectors;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.client.event.RenderHandEvent;
|
||||
//$$
|
||||
//#if MC>=11400
|
||||
//#else
|
||||
//$$ import org.lwjgl.input.Keyboard;
|
||||
//#endif
|
||||
//$$
|
||||
//#if MC>=10800
|
||||
//$$ import com.google.common.base.Predicate;
|
||||
//#if MC>=11400
|
||||
//$$ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
//#endif
|
||||
//#else
|
||||
//$$ import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
//$$ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -126,16 +115,7 @@ public class PlayerOverview extends EventRegistrations implements Extra {
|
||||
hiddenPlayers.clear();
|
||||
}
|
||||
|
||||
//#if MC>=11400
|
||||
{ on(PreRenderHandCallback.EVENT, this::shouldHideHand); }
|
||||
//#else
|
||||
//$$ @SubscribeEvent
|
||||
//$$ public void oRenderHand(RenderHandEvent event) {
|
||||
//$$ if (shouldHideHand()) {
|
||||
//$$ event.setCanceled(true);
|
||||
//$$ }
|
||||
//$$ }
|
||||
//#endif
|
||||
private boolean shouldHideHand() {
|
||||
Entity view = getRenderViewEntity(module.getCore().getMinecraft());
|
||||
return view != null && isHidden(view.getUuid());
|
||||
|
||||
Reference in New Issue
Block a user