-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: Marine Cannon, finished hats, EMI Support
- Loading branch information
1 parent
372365d
commit ddba1bf
Showing
63 changed files
with
1,281 additions
and
644 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
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
47 changes: 47 additions & 0 deletions
47
src/client/kotlin/cc/tweaked_programs/partnership/client/compat/emi/BoatyardEmiRecipe.kt
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,47 @@ | ||
package cc.tweaked_programs.partnership.client.compat.emi | ||
|
||
import cc.tweaked_programs.partnership.main.MOD_ID | ||
import cc.tweaked_programs.partnership.main.block.boatyard.BoatyardBlockEntity | ||
import cc.tweaked_programs.partnership.main.menu.inventory.GenericListenerSlot | ||
import cc.tweaked_programs.partnership.main.menu.inventory.GenericOutputOnlySlot | ||
import cc.tweaked_programs.partnership.main.recipe.BoatyardRecipe | ||
import dev.emi.emi.api.recipe.EmiRecipe | ||
import dev.emi.emi.api.recipe.EmiRecipeCategory | ||
import dev.emi.emi.api.render.EmiTexture | ||
import dev.emi.emi.api.stack.EmiIngredient | ||
import dev.emi.emi.api.stack.EmiStack | ||
import dev.emi.emi.api.widget.WidgetHolder | ||
import net.minecraft.core.RegistryAccess | ||
import net.minecraft.resources.ResourceLocation | ||
|
||
class BoatyardEmiRecipe(recipe: BoatyardRecipe) : EmiRecipe { | ||
|
||
private val input: MutableList<EmiIngredient> = recipe.getIngredientsAsItemStacks().map { EmiStack.of(it) }.toMutableList() | ||
private val output: MutableList<EmiStack> = mutableListOf(EmiStack.of(recipe.getResultItem(RegistryAccess.EMPTY))) | ||
|
||
override fun getCategory(): EmiRecipeCategory = PartnershipEmi.BOATYARD_CATEGORY | ||
|
||
override fun getId(): ResourceLocation = ResourceLocation(MOD_ID, "boatyard_construct_recipe") | ||
|
||
override fun getInputs() = input | ||
|
||
override fun getOutputs() = output | ||
|
||
override fun getDisplayWidth(): Int = 128 | ||
|
||
override fun getDisplayHeight(): Int = 58 | ||
|
||
override fun addWidgets(widgets: WidgetHolder) { | ||
val offset = 2 | ||
|
||
widgets.addTexture(EmiTexture.EMPTY_ARROW, 79, (getDisplayHeight()/2)-(EmiTexture.EMPTY_ARROW.height/2)-1) | ||
|
||
repeat (3) { column -> | ||
repeat (4) { row -> | ||
widgets.addSlot(inputs[row + column * 4], offset + row * 18, offset + column * 18) | ||
} | ||
} | ||
|
||
widgets.addSlot(output[0], getDisplayWidth()-18-offset, getDisplayHeight()/2-9) | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/client/kotlin/cc/tweaked_programs/partnership/client/compat/emi/PartnershipEmi.kt
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,31 @@ | ||
package cc.tweaked_programs.partnership.client.compat.emi | ||
|
||
import cc.tweaked_programs.partnership.main.MOD_ID | ||
import cc.tweaked_programs.partnership.main.recipe.BoatyardRecipe | ||
import cc.tweaked_programs.partnership.main.registries.ItemRegistries | ||
import dev.emi.emi.api.EmiPlugin | ||
import dev.emi.emi.api.EmiRegistry | ||
import dev.emi.emi.api.recipe.EmiRecipeCategory | ||
import dev.emi.emi.api.render.EmiTexture | ||
import dev.emi.emi.api.stack.EmiStack | ||
import net.minecraft.resources.ResourceLocation | ||
|
||
class PartnershipEmi : EmiPlugin { | ||
override fun register(registry: EmiRegistry) { | ||
registry.addCategory(BOATYARD_CATEGORY) | ||
|
||
registry.addWorkstation(BOATYARD_CATEGORY, BOATYARD_WORKSTATION) | ||
|
||
registry.recipeManager.getAllRecipesFor(BoatyardRecipe.Companion.Type.TYPE).forEach { | ||
registry.addRecipe(BoatyardEmiRecipe(it.value)) | ||
} | ||
} | ||
|
||
companion object { | ||
private val SPRITES = ResourceLocation(MOD_ID, "textures/gui/emi_simplified_containers.png") | ||
|
||
val BOATYARD_WORKSTATION: EmiStack = EmiStack.of(ItemRegistries.BOATYARD) | ||
val BOATYARD_CATEGORY = EmiRecipeCategory(ResourceLocation(MOD_ID, "boatyard"), BOATYARD_WORKSTATION, | ||
EmiTexture(SPRITES, 0, 0, 16, 16)) | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
src/client/kotlin/cc/tweaked_programs/partnership/client/model/hat/CaptainsHatModel.kt
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,54 @@ | ||
package cc.tweaked_programs.partnership.client.model.hat | ||
|
||
import cc.tweaked_programs.partnership.main.MOD_ID | ||
import com.mojang.blaze3d.vertex.PoseStack | ||
import com.mojang.blaze3d.vertex.VertexConsumer | ||
import net.minecraft.client.model.HumanoidModel | ||
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.CubeDeformation | ||
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.renderer.RenderType | ||
import net.minecraft.resources.ResourceLocation | ||
import net.minecraft.world.entity.LivingEntity | ||
import org.joml.Vector3f | ||
import java.util.function.Function | ||
|
||
|
||
class CaptainsHatModel(val root: ModelPart) : Model(Function { resourceLocation: ResourceLocation -> RenderType.entityTranslucent(resourceLocation) }) { | ||
|
||
override fun renderToBuffer(poseStack: PoseStack, vertexConsumer: VertexConsumer, packedLight: Int, | ||
packedOverlay: Int, red: Float, green: Float, blue: Float, alpha: Float) { | ||
|
||
root.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha) | ||
} | ||
|
||
fun setupAnim(humanoidModel: HumanoidModel<LivingEntity>) { | ||
root.setRotation(humanoidModel.hat.xRot, humanoidModel.hat.yRot, humanoidModel.hat.zRot) | ||
root.x = -0.65F | ||
root.y = 0.5F | ||
} | ||
|
||
companion object { | ||
val TEXTURE = ResourceLocation(MOD_ID, "textures/models/armor/captains_hat.png") | ||
|
||
fun createBodyLayer(): LayerDefinition { | ||
val meshdefinition = MeshDefinition() | ||
val partdefinition = meshdefinition.root | ||
|
||
val main = partdefinition.addOrReplaceChild( | ||
"main", | ||
CubeListBuilder.create().texOffs(0, 14).addBox(-4.0f, -1.0f, -5.0f, 9.0f, 1.0f, 9.0f, CubeDeformation(0.0f)) | ||
.texOffs(0, 24).addBox(-4.0f, 0.0f, -8.0f, 9.0f, 0.0f, 3.0f, CubeDeformation(0.0f)) | ||
.texOffs(20, 24).addBox(-3.0f, 0.0f, -9.0f, 7.0f, 0.0f, 1.0f, CubeDeformation(0.0f)) | ||
.texOffs(0, 0).addBox(-5.0f, -4.0f, -6.0f, 11.0f, 3.0f, 11.0f, CubeDeformation(0.0f)), | ||
PartPose.offset(0.0f, -7.0f, 0.0f) | ||
) | ||
|
||
return LayerDefinition.create(meshdefinition, 64, 64) | ||
} | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
src/client/kotlin/cc/tweaked_programs/partnership/client/model/hat/SailorsHatModel.kt
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,51 @@ | ||
package cc.tweaked_programs.partnership.client.model.hat | ||
|
||
import cc.tweaked_programs.partnership.main.MOD_ID | ||
import com.mojang.blaze3d.vertex.PoseStack | ||
import com.mojang.blaze3d.vertex.VertexConsumer | ||
import net.minecraft.client.model.HumanoidModel | ||
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.CubeDeformation | ||
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.renderer.RenderType | ||
import net.minecraft.resources.ResourceLocation | ||
import net.minecraft.world.entity.LivingEntity | ||
import java.util.function.Function | ||
|
||
|
||
class SailorsHatModel(val root: ModelPart) : Model(Function { resourceLocation: ResourceLocation -> RenderType.entityTranslucent(resourceLocation) }) { | ||
|
||
override fun renderToBuffer(poseStack: PoseStack, vertexConsumer: VertexConsumer, packedLight: Int, | ||
packedOverlay: Int, red: Float, green: Float, blue: Float, alpha: Float) { | ||
|
||
root.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha) | ||
} | ||
|
||
fun setupAnim(humanoidModel: HumanoidModel<LivingEntity>) { | ||
root.setRotation(humanoidModel.hat.xRot, humanoidModel.hat.yRot, humanoidModel.hat.zRot) | ||
root.x = -0.65F | ||
root.y = 0.5F | ||
} | ||
|
||
companion object { | ||
val TEXTURE = ResourceLocation(MOD_ID, "textures/models/armor/sailors_hat.png") | ||
|
||
fun createBodyLayer(): LayerDefinition { | ||
val meshdefinition = MeshDefinition() | ||
val partdefinition = meshdefinition.root | ||
|
||
val bb_main = partdefinition.addOrReplaceChild( | ||
"main", | ||
CubeListBuilder.create().texOffs(0, 0) | ||
.addBox(-3.0f, -3.0f, -3.0f, 6.0f, 3.0f, 6.0f, CubeDeformation(0.0f)), | ||
PartPose.offset(0.0f, -7.0f, 0.0f) | ||
) | ||
|
||
return LayerDefinition.create(meshdefinition, 32, 32) | ||
} | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
...otlin/cc/tweaked_programs/partnership/client/model/marine_cannon/MarineCannonLegsModel.kt
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,76 @@ | ||
package cc.tweaked_programs.partnership.client.model.marine_cannon | ||
|
||
import cc.tweaked_programs.partnership.main.MOD_ID | ||
import cc.tweaked_programs.partnership.main.block.cannon.MarineCannonBlockEntity | ||
import com.mojang.blaze3d.vertex.PoseStack | ||
import com.mojang.blaze3d.vertex.VertexConsumer | ||
import net.minecraft.client.model.Model | ||
import net.minecraft.client.model.geom.ModelLayerLocation | ||
import net.minecraft.client.model.geom.ModelPart | ||
import net.minecraft.client.model.geom.PartPose | ||
import net.minecraft.client.model.geom.builders.CubeDeformation | ||
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.renderer.RenderType | ||
import net.minecraft.core.Direction | ||
import net.minecraft.resources.ResourceLocation | ||
import net.minecraft.world.level.block.state.properties.BlockStateProperties | ||
import java.util.function.Function | ||
import kotlin.math.PI | ||
|
||
|
||
class MarineCannonLegsModel(root: ModelPart) : | ||
Model(Function { resourceLocation: ResourceLocation -> RenderType.entityTranslucent(resourceLocation) }) { | ||
|
||
private val root: ModelPart = root.getChild("root") | ||
|
||
fun setupAnim(entity: MarineCannonBlockEntity, partialTicks: Float) { | ||
root.setRotation(0F, (when (entity.state.getValue(BlockStateProperties.HORIZONTAL_FACING)) { | ||
Direction.NORTH -> 0F | ||
Direction.EAST -> 270F | ||
Direction.SOUTH -> 180F | ||
Direction.WEST -> 90F | ||
else -> 0F | ||
} + entity.getXRot()) * MAGIKK, 0F) | ||
} | ||
|
||
override fun renderToBuffer(poseStack: PoseStack, vertexConsumer: VertexConsumer, packedLight:Int, | ||
packedOverlay: Int, red: Float, green: Float, blue: Float, alpha: Float) { | ||
|
||
root.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha) | ||
} | ||
|
||
companion object { | ||
val LAYER_LOCATION: ModelLayerLocation = ModelLayerLocation(ResourceLocation(MOD_ID, "marine_cannon"), "main") | ||
|
||
val TEXTURE = ResourceLocation(MOD_ID, "textures/entity/marine_cannon/legs.png") | ||
|
||
private const val MAGIKK: Float = (PI.toFloat() / 180f) | ||
|
||
fun createBodyLayer(): LayerDefinition { | ||
val meshDefinition = MeshDefinition() | ||
val partDefinition = meshDefinition.root | ||
|
||
val root = partDefinition.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0f, 23.0f, 0.0f)) | ||
|
||
/*val cube_r1 = */root.addOrReplaceChild( | ||
"cube_r1", | ||
CubeListBuilder.create().texOffs(0, 0) | ||
.addBox(3.0f, -6.2866f, -4.6194f, 2.0f, 8.2f, 2.0f, CubeDeformation(0.0f)) | ||
.texOffs(0, 0).addBox(-5.0f, -6.2866f, -4.6194f, 2.0f, 8.2f, 2.0f, CubeDeformation(0.0f)), | ||
PartPose.offsetAndRotation(0.0f, 0.0f, 0.0f, -0.3927f, 0.0f, 0.0f) | ||
) | ||
|
||
/*val cube_r2 = */root.addOrReplaceChild( | ||
"cube_r2", | ||
CubeListBuilder.create().texOffs(0, 0) | ||
.addBox(3.0f, -6.2866f, 2.6194f, 2.0f, 8.2f, 2.0f, CubeDeformation(0.0f)) | ||
.texOffs(0, 0).addBox(-5.0f, -6.2866f, 2.6194f, 2.0f, 8.2f, 2.0f, CubeDeformation(0.0f)), | ||
PartPose.offsetAndRotation(0.0f, 0.0f, 0.0f, 0.3927f, 0.0f, 0.0f) | ||
) | ||
|
||
return LayerDefinition.create(meshDefinition, 16, 16) | ||
} | ||
} | ||
} |
Oops, something went wrong.