Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.11 KB | None | 0 0
  1. package neg2013.acsension.infrastructure;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.HashSet;
  5. import java.util.Random;
  6. import java.util.Set;
  7.  
  8. import cpw.mods.fml.relauncher.Side;
  9. import cpw.mods.fml.relauncher.SideOnly;
  10. import neg2013.acsension.Acsension;
  11. import neg2013.acsension.interfaces.IAc;
  12. import neg2013.acsension.tile_entity.TileEntityCopperChest;
  13. import net.minecraft.block.Block;
  14. import net.minecraft.block.BlockContainer;
  15. import net.minecraft.block.BlockSlab;
  16. import net.minecraft.block.material.Material;
  17. import net.minecraft.client.model.ModelRenderer;
  18. import net.minecraft.client.renderer.texture.IIconRegister;
  19. import net.minecraft.entity.EntityLivingBase;
  20. import net.minecraft.init.Blocks;
  21. import net.minecraft.init.Items;
  22. import net.minecraft.item.Item;
  23. import net.minecraft.item.ItemStack;
  24. import net.minecraft.nbt.NBTTagCompound;
  25. import net.minecraft.nbt.NBTTagList;
  26. import net.minecraft.tileentity.TileEntity;
  27. import net.minecraft.tileentity.TileEntityChest;
  28. import net.minecraft.util.AxisAlignedBB;
  29. import net.minecraft.util.Direction;
  30. import net.minecraft.util.IIcon;
  31. import net.minecraft.util.MathHelper;
  32. import net.minecraft.world.ChunkPosition;
  33. import net.minecraft.world.IBlockAccess;
  34. import net.minecraft.world.World;
  35.  
  36. public class BlockDuct extends BlockEnergyDuctBase implements IAc{
  37.  
  38. //power shit start
  39.  
  40. /*//done
  41. @Override
  42. public int MaxEnergyStored() {
  43.  
  44. return 2;
  45. }
  46.  
  47. //done
  48. @Override
  49. public int EnergyGenerating() {
  50.  
  51. return 0;
  52. }
  53.  
  54. //done
  55. @Override
  56. public boolean canAcceptEnergy() {
  57.  
  58. return true;
  59. }
  60.  
  61. //done
  62. @Override
  63. public boolean canConnectToAc() {
  64.  
  65. return true;
  66. }
  67.  
  68. //done
  69. @Override
  70. public boolean CanGenerateEnergy(int x, int y, int z) {
  71.  
  72. return false;
  73. }
  74.  
  75. //done
  76. @Override
  77. public boolean CanConsumeEnergy() {
  78.  
  79. return false;
  80. }
  81.  
  82. //work needed
  83. @Override
  84. public int EnergyIn(IBlockAccess access, int x, int y, int z, World world) {
  85. int energyIn = EnergyIn(access, x, y, z, world);
  86. Block block = access.getBlock(x, y, z);
  87.  
  88.  
  89. if(block == this && block != Acsension.blockSolarGenny && block != Acsension.blockEnergyCell){
  90.  
  91.  
  92.  
  93.  
  94.  
  95. if (energyIn >= MaxEnergyIn()){
  96. return MaxEnergyIn();
  97. }
  98.  
  99. if (energyIn <= MaxEnergyIn()){
  100. return energyIn;
  101. }
  102.  
  103. }
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110. return 0;
  111. }
  112.  
  113. @Override
  114. public int EnergyStored() {
  115. // TODO Auto-generated method stub
  116. return 0;
  117. }
  118.  
  119. @Override
  120. public int EnergyOut(IBlockAccess access, int x, int y, int z, World world) {
  121.  
  122. int energyIn = EnergyIn(access, x, y, z, world);
  123.  
  124. //if(){}
  125. return EnergyIn(access, x, y, z, world);
  126. }
  127.  
  128. @Override
  129. public int EnergyDraw(IBlockAccess access, int x, int y, int z, World world) {
  130.  
  131. return 0;
  132. }
  133.  
  134. @Override
  135. public int EnergyPush(IBlockAccess access, int x, int y, int z, World world) {
  136.  
  137. return EnergyIn(access, x, y, z, world);
  138. }
  139. */
  140.  
  141. //power shit end
  142.  
  143.  
  144.  
  145.  
  146.  
  147. //connection start
  148. public boolean canConnectDuctTo(IBlockAccess access, int x, int y, int z)
  149. {
  150. Block block = access.getBlock(x, y, z);
  151.  
  152. // return ((IAc) block).canAcceptEnergy();
  153.  
  154. return block != this && block != Acsension.blockDuct && block != Acsension.blockSolarGenny && block != Acsension.blockEnergyCell && block != Acsension.blockRedstoneConverter;
  155. }
  156.  
  157. @Override
  158. public void setBlockBoundsBasedOnState(IBlockAccess access, int x, int y, int z)
  159. {
  160.  
  161.  
  162. boolean flag = this.canConnectDuctTo(access, x, y, z - 1);
  163. boolean flag1 = this.canConnectDuctTo(access, x, y, z + 1);
  164. boolean flag2 = this.canConnectDuctTo(access, x - 1, y, z);
  165. boolean flag3 = this.canConnectDuctTo(access, x + 1, y, z);
  166. boolean flag4 = this.canConnectDuctTo(access, x , y - 1, z);
  167. boolean flag5 = this.canConnectDuctTo(access, x , y + 1, z);
  168.  
  169. float f = 0.25f;
  170. float f1 = 0.75f;
  171. float f2 = 0.25f;
  172. float f3 = 0.75f;
  173. float f4 = 0.25f;
  174. float f5 = 0.75f;
  175.  
  176. if (!flag)
  177. {
  178. f2 = 0.0F;
  179.  
  180. }
  181.  
  182. if (!flag1)
  183. {
  184. f3 = 1.0F;
  185. }
  186. //me
  187. if (!flag4)
  188. {
  189. f4 = 0.0F;
  190. }
  191.  
  192. if (!flag5)
  193. {
  194. f5 = 1.0F;
  195. }
  196. //me
  197. if (!flag2)
  198. {
  199. f = 0.0F;
  200. }
  201.  
  202. if (!flag3)
  203. {
  204. f1 = 1.0F;
  205. }
  206.  
  207. this.setBlockBounds(f, f4, f2, f1, f5, f3);
  208.  
  209.  
  210.  
  211.  
  212.  
  213. }
  214.  
  215.  
  216.  
  217. //connection end
  218.  
  219.  
  220.  
  221.  
  222.  
  223. public BlockDuct(Material material) {
  224. super(material);
  225. this.blockHardness = 2f;
  226. }
  227. public boolean isOpaqueCube(){
  228. return false;
  229. }
  230. public boolean renderAsNormalBlock()
  231. {
  232. return false;
  233. }
  234. @Override
  235. public Block setLightOpacity(int p_149713_1_) {
  236. return super.setLightOpacity(15);
  237. }
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement