Jump to content

Out of bounds error, not sure what caused.


HappleAcks

Recommended Posts

So I got this out of bounds error, and I see it's with the particle effects. I was shooting a weapon that leaves a particle effect trail, so I'm not sure how it got out of bounds.

 

 

 

[19:08:26] [Client thread/FATAL]: Unreported exception thrown!

java.lang.IndexOutOfBoundsException: Index: 3999, Size: 4000

at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.7.0_51]

at java.util.ArrayList.get(Unknown Source) ~[?:1.7.0_51]

at net.minecraft.client.particle.EffectRenderer.updateEffects(EffectRenderer.java:77) ~[EffectRenderer.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:2153) ~[Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1036) ~[Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_51]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

 

 

Link to comment
Share on other sites

Can you show your particle spawning code?

The code spawning it from the projectile:

 

 

@Override

public void onUpdate()

  {

      super.onUpdate();

 

      for (int var3 = 0; var3 < 8; ++var3)

        {

            Powder var1 = new Powder(this.worldObj, this.posX, this.posY-1, this.posZ, 0.0D, 0.0D, 0.0D, 5);

            FMLClientHandler.instance().getClient().effectRenderer.addEffect(var1);

        }

    }

     

 

 

 

 

And the actual particle code:

 

 

@SideOnly(Side.CLIENT)

public class Powder extends EntityFX

{

    public float portalParticleScale;

    public int last;

 

    public Powder (World par1World, double par2, double par4, double par6, double par8, double par10, double par12, int age)

    {

        super(par1World, par2, par4, par6, par8, par10, par12);

        this.last = age;

        this.motionX = par8 + (float)(Math.random() * 2.0D - 1.0D) * 0.05F;

        this.motionY = par10 + (float)(Math.random() * 2.0D - 1.0D) * 0.05F;

        this.motionZ = par12 + (float)(Math.random() * 2.0D - 1.0D) * 0.05F;

        float var14 = this.rand.nextFloat() * 0.6F + 0.4F;

        this.portalParticleScale = this.particleScale = this.rand.nextFloat() * 0.2F + 0.5F;

        this.particleRed = this.particleGreen = this.particleBlue = 1.0F * var14;

        this.particleGreen *= 0.3F;

        this.particleRed *= 0.9F;

        this.particleScale = this.rand.nextFloat() * this.rand.nextFloat() * 6.0F + 1.0F;

        this.particleMaxAge = (int)(16.0D / (this.rand.nextFloat() * 0.8D + 0.2D)) + 2;

    }

 

    /**

    * Called to update the entity's position/logic.

    */

    @Override

    public void onUpdate()

    {

        this.prevPosX = this.posX;

        this.prevPosY = this.posY;

        this.prevPosZ = this.posZ;

 

        if (this.particleAge++ >= this.particleMaxAge)

        {

            this.setDead();

        }

 

        this.setParticleTextureIndex(7 - this.particleAge * last / this.particleMaxAge);

        this.motionY += 0.004D;

        this.motionX *= 0.8999999761581421D;

        this.motionY *= 0.8999999761581421D;

        this.motionZ *= 0.8999999761581421D;

 

        if (this.onGround)

        {

            this.motionX *= 0.699999988079071D;

            this.motionZ *= 0.699999988079071D;

        }

    }

}

 

 

Link to comment
Share on other sites

onUpdate get's called on both client & server.

You must a) check for the client with world.isRemote and

b) not call client-only stuff (particles) from common code (entities).

 

My bad for B, I didn't actually copy this part, but right before the on update there is:

@SideOnly(Side.CLIENT)  <--- This

@Override

