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

    • My name is Richie Leo, and I’m sharing this message with a heart full of gratitude and hope. Several months ago, I was a victim of a devastating online scam that cost me a staggering $873,463. I was devastated, confused, and had nearly given up on ever recovering my money — until I came across Wizard George Cyber Service. Through their exceptional cyber recovery expertise and deep investigative skills, Wizard George and his team were able to trace, track, and recover the full amount that was stolen from me. Their professionalism, speed, and transparency truly amazed me. If you’re reading this and you’ve been scammed — whether it’s crypto, investment fraud, or any kind of online theft — don’t give up. I strongly recommend reaching out to Wizard George Cyber Service. 📧 Em: wizardgeorgecyberservice(AT) g m a l L. C o M
    • Alright, here is the log file https://mclo.gs/5eCwafV
    • Please read the FAQ (https://forums.minecraftforge.net/topic/125488-rules-and-frequently-asked-questions-faq/) and post log files as described there, using a site such as https://mclo.gs/ and post the link here.  
    • I tried updating the mods in my modpack which caused incompatibilities so i have tried to revert them back to their older versions i was using before. In the logs it doesnt show me any clear incompatibilities except for tfmg & entity texture features, but when i try to remove those it still doesn't work. I have tried removing the forge-client.toml file which was a suggestion i found on  a few other posts. This is the log file i get. [inline log removed] Any help would be appreciated. Thanks in advance
    • I don't use KubeJS, never even heard of it. But after doing what "Ugdhar" suggested earlier in this post with the "config/Mekanism/generator-storage.toml", I tried going into an individual save's serverconfig folder, and just deleting everything except the parcool folder (I have that mod installed.) Then, a bit of loading and temporary freezing later, seems to have worked. Even when quitting to menu and loading back in, or also when quitting to menu, exiting to desktop, and re-launching MC, choose a save and loading it.
  • Topics

×
×
  • Create New...

Important Information

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