Jump to content

[1.19.2] custome bow, force particle to allways spawn ? or make arrow based entity to shine and fade away ?


perromercenary00

Recommended Posts

good days i try to make the question shortest possible 

i redooo mi bow|crossbow|arrow to 1.19 version 
this costume arrow has 2 particularities, 

* when hit something it rolls a d20 

 int d20 = (1 + ((int) (Math.random() * 20))); 

and if its more than 17  doubles the damage

* using math detects if the hits its a head-shoot and if it is it also doubles damage 


so i made code way if head-shoot at same times than critical  does one shoot kill
for anything under 26hp like witches  way it has not effect on guardians brutes or custom bosses 
#####

now obviously i wanna has some kind mark to indicator wheres is a critical headshoot soo i made a custome SKULL_PARTICLE 

icon-particle2-edit.gif

 

Is nice and all it glows soo is visible in the dark and fade away 
# but has a  problem it  just spawns wherever it feels like like 70% of the time don't works 

so i try to spawn it multiple times

	             for( int i = 0 ; i < 5 ; i++ ) {
             this.level.addAlwaysVisibleParticle(ParticleInit.SKULL_PARTICLE.get(), eye.x, eye.y, eye.z, 0.0D, 0.0D, 0.0D); 
             }

but it has a ugly washed away looks and thats when it feels like spawning 
icon-particle-edit.gif

 

first 3 times it works 
last 2 dont's works 

####################
i get boored and change of tactic 
i take the arrow render class twerkit change texture and create an icon-entity only for the sole purpose of showing and skull when critical head-shoot 
icon-entity-edit.gif

icon-entity-edit.gifthis one works 100% of times 
also the true was easy to make the icon-entity than the skull-particle 

the problem whit this one is i dont know how to make it glow or fade away this one just dissapears 
 

############################################################################################################

############################################################################################################

############################################################################################################

 

if do you reach to this point thanks for you time 

this posted question has two possible solutions 

one is to find a way to force the particle to spawn one time 

something like 

	//try 10 times to spawn the particle 
	             for( int i = 0 ; i < 10 ; i++ ) {
	                         if(  this.level.addAlwaysVisibleParticle(ParticleInit.SKULL_PARTICLE.get(), eye.x, eye.y, eye.z, 0.0D, 0.0D, 0.0D)   ){
	                                     //if particle spawn stop trying 
	                                     break;
	                         } 
	             }
	

Can you guide me whit this 

 

the other way  be made the icon-entity Glow  in the dark and fade away   
 

