mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-27 07:13:14 +00:00
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
56 lines
2.0 KiB
Java
56 lines
2.0 KiB
Java
package WayofTime.alchemicalWizardry.client;
|
|
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.util.ResourceLocation;
|
|
import net.minecraftforge.client.event.RenderBlockOverlayEvent;
|
|
import net.minecraftforge.client.event.sound.SoundEvent;
|
|
|
|
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
|
import WayofTime.alchemicalWizardry.ModBlocks;
|
|
import WayofTime.alchemicalWizardry.client.renderer.RenderHelper;
|
|
import cpw.mods.fml.client.FMLClientHandler;
|
|
import cpw.mods.fml.common.eventhandler.Event.Result;
|
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|
import cpw.mods.fml.common.gameevent.TickEvent;
|
|
|
|
public class ClientEventHandler {
|
|
|
|
private final Minecraft mc = FMLClientHandler.instance().getClient();
|
|
|
|
public static ResourceLocation currentPlayerTexture = null;
|
|
|
|
@SubscribeEvent
|
|
public void onPlayerSoundEvent(SoundEvent event) {
|
|
if (Minecraft.getMinecraft() != null) {
|
|
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
|
|
|
if (player != null && player.isPotionActive(AlchemicalWizardry.customPotionDeaf)) {
|
|
event.setResult(Result.DENY);
|
|
if (event.isCancelable()) event.setCanceled(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
@SubscribeEvent
|
|
public void onOverlayEvent(RenderBlockOverlayEvent event) {
|
|
if (event.overlayType == RenderBlockOverlayEvent.OverlayType.WATER
|
|
&& event.player.isPotionActive(AlchemicalWizardry.customPotionAmphibian.id)) // TODO Placeholder for new
|
|
// potion effect
|
|
if (event.isCancelable()) {
|
|
event.setCanceled(true);
|
|
}
|
|
|
|
if (event.blockForOverlay == ModBlocks.blockMimic && event.isCancelable()) {
|
|
event.setCanceled(true);
|
|
}
|
|
}
|
|
|
|
@SubscribeEvent
|
|
public void onTick(TickEvent.RenderTickEvent event) {
|
|
if (event.phase.equals(TickEvent.Phase.START)) return;
|
|
|
|
RenderHelper.onTickInGame(mc);
|
|
}
|
|
}
|