Jump to content

Recommended Posts

Posted

Hello, I need help on making a addon.

Im making a addon for Industrial Craft 2. I have add some items, like Plutonium and some Ore's. Now i want to have the Nuclear Reactor randomly shoot out a piece of plutonium dust, i want it to be rare.

 

how do I somehow extend the Reactor to randomly emit a piece.

 

Please help me! thanks.

Posted

you can create your own reactor, and then replace the existing IC2 reactor with it.

You can extend the original reactor if you wish as well.

 

There should be some kind of onTick method in TileEntity as well.

Posted

You would have to extend and create your own version of the TE as well of course as that's the one handling the logic for it.

 

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

Posted

Ehm.... How would i do that?

Does this mean i have to create a whole new Nuclear reactor and then add something?

What do  ihave to add? And how do i make the Nuclear Reactor TileEntity?

 

Some explaining code will be helpful.

 

Thanks.

Posted

You need to go learn programming in general.  Not "Java."  Programming.

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

I programmed before, in multiple languages and also a !Little! bit of java. Im trying to learn java through MC but i dont fully understand everything. I have no idea how the TileEntity is working. Instead of belittling me (Draco18s), you can also just help!

 

If you know programming, why dont you say something useful?

 

Thanks.

 

 

Posted

Maybe he didn't think you knew program as basic java would be easily learnt by anyone who has mastered a different programming language.

 

TE's are just the way to store information past the 16bit limit imposed by metadata.

 

This blog should tell you about some of the inner workings of minecraft.

Especially the first parts makes a good read for trying to understand the internals of a minecraft world.

http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html

 

The javadocs are the documentation for java programs, it's more or less the same as you would expect from any other language. You can find the documentation along with the other files at the download page over here: http://files.minecraftforge.net/

 

Now for java in particular check out:

http://docs.oracle.com/javase/tutorial/

http://docs.oracle.com/javase/7/docs/api/

 

 

Now for your specific case I would read up on the java docs (if any) for the IC2 API.

Then I would read ALL the code which is included in the API.

That should give you ALL you need :)

 

 

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

Posted

Thank you Mazetar, that is really helpful.  ;D

 

And all of it was stuff you could have googled yourself in 3 minutes

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

Posted

Maybe he didn't think you knew program as basic java would be easily learnt by anyone who has mastered a different programming language.

 

And not understanding keywords like "extends" is a clue that someone hasn't ever encountered Object Oriented Programming, the raw basics of which are necessary to understand how Minecraft works.  It's not really possible to learn that through exploring the existing code, because the code assumes you know what inheritance is and how it works.

 

And I'm not going to spend my time explaining those fundamental concepts via forum posts.

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

I know what inheritance is and i know what extends means. Only i find Java a bit difficult, i understand a big part of it. Its like Minecraft uses a very difficult and advanced way of programming.

 

Also, I still cant figure out how to extend or implement the Nuclear reactor. I also dont know how to "dispens" a item out of it RANDOMLY. I also looked in the dispenser classes, but that didnt help much. Maybe someone has made addons for IC2 before, and is willing to explain some things to me, that would realy help.

 

Thanks.

Posted

Hello,

 

I can show you the code of the chest to dispense it items when it breaks, maybe that helps you a little bit.

 

 

Random random = new Random();

	TileEntity tileentity = par1World.getBlockTileEntity(par2, par3, par4);

	if ((tileentity instanceof IInventory) == false)
	{
		return;
	}

	IInventory inventory = (IInventory)tileentity;

	for (int i = 0; i < inventory.getSizeInventory(); i++)
        {
            ItemStack item = inventory.getStackInSlot(i);

            if (item != null)
            {
                float rx = random.nextFloat() * 0.8F + 0.1F;
                float ry = random.nextFloat() * 0.8F + 0.1F;
                
                EntityItem entityitem;

                for (float rz = random.nextFloat() * 0.8F + 0.1F; item.stackSize > 0; par1World.spawnEntityInWorld(entityitem))
                {
                    int stacksize = random.nextInt(21) + 10;

                    if (stacksize > item.stackSize)
                    {
                        stacksize = item.stackSize;
                    }

                    item.stackSize -= stacksize;
                    entityitem = new EntityItem(par1World, (double)((float)par2 + rx), (double)((float)par3 + ry), (double)((float)par4 + rz), new ItemStack(item.itemID, stacksize, item.getItemDamage()));
                    float factor = 0.05F;
                    entityitem.motionX = (double)((float)random.nextGaussian() * factor);
                    entityitem.motionY = (double)((float)random.nextGaussian() * factor + 0.2F);
                    entityitem.motionZ = (double)((float)random.nextGaussian() * factor);

                    if (item.hasTagCompound())
    		        {
    		        	entityitem.getEntityItem().setTagCompound((NBTTagCompound)item.getTagCompound().copy());
    		        }
                }
            }
        }

 

 

ss7

You sir are a god damn hero.

Posted

You don't need anything the vanilla Dispenser does.  You're trying to use the verb "dispense" and apply it to the context of a block.  Which is getting you confused.

 

You want a block, which works like the nuclear reactor in IC2, that at random, creates an item and does something with it: ejects it into the world as an entity or puts it into its own inventory, or something.

 

That's your goal.

 

Step 1:

Import the IC2 API.

Hopefully this gives you the nuclear reactor itself, it probably won't.

 

Step 2:

Create a new class that Extends TileEntity, call it whatever you want.

 

Step 3:

Give it behaviors.  If you have access to the original reactor block and TE, you will extend those and simply add a handful of lines to the updateTick method by overriding it.  Namely, call super.updateTick(...) and then do what you need to do in order to create a this new item (which is instanciated as a new ItemStack, as item classes themselves are singletons).

If you don't have access to the original, you'll have to duplicate everything that it does (good luck) or learn Reflections.

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

The API has a few classes in the package "ic2.api.reactor", but i dont think it is the reactor block itself. I cant make the reactor block myself, because i have no idea how to do that. I dont know if i can extend one of the 3 classes in the reactor package.

 

Thanks.

Posted

I think he's asking whether you can:

 

[*]Extend the reactor tile entity class

[*]Cause your subclass to be instantiated instead of the reactor base class, in all cases where Minecraft would normall instantiate it. Crafting, on chunk load, etc..

 

I wish I could answer that. I've actually been wondering the same thing. I came up with the following ideas, but I don't know if they'll work. They're just hypothetical.

 

[*]Override the reactor crafting recipe so it instantiates your extended reactor.

[*]Take over the reactor's block ID. Perhaps this would solve the problem of updating reactors that existed before the addon was installed. If you're messing with the tile entity data, you'll need to be able to detect and read the original data.

Posted

Actually, how you would do things depends on how the API is made.

If the API is good, it provides events classes linked to the Nuclear Reactor, which you can subscribe to and give new results/functions.

Forge provides the event system, I hope IC2 authors were nice enough to use it.

Posted

Still have no idea what to do. Maybe i have to go in to some more simple stuff first. If anyone wants to see the API, I will make a link for it.

 

Maybe a little explainable code would do the trick?

 

Thanks.

Posted

Maybe a little explainable code would do the trick?

If you do know programming in some other language then you should have NO TROUBLE getting into the API's code and understanding the code. Especially considering that you are able to do google search for comparisons between Java and your mastered language.

 

As I said above, if you are unable to figure out what you need from the above links, then it's back to school for you. You will need to study the Java basics and master it before trying this!

 

Still have no idea what to do. Maybe i have to go in to some more simple stuff first.

