You've already forked CompressionStick
complete
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package cn.rtast.compressionstick
|
||||
|
||||
import cn.rtast.compressionstick.items.ModItems
|
||||
import net.fabricmc.api.ModInitializer
|
||||
|
||||
class CompressionStick : ModInitializer {
|
||||
|
||||
companion object {
|
||||
const val MOD_ID = "compressionstick"
|
||||
}
|
||||
|
||||
override fun onInitialize() {
|
||||
ModItems.initialize()
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package cn.rtast.compressionstick
|
||||
|
||||
import net.fabricmc.api.ModInitializer
|
||||
|
||||
class Compressionstick : ModInitializer {
|
||||
|
||||
override fun onInitialize() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright © 2025 RTAkland
|
||||
* Author: RTAkland
|
||||
* Date: 2025/1/5
|
||||
*/
|
||||
|
||||
|
||||
package cn.rtast.compressionstick.items
|
||||
|
||||
import net.minecraft.entity.Entity
|
||||
import net.minecraft.entity.LivingEntity
|
||||
import net.minecraft.entity.damage.DamageSource
|
||||
import net.minecraft.entity.player.PlayerEntity
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.item.SwordItem
|
||||
import net.minecraft.item.ToolMaterial
|
||||
import net.minecraft.util.ActionResult
|
||||
import net.minecraft.util.Hand
|
||||
|
||||
class LevelTopWoodenSword(settings: Settings) : SwordItem(ToolMaterial.WOOD, 114514f, 1000000f, settings) {
|
||||
override fun useOnEntity(stack: ItemStack, user: PlayerEntity, entity: LivingEntity, hand: Hand): ActionResult {
|
||||
entity.jump()
|
||||
entity.bodyYaw = 0f
|
||||
return ActionResult.PASS
|
||||
}
|
||||
|
||||
override fun getBonusAttackDamage(target: Entity, baseAttackDamage: Float, damageSource: DamageSource): Float {
|
||||
return 114514f
|
||||
}
|
||||
}
|
||||
47
src/main/kotlin/cn/rtast/compressionstick/items/ModItems.kt
Normal file
47
src/main/kotlin/cn/rtast/compressionstick/items/ModItems.kt
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright © 2025 RTAkland
|
||||
* Author: RTAkland
|
||||
* Date: 2025/1/5
|
||||
*/
|
||||
|
||||
|
||||
package cn.rtast.compressionstick.items
|
||||
|
||||
import cn.rtast.compressionstick.CompressionStick.Companion.MOD_ID
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents
|
||||
import net.minecraft.item.Item
|
||||
import net.minecraft.item.ItemGroups
|
||||
import net.minecraft.item.Items
|
||||
import net.minecraft.registry.RegistryKey
|
||||
import net.minecraft.registry.RegistryKeys
|
||||
import net.minecraft.util.Identifier
|
||||
|
||||
object ModItems {
|
||||
val LEVEL_ONE_STICK = register("level_one_stick", ::Item, Item.Settings())
|
||||
val LEVEL_TWO_STICK = register("level_two_stick", ::Item, Item.Settings())
|
||||
val LEVEL_THREE_STICK = register("level_three_stick", ::Item, Item.Settings())
|
||||
val LEVEL_TOP_STICK = register("level_top_stick", ::Item, Item.Settings())
|
||||
val LEVEL_TOP_WOODEN_SWORD = register("level_top_wooden_sword", ::LevelTopWoodenSword, Item.Settings())
|
||||
|
||||
fun register(path: String, factory: (Item.Settings) -> Item, settings: Item.Settings): Item {
|
||||
val registryKey = RegistryKey.of(RegistryKeys.ITEM, Identifier.of(MOD_ID, path))
|
||||
return Items.register(registryKey, factory, settings)
|
||||
}
|
||||
|
||||
fun customIngredients(entries: FabricItemGroupEntries) {
|
||||
entries.add(LEVEL_ONE_STICK)
|
||||
entries.add(LEVEL_TWO_STICK)
|
||||
entries.add(LEVEL_THREE_STICK)
|
||||
entries.add(LEVEL_TOP_STICK)
|
||||
}
|
||||
|
||||
fun customCombat(entries: FabricItemGroupEntries) {
|
||||
entries.add(LEVEL_TOP_WOODEN_SWORD)
|
||||
}
|
||||
|
||||
fun initialize() {
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(::customIngredients)
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register(::customCombat)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"model": {
|
||||
"type": "minecraft:model",
|
||||
"model": "compressionstick:item/level_one_stick"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"model": {
|
||||
"type": "minecraft:model",
|
||||
"model": "compressionstick:item/level_three_stick"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"model": {
|
||||
"type": "minecraft:model",
|
||||
"model": "compressionstick:item/level_top_stick"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"model": {
|
||||
"type": "minecraft:model",
|
||||
"model": "compressionstick:item/level_top_wooden_sword"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"model": {
|
||||
"type": "minecraft:model",
|
||||
"model": "compressionstick:item/level_two_stick"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"item.compressionstick.level_one_stick": "Level 1 compression stick",
|
||||
"item.compressionstick.level_two_stick": "Level 2 compression stick",
|
||||
"item.compressionstick.level_three_stick": "Level 3 compression stick",
|
||||
"item.compressionstick.level_top_stick": "Level top compression stick",
|
||||
"item.compressionstick.level_top_wooden_sword": "Level top compression wooden sword"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"item.compressionstick.level_one_stick": "一级压缩木棍",
|
||||
"item.compressionstick.level_two_stick": "二级压缩木棍",
|
||||
"item.compressionstick.level_three_stick": "三级压缩木棍",
|
||||
"item.compressionstick.level_top_stick": "顶级压缩木棍",
|
||||
"item.compressionstick.level_top_wooden_sword": "顶级压缩木剑"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "compressionstick:item/level_one_stick"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "compressionstick:item/level_three_stick"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "compressionstick:item/level_top_stick"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "compressionstick:item/level_top_wooden_sword"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "compressionstick:item/level_two_stick"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 209 B |
Binary file not shown.
|
After Width: | Height: | Size: 224 B |
Binary file not shown.
|
After Width: | Height: | Size: 226 B |
Binary file not shown.
|
After Width: | Height: | Size: 276 B |
Binary file not shown.
|
After Width: | Height: | Size: 219 B |
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"XXX",
|
||||
"XXX",
|
||||
"XXX"
|
||||
],
|
||||
"key": {
|
||||
"X": [
|
||||
"minecraft:stick"
|
||||
]
|
||||
},
|
||||
"result": {
|
||||
"id": "compressionstick:level_one_stick",
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"XXX",
|
||||
"XXX",
|
||||
"XXX"
|
||||
],
|
||||
"key": {
|
||||
"X": [
|
||||
"compressionstick:level_two_stick"
|
||||
]
|
||||
},
|
||||
"result": {
|
||||
"id": "compressionstick:level_three_stick",
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"XXX",
|
||||
"XXX",
|
||||
"XXX"
|
||||
],
|
||||
"key": {
|
||||
"X": [
|
||||
"compressionstick:level_three_stick"
|
||||
]
|
||||
},
|
||||
"result": {
|
||||
"id": "compressionstick:level_top_stick",
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
" X ",
|
||||
" X ",
|
||||
" O "
|
||||
],
|
||||
"key": {
|
||||
"X": [
|
||||
"compressionstick:level_top_stick"
|
||||
],
|
||||
"O": [
|
||||
"minecraft:stick"
|
||||
]
|
||||
},
|
||||
"result": {
|
||||
"id": "compressionstick:level_top_wooden_sword",
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"XXX",
|
||||
"XXX",
|
||||
"XXX"
|
||||
],
|
||||
"key": {
|
||||
"X": [
|
||||
"compressionstick:level_one_stick"
|
||||
]
|
||||
},
|
||||
"result": {
|
||||
"id": "compressionstick:level_two_stick",
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,19 @@
|
||||
"version": "${version}",
|
||||
"name": "CompressionStick",
|
||||
"description": "压缩木棍",
|
||||
"authors": [],
|
||||
"authors": [
|
||||
"RTAkland"
|
||||
],
|
||||
"contact": {},
|
||||
"license": "Apache-2.0",
|
||||
"icon": "assets/compressionstick/icon.png",
|
||||
"environment": "server",
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"cn.rtast.compressionstick.Compressionstick"
|
||||
{
|
||||
"adapter": "kotlin",
|
||||
"value": "cn.rtast.compressionstick.CompressionStick"
|
||||
}
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
|
||||
Reference in New Issue
Block a user