Skip to content

Commit

Permalink
✨ AAswordman&AAswordmanblock
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenXu233 committed Oct 20, 2024
1 parent 9f2c2ef commit 6d558db
Show file tree
Hide file tree
Showing 14 changed files with 123 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain platforms or Java versions, and provides a first line of defence
# against bad commits.

name: build
on: [pull_request, push]

jobs:
build:
strategy:
matrix:
# Use these Java versions
java: [
21, # Current Java LTS
]
runs-on: ubuntu-22.04
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'microsoft'
- name: make gradle wrapper executable
run: chmod +x ./gradlew
- name: build
run: ./gradlew build
- name: capture build artifacts
if: ${{ matrix.java == '21' }} # Only upload artifacts built from latest java
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: build/libs/
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import net.fabricmc.api.ModInitializer;

import org.decdev.thepoetryofwinter.block.ModBlocks;
import org.decdev.thepoetryofwinter.item.ModItems;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -19,6 +21,9 @@ public void onInitialize() {
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.

ModItems.registerModItems();
ModBlocks.registerModBlocks();

LOGGER.info("Hello Fabric world!");
}
}
30 changes: 30 additions & 0 deletions src/main/java/org/decdev/thepoetryofwinter/block/ModBlocks.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.decdev.thepoetryofwinter.block;

import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import org.decdev.thepoetryofwinter.ThePoetryOfWinter;

public class ModBlocks {

public static final Block AA_SWORDMAN_BLOCK = register("aaswordman_block", new Block(AbstractBlock.Settings.create().strength(3.0f,3.0f)));

public static void registerBlockItems(String id, Block block){
Item item = Registry.register(Registries.ITEM,Identifier.of(ThePoetryOfWinter.MOD_ID,id),new BlockItem(block, new Item.Settings()));
if (item instanceof BlockItem) {
((BlockItem)item).appendBlocks(Item.BLOCK_ITEMS,item);
}
}

public static Block register(String id, Block block){
registerBlockItems(id,block);
return Registry.register(Registries.BLOCK, Identifier.of(ThePoetryOfWinter.MOD_ID,id),block);
}
public static void registerModBlocks(){
ThePoetryOfWinter.LOGGER.info("Registering ThePoetryOfWinter Blocks");
}
}
21 changes: 21 additions & 0 deletions src/main/java/org/decdev/thepoetryofwinter/item/ModItems.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.decdev.thepoetryofwinter.item;

import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import org.decdev.thepoetryofwinter.ThePoetryOfWinter;

public class ModItems {

public static final Item AA_SWORDMAN = registerItems("aaswordman", new Item(new Item.Settings().maxCount(1)));

public static Item registerItems(String id, Item item) {
return Registry.register(
Registries.ITEM, Identifier.of(ThePoetryOfWinter.MOD_ID,id), item);
}

public static void registerModItems(){
ThePoetryOfWinter.LOGGER.info("Registering ThePoetryOfWinter Items");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "thepoetryofwinter:block/aaswordman_block"
}
}
}
4 changes: 4 additions & 0 deletions src/main/resources/assets/thepoetryofwinter/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"item.thepoetryofwinter.aaswordman": "AAswordman",
"block.thepoetryofwinter.aaswordman_block": "AAswordman block"
}
4 changes: 4 additions & 0 deletions src/main/resources/assets/thepoetryofwinter/lang/zh_cn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"item.thepoetryofwinter.aaswordman": "AA剑侠",
"block.thepoetryofwinter.aaswordman_block": "AA剑侠方块"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "thepoetryofwinter:block/aaswordman_block"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "thepoetryofwinter:item/aaswordman"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "thepoetryofwinter:block/aaswordman_block"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6d558db

Please sign in to comment.