Jump to content

[1.7.10]Powering system


NEG2013

Recommended Posts

First things first, why are you still on 1.7.10

Next, if a class implements an interface, its subclasses will already be implementing that interface, you don't need to declare it again:

BlockAC extends Block implements IAc

BlockEnergyDuctBase extends BlockAC implements IAc

Third, define "not working."

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.

Link to comment
Share on other sites

Line 105 of that paste has a method that calls itself.

 

Also,

setLightLevel

is not how you get a block to emit light on a per-instance basis.  That will cause all copies of the block to start emitting light.  You also never reset the light value.

 

That block also never calls

EnergyDraw

in order to determine how much energy it should take from anywhere.  Similarly,

EnergyIn

isn't called from anywhere and similarly does nothing.

 

Then in your EnergyDuct block your

EnergyStored

method returns 0, meaning it would be incapable of sending energy anywhere.  But if we look at this a little more closely: where would this block store energy? If we create a field for it, all of our Duct blocks would share that variable!

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.

Link to comment
Share on other sites

I removed the setLightLevel bit, energyDraw was set at 1 on the test block also what do you mean here "where would this block store energy? If we create a field for it, all of our Duct blocks would share that variable!"?

 

and the duct has this for its stored

 

int tick = tickRate(Minecraft.getMinecraft().theWorld);
		int energyStored = tick * EnergyGenerating();

		return energyStored;"

Line 105 of that paste has a method that calls itself.

Also, setLightLevel is not how you get a block to emit light on a per-instance basis.  That will cause all copies of the block to start emitting light.  You also never reset the light value.

That block also never calls EnergyDraw in order to determine how much energy it should take from anywhere.  Similarly, EnergyIn isn't called from anywhere and similarly does nothing.

Then in your EnergyDuct block your EnergyStored method returns 0, meaning it would be incapable of sending energy anywhere.  But if we look at this a little more closely: where would this block store energy? If we create a field for it, all of our Duct blocks would share that variable!

Link to comment
Share on other sites

I removed the setLightLevel bit, energyDraw was set at 1 on the test block also what do you mean here "where would this block store energy? If we create a field for it, all of our Duct blocks would share that variable!"?

 

and the duct has this for its stored

 

Cough.

BlockDuct  line 114:

 

    @Override
    public int EnergyStored() {
        // TODO Auto-generated method stub
        return 0;
    }

 

How do you plan on implementing that method?

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.

Link to comment
Share on other sites

Still a stub.

 

    @Override
    public int EnergyStored() {
        // TODO Auto-generated method stub
        return 0;
    }

 

And even in your EnergyDuctBase that method will return 0 as well, because it multiplies its tick rate by the result of

EnergyGenerating()

which returns 0:

 

        //done
        @Override
        public int EnergyGenerating() {
            return 0;
        }

 

You will almost certainly not be able to get this to work without using TileEntities.

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.

Link to comment
Share on other sites

I replaced the generating one this this                    hint it still will not work

 

                        int tick = tickRate(Minecraft.getMinecraft().theWorld);

		int energyStored = EnergyIn(access, x, y, z, world);

		return (energyStored * tick);

 

I also don't know where you see this method

 

@Override
    public int EnergyStored() {
        // TODO Auto-generated method stub
        return 0;
    }

Link to comment
Share on other sites

I also don't know where you see this method

 

@Override
    public int EnergyStored() {
        // TODO Auto-generated method stub
        return 0;
    }

 

BlockDuct.java line 114

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.

Link to comment
Share on other sites

I understand and also I update all the blocks to TileEntitys but the system still doesn't work so here are the class again(some stuff changed)

 

BlockDuct.java

http://pastebin.com/EK4GTDYC

 

BlockEnergyDuctBase.java

http://pastebin.com/F4GsHtvx

 

IAc.java(interface)

http://pastebin.com/9f2MaawR

 

BlockSolarGenny.java

http://pastebin.com/1WSPeBe8

 

BlockAc.java

package neg2013.acsension.infrastructure;

