Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hey Guys,

I have two questions. At the moment I make a mod called Chemical Mixture. In this mod you can be a Chemist - so the name. But I need two things. First of all the energy System. I would like to create my own energy System because I don't want to use RF or EU. So, I want to create 2 items. 1. The generator, it make energy using coal and 2. the cable, it transport the energy to this point you need the energy. Can you help me, I don't know how I can do this?

The second question is about Liquid Transport Pipes. In my mod you work with Chemical Liquids and you need Liquid Pipes to transport the Liquid, who can I do this?

 

Oh I forgot something, to make the Liquid Pipes I need 3D models, who can I create this models and who can I import the models in eclipse?

 

Sorry for my bad english I am from Germany

Pipes are basically blocks that are custom rendered. You can use block methods to see if the pipe is connected to a block that has stored "liquid" in it and you can give that "liquid" to the pipe so the pipe will transport it to another block that accepts the liquid. For that you will need a tile entity instance of the pipe. About the energy system. That is not hard either. You need a custom class which will hold data about your energyitems or energyblocks, like some energy base values which your blocks or items will hold. Based on these Energy Values you can say if the block will work or not and in what speed it will work. NBT data will be your best friend on this.

But how can I do this...code please  :(

 

I am sorry but i cannot write the whole code for you. Watch tutorials for custom rendering. Watch tutorials on how to use TileEntities. And also watch tutorials on how to use NBTTagCompound. If i am not mistaken the official forge wiki has tutorials for all three of these so you can see some examples there.

But how can I do this...code please  :(

 

Nobody here is going to write code for you, we will give you the knowledge you need to be able to code it, but we won't code it for you, otherwise you wouldn't learn anything.

Don't make mods if you don't know Java.

Check out my website: http://shadowfacts.net

Developer of many mods

^What they said.

 

For the generator, you need to use the TileEntity's onUpdate method. If there is fuel in the slot, then find the fuel's value (look in TileEntityFurnace for that), then remove the item and add that value to the TileEntity's saved value. You'll need to use NBT for that.

It's likely you want to show that value in some sort of GUI too, so you'll need to sync it to the client.

 

I won't provide the code, because obviously it's important to learn it, but the methods you'll need in your TileEntity for that are:

 

void writeToNBT(NBTTagCompound nbt) - Writes the custom fuel value

void readFromNBT(NBTTagCompound nbt) - Reads the value back for usage

Packet getDescriptionPacket() - Writes NBT to a packet to be sent to the client

void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) - Reads the packet on the client (to show the value in a GUI)

 

With those, you can generate fuel and save the value, but it won't keep any extra coal in the inventory - you'll need to implement IInventory for that, as well as make a container.

 

As for your pipes, you'll need a tank or similar first (Similar to above, a tile entity with NBT stuff). Then in your onUpdate, check around your tank for a pipe, and if there is one, fill the pipe with your liquid (which is effectively a tiny tank). Alternatively, you could just track through the pipes until you find another tank/block that accepts liquids - which is how ExtraUtilities works but can be slow for large networks.

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

As a general strategy for making an energy delivery system, I would recommend the following.  The cables should basically check around for any blocks next to it that are a generator, if there is a generator beside it then it should consider itself powered. Then cables should look for any cables around itself that are powered and if there are then consider themselves powered.

 

You could leave it at that (it would create a power system) but it would have a couple issues. First of all, if you deleted a power source it would stay powered. So it could be better to calculate all the power system fresh each tick. In that case you need to iterate until you've propagated the power throgh the entire length of the cable. For example, you would keep cycling through all the cable blocks and check for if any adjacent block is powered, if it is then you power the block and then cycle again -- keep going until you don't find any new blocks that need power.

 

Also, many power systems have a limit on how far the power can propagate. In that case you need to have a power level at the gen4erator and subtract some amount for each piece of cable.

 

But generally the idea is still the same -- each block needs to check all surrounding blocks and propogate power where appropriate.

 

Note that where I say blocks above you probably want to use tile entities since they can contain more complicated data fields and also process every tick.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

You can either use custom models for the pipe or work with block bounds. Another way would be a tessellator but thats to much work for a pipe

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.