Guest User

Untitled

a guest
Jul 13th, 2017
96
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. import net.minecraftforge.fml.relauncher.SideOnly;
  4. import net.minecraftforge.fml.relauncher.Side;
  5. import net.minecraftforge.fml.common.registry.GameRegistry;
  6. import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
  7. import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
  8. import net.minecraftforge.fml.common.event.FMLInitializationEvent;
  9.  
  10. import net.minecraft.world.World;
  11. import net.minecraft.world.IBlockAccess;
  12. import net.minecraft.util.math.BlockPos;
  13. import net.minecraft.util.math.AxisAlignedBB;
  14. import net.minecraft.util.EnumParticleTypes;
  15. import net.minecraft.util.EnumFacing;
  16. import net.minecraft.util.BlockRenderLayer;
  17. import net.minecraft.item.ItemStack;
  18. import net.minecraft.item.ItemBlock;
  19. import net.minecraft.item.Item;
  20. import net.minecraft.entity.player.EntityPlayer;
  21. import net.minecraft.client.renderer.block.model.ModelResourceLocation;
  22. import net.minecraft.client.Minecraft;
  23. import net.minecraft.block.state.IBlockState;
  24. import net.minecraft.block.material.Material;
  25. import net.minecraft.block.SoundType;
  26. import net.minecraft.block.Block;
  27.  
  28. import java.util.Random;
  29.  
  30. public class mcreator_litdarklamp {
  31.  
  32. public mcreator_litdarklamp() {
  33. }
  34.  
  35. public static BlockLitdarklamp block;
  36.  
  37. public static Object instance;
  38.  
  39. public int addFuel(ItemStack fuel) {
  40. return 0;
  41. }
  42.  
  43. public void serverLoad(FMLServerStartingEvent event) {
  44. }
  45.  
  46. public void preInit(FMLPreInitializationEvent event) {
  47. block.setRegistryName("litdarklamp");
  48. GameRegistry.register(block);
  49. GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
  50. }
  51.  
  52. public void registerRenderers() {
  53. }
  54.  
  55. public void load(FMLInitializationEvent event) {
  56. if (event.getSide() == Side.CLIENT) {
  57. Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
  58. .register(Item.getItemFromBlock(block), 0, new ModelResourceLocation("testenvironmentmod:litdarklamp", "inventory"));
  59. }
  60. }
  61.  
  62. static {
  63.  
  64. block = (BlockLitdarklamp) (new BlockLitdarklamp().setHardness(2.0F).setResistance(10.0F).setLightLevel(5.0F)
  65. .setUnlocalizedName("Litdarklamp").setLightOpacity(0).setCreativeTab(mcreator_raolblocks.tab));
  66. block.setHarvestLevel("pickaxe", 0);
  67. }
  68.  
  69. public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
  70. }
  71.  
  72. public void generateNether(World world, Random random, int chunkX, int chunkZ) {
  73. }
  74.  
  75. static class BlockLitdarklamp extends Block {
  76.  
  77. int a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0;
  78.  
  79. boolean red = false;
  80.  
  81. protected BlockLitdarklamp() {
  82. super(Material.ROCK);
  83.  
  84. setSoundType(SoundType.STONE);
  85.  
  86. }
  87.  
  88. @Override
  89. public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
  90. int i = pos.getX();
  91. int j = pos.getY();
  92. int k = pos.getZ();
  93. world.scheduleUpdate(new BlockPos(i, j, k), this, this.tickRate(world));
  94.  
  95. }
  96.  
  97. @Override
  98. public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
  99. return red ? 15 : 0;
  100. }
  101.  
  102. @Override
  103. public int getStrongPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
  104. return red ? 15 : 0;
  105. }
  106.  
  107. @Override
  108. public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock, BlockPos fromPos){
  109. super.neighborChanged(state,world,pos,neighborBlock,fromPos);int i = pos.getX();int j = pos.getY();int k = pos.getZ();EntityPlayer entity = Minecraft.getMinecraft().player;
  110. else if(world.isBlockIndirectlyGettingPowered(new BlockPos(i, j, k))<=0){
  111.  
  112. if(true){
  113. world.setBlockState(new BlockPos(i, j, k), mcreator_darklamp.block.getDefaultState(), 3);
  114. }
  115.  
  116. }
  117. }
  118.  
  119. @Override
  120. public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random random) {
  121. EntityPlayer entity = Minecraft.getMinecraft().player;
  122. int i = pos.getX();
  123. int j = pos.getY();
  124. int k = pos.getZ();
  125. World par1World = world;
  126. int par2 = i;
  127. int par3 = j;
  128. int par4 = k;
  129. Random par5Random = random;
  130. if (true)
  131. for (int l = 0; l < 4; ++l) {
  132. double d0 = (double) ((float) par2 + par5Random.nextFloat());
  133. double d1 = (double) ((float) par3 + par5Random.nextFloat());
  134. double d2 = (double) ((float) par4 + par5Random.nextFloat());
  135. double d3 = 0.0D;
  136. double d4 = 0.0D;
  137. double d5 = 0.0D;
  138. int i1 = par5Random.nextInt(2) * 2 - 1;
  139. d3 = ((double) par5Random.nextFloat() - 0.5D) * 0.5D;
  140. d4 = ((double) par5Random.nextFloat() - 0.5D) * 0.5D;
  141. d5 = ((double) par5Random.nextFloat() - 0.5D) * 0.5D;
  142. par1World.spawnParticle(EnumParticleTypes.SPELL, d0, d1, d2, d3, d4, d5);
  143. }
  144.  
  145. }
  146.  
  147. @SideOnly(Side.CLIENT)
  148. @Override
  149. public BlockRenderLayer getBlockLayer() {
  150. return BlockRenderLayer.SOLID;
  151. }
  152.  
  153. @Override
  154. public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
  155. return new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
  156. }
  157.  
  158. @Override
  159. public int tickRate(World world) {
  160. return 10;
  161. }
  162.  
  163. @Override
  164. public int quantityDropped(Random par1Random) {
  165. return 1;
  166. }
  167.  
  168. @Override
  169. public Item getItemDropped(IBlockState state, Random par2Random, int par3) {
  170. return new ItemStack(mcreator_darklamp.block).getItem();
  171. }
  172. }
  173. }
RAW Paste Data