Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mod.mcreator;
- import net.minecraftforge.fml.relauncher.SideOnly;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.fml.common.registry.GameRegistry;
- import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
- import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
- import net.minecraftforge.fml.common.event.FMLInitializationEvent;
- import net.minecraft.world.gen.feature.WorldGenMinable;
- import net.minecraft.world.World;
- import net.minecraft.world.IBlockAccess;
- import net.minecraft.world.Explosion;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.util.math.AxisAlignedBB;
- import net.minecraft.util.EnumParticleTypes;
- import net.minecraft.util.EnumHand;
- import net.minecraft.util.EnumFacing;
- import net.minecraft.util.BlockRenderLayer;
- import net.minecraft.item.ItemStack;
- import net.minecraft.item.Item;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.entity.Entity;
- import net.minecraft.client.renderer.block.model.ModelResourceLocation;
- import net.minecraft.client.Minecraft;
- import net.minecraft.block.state.IBlockState;
- import net.minecraft.block.material.Material;
- import net.minecraft.block.SoundType;
- import net.minecraft.block.Block;
- import java.util.Random;
- public class mcreator_nauseOre {
- public mcreator_nauseOre() {
- }
- public static BlockNauseOre block;
- public static Object instance;
- public int addFuel(ItemStack fuel) {
- return 0;
- }
- public void serverLoad(FMLServerStartingEvent event) {
- }
- public void preInit(FMLPreInitializationEvent event) {
- }
- public void registerRenderers() {
- }
- public void load(FMLInitializationEvent event) {
- if (event.getSide() == Side.CLIENT) {
- Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
- .register(Item.getItemFromBlock(block), 0, new ModelResourceLocation("TestEnvironmentMod:NauseOre", "inventory"));
- }
- }
- static {
- block = (BlockNauseOre) (new BlockNauseOre().setHardness(8.0F).setResistance(12.5F).setLightLevel(5.5F).setUnlocalizedName("NauseOre")
- .setLightOpacity(126).setCreativeTab(mcreator_mergingWorldTab.tab));
- block.setHarvestLevel("pickaxe", 3);
- }
- public void generateSurface(World world, java.util.Random rand, int chunkX, int chunkZ) {
- for (int i = 0; i < 6; i++) {
- int randPosX = chunkX + rand.nextInt(16);
- int randPosY = rand.nextInt(128) + 0;
- int randPosZ = chunkZ + rand.nextInt(16);
- (new WorldGenMinable(mcreator_nauseOre.block.getDefaultState(), 8)).generate(world, rand, new BlockPos(randPosX, randPosY, randPosZ));
- }
- }
- public void generateNether(World world, Random random, int chunkX, int chunkZ) {
- }
- static class BlockNauseOre extends Block {
- int a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0;
- boolean red = false;
- protected BlockNauseOre() {
- super(Material.IRON);
- GameRegistry.registerBlock(this, "NauseOre");
- setSoundType(SoundType.STONE);
- }
- @Override
- public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
- int i = pos.getX();
- int j = pos.getY();
- int k = pos.getZ();
- EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
- world.scheduleUpdate(new BlockPos(i, j, k), this, this.tickRate(world));
- }
- @Override
- public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
- return red ? 15 : 0;
- }
- @Override
- public int getStrongPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
- return red ? 15 : 0;
- }
- @Override
- public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock) {
- int i = pos.getX();
- int j = pos.getY();
- int k = pos.getZ();
- EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
- if (world.isBlockIndirectlyGettingPowered(new BlockPos(i, j, k)) > 0) {
- if (true) {
- world.createExplosion((Entity) null, i, j, k, 8F, true);
- }
- }
- }
- @Override
- public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random random) {
- EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
- int i = pos.getX();
- int j = pos.getY();
- int k = pos.getZ();
- World par1World = world;
- int par2 = i;
- int par3 = j;
- int par4 = k;
- Random par5Random = random;
- if (true)
- for (int l = 0; l < 22; ++l) {
- double d0 = (double) ((float) par2 + par5Random.nextFloat());
- double d1 = (double) ((float) par3 + par5Random.nextFloat());
- double d2 = (double) ((float) par4 + par5Random.nextFloat());
- double d3 = 0.0D;
- double d4 = 0.0D;
- double d5 = 0.0D;
- int i1 = par5Random.nextInt(2) * 2 - 1;
- d3 = ((double) par5Random.nextFloat() - 0.5D) * 0.49999999850988386D;
- d4 = ((double) par5Random.nextFloat() - 0.5D) * 0.49999999850988386D;
- d5 = ((double) par5Random.nextFloat() - 0.5D) * 0.49999999850988386D;
- par1World.spawnParticle(EnumParticleTypes.CRIT_MAGIC, d0, d1, d2, d3, d4, d5);
- }
- }
- @Override
- public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state) {
- EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
- int i = pos.getX();
- int j = pos.getY();
- int k = pos.getZ();
- if ((Math.random() * 100) <= 50) {
- world.createExplosion((Entity) null, i, j, k, 4F, true);
- }
- }
- @Override
- public void onBlockDestroyedByExplosion(World world, BlockPos pos, Explosion e) {
- EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
- int i = pos.getX();
- int j = pos.getY();
- int k = pos.getZ();
- if (true) {
- world.createExplosion((Entity) null, i, j, k, 2F, true);
- }
- }
- @Override
- public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
- int i = pos.getX();
- int j = pos.getY();
- int k = pos.getZ();
- if (true) {
- world.createExplosion((Entity) null, i, j, k, 4F, true);
- }
- }
- @Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entity, EnumHand hand, ItemStack heldItem,
- EnumFacing side, float hitX, float hitY, float hitZ) {
- int i = pos.getX();
- int j = pos.getY();
- int k = pos.getZ();
- if (true) {
- world.createExplosion((Entity) null, i, j, k, 4F, true);
- }
- return true;
- }
- @SideOnly(Side.CLIENT)
- @Override
- public BlockRenderLayer getBlockLayer() {
- return BlockRenderLayer.SOLID;
- }
- @Override
- public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
- return new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
- }
- @Override
- public int tickRate(World world) {
- return 10;
- }
- @Override
- public int quantityDropped(Random par1Random) {
- return 1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement