-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Make it build against 1.21.2 - Fix broken things - Replace basically all of the boat API
- Loading branch information
1 parent
a7ac9de
commit b323b57
Showing
38 changed files
with
449 additions
and
1,080 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
org.gradle.jvmargs=-Xmx2G | ||
org.gradle.parallel=true | ||
fabric.loom.multiProjectOptimisation=true | ||
|
||
maven_group=com.terraformersmc.terraform-api | ||
version=11.0.0-alpha.1 | ||
version=12.0.0-alpha.1 | ||
|
||
minecraft_version=1.21 | ||
yarn_mappings=1.21+build.7 | ||
loader_version=0.15.11 | ||
fabric_version=0.100.4+1.21 | ||
minecraft_version=1.21.2-pre3 | ||
yarn_mappings=1.21.2-pre3+build.3 | ||
loader_version=0.16.7 | ||
fabric_version=0.105.4+1.21.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 0 additions & 86 deletions
86
...rm-wood-api-v1/src/main/java/com/terraformersmc/terraform/boat/api/TerraformBoatType.java
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
...api-v1/src/main/java/com/terraformersmc/terraform/boat/api/TerraformBoatTypeRegistry.java
This file was deleted.
Oops, something went wrong.
78 changes: 15 additions & 63 deletions
78
...src/main/java/com/terraformersmc/terraform/boat/api/client/TerraformBoatClientHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,35 @@ | ||
package com.terraformersmc.terraform.boat.api.client; | ||
|
||
import com.terraformersmc.terraform.boat.impl.client.TerraformBoatClientHelperImpl; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry; | ||
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry.TexturedModelDataProvider; | ||
import net.minecraft.client.render.entity.model.BoatEntityModel; | ||
import net.minecraft.client.render.entity.model.ChestBoatEntityModel; | ||
import net.minecraft.client.render.entity.model.ChestRaftEntityModel; | ||
import net.minecraft.client.render.entity.BoatEntityRenderer; | ||
import net.minecraft.client.render.entity.model.EntityModelLayer; | ||
import net.minecraft.client.render.entity.model.RaftEntityModel; | ||
import net.minecraft.util.Identifier; | ||
|
||
@Environment(EnvType.CLIENT) | ||
/** | ||
* This class provides useful helpers for registering a {@linkplain com.terraformersmc.terraform.boat.api.TerraformBoatType Terraform boat} on the client. | ||
* This class provides useful helpers for registering a {@linkplain net.minecraft.entity.vehicle.BoatEntity boat} on the client. | ||
*/ | ||
@Environment(EnvType.CLIENT) | ||
@SuppressWarnings("unused") | ||
public final class TerraformBoatClientHelper { | ||
private TerraformBoatClientHelper() { | ||
return; | ||
} | ||
|
||
/** | ||
* Gets the identifier of a {@linkplain EntityModelLayer model layer} for a boat of a given type. | ||
* @param boatId the {@linkplain net.minecraft.util.Identifier identifier} of the {@linkplain com.terraformersmc.terraform.boat.api.TerraformBoatType boat} | ||
* @param raft whether the boat is a raft | ||
* @param chest whether the boat contains a chest | ||
*/ | ||
private static Identifier getLayerId(Identifier boatId, boolean raft, boolean chest) { | ||
String prefix = raft ? (chest ? "chest_raft/" : "raft/") : (chest ? "chest_boat/" : "boat/"); | ||
return boatId.withPrefixedPath(prefix); | ||
} | ||
|
||
/** | ||
* Creates a {@linkplain EntityModelLayer model layer} for a boat of a given type. | ||
* @param boatId the {@linkplain net.minecraft.util.Identifier identifier} of the {@linkplain com.terraformersmc.terraform.boat.api.TerraformBoatType boat} | ||
* @param raft whether the boat is a raft | ||
* @param chest whether the boat contains a chest | ||
* | ||
* <pre>{@code | ||
* EntityModelLayer layer = TerraformBoatClientHelper.getLayer(Identifier.of("examplemod", "mahogany"), false, false); | ||
* }</pre> | ||
*/ | ||
public static EntityModelLayer getLayer(Identifier boatId, boolean raft, boolean chest) { | ||
return new EntityModelLayer(getLayerId(boatId, raft, chest), "main"); | ||
} | ||
|
||
private static TexturedModelDataProvider getTexturedModelDataProvider(boolean raft, boolean chest) { | ||
if (raft) { | ||
return chest ? ChestRaftEntityModel::getTexturedModelData : RaftEntityModel::getTexturedModelData; | ||
} else { | ||
return chest ? ChestBoatEntityModel::getTexturedModelData : BoatEntityModel::getTexturedModelData; | ||
} | ||
} | ||
|
||
/** | ||
* Registers a {@linkplain EntityModelLayer model layer} for a boat of a given type. | ||
* @param boatId the {@linkplain net.minecraft.util.Identifier identifier} of the {@linkplain com.terraformersmc.terraform.boat.api.TerraformBoatType boat} | ||
* @param raft whether the boat is a raft | ||
* @param chest whether the boat contains a chest | ||
* | ||
* <pre>{@code | ||
* TerraformBoatClientHelper.registerModelLayer(Identifier.of("examplemod", "mahogany"), false, false); | ||
* }</pre> | ||
*/ | ||
private static void registerModelLayer(Identifier boatId, boolean raft, boolean chest) { | ||
EntityModelLayerRegistry.registerModelLayer(getLayer(boatId, raft, chest), getTexturedModelDataProvider(raft, chest)); | ||
} | ||
|
||
/** | ||
* Registers {@linkplain EntityModelLayer model layers} for a given boat type. | ||
* @param boatId the {@linkplain net.minecraft.util.Identifier identifier} of the {@linkplain com.terraformersmc.terraform.boat.api.TerraformBoatType boat type} | ||
* @param raft whether the boat is a raft | ||
* | ||
* Registers {@linkplain EntityModelLayer model layers} and | ||
* {@linkplain BoatEntityRenderer entity renderers} for all boats of given boat type. | ||
* The provided identifier must match the identifier used to | ||
* {@linkplain com.terraformersmc.terraform.boat.api.item.TerraformBoatItemHelper#registerBoatItem register the boat type}. | ||
* | ||
* <pre>{@code | ||
* TerraformBoatClientHelper.registerModelLayers(Identifier.of("examplemod", "mahogany"), false); | ||
* TerraformBoatClientHelper.registerModelLayers(Identifier.of("examplemod", "mahogany")); | ||
* }</pre> | ||
* | ||
* @param id the {@linkplain net.minecraft.util.Identifier identifier} of the boat type. | ||
*/ | ||
public static void registerModelLayers(Identifier boatId, boolean raft) { | ||
registerModelLayer(boatId, raft, false); | ||
registerModelLayer(boatId, raft, true); | ||
public static void registerModelLayers(Identifier id) { | ||
TerraformBoatClientHelperImpl.registerModelLayers(id); | ||
} | ||
} |
Oops, something went wrong.