-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
variant schooling, start the switch to geckolib
- Loading branch information
Showing
184 changed files
with
861 additions
and
452 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
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
71 changes: 71 additions & 0 deletions
71
src/main/java/codyhuh/unusualfishmod/client/geo/GenericGeoModel.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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package codyhuh.unusualfishmod.client.geo; | ||
|
||
import codyhuh.unusualfishmod.UnusualFishMod; | ||
import codyhuh.unusualfishmod.common.entity.util.misc.IFlopper; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import software.bernie.geckolib.animatable.GeoEntity; | ||
import software.bernie.geckolib.core.animatable.model.CoreGeoBone; | ||
import software.bernie.geckolib.core.animation.AnimationState; | ||
import software.bernie.geckolib.model.GeoModel; | ||
|
||
public class GenericGeoModel<E extends LivingEntity & GeoEntity> extends GeoModel<E> { | ||
private final String model; | ||
private final String texture; | ||
private final String anim; | ||
|
||
public GenericGeoModel(String name) { | ||
this(name, name, name); | ||
} | ||
|
||
public GenericGeoModel(String model, String texture, String anim) { | ||
this.model = model; | ||
this.texture = texture; | ||
this.anim = anim; | ||
} | ||
|
||
|
||
@Override | ||
public ResourceLocation getModelResource(E object) { | ||
return new ResourceLocation(UnusualFishMod.MOD_ID, "geo/entity/" + model + ".geo.json"); | ||
} | ||
|
||
@Override | ||
public ResourceLocation getTextureResource(E object) { | ||
return new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/" + texture + ".png"); | ||
} | ||
|
||
@Override | ||
public ResourceLocation getAnimationResource(E object) { | ||
return new ResourceLocation(UnusualFishMod.MOD_ID, "animations/entity/" + anim + ".animation.json"); | ||
} | ||
|
||
@Override | ||
public void setCustomAnimations(E entity, long instanceId, AnimationState<E> customPredicate) { | ||
super.setCustomAnimations(entity, instanceId, customPredicate); | ||
|
||
CoreGeoBone root = getAnimationProcessor().getBone("root"); | ||
|
||
if (entity instanceof IFlopper) { | ||
if (!entity.isInWater()) { | ||
root.setRotZ(1.5708F); | ||
} | ||
else { | ||
root.setRotZ(0.0F); | ||
} | ||
} | ||
// if (entity instanceof ISwimmer) { | ||
// if (entity.isInWater()) { | ||
// | ||
// EntityModelData extraData = customPredicate.getData(DataTickets.ENTITY_MODEL_DATA); | ||
// | ||
// root.setRotX(extraData.headPitch() * ((float)Math.PI / 180F)); | ||
// root.setRotY(extraData.netHeadYaw() * ((float)Math.PI / 180F)); | ||
// } | ||
// else { | ||
// root.setRotX(0.0F); | ||
// root.setRotY(0.0F); | ||
// } | ||
// } | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
src/main/java/codyhuh/unusualfishmod/client/geo/GenericGeoRenderer.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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package codyhuh.unusualfishmod.client.geo; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import com.mojang.blaze3d.vertex.VertexConsumer; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.client.renderer.RenderType; | ||
import net.minecraft.client.renderer.entity.EntityRendererProvider; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.entity.AgeableMob; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import software.bernie.geckolib.animatable.GeoEntity; | ||
import software.bernie.geckolib.cache.object.BakedGeoModel; | ||
import software.bernie.geckolib.model.GeoModel; | ||
import software.bernie.geckolib.renderer.GeoEntityRenderer; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public class GenericGeoRenderer<T extends LivingEntity & GeoEntity> extends GeoEntityRenderer<T> { | ||
private float scale = 1F; | ||
|
||
public GenericGeoRenderer(EntityRendererProvider.Context renderManager, Supplier<GeoModel<T>> model) { | ||
super(renderManager, model.get()); | ||
this.shadowRadius = 0.3F; | ||
} | ||
|
||
public GenericGeoRenderer(EntityRendererProvider.Context renderManager, Supplier<GeoModel<T>> model, float scale) { | ||
this(renderManager, model.get(), scale); | ||
this.scale = scale; | ||
} | ||
|
||
public GenericGeoRenderer(EntityRendererProvider.Context mgr, GeoModel<T> modelProvider) { | ||
super(mgr, modelProvider); | ||
} | ||
|
||
public GenericGeoRenderer(EntityRendererProvider.Context mgr, GeoModel<T> modelProvider, float scale) { | ||
this(mgr, modelProvider); | ||
this.scale = scale; | ||
} | ||
|
||
@Override | ||
public void render(T entity, float entityYaw, float partialTicks, PoseStack stack, MultiBufferSource bufferIn, int packedLightIn) { | ||
if (scale != 1F) { | ||
stack.scale(scale, scale, scale); | ||
} | ||
|
||
if (entity instanceof AgeableMob mob && mob.isBaby()) { | ||
stack.scale(0.5F, 0.5F, 0.5F); | ||
} | ||
|
||
super.render(entity, entityYaw, partialTicks, stack, bufferIn, packedLightIn); | ||
} | ||
|
||
@Override | ||
public void preRender(PoseStack poseStack, T animatable, BakedGeoModel bakedGeoModel, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { | ||
super.preRender(poseStack, animatable, bakedGeoModel, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, red, green, blue, alpha); | ||
} | ||
|
||
@Override | ||
public RenderType getRenderType(T animatable, ResourceLocation texture, @org.jetbrains.annotations.Nullable MultiBufferSource bufferSource, float partialTick) { | ||
return RenderType.entityTranslucent(texture); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/codyhuh/unusualfishmod/client/geo/TextureVariantModel.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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package codyhuh.unusualfishmod.client.geo; | ||
|
||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import software.bernie.geckolib.animatable.GeoEntity; | ||
|
||
import java.util.List; | ||
import java.util.function.Function; | ||
|
||
public class TextureVariantModel<E extends LivingEntity & GeoEntity> extends GenericGeoModel<E> { | ||
List<ResourceLocation> textures; | ||
Function<E, Integer> whichTexture; | ||
|
||
public TextureVariantModel(String name) { | ||
super(name); | ||
} | ||
|
||
public TextureVariantModel<E> setTextures(Function<E, Integer> whichTexture, List<ResourceLocation> textures){ | ||
this.whichTexture = whichTexture; | ||
this.textures = textures; | ||
return this; | ||
} | ||
|
||
@Override | ||
public ResourceLocation getTextureResource(E object) { | ||
if (this.textures == null || this.whichTexture == null) return null; | ||
return this.textures.get(this.whichTexture.apply(object)); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../unusualfishmod/client/UFModelLayers.java → ...sualfishmod/client/old/UFModelLayers.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
2 changes: 1 addition & 1 deletion
2
...alfishmod/client/model/AeroMonoModel.java → ...shmod/client/old/model/AeroMonoModel.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
2 changes: 1 addition & 1 deletion
2
...lfishmod/client/model/AmberGobyModel.java → ...hmod/client/old/model/AmberGobyModel.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
2 changes: 1 addition & 1 deletion
2
...hmod/client/model/BarkAngelfishModel.java → .../client/old/model/BarkAngelfishModel.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
2 changes: 1 addition & 1 deletion
2
...hmod/client/model/BeakedHerringModel.java → .../client/old/model/BeakedHerringModel.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
2 changes: 1 addition & 1 deletion
2
...hmod/client/model/BlackcapSnailModel.java → .../client/old/model/BlackcapSnailModel.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
2 changes: 1 addition & 1 deletion
2
...shmod/client/model/BlindSailfinModel.java → ...d/client/old/model/BlindSailfinModel.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
2 changes: 1 addition & 1 deletion
2
...od/client/model/BlizzardfinTunaModel.java → ...lient/old/model/BlizzardfinTunaModel.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
2 changes: 1 addition & 1 deletion
2
...fishmod/client/model/BrickSnailModel.java → ...mod/client/old/model/BrickSnailModel.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
2 changes: 1 addition & 1 deletion
2
...hmod/client/model/CelestialFishModel.java → .../client/old/model/CelestialFishModel.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
2 changes: 1 addition & 1 deletion
2
...fishmod/client/model/CircusFishModel.java → ...mod/client/old/model/CircusFishModel.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
2 changes: 1 addition & 1 deletion
2
...od/client/model/ClownthornSharkModel.java → ...lient/old/model/ClownthornSharkModel.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
2 changes: 1 addition & 1 deletion
2
...client/model/CopperflameAnthiasModel.java → ...nt/old/model/CopperflameAnthiasModel.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
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
Oops, something went wrong.