Guest User

sa

a guest
Jun 8th, 2015
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 23.00 KB | None | 0 0
  1. package com.redenergy.blocks;
  2.  
  3. import cpw.mods.fml.relauncher.Side;
  4. import cpw.mods.fml.relauncher.SideOnly;
  5.  
  6. import java.util.List;
  7. import java.util.Random;
  8.  
  9. import com.redenergy.ModInfo;
  10. import com.redenergy.Register;
  11.  
  12. import net.minecraft.block.Block;
  13. import net.minecraft.block.material.MapColor;
  14. import net.minecraft.client.renderer.texture.IIconRegister;
  15. import net.minecraft.creativetab.CreativeTabs;
  16. import net.minecraft.entity.Entity;
  17. import net.minecraft.entity.EntityLivingBase;
  18. import net.minecraft.entity.player.EntityPlayer;
  19. import net.minecraft.init.Blocks;
  20. import net.minecraft.item.ItemStack;
  21. import net.minecraft.util.AxisAlignedBB;
  22. import net.minecraft.util.IIcon;
  23. import net.minecraft.util.MathHelper;
  24. import net.minecraft.util.MovingObjectPosition;
  25. import net.minecraft.util.Vec3;
  26. import net.minecraft.world.Explosion;
  27. import net.minecraft.world.IBlockAccess;
  28. import net.minecraft.world.World;
  29.  
  30. public class BlockStairs extends Block
  31. {
  32.     private static final int[][] field_150150_a = new int[][] {{2, 6}, {3, 7}, {2, 3}, {6, 7}, {0, 4}, {1, 5}, {0, 1}, {4, 5}};
  33.     private final Block field_150149_b;
  34.     private final int field_150151_M;
  35.     private boolean field_150152_N;
  36.     private int field_150153_O;
  37.     private static final String __OBFID = "CL_00000314";
  38.  
  39.     public BlockStairs(Block p_i45428_1_, int p_i45428_2_, String name)
  40.     {
  41.         super(p_i45428_1_.getMaterial());
  42.         this.setBlockName(name);
  43.         this.setBlockTextureName(ModInfo.MODID+":"+name);
  44.         this.setCreativeTab(Register.Addblocks);
  45.         this.field_150149_b = p_i45428_1_;
  46.         this.field_150151_M = p_i45428_2_;
  47.         this.setStepSound(p_i45428_1_.stepSound);
  48.         this.setLightOpacity(255);
  49.     }
  50.  
  51.     /**
  52.      * Updates the blocks bounds based on its current state. Args: world, x, y, z
  53.      */
  54.     public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_)
  55.     {
  56.         if (this.field_150152_N)
  57.         {
  58.             this.setBlockBounds(0.5F * (float)(this.field_150153_O % 2), 0.5F * (float)(this.field_150153_O / 2 % 2), 0.5F * (float)(this.field_150153_O / 4 % 2), 0.5F + 0.5F * (float)(this.field_150153_O % 2), 0.5F + 0.5F * (float)(this.field_150153_O / 2 % 2), 0.5F + 0.5F * (float)(this.field_150153_O / 4 % 2));
  59.         }
  60.         else
  61.         {
  62.             this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
  63.         }
  64.     }
  65.  
  66.     /**
  67.      * Is this block (a) opaque and (b) a full 1m cube?  This determines whether or not to render the shared face of two
  68.      * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
  69.      */
  70.     public boolean isOpaqueCube()
  71.     {
  72.         return false;
  73.     }
  74.  
  75.     /**
  76.      * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
  77.      */
  78.     public boolean renderAsNormalBlock()
  79.     {
  80.         return false;
  81.     }
  82.  
  83.     /**
  84.      * The type of render function that is called for this block
  85.      */
  86.     public int getRenderType()
  87.     {
  88.         return 10;
  89.     }
  90.  
  91.     public void func_150147_e(IBlockAccess p_150147_1_, int p_150147_2_, int p_150147_3_, int p_150147_4_)
  92.     {
  93.         int l = p_150147_1_.getBlockMetadata(p_150147_2_, p_150147_3_, p_150147_4_);
  94.  
  95.         if ((l & 4) != 0)
  96.         {
  97.             this.setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
  98.         }
  99.         else
  100.         {
  101.             this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
  102.         }
  103.     }
  104.  
  105.     public static boolean func_150148_a(Block p_150148_0_)
  106.     {
  107.         return p_150148_0_ instanceof BlockStairs;
  108.     }
  109.  
  110.     private boolean func_150146_f(IBlockAccess p_150146_1_, int p_150146_2_, int p_150146_3_, int p_150146_4_, int p_150146_5_)
  111.     {
  112.         Block block = p_150146_1_.getBlock(p_150146_2_, p_150146_3_, p_150146_4_);
  113.         return func_150148_a(block) && p_150146_1_.getBlockMetadata(p_150146_2_, p_150146_3_, p_150146_4_) == p_150146_5_;
  114.     }
  115.  
  116.     public boolean func_150145_f(IBlockAccess p_150145_1_, int p_150145_2_, int p_150145_3_, int p_150145_4_)
  117.     {
  118.         int l = p_150145_1_.getBlockMetadata(p_150145_2_, p_150145_3_, p_150145_4_);
  119.         int i1 = l & 3;
  120.         float f = 0.5F;
  121.         float f1 = 1.0F;
  122.  
  123.         if ((l & 4) != 0)
  124.         {
  125.             f = 0.0F;
  126.             f1 = 0.5F;
  127.         }
  128.  
  129.         float f2 = 0.0F;
  130.         float f3 = 1.0F;
  131.         float f4 = 0.0F;
  132.         float f5 = 0.5F;
  133.         boolean flag = true;
  134.         Block block;
  135.         int j1;
  136.         int k1;
  137.  
  138.         if (i1 == 0)
  139.         {
  140.             f2 = 0.5F;
  141.             f5 = 1.0F;
  142.             block = p_150145_1_.getBlock(p_150145_2_ + 1, p_150145_3_, p_150145_4_);
  143.             j1 = p_150145_1_.getBlockMetadata(p_150145_2_ + 1, p_150145_3_, p_150145_4_);
  144.  
  145.             if (func_150148_a(block) && (l & 4) == (j1 & 4))
  146.             {
  147.                 k1 = j1 & 3;
  148.  
  149.                 if (k1 == 3 && !this.func_150146_f(p_150145_1_, p_150145_2_, p_150145_3_, p_150145_4_ + 1, l))
  150.                 {
  151.                     f5 = 0.5F;
  152.                     flag = false;
  153.                 }
  154.                 else if (k1 == 2 && !this.func_150146_f(p_150145_1_, p_150145_2_, p_150145_3_, p_150145_4_ - 1, l))
  155.                 {
  156.                     f4 = 0.5F;
  157.                     flag = false;
  158.                 }
  159.             }
  160.         }
  161.         else if (i1 == 1)
  162.         {
  163.             f3 = 0.5F;
  164.             f5 = 1.0F;
  165.             block = p_150145_1_.getBlock(p_150145_2_ - 1, p_150145_3_, p_150145_4_);
  166.             j1 = p_150145_1_.getBlockMetadata(p_150145_2_ - 1, p_150145_3_, p_150145_4_);
  167.  
  168.             if (func_150148_a(block) && (l & 4) == (j1 & 4))
  169.             {
  170.                 k1 = j1 & 3;
  171.  
  172.                 if (k1 == 3 && !this.func_150146_f(p_150145_1_, p_150145_2_, p_150145_3_, p_150145_4_ + 1, l))
  173.                 {
  174.                     f5 = 0.5F;
  175.                     flag = false;
  176.                 }
  177.                 else if (k1 == 2 && !this.func_150146_f(p_150145_1_, p_150145_2_, p_150145_3_, p_150145_4_ - 1, l))
  178.                 {
  179.                     f4 = 0.5F;
  180.                     flag = false;
  181.                 }
  182.             }
  183.         }
  184.         else if (i1 == 2)
  185.         {
  186.             f4 = 0.5F;
  187.             f5 = 1.0F;
  188.             block = p_150145_1_.getBlock(p_150145_2_, p_150145_3_, p_150145_4_ + 1);
  189.             j1 = p_150145_1_.getBlockMetadata(p_150145_2_, p_150145_3_, p_150145_4_ + 1);
  190.  
  191.             if (func_150148_a(block) && (l & 4) == (j1 & 4))
  192.             {
  193.                 k1 = j1 & 3;
  194.  
  195.                 if (k1 == 1 && !this.func_150146_f(p_150145_1_, p_150145_2_ + 1, p_150145_3_, p_150145_4_, l))
  196.                 {
  197.                     f3 = 0.5F;
  198.                     flag = false;
  199.                 }
  200.                 else if (k1 == 0 && !this.func_150146_f(p_150145_1_, p_150145_2_ - 1, p_150145_3_, p_150145_4_, l))
  201.                 {
  202.                     f2 = 0.5F;
  203.                     flag = false;
  204.                 }
  205.             }
  206.         }
  207.         else if (i1 == 3)
  208.         {
  209.             block = p_150145_1_.getBlock(p_150145_2_, p_150145_3_, p_150145_4_ - 1);
  210.             j1 = p_150145_1_.getBlockMetadata(p_150145_2_, p_150145_3_, p_150145_4_ - 1);
  211.  
  212.             if (func_150148_a(block) && (l & 4) == (j1 & 4))
  213.             {
  214.                 k1 = j1 & 3;
  215.  
  216.                 if (k1 == 1 && !this.func_150146_f(p_150145_1_, p_150145_2_ + 1, p_150145_3_, p_150145_4_, l))
  217.                 {
  218.                     f3 = 0.5F;
  219.                     flag = false;
  220.                 }
  221.                 else if (k1 == 0 && !this.func_150146_f(p_150145_1_, p_150145_2_ - 1, p_150145_3_, p_150145_4_, l))
  222.                 {
  223.                     f2 = 0.5F;
  224.                     flag = false;
  225.                 }
  226.             }
  227.         }
  228.  
  229.         this.setBlockBounds(f2, f, f4, f3, f1, f5);
  230.         return flag;
  231.     }
  232.  
  233.     public boolean func_150144_g(IBlockAccess p_150144_1_, int p_150144_2_, int p_150144_3_, int p_150144_4_)
  234.     {
  235.         int l = p_150144_1_.getBlockMetadata(p_150144_2_, p_150144_3_, p_150144_4_);
  236.         int i1 = l & 3;
  237.         float f = 0.5F;
  238.         float f1 = 1.0F;
  239.  
  240.         if ((l & 4) != 0)
  241.         {
  242.             f = 0.0F;
  243.             f1 = 0.5F;
  244.         }
  245.  
  246.         float f2 = 0.0F;
  247.         float f3 = 0.5F;
  248.         float f4 = 0.5F;
  249.         float f5 = 1.0F;
  250.         boolean flag = false;
  251.         Block block;
  252.         int j1;
  253.         int k1;
  254.  
  255.         if (i1 == 0)
  256.         {
  257.             block = p_150144_1_.getBlock(p_150144_2_ - 1, p_150144_3_, p_150144_4_);
  258.             j1 = p_150144_1_.getBlockMetadata(p_150144_2_ - 1, p_150144_3_, p_150144_4_);
  259.  
  260.             if (func_150148_a(block) && (l & 4) == (j1 & 4))
  261.             {
  262.                 k1 = j1 & 3;
  263.  
  264.                 if (k1 == 3 && !this.func_150146_f(p_150144_1_, p_150144_2_, p_150144_3_, p_150144_4_ - 1, l))
  265.                 {
  266.                     f4 = 0.0F;
  267.                     f5 = 0.5F;
  268.                     flag = true;
  269.                 }
  270.                 else if (k1 == 2 && !this.func_150146_f(p_150144_1_, p_150144_2_, p_150144_3_, p_150144_4_ + 1, l))
  271.                 {
  272.                     f4 = 0.5F;
  273.                     f5 = 1.0F;
  274.                     flag = true;
  275.                 }
  276.             }
  277.         }
  278.         else if (i1 == 1)
  279.         {
  280.             block = p_150144_1_.getBlock(p_150144_2_ + 1, p_150144_3_, p_150144_4_);
  281.             j1 = p_150144_1_.getBlockMetadata(p_150144_2_ + 1, p_150144_3_, p_150144_4_);
  282.  
  283.             if (func_150148_a(block) && (l & 4) == (j1 & 4))
  284.             {
  285.                 f2 = 0.5F;
  286.                 f3 = 1.0F;
  287.                 k1 = j1 & 3;
  288.  
  289.                 if (k1 == 3 && !this.func_150146_f(p_150144_1_, p_150144_2_, p_150144_3_, p_150144_4_ - 1, l))
  290.                 {
  291.                     f4 = 0.0F;
  292.                     f5 = 0.5F;
  293.                     flag = true;
  294.                 }
  295.                 else if (k1 == 2 && !this.func_150146_f(p_150144_1_, p_150144_2_, p_150144_3_, p_150144_4_ + 1, l))
  296.                 {
  297.                     f4 = 0.5F;
  298.                     f5 = 1.0F;
  299.                     flag = true;
  300.                 }
  301.             }
  302.         }
  303.         else if (i1 == 2)
  304.         {
  305.             block = p_150144_1_.getBlock(p_150144_2_, p_150144_3_, p_150144_4_ - 1);
  306.             j1 = p_150144_1_.getBlockMetadata(p_150144_2_, p_150144_3_, p_150144_4_ - 1);
  307.  
  308.             if (func_150148_a(block) && (l & 4) == (j1 & 4))
  309.             {
  310.                 f4 = 0.0F;
  311.                 f5 = 0.5F;
  312.                 k1 = j1 & 3;
  313.  
  314.                 if (k1 == 1 && !this.func_150146_f(p_150144_1_, p_150144_2_ - 1, p_150144_3_, p_150144_4_, l))
  315.                 {
  316.                     flag = true;
  317.                 }
  318.                 else if (k1 == 0 && !this.func_150146_f(p_150144_1_, p_150144_2_ + 1, p_150144_3_, p_150144_4_, l))
  319.                 {
  320.                     f2 = 0.5F;
  321.                     f3 = 1.0F;
  322.                     flag = true;
  323.                 }
  324.             }
  325.         }
  326.         else if (i1 == 3)
  327.         {
  328.             block = p_150144_1_.getBlock(p_150144_2_, p_150144_3_, p_150144_4_ + 1);
  329.             j1 = p_150144_1_.getBlockMetadata(p_150144_2_, p_150144_3_, p_150144_4_ + 1);
  330.  
  331.             if (func_150148_a(block) && (l & 4) == (j1 & 4))
  332.             {
  333.                 k1 = j1 & 3;
  334.  
  335.                 if (k1 == 1 && !this.func_150146_f(p_150144_1_, p_150144_2_ - 1, p_150144_3_, p_150144_4_, l))
  336.                 {
  337.                     flag = true;
  338.                 }
  339.                 else if (k1 == 0 && !this.func_150146_f(p_150144_1_, p_150144_2_ + 1, p_150144_3_, p_150144_4_, l))
  340.                 {
  341.                     f2 = 0.5F;
  342.                     f3 = 1.0F;
  343.                     flag = true;
  344.                 }
  345.             }
  346.         }
  347.  
  348.         if (flag)
  349.         {
  350.             this.setBlockBounds(f2, f, f4, f3, f1, f5);
  351.         }
  352.  
  353.         return flag;
  354.     }
  355.  
  356.     /**
  357.      * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the
  358.      * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity
  359.      */
  360.     public void addCollisionBoxesToList(World p_149743_1_, int p_149743_2_, int p_149743_3_, int p_149743_4_, AxisAlignedBB p_149743_5_, List p_149743_6_, Entity p_149743_7_)
  361.     {
  362.         this.func_150147_e(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_);
  363.         super.addCollisionBoxesToList(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_, p_149743_5_, p_149743_6_, p_149743_7_);
  364.         boolean flag = this.func_150145_f(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_);
  365.         super.addCollisionBoxesToList(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_, p_149743_5_, p_149743_6_, p_149743_7_);
  366.  
  367.         if (flag && this.func_150144_g(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_))
  368.         {
  369.             super.addCollisionBoxesToList(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_, p_149743_5_, p_149743_6_, p_149743_7_);
  370.         }
  371.  
  372.         this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
  373.     }
  374.  
  375.     /**
  376.      * Called when a player hits the block. Args: world, x, y, z, player
  377.      */
  378.     public void onBlockClicked(World p_149699_1_, int p_149699_2_, int p_149699_3_, int p_149699_4_, EntityPlayer p_149699_5_)
  379.     {
  380.         this.field_150149_b.onBlockClicked(p_149699_1_, p_149699_2_, p_149699_3_, p_149699_4_, p_149699_5_);
  381.     }
  382.  
  383.     /**
  384.      * A randomly called display update to be able to add particles or other items for display
  385.      */
  386.     @SideOnly(Side.CLIENT)
  387.     public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_)
  388.     {
  389.         this.field_150149_b.randomDisplayTick(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_, p_149734_5_);
  390.     }
  391.  
  392.     /**
  393.      * Called right before the block is destroyed by a player.  Args: world, x, y, z, metaData
  394.      */
  395.     public void onBlockDestroyedByPlayer(World p_149664_1_, int p_149664_2_, int p_149664_3_, int p_149664_4_, int p_149664_5_)
  396.     {
  397.         this.field_150149_b.onBlockDestroyedByPlayer(p_149664_1_, p_149664_2_, p_149664_3_, p_149664_4_, p_149664_5_);
  398.     }
  399.  
  400.     /**
  401.      * Returns how much this block can resist explosions from the passed in entity.
  402.      */
  403.     public float getExplosionResistance(Entity p_149638_1_)
  404.     {
  405.         return this.field_150149_b.getExplosionResistance(p_149638_1_);
  406.     }
  407.  
  408.     /**
  409.      * How many world ticks before ticking
  410.      */
  411.     public int tickRate(World p_149738_1_)
  412.     {
  413.         return this.field_150149_b.tickRate(p_149738_1_);
  414.     }
  415.  
  416.     /**
  417.      * Can add to the passed in vector for a movement vector to be applied to the entity. Args: x, y, z, entity, vec3d
  418.      */
  419.     public void velocityToAddToEntity(World p_149640_1_, int p_149640_2_, int p_149640_3_, int p_149640_4_, Entity p_149640_5_, Vec3 p_149640_6_)
  420.     {
  421.         this.field_150149_b.velocityToAddToEntity(p_149640_1_, p_149640_2_, p_149640_3_, p_149640_4_, p_149640_5_, p_149640_6_);
  422.     }
  423.  
  424.     /**
  425.      * How bright to render this block based on the light its receiving. Args: iBlockAccess, x, y, z
  426.      */
  427.     @SideOnly(Side.CLIENT)
  428.     public int getMixedBrightnessForBlock(IBlockAccess p_149677_1_, int p_149677_2_, int p_149677_3_, int p_149677_4_)
  429.     {
  430.         return this.field_150149_b.getMixedBrightnessForBlock(p_149677_1_, p_149677_2_, p_149677_3_, p_149677_4_);
  431.     }
  432.  
  433.     /**
  434.      * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha
  435.      */
  436.     @SideOnly(Side.CLIENT)
  437.     public int getRenderBlockPass()
  438.     {
  439.         return this.field_150149_b.getRenderBlockPass();
  440.     }
  441.  
  442.     /**
  443.      * Gets the block's texture. Args: side, meta
  444.      */
  445.     @SideOnly(Side.CLIENT)
  446.     public IIcon getIcon(int p_149691_1_, int p_149691_2_)
  447.     {
  448.         return this.field_150149_b.getIcon(p_149691_1_, this.field_150151_M);
  449.     }
  450.  
  451.     /**
  452.      * Returns the bounding box of the wired rectangular prism to render.
  453.      */
  454.     @SideOnly(Side.CLIENT)
  455.     public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_, int p_149633_4_)
  456.     {
  457.         return this.field_150149_b.getSelectedBoundingBoxFromPool(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_);
  458.     }
  459.  
  460.     /**
  461.      * Returns if this block is collidable (only used by Fire). Args: x, y, z
  462.      */
  463.     public boolean isCollidable()
  464.     {
  465.         return this.field_150149_b.isCollidable();
  466.     }
  467.  
  468.     /**
  469.      * Returns whether this block is collideable based on the arguments passed in
  470.      * @param par1 block metaData
  471.      * @param par2 whether the player right-clicked while holding a boat
  472.      */
  473.     public boolean canCollideCheck(int p_149678_1_, boolean p_149678_2_)
  474.     {
  475.         return this.field_150149_b.canCollideCheck(p_149678_1_, p_149678_2_);
  476.     }
  477.  
  478.     /**
  479.      * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
  480.      */
  481.     public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
  482.     {
  483.         return this.field_150149_b.canPlaceBlockAt(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_);
  484.     }
  485.  
  486.     /**
  487.      * Called whenever the block is added into the world. Args: world, x, y, z
  488.      */
  489.     public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_)
  490.     {
  491.         this.onNeighborBlockChange(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_, Blocks.air);
  492.         this.field_150149_b.onBlockAdded(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_);
  493.     }
  494.  
  495.     public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
  496.     {
  497.         this.field_150149_b.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
  498.     }
  499.  
  500.     /**
  501.      * Called whenever an entity is walking on top of this block. Args: world, x, y, z, entity
  502.      */
  503.     public void onEntityWalking(World p_149724_1_, int p_149724_2_, int p_149724_3_, int p_149724_4_, Entity p_149724_5_)
  504.     {
  505.         this.field_150149_b.onEntityWalking(p_149724_1_, p_149724_2_, p_149724_3_, p_149724_4_, p_149724_5_);
  506.     }
  507.  
  508.     /**
  509.      * Ticks the block if it's been scheduled
  510.      */
  511.     public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
  512.     {
  513.         this.field_150149_b.updateTick(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_);
  514.     }
  515.  
  516.     /**
  517.      * Called upon block activation (right click on the block.)
  518.      */
  519.     public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
  520.     {
  521.         return this.field_150149_b.onBlockActivated(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, p_149727_5_, 0, 0.0F, 0.0F, 0.0F);
  522.     }
  523.  
  524.     /**
  525.      * Called upon the block being destroyed by an explosion
  526.      */
  527.     public void onBlockDestroyedByExplosion(World p_149723_1_, int p_149723_2_, int p_149723_3_, int p_149723_4_, Explosion p_149723_5_)
  528.     {
  529.         this.field_150149_b.onBlockDestroyedByExplosion(p_149723_1_, p_149723_2_, p_149723_3_, p_149723_4_, p_149723_5_);
  530.     }
  531.  
  532.     public MapColor getMapColor(int p_149728_1_)
  533.     {
  534.         return this.field_150149_b.getMapColor(this.field_150151_M);
  535.     }
  536.  
  537.     /**
  538.      * Called when the block is placed in the world.
  539.      */
  540.     public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_)
  541.     {
  542.         int l = MathHelper.floor_double((double)(p_149689_5_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
  543.         int i1 = p_149689_1_.getBlockMetadata(p_149689_2_, p_149689_3_, p_149689_4_) & 4;
  544.  
  545.         if (l == 0)
  546.         {
  547.             p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 2 | i1, 2);
  548.         }
  549.  
  550.         if (l == 1)
  551.         {
  552.             p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 1 | i1, 2);
  553.         }
  554.  
  555.         if (l == 2)
  556.         {
  557.             p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 3 | i1, 2);
  558.         }
  559.  
  560.         if (l == 3)
  561.         {
  562.             p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 0 | i1, 2);
  563.         }
  564.     }
  565.  
  566.     /**
  567.      * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata
  568.      */
  569.     public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
  570.     {
  571.         return p_149660_5_ != 0 && (p_149660_5_ == 1 || (double)p_149660_7_ <= 0.5D) ? p_149660_9_ : p_149660_9_ | 4;
  572.     }
  573.  
  574.     /**
  575.      * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world,
  576.      * x, y, z, startVec, endVec
  577.      */
  578.     public MovingObjectPosition collisionRayTrace(World p_149731_1_, int p_149731_2_, int p_149731_3_, int p_149731_4_, Vec3 p_149731_5_, Vec3 p_149731_6_)
  579.     {
  580.         MovingObjectPosition[] amovingobjectposition = new MovingObjectPosition[8];
  581.         int l = p_149731_1_.getBlockMetadata(p_149731_2_, p_149731_3_, p_149731_4_);
  582.         int i1 = l & 3;
  583.         boolean flag = (l & 4) == 4;
  584.         int[] aint = field_150150_a[i1 + (flag?4:0)];
  585.         this.field_150152_N = true;
  586.         int k1;
  587.         int l1;
  588.         int i2;
  589.  
  590.         for (int j1 = 0; j1 < 8; ++j1)
  591.         {
  592.             this.field_150153_O = j1;
  593.             int[] aint1 = aint;
  594.             k1 = aint.length;
  595.  
  596.             for (l1 = 0; l1 < k1; ++l1)
  597.             {
  598.                 i2 = aint1[l1];
  599.  
  600.                 if (i2 == j1)
  601.                 {
  602.                     ;
  603.                 }
  604.             }
  605.  
  606.             amovingobjectposition[j1] = super.collisionRayTrace(p_149731_1_, p_149731_2_, p_149731_3_, p_149731_4_, p_149731_5_, p_149731_6_);
  607.         }
  608.  
  609.         int[] aint2 = aint;
  610.         int k2 = aint.length;
  611.  
  612.         for (k1 = 0; k1 < k2; ++k1)
  613.         {
  614.             l1 = aint2[k1];
  615.             amovingobjectposition[l1] = null;
  616.         }
  617.  
  618.         MovingObjectPosition movingobjectposition1 = null;
  619.         double d1 = 0.0D;
  620.         MovingObjectPosition[] amovingobjectposition1 = amovingobjectposition;
  621.         i2 = amovingobjectposition.length;
  622.  
  623.         for (int j2 = 0; j2 < i2; ++j2)
  624.         {
  625.             MovingObjectPosition movingobjectposition = amovingobjectposition1[j2];
  626.  
  627.             if (movingobjectposition != null)
  628.             {
  629.                 double d0 = movingobjectposition.hitVec.squareDistanceTo(p_149731_6_);
  630.  
  631.                 if (d0 > d1)
  632.                 {
  633.                     movingobjectposition1 = movingobjectposition;
  634.                     d1 = d0;
  635.                 }
  636.             }
  637.         }
  638.  
  639.         return movingobjectposition1;
  640.     }
  641.  
  642.     @SideOnly(Side.CLIENT)
  643.     public void registerBlockIcons(IIconRegister p_149651_1_) {}
  644. }
Advertisement
Add Comment
Please, Sign In to add comment