Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

JurassicFixx

Members
  • Joined

  • Last visited

  1. Maybe I did, owell. I will be going and learning java to the best of my ability now. Thank you
  2. Alright, I don't believe I changed anything to do with IBlockState though. As I said, I learned most of what I know off basic YouTube tutorials.
  3. package jurassicfixx.jfmobs.blocks; import java.util.Random; import jurassicfixx.jfmobs.Main; import jurassicfixx.jfmobs.init.BlockInit; import jurassicfixx.jfmobs.init.ItemInit; import jurassicfixx.jfmobs.util.IHasModel; import net.minecraft.block.BlockLilyPad; import net.minecraft.block.BlockDirt; import net.minecraft.block.BlockGrass; import net.minecraft.block.BlockLiquid; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockAlgae extends BlockLilyPad implements IHasModel //indicator jurassicfixx.jfmobs { public static AxisAlignedBB ALGAE_AABB; public BlockAlgae(String name, Material material) { super(); ALGAE_AABB = new AxisAlignedBB(1D, 0.0D, 1D, 0D, 0.09375D, 0D); this.getTickRandomly(); setUnlocalizedName(name); setRegistryName(name); setCreativeTab(Main.jfmobsblocks); BlockInit.BLOCKS.add(this); ItemInit.ITEMS.add(new ItemBlock(this).setRegistryName(this.getRegistryName())); } @Override public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (!worldIn.isRemote) { { worldIn.setBlockState(pos, (IBlockState) BlockInit.ALGAE); } } } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return ItemInit.SWAMP_ALGAE; } public int quantityDropped(IBlockState state, int fortune, Random random) { return random.nextInt(2); } @Override public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { super.onEntityCollidedWithBlock(worldIn, pos, state, entityIn); { worldIn.destroyBlock(new BlockPos(pos), true); } } @Override public void registerModels() { Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 0, "inventory"); } @Override public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { return BlockFaceShape.UNDEFINED; } }
  4. I was cleaning it up and I tested it out, the game crashed - if there is any chance you would like to have a look at the report and help me out some more, please let me know
  5. Thank you, I will work on all of these things. As I said I am very new to Java, and have no idea what I am doing
  6. So I am entirely new to modding, and for the most part I followed relevant tutorials on YouTube to get what I wanted into my mod. However, I haven't been able to get my block to function how I want it to. To get to the point, I have what is essentially a custom lilypad that I want to place on water like a lilypad, and also have it be ticked randomly, and spread to a nearby block above water every time it is ticked. I also want it to break every time an entity comes in contact with it (I have that part more or less working). If anybody could take a look at my code and tell me how to get it to spread correctly, I would appreciate it so much. Thank you. P.s. If any other part of code is required to help, I will be happy to provide it. package jurassicfixx.jfmobs.blocks; import java.util.Random; import jurassicfixx.jfmobs.Main; import jurassicfixx.jfmobs.init.BlockInit; import jurassicfixx.jfmobs.init.ItemInit; import jurassicfixx.jfmobs.util.IHasModel; import net.minecraft.block.BlockLilyPad; import net.minecraft.block.BlockDirt; import net.minecraft.block.BlockGrass; import net.minecraft.block.BlockLiquid; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockAlgae extends BlockLilyPad implements IHasModel //indicator jurassicfixx.jfmobs { public static AxisAlignedBB ALGAE_AABB; public BlockAlgae(String name, Material material) { super(); ALGAE_AABB = new AxisAlignedBB(1D, 0.0D, 1D, 0D, 0.09375D, 0D); this.getTickRandomly(); setUnlocalizedName(name); setRegistryName(name); setCreativeTab(Main.jfmobsblocks); BlockInit.BLOCKS.add(this); ItemInit.ITEMS.add(new ItemBlock(this).setRegistryName(this.getRegistryName())); } @Override public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (!worldIn.isRemote) { if (!worldIn.isAreaLoaded(pos, 3)) return; { { if ((worldIn.getBlockState(pos) == Blocks.WATER)) { worldIn.setBlockState(pos.up(1), (IBlockState) BlockInit.ALGAE); } } } } } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return ItemInit.SWAMP_ALGAE; } public int quantityDropped(IBlockState state, int fortune, Random random) { return random.nextInt(2); } @Override public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { super.onEntityCollidedWithBlock(worldIn, pos, state, entityIn); if (entityIn instanceof Entity) { worldIn.destroyBlock(new BlockPos(pos), true); } } @Override public void registerModels() { Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 0, "inventory"); } @Override public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { return BlockFaceShape.UNDEFINED; } }

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.