56 lines
1.8 KiB
Java
56 lines
1.8 KiB
Java
/*
|
|
* Minecraft Forge
|
|
* Copyright (c) 2016-2018.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation version 2.1
|
|
* of the License.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
package net.minecraftforge.debug.client;
|
|
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraftforge.client.event.EntityViewRenderEvent;
|
|
import net.minecraftforge.common.MinecraftForge;
|
|
import net.minecraftforge.fml.common.Mod;
|
|
import net.minecraftforge.fml.common.Mod.EventHandler;
|
|
import net.minecraftforge.fml.event.FMLInitializationEvent;
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|
|
|
/**
|
|
* Simple mod to test fov modifier.
|
|
*/
|
|
@Mod(modid = "fovmodifiertest", name = "FOV Modifier Test", version = "0.0.0", clientSideOnly = true)
|
|
public class FOVModifierEventTest
|
|
{
|
|
static final boolean ENABLED = false;
|
|
|
|
@EventHandler
|
|
public void init(FMLInitializationEvent event)
|
|
{
|
|
if (ENABLED)
|
|
{
|
|
MinecraftForge.EVENT_BUS.register(this);
|
|
}
|
|
}
|
|
|
|
@SubscribeEvent
|
|
public void getFOVModifier(EntityViewRenderEvent.FOVModifier event)
|
|
{
|
|
if (event.getState().getMaterial() == Material.WATER)
|
|
{
|
|
event.setFOV(event.getFOV() / 60.0f * 50.0f);
|
|
}
|
|
}
|
|
}
|