added basic block
This commit is contained in:
parent
3dd6ca4697
commit
a2063df069
3 changed files with 78 additions and 0 deletions
73
src/main/java/techreborn/blocks/BlockDistributor.java
Normal file
73
src/main/java/techreborn/blocks/BlockDistributor.java
Normal file
|
@ -0,0 +1,73 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
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.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.util.ItemNBTHelper;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
|
||||
/**
|
||||
* Created by mark on 14/05/16.
|
||||
*/
|
||||
public class BlockDistributor extends Block {
|
||||
|
||||
AxisAlignedBB AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.0625D, 0.9375D);
|
||||
|
||||
public BlockDistributor( ) {
|
||||
super(Material.IRON);
|
||||
setHardness(2f);
|
||||
setUnlocalizedName("techreborn.distributor");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
public static ItemStack getReleaseStack(){
|
||||
ItemStack newStack = new ItemStack(Items.SHIELD);
|
||||
ItemNBTHelper.setString(newStack, "type", "modmuss50");
|
||||
ItemNBTHelper.setBoolean(newStack, "vanilla", false);
|
||||
return newStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) {
|
||||
return NULL_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {
|
||||
if(entityIn instanceof EntityPlayer){
|
||||
EntityPlayer player = (EntityPlayer) entityIn;
|
||||
if(player.getHeldItemOffhand() == null || player.getHeldItemOffhand() != null && player.getHeldItemOffhand().getItem() != Items.SHIELD){
|
||||
player.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, getReleaseStack());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -53,6 +53,7 @@ public class ChargeHud
|
|||
EntityPlayer player = mc.thePlayer;
|
||||
ItemStack armorstack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
ItemStack offHandstack = player.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
|
||||
offHandstack = null;
|
||||
ItemStack stack = mc.thePlayer.inventory.getCurrentItem();
|
||||
|
||||
int y = 5;
|
||||
|
|
|
@ -175,6 +175,7 @@ public class ModBlocks
|
|||
public static Block rubberPlanks;
|
||||
|
||||
public static Block ironFence;
|
||||
public static Block distributor;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
|
@ -439,6 +440,9 @@ public class ModBlocks
|
|||
registerBlock(scrapboxinator, "scrapboxinator");
|
||||
GameRegistry.registerTileEntity(TileScrapboxinator.class, "TileScrapboxinatorTR");
|
||||
|
||||
distributor = new BlockDistributor();
|
||||
registerBlock(distributor, "distributor");
|
||||
|
||||
registerOreDict();
|
||||
Core.logHelper.info("TechReborns Blocks Loaded");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue