Guest User

Untitled

a guest
May 13th, 2015
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 24.94 KB | None | 0 0
  1. package com.paragoncds.firetraces.blocks;
  2.  
  3. import static net.minecraftforge.common.util.ForgeDirection.DOWN;
  4. import static net.minecraftforge.common.util.ForgeDirection.EAST;
  5. import static net.minecraftforge.common.util.ForgeDirection.NORTH;
  6. import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
  7. import static net.minecraftforge.common.util.ForgeDirection.UP;
  8. import static net.minecraftforge.common.util.ForgeDirection.WEST;
  9.  
  10. import java.util.IdentityHashMap;
  11. import java.util.Map.Entry;
  12. import java.util.Random;
  13.  
  14. import net.minecraft.block.Block;
  15. import net.minecraft.block.BlockFire;
  16. import net.minecraft.block.material.MapColor;
  17. import net.minecraft.block.material.Material;
  18. import net.minecraft.client.renderer.texture.IIconRegister;
  19. import net.minecraft.init.Blocks;
  20. import net.minecraft.util.AxisAlignedBB;
  21. import net.minecraft.util.IIcon;
  22. import net.minecraft.world.IBlockAccess;
  23. import net.minecraft.world.World;
  24. import net.minecraftforge.common.util.ForgeDirection;
  25.  
  26. import com.google.common.collect.Maps;
  27.  
  28. import cpw.mods.fml.relauncher.Side;
  29. import cpw.mods.fml.relauncher.SideOnly;
  30.  
  31. public class fireTweak extends BlockFire {
  32.  
  33.     @Deprecated
  34.     private int[] field_149849_a = new int[4096];
  35.     @Deprecated
  36.     private int[] field_149848_b = new int[4096];
  37.     @SideOnly(Side.CLIENT)
  38.     private IIcon[] field_149850_M;
  39.     private static final String __OBFID = "CL_00000245";
  40.  
  41.     public fireTweak()
  42.     {
  43.         super();
  44.         this.setBlockName("fireTweak");
  45.         this.setBlockTextureName("ftmod:fire");
  46.         this.setTickRandomly(true);
  47.     }
  48.  
  49.     public static void func_149843_e()
  50.     {
  51.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.planks), 5, 20);
  52.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.double_wooden_slab), 5, 20);
  53.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.wooden_slab), 5, 20);
  54.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.fence), 5, 20);
  55.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.oak_stairs), 5, 20);
  56.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.birch_stairs), 5, 20);
  57.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.spruce_stairs), 5, 20);
  58.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.jungle_stairs), 5, 20);
  59.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.log), 5, 5);
  60.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.log2), 5, 5);
  61.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.leaves), 30, 60);
  62.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.leaves2), 30, 60);
  63.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.bookshelf), 30, 20);
  64.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.tnt), 15, 100);
  65.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.tallgrass), 60, 100);
  66.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.double_plant), 60, 100);
  67.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.yellow_flower), 60, 100);
  68.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.red_flower), 60, 100);
  69.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.wool), 30, 60);
  70.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.vine), 15, 100);
  71.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.coal_block), 5, 5);
  72.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.hay_block), 60, 20);
  73.         Blocks.fire.func_149842_a(getIdFromBlock(Blocks.carpet), 60, 20);
  74.     }
  75.  
  76.     @Deprecated // Use setFireInfo
  77.     public void func_149842_a(int p_149842_1_, int p_149842_2_, int p_149842_3_)
  78.     {
  79.         this.setFireInfo((Block)Block.blockRegistry.getObjectById(p_149842_1_), p_149842_2_, p_149842_3_);
  80.     }
  81.  
  82.     /**
  83.      * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
  84.      * cleared to be reused)
  85.      */
  86.     public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
  87.     {
  88.         return null;
  89.     }
  90.  
  91.     /**
  92.      * Is this block (a) opaque and (b) a full 1m cube?  This determines whether or not to render the shared face of two
  93.      * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
  94.      */
  95.     public boolean isOpaqueCube()
  96.     {
  97.         return false;
  98.     }
  99.  
  100.     /**
  101.      * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
  102.      */
  103.     public boolean renderAsNormalBlock()
  104.     {
  105.         return false;
  106.     }
  107.  
  108.     /**
  109.      * The type of render function that is called for this block
  110.      */
  111.     public int getRenderType()
  112.     {
  113.         return 3;
  114.     }
  115.  
  116.     /**
  117.      * Returns the quantity of items to drop on block destruction.
  118.      */
  119.     public int quantityDropped(Random p_149745_1_)
  120.     {
  121.         return 0;
  122.     }
  123.  
  124.     /**
  125.      * How many world ticks before ticking
  126.      */
  127.     public int tickRate(World p_149738_1_)
  128.     {
  129.         return 30;
  130.     }
  131.  
  132.     /**
  133.      * Ticks the block if it's been scheduled
  134.      */
  135.     public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
  136.     {
  137.         if (p_149674_1_.getGameRules().getGameRuleBooleanValue("doFireTick"))
  138.         {
  139.             boolean flag = p_149674_1_.getBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_).isFireSource(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, UP);
  140.  
  141.             if (!this.canPlaceBlockAt(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_))
  142.             {
  143.                 p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
  144.             }
  145.  
  146.             if (!flag && p_149674_1_.isRaining() && (p_149674_1_.canLightningStrikeAt(p_149674_2_, p_149674_3_, p_149674_4_) || p_149674_1_.canLightningStrikeAt(p_149674_2_ - 1, p_149674_3_, p_149674_4_) || p_149674_1_.canLightningStrikeAt(p_149674_2_ + 1, p_149674_3_, p_149674_4_) || p_149674_1_.canLightningStrikeAt(p_149674_2_, p_149674_3_, p_149674_4_ - 1) || p_149674_1_.canLightningStrikeAt(p_149674_2_, p_149674_3_, p_149674_4_ + 1)))
  147.             {
  148.                 p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
  149.             }
  150.             else
  151.             {
  152.                 int l = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_);
  153.  
  154.                 if (l < 15)
  155.                 {
  156.                     p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, l + p_149674_5_.nextInt(3) / 2, 4);
  157.                 }
  158.  
  159.                 p_149674_1_.scheduleBlockUpdate(p_149674_2_, p_149674_3_, p_149674_4_, this, this.tickRate(p_149674_1_) + p_149674_5_.nextInt(10));
  160.  
  161.                 if (!flag && !this.canNeighborBurn(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_))
  162.                 {
  163.                     if (!World.doesBlockHaveSolidTopSurface(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_) || l > 3)
  164.                     {
  165.                         p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
  166.                     }
  167.                 }
  168.                 else if (!flag && !this.canCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, UP) && l == 15 && p_149674_5_.nextInt(4) == 0)
  169.                 {
  170.                     p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
  171.                 }
  172.                 else
  173.                 {
  174.                     boolean flag1 = p_149674_1_.isBlockHighHumidity(p_149674_2_, p_149674_3_, p_149674_4_);
  175.                     byte b0 = 0;
  176.  
  177.                     if (flag1)
  178.                     {
  179.                         b0 = -50;
  180.                     }
  181.  
  182.                     this.tryCatchFire(p_149674_1_, p_149674_2_ + 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l, WEST );
  183.                     this.tryCatchFire(p_149674_1_, p_149674_2_ - 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l, EAST );
  184.                     this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, 250 + b0, p_149674_5_, l, UP   );
  185.                     this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, 250 + b0, p_149674_5_, l, DOWN );
  186.                     this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ - 1, 300 + b0, p_149674_5_, l, SOUTH);
  187.                     this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ + 1, 300 + b0, p_149674_5_, l, NORTH);
  188.  
  189.                     for (int i1 = p_149674_2_ - 1; i1 <= p_149674_2_ + 1; ++i1)
  190.                     {
  191.                         for (int j1 = p_149674_4_ - 1; j1 <= p_149674_4_ + 1; ++j1)
  192.                         {
  193.                             for (int k1 = p_149674_3_ - 1; k1 <= p_149674_3_ + 4; ++k1)
  194.                             {
  195.                                 if (i1 != p_149674_2_ || k1 != p_149674_3_ || j1 != p_149674_4_)
  196.                                 {
  197.                                     int l1 = 100;
  198.  
  199.                                     if (k1 > p_149674_3_ + 1)
  200.                                     {
  201.                                         l1 += (k1 - (p_149674_3_ + 1)) * 100;
  202.                                     }
  203.  
  204.                                     int i2 = this.getChanceOfNeighborsEncouragingFire(p_149674_1_, i1, k1, j1);
  205.  
  206.                                     if (i2 > 0)
  207.                                     {
  208.                                         int j2 = (i2 + 40 + p_149674_1_.difficultySetting.getDifficultyId() * 7) / (l + 30);
  209.  
  210.                                         if (flag1)
  211.                                         {
  212.                                             j2 /= 2;
  213.                                         }
  214.  
  215.                                         if (j2 > 0 && p_149674_5_.nextInt(l1) <= j2 && (!p_149674_1_.isRaining() || !p_149674_1_.canLightningStrikeAt(i1, k1, j1)) && !p_149674_1_.canLightningStrikeAt(i1 - 1, k1, p_149674_4_) && !p_149674_1_.canLightningStrikeAt(i1 + 1, k1, j1) && !p_149674_1_.canLightningStrikeAt(i1, k1, j1 - 1) && !p_149674_1_.canLightningStrikeAt(i1, k1, j1 + 1))
  216.                                         {
  217.                                             int k2 = l + p_149674_5_.nextInt(5) / 4;
  218.  
  219.                                             if (k2 > 15)
  220.                                             {
  221.                                                 k2 = 15;
  222.                                             }
  223.  
  224.                                             p_149674_1_.setBlock(i1, k1, j1, this, k2, 3);
  225.                                         }
  226.                                     }
  227.                                 }
  228.                             }
  229.                         }
  230.                     }
  231.                 }
  232.             }
  233.         }
  234.     }
  235.  
  236.     public boolean func_149698_L()
  237.     {
  238.         return false;
  239.     }
  240.  
  241.     /**
  242.      * Tries to set block on fire. Deprecated in favour of side-sensitive version.
  243.      */
  244.     @Deprecated
  245.     private void tryCatchFire(World p_149841_1_, int p_149841_2_, int p_149841_3_, int p_149841_4_, int p_149841_5_, Random p_149841_6_, int p_149841_7_)
  246.     {
  247.         this.tryCatchFire(p_149841_1_, p_149841_2_, p_149841_3_, p_149841_4_, p_149841_5_, p_149841_6_, p_149841_7_, UP);
  248.     }
  249.  
  250.     private void tryCatchFire(World p_149841_1_, int p_149841_2_, int p_149841_3_, int p_149841_4_, int p_149841_5_, Random p_149841_6_, int p_149841_7_, ForgeDirection face)
  251.     {
  252.         int j1 = p_149841_1_.getBlock(p_149841_2_, p_149841_3_, p_149841_4_).getFlammability(p_149841_1_, p_149841_2_, p_149841_3_, p_149841_4_, face);
  253.  
  254.         if (p_149841_6_.nextInt(p_149841_5_) < j1)
  255.         {
  256.             boolean flag = p_149841_1_.getBlock(p_149841_2_, p_149841_3_, p_149841_4_) == Blocks.tnt;
  257.  
  258.             if (p_149841_6_.nextInt(p_149841_7_ + 10) < 5 && !p_149841_1_.canLightningStrikeAt(p_149841_2_, p_149841_3_, p_149841_4_))
  259.             {
  260.                 int k1 = p_149841_7_ + p_149841_6_.nextInt(5) / 4;
  261.  
  262.                 if (k1 > 15)
  263.                 {
  264.                     k1 = 15;
  265.                 }
  266.  
  267.                 p_149841_1_.setBlock(p_149841_2_, p_149841_3_, p_149841_4_, this, k1, 3);
  268.             }
  269.             else
  270.             {
  271.                 p_149841_1_.setBlockToAir(p_149841_2_, p_149841_3_, p_149841_4_);
  272.             }
  273.  
  274.             if (flag)
  275.             {
  276.                 Blocks.tnt.onBlockDestroyedByPlayer(p_149841_1_, p_149841_2_, p_149841_3_, p_149841_4_, 1);
  277.             }
  278.         }
  279.     }
  280.  
  281.     /**
  282.      * Returns true if at least one block next to this one can burn.
  283.      */
  284.     private boolean canNeighborBurn(World p_149847_1_, int p_149847_2_, int p_149847_3_, int p_149847_4_)
  285.     {
  286.         return this.canCatchFire(p_149847_1_, p_149847_2_ + 1, p_149847_3_, p_149847_4_, WEST ) ||
  287.                this.canCatchFire(p_149847_1_, p_149847_2_ - 1, p_149847_3_, p_149847_4_, EAST ) ||
  288.                this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_ - 1, p_149847_4_, UP   ) ||
  289.                this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_ + 1, p_149847_4_, DOWN ) ||
  290.                this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ - 1, SOUTH) ||
  291.                this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ + 1, NORTH);
  292.     }
  293.  
  294.     /**
  295.      * Gets the highest chance of a neighbor block encouraging this block to catch fire
  296.      */
  297.     private int getChanceOfNeighborsEncouragingFire(World p_149845_1_, int p_149845_2_, int p_149845_3_, int p_149845_4_)
  298.     {
  299.         byte b0 = 0;
  300.  
  301.         if (!p_149845_1_.isAirBlock(p_149845_2_, p_149845_3_, p_149845_4_))
  302.         {
  303.             return 0;
  304.         }
  305.         else
  306.         {
  307.             int l = b0;
  308.             l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_ + 1, p_149845_3_, p_149845_4_, l, WEST );
  309.             l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_ - 1, p_149845_3_, p_149845_4_, l, EAST );
  310.             l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_ - 1, p_149845_4_, l, UP   );
  311.             l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_ + 1, p_149845_4_, l, DOWN );
  312.             l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ - 1, l, SOUTH);
  313.             l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ + 1, l, NORTH);
  314.             return l;
  315.         }
  316.     }
  317.  
  318.     /**
  319.      * Returns if this block is collidable (only used by Fire). Args: x, y, z
  320.      */
  321.     public boolean isCollidable()
  322.     {
  323.         return false;
  324.     }
  325.  
  326.     /**
  327.      * Checks the specified block coordinate to see if it can catch fire.  Args: blockAccess, x, y, z
  328.      */
  329.     @Deprecated
  330.     public boolean canBlockCatchFire(IBlockAccess p_149844_1_, int p_149844_2_, int p_149844_3_, int p_149844_4_)
  331.     {
  332.         return canCatchFire(p_149844_1_, p_149844_2_, p_149844_3_, p_149844_4_, UP);
  333.     }
  334.  
  335.     @Deprecated
  336.     public int func_149846_a(World p_149846_1_, int p_149846_2_, int p_149846_3_, int p_149846_4_, int p_149846_5_)
  337.     {
  338.         return getChanceToEncourageFire(p_149846_1_, p_149846_2_, p_149846_3_, p_149846_4_, p_149846_5_, UP);
  339.     }
  340.  
  341.     /**
  342.      * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
  343.      */
  344.     public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
  345.     {
  346.         return World.doesBlockHaveSolidTopSurface(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) || this.canNeighborBurn(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_);
  347.     }
  348.  
  349.     /**
  350.      * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
  351.      * their own) Args: x, y, z, neighbor Block
  352.      */
  353.     public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
  354.     {
  355.         if (!World.doesBlockHaveSolidTopSurface(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_) && !this.canNeighborBurn(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_))
  356.         {
  357.             p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_);
  358.         }
  359.     }
  360.  
  361.     /**
  362.      * Called whenever the block is added into the world. Args: world, x, y, z
  363.      */
  364.     public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_)
  365.     {
  366.         if (p_149726_1_.provider.dimensionId > 0 || !Blocks.portal.func_150000_e(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_))
  367.         {
  368.             if (!World.doesBlockHaveSolidTopSurface(p_149726_1_, p_149726_2_, p_149726_3_ - 1, p_149726_4_) && !this.canNeighborBurn(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_))
  369.             {
  370.                 p_149726_1_.setBlockToAir(p_149726_2_, p_149726_3_, p_149726_4_);
  371.             }
  372.             else
  373.             {
  374.                 p_149726_1_.scheduleBlockUpdate(p_149726_2_, p_149726_3_, p_149726_4_, this, this.tickRate(p_149726_1_) + p_149726_1_.rand.nextInt(10));
  375.             }
  376.         }
  377.     }
  378.  
  379.     /**
  380.      * A randomly called display update to be able to add particles or other items for display
  381.      */
  382.     @SideOnly(Side.CLIENT)
  383.     public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_)
  384.     {
  385.         if (p_149734_5_.nextInt(24) == 0)
  386.         {
  387.             p_149734_1_.playSound((double)((float)p_149734_2_ + 0.5F), (double)((float)p_149734_3_ + 0.5F), (double)((float)p_149734_4_ + 0.5F), "fire.fire", 1.0F + p_149734_5_.nextFloat(), p_149734_5_.nextFloat() * 0.7F + 0.3F, false);
  388.         }
  389.  
  390.         int l;
  391.         float f;
  392.         float f1;
  393.         float f2;
  394.  
  395.         if (!World.doesBlockHaveSolidTopSurface(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_) && !Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_, UP))
  396.         {
  397.             if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_ - 1, p_149734_3_, p_149734_4_, EAST))
  398.             {
  399.                 for (l = 0; l < 2; ++l)
  400.                 {
  401.                     f = (float)p_149734_2_ + p_149734_5_.nextFloat() * 0.1F;
  402.                     f1 = (float)p_149734_3_ + p_149734_5_.nextFloat();
  403.                     f2 = (float)p_149734_4_ + p_149734_5_.nextFloat();
  404.                     p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
  405.                 }
  406.             }
  407.  
  408.             if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_ + 1, p_149734_3_, p_149734_4_, WEST))
  409.             {
  410.                 for (l = 0; l < 2; ++l)
  411.                 {
  412.                     f = (float)(p_149734_2_ + 1) - p_149734_5_.nextFloat() * 0.1F;
  413.                     f1 = (float)p_149734_3_ + p_149734_5_.nextFloat();
  414.                     f2 = (float)p_149734_4_ + p_149734_5_.nextFloat();
  415.                     p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
  416.                 }
  417.             }
  418.  
  419.             if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ - 1, SOUTH))
  420.             {
  421.                 for (l = 0; l < 2; ++l)
  422.                 {
  423.                     f = (float)p_149734_2_ + p_149734_5_.nextFloat();
  424.                     f1 = (float)p_149734_3_ + p_149734_5_.nextFloat();
  425.                     f2 = (float)p_149734_4_ + p_149734_5_.nextFloat() * 0.1F;
  426.                     p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
  427.                 }
  428.             }
  429.  
  430.             if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ + 1, NORTH))
  431.             {
  432.                 for (l = 0; l < 2; ++l)
  433.                 {
  434.                     f = (float)p_149734_2_ + p_149734_5_.nextFloat();
  435.                     f1 = (float)p_149734_3_ + p_149734_5_.nextFloat();
  436.                     f2 = (float)(p_149734_4_ + 1) - p_149734_5_.nextFloat() * 0.1F;
  437.                     p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
  438.                 }
  439.             }
  440.  
  441.             if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ + 1, p_149734_4_, DOWN))
  442.             {
  443.                 for (l = 0; l < 2; ++l)
  444.                 {
  445.                     f = (float)p_149734_2_ + p_149734_5_.nextFloat();
  446.                     f1 = (float)(p_149734_3_ + 1) - p_149734_5_.nextFloat() * 0.1F;
  447.                     f2 = (float)p_149734_4_ + p_149734_5_.nextFloat();
  448.                     p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
  449.                 }
  450.             }
  451.         }
  452.         else
  453.         {
  454.             for (l = 0; l < 3; ++l)
  455.             {
  456.                 f = (float)p_149734_2_ + p_149734_5_.nextFloat();
  457.                 f1 = (float)p_149734_3_ + p_149734_5_.nextFloat() * 0.5F + 0.5F;
  458.                 f2 = (float)p_149734_4_ + p_149734_5_.nextFloat();
  459.                 p_149734_1_.spawnParticle("largesmoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
  460.             }
  461.         }
  462.     }
  463.  
  464.     @SideOnly(Side.CLIENT)
  465.     public void registerBlockIcons(IIconRegister p_149651_1_)
  466.     {
  467.         this.field_149850_M = new IIcon[] {p_149651_1_.registerIcon(this.getTextureName() + "_layer_0"), p_149651_1_.registerIcon(this.getTextureName() + "_layer_1")};
  468.     }
  469.  
  470.     @SideOnly(Side.CLIENT)
  471.     public IIcon getFireIcon(int p_149840_1_)
  472.     {
  473.         return this.field_149850_M[p_149840_1_];
  474.     }
  475.  
  476.     /**
  477.      * Gets the block's texture. Args: side, meta
  478.      */
  479.     @SideOnly(Side.CLIENT)
  480.     public IIcon getIcon(int p_149691_1_, int p_149691_2_)
  481.     {
  482.         return this.field_149850_M[0];
  483.     }
  484.  
  485.     public MapColor getMapColor(int p_149728_1_)
  486.     {
  487.         return MapColor.tntColor;
  488.     }
  489.  
  490.     /*================================= Forge Start ======================================*/
  491.     private static class FireInfo
  492.     {
  493.         private int encouragement = 0;
  494.         private int flammibility = 0;
  495.     }
  496.     private IdentityHashMap<Block, FireInfo> blockInfo = Maps.newIdentityHashMap();
  497.  
  498.     public void setFireInfo(Block block, int encouragement, int flammibility)
  499.     {
  500.         if (block == Blocks.air) throw new IllegalArgumentException("Tried to set air on fire... This is bad.");
  501.         int id = Block.getIdFromBlock(block);
  502.         this.field_149849_a[id] = encouragement;
  503.         this.field_149848_b[id] = flammibility;
  504.  
  505.         FireInfo info = getInfo(block, true);
  506.         info.encouragement = encouragement;
  507.         info.flammibility = flammibility;
  508.     }
  509.  
  510.     private FireInfo getInfo(Block block, boolean garentee)
  511.     {
  512.         FireInfo ret = blockInfo.get(block);
  513.         if (ret == null && garentee)
  514.         {
  515.             ret = new FireInfo();
  516.             blockInfo.put(block, ret);
  517.         }
  518.         return ret;
  519.     }
  520.  
  521.     public void rebuildFireInfo()
  522.     {
  523.         for (int x = 0; x < 4096; x++)
  524.         {
  525.             //If we care.. we could detect changes in here and make sure we keep them, however
  526.             //it's my thinking that anyone who hacks into the private variables should DIAF and we don't care about them.
  527.             field_149849_a[x] = 0;
  528.             field_149848_b[x] = 0;
  529.         }
  530.  
  531.         for (Entry<Block, FireInfo> e : blockInfo.entrySet())
  532.         {
  533.             int id = Block.getIdFromBlock(e.getKey());
  534.             if (id >= 0 && id < 4096)
  535.             {
  536.                 field_149849_a[id] = e.getValue().encouragement;
  537.                 field_149848_b[id] = e.getValue().flammibility;
  538.             }
  539.         }
  540.     }
  541.  
  542.     public int getFlammability(Block block)
  543.     {
  544.         int id = Block.getIdFromBlock(block);
  545.         return id >= 0 && id < 4096 ? field_149848_b[id] : 0;
  546.     }
  547.  
  548.     public int getEncouragement(Block block)
  549.     {
  550.         int id = Block.getIdFromBlock(block);
  551.         return id >= 0 && id < 4096 ? field_149849_a[id] : 0;
  552.     }
  553.  
  554.     /**
  555.      * Side sensitive version that calls the block function.
  556.      *
  557.      * @param world The current world
  558.      * @param x X Position
  559.      * @param y Y Position
  560.      * @param z Z Position
  561.      * @param face The side the fire is coming from
  562.      * @return True if the face can catch fire.
  563.      */
  564.     public boolean canCatchFire(IBlockAccess world, int x, int y, int z, ForgeDirection face)
  565.     {
  566.         return world.getBlock(x, y, z).isFlammable(world, x, y, z, face);
  567.     }
  568.  
  569.     /**
  570.      * Side sensitive version that calls the block function.
  571.      *
  572.      * @param world The current world
  573.      * @param x X Position
  574.      * @param y Y Position
  575.      * @param z Z Position
  576.      * @param oldChance The previous maximum chance.
  577.      * @param face The side the fire is coming from
  578.      * @return The chance of the block catching fire, or oldChance if it is higher
  579.      */
  580.     public int getChanceToEncourageFire(IBlockAccess world, int x, int y, int z, int oldChance, ForgeDirection face)
  581.     {
  582.         int newChance = world.getBlock(x, y, z).getFireSpreadSpeed(world, x, y, z, face);
  583.         return (newChance > oldChance ? newChance : oldChance);
  584.     }
  585.     /*================================= Forge Start ======================================*/
  586.  
  587. }
Advertisement
Add Comment
Please, Sign In to add comment