Smaragdant crystal shards

This commit is contained in:
paulevsGitch 2021-03-08 15:39:42 +03:00
parent e12ec53c01
commit 48c21395a6
17 changed files with 166 additions and 12 deletions

View file

@ -1,5 +1,8 @@
package ru.betterend.blocks;
import java.util.Objects;
import java.util.Random;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
@ -36,9 +39,6 @@ import ru.betterend.interfaces.TeleportingEntity;
import ru.betterend.registry.EndParticles;
import ru.betterend.registry.EndPortals;
import java.util.Objects;
import java.util.Random;
public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable, IColorProvider {
public static final IntProperty PORTAL = BlockProperties.PORTAL;

View file

@ -0,0 +1,107 @@
package ru.betterend.blocks;
import java.util.EnumMap;
import com.google.common.collect.Maps;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.FluidFillable;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
import net.minecraft.block.ShapeContext;
import net.minecraft.block.Waterloggable;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import ru.betterend.blocks.basis.AttachedBlock;
import ru.betterend.client.render.ERenderLayer;
import ru.betterend.interfaces.IRenderTypeable;
public class SmaragdantCrystalShardBlock extends AttachedBlock implements IRenderTypeable, Waterloggable, FluidFillable {
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
public SmaragdantCrystalShardBlock() {
super(FabricBlockSettings.of(Material.STONE)
.materialColor(MaterialColor.GREEN)
.breakByTool(FabricToolTags.PICKAXES)
.sounds(BlockSoundGroup.GLASS)
.luminance(15)
.requiresTool()
.noCollision());
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
super.appendProperties(stateManager);
stateManager.add(WATERLOGGED);
}
@Override
public ERenderLayer getRenderLayer() {
return ERenderLayer.CUTOUT;
}
@Override
public boolean canFillWithFluid(BlockView world, BlockPos pos, BlockState state, Fluid fluid) {
return !state.get(WATERLOGGED);
}
@Override
public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) {
return !state.get(WATERLOGGED);
}
@Override
public BlockState getPlacementState(ItemPlacementContext ctx) {
BlockState state = super.getPlacementState(ctx);
if (state != null) {
WorldView worldView = ctx.getWorld();
BlockPos blockPos = ctx.getBlockPos();
boolean water = worldView.getFluidState(blockPos).getFluid() == Fluids.WATER;
return state.with(WATERLOGGED, water);
}
return null;
}
@Override
public FluidState getFluidState(BlockState state) {
return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : Fluids.EMPTY.getDefaultState();
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
return BOUNDING_SHAPES.get(state.get(FACING));
}
@Override
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
Direction direction = (Direction) state.get(FACING);
BlockPos blockPos = pos.offset(direction.getOpposite());
return world.getBlockState(blockPos).isSideSolidFullSquare(world, blockPos, direction);
}
static {
BOUNDING_SHAPES.put(Direction.UP, VoxelShapes.cuboid(0.125, 0.0, 0.125, 0.875F, 0.875F, 0.875F));
BOUNDING_SHAPES.put(Direction.DOWN, VoxelShapes.cuboid(0.125, 0.125, 0.125, 0.875F, 1.0, 0.875F));
BOUNDING_SHAPES.put(Direction.NORTH, VoxelShapes.cuboid(0.125, 0.125, 0.125, 0.875F, 0.875F, 1.0));
BOUNDING_SHAPES.put(Direction.SOUTH, VoxelShapes.cuboid(0.125, 0.125, 0.0, 0.875F, 0.875F, 0.875F));
BOUNDING_SHAPES.put(Direction.WEST, VoxelShapes.cuboid(0.125, 0.125, 0.125, 1.0, 0.875F, 0.875F));
BOUNDING_SHAPES.put(Direction.EAST, VoxelShapes.cuboid(0.0, 0.125, 0.125, 0.875F, 0.875F, 0.875F));
}
}

View file

