Jump to content

RiceAndCheese

Members
  • Posts

    3
  • Joined

  • Last visited

RiceAndCheese's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Worked thanks! If anyone wants the code: package com.riceandcheese.jademod.common.items; import com.riceandcheese.jademod.core.init.Iteminit; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class SpecialItem4 extends Item { public SpecialItem4(Properties properties) { super(properties); } @Override public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { if(entityIn instanceof PlayerEntity){ PlayerEntity player = (PlayerEntity) entityIn; if(player.inventory.hasItemStack(Iteminit.fire_fragment.get().getDefaultInstance())) { player.forceFireTicks(30); } } super.inventoryTick(stack, worldIn, entityIn, itemSlot, isSelected); } }
  2. Ok so, this is my EventHandler class: package com.riceandcheese.jademod.core.event; import com.riceandcheese.jademod.Jademod; import com.riceandcheese.jademod.core.init.Iteminit; import net.minecraft.entity.player.PlayerEntity; import net.minecraftforge.event.TickEvent.PlayerTickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; @EventBusSubscriber(modid = Jademod.MOD_ID, bus = Bus.FORGE) public class EventHandler { @SubscribeEvent public void onTickPlayerEvent(PlayerTickEvent event){ if(event.player instanceof PlayerEntity){ PlayerEntity player = (PlayerEntity) event.player; if(player.inventory.hasItemStack(Iteminit.fire_fragment.get().getDefaultInstance())) { player.forceFireTicks(21); } } } } It's still not working (fire_fragment is the item that's gonna make it happen)
  3. So, I have this code. What I wanna do is that when the item is in my inventory, the player is set on fire. It isn't working... Any Idea on what is the problem (Eclipse shows me no problem) I almost forgot to say, I used ACATIA_BUTTON just to test and I'm kinda new at this. package com.riceandcheese.jademod.common.items; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.Items; import net.minecraftforge.event.TickEvent.PlayerTickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; public class SpecialItem4 extends Item { public SpecialItem4(Properties properties) { super(properties); } @SubscribeEvent public void onTickPlayerEvent(PlayerTickEvent event){ if(event.player instanceof PlayerEntity){ PlayerEntity player = (PlayerEntity) event.player; if(player.inventory.hasItemStack(Items.ACACIA_BUTTON.getDefaultInstance())) { player.forceFireTicks(21); } } } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.