import neg2013.acsension.interfaces.IAc;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class BlockAC extends Block implements IAc{





protected BlockAC(Material material) {
	super(material);
	this.blockHardness = 2f;
}



//done
@Override
public int MaxEnergyStored() {
	int maxEnergyStored = MaxEnergyStored();
	return 0;
}

//done
@Override
public int EnergyStored(IBlockAccess access, int x, int y, int z, World world) {


	int tick = tickRate(Minecraft.getMinecraft().theWorld);

	int energyStored = tick * EnergyGenerating() - EnergyConsuming();

	return energyStored;
}

//done
@Override
public int EnergyGenerating() {
	int energyGenerating = EnergyGenerating();
	return energyGenerating;
}

//done
@Override
public boolean CanGenerateEnergy(int x, int y, int z) {
	boolean canGenerateEnergy = CanGenerateEnergy(x, y, z);
	return canGenerateEnergy;
}

//done
@Override
public boolean CanConsumeEnergy() {
	boolean canConsumeEnergy = CanConsumeEnergy();
	return canConsumeEnergy;
}

//done
@Override
public boolean canAcceptEnergy() {
	boolean canacceptEnergy = canAcceptEnergy();
	return canacceptEnergy;
}

//done
@Override
public boolean canConnectToAc() {
	boolean canconnectToAc = canConnectToAc();
	canconnectToAc = true;
	return canconnectToAc;
}

//done
@Override
public int EnergyIn(IBlockAccess access, int x, int y, int z, World world) {
	int energyIn = EnergyIn(access, x, y, z, world);

	energyIn = EnergyDraw(access, x, y, z, world);

	return energyIn;
}

//done
@Override
public int EnergyOut(IBlockAccess access, int x, int y, int z, World world) {
	int energyOut = EnergyOut(access, x, y, z, world);
	 energyOut = EnergyPush(access, x, energyOut, z, world);
	return energyOut;
}

//done
@Override
public int EnergyDraw(IBlockAccess access, int x, int y, int z, World world) {
	int energyDraw = EnergyDraw(access, x, y, z, world);
	return energyDraw;
}

//done
@Override
public int EnergyPush(IBlockAccess access, int x, int y, int z, World world) {
	int energyPush = EnergyPush(access, x, y, z, world);
	return energyPush;
}

//done
@Override
public int NeighborDraw(IBlockAccess access, int x, int y, int z, World world) {
	int neighborDraw = NeighborDraw(access, x, y, z, world);
	return neighborDraw;
}

//done
@Override
public int NeighborPush(IBlockAccess access, int x, int y, int z, World world) {
	int neighborPush = NeighborPush(access, x, y, z, world);
	return neighborPush;
}




//done
@Override
public int EnergyConsuming() {
	int energyConsuming = EnergyConsuming();
	return energyConsuming;
}



@Override
public boolean IsPowered(IBlockAccess access, int x, int y, int z, World world) {
	if(NeighborPush(access, x, y, z, world) >=1 ){
		return true;
	}
	return false;
}





}

 

BlockRedstoneConverter.java

package neg2013.acsension.infrastructure;

import neg2013.acsension.Acsension;
import neg2013.acsension.interfaces.IAc;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class BlockRedstoneConverter extends BlockAC implements ITileEntityProvider{

public BlockRedstoneConverter(Material material) {
	super(material);


}

@Override
public int MaxEnergyStored() {
	// TODO Auto-generated method stub
	return 2;
}

@Override
public boolean CanGenerateEnergy(int x, int y, int z) {
	// TODO Auto-generated method stub
	return false;
}

@Override
public boolean CanConsumeEnergy() {
	// TODO Auto-generated method stub
	return true;
}

@Override
public boolean canAcceptEnergy() {
	// TODO Auto-generated method stub
	return true;
}

//done
@Override
public boolean canConnectToAc() {

	return true;
}

//done
@Override
public int EnergyOut(IBlockAccess access, int x, int y, int z, World world) {

	return 0;
}

//done
@Override
public int EnergyDraw(IBlockAccess access, int x, int y, int z, World world) {

	return 1;
}

//done
@Override
public int EnergyPush(IBlockAccess access, int x, int y, int z, World world) {
	return 0;
}


public int EnergyIn (IBlockAccess access, int x, int y, int z, World world) {





	return super.EnergyIn(access, x, y, z, world);
}

@Override
public int EnergyConsuming() {

	return 1;
}


@Override
public int EnergyStored(IBlockAccess access, int x, int y, int z, World world) {
	int energyStored = EnergyStored( access,  x,  y,  z,  world);		



	return super.EnergyStored( access,  x,  y,  z,  world);

}


@Override
public boolean IsPowered(IBlockAccess access, int x, int y, int z, World world) {



	if(IsPowered(access, x, y, z, world)){
		this.setLightLevel(15f);

	}

	return super.IsPowered(access, x, y, z, world);
}


@Override
public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) {

	return true;
}

public boolean canProvidePower()
    {
        return true;
    }




@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
	// TODO Auto-generated method stub
	return null;
}

}

 

BlockCreativeArray.java

package neg2013.acsension.infrastructure;

import neg2013.acsension.interfaces.IAc;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class BlockCreativeArray extends Block implements IAc , ITileEntityProvider{

public BlockCreativeArray(Material material) {
	super(material);

}

@Override
public int MaxEnergyStored() {

	return 1000000000;
}

@Override
public int EnergyStored(IBlockAccess access, int x, int y, int z, World world) {

	return 1000000000;
}

@Override
public int EnergyGenerating() {
	// TODO Auto-generated method stub
	return 1000000000;
}

@Override
public int EnergyConsuming() {
	// TODO Auto-generated method stub
	return 0;
}

@Override
public boolean CanGenerateEnergy(int x, int y, int z) {
	// TODO Auto-generated method stub
	return true;
}

@Override
public boolean CanConsumeEnergy() {
	// TODO Auto-generated method stub
	return false;
}

@Override
public boolean canAcceptEnergy() {
	// TODO Auto-generated method stub
	return false;
}

@Override
public boolean canConnectToAc() {
	// TODO Auto-generated method stub
	return true;
}

@Override
public int EnergyIn(IBlockAccess access, int x, int y, int z, World world) {
	// TODO Auto-generated method stub
	return 1000000000;
}

@Override
public int EnergyOut(IBlockAccess access, int x, int y, int z, World world) {
	// TODO Auto-generated method stub
	return 1000000000;
}

@Override
public int EnergyDraw(IBlockAccess access, int x, int y, int z, World world) {
	// TODO Auto-generated method stub
	return 0;
}

@Override
public int EnergyPush(IBlockAccess access, int x, int y, int z, World world) {
	// TODO Auto-generated method stub
	return 1000000000;
}

@Override
public int NeighborDraw(IBlockAccess access, int x, int y, int z, World world) {
	// TODO Auto-generated method stub
	return 0;
}

@Override
public int NeighborPush(IBlockAccess access, int x, int y, int z, World world) {
	// TODO Auto-generated method stub
	return 0;
}

@Override
public boolean IsPowered(IBlockAccess access, int x, int y, int z, World world) {
	// TODO Auto-generated method stub
	return false;
}







@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
	// TODO Auto-generated method stub
	return null;
}

}

Link to comment
Share on other sites

Oh my god, so much wrong with this thread...

 

If you want TileEntities you have to actually create TileEntities.  And the TEs should be the ones implementing all of this power API interfaces, not the block.

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.

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

    • I am following a tutorial for modding minecraft 1.20.1, and while running the mod with the minecraft of the idea, no errors was present but, when I switched to real minecraft, it started to want a default constructor "public ZeroToAutomation()" instead of the one recomended by the video "public ZeroToAutomation(FMLJavaModLoadingContext context) {...}", and I can't use the default constructor because I need the FMLJavaModLoadingContext to register the blocks and items.   The problem is at: "net/myself/zerotoautomation/ZeroToAutomation.java" the file contains the default constructor, "Logger"s, and the code for the mod the defaut constructor was added after an error requesting it the Loggers was used to see which methods/constructors was used by the Launcher   things that I tried to fix the issue: remove the default constructor, but an error appeared "net.myself.zerotoautomation.ZeroToAutomation.<init>()", and nothing else on the class runs adding an "public static void init()" method, but it changed nothing   The mod files: https://github.com/Matwaua/Zero_To_Automation/tree/not-finished
    • It is an issue/conflict with distanthorizons
    • I have been trying to combat this issue between oculus and embeddium and to no avail... I have already tried a few online tutorials on how to get this working but it doesn't work at all. https://pastebin.com/geQgifjc
    • wow you sound like fun to play with
    • Instale el mod en mi servidor y este se queda iniciando por horas, en la consola me habla de algo de permisos y trate de seguir la ruta que me da pero no existe.   [13:05:32 INFO]: CustomNPC Permissions available: [13:05:32 INFO]: customnpcs.edit.blocks [13:05:32 INFO]: customnpcs.edit.villager [13:05:32 INFO]: customnpcs.global.bank [13:05:32 INFO]: customnpcs.global.dialog [13:05:32 INFO]: customnpcs.global.faction [13:05:32 INFO]: customnpcs.global.linked [13:05:32 INFO]: customnpcs.global.naturalspawn [13:05:32 INFO]: customnpcs.global.playerdata [13:05:32 INFO]: customnpcs.global.quest [13:05:32 INFO]: customnpcs.global.recipe [13:05:32 INFO]: customnpcs.global.transport [13:05:32 INFO]: customnpcs.npc.advanced [13:05:32 INFO]: customnpcs.npc.ai [13:05:32 INFO]: customnpcs.npc.clone [13:05:32 INFO]: customnpcs.npc.create [13:05:32 INFO]: customnpcs.npc.delete [13:05:32 INFO]: customnpcs.npc.display [13:05:32 INFO]: customnpcs.npc.freeze [13:05:32 INFO]: customnpcs.npc.gui [13:05:32 INFO]: customnpcs.npc.inventory [13:05:32 INFO]: customnpcs.npc.reset [13:05:32 INFO]: customnpcs.npc.stats [13:05:32 INFO]: customnpcs.scenes [13:05:32 INFO]: customnpcs.soulstone.all [13:05:32 INFO]: customnpcs.spawner.create [13:05:32 INFO]: customnpcs.spawner.mob [13:05:32 INFO]: customnpcs.tool.mounter [13:05:32 INFO]: customnpcs.tool.nbtbook [13:05:32 INFO]: customnpcs.tool.pather [13:05:32 INFO]: customnpcs.tool.scripter
  • Topics

×
×
  • Create New...

Important Information

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