Jump to content

Recommended Posts

Posted

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.

Posted

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.

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

Posted
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/

Posted

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.

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

Posted (edited)
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.

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

Posted

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?

Posted (edited)
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
Posted (edited)

 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
Posted (edited)

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
Posted
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/

Posted

Thanks it works. Now the problem is how do I put RightClickBlock into the update() method because I can't put @SubscribeEvent there, I want it so when player right clicks the block he gets the internal capacity.

Posted

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/

Posted (edited)

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

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

    • Im trying to build my mod using shade since i use the luaj library however i keep getting this error Reason: Task ':reobfJar' uses this output of task ':shadowJar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. So i try adding reobfJar.dependsOn shadowJar  Could not get unknown property 'reobfJar' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. my gradle file plugins { id 'eclipse' id 'idea' id 'maven-publish' id 'net.minecraftforge.gradle' version '[6.0,6.2)' id 'com.github.johnrengelman.shadow' version '7.1.2' id 'org.spongepowered.mixin' version '0.7.+' } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' apply plugin: 'com.github.johnrengelman.shadow' version = mod_version group = mod_group_id base { archivesName = mod_id } // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. java.toolchain.languageVersion = JavaLanguageVersion.of(17) //jarJar.enable() println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { mappings channel: mapping_channel, version: mapping_version copyIdeResources = true runs { configureEach { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' arg "-mixin.config=derp.mixin.json" mods { "${mod_id}" { source sourceSets.main } } } client { // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. property 'forge.enabledGameTestNamespaces', mod_id } server { property 'forge.enabledGameTestNamespaces', mod_id args '--nogui' } gameTestServer { property 'forge.enabledGameTestNamespaces', mod_id } data { workingDirectory project.file('run-data') args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') } } } sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { flatDir { dirs './libs' } maven { url = "https://jitpack.io" } } configurations { shade implementation.extendsFrom shade } dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" implementation 'org.luaj:luaj-jse-3.0.2' implementation fg.deobf("com.github.Virtuoel:Pehkui:${pehkui_version}") annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' minecraftLibrary 'luaj:luaj-jse:3.0.2' shade 'luaj:luaj-jse:3.0.2' } // Example for how to get properties into the manifest for reading at runtime. tasks.named('jar', Jar).configure { manifest { attributes([ 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors, 'Specification-Version' : '1', // We are version 1 of ourselves 'Implementation-Title' : project.name, 'Implementation-Version' : project.jar.archiveVersion, 'Implementation-Vendor' : mod_authors, 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", "TweakOrder" : 0, "MixinConfigs" : "derp.mixin.json" ]) } rename 'mixin.refmap.json', 'derp.mixin-refmap.json' } shadowJar { archiveClassifier = '' configurations = [project.configurations.shade] finalizedBy 'reobfShadowJar' } assemble.dependsOn shadowJar reobf { re shadowJar {} } publishing { publications { mavenJava(MavenPublication) { artifact jar } } repositories { maven { url "file://${project.projectDir}/mcmodsrepo" } } }  
    • All versions of Minecraft Forge suddenly black screen even without mods (tried reinstalling original Minecraft, Java, updating drivers doesn't work)
    • When i join minecraft all ok, when i join world all working fine, but when i open indentity menu, i get this The game crashed whilst unexpected error Error: java.lang.NullPointerException: Cannot invoke "top.ribs.scguns.common.Gun$Projectile.getDamage()" because "this.projectile" is null crash report here https://paste.ee/p/0vKaf
  • Topics

×
×
  • Create New...

Important Information

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