-
-
Save Vulcandium/16080983071c06515cf8512accbe4764 to your computer and use it in GitHub Desktop.
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
@Mod.EventBusSubscriber(modid = OceanicExpansion.MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) | |
public class ModEventBusClientEvents { | |
@SubscribeEvent | |
public static void registerLayer(EntityRenderersEvent.RegisterLayerDefinitions event){ | |
event.registerLayerDefinition(ModModelLayers.TIAMAT_LAYER, TiamatModel::createBodyLayer); | |
} | |
} |
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
@Mod.EventBusSubscriber(modid = OceanicExpansion.MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) | |
public class ModEventBusEvents { | |
@SubscribeEvent | |
public static void registerAttributes(EntityRenderersEvent.RegisterLayerDefinitions event){ | |
event.registerLayerDefinition(ModModelLayers.TIAMAT_LAYER, TiamatModel::createBodyLayer); | |
} | |
} |
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
public class ModModelLayers { | |
public static final ModelLayerLocation TIAMAT_LAYER = new ModelLayerLocation( | |
new ResourceLocation(OceanicExpansion.MODID,"tiamat_layer"),"main"); | |
} |
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
public class TiamatEntity extends Animal { | |
public TiamatEntity(EntityType<? extends Animal> pEntityType, Level pLevel) { | |
super(pEntityType, pLevel); | |
this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); | |
this.lookControl = new SmoothSwimmingLookControl(this, 10); | |
} | |
@Override | |
protected void registerGoals() { | |
this.goalSelector.addGoal(0,new RandomSwimmingGoal(this,10,1)); | |
this.goalSelector.addGoal(1,new BreedGoal(this,5)); | |
this.goalSelector.addGoal(2,new TemptGoal(this,5, Ingredient.of(Items.ENCHANTED_GOLDEN_APPLE),false)); | |
this.goalSelector.addGoal(3,new FollowParentGoal(this,6)); | |
this.goalSelector.addGoal(4,new LookAtPlayerGoal(this, Player.class,3f)); | |
} | |
public static AttributeSupplier.Builder setAttributes(){ | |
return Animal.createLivingAttributes() | |
.add(Attributes.MAX_HEALTH,1) | |
.add(Attributes.MOVEMENT_SPEED,0.2D) | |
.add(Attributes.ARMOR_TOUGHNESS,0.5D) | |
.add(Attributes.ATTACK_KNOCKBACK,0.2D) | |
.add(Attributes.KNOCKBACK_RESISTANCE,3D) | |
.add(Attributes.ATTACK_DAMAGE,5f); | |
} | |
@Nullable | |
@Override | |
public AgeableMob getBreedOffspring(ServerLevel pLevel, AgeableMob pOtherParent) { | |
return ModEntities.TIAMAT.get().create(pLevel); | |
} | |
@Override | |
public boolean isFood(ItemStack pStack) { | |
return pStack.is(Items.ENCHANTED_GOLDEN_APPLE); | |
} | |
} |
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
public class TiamatModel<T extends Entity> extends HierarchicalModel<T> { | |
// This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor | |
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation("modid", "unknown"), "main"); | |
private final ModelPart tiamat; | |
private final ModelPart head; | |
public TiamatModel(ModelPart root) { | |
this.tiamat = root.getChild("tiamat"); | |
this.head = tiamat.getChild("upperbody").getChild("head"); | |
} | |
public static LayerDefinition createBodyLayer() { | |
MeshDefinition meshdefinition = new MeshDefinition(); | |
PartDefinition partdefinition = meshdefinition.getRoot(); | |
PartDefinition tiamat = partdefinition.addOrReplaceChild("tiamat", CubeListBuilder.create(), PartPose.offset(0.0F, 21.0F, 0.0F)); | |
PartDefinition upperbody = tiamat.addOrReplaceChild("upperbody", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); | |
PartDefinition head = upperbody.addOrReplaceChild("head", CubeListBuilder.create().texOffs(25, 27).addBox(-2.0F, -2.0F, -1.0F, 4.0F, 4.0F, 7.0F, new CubeDeformation(0.0F)) | |
.texOffs(12, 36).addBox(-1.0F, -2.0F, 6.0F, 2.0F, 2.0F, 8.0F, new CubeDeformation(0.0F)) | |
.texOffs(18, 24).addBox(-1.0F, -1.0F, 13.0F, 2.0F, 2.0F, 0.0F, new CubeDeformation(0.0F)) | |
.texOffs(18, 24).addBox(-1.0F, -1.0F, 12.0F, 2.0F, 2.0F, 0.0F, new CubeDeformation(0.0F)) | |
.texOffs(18, 24).addBox(-1.0F, -1.0F, 11.0F, 2.0F, 2.0F, 0.0F, new CubeDeformation(0.0F)) | |
.texOffs(18, 24).addBox(-1.0F, -1.0F, 10.0F, 2.0F, 2.0F, 0.0F, new CubeDeformation(0.0F)) | |
.texOffs(18, 24).addBox(-1.0F, -1.0F, 9.0F, 2.0F, 2.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 8.0F)); | |
PartDefinition jaw = head.addOrReplaceChild("jaw", CubeListBuilder.create().texOffs(0, 34).addBox(-1.0F, -1.0F, 0.0F, 2.0F, 2.0F, 8.0F, new CubeDeformation(0.0F)) | |
.texOffs(18, 19).addBox(-1.0F, -2.0F, 7.0F, 2.0F, 2.0F, 0.0F, new CubeDeformation(0.0F)) | |
.texOffs(18, 19).addBox(-1.0F, -2.0F, 6.0F, 2.0F, 2.0F, 0.0F, new CubeDeformation(0.0F)) | |
.texOffs(18, 19).addBox(-1.0F, -2.0F, 5.0F, 2.0F, 2.0F, 0.0F, new CubeDeformation(0.0F)) | |
.texOffs(18, 19).addBox(-1.0F, -2.0F, 4.0F, 2.0F, 2.0F, 0.0F, new CubeDeformation(0.0F)) | |
.texOffs(18, 19).addBox(-1.0F, -2.0F, 3.0F, 2.0F, 2.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 1.0F, 6.0F)); | |
PartDefinition tongue = jaw.addOrReplaceChild("tongue", CubeListBuilder.create().texOffs(16, 2).addBox(-1.0F, 0.0F, -2.0F, 2.0F, 0.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -1.0F, 3.0F)); | |
PartDefinition body = upperbody.addOrReplaceChild("body", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -3.0F, -3.0F, 6.0F, 6.0F, 11.0F, new CubeDeformation(0.0F)), PartPose.offset(1.0F, 0.0F, 0.0F)); | |
PartDefinition fin1 = body.addOrReplaceChild("fin1", CubeListBuilder.create(), PartPose.offset(-5.0F, 3.0F, 1.0F)); | |
PartDefinition fin1_r1 = fin1.addOrReplaceChild("fin1_r1", CubeListBuilder.create().texOffs(0, 20).addBox(0.0293F, -1.1866F, -0.5985F, 1.0F, 6.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -2.0F, 0.0F, -0.8895F, 0.2054F, 0.2406F)); | |
PartDefinition fin2 = body.addOrReplaceChild("fin2", CubeListBuilder.create(), PartPose.offset(3.0F, 3.0F, 1.0F)); | |
PartDefinition fin2_r1 = fin2.addOrReplaceChild("fin2_r1", CubeListBuilder.create().texOffs(0, 0).addBox(-1.0293F, -1.1866F, -0.5985F, 1.0F, 6.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -2.0F, 0.0F, -0.8895F, -0.2054F, -0.2406F)); | |
PartDefinition lowerbody = tiamat.addOrReplaceChild("lowerbody", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 1.0F)); | |
PartDefinition midsegment = lowerbody.addOrReplaceChild("midsegment", CubeListBuilder.create().texOffs(22, 5).addBox(-2.0F, -2.0F, -15.0F, 4.0F, 4.0F, 12.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); | |
PartDefinition afin1 = midsegment.addOrReplaceChild("afin1", CubeListBuilder.create(), PartPose.offset(-3.0F, 2.0F, -11.0F)); | |
PartDefinition afin1_r1 = afin1.addOrReplaceChild("afin1_r1", CubeListBuilder.create().texOffs(12, 34).addBox(1.0F, -1.0F, -2.0F, 1.0F, 5.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-1.0F, 0.0F, 1.0F, -1.0908F, 0.0F, 0.0F)); | |
PartDefinition afin2 = midsegment.addOrReplaceChild("afin2", CubeListBuilder.create(), PartPose.offset(3.0F, 2.0F, -11.0F)); | |
PartDefinition afin2_r1 = afin2.addOrReplaceChild("afin2_r1", CubeListBuilder.create().texOffs(0, 34).addBox(-2.0F, -1.0F, -2.0F, 1.0F, 5.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(1.0F, 0.0F, 1.0F, -1.0908F, 0.0F, 0.0F)); | |
PartDefinition tail = lowerbody.addOrReplaceChild("tail", CubeListBuilder.create().texOffs(0, 17).addBox(-1.0F, -2.0F, -14.0F, 2.0F, 3.0F, 14.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, -15.0F)); | |
PartDefinition tailfluke = tail.addOrReplaceChild("tailfluke", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, -13.0F)); | |
PartDefinition tailfluke_r1 = tailfluke.addOrReplaceChild("tailfluke_r1", CubeListBuilder.create().texOffs(18, 8).addBox(0.0F, 5.5F, -0.4019F, 0.0F, 3.0F, 13.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, -12.0F, 0.5236F, 0.0F, 0.0F)); | |
PartDefinition tailfluke_r2 = tailfluke.addOrReplaceChild("tailfluke_r2", CubeListBuilder.create().texOffs(0, 11).addBox(0.0F, -7.0F, 2.0F, 0.0F, 3.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, -9.0F, -0.5236F, 0.0F, 0.0F)); | |
return LayerDefinition.create(meshdefinition, 64, 64); | |
} | |
@Override | |
public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { | |
} | |
@Override | |
public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { | |
tiamat.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); | |
} | |
@Override | |
public ModelPart root() { | |
return tiamat; | |
} |
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
public class TiamatRenderer extends MobRenderer<TiamatEntity,TiamatModel<TiamatEntity>> { | |
public TiamatRenderer(EntityRendererProvider.Context pContext) { | |
super(pContext, new TiamatModel<>((pContext.bakeLayer(ModModelLayers.TIAMAT_LAYER))), 2f); | |
} | |
@Override | |
public ResourceLocation getTextureLocation(TiamatEntity tiamatEntity) { | |
return new ResourceLocation(OceanicExpansion.MODID,"textures/entity/tiamat3.png"); | |
} | |
@Override | |
public void render(TiamatEntity pEntity, float pEntityYaw, float pPartialTicks, PoseStack pMatrixStack, MultiBufferSource pBuffer, int pPackedLight) { | |
pMatrixStack.scale(5f,5f,5f); | |
if(pEntity.isBaby()){ | |
pMatrixStack.scale(0.1f,0.1f,0.1f); | |
} | |
super.render(pEntity, pEntityYaw, pPartialTicks, pMatrixStack, pBuffer, pPackedLight); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment