-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
src/main/java/com/sekwah/narutomod/client/model/entity/SubstitutionLogModel.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,58 @@ | ||
package com.sekwah.narutomod.client.model.entity; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import com.mojang.blaze3d.vertex.VertexConsumer; | ||
import net.minecraft.client.model.Model; | ||
import net.minecraft.client.model.geom.ModelPart; | ||
import net.minecraft.client.model.geom.PartPose; | ||
import net.minecraft.client.model.geom.builders.CubeListBuilder; | ||
import net.minecraft.client.model.geom.builders.LayerDefinition; | ||
import net.minecraft.client.model.geom.builders.MeshDefinition; | ||
import net.minecraft.client.model.geom.builders.PartDefinition; | ||
import net.minecraft.client.renderer.RenderType; | ||
|
||
public class SubstitutionLogModel extends Model { | ||
|
||
private final ModelPart main; | ||
|
||
public SubstitutionLogModel(ModelPart modelPart) | ||
{ | ||
super(RenderType::entitySolid); | ||
this.main = modelPart.getChild("main"); | ||
} | ||
|
||
|
||
public static LayerDefinition createLayer() { | ||
|
||
MeshDefinition meshdefinition = new MeshDefinition(); | ||
PartDefinition partdefinition = meshdefinition.getRoot(); | ||
|
||
PartDefinition main = partdefinition.addOrReplaceChild("main", | ||
CubeListBuilder.create() | ||
.mirror(true) | ||
.texOffs(0, 0) | ||
.addBox(-2F, 0F, -2F, 4, 8, 4) | ||
, PartPose.offsetAndRotation(0F, 0F, 0F, (float) Math.PI, 0F, 0F)); | ||
|
||
main.addOrReplaceChild("Shape2", | ||
CubeListBuilder.create() | ||
.mirror(true) | ||
.texOffs(16, 0) | ||
.addBox(-0.2666667F, 2F, -1.866667F, 4, 1, 1) | ||
, PartPose.offsetAndRotation(0F, 0F, 0F, 0.4461433F, 0F, 0F)); | ||
|
||
main.addOrReplaceChild("Shape3", | ||
CubeListBuilder.create() | ||
.mirror(true) | ||
.texOffs(26, 0) | ||
.addBox(2.066667F, 1.733333F, 0F, 2, 2, 0) | ||
, PartPose.offsetAndRotation(0F, 0F, 0F, 0F, 0F, -0.3717861F)); | ||
|
||
return LayerDefinition.create(meshdefinition, 64, 64); | ||
} | ||
|
||
@Override | ||
public void renderToBuffer(PoseStack matrixStack, VertexConsumer vertexConsumer, int p_225598_3_, int p_225598_4_, float p_225598_5_, float p_225598_6_, float p_225598_7_, float p_225598_8_) { | ||
this.main.render(matrixStack, vertexConsumer, p_225598_3_, p_225598_4_, p_225598_5_, p_225598_6_, p_225598_7_, p_225598_8_); | ||
} | ||
} |
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
46 changes: 46 additions & 0 deletions
46
src/main/java/com/sekwah/narutomod/client/renderer/entity/SubstitutionLogRenderer.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,46 @@ | ||
package com.sekwah.narutomod.client.renderer.entity; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import com.mojang.blaze3d.vertex.VertexConsumer; | ||
import com.mojang.math.Vector3f; | ||
import com.sekwah.narutomod.client.model.entity.SubstitutionLogModel; | ||
import com.sekwah.narutomod.client.model.jutsu.FireballJutsuModel; | ||
import com.sekwah.narutomod.client.renderer.NarutoRenderEvents; | ||
import com.sekwah.narutomod.entity.SubstitutionLogEntity; | ||
import com.sekwah.narutomod.entity.jutsuprojectile.FireballJutsuEntity; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.client.renderer.RenderType; | ||
import net.minecraft.client.renderer.entity.EntityRenderer; | ||
import net.minecraft.client.renderer.entity.EntityRendererProvider; | ||
import net.minecraft.client.renderer.texture.OverlayTexture; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.resources.ResourceLocation; | ||
|
||
|
||
public class SubstitutionLogRenderer extends EntityRenderer<SubstitutionLogEntity> { | ||
public static final ResourceLocation SUBSTITUTION_LOG = new ResourceLocation("narutomod", "textures/entity/jutsu/substitution.png"); | ||
private static final RenderType RENDER_TYPE = RenderType.entitySolid(SUBSTITUTION_LOG); | ||
private final SubstitutionLogModel model; | ||
|
||
public SubstitutionLogRenderer(EntityRendererProvider.Context manager) { | ||
super(manager); | ||
this.model = new SubstitutionLogModel(manager.bakeLayer(NarutoRenderEvents.SUBSTITUTION_LOG_LAYER)); | ||
} | ||
|
||
@Override | ||
public void render(SubstitutionLogEntity substitutionLogEntity, float p_114486_, float partial, PoseStack poseStack, MultiBufferSource multiBufferSource, int p_114490_) { | ||
VertexConsumer vertexconsumer = multiBufferSource.getBuffer(RENDER_TYPE); | ||
poseStack.pushPose(); | ||
poseStack.translate(0,substitutionLogEntity.getBbHeight() / 2f,0); | ||
|
||
this.model.renderToBuffer(poseStack, vertexconsumer, p_114490_, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); | ||
poseStack.popPose(); | ||
super.render(substitutionLogEntity, p_114486_, partial, poseStack, multiBufferSource, p_114490_); | ||
} | ||
|
||
@Override | ||
public ResourceLocation getTextureLocation(SubstitutionLogEntity p_114482_) { | ||
return SUBSTITUTION_LOG; | ||
} | ||
|
||
} |
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
24 changes: 24 additions & 0 deletions
24
src/main/java/com/sekwah/narutomod/entity/SubstitutionLogEntity.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,24 @@ | ||
package com.sekwah.narutomod.entity; | ||
|
||
import net.minecraft.network.protocol.Packet; | ||
import net.minecraft.world.entity.EntityType; | ||
import net.minecraft.world.entity.Mob; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraftforge.network.NetworkHooks; | ||
|
||
public class SubstitutionLogEntity extends Mob { | ||
|
||
protected SubstitutionLogEntity(EntityType<? extends Mob> p_21368_, Level p_21369_) { | ||
super(p_21368_, p_21369_); | ||
} | ||
|
||
@Override | ||
protected void defineSynchedData() { | ||
|
||
} | ||
|
||
@Override | ||
public Packet<?> getAddEntityPacket() { | ||
return NetworkHooks.getEntitySpawningPacket(this); | ||
} | ||
} |
Binary file added
BIN
+48.1 KB
src/main/resources/assets/narutomod/textures/entity/jutsu/substitution.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.