Jump to content

gnosticChemist

Members
  • Posts

    2
  • Joined

  • Last visited

gnosticChemist's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Thanks, it solved. When I see how Flint & Steel put fire I realized that my code doesn't give the flags that the fire need. I still have to verify if the item isn't flying because if is it creates flying fires that sometimes doesn't burn out, but is't work perfectly. Here's the code if anyone is having the same problem: @Override public boolean onEntityItemUpdate(EntityItem entityItem) { BlockPos pos = entityItem.getPosition(); World world = entityItem.world; if(world.isAirBlock(pos) && !world.isAirBlock(pos.down())) { world.setBlockState(entityItem.getPosition(), Blocks.FIRE.getDefaultState(),11); //This line /\ set the fire with the properly flags } return bFull3D; }
  2. I'm trying to do an late game item for my magic mod, it's basically an infinite fuel called Sun Piece. I want to add a feature that when a Sun piece is dropped it set the block on fire, I managed to make the fire appears but there's some weird bugs, it was creating floating fires, also the doesn't burn out and can't hurt mobs. I think that I'm doing something wrong, but since this is my first mod (Not first java) I have no idea. How would I do it properly? Here's Sun Piece class: public class SunPiece extends Item { public SunPiece(){ super(); setUnlocalizedName("sunpiece"); setRegistryName("sunpiece"); setCreativeTab(CreativeTabs.MISC); setMaxStackSize(1); setContainerItem(this); } @Override public int getItemBurnTime(ItemStack itemStack) { return 12800; } @Override public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { if(!entityIn.isBurning()) { entityIn.setFire(10); } } @Override public boolean hasCustomEntity(ItemStack stack) { return true; } @Override public Entity createEntity(World world, Entity location, ItemStack itemstack){ EntityItem item = new EntityItem(world, location.posX, location.posY, location.posZ, itemstack) { @Override public boolean isEntityInvulnerable(DamageSource source) { if(source.isFireDamage())return true; return super.isEntityInvulnerable(source); } }; item.motionX = location.motionX; item.motionY = location.motionY; item.motionZ = location.motionZ; item.isAirBorne = true; item.setDefaultPickupDelay(); return item; } @Override public boolean onEntityItemUpdate(EntityItem entityItem) { World world = entityItem.world; if(world.getBlockState(entityItem.getPosition()) == Blocks.AIR.getDefaultState()) { if(world.getBlockState(entityItem.getPosition().down()) != Blocks.AIR.getDefaultState()) if(entityItem.motionZ == 0 && world.getBlockState(entityItem.getPosition()) != Blocks.FIRE.getDefaultState()) world.setBlockState(entityItem.getPosition(), Blocks.FIRE.getDefaultState()); } return bFull3D; } } I'm doing the fire set on metod onEntityItemUpdate()
×
×
  • Create New...

Important Information

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