Skip to content

Commit 67aaa11

Browse files
committed
Not even labeling these right now. Just that much conversion.
1 parent 3c1010f commit 67aaa11

File tree

73 files changed

+2536
-2327
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2536
-2327
lines changed

common/src/main/java/generations/gg/generations/core/generationscore/common/api/events/CurryEvents.java

Lines changed: 0 additions & 95 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package generations.gg.generations.core.generationscore.common.api.events
2+
3+
import com.cobblemon.mod.common.api.berry.Berry
4+
import dev.architectury.event.Event
5+
import dev.architectury.event.EventActor
6+
import dev.architectury.event.EventFactory
7+
import generations.gg.generations.core.generationscore.common.api.player.CurryDex.CurryDexEntry
8+
import generations.gg.generations.core.generationscore.common.world.item.curry.CurryData
9+
import generations.gg.generations.core.generationscore.common.world.item.curry.CurryTasteRating
10+
import generations.gg.generations.core.generationscore.common.world.item.curry.CurryType
11+
import net.minecraft.server.level.ServerPlayer
12+
import java.util.function.Function
13+
14+
object CurryEvents {
15+
val COOK: Event<EventActor<Cook>> = EventFactory.createEventActorLoop()
16+
17+
val MODIFY_RATING: Event<ModifyRating> = EventFactory.of(
18+
{ eventActors: List<ModifyRating> ->
19+
return@of ModifyRating { original: CurryTasteRating, player: ServerPlayer, data: CurryData ->
20+
var rating: CurryTasteRating? = null
21+
for (actor in eventActors) {
22+
rating = actor.modifyRating(original, player, data)
23+
}
24+
rating ?: original
25+
}
26+
})
27+
28+
val ADD_ENTRY: Event<EventActor<AddEntry>> = EventFactory.createEventActorLoop()
29+
30+
class Cook(val mainIngredient: CurryType, val berries: List<Berry>, var output: CurryData)
31+
32+
class AddEntry(val player: ServerPlayer, val curry: CurryData, var entry: CurryDexEntry)
33+
34+
fun interface ModifyRating {
35+
fun modifyRating(original: CurryTasteRating, player: ServerPlayer, data: CurryData): CurryTasteRating?
36+
}
37+
}

common/src/main/java/generations/gg/generations/core/generationscore/common/client/render/block/entity/GenericChestRenderer.java

Lines changed: 0 additions & 101 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
package generations.gg.generations.core.generationscore.common.client.render.block.entity
2+
3+
import com.mojang.blaze3d.vertex.PoseStack
4+
import com.mojang.blaze3d.vertex.VertexConsumer
5+
import com.mojang.math.Axis
6+
import generations.gg.generations.core.generationscore.common.GenerationsCore
7+
import generations.gg.generations.core.generationscore.common.client.render.rarecandy.instanceOrNull
8+
import generations.gg.generations.core.generationscore.common.world.level.block.GenerationsBlocks
9+
import generations.gg.generations.core.generationscore.common.world.level.block.entities.generic.GenericChestBlockEntity
10+
import generations.gg.generations.core.generationscore.common.world.level.block.generic.GenericChestBlock
11+
import net.minecraft.Util
12+
import net.minecraft.client.model.geom.ModelLayers
13+
import net.minecraft.client.model.geom.ModelPart
14+
import net.minecraft.client.renderer.MultiBufferSource
15+
import net.minecraft.client.renderer.RenderType
16+
import net.minecraft.client.renderer.Sheets
17+
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer
18+
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider
19+
import net.minecraft.client.resources.model.Material
20+
import net.minecraft.core.Direction
21+
import net.minecraft.resources.ResourceLocation
22+
import net.minecraft.world.level.block.ChestBlock
23+
import java.util.function.Consumer
24+
25+
class GenericChestRenderer(arg: BlockEntityRendererProvider.Context) :
26+
BlockEntityRenderer<GenericChestBlockEntity> {
27+
private val lid: ModelPart
28+
private val bottom: ModelPart
29+
private val lock: ModelPart
30+
31+
override fun render(
32+
blockEntity: GenericChestBlockEntity,
33+
partialTick: Float,
34+
poseStack: PoseStack,
35+
bufferSource: MultiBufferSource,
36+
packedLight: Int,
37+
packedOverlay: Int
38+
) {
39+
val level = blockEntity.level
40+
val flag = level != null
41+
val blockstate =
42+
if (flag) blockEntity.blockState else GenerationsBlocks.POKEBALL_CHEST.get().defaultBlockState().setValue(
43+
ChestBlock.FACING, Direction.SOUTH
44+
)
45+
46+
poseStack.pushPose()
47+
val f = blockstate.getValue(ChestBlock.FACING).toYRot()
48+
poseStack.translate(0.5, 0.5, 0.5)
49+
poseStack.mulPose(Axis.YP.rotationDegrees(-f))
50+
poseStack.translate(-0.5, -0.5, -0.5)
51+
52+
var f1 = blockEntity.getOpenNess(partialTick)
53+
f1 = 1.0f - f1
54+
f1 = 1.0f - f1 * f1 * f1
55+
val material = getMaterial(blockEntity)
56+
val vertexconsumer = material.buffer(bufferSource) { location -> RenderType.entityCutout(location) }
57+
this.render(poseStack, vertexconsumer, this.lid, this.lock, this.bottom, f1, packedLight, packedOverlay)
58+
poseStack.popPose()
59+
}
60+
61+
private fun render(
62+
poseStack: PoseStack,
63+
consumer: VertexConsumer,
64+
lidPart: ModelPart,
65+
lockPart: ModelPart,
66+
bottomPart: ModelPart,
67+
lidAngle: Float,
68+
packedLight: Int,
69+
packedOverlay: Int
70+
) {
71+
lidPart.xRot = -(lidAngle * ((Math.PI / 2).toFloat()))
72+
lockPart.xRot = lidPart.xRot
73+
lidPart.render(poseStack, consumer, packedLight, packedOverlay)
74+
lockPart.render(poseStack, consumer, packedLight, packedOverlay)
75+
bottomPart.render(poseStack, consumer, packedLight, packedOverlay)
76+
}
77+
78+
init {
79+
val modelpart = arg.bakeLayer(ModelLayers.CHEST)
80+
this.bottom = modelpart.getChild("bottom")
81+
this.lid = modelpart.getChild("lid")
82+
this.lock = modelpart.getChild("lock")
83+
}
84+
85+
companion object {
86+
private const val BOTTOM = "bottom"
87+
private const val LID = "lid"
88+
private const val LOCK = "lock"
89+
private fun getMaterial(blockEntity: GenericChestBlockEntity): Material {
90+
return map[blockEntity.blockState.block.instanceOrNull<GenericChestBlock>()?.materialType ?: "pokeball_chest"]!!
91+
}
92+
93+
private val map: HashMap<String, Material> = Util.make(
94+
HashMap()
95+
) { map: HashMap<String, Material> ->
96+
val consumer = { id: String ->
97+
map[id] = Material(
98+
Sheets.CHEST_SHEET, GenerationsCore.id(
99+
"entity/chest/$id"
100+
)
101+
)
102+
}
103+
consumer.invoke("pokeball_chest")
104+
consumer.invoke("greatball_chest")
105+
consumer.invoke("ultraball_chest")
106+
consumer.invoke("masterball_chest")
107+
}
108+
109+
val genericChestTextures: Collection<Material>
110+
get() = map.values
111+
}
112+
}

common/src/main/java/generations/gg/generations/core/generationscore/common/client/screen/container/GenericChestScreen.java

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)