Colored lanterns

This commit is contained in:
paulevsGitch 2020-11-27 01:50:11 +03:00
parent 6564429aa1
commit 3399253010
31 changed files with 378 additions and 7 deletions

View file

@ -30,7 +30,7 @@ public class BlockBulbVineLantern extends BlockBaseNotFull implements IRenderTyp
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
public BlockBulbVineLantern() { public BlockBulbVineLantern() {
super(FabricBlockSettings.of(Material.METAL) this(FabricBlockSettings.of(Material.METAL)
.sounds(BlockSoundGroup.LANTERN) .sounds(BlockSoundGroup.LANTERN)
.hardness(1) .hardness(1)
.resistance(1) .resistance(1)
@ -40,6 +40,10 @@ public class BlockBulbVineLantern extends BlockBaseNotFull implements IRenderTyp
.luminance(15)); .luminance(15));
} }
public BlockBulbVineLantern(FabricBlockSettings settings) {
super(settings);
}
@Override @Override
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) { protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
stateManager.add(WATERLOGGED); stateManager.add(WATERLOGGED);

View file

@ -0,0 +1,54 @@
package ru.betterend.blocks;
import java.io.Reader;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.color.block.BlockColorProvider;
import net.minecraft.client.color.item.ItemColorProvider;
import net.minecraft.util.Identifier;
import ru.betterend.interfaces.IColorProvider;
import ru.betterend.patterns.BlockPatterned;
import ru.betterend.patterns.Patterns;
public class BlockBulbVineLanternColored extends BlockBulbVineLantern implements IColorProvider, BlockPatterned {
private final BlockColorProvider blockProvider;
private final ItemColorProvider itemProvider;
public BlockBulbVineLanternColored(FabricBlockSettings settings) {
super(settings);
blockProvider = (state, world, pos, tintIndex) -> {
return this.getDefaultMaterialColor().color;
};
itemProvider = (stack, tintIndex) -> {
return this.getDefaultMaterialColor().color;
};
}
@Override
public BlockColorProvider getProvider() {
return blockProvider;
}
@Override
public ItemColorProvider getItemProvider() {
return itemProvider;
}
@Override
public String getStatesPattern(Reader data) {
String path = "betterend:block/bulb_lantern_colored";
return Patterns.createJson(data, path, path);
}
@Override
public String getModelPattern(String block) {
return Patterns.createJson(Patterns.BLOCK_BULB_LANTERN_COLORED, "", "");
}
@Override
public Identifier statePatternId() {
return Patterns.STATE_DIRECT;
}
}

View file

@ -0,0 +1,33 @@
package ru.betterend.blocks.complex;
import java.util.Map;
import java.util.function.Function;
import com.google.common.collect.Maps;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.item.DyeItem;
import net.minecraft.util.DyeColor;
import net.minecraft.util.registry.Registry;
import ru.betterend.recipe.builders.GridRecipe;
import ru.betterend.registry.EndBlocks;
public class ColoredMaterial {
private final Map<DyeColor, Block> colors = Maps.newEnumMap(DyeColor.class);
public ColoredMaterial(Function<FabricBlockSettings, Block> constructor, Block source) {
String id = Registry.BLOCK.getId(source).getPath();
for (DyeColor color: DyeColor.values()) {
Block block = constructor.apply(FabricBlockSettings.copyOf(source).materialColor(color));
String blockName = id + "_" + color.getName();
EndBlocks.registerBlock(blockName, block);
GridRecipe.make(blockName, block).setList("#D").addMaterial('#', source).addMaterial('D', DyeItem.byColor(color)).build();
colors.put(color, block);
}
}
public Block getByColor(DyeColor color) {
return colors.get(color);
}
}

View file

@ -33,6 +33,7 @@ public class Patterns {
public final static Identifier STATE_BARREL = BetterEnd.makeID("patterns/blockstate/pattern_barrel.json"); public final static Identifier STATE_BARREL = BetterEnd.makeID("patterns/blockstate/pattern_barrel.json");
public final static Identifier STATE_PEDESTAL = BetterEnd.makeID("patterns/blockstate/pattern_pedestal.json"); public final static Identifier STATE_PEDESTAL = BetterEnd.makeID("patterns/blockstate/pattern_pedestal.json");
public final static Identifier STATE_STONE_LANTERN = BetterEnd.makeID("patterns/blockstate/stone_lantern.json"); public final static Identifier STATE_STONE_LANTERN = BetterEnd.makeID("patterns/blockstate/stone_lantern.json");
public final static Identifier STATE_DIRECT = BetterEnd.makeID("patterns/blockstate/pattern_direct.json");
//Models Block //Models Block
public final static Identifier BLOCK_EMPTY = BetterEnd.makeID("patterns/block/pattern_empty.json"); public final static Identifier BLOCK_EMPTY = BetterEnd.makeID("patterns/block/pattern_empty.json");
@ -74,6 +75,7 @@ public class Patterns {
public final static Identifier BLOCK_BOOKSHELF = BetterEnd.makeID("patterns/block/bookshelf.json"); public final static Identifier BLOCK_BOOKSHELF = BetterEnd.makeID("patterns/block/bookshelf.json");
public final static Identifier BLOCK_STONE_LANTERN_CEIL = BetterEnd.makeID("patterns/block/stone_lantern_ceil.json"); public final static Identifier BLOCK_STONE_LANTERN_CEIL = BetterEnd.makeID("patterns/block/stone_lantern_ceil.json");
public final static Identifier BLOCK_STONE_LANTERN_FLOOR = BetterEnd.makeID("patterns/block/stone_lantern_floor.json"); public final static Identifier BLOCK_STONE_LANTERN_FLOOR = BetterEnd.makeID("patterns/block/stone_lantern_floor.json");
public final static Identifier BLOCK_BULB_LANTERN_COLORED = BetterEnd.makeID("models/block/bulb_lantern_colored.json");
//Models Item //Models Item
public final static Identifier ITEM_WALL = BetterEnd.makeID("patterns/item/pattern_wall.json"); public final static Identifier ITEM_WALL = BetterEnd.makeID("patterns/item/pattern_wall.json");

View file

@ -113,7 +113,7 @@ public class CraftingRecipes {
GridRecipe.make("amber_gem", EndItems.AMBER_GEM).setShape("##", "##").addMaterial('#', EndItems.RAW_AMBER).build(); GridRecipe.make("amber_gem", EndItems.AMBER_GEM).setShape("##", "##").addMaterial('#', EndItems.RAW_AMBER).build();
GridRecipe.make("amber_block", EndBlocks.AMBER_BLOCK).setShape("###", "###", "###").addMaterial('#', EndItems.AMBER_GEM).build(); GridRecipe.make("amber_block", EndBlocks.AMBER_BLOCK).setShape("###", "###", "###").addMaterial('#', EndItems.AMBER_GEM).build();
GridRecipe.make("bulb_lantern", EndBlocks.BULB_VINE_LANTERN).addMaterial('C', Items.CHAIN).addMaterial('I', Items.IRON_INGOT).setShape("C", "I", "#").addMaterial('#', EndItems.GLOWING_BULB).build(); GridRecipe.make("bulb_lantern", EndBlocks.BULB_LANTERN).addMaterial('C', Items.CHAIN).addMaterial('I', Items.IRON_INGOT).setShape("C", "I", "#").addMaterial('#', EndItems.GLOWING_BULB).build();
} }
private static void registerLantern(String name, Block lantern, Block slab) { private static void registerLantern(String name, Block lantern, Block slab) {

View file

@ -17,6 +17,7 @@ import ru.betterend.blocks.BlockBlueVineSeed;
import ru.betterend.blocks.BlockBubbleCoral; import ru.betterend.blocks.BlockBubbleCoral;
import ru.betterend.blocks.BlockBulbVine; import ru.betterend.blocks.BlockBulbVine;
import ru.betterend.blocks.BlockBulbVineLantern; import ru.betterend.blocks.BlockBulbVineLantern;
import ru.betterend.blocks.BlockBulbVineLanternColored;
import ru.betterend.blocks.BlockBulbVineSeed; import ru.betterend.blocks.BlockBulbVineSeed;
import ru.betterend.blocks.BlockChorusGrass; import ru.betterend.blocks.BlockChorusGrass;
import ru.betterend.blocks.BlockDragonTreeSapling; import ru.betterend.blocks.BlockDragonTreeSapling;
@ -61,6 +62,7 @@ import ru.betterend.blocks.basis.BlockStoneLantern;
import ru.betterend.blocks.basis.BlockVine; import ru.betterend.blocks.basis.BlockVine;
import ru.betterend.blocks.basis.BlockWallMushroom; import ru.betterend.blocks.basis.BlockWallMushroom;
import ru.betterend.blocks.basis.BlockWallPlant; import ru.betterend.blocks.basis.BlockWallPlant;
import ru.betterend.blocks.complex.ColoredMaterial;
import ru.betterend.blocks.complex.StoneMaterial; import ru.betterend.blocks.complex.StoneMaterial;
import ru.betterend.blocks.complex.WoodenMaterial; import ru.betterend.blocks.complex.WoodenMaterial;
import ru.betterend.config.MainConfig; import ru.betterend.config.MainConfig;
@ -189,7 +191,9 @@ public class EndBlocks {
public static final Block PURPUR_LANTERN = registerBlock("purpur_lantern", new BlockStoneLantern(Blocks.PURPUR_BLOCK)); public static final Block PURPUR_LANTERN = registerBlock("purpur_lantern", new BlockStoneLantern(Blocks.PURPUR_BLOCK));
public static final Block END_STONE_LANTERN = registerBlock("end_stone_lantern", new BlockStoneLantern(Blocks.END_STONE)); public static final Block END_STONE_LANTERN = registerBlock("end_stone_lantern", new BlockStoneLantern(Blocks.END_STONE));
public static final Block BLACKSTONE_LANTERN = registerBlock("blackstone_lantern", new BlockStoneLantern(Blocks.BLACKSTONE)); public static final Block BLACKSTONE_LANTERN = registerBlock("blackstone_lantern", new BlockStoneLantern(Blocks.BLACKSTONE));
public static final Block BULB_VINE_LANTERN = registerBlock("bulb_vine_lantern", new BlockBulbVineLantern());
public static final Block BULB_LANTERN = registerBlock("bulb_lantern", new BlockBulbVineLantern());
public static final ColoredMaterial BULB_LANTERN_COLORED = new ColoredMaterial(BlockBulbVineLanternColored::new, BULB_LANTERN);
// Blocks With Entity // // Blocks With Entity //
public static final Block END_STONE_SMELTER = registerBlock("end_stone_smelter", new EndStoneSmelter()); public static final Block END_STONE_SMELTER = registerBlock("end_stone_smelter", new EndStoneSmelter());

View file

@ -341,7 +341,24 @@
"block.betterend.twisted_moss": "Twisted Moss", "block.betterend.twisted_moss": "Twisted Moss",
"block.betterend.bulb_vine": "Bulb Vine", "block.betterend.bulb_vine": "Bulb Vine",
"block.betterend.bulb_vine_lantern": "Bulb Vine Lantern", "block.betterend.bulb_lantern": "Bulb Lantern",
"block.betterend.bulb_vine_seed": "Bulb Vine Seed", "block.betterend.bulb_vine_seed": "Bulb Vine Seed",
"item.betterend.glowing_bulb": "Glowing Bulb" "item.betterend.glowing_bulb": "Glowing Bulb",
"block.betterend.bulb_lantern_black": "Black Bulb Lantern",
"block.betterend.bulb_lantern_blue": "Blue Bulb Lantern",
"block.betterend.bulb_lantern_brown": "Brown Bulb Lantern",
"block.betterend.bulb_lantern_cyan": "Cyan Bulb Lantern",
"block.betterend.bulb_lantern_gray": "Gray Bulb Lantern",
"block.betterend.bulb_lantern_green": "Green Bulb Lantern",
"block.betterend.bulb_lantern_light_blue": "Light Blue Bulb Lantern",
"block.betterend.bulb_lantern_light_gray": "Light Gray Bulb Lantern",
"block.betterend.bulb_lantern_lime": "Lime Bulb Lantern",
"block.betterend.bulb_lantern_magenta": "Magenta Bulb Lantern",
"block.betterend.bulb_lantern_orange": "Orange Bulb Lantern",
"block.betterend.bulb_lantern_pink": "Pink Bulb Lantern",
"block.betterend.bulb_lantern_purple": "Purple Bulb Lantern",
"block.betterend.bulb_lantern_red": "Red Bulb Lantern",
"block.betterend.bulb_lantern_white": "White Bulb Lantern",
"block.betterend.bulb_lantern_yellow": "Yellow Bulb Lantern"
} }

View file

@ -343,7 +343,24 @@
"block.betterend.twisted_moss": "Закрученный мох", "block.betterend.twisted_moss": "Закрученный мох",
"block.betterend.bulb_vine": "Луковичная лоза", "block.betterend.bulb_vine": "Луковичная лоза",
"block.betterend.bulb_vine_lantern": "Фонарь из светящейся луковицы", "block.betterend.bulb_lantern": "Луковичный фонарь",
"block.betterend.bulb_vine_seed": "Семя луковичной лозы", "block.betterend.bulb_vine_seed": "Семя луковичной лозы",
"item.betterend.glowing_bulb": "Светящаяся луковица" "item.betterend.glowing_bulb": "Светящаяся луковица",
"block.betterend.bulb_lantern_black": "Чёрный луковичный фонарь",
"block.betterend.bulb_lantern_blue": "Синий луковичный фонарь",
"block.betterend.bulb_lantern_brown": "Коричневый луковичный фонарь",
"block.betterend.bulb_lantern_cyan": "Циановый луковичный фонарь",
"block.betterend.bulb_lantern_gray": "Серый луковичный фонарь",
"block.betterend.bulb_lantern_green": "Зелёный луковичный фонарь",
"block.betterend.bulb_lantern_light_blue": "Голубой луковичный фонарь",
"block.betterend.bulb_lantern_light_gray": "Светло-серый луковичный фонарь",
"block.betterend.bulb_lantern_lime": "Лаймовый луковичный фонарь",
"block.betterend.bulb_lantern_magenta": "Фиолетовый луковичный фонарь",
"block.betterend.bulb_lantern_orange": "Оранжевый луковичный фонарь",
"block.betterend.bulb_lantern_pink": "Розовый луковичный фонарь",
"block.betterend.bulb_lantern_purple": "Пурпурный луковичный фонарь",
"block.betterend.bulb_lantern_red": "Красный луковичный фонарь",
"block.betterend.bulb_lantern_white": "Белый луковичный фонарь",
"block.betterend.bulb_lantern_yellow": "Жёлтый луковичный фонарь"
} }

View file

@ -0,0 +1,10 @@
{
"defaultMap": {
"spriteMap": [
{
"sprite": "betterend:block/bulb_vine_lantern_overlay",
"material": "betterend:glow_all"
}
]
}
}

View file

@ -0,0 +1,10 @@
{
"defaultMap": {
"spriteMap": [
{
"sprite": "betterend:block/bulb_vine_lantern_overlay",
"material": "betterend:glow_all"
}
]
}
}

View file

@ -0,0 +1,10 @@
{
"defaultMap": {
"spriteMap": [
{
"sprite": "betterend:block/bulb_vine_lantern_overlay",
"material": "betterend:glow_all"
}
]
}
}

View file

@ -0,0 +1,10 @@
{
"defaultMap": {
"spriteMap": [
{
"sprite": "betterend:block/bulb_vine_lantern_overlay",
"material": "betterend:glow_all"
}
]
}
}

View file

@ -0,0 +1,10 @@
{
"defaultMap": {
"spriteMap": [
{
"sprite": "betterend:block/bulb_vine_lantern_overlay",
"material": "betterend:glow_all"
}
]
}
}

View file

@ -0,0 +1,10 @@
{
"defaultMap": {
"spriteMap": [
{
"sprite": "betterend:block/bulb_vine_lantern_overlay",
"material": "betterend:glow_all"
}
]
}
}

View file

@ -0,0 +1,10 @@
{
"defaultMap": {
"spriteMap": [
{
"sprite": "betterend:block/bulb_vine_lantern_overlay",
"material": "betterend:glow_all"
}
]
}
}

View file

@ -0,0 +1,10 @@
{
"defaultMap": {
"spriteMap": [
{
"sprite": "betterend:block/bulb_vine_lantern_overlay",
"material": "betterend:glow_all"
}
]
}
}

View file

@ -0,0 +1,10 @@
{
"defaultMap": {
"spriteMap": [
{
"sprite": "betterend:block/bulb_vine_lantern_overlay",
"material": "betterend:glow_all"
}
]
}
}

View file

@ -0,0 +1,10 @@
{
"defaultMap": {
"spriteMap": [
{
"sprite": "betterend:block/bulb_vine_lantern_overlay",
"material": "betterend:glow_all"
}
]
}
}

View file

@ -0,0 +1,10 @@
{
"defaultMap": {
"spriteMap": [
{
"sprite": "betterend:block/bulb_vine_lantern_overlay",
"material": "betterend:glow_all"
}
]
}
}

View file

@ -0,0 +1,10 @@
{
"defaultMap": {
"spriteMap": [
{
"sprite": "betterend:block/bulb_vine_lantern_overlay",
"material": "betterend:glow_all"
}
]
}
}

View file

@ -0,0 +1,10 @@
{
"defaultMap": {
"spriteMap": [
{
"sprite": "betterend:block/bulb_vine_lantern_overlay",
"material": "betterend:glow_all"
}
]
}
}

View file

@ -0,0 +1,10 @@
{
"defaultMap": {
"spriteMap": [
{
"sprite": "betterend:block/bulb_vine_lantern_overlay",
"material": "betterend:glow_all"
}
]
}
}

View file

@ -0,0 +1,10 @@
{
"defaultMap": {
"spriteMap": [
{
"sprite": "betterend:block/bulb_vine_lantern_overlay",
"material": "betterend:glow_all"
}
]
}
}

View file

@ -0,0 +1,10 @@
{
"defaultMap": {
"spriteMap": [
{
"sprite": "betterend:block/bulb_vine_lantern_overlay",
"material": "betterend:glow_all"
}
]
}
}

View file

@ -0,0 +1,73 @@
{
"__comment": "Designed by Paulevs with Cubik Studio - https://cubik.studio",
"parent": "block/block",
"textures": {
"overlay": "betterend:block/bulb_vine_lantern_overlay",
"metal": "betterend:block/bulb_vine_lantern_metal",
"particle": "#overlay"
},
"elements": [
{
"__comment": "Box1",
"from": [ 4, 4, 4 ],
"to": [ 12, 12, 12 ],
"shade": false,
"faces": {
"down": { "uv": [ 8, 0, 16, 8 ], "texture": "#metal" },
"up": { "uv": [ 0, 0, 8, 8 ], "texture": "#metal" },
"north": { "uv": [ 0, 8, 8, 16 ], "texture": "#metal" },
"south": { "uv": [ 0, 8, 8, 16 ], "texture": "#metal" },
"west": { "uv": [ 0, 8, 8, 16 ], "texture": "#metal" },
"east": { "uv": [ 0, 8, 8, 16 ], "texture": "#metal" }
}
},
{
"__comment": "Box1",
"from": [ 4, 4, 4 ],
"to": [ 12, 12, 12 ],
"shade": false,
"faces": {
"down": { "uv": [ 8, 0, 16, 8 ], "texture": "#overlay", "tintindex": 0 },
"up": { "uv": [ 0, 0, 8, 8 ], "texture": "#overlay", "tintindex": 0 },
"north": { "uv": [ 0, 8, 8, 16 ], "texture": "#overlay", "tintindex": 0 },
"south": { "uv": [ 0, 8, 8, 16 ], "texture": "#overlay", "tintindex": 0 },
"west": { "uv": [ 0, 8, 8, 16 ], "texture": "#overlay", "tintindex": 0 },
"east": { "uv": [ 0, 8, 8, 16 ], "texture": "#overlay", "tintindex": 0 }
}
},
{
"__comment": "Box11",
"from": [ 6, 12, 6 ],
"to": [ 10, 13, 10 ],
"faces": {
"up": { "uv": [ 10, 8, 14, 12 ], "texture": "#metal" },
"north": { "uv": [ 10, 12, 14, 13 ], "texture": "#metal" },
"south": { "uv": [ 10, 12, 14, 13 ], "texture": "#metal" },
"west": { "uv": [ 10, 12, 14, 13 ], "texture": "#metal" },
"east": { "uv": [ 10, 12, 14, 13 ], "texture": "#metal" }
}
},
{
"__comment": "PlaneX15",
"from": [ 7, 13, 7 ],
"to": [ 7.001, 16, 10 ],
"rotation": { "origin": [ 7, 13, 7 ], "axis": "y", "angle": 45 },
"shade": false,
"faces": {
"west": { "uv": [ 10, 13, 13, 16 ], "texture": "#metal" },
"east": { "uv": [ 10, 13, 13, 16 ], "texture": "#metal" }
}
},
{
"__comment": "PlaneX15",
"from": [ 9, 13, 7 ],
"to": [ 9.001, 16, 10 ],
"rotation": { "origin": [ 9, 13, 7 ], "axis": "y", "angle": -45 },
"shade": false,
"faces": {
"west": { "uv": [ 10, 13, 13, 16 ], "texture": "#metal" },
"east": { "uv": [ 10, 13, 13, 16 ], "texture": "#metal" }
}
}
]
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "%block%"
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB