-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: = <[email protected]>
- Loading branch information
Showing
281 changed files
with
20,296 additions
and
14,481 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
5 changes: 2 additions & 3 deletions
5
common/src/main/java/mod/azure/azurelib/common/api/client/helper/ClientUtils.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
98 changes: 52 additions & 46 deletions
98
common/src/main/java/mod/azure/azurelib/common/api/client/model/DefaultedBlockGeoModel.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,54 +1,60 @@ | ||
package mod.azure.azurelib.common.api.client.model; | ||
|
||
import mod.azure.azurelib.core.animatable.GeoAnimatable; | ||
import net.minecraft.resources.ResourceLocation; | ||
|
||
import mod.azure.azurelib.core.animatable.GeoAnimatable; | ||
|
||
/** | ||
* {@link DefaultedGeoModel} specific to {@link net.minecraft.world.level.block.Block Blocks}. | ||
* Using this class pre-sorts provided asset paths into the "block" subdirectory | ||
* {@link DefaultedGeoModel} specific to {@link net.minecraft.world.level.block.Block Blocks}. Using this class | ||
* pre-sorts provided asset paths into the "block" subdirectory | ||
*/ | ||
public class DefaultedBlockGeoModel<T extends GeoAnimatable> extends DefaultedGeoModel<T> { | ||
/** | ||
* Create a new instance of this model class.<br> | ||
* The asset path should be the truncated relative path from the base folder.<br> | ||
* E.G. | ||
* <pre>{@code | ||
* new ResourceLocation("myMod", "workbench/sawmill") | ||
* }</pre> | ||
*/ | ||
public DefaultedBlockGeoModel(ResourceLocation assetSubpath) { | ||
super(assetSubpath); | ||
} | ||
|
||
@Override | ||
protected String subtype() { | ||
return "block"; | ||
} | ||
|
||
/** | ||
* Changes the constructor-defined model path for this model to an alternate.<br> | ||
* This is useful if your animatable shares a model path with another animatable that differs in path to the texture and animations for this model | ||
*/ | ||
@Override | ||
public DefaultedBlockGeoModel<T> withAltModel(ResourceLocation altPath) { | ||
return (DefaultedBlockGeoModel<T>)super.withAltModel(altPath); | ||
} | ||
|
||
/** | ||
* Changes the constructor-defined animations path for this model to an alternate.<br> | ||
* This is useful if your animatable shares an animations path with another animatable that differs in path to the model and texture for this model | ||
*/ | ||
@Override | ||
public DefaultedBlockGeoModel<T> withAltAnimations(ResourceLocation altPath) { | ||
return (DefaultedBlockGeoModel<T>)super.withAltAnimations(altPath); | ||
} | ||
|
||
/** | ||
* Changes the constructor-defined texture path for this model to an alternate.<br> | ||
* This is useful if your animatable shares a texture path with another animatable that differs in path to the model and animations for this model | ||
*/ | ||
@Override | ||
public DefaultedBlockGeoModel<T> withAltTexture(ResourceLocation altPath) { | ||
return (DefaultedBlockGeoModel<T>)super.withAltTexture(altPath); | ||
} | ||
|
||
/** | ||
* Create a new instance of this model class.<br> | ||
* The asset path should be the truncated relative path from the base folder.<br> | ||
* E.G. | ||
* | ||
* <pre>{@code | ||
* new ResourceLocation("myMod", "workbench/sawmill") | ||
* }</pre> | ||
*/ | ||
public DefaultedBlockGeoModel(ResourceLocation assetSubpath) { | ||
super(assetSubpath); | ||
} | ||
|
||
@Override | ||
protected String subtype() { | ||
return "block"; | ||
} | ||
|
||
/** | ||
* Changes the constructor-defined model path for this model to an alternate.<br> | ||
* This is useful if your animatable shares a model path with another animatable that differs in path to the texture | ||
* and animations for this model | ||
*/ | ||
@Override | ||
public DefaultedBlockGeoModel<T> withAltModel(ResourceLocation altPath) { | ||
return (DefaultedBlockGeoModel<T>) super.withAltModel(altPath); | ||
} | ||
|
||
/** | ||
* Changes the constructor-defined animations path for this model to an alternate.<br> | ||
* This is useful if your animatable shares an animations path with another animatable that differs in path to the | ||
* model and texture for this model | ||
*/ | ||
@Override | ||
public DefaultedBlockGeoModel<T> withAltAnimations(ResourceLocation altPath) { | ||
return (DefaultedBlockGeoModel<T>) super.withAltAnimations(altPath); | ||
} | ||
|
||
/** | ||
* Changes the constructor-defined texture path for this model to an alternate.<br> | ||
* This is useful if your animatable shares a texture path with another animatable that differs in path to the model | ||
* and animations for this model | ||
*/ | ||
@Override | ||
public DefaultedBlockGeoModel<T> withAltTexture(ResourceLocation altPath) { | ||
return (DefaultedBlockGeoModel<T>) super.withAltTexture(altPath); | ||
} | ||
} |
128 changes: 67 additions & 61 deletions
128
common/src/main/java/mod/azure/azurelib/common/api/client/model/DefaultedEntityGeoModel.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,89 @@ | ||
package mod.azure.azurelib.common.api.client.model; | ||
|
||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.util.Mth; | ||
|
||
import mod.azure.azurelib.common.internal.client.model.data.EntityModelData; | ||
import mod.azure.azurelib.common.internal.common.constant.DataTickets; | ||
import mod.azure.azurelib.core.animatable.GeoAnimatable; | ||
import mod.azure.azurelib.core.animatable.model.CoreGeoBone; | ||
import mod.azure.azurelib.core.animation.AnimationState; | ||
import mod.azure.azurelib.common.internal.client.model.data.EntityModelData; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.util.Mth; | ||
|
||
/** | ||
* {@link DefaultedGeoModel} specific to {@link net.minecraft.world.entity.Entity Entities}. | ||
* Using this class pre-sorts provided asset paths into the "entity" subdirectory | ||
* Additionally it can automatically handle head-turning if the entity has a "head" bone | ||
* {@link DefaultedGeoModel} specific to {@link net.minecraft.world.entity.Entity Entities}. Using this class pre-sorts | ||
* provided asset paths into the "entity" subdirectory Additionally it can automatically handle head-turning if the | ||
* entity has a "head" bone | ||
*/ | ||
public class DefaultedEntityGeoModel<T extends GeoAnimatable> extends DefaultedGeoModel<T> { | ||
private final boolean turnsHead; | ||
|
||
/** | ||
* Create a new instance of this model class.<br> | ||
* The asset path should be the truncated relative path from the base folder.<br> | ||
* E.G. | ||
* <pre>{@code | ||
* new ResourceLocation("myMod", "animals/red_fish") | ||
* }</pre> | ||
*/ | ||
public DefaultedEntityGeoModel(ResourceLocation assetSubpath) { | ||
this(assetSubpath, false); | ||
} | ||
private final boolean turnsHead; | ||
|
||
/** | ||
* Create a new instance of this model class.<br> | ||
* The asset path should be the truncated relative path from the base folder.<br> | ||
* E.G. | ||
* | ||
* <pre>{@code | ||
* new ResourceLocation("myMod", "animals/red_fish") | ||
* }</pre> | ||
*/ | ||
public DefaultedEntityGeoModel(ResourceLocation assetSubpath) { | ||
this(assetSubpath, false); | ||
} | ||
|
||
public DefaultedEntityGeoModel(ResourceLocation assetSubpath, boolean turnsHead) { | ||
super(assetSubpath); | ||
public DefaultedEntityGeoModel(ResourceLocation assetSubpath, boolean turnsHead) { | ||
super(assetSubpath); | ||
|
||
this.turnsHead = turnsHead; | ||
} | ||
this.turnsHead = turnsHead; | ||
} | ||
|
||
@Override | ||
protected String subtype() { | ||
return "entity"; | ||
} | ||
@Override | ||
protected String subtype() { | ||
return "entity"; | ||
} | ||
|
||
@Override | ||
public void setCustomAnimations(T animatable, long instanceId, AnimationState<T> animationState) { | ||
if (!this.turnsHead) | ||
return; | ||
@Override | ||
public void setCustomAnimations(T animatable, long instanceId, AnimationState<T> animationState) { | ||
if (!this.turnsHead) | ||
return; | ||
|
||
CoreGeoBone head = getAnimationProcessor().getBone("head"); | ||
CoreGeoBone head = getAnimationProcessor().getBone("head"); | ||
|
||
if (head != null) { | ||
EntityModelData entityData = animationState.getData(DataTickets.ENTITY_MODEL_DATA); | ||
if (head != null) { | ||
EntityModelData entityData = animationState.getData(DataTickets.ENTITY_MODEL_DATA); | ||
|
||
head.setRotX(entityData.headPitch() * Mth.DEG_TO_RAD); | ||
head.setRotY(entityData.netHeadYaw() * Mth.DEG_TO_RAD); | ||
} | ||
} | ||
head.setRotX(entityData.headPitch() * Mth.DEG_TO_RAD); | ||
head.setRotY(entityData.netHeadYaw() * Mth.DEG_TO_RAD); | ||
} | ||
} | ||
|
||
/** | ||
* Changes the constructor-defined model path for this model to an alternate.<br> | ||
* This is useful if your animatable shares a model path with another animatable that differs in path to the texture and animations for this model | ||
*/ | ||
@Override | ||
public DefaultedEntityGeoModel<T> withAltModel(ResourceLocation altPath) { | ||
return (DefaultedEntityGeoModel<T>)super.withAltModel(altPath); | ||
} | ||
/** | ||
* Changes the constructor-defined model path for this model to an alternate.<br> | ||
* This is useful if your animatable shares a model path with another animatable that differs in path to the texture | ||
* and animations for this model | ||
*/ | ||
@Override | ||
public DefaultedEntityGeoModel<T> withAltModel(ResourceLocation altPath) { | ||
return (DefaultedEntityGeoModel<T>) super.withAltModel(altPath); | ||
} | ||
|
||
/** | ||
* Changes the constructor-defined animations path for this model to an alternate.<br> | ||
* This is useful if your animatable shares an animations path with another animatable that differs in path to the model and texture for this model | ||
*/ | ||
@Override | ||
public DefaultedEntityGeoModel<T> withAltAnimations(ResourceLocation altPath) { | ||
return (DefaultedEntityGeoModel<T>)super.withAltAnimations(altPath); | ||
} | ||
/** | ||
* Changes the constructor-defined animations path for this model to an alternate.<br> | ||
* This is useful if your animatable shares an animations path with another animatable that differs in path to the | ||
* model and texture for this model | ||
*/ | ||
@Override | ||
public DefaultedEntityGeoModel<T> withAltAnimations(ResourceLocation altPath) { | ||
return (DefaultedEntityGeoModel<T>) super.withAltAnimations(altPath); | ||
} | ||
|
||
/** | ||
* Changes the constructor-defined texture path for this model to an alternate.<br> | ||
* This is useful if your animatable shares a texture path with another animatable that differs in path to the model and animations for this model | ||
*/ | ||
@Override | ||
public DefaultedEntityGeoModel<T> withAltTexture(ResourceLocation altPath) { | ||
return (DefaultedEntityGeoModel<T>)super.withAltTexture(altPath); | ||
} | ||
/** | ||
* Changes the constructor-defined texture path for this model to an alternate.<br> | ||
* This is useful if your animatable shares a texture path with another animatable that differs in path to the model | ||
* and animations for this model | ||
*/ | ||
@Override | ||
public DefaultedEntityGeoModel<T> withAltTexture(ResourceLocation altPath) { | ||
return (DefaultedEntityGeoModel<T>) super.withAltTexture(altPath); | ||
} | ||
} |
Oops, something went wrong.