Jump to content

Where to learn about power system


Terrails

Recommended Posts

I'm just wondering where could I go to start learning about power system like RF, EU....

I made couple of basic furnaces which are faster and use different kinds of fuel but I want to go further and start making a furnace which uses RF.

Where should I check for that? I heard forge added its own power system.

Link to comment
Share on other sites

Check out the Energy Capability in the forge source and the documentation on Capabilities of the forge docs.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

10 hours ago, Awesome_Spider said:

If you want to use RF I think you have to use this. I'm not sure if you can use it in combination with forge's api or not.

If I remember RF is basically completely deprecated. All mods should move to the standard energy offered directly by Forge.

Link to comment
Share on other sites

32 minutes ago, Koward said:

If I remember RF is basically completely deprecated. All mods should move to the standard energy offered directly by Forge.

 
 

No. It is entirely up to the mod author to decide whether to use the Forge energy capability or not. LexManos explains it here. Also, RF is not deprecated, it just has not updated yet, and a lot of mods which are "RF compatible" are just calling the Forge energy capability "RF". 

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

42 minutes ago, Terrails said:

One question. Can is somehow add another mod to the client for example Ender IO (just for testing with power), if  I put it into run -> mods of my workspace it crashes.

You need to open up your run configurations and remove the arguments.

2 hours ago, Terrails said:

Just one question. What am I supposed to do to make a basic battery block (inputs power, extracts power and max storage), I don't need a GUI for now.

Very simple, you need a block with a TE and the TE needs to return a Energy storage provided by Forge, and you need to make sure it is asking for one of the Forge Energy Capability.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

29 minutes ago, Terrails said:

