diff --git a/src/client/java/modchest/REServerModClient.java b/src/client/java/modchest/REServerModClient.java index 0d18944..2012197 100644 --- a/src/client/java/modchest/REServerModClient.java +++ b/src/client/java/modchest/REServerModClient.java @@ -4,14 +4,16 @@ import modchest.networking.modNetworkingClient; import net.fabricmc.api.ClientModInitializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import modchest.util.initializer; public class REServerModClient implements ClientModInitializer { public static final Logger LOGGER = LoggerFactory.getLogger("modchest"); // Erster Error Logger @Override public void onInitializeClient() { // This entrypoint is suitable for setting up client-specific logic, such as rendering. + initializer.networking(); + initializer.renderer(); - modNetworkingClient.registerC2SPackets(); //Identifier unter denen der Client zuhoert werden registriert LOGGER.info("Modchest-Client successfully loaded!"); } diff --git a/src/client/java/modchest/util/initializer.java b/src/client/java/modchest/util/initializer.java new file mode 100644 index 0000000..186c79a --- /dev/null +++ b/src/client/java/modchest/util/initializer.java @@ -0,0 +1,33 @@ +package modchest.util; + +import modchest.block.entity.modBlockEntities; +import modchest.block.modBlocks; +import modchest.item.modItemGroup; +import modchest.item.modItems; +import modchest.networking.modNetworkingClient; +import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; +import net.minecraft.client.render.RenderLayer; + +public class initializer { + public static void itemGroups() { + //modItemGroup.modchest(); // Item Gruppe fürs Creative-Inventar wird erstellt; In dieser Gruppe sollen + // dann alle Items und Blöcke dieser Mod angezeigt werden + } + + public static void itemsAndBlocks() { + //modItems.setItems(); // die Items werden erstellt + //modBlocks.setBlocks(); // Hier werden die Blöcke erstellt + //modBlockEntities.registerBlockEntities(); // Die Interaktionsmenüs für die Blöcke werden erstellt + } + + public static void events() { //Events, bei denen custom Code ausgefuehrt wird, werden eingefuehrt + } + + public static void networking() { //Identifier unter denen der Server zuhoert werden registriert + modNetworkingClient.registerC2SPackets(); //Identifier unter denen der Client zuhoert werden registriert + } + + public static void renderer() { //Grafikrenderer werden aufgerufen + BlockRenderLayerMap.INSTANCE.putBlock(modBlocks.denk_mal_block, RenderLayer.getTranslucent()); //denk_mal_block bekommt die Faehigkeit, transparente Grafiken zu haben + } +} diff --git a/src/main/java/modchest/block/custom/denkMalBlock.java b/src/main/java/modchest/block/custom/denkMalBlock.java index 2ee23f2..000de6d 100644 --- a/src/main/java/modchest/block/custom/denkMalBlock.java +++ b/src/main/java/modchest/block/custom/denkMalBlock.java @@ -1,13 +1,17 @@ package modchest.block.custom; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; +import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; import net.minecraft.block.BlockWithEntity; +import net.minecraft.block.ShapeContext; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.item.ItemStack; import net.minecraft.text.Text; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.BlockView; import net.minecraft.world.World; import net.minecraft.world.explosion.Explosion; import org.jetbrains.annotations.Nullable; @@ -16,6 +20,17 @@ public class denkMalBlock extends BlockWithEntity { //Item soll nciht crafta public denkMalBlock(FabricBlockSettings fabricBlockSettings) { super(fabricBlockSettings); } + @Override + public BlockRenderType getRenderType(BlockState state) { //ruft auf, die Grafik zu rendern + return BlockRenderType.MODEL; + } + + private static VoxelShape SHAPE = BlockWithEntity.createCuboidShape(0, 0, 0, 16, 32, 16); //Erstellt eine approximation des Koerpers; braucht weniger Leistung als ein Volles Rendern + + @Override + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { //Beschreibt die tatsaechlichen Konturen + return SHAPE; + } @Nullable @Override //Später relevant für das Interface diff --git a/src/main/java/modchest/block/custom/steeringWheelBlock.java b/src/main/java/modchest/block/custom/steeringWheelBlock.java index 35b1e25..c814823 100644 --- a/src/main/java/modchest/block/custom/steeringWheelBlock.java +++ b/src/main/java/modchest/block/custom/steeringWheelBlock.java @@ -25,10 +25,8 @@ public class steeringWheelBlock extends BlockWithEntity implements BlockEntityPr super(settings); } - - /* stuff benötigt um das Interaktionsmenü zu laden!*/ @Override - public BlockRenderType getRenderType(BlockState state) { + public BlockRenderType getRenderType(BlockState state) {//ruft auf, die Grafik zu rendern return BlockRenderType.MODEL; } @@ -44,6 +42,7 @@ public class steeringWheelBlock extends BlockWithEntity implements BlockEntityPr } } + /* stuff benötigt um das Interaktionsmenü zu laden!*/ @Override //wird bei einem rechtsklick aufgerufen (ersellt das Blockentity) public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { if (!world.isClient) { diff --git a/src/main/java/modchest/block/modBlocks.java b/src/main/java/modchest/block/modBlocks.java index 36ecdae..5e7a1a4 100644 --- a/src/main/java/modchest/block/modBlocks.java +++ b/src/main/java/modchest/block/modBlocks.java @@ -7,6 +7,7 @@ import modchest.REServerMod; import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.Block; +import net.minecraft.block.Blocks; import net.minecraft.block.Material; import net.minecraft.item.BlockItem; import net.minecraft.item.ItemGroup; @@ -24,7 +25,7 @@ public class modBlocks { modItemGroup.modchest); denk_mal_block = registerBlock("denk_mal_block", - new denkMalBlock(FabricBlockSettings.of(Material.METAL).strength(1.0f).requiresTool()), + new denkMalBlock(FabricBlockSettings.copyOf(Blocks.GLASS).nonOpaque()), modItemGroup.modchest); } diff --git a/src/main/resources/assets/modchest/blockstates/denk_mal_block.json b/src/main/resources/assets/modchest/blockstates/denk_mal_block.json new file mode 100644 index 0000000..49bafc0 --- /dev/null +++ b/src/main/resources/assets/modchest/blockstates/denk_mal_block.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "modchest:block/denk_mal_block_aus"} + } +} \ No newline at end of file diff --git a/src/main/resources/assets/modchest/models/block/denk_mal_block_an.json b/src/main/resources/assets/modchest/models/block/denk_mal_block_an.json new file mode 100644 index 0000000..b765d7f --- /dev/null +++ b/src/main/resources/assets/modchest/models/block/denk_mal_block_an.json @@ -0,0 +1,87 @@ +{ + "credit": "Made with Blockbench", + "texture_size": [64, 64], + "textures": { + "1": "modchest:block/denk_mal_block", + "3": "modchest:block/denk_mal_block_basis", + "particle": "modchest:block/denk_mal_block_kern_an" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [0, 0, 4, 4], "texture": "#3"}, + "east": {"uv": [0, 4, 4, 8], "texture": "#3"}, + "south": {"uv": [4, 0, 8, 4], "texture": "#3"}, + "west": {"uv": [4, 4, 8, 8], "texture": "#3"}, + "up": {"uv": [4, 12, 0, 8], "texture": "#3"}, + "down": {"uv": [12, 0, 8, 4], "texture": "#3"} + } + }, + { + "from": [0, 16, 0], + "to": [16, 32, 16], + "faces": { + "north": {"uv": [0, 0, 4, 4], "texture": "#1"}, + "east": {"uv": [0, 4, 4, 8], "texture": "#1"}, + "south": {"uv": [4, 0, 8, 4], "texture": "#1"}, + "west": {"uv": [4, 4, 8, 8], "texture": "#1"}, + "up": {"uv": [4, 12, 0, 8], "texture": "#1"}, + "down": {"uv": [12, 0, 8, 4], "texture": "#1"} + } + }, + { + "from": [3, 18, 3], + "to": [13, 29, 13], + "faces": { + "north": {"uv": [0, 0, 5, 5.5], "texture": "#missing"}, + "east": {"uv": [5, 0, 10, 5.5], "texture": "#missing"}, + "south": {"uv": [0, 5.5, 5, 11], "texture": "#missing"}, + "west": {"uv": [5, 5.5, 10, 11], "texture": "#missing"}, + "up": {"uv": [15, 5, 10, 0], "texture": "#missing"}, + "down": {"uv": [15, 5, 10, 10], "texture": "#missing"} + } + } + ], + "display": { + "thirdperson_righthand": { + "scale": [0.5, 0.5, 0.5] + }, + "thirdperson_lefthand": { + "scale": [0.5, 0.5, 0.5] + }, + "firstperson_righthand": { + "rotation": [1, 0, 0], + "translation": [2.5, -1.5, 0], + "scale": [0.5, 0.5, 0.5] + }, + "firstperson_lefthand": { + "translation": [2.5, -1.5, 0], + "scale": [0.5, 0.5, 0.5] + }, + "ground": { + "scale": [0.5, 0.5, 0.5] + }, + "gui": { + "translation": [0, -3.25, 0], + "scale": [0.5, 0.5, 0.5] + }, + "head": { + "translation": [0, 11.5, 0], + "scale": [0.5, 0.5, 0.5] + }, + "fixed": { + "translation": [0, -1.75, 0], + "scale": [0.5, 0.5, 0.5] + } + }, + "groups": [ + { + "name": "VoxelShapes", + "origin": [8, 8, 8], + "color": 0, + "children": [0, 1, 2] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/modchest/models/block/denk_mal_block_aus.json b/src/main/resources/assets/modchest/models/block/denk_mal_block_aus.json new file mode 100644 index 0000000..62440df --- /dev/null +++ b/src/main/resources/assets/modchest/models/block/denk_mal_block_aus.json @@ -0,0 +1,324 @@ +{ + "parent": "block/cube_all", + "credit": "Made with Blockbench", + "texture_size": [ + 64, + 64 + ], + "textures": { + "1": "modchest:block/denk_mal_block", + "2": "modchest:block/denk_mal_block_kern_aus", + "3": "modchest:block/denk_mal_block_basis", + "particles": "modchest:block/denk_mal_block_basis" + }, + "elements": [ + { + "from": [ + 0, + 0, + 0 + ], + "to": [ + 16, + 16, + 16 + ], + "faces": { + "north": { + "uv": [ + 0, + 0, + 4, + 4 + ], + "texture": "#3" + }, + "east": { + "uv": [ + 0, + 4, + 4, + 8 + ], + "texture": "#3" + }, + "south": { + "uv": [ + 4, + 0, + 8, + 4 + ], + "texture": "#3" + }, + "west": { + "uv": [ + 4, + 4, + 8, + 8 + ], + "texture": "#3" + }, + "up": { + "uv": [ + 4, + 12, + 0, + 8 + ], + "texture": "#3" + }, + "down": { + "uv": [ + 12, + 0, + 8, + 4 + ], + "texture": "#3" + } + } + }, + { + "from": [ + 0, + 16, + 0 + ], + "to": [ + 16, + 32, + 16 + ], + "faces": { + "north": { + "uv": [ + 0, + 0, + 4, + 4 + ], + "texture": "#1" + }, + "east": { + "uv": [ + 0, + 4, + 4, + 8 + ], + "texture": "#1" + }, + "south": { + "uv": [ + 4, + 0, + 8, + 4 + ], + "texture": "#1" + }, + "west": { + "uv": [ + 4, + 4, + 8, + 8 + ], + "texture": "#1" + }, + "up": { + "uv": [ + 4, + 12, + 0, + 8 + ], + "texture": "#1" + }, + "down": { + "uv": [ + 12, + 0, + 8, + 4 + ], + "texture": "#1" + } + } + }, + { + "from": [ + 3, + 18, + 3 + ], + "to": [ + 13, + 29, + 13 + ], + "faces": { + "north": { + "uv": [ + 0, + 0, + 5, + 5.5 + ], + "texture": "#2" + }, + "east": { + "uv": [ + 5, + 0, + 10, + 5.5 + ], + "texture": "#2" + }, + "south": { + "uv": [ + 0, + 5.5, + 5, + 11 + ], + "texture": "#2" + }, + "west": { + "uv": [ + 5, + 5.5, + 10, + 11 + ], + "texture": "#2" + }, + "up": { + "uv": [ + 15, + 5, + 10, + 0 + ], + "texture": "#2" + }, + "down": { + "uv": [ + 15, + 5, + 10, + 10 + ], + "texture": "#2" + } + } + } + ], + "display": { + "thirdperson_righthand": { + "scale": [ + 0.5, + 0.5, + 0.5 + ] + }, + "thirdperson_lefthand": { + "scale": [ + 0.5, + 0.5, + 0.5 + ] + }, + "firstperson_righthand": { + "rotation": [ + 1, + 0, + 0 + ], + "translation": [ + 2.5, + -1.5, + 0 + ], + "scale": [ + 0.5, + 0.5, + 0.5 + ] + }, + "firstperson_lefthand": { + "translation": [ + 2.5, + -1.5, + 0 + ], + "scale": [ + 0.5, + 0.5, + 0.5 + ] + }, + "ground": { + "scale": [ + 0.5, + 0.5, + 0.5 + ] + }, + "gui": { + "translation": [ + 0, + -3.25, + 0 + ], + "scale": [ + 0.5, + 0.5, + 0.5 + ] + }, + "head": { + "translation": [ + 0, + 11.5, + 0 + ], + "scale": [ + 0.5, + 0.5, + 0.5 + ] + }, + "fixed": { + "translation": [ + 0, + -1.75, + 0 + ], + "scale": [ + 0.5, + 0.5, + 0.5 + ] + } + }, + "groups": [ + { + "name": "VoxelShapes", + "origin": [ + 8, + 8, + 8 + ], + "color": 0, + "children": [ + 0, + 1, + 2 + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/modchest/models/block/senk_mal_block.json b/src/main/resources/assets/modchest/models/block/senk_mal_block.json deleted file mode 100644 index 9f0a582..0000000 --- a/src/main/resources/assets/modchest/models/block/senk_mal_block.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/cube_all", - "textures": { - "all": "modchest:block/denk_mal_block" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/modchest/models/item/denk_mal_block.json b/src/main/resources/assets/modchest/models/item/denk_mal_block.json new file mode 100644 index 0000000..c9b0e8c --- /dev/null +++ b/src/main/resources/assets/modchest/models/item/denk_mal_block.json @@ -0,0 +1,3 @@ +{ + "parent": "modchest:block/denk_mal_block" +} \ No newline at end of file diff --git a/src/main/resources/assets/modchest/textures/block/denk_mal_block.png b/src/main/resources/assets/modchest/textures/block/denk_mal_block.png new file mode 100644 index 0000000..8db9cf0 Binary files /dev/null and b/src/main/resources/assets/modchest/textures/block/denk_mal_block.png differ diff --git a/src/main/resources/assets/modchest/textures/block/denk_mal_block_basis.png b/src/main/resources/assets/modchest/textures/block/denk_mal_block_basis.png new file mode 100644 index 0000000..0fdf5b4 Binary files /dev/null and b/src/main/resources/assets/modchest/textures/block/denk_mal_block_basis.png differ diff --git a/src/main/resources/assets/modchest/textures/block/denk_mal_block_kern_an.png b/src/main/resources/assets/modchest/textures/block/denk_mal_block_kern_an.png new file mode 100644 index 0000000..0335f71 Binary files /dev/null and b/src/main/resources/assets/modchest/textures/block/denk_mal_block_kern_an.png differ diff --git a/src/main/resources/assets/modchest/textures/block/denk_mal_block_kern_aus.png b/src/main/resources/assets/modchest/textures/block/denk_mal_block_kern_aus.png new file mode 100644 index 0000000..1133eb5 Binary files /dev/null and b/src/main/resources/assets/modchest/textures/block/denk_mal_block_kern_aus.png differ