More blocks!

* - Refactoring
- Add black, blue, cyan, purple, red, white and yellow chroma blocks
- Rename mod
This commit is contained in:
Timofey Gelazoniya 2022-08-11 10:51:02 +03:00
parent 52ae854280
commit 156a401bd7
Signed by: zeldon
GPG Key ID: 047886915281DD2A
53 changed files with 506 additions and 141 deletions

View File

@ -1,10 +1,11 @@
# Green Screen Mod # ChromaBlocks
This mod just adds a green block to the miscellaneous tab. ![img](https://i.imgur.com/WmOq3tm.png)
ChromaBlocks is a mod for Minecraft that adds a various chroma key blocks.
# Download # Download
Download last version from [releases](https://github.com/xzeldon/GreenScreenMod/releases). Download last version from [releases](https://github.com/xzeldon/chromablocks/releases).
# Install # Install
Download and install [Fabric](https://fabricmc.net/use/installer/) then place `.jar` file to the `mods` folder. Download and install [Fabric](https://fabricmc.net/use/installer/) then place `.jar` file to the `mods` folder.
> For compability with [Sodium](https://www.curseforge.com/minecraft/mc-mods/sodium) install [Indium](https://www.curseforge.com/minecraft/mc-mods/indium) > For compability with [Sodium](https://modrinth.com/mod/sodium) install [Indium](https://modrinth.com/mod/indium)

View File

@ -8,9 +8,9 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.14.9 loader_version=0.14.9
# Mod Properties # Mod Properties
mod_version = 1.1.0-1.19.2 mod_version = 2.0.0-1.19.2
maven_group = ru.xzeldon.greenscreenmod maven_group = ru.xzeldon.chromablocks
archives_base_name = greenscreenmod archives_base_name = chromablocks
# Dependencies # Dependencies
fabric_version=0.59.0+1.19.2 fabric_version=0.59.0+1.19.2

View File

@ -0,0 +1,16 @@
package ru.xzeldon.chromablocks;
import net.fabricmc.api.ModInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.xzeldon.chromablocks.block.ChromaBlocksBlockRegister;
public class ChromaBlocks implements ModInitializer {
public static final String MOD_ID = "chromablocks";
public static final Logger LOGGER = LoggerFactory.getLogger("chromablocks");
@Override
public void onInitialize() {
ChromaBlocksBlockRegister.registerBlocks();
}
}

View File

@ -1,12 +1,12 @@
package ru.xzeldon.greenscreenmod; package ru.xzeldon.chromablocks;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry; import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
import ru.xzeldon.greenscreenmod.model.GreenScreenModelProvider; import ru.xzeldon.chromablocks.model.ChromaBlockModelProvider;
public class GreenScreenModClient implements ClientModInitializer { public class ChromaBlocksClient implements ClientModInitializer {
@Override @Override
public void onInitializeClient() { public void onInitializeClient() {
ModelLoadingRegistry.INSTANCE.registerResourceProvider(rm -> new GreenScreenModelProvider()); ModelLoadingRegistry.INSTANCE.registerResourceProvider(rm -> new ChromaBlockModelProvider());
} }
} }

View File

@ -0,0 +1,117 @@
package ru.xzeldon.chromablocks.block;
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.Material;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import ru.xzeldon.chromablocks.ChromaBlocks;
import ru.xzeldon.chromablocks.item.ChromaBlocksItemsGroup;
public class ChromaBlocksBlockRegister {
public static final Block CHROMA_GREEN = registerBlock("chroma_green",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
.luminance(15)
), ChromaBlocksItemsGroup.GREENSCREEN);
public static final Block CHROMA_GREEN_DIM = registerBlock("chroma_green_dim",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
), ChromaBlocksItemsGroup.GREENSCREEN);
public static final Block CHROMA_BLACK = registerBlock("chroma_black",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
.luminance(15)
), ChromaBlocksItemsGroup.GREENSCREEN);
public static final Block CHROMA_BLACK_DIM = registerBlock("chroma_black_dim",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
), ChromaBlocksItemsGroup.GREENSCREEN);
public static final Block CHROMA_BLUE = registerBlock("chroma_blue",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
.luminance(15)
), ChromaBlocksItemsGroup.GREENSCREEN);
public static final Block CHROMA_BLUE_DIM = registerBlock("chroma_blue_dim",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
), ChromaBlocksItemsGroup.GREENSCREEN);
public static final Block CHROMA_CYAN = registerBlock("chroma_cyan",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
.luminance(15)
), ChromaBlocksItemsGroup.GREENSCREEN);
public static final Block CHROMA_CYAN_DIM = registerBlock("chroma_cyan_dim",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
), ChromaBlocksItemsGroup.GREENSCREEN);
public static final Block CHROMA_PURPLE = registerBlock("chroma_purple",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
.luminance(15)
), ChromaBlocksItemsGroup.GREENSCREEN);
public static final Block CHROMA_PURPLE_DIM = registerBlock("chroma_purple_dim",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
), ChromaBlocksItemsGroup.GREENSCREEN);
public static final Block CHROMA_RED = registerBlock("chroma_red",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
.luminance(15)
), ChromaBlocksItemsGroup.GREENSCREEN);
public static final Block CHROMA_RED_DIM = registerBlock("chroma_red_dim",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
), ChromaBlocksItemsGroup.GREENSCREEN);
public static final Block CHROMA_WHITE = registerBlock("chroma_white",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
.luminance(15)
), ChromaBlocksItemsGroup.GREENSCREEN);
public static final Block CHROMA_WHITE_DIM = registerBlock("chroma_white_dim",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
), ChromaBlocksItemsGroup.GREENSCREEN);
public static final Block CHROMA_YELLOW = registerBlock("chroma_yellow",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
.luminance(15)
), ChromaBlocksItemsGroup.GREENSCREEN);
public static final Block CHROMA_YELLOW_DIM = registerBlock("chroma_yellow_dim",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
), ChromaBlocksItemsGroup.GREENSCREEN);
private static Block registerBlock(String name, Block block, ItemGroup group) {
registerBlockItem(name, block, group);
return Registry.register(Registry.BLOCK, new Identifier(ChromaBlocks.MOD_ID, name), block);
}
private static Item registerBlockItem(String name, Block block, ItemGroup group) {
return Registry.register(Registry.ITEM, new Identifier(ChromaBlocks.MOD_ID, name),
new BlockItem(block, new FabricItemSettings().group(group)));
}
public static void registerBlocks() {
ChromaBlocks.LOGGER.info("Registering ModBlocks for " + ChromaBlocks.MOD_ID);
}
}

