Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
NEO

It does not define the item as an upgrade.

Question

I am creating an addition to the operating system, namely Tesla update for the robot , but for some - I do not know the reasons why it does not work , when I change the map type , or other things work , but as soon as I put all Slot. Updating nothing works .

 

Driver

 

public class DriverTeslaUpgrade implements HostAware {

 

 

    @Override

    public boolean worksWith(ItemStack stack, Class<? extends EnvironmentHost> host) {

        return true;

    }

 

    @Override

    public boolean worksWith(ItemStack stack) {

        return stack.getItem() == Items.tesla;

    }

 

    @Override

    public ManagedEnvironment createEnvironment(ItemStack stack, EnvironmentHost host) {

        return null;

    }

 

    @Override

    public String slot(ItemStack stack) {

        return Slot.Upgrade;

    }

 

    @Override

    public int tier(ItemStack stack) {

        return 0;

    }

 

    @Override

    public NBTTagCompound dataTag(ItemStack stack) {

        return null;

    }

}

 

Register Driver

 

public class Drivers {

    public static Item driverTeslaUpgrade;

 

    public static void init(){

        driverTeslaUpgrade = new DriverTeslaUpgrade();

 

        Driver.add(driverTeslaUpgrade);

    }

}

 

Item

 

public class ItemUpgradeTesla extends Item  {

 

    public ItemUpgradeTesla() {

        setCreativeTab(OpenTechnology.tab);

    }

}

 
 
 
I would be grateful if you help
P.S
 
ManagedEnvironment I came return , the result did not change.
 

I am creating an addition to the operating system, namely Tesla update for the robot , but for some - I do not know the reasons why it does not work , when I change the map type , or other things work , but as soon as I put all Slot. Updating nothing works .

Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

You return null in createEnvironment() but you have the return a ManagedEnvironment.

The ManagedEnvironment also needs a Network Node with a component.

public class TeslaUpgrade extends li.cil.oc.api.prefab.ManagedEnvironment{

  public TeslaUpgrade(){ 
    this.setNode( Network.newNode(this, Visibility.Neighbors).withComponent("teslaUpgrade").create() );
  }

} 

I do not know if you have seen the example on GitHub

 

If the upgrade is only for robots you should check in worksWith() if the host class is li.cil.oc.common.tileentity.Robot because there are also upgrade slots in drones, microcontrollers and in the adapter block

Link to post
Share on other sites
  • 0

You return null in createEnvironment() but you have the return a ManagedEnvironment.

The ManagedEnvironment also needs a Network Node with a component.

public class TeslaUpgrade extends li.cil.oc.api.prefab.ManagedEnvironment{

  public TeslaUpgrade(){ 
    this.setNode( Network.newNode(this, Visibility.Neighbors).withComponent("teslaUpgrade").create() );
  }

} 

I do not know if you have seen the example on GitHub

 

If the upgrade is only for robots you should check in worksWith() if the host class is li.cil.oc.common.tileentity.Robot because there are also upgrade slots in drones, microcontrollers and in the adapter block

Already it is working, although for some reason the upgrade in the container does not want to lay down.

Link to post
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
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...

×
×
  • Create New...

Important Information

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