Jump to content

[ SOLVED ] [1.15.2] java.lang.IllegalArgumentException: Cannot register a capability implementation multiple times


Novârch

Recommended Posts

I'm trying to port a capability from 1.12 to 1.15 and keep getting this error, but I don't understand where I'm registering it twice.

Here are the capability classes:

Spoiler

public interface IStand
{
    void setStandID(final int p0);

    void setStandAct(final int p0);

    void setStandOn(final boolean p0);

    void setJojoPower(final int p0);

    void setPowerSpawned(final boolean p0);

    void setPlayerStandName(final String p0);

    int getStandID();

    int getStandAct();

    boolean getStandOn();

    int getJojoPower();

    boolean getPowerSpawned();

    String getPlayerStandName();

    void setStandRemoved();

    void cloneSaveFunction(final IStand p0);
}

 

Spoiler

public class IStandStorage implements IStorage<IStand>
{
	public INBT writeNBT(Capability<IStand> capability, IStand instance, Direction side)
	{
        CompoundNBT props = new CompoundNBT();
        props.putInt("standID", instance.getStandID());
        props.putInt("StandAct", instance.getStandAct());
        props.putBoolean("StandOn", instance.getStandOn());
        props.putBoolean("PowerOn", instance.getPowerSpawned());
        props.putInt("PowerID", instance.getJojoPower());
        return (INBT)props;
      }
      
      public void readNBT(Capability<IStand> capability, IStand instance, Direction side, INBT nbt)
      {
        CompoundNBT propertyData = (CompoundNBT)nbt;
        instance.setStandID(propertyData.getInt("standID"));
        instance.setStandAct(propertyData.getInt("StandAct"));
        instance.setStandOn(propertyData.getBoolean("StandOn"));
        instance.setPowerSpawned(propertyData.getBoolean("PowerOn"));
        instance.setJojoPower(propertyData.getInt("PowerID"));
      }
Spoiler


public class IStandCapability implements IStand
{
	private int playerStandID = 0;
	  
	  private int playerStandAct = 0;
	  
	  private boolean playerStandOn = false;
	  
	  private int playerStandExp = 0;
	  
	  private boolean playerPowerSpawned = false;
	  
	  private int playerJojoPower = 0;
	  
	  private String playerStandName = "";
	  
	  public void addStandExp(int value) {
	    this.playerStandExp += value;
	  }
	  
	  public void setStandID(int value) {
	    this.playerStandID = value;
	  }
	  
	  public void setStandExp(int value) {
	    this.playerStandExp = value;
	  }
	  
	  public void setStandAct(int value) {
	    this.playerStandAct = value;
	  }
	  
	  public void setStandOn(boolean value) {
	    this.playerStandOn = value;
	  }
	  
	  public void setJojoPower(int value) {
	    this.playerJojoPower = value;
	  }
	  
	  public void setPowerSpawned(boolean value) {
	    this.playerPowerSpawned = value;
	  }
	  
	  public void setPlayerStandName(String value) {
	    this.playerStandName = value;
	  }
	  
	  public int getStandID() {
	    return this.playerStandID;
	  }
	  
	  public int getStandExp() {
	    return this.playerStandExp;
	  }
	  
	  public int getStandAct() {
	    return this.playerStandAct;
	  }
	  
	  public boolean getStandOn() {
	    return this.playerStandOn;
	  }
	  
	  public int getJojoPower() {
	    return this.playerJojoPower;
	  }
	  
	  public boolean getPowerSpawned() {
	    return this.playerPowerSpawned;
	  }
	  
	  public String getPlayerStandName() {
	    return this.playerStandName;
	  }
	  
	  public void cloneSaveFunction(IStand props) {
	    setStandID(props.getStandID());
	    setStandAct(props.getStandAct());
	    setStandOn(props.getStandOn());
	    setJojoPower(props.getJojoPower());
	    setPowerSpawned(props.getPowerSpawned());
	    setPlayerStandName(props.getPlayerStandName());
	  }
	  
	  public void setStandRemoved() {
	    setStandOn(false);
	    setStandAct(0);
	    setStandExp(0);
	    setStandID(0);
	    setPlayerStandName("");
	  }
}
Spoiler

Registering the capability:




public static void registerCapabilities()
    {
    	CapabilityManager.INSTANCE.register(IStand.class, new IStandStorage(), IStandCapability::new);
        MinecraftForge.EVENT_BUS.register(new CapabilityHandler());
    }

 

 

 

 

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

Link to comment
Share on other sites

8 hours ago, Novârch said:

public static void registerCapabilities()

Where do you call this?

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

 

1 hour ago, Animefan8888 said:

Where do you call this?

FMLCommonSetupEvent

 

Edited by Novârch

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

Link to comment
Share on other sites

7 minutes ago, Novârch said:

FMLCommonSetupEvent

Show more of your code. Preferably as a git repo.

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

13 minutes ago, Animefan8888 said:

Show more of your code. Preferably as a git repo.

Heres the repo:

Switched it to ClientSetupEvent.

https://github.com/Novarch129/Jojomod-1.15.2

Theres a lot of commented out code due to this being a port of a 1.12.2 mod.

Edited by Novârch

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

Link to comment
Share on other sites

  • Novârch changed the title to [ SOLVED ] [1.15.2] java.lang.IllegalArgumentException: Cannot register a capability implementation multiple times

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

