nether altar, part 1

This commit is contained in:
Ellpeck 2020-02-25 20:07:26 +01:00
parent 438606d8fd
commit 5be58608b6
15 changed files with 131 additions and 14 deletions

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "naturesaura:block/gold_nether_brick"
}
}
}

View file

@ -1,7 +0,0 @@
{
"variants": {
"": {
"model": "naturesaura:block/nature_altar"
}
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "naturesaura:block/gold_nether_brick"
}
}

View file

@ -0,0 +1,3 @@
{
"parent": "naturesaura:block/gold_nether_brick"
}

View file

@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:gold_nether_brick"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -1,17 +1,23 @@
package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import de.ellpeck.naturesaura.reg.ITESRProvider;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
@ -25,12 +31,14 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import javax.annotation.Nullable;
import java.util.function.Function;
import java.util.function.Supplier;
public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvider<TileEntityNatureAltar>, ICustomBlockState {
private static final VoxelShape SHAPE = VoxelShapes.create(0, 0, 0, 1, 12 / 16F, 1);
public static final BooleanProperty NETHER = BooleanProperty.create("nether");
public BlockNatureAltar() {
super("nature_altar", TileEntityNatureAltar::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(4F).harvestLevel(1).harvestTool(ToolType.PICKAXE));
@ -58,6 +66,19 @@ public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvide
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName())));
// noop
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder);
builder.add(NETHER);
}
@Nullable
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
boolean nether = IAuraType.forWorld(context.getWorld()).isSimilar(NaturesAuraAPI.TYPE_NETHER);
return super.getStateForPlacement(context).with(NETHER, nether);
}
}

View file

@ -45,6 +45,7 @@ public final class ModBlocks {
public static Block ANIMAL_SPAWNER;
public static Block AUTO_CRAFTER;
public static Block GOLD_BRICK;
public static Block GOLD_NETHER_BRICK;
public static Block RF_CONVERTER;
public static Block MOSS_GENERATOR;
public static Block TIME_CHANGER;

View file

@ -15,19 +15,29 @@ import net.minecraft.util.ResourceLocation;
public final class Multiblocks {
private static final String[][] ALTAR_PATTERN = new String[][]{
{" M ", " ", " ", " ", "M M", " ", " ", " ", " M "},
{" B ", " ", " ", " ", "B B", " ", " ", " ", " B "},
{" B ", " ", " M M ", " ", "B 0 B", " ", " M M ", " ", " B "},
{" ", " WBW ", " WBW ", " WWCWCWW ", " BBW WBB ", " WWCWCWW ", " WBW ", " WBW ", " "}};
public static final IMultiblock ALTAR = NaturesAuraAPI.instance().createMultiblock(
new ResourceLocation(NaturesAura.MOD_ID, "altar"),
new String[][]{
{" M ", " ", " ", " ", "M M", " ", " ", " ", " M "},
{" B ", " ", " ", " ", "B B", " ", " ", " ", " B "},
{" B ", " ", " M M ", " ", "B 0 B", " ", " M M ", " ", " B "},
{" ", " WBW ", " WBW ", " WWCWCWW ", " BBW WBB ", " WWCWCWW ", " WBW ", " WBW ", " "}},
ALTAR_PATTERN,
'C', Blocks.CHISELED_STONE_BRICKS,
'B', Blocks.STONE_BRICKS,
'W', Matcher.tag(Blocks.OAK_PLANKS, BlockTags.PLANKS),
'M', ModBlocks.GOLD_BRICK,
'0', ModBlocks.NATURE_ALTAR,
' ', Matcher.wildcard());
public static final IMultiblock NETHER_ALTAR = NaturesAuraAPI.instance().createMultiblock(
new ResourceLocation(NaturesAura.MOD_ID, "nether_altar"),
ALTAR_PATTERN,
'C', Blocks.RED_NETHER_BRICKS,
'B', Blocks.NETHER_BRICKS,
'W', Blocks.NETHER_WART_BLOCK,
'M', ModBlocks.GOLD_NETHER_BRICK,
'0', ModBlocks.NATURE_ALTAR,
' ', Matcher.wildcard());
public static final IMultiblock TREE_RITUAL = NaturesAuraAPI.instance().createMultiblock(
new ResourceLocation(NaturesAura.MOD_ID, "tree_ritual"),
new String[][]{

View file

@ -109,7 +109,8 @@ public final class ModRegistry {
new BlockGratedChute(),
new BlockAnimalSpawner(),
new BlockAutoCrafter(),
new BlockImpl("gold_brick", ModBlocks.prop(Material.ROCK).sound(SoundType.STONE).hardnessAndResistance(2F)),
new BlockImpl("gold_brick", ModBlocks.prop(Blocks.STONE_BRICKS)),
new BlockImpl("gold_nether_brick", ModBlocks.prop(Blocks.NETHER_BRICKS)),
new BlockMossGenerator(),
new BlockTimeChanger(),
new BlockGeneratorLimitRemover(),

View file

@ -0,0 +1,10 @@
{
"variants": {
"nether=false": {
"model": "naturesaura:block/nature_altar"
},
"nether=true": {
"model": "naturesaura:block/nature_altar_nether"
}
}
}

View file

@ -41,6 +41,7 @@
"block.naturesaura.animal_spawner": "Altar of Birthing",
"block.naturesaura.auto_crafter": "Automatic Constructor",
"block.naturesaura.gold_brick": "Golden Stone Bricks",
"block.naturesaura.gold_nether_brick": "Golden Nether Bricks",
"block.naturesaura.rf_converter": "Energetic Aura Forge",
"block.naturesaura.moss_generator": "Swamp Homi",
"block.naturesaura.time_changer": "Shifting Sundial",

View file

@ -0,0 +1,45 @@
{
"parent": "minecraft:block/block",
"textures": {
"texture": "naturesaura:block/nature_altar_nether",
"top": "naturesaura:block/nature_altar_nether_top",
"particle": "#top"
},
"elements": [
{
"from": [0, 0, 0],
"to": [16, 12, 16],
"faces": {
"down": {
"uv": [0, 0, 16, 16],
"texture": "#top",
"cullface": "down"
},
"up": {
"uv": [0, 0, 16, 16],
"texture": "#top"
},
"north": {
"uv": [0, 4, 16, 16],
"texture": "#texture",
"cullface": "north"
},
"south": {
"uv": [0, 4, 16, 16],
"texture": "#texture",
"cullface": "south"
},
"west": {
"uv": [0, 4, 16, 16],
"texture": "#texture",
"cullface": "west"
},
"east": {
"uv": [0, 4, 16, 16],
"texture": "#texture",
"cullface": "east"
}
}
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B