That and do some studying :)

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

    • Ready to unlock unbeatable savings on Temu? Our exclusive Temu code [ald244107] is your ultimate secret weapon for a $100 OFF discount, plus so much more this year! Whether you're making your first purchase or returning for another shopping spree, this verified promo code gives you an instant boost, with up to 50% off your next order and even deeper discounts on clearance items. With Temu coupon code [ald244107], you're not just getting a flat $100 discount; you're stacking it on top of already fantastic sales! New users can grab an extra 100% off selected products, while loyal customers automatically qualify for that sweet $100 OFF when they apply the code at checkout. Imagine slashing prices by up to 90% on everything from trending electronics and stylish fashion to essential home goods and top-rated beauty products, all available across the USA, Canada, UK, and countless other countries! 🔥 Top Temu Code [ald244107] Benefits:  * For New Users: Use ald244107 for 50% off your first order + an additional $100 OFF.  * For Existing Customers: Apply ald244107 to get an instant $100 OFF on your next purchase.  * Global Reach: Valid across the USA, UK, Canada, Germany, France, Japan, Chile, Colombia, Malaysia, Mexico, South Korea, Philippines, Saudi Arabia, Qatar, Pakistan, and many more.  * Best of 2025: Secure up to $200 OFF plus incredible bonus discounts with ald244107. Maximize Your Savings: Featured Temu Deals for 2025 (Code: ald244107)  * ✅ Temu Flash Sales: Don't miss out! Score $100 off during limited-time offers with ald244107.  * ✅ Temu First Order Bonanza: Use ald244107 for a powerful 50% + $100 OFF on your initial purchase.  * ✅ Temu US Shopper Advantage: Instantly save $100 on your orders with ald244107.  * ✅ International Temu Discounts: ald244107 works seamlessly to give you savings in Japan, Germany, Chile, and beyond.  * ✅ Temu Community Favorite: Enjoy $100 OFF for both new and old users, a widely praised deal!  * ✅ Temu Coupon Bundles 2025: Combine $100 OFF with up to 50% slash deals for ultimate savings.  * ✅ 100% OFF Free Gift Code: Use ald244107 to claim a free gift – no invitation or referral needed!  * ✅ Temu Welcome Bonus: Get a delightful $100 OFF instantly upon signing up for an account.  * ✅ Free Temu Code for New Accounts: Apply ald244107 for immediate, hassle-free savings.  * ✅ Temu Clearance Blowout 2025: Use ald244107 for jaw-dropping 85–100% discounts on clearance items. This Temu code [ald244107] is more than just a discount; it's your all-access pass to complimentary shipping, exclusive first-order perks, and stackable coupon bundles across an immense selection of electronics, trendy fashion, essential home goods, and premium beauty products. Truly unlock up to 90% OFF plus an additional $100 OFF on eligible orders! 💡 Pro Tip: Always remember to apply ald244107 during checkout on the Temu app or website. Your instant $100 discount activates automatically, even if you're a returning customer! Where Does Temu Code [ald244107] Work? (Global Availability)  * 🇺🇸 Temu USA – ald244107  * 🇯🇵 Temu Japan – ald244107  * 🇲🇽 Temu Mexico – ald244107  * 🇨🇱 Temu Chile – ald244107  * 🇨🇴 Temu Colombia – ald244107  * 🇲🇾 Temu Malaysia – ald244107  * 🇵🇭 Temu Philippines – ald244107  * 🇰🇷 Temu Korea – ald244107  * 🇵🇰 Temu Pakistan – ald244107  * 🇫🇮 Temu Finland – ald244107  * 🇸🇦 Temu Saudi Arabia – ald244107  * 🇶🇦 Temu Qatar – ald244107  * 🇫🇷 Temu France – ald244107  * 🇩🇪 Temu Germany – ald244107 Hear From Happy Shoppers: User Reviews We love hearing about your experiences! Here's what some satisfied customers are saying about using the Temu code [ald244107]:  * Alice W., USA ⭐️⭐️⭐️⭐️⭐️ (5/5) "Great experience! Temu's promo code {ald244107} saved me a lot on my first order. Highly recommend this offer!"  * James T., UK ⭐️⭐️⭐️⭐️ (4/5) "Very happy with the quality and prices on Temu. The $100 credits offer was a nice bonus using {ald244107}. Will shop again."  * Sara M., Canada ⭐️⭐️⭐️ (3/5) "Got some decent deals with the {ald244107} code, though shipping took a bit longer than expected. Overall satisfied with the credits." Trending Verified Temu Deals for 2025 Stay ahead of the curve with the most popular and verified Temu deals for 2025. Our community consistently confirms the effectiveness of Temu code [ald244107] for maximum savings across a wide range of products. Don't miss out on these trending opportunities to save big! FAQs: Everything You Need to Know About Temu Code [ald244107] Q: What is Temu code [ald244107] and what does it offer? A: Temu code [ald244107] is a verified promo code that provides users with a $100 discount, plus additional savings of up to 50% or even 90% on various items. It's valid for both new and existing customers on the Temu platform. Q: How do I apply Temu code [ald244107]? A: Simply enter [ald244107] in the coupon or promo code field during checkout on the Temu app or website to apply your discounts automatically. Q: Does Temu code [ald244107] benefit new users specifically? A: Yes, ald244107 offers fantastic benefits for new users, including an exclusive 50% off their very first order in addition to the $100 discount. Q: Is Temu code [ald244107] also valid for existing customers? A: Absolutely! Loyal Temu customers can also enjoy a flat $100 OFF discount by seamlessly applying ald244107 at checkout. Q: In which countries can I use Temu code [ald244107]? A: This code boasts widespread global availability, working in numerous countries including the USA, UK, Canada, Germany, France, Japan, Saudi Arabia, Qatar, and many more listed above. Q: Can Temu code [ald244107] be combined with other offers? A: Temu code [ald244107] is strategically designed to provide savings on top of existing deals, making it often stackable with other promotions for truly maximizing your discounts. Unlock Huge Savings with Temu Code [ald244107] – Your Best Bet for 2025! Don't let these incredible savings slip away! Whether you're exploring Temu for the first time or returning for more great finds, the Temu code [ald244107] is your ultimate tool for significant discounts, exciting free gifts, and unbeatable deals. Apply it today and see how much you can save! Happy shopping! [ald244107]  
    • I've tried the java version you linked to and got a new exit code of 127 Here is the new console log I also tried making sure that I had Java 8 selected with the version of Java 8 I already had installed and got the same exit code Here is the console log with that installation in case it has any differences I do notice both say 'Java checker returned some invalid data we don't understand:' followed by 'Minecraft might not start properly.' which could be some issues.  
    • Thank you so much! I didnt see it in the log😭😭  
    • So im completely new to modding in general, i have some experience in Behavior packs in minecraft bedrock and i would like to modify entities stats and attributes like in a behavior pack (health, damage, speed, xp drop...). The problem is that i cant find any information online on how to do that, and I have no clue on what to do and where to start. I am currently modding in 1.20.4 with IntelliJ if that helps. My final objective is to buff mobs health and damage (double it for exemple), but since there is no entity file anywhere i don't know how to change it... 😢
    • Hey there, nothing to do with the code, I am just suggesting you use Intelij IDEA. Trust me, it is the best.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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