Jump to content

Recommended Posts

Posted

My recommendation is to make a capability which you can start a timer for a given block and destroy it once that timer has finished. It would probably be a list which you can tick that holds the block position and then calls the destroy block method in the level once it finishes.

Posted

I would suggest learning Java before modding. It's an absolutely terrible idea to learn it at the same time because Minecraft contains numerous bad practices and you are expected to have an intermediate level of Java knowledge beforehand since we do not explain Java concepts, only answer Minecraft related questions. It's like trying to run before figuring out how to stand.

  • 2 weeks later...
Posted
  On 2/15/2023 at 10:58 AM, Rex_Technology said:

I already learned java, I followed a java tutorial made by Kaupenjoe that is made for minecraft modding

Expand  

Following a tutorial is not the same as learning a language, but your choice.

Regardless, I gave the answer above, use a capability on the level and create a timer method to handle the destroying. If you are using a block entity to destroy the block, then use that instead of a capability on the level. There are docs, wikis, and tutorials on capabilities if you are unsure of their system.

  • Thanks 1
Posted
  On 2/15/2023 at 5:36 PM, Alpvax said:

You need to make your own capability, and you can give it whatever methods you want.

Expand  

well yes but not quite

short ago i have to made a capability extending itemhandler to make a custome drill and i need to recalculate the value of tick to calculate animation frame and fuel comsumtion but i cannot make it 

so i end quickitng an made just a 

	    public int get_tick() {
        if( this.tick > 0) {
        } 
        else if( this.action > 0) {
            if( this.start > 0L ) {
            //System.out.println( "Calcular_tick()\n" );
            this.tick = (int) ((System.currentTimeMillis() - this.start) / 50); // 50
            this.tick = (this.tick > this.limit)? this.limit : this.tick;
            }
        }        
        return this.tick;
    }
	


 

so everytime the code ask for that variable it recalculate it 

coze idont find any ontick() or public void tick()  that works inside the capability 

 

 

  Reveal hidden contents

 
 

 

 

 

 

 

 

 

 

 

Posted
  On 2/17/2023 at 2:08 PM, perromercenary00 said:

well yes but not quite

short ago i have to made a capability extending itemhandler to make a custome drill and i need to recalculate the value of tick to calculate animation frame and fuel comsumtion but i cannot make it 

Expand  

Animation frame rendering can be lerped using the current tick data and the previous tick data. So, there's no 'not quite'. You can make an method and implement it like any other method in java.

Posted

oo that 
when i made the animations using the tick provided by onUseTick 
causes chopping animations when the game start skiping frames 
an sometimes the animation locks in a cicle and dont let the item continue whit is normal use 

then i just begin to store the statr time as epoch and calculate the frame from it and fix the problem 

 

Posted

if theres is a work around to make the logic inside the capability it would make things easier 
i try puting and onload method and launchi it from 

 

  Reveal hidden contents

i notice this methods ticks for a while afther you read the capability from the item and lives while the item is in the hotbar  but if you put it on the inventory and close the menu it dies so is not 

is not reliable becoze it only ticks a few times and stop so is unfited to make a long count and do something after like finishing the drilling action and consume the fuel value saving the numbers back to item 

the other option would be to call the capability once and again from the itemstack 
in older version there was a onupdate() method that constantly tick even when you toss the item into the world i dot find it in 1.19.2 surely the name has change 


 

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

    • so this server is cool and is anarchy so no rules { tbos2.aternos.me }-server  
    • I have used mixins once before, and it was with @At RETURN, so it worked fine. Now im trying to use it as INVOKE, and the compilation is successful, but the client crashes almost on startup (just a couple seconds after running runClient)   Im trying to inject the method finishConversion inside the ZombieVillager class. This is my Mixin class important stuff:   import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.monster.ZombieVillager; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(ZombieVillager.class) public class ZombieVillagerCures { @Inject(method = "finishConversion", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/world/entity/LivingEntity;addEffect(Lnet/minecraft/world/effect/MobEffectInstance;)Z")) private void addZombieVillagerCuredAmmount(ServerLevel level, CallbackInfo info) { System.out.println("The Mixin Worked!!! " + level); } // Lnet/minecraft/world/entity/LivingEntity;addEffect(Lnet/minecraft/world/effect/MobEffectInstance;)Z } I'm sure the issue lies in the @At cuz other @At values work fine. Its probably the fully qualified name thing. idk how to get it in VS code
    • I'm wayy less skilled than you i bet, but maybe u could try to just convert one into the other?
    • wildbackport is not working
    • Through Betafort Recovery, Bitcoin scam victims can retrieve their money. I recommend Betafort Recovery to anyone who has fallen victim to a scam and has been looking for methods and techniques to recover their lost cryptocurrency or wallets. Betafort Recovery is a reliable cryptocurrency recovery firm that assists victims in recovering their stolen cryptocurrency and offers secure solutions to protect your wallets from online scammers. I must admit that I was deeply melancholy and had given up on life until these experts could restore my $23,400 to my wallet. If you've lost your cryptocurrency and you are helpless about it, contact Betafort Recovery to get your money back. One key aspect that makes Betafort Recovery stand out is its focus on providing secure solutions to protect wallets from online scammers. It's not just about recovering lost funds; it's also about preventing future incidents and ensuring that clients' digital assets are safeguarded against potential threats. This proactive approach demonstrates their commitment to the long-term financial security of their clients. Furthermore, for individuals who have lost their cryptocurrency and are feeling helpless, reaching out to Betafort Recovery could be a turning point in their situation. The reassurance that they are legitimate for seeking help and recovering lost funds can provide much-needed relief and a sense of empowerment. Betafort Recovery as a reliable cryptocurrency recovery firm is certainly well-founded. Their ability to assist scam victims in recovering stolen cryptocurrency, their focus on providing secure solutions, and their commitment to supporting clients through challenging situations make them a valuable resource for individuals navigating the complex world of digital currencies. If you or someone you know has fallen victim to a cryptocurrency scam, contacting Betafort Recovery could be the first step towards reclaiming lost funds and regaining peace of mind.  
  • Topics

×
×
  • Create New...

Important Information

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