mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 02:39:05 +00:00
1.7.10 Files
Files added
This commit is contained in:
1 parent
393ea9b463
commit
a31efb2dc3
1768 files changed
+84831
No files matched your search
@@ -0,0 +1,76 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.blocks.tiles.TileBarrel;
|
||||
import noppes.npcs.blocks.tiles.TileNpcContainer;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
|
||||
public class BlockBarrel extends BlockRotated{
|
||||
|
||||
public BlockBarrel() {
|
||||
super(Blocks.planks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
par3List.add(new ItemStack(par1, 1, 2));
|
||||
par3List.add(new ItemStack(par1, 1, 3));
|
||||
par3List.add(new ItemStack(par1, 1, 4));
|
||||
par3List.add(new ItemStack(par1, 1, 5));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int par1){
|
||||
return par1;
|
||||
}
|
||||
|
||||
public int maxRotation(){
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
if(par1World.isRemote)
|
||||
return true;
|
||||
|
||||
par1World.playSoundEffect(i, j + 0.5D, k, "random.chestopen", 0.5F, par1World.rand.nextFloat() * 0.1F + 0.9F);
|
||||
player.openGui(CustomNpcs.instance, EnumGuiType.Crate.ordinal(), par1World, i, j, k);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){
|
||||
super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack);
|
||||
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2) {
|
||||
return new TileBarrel();
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int p_149749_6_){
|
||||
TileNpcContainer tile = (TileNpcContainer)world.getTileEntity(x, y, z);
|
||||
if (tile == null)
|
||||
return;
|
||||
tile.dropItems(world, x, y, z);
|
||||
|
||||
world.func_147453_f(x, y, z, block);
|
||||
super.breakBlock(world, x, y, z, block, p_149749_6_);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user