Jump to content

Can I make Tickable tileentities update some functionality every several ticks?


Ice2670

Recommended Posts

Make a counter that increments every tick. If the counter hits 5, reset it to 0 and do whatever you want.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

2 hours ago, DavidM said:

Make a counter that increments every tick. If the counter hits 5, reset it to 0 and do whatever you want.

thank you for replying! are there 3 kinds of counters for ServerTickEvent, WorldTcikEvent and PlayerTickEvent? 

 Mind show me an example or just direct me to a thread with examples?

Link to comment
Share on other sites

Those are irrelevant. Add the counter in your ITickable#update. My previous post explained how to implement this.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

3 hours ago, Ice2670 said:

thank you for replying! are there 3 kinds of counters for ServerTickEvent, WorldTcikEvent and PlayerTickEvent? 

 Mind show me an example or just direct me to a thread with examples?

By counter, I believe DavidM is suggesting you use a type such as an Integer which is incremented by 1(int++) within update().

You would then have the if statement check the value of this Integer and if it reaches 5, set it back to 0.

Link to comment
Share on other sites

19 minutes ago, TheMCJavaFre4k said:

Integer

probably an int, not an Integer

20 minutes ago, TheMCJavaFre4k said:

1(int++)

This is also the perfect place for a pre-increment with ++counter;

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

41 minutes ago, Krevik said:

in your tile entity class


private int ticker=0;

in your tick() method


tick(){
ticker++;
  if(ticker>=5){
  ticker=0;
  //do your thing here
  }
}

 

1. Use the correct syntax highlight when posting code.

2. Post code with correct Java syntax or specify that it is pseudocode.

3. Don't just post solutions like that. Others can copy/paste without learning.

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

2 hours ago, DavidM said:

1. Use the correct syntax highlight when posting code.

2. Post code with correct Java syntax or specify that it is pseudocode.

3. Don't just post solutions like that. Others can copy/paste without learning.

Others already explained it enough. He asked for example. And this your post is not connected with his problem.

Edited by Krevik
Link to comment
Share on other sites

3 hours ago, Krevik said:

He asked for example.

1. Even if he did, you should not directly post the code that he is supposed to write.

2. Your example is bad both style-wise and performance-wise. This will set a poor example for others.

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

12 minutes ago, DavidM said:

1. Even if he did, you should not directly post the code that he is supposed to write.

2. Your example is bad, both style-wise and performance-wise. This will set a poor example for others.

Okay I will delete my bad example then.

Link to comment
Share on other sites

They don’t exactly “let” you learn. They force you to learn ?

  • Haha 2

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

On 2/27/2019 at 3:09 AM, DavidM said:

1. Use the correct syntax highlight when posting code.

2. Post code with correct Java syntax or specify that it is pseudocode.

3. Don't just post solutions like that. Others can copy/paste without learning.

What you say is ridiculous. I'll need to understand what you are saying so that i can learn, but most of the time it is really hard to understand what you say with out an example. For example, what i don't understand is "counter", it is a term that others may don't understand. you should say an int++ in update() can be a counter, or show me that update{int++ } is a counter. other wise HOW I'm I suppose to learn??

Edited by Ice2670
Link to comment
Share on other sites

On 2/27/2019 at 5:35 AM, Krevik said:

Others already explained it enough. He asked for example. And this your post is not connected with his problem.

keep your example there, what DavidM says really don't make sense! People can LEARN WITH examples!

Link to comment
Share on other sites

On 2/27/2019 at 8:39 AM, DavidM said:

1. Even if he did, you should not directly post the code that he is supposed to write.

2. Your example is bad both style-wise and performance-wise. This will set a poor example for others.

yeah, maybe the example is not that good, then you should tell others what is a good example!!! If you are a teacher then you are a BAD teacher with BAD teaching principle!!

Link to comment
Share on other sites

4 hours ago, Ice2670 said:

other wise HOW I'm I suppose to learn??

1. If you need an example in order to understand "increment every tick and check if it reaches 5", then you should probably learn basic programming before trying to make a mod. It is a basic programming concept.

2. He is not giving you an example, but rather giving you a copy to copy/paste from, which is discouraged on this forum.

Edited by DavidM
Deleted unproductive comments

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

1 hour ago, DavidM said:

1. If you need an example in order to understand "increment every tick and check if it reaches 5", then you should probably learn basic programming before trying to make a mod. It is a basic programming concept.

2. He is not giving you an example, but rather giving you a copy to copy/paste from, which is discouraged on this forum.

 

3. I'm not a teacher, but my principle is that people should learn instead of posting functioning code for others to copy.

 

4. a) add space to style code. b) use I++ inside the if loop to prevent multiple unnecessary references.

not everyone here is a professional computer programmer and you don't need to be a computer programmer to make a mod!! 

Link to comment
Share on other sites

1 hour ago, DavidM said:

 

 

3. I'm not a teacher, but my principle is that people should learn instead of posting functioning code for others to copy.

 

 

I don't care how your principle work! different people got different learning principle, if you don't have the ability to understand that you are just simply toooooooooooo selfish! not to mention that you are imposing your principle on others!

Link to comment
Share on other sites

1 hour ago, DavidM said:

 

2. He is not giving you an example, but rather giving you a copy to copy/paste from, which is discouraged on this forum.

 

 

the problem is you didn't even give me a proper example in your standard! and the code he gave me is definitely not gonna work on my mod if i just copy/paste it 

Link to comment
Share on other sites

1 hour ago, Ice2670 said:

you don't need to be a computer programmer to make a mod

You need to know programming though.

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

8 minutes ago, DavidM said:

You need to know programming though.

You should probably, you know, learn programming like a good boy and stop telling others to give you copy/paste-able code.

Also, you focus too much on complaining instead of trying to solve your problem, so welcome to my ignore list ;).

my problem is already solved you dumbass! it's you being a selfish dumbass first so i replied. Since you are not being helpful i don't need your future help either, you are also on my ignore list 

Edited by Ice2670
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • OLXTOTO: Menikmati Sensasi Bermain Togel dan Slot dengan Aman dan Mengasyikkan Dunia perjudian daring terus berkembang dengan cepat, dan salah satu situs yang telah menonjol dalam pasar adalah OLXTOTO. Sebagai platform resmi untuk permainan togel dan slot, OLXTOTO telah memenangkan kepercayaan banyak pemain dengan menyediakan pengalaman bermain yang aman, adil, dan mengasyikkan. DAFTAR OLXTOTO DISINI <a href="https://imgbb.com/"><img src="https://i.ibb.co/GnjSVpx/daftar1-480x480.webp" alt="daftar1-480x480" border="0" /></a> Keamanan Sebagai Prioritas Utama Salah satu aspek utama yang membuat OLXTOTO begitu menonjol adalah komitmennya terhadap keamanan pemain. Dengan menggunakan teknologi enkripsi terkini, situs ini memastikan bahwa semua informasi pribadi dan keuangan para pemain tetap aman dan terlindungi dari akses yang tidak sah. Beragam Permainan yang Menarik Di OLXTOTO, pemain dapat menemukan beragam permainan yang menarik untuk dinikmati. Mulai dari permainan klasik seperti togel hingga slot modern dengan fitur-fitur inovatif, ada sesuatu untuk setiap selera dan preferensi. Grafik yang memukau dan efek suara yang mengagumkan menambah keseruan setiap putaran. Peluang Menang yang Tinggi Salah satu hal yang paling menarik bagi para pemain adalah peluang menang yang tinggi yang ditawarkan oleh OLXTOTO. Dengan pembayaran yang adil dan peluang yang setara bagi semua pemain, setiap taruhan memberikan kesempatan nyata untuk memenangkan hadiah besar. Layanan Pelanggan yang Responsif Tim layanan pelanggan OLXTOTO siap membantu para pemain dengan setiap pertanyaan atau masalah yang mereka hadapi. Dengan layanan yang ramah dan responsif, pemain dapat yakin bahwa mereka akan mendapatkan bantuan yang mereka butuhkan dengan cepat dan efisien. Kesimpulan OLXTOTO telah membuktikan dirinya sebagai salah satu situs terbaik untuk penggemar togel dan slot online. Dengan fokus pada keamanan, beragam permainan yang menarik, peluang menang yang tinggi, dan layanan pelanggan yang luar biasa, tidak mengherankan bahwa situs ini telah menjadi pilihan utama bagi banyak pemain. Jadi, jika Anda mencari pengalaman bermain yang aman, adil, dan mengasyikkan, jangan ragu untuk bergabung dengan OLXTOTO hari ini dan rasakan sensasi kemenangan!
    • Slot deposit dana adalah situs slot deposit dana yang juga menerima dari e-wallet lain seperti deposit via dana, ovo, gopay & linkaja terlengkap saat ini, sehingga para pemain yang tidak memiliki rekening bank lokal bisa tetap bermain slot dan terbantu dengan adanya fitur tersebut.   DAFTAR & LOGIN AKUN PRO SLOT DEPOSIT DANA ⭐⭐⭐ KLIK DISINI ⭐⭐⭐  
    • Slot deposit dana adalah situs slot deposit dana minimal 5000 yang dijamin garansi super gacor dan gampang menang, dimana para pemain yang tidak memiliki rekening bank lokal tetap dalam bermain slot dengan melakukan deposit dana serta e-wallet lainnya seperti ovo, gopay maupun linkaja lengkap. Agar para pecinta slot di seluruh Indonesia tetap dapat menikmati permainan tanpa halangan apapun khususnya metode deposit, dimana ketersediaan cara deposit saat ini yang lebih beragam tentunya sangat membantu para pecinta slot.   DAFTAR & LOGIN AKUN PRO SLOT DEPOSIT DANA ⭐⭐⭐ KLIK DISINI ⭐⭐⭐  
    • Slot deposit pulsa adalah situs slot deposit pulsa tanpa potongan apapun yang dijamin garansi terpercaya, dimana kamu bisa bermain slot dengan melakukan deposit pulsa dan tanpa dikenakan potongan apapun sehingga dana yang masuk ke dalam akun akan 100% utuh. Proses penarikan dana juga dijamin gampang dan tidak sulit sehingga kamu tidak perlu khawatir akan kemenangan yang akan kamu peroleh dengan sangat mudah jika bermain disini.   DAFTAR & LOGIN AKUN PRO SLOT DEPOSIT PULSA TANPA POTONGAN ⭐⭐⭐ KLIK DISINI ⭐⭐⭐  
    • Slot deposit pulsa merupakan situs slot deposit pulsa tanpa potongan apapun yang dijamin 100% garansi bebas biaya dimana deposit pulsa yang masuk ke dalam akun tidak akan dikenakan potongan apapun sehingga para pemain tidak akan terbebani dan bisa memanfaatkan modal bermain mereka dengan lebih maksimal. Sebab slot deposit pulsa tanpa potongan ini bertujuan untuk membantu para pecinta slot yang gemar bermain tetapi terhalang oleh keterbatasan akses dan modal, yang maka dari itu kami hadirkan fasilitas terbaru ini.   DAFTAR & LOGIN AKUN PRO SLOT DEPOSIT PULSA TANPA POTONGAN ⭐⭐⭐ KLIK DISINI ⭐⭐⭐  
  • Topics

×
×
  • Create New...

Important Information

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