Git Product home page Git Product logo

Comments (3)

daviscook477 avatar daviscook477 commented on July 26, 2024

Note that if I change the code to the following it works

package basemod.patches.com.megacrit.cardcrawl.core.CardCrawlGame;

import com.evacipated.cardcrawl.modthespire.lib.ByRef;
import com.evacipated.cardcrawl.modthespire.lib.SpireInsertPatch;
import com.evacipated.cardcrawl.modthespire.lib.SpirePatch;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.CardCrawlGame;

import basemod.BaseMod;

@SpirePatch(cls="com.megacrit.cardcrawl.core.CardCrawlGame", method="createCharacter")
public class CreateCharacterSwitch {

	@SpireInsertPatch(loc=999, localvars={"p"})
	public static void Insert(Object selectionObj, Object pObj) {
		AbstractPlayer.PlayerClass selection = (AbstractPlayer.PlayerClass) selectionObj;
		AbstractPlayer p = (AbstractPlayer) pObj;
		if (!selection.toString().equals("IRONCLAD") && !selection.toString().equals("THE_SILENT") &&
				!selection.toString().equals("CROWBOT")) {
			p = BaseMod.createCharacter(selection.toString(), CardCrawlGame.playerName);
			//pObj[0] = (Object) p;
		}
	}
	
}

from modthespire.

daviscook477 avatar daviscook477 commented on July 26, 2024

The issue is in the line src += info.localvars()[i] + " = __" + info.localvars()[i] + "[0];\n"; because it is trying to assign type Object to whatever type the localvar is without a type cast. A type cast is required to make this work. However, types cannot be obtained from local variables so the @ByRef annotation will need a field for allowing the modder to provide the fully qualified path of the type of the local variable

from modthespire.

kiooeht avatar kiooeht commented on July 26, 2024

Fixed in commit fbc476f

from modthespire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.