Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boatinit questions for 1.21.2 #96

Open
JCS-Mecabricks opened this issue Nov 12, 2024 · 3 comments
Open

Boatinit questions for 1.21.2 #96

JCS-Mecabricks opened this issue Nov 12, 2024 · 3 comments

Comments

@JCS-Mecabricks
Copy link

How do you make a custom boat? I don't see Terraform Boat Type.

@gniftygnome
Copy link
Contributor

gniftygnome commented Nov 13, 2024

We are no longer maintaining a separate registry; it's not needed since vanilla split up their boats. Instead, Terraform API is now just an easy way to use the vanilla registries. For the basic use case of a boat and chest boat, all you need to do is call the item helper to register both items and entities, and then call the client helper to register all textures, model layers, and entity renderers for the boat type.

F.e. common code:

public class TraverseBoats {
	public static final Identifier FIR = Identifier.of(Traverse.MOD_ID, "fir");
	public static final Item FIR_BOAT = TerraformBoatItemHelper.registerBoatItem(FIR, false);
	public static final Item FIR_CHEST_BOAT = TerraformBoatItemHelper.registerBoatItem(FIR, true);

	public static void register() {
	}
}

and client side:

public class TraverseClient implements ClientModInitializer {
	@Override
	public void onInitializeClient() {
		TerraformBoatClientHelper.registerModelLayers(TraverseBoats.FIR);
	}
}

Assuming your boat Identifiers were similar to vanilla (f.e. mahogany_chest_boat and chest_boat/mahogany), you don't need to move your textures around, either.

Note that the Identifier you give the new API methods identifies the boat type as a whole, f.e. traverse:fir not traverse:fir_chest_boat. The API will prepend/append the right things for individual Identifiers. This also means it is now possible to register both boat and raft for the same wood type in Terraform boat API.

@gniftygnome gniftygnome changed the title Boatinit Boatinit questions for 1.21.2 Nov 13, 2024
@gniftygnome gniftygnome pinned this issue Nov 13, 2024
@JCS-Mecabricks
Copy link
Author

Thanks!

@gniftygnome
Copy link
Contributor

gniftygnome commented Nov 18, 2024

Right now the API doesn't provide it, because in theory you generally don't need it.

If you need the key for some reason, you can do something like this:

Item boatItem = TerraformBoatItemHelper.registerBoatItem(woodTypeId, false);
RegistryKey<Item> boatKey = Registries.ITEM.getKey(boatItem).orElseThrow();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants