Jump to content

MonolinkTV

Members
  • Posts

    24
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

MonolinkTV's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I want to make a manual for my mod but first I cant get it to open a gui and second I want to make it a paged system
  2. Sorry man didnt realize lol Love what your doing
  3. Is there any way to use an obj file from blender to make models?
  4. No errors in the console or errors at all but nothing is spawning Generator Class public class OreGeneratorFTU implements IWorldGenerator{ private WorldGenerator ORE_OVERWORLD_FUTURIUM; private WorldGenerator ORE_OVERWORLD_TITANIUM; private WorldGenerator ORE_OVERWORLD_URANIUM; public OreGeneratorFTU() { ORE_OVERWORLD_FUTURIUM = new WorldGenMinable(ModBlocks.ORE_OVERWORLD_FUTURIUM.getDefaultState(), 9, BlockMatcher.forBlock(Blocks.STONE)); ORE_OVERWORLD_URANIUM = new WorldGenMinable(ModBlocks.ORE_OVERWORLD_URANIUM.getDefaultState(), 5, BlockMatcher.forBlock(Blocks.STONE)); ORE_OVERWORLD_TITANIUM = new WorldGenMinable(ModBlocks.ORE_OVERWORLD_TITANIUM.getDefaultState(), 3, BlockMatcher.forBlock(Blocks.STONE)); } private void runGenerator(WorldGenerator gen, World world, Random rand, int chunkX, int chunkZ, int chance, int minHeight, int maxHeight) { if(minHeight > maxHeight || minHeight < 0 || maxHeight > 256) throw new IllegalArgumentException("Ore Generated Out Of Bounds !!!"); int heightDiff = maxHeight - minHeight +1; for(int i = 0; i < chance; i++) { int x = chunkX * 16 + rand.nextInt(16); int y = minHeight * 16 + rand.nextInt(heightDiff); int z = chunkZ * 16 + rand.nextInt(16); gen.generate(world, rand, new BlockPos(x,y,z)); } } @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.getDimension()) { case -1: break; case 0: runGenerator(ORE_OVERWORLD_FUTURIUM, world, random, chunkX, chunkZ, 50, 40, 100); runGenerator(ORE_OVERWORLD_TITANIUM, world, random, chunkX, chunkZ, 30, 10, 60); runGenerator(ORE_OVERWORLD_URANIUM, world, random, chunkX, chunkZ, 10, 0, 15); break; case 1: break; } } } RegistryHandler package com.mrf.infinityweapons.util.handlers; import com.mrf.infinityweapons.init.ModBlocks; import com.mrf.infinityweapons.init.ModItems; import com.mrf.infinityweapons.init.ModTileEntitys; import com.mrf.infinityweapons.util.IHasModel; import com.mrf.infinityweapons.util.IHasTileEntity; import com.mrf.infinityweapons.worldgen.ores.OreGeneratorFTU; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry; @EventBusSubscriber public class RegistryHandler { @SubscribeEvent public static void onItemRegester(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0])); } @SubscribeEvent public static void onBlockRegister(RegistryEvent.Register<Block> event) { event.getRegistry().registerAll(ModBlocks.BLOCKS.toArray(new Block[0])); } @SubscribeEvent public static void onModelRegister(ModelRegistryEvent event) { for (Item item : ModItems.ITEMS) { if (item instanceof IHasModel) { ((IHasModel) item).registerModels(); } } for (Block block : ModBlocks.BLOCKS) { if (block instanceof IHasModel) { ((IHasModel) block).registerModels(); } } for (TileEntity tileEntity : ModTileEntitys.TILEENTITYS) { if (tileEntity instanceof IHasTileEntity) { ((IHasTileEntity) tileEntity).registerTileEntity(); } } } public static void otherRegistries() { GameRegistry.registerWorldGenerator(new OreGeneratorFTU(), 0); } } Main package com.mrf.infinityweapons; import com.mrf.infinityweapons.proxy.CommonProxy; import com.mrf.infinityweapons.tabs.InfinityWeaponsTab; import com.mrf.infinityweapons.util.Referance; import com.mrf.infinityweapons.util.handlers.GuiHandler; import com.mrf.infinityweapons.util.handlers.RegistryHandler; import net.minecraft.creativetab.CreativeTabs; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.registry.GameRegistry; @Mod(modid = Referance.MOD_ID , name = Referance.NAME , version = Referance.VERSION) public class Main { public static final CreativeTabs infinityweaponstab = new InfinityWeaponsTab("infinityweaponstab"); @Instance public static Main instance; @SidedProxy(clientSide = Referance.CLIENT_PROXY_CLASS , serverSide = Referance.COMMON_PROXY_CLASS) public static CommonProxy proxy; @EventHandler public static void PreInit(FMLPreInitializationEvent event) { RegistryHandler.otherRegistries(); } @EventHandler public static void Init(FMLInitializationEvent event) { NetworkRegistry.INSTANCE.registerGuiHandler(Main.instance, new GuiHandler()); } @EventHandler public static void PostInit(FMLPostInitializationEvent event) { } } Can someone please tell me what im doing wrong
  5. Lol my bad RegistryHandler package com.mrf.infinityweapons.util.handlers; import com.mrf.infinityweapons.init.ModBlocks; import com.mrf.infinityweapons.init.ModItems; import com.mrf.infinityweapons.init.ModTileEntitys; import com.mrf.infinityweapons.util.IHasModel; import com.mrf.infinityweapons.util.IHasTileEntity; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @EventBusSubscriber public class RegistryHandler { @SubscribeEvent public static void onItemRegester(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0])); } @SubscribeEvent public static void onBlockRegister(RegistryEvent.Register<Block> event) { event.getRegistry().registerAll(ModBlocks.BLOCKS.toArray(new Block[0])); } @SubscribeEvent public static void onModelRegister(ModelRegistryEvent event) { for (Item item : ModItems.ITEMS) { if (item instanceof IHasModel) { ((IHasModel) item).registerModels(); } } for (Block block : ModBlocks.BLOCKS) { if (block instanceof IHasModel) { ((IHasModel) block).registerModels(); } } for (TileEntity tileEntity : ModTileEntitys.TILEENTITYS) { if (tileEntity instanceof IHasTileEntity) { ((IHasTileEntity) tileEntity).registerTileEntity(); } } } }
  6. I'm making a list for my ore gen followed Harry's tutorials but this is what I get https://pastebin.com/CYmZ0kUN Here is all the code you should need ModBlocks package com.mrf.infinityweapons.init; import java.util.ArrayList; import java.util.List; import com.mrf.infinityweapons.blocks.BlockBase; import com.mrf.infinityweapons.blocks.Electric_Compressor; import com.mrf.infinityweapons.blocks.FuturiumOre; import com.mrf.infinityweapons.blocks.Lava_Compressor; import com.mrf.infinityweapons.blocks.Tier1_Energy_Cell; import com.mrf.infinityweapons.blocks.Tier2_Energy_Cell; import com.mrf.infinityweapons.blocks.Tier3_Energy_Cell; import com.mrf.infinityweapons.blocks.Tier4_Energy_Cell; import com.mrf.infinityweapons.blocks.Tier5_Energy_Cell; import com.mrf.infinityweapons.blocks.ores.BlockOres; import com.mrf.infinityweapons.blocks.trees.LeavesBase; import com.mrf.infinityweapons.blocks.trees.LogsBase; import com.mrf.infinityweapons.blocks.trees.PlanksBase; import com.mrf.infinityweapons.blocks.trees.SaplingsBase; import net.minecraft.block.Block; import net.minecraft.block.BlockLeaves; import net.minecraft.block.material.Material; public class ModBlocks { public static final List<Block> BLOCKS = new ArrayList<Block>(); //Compressor public static Block LAVA_COMPRESSOR_BLOCK = new Lava_Compressor("lava_compressor_block", Material.ANVIL); public static Block ELECTRIC_COMPRESSOR_BLOCK = new Electric_Compressor("electric_compressor_block", Material.ANVIL); //Bunker Things/Ascetics public static Block REINFORCED_CONCRETE = new BlockBase("reinforced_concrete", Material.ROCK); public static Block CONCRETE = new BlockBase("concrete", Material.ROCK); public static Block MARBLE_BRICK = new BlockBase("marble_brick", Material.ROCK); public static Block CRACKED_MARBLE_BRICK = new BlockBase("cracked_marble_brick", Material.ROCK); public static Block BASAULT_BRICK = new BlockBase("basault_brick", Material.ROCK); //Ores public static Block ORE_OVERWORLD = new BlockOres("ore_overworld", "overworld"); //Energy Cells public static Block TIER1_ENERGY_CELL = new Tier1_Energy_Cell("tier1_energy_cell", Material.ANVIL); public static Block TIER2_ENERGY_CELL = new Tier2_Energy_Cell("tier2_energy_cell", Material.ANVIL); public static Block TIER3_ENERGY_CELL = new Tier3_Energy_Cell("tier3_energy_cell", Material.ANVIL); public static Block TIER4_ENERGY_CELL = new Tier4_Energy_Cell("tier4_energy_cell", Material.ANVIL); public static Block TIER5_ENERGY_CELL = new Tier5_Energy_Cell("tier5_energy_cell", Material.ANVIL); //Variants //Leaves/Log /*public static Block LEAVES = new LeavesBase("leaves"); public static Block LOGS = new LogsBase("logs"); public static Block PLANKS = new PlanksBase("planks"); public static Block SAPLINGS = new SaplingsBase("saplings");*/ } BlockOres package com.mrf.infinityweapons.blocks.ores; import com.mrf.infinityweapons.Main; import com.mrf.infinityweapons.init.ModBlocks; import com.mrf.infinityweapons.init.ModItems; import com.mrf.infinityweapons.items.ItemBlockVariants; import com.mrf.infinityweapons.util.IHasModel; import com.mrf.infinityweapons.util.IMetaName; import com.mrf.infinityweapons.util.handlers.EnumHandler; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; public class BlockOres extends Block implements IHasModel, IMetaName { public static final PropertyEnum<EnumHandler.EnumType> VARIANT = PropertyEnum.<EnumHandler.EnumType>create( "variant", EnumHandler.EnumType.class); private String name, dimension; public BlockOres(String name, String dimension) { super(Material.ROCK); setUnlocalizedName(name); setRegistryName(name); setCreativeTab(Main.infinityweaponstab); setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, EnumHandler.EnumType.URANIUM)); ModBlocks.BLOCKS.add(this); ModItems.ITEMS.add(new ItemBlockVariants(this.setRegistryName(this.getRegistryName()))); this.name = name; this.dimension = dimension; } @Override public int damageDropped(IBlockState state) { return ((EnumHandler.EnumType) state.getValue(VARIANT)).getMeta(); } @Override public int getMetaFromState(IBlockState state) { return ((EnumHandler.EnumType) state.getValue(VARIANT)).getMeta(); } @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(VARIANT, EnumHandler.EnumType.byMetadata(meta)); } @Override public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(Item.getItemFromBlock(this), 1, getMetaFromState(world.getBlockState(pos))); } @Override public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items) { for (EnumHandler.EnumType variant : EnumHandler.EnumType.values()) { items.add(new ItemStack(this, 1, variant.getMeta())); } } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] { VARIANT }); } @Override public String getSpecialName(ItemStack stack) { return EnumHandler.EnumType.values()[stack.getItemDamage()].getName(); } @Override public void registerModels() { for (int i = 0; i < EnumHandler.EnumType.values().length; i++) { Main.proxy.registerVariantRenderer(Item.getItemFromBlock(this), 1, "ore_" + this.dimension + EnumHandler.EnumType.values()[i].getName(), "inventory"); } } } EnumHandler And EnumType package com.mrf.infinityweapons.util.handlers; import com.mrf.infinityweapons.blocks.trees.PlanksBase; import net.minecraft.util.IStringSerializable; public class EnumHandler { public static enum EnumType implements IStringSerializable { URANIUM(0, "uranium"), TITANIUM(1, "titanium"), FUTURIUM(2, "futurium"); private static final EnumType[] META_LOOKUP = new EnumType[values().length]; private final int meta; private final String name, unlocalizedName; private EnumType(int meta, String name) { this(meta, name, name); } private EnumType(int meta, String name, String unlocalizedName) { this.meta = meta; this.name = name; this.unlocalizedName = unlocalizedName; } @Override public String getName() { return this.name; } public int getMeta() { return this.meta; } public String getUnlocalizedName() { return this.unlocalizedName; } @Override public String toString() { return this.name(); } public static EnumType byMetadata(int meta) { return META_LOOKUP[meta]; } static { for (EnumType enumtype : values()) { META_LOOKUP[enumtype.getMeta()] = enumtype; } } } } ClientProxy Then CommonProxy package com.mrf.infinityweapons.proxy; import com.mrf.infinityweapons.util.Referance; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; public class ClientProxy extends CommonProxy { public void registerItemRenderer(Item item, int meta, String id) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), id)); } @Override public void registerVariantRenderer(Item item, int meta, String filename, String id) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(new ResourceLocation(Referance.MOD_ID, filename), "inventory")); } } package com.mrf.infinityweapons.proxy; import com.mrf.infinityweapons.items.ItemBase; import net.minecraft.item.Item; public class CommonProxy { public void registerItemRenderer(Item item, int meta, String id) { } public void registerVariantRenderer(Item item, int meta, String filename, String id) { } } ItemBlockVariants package com.mrf.infinityweapons.items; import com.mrf.infinityweapons.util.IMetaName; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; public class ItemBlockVariants extends ItemBlock { public ItemBlockVariants(Block block) { super(block); setHasSubtypes(true); setMaxDamage(0); } @Override public String getUnlocalizedName(ItemStack stack) { return super.getUnlocalizedName() + "_" + ((IMetaName)this.block).getSpecialName(stack); } @Override public int getMetadata(int damage) { return damage; } } IMetaName package com.mrf.infinityweapons.util; import net.minecraft.item.ItemStack; public interface IMetaName { public String getSpecialName(ItemStack stack); }
  7. I would need more info you mean register them as a single you do it in your preInit NetworkRegistry.INSTANCE.registerGuiHandler(Main.instance, new GuiHandler()); Of course, you would need a GUIHandler package com.mrf.infinityweapons.util.handlers; import com.mrf.infinityweapons.container.Container_Lava_Compressor; import com.mrf.infinityweapons.gui.GUI_Lava_Compressor; import com.mrf.infinityweapons.tileentitys.TileEntity_Lava_Compressor; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.IGuiHandler; public class GuiHandler implements IGuiHandler { public static final int GUINAMEHERE = 0; @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if (ID == GUINAMEHERE) { return new CONTAINERCLASSHERE(player.inventory, (YourTileEntityHere) world.getTileEntity(new BlockPos(x, y, z))); } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if (ID == GUINAMEHERE) { return new GUICLASSHERE(player.inventory, (YourTileEntityHere) world.getTileEntity(new BlockPos(x, y, z))); } return null; } } Just fill in the blanks Hope this helped!
  8. I don't know how the register the generator for generating trees Here is how I registered my ore GameRegistry.registerWorldGenerator(new InfinityWeaponsOreGen(), 0); Here are my classes for the generating part Base Tree Gen Class package com.mrf.infinityweapons.worldgen; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; public abstract class TreeGenBase extends WorldGenerator { public TreeGenBase(boolean notify) { super(notify); } /** * returns whether or not a tree can grow into a block * For example, a tree will not grow into stone */ protected boolean canGrowInto(Block blockType) { Material material = blockType.getDefaultState().getMaterial(); return material == Material.AIR || material == Material.LEAVES || blockType == Blocks.GRASS || blockType == Blocks.DIRT || blockType == Blocks.LOG || blockType == Blocks.LOG2 || blockType == Blocks.SAPLING || blockType == Blocks.VINE; } public void generateSaplings(World worldIn, Random random, BlockPos pos) { } /** * sets dirt at a specific location if it isn't already dirt */ protected void setDirtAt(World worldIn, BlockPos pos) { if (worldIn.getBlockState(pos).getBlock() != Blocks.DIRT) { this.setBlockAndNotifyAdequately(worldIn, pos, Blocks.DIRT.getDefaultState()); } } public boolean isReplaceable(World world, BlockPos pos) { net.minecraft.block.state.IBlockState state = world.getBlockState(pos); return state.getBlock().isAir(state, world, pos) || state.getBlock().isLeaves(state, world, pos) || state.getBlock().isWood(world, pos) || canGrowInto(state.getBlock()); } } Rubber Tree Gen package com.mrf.infinityweapons.worldgen; import java.util.Random; import com.mrf.infinityweapons.blocks.OldRubberTreeLeaves; import com.mrf.infinityweapons.blocks.OldRubberTreeLog; import com.mrf.infinityweapons.init.ModBlocks; import com.mrf.infinityweapons.init.ModLogs; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.IChunkGenerator; import net.minecraftforge.fml.common.IWorldGenerator; public class RubberTreeGen extends TreeGenBase { private static final IBlockState LOG = ModBlocks.RUBBER_TREE_LOG.getDefaultState().withProperty(OldRubberTreeLog.VARIANT, ModLogs.EnumType.RUBBER); private static final IBlockState LEAF = ModBlocks.LEAVES_RUBBER.getDefaultState() .withProperty(OldRubberTreeLeaves.VARIANT, ModLogs.EnumType.RUBBER) .withProperty(OldRubberTreeLeaves.CHECK_DECAY, Boolean.valueOf(false)); private final boolean useExtraRandomHeight; public RubberTreeGen(boolean notify, boolean useExtraRandomHeightIn) { super(notify); this.useExtraRandomHeight = useExtraRandomHeightIn; } @Override public boolean generate(World worldIn, Random rand, BlockPos position) { int i = rand.nextInt(3) + 5; if (this.useExtraRandomHeight) { i += rand.nextInt(7); } boolean flag = true; if (position.getY() >= 1 && position.getY() + i + 1 <= 256) { for (int j = position.getY(); j <= position.getY() + 1 + i; ++j) { int k = 1; if (j == position.getY()) { k = 0; } if (j >= position.getY() + 1 + i - 2) { k = 2; } BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) { for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) { if (j >= 0 && j < worldIn.getHeight()) { if (!this.isReplaceable(worldIn, blockpos$mutableblockpos.setPos(l, j, i1))) { flag = false; } } else { flag = false; } } } } if (!flag) { return false; } else { BlockPos down = position.down(); IBlockState state = worldIn.getBlockState(down); boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) Blocks.SAPLING); if (isSoil && position.getY() < worldIn.getHeight() - i - 1) { state.getBlock().onPlantGrow(state, worldIn, down, position); for (int i2 = position.getY() - 3 + i; i2 <= position.getY() + i; ++i2) { int k2 = i2 - (position.getY() + i); int l2 = 1 - k2 / 2; for (int i3 = position.getX() - l2; i3 <= position.getX() + l2; ++i3) { int j1 = i3 - position.getX(); for (int k1 = position.getZ() - l2; k1 <= position.getZ() + l2; ++k1) { int l1 = k1 - position.getZ(); if (Math.abs(j1) != l2 || Math.abs(l1) != l2 || rand.nextInt(2) != 0 && k2 != 0) { BlockPos blockpos = new BlockPos(i3, i2, k1); IBlockState state2 = worldIn.getBlockState(blockpos); if (state2.getBlock().isAir(state2, worldIn, blockpos) || state2.getBlock().isAir(state2, worldIn, blockpos)) { this.setBlockAndNotifyAdequately(worldIn, blockpos, LEAF); } } } } } for (int j2 = 0; j2 < i; ++j2) { BlockPos upN = position.up(j2); IBlockState state2 = worldIn.getBlockState(upN); if (state2.getBlock().isAir(state2, worldIn, upN) || state2.getBlock().isLeaves(state2, worldIn, upN)) { this.setBlockAndNotifyAdequately(worldIn, position.up(j2), LOG); } } return true; } else { return false; } } } else { return false; } } }
  9. So you said i wasn't getting my blocks position. I did pos.GetX,y and z
  10. private final boolean isOn; And also i am getting my blocks position what do you mean and of course somethings wrong i was asking why
  11. package com.mrf.infinityweapons.blocks; import java.util.Random; import com.mrf.infinityweapons.init.ModBlocks; import com.mrf.infinityweapons.particles.UraniumOreParticles; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class FuturiumOre extends BlockBase { private final boolean isOn; public FuturiumOre(String name, Material material, boolean isOn) { super(name, material); setHardness(1.5F); setResistance(15); setHarvestLevel("pickaxe", 2); if (isOn) { this.setTickRandomly(true); } this.isOn = isOn; } @Override public int tickRate(World worldIn) { return 100; } @Override public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn) { this.activate(worldIn, pos); super.onBlockClicked(worldIn, pos, playerIn); } public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn) { this.activate(worldIn, pos); super.onEntityWalk(worldIn, pos, entityIn); } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { this.activate(worldIn, pos); return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ); } public void activate(World worldIn, BlockPos pos) { this.spawnParticles(worldIn, pos); if (this == ModBlocks.FUTURIUM_ORE.getDefaultState()) { worldIn.setBlockState(pos, ModBlocks.FUTURIUM_ORE_LIT.getDefaultState()); } } public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (this == ModBlocks.FUTURIUM_ORE_LIT.getDefaultState()) { worldIn.setBlockState(pos, ModBlocks.FUTURIUM_ORE.getDefaultState()); } } @SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { if (this.isOn) { this.spawnParticles(worldIn, pos); } } private void spawnParticles(World worldIn, BlockPos pos) { Random random = worldIn.rand; double d0 = 0.0625D; for (int i = 0; i < 6; ++i) { double d1 = (double) ((float) pos.getX() + random.nextFloat()); double d2 = (double) ((float) pos.getY() + random.nextFloat()); double d3 = (double) ((float) pos.getZ() + random.nextFloat()); if (i == 0 && !worldIn.getBlockState(pos.up()).isOpaqueCube()) { d2 = (double) pos.getY() + 0.0625D + 1.0D; } if (i == 1 && !worldIn.getBlockState(pos.down()).isOpaqueCube()) { d2 = (double) pos.getY() - 0.0625D; } if (i == 2 && !worldIn.getBlockState(pos.south()).isOpaqueCube()) { d3 = (double) pos.getZ() + 0.0625D + 1.0D; } if (i == 3 && !worldIn.getBlockState(pos.north()).isOpaqueCube()) { d3 = (double) pos.getZ() - 0.0625D; } if (i == 4 && !worldIn.getBlockState(pos.east()).isOpaqueCube()) { d1 = (double) pos.getX() + 0.0625D + 1.0D; } if (i == 5 && !worldIn.getBlockState(pos.west()).isOpaqueCube()) { d1 = (double) pos.getX() - 0.0625D; } if (d1 < (double) pos.getX() || d1 > (double) (pos.getX() + 1) || d2 < 0.0D || d2 > (double) (pos.getY() + 1) || d3 < (double) pos.getZ() || d3 > (double) (pos.getZ() + 1)) { Minecraft.getMinecraft().effectRenderer.addEffect(UraniumOreParticles.CreateParticle(worldIn, pos.getX(), pos.getY(), pos.getY(), 1f, 0, 0, 1)); //worldIn.spawnParticle(EnumParticleTypes.REDSTONE, d1, d2, d3, -10.0D, 8.0D, -10.0D); } } } } package com.mrf.infinityweapons.particles; import net.minecraft.client.particle.ParticleRedstone; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class UraniumOreParticles extends ParticleRedstone { public UraniumOreParticles(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float f, float p_i46349_8_, float p_i46349_9_, float p_i46349_10_) { super(worldIn, xCoordIn, yCoordIn, zCoordIn, 1.0F, p_i46349_8_, p_i46349_9_, p_i46349_10_); } @Override public boolean shouldDisableDepth() { return false; } public static UraniumOreParticles CreateParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float f, float p_i46349_8_, float p_i46349_9_, float p_i46349_10_) { UraniumOreParticles particle = new UraniumOreParticles(worldIn, xCoordIn, yCoordIn, zCoordIn, 1.0F, p_i46349_8_, p_i46349_9_, p_i46349_10_); ((ParticleRedstone) particle).setParticleTextureIndex(0); float f1 = worldIn.rand.nextFloat() * 0.05F + 0.95F; particle.setRBGColorF(1.0F * f1, 0.91F * f1, 0.46F * f1); return particle; } } Did what you said nothing spawned
  12. Wait Krevik or anyone else were talking about blocks
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.