Jump to content

Recommended Posts

Posted

Hi folks,

 

I'm just starting off modding, so I have an easy question for you all. I would like to set a block at arbitrary coordinates (say 0,80,0) to an arbitrary value. (say, block of emerald, or id 133)

 

I've been following the tutorials here:

http://www.minecraftforge.net/wiki/Basic_Modding

 

But I'm not seeing any information on how to set a block post-world generation. I've also taken a look at the Ruins mod source code, and discovered the setBlock function there.

 

I'm 99% sure that setBlock shouldn't go in preInit, load, or postInit, because I'm assuming those functions are just relating to loading the mod. We need to call setBlock after the world has already been generated.

 

I basically just need to know how and when to call setBlock, and how to reference the current world in setBlock.

 

Thanks folks!!  :)

Posted

You can do setBlock whenever you have access to the world object, and some position you want to place it.

If you don't want it during world gen, then the better question is when do you want it? :)

 

Also all Entities have a worldObj field for the world they are currently in, this includes the player.

So you have access to a reference to a world most of the time :)

When a player uses an item for example, you know the player, so you know the world hes in.

  Quote

If you guys dont get it.. then well ya.. try harder...

Posted

You could use the terrain gen events and do it in the last step of the generation?

I dunno what it would be tbh, but hey have you actually tested just using the world generator?

It does happen after the caves and shit. Alternatively I guess you could perhaps use the BiomeDectorator? :P

 

Why does it need to be last?

For most cases the world generation method which is used for custom structures by many mods should suffice:)

  Quote

If you guys dont get it.. then well ya.. try harder...

Posted

I wanted it to be last as I wanted to ensure that my block wasn't overwritten with another block.

 

I'll google biome decorator and see what I can find there.

 

My issue is that the Forge tutorials are currently not extensive enough to allow me to see how to proceed. However, I did just find this:

 

http://wuppy29.blogspot.nl/2012/08/modding-ore-generation.html

 

So I will look that over and see if I can use that.

 

An example here would be awesome, it might actually make for a good tutorial to go along with the rest of the Forge tutorials, ie, "Here's how you set a single block".

 

Thanks!

Posted

If you use it during world gen, then it will most of the time not be removed by other stuff.

If your mod is the only one being used then it's quite unlikely that your shit will be touched :P

  Quote

If you guys dont get it.. then well ya.. try harder...

Posted

Ok cool. I thinking something like "First vanilla minecraft decides where to place all blocks, once that step is done, then I can determine what blocks to change". That is what I meant by "post-world generation" :P

Posted
  On 11/5/2013 at 9:22 PM, foul_owl said:

Ok cool. I thinking something like "First vanilla minecraft decides where to place all blocks, once that step is done, then I can determine what blocks to change". That is what I meant by "post-world generation" :P

 

IIRC there's like four steps:

 

1) Terrain

2) Features (ravines, caves)

3) Decoration (trees, flowers)

4) Structures (villages, mineshafts)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

That makes sense.

 

I would like to perform a setBlock() as soon as step 4 finishes, but before anything else is done.

 

How would I do this? If I could see a code snippet, it would be much appreciated, particularly as I am brand new to this.

 

As another option, I would be down to execute a setBlock() when a key is pressed, ie, the "j" key. (Hardcoded for now, but of course I understand that is bad practice haha)

 

Thanks!

Posted

You can't wait for step 4 to finish, technically.  At best you can do your stuff IN step 4.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Yes...but that's a lot of work for a single setblock

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Understood.

 

But it might be a good way for me to learn how to execute an arbitrary function via keypress.

 

In the meantime, for the sake of avoiding scope creep, I'm back to my original question, ie, changing blocks at the end of stage 4.

 

Thanks!

Posted
  On 11/5/2013 at 10:48 PM, foul_owl said:

It wouldn't be possible to execute a setBlock from a keypress?

 

First learn how to do something on a keypress, there's a tutorial for that over at the minecraft forums.

Also learn how to work with packets, since Input is client side, while setting a block must be done on the server side (it can be done on both sides, but it MUST be done on the server in order to affect the world as the server is the boss of everything ;) )

 

Then you can do on key pressed -> packet to server -> packet handled on server side -> do the setBlock.

 

 

For your original question, I doubt it's possible to guarantee that it happens last during the world gen.

But if you do it during the 4th stage it would be small chances of it getting overwritten by something else.

 

Is this a block which only needs to be generated once during the very start of the game, near spawn for example?

 

  Quote

