Jump to content

funsize888

Members
  • Posts

    85
  • Joined

  • Last visited

Everything posted by funsize888

  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. Nothing happened, it didn't render
  7. No I did file -> export, in eclipse
  8. 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:
  9. Put, @SideOnly(Side.CLIENT) above, public class ClientProxy extends CommonProxy {
  10. Post your client proxy
  11. 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
  12. hmmm, I put that in my Main class under pre init event, it didn't work, should it go in either of the proxys?
  13. Hi, I have a custom entity, and I cant figure out how to register the renders for it. I see the way it works has changed a lot in 1.11. I really don't know how to approach this. Any help is appreciated, thanks!
  14. Hello, I have been trying to get a custom sound to work for a while now, I thought I did everything right but the sound will not play in-game. Here is my handler Here is my Sounds.json: My sound is located at : Workspace\src\main\resources\assets\nm\sounds\block Any help is appreciated, thanks!
  15. I'm not a complete noob to coding, its just registering a entity changed a lot in 1.11. Would it be something like this? @Override public Render<? super T> createRenderFor(RenderManager manager){ return (Render<? super NukePrimed>)); } }
  16. @Override public Render createRenderFor(RenderManager manager){ return (new NukePrimed(manager)); } } I'm still confused
  17. @Override public Render<? super T> createRenderFor(RenderManager manager){ return (Render<? super T>) (new NukePrimed(manager)); this throws a bunch of errors
  18. Why would it be EntityNukePrimed, I don't even have a class called that
  19. Ok, now I have public class ModEntities<T> implements IRenderFactory{ public static void register(IRenderFactory factory){ RenderingRegistry.registerEntityRenderingHandler(RenderNukePrimed.class, factory); } @SuppressWarnings("unchecked") @Override public Render<? super T> createRenderFor(RenderManager manager){ return (Render<? super T>) (new RenderNukePrimed(manager)); } } but I get an error on: registerEntityRenderingHandler. It says: The method registerEntityRenderingHandler(Class<? extends Entity>, Render<? extends Entity>) in the type RenderingRegistry is not applicable for the arguments (Class<RenderNukePrimed>, IRenderFactory)
  20. I already have this code in my RenderNukePrimed, shouldn't this do the trick?: public void doRender(NukePrimed entity, double x, double y, double z, float entityYaw, float partialTicks) also it shouldn't be rendering as regular tnt it should be rendering as a missing texture, why is it rendering as regular tnt?
  21. Ok, I got this, getting errors, still don't quite fully understand public class ModEntity<T> implements IRenderFactory{ public static void register(){ RenderingRegistry.registerEntityRenderingHandler(RenderNukePrimed.class, factory); } @Override public Render<? super T> createRenderFor(RenderManager manager){ return (new RenderNukePrimed(manager)); } }
×
×
  • Create New...

Important Information

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