@ -46,6 +46,7 @@ import ru.betterend.blocks.EnderBlock;
import ru.betterend.blocks.EndstoneDustBlock;
import ru.betterend.blocks.EternalPedestal;
import ru.betterend.blocks.EternalRunedFlavolite;
import ru.betterend.blocks.GlowingHymenophoreBlock;
import ru.betterend.blocks.GlowingMossBlock;
import ru.betterend.blocks.GlowingPillarLuminophorBlock;
import ru.betterend.blocks.GlowingPillarRootsBlock;
@ -70,7 +71,6 @@ import ru.betterend.blocks.MengerSpongeWetBlock;
import ru.betterend.blocks.MissingTileBlock;
import ru.betterend.blocks.MossyBoneBlock;
import ru.betterend.blocks.MossyGlowshroomCapBlock;
import ru.betterend.blocks.GlowingHymenophoreBlock;
import ru.betterend.blocks.MossyGlowshroomSaplingBlock;
import ru.betterend.blocks.MossyObsidian;
import ru.betterend.blocks.MurkweedBlock;
@ -85,6 +85,7 @@ import ru.betterend.blocks.SilkMothNestBlock;
import ru.betterend.blocks.SmallAmaranitaBlock;
import ru.betterend.blocks.SmallJellyshroomBlock;
import ru.betterend.blocks.SmaragdantCrystalBlock;
import ru.betterend.blocks.SmaragdantCrystalShardBlock;
import ru.betterend.blocks.SulphurCrystalBlock;
import ru.betterend.blocks.TenaneaFlowersBlock;
import ru.betterend.blocks.TenaneaSaplingBlock;
@ -334,6 +335,7 @@ public class EndBlocks {
public static final Block AURORA_CRYSTAL = registerBlock("aurora_crystal", new AuroraCrystalBlock());
public static final Block AMBER_BLOCK = registerBlock("amber_block", new AmberBlock());
public static final Block SMARAGDANT_CRYSTAL = registerBlock("smaragdant_crystal", new SmaragdantCrystalBlock());
public static final Block SMARAGDANT_CRYSTAL_SHARD = registerBlock("smaragdant_crystal_shard", new SmaragdantCrystalShardBlock());
public static final Block RESPAWN_OBELISK = registerBlock("respawn_obelisk", new RespawnObeliskBlock());

View file

@ -1,8 +1,10 @@
package ru.betterend.registry;
import java.io.File;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.ibm.icu.impl.UResource;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.Identifier;
@ -11,8 +13,6 @@ import ru.betterend.config.ConfigWriter;
import ru.betterend.util.JsonFactory;
import ru.betterend.util.MHelper;
import java.io.File;
public class EndPortals {
private static PortalInfo[] portals;

View file

@ -1,5 +1,7 @@
package ru.betterend.rituals;
import java.awt.Point;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.Inventory;
@ -14,8 +16,6 @@ import ru.betterend.blocks.entities.PedestalBlockEntity;
import ru.betterend.particle.InfusionParticleType;
import ru.betterend.recipe.builders.InfusionRecipe;
import java.awt.*;
public class InfusionRitual implements Inventory {
private static final Point[] PEDESTALS_MAP = new Point[] {
new Point(0, 3), new Point(2, 2), new Point(3, 0), new Point(2, -2),

View file

@ -8,11 +8,11 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockPos.Mutable;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Direction.Axis;
import net.minecraft.util.math.Direction.AxisDirection;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.BlockPos.Mutable;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;

View file

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "betterend:block/smaragdant_crystal" }
}
}

View file

@ -0,0 +1,10 @@
{
"variants": {
"facing=up": { "model": "betterend:block/smaragdant_crystal_shard" },
"facing=down": { "model": "betterend:block/smaragdant_crystal_shard", "x": 180 },
"facing=north": { "model": "betterend:block/smaragdant_crystal_shard", "x": 90 },
"facing=south": { "model": "betterend:block/smaragdant_crystal_shard", "x": 90, "y": 180 },
"facing=east": { "model": "betterend:block/smaragdant_crystal_shard", "x": 90, "y": 90 },
"facing=west": { "model": "betterend:block/smaragdant_crystal_shard", "x": 90, "y": 270 }
}
}

View file

@ -0,0 +1,3 @@
{
"defaultMaterial": "betterend:glow_all"
}

View file

@ -4,7 +4,7 @@
"down": "betterend:block/amaranita_hyphae_top",
"east": "betterend:block/amaranita_hyphae_side",
"north": "betterend:block/amaranita_hyphae_side",
"particle": "betterend:block/mossy_bone_side_ver",
"particle": "betterend:block/amaranita_hyphae_side",
"south": "betterend:block/amaranita_hyphae_side",
"up": "betterend:block/amaranita_hyphae_top",
"west": "betterend:block/amaranita_hyphae_side"

View file

@ -0,0 +1,12 @@
{
"parent": "block/cube",
"textures": {
"down": "betterend:block/smaragdant_crystal_top",
"east": "betterend:block/smaragdant_crystal_side",
"north": "betterend:block/smaragdant_crystal_side",
"particle": "betterend:block/smaragdant_crystal_side",
"south": "betterend:block/smaragdant_crystal_side",
"up": "betterend:block/smaragdant_crystal_top",
"west": "betterend:block/smaragdant_crystal_side"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/cross",
"textures": {
"cross": "betterend:block/smaragdant_crystal_shard"
}
}

View file

@ -0,0 +1,3 @@
{
"parent": "betterend:block/smaragdant_crystal"
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "betterend:block/smaragdant_crystal_shard"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B