Code style changes, entities fixes
This commit is contained in:
parent
9d604b2d25
commit
44962e18b6
377 changed files with 5038 additions and 4914 deletions
|
@ -1,12 +1,7 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
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.core.BlockPos;
|
||||
|
@ -41,12 +36,16 @@ import ru.bclib.util.MHelper;
|
|||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndItems;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class SulphurCrystalBlock extends BaseAttachedBlock implements IRenderTyped, SimpleWaterloggedBlock, LiquidBlockContainer {
|
||||
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
|
||||
public static final IntegerProperty AGE = IntegerProperty.create("age", 0, 2);
|
||||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||
|
||||
|
||||
public SulphurCrystalBlock() {
|
||||
super(FabricBlockSettings.of(Material.STONE)
|
||||
.materialColor(MaterialColor.COLOR_YELLOW)
|
||||
|
@ -55,23 +54,23 @@ public class SulphurCrystalBlock extends BaseAttachedBlock implements IRenderTyp
|
|||
.requiresCorrectToolForDrops()
|
||||
.noCollission());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> stateManager) {
|
||||
super.createBlockStateDefinition(stateManager);
|
||||
stateManager.add(AGE, WATERLOGGED);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BCLRenderLayer getRenderLayer() {
|
||||
return BCLRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return state.getValue(AGE) < 2 ? Collections.emptyList() : Lists.newArrayList(new ItemStack(EndItems.CRYSTALLINE_SULPHUR, MHelper.randRange(1, 3, MHelper.RANDOM)));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canPlaceLiquid(BlockGetter world, BlockPos pos, BlockState state, Fluid fluid) {
|
||||
return !state.getValue(WATERLOGGED);
|
||||
|
@ -81,7 +80,7 @@ public class SulphurCrystalBlock extends BaseAttachedBlock implements IRenderTyp
|
|||
public boolean placeLiquid(LevelAccessor world, BlockPos pos, BlockState state, FluidState fluidState) {
|
||||
return !state.getValue(WATERLOGGED);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
|
||||
BlockState state = super.getStateForPlacement(ctx);
|
||||
|
@ -93,24 +92,24 @@ public class SulphurCrystalBlock extends BaseAttachedBlock implements IRenderTyp
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : Fluids.EMPTY.defaultFluidState();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
return BOUNDING_SHAPES.get(state.getValue(FACING));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
|
||||
Direction direction = state.getValue(FACING);
|
||||
BlockPos blockPos = pos.relative(direction.getOpposite());
|
||||
return world.getBlockState(blockPos).is(EndBlocks.BRIMSTONE);
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
BOUNDING_SHAPES.put(Direction.UP, Shapes.box(0.125, 0.0, 0.125, 0.875F, 0.5, 0.875F));
|
||||
BOUNDING_SHAPES.put(Direction.DOWN, Shapes.box(0.125, 0.5, 0.125, 0.875F, 1.0, 0.875F));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue