Jump to content

Scriph

Members
  • Posts

    8
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Scriph's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Okay, so I am trying to make a custom furnace, and make it faster. It works, just wont get faster. blockFile: http://pastebin.com/N6NPCqRu tileFile: http://pastebin.com/MZBtkeDp
  2. I'm not making a clone, just this will be a feature.
  3. Before I start, code will NOT be formatted. BBcode is not working for me. My code runs multiple times sometimes. When I break a block, sometimes it does 2 things. I wan't it to only do 1 thing. It randomly happens. Read all the code before replying. Thanks in advance! package com.scriph.luckybox.blocks; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.command.ICommandManager; import net.minecraft.command.ICommandSender; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.IChatComponent; import net.minecraft.world.World; public class blockLuckyBlock extends Block{ int randomWithRange(int min, int max){ int range = (max - min) + 1; return (int)(Math.random() * range) + min; } public blockLuckyBlock(){ super(Material.rock); this.setCreativeTab(CreativeTabs.tabBlock); this.setBlockName("luckyboxblock"); this.setCreativeTab(CreativeTabs.tabBlock); this.setBlockTextureName("luckybox:lucky_box"); this.setResistance(1000); } public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta) { MinecraftServer minecraftserver = MinecraftServer.getServer(); ICommandManager icommandmanager = minecraftserver.getCommandManager(); ICommandSender thisi = minecraftserver; int jf=randomWithRange(3,7); switch (jf) { case 3: jf=3; icommandmanager.executeCommand(thisi,"/give @p minecraft:dirt 1"); break; case 4: jf=4; icommandmanager.executeCommand(thisi,"/give @p minecraft:diamond "+randomWithRange(3,34)); break; case 5: jf=5; Entity gravel = EntityList.createEntityByID(2, world); gravel.setPosition(x, y, z); world.spawnEntityInWorld(gravel); Entity gravelz = EntityList.createEntityByID(2, world); gravelz.setPosition(x, y, z); world.spawnEntityInWorld(gravelz); break; case 6: jf=6; Entity gravel1 = EntityList.createEntityByID(50, world); gravel1.setPosition(x, y, z); world.spawnEntityInWorld(gravel1); Entity gravel2 = EntityList.createEntityByID(50, world); gravel2.setPosition(x, y, z); world.spawnEntityInWorld(gravel2); world.spawnEntityInWorld(gravel2); world.spawnEntityInWorld(gravel2); world.spawnEntityInWorld(gravel2); world.spawnEntityInWorld(gravel2); break; case 7: jf=7; Entity EntityTNTPrimed = EntityList.createEntityByID(20, world); EntityTNTPrimed.setPosition(x, y, z); world.spawnEntityInWorld(EntityTNTPrimed); Entity EntityTNTPrimedz = EntityList.createEntityByID(20, world); EntityTNTPrimedz.setPosition(x-3, y, z); world.spawnEntityInWorld(EntityTNTPrimedz); Entity EntityTNTPrimedm = EntityList.createEntityByID(20, world); EntityTNTPrimedm.setPosition(x+3, y, z); world.spawnEntityInWorld(EntityTNTPrimedm); Entity EntityTNTPrimedz1 = EntityList.createEntityByID(20, world); EntityTNTPrimedz1.setPosition(x, y, z-3); world.spawnEntityInWorld(EntityTNTPrimedz1); Entity EntityTNTPrimedz2 = EntityList.createEntityByID(20, world); EntityTNTPrimedz2.setPosition(x, y, z+3); world.spawnEntityInWorld(EntityTNTPrimedz2); break; }return;}}
  4. @anon What is the player param... How do I make it work as a string, because it wants me to change it to ICommandSender
  5. @above I have alot I will end up executing.
  6. Not make a new command, but RUN it. I looked in the CommandBlock classes, the net.minecraft imports. Even in the imports I checked the imports, I could not find how. I would like the code here to do it. In the (jf==3) { } code block public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta){ int jf = 0; for(int i=1; i<=10; i++) { jf=randomWithRange(3,3); } /* Wanted */ if (jf==3) { } if (jf==4) { Entity gravelz = EntityList.createEntityByID(200, world); gravelz.setPosition(x, y, z); world.spawnEntityInWorld(gravelz); } if (jf==5) { Entity gravel = EntityList.createEntityByID(2, world); gravel.setPosition(x, y, z); world.spawnEntityInWorld(gravel); Entity gravelz = EntityList.createEntityByID(2, world); gravelz.setPosition(x, y, z); world.spawnEntityInWorld(gravelz); } if (jf==6) { Entity gravel = EntityList.createEntityByID(50, world); gravel.setPosition(x, y, z); world.spawnEntityInWorld(gravel); Entity gravelz = EntityList.createEntityByID(50, world); gravelz.setPosition(x, y, z); world.spawnEntityInWorld(gravelz); world.spawnEntityInWorld(gravelz); world.spawnEntityInWorld(gravelz); world.spawnEntityInWorld(gravelz); world.spawnEntityInWorld(gravelz); } if (jf==7) { Entity EntityTNTPrimed = EntityList.createEntityByID(20, world); EntityTNTPrimed.setPosition(x, y, z); world.spawnEntityInWorld(EntityTNTPrimed); Entity EntityTNTPrimedz = EntityList.createEntityByID(20, world); EntityTNTPrimedz.setPosition(x-3, y, z); world.spawnEntityInWorld(EntityTNTPrimedz); Entity EntityTNTPrimedm = EntityList.createEntityByID(20, world); EntityTNTPrimedm.setPosition(x+3, y, z); world.spawnEntityInWorld(EntityTNTPrimedm); Entity EntityTNTPrimedz1 = EntityList.createEntityByID(20, world); EntityTNTPrimedz1.setPosition(x, y, z-3); world.spawnEntityInWorld(EntityTNTPrimedz1); Entity EntityTNTPrimedz2 = EntityList.createEntityByID(20, world); EntityTNTPrimedz2.setPosition(x, y, z+3); world.spawnEntityInWorld(EntityTNTPrimedz2); } } }
  7. @above I can put the mod to 1.8 If 1.8 is not to dif.
  8. I would like it in my blockExampleBlock.class file. Thanks in advance. ~Scriph.
×
×
  • Create New...

Important Information

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