Search in sources :

Example 56 with SubscribeEvent

use of net.minecraftforge.eventbus.api.SubscribeEvent in project NetherEx by LogicTechCorp.

the class WorldHandler method onEntitySpawn.

@SubscribeEvent
public static void onEntitySpawn(EntityJoinWorldEvent event) {
    World world = event.getWorld();
    Entity entity = event.getEntity();
    if (!world.isRemote()) {
        if (entity instanceof AreaEffectCloudEntity) {
            AreaEffectCloudEntity areaEffectCloudEntity = (AreaEffectCloudEntity) entity;
            areaEffectCloudEntity.effects.removeIf(effect -> effect.getPotion() == NetherExEffects.FIRE_BURNING.get());
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) AreaEffectCloudEntity(net.minecraft.entity.AreaEffectCloudEntity) AreaEffectCloudEntity(net.minecraft.entity.AreaEffectCloudEntity) World(net.minecraft.world.World) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 57 with SubscribeEvent

use of net.minecraftforge.eventbus.api.SubscribeEvent in project NetherEx by LogicTechCorp.

the class RenderEventHandler method onRenderLivingPost.

@SubscribeEvent
public static void onRenderLivingPost(RenderLivingEvent.Post<?, ?> event) {
    MatrixStack matrixStack = event.getMatrixStack();
    IRenderTypeBuffer renderTypeBuffer = event.getBuffers();
    LivingEntity entity = event.getEntity();
    if (entity.isPotionActive(NetherExEffects.FIRE_BURNING.get())) {
        renderThirdPersonBlueFire(matrixStack, renderTypeBuffer, entity);
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) MatrixStack(com.mojang.blaze3d.matrix.MatrixStack) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 58 with SubscribeEvent

use of net.minecraftforge.eventbus.api.SubscribeEvent in project NetherEx by LogicTechCorp.

the class RenderEventHandler method onRenderSpecificHand.

@SubscribeEvent
public static void onRenderSpecificHand(RenderHandEvent event) {
    PlayerEntity player = MINECRAFT.player;
    MatrixStack matrixStack = event.getMatrixStack();
    if (player != null && player.isPotionActive(NetherExEffects.FIRE_BURNING.get())) {
        renderFirstPersonBlueFire(matrixStack);
    }
}
Also used : MatrixStack(com.mojang.blaze3d.matrix.MatrixStack) PlayerEntity(net.minecraft.entity.player.PlayerEntity) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 59 with SubscribeEvent

use of net.minecraftforge.eventbus.api.SubscribeEvent in project NetherEx by LogicTechCorp.

the class DataGenerationHandler method onDataGathered.

@SubscribeEvent
public static void onDataGathered(GatherDataEvent event) {
    DataGenerator generator = event.getGenerator();
    if (event.includeServer()) {
        generator.addProvider(gatherLootTables(generator));
        generator.addProvider(gatherRecipes(generator));
    }
}
Also used : DataGenerator(net.minecraft.data.DataGenerator) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 60 with SubscribeEvent

use of net.minecraftforge.eventbus.api.SubscribeEvent in project NetherEx by LogicTechCorp.

the class MimicModelHandler method onModelBake.

@SubscribeEvent
public static void onModelBake(ModelBakeEvent event) {
    MimicBlock quartzOreBlock = (MimicBlock) NetherExBlocks.QUARTZ_ORE.get();
    if (quartzOreBlock != null) {
        ModelResourceLocation modelLocation = quartzOreBlock.getModelLocation();
        IBakedModel model = event.getModelRegistry().get(modelLocation);
        if (model != null) {
            event.getModelRegistry().put(modelLocation, new MimicBakedModel(model, quartzOreBlock.getMimicType()));
        }
    }
}
Also used : MimicBlock(logictechcorp.libraryex.block.MimicBlock) ModelResourceLocation(net.minecraft.client.renderer.model.ModelResourceLocation) IBakedModel(net.minecraft.client.renderer.model.IBakedModel) MimicBakedModel(logictechcorp.libraryex.client.render.model.MimicBakedModel) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Aggregations

SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)87 PlayerEntity (net.minecraft.entity.player.PlayerEntity)18 ItemStack (net.minecraft.item.ItemStack)17 ServerPlayerEntity (net.minecraft.entity.player.ServerPlayerEntity)11 ResourceLocation (net.minecraft.util.ResourceLocation)10 World (net.minecraft.world.World)8 Player (net.minecraft.world.entity.player.Player)8 BlockPos (net.minecraft.util.math.BlockPos)7 Entity (net.minecraft.world.entity.Entity)7 ItemStack (net.minecraft.world.item.ItemStack)7 CompoundNBT (net.minecraft.nbt.CompoundNBT)6 Minecraft (net.minecraft.client.Minecraft)5 BlockPos (net.minecraft.core.BlockPos)5 ServerPlayer (net.minecraft.server.level.ServerPlayer)5 StringTextComponent (net.minecraft.util.text.StringTextComponent)5 Item (net.minecraft.world.item.Item)5 BlockItem (net.minecraft.item.BlockItem)4 ResourceLocation (net.minecraft.resources.ResourceLocation)4 BlockState (net.minecraft.world.level.block.state.BlockState)4 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)4