Sign in to follow this  

Customize max farming slope

Recommended Posts

I saw someone request this elsewhere. I don't want to maintain Javassist/Hookmanager based mods so wrote the code and am putting it here.


In addition to the code below, which handles sowing, you'd need to make something almost identical for the TileFieldBehaviour.class so raking is possible. All you need to do is copy the code and change the CtClass's path to reflect "com.wurmonline.server.behaviours.TileFieldBehaviour".



public void configureMaxSowingSlope(int customMaxSlope){
	try {

		CtClass ctClassTileDirtBehaviour = HookManager.getInstance().getClassPool().get(
		CtClass returnType = CtPrimitiveType.booleanType;
		//Action act, Creature performer, Item source, int tilex, int tiley, boolean onSurface, int heightOffset,
		//   int tile, short action, float counter
		CtClass[] paramTypes = {
				CtPrimitiveType.intType, CtPrimitiveType.intType, CtPrimitiveType.booleanType, CtPrimitiveType.intType,
				CtPrimitiveType.intType, CtPrimitiveType.shortType, CtPrimitiveType.floatType
		CtMethod ctMethodAction = ctClassTileDirtBehaviour.getMethod("action",
				Descriptor.ofMethod(returnType, paramTypes));
		ctMethodAction.instrument(new ExprEditor() {
			public void edit(MethodCall methodCall) throws CannotCompileException {
				if (Objects.equals("isFlat", methodCall.getMethodName())) {
					methodCall.replace("{ $4 = "+customMaxSlope+"; $_ = $proceed($$); }");
	} catch (NotFoundException | CannotCompileException e){




Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this