mirror of
https://github.com/Pridecraft-Studios/joy.git
synced 2025-08-03 22:46:02 -04:00
Refactor PrideFox to SockFox
This commit is contained in:
parent
aeeaa3cb88
commit
ffa611d216
@ -76,7 +76,7 @@ public class Joy implements ModInitializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void registerEntityAttributes() {
|
private void registerEntityAttributes() {
|
||||||
FabricDefaultAttributeRegistry.register(ModEntities.THIGH_HIGH_FOX, MobEntity.createMobAttributes()
|
FabricDefaultAttributeRegistry.register(ModEntities.SOCK_FOX, MobEntity.createMobAttributes()
|
||||||
.add(EntityAttributes.GENERIC_ATTACK_DAMAGE, 2.0)
|
.add(EntityAttributes.GENERIC_ATTACK_DAMAGE, 2.0)
|
||||||
.add(EntityAttributes.GENERIC_FOLLOW_RANGE, 32.0)
|
.add(EntityAttributes.GENERIC_FOLLOW_RANGE, 32.0)
|
||||||
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.3));
|
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.3));
|
||||||
|
@ -54,7 +54,7 @@ public class JoyClient implements ClientModInitializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void registerEntityRenderers() {
|
private static void registerEntityRenderers() {
|
||||||
EntityRendererRegistry.register(ModEntities.THIGH_HIGH_FOX, ThighHighFoxRenderer::new);
|
EntityRendererRegistry.register(ModEntities.SOCK_FOX, SockFoxRenderer::new);
|
||||||
EntityRendererRegistry.register(ModEntities.BII, BiiRenderer::new);
|
EntityRendererRegistry.register(ModEntities.BII, BiiRenderer::new);
|
||||||
EntityRendererRegistry.register(ModEntities.ENBEE, EnbeeRenderer::new);
|
EntityRendererRegistry.register(ModEntities.ENBEE, EnbeeRenderer::new);
|
||||||
EntityRendererRegistry.register(ModEntities.TREE, TreeRenderer::new);
|
EntityRendererRegistry.register(ModEntities.TREE, TreeRenderer::new);
|
||||||
|
@ -34,10 +34,10 @@ public class ModEntities {
|
|||||||
).build()
|
).build()
|
||||||
);
|
);
|
||||||
|
|
||||||
public static final EntityType<CustomFoxEntity.ThighHighFoxEntity> THIGH_HIGH_FOX = Registry.register(
|
public static final EntityType<CustomFoxEntity.SockFoxEntity> SOCK_FOX = Registry.register(
|
||||||
Registries.ENTITY_TYPE,
|
Registries.ENTITY_TYPE,
|
||||||
Identifier.of(Joy.MOD_ID, "thigh_high_fox"),
|
Identifier.of(Joy.MOD_ID, "sock_fox"),
|
||||||
EntityType.Builder.create(CustomFoxEntity.ThighHighFoxEntity::new, EntityType.FOX.getSpawnGroup())
|
EntityType.Builder.create(CustomFoxEntity.SockFoxEntity::new, EntityType.FOX.getSpawnGroup())
|
||||||
.dimensions(0.6f, 0.7f)
|
.dimensions(0.6f, 0.7f)
|
||||||
.maxTrackingRange(8)
|
.maxTrackingRange(8)
|
||||||
.build()
|
.build()
|
||||||
|
@ -9,8 +9,8 @@ public class CustomFoxEntity extends FoxEntity {
|
|||||||
super(entityType, world);
|
super(entityType, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ThighHighFoxEntity extends CustomFoxEntity {
|
public static class SockFoxEntity extends CustomFoxEntity {
|
||||||
public ThighHighFoxEntity(EntityType<? extends ThighHighFoxEntity> entityType, World world) {
|
public SockFoxEntity(EntityType<? extends SockFoxEntity> entityType, World world) {
|
||||||
super(entityType, world);
|
super(entityType, world);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@ public class SpawnModifier {
|
|||||||
BiomeKeys.SNOWY_TAIGA,
|
BiomeKeys.SNOWY_TAIGA,
|
||||||
BiomeKeys.OLD_GROWTH_PINE_TAIGA,
|
BiomeKeys.OLD_GROWTH_PINE_TAIGA,
|
||||||
BiomeKeys.OLD_GROWTH_SPRUCE_TAIGA),
|
BiomeKeys.OLD_GROWTH_SPRUCE_TAIGA),
|
||||||
ModEntities.THIGH_HIGH_FOX.getSpawnGroup(),
|
ModEntities.SOCK_FOX.getSpawnGroup(),
|
||||||
ModEntities.THIGH_HIGH_FOX,
|
ModEntities.SOCK_FOX,
|
||||||
Config.foxWeight,
|
Config.foxWeight,
|
||||||
Config.foxMinGroupSize,
|
Config.foxMinGroupSize,
|
||||||
Config.foxMaxGroupSize
|
Config.foxMaxGroupSize
|
||||||
|
@ -56,7 +56,7 @@ public class ModItemGroups {
|
|||||||
entries.add(ModItems.PRIDE_BRUSH);
|
entries.add(ModItems.PRIDE_BRUSH);
|
||||||
entries.add(ModItems.PRIDE_SLIME_BALL);
|
entries.add(ModItems.PRIDE_SLIME_BALL);
|
||||||
entries.add(ModItems.PRIDE_ELYTRA);
|
entries.add(ModItems.PRIDE_ELYTRA);
|
||||||
entries.add(ModItems.THIGH_HIGH_FOX_SPAWN_EGG);
|
entries.add(ModItems.SOCK_FOX_SPAWN_EGG);
|
||||||
entries.add(ModItems.BII_SPAWN_EGG);
|
entries.add(ModItems.BII_SPAWN_EGG);
|
||||||
entries.add(ModItems.ENBEE_SPAWN_EGG);
|
entries.add(ModItems.ENBEE_SPAWN_EGG);
|
||||||
entries.add(ModItems.TREE_SPAWN_EGG);
|
entries.add(ModItems.TREE_SPAWN_EGG);
|
||||||
|
@ -19,7 +19,7 @@ public class ModItems {
|
|||||||
new Item(new Item.Settings().maxCount(1)));
|
new Item(new Item.Settings().maxCount(1)));
|
||||||
public static final Item PRIDE_BRUSH = registerItem("pride_brush", new BrushItem(new Item.Settings()));
|
public static final Item PRIDE_BRUSH = registerItem("pride_brush", new BrushItem(new Item.Settings()));
|
||||||
public static final Item PRIDE_SLIME_BALL = registerItem("pride_slime_ball", new Item(new Item.Settings()));
|
public static final Item PRIDE_SLIME_BALL = registerItem("pride_slime_ball", new Item(new Item.Settings()));
|
||||||
public static final Item THIGH_HIGH_FOX_SPAWN_EGG = registerItem("thigh_high_fox_spawn_egg", new RainbowSpawnEggItem(ModEntities.THIGH_HIGH_FOX, 14005919, 0xff80bf, new Item.Settings()));
|
public static final Item SOCK_FOX_SPAWN_EGG = registerItem("thigh_high_fox_spawn_egg", new RainbowSpawnEggItem(ModEntities.SOCK_FOX, 14005919, 0xff80bf, new Item.Settings()));
|
||||||
public static final Item BII_SPAWN_EGG = registerItem("bii_spawn_egg", new RainbowSpawnEggItem(ModEntities.BII, 15582019, 0xFF69B4, new Item.Settings()));
|
public static final Item BII_SPAWN_EGG = registerItem("bii_spawn_egg", new RainbowSpawnEggItem(ModEntities.BII, 15582019, 0xFF69B4, new Item.Settings()));
|
||||||
public static final Item ENBEE_SPAWN_EGG = registerItem("bii_spawn_egg", new RainbowSpawnEggItem(ModEntities.ENBEE, 16577588, 0x9C59D1, new Item.Settings()));
|
public static final Item ENBEE_SPAWN_EGG = registerItem("bii_spawn_egg", new RainbowSpawnEggItem(ModEntities.ENBEE, 16577588, 0x9C59D1, new Item.Settings()));
|
||||||
public static final Item TREE_SPAWN_EGG = registerItem("tree_spawn_egg", new RainbowSpawnEggItem(ModEntities.TREE, 16577588, 0x9C59D1, new Item.Settings()));
|
public static final Item TREE_SPAWN_EGG = registerItem("tree_spawn_egg", new RainbowSpawnEggItem(ModEntities.TREE, 16577588, 0x9C59D1, new Item.Settings()));
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
package gay.pridecraft.joy.renderer.entity;
|
||||||
|
|
||||||
|
import gay.pridecraft.joy.Joy;
|
||||||
|
import gay.pridecraft.joy.entity.custom.living.CustomFoxEntity;
|
||||||
|
import gay.pridecraft.joy.renderer.feature.SockFoxHeldItemFeatureRenderer;
|
||||||
|
import gay.pridecraft.joy.renderer.model.SockFoxEntityModel;
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.api.Environment;
|
||||||
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
|
import net.minecraft.client.render.entity.MobEntityRenderer;
|
||||||
|
import net.minecraft.client.render.entity.model.EntityModelLayers;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.entity.passive.FoxEntity;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.RotationAxis;
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public class SockFoxRenderer extends MobEntityRenderer<CustomFoxEntity.SockFoxEntity, SockFoxEntityModel<CustomFoxEntity.SockFoxEntity>> {
|
||||||
|
private static final Identifier TEXTURE = Identifier.of(Joy.MOD_ID, "textures/entity/fox/sock_fox.png");
|
||||||
|
private static final Identifier SLEEPING_TEXTURE = Identifier.of(Joy.MOD_ID, "textures/entity/fox/sock_fox_sleep.png");
|
||||||
|
private static final Identifier SNOW_TEXTURE = Identifier.of(Joy.MOD_ID, "textures/entity/fox/snow_sock_fox.png");
|
||||||
|
private static final Identifier SLEEPING_SNOW_TEXTURE = Identifier.of(Joy.MOD_ID, "textures/entity/fox/snow_sock_fox_sleep.png");
|
||||||
|
|
||||||
|
public SockFoxRenderer(EntityRendererFactory.Context context) {
|
||||||
|
super(context, new SockFoxEntityModel<>(context.getPart(EntityModelLayers.FOX)), 0.4F);
|
||||||
|
this.addFeature(new SockFoxHeldItemFeatureRenderer(this, context.getHeldItemRenderer()));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setupTransforms(CustomFoxEntity.SockFoxEntity sockFoxEntity, MatrixStack matrixStack, float animationProgress, float bodyYaw, float tickDelta, float scale) {
|
||||||
|
super.setupTransforms(sockFoxEntity, matrixStack, animationProgress, bodyYaw, tickDelta, scale);
|
||||||
|
if (sockFoxEntity.isChasing() || sockFoxEntity.isWalking()) {
|
||||||
|
float i = -MathHelper.lerp(tickDelta, sockFoxEntity.prevPitch, sockFoxEntity.getPitch());
|
||||||
|
matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Identifier getTexture(CustomFoxEntity.SockFoxEntity entity) {
|
||||||
|
if (entity.getVariant() == FoxEntity.Type.RED) {
|
||||||
|
return entity.isSleeping() ? SLEEPING_TEXTURE : TEXTURE;
|
||||||
|
} else {
|
||||||
|
return entity.isSleeping() ? SLEEPING_SNOW_TEXTURE : SNOW_TEXTURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,46 +0,0 @@
|
|||||||
package gay.pridecraft.joy.renderer.entity;
|
|
||||||
|
|
||||||
import gay.pridecraft.joy.Joy;
|
|
||||||
import gay.pridecraft.joy.entity.custom.living.CustomFoxEntity;
|
|
||||||
import gay.pridecraft.joy.renderer.feature.ThighHighFoxHeldItemFeatureRenderer;
|
|
||||||
import gay.pridecraft.joy.renderer.model.ThighHighFoxEntityModel;
|
|
||||||
import net.fabricmc.api.EnvType;
|
|
||||||
import net.fabricmc.api.Environment;
|
|
||||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
|
||||||
import net.minecraft.client.render.entity.MobEntityRenderer;
|
|
||||||
import net.minecraft.client.render.entity.model.EntityModelLayers;
|
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
|
||||||
import net.minecraft.entity.passive.FoxEntity;
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
|
||||||
import net.minecraft.util.math.RotationAxis;
|
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
|
||||||
public class ThighHighFoxRenderer extends MobEntityRenderer<CustomFoxEntity.ThighHighFoxEntity, ThighHighFoxEntityModel<CustomFoxEntity.ThighHighFoxEntity>> {
|
|
||||||
private static final Identifier TEXTURE = Identifier.of(Joy.MOD_ID, "textures/entity/fox/thigh_high_fox.png");
|
|
||||||
private static final Identifier SLEEPING_TEXTURE = Identifier.of(Joy.MOD_ID, "textures/entity/fox/thigh_high_fox_sleep.png");
|
|
||||||
private static final Identifier SNOW_TEXTURE = Identifier.of(Joy.MOD_ID, "textures/entity/fox/thigh_high_snow_fox.png");
|
|
||||||
private static final Identifier SLEEPING_SNOW_TEXTURE = Identifier.of(Joy.MOD_ID, "textures/entity/fox/thigh_high_snow_fox_sleep.png");
|
|
||||||
|
|
||||||
public ThighHighFoxRenderer(EntityRendererFactory.Context context) {
|
|
||||||
super(context, new ThighHighFoxEntityModel<>(context.getPart(EntityModelLayers.FOX)), 0.4F);
|
|
||||||
this.addFeature(new ThighHighFoxHeldItemFeatureRenderer(this, context.getHeldItemRenderer()));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setupTransforms(CustomFoxEntity.ThighHighFoxEntity thighHighFoxEntity, MatrixStack matrixStack, float animationProgress, float bodyYaw, float tickDelta, float scale) {
|
|
||||||
super.setupTransforms(thighHighFoxEntity, matrixStack, animationProgress, bodyYaw, tickDelta, scale);
|
|
||||||
if (thighHighFoxEntity.isChasing() || thighHighFoxEntity.isWalking()) {
|
|
||||||
float i = -MathHelper.lerp(tickDelta, thighHighFoxEntity.prevPitch, thighHighFoxEntity.getPitch());
|
|
||||||
matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Identifier getTexture(CustomFoxEntity.ThighHighFoxEntity entity) {
|
|
||||||
if (entity.getVariant() == FoxEntity.Type.RED) {
|
|
||||||
return entity.isSleeping() ? SLEEPING_TEXTURE : TEXTURE;
|
|
||||||
} else {
|
|
||||||
return entity.isSleeping() ? SLEEPING_SNOW_TEXTURE : SNOW_TEXTURE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,7 @@
|
|||||||
package gay.pridecraft.joy.renderer.feature;
|
package gay.pridecraft.joy.renderer.feature;
|
||||||
|
|
||||||
import gay.pridecraft.joy.entity.custom.living.CustomFoxEntity;
|
import gay.pridecraft.joy.entity.custom.living.CustomFoxEntity;
|
||||||
import gay.pridecraft.joy.renderer.model.ThighHighFoxEntityModel;
|
import gay.pridecraft.joy.renderer.model.SockFoxEntityModel;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
@ -15,10 +15,10 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.util.math.RotationAxis;
|
import net.minecraft.util.math.RotationAxis;
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
public class ThighHighFoxHeldItemFeatureRenderer extends FeatureRenderer<CustomFoxEntity.ThighHighFoxEntity, ThighHighFoxEntityModel<CustomFoxEntity.ThighHighFoxEntity>> {
|
public class SockFoxHeldItemFeatureRenderer extends FeatureRenderer<CustomFoxEntity.SockFoxEntity, SockFoxEntityModel<CustomFoxEntity.SockFoxEntity>> {
|
||||||
private final HeldItemRenderer heldItemRenderer;
|
private final HeldItemRenderer heldItemRenderer;
|
||||||
|
|
||||||
public ThighHighFoxHeldItemFeatureRenderer(FeatureRendererContext<CustomFoxEntity.ThighHighFoxEntity, ThighHighFoxEntityModel<CustomFoxEntity.ThighHighFoxEntity>> context, HeldItemRenderer heldItemRenderer) {
|
public SockFoxHeldItemFeatureRenderer(FeatureRendererContext<CustomFoxEntity.SockFoxEntity, SockFoxEntityModel<CustomFoxEntity.SockFoxEntity>> context, HeldItemRenderer heldItemRenderer) {
|
||||||
super(context);
|
super(context);
|
||||||
this.heldItemRenderer = heldItemRenderer;
|
this.heldItemRenderer = heldItemRenderer;
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ public class ThighHighFoxHeldItemFeatureRenderer extends FeatureRenderer<CustomF
|
|||||||
MatrixStack matrixStack,
|
MatrixStack matrixStack,
|
||||||
VertexConsumerProvider vertexConsumerProvider,
|
VertexConsumerProvider vertexConsumerProvider,
|
||||||
int i,
|
int i,
|
||||||
CustomFoxEntity.ThighHighFoxEntity foxEntity,
|
CustomFoxEntity.SockFoxEntity foxEntity,
|
||||||
float f,
|
float f,
|
||||||
float g,
|
float g,
|
||||||
float h,
|
float h,
|
@ -9,7 +9,7 @@ import net.minecraft.client.render.entity.model.AnimalModel;
|
|||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
public class ThighHighFoxEntityModel<T extends CustomFoxEntity> extends AnimalModel<T> {
|
public class SockFoxEntityModel<T extends CustomFoxEntity> extends AnimalModel<T> {
|
||||||
public final ModelPart head;
|
public final ModelPart head;
|
||||||
private final ModelPart body;
|
private final ModelPart body;
|
||||||
private final ModelPart rightHindLeg;
|
private final ModelPart rightHindLeg;
|
||||||
@ -22,7 +22,7 @@ public class ThighHighFoxEntityModel<T extends CustomFoxEntity> extends AnimalMo
|
|||||||
private static final float LEG_Y_PIVOT = 17.5F;
|
private static final float LEG_Y_PIVOT = 17.5F;
|
||||||
private float legPitchModifier;
|
private float legPitchModifier;
|
||||||
|
|
||||||
public ThighHighFoxEntityModel(ModelPart root) {
|
public SockFoxEntityModel(ModelPart root) {
|
||||||
super(true, 8.0F, 3.35F);
|
super(true, 8.0F, 3.35F);
|
||||||
this.head = root.getChild("head");
|
this.head = root.getChild("head");
|
||||||
this.body = root.getChild("body");
|
this.body = root.getChild("body");
|
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 683 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Loading…
x
Reference in New Issue
Block a user