    • Niigata大女儿房验证ºBCGAME55·COM℡ Niigata大女儿房开放聊天骑马 Niigata大女儿房链接软式网球大女儿房地址水球大女儿房亚东[本社咨询的Tele@JBOX7] [Niigata大女儿房视频 硬地滚球大女儿房广告 Free Style大女儿房Kakao Talk 橄榄球场开放聊天[总经销的Kakao Talk JBOX7] NiGATA 大草莓同好高点] 拳击视频 [赌场总公司] NIGAGATA 大女儿房 度假村 奥运会 NIGAGATA 大女儿房社区骑马大女儿房推荐广告 [体育总公司] NIGAGATA 大女儿房 Telegram 骑马 NIGAGATA 大女儿房的故事 功夫 大女儿房 招聘广告 Alpine 大女儿房的地图[TOTO总公司咨询] NIGAGATA 大女儿房总经销摔跤 NIGAGATA 大闺房系统跳高 视频 跳远 高尔夫 Twitter [TO总销购买] NIGAGOTA TANGETA GO TAN GO TAN GO TEA 羽毛球大女儿房LING大女儿房Instagram[BAKARA总经销] NIGATA大女儿房聚会信息 PLING NIGATA大女儿房链接滑雪大女儿房视频软网球大女儿房验证[赛马总经销] NIGATA大女儿房最新地址 Alpine NIGAGATA大女儿房链接藤球馆营业所招集 拳击 大草莓屋链接[BCGAME BC游戏总经销咨询] 设置通知 推荐订阅点赞
    • ヨーロッパカジノ遊び場↙BCGAME33·COM□ベラルーシのカジノ方法ヨーロッパ北欧カジノ中継[本社お問い合わせテレJBOX7]ヨーロッパカジノ♧▥ツアーエルサルバドルカジノ旅行ヨーロッパ西アフリカヨーロッパカジノコミュニティ[総販お問い合わせカカオトークJBOX7]ヨーロッパカジノ↕♠キャッシュゲームジブチカジノ検証ヨーロッパボリビアヨーロッパカジノ業者[各種オフィコミュニティ制作]欧州カジノ† サイトケニア カジノ接続 欧州アフリカ欧州カジノ接続[マーケティングお問い合わせ]欧州カジノ@放送 ボリビア カジノサイト 欧州 欧州 カジノサイト 欧州 カジノサイト 欧州 カジブチノサイト セルビア競技場] パラオカジノ旅行ヨーロッパカナダヨーロッパカジノツアー[トト本社お問い合わせ]ヨーロッパカジノ☎♨京畿アイランドカジノおすすめヨーロッパキプロスヨーロッパカジノおすすめ[トト総販購入]ヨーロッパカジノ☏↓接続アゼルバイジャンカジノツアーヨーロッパバルバドスヨーロッパカジノホールダンバ[カジノ総販]欧州カジノ#■賭博場ニジェールカジノゲーム場欧州アンドラ 欧州カジノゲーム[ヤマト本社]欧州カジノ↔@映像ガボン カジノホールダンバ 欧州バーデンバーデン 欧州 カジノ映像[バカラ総販] º㏘コミュニティスリナムアジア カジノポーカー大会 欧州東南アジア カジノンホールメニスタンバ おすすめ購読、いいですね
    • 横滨SPA链接♤BCGAME55·COM↙横滨SPA聚会信息地板运动横滨SPA故事按摩SPA地址快速SPA验证[本社咨询的Tele@JBOX7]横滨SPA地图跳高横滨SPA视频连接水上运动SPA社区[总经销的Kakao Talk JBOX7]横滨Spa Telegram 踢拳头横滨Youtube拳击Spa系统标枪机Instagram[各种官方网站制作]KOko Kakao Talk 机械马术spa SPA视频连接水上运动spa Spagram 诱导拳击运动视频 电子竞技横滨spa旅行冰球spa地图乒乓球spa巡回赛[体育总公司]横滨spa登录壁球横滨spa招聘广告跳马spa网站拳击spa最新地址[TOTO总公司咨询]横滨spa社区软网球横滨SPA新地址真实SPA登录[TOTO总经销购买]横滨pas验证长曲棍球横滨SPA认证跳马SPA公开聊天游泳SPA视频[赌场总经销]横滨SPA总经销网SPA网站推荐的YOSPA位置 短视频[KO] 做SPA的地方短道速滑SPA视频手球SPA同好会[赛马总经销]横滨SPA亚东滚球横滨SPA连接掷铅球SPA地址美式足球SPA Youtube[BCGAME BC游戏总经销咨询]通知设置推荐 订阅点赞
    • 私設ブラックジャック遊び場=BCGAME33·COM▦ヨルダンブラックジャック映像私設英国ブラックジャックツアー[本社お問い合わせテレJBOX7]私設ブラックジャック▒YouTubeアンティークガバーブーダブラックジャック募集私設ギニア私設ブラックジャック賭博場[総販お問い合わせカカオトークJBOX7]私設ブラックジャック▤️コミュニティアルバニアブラックジャックグループトーク私設フィジー私設ブラッグリーグ[各種オフィコミュニティ制作]社説黒ザック♪▨業者アラブ首長国連邦の黒ザックキャッシュゲーム社説チュニジア社説黒ザック映像[マーケティングお問い合わせ]社説黒ザック↘↗カジノパブ 韓国ブラックジャック動画私設マリ私設ブラックジャックホールダンパブ[ト本社お問い合わせ]私設ブラックジャック▲▨業者ルクセンブルクブラックジャックサイト私設ギリシャ私設ブラックジャック業者[ト総販購入]私設ブラックジャック↔§ホールダンバジョージアブラックジャックカジノパブ私設セネガル私設ブラックジャックコミュニティ[カジノ総販]社説ブラックジャッキ▲▼遊び場コモロ ブラックジャッキキャッシュゲーム社説北マケドニア社説ブラックジャッキグループチャット[大和本社]社説 ブラックジャッキ™¶ クープーンベラジオカジノ ブラックジャッキ [バサミコ] 総販のお問い合わせ]お知らせ設定おすすめ購読いいですね
  • Topics

×
×
  • Create New...

Important Information

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