Skip to content

Commit

Permalink
Added StationEntity and tweaked rocket engine texture location
Browse files Browse the repository at this point in the history
  • Loading branch information
JunePrimavera committed Aug 31, 2023
1 parent 57d024f commit 9ce9c8b
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public RocketEntityRenderer(EntityRendererFactory.Context context) {

@Override
public Identifier getTexture(RocketEntity entity) {
return new Identifier("entitytesting", "textures/entity/cube/cube.png");
return new Identifier("propulsive", "textures/spacecraft/rocket.png");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ public boolean isOnGround() { // it's on the ground I swear!
return true;
}



@Override
public boolean isTame() {
return true;
Expand Down
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);
}
}
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);
});
}

}
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");
}
}

0 comments on commit 9ce9c8b

Please sign in to comment.