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.

Featured Replies

Posted

Basically it is modeled as a normal block instead of being like the spider web, even though it uses the same code from BlocKWeb

 

n7HR1F3.png

 

 

Blocks class

 

package top.mod.block;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.Item;

import net.minecraft.item.ItemBlock;

import net.minecraft.util.ResourceLocation;

import net.minecraftforge.fml.common.registry.GameRegistry;

import top.mod.item.ModItems;

import top.mod.main.Reference;

import top.mod.tab.TopTab;

 

public class ModBlocks {

 

public static BlockBase copperore;

public static BlockBase copperblock;

public static BlockBase copperbars;

 

public static final void preinit(){

copperore = registerBlock(new CopperOre(Material.ROCK), "copperore");

copperblock = registerBlock(new CopperBlock(Material.IRON), "copperblock");

copperbars = registerBlock(new CopperBars(Material.WEB), "copperbars");

}

 

public static final void registerRenders() {

ModItems.registerRender(copperore.i);

ModItems.registerRender(copperblock.i);

ModItems.registerRender(copperbars.i);

}

 

public static final BlockBase registerBlock(BlockBase b, String n){

    ResourceLocation r = new ResourceLocation(Reference.MODID, n);

   

b.setUnlocalizedName(n);

b.setRegistryName®;

b.i = new ItemBlock(b);

b.setCreativeTab(TopTab.toptab);

 

GameRegistry.register(b);

GameRegistry.register(b.i, r);

return b;

 

}

}

 

 

Copperbars class

 

package top.mod.block;

 

import java.util.Random;

 

import javax.annotation.Nullable;

 

import net.minecraft.block.SoundType;

import net.minecraft.block.material.Material;

import net.minecraft.block.state.IBlockState;

import net.minecraft.entity.Entity;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.stats.StatList;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.util.BlockRenderLayer;

import net.minecraft.util.math.AxisAlignedBB;

import net.minecraft.util.math.BlockPos;

import net.minecraft.world.World;

import net.minecraftforge.fml.relauncher.Side;

import net.minecraftforge.fml.relauncher.SideOnly;

import top.mod.item.ModItems;

 

public class CopperBars extends BlockBase {

 

public CopperBars(Material mat) {

super(mat);

 

setHardness(3F);

setResistance(3F);

setHarvestLevel("pickaxe", 0);

this.setSoundType(SoundType.STONE);

 

}

 

 

 

/**

* Called When an Entity Collided with the Block

*/

public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)

{

    entityIn.setInWeb();

}

 

/**

* Used to determine ambient occlusion and culling when rebuilding chunks for render

*/

public boolean isOpaqueCube(IBlockState state)

{

    return false;

}

 

@Nullable

public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos)

{

    return NULL_AABB;

}

 

public boolean isFullCube(IBlockState state)

{

    return false;

}

 

/**

* Get the Item that this Block should drop when harvested.

*/

@Nullable

public Item getItemDropped(IBlockState state, Random rand, int fortune)

{

    return Items.STRING;

}

 

protected boolean canSilkHarvest()

{

    return true;

}

 

@SideOnly(Side.CLIENT)

public BlockRenderLayer getBlockLayer()

{

    return BlockRenderLayer.CUTOUT;

}

 

public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, @Nullable ItemStack stack)

{

    if (!worldIn.isRemote && stack != null && stack.getItem() == Items.SHEARS)

    {

        player.addStat(StatList.getBlockStats(this));

        spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1));

    }

    else

    {

        super.harvestBlock(worldIn, player, pos, state, te, stack);

    }

}

}

 

 

In you copperbars.json be sure to set the parent model as "block/cross".

 

e.g.

 

{
    "parent": "block/cross",
    "textures": {
        "cross": "blocks/web"
    }
}

Look at the model for IronBars

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.