-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added StationEntity and tweaked rocket engine texture location
- Loading branch information
1 parent
57d024f
commit 9ce9c8b
Showing
5 changed files
with
69 additions
and
4 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
12 changes: 11 additions & 1 deletion
12
src/main/java/io/github/teampropulsive/space/station/StationEntity.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,4 +1,14 @@ | ||
package io.github.teampropulsive.space.station; | ||
|
||
public class StationEntity { | ||
import io.github.teampropulsive.space.spacecraft.SpacecraftEntity; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.passive.AbstractHorseEntity; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.world.World; | ||
|
||
public class StationEntity extends SpacecraftEntity { | ||
public Identifier variation; | ||
protected StationEntity(EntityType<? extends AbstractHorseEntity> entityType, World world) { | ||
super(entityType, world); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/io/github/teampropulsive/space/station/StationEntityModel.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,37 @@ | ||
package io.github.teampropulsive.space.station; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import io.github.teampropulsive.space.rocket.RocketEntity; | ||
import io.github.teampropulsive.space.station.StationEntity; | ||
import net.minecraft.client.model.*; | ||
import net.minecraft.client.render.VertexConsumer; | ||
import net.minecraft.client.render.entity.model.EntityModel; | ||
import net.minecraft.client.render.entity.model.EntityModelPartNames; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
|
||
public class StationEntityModel extends EntityModel<StationEntity> { | ||
|
||
private final ModelPart base; | ||
|
||
public StationEntityModel(ModelPart modelPart) { | ||
this.base = modelPart.getChild(EntityModelPartNames.CUBE); | ||
} | ||
|
||
public static TexturedModelData getTexturedModelData() { | ||
ModelData modelData = new ModelData(); | ||
ModelPartData modelPartData = modelData.getRoot(); | ||
modelPartData.addChild(EntityModelPartNames.CUBE, ModelPartBuilder.create().uv(0, 0).cuboid(-6F, 12F, -6F, 12F, 12F, 12F), ModelTransform.pivot(0F, 0F, 0F)); | ||
return TexturedModelData.of(modelData, 64, 64); | ||
} | ||
@Override | ||
public void setAngles(StationEntity entity, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch) { | ||
} | ||
|
||
@Override | ||
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) { | ||
ImmutableList.of(this.base).forEach((modelRenderer) -> { | ||
modelRenderer.render(matrices, vertices, light, overlay, red, green, blue, alpha); | ||
}); | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/io/github/teampropulsive/space/station/StationEntityRenderer.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,20 @@ | ||
package io.github.teampropulsive.space.station; | ||
|
||
import io.github.teampropulsive.PropulsiveClient; | ||
import io.github.teampropulsive.space.rocket.RocketEntity; | ||
import io.github.teampropulsive.space.rocket.RocketEntityModel; | ||
import net.minecraft.client.render.entity.EntityRendererFactory; | ||
import net.minecraft.client.render.entity.MobEntityRenderer; | ||
import net.minecraft.util.Identifier; | ||
|
||
public class StationEntityRenderer extends MobEntityRenderer<StationEntity, StationEntityModel> { | ||
|
||
public StationEntityRenderer(EntityRendererFactory.Context context) { | ||
super(context, new StationEntityModel(context.getPart(PropulsiveClient.MODEL_CUBE_LAYER)), 0.5f); | ||
} | ||
|
||
@Override | ||
public Identifier getTexture(StationEntity entity) { | ||
return new Identifier("propulsive", "textures/spacecraft/"+entity.variation.getPath()+"/texture.png"); | ||
} | ||
} |