If you guys dont get it.. then well ya.. try harder...

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

    • Hello to everyone. I am new here... Nice to meet you.<><><>.........
    • Temmuz 2025 için En İyi 7 Temu Kampanyası: (acu729640) Kupon Kodu ile Büyük Tasarruf Edin Giriş:  Temmuz 2025, Temu’dan kaçırılmayacak fırsatlarla geliyor. Moda, elektronik, ev ürünleri veya kozmetik alışverişi yapıyor olun fark etmez – güçlü Temu kupon kodu (acu729640) ile açabileceğiniz özel indirimler sizi bekliyor. Bu rehberde, yeni ve mevcut kullanıcılar için geçerli 100$ indirimler, ekstra %40 tasarruf ve kupon paketleri dahil olmak üzere şu anda sunulan en iyi 7 Temu fırsatını sıraladık. 1. Temu Kupon Kodu (acu729640) – Yeni Kullanıcılara 100$ İndirim  Eğer Temu’dan ilk kez alışveriş yapacaksanız, (acu729640) kupon kodu ile siparişinizde anında 100$ indirim kazanabilirsiniz. Bu teklif; trend moda, elektronik ve ev dekorasyon ürünleri gibi birçok kategori için geçerlidir.  Öne Çıkanlar: Tüm site genelinde geçerlidir Ücretsiz hediye dahildir Sadece ilk kez alışveriş yapanlara özeldir ABD, Kanada, Birleşik Krallık ve Japonya’da geçerli 2. Temu Kupon Kodu (acu729640) – Mevcut Kullanıcılara 100$ İndirim  Temu’da daha önce alışveriş yaptıysanız endişelenmeyin; siz de (acu729640) kupon kodunu kullanarak 100$ indirim kazanabilirsiniz. Sadık müşterilere özel bu nadir fırsatı kaçırmayın.  Öne Çıkanlar: Geri dönen müşteriler için geçerlidir Diğer Temu kampanyaları ile birleştirilebilir 150$ üzeri alışverişler için idealdir 3. Temu Kupon Kodu (acu729640) – Ekstra %40 İndirim  Temmuz 2025’in dikkat çeken bir diğer kampanyası: Temu kupon kodu (acu729640) ile %40 ekstra indirim. Bu indirim, mevcut ürün fırsatları, flaş indirimler ve outlet ürünlerle birlikte uygulanabilir.  Öne Çıkanlar: Tüm uygun kategorilerde geçerli Flaş indirimlerle birleştirilebilir Meksika, Brezilya, Fransa ve Almanya’da geçerli 4. Temu 100$ Kupon Paketi – Tek Kodla Birden Fazla Kupon  Temu, artık birden fazla kupon içeren 100$ değerinde bir kupon paketi sunuyor. Bu, birden fazla alışverişte tasarruf etmek isteyen kullanıcılar için mükemmel.  Öne Çıkanlar: Birden fazla kupon içerir (örnek: 20$ x 5) Yeni ve mevcut kullanıcılar için uygundur (acu729640) koduyla kullanılabilir 5. Temu Yeni Kullanıcı Kuponu – Hoş Geldin Hediyesi + İndirim  Temu yeni kullanıcı kuponu sadece indirim değil, aynı zamanda 15$ değerinde bir hoş geldin hediyesi de sunuyor. 100$ indirimle birleştirildiğinde, giriş seviyesi için en cömert tekliftir.  Öne Çıkanlar: 100$ indirim + ücretsiz ürün içerir Belirli ülkelerde minimum harcama şartı yoktur Temmuz 2025 için (acu729640) koduyla geçerlidir 6. Temu Ülkelere Özel Kuponlar – Uluslararası Kullanıcılara Özel Fırsatlar  Temu’nun küresel varlığı sayesinde, farklı bölgelerdeki kullanıcılar Temmuz 2025’te (acu729640) kupon kodu ile özel avantajlar elde edebilir. İşte hızlı bir özet: ABD: 100$ indirim ve hızlı teslimat Kanada: 100$ indirim + ikinci siparişte ekstra indirim İngiltere: Ücretsiz kargo ve %40 indirim Japonya: Öncelikli teslimat ve kupon erişimi Meksika & Brezilya: Elektronik ve giyimde %40 indirim Fransa & Almanya: Temmuz indirimi için erken erişim 7. Temu Temmuz 2025 Yeni Teklifler – Flaş Fırsatlar ve Erken Erişim  Temu, Temmuz 2025’te saatlik flaş fırsatlar, özel kupon paketleri ve yaz koleksiyonlarına erken erişim gibi birçok yeni teklif sunuyor. Tüm bu fırsatlar, (acu729640) kupon kodu ile birlikte sorunsuz çalışıyor.  Öne Çıkanlar: Günlük değişen flaş satışlar Haftalık olarak yeni kupon paketleri 100$ kupon ve %40 indirimle birleştirilebilir Son Düşünceler: (acu729640) Temu kupon kodu sayesinde Temmuz 2025’te dev tasarruflar sizi bekliyor. 100$ indirimden ekstra %40 indirime kadar her teklif, alışveriş deneyiminizi daha kazançlı hale getirmek için tasarlandı. Yeni kullanıcı olun ya da mevcut müşteri, herkes için özel fırsatlar, ücretsiz hediyeler ve kupon paketleri var.  Hemen kazanmaya başlayın: Kodunuzu (acu729640) şimdi kullanın ve Temu’da akıllıca alışveriş yapın!
    • Top 7 Temu Special Offers for July 2025: Save Big with Coupon Code (acu729640) Introduction: July 2025 brings a wave of unbeatable deals from Temu. Whether you're shopping for fashion, electronics, home goods, or beauty, Temu has crafted exclusive offers that you can unlock with the powerful Temu coupon code (acu729640). This guide ranks the top seven Temu promotions available now, including $100 discounts, 40% extra savings, and coupon bundles for both new and existing users. 1. Temu Coupon Code (acu729640) – $100 Off for New Users If this is your first time shopping on Temu, you’re eligible for a flat $100 off your order using Temu coupon code (acu729640). This offer is valid on a wide range of categories, including trending fashion, electronics, and home decor. Highlights: Works sitewide Free gift included Exclusive to first-time buyers Available in USA, Canada, UK, and Japan 2. Temu Coupon Code (acu729640) – $100 Off for Existing Users Returning shoppers aren’t left out. If you’ve shopped with Temu before, you can still apply the Temu coupon code (acu729640) $100 off for existing users. This is a rare opportunity for loyal customers to get deep discounts on their next order. Highlights: Valid for returning customers Compatible with other Temu offers Ideal for larger purchases over $150 3. Temu Coupon Code (acu729640) – 40% Off Extra Discount Another standout offer for July 2025 is the Temu coupon code (acu729640) 40% off. This stacks with existing product discounts, flash sales, and clearance deals, delivering unmatched value for budget-conscious shoppers. Highlights: Applies to all eligible categories Stackable with flash sales Available in Mexico, Brazil, France, and Germany 4. Temu $100 Coupon Bundle – Multiple Coupons, One Code Temu now offers a $100 coupon bundle that includes several smaller denomination coupons you can use across multiple orders. Perfect for shoppers who want to stretch their savings over several purchases. Highlights: Includes multiple coupons (e.g., $20 x 5) Works for both new and existing users Redeem with Temu coupon code (acu729640) 5. Temu First Time User Coupon – Welcome Gift + Discounts The Temu first time user coupon gives more than just a discount — you’ll also receive a welcome gift valued up to $15. Combined with the $100 off for new users, this is the most generous entry-level offer. Highlights: Includes $100 off and a free product No minimum spend in select countries Valid with Temu discount code (acu729640) for July 2025 6. Temu Coupons by Country – Tailored International Offers Temu’s global presence means regional shoppers enjoy unique benefits when using the Temu promo code (acu729640) for July 2025. Here's a quick overview: USA: $100 off and fast shipping Canada: $100 off with bonus discount on second order. UK: Free shipping and 40% off Japan: Priority delivery with coupon code access Mexico & Brazil: 40% off electronics and apparel France & Germany: Early access to July clearance Argentina: Exclusive coupon bun7. Temu New Offers in July 2025 – Flash Deals and Early Access Temu rolls out new offers in July 2025 including hourly flash deals, exclusive bundles, and early access to summer collection sales. All these deals work seamlessly with Temu coupon code (acu729640). Highlights: Daily rotating flash sales New bundles released weekly Combine with $100 coupon code and 40% discount Final Thoughts With the Temu coupon code (acu729640), shoppers can unlock massive savings this July 2025. From the $100 off deals to the 40% extra discount, every offer is built to maximize value. Whether you're a new user or a returning customer, there’s something for everyone — including free gifts and exclusive bundles. Ready to claim your deals? Use the code (acu729640) now and shop smart with Temu.
    • welcome to evrone need to play
  • Topics

×
×
  • Create New...

Important Information

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