Jump to content

Recommended Posts

Posted

I'm attempting to create a custom brewing stand and ran into an interesting problem.  I'm trying to spawn particles when the custom brewing stand is actually brewing, but getting mixed results.  Note, my custom object right now is pretty much a copy of the original!!

 

To doi this I am calling a method spawnProcessingParticle inside the ChuProcessorTileEntity.tick() method...

 

I posted the tick method below along with two places I am trying to call spawnProcessingParticle() .... I have the placements in BOLD.

Placement #1 Logs (Interesting because it calls the render):

[03Apr2020 22:25:28.606] [Server thread/INFO] [weible.rupeehunt.RupeeHuntMod/]: Spawning World Particle at (-71.6,65.7,-204.6), BT(0)

[03Apr2020 22:25:28.678] [Server thread/INFO] [weible.rupeehunt.RupeeHuntMod/]: Spawning World Particle at (-71.6,65.7,-204.6), BT(0)

[03Apr2020 22:25:28.687] [Render thread/INFO] [weible.rupeehunt.RupeeHuntMod/]: Spawning World Particle at (-71.6,65.7,-204.6), BT(0)

[03Apr2020 22:25:28.710] [Render thread/INFO] [weible.rupeehunt.RupeeHuntMod/]: Spawning World Particle at (-71.6,65.7,-204.6), BT(0)

 

Placement #2 Logs (Doesn't call the render):

[03Apr2020 22:43:57.059] [Server thread/INFO] [weible.rupeehunt.RupeeHuntMod/]: Spawning World Particle at (-71.6,65.7,-204.6), BT(398)

[03Apr2020 22:43:57.103] [Server thread/INFO] [weible.rupeehunt.RupeeHuntMod/]: Spawning World Particle at (-71.6,65.7,-204.6), BT(397)

[03Apr2020 22:43:57.155] [Server thread/INFO] [weible.rupeehunt.RupeeHuntMod/]: Spawning World Particle at (-71.6,65.7,-204.6), BT(396)

[03Apr2020 22:43:57.202] [Server thread/INFO] [weible.rupeehunt.RupeeHuntMod/]: Spawning World Particle at (-71.6,65.7,-204.6), BT(395)

 

 

   public void spawnProcessingParticle()
   {
           double d0 = (double)this.getPos().getX() + 0.4D;
           double d1 = (double)this.getPos().getY() + 0.7D;
           double d2 = (double)this.getPos().getZ() + 0.4D;
           RupeeHuntMod.LOGGER.log(Level.INFO, "Spawning World Particle at ("+d0+","+d1+","+d2+"), BT("+this.brewTime+")");
           
           for(int i = 0; i<100;i++)
           {
               this.world.addParticle(ParticleTypes.HAPPY_VILLAGER, d0, d1, d2, 0.0D, 0.0D, 0.0D);
           }
   }

 

-----------------

 

   public void tick() 
   {
      ItemStack itemstack = this.brewingItemStacks.get(4);
      if (this.fuel <= 0 && itemstack.getItem() == Items.BLAZE_POWDER) 
      {
         this.fuel = 20;
         itemstack.shrink(1);
         this.markDirty();
      }
      
      /*

          PLACEMENT NUMBER 1) THIS WORKS AND SPAWNS PARTICLES, BUT DOESN'T MEET THE DESIRE 

           spawnProcessingParticle();

         

      */

 

      boolean flag = this.canBrew();
      boolean flag1 = this.brewTime > 0;
      ItemStack itemstack1 = this.brewingItemStacks.get(3);
      
      if (flag1) 
      {
         --this.brewTime;
         
         boolean flag2 = this.brewTime == 0;
         if (flag2 && flag) 
         {

            this.brewPotions();
            this.markDirty();          

            /*

          PLACEMENT NUMBER 2) THIS MEETS THE DESIRES BY CALLING THE METHOD, BUT PARTICLES NEVER RENDER

           spawnProcessingParticle();     

             */

         } 
         else if (!flag) 
         {
            this.brewTime = 0;
            this.markDirty();            
         } 
         else if (this.ingredientID != itemstack1.getItem()) 
         {
            this.brewTime = 0;
            this.markDirty();
         }
      } 
      else if (flag && this.fuel > 0) 
      {
         --this.fuel;
         this.brewTime = 400;
         this.isBrewing = true;
         this.ingredientID = itemstack1.getItem();
         this.markDirty();

      }

      if (!this.world.isRemote) 
      {
         boolean[] aboolean = this.createFilledSlotsArray();
         if (!Arrays.equals(aboolean, this.filledSlots)) {
            this.filledSlots = aboolean;
            BlockState blockstate = this.world.getBlockState(this.getPos());
            if (!(blockstate.getBlock() instanceof ChuProcessorBlock)) {
               return;
            }

            for(int i = 0; i < ChuProcessorBlock.HAS_BOTTLE.length; ++i) {
               blockstate = blockstate.with(ChuProcessorBlock.HAS_BOTTLE, Boolean.valueOf(aboolean));
            }
         }
      }

   }

 

Anyway, curious on ideas, or why this is only Rendering at certain points in the code .....

I'm a little new to TileEntities .... so hopefully I'm not doing something completely not right ... any help would be appreciated!

 

 

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



×
×
  • Create New...

Important Information

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