Jump to content

funsize888

Members
  • Posts

    85
  • Joined

  • Last visited

Recent Profile Visitors

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

funsize888's Achievements

Stone Miner

Stone Miner (3/8)

0

Reputation

  1. Hey, I have a custom tnt explosion and I was able to make it destroy a sphere, but I wanted to to only destroy the bottom half of the sphere and then expand from there on up. Here is my code, @Override public void doExplosionA() { Set<BlockPos> set = Sets.<BlockPos>newHashSet(); Set<IBlockState> states = Sets.<IBlockState>newHashSet(); int blocksDestroyed = 0; int radius = this.size; for (int j = -radius; j < radius; j ++) { for (int k = -radius; k < radius; k ++) { for (int l = -radius; l < radius; l ++) { double distSq = j * j + k * k + l * l; if(distSq <= (radius * radius)) { if(k > 0) { continue; } BlockPos pos = new BlockPos(x + j, y + k, z + l); if(world.getBlockState (pos) != Blocks.BEDROCK.getDefaultState()){ if(world.getBlockState(pos) != Blocks.AIR.getDefaultState()) { world.setBlockToAir(pos); blocksDestroyed++; } } } } } } I have it stop destroying blocks half way up, because thats the point at which I want it to expand. Any help is appreciated, Thanks
  2. That’s the part struggling with, I’m not sure how I would delay the for loop for a certain amount of ticks. Maybe I could save all the blocks from the loop and place them one by one with a delay?
  3. ok so now I have this: static int tick = 0; static int timer = 0; @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if(tick == 40) { tick = 0; timer++; System.out.print(timer); if(timer >= 20) { timer = 0; } }tick++; } /** * Does the first part of the explosion (destroy blocks) */ @Override public void doExplosionA() { Set<BlockPos> set = Sets.<BlockPos>newHashSet(); Set<IBlockState> states = Sets.<IBlockState>newHashSet(); long time = world.getWorldTime(); int blocksDestroyed = 0; int radius = this.size; int center = radius / 2; if(timer == 20) { for (int j = center - radius; j < center + radius; j++) { for (int k = center - radius; k < center + radius; k++) { for (int l = center - radius; l < center + radius; l++) { double distSq = (j-center) * (j-center) + (k-center) * (k-center) + (l-center) * (l-center); if(distSq <= (radius) * (radius)) { BlockPos pos = new BlockPos(x + j - center, y + k - center, z + l - center); if(world.getBlockState (pos) != Blocks.BEDROCK.getDefaultState()){ world.setBlockToAir(pos); timer = 0; blocksDestroyed++; System.out.println(timer); } } } } } } but obviously the if statement will only run if the timer = 20. So the code isnt run at all. how do I wait for the timer to = 20?
  4. What do you mean by keep track of the position im at? or which explosion, its only one explosion.
  5. Hello, I have made a custom TNT with a custom explosion, but I wanted the explosion to be huge, like 1,000,000+ blocks. It works fine but obviously there is a huge lag when detonating, I was wondering how I could add a very slight delay between each time a block is removed. Here is my code: static int tick = 0; @SubscribeEvent public static void onClientTick(TickEvent.ClientTickEvent event) { if(tick == 80) { System.out.print("DELAY"); tick = 0; } tick++; } /** * Does the first part of the explosion (destroy blocks) */ @Override public void doExplosionA() { Set<BlockPos> set = Sets.<BlockPos>newHashSet(); long time = world.getWorldTime(); int blocksDestroyed = 0; int radius = this.size; int center = radius / 2; for (int j = center - radius; j < center + radius; j++) { for (int k = center - radius; k < center + radius; k++) { for (int l = center - radius; l < center + radius; l++) { double distSq = (j-center) * (j-center) + (k-center) * (k-center) + (l-center) * (l-center); if(distSq <= (radius) * (radius)) { BlockPos pos = new BlockPos(x + j - center, y + k - center, z + l - center); if(world.getBlockState (pos) != Blocks.BEDROCK.getDefaultState()){ world.setBlockState(pos, Blocks.AIR.getDefaultState()); I added the ClientTickEvent, because I thought it would be the way to go, but cant figure out how to add the delay after each block gets removed. Any help is appreciated, thanks.
  6. Hello, I have made a mod in eclipse and it works just fine with no errors. But when I export it as a java file and try to run it in regular minecraft, I get a crash. I have no clue why this would happen. My crash log: Looks like this is the main problem class:
  7. Put, @SideOnly(Side.CLIENT) above, public class ClientProxy extends CommonProxy {
  8. Caused by: net.minecraftforge.fml.common.LoaderException: java.lang.ClassNotFoundException: co/coolbeyblades7/minecraft_mod/proxy/ClientProxy; at net.minecraftforge.fml.common.ProxyInjector.inject(ProxyInjector.java:88) at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:595) It says what it was caused by. Try taking a look at your ProxyInjector, that seems to be the problem
  9. hmmm, I put that in my Main class under pre init event, it didn't work, should it go in either of the proxys?
×
×
  • Create New...

Important Information

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