init
This commit is contained in:
10
src/client/java/dev/tggamesyt/szar/client/SzarClient.java
Normal file
10
src/client/java/dev/tggamesyt/szar/client/SzarClient.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package dev.tggamesyt.szar.client;
|
||||
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
|
||||
public class SzarClient implements ClientModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package dev.tggamesyt.szar.client;
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
|
||||
|
||||
public class SzarDataGenerator implements DataGeneratorEntrypoint {
|
||||
|
||||
@Override
|
||||
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
|
||||
FabricDataGenerator.Pack pack = fabricDataGenerator.createPack();
|
||||
}
|
||||
}
|
||||
14
src/client/resources/szar.client.mixins.json
Normal file
14
src/client/resources/szar.client.mixins.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "dev.tggamesyt.szar.mixin.client",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"client": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
},
|
||||
"overwrites": {
|
||||
"requireAnnotations": true
|
||||
}
|
||||
}
|
||||
71
src/main/java/dev/tggamesyt/szar/FaszBlock.java
Normal file
71
src/main/java/dev/tggamesyt/szar/FaszBlock.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package dev.tggamesyt.szar;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.particle.BlockStateParticleEffect;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FaszBlock extends Block {
|
||||
|
||||
public FaszBlock() {
|
||||
super(Settings.copy(Blocks.STONE));
|
||||
}
|
||||
|
||||
private static final VoxelShape SHAPE_1 = Block.createCuboidShape(
|
||||
6, 0, 2,
|
||||
10, 4, 6
|
||||
);
|
||||
|
||||
// Element 2: from [6, 0, 10] to [10, 4, 14]
|
||||
private static final VoxelShape SHAPE_2 = Block.createCuboidShape(
|
||||
6, 0, 10,
|
||||
10, 4, 14
|
||||
);
|
||||
|
||||
// Element 3: from [6, 4, 6] to [10, 32, 10]
|
||||
private static final VoxelShape SHAPE_3 = Block.createCuboidShape(
|
||||
6, 4, 6,
|
||||
10, 32, 10
|
||||
);
|
||||
|
||||
// Combine all shapes
|
||||
private static final VoxelShape SHAPE = VoxelShapes.union(
|
||||
SHAPE_1,
|
||||
SHAPE_2,
|
||||
SHAPE_3
|
||||
);
|
||||
|
||||
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(
|
||||
BlockState state,
|
||||
BlockView world,
|
||||
BlockPos pos,
|
||||
ShapeContext context
|
||||
) {
|
||||
return SHAPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(
|
||||
BlockState state,
|
||||
BlockView world,
|
||||
BlockPos pos,
|
||||
ShapeContext context
|
||||
) {
|
||||
// behave like vanilla: collision follows outline
|
||||
return SHAPE;
|
||||
}
|
||||
}
|
||||
48
src/main/java/dev/tggamesyt/szar/FaszItem.java
Normal file
48
src/main/java/dev/tggamesyt/szar/FaszItem.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package dev.tggamesyt.szar;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.particle.BlockStateParticleEffect;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FaszItem extends BlockItem {
|
||||
|
||||
public FaszItem(Block block, Settings settings) {
|
||||
super(block, settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
||||
ItemStack stack = user.getStackInHand(hand);
|
||||
|
||||
if (!world.isClient && stack.isOf(this)) {
|
||||
ServerWorld serverWorld = (ServerWorld) world;
|
||||
|
||||
// Get the direction the player's torso is looking
|
||||
var lookVec = user.getRotationVec(1.0F); // normalized direction vector
|
||||
|
||||
// Calculate the particle spawn position 2 blocks ahead
|
||||
double px = user.getX() + lookVec.x * 2;
|
||||
double py = user.getBodyY(0.5); // torso height
|
||||
double pz = user.getZ() + lookVec.z * 2;
|
||||
|
||||
// Spawn block particles
|
||||
serverWorld.spawnParticles(
|
||||
new BlockStateParticleEffect(ParticleTypes.BLOCK, Szar.FASZ_BLOCK.getDefaultState()),
|
||||
px, py, pz, // position
|
||||
20, // particle count
|
||||
0.3, 0.3, 0.3, // spread in x/y/z
|
||||
0.05 // velocity
|
||||
);
|
||||
}
|
||||
|
||||
return TypedActionResult.pass(stack);
|
||||
}
|
||||
}
|
||||
51
src/main/java/dev/tggamesyt/szar/Szar.java
Normal file
51
src/main/java/dev/tggamesyt/szar/Szar.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package dev.tggamesyt.szar;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
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;
|
||||
|
||||
public class Szar implements ModInitializer {
|
||||
|
||||
public static final String MOD_ID = "szar";
|
||||
|
||||
public static final Block SZAR_BLOCK =
|
||||
new SzarBlock();
|
||||
public static final Block FASZ_BLOCK =
|
||||
new FaszBlock();
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
|
||||
// register block
|
||||
Registry.register(
|
||||
Registries.BLOCK,
|
||||
new Identifier(MOD_ID, "cigany"),
|
||||
SZAR_BLOCK
|
||||
);
|
||||
|
||||
// register item so you can hold it
|
||||
Registry.register(
|
||||
Registries.ITEM,
|
||||
new Identifier(MOD_ID, "cigany"),
|
||||
new BlockItem(SZAR_BLOCK, new Item.Settings())
|
||||
);
|
||||
|
||||
Registry.register(
|
||||
Registries.BLOCK,
|
||||
new Identifier(MOD_ID, "fasz"),
|
||||
FASZ_BLOCK
|
||||
);
|
||||
|
||||
// register item so you can hold it
|
||||
Registry.register(
|
||||
Registries.ITEM,
|
||||
new Identifier(MOD_ID, "fasz"),
|
||||
new FaszItem(FASZ_BLOCK, new Item.Settings())
|
||||
);
|
||||
}
|
||||
}
|
||||
11
src/main/java/dev/tggamesyt/szar/SzarBlock.java
Normal file
11
src/main/java/dev/tggamesyt/szar/SzarBlock.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package dev.tggamesyt.szar;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
|
||||
public class SzarBlock extends Block {
|
||||
|
||||
public SzarBlock() {
|
||||
super(Settings.copy(Blocks.STONE));
|
||||
}
|
||||
}
|
||||
7
src/main/resources/assets/szar/blockstates/cigany.json
Normal file
7
src/main/resources/assets/szar/blockstates/cigany.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "szar:block/cigany"
|
||||
}
|
||||
}
|
||||
}
|
||||
7
src/main/resources/assets/szar/blockstates/fasz.json
Normal file
7
src/main/resources/assets/szar/blockstates/fasz.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "szar:block/fasz"
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
src/main/resources/assets/szar/icon.png
Normal file
BIN
src/main/resources/assets/szar/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 237 KiB |
4
src/main/resources/assets/szar/lang/en_us.json
Normal file
4
src/main/resources/assets/szar/lang/en_us.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"block.szar.cigany": "Cigány Block",
|
||||
"block.szar.fasz": "Fasz"
|
||||
}
|
||||
6
src/main/resources/assets/szar/models/block/cigany.json
Normal file
6
src/main/resources/assets/szar/models/block/cigany.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:block/cube_all",
|
||||
"textures": {
|
||||
"all": "szar:block/cigany"
|
||||
}
|
||||
}
|
||||
57
src/main/resources/assets/szar/models/block/fasz.json
Normal file
57
src/main/resources/assets/szar/models/block/fasz.json
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"format_version": "1.9.0",
|
||||
"credit": "Made with Blockbench",
|
||||
"texture_size": [32, 32],
|
||||
"textures": {
|
||||
"0": "szar:block/fasz",
|
||||
"particle": "szar:block/white"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [6, 0, 2],
|
||||
"to": [10, 4, 6],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [6, 0, 2]},
|
||||
"faces": {
|
||||
"north": {"uv": [8, 0, 10, 2], "texture": "#0"},
|
||||
"east": {"uv": [8, 2, 10, 4], "texture": "#0"},
|
||||
"south": {"uv": [8, 4, 10, 6], "texture": "#0"},
|
||||
"west": {"uv": [8, 6, 10, 8], "texture": "#0"},
|
||||
"up": {"uv": [10, 10, 8, 8], "texture": "#0"},
|
||||
"down": {"uv": [12, 0, 10, 2], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [6, 0, 10],
|
||||
"to": [10, 4, 14],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [6, 0, 10]},
|
||||
"faces": {
|
||||
"north": {"uv": [10, 2, 12, 4], "texture": "#0"},
|
||||
"east": {"uv": [10, 4, 12, 6], "texture": "#0"},
|
||||
"south": {"uv": [10, 6, 12, 8], "texture": "#0"},
|
||||
"west": {"uv": [8, 10, 10, 12], "texture": "#0"},
|
||||
"up": {"uv": [12, 10, 10, 8], "texture": "#0"},
|
||||
"down": {"uv": [12, 10, 10, 12], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [6, 4, 6],
|
||||
"to": [10, 32, 10],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [6, 4, 6]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 2, 14], "texture": "#0"},
|
||||
"east": {"uv": [2, 0, 4, 14], "texture": "#0"},
|
||||
"south": {"uv": [4, 0, 6, 14], "texture": "#0"},
|
||||
"west": {"uv": [6, 0, 8, 14], "texture": "#0"},
|
||||
"up": {"uv": [14, 2, 12, 0], "texture": "#0"},
|
||||
"down": {"uv": [14, 2, 12, 4], "texture": "#0"}
|
||||
}
|
||||
}
|
||||
],
|
||||
"display": {
|
||||
"thirdperson_righthand": {
|
||||
"rotation": [79.94, -84.91, 76.47],
|
||||
"translation": [-6.75, 6.75, 1.5],
|
||||
"scale": [1, 1.43164, 1]
|
||||
}
|
||||
}
|
||||
}
|
||||
3
src/main/resources/assets/szar/models/item/cigany.json
Normal file
3
src/main/resources/assets/szar/models/item/cigany.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"parent": "szar:block/cigany"
|
||||
}
|
||||
3
src/main/resources/assets/szar/models/item/fasz.json
Normal file
3
src/main/resources/assets/szar/models/item/fasz.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"parent": "szar:block/fasz"
|
||||
}
|
||||
BIN
src/main/resources/assets/szar/textures/block/cigany.png
Normal file
BIN
src/main/resources/assets/szar/textures/block/cigany.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 237 KiB |
BIN
src/main/resources/assets/szar/textures/block/fasz.png
Normal file
BIN
src/main/resources/assets/szar/textures/block/fasz.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 192 B |
BIN
src/main/resources/assets/szar/textures/block/white.png
Normal file
BIN
src/main/resources/assets/szar/textures/block/white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 157 B |
20
src/main/resources/data/szar/recipes/fasz.json
Normal file
20
src/main/resources/data/szar/recipes/fasz.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
" M ",
|
||||
" B ",
|
||||
"B B"
|
||||
],
|
||||
"key": {
|
||||
"M": {
|
||||
"item": "minecraft:milk_bucket"
|
||||
},
|
||||
"B": {
|
||||
"item": "minecraft:beef"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "szar:fasz",
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
35
src/main/resources/fabric.mod.json
Normal file
35
src/main/resources/fabric.mod.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "szar",
|
||||
"version": "${version}",
|
||||
"name": "szar",
|
||||
"description": "Valami szar mod",
|
||||
"authors": ["TGdoesCode"],
|
||||
"contact": {},
|
||||
"license": "All-Rights-Reserved",
|
||||
"icon": "assets/szar/icon.png",
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"fabric-datagen": [
|
||||
"dev.tggamesyt.szar.client.SzarDataGenerator"
|
||||
],
|
||||
"client": [
|
||||
"dev.tggamesyt.szar.client.SzarClient"
|
||||
],
|
||||
"main": [
|
||||
"dev.tggamesyt.szar.Szar"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"szar.mixins.json",
|
||||
{
|
||||
"config": "szar.client.mixins.json",
|
||||
"environment": "client"
|
||||
}
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=${loader_version}",
|
||||
"fabric": "*",
|
||||
"minecraft": "${minecraft_version}"
|
||||
}
|
||||
}
|
||||
14
src/main/resources/szar.mixins.json
Normal file
14
src/main/resources/szar.mixins.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "dev.tggamesyt.szar.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
},
|
||||
"overwrites": {
|
||||
"requireAnnotations": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user