Tube worms, floating block fixes
This commit is contained in:
parent
08e31b8743
commit
e3769bb20b
17 changed files with 413 additions and 9 deletions
|
@ -0,0 +1,59 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.FluidFillable;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.WorldView;
|
||||
|
||||
public class BlockUnderwaterWallPlant extends BlockWallPlant implements FluidFillable {
|
||||
|
||||
public BlockUnderwaterWallPlant() {
|
||||
super(FabricBlockSettings.of(Material.UNDERWATER_PLANT)
|
||||
.breakByTool(FabricToolTags.SHEARS)
|
||||
.sounds(BlockSoundGroup.WET_GRASS)
|
||||
.breakByHand(true)
|
||||
.noCollision());
|
||||
}
|
||||
|
||||
public BlockUnderwaterWallPlant(int light) {
|
||||
super(FabricBlockSettings.of(Material.UNDERWATER_PLANT)
|
||||
.breakByTool(FabricToolTags.SHEARS)
|
||||
.sounds(BlockSoundGroup.WET_GRASS)
|
||||
.luminance(light)
|
||||
.breakByHand(true)
|
||||
.noCollision());
|
||||
}
|
||||
|
||||
public BlockUnderwaterWallPlant(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFillWithFluid(BlockView world, BlockPos pos, BlockState state, Fluid fluid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return Fluids.WATER.getStill(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
|
||||
return world.getFluidState(pos).getFluid() == Fluids.WATER && super.canPlaceAt(state, world, pos);
|
||||
}
|
||||
}
|
|
@ -37,7 +37,11 @@ public class BlockWallPlant extends BlockPlant {
|
|||
public static final DirectionProperty FACING = HorizontalFacingBlock.FACING;
|
||||
|
||||
public BlockWallPlant() {
|
||||
this(0);
|
||||
this(FabricBlockSettings.of(Material.PLANT)
|
||||
.breakByTool(FabricToolTags.SHEARS)
|
||||
.sounds(BlockSoundGroup.GRASS)
|
||||
.breakByHand(true)
|
||||
.noCollision());
|
||||
}
|
||||
|
||||
public BlockWallPlant(int light) {
|
||||
|
|
|
@ -16,13 +16,18 @@ 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) {
|
||||
public ColoredMaterial(Function<FabricBlockSettings, Block> constructor, Block source, boolean craftEight) {
|
||||
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();
|
||||
if (craftEight) {
|
||||
GridRecipe.make(blockName, block).setOutputCount(8).setShape("###", "#D#", "###").addMaterial('#', source).addMaterial('D', DyeItem.byColor(color)).build();
|
||||
}
|
||||
else {
|
||||
GridRecipe.make(blockName, block).setList("#D").addMaterial('#', source).addMaterial('D', DyeItem.byColor(color)).build();
|
||||
}
|
||||
colors.put(color, block);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue