tterrag1098

Untitled

Nov 17th, 2013
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 17.00 KB | None | 0 0
  1. package tterrag.stoneLamp.block;
  2.  
  3. import net.minecraft.block.Block;
  4. import net.minecraft.block.material.Material;
  5. import net.minecraft.client.renderer.texture.IconRegister;
  6. import net.minecraft.entity.player.EntityPlayer;
  7. import net.minecraft.item.Item;
  8. import net.minecraft.item.ItemStack;
  9. import net.minecraft.util.Icon;
  10. import net.minecraft.world.IBlockAccess;
  11. import net.minecraft.world.World;
  12. import tconstruct.common.TContent;
  13. import tterrag.stoneLamp.AkivarMod;
  14. import tterrag.stoneLamp.config.ConfigKeys;
  15. import tterrag.stoneLamp.item.ModItem;
  16. import cpw.mods.fml.common.Loader;
  17. import cpw.mods.fml.relauncher.Side;
  18. import cpw.mods.fml.relauncher.SideOnly;
  19.  
  20. public class BlockLamp extends Block {
  21.    
  22.     private float lightVal;
  23.    
  24.     public BlockLamp(int id, float lightValue, String unlocName) {
  25.         super(id, Material.glass);
  26.         setLightValue(lightValue);
  27.         lightVal = lightValue;
  28.         setUnlocalizedName(unlocName);
  29.         setCreativeTab(AkivarMod.tabStoneLamp);
  30.         setHardness(0.6F);
  31.     }
  32.  
  33.     @SideOnly(Side.CLIENT)
  34.     private Icon icon;
  35.    
  36.     @Override
  37.     public int onBlockPlaced(World world, int x, int y, int z,
  38.             int par5, float par6, float par7, float par8, int par9) {
  39.        
  40.         for (int i = -1; i <= 1; i++)
  41.             for (int j = -1; j <=1; j++)
  42.                 world.markBlockForRenderUpdate(x + i, y, z + i);
  43.        
  44.         return super.onBlockPlaced(world, x, y, z, par5, par6, par7, par8,
  45.                 par9);
  46.     }
  47.    
  48.     /**
  49.      * @author fuj1n (from here down)
  50.      */
  51.     public static Icon[] icons = new Icon[9];
  52.     public static int renderId;
  53.     protected String folder;
  54.  
  55.     /**
  56.      * This is checked to see if the texture should connect to this block
  57.      * @param par2 x
  58.      * @param par3 y
  59.      * @param par4 z
  60.      * @param par5 ID this block is asking to connect to (may be 0 if there is no block)
  61.      * @param par6 Metadata of the block this block is trying to connect to
  62.      * @return true if should connect
  63.      */
  64.     public boolean shouldConnectToBlock (IBlockAccess par1IBlockAccess, int x, int y, int z, int par5, int par6)
  65.     {
  66.         return par5 == this.blockID && par1IBlockAccess.getBlockMetadata(x, y, z) == par6;
  67.     }
  68.  
  69.     @Override
  70.     public Icon getBlockTexture (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
  71.     {
  72.         return getConnectedBlockTexture(par1IBlockAccess, par2, par3, par4, par5, icons);
  73.     }
  74.  
  75.     public Icon getConnectedBlockTexture (IBlockAccess block, int x, int y, int z, int side, Icon[] icons)
  76.     {
  77.         boolean isOpenUp = false, isOpenDown = false, isOpenLeft = false, isOpenRight = false;
  78.  
  79.         if (!ConfigKeys.allowConnectedTextures)
  80.             return icons[0];
  81.        
  82.         switch (side)
  83.         {
  84.         case 0:
  85.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x - 1, y, z), block.getBlockMetadata(x - 1, y, z)))
  86.             {
  87.                 isOpenDown = true;
  88.             }
  89.  
  90.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x + 1, y, z), block.getBlockMetadata(x + 1, y, z)))
  91.             {
  92.                 isOpenUp = true;
  93.             }
  94.  
  95.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x, y, z - 1), block.getBlockMetadata(x, y, z - 1)))
  96.             {
  97.                 isOpenLeft = true;
  98.             }
  99.  
  100.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x, y, z + 1), block.getBlockMetadata(x, y, z + 1)))
  101.             {
  102.                 isOpenRight = true;
  103.             }
  104.            
  105.             if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
  106.             {
  107.                 return icons[15];
  108.             }
  109.             else if (isOpenUp && isOpenDown && isOpenLeft)
  110.             {
  111.                 return icons[11];
  112.             }
  113.             else if (isOpenUp && isOpenDown && isOpenRight)
  114.             {
  115.                 return icons[12];
  116.             }
  117.             else if (isOpenUp && isOpenLeft && isOpenRight)
  118.             {
  119.                 return icons[13];
  120.             }
  121.             else if (isOpenDown && isOpenLeft && isOpenRight)
  122.             {
  123.                 return icons[14];
  124.             }
  125.             else if (isOpenDown && isOpenUp)
  126.             {
  127.                 return icons[5];
  128.             }
  129.             else if (isOpenLeft && isOpenRight)
  130.             {
  131.                 return icons[6];
  132.             }
  133.             else if (isOpenDown && isOpenLeft)
  134.             {
  135.                 return icons[8];
  136.             }
  137.             else if (isOpenDown && isOpenRight)
  138.             {
  139.                 return icons[10];
  140.             }
  141.             else if (isOpenUp && isOpenLeft)
  142.             {
  143.                 return icons[7];
  144.             }
  145.             else if (isOpenUp && isOpenRight)
  146.             {
  147.                 return icons[9];
  148.             }
  149.             else if (isOpenDown)
  150.             {
  151.                 return icons[3];
  152.             }
  153.             else if (isOpenUp)
  154.             {
  155.                 return icons[4];
  156.             }
  157.             else if (isOpenLeft)
  158.             {
  159.                 return icons[2];
  160.             }
  161.             else if (isOpenRight)
  162.             {
  163.                 return icons[1];
  164.             }
  165.             break;
  166.         case 1:
  167.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x - 1, y, z), block.getBlockMetadata(x - 1, y, z)))
  168.             {
  169.                 isOpenDown = true;
  170.             }
  171.  
  172.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x + 1, y, z), block.getBlockMetadata(x + 1, y, z)))
  173.             {
  174.                 isOpenUp = true;
  175.             }
  176.  
  177.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x, y, z - 1), block.getBlockMetadata(x, y, z - 1)))
  178.             {
  179.                 isOpenLeft = true;
  180.             }
  181.  
  182.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x, y, z + 1), block.getBlockMetadata(x, y, z + 1)))
  183.             {
  184.                 isOpenRight = true;
  185.             }
  186.  
  187.             if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
  188.             {
  189.                 return icons[15];
  190.             }
  191.             else if (isOpenUp && isOpenDown && isOpenLeft)
  192.             {
  193.                 return icons[11];
  194.             }
  195.             else if (isOpenUp && isOpenDown && isOpenRight)
  196.             {
  197.                 return icons[12];
  198.             }
  199.             else if (isOpenUp && isOpenLeft && isOpenRight)
  200.             {
  201.                 return icons[13];
  202.             }
  203.             else if (isOpenDown && isOpenLeft && isOpenRight)
  204.             {
  205.                 return icons[14];
  206.             }
  207.             else if (isOpenDown && isOpenUp)
  208.             {
  209.                 return icons[5];
  210.             }
  211.             else if (isOpenLeft && isOpenRight)
  212.             {
  213.                 return icons[6];
  214.             }
  215.             else if (isOpenDown && isOpenLeft)
  216.             {
  217.                 return icons[8];
  218.             }
  219.             else if (isOpenDown && isOpenRight)
  220.             {
  221.                 return icons[10];
  222.             }
  223.             else if (isOpenUp && isOpenLeft)
  224.             {
  225.                 return icons[7];
  226.             }
  227.             else if (isOpenUp && isOpenRight)
  228.             {
  229.                 return icons[9];
  230.             }
  231.             else if (isOpenDown)
  232.             {
  233.                 return icons[3];
  234.             }
  235.             else if (isOpenUp)
  236.             {
  237.                 return icons[4];
  238.             }
  239.             else if (isOpenLeft)
  240.             {
  241.                 return icons[2];
  242.             }
  243.             else if (isOpenRight)
  244.             {
  245.                 return icons[1];
  246.             }
  247.             break;
  248.         case 2:
  249.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x, y - 1, z), block.getBlockMetadata(x, y - 1, z)))
  250.             {
  251.                 isOpenDown = true;
  252.             }
  253.  
  254.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x, y + 1, z), block.getBlockMetadata(x, y + 1, z)))
  255.             {
  256.                 isOpenUp = true;
  257.             }
  258.  
  259.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x - 1, y, z), block.getBlockMetadata(x - 1, y, z)))
  260.             {
  261.                 isOpenLeft = true;
  262.             }
  263.  
  264.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x + 1, y, z), block.getBlockMetadata(x + 1, y, z)))
  265.             {
  266.                 isOpenRight = true;
  267.             }
  268.  
  269.             if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
  270.             {
  271.                 return icons[15];
  272.             }
  273.             else if (isOpenUp && isOpenDown && isOpenLeft)
  274.             {
  275.                 return icons[13];
  276.             }
  277.             else if (isOpenUp && isOpenDown && isOpenRight)
  278.             {
  279.                 return icons[14];
  280.             }
  281.             else if (isOpenUp && isOpenLeft && isOpenRight)
  282.             {
  283.                 return icons[11];
  284.             }
  285.             else if (isOpenDown && isOpenLeft && isOpenRight)
  286.             {
  287.                 return icons[12];
  288.             }
  289.             else if (isOpenDown && isOpenUp)
  290.             {
  291.                 return icons[6];
  292.             }
  293.             else if (isOpenLeft && isOpenRight)
  294.             {
  295.                 return icons[5];
  296.             }
  297.             else if (isOpenDown && isOpenLeft)
  298.             {
  299.                 return icons[9];
  300.             }
  301.             else if (isOpenDown && isOpenRight)
  302.             {
  303.                 return icons[10];
  304.             }
  305.             else if (isOpenUp && isOpenLeft)
  306.             {
  307.                 return icons[7];
  308.             }
  309.             else if (isOpenUp && isOpenRight)
  310.             {
  311.                 return icons[8];
  312.             }
  313.             else if (isOpenDown)
  314.             {
  315.                 return icons[1];
  316.             }
  317.             else if (isOpenUp)
  318.             {
  319.                 return icons[2];
  320.             }
  321.             else if (isOpenLeft)
  322.             {
  323.                 return icons[4];
  324.             }
  325.             else if (isOpenRight)
  326.             {
  327.                 return icons[3];
  328.             }
  329.             break;
  330.         case 3:
  331.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x, y - 1, z), block.getBlockMetadata(x, y - 1, z)))
  332.             {
  333.                 isOpenDown = true;
  334.             }
  335.  
  336.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x, y + 1, z), block.getBlockMetadata(x, y + 1, z)))
  337.             {
  338.                 isOpenUp = true;
  339.             }
  340.  
  341.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x - 1, y, z), block.getBlockMetadata(x - 1, y, z)))
  342.             {
  343.                 isOpenLeft = true;
  344.             }
  345.  
  346.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x + 1, y, z), block.getBlockMetadata(x + 1, y, z)))
  347.             {
  348.                 isOpenRight = true;
  349.             }
  350.  
  351.             if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
  352.             {
  353.                 return icons[15];
  354.             }
  355.             else if (isOpenUp && isOpenDown && isOpenLeft)
  356.             {
  357.                 return icons[14];
  358.             }
  359.             else if (isOpenUp && isOpenDown && isOpenRight)
  360.             {
  361.                 return icons[13];
  362.             }
  363.             else if (isOpenUp && isOpenLeft && isOpenRight)
  364.             {
  365.                 return icons[11];
  366.             }
  367.             else if (isOpenDown && isOpenLeft && isOpenRight)
  368.             {
  369.                 return icons[12];
  370.             }
  371.             else if (isOpenDown && isOpenUp)
  372.             {
  373.                 return icons[6];
  374.             }
  375.             else if (isOpenLeft && isOpenRight)
  376.             {
  377.                 return icons[5];
  378.             }
  379.             else if (isOpenDown && isOpenLeft)
  380.             {
  381.                 return icons[10];
  382.             }
  383.             else if (isOpenDown && isOpenRight)
  384.             {
  385.                 return icons[9];
  386.             }
  387.             else if (isOpenUp && isOpenLeft)
  388.             {
  389.                 return icons[8];
  390.             }
  391.             else if (isOpenUp && isOpenRight)
  392.             {
  393.                 return icons[7];
  394.             }
  395.             else if (isOpenDown)
  396.             {
  397.                 return icons[1];
  398.             }
  399.             else if (isOpenUp)
  400.             {
  401.                 return icons[2];
  402.             }
  403.             else if (isOpenLeft)
  404.             {
  405.                 return icons[3];
  406.             }
  407.             else if (isOpenRight)
  408.             {
  409.                 return icons[4];
  410.             }
  411.             break;
  412.         case 4:
  413.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x, y - 1, z), block.getBlockMetadata(x, y - 1, z)))
  414.             {
  415.                 isOpenDown = true;
  416.             }
  417.  
  418.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x, y + 1, z), block.getBlockMetadata(x, y + 1, z)))
  419.             {
  420.                 isOpenUp = true;
  421.             }
  422.  
  423.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x, y, z - 1), block.getBlockMetadata(x, y, z - 1)))
  424.             {
  425.                 isOpenLeft = true;
  426.             }
  427.  
  428.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x, y, z + 1), block.getBlockMetadata(x, y, z + 1)))
  429.             {
  430.                 isOpenRight = true;
  431.             }
  432.  
  433.             if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
  434.             {
  435.                 return icons[15];
  436.             }
  437.             else if (isOpenUp && isOpenDown && isOpenLeft)
  438.             {
  439.                 return icons[14];
  440.             }
  441.             else if (isOpenUp && isOpenDown && isOpenRight)
  442.             {
  443.                 return icons[13];
  444.             }
  445.             else if (isOpenUp && isOpenLeft && isOpenRight)
  446.             {
  447.                 return icons[11];
  448.             }
  449.             else if (isOpenDown && isOpenLeft && isOpenRight)
  450.             {
  451.                 return icons[12];
  452.             }
  453.             else if (isOpenDown && isOpenUp)
  454.             {
  455.                 return icons[6];
  456.             }
  457.             else if (isOpenLeft && isOpenRight)
  458.             {
  459.                 return icons[5];
  460.             }
  461.             else if (isOpenDown && isOpenLeft)
  462.             {
  463.                 return icons[10];
  464.             }
  465.             else if (isOpenDown && isOpenRight)
  466.             {
  467.                 return icons[9];
  468.             }
  469.             else if (isOpenUp && isOpenLeft)
  470.             {
  471.                 return icons[8];
  472.             }
  473.             else if (isOpenUp && isOpenRight)
  474.             {
  475.                 return icons[7];
  476.             }
  477.             else if (isOpenDown)
  478.             {
  479.                 return icons[1];
  480.             }
  481.             else if (isOpenUp)
  482.             {
  483.                 return icons[2];
  484.             }
  485.             else if (isOpenLeft)
  486.             {
  487.                 return icons[3];
  488.             }
  489.             else if (isOpenRight)
  490.             {
  491.                 return icons[4];
  492.             }
  493.             break;
  494.         case 5:
  495.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x, y - 1, z), block.getBlockMetadata(x, y - 1, z)))
  496.             {
  497.                 isOpenDown = true;
  498.             }
  499.  
  500.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x, y + 1, z), block.getBlockMetadata(x, y + 1, z)))
  501.             {
  502.                 isOpenUp = true;
  503.             }
  504.  
  505.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x, y, z - 1), block.getBlockMetadata(x, y, z - 1)))
  506.             {
  507.                 isOpenLeft = true;
  508.             }
  509.  
  510.             if (shouldConnectToBlock(block, x, y, z, block.getBlockId(x, y, z + 1), block.getBlockMetadata(x, y, z + 1)))
  511.             {
  512.                 isOpenRight = true;
  513.             }
  514.  
  515.             if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight)
  516.             {
  517.                 return icons[15];
  518.             }
  519.             else if (isOpenUp && isOpenDown && isOpenLeft)
  520.             {
  521.                 return icons[13];
  522.             }
  523.             else if (isOpenUp && isOpenDown && isOpenRight)
  524.             {
  525.                 return icons[14];
  526.             }
  527.             else if (isOpenUp && isOpenLeft && isOpenRight)
  528.             {
  529.                 return icons[11];
  530.             }
  531.             else if (isOpenDown && isOpenLeft && isOpenRight)
  532.             {
  533.                 return icons[12];
  534.             }
  535.             else if (isOpenDown && isOpenUp)
  536.             {
  537.                 return icons[6];
  538.             }
  539.             else if (isOpenLeft && isOpenRight)
  540.             {
  541.                 return icons[5];
  542.             }
  543.             else if (isOpenDown && isOpenLeft)
  544.             {
  545.                 return icons[9];
  546.             }
  547.             else if (isOpenDown && isOpenRight)
  548.             {
  549.                 return icons[10];
  550.             }
  551.             else if (isOpenUp && isOpenLeft)
  552.             {
  553.                 return icons[7];
  554.             }
  555.             else if (isOpenUp && isOpenRight)
  556.             {
  557.                 return icons[8];
  558.             }
  559.             else if (isOpenDown)
  560.             {
  561.                 return icons[1];
  562.             }
  563.             else if (isOpenUp)
  564.             {
  565.                 return icons[2];
  566.             }
  567.             else if (isOpenLeft)
  568.             {
  569.                 return icons[4];
  570.             }
  571.             else if (isOpenRight)
  572.             {
  573.                 return icons[3];
  574.             }
  575.             break;
  576.         }
  577.  
  578.         return icons[0];
  579.     }
  580.  
  581.     @Override
  582.     public Icon getIcon (int par1, int par2)
  583.     {
  584.         return icons[0];
  585.     }
  586.  
  587.     @Override
  588.     public void registerIcons (IconRegister par1IconRegister)
  589.     {
  590.         icons[0] = par1IconRegister.registerIcon("akivarmod:topBorder");
  591.         icons[1] = par1IconRegister.registerIcon("akivarmod:rightBorder");
  592.         icons[2] = par1IconRegister.registerIcon("akivarmod:bottomBorder");
  593.         icons[3] = par1IconRegister.registerIcon("akivarmod:leftBorder");
  594.         icons[4] = par1IconRegister.registerIcon("akivarmod:topLeftCorner");
  595.         icons[5] = par1IconRegister.registerIcon("akivarmod:bottomLeftCorner");
  596.         icons[6] = par1IconRegister.registerIcon("akivarmod:bottomRightCorner");
  597.         icons[7] = par1IconRegister.registerIcon("akivarmod:topRightCorner");
  598.         icons[8] = par1IconRegister.registerIcon("akivarmod:lamp_full");
  599.         //icons[9] = par1IconRegister.registerIcon("akivarmod:lamp_ul");
  600.         //icons[10] = par1IconRegister.registerIcon("akivarmod:lamp_dl");
  601.         //icons[11] = par1IconRegister.registerIcon("akivarmod:lamp_di");
  602.         //icons[12] = par1IconRegister.registerIcon("akivarmod:lamp_ui");
  603.         //icons[13] = par1IconRegister.registerIcon("akivarmod:lamp_li");
  604.         //icons[14] = par1IconRegister.registerIcon("akivarmod:lamp_ri");
  605.         //icons[15] = par1IconRegister.registerIcon("akivarmod:lamp_full");
  606.     }
  607.  
  608.     @Override
  609.     public boolean canPlaceTorchOnTop (World world, int x, int y, int z)
  610.     {
  611.         return true;
  612.     }
  613.    
  614.     @Override
  615.     public int getBlockColor() {
  616.         if (lightVal == 0.0F)
  617.             return (180 << 16) | (180 << 8) | 180;
  618.         else return (255 << 16) | (255 << 8) | 255;
  619.     }
  620.    
  621.     @Override
  622.     public int getRenderColor(int par1) {
  623.         return getBlockColor();
  624.     }
  625.    
  626.     @Override
  627.     public void onBlockClicked(World world, int x, int y, int z,
  628.             EntityPlayer player) {
  629.         if (!world.isRemote && player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().itemID == (ModItem.CONNECTOR_ID + 256) && (this.blockID == ModBlock.COLOREDLAMP_ID || this.blockID == ModBlock.LAMP_ID) && player.isSneaking())
  630.         {
  631.             int id = world.getBlockId(x, y, z) == ModBlock.COLOREDLAMP_ID ? ModBlock.EMPTYCOLOREDLAMP_ID : ModBlock.EMPTYLAMP_ID;
  632.             int meta = world.getBlockMetadata(x, y, z);
  633.             world.setBlock(x, y, z, id);
  634.             world.setBlockMetadataWithNotify(x, y, z, meta, 3);
  635.             if (!player.inventory.addItemStackToInventory(new ItemStack(Block.torchWood, 1)))
  636.                 player.dropItem(Block.torchWood.blockID, 1);
  637.         }
  638.         super.onBlockClicked(world, x, y, z, player);
  639.     }
  640.    
  641.     @Override
  642.     public boolean onBlockActivated(World world, int x, int y,
  643.             int z, EntityPlayer player, int par6, float par7,
  644.             float par8, float par9) {
  645.         if (player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().itemID == Block.torchWood.blockID && (this.blockID == ModBlock.EMPTYCOLOREDLAMP_ID || this.blockID == ModBlock.EMPTYLAMP_ID) && !player.isSneaking())
  646.         {
  647.             int id = world.getBlockId(x, y, z) == ModBlock.EMPTYCOLOREDLAMP_ID ? ModBlock.COLOREDLAMP_ID : ModBlock.LAMP_ID;
  648.             int meta = world.getBlockMetadata(x, y, z);
  649.             world.setBlock(x, y, z, id);
  650.             world.setBlockMetadataWithNotify(x, y, z, meta, 3);
  651.             player.inventory.getCurrentItem().stackSize--;
  652.             return true;
  653.         }
  654.         else if (Loader.isModLoaded("TConstruct") && player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().itemID == TContent.stoneTorch.blockID && (this.blockID == ModBlock.EMPTYCOLOREDLAMP_ID || this.blockID == ModBlock.EMPTYLAMP_ID) && !player.isSneaking())
  655.         {
  656.             int id = world.getBlockId(x, y, z) == ModBlock.EMPTYCOLOREDLAMP_ID ? ModBlock.COLOREDLAMP_ID : ModBlock.LAMP_ID;
  657.             int meta = world.getBlockMetadata(x, y, z);
  658.             world.setBlock(x, y, z, id);
  659.             world.setBlockMetadataWithNotify(x, y, z, meta, 3);
  660.             player.inventory.getCurrentItem().stackSize--;
  661.             return true;
  662.         }
  663.         else if (player.inventory.getCurrentItem().itemID == Item.bucketWater.itemID || player.inventory.getCurrentItem().itemID == Item.bucketEmpty.itemID)
  664.             return true;
  665.         else return super.onBlockActivated(world, x, y, z, player, par6, par7, par8, par9);
  666.     }
  667.    
  668.     @Override
  669.     public boolean isBlockSolidOnSide(World world, int x, int y, int z, net.minecraftforge.common.ForgeDirection side) {
  670.         return true;
  671.     };
  672.    
  673.     @Override
  674.     public int getRenderType() {
  675.         return renderId;
  676.     }
  677. }
Advertisement
Add Comment
Please, Sign In to add comment