Spoiler

				
			package mercbow.entity;				
			import mercbow.item.ingot.red_hot_iron;
		import mercbow.util.Postate;
		import net.minecraft.core.BlockPos;
		import net.minecraft.core.particles.ParticleTypes;
		import net.minecraft.nbt.CompoundTag;
		import net.minecraft.network.protocol.Packet;
		import net.minecraft.sounds.SoundEvents;
		import net.minecraft.world.entity.Entity;
		import net.minecraft.world.entity.EntityType;
		import net.minecraft.world.level.Level;
		import net.minecraft.world.phys.Vec3;
		import net.minecraftforge.network.NetworkHooks;				
			public class icon_entity extends Entity {				
			    private int tick;
		    private Entity target_entity = null;				
			    public icon_entity(EntityType<?> w_entity, Level warudo) {
		        super(w_entity, warudo);
		    }				
			    public icon_entity(EntityType<?> w_entity, Level warudo, Entity target_entity) {
		        super(w_entity, warudo);
		        this.target_entity = target_entity;
		    }				
			    public icon_entity(EntityType<?> w_entity, Level warudo, Vec3 vi) {
		        super(w_entity, warudo);
		        this.setPos(vi);
		    }    
		    
		    public void set_target_entity(Entity target_entity) {
		        this.target_entity = target_entity;
		    }				
			    
		    // #################### #################### ####################    
		    private boolean mustdie() {
		        
		        //life limit
		        if(  this.tick > 40 ) {
		            
		            System.out.println( "icon_entity.mustdie( time limit ("+this.level.isClientSide+ "," + this.position() + ") )" );
		            
		            this.kill();
		            return true;
		        }
		        
		        if (this.target_entity == null || !this.target_entity.isAlive()) {
		            // System.out.println("\nWatcher Entity has dye\n");
		            //this.kill();
		        }     
		                
		        
		                
		        return false;
		    }    
		    
		    @Override
		    public void tick() {				
			        mustdie();
		        
		        // every 5 ticks check if target_entity is alive and update the pos of watcher
		        // entity
		        //if ((tick % 1 == 0)) 
		        {
		            // reset position to match target entity
		            if (this.target_entity == null || !this.target_entity.isAlive()) {
		                // System.out.println("\nWatcher Entity has dye\n");
		                //this.kill();
		            } else {
		                Vec3 eye = this.target_entity.getEyePosition();
		                this.setPos(eye);
		                
		                //this.setPos(eye.x, eye.y, eye.z);
		                this.setXRot( this.target_entity.getXRot() );
		                this.setYRot( 90.0F );
		                
		            }
		        }				
			        if (tick % 20 == 0) {				
			            Level warudo = this.level;
		            BlockPos pos = new BlockPos(this.getX(), this.getY(), this.getZ());
		            //BlockState blkstate = warudo.getBlockState(pos);
		        }				
			        this.tick++;
		    }				
			    @Override
		    protected void defineSynchedData() {
		        // TODO Auto-generated method stub
		    }				
			    @Override
		    protected void readAdditionalSaveData(CompoundTag p_70037_1_) {
		        // TODO Auto-generated method stub
		    }				
			    @Override
		    protected void addAdditionalSaveData(CompoundTag p_213281_1_) {
		        // TODO Auto-generated method stub
		    }				
			    // comunications
		    // in ExplosiveArrowEntity.java
		    @Override
		    public Packet<?> getAddEntityPacket() {
		        return NetworkHooks.getEntitySpawningPacket(this);
		    }				
			}
		

 

				
			package mercbow.entity;				
			import mercbow.mercbow;
		import net.minecraft.client.renderer.entity.ArrowRenderer;
		import net.minecraft.client.renderer.entity.EntityRenderer;
		import net.minecraft.client.renderer.entity.EntityRendererProvider;
		import net.minecraft.client.resources.model.ModelResourceLocation;
		import net.minecraft.resources.ResourceLocation;
		import net.minecraft.world.entity.Entity;				
			public class icon_entity_renderer extends icon_entity_model<icon_entity> {
		    //public static final ResourceLocation TEXTURE = new ResourceLocation(mercbow.MOD_ID, "textures/entity/mercenary_arrow.png");				
			    public static final ResourceLocation TEXTURE = new ResourceLocation(mercbow.MOD_ID, "textures/entity/skull_particle.png");
		    public static final ResourceLocation TRANSPARENT = new ResourceLocation(mercbow.MOD_ID, "textures/entity/transparent.png");				
			    public icon_entity_renderer(EntityRendererProvider.Context context) {
		        super(context);
		    }				
			    @Override
		    public ResourceLocation getTextureLocation(icon_entity arrow) {
		        
		        int tick = arrow.tickCount;
		        if (tick < 2 ){
		            return TRANSPARENT;    
		        } 
		        
		        
		        return TEXTURE;
		    }				
			 }				
			

 

 

				
			package mercbow.entity;				
			import com.mojang.blaze3d.vertex.PoseStack;
		import com.mojang.blaze3d.vertex.VertexConsumer;
		import com.mojang.math.Matrix3f;
		import com.mojang.math.Matrix4f;
		import com.mojang.math.Vector3f;
		import net.minecraft.client.renderer.MultiBufferSource;
		import net.minecraft.client.renderer.RenderType;
		import net.minecraft.client.renderer.entity.EntityRenderer;
		import net.minecraft.client.renderer.entity.EntityRendererProvider;
		import net.minecraft.client.renderer.texture.OverlayTexture;
		import net.minecraft.util.Mth;
		import net.minecraft.world.entity.Entity;
		import net.minecraft.world.entity.projectile.AbstractArrow;
		import net.minecraftforge.api.distmarker.Dist;
		import net.minecraftforge.api.distmarker.OnlyIn;				
			@OnlyIn(Dist.CLIENT)
		public abstract class icon_entity_model<T extends icon_entity> extends EntityRenderer<T> {
		   public icon_entity_model(EntityRendererProvider.Context contex) {
		      super(contex);
		   }				
			   public void render(T entity, float p_225623_2_, float p_225623_3_, PoseStack matrixstack, MultiBufferSource irendertypebuffer, int p_225623_6_) {
		   //public void render(T entity, float p_225623_2_, float p_225623_3_, MatrixStack matrixstack, IRenderTypeBuffer irendertypebuffer, int p_225623_6_) {       
		      
		        int tick = entity.tickCount;
		        
		        matrixstack.pushPose();
		        matrixstack.mulPose(Vector3f.YP.rotationDegrees(Mth.lerp(p_225623_3_, entity.yRotO, entity.getYRot()) - 90.0F));
		        matrixstack.mulPose(Vector3f.ZP.rotationDegrees(Mth.lerp(p_225623_3_, entity.xRotO, entity.getXRot())));				
			      
		        int i = 0;
		        float f = 0.0F;
		        float f1 = 0.5F;
		        float f2 = 0.0F;
		        float f3 = 0.15625F;
		        float f4 = 0.0F;
		        float f5 = 0.15625F;
		        float f6 = 0.15625F;
		        float f7 = 0.3125F;
		        float f8 = 0.05625F;
		        float f9 = 0.0F;// (float)entity.shakeTime - p_225623_3_;
		        if (f9 > 0.0F) {
		            float f10 = -Mth.sin(f9 * 3.0F) * f9;
		            matrixstack.mulPose(Vector3f.ZP.rotationDegrees(f10));
		        }               
		      
		        matrixstack.mulPose(Vector3f.XP.rotationDegrees(0.0F));// rotation del modelo				
			        float scale = 0.03F; //1 is like one chunck 
		        matrixstack.scale(scale, scale, scale);
		        matrixstack.translate(0.0D, 0.0D, 0.0D);
		        VertexConsumer ivertexbuilder = irendertypebuffer.getBuffer(RenderType.entityCutout(this.getTextureLocation(entity)));
		        PoseStack.Pose  matrixstack$entry = matrixstack.last();
		        Matrix4f matrix4f = matrixstack$entry.pose();
		        Matrix3f matrix3f = matrixstack$entry.normal();				
			        // el que se desde atraz x				
			        this.vertex(matrix4f, matrix3f, ivertexbuilder, 9, -10, -10, 0.00F, 1.00F, -1, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 9, -10, 10, 1.00F, 1.00F, -1, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 9,  10, 10, 1.00F, 0.00F, -1, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 9,  10, -10, 0.00F, 0.00F, -1, 0, 0, p_225623_6_);				
			        // el que se ve desde adelante x
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 10,  10, -10, 0.00F, 0.00F, -1, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 10,  10, 10, 1.00F, 0.00F, -1, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 10, -10, 10, 1.00F, 1.00F, -1, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 10, -10, -10, 0.00F, 1.00F, -1, 0, 0, p_225623_6_);				
			        // el que se ve desde arriba y
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 10, 10, 10, 1.00F, 0.00F, 0, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 10, 10, -10, 0.00F, 0.00F, 0, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 9,  10, -10, 0.00F, 0.20F, 0, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 9,  10, 10, 1.00F, 0.20F, 0, 0, 0, p_225623_6_);				
			        // el que se ve desde abajo y
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 10, -10, -10, 0.00F, 0.00F, 0, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 10, -10, 10, 1.00F, 0.00F, 0, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 9,  -10, 10, 1.00F, 0.20F, 0, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 9,  -10, -10, 0.00F, 0.20F, 0, 0, 0, p_225623_6_);
		        
		        // el que se ve desde izquierda east z
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 9, -10, -10, 0.20F, 1.00F, 0, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 9, 10, -10, 0.20F, 0.00F, 0, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 10, 10, -10, 0.00F, 0.00F, 0, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 10, -10, -10, 0.00F, 1.00F, 0, 0, 0, p_225623_6_);				
			        // el que se ve desde derecha west z
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 10, -10, 10, 0.20F, 1.00F, 0, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 10,  10, 10, 0.20F, 0.00F, 0, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 9,   10, 10, 0.00F, 0.00F, 0, 0, 0, p_225623_6_);
		        this.vertex(matrix4f, matrix3f, ivertexbuilder, 9,  -10, 10, 0.00F, 1.00F, 0, 0, 0, p_225623_6_);
		        
		        //ModelHelper.setLightmapTextureCoords(ModelHelper.lightmapTexUnit, (float)j, (float)k);
		      				
			      matrixstack.popPose();
		      super.render(entity, p_225623_2_, p_225623_3_, matrixstack, irendertypebuffer, p_225623_6_);
		   }				
			   public void vertex(Matrix4f p_113826_, Matrix3f p_113827_, VertexConsumer p_113828_, int p_113829_, int p_113830_, int p_113831_, float p_113832_, float p_113833_, int p_113834_, int p_113835_, int p_113836_, int p_113837_) {
		      p_113828_.vertex(p_113826_, (float)p_113829_, (float)p_113830_, (float)p_113831_).color(255, 255, 255, 255).uv(p_113832_, p_113833_).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(p_113837_).normal(p_113827_, (float)p_113834_, (float)p_113836_, (float)p_113835_).endVertex();
		   }
		}
		

 

 

