Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
RypoFalem committed Apr 5, 2020
1 parent e8c2eab commit c158d56
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

archivesBaseName = project.archives_base_name
version = "${project.minecraft_version} - ${project.mod_version}"
version = "${project.minecraft_version}-${project.mod_version}"
group = project.maven_group

minecraft {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"client": [
{
"adapter": "scala",
"value": "io.github.rypofalem.the_blue.TheBlueMod"
"value": "io.github.rypofalem.the_blue.TheBlueClient"
}
]
},
Expand Down
17 changes: 10 additions & 7 deletions src/main/scala/io/github/rypofalem/the_blue/TheBlueMod.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package io.github.rypofalem.the_blue


import io.github.rypofalem.the_blue.TheBlueMod.{fishingNetBlock, fishingNetTileType}
import io.github.rypofalem.the_blue.blocks.tiles.{FishingNetBlock, FishingNetItem, FishingNetRenderer, FishingNetTile}
import net.fabricmc.api.{ClientModInitializer, ModInitializer}
import net.fabricmc.fabric.api.block.FabricBlockSettings
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder
import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry
import net.minecraft.block.{Block, Material}
import net.minecraft.block.entity.{BlockEntity, BlockEntityType}
import net.minecraft.client.render.RenderLayer
Expand All @@ -15,7 +17,7 @@ import net.minecraft.util.Identifier
import net.minecraft.util.registry.Registry

// todo dolphin saddle
object TheBlueMod extends ModInitializer with ClientModInitializer{
object TheBlueMod extends ModInitializer{

val modid:String = "the_blue"
val itemGroup:ItemGroup = FabricItemGroupBuilder.build(
Expand All @@ -34,12 +36,6 @@ object TheBlueMod extends ModInitializer with ClientModInitializer{
registerTile("fishingnet", fishingNetTileType)
}

override def onInitializeClient(): Unit = {
BlockRenderLayerMap.INSTANCE.putBlock(fishingNetBlock, RenderLayer.getTranslucent)
import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry
BlockEntityRendererRegistry.INSTANCE.register[FishingNetTile](fishingNetTileType, x => new FishingNetRenderer(x) )
}

private def registerTile[A<:BlockEntity](name:String, tileType:BlockEntityType[A] ): BlockEntityType[A] = {
Registry.register(
Registry.BLOCK_ENTITY_TYPE,
Expand All @@ -56,3 +52,10 @@ object TheBlueMod extends ModInitializer with ClientModInitializer{
Registry.register(Registry.ITEM, new Identifier (modid, name), blockItem)
}
}

object TheBlueClient extends ClientModInitializer{
override def onInitializeClient(): Unit = {
BlockRenderLayerMap.INSTANCE.putBlock(fishingNetBlock, RenderLayer.getTranslucent)
BlockEntityRendererRegistry.INSTANCE.register[FishingNetTile](fishingNetTileType, x => new FishingNetRenderer(x) )
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ class FishingNetBlock(settings:Block.Settings) extends Block(settings) with Bloc
var lootCount:Int = 0

// a location in the center of the hit side, .2 blocks extended outwards
val dropLocation:Vector3d = {
val dropLocation:(Double, Double, Double) = {
val side = hit.getSide
def offset(d:Double):Double = d * 0.7 + .5
new Vector3d(offset(side.getOffsetX) + pos.getX,
(offset(side.getOffsetX) + pos.getX,
offset(side.getOffsetY) + pos.getY,
offset(side.getOffsetZ) + pos.getZ)
}
Expand All @@ -193,7 +193,7 @@ class FishingNetBlock(settings:Block.Settings) extends Block(settings) with Bloc
} {
net.setInvStack(slot, ItemStack.EMPTY)
lootCount += 1
val worldItem = new ItemEntity(world, dropLocation.x, dropLocation.y, dropLocation.z, item)
val worldItem = new ItemEntity(world, dropLocation._1, dropLocation._2, dropLocation._3, item)
worldItem.setPickupDelay(0)
world.spawnEntity(worldItem)
}
Expand Down

0 comments on commit c158d56

Please sign in to comment.