View File

@ -1,14 +1,12 @@
package ru.xzeldon.greenscreenmod.block.custom; package ru.xzeldon.chromablocks.block.custom;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView; import net.minecraft.world.BlockView;
public class GreenScreenBlock extends Block { public class ChromaBlock extends Block {
public GreenScreenBlock(Settings settings) { public ChromaBlock(Settings settings) {
super(settings); super(settings);
} }

View File

@ -0,0 +1,7 @@
package ru.xzeldon.chromablocks.block.custom;
public class ChromaBlockDim extends ChromaBlock {
public ChromaBlockDim(Settings settings) {
super(settings);
}
}

View File

@ -0,0 +1,13 @@
package ru.xzeldon.chromablocks.item;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import ru.xzeldon.chromablocks.ChromaBlocks;
import ru.xzeldon.chromablocks.block.ChromaBlocksBlockRegister;
public class ChromaBlocksItemsGroup {
public static final ItemGroup GREENSCREEN = FabricItemGroupBuilder.build(new Identifier(ChromaBlocks.MOD_ID, "chroma_blocks"),
()-> new ItemStack(ChromaBlocksBlockRegister.CHROMA_GREEN));
}

View File

@ -1,4 +1,4 @@
package ru.xzeldon.greenscreenmod.model; package ru.xzeldon.chromablocks.model;
import com.mojang.datafixers.util.Pair; import com.mojang.datafixers.util.Pair;
import net.fabricmc.fabric.api.renderer.v1.Renderer; import net.fabricmc.fabric.api.renderer.v1.Renderer;
@ -25,19 +25,24 @@ import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.Random; import net.minecraft.util.math.random.Random;
import net.minecraft.world.BlockRenderView; import net.minecraft.world.BlockRenderView;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import ru.xzeldon.chromablocks.ChromaBlocks;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
public class GreenScreenBlockModel implements UnbakedModel, BakedModel, FabricBakedModel { public class ChromaBlockModel implements UnbakedModel, BakedModel, FabricBakedModel {
private static final SpriteIdentifier SPRITE_ID = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, new Identifier("greenscreenmod:block/green_screen_block")); protected final SpriteIdentifier SPRITE_ID;
private static final Identifier DEFAULT_BLOCK_MODEL = new Identifier("minecraft:block/block"); private static final Identifier DEFAULT_BLOCK_MODEL = new Identifier("minecraft:block/block");
private final Sprite[] SPRITES = new Sprite[1]; private final Sprite[] SPRITES = new Sprite[1];
private static final Renderer renderer = RendererAccess.INSTANCE.getRenderer(); private static final Renderer renderer = RendererAccess.INSTANCE.getRenderer();
private ModelTransformation transformation; private ModelTransformation transformation;
private Mesh mesh; private Mesh mesh;
public ChromaBlockModel(String color) {
this.SPRITE_ID = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, new Identifier(ChromaBlocks.MOD_ID + ":block/" + color));
}
@Override @Override
public boolean isVanillaAdapter() { public boolean isVanillaAdapter() {
return false; return false;

View File

@ -0,0 +1,119 @@
package ru.xzeldon.chromablocks.model;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.model.ModelProviderContext;
import net.fabricmc.fabric.api.client.model.ModelProviderException;
import net.fabricmc.fabric.api.client.model.ModelResourceProvider;
import net.minecraft.client.render.model.UnbakedModel;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
import ru.xzeldon.chromablocks.ChromaBlocks;
import ru.xzeldon.chromablocks.model.custom.*;
@Environment(EnvType.CLIENT)
public class ChromaBlockModelProvider implements ModelResourceProvider {
public static final Identifier CHROMA_MODEL_GREEN = new Identifier(ChromaBlocks.MOD_ID + ":block/chroma_green");
public static final Identifier CHROMA_MODEL_GREEN_DIM = new Identifier(ChromaBlocks.MOD_ID + ":block/chroma_green_dim");
public static final Identifier CHROMA_MODEL_GREEN_ITEM = new Identifier(ChromaBlocks.MOD_ID + ":item/chroma_green");
public static final Identifier CHROMA_MODEL_GREEN_ITEM_DIM = new Identifier(ChromaBlocks.MOD_ID + ":item/chroma_green_dim");
public static final Identifier CHROMA_MODEL_BLACK = new Identifier(ChromaBlocks.MOD_ID + ":block/chroma_black");
public static final Identifier CHROMA_MODEL_BLACK_DIM = new Identifier(ChromaBlocks.MOD_ID + ":block/chroma_black_dim");
public static final Identifier CHROMA_MODEL_BLACK_ITEM = new Identifier(ChromaBlocks.MOD_ID + ":item/chroma_black");
public static final Identifier CHROMA_MODEL_BLACK_ITEM_DIM = new Identifier(ChromaBlocks.MOD_ID + ":item/chroma_black_dim");
public static final Identifier CHROMA_MODEL_BLUE = new Identifier(ChromaBlocks.MOD_ID + ":block/chroma_blue");
public static final Identifier CHROMA_MODEL_BLUE_DIM = new Identifier(ChromaBlocks.MOD_ID + ":block/chroma_blue_dim");
public static final Identifier CHROMA_MODEL_BLUE_ITEM = new Identifier(ChromaBlocks.MOD_ID + ":item/chroma_blue");
public static final Identifier CHROMA_MODEL_BLUE_ITEM_DIM = new Identifier(ChromaBlocks.MOD_ID + ":item/chroma_blue_dim");
public static final Identifier CHROMA_MODEL_CYAN = new Identifier(ChromaBlocks.MOD_ID + ":block/chroma_cyan");
public static final Identifier CHROMA_MODEL_CYAN_DIM = new Identifier(ChromaBlocks.MOD_ID + ":block/chroma_cyan_dim");
public static final Identifier CHROMA_MODEL_CYAN_ITEM = new Identifier(ChromaBlocks.MOD_ID + ":item/chroma_cyan");
public static final Identifier CHROMA_MODEL_CYAN_ITEM_DIM = new Identifier(ChromaBlocks.MOD_ID + ":item/chroma_cyan_dim");
public static final Identifier CHROMA_MODEL_PURPLE = new Identifier(ChromaBlocks.MOD_ID + ":block/chroma_purple");
public static final Identifier CHROMA_MODEL_PURPLE_DIM = new Identifier(ChromaBlocks.MOD_ID + ":block/chroma_purple_dim");
public static final Identifier CHROMA_MODEL_PURPLE_ITEM = new Identifier(ChromaBlocks.MOD_ID + ":item/chroma_purple");
public static final Identifier CHROMA_MODEL_PURPLE_ITEM_DIM = new Identifier(ChromaBlocks.MOD_ID + ":item/chroma_purple_dim");
public static final Identifier CHROMA_MODEL_RED = new Identifier(ChromaBlocks.MOD_ID + ":block/chroma_red");
public static final Identifier CHROMA_MODEL_RED_DIM = new Identifier(ChromaBlocks.MOD_ID + ":block/chroma_red_dim");
public static final Identifier CHROMA_MODEL_RED_ITEM = new Identifier(ChromaBlocks.MOD_ID + ":item/chroma_red");
public static final Identifier CHROMA_MODEL_RED_ITEM_DIM = new Identifier(ChromaBlocks.MOD_ID + ":item/chroma_red_dim");
public static final Identifier CHROMA_MODEL_WHITE = new Identifier(ChromaBlocks.MOD_ID + ":block/chroma_white");
public static final Identifier CHROMA_MODEL_WHITE_DIM = new Identifier(ChromaBlocks.MOD_ID + ":block/chroma_white_dim");
public static final Identifier CHROMA_MODEL_WHITE_ITEM = new Identifier(ChromaBlocks.MOD_ID + ":item/chroma_white");
public static final Identifier CHROMA_MODEL_WHITE_ITEM_DIM = new Identifier(ChromaBlocks.MOD_ID + ":item/chroma_white_dim");
public static final Identifier CHROMA_MODEL_YELLOW = new Identifier(ChromaBlocks.MOD_ID + ":block/chroma_yellow");
public static final Identifier CHROMA_MODEL_YELLOW_DIM = new Identifier(ChromaBlocks.MOD_ID + ":block/chroma_yellow_dim");
public static final Identifier CHROMA_MODEL_YELLOW_ITEM = new Identifier(ChromaBlocks.MOD_ID + ":item/chroma_yellow");
public static final Identifier CHROMA_MODEL_YELLOW_ITEM_DIM = new Identifier(ChromaBlocks.MOD_ID + ":item/chroma_yellow_dim");
@Override
public @Nullable UnbakedModel loadModelResource(Identifier resourceId, ModelProviderContext context) throws ModelProviderException {
if (
resourceId.equals(CHROMA_MODEL_GREEN) ||
resourceId.equals(CHROMA_MODEL_GREEN_DIM) ||
resourceId.equals(CHROMA_MODEL_GREEN_ITEM) ||
resourceId.equals(CHROMA_MODEL_GREEN_ITEM_DIM)
) {
return new GreenChromaBlockModel();
} else if (
resourceId.equals(CHROMA_MODEL_BLACK) ||
resourceId.equals(CHROMA_MODEL_BLACK_DIM) ||
resourceId.equals(CHROMA_MODEL_BLACK_ITEM) ||
resourceId.equals(CHROMA_MODEL_BLACK_ITEM_DIM)
) {
return new BlackChromaBlockModel();
} else if (
resourceId.equals(CHROMA_MODEL_BLUE) ||
resourceId.equals(CHROMA_MODEL_BLUE_DIM) ||
resourceId.equals(CHROMA_MODEL_BLUE_ITEM) ||
resourceId.equals(CHROMA_MODEL_BLUE_ITEM_DIM)
) {
return new BlueChromaBlockModel();
} else if (
resourceId.equals(CHROMA_MODEL_CYAN) ||
resourceId.equals(CHROMA_MODEL_CYAN_DIM) ||
resourceId.equals(CHROMA_MODEL_CYAN_ITEM) ||
resourceId.equals(CHROMA_MODEL_CYAN_ITEM_DIM)
) {
return new CyanChromaBlockModel();
} else if (
resourceId.equals(CHROMA_MODEL_PURPLE) ||
resourceId.equals(CHROMA_MODEL_PURPLE_DIM) ||
resourceId.equals(CHROMA_MODEL_PURPLE_ITEM) ||
resourceId.equals(CHROMA_MODEL_PURPLE_ITEM_DIM)
) {
return new PurpleChromaBlockModel();
} else if (
resourceId.equals(CHROMA_MODEL_RED) ||
resourceId.equals(CHROMA_MODEL_RED_DIM) ||
resourceId.equals(CHROMA_MODEL_RED_ITEM) ||
resourceId.equals(CHROMA_MODEL_RED_ITEM_DIM)
) {
return new RedChromaBlockModel();
} else if (
resourceId.equals(CHROMA_MODEL_WHITE) ||
resourceId.equals(CHROMA_MODEL_WHITE_DIM) ||
resourceId.equals(CHROMA_MODEL_WHITE_ITEM) ||
resourceId.equals(CHROMA_MODEL_WHITE_ITEM_DIM)
) {
return new WhiteChromaBlockModel();
} else if (
resourceId.equals(CHROMA_MODEL_YELLOW) ||
resourceId.equals(CHROMA_MODEL_YELLOW_DIM) ||
resourceId.equals(CHROMA_MODEL_YELLOW_ITEM) ||
resourceId.equals(CHROMA_MODEL_YELLOW_ITEM_DIM)
) {
return new YellowChromaBlockModel();
} else {
return null;
}
}
}

View File

@ -0,0 +1,9 @@
package ru.xzeldon.chromablocks.model.custom;
import ru.xzeldon.chromablocks.model.ChromaBlockModel;
public class BlackChromaBlockModel extends ChromaBlockModel {
public BlackChromaBlockModel() {
super("black");
}
}

View File

@ -0,0 +1,9 @@
package ru.xzeldon.chromablocks.model.custom;
import ru.xzeldon.chromablocks.model.ChromaBlockModel;
public class BlueChromaBlockModel extends ChromaBlockModel {
public BlueChromaBlockModel() {
super("blue");
}
}

View File

@ -0,0 +1,9 @@
package ru.xzeldon.chromablocks.model.custom;
import ru.xzeldon.chromablocks.model.ChromaBlockModel;
public class CyanChromaBlockModel extends ChromaBlockModel {
public CyanChromaBlockModel() {
super("cyan");
}
}

View File

@ -0,0 +1,9 @@
package ru.xzeldon.chromablocks.model.custom;
import ru.xzeldon.chromablocks.model.ChromaBlockModel;
public class GreenChromaBlockModel extends ChromaBlockModel {
public GreenChromaBlockModel() {
super("green");
}
}

View File

@ -0,0 +1,9 @@
package ru.xzeldon.chromablocks.model.custom;
import ru.xzeldon.chromablocks.model.ChromaBlockModel;
public class PurpleChromaBlockModel extends ChromaBlockModel {
public PurpleChromaBlockModel() {
super("purple");
}
}

View File

@ -0,0 +1,9 @@
package ru.xzeldon.chromablocks.model.custom;
import ru.xzeldon.chromablocks.model.ChromaBlockModel;
public class RedChromaBlockModel extends ChromaBlockModel {
public RedChromaBlockModel() {
super("red");
}
}

View File

@ -0,0 +1,9 @@
package ru.xzeldon.chromablocks.model.custom;
import ru.xzeldon.chromablocks.model.ChromaBlockModel;
public class WhiteChromaBlockModel extends ChromaBlockModel {
public WhiteChromaBlockModel() {
super("white");
}
}

View File

@ -0,0 +1,9 @@
package ru.xzeldon.chromablocks.model.custom;
import ru.xzeldon.chromablocks.model.ChromaBlockModel;
public class YellowChromaBlockModel extends ChromaBlockModel {
public YellowChromaBlockModel() {
super("yellow");
}
}

View File

@ -1,16 +0,0 @@
package ru.xzeldon.greenscreenmod;
import net.fabricmc.api.ModInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.xzeldon.greenscreenmod.block.GreenScreenBlocks;
public class GreenScreenMod implements ModInitializer {
public static final String MOD_ID = "greenscreenmod";
public static final Logger LOGGER = LoggerFactory.getLogger("greenscreenmod");
@Override
public void onInitialize() {
GreenScreenBlocks.registerBlocks();
}
}

View File

@ -1,39 +0,0 @@
package ru.xzeldon.greenscreenmod.block;
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.Material;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import ru.xzeldon.greenscreenmod.GreenScreenMod;
public class GreenScreenBlocks {
public static final Block GREEN_SCREEN_BLOCK = registerBlock("green_screen_block",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
), ItemGroup.MISC);
public static final Block GREEN_SCREEN_BLOCK_DIM = registerBlock("green_screen_block_dim",
new Block(FabricBlockSettings.of(Material.METAL)
.breakInstantly()
.luminance(15)
), ItemGroup.MISC);
private static Block registerBlock(String name, Block block, ItemGroup group) {
registerBlockItem(name, block, group);
return Registry.register(Registry.BLOCK, new Identifier(GreenScreenMod.MOD_ID, name), block);
}
private static Item registerBlockItem(String name, Block block, ItemGroup group) {
return Registry.register(Registry.ITEM, new Identifier(GreenScreenMod.MOD_ID, name),
new BlockItem(block, new FabricItemSettings().group(group)));
}
public static void registerBlocks() {
GreenScreenMod.LOGGER.info("Registering ModBlocks for " + GreenScreenMod.MOD_ID);
}
}

View File

@ -1,7 +0,0 @@
package ru.xzeldon.greenscreenmod.block.custom;
public class GreenScreenBlockDim extends GreenScreenBlock {
public GreenScreenBlockDim(Settings settings) {
super(settings);
}
}

View File

@ -1,34 +0,0 @@
package ru.xzeldon.greenscreenmod.model;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.model.ModelProviderContext;
import net.fabricmc.fabric.api.client.model.ModelProviderException;
import net.fabricmc.fabric.api.client.model.ModelResourceProvider;
import net.minecraft.client.render.model.UnbakedModel;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
import ru.xzeldon.greenscreenmod.GreenScreenMod;
@Environment(EnvType.CLIENT)
public class GreenScreenModelProvider implements ModelResourceProvider {
public static final Identifier GREEN_SCREEN_MODEL = new Identifier("greenscreenmod:block/green_screen_block");
public static final Identifier GREEN_SCREEN_MODEL_DIM = new Identifier("greenscreenmod:block/green_screen_block_dim");
public static final Identifier GREEN_SCREEN_MODEL_ITEM = new Identifier("greenscreenmod:item/green_screen_block");
public static final Identifier GREEN_SCREEN_MODEL_ITEM_DIM = new Identifier("greenscreenmod:item/green_screen_block_dim");
@Override
public @Nullable UnbakedModel loadModelResource(Identifier resourceId, ModelProviderContext context) throws ModelProviderException {
if (
resourceId.equals(GREEN_SCREEN_MODEL) ||
resourceId.equals(GREEN_SCREEN_MODEL_ITEM) ||
resourceId.equals(GREEN_SCREEN_MODEL_DIM) ||
resourceId.equals(GREEN_SCREEN_MODEL_ITEM_DIM)
) {
return new GreenScreenBlockModel();
} else {
return null;
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "chromablocks:block/chroma_black"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "chromablocks:block/chroma_black"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "chromablocks:block/chroma_blue"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "chromablocks:block/chroma_blue"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "chromablocks:block/chroma_cyan"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "chromablocks:block/chroma_cyan"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "chromablocks:block/chroma_green"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "chromablocks:block/chroma_green"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "chromablocks:block/chroma_purple"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "chromablocks:block/chroma_purple"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "chromablocks:block/chroma_red"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "chromablocks:block/chroma_red"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "chromablocks:block/chroma_white"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "chromablocks:block/chroma_white"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "chromablocks:block/chroma_yellow"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "chromablocks:block/chroma_yellow"
}
}
}

View File

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 162 B

View File

@ -0,0 +1,20 @@
{
"block.chromablocks.chroma_green": "Green Chroma Block",
"block.chromablocks.chroma_green_dim": "Green Chroma Block Dim",
"block.chromablocks.chroma_black": "Black Chroma Block",
"block.chromablocks.chroma_black_dim": "Black Chroma Block Dim",
"block.chromablocks.chroma_blue": "Blue Chroma Block",
"block.chromablocks.chroma_blue_dim": "Blue Chroma Block Dim",
"block.chromablocks.chroma_cyan": "Cyan Chroma Block",
"block.chromablocks.chroma_cyan_dim": "Cyan Chroma Block Dim",
"block.chromablocks.chroma_purple": "Purple Chroma Block",
"block.chromablocks.chroma_purple_dim": "Purple Chroma Block Dim",
"block.chromablocks.chroma_red": "Red Chroma Block",
"block.chromablocks.chroma_red_dim": "Red Chroma Block Dim",
"block.chromablocks.chroma_white": "White Chroma Block",
"block.chromablocks.chroma_white_dim": "White Chroma Block Dim",
"block.chromablocks.chroma_yellow": "Yellow Chroma Block",
"block.chromablocks.chroma_yellow_dim": "Yellow Chroma Block Dim",
"itemGroup.chromablocks.chroma_blocks": "Chroma blocks"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 959 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 960 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 957 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 956 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 953 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 958 B

View File

@ -1,7 +0,0 @@
{
"variants": {
"": {
"model": "greenscreenmod:block/green_screen_block"
}
}
}

View File

@ -1,7 +0,0 @@
{
"variants": {
"": {
"model": "greenscreenmod:block/green_screen_block"
}
}
}

View File

@ -1,5 +0,0 @@
{
"block.greenscreenmod.green_screen_block": "Green Screen Block",
"block.greenscreenmod.green_screen_block_dim": "Green Screen Block Dim"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

View File

@ -1,29 +1,29 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"id": "greenscreenmod", "id": "chromablocks",
"version": "${version}", "version": "${version}",
"name": "Green Screen Mod", "name": "Chroma Blocks",
"description": "This mod add green screen block to Minecraft", "description": "Chroma key in Minecraft!",
"authors": [ "authors": [
"xzeldon" "xzeldon"
], ],
"contact": { "contact": {
"homepage": "https://zeldon.ru/", "homepage": "https://zeldon.ru/",
"sources": "https://github.com/xzeldon/GreenScreenMod" "sources": "https://github.com/xzeldon/chromablocks"
}, },
"license": "MIT", "license": "MIT",
"icon": "assets/greenscreenmod/icon.png", "icon": "assets/chromablocks/icon.png",
"environment": "*", "environment": "*",
"entrypoints": { "entrypoints": {
"main": [ "main": [
"ru.xzeldon.greenscreenmod.GreenScreenMod" "ru.xzeldon.chromablocks.ChromaBlocks"
], ],
"client": [ "client": [
"ru.xzeldon.greenscreenmod.GreenScreenModClient" "ru.xzeldon.chromablocks.ChromaBlocksClient"
] ]
}, },
"mixins": [], "mixins": [],