the glow effect must be applied to the icon_entity_model class i don't have idea how to do it  and i alredy ask this before without avail 

 

over the two i would prefer to fix the icon-entity and make it glow, this one would work even if the user disables the particles 

 

 

thanks for your time 

 

 

 

 

 

 

 

 









  

Link to comment
Share on other sites

yesterday night i made some other post and they give me the render class for the fireball 
so  i get know how to make the icon entity glow in the dark 

just add this two methods to the icon_entity_renderer class

	    @Override
    protected int getBlockLightLevel(T icon_entity, BlockPos pos) {
        return this.fullBright ? 15 : super.getBlockLightLevel(icon_entity, pos);
    }
    
    @Override
    protected int getSkyLightLevel(T icon_entity, BlockPos pos) {
        return icon_entity.level.getBrightness(LightLayer.SKY, pos);
        //return 15;
     }
	




fireandlight-edit.gif

 

its just not what i spected i just make the skull texture glow and are visible in dark and all
but it don't emit any light 
soo i bring in a blaze and its the same thing is visible but don't shines 
anyway being visible in the dark is enough for this case 
 

 

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I am in such a mess. I have lost over 4.7m due to a scammer... It started as bank wires and then bitcoin. it is hard to imagine but it is true and can send any proof, then I tried to use a couple of recovery companies and was as well. Graphic design has been more than just a hobby for me since high school—it has become a thriving career. Starting in my parents' garage, I eventually expanded to my office, running a successful graphic design business. However, like many, I faced the need to diversify my investments due to inflation. This led me to invest 60.16 in Bitcoin, a decision that paid off handsomely as my investment grew to 4.7m over time. This financial windfall allowed me to upgrade my equipment and take on more ambitious projects, furthering the growth of my business. Unfortunately, my excitement was abruptly cut short when I fell victim to a hacking incident. Malware infected my computer, giving hackers access to my Bitcoin wallet. The devastation of potentially losing all my hard-earned savings and plans weighed heavily on me. At this dire moment, a fellow designer suggested Linux Cyber Security Company as a potential solution. Desperate for a lifeline, I reached out to them, hoping for a miracle. The response from Linux Cyber Security Company was prompt, incredibly professional, and effective. Their team quickly traced the hacker’s activities and recovered most of my funds, alleviating a significant amount of stress and uncertainty. Beyond the recovery, they took the time to educate me on essential practices to secure my Bitcoin holdings better. They emphasized using antivirus software to prevent malware infections, avoiding suspicious downloads, and the added security provided by hardware wallets. This experience served as a critical wake-up call for me. It highlighted the vulnerabilities inherent in digital assets and underscored the importance of robust security measures. Thanks to the guidance and expertise of Linux Cyber Security Company, I now feel more equipped to protect my digital assets proactively. Their insights have empowered me to implement stronger security protocols in my business operations and personal finances alike. With my Bitcoin funds securely recovered and a newfound understanding of digital security best practices, I am more confident in navigating future challenges. This journey has reinforced my commitment to safeguarding my hard-earned assets and leveraging technology responsibly. I am optimistic about the growth opportunities ahead, creatively in graphic design and prudently in investment strategies. In conclusion, while the hacking incident was a setback, it ultimately became a catalyst for enhancing my digital security awareness and resilience. I am grateful to Linux Cyber Security Company for their expertise and support during a challenging time, enabling me to continue pursuing my passion for graphic design with renewed confidence and financial stability. Contact a professional company I am sure they can help you with your case too, Website [www.linuxcybersecurity.com Email the team; info@)(linuxcybersecurity.com
    • https://pastebin.com/B2HnBZTa
    • it was easy villager mate, thanks ill see how to do it without that mod! thanks
    • mybe but thats the central mod i want, is that the one causing the problem?
  • Topics

×
×
  • Create New...

Important Information

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