Skip to content

Commit

Permalink
Add bamboo rafts
Browse files Browse the repository at this point in the history
Updated raft item texture to be programmer art-styled
  • Loading branch information
Roadhog360 committed May 23, 2024
1 parent 2c78e6e commit a3d0e01
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 65 deletions.
4 changes: 2 additions & 2 deletions src/main/java/ganymedes01/etfuturum/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public enum ModItems {
MANGROVE_CHEST_BOAT(ConfigBlocksItems.enableNewBoats && ConfigExperiments.enableMangroveBlocks, new ItemNewBoat("minecraft", "mangrove", ModBlocks.WOOD_PLANKS::getItem, 2, true, false)),
CHERRY_BOAT(ConfigBlocksItems.enableNewBoats && ConfigBlocksItems.enableCherryBlocks, new ItemNewBoat("minecraft", "cherry", ModBlocks.WOOD_PLANKS::getItem, 3, false, false)),
CHERRY_CHEST_BOAT(ConfigBlocksItems.enableNewBoats && ConfigBlocksItems.enableCherryBlocks, new ItemNewBoat("minecraft", "cherry", ModBlocks.WOOD_PLANKS::getItem, 3, true, false)),
// BAMBOO_RAFT(ConfigBlocksItems.enableNewBoats, new ItemNewBoat("minecraft", "bamboo", ModBlocks.WOOD_PLANKS::getItem, 4, false, true)),
// BAMBOO_CHEST_RAFT(ConfigBlocksItems.enableNewBoats, new ItemNewBoat("minecraft", "bamboo", ModBlocks.WOOD_PLANKS::getItem, 4, true, true)),
BAMBOO_RAFT(ConfigBlocksItems.enableNewBoats, new ItemNewBoat("minecraft", "bamboo", ModBlocks.WOOD_PLANKS::getItem, 4, false, true)),
BAMBOO_CHEST_RAFT(ConfigBlocksItems.enableNewBoats, new ItemNewBoat("minecraft", "bamboo", ModBlocks.WOOD_PLANKS::getItem, 4, true, true)),

//legacy sign items -- new signs use their ItemBlock as the sign item instead
ITEM_SIGN_SPRUCE(ConfigBlocksItems.enableSigns, new ItemWoodSign((BlockWoodSign) ModBlocks.SIGN_SPRUCE.get())),
Expand Down
16 changes: 13 additions & 3 deletions src/main/java/ganymedes01/etfuturum/client/model/ModelNewBoat.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,25 @@
import org.lwjgl.opengl.GL11;

public class ModelNewBoat extends ModelBase {
public ModelRenderer[] boatSides = new ModelRenderer[5];
public ModelRenderer[] paddles = new ModelRenderer[2];
public final ModelRenderer[] boatSides;
public final ModelRenderer[] paddles;

/**
* Part of the model rendered to make it seem like there's no water in the boat
*/
public ModelRenderer noWater;

public ModelNewBoat() {
this(new ModelRenderer[5], new ModelRenderer[2]);
}

public ModelNewBoat(ModelRenderer[] boatSides, ModelRenderer[] paddles) {
this.boatSides = boatSides;
this.paddles = paddles;
setupModel();
}

protected void setupModel() {
this.boatSides[0] = (new ModelRenderer(this, 0, 0)).setTextureSize(128, 64);
this.boatSides[1] = (new ModelRenderer(this, 0, 19)).setTextureSize(128, 64);
this.boatSides[2] = (new ModelRenderer(this, 0, 27)).setTextureSize(128, 64);
Expand Down Expand Up @@ -62,7 +72,7 @@ public void render(Entity entityIn, float limbSwing, float limbSwingAmount, floa
EntityNewBoat entityboat = (EntityNewBoat) entityIn;
this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn);

for (int i = 0; i < 5; ++i) {
for (int i = 0; i < boatSides.length; ++i) {
this.boatSides[i].render(scale);
}

Expand Down
95 changes: 42 additions & 53 deletions src/main/java/ganymedes01/etfuturum/client/model/ModelRaft.java
Original file line number Diff line number Diff line change
@@ -1,57 +1,46 @@
package ganymedes01.etfuturum.client.model;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class ModelRaft extends ModelBase {
// private final ModelRenderer leftPaddle;
// private final ModelRenderer rightPaddle;
// private final ImmutableList<ModelRenderer> parts;
//
// public RaftModel() {
// this.leftPaddle = p_251383_.getChild("left_paddle");
// this.rightPaddle = p_251383_.getChild("right_paddle");
// this.parts = this.createPartsBuilder(p_251383_).build();
// }
//
// protected ImmutableList.Builder<ModelPart> createPartsBuilder(ModelRenderer p_250773_) {
// ImmutableList.Builder<ModelPart> builder = new ImmutableList.Builder<>();
// builder.add(p_250773_.getChild("bottom"), this.leftPaddle, this.rightPaddle);
// return builder;
// }
//
// public static void createChildren(PartDefinition p_250262_) {
// p_250262_.addOrReplaceChild("bottom", CubeListBuilder.create().texOffs(0, 0).addBox(-14.0F, -11.0F, -4.0F, 28.0F, 20.0F, 4.0F).texOffs(0, 0).addBox(-14.0F, -9.0F, -8.0F, 28.0F, 16.0F, 4.0F), PartPose.offsetAndRotation(0.0F, -2.0F, 1.0F, 1.5708F, 0.0F, 0.0F));
// int i = 20;
// int j = 7;
// int k = 6;
// float f = -5.0F;
// p_250262_.addOrReplaceChild("left_paddle", CubeListBuilder.create().texOffs(0, 24).addBox(-1.0F, 0.0F, -5.0F, 2.0F, 2.0F, 18.0F).addBox(-1.001F, -3.0F, 8.0F, 1.0F, 6.0F, 7.0F), PartPose.offsetAndRotation(3.0F, -4.0F, 9.0F, 0.0F, 0.0F, 0.19634955F));
// p_250262_.addOrReplaceChild("right_paddle", CubeListBuilder.create().texOffs(40, 24).addBox(-1.0F, 0.0F, -5.0F, 2.0F, 2.0F, 18.0F).addBox(0.001F, -3.0F, 8.0F, 1.0F, 6.0F, 7.0F), PartPose.offsetAndRotation(3.0F, -4.0F, -9.0F, 0.0F, (float)Math.PI, 0.19634955F));
// }
//
// public static LayerDefinition createBodyModel() {
// MeshDefinition meshdefinition = new MeshDefinition();
// PartDefinition partdefinition = meshdefinition.getRoot();
// createChildren(partdefinition);
// return LayerDefinition.create(meshdefinition, 128, 64);
// }
//
// public void setupAnim(Boat p_249733_, float p_249202_, float p_252219_, float p_249366_, float p_249759_, float p_250286_) {
// animatePaddle(p_249733_, 0, this.leftPaddle, p_249202_);
// animatePaddle(p_249733_, 1, this.rightPaddle, p_249202_);
// }
//
// public ImmutableList<ModelPart> parts() {
// return this.parts;
// }
//
// public void renderPaddle(EntityNewBoat boat, int paddle, float scale, float limbSwing) {
// float f = p_250792_.getRowingTime(p_249947_, p_251990_);
// p_248943_.xRot = Math.clampedLerp((-(float)Math.PI / 3F), -0.2617994F, (Math.sin(-f) + 1.0F) / 2.0F);
// p_248943_.yRot = Math.clampedLerp((-(float)Math.PI / 4F), ((float)Math.PI / 4F), (Math.sin(-f + 1.0F) + 1.0F) / 2.0F);
// if (p_249947_ == 1) {
// p_248943_.yRot = (float)Math.PI - p_248943_.yRot;
// }
//
// }
public class ModelRaft extends ModelNewBoat {
public ModelRaft() {
super(new ModelRenderer[2], new ModelRenderer[2]);
}

@Override
protected void setupModel() {
this.boatSides[0] = (new ModelRenderer(this, 0, 0)).setTextureSize(128, 64);
this.boatSides[1] = (new ModelRenderer(this, 0, 0)).setTextureSize(128, 64);

this.boatSides[0].addBox(-14.0F, -11.0F, -4.0F, 28, 20, 4)
.setRotationPoint(1.5708F, 0.0F, 0.0F);
this.boatSides[1].addBox(-14.0F, -9.0F, -8.0F, 28, 16, 4)
.setRotationPoint(1.5708F, 0.0F, 0.0F);
boatSides[0].rotateAngleX = ((float) Math.PI / 2F);
boatSides[0].offsetX = -0.09375F;
boatSides[0].offsetY = -0.125F;
boatSides[0].offsetZ = 0.09375F;
boatSides[1].rotateAngleX = ((float) Math.PI / 2F);
boatSides[1].offsetX = -0.09375F;
boatSides[1].offsetY = -0.125F;
boatSides[1].offsetZ = 0.09375F;
this.paddles[0] = this.makePaddle(true);
this.paddles[0].setRotationPoint(3.0F, -4.0F, 9.0F);
this.paddles[1] = this.makePaddle(false);
this.paddles[1].setRotationPoint(3.0F, -4.0F, 9.0F);
this.paddles[1].rotateAngleY = (float) Math.PI;
this.paddles[0].rotateAngleZ = this.paddles[1].rotateAngleZ = 0.19634955F;
paddles[1].offsetZ = -1.0625F;
}

public void renderMultipass(Entity p_187054_1_, float p_187054_2_, float p_187054_3_, float p_187054_4_, float p_187054_5_, float p_187054_6_, float scale) {
}

ModelRenderer makePaddle(boolean p_187056_1_) {
ModelRenderer modelrenderer = (new ModelRenderer(this, p_187056_1_ ? 0 : 40, 24)).setTextureSize(128, 64);
modelrenderer.addBox(-1.0F, 0.0F, -5.0F, 2, 2, 18);
modelrenderer.addBox(p_187056_1_ ? -1.001F : 0.01F, -3.0F, 8.0F, 1, 6, 7);
return modelrenderer;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ protected void renderExtraBoatContents(EntityNewBoat boat, float partialTicks) {
if (boat instanceof EntityNewBoatWithChest) {
GL11.glRotatef(180f, 0f, 1f, 0f);
GL11.glScalef(0.8f, 0.8f, 0.8f);
GL11.glTranslatef(-0.5f, ((EntityNewBoatWithChest) boat).getChestHeight(), -1.1f);
GL11.glTranslatef(
((EntityNewBoatWithChest) boat).getChestXOffset(),
((EntityNewBoatWithChest) boat).getChestHeight(),
((EntityNewBoatWithChest) boat).getChestZOffset());
TileEntityRendererDispatcher.instance.renderTileEntityAt(chest, 0, 0, 0, partialTicks);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ public boolean canBePushed() {
* Returns the Y offset from the entity's position for any entity riding this one.
*/
public double getMountedYOffset() {
return 0;
// return -0.1D;
return isRaft() ? 0.3D : 0;
}

public double getYOffset() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,18 @@ public boolean interactFirst(EntityPlayer p_130002_1_) {

@Override
protected float getDefaultRiderOffset() {
return -0.2f;
return 0.2f;
}

public float getChestHeight() {
return -0.2f;
return isRaft() ? 0.15625f : -0.2f;
}

public float getChestXOffset() {
return isRaft() ? -0.46875f : -0.5f;
}

public float getChestZOffset() {
return isRaft() ? -1.15f : -1.1f;
}
}
5 changes: 3 additions & 2 deletions src/main/resources/assets/etfuturum/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -338,19 +338,20 @@ item.etfuturum.raw_copper.name=Raw Copper
item.etfuturum.raw_iron.name=Raw Iron
item.etfuturum.raw_gold.name=Raw Gold
item.etfuturum.oak_boat.name=Oak Boat
item.etfuturum.cherry_boat.name=Cherry Boat
item.etfuturum.spruce_boat.name=Spruce Boat
item.etfuturum.birch_boat.name=Birch Boat
item.etfuturum.jungle_boat.name=Jungle Boat
item.etfuturum.dark_oak_boat.name=Dark Oak Boat
item.etfuturum.acacia_boat.name=Acacia Boat
item.etfuturum.cherry_boat.name=Cherry Boat
item.etfuturum.bamboo_raft.name=Bamboo Boat
item.etfuturum.oak_chest_boat.name=Oak Boat with Chest
item.etfuturum.cherry_chest_boat.name=Cherry Boat with Chest
item.etfuturum.spruce_chest_boat.name=Spruce Boat with Chest
item.etfuturum.birch_chest_boat.name=Birch Boat with Chest
item.etfuturum.jungle_chest_boat.name=Jungle Boat with Chest
item.etfuturum.dark_oak_chest_boat.name=Dark Oak Boat with Chest
item.etfuturum.acacia_chest_boat.name=Acacia Boat with Chest
item.etfuturum.bamboo_chest_raft.name=Bamboo Raft with Chest
item.etfuturum.shulker_shell.name=Shulker Shell
item.etfuturum.amethyst_shard.name=Amethyst Shard
item.etfuturum.honeycomb.name=Honeycomb
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a3d0e01

Please sign in to comment.