public void onUpdate()

  {

      super.onUpdate();

---

So I can assume the client only thing wasn't a problem. Now, for checking if the world is remote, I do  this in the entity projectile file correct? So something like the following:

 

 

 

@SideOnly(Side.CLIENT)

@Override

public void onUpdate()

  {

      super.onUpdate();

 

      if (!this.worldObj.isRemote) {

      for (int var3 = 0; var3 < 8; ++var3)

        {

            Powder var1 = new Powder(this.worldObj, this.posX, this.posY-1, this.posZ, 0.0D, 0.0D, 0.0D, 5);

            FMLClientHandler.instance().getClient().effectRenderer.addEffect(var1);

        }

      }

    }

 

 

Link to comment
Share on other sites

@SideOnly does NOT do what you think it does.

You should never actually use it.

@SideOnly(Side.CLIENT) means the class/method/field will not be present in the minecraft_server.jar, only in the minecraft.jar. That means it WILL be present on the Integrated Server.

 

isRemote doesn't do this and therefor is the way to go.

Is the new place where I placed the isRemote [in previous post] correct? Also, in all my Render files I always have @SideOnly(Side.CLIENT)  at the beginning because I was told a while back that's how you make things properly work for SMP. I assume this is okay for the render files though [like the mob render files]. However, for an entity I should always use the isRemote (I already had the isRemote in the weapon code for spawning the entity too)?

Link to comment
Share on other sites

That is true.

But then again: @SideOnly on the render files is not needed. If you do NOT have it and it crashes, adding it will most likely not fix it.

So I just had this issue again, and with the previous fixes.

 

Particle spawn:

 

 

@Override

  public void onUpdate()

      {

        super.onUpdate();

        if (!this.worldObj.isRemote) {

          for (int var3 = 0; var3 < 8; ++var3)

          {

              Powder var1 = new Powder(this.worldObj, this.posX, this.posY-1, this.posZ, 0.0D, 0.0D, 0.0D, 5);

              FMLClientHandler.instance().getClient().effectRenderer.addEffect(var1);

          }

      }

}

         

 

 

 

 

Particle code:

 

 

@SideOnly(Side.CLIENT)

public class Powder extends EntityFX

{

    public float portalParticleScale;

    public int last;

 

    public Powder (World par1World, double par2, double par4, double par6, double par8, double par10, double par12, int age)

    {

        super(par1World, par2, par4, par6, par8, par10, par12);

        this.last = age;

        this.motionX = par8 + (float)(Math.random() * 2.0D - 1.0D) * 0.05F;

        this.motionY = par10 + (float)(Math.random() * 2.0D - 1.0D) * 0.05F;

        this.motionZ = par12 + (float)(Math.random() * 2.0D - 1.0D) * 0.05F;

        float var14 = this.rand.nextFloat() * 0.6F + 0.4F;

        this.portalParticleScale = this.particleScale = this.rand.nextFloat() * 0.2F + 0.5F;

        this.particleRed = this.particleGreen = this.particleBlue = 1.0F * var14;

        this.particleGreen *= 0.3F;

        this.particleRed *= 0.9F;

        this.particleScale = this.rand.nextFloat() * this.rand.nextFloat() * 6.0F + 1.0F;

        this.particleMaxAge = (int)(16.0D / (this.rand.nextFloat() * 0.8D + 0.2D)) + 2;

    }

 

    /**

    * Called to update the entity's position/logic.

    */

    @Override

    public void onUpdate()

    {

        this.prevPosX = this.posX;

        this.prevPosY = this.posY;

        this.prevPosZ = this.posZ;

 

        if (this.particleAge++ >= this.particleMaxAge)

        {

            this.setDead();

        }

 

        this.setParticleTextureIndex(7 - this.particleAge * last / this.particleMaxAge);

        this.motionY += 0.004D;

        this.motionX *= 0.8999999761581421D;

        this.motionY *= 0.8999999761581421D;

        this.motionZ *= 0.8999999761581421D;

 

        if (this.onGround)

        {

            this.motionX *= 0.699999988079071D;

            this.motionZ *= 0.699999988079071D;

        }

    }

}

 

 

Link to comment
Share on other sites

You are now checking if the world is not remote, so if it's the server, you spawn the client-side particles and on the client it does nothing. I bet that's what you want

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Pretty much, although all the recipes im planning to make on it are shapeless. The idea is that the chamber uses energy to "fuse" the items in each of the center slots together, in this case an ingot. The two slots at the sides are fuel. (A special kind of wood in this case). Here is an image of the interface just for reference (The center slot is the output)   As for the code- Can you elaborate a little bit on it? Seeing three different record classes has confused me a lot. (Elaborate as in why make them in three different records. I understand the code itself more or less)
    • Hello im trying to make a mod and the past few days GSON has almost killed me, when i export the mod and then launch it through minecraft launcher i get java.lang.NoSuchMethodError: com.google.gson.JsonParser.parseString(Ljava/lang/String;)Lcom/google/gson/JsonElement; i have literally tried everything here is my build config   dependencies { minecraft("com.mojang:minecraft:1.8.9") mappings("de.oceanlabs.mcp:mcp_stable:22-1.8.9") forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9") compileOnly("cc.polyfrost:oneconfig-1.8.9-forge:0.2.2-alpha+") shadowImpl("cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-beta+") { isTransitive = false exclude(module = "gson") } shadowImpl("org.spongepowered:mixin:0.7.11-SNAPSHOT") { isTransitive = false exclude(module = "gson") } annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT") shadowImpl("org.javassist:javassist:3.15.0-GA") { isTransitive = false exclude(module = "gson") } shadowImpl("com.neovisionaries:nv-i18n:1.28") { isTransitive = false exclude(module = "gson") } shadowImpl("org.apache.commons:commons-lang3:3.4") { isTransitive = false exclude(module = "gson") } shadowImpl("org.apache.httpcomponents:httpcore:4.4.5") { isTransitive = false exclude(module = "gson") } compileOnly("com.google.code.gson:gson:2.8.6") { isTransitive = false } configurations.all { resolutionStrategy { force("com.google.code.gson:gson:2.8.6") } } shadowImpl(fileTree( mapOf( "dir" to "libs", "include" to listOf("*.jar"), "exclude" to listOf( "asm", "asm-commons", "asm-tree", "gson", "unspecified", "nv-i18n" ) ) )) }  
    • @chxr Looks like you're making some sort of a crafting table / furnace hybrid? Are the inputs needing arranging like a shaped recipe, or is it shapeless? I'll assume it's shapeless since that just adds a lot more complexity. In that case I'd probably do something like this { "type": "relativedimensions:particle_rebound", "inputs": [ { "ingredient": { "item": "relativedimensions:aberrant_shard" }, "count": 8 } ], "fuel": { "tag": "relativedimensions:block/aberrant_fuel" }, "output": { "Count": 1, "id": "relativedimensions:aberrant_ingot" } } inputs: A list of ingredients and how many are needed. The count among each input adds up to 8. Since there's only 1 ingredient, the count is set to 8. fuel: Same thing as before but remove the list and just make it an object with a tag. output: Kept the same.   In this case the Codec I would make is public record ParticleReboundIngredient(Ingredient ingredient, int count) { public static final Codec<ParticleReboundIngredient> CODEC = RecordCodecBuilder.create( builder -> builder.group( Ingredient.CODEC.fieldOf("ingredient").forGetter((i) -> i.ingredient), Codec.INT.fieldOf("count").forGetter(i -> i.count) ).apply(builder, ParticleReboundIngredient::new) ); } public record ParticleReboundFuel(String tag) { public static final Codec<ParticleReboundFuel> CODEC = RecordCodecBuilder.create( builder -> builder.group(Codec.STRING.fieldOf("tag").forGetter(f -> f.tag)).apply(builder, ParticleReboundFuel::new) ); public boolean isFuel(ItemStack stack) { // TODO: Check if fuel item matches the tag } } public record ParticleReboundRecipe(List<ParticleReboundIngredient> inputs, ParticleReboundFuel fuel, ItemStack output) { public static final Codec<ParticleReboundRecipe> CODEC = RecordCodecBuilder.create( builder -> builder.group( ParticleReboundIngredient.CODEC.listOf().fieldOf("inputs").forGetter(r -> r.inputs), ParticleReboundFuel.CODEC.fieldOf("fuel").forGetter(r -> r.fuel), ItemStack.CODEC.fieldOf("output").forGetter(r -> r.output) ).apply(builder, ParticleReboundRecipe::new) ); }   There might be a more proper Codec for the fuel and the tag that's built into minecraft / forge, but I didn't look
    • Tested with 5900X, 64GB 3200 MHz, 3070 Ti, driver 551.86 GPU clock range: 200 - 1950 MHz, usually 210 MHz with 10-30% utilisation on desktop idle use Render settings: Vsync ON, Framerate unlimited, Render distance 32, Fullscreen ON (60hz monitor, so 60 fps with vsync) Vanilla minecraft: Main menu: 210mhz idle clock always, ingame clock around 400 - 1000 mhz with ~30% utilisation and after alt+tab stays at same. Modded install with curseforge app, only said forge added: Main menu: 210 mhz idle clock always, ingame clock around 400 - 1000 mhz with ~30% utilisation, but after alt+tab gpu clock shoots up to 1950 mhz and utilisation is at 50-60% After disabling all render and chunk related stuff in config, after alt+tab it goes up to 1500 mhz. So game turns gpu into space heater when its not even seen. GPU usage returns to expected when game comes back on top. If instead of unlimited fps, fps is set to ~60, then during alt+tab gpu stays at same range as vanilla, but minecraft has horrible limit logic and framerate limit causes lot of tearing, so its not an option. So it seems that when alt+tabbing, for some reason logic no longer takes vsync toggle into account. So expected behaviour would be for it to work like vanilla does. keep rendering in same manner, no matter if its seen and use same amount of resources. Essentially noticed this behaviour while playing Supersymmetry and after elimination testing, result was that only Forge was enough to cause it. And also confirmed it by doing fresh pack with only Forge added, so no other mods even in disabled state. Also happened with both singleplayer and remote multiplayer. Other offender was "Universal Tweaks" which introduced same effect to main menu with its # Removes the hardcoded 30 FPS limit in screens like the main menu B:"Uncap FPS"=true setting, meaning when game was on top, it still worked in limits of vsync cap, but after alt+tabbing even in main menu gpu usage shot up to max.
    • Add crash-reports with sites like https://paste.ee/ and paste the link to it here Make a test without the mod auditory
  • Topics

×
×
  • Create New...

Important Information

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