From c158d563af1bd857197627a1970b2970908ec58d Mon Sep 17 00:00:00 2001 From: RypoFalem Date: Sun, 5 Apr 2020 15:07:51 -0500 Subject: [PATCH] misc --- build.gradle | 2 +- src/main/resources/fabric.mod.json | 2 +- .../github/rypofalem/the_blue/TheBlueMod.scala | 17 ++++++++++------- .../the_blue/blocks/tiles/FishingNetTile.scala | 6 +++--- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index 0316e8c..4993603 100644 --- a/build.gradle +++ b/build.gradle @@ -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 { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 3a62547..a7070b1 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -20,7 +20,7 @@ "client": [ { "adapter": "scala", - "value": "io.github.rypofalem.the_blue.TheBlueMod" + "value": "io.github.rypofalem.the_blue.TheBlueClient" } ] }, diff --git a/src/main/scala/io/github/rypofalem/the_blue/TheBlueMod.scala b/src/main/scala/io/github/rypofalem/the_blue/TheBlueMod.scala index 2f6c638..f8ba65a 100644 --- a/src/main/scala/io/github/rypofalem/the_blue/TheBlueMod.scala +++ b/src/main/scala/io/github/rypofalem/the_blue/TheBlueMod.scala @@ -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 @@ -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( @@ -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, @@ -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) ) + } +} \ No newline at end of file diff --git a/src/main/scala/io/github/rypofalem/the_blue/blocks/tiles/FishingNetTile.scala b/src/main/scala/io/github/rypofalem/the_blue/blocks/tiles/FishingNetTile.scala index 9eb738e..05c514c 100644 --- a/src/main/scala/io/github/rypofalem/the_blue/blocks/tiles/FishingNetTile.scala +++ b/src/main/scala/io/github/rypofalem/the_blue/blocks/tiles/FishingNetTile.scala @@ -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) } @@ -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) }