java.lang.NoSuchMethodError: net.minecraft.block.state.IBlockState.getPropertyKeys()Ljava/util/Collection;
    at crazypants.enderio.render.registry.SmartModelAttacher.bakeModels(SmartModelAttacher.java:153

 

If you look at the IBlockState class do you see a method called getPropertyKeys, or is it called getPropertyNames?

 

The method was renamed from getPropertyNames to getPropertyKeys on 2016-11-17. If you see the old name, you should update your MCP mappings to stable_29 (the final mappings version for 1.10.2).

 

If you're using an obfuscated build of EnderIO, it should be automatically deobfuscated to your current MCP mappings. This error suggests that you're using a deobfuscated build or EnderIO/EnderCore are messing with the deobfuscation.

Edited by Choonster
  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

8 hours ago, larsgerrits said:

No. It is entirely up to the mod author to decide whether to use the Forge energy capability or not. LexManos explains it here. Also, RF is not deprecated, it just has not updated yet, and a lot of mods which are "RF compatible" are just calling the Forge energy capability "RF". 

I do not interpret Lex's message the same way. Of course anyone can use, or not, the Forge capabilities. You can always do whatever energy system you want, that's obvious. But if you want to operate with other mods machine, you have to set a standard. Many energy systems, like RF, were meant to be universal standards, a lot of them proliferated. Now Forge uses its de facto authority to set the new standard.

If you want your machine to not work with/like Forge Energy machines, you can create your own energy with new capabilities (there are a lot of very good reasons to do that). If you want to do compatible machines that use the same Energy as the majority, you use Forge Energy.

Link to comment
Share on other sites

9 minutes ago, Terrails said:

Basically I can name my energy anything and if I use Forge Energy and if some other mod that uses Forge Energy has some other name for their power. Will those two both work? Naming doesn't matter?

Imagine you use builtin capabilities made for Forge Energy. You could create in your mod a machine that outputs Forge Energy. If another mod has a machine that receives Forge Energy, it will work with your FE machine too.

 

Imagine you create new capabilities for your energy, then it will only work with machines made for that energy too.

 

And that's why when people got the idea "machines from many mods compatible together" they needed a standard. For a long time this standard has been RF, now it's becoming FE.

Edited by Koward
Link to comment
Share on other sites

 I made a solar panel which generates 20 energy/t and its storage is 2500 energy, I'm trying to give the player information about the stored power, I'm using RightClickBlock event but I can't place it in my update() method so it just prints it 0/2500 in the chat. If I try to put it into the update() method it says Annotations are not allowed here which is normal, so what should I do about that? BTW when I right click the block it spams the chat 4 times with the information.

TileEntitySolarPanel

Spoiler

public class TileEntitySolarPanel extends TileEntity implements ITickable{

    private final BaseEnergyContainer container;

    public TileEntitySolarPanel() {
        this.container = new BaseEnergyContainer();
        this.container.setMaxEnergyStored(2500);
        this.container.setMaxOutput(15);
        this.container.setMaxInput(20);
    }

    @Override
    public void update() {
        if(this.hasWorld() && !this.world.isRemote) {
            if(!this.getWorld().provider.hasNoSky() && this.getWorld().canBlockSeeSky(this.getPos().offset(EnumFacing.UP))
                    && this.getWorld().getSkylightSubtracted() == 0 && this.container.getEnergyStored() != this.container.getMaxEnergyStored())
                this.container.receiveEnergy(20, false);

            final TileEntity tileEntity = this.getWorld().getTileEntity(this.getPos().offset(EnumFacing.DOWN));

            if(tileEntity != null && !tileEntity.isInvalid()) {
                if(tileEntity.hasCapability(CapabilityEnergy.ENERGY, EnumFacing.UP)) {
                    IEnergyStorage consumer = tileEntity.getCapability(CapabilityEnergy.ENERGY, EnumFacing.UP);

                    if(consumer != null)
                        this.container.extractEnergy(consumer.receiveEnergy(this.container.getEnergyStored(), false), false);
                }
            }
        }
    }
    @SubscribeEvent
    public void onRightClick(PlayerInteractEvent.RightClickBlock event){
        if (event.getWorld().getBlockState(event.getPos()).getBlock() == BlocksUtil.blockSolarGenerator)
            Minecraft.getMinecraft().player.sendChatMessage(this.container.getEnergyStored() + "/" + this.container.getMaxEnergyStored());
    }


    @Override
    public void readFromNBT(NBTTagCompound compound) {
        super.readFromNBT(compound);
        //this.container.setEnergyStored(compound.getInteger("StoredJAE"));
        this.container.deserializeNBT(compound.getCompoundTag("StoredTF"));
    }

    @Override
    public NBTTagCompound writeToNBT(NBTTagCompound compound) {
        //compound.setInteger("StoredJAE", this.container.getEnergyStored());
        compound.setTag("StoredTF", this.container.serializeNBT());
        return super.writeToNBT(compound);
    }
}

 

BaseEnergyContainer

Spoiler

public class BaseEnergyContainer implements IEnergyStorage, INBTSerializable<NBTTagCompound> {

    private int stored;
    private int capacity;
    private int input;
    private int output;

    public BaseEnergyContainer() {
        this(1000, 0, 0);
    }

    public BaseEnergyContainer(int capacity, int input, int output) {
        this(0, capacity, input, output);
    }

    public BaseEnergyContainer(int power, int capacity, int input, int output) {
        this.stored = power;
        this.capacity = capacity;
        this.input = input;
        this.output = output;
    }

    public BaseEnergyContainer(NBTTagCompound dataTag) {
        this.deserializeNBT(dataTag);
    }

    @Override
    public NBTTagCompound serializeNBT() {
        final NBTTagCompound dataTag = new NBTTagCompound();

        dataTag.setInteger("TFStored", this.stored);
        dataTag.setInteger("TFCapacity", this.capacity);
        dataTag.setInteger("TFInput", this.input);
        dataTag.setInteger("TFOutput", this.output);

        return dataTag;
    }

    @Override
    public void deserializeNBT(NBTTagCompound nbt) {
        if(nbt.hasKey("TFStored"))
            this.stored = nbt.getInteger("TFStored");
        if(nbt.hasKey("TFCapacity"))
            this.capacity = nbt.getInteger("TFCapacity");
        if(nbt.hasKey("TFInput"))
            this.input = nbt.getInteger("TFInput");
        if(nbt.hasKey("TFOutput"))
            this.output = nbt.getInteger("TFOutput");

        if(this.stored > this.getMaxEnergyStored())
            this.stored = this.getMaxEnergyStored();
    }

    @Override
    public int receiveEnergy(int maxReceive, boolean simulate) {
        final int acceptedPower = Math.min(this.getMaxEnergyStored() - this.getEnergyStored(), Math.min(this.getMaxInput(), maxReceive));

        if(!simulate)
            this.stored += acceptedPower;

        return this.canReceive() ? acceptedPower : 0;
    }

    @Override
    public int extractEnergy(int maxExtract, boolean simulate) {
        final int removedPower = Math.min(this.getEnergyStored(), Math.min(this.getMaxOutput(), maxExtract));

        if(!simulate)
            this.stored -= removedPower;
        return this.canExtract() ? removedPower : 0;
    }

    @Override
    public int getEnergyStored() {
        return this.stored;
    }

    @Override
    public int getMaxEnergyStored() {
        return this.capacity;
    }

    public void setMaxEnergyStored(int capacity) {
        this.capacity = capacity;

        if(this.stored > capacity)
            this.stored = capacity;
    }

    public int getMaxInput() {
        return this.input;
    }

    public void setMaxInput(int input) {
        this.input = input;
    }

    public int getMaxOutput() {
        return this.output;
    }

    public void setMaxOutput(int output) {
        this.output = output;
    }

    @Override
    public boolean canExtract() {
        return this.getMaxOutput() > 0 && this.stored > 0;
    }

    @Override
    public boolean canReceive() {
        return this.getMaxInput() > 0;
    }
}

 

 

Edited by Terrails
Link to comment
Share on other sites

The four times is because it happens on both client and server and for both hands. I believe the problem is with your getSkylightSubtracted == 0

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

I discovered another problem... I tested it with capacitor banks. Basically my solar panel as builds up power it makes that much rf/t, but it should do only 20 rf/t like I specified. It stops at 2500 rf because thats the max it can hold

This is what I'm talking about

643206d32893bb37a58b54860c69de25.gif

EDIT: this only happens when I go through bank's configuration to Input for the second time.

Edited by Terrails
Link to comment
Share on other sites

When sending the energy to the Capacitor bank use extract receive extract i side of each other.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

if(consumer != null)
                        this.container.extractEnergy(consumer.receiveEnergy(this.container.getEnergyStored(), false), false);

I think your issue is here. You are trying to make the consumer receive all the energy stored inside the solar panel. Try using the max output (15) instead of getEnergyStored().

  • Like 1

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Do you mean that you want to get the energy when the player right-clicks the block? Override Block#onBlockActivated, get the TileEntity using IBlockAccess#getTileEntity and cast it to your TileEntitySolarPanel. Then print the energy to chat using EntityPlayer#sendStatusMessage.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

The problem is to I can't access my .getEnergyStored from the BlockSolarGenerator... I can only access the generating energy and the max storage energy. To access the .getEnergyStored I need to put the sendStatusMessage into the update() method otherwise my energy will always be 0/2500 and if I put it into update() I cannot make onBlockActivated method in it.

Its not possible to pass a variable from one method to another...

Edited by Terrails
Link to comment
Share on other sites

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

    • This honestly might just work for you @SubscribeEvent public static void onScreenRender(ScreenEvent.Render.Post event) { final var player = Minecraft.getInstance().player; if(!hasMyEffect(player)) return; // TODO: You provide hasMyEffect float f = Mth.lerp(p_109094_, this.minecraft.player.oSpinningEffectIntensity, this.minecraft.player.spinningEffectIntensity); float f1 = ((Double)this.minecraft.options.screenEffectScale().get()).floatValue(); if(f <= 0F || f1 >= 1F) return; float p_282656_ = ?; final var p_282460_ = event.getGuiGraphics(); int i = p_282460_.guiWidth(); int j = p_282460_.guiHeight(); p_282460_.pose().pushPose(); float f = Mth.lerp(p_282656_, 2.0F, 1.0F); p_282460_.pose().translate((float)i / 2.0F, (float)j / 2.0F, 0.0F); p_282460_.pose().scale(f, f, f); p_282460_.pose().translate((float)(-i) / 2.0F, (float)(-j) / 2.0F, 0.0F); float f1 = 0.2F * p_282656_; float f2 = 0.4F * p_282656_; float f3 = 0.2F * p_282656_; RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(SourceFactor.ONE, DestFactor.ONE, SourceFactor.ONE, DestFactor.ONE); p_282460_.setColor(f1, f2, f3, 1.0F); p_282460_.blit(NAUSEA_LOCATION, 0, 0, -90, 0.0F, 0.0F, i, j, i, j); p_282460_.setColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.defaultBlendFunc(); RenderSystem.disableBlend(); RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); p_282460_.pose().popPose(); }   Note: Most of this is directly copied from GameRenderer as you pointed out you found. The only thing you'll have to likely do is update the `oSpinningEffectIntensity` + `spinningEffectIntensity` variables on the player when your effect is applied. Which values should be there? Not 100% sure, might be a game of guess and check, but `handleNetherPortalClient` in LocalPlayer has some hard coded you might be able to start with.
    • Dalam dunia perjudian online yang berkembang pesat, mencari platform yang dapat memberikan kemenangan maksimal dan hasil terbaik adalah impian setiap penjudi. OLXTOTO, dengan bangga, mempersembahkan dirinya sebagai jawaban atas pencarian itu. Sebagai platform terbesar untuk kemenangan maksimal dan hasil optimal, OLXTOTO telah menciptakan gelombang besar di komunitas perjudian online. Satu dari banyak keunggulan yang dimiliki OLXTOTO adalah koleksi permainan yang luas dan beragam. Dari togel hingga slot online, dari live casino hingga permainan kartu klasik, OLXTOTO memiliki sesuatu untuk setiap pemain. Dibangun dengan teknologi terkini dan dikembangkan oleh para ahli industri, setiap permainan di platform ini dirancang untuk memberikan pengalaman yang tak tertandingi bagi para penjudi. Namun, keunggulan OLXTOTO tidak hanya terletak pada variasi permainan yang mereka tawarkan. Mereka juga menonjol karena komitmen mereka terhadap keamanan dan keadilan. Dengan sistem keamanan tingkat tinggi dan proses audit yang ketat, OLXTOTO memastikan bahwa setiap putaran permainan berjalan dengan adil dan transparan. Para pemain dapat merasa aman dan yakin bahwa pengalaman berjudi mereka di OLXTOTO tidak akan terganggu oleh masalah keamanan atau keadilan. Tak hanya itu, OLXTOTO juga terkenal karena layanan pelanggan yang luar biasa. Tim dukungan mereka selalu siap sedia untuk membantu para pemain dengan segala pertanyaan atau masalah yang mereka hadapi. Dengan respon cepat dan solusi yang efisien, OLXTOTO memastikan bahwa pengalaman berjudi para pemain tetap mulus dan menyenangkan. Dengan semua fitur dan keunggulan yang ditawarkannya, tidak mengherankan bahwa OLXTOTO telah menjadi pilihan utama bagi jutaan penjudi online di seluruh dunia. Jika Anda mencari platform yang dapat memberikan kemenangan maksimal dan hasil optimal, tidak perlu mencari lebih jauh dari OLXTOTO. Bergabunglah dengan OLXTOTO hari ini dan mulailah petualangan Anda menuju kemenangan besar dan hasil terbaik!
    • Selamat datang di OLXTOTO, situs slot gacor terpanas yang sedang booming di industri perjudian online. Jika Anda mencari pengalaman bermain yang luar biasa, maka OLXTOTO adalah tempat yang tepat untuk Anda. Dapatkan sensasi tidak biasa dengan variasi slot online terlengkap dan peluang memenangkan jackpot slot maxwin yang sering. Di sini, Anda akan merasakan keseruan yang luar biasa dalam bermain judi slot. DAFTAR OLXTOTO DISINI LOGIN OLXTOTO DISINI AKUN PRO OLXTOTO DISINI   Jackpot Slot Maxwin Sering Untuk Peluang Besar Di OLXTOTO, kami tidak hanya memberikan hadiah slot biasa, tapi juga memberikan kesempatan kepada pemain untuk memenangkan jackpot slot maxwin yang sering. Dengan demikian, Anda dapat meraih keberuntungan besar dan memenangkan ribuan rupiah sebagai hadiah jackpot slot maxwin kami. Jackpot slot maxwin merupakan peluang besar bagi para pemain judi slot untuk meraih keuntungan yang lebih besar. Dalam permainan kami, Anda tidak harus terpaku pada kemenangan biasa saja. Kami hadir dengan jackpot slot maxwin yang sering, sehingga Anda memiliki peluang yang lebih besar untuk meraih kemenangan besar dengan hadiah yang menggiurkan. Dalam permainan judi slot, pengalaman bermain bukan hanya tentang keseruan dan hiburan semata. Kami memahami bahwa para pemain juga menginginkan kesempatan untuk meraih keberuntungan besar. Oleh karena itu, OLXTOTO hadir dengan jackpot slot maxwin yang sering untuk memberikan peluang besar kepada para pemain kami. Peluang Besar Menang Jackpot Slot Maxwin Peluang menang jackpot slot maxwin di OLXTOTO sangatlah besar. Anda tidak perlu khawatir tentang batasan atau pembatasan dalam meraih jackpot tersebut. Kami ingin memberikan kesempatan kepada semua pemain kami untuk merasakan sensasi menang dalam jumlah yang luar biasa. Jackpot slot maxwin kami dibuka untuk semua pemain judi slot di OLXTOTO. Anda memiliki peluang yang sama dengan pemain lainnya untuk memenangkan hadiah jackpot yang besar. Kami percaya bahwa semua orang memiliki kesempatan untuk meraih keberuntungan besar, dan itulah mengapa kami menyediakan jackpot slot maxwin yang sering untuk memenuhi harapan dan keinginan Anda.   Kesimpulan OLXTOTO adalah situs slot gacor terbaik yang memberikan pengalaman bermain judi slot online yang tak terlupakan. Dengan variasi slot online terlengkap dan peluang memenangkan jackpot slot maxwin yang sering, OLXTOTO menjadi pilihan terbaik bagi para pemain yang mencari kesenangan dan kemenangan besar dalam perjudian online. Di samping itu, OLXTOTO juga menawarkan layanan pelanggan yang ramah dan responsif, siap membantu setiap pemain dalam mengatasi masalah teknis atau pertanyaan seputar perjudian online. Kami menjaga integritas game dan memberikan lingkungan bermain yang adil serta menjalankan kebijakan perlindungan pelanggan yang cermat. Bergabunglah dengan OLXTOTO sekarang dan nikmati pengalaman bermain slot online yang luar biasa. Jadilah bagian dari komunitas perjudian yang mengagumkan ini dan raih kesempatan untuk meraih kemenangan besar. Dapatkan akses mudah dan praktis ke situs OLXTOTO dan rasakan sensasi bermain judi slot yang tak terlupakan.  
    • OLXTOTO: Platform Maxwin dan Gacor Terbesar Sepanjang Masa Di dunia perjudian online yang begitu kompetitif, mencari platform yang dapat memberikan kemenangan maksimal (Maxwin) dan hasil terbaik (Gacor) adalah prioritas bagi para penjudi yang cerdas. Dalam upaya ini, OLXTOTO telah muncul sebagai pemain kunci yang mengubah lanskap perjudian online dengan menawarkan pengalaman tanpa tandingan.     Sejak diluncurkan, OLXTOTO telah menjadi sorotan industri perjudian online. Dikenal sebagai "Platform Maxwin dan Gacor Terbesar Sepanjang Masa", OLXTOTO telah menarik perhatian pemain dari seluruh dunia dengan reputasinya yang solid dan kinerja yang luar biasa. Salah satu fitur utama yang membedakan OLXTOTO dari pesaingnya adalah komitmen mereka untuk memberikan pengalaman berjudi yang unik dan memuaskan. Dengan koleksi game yang luas dan beragam, termasuk togel, slot online, live casino, dan banyak lagi, OLXTOTO menawarkan sesuatu untuk semua orang. Dibangun dengan teknologi terkini dan didukung oleh tim ahli yang berdedikasi, platform ini memastikan bahwa setiap pengalaman berjudi di OLXTOTO tidak hanya menghibur, tetapi juga menguntungkan. Namun, keunggulan OLXTOTO tidak hanya terletak pada permainan yang mereka tawarkan. Mereka juga terkenal karena keamanan dan keadilan yang mereka berikan kepada para pemain mereka. Dengan sistem keamanan tingkat tinggi dan audit rutin yang dilakukan oleh otoritas regulasi independen, para pemain dapat yakin bahwa setiap putaran permainan di OLXTOTO adalah adil dan transparan. Tidak hanya itu, OLXTOTO juga dikenal karena layanan pelanggan yang luar biasa. Dengan tim dukungan yang ramah dan responsif, para pemain dapat yakin bahwa setiap pertanyaan atau masalah mereka akan ditangani dengan cepat dan efisien. Dengan semua fitur dan keunggulan yang ditawarkannya, tidak mengherankan bahwa OLXTOTO telah menjadi platform pilihan bagi para penjudi online yang mencari kemenangan maksimal dan hasil terbaik. Jadi, jika Anda ingin bergabung dengan jutaan pemain yang telah merasakan keajaiban OLXTOTO, jangan ragu untuk mendaftar dan mulai bermain hari ini!  
    • OLXTOTO adalah bandar slot yang terkenal dan terpercaya di Indonesia. Mereka menawarkan berbagai jenis permainan slot yang menarik dan menghibur. Dengan tampilan yang menarik dan grafis yang berkualitas tinggi, pemain akan merasa seperti berada di kasino sungguhan. OLXTOTO juga menyediakan layanan pelanggan yang ramah dan responsif, siap membantu pemain dengan segala pertanyaan atau masalah yang mereka hadapi. Daftar =  https://surkale.me/Olxtotodotcom1
  • Topics

×
×
  • Create New...

Important Information

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