Search in sources :

Example 46 with SubscribeEvent

use of net.minecraftforge.fml.common.eventhandler.SubscribeEvent in project Totemic by TeamTotemic.

the class GameOverlay method onFOVUpdate.

@SubscribeEvent
public void onFOVUpdate(FOVUpdateEvent event) {
    EntityPlayer player = Minecraft.getMinecraft().player;
    if (player.isHandActive() && player.getActiveItemStack().getItem() instanceof ItemBaykokBow) {
        int bowTicks = player.getItemInUseMaxCount();
        float modifier = bowTicks / 20.0F;
        if (modifier > 1.0F)
            modifier = 1.0F;
        else
            modifier = modifier * modifier;
        event.setNewfov(event.getFov() * (1.0F - 0.15F * modifier));
    }
}
Also used : ItemBaykokBow(pokefenn.totemic.item.equipment.weapon.ItemBaykokBow) EntityPlayer(net.minecraft.entity.player.EntityPlayer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 47 with SubscribeEvent

use of net.minecraftforge.fml.common.eventhandler.SubscribeEvent in project Totemic by TeamTotemic.

the class PlayerRender method onPlayerRender.

@SubscribeEvent
public void onPlayerRender(RenderPlayerEvent.Post event) {
    AbstractClientPlayer player = (AbstractClientPlayer) event.getEntityPlayer();
    if (ljfaUUID.equals(player.getUniqueID()) && annaSkinId.equals(player.getLocationSkin().getResourcePath())) {
        float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * event.getPartialRenderTick();
        float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * event.getPartialRenderTick();
        float pitchZ = (float) Math.toDegrees(event.getRenderer().getMainModel().bipedHead.rotateAngleZ);
        GlStateManager.pushMatrix();
        if (player.isSneaking())
            GlStateManager.translate(0, -0.25F, 0);
        GlStateManager.translate(event.getX(), event.getY() + 1.501F * 0.9375F, event.getZ());
        GlStateManager.rotate(pitchZ, 0, 0, 1);
        GlStateManager.rotate(yaw - 90, 0, -1, 0);
        GlStateManager.rotate(pitch + 180, 0, 0, 1);
        if (!player.inventory.armorItemInSlot(3).isEmpty())
            GlStateManager.translate(0.01F, -0.04F, 0);
        if (annaHatDisplayList == 0)
            createAnnaHatDisplayList();
        GlStateManager.callList(annaHatDisplayList);
        GlStateManager.popMatrix();
    }
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 48 with SubscribeEvent

use of net.minecraftforge.fml.common.eventhandler.SubscribeEvent in project Totemic by TeamTotemic.

the class ModBlocks method setStateMappers.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void setStateMappers(ModelRegistryEvent event) {
    ModelLoader.setCustomStateMapper(cedar_sapling, new Builder().ignore(BlockCedarSapling.TYPE, BlockCedarSapling.STAGE).build());
    ModelLoader.setCustomStateMapper(cedar_leaves, new Builder().ignore(BlockCedarLeaves.CHECK_DECAY, BlockCedarLeaves.DECAYABLE).build());
}
Also used : Builder(net.minecraft.client.renderer.block.statemap.StateMap.Builder) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 49 with SubscribeEvent

use of net.minecraftforge.fml.common.eventhandler.SubscribeEvent in project Totemic by TeamTotemic.

the class ModContent method createRegistries.

@SubscribeEvent
public static void createRegistries(RegistryEvent.NewRegistry event) {
    // RegistryEvents are fired in alphabetic order.
    // Instruments have to be registered before Ceremonies.
    new RegistryBuilder<MusicInstrument>().setName(new ResourceLocation(Totemic.MOD_ID, "a_music_instruments")).setType(MusicInstrument.class).setMaxID(Byte.MAX_VALUE).disableSaving().create();
    new RegistryBuilder<TotemEffect>().setName(new ResourceLocation(Totemic.MOD_ID, "b_totem_effects")).setType(TotemEffect.class).setMaxID(Byte.MAX_VALUE).disableSaving().create();
    new RegistryBuilder<Ceremony>().setName(new ResourceLocation(Totemic.MOD_ID, "c_ceremonies")).setType(Ceremony.class).setMaxID(Byte.MAX_VALUE).disableSaving().create();
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) MusicInstrument(pokefenn.totemic.api.music.MusicInstrument) TotemEffect(pokefenn.totemic.api.totem.TotemEffect) Ceremony(pokefenn.totemic.api.ceremony.Ceremony) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 50 with SubscribeEvent

use of net.minecraftforge.fml.common.eventhandler.SubscribeEvent in project GregTech by GregTechCE.

the class CustomDataTileHandler method onChunkWatch.

@SubscribeEvent
public void onChunkWatch(ChunkWatchEvent.Watch event) {
    ChunkPos chunkPos = event.getChunk();
    EntityPlayerMP player = event.getPlayer();
    Chunk chunk = player.world.getChunkFromChunkCoords(chunkPos.x, chunkPos.z);
    for (TileEntity tileEntity : chunk.getTileEntityMap().values()) {
        if (tileEntity instanceof ICustomDataTile) {
            ICustomDataTile customDataTile = (ICustomDataTile) tileEntity;
            customDataTile.onBeingWatched(player);
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ICustomDataTile(gregtech.api.capability.ICustomDataTile) ChunkPos(net.minecraft.util.math.ChunkPos) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) Chunk(net.minecraft.world.chunk.Chunk) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1135 ItemStack (net.minecraft.item.ItemStack)316 EntityPlayer (net.minecraft.entity.player.EntityPlayer)314 World (net.minecraft.world.World)196 BlockPos (net.minecraft.util.math.BlockPos)179 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)136 IBlockState (net.minecraft.block.state.IBlockState)120 ResourceLocation (net.minecraft.util.ResourceLocation)102 Entity (net.minecraft.entity.Entity)93 Block (net.minecraft.block.Block)86 EntityLivingBase (net.minecraft.entity.EntityLivingBase)84 Minecraft (net.minecraft.client.Minecraft)72 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)66 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)64 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)55 Item (net.minecraft.item.Item)53 EntityItem (net.minecraft.entity.item.EntityItem)48 TileEntity (net.minecraft.tileentity.TileEntity)46 TextComponentString (net.minecraft.util.text.TextComponentString)42 Random (java.util.Random)37