Guest User

Untitled

a guest
Aug 8th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.19 KB | None | 0 0
  1. package mod.mcreator;
  2.  
  3. import net.minecraft.world.World;
  4. import net.minecraft.world.IBlockAccess;
  5. import net.minecraft.util.MathHelper;
  6. import net.minecraft.util.IIcon;
  7. import net.minecraft.item.ItemStack;
  8. import net.minecraft.item.Item;
  9. import net.minecraft.init.Items;
  10. import net.minecraft.entity.player.EntityPlayer;
  11. import net.minecraft.creativetab.CreativeTabs;
  12. import net.minecraft.client.renderer.texture.IIconRegister;
  13. import net.minecraft.client.Minecraft;
  14. import net.minecraft.block.material.Material;
  15. import net.minecraft.block.Block;
  16.  
  17. import java.util.Random;
  18.  
  19. import cpw.mods.fml.relauncher.SideOnly;
  20. import cpw.mods.fml.relauncher.Side;
  21. import cpw.mods.fml.common.registry.GameRegistry;
  22. import cpw.mods.fml.common.event.FMLServerStartingEvent;
  23. import cpw.mods.fml.common.event.FMLPreInitializationEvent;
  24.  
  25. public class mcreator_sugarcaneblock {
  26.  
  27. public mcreator_sugarcaneblock() {
  28. }
  29.  
  30. public static BlockSugarcaneblock block;
  31.  
  32. public static Object instance;
  33.  
  34. public int addFuel(ItemStack fuel) {
  35. return 0;
  36. }
  37.  
  38. public void serverLoad(FMLServerStartingEvent event) {
  39. }
  40.  
  41. public void preInit(FMLPreInitializationEvent event) {
  42.  
  43. GameRegistry.registerBlock(block, "Sugarcaneblock");
  44. }
  45.  
  46. public void registerRenderers() {
  47. }
  48.  
  49. public void load() {
  50.  
  51. GameRegistry.addRecipe(new ItemStack(block, 1), new Object[]{"XXX", "X45", "X78", Character.valueOf('4'), new ItemStack(Items.reeds, 1),
  52. Character.valueOf('5'), new ItemStack(Items.reeds, 1), Character.valueOf('7'), new ItemStack(Items.reeds, 1), Character.valueOf('8'),
  53. new ItemStack(Items.reeds, 1),});
  54. }
  55.  
  56. static {
  57.  
  58. block = (BlockSugarcaneblock) (new BlockSugarcaneblock().setHardness(0.25F).setResistance(10.0F).setLightLevel(0.0F)
  59. .setBlockName("Sugarcaneblock").setBlockTextureName("sugarcaneblocktop").setLightOpacity(0).setStepSound(Block.soundTypeWood)
  60. .setCreativeTab(CreativeTabs.tabBlock));
  61. block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
  62. Block.blockRegistry.addObject(178, "Sugarcaneblock", block);
  63. block.setHarvestLevel("axe", 0);
  64. }
  65.  
  66. public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
  67. }
  68.  
  69. public void generateNether(World world, Random random, int chunkX, int chunkZ) {
  70. }
  71.  
  72. static class BlockSugarcaneblock extends Block {
  73.  
  74. int a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0;
  75.  
  76. Random field_149942_b = new Random();
  77.  
  78. IIcon gor = null, dol = null, st1 = null, st2 = null, st3 = null, st4 = null;
  79.  
  80. boolean red = false;
  81.  
  82. protected BlockSugarcaneblock() {
  83. super(Material.wood);
  84.  
  85. }
  86.  
  87. public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entity, ItemStack stack) {
  88. if (entity != null && world != null) {
  89. int le = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
  90. world.setBlockMetadataWithNotify(i, j, k, le, 2);
  91. }
  92.  
  93. world.scheduleBlockUpdate(i, j, k, this, this.tickRate(world));
  94.  
  95. }
  96.  
  97. public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
  98. return red ? 1 : 0;
  99. }
  100.  
  101. @SideOnly(Side.CLIENT)
  102. @Override
  103. public IIcon getIcon(int i, int par2) {
  104.  
  105. if (i == 0)
  106. return gor;
  107.  
  108. else if (i == 1)
  109. return dol;
  110.  
  111. else if (i == 2)
  112. return st1;
  113.  
  114. else if (i == 3)
  115. return st2;
  116.  
  117. else if (i == 4)
  118. return st4;
  119.  
  120. else if (i == 5)
  121. return st3;
  122.  
  123. else
  124. return gor;
  125.  
  126. }
  127.  
  128. @SideOnly(Side.CLIENT)
  129. @Override
  130. public void registerBlockIcons(IIconRegister reg) {
  131. this.gor = reg.registerIcon("sugarcaneblocktop");
  132. this.dol = reg.registerIcon("sugarcaneblock");
  133. this.st1 = reg.registerIcon("sugarcaneblock");
  134. this.st2 = reg.registerIcon("sugarcaneblock");
  135. this.st3 = reg.registerIcon("sugarcaneblock");
  136. this.st4 = reg.registerIcon("sugarcaneblocktop");
  137. }
  138.  
  139. public int getRenderType() {
  140. return 0;
  141. }
  142.  
  143. @Override
  144. public int tickRate(World world) {
  145. return 10;
  146. }
  147.  
  148. public int quantityDropped(Random par1Random) {
  149. return 4;
  150. }
  151.  
  152. public Item getItemDropped(int par1, Random par2Random, int par3) {
  153. return Items.reeds;
  154. }
  155. }
  156. }
Add Comment
Please, Sign In to add comment