Update to BCLib 0.3.0

This commit is contained in:
paulevsGitch 2021-07-20 00:39:58 +03:00
parent 1a52251af0
commit b2431153dc
294 changed files with 7484 additions and 1440 deletions

View file

@ -13,6 +13,6 @@ archives_base_name=better-end
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
patchouli_version = 55-FABRIC-SNAPSHOT
fabric_version = 0.36.1+1.17
bclib_version = 0.2.4
bclib_version = 0.3.0
rei_version = 6.0.264-alpha
canvas_version = 1.0.+

View file

@ -58,7 +58,9 @@ public class BetterEnd implements ModInitializer {
BonemealPlants.init();
GeneratorOptions.init();
LootTableUtil.init();
FabricLoader.getInstance().getEntrypoints("betterend", BetterEndPlugin.class).forEach(BetterEndPlugin::register);
FabricLoader.getInstance()
.getEntrypoints("betterend", BetterEndPlugin.class)
.forEach(BetterEndPlugin::register);
Integrations.init();
Configs.saveConfigs();
}

View file

@ -14,7 +14,11 @@ import ru.bclib.blocks.BaseBlock;
public class AeterniumBlock extends BaseBlock {
public AeterniumBlock() {
super(FabricBlockSettings.of(Material.METAL, MaterialColor.COLOR_GRAY).hardness(65F).resistance(1200F).requiresCorrectToolForDrops().sound(SoundType.NETHERITE_BLOCK));
super(FabricBlockSettings.of(Material.METAL, MaterialColor.COLOR_GRAY)
.hardness(65F)
.resistance(1200F)
.requiresCorrectToolForDrops()
.sound(SoundType.NETHERITE_BLOCK));
}
@Environment(EnvType.CLIENT)

View file

@ -6,9 +6,9 @@ import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.material.Material;
import ru.bclib.blocks.BaseBlock;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.RenderLayerProvider;
public class AmaranitaHymenophoreBlock extends BaseBlock implements IRenderTyped {
public class AmaranitaHymenophoreBlock extends BaseBlock implements RenderLayerProvider {
public AmaranitaHymenophoreBlock() {
super(FabricBlockSettings.of(Material.WOOD).breakByTool(FabricToolTags.AXES).sound(SoundType.WOOD));
}

View file

@ -3,22 +3,16 @@ package ru.betterend.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.Vec3;
import ru.bclib.blocks.BaseBlock;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper;
@ -62,7 +56,17 @@ public class AncientEmeraldIceBlock extends BaseBlock {
}
private void makeParticles(ServerLevel world, BlockPos pos, Random random) {
world.sendParticles(EndParticles.SNOWFLAKE, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 20, 0.5, 0.5, 0.5, 0);
world.sendParticles(
EndParticles.SNOWFLAKE,
pos.getX() + 0.5,
pos.getY() + 0.5,
pos.getZ() + 0.5,
20,
0.5,
0.5,
0.5,
0
);
}
@Override

View file

@ -19,21 +19,29 @@ import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import ru.bclib.api.TagAPI;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IColorProvider;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.CustomColorProvider;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.ColorUtil;
import ru.bclib.util.MHelper;
import ru.betterend.registry.EndItems;
import java.util.List;
public class AuroraCrystalBlock extends AbstractGlassBlock implements IRenderTyped, IColorProvider {
public class AuroraCrystalBlock extends AbstractGlassBlock implements RenderLayerProvider, CustomColorProvider {
public static final Vec3i[] COLORS;
private static final int MIN_DROP = 1;
private static final int MAX_DROP = 4;
public AuroraCrystalBlock() {
super(FabricBlockSettings.of(Material.GLASS).breakByTool(FabricToolTags.PICKAXES).breakByTool(TagAPI.HAMMERS).hardness(1F).resistance(1F).luminance(15).noOcclusion().isSuffocating((state, world, pos) -> false).sound(SoundType.GLASS));
super(FabricBlockSettings.of(Material.GLASS)
.breakByTool(FabricToolTags.PICKAXES)
.breakByTool(TagAPI.HAMMERS)
.hardness(1F)
.resistance(1F)
.luminance(15)
.noOcclusion()
.isSuffocating((state, world, pos) -> false)
.sound(SoundType.GLASS));
}
@Override
@ -101,6 +109,11 @@ public class AuroraCrystalBlock extends AbstractGlassBlock implements IRenderTyp
}
static {
COLORS = new Vec3i[]{new Vec3i(247, 77, 161), new Vec3i(120, 184, 255), new Vec3i(120, 255, 168), new Vec3i(243, 58, 255)};
COLORS = new Vec3i[] {
new Vec3i(247, 77, 161),
new Vec3i(120, 184, 255),
new Vec3i(120, 255, 168),
new Vec3i(243, 58, 255)
};
}
}

View file

@ -21,7 +21,10 @@ public class BlueVineLanternBlock extends BaseBlock {
public static final BooleanProperty NATURAL = BlockProperties.NATURAL;
public BlueVineLanternBlock() {
super(FabricBlockSettings.of(Material.WOOD).breakByTool(FabricToolTags.AXES).luminance(15).sound(SoundType.WART_BLOCK));
super(FabricBlockSettings.of(Material.WOOD)
.breakByTool(FabricToolTags.AXES)
.luminance(15)
.sound(SoundType.WART_BLOCK));
this.registerDefaultState(this.stateDefinition.any().setValue(NATURAL, false));
}

View file

@ -22,24 +22,51 @@ public class BlueVineSeedBlock extends EndPlantWithAgeBlock {
if (h < height + 1) {
return;
}
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.BLUE_VINE.defaultBlockState().setValue(BlockProperties.TRIPLE_SHAPE, BlockProperties.TripleShape.BOTTOM));
BlocksHelper.setWithoutUpdate(
world,
pos,
EndBlocks.BLUE_VINE.defaultBlockState()
.setValue(BlockProperties.TRIPLE_SHAPE, BlockProperties.TripleShape.BOTTOM)
);
for (int i = 1; i < height; i++) {
BlocksHelper.setWithoutUpdate(world, pos.above(i), EndBlocks.BLUE_VINE.defaultBlockState().setValue(BlockProperties.TRIPLE_SHAPE, BlockProperties.TripleShape.MIDDLE));
BlocksHelper.setWithoutUpdate(
world,
pos.above(i),
EndBlocks.BLUE_VINE.defaultBlockState()
.setValue(BlockProperties.TRIPLE_SHAPE, BlockProperties.TripleShape.MIDDLE)
);
}
BlocksHelper.setWithoutUpdate(world, pos.above(height), EndBlocks.BLUE_VINE.defaultBlockState().setValue(BlockProperties.TRIPLE_SHAPE, BlockProperties.TripleShape.TOP));
BlocksHelper.setWithoutUpdate(
world,
pos.above(height),
EndBlocks.BLUE_VINE.defaultBlockState()
.setValue(BlockProperties.TRIPLE_SHAPE, BlockProperties.TripleShape.TOP)
);
placeLantern(world, pos.above(height + 1));
}
private void placeLantern(WorldGenLevel world, BlockPos pos) {
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.BLUE_VINE_LANTERN.defaultBlockState().setValue(BlueVineLanternBlock.NATURAL, true));
BlocksHelper.setWithoutUpdate(
world,
pos,
EndBlocks.BLUE_VINE_LANTERN.defaultBlockState().setValue(BlueVineLanternBlock.NATURAL, true)
);
for (Direction dir : BlocksHelper.HORIZONTAL) {
BlockPos p = pos.relative(dir);
if (world.isEmptyBlock(p)) {
BlocksHelper.setWithoutUpdate(world, p, EndBlocks.BLUE_VINE_FUR.defaultBlockState().setValue(FurBlock.FACING, dir));
BlocksHelper.setWithoutUpdate(
world,
p,
EndBlocks.BLUE_VINE_FUR.defaultBlockState().setValue(FurBlock.FACING, dir)
);
}
}
if (world.isEmptyBlock(pos.above())) {
BlocksHelper.setWithoutUpdate(world, pos.above(), EndBlocks.BLUE_VINE_FUR.defaultBlockState().setValue(FurBlock.FACING, Direction.UP));
BlocksHelper.setWithoutUpdate(
world,
pos.above(),
EndBlocks.BLUE_VINE_FUR.defaultBlockState().setValue(FurBlock.FACING, Direction.UP)
);
}
}

View file

@ -87,7 +87,10 @@ public class BrimstoneBlock extends BaseBlock {
}
}
else if (sideState.getFluidState().getType() == Fluids.WATER) {
BlockState crystal = EndBlocks.SULPHUR_CRYSTAL.defaultBlockState().setValue(SulphurCrystalBlock.FACING, dir).setValue(SulphurCrystalBlock.WATERLOGGED, true).setValue(SulphurCrystalBlock.AGE, 0);
BlockState crystal = EndBlocks.SULPHUR_CRYSTAL.defaultBlockState()
.setValue(SulphurCrystalBlock.FACING, dir)
.setValue(SulphurCrystalBlock.WATERLOGGED, true)
.setValue(SulphurCrystalBlock.AGE, 0);
world.setBlockAndUpdate(side, crystal);
}
}

View file

@ -24,7 +24,11 @@ public class BubbleCoralBlock extends EndUnderwaterPlantBlock {
private static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 14, 16);
public BubbleCoralBlock() {
super(FabricBlockSettings.of(Material.WATER_PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).sound(SoundType.CORAL_BLOCK).noCollission());
super(FabricBlockSettings.of(Material.WATER_PLANT)
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.CORAL_BLOCK)
.noCollission());
}
@Override

View file

@ -41,6 +41,7 @@ public class BulbVineBlock extends BaseVineBlock {
@Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
boolean canPlace = super.canSurvive(state, world, pos);
return (state.is(this) && state.getValue(SHAPE) == TripleShape.BOTTOM) ? canPlace : canPlace && world.getBlockState(pos.below()).is(this);
return (state.is(this) && state.getValue(SHAPE) == TripleShape.BOTTOM) ? canPlace : canPlace && world.getBlockState(
pos.below()).is(this);
}
}

View file

@ -17,22 +17,29 @@ import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.BlockModelProvider;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.betterend.blocks.basis.EndLanternBlock;
import ru.betterend.client.models.Patterns;
import java.util.Map;
import java.util.Optional;
public class BulbVineLanternBlock extends EndLanternBlock implements IRenderTyped, BlockModelProvider {
public class BulbVineLanternBlock extends EndLanternBlock implements RenderLayerProvider, BlockModelProvider {
private static final VoxelShape SHAPE_CEIL = Block.box(4, 4, 4, 12, 16, 12);
private static final VoxelShape SHAPE_FLOOR = Block.box(4, 0, 4, 12, 12, 12);
public BulbVineLanternBlock() {
this(FabricBlockSettings.of(Material.METAL).hardness(1).resistance(1).breakByTool(FabricToolTags.PICKAXES).materialColor(MaterialColor.COLOR_LIGHT_GRAY).luminance(15).requiresCorrectToolForDrops().sound(SoundType.LANTERN));
this(FabricBlockSettings.of(Material.METAL)
.hardness(1)
.resistance(1)
.breakByTool(FabricToolTags.PICKAXES)
.materialColor(MaterialColor.COLOR_LIGHT_GRAY)
.luminance(15)
.requiresCorrectToolForDrops()
.sound(SoundType.LANTERN));
}
public BulbVineLanternBlock(Properties settings) {
@ -55,7 +62,10 @@ public class BulbVineLanternBlock extends EndLanternBlock implements IRenderType
Map<String, String> textures = Maps.newHashMap();
textures.put("%glow%", getGlowTexture());
textures.put("%metal%", getMetalTexture(resourceLocation));
Optional<String> pattern = blockState.getValue(IS_FLOOR) ? Patterns.createJson(Patterns.BLOCK_BULB_LANTERN_FLOOR, textures) : Patterns.createJson(Patterns.BLOCK_BULB_LANTERN_CEIL, textures);
Optional<String> pattern = blockState.getValue(IS_FLOOR) ? Patterns.createJson(
Patterns.BLOCK_BULB_LANTERN_FLOOR,
textures
) : Patterns.createJson(Patterns.BLOCK_BULB_LANTERN_CEIL, textures);
return ModelsHelper.fromPattern(pattern);
}

View file

@ -3,11 +3,11 @@ package ru.betterend.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.color.block.BlockColor;
import net.minecraft.client.color.item.ItemColor;
import ru.bclib.interfaces.IColorProvider;
import ru.bclib.interfaces.CustomColorProvider;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.ColorUtil;
public class BulbVineLanternColoredBlock extends BulbVineLanternBlock implements IColorProvider {
public class BulbVineLanternColoredBlock extends BulbVineLanternBlock implements CustomColorProvider {
public BulbVineLanternColoredBlock(FabricBlockSettings settings) {
super(settings);
}

View file

@ -26,11 +26,23 @@ public class BulbVineSeedBlock extends EndPlantWithAgeBlock {
public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {
int h = BlocksHelper.downRay(world, pos, random.nextInt(24)) - 1;
if (h > 2) {
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.BULB_VINE.defaultBlockState().setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.TOP));
BlocksHelper.setWithoutUpdate(
world,
pos,
EndBlocks.BULB_VINE.defaultBlockState().setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.TOP)
);
for (int i = 1; i < h; i++) {
BlocksHelper.setWithoutUpdate(world, pos.below(i), EndBlocks.BULB_VINE.defaultBlockState().setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.MIDDLE));
BlocksHelper.setWithoutUpdate(
world,
pos.below(i),
EndBlocks.BULB_VINE.defaultBlockState().setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.MIDDLE)
);
}
BlocksHelper.setWithoutUpdate(world, pos.below(h), EndBlocks.BULB_VINE.defaultBlockState().setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.BOTTOM));
BlocksHelper.setWithoutUpdate(
world,
pos.below(h),
EndBlocks.BULB_VINE.defaultBlockState().setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.BOTTOM)
);
}
}
}

View file

@ -16,13 +16,13 @@ import net.minecraft.world.phys.shapes.VoxelShape;
import ru.bclib.blocks.BaseBlockNotFull;
import ru.bclib.blocks.BlockProperties;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.betterend.registry.EndBlocks;
import java.util.Collections;
import java.util.List;
public class CavePumpkinBlock extends BaseBlockNotFull implements IRenderTyped {
public class CavePumpkinBlock extends BaseBlockNotFull implements RenderLayerProvider {
public static final BooleanProperty SMALL = BlockProperties.SMALL;
private static final VoxelShape SHAPE_SMALL;
private static final VoxelShape SHAPE_BIG;
@ -49,7 +49,8 @@ public class CavePumpkinBlock extends BaseBlockNotFull implements IRenderTyped {
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
return state.getValue(SMALL) ? Collections.singletonList(new ItemStack(EndBlocks.CAVE_PUMPKIN_SEED)) : Collections.singletonList(new ItemStack(this));
return state.getValue(SMALL) ? Collections.singletonList(new ItemStack(EndBlocks.CAVE_PUMPKIN_SEED)) : Collections
.singletonList(new ItemStack(this));
}
static {

View file

@ -31,12 +31,16 @@ public class CavePumpkinVineBlock extends EndPlantWithAgeBlock {
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
int age = state.getValue(AGE);
BlockState down = world.getBlockState(pos.below());
if (down.getMaterial().isReplaceable() || (down.is(EndBlocks.CAVE_PUMPKIN) && down.getValue(BlockProperties.SMALL))) {
if (down.getMaterial()
.isReplaceable() || (down.is(EndBlocks.CAVE_PUMPKIN) && down.getValue(BlockProperties.SMALL))) {
if (age < 3) {
world.setBlockAndUpdate(pos, state.setValue(AGE, age + 1));
}
if (age == 2) {
world.setBlockAndUpdate(pos.below(), EndBlocks.CAVE_PUMPKIN.defaultBlockState().setValue(BlockProperties.SMALL, true));
world.setBlockAndUpdate(
pos.below(),
EndBlocks.CAVE_PUMPKIN.defaultBlockState().setValue(BlockProperties.SMALL, true)
);
}
else if (age == 3) {
world.setBlockAndUpdate(pos.below(), EndBlocks.CAVE_PUMPKIN.defaultBlockState());

View file

@ -18,21 +18,25 @@ import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;
import ru.bclib.blocks.BaseAttachedBlock;
import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.BlockModelProvider;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.betterend.client.models.Patterns;
import java.util.EnumMap;
import java.util.Map;
import java.util.Optional;
public class ChandelierBlock extends BaseAttachedBlock implements IRenderTyped, BlockModelProvider {
public class ChandelierBlock extends BaseAttachedBlock implements RenderLayerProvider, BlockModelProvider {
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
public ChandelierBlock(Block source) {
super(FabricBlockSettings.copyOf(source).luminance(15).noCollission().noOcclusion().requiresCorrectToolForDrops());
super(FabricBlockSettings.copyOf(source)
.luminance(15)
.noCollission()
.noOcclusion()
.requiresCorrectToolForDrops());
}
@Override

View file

@ -10,12 +10,12 @@ import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import ru.bclib.blocks.BaseBlock;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.RenderLayerProvider;
import java.util.Collections;
import java.util.List;
public class DenseEmeraldIceBlock extends BaseBlock implements IRenderTyped {
public class DenseEmeraldIceBlock extends BaseBlock implements RenderLayerProvider {
public DenseEmeraldIceBlock() {
super(FabricBlockSettings.copyOf(Blocks.PACKED_ICE));
}

View file

@ -5,7 +5,6 @@ import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;

View file

@ -21,15 +21,15 @@ import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.BlockModelProvider;
import ru.bclib.interfaces.RenderLayerProvider;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class EmeraldIceBlock extends HalfTransparentBlock implements IRenderTyped, BlockModelProvider {
public class EmeraldIceBlock extends HalfTransparentBlock implements RenderLayerProvider, BlockModelProvider {
public EmeraldIceBlock() {
super(FabricBlockSettings.copyOf(Blocks.ICE));
}

View file

@ -19,7 +19,8 @@ public class EndBlockProperties extends BlockProperties {
public static final BooleanProperty HAS_ITEM = BooleanProperty.create("has_item");
public enum PedestalState implements StringRepresentable {
PEDESTAL_TOP("pedestal_top"), COLUMN_TOP("column_top"), BOTTOM("bottom"), PILLAR("pillar"), COLUMN("column"), DEFAULT("default");
PEDESTAL_TOP("pedestal_top"), COLUMN_TOP("column_top"), BOTTOM("bottom"), PILLAR("pillar"), COLUMN("column"), DEFAULT(
"default");
private final String name;
@ -39,7 +40,10 @@ public class EndBlockProperties extends BlockProperties {
}
public enum HydraluxShape implements StringRepresentable {
FLOWER_BIG_BOTTOM("flower_big_bottom", true), FLOWER_BIG_TOP("flower_big_top", true), FLOWER_SMALL_BOTTOM("flower_small_bottom", true), FLOWER_SMALL_TOP("flower_small_top", true), VINE("vine", false), ROOTS("roots", false);
FLOWER_BIG_BOTTOM("flower_big_bottom", true), FLOWER_BIG_TOP("flower_big_top", true), FLOWER_SMALL_BOTTOM(
"flower_small_bottom",
true
), FLOWER_SMALL_TOP("flower_small_top", true), VINE("vine", false), ROOTS("roots", false);
private final String name;
private final boolean glow;
@ -65,7 +69,13 @@ public class EndBlockProperties extends BlockProperties {
}
public enum LumecornShape implements StringRepresentable {
LIGHT_TOP("light_top", 15), LIGHT_TOP_MIDDLE("light_top_middle", 15), LIGHT_MIDDLE("light_middle", 15), LIGHT_BOTTOM("light_bottom", 15), MIDDLE("middle", 0), BOTTOM_BIG("bottom_big", 0), BOTTOM_SMALL("bottom_small", 0);
LIGHT_TOP("light_top", 15), LIGHT_TOP_MIDDLE("light_top_middle", 15), LIGHT_MIDDLE(
"light_middle",
15
), LIGHT_BOTTOM("light_bottom", 15), MIDDLE("middle", 0), BOTTOM_BIG("bottom_big", 0), BOTTOM_SMALL(
"bottom_small",
0
);
private final String name;
private final int light;

View file

@ -42,7 +42,12 @@ public class EndLilyBlock extends EndUnderwaterPlantBlock {
private static final VoxelShape SHAPE_TOP = Block.box(2, 0, 2, 14, 6, 14);
public EndLilyBlock() {
super(FabricBlockSettings.of(Material.WATER_PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).sound(SoundType.WET_GRASS).lightLevel((state) -> state.getValue(SHAPE) == TripleShape.TOP ? 13 : 0).noCollission());
super(FabricBlockSettings.of(Material.WATER_PLANT)
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.WET_GRASS)
.lightLevel((state) -> state.getValue(SHAPE) == TripleShape.TOP ? 13 : 0)
.noCollission());
}
@Override
@ -69,7 +74,8 @@ public class EndLilyBlock extends EndUnderwaterPlantBlock {
@Override
public FluidState getFluidState(BlockState state) {
return state.getValue(SHAPE) == TripleShape.TOP ? Fluids.EMPTY.defaultFluidState() : Fluids.WATER.getSource(false);
return state.getValue(SHAPE) == TripleShape.TOP ? Fluids.EMPTY.defaultFluidState() : Fluids.WATER.getSource(
false);
}
@Override
@ -90,7 +96,10 @@ public class EndLilyBlock extends EndUnderwaterPlantBlock {
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
if (state.getValue(SHAPE) == TripleShape.TOP) {
return Lists.newArrayList(new ItemStack(EndItems.END_LILY_LEAF, MHelper.randRange(1, 2, MHelper.RANDOM)), new ItemStack(EndBlocks.END_LILY_SEED, MHelper.randRange(1, 2, MHelper.RANDOM)));
return Lists.newArrayList(
new ItemStack(EndItems.END_LILY_LEAF, MHelper.randRange(1, 2, MHelper.RANDOM)),
new ItemStack(EndBlocks.END_LILY_SEED, MHelper.randRange(1, 2, MHelper.RANDOM))
);
}
return Collections.emptyList();
}

View file

@ -16,13 +16,25 @@ public class EndLilySeedBlock extends UnderwaterPlantWithAgeBlock {
@Override
public void grow(WorldGenLevel world, Random random, BlockPos pos) {
if (canGrow(world, pos)) {
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.END_LILY.defaultBlockState().setValue(EndLilyBlock.SHAPE, TripleShape.BOTTOM));
BlocksHelper.setWithoutUpdate(
world,
pos,
EndBlocks.END_LILY.defaultBlockState().setValue(EndLilyBlock.SHAPE, TripleShape.BOTTOM)
);
BlockPos up = pos.above();
while (world.getFluidState(up).isSource()) {
BlocksHelper.setWithoutUpdate(world, up, EndBlocks.END_LILY.defaultBlockState().setValue(EndLilyBlock.SHAPE, TripleShape.MIDDLE));
BlocksHelper.setWithoutUpdate(
world,
up,
EndBlocks.END_LILY.defaultBlockState().setValue(EndLilyBlock.SHAPE, TripleShape.MIDDLE)
);
up = up.above();
}
BlocksHelper.setWithoutUpdate(world, up, EndBlocks.END_LILY.defaultBlockState().setValue(EndLilyBlock.SHAPE, TripleShape.TOP));
BlocksHelper.setWithoutUpdate(
world,
up,
EndBlocks.END_LILY.defaultBlockState().setValue(EndLilyBlock.SHAPE, TripleShape.TOP)
);
}
}

View file

@ -24,11 +24,11 @@ import ru.bclib.blocks.BaseBlockNotFull;
import ru.bclib.blocks.BlockProperties;
import ru.bclib.blocks.BlockProperties.TripleShape;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.BlocksHelper;
import ru.betterend.registry.EndBlocks;
public class EndLotusLeafBlock extends BaseBlockNotFull implements IRenderTyped {
public class EndLotusLeafBlock extends BaseBlockNotFull implements RenderLayerProvider {
public static final EnumProperty<Direction> HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING;
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
private static final VoxelShape VSHAPE = Block.box(0, 0, 0, 16, 1, 16);

View file

@ -19,7 +19,9 @@ public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock {
public void grow(WorldGenLevel world, Random random, BlockPos pos) {
if (canGrow(world, pos)) {
BlockState startLeaf = EndBlocks.END_LOTUS_STEM.defaultBlockState().setValue(EndLotusStemBlock.LEAF, true);
BlockState roots = EndBlocks.END_LOTUS_STEM.defaultBlockState().setValue(EndLotusStemBlock.SHAPE, TripleShape.BOTTOM).setValue(EndLotusStemBlock.WATERLOGGED, true);
BlockState roots = EndBlocks.END_LOTUS_STEM.defaultBlockState()
.setValue(EndLotusStemBlock.SHAPE, TripleShape.BOTTOM)
.setValue(EndLotusStemBlock.WATERLOGGED, true);
BlockState stem = EndBlocks.END_LOTUS_STEM.defaultBlockState();
BlockState flower = EndBlocks.END_LOTUS_FLOWER.defaultBlockState();
@ -37,7 +39,11 @@ public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock {
BlockPos leafCenter = bpos.immutable().relative(dir);
if (hasLeaf(world, leafCenter)) {
generateLeaf(world, leafCenter);
BlocksHelper.setWithoutUpdate(world, bpos, startLeaf.setValue(EndLotusStemBlock.SHAPE, shape).setValue(EndLotusStemBlock.FACING, dir));
BlocksHelper.setWithoutUpdate(
world,
bpos,
startLeaf.setValue(EndLotusStemBlock.SHAPE, shape).setValue(EndLotusStemBlock.FACING, dir)
);
}
else {
BlocksHelper.setWithoutUpdate(world, bpos, stem.setValue(EndLotusStemBlock.SHAPE, shape));
@ -93,12 +99,22 @@ public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock {
BlockState leaf = EndBlocks.END_LOTUS_LEAF.defaultBlockState();
BlocksHelper.setWithoutUpdate(world, pos, leaf.setValue(EndLotusLeafBlock.SHAPE, TripleShape.BOTTOM));
for (Direction move : BlocksHelper.HORIZONTAL) {
BlocksHelper.setWithoutUpdate(world, p.set(pos).move(move), leaf.setValue(EndLotusLeafBlock.HORIZONTAL_FACING, move).setValue(EndLotusLeafBlock.SHAPE, TripleShape.MIDDLE));
BlocksHelper.setWithoutUpdate(
world,
p.set(pos).move(move),
leaf.setValue(EndLotusLeafBlock.HORIZONTAL_FACING, move)
.setValue(EndLotusLeafBlock.SHAPE, TripleShape.MIDDLE)
);
}
for (int i = 0; i < 4; i++) {
Direction d1 = BlocksHelper.HORIZONTAL[i];
Direction d2 = BlocksHelper.HORIZONTAL[(i + 1) & 3];
BlocksHelper.setWithoutUpdate(world, p.set(pos).move(d1).move(d2), leaf.setValue(EndLotusLeafBlock.HORIZONTAL_FACING, d1).setValue(EndLotusLeafBlock.SHAPE, TripleShape.TOP));
BlocksHelper.setWithoutUpdate(
world,
p.set(pos).move(d1).move(d2),
leaf.setValue(EndLotusLeafBlock.HORIZONTAL_FACING, d1)
.setValue(EndLotusLeafBlock.SHAPE, TripleShape.TOP)
);
}
}

View file

@ -26,12 +26,12 @@ import ru.bclib.blocks.BaseBlock;
import ru.bclib.blocks.BlockProperties;
import ru.bclib.blocks.BlockProperties.TripleShape;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.BlocksHelper;
import java.util.Map;
public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlock, IRenderTyped {
public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlock, RenderLayerProvider {
public static final EnumProperty<Direction> FACING = BlockStateProperties.FACING;
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
public static final BooleanProperty LEAF = BooleanProperty.create("leaf");
@ -40,7 +40,10 @@ public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlo
public EndLotusStemBlock() {
super(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS));
this.registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false).setValue(SHAPE, TripleShape.MIDDLE).setValue(LEAF, false).setValue(FACING, Direction.UP));
this.registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false)
.setValue(SHAPE, TripleShape.MIDDLE)
.setValue(LEAF, false)
.setValue(FACING, Direction.UP));
}
@Override
@ -62,7 +65,9 @@ public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlo
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
LevelAccessor worldAccess = ctx.getLevel();
BlockPos blockPos = ctx.getClickedPos();
return this.defaultBlockState().setValue(WATERLOGGED, worldAccess.getFluidState(blockPos).getType() == Fluids.WATER).setValue(FACING, ctx.getClickedFace());
return this.defaultBlockState()
.setValue(WATERLOGGED, worldAccess.getFluidState(blockPos).getType() == Fluids.WATER)
.setValue(FACING, ctx.getClickedFace());
}
@Override

View file

@ -29,8 +29,8 @@ import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.dimension.DimensionType;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IColorProvider;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.CustomColorProvider;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.betterend.interfaces.TeleportingEntity;
import ru.betterend.registry.EndParticles;
import ru.betterend.registry.EndPortals;
@ -40,11 +40,13 @@ import java.util.Objects;
import java.util.Optional;
import java.util.Random;
public class EndPortalBlock extends NetherPortalBlock implements IRenderTyped, IColorProvider {
public class EndPortalBlock extends NetherPortalBlock implements RenderLayerProvider, CustomColorProvider {
public static final IntegerProperty PORTAL = EndBlockProperties.PORTAL;
public EndPortalBlock() {
super(FabricBlockSettings.copyOf(Blocks.NETHER_PORTAL).resistance(Blocks.BEDROCK.getExplosionResistance()).luminance(15));
super(FabricBlockSettings.copyOf(Blocks.NETHER_PORTAL)
.resistance(Blocks.BEDROCK.getExplosionResistance())
.luminance(15));
}
@Override
@ -57,7 +59,16 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTyped, I
@Environment(EnvType.CLIENT)
public void animateTick(BlockState state, Level world, BlockPos pos, Random random) {
if (random.nextInt(100) == 0) {
world.playLocalSound(pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, SoundEvents.PORTAL_AMBIENT, SoundSource.BLOCKS, 0.5F, random.nextFloat() * 0.4F + 0.8F, false);
world.playLocalSound(
pos.getX() + 0.5D,
pos.getY() + 0.5D,
pos.getZ() + 0.5D,
SoundEvents.PORTAL_AMBIENT,
SoundSource.BLOCKS,
0.5F,
random.nextFloat() * 0.4F + 0.8F,
false
);
}
double x = pos.getX() + random.nextDouble();
@ -95,7 +106,14 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTyped, I
BlockPos exitPos = findExitPos(currentWorld, destination, pos, entity);
if (exitPos == null) return;
if (entity instanceof ServerPlayer && ((ServerPlayer) entity).isCreative()) {
((ServerPlayer) entity).teleportTo(destination, exitPos.getX() + 0.5, exitPos.getY(), exitPos.getZ() + 0.5, entity.getYRot(), entity.getXRot());
((ServerPlayer) entity).teleportTo(
destination,
exitPos.getX() + 0.5,
exitPos.getY(),
exitPos.getZ() + 0.5,
entity.getYRot(),
entity.getXRot()
);
}
else {
((TeleportingEntity) entity).be_setExitPos(exitPos);
@ -115,17 +133,28 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTyped, I
private BlockPos findExitPos(ServerLevel currentWorld, ServerLevel targetWorld, BlockPos currentPos, Entity entity) {
if (targetWorld == null) return null;
Registry<DimensionType> registry = targetWorld.registryAccess().registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY);
Registry<DimensionType> registry = targetWorld.registryAccess()
.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY);
ResourceLocation targetWorldId = targetWorld.dimension().location();
ResourceLocation currentWorldId = currentWorld.dimension().location();
double targetMultiplier = Objects.requireNonNull(registry.get(targetWorldId)).coordinateScale();
double currentMultiplier = Objects.requireNonNull(registry.get(currentWorldId)).coordinateScale();
double multiplier = targetMultiplier > currentMultiplier ? 1.0 / targetMultiplier : currentMultiplier;
MutableBlockPos basePos = currentPos.mutable().set(currentPos.getX() * multiplier, currentPos.getY(), currentPos.getZ() * multiplier);
MutableBlockPos basePos = currentPos.mutable()
.set(currentPos.getX() * multiplier,
currentPos.getY(),
currentPos.getZ() * multiplier
);
MutableBlockPos checkPos = basePos.mutable();
BlockState currentState = currentWorld.getBlockState(currentPos);
int radius = (EternalRitual.SEARCH_RADIUS >> 4) + 1;
checkPos = EternalRitual.findBlockPos(targetWorld, checkPos, radius, this, state -> state.is(this) && state.getValue(PORTAL).equals(currentState.getValue(PORTAL)));
checkPos = EternalRitual.findBlockPos(
targetWorld,
checkPos,
radius,
this,
state -> state.is(this) && state.getValue(PORTAL).equals(currentState.getValue(PORTAL))
);
if (checkPos != null) {
BlockState checkState = targetWorld.getBlockState(checkPos);
Axis axis = checkState.getValue(AXIS);

View file

@ -49,7 +49,12 @@ public class EndStoneSmelter extends BaseBlockWithEntity {
public static final String ID = "end_stone_smelter";
public EndStoneSmelter() {
super(FabricBlockSettings.of(Material.STONE, MaterialColor.COLOR_GRAY).luminance(state -> state.getValue(LIT) ? 15 : 0).hardness(4F).resistance(100F).requiresCorrectToolForDrops().sound(SoundType.STONE));
super(FabricBlockSettings.of(Material.STONE, MaterialColor.COLOR_GRAY)
.luminance(state -> state.getValue(LIT) ? 15 : 0)
.hardness(4F)
.resistance(100F)
.requiresCorrectToolForDrops()
.sound(SoundType.STONE));
registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(LIT, false));
}
@ -134,7 +139,16 @@ public class EndStoneSmelter extends BaseBlockWithEntity {
double y = pos.getY();
double z = pos.getZ() + 0.5D;
if (random.nextDouble() < 0.1D) {
world.playLocalSound(x, y, z, SoundEvents.BLASTFURNACE_FIRE_CRACKLE, SoundSource.BLOCKS, 1.0F, 1.0F, false);
world.playLocalSound(
x,
y,
z,
SoundEvents.BLASTFURNACE_FIRE_CRACKLE,
SoundSource.BLOCKS,
1.0F,
1.0F,
false
);
}
Direction direction = state.getValue(FACING);
@ -151,6 +165,10 @@ public class EndStoneSmelter extends BaseBlockWithEntity {
@Override
@Nullable
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState blockState, BlockEntityType<T> blockEntityType) {
return level.isClientSide() ? null : createTickerHelper(blockEntityType, EndBlockEntities.END_STONE_SMELTER, EndStoneSmelterBlockEntity::tick);
return level.isClientSide() ? null : createTickerHelper(
blockEntityType,
EndBlockEntities.END_STONE_SMELTER,
EndStoneSmelterBlockEntity::tick
);
}
}

View file

@ -14,7 +14,11 @@ import ru.bclib.blocks.BaseBlock;
public class EnderBlock extends BaseBlock {
public EnderBlock() {
super(FabricBlockSettings.of(Material.STONE, MaterialColor.WARPED_WART_BLOCK).hardness(5F).resistance(6F).requiresCorrectToolForDrops().sound(SoundType.STONE));
super(FabricBlockSettings.of(Material.STONE, MaterialColor.WARPED_WART_BLOCK)
.hardness(5F)
.resistance(6F)
.requiresCorrectToolForDrops()
.sound(SoundType.STONE));
}
@Environment(EnvType.CLIENT)

View file

@ -21,7 +21,9 @@ public class EndstoneDustBlock extends FallingBlock {
private static final int COLOR = ColorUtil.color(226, 239, 168);
public EndstoneDustBlock() {
super(FabricBlockSettings.copyOf(Blocks.SAND).breakByTool(FabricToolTags.SHOVELS).materialColor(Blocks.END_STONE.defaultMaterialColor()));
super(FabricBlockSettings.copyOf(Blocks.SAND)
.breakByTool(FabricToolTags.SHOVELS)
.materialColor(Blocks.END_STONE.defaultMaterialColor()));
}
@Override

View file

@ -8,6 +8,9 @@ import ru.bclib.blocks.BaseBlock;
public class FilaluxLanternBlock extends BaseBlock {
public FilaluxLanternBlock() {
super(FabricBlockSettings.of(Material.WOOD).breakByTool(FabricToolTags.AXES).luminance(15).sound(SoundType.WOOD));
super(FabricBlockSettings.of(Material.WOOD)
.breakByTool(FabricToolTags.AXES)
.luminance(15)
.sound(SoundType.WOOD));
}
}

View file

@ -14,15 +14,18 @@ import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import ru.bclib.blocks.BaseAttachedBlock;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.RenderLayerProvider;
import java.util.EnumMap;
public class FilaluxWingsBlock extends BaseAttachedBlock implements IRenderTyped {
public class FilaluxWingsBlock extends BaseAttachedBlock implements RenderLayerProvider {
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
public FilaluxWingsBlock() {
super(FabricBlockSettings.of(Material.PLANT).breakByTool(FabricToolTags.SHEARS).sound(SoundType.WET_GRASS).noCollission());
super(FabricBlockSettings.of(Material.PLANT)
.breakByTool(FabricToolTags.SHEARS)
.sound(SoundType.WET_GRASS)
.noCollission());
}
@Override

View file

@ -1,10 +1,14 @@
package ru.betterend.blocks;
import com.google.common.collect.Lists;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.WaterLilyBlockItem;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
@ -15,16 +19,19 @@ import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import ru.bclib.interfaces.ISpetialItem;
import ru.bclib.interfaces.CustomItemProvider;
import ru.betterend.blocks.basis.EndPlantBlock;
import java.util.List;
public class FlamaeaBlock extends EndPlantBlock implements ISpetialItem {
public class FlamaeaBlock extends EndPlantBlock implements CustomItemProvider {
private static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 1, 16);
public FlamaeaBlock() {
super(FabricBlockSettings.of(Material.PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).sound(SoundType.WET_GRASS));
super(FabricBlockSettings.of(Material.PLANT)
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.WET_GRASS));
}
@Override
@ -47,18 +54,13 @@ public class FlamaeaBlock extends EndPlantBlock implements ISpetialItem {
return Lists.newArrayList(new ItemStack(this));
}
@Override
public int getStackSize() {
return 64;
}
@Override
public boolean canPlaceOnWater() {
return true;
}
@Override
public boolean addToPot() {
return false;
}
@Override
public BlockItem getCustomItem(ResourceLocation resourceLocation, FabricItemSettings fabricItemSettings) {
return new WaterLilyBlockItem(this, fabricItemSettings);
}
}

View file

@ -9,7 +9,6 @@ import com.mojang.math.Vector3f;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.mixin.object.builder.AbstractBlockAccessor;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.BlockModel;
@ -45,8 +44,8 @@ import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.ModelsHelper.MultiPartBuilder;
import ru.bclib.client.models.PatternsHelper;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IPostInit;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.PostInitable;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.JsonFactory;
import ru.betterend.BetterEnd;
@ -58,12 +57,11 @@ import ru.betterend.interfaces.PottableTerrain;
import ru.betterend.registry.EndBlocks;
import java.io.File;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
public class FlowerPotBlock extends BaseBlockNotFull implements IRenderTyped, IPostInit {
public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvider, PostInitable {
private static final IntegerProperty PLANT_ID = EndBlockProperties.PLANT_ID;
private static final IntegerProperty SOIL_ID = EndBlockProperties.SOIL_ID;
private static final IntegerProperty POT_LIGHT = EndBlockProperties.POT_LIGHT;
@ -74,7 +72,10 @@ public class FlowerPotBlock extends BaseBlockNotFull implements IRenderTyped, IP
public FlowerPotBlock(Block source) {
super(FabricBlockSettings.copyOf(source).luminance(state -> state.getValue(POT_LIGHT) * 5));
this.registerDefaultState(this.defaultBlockState().setValue(PLANT_ID, 0).setValue(SOIL_ID, 0).setValue(POT_LIGHT, 0));
this.registerDefaultState(this.defaultBlockState()
.setValue(PLANT_ID, 0)
.setValue(SOIL_ID, 0)
.setValue(POT_LIGHT, 0));
}
@Override
@ -122,7 +123,10 @@ public class FlowerPotBlock extends BaseBlockNotFull implements IRenderTyped, IP
Map<String, Integer> reservedPlantsIDs = Maps.newHashMap();
Map<String, Integer> reservedSoilIDs = Maps.newHashMap();
JsonObject obj = JsonFactory.getJsonObject(new File(FabricLoader.getInstance().getConfigDir().toFile(), BetterEnd.MOD_ID + "/blocks.json"));
JsonObject obj = JsonFactory.getJsonObject(new File(
FabricLoader.getInstance().getConfigDir().toFile(),
BetterEnd.MOD_ID + "/blocks.json"
));
if (obj.get("flower_pots") != null) {
JsonElement plantsObj = obj.get("flower_pots").getAsJsonObject().get("plants");
JsonElement soilsObj = obj.get("flower_pots").getAsJsonObject().get("soils");
@ -236,7 +240,16 @@ public class FlowerPotBlock extends BaseBlockNotFull implements IRenderTyped, IP
}
int light = plants[i].defaultBlockState().getLightEmission() / 5;
BlocksHelper.setWithUpdate(level, pos, state.setValue(PLANT_ID, i + 1).setValue(POT_LIGHT, light));
level.playLocalSound(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, SoundEvents.HOE_TILL, SoundSource.BLOCKS, 1, 1, false);
level.playLocalSound(
pos.getX() + 0.5,
pos.getY() + 0.5,
pos.getZ() + 0.5,
SoundEvents.HOE_TILL,
SoundSource.BLOCKS,
1,
1,
false
);
return InteractionResult.SUCCESS;
}
}
@ -264,11 +277,17 @@ public class FlowerPotBlock extends BaseBlockNotFull implements IRenderTyped, IP
final int compareID = i + 1;
ResourceLocation modelPath = Registry.BLOCK.getKey(plants[i]);
ResourceLocation objSource = new ResourceLocation(modelPath.getNamespace(), "models/block/" + modelPath.getPath() + "_potted.json");
ResourceLocation objSource = new ResourceLocation(
modelPath.getNamespace(),
"models/block/" + modelPath.getPath() + "_potted.json"
);
if (Minecraft.getInstance().getResourceManager().hasResource(objSource)) {
objSource = new ResourceLocation(modelPath.getNamespace(), "block/" + modelPath.getPath() + "_potted");
model.part(objSource).setTransformation(offset).setCondition(state -> state.getValue(PLANT_ID) == compareID).add();
model.part(objSource)
.setTransformation(offset)
.setCondition(state -> state.getValue(PLANT_ID) == compareID)
.add();
continue;
}
@ -281,7 +300,10 @@ public class FlowerPotBlock extends BaseBlockNotFull implements IRenderTyped, IP
Optional<String> pattern = Patterns.createJson(BasePatterns.BLOCK_CROSS, textures);
UnbakedModel unbakedModel = ModelsHelper.fromPattern(pattern);
modelCache.put(modelPath, unbakedModel);
model.part(modelPath).setTransformation(offset).setCondition(state -> state.getValue(PLANT_ID) == compareID).add();
model.part(modelPath)
.setTransformation(offset)
.setCondition(state -> state.getValue(PLANT_ID) == compareID)
.add();
continue;
}
else if (plants[i] instanceof PottableLeavesBlock) {
@ -293,7 +315,10 @@ public class FlowerPotBlock extends BaseBlockNotFull implements IRenderTyped, IP
Optional<String> pattern = Patterns.createJson(Patterns.BLOCK_POTTED_LEAVES, textures);
UnbakedModel unbakedModel = ModelsHelper.fromPattern(pattern);
modelCache.put(modelPath, unbakedModel);
model.part(modelPath).setTransformation(offset).setCondition(state -> state.getValue(PLANT_ID) == compareID).add();
model.part(modelPath)
.setTransformation(offset)
.setCondition(state -> state.getValue(PLANT_ID) == compareID)
.add();
continue;
}
@ -332,12 +357,18 @@ public class FlowerPotBlock extends BaseBlockNotFull implements IRenderTyped, IP
continue;
}
model.part(new ResourceLocation(path)).setTransformation(offset).setCondition(state -> state.getValue(PLANT_ID) == compareID).add();
model.part(new ResourceLocation(path))
.setTransformation(offset)
.setCondition(state -> state.getValue(PLANT_ID) == compareID)
.add();
}
else {
for (ResourceLocation location : modelCache.keySet()) {
if (location.getPath().equals(modelPath.getPath())) {
model.part(location).setTransformation(offset).setCondition(state -> state.getValue(PLANT_ID) == compareID).add();
model.part(location)
.setTransformation(offset)
.setCondition(state -> state.getValue(PLANT_ID) == compareID)
.add();
break;
}
}

View file

@ -8,6 +8,9 @@ import ru.bclib.blocks.BaseBlock;
public class GlowingHymenophoreBlock extends BaseBlock {
public GlowingHymenophoreBlock() {
super(FabricBlockSettings.of(Material.WOOD).breakByTool(FabricToolTags.AXES).luminance(15).sound(SoundType.WART_BLOCK));
super(FabricBlockSettings.of(Material.WOOD)
.breakByTool(FabricToolTags.AXES)
.luminance(15)
.sound(SoundType.WART_BLOCK));
}
}

View file

@ -21,7 +21,12 @@ public class GlowingPillarLuminophorBlock extends BaseBlock {
public static final BooleanProperty NATURAL = EndBlockProperties.NATURAL;
public GlowingPillarLuminophorBlock() {
super(FabricBlockSettings.of(Material.LEAVES).materialColor(MaterialColor.COLOR_ORANGE).breakByTool(FabricToolTags.SHEARS).strength(0.2F).luminance(15).sound(SoundType.GRASS));
super(FabricBlockSettings.of(Material.LEAVES)
.materialColor(MaterialColor.COLOR_ORANGE)
.breakByTool(FabricToolTags.SHEARS)
.strength(0.2F)
.luminance(15)
.sound(SoundType.GRASS));
this.registerDefaultState(this.stateDefinition.any().setValue(NATURAL, false));
}

View file

@ -23,7 +23,13 @@ import java.util.Random;
public class GlowingPillarSeedBlock extends EndPlantWithAgeBlock {
public GlowingPillarSeedBlock() {
super(FabricBlockSettings.of(Material.PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).sound(SoundType.GRASS).lightLevel(state -> state.getValue(AGE) * 3 + 3).randomTicks().noCollission());
super(FabricBlockSettings.of(Material.PLANT)
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.GRASS)
.lightLevel(state -> state.getValue(AGE) * 3 + 3)
.randomTicks()
.noCollission());
}
@Override
@ -45,16 +51,28 @@ public class GlowingPillarSeedBlock extends EndPlantWithAgeBlock {
BlocksHelper.setWithUpdate(world, mut, roots.setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.TOP));
}
mut.move(Direction.UP);
BlocksHelper.setWithUpdate(world, mut, EndBlocks.GLOWING_PILLAR_LUMINOPHOR.defaultBlockState().setValue(BlueVineLanternBlock.NATURAL, true));
BlocksHelper.setWithUpdate(
world,
mut,
EndBlocks.GLOWING_PILLAR_LUMINOPHOR.defaultBlockState().setValue(BlueVineLanternBlock.NATURAL, true)
);
for (Direction dir : BlocksHelper.DIRECTIONS) {
pos = mut.relative(dir);
if (world.isEmptyBlock(pos)) {
BlocksHelper.setWithUpdate(world, pos, EndBlocks.GLOWING_PILLAR_LEAVES.defaultBlockState().setValue(BlockStateProperties.FACING, dir));
BlocksHelper.setWithUpdate(
world,
pos,
EndBlocks.GLOWING_PILLAR_LEAVES.defaultBlockState().setValue(BlockStateProperties.FACING, dir)
);
}
}
mut.move(Direction.UP);
if (world.isEmptyBlock(mut)) {
BlocksHelper.setWithUpdate(world, mut, EndBlocks.GLOWING_PILLAR_LEAVES.defaultBlockState().setValue(BlockStateProperties.FACING, Direction.UP));
BlocksHelper.setWithUpdate(
world,
mut,
EndBlocks.GLOWING_PILLAR_LEAVES.defaultBlockState().setValue(BlockStateProperties.FACING, Direction.UP)
);
}
}

View file

@ -20,7 +20,7 @@ import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import ru.bclib.blocks.BaseBlock;
import ru.bclib.interfaces.IColorProvider;
import ru.bclib.interfaces.CustomColorProvider;
import ru.bclib.util.ColorUtil;
import ru.bclib.util.MHelper;
import ru.betterend.noise.OpenSimplexNoise;
@ -29,12 +29,17 @@ import ru.betterend.registry.EndBlocks;
import java.util.Collections;
import java.util.List;
public class HelixTreeLeavesBlock extends BaseBlock implements IColorProvider {
public class HelixTreeLeavesBlock extends BaseBlock implements CustomColorProvider {
public static final IntegerProperty COLOR = EndBlockProperties.COLOR;
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
public HelixTreeLeavesBlock() {
super(FabricBlockSettings.of(Material.LEAVES).materialColor(MaterialColor.COLOR_ORANGE).breakByTool(FabricToolTags.SHEARS).sound(SoundType.WART_BLOCK).sound(SoundType.GRASS).strength(0.2F));
super(FabricBlockSettings.of(Material.LEAVES)
.materialColor(MaterialColor.COLOR_ORANGE)
.breakByTool(FabricToolTags.SHEARS)
.sound(SoundType.WART_BLOCK)
.sound(SoundType.GRASS)
.strength(0.2F));
}
@Override
@ -73,7 +78,10 @@ public class HelixTreeLeavesBlock extends BaseBlock implements IColorProvider {
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null) {
if (tool.is(FabricToolTags.SHEARS) || tool.isCorrectToolForDrops(state) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
if (tool.is(FabricToolTags.SHEARS) || tool.isCorrectToolForDrops(state) || EnchantmentHelper.getItemEnchantmentLevel(
Enchantments.SILK_TOUCH,
tool
) > 0) {
return Collections.singletonList(new ItemStack(this));
}
int fortune = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.BLOCK_FORTUNE, tool);
@ -82,6 +90,7 @@ public class HelixTreeLeavesBlock extends BaseBlock implements IColorProvider {
}
return Lists.newArrayList();
}
return MHelper.RANDOM.nextInt(32) == 0 ? Lists.newArrayList(new ItemStack(EndBlocks.HELIX_TREE_SAPLING)) : Lists.newArrayList();
return MHelper.RANDOM.nextInt(32) == 0 ? Lists.newArrayList(new ItemStack(EndBlocks.HELIX_TREE_SAPLING)) : Lists
.newArrayList();
}
}

View file

@ -5,7 +5,6 @@ import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;

View file

@ -33,7 +33,12 @@ public class HydraluxBlock extends UnderwaterPlantBlock {
public static final EnumProperty<HydraluxShape> SHAPE = EndBlockProperties.HYDRALUX_SHAPE;
public HydraluxBlock() {
super(FabricBlockSettings.of(Material.WATER_PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).sound(SoundType.WET_GRASS).lightLevel((state) -> state.getValue(SHAPE).hasGlow() ? 15 : 0).noCollission());
super(FabricBlockSettings.of(Material.WATER_PLANT)
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.WET_GRASS)
.lightLevel((state) -> state.getValue(SHAPE).hasGlow() ? 15 : 0)
.noCollission());
}
@Override
@ -84,7 +89,10 @@ public class HydraluxBlock extends UnderwaterPlantBlock {
return Lists.newArrayList(new ItemStack(EndItems.HYDRALUX_PETAL, MHelper.randRange(1, 4, MHelper.RANDOM)));
}
else if (shape == HydraluxShape.ROOTS) {
return Lists.newArrayList(new ItemStack(EndBlocks.HYDRALUX_SAPLING, MHelper.randRange(1, 2, MHelper.RANDOM)));
return Lists.newArrayList(new ItemStack(
EndBlocks.HYDRALUX_SAPLING,
MHelper.randRange(1, 2, MHelper.RANDOM)
));
}
return Collections.emptyList();
}

View file

@ -13,7 +13,13 @@ import ru.bclib.blocks.BaseBlock;
public class HydraluxPetalBlock extends BaseBlock {
public HydraluxPetalBlock() {
this(FabricBlockSettings.of(Material.PLANT).breakByTool(FabricToolTags.AXES).breakByHand(true).hardness(1).resistance(1).materialColor(MaterialColor.PODZOL).sound(SoundType.WART_BLOCK));
this(FabricBlockSettings.of(Material.PLANT)
.breakByTool(FabricToolTags.AXES)
.breakByHand(true)
.hardness(1)
.resistance(1)
.materialColor(MaterialColor.PODZOL)
.sound(SoundType.WART_BLOCK));
}
public HydraluxPetalBlock(Properties settings) {

View file

@ -10,13 +10,13 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.ModelsHelper;
import ru.bclib.interfaces.IColorProvider;
import ru.bclib.interfaces.CustomColorProvider;
import ru.bclib.util.BlocksHelper;
import ru.betterend.client.models.Patterns;
import java.util.Optional;
public class HydraluxPetalColoredBlock extends HydraluxPetalBlock implements IColorProvider {
public class HydraluxPetalColoredBlock extends HydraluxPetalBlock implements CustomColorProvider {
public HydraluxPetalColoredBlock(FabricBlockSettings settings) {
super(settings);
}

View file

@ -29,18 +29,40 @@ public class HydraluxSaplingBlock extends UnderwaterPlantWithAgeBlock {
mut.setY(pos.getY());
BlockState state = EndBlocks.HYDRALUX.defaultBlockState();
BlocksHelper.setWithoutUpdate(world, pos, state.setValue(EndBlockProperties.HYDRALUX_SHAPE, HydraluxShape.ROOTS));
BlocksHelper.setWithoutUpdate(
world,
pos,
state.setValue(EndBlockProperties.HYDRALUX_SHAPE, HydraluxShape.ROOTS)
);
for (int i = 1; i < h - 2; i++) {
mut.setY(pos.getY() + i);
BlocksHelper.setWithoutUpdate(world, mut, state.setValue(EndBlockProperties.HYDRALUX_SHAPE, HydraluxShape.VINE));
BlocksHelper.setWithoutUpdate(
world,
mut,
state.setValue(EndBlockProperties.HYDRALUX_SHAPE, HydraluxShape.VINE)
);
}
mut.setY(mut.getY() + 1);
boolean big = random.nextBoolean();
BlocksHelper.setWithoutUpdate(world, mut, state.setValue(EndBlockProperties.HYDRALUX_SHAPE, big ? HydraluxShape.FLOWER_BIG_BOTTOM : HydraluxShape.FLOWER_SMALL_BOTTOM));
BlocksHelper.setWithoutUpdate(
world,
mut,
state.setValue(
EndBlockProperties.HYDRALUX_SHAPE,
big ? HydraluxShape.FLOWER_BIG_BOTTOM : HydraluxShape.FLOWER_SMALL_BOTTOM
)
);
mut.setY(mut.getY() + 1);
BlocksHelper.setWithoutUpdate(world, mut, state.setValue(EndBlockProperties.HYDRALUX_SHAPE, big ? HydraluxShape.FLOWER_BIG_TOP : HydraluxShape.FLOWER_SMALL_TOP));
BlocksHelper.setWithoutUpdate(
world,
mut,
state.setValue(
EndBlockProperties.HYDRALUX_SHAPE,
big ? HydraluxShape.FLOWER_BIG_TOP : HydraluxShape.FLOWER_SMALL_TOP
)
);
}
@Override

View file

@ -50,7 +50,11 @@ public class HydrothermalVentBlock extends BaseBlockNotFull implements EntityBlo
private static final VoxelShape SHAPE = Block.box(1, 1, 1, 15, 16, 15);
public HydrothermalVentBlock() {
super(FabricBlockSettings.of(Material.STONE).breakByTool(FabricToolTags.PICKAXES).sound(SoundType.STONE).noCollission().requiresCorrectToolForDrops());
super(FabricBlockSettings.of(Material.STONE)
.breakByTool(FabricToolTags.PICKAXES)
.sound(SoundType.STONE)
.noCollission()
.requiresCorrectToolForDrops());
this.registerDefaultState(defaultBlockState().setValue(WATERLOGGED, true).setValue(ACTIVATED, false));
}
@ -95,7 +99,8 @@ public class HydrothermalVentBlock extends BaseBlockNotFull implements EntityBlo
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
LevelAccessor worldAccess = ctx.getLevel();
BlockPos blockPos = ctx.getClickedPos();
return this.defaultBlockState().setValue(WATERLOGGED, worldAccess.getFluidState(blockPos).getType() == Fluids.WATER);
return this.defaultBlockState()
.setValue(WATERLOGGED, worldAccess.getFluidState(blockPos).getType() == Fluids.WATER);
}
@Override
@ -119,7 +124,8 @@ public class HydrothermalVentBlock extends BaseBlockNotFull implements EntityBlo
@Override
public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) {
if (world instanceof ServerLevel && state.getValue(WATERLOGGED) && world.getBlockState(pos.above()).is(Blocks.WATER)) {
if (world instanceof ServerLevel && state.getValue(WATERLOGGED) && world.getBlockState(pos.above())
.is(Blocks.WATER)) {
tick(state, (ServerLevel) world, pos, world.random);
}
}

View file

@ -20,11 +20,11 @@ import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.storage.loot.LootContext;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IColorProvider;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.BlockModelProvider;
import ru.bclib.interfaces.CustomColorProvider;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.ColorUtil;
import ru.bclib.util.MHelper;
import ru.betterend.client.models.Patterns;
@ -33,7 +33,7 @@ import ru.betterend.noise.OpenSimplexNoise;
import java.util.List;
import java.util.Optional;
public class JellyshroomCapBlock extends SlimeBlock implements IRenderTyped, BlockModelProvider, IColorProvider {
public class JellyshroomCapBlock extends SlimeBlock implements RenderLayerProvider, BlockModelProvider, CustomColorProvider {
public static final IntegerProperty COLOR = EndBlockProperties.COLOR;
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
private final Vec3i colorStart;

View file

@ -5,7 +5,6 @@ import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
@ -22,7 +21,8 @@ public class LacugroveSaplingBlock extends PottableFeatureSapling {
@Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return world.getBlockState(pos.below()).is(EndBlocks.END_MOSS) || world.getBlockState(pos.below()).is(EndBlocks.ENDSTONE_DUST);
return world.getBlockState(pos.below()).is(EndBlocks.END_MOSS) || world.getBlockState(pos.below())
.is(EndBlocks.ENDSTONE_DUST);
}
@Override

View file

@ -42,7 +42,8 @@ public class LanceleafBlock extends EndPlantBlock {
return world.getBlockState(pos.below()).is(this);
}
else if (shape == PentaShape.BOTTOM) {
return world.getBlockState(pos.below()).is(EndBlocks.AMBER_MOSS) && world.getBlockState(pos.above()).is(this);
return world.getBlockState(pos.below()).is(EndBlocks.AMBER_MOSS) && world.getBlockState(pos.above())
.is(this);
}
else {
return world.getBlockState(pos.below()).is(this) && world.getBlockState(pos.above()).is(this);
@ -64,6 +65,7 @@ public class LanceleafBlock extends EndPlantBlock {
if (state.getValue(SHAPE) == PentaShape.BOTTOM) {
return Collections.singletonList(new ItemStack(EndBlocks.LANCELEAF_SEED));
}
return MHelper.RANDOM.nextBoolean() ? Collections.emptyList() : Collections.singletonList(new ItemStack(EndBlocks.LANCELEAF_SEED));
return MHelper.RANDOM.nextBoolean() ? Collections.emptyList() : Collections.singletonList(new ItemStack(
EndBlocks.LANCELEAF_SEED));
}
}

View file

@ -27,12 +27,28 @@ public class LanceleafSeedBlock extends EndPlantWithAgeBlock {
MutableBlockPos mut = new MutableBlockPos().set(pos);
BlockState plant = EndBlocks.LANCELEAF.defaultBlockState().setValue(BlockProperties.ROTATION, rotation);
BlocksHelper.setWithoutUpdate(world, mut, plant.setValue(BlockProperties.PENTA_SHAPE, PentaShape.BOTTOM));
BlocksHelper.setWithoutUpdate(world, mut.move(Direction.UP), plant.setValue(BlockProperties.PENTA_SHAPE, PentaShape.PRE_BOTTOM));
BlocksHelper.setWithoutUpdate(
world,
mut.move(Direction.UP),
plant.setValue(BlockProperties.PENTA_SHAPE, PentaShape.PRE_BOTTOM)
);
for (int i = 2; i < height - 2; i++) {
BlocksHelper.setWithoutUpdate(world, mut.move(Direction.UP), plant.setValue(BlockProperties.PENTA_SHAPE, PentaShape.MIDDLE));
BlocksHelper.setWithoutUpdate(
world,
mut.move(Direction.UP),
plant.setValue(BlockProperties.PENTA_SHAPE, PentaShape.MIDDLE)
);
}
BlocksHelper.setWithoutUpdate(world, mut.move(Direction.UP), plant.setValue(BlockProperties.PENTA_SHAPE, PentaShape.PRE_TOP));
BlocksHelper.setWithoutUpdate(world, mut.move(Direction.UP), plant.setValue(BlockProperties.PENTA_SHAPE, PentaShape.TOP));
BlocksHelper.setWithoutUpdate(
world,
mut.move(Direction.UP),
plant.setValue(BlockProperties.PENTA_SHAPE, PentaShape.PRE_TOP)
);
BlocksHelper.setWithoutUpdate(
world,
mut.move(Direction.UP),
plant.setValue(BlockProperties.PENTA_SHAPE, PentaShape.TOP)
);
}
@Override

View file

@ -28,7 +28,11 @@ public class LargeAmaranitaBlock extends EndPlantBlock {
private static final VoxelShape SHAPE_TOP = Shapes.or(Block.box(1, 3, 1, 15, 16, 15), SHAPE_BOTTOM);
public LargeAmaranitaBlock() {
super(FabricBlockSettings.of(Material.PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).sound(SoundType.GRASS).lightLevel((state) -> (state.getValue(SHAPE) == TripleShape.TOP) ? 15 : 0));
super(FabricBlockSettings.of(Material.PLANT)
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.GRASS)
.lightLevel((state) -> (state.getValue(SHAPE) == TripleShape.TOP) ? 15 : 0));
}
@Override

View file

@ -5,7 +5,6 @@ import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;

View file

@ -22,7 +22,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
import ru.bclib.api.TagAPI;
import ru.bclib.blocks.BaseBlockNotFull;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.MHelper;
import ru.betterend.blocks.EndBlockProperties.LumecornShape;
import ru.betterend.registry.EndBlocks;
@ -32,13 +32,16 @@ import java.util.Collections;
import java.util.List;
@SuppressWarnings("deprecation")
public class LumecornBlock extends BaseBlockNotFull implements IRenderTyped {
public class LumecornBlock extends BaseBlockNotFull implements RenderLayerProvider {
public static final EnumProperty<LumecornShape> SHAPE = EnumProperty.create("shape", LumecornShape.class);
private static final VoxelShape SHAPE_BOTTOM = Block.box(6, 0, 6, 10, 16, 10);
private static final VoxelShape SHAPE_TOP = Block.box(6, 0, 6, 10, 8, 10);
public LumecornBlock() {
super(FabricBlockSettings.of(Material.WOOD).breakByTool(FabricToolTags.AXES).hardness(0.5F).luminance(state -> state.getValue(SHAPE).getLight()));
super(FabricBlockSettings.of(Material.WOOD)
.breakByTool(FabricToolTags.AXES)
.hardness(0.5F)
.luminance(state -> state.getValue(SHAPE).getLight()));
}
@Override
@ -84,9 +87,13 @@ public class LumecornBlock extends BaseBlockNotFull implements IRenderTyped {
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
LumecornShape shape = state.getValue(SHAPE);
if (shape == LumecornShape.BOTTOM_BIG || shape == LumecornShape.BOTTOM_SMALL || shape == LumecornShape.MIDDLE) {
return Collections.singletonList(new ItemStack(EndBlocks.LUMECORN_SEED, MHelper.randRange(1, 2, MHelper.RANDOM)));
return Collections.singletonList(new ItemStack(
EndBlocks.LUMECORN_SEED,
MHelper.randRange(1, 2, MHelper.RANDOM)
));
}
return MHelper.RANDOM.nextBoolean() ? Collections.singletonList(new ItemStack(EndItems.LUMECORN_ROD)) : Collections.emptyList();
return MHelper.RANDOM.nextBoolean() ? Collections.singletonList(new ItemStack(EndItems.LUMECORN_ROD)) : Collections
.emptyList();
}
@Override

View file

@ -17,13 +17,13 @@ import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Material;
import ru.bclib.blocks.BaseBlockNotFull;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.betterend.registry.EndBlocks;
import java.util.Queue;
@SuppressWarnings("deprecation")
public class MengerSpongeBlock extends BaseBlockNotFull implements IRenderTyped {
public class MengerSpongeBlock extends BaseBlockNotFull implements RenderLayerProvider {
public MengerSpongeBlock() {
super(FabricBlockSettings.copyOf(Blocks.SPONGE).noOcclusion());
}
@ -59,7 +59,11 @@ public class MengerSpongeBlock extends BaseBlockNotFull implements IRenderTyped
FluidState fluidState = world.getFluidState(blockPos2);
Material material = blockState.getMaterial();
if (fluidState.is(FluidTags.WATER)) {
if (blockState.getBlock() instanceof BucketPickup && !((BucketPickup) blockState.getBlock()).pickupBlock(world, blockPos2, blockState).isEmpty()) {
if (blockState.getBlock() instanceof BucketPickup && !((BucketPickup) blockState.getBlock()).pickupBlock(
world,
blockPos2,
blockState
).isEmpty()) {
++i;
if (j < 6) {
queue.add(new Tuple<>(blockPos2, j + 1));

View file

@ -19,14 +19,14 @@ import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import ru.bclib.blocks.BaseBlockNotFull;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.BlocksHelper;
import ru.betterend.registry.EndBlocks;
import java.util.Random;
@SuppressWarnings("deprecation")
public class MengerSpongeWetBlock extends BaseBlockNotFull implements IRenderTyped {
public class MengerSpongeWetBlock extends BaseBlockNotFull implements RenderLayerProvider {
public MengerSpongeWetBlock() {
super(FabricBlockSettings.copyOf(Blocks.WET_SPONGE).noOcclusion());
}
@ -36,7 +36,14 @@ public class MengerSpongeWetBlock extends BaseBlockNotFull implements IRenderTyp
if (world.dimensionType().ultraWarm()) {
world.setBlock(pos, EndBlocks.MENGER_SPONGE.defaultBlockState(), 3);
world.levelEvent(2009, pos, 0);
world.playSound(null, pos, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 1.0F, (1.0F + world.getRandom().nextFloat() * 0.2F) * 0.7F);
world.playSound(
null,
pos,
SoundEvents.FIRE_EXTINGUISH,
SoundSource.BLOCKS,
1.0F,
(1.0F + world.getRandom().nextFloat() * 0.2F) * 0.7F
);
}
}
@ -90,7 +97,13 @@ public class MengerSpongeWetBlock extends BaseBlockNotFull implements IRenderTyp
world.levelEvent(2001, pos, getId(state));
}
if (world.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS) && (player == null || !player.isCreative())) {
ItemEntity drop = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, new ItemStack(this));
ItemEntity drop = new ItemEntity(
world,
pos.getX() + 0.5,
pos.getY() + 0.5,
pos.getZ() + 0.5,
new ItemStack(this)
);
world.addFreshEntity(drop);
}
}

View file

@ -54,7 +54,15 @@ public class MossyDragonBoneBlock extends BaseRotatedPillarBlock {
return false;
}
else {
int i = LayerLightEngine.getLightBlockInto(worldView, state, pos, blockState, blockPos, Direction.UP, blockState.getLightBlock(worldView, blockPos));
int i = LayerLightEngine.getLightBlockInto(
worldView,
state,
pos,
blockState,
blockPos,
Direction.UP,
blockState.getLightBlock(worldView, blockPos)
);
return i < 5;
}
}

View file

@ -21,7 +21,11 @@ public class MossyGlowshroomCapBlock extends BaseBlock {
}
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
return this.defaultBlockState().setValue(TRANSITION, EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(ctx.getLevel().getBlockState(ctx.getClickedPos().below())));
return this.defaultBlockState()
.setValue(
TRANSITION,
EndBlocks.MOSSY_GLOWSHROOM.isTreeLog(ctx.getLevel().getBlockState(ctx.getClickedPos().below()))
);
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {

View file

@ -5,7 +5,6 @@ import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
@ -22,7 +21,8 @@ public class MossyGlowshroomSaplingBlock extends PottableFeatureSapling {
@Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return world.getBlockState(pos.below()).is(EndBlocks.END_MOSS) || world.getBlockState(pos.below()).is(EndBlocks.END_MYCELIUM);
return world.getBlockState(pos.below()).is(EndBlocks.END_MOSS) || world.getBlockState(pos.below())
.is(EndBlocks.END_MYCELIUM);
}
@Override

View file

@ -51,7 +51,15 @@ public class MossyObsidian extends BaseBlock {
return false;
}
else {
int i = LayerLightEngine.getLightBlockInto(worldView, state, pos, blockState, blockPos, Direction.UP, blockState.getLightBlock(worldView, blockPos));
int i = LayerLightEngine.getLightBlockInto(
worldView,
state,
pos,
blockState,
blockPos,
Direction.UP,
blockState.getLightBlock(worldView, blockPos)
);
return i < 5;
}
}

View file

@ -33,7 +33,10 @@ public class NeedlegrassBlock extends EndPlantBlock {
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null && tool.is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
if (tool != null && tool.is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(
Enchantments.SILK_TOUCH,
tool
) > 0) {
return Lists.newArrayList(new ItemStack(this));
}
else {

View file

@ -39,7 +39,7 @@ import ru.bclib.blocks.BaseBlockNotFull;
import ru.bclib.blocks.BlockProperties;
import ru.bclib.blocks.BlockProperties.TripleShape;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper;
import ru.betterend.blocks.EndBlockProperties.CactusBottom;
@ -51,7 +51,7 @@ import java.util.List;
import java.util.Random;
@SuppressWarnings("deprecation")
public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWaterloggedBlock, IRenderTyped, PottablePlant {
public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWaterloggedBlock, RenderLayerProvider, PottablePlant {
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
public static final EnumProperty<CactusBottom> CACTUS_BOTTOM = EndBlockProperties.CACTUS_BOTTOM;
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
@ -67,7 +67,9 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
public NeonCactusPlantBlock() {
super(FabricBlockSettings.copyOf(Blocks.CACTUS).luminance(15).randomTicks());
registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false).setValue(FACING, Direction.UP).setValue(SHAPE, TripleShape.TOP));
registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false)
.setValue(FACING, Direction.UP)
.setValue(SHAPE, TripleShape.TOP));
}
@Override
@ -81,7 +83,9 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
BlockPos pos = ctx.getClickedPos();
Direction dir = ctx.getClickedFace();
BlockState down = world.getBlockState(pos.relative(dir.getOpposite()));
BlockState state = this.defaultBlockState().setValue(WATERLOGGED, world.getFluidState(pos).getType() == Fluids.WATER).setValue(FACING, ctx.getClickedFace());
BlockState state = this.defaultBlockState()
.setValue(WATERLOGGED, world.getFluidState(pos).getType() == Fluids.WATER)
.setValue(FACING, ctx.getClickedFace());
if (down.is(Blocks.END_STONE) || down.is(EndBlocks.ENDSTONE_DUST)) {
state = state.setValue(CACTUS_BOTTOM, CactusBottom.SAND);
}
@ -195,11 +199,17 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
Direction side = getSideDirection(world, pos, state, dir, random);
BlockPos sidePos = pos.relative(side);
if (world.isEmptyBlock(sidePos)) {
BlockState placement = state.setValue(SHAPE, TripleShape.TOP).setValue(CACTUS_BOTTOM, CactusBottom.EMPTY).setValue(WATERLOGGED, false).setValue(FACING, side);
BlockState placement = state.setValue(SHAPE, TripleShape.TOP)
.setValue(CACTUS_BOTTOM, CactusBottom.EMPTY)
.setValue(WATERLOGGED, false)
.setValue(FACING, side);
BlocksHelper.setWithoutUpdate(world, sidePos, placement);
}
}
BlockState placement = state.setValue(SHAPE, TripleShape.TOP).setValue(CACTUS_BOTTOM, CactusBottom.EMPTY).setValue(WATERLOGGED, false).setValue(FACING, dir);
BlockState placement = state.setValue(SHAPE, TripleShape.TOP)
.setValue(CACTUS_BOTTOM, CactusBottom.EMPTY)
.setValue(WATERLOGGED, false)
.setValue(FACING, dir);
BlocksHelper.setWithoutUpdate(world, pos.relative(dir), placement);
mutateStem(placement, world, pos, MAX_LENGTH);
}
@ -256,12 +266,18 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
Direction side = getSideDirection(world, pos, state, dir, random);
BlockPos sidePos = pos.relative(side);
if (world.isEmptyBlock(sidePos)) {
BlockState placement = state.setValue(SHAPE, TripleShape.TOP).setValue(CACTUS_BOTTOM, CactusBottom.EMPTY).setValue(WATERLOGGED, false).setValue(FACING, side);
BlockState placement = state.setValue(SHAPE, TripleShape.TOP)
.setValue(CACTUS_BOTTOM, CactusBottom.EMPTY)
.setValue(WATERLOGGED, false)
.setValue(FACING, side);
BlocksHelper.setWithoutUpdate(world, sidePos, placement);
ends.add(sidePos.mutable());
}
}
BlockState placement = state.setValue(SHAPE, TripleShape.TOP).setValue(CACTUS_BOTTOM, CactusBottom.EMPTY).setValue(WATERLOGGED, false).setValue(FACING, dir);
BlockState placement = state.setValue(SHAPE, TripleShape.TOP)
.setValue(CACTUS_BOTTOM, CactusBottom.EMPTY)
.setValue(WATERLOGGED, false)
.setValue(FACING, dir);
BlocksHelper.setWithoutUpdate(world, pos.relative(dir), placement);
mutateStem(placement, world, pos, MAX_LENGTH);
pos.move(dir);

View file

@ -23,7 +23,12 @@ public class PondAnemoneBlock extends EndUnderwaterPlantBlock {
private static final VoxelShape SHAPE = Block.box(2, 0, 2, 14, 14, 14);
public PondAnemoneBlock() {
super(FabricBlockSettings.of(Material.WATER_PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).luminance(13).sound(SoundType.CORAL_BLOCK).noCollission());
super(FabricBlockSettings.of(Material.WATER_PLANT)
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.luminance(13)
.sound(SoundType.CORAL_BLOCK)
.noCollission());
}
@Override

View file

@ -5,7 +5,6 @@ import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;

View file

@ -35,8 +35,8 @@ import ru.bclib.blocks.BaseBlock;
import ru.bclib.blocks.BlockProperties;
import ru.bclib.blocks.BlockProperties.TripleShape;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IColorProvider;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.CustomColorProvider;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.ColorUtil;
import ru.betterend.particle.InfusionParticleType;
@ -45,7 +45,7 @@ import ru.betterend.registry.EndItems;
import java.util.List;
public class RespawnObeliskBlock extends BaseBlock implements IColorProvider, IRenderTyped {
public class RespawnObeliskBlock extends BaseBlock implements CustomColorProvider, RenderLayerProvider {
private static final VoxelShape VOXEL_SHAPE_BOTTOM = Block.box(1, 0, 1, 15, 16, 15);
private static final VoxelShape VOXEL_SHAPE_MIDDLE_TOP = Block.box(2, 0, 2, 14, 16, 14);
@ -145,7 +145,7 @@ public class RespawnObeliskBlock extends BaseBlock implements IColorProvider, IR
@Override
public BlockColor getProvider() {
return ((IColorProvider) EndBlocks.AURORA_CRYSTAL).getProvider();
return ((CustomColorProvider) EndBlocks.AURORA_CRYSTAL).getProvider();
}
@Override
@ -162,7 +162,10 @@ public class RespawnObeliskBlock extends BaseBlock implements IColorProvider, IR
if (hand != InteractionHand.MAIN_HAND || !canActivate) {
if (!world.isClientSide && !(itemStack.getItem() instanceof BlockItem) && !player.isCreative()) {
ServerPlayer serverPlayerEntity = (ServerPlayer) player;
serverPlayerEntity.displayClientMessage(new TranslatableComponent("message.betterend.fail_spawn"), true);
serverPlayerEntity.displayClientMessage(
new TranslatableComponent("message.betterend.fail_spawn"),
true
);
}
return InteractionResult.FAIL;
}

View file

@ -21,7 +21,12 @@ public class RunedFlavolite extends BaseBlock {
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE;
public RunedFlavolite(boolean unbreakable) {
super(FabricBlockSettings.copyOf(EndBlocks.FLAVOLITE.polished).strength(unbreakable ? -1 : 1, unbreakable ? Blocks.BEDROCK.getExplosionResistance() : Blocks.OBSIDIAN.getExplosionResistance()).luminance(state -> {
super(FabricBlockSettings.copyOf(EndBlocks.FLAVOLITE.polished)
.strength(
unbreakable ? -1 : 1,
unbreakable ? Blocks.BEDROCK.getExplosionResistance() : Blocks.OBSIDIAN.getExplosionResistance()
)
.luminance(state -> {
return state.getValue(ACTIVATED) ? 8 : 0;
}));
this.registerDefaultState(stateDefinition.any().setValue(ACTIVATED, false));

View file

@ -20,7 +20,15 @@ public class ShadowGrassBlock extends EndTerrainBlock {
public void animateTick(BlockState state, Level world, BlockPos pos, Random random) {
super.animateTick(state, world, pos, random);
if (random.nextInt(32) == 0) {
world.addParticle(EndParticles.BLACK_SPORE, (double) pos.getX() + random.nextDouble(), (double) pos.getY() + 1.1D, (double) pos.getZ() + random.nextDouble(), 0.0D, 0.0D, 0.0D);
world.addParticle(
EndParticles.BLACK_SPORE,
(double) pos.getX() + random.nextDouble(),
(double) pos.getY() + 1.1D,
(double) pos.getZ() + random.nextDouble(),
0.0D,
0.0D,
0.0D
);
}
}
}

View file

@ -41,7 +41,13 @@ public class SilkMothHiveBlock extends BaseBlock {
public static final IntegerProperty FULLNESS = EndBlockProperties.FULLNESS;
public SilkMothHiveBlock() {
super(FabricBlockSettings.of(Material.WOOD).breakByHand(true).hardness(0.5F).resistance(0.1F).sound(SoundType.WOOL).noOcclusion().randomTicks());
super(FabricBlockSettings.of(Material.WOOD)
.breakByHand(true)
.hardness(0.5F)
.resistance(0.1F)
.sound(SoundType.WOOL)
.noOcclusion()
.randomTicks());
this.registerDefaultState(defaultBlockState().setValue(FULLNESS, 0));
}

View file

@ -37,7 +37,7 @@ import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import ru.bclib.blocks.BaseBlock;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper;
import ru.betterend.entity.SilkMothEntity;
@ -48,7 +48,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Random;
public class SilkMothNestBlock extends BaseBlock implements IRenderTyped {
public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider {
public static final BooleanProperty ACTIVE = EndBlockProperties.ACTIVE;
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public static final IntegerProperty FULLNESS = EndBlockProperties.FULLNESS;
@ -56,7 +56,12 @@ public class SilkMothNestBlock extends BaseBlock implements IRenderTyped {
private static final VoxelShape BOTTOM = box(0, 0, 0, 16, 16, 16);
public SilkMothNestBlock() {
super(FabricBlockSettings.of(Material.WOOL).hardness(0.5F).resistance(0.1F).sound(SoundType.WOOL).noOcclusion().randomTicks());
super(FabricBlockSettings.of(Material.WOOL)
.hardness(0.5F)
.resistance(0.1F)
.sound(SoundType.WOOL)
.noOcclusion()
.randomTicks());
this.registerDefaultState(defaultBlockState().setValue(ACTIVE, true).setValue(FULLNESS, 0));
}
@ -84,7 +89,8 @@ public class SilkMothNestBlock extends BaseBlock implements IRenderTyped {
@Override
public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
if (!state.getValue(ACTIVE)) {
if (canSupportCenter(world, pos.above(), Direction.DOWN) || world.getBlockState(pos.above()).is(BlockTags.LEAVES)) {
if (canSupportCenter(world, pos.above(), Direction.DOWN) || world.getBlockState(pos.above())
.is(BlockTags.LEAVES)) {
return state;
}
else {

View file

@ -30,7 +30,8 @@ public class SmallAmaranitaBlock extends EndPlantBlock {
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
BlockPos bigPos = growBig(world, pos);
if (bigPos != null) {
if (EndFeatures.GIGANTIC_AMARANITA.getFeature().place(new FeaturePlaceContext<>(world, null, random, bigPos, null))) {
if (EndFeatures.GIGANTIC_AMARANITA.getFeature()
.place(new FeaturePlaceContext<>(world, null, random, bigPos, null))) {
replaceMushroom(world, bigPos);
replaceMushroom(world, bigPos.south());
replaceMushroom(world, bigPos.east());
@ -60,7 +61,8 @@ public class SmallAmaranitaBlock extends EndPlantBlock {
}
private boolean checkFrame(ServerLevel world, BlockPos pos) {
return world.getBlockState(pos).is(this) && world.getBlockState(pos.south()).is(this) && world.getBlockState(pos.east()).is(this) && world.getBlockState(pos.south().east()).is(this);
return world.getBlockState(pos).is(this) && world.getBlockState(pos.south()).is(this) && world.getBlockState(pos
.east()).is(this) && world.getBlockState(pos.south().east()).is(this);
}
private void replaceMushroom(ServerLevel world, BlockPos pos) {

View file

@ -30,7 +30,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
import ru.bclib.api.TagAPI;
import ru.bclib.blocks.BaseAttachedBlock;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.BlocksHelper;
import ru.betterend.interfaces.PottablePlant;
import ru.betterend.registry.EndFeatures;
@ -39,11 +39,15 @@ import java.util.EnumMap;
import java.util.List;
import java.util.Random;
public class SmallJellyshroomBlock extends BaseAttachedBlock implements IRenderTyped, BonemealableBlock, PottablePlant {
public class SmallJellyshroomBlock extends BaseAttachedBlock implements RenderLayerProvider, BonemealableBlock, PottablePlant {
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
public SmallJellyshroomBlock() {
super(FabricBlockSettings.of(Material.PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).sound(SoundType.NETHER_WART).noCollission());
super(FabricBlockSettings.of(Material.PLANT)
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.NETHER_WART)
.noCollission());
}
@Override
@ -55,7 +59,10 @@ public class SmallJellyshroomBlock extends BaseAttachedBlock implements IRenderT
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null && tool.is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
if (tool != null && tool.is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(
Enchantments.SILK_TOUCH,
tool
) > 0) {
return Lists.newArrayList(new ItemStack(this));
}
else {

View file

@ -8,6 +8,12 @@ import ru.betterend.blocks.basis.LitPillarBlock;
public class SmaragdantCrystalBlock extends LitPillarBlock {
public SmaragdantCrystalBlock() {
super(FabricBlockSettings.of(Material.GLASS).breakByTool(FabricToolTags.PICKAXES).luminance(15).hardness(1F).resistance(1F).noOcclusion().sound(SoundType.AMETHYST));
super(FabricBlockSettings.of(Material.GLASS)
.breakByTool(FabricToolTags.PICKAXES)
.luminance(15)
.hardness(1F)
.resistance(1F)
.noOcclusion()
.sound(SoundType.AMETHYST));
}
}

View file

@ -27,17 +27,23 @@ import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import ru.bclib.blocks.BaseAttachedBlock;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.RenderLayerProvider;
import java.util.EnumMap;
@SuppressWarnings("deprecation")
public class SmaragdantCrystalShardBlock extends BaseAttachedBlock implements IRenderTyped, SimpleWaterloggedBlock, LiquidBlockContainer {
public class SmaragdantCrystalShardBlock extends BaseAttachedBlock implements RenderLayerProvider, SimpleWaterloggedBlock, LiquidBlockContainer {
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
public SmaragdantCrystalShardBlock() {
super(FabricBlockSettings.of(Material.STONE).materialColor(MaterialColor.COLOR_GREEN).breakByTool(FabricToolTags.PICKAXES).luminance(15).sound(SoundType.AMETHYST_CLUSTER).requiresCorrectToolForDrops().noCollission());
super(FabricBlockSettings.of(Material.STONE)
.materialColor(MaterialColor.COLOR_GREEN)
.breakByTool(FabricToolTags.PICKAXES)
.luminance(15)
.sound(SoundType.AMETHYST_CLUSTER)
.requiresCorrectToolForDrops()
.noCollission());
}
@Override

View file

@ -31,7 +31,7 @@ import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import ru.bclib.blocks.BaseAttachedBlock;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.MHelper;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndItems;
@ -41,13 +41,18 @@ import java.util.EnumMap;
import java.util.List;
@SuppressWarnings("deprecation")
public class SulphurCrystalBlock extends BaseAttachedBlock implements IRenderTyped, SimpleWaterloggedBlock, LiquidBlockContainer {
public class SulphurCrystalBlock extends BaseAttachedBlock implements RenderLayerProvider, 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).breakByTool(FabricToolTags.PICKAXES).sound(SoundType.GLASS).requiresCorrectToolForDrops().noCollission());
super(FabricBlockSettings.of(Material.STONE)
.materialColor(MaterialColor.COLOR_YELLOW)
.breakByTool(FabricToolTags.PICKAXES)
.sound(SoundType.GLASS)
.requiresCorrectToolForDrops()
.noCollission());
}
@Override
@ -63,7 +68,10 @@ public class SulphurCrystalBlock extends BaseAttachedBlock implements IRenderTyp
@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)));
return state.getValue(AGE) < 2 ? Collections.emptyList() : Lists.newArrayList(new ItemStack(
EndItems.CRYSTALLINE_SULPHUR,
MHelper.randRange(1, 3, MHelper.RANDOM)
));
}
@Override

View file

@ -11,14 +11,14 @@ import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import ru.bclib.blocks.BaseVineBlock;
import ru.bclib.interfaces.IColorProvider;
import ru.bclib.interfaces.CustomColorProvider;
import ru.bclib.util.ColorUtil;
import ru.bclib.util.MHelper;
import ru.betterend.registry.EndParticles;
import java.util.Random;
public class TenaneaFlowersBlock extends BaseVineBlock implements IColorProvider {
public class TenaneaFlowersBlock extends BaseVineBlock implements CustomColorProvider {
public static final Vec3i[] COLORS;
public TenaneaFlowersBlock() {
@ -73,6 +73,11 @@ public class TenaneaFlowersBlock extends BaseVineBlock implements IColorProvider
}
static {
COLORS = new Vec3i[]{new Vec3i(250, 111, 222), new Vec3i(167, 89, 255), new Vec3i(120, 207, 239), new Vec3i(255, 87, 182)};
COLORS = new Vec3i[] {
new Vec3i(250, 111, 222),
new Vec3i(167, 89, 255),
new Vec3i(120, 207, 239),
new Vec3i(255, 87, 182)
};
}
}

View file

@ -5,7 +5,6 @@ import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;

View file

@ -42,7 +42,8 @@ public class TwistedUmbrellaMossBlock extends EndPlantBlock {
@Override
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
int rot = world.random.nextInt(4);
BlockState bs = EndBlocks.TWISTED_UMBRELLA_MOSS_TALL.defaultBlockState().setValue(BaseDoublePlantBlock.ROTATION, rot);
BlockState bs = EndBlocks.TWISTED_UMBRELLA_MOSS_TALL.defaultBlockState()
.setValue(BaseDoublePlantBlock.ROTATION, rot);
BlocksHelper.setWithoutUpdate(world, pos, bs);
BlocksHelper.setWithoutUpdate(world, pos.above(), bs.setValue(BaseDoublePlantBlock.TOP, true));
}

View file

@ -17,7 +17,13 @@ public class TwistedUmbrellaMossTallBlock extends BaseDoublePlantBlock {
@Override
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
ItemEntity item = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, new ItemStack(EndBlocks.TWISTED_UMBRELLA_MOSS));
ItemEntity item = new ItemEntity(
world,
pos.getX() + 0.5,
pos.getY() + 0.5,
pos.getZ() + 0.5,
new ItemStack(EndBlocks.TWISTED_UMBRELLA_MOSS)
);
world.addFreshEntity(item);
}

View file

@ -17,7 +17,13 @@ public class UmbrellaMossTallBlock extends BaseDoublePlantBlock {
@Override
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
ItemEntity item = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, new ItemStack(EndBlocks.UMBRELLA_MOSS));
ItemEntity item = new ItemEntity(
world,
pos.getX() + 0.5,
pos.getY() + 0.5,
pos.getZ() + 0.5,
new ItemStack(EndBlocks.UMBRELLA_MOSS)
);
world.addFreshEntity(item);
}

View file

@ -27,7 +27,9 @@ public class UmbrellaTreeClusterBlock extends BaseBlock {
public static final BooleanProperty NATURAL = BlockProperties.NATURAL;
public UmbrellaTreeClusterBlock() {
super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK).materialColor(MaterialColor.COLOR_PURPLE).luminance(15));
super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK)
.materialColor(MaterialColor.COLOR_PURPLE)
.luminance(15));
registerDefaultState(stateDefinition.any().setValue(NATURAL, false));
}
@ -45,8 +47,21 @@ public class UmbrellaTreeClusterBlock extends BaseBlock {
}
stack = new ItemStack(EndItems.UMBRELLA_CLUSTER_JUICE);
player.addItem(stack);
world.playLocalSound(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, SoundEvents.BOTTLE_FILL, SoundSource.BLOCKS, 1, 1, false);
BlocksHelper.setWithUpdate(world, pos, EndBlocks.UMBRELLA_TREE_CLUSTER_EMPTY.defaultBlockState().setValue(NATURAL, state.getValue(NATURAL)));
world.playLocalSound(
pos.getX() + 0.5,
pos.getY() + 0.5,
pos.getZ() + 0.5,
SoundEvents.BOTTLE_FILL,
SoundSource.BLOCKS,
1,
1,
false
);
BlocksHelper.setWithUpdate(
world,
pos,
EndBlocks.UMBRELLA_TREE_CLUSTER_EMPTY.defaultBlockState().setValue(NATURAL, state.getValue(NATURAL))
);
return InteractionResult.SUCCESS;
}
return InteractionResult.FAIL;

View file

@ -19,7 +19,9 @@ public class UmbrellaTreeClusterEmptyBlock extends BaseBlock {
public static final BooleanProperty NATURAL = EndBlockProperties.NATURAL;
public UmbrellaTreeClusterEmptyBlock() {
super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK).materialColor(MaterialColor.COLOR_PURPLE).randomTicks());
super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK)
.materialColor(MaterialColor.COLOR_PURPLE)
.randomTicks());
registerDefaultState(stateDefinition.any().setValue(NATURAL, false));
}
@ -31,7 +33,11 @@ public class UmbrellaTreeClusterEmptyBlock extends BaseBlock {
@Override
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
if (state.getValue(NATURAL) && random.nextInt(16) == 0) {
BlocksHelper.setWithUpdate(world, pos, EndBlocks.UMBRELLA_TREE_CLUSTER.defaultBlockState().setValue(UmbrellaTreeClusterBlock.NATURAL, true));
BlocksHelper.setWithUpdate(
world,
pos,
EndBlocks.UMBRELLA_TREE_CLUSTER.defaultBlockState().setValue(UmbrellaTreeClusterBlock.NATURAL, true)
);
}
}
}

View file

@ -18,9 +18,9 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.storage.loot.LootContext;
import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.BlockModelProvider;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.MHelper;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
@ -28,7 +28,7 @@ import ru.betterend.registry.EndBlocks;
import java.util.Collections;
import java.util.List;
public class UmbrellaTreeMembraneBlock extends SlimeBlock implements IRenderTyped, BlockModelProvider {
public class UmbrellaTreeMembraneBlock extends SlimeBlock implements RenderLayerProvider, BlockModelProvider {
public static final IntegerProperty COLOR = EndBlockProperties.COLOR;
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
@ -60,7 +60,8 @@ public class UmbrellaTreeMembraneBlock extends SlimeBlock implements IRenderType
return Lists.newArrayList(new ItemStack(this));
}
else {
return MHelper.RANDOM.nextInt(4) == 0 ? Lists.newArrayList(new ItemStack(EndBlocks.UMBRELLA_TREE_SAPLING)) : Collections.emptyList();
return MHelper.RANDOM.nextInt(4) == 0 ? Lists.newArrayList(new ItemStack(EndBlocks.UMBRELLA_TREE_SAPLING)) : Collections
.emptyList();
}
}

View file

@ -5,7 +5,6 @@ import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock;
import ru.bclib.client.render.BCLRenderLayer;
import ru.betterend.blocks.basis.PottableFeatureSapling;
import ru.betterend.registry.EndBlocks;

View file

@ -87,7 +87,16 @@ public class VentBubbleColumnBlock extends Block implements BucketPickup, Liquid
world.addAlwaysVisibleParticle(ParticleTypes.BUBBLE_COLUMN_UP, px, py, pz, 0, 0.04, 0);
}
if (random.nextInt(200) == 0) {
world.playLocalSound(pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BUBBLE_COLUMN_UPWARDS_AMBIENT, SoundSource.BLOCKS, 0.2F + random.nextFloat() * 0.2F, 0.9F + random.nextFloat() * 0.15F, false);
world.playLocalSound(
pos.getX(),
pos.getY(),
pos.getZ(),
SoundEvents.BUBBLE_COLUMN_UPWARDS_AMBIENT,
SoundSource.BLOCKS,
0.2F + random.nextFloat() * 0.2F,
0.9F + random.nextFloat() * 0.15F,
false
);
}
}
@ -100,8 +109,28 @@ public class VentBubbleColumnBlock extends Block implements BucketPickup, Liquid
ServerLevel serverWorld = (ServerLevel) world;
for (int i = 0; i < 2; ++i) {
serverWorld.sendParticles(ParticleTypes.SPLASH, (double) pos.getX() + world.random.nextDouble(), (double) (pos.getY() + 1), (double) pos.getZ() + world.random.nextDouble(), 1, 0.0D, 0.0D, 0.0D, 1.0D);
serverWorld.sendParticles(ParticleTypes.BUBBLE, (double) pos.getX() + world.random.nextDouble(), (double) (pos.getY() + 1), (double) pos.getZ() + world.random.nextDouble(), 1, 0.0D, 0.01D, 0.0D, 0.2D);
serverWorld.sendParticles(
ParticleTypes.SPLASH,
(double) pos.getX() + world.random.nextDouble(),
(double) (pos.getY() + 1),
(double) pos.getZ() + world.random.nextDouble(),
1,
0.0D,
0.0D,
0.0D,
1.0D
);
serverWorld.sendParticles(
ParticleTypes.BUBBLE,
(double) pos.getX() + world.random.nextDouble(),
(double) (pos.getY() + 1),
(double) pos.getZ() + world.random.nextDouble(),
1,
0.0D,
0.01D,
0.0D,
0.2D
);
}
}
}

View file

@ -72,7 +72,8 @@ public class EndAnvilBlock extends BaseAnvilBlock {
@Override
public BlockState getStateForPlacement(@NotNull BlockPlaceContext blockPlaceContext) {
return Objects.requireNonNull(super.getStateForPlacement(blockPlaceContext)).setValue(durability, maxDurability);
return Objects.requireNonNull(super.getStateForPlacement(blockPlaceContext))
.setValue(durability, maxDurability);
}
@Override

View file

@ -21,25 +21,34 @@ import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import ru.bclib.blocks.BaseAttachedBlock;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.MHelper;
import java.util.EnumMap;
import java.util.List;
public class FurBlock extends BaseAttachedBlock implements IRenderTyped {
public class FurBlock extends BaseAttachedBlock implements RenderLayerProvider {
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
private final ItemLike drop;
private final int dropChance;
public FurBlock(ItemLike drop, int light, int dropChance, boolean wet) {
super(FabricBlockSettings.of(Material.REPLACEABLE_PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).luminance(light).sound(wet ? SoundType.WET_GRASS : SoundType.GRASS).noCollission());
super(FabricBlockSettings.of(Material.REPLACEABLE_PLANT)
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.luminance(light)
.sound(wet ? SoundType.WET_GRASS : SoundType.GRASS)
.noCollission());
this.drop = drop;
this.dropChance = dropChance;
}
public FurBlock(ItemLike drop, int dropChance) {
super(FabricBlockSettings.of(Material.REPLACEABLE_PLANT).breakByTool(FabricToolTags.SHEARS).breakByHand(true).sound(SoundType.GRASS).noCollission());
super(FabricBlockSettings.of(Material.REPLACEABLE_PLANT)
.breakByTool(FabricToolTags.SHEARS)
.breakByHand(true)
.sound(SoundType.GRASS)
.noCollission());
this.drop = drop;
this.dropChance = dropChance;
}
@ -52,7 +61,10 @@ public class FurBlock extends BaseAttachedBlock implements IRenderTyped {
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null && tool.is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
if (tool != null && tool.is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(
Enchantments.SILK_TOUCH,
tool
) > 0) {
return Lists.newArrayList(new ItemStack(this));
}
else if (dropChance < 1 || MHelper.RANDOM.nextInt(dropChance) == 0) {

View file

@ -95,7 +95,10 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
public PedestalBlock(Block parent) {
super(FabricBlockSettings.copyOf(parent).luminance(getLuminance(parent.defaultBlockState())));
this.registerDefaultState(stateDefinition.any().setValue(STATE, PedestalState.DEFAULT).setValue(HAS_ITEM, false).setValue(HAS_LIGHT, false));
this.registerDefaultState(stateDefinition.any()
.setValue(STATE, PedestalState.DEFAULT)
.setValue(HAS_ITEM, false)
.setValue(HAS_LIGHT, false));
this.parent = parent;
}
@ -432,7 +435,10 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
@Environment(EnvType.CLIENT)
public UnbakedModel getModelVariant(ResourceLocation stateId, BlockState blockState, Map<ResourceLocation, UnbakedModel> modelCache) {
PedestalState state = blockState.getValue(STATE);
ResourceLocation modelId = new ResourceLocation(stateId.getNamespace(), "block/" + stateId.getPath() + "_" + state);
ResourceLocation modelId = new ResourceLocation(
stateId.getNamespace(),
"block/" + stateId.getPath() + "_" + state
);
registerBlockModel(stateId, modelId, blockState, modelCache);
return ModelsHelper.createBlockSimple(modelId);
}

View file

@ -1,7 +1,5 @@
package ru.betterend.blocks.basis;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.levelgen.feature.Feature;
import ru.bclib.blocks.FeatureSaplingBlock;
import ru.betterend.interfaces.PottablePlant;

View file

@ -15,13 +15,13 @@ import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.ModelsHelper;
import ru.bclib.interfaces.IColorProvider;
import ru.bclib.interfaces.CustomColorProvider;
import ru.betterend.client.models.Patterns;
import ru.betterend.registry.EndBlocks;
import java.util.Optional;
public class StoneLanternBlock extends EndLanternBlock implements IColorProvider {
public class StoneLanternBlock extends EndLanternBlock implements CustomColorProvider {
private static final VoxelShape SHAPE_CEIL = Block.box(3, 1, 3, 13, 16, 13);
private static final VoxelShape SHAPE_FLOOR = Block.box(3, 0, 3, 13, 15, 13);
@ -31,12 +31,12 @@ public class StoneLanternBlock extends EndLanternBlock implements IColorProvider
@Override
public BlockColor getProvider() {
return ((IColorProvider) EndBlocks.AURORA_CRYSTAL).getProvider();
return ((CustomColorProvider) EndBlocks.AURORA_CRYSTAL).getProvider();
}
@Override
public ItemColor getItemProvider() {
return ((IColorProvider) EndBlocks.AURORA_CRYSTAL).getItemProvider();
return ((CustomColorProvider) EndBlocks.AURORA_CRYSTAL).getItemProvider();
}
@Override
@ -48,7 +48,11 @@ public class StoneLanternBlock extends EndLanternBlock implements IColorProvider
@Environment(EnvType.CLIENT)
public @Nullable BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
String blockName = resourceLocation.getPath();
Optional<String> pattern = blockState.getValue(IS_FLOOR) ? Patterns.createJson(Patterns.BLOCK_STONE_LANTERN_FLOOR, blockName, blockName) : Patterns.createJson(Patterns.BLOCK_STONE_LANTERN_CEIL, blockName, blockName);
Optional<String> pattern = blockState.getValue(IS_FLOOR) ? Patterns.createJson(
Patterns.BLOCK_STONE_LANTERN_FLOOR,
blockName,
blockName
) : Patterns.createJson(Patterns.BLOCK_STONE_LANTERN_CEIL, blockName, blockName);
return ModelsHelper.fromPattern(pattern);
}
}

View file

@ -30,13 +30,25 @@ public class ColoredMaterial {
String id = Registry.BLOCK.getKey(source).getPath();
colors.forEach((color, name) -> {
String blockName = id + "_" + name;
Block block = constructor.apply(FabricBlockSettings.copyOf(source).materialColor(MaterialColor.COLOR_BLACK));
Block block = constructor.apply(FabricBlockSettings.copyOf(source)
.materialColor(MaterialColor.COLOR_BLACK));
EndBlocks.registerBlock(blockName, block);
if (craftEight) {
GridRecipe.make(BetterEnd.MOD_ID, blockName, block).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(8).setShape("###", "#D#", "###").addMaterial('#', source).addMaterial('D', dyes.get(color)).build();
GridRecipe.make(BetterEnd.MOD_ID, blockName, block)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(8)
.setShape("###", "#D#", "###")
.addMaterial('#', source)
.addMaterial('D', dyes.get(color))
.build();
}
else {
GridRecipe.make(BetterEnd.MOD_ID, blockName, block).checkConfig(Configs.RECIPE_CONFIG).setList("#D").addMaterial('#', source).addMaterial('D', dyes.get(color)).build();
GridRecipe.make(BetterEnd.MOD_ID, blockName, block)
.checkConfig(Configs.RECIPE_CONFIG)
.setList("#D")
.addMaterial('#', source)
.addMaterial('D', dyes.get(color))
.build();
}
this.colors.put(color, block);
BlocksHelper.addBlockColor(block, color);

View file

@ -45,18 +45,77 @@ public class CrystalSubblocksMaterial {
brick_wall = EndBlocks.registerBlock(name + "_bricks_wall", new BaseWallBlock(bricks));
// Recipes //
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks", bricks).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("##", "##").addMaterial('#', source).setGroup("end_bricks").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_polished", polished).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("##", "##").addMaterial('#', bricks).setGroup("end_tile").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_tiles", tiles).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("##", "##").addMaterial('#', polished).setGroup("end_small_tile").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_pillar", pillar).checkConfig(Configs.RECIPE_CONFIG).setShape("#", "#").addMaterial('#', slab).setGroup("end_pillar").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks", bricks)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(4)
.setShape("##", "##")
.addMaterial('#', source)
.setGroup("end_bricks")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_polished", polished)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(4)
.setShape("##", "##")
.addMaterial('#', bricks)
.setGroup("end_tile")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_tiles", tiles)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(4)
.setShape("##", "##")
.addMaterial('#', polished)
.setGroup("end_small_tile")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_pillar", pillar)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("#", "#")
.addMaterial('#', slab)
.setGroup("end_pillar")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_stairs", stairs).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("# ", "## ", "###").addMaterial('#', source).setGroup("end_stone_stairs").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_slab", slab).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###").addMaterial('#', source).setGroup("end_stone_slabs").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_stairs", brick_stairs).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("# ", "## ", "###").addMaterial('#', bricks).setGroup("end_stone_stairs").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_slab", brick_slab).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###").addMaterial('#', bricks).setGroup("end_stone_slabs").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_stairs", stairs)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(4)
.setShape("# ", "## ", "###")
.addMaterial('#', source)
.setGroup("end_stone_stairs")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_slab", slab)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(6)
.setShape("###")
.addMaterial('#', source)
.setGroup("end_stone_slabs")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_stairs", brick_stairs)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(4)
.setShape("# ", "## ", "###")
.addMaterial('#', bricks)
.setGroup("end_stone_stairs")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_slab", brick_slab)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(6)
.setShape("###")
.addMaterial('#', bricks)
.setGroup("end_stone_slabs")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_wall", wall).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###", "###").addMaterial('#', source).setGroup("end_wall").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_wall", brick_wall).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###", "###").addMaterial('#', bricks).setGroup("end_wall").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_wall", wall)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(6)
.setShape("###", "###")
.addMaterial('#', source)
.setGroup("end_wall")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_wall", brick_wall)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(6)
.setShape("###", "###")
.addMaterial('#', bricks)
.setGroup("end_wall")
.build();
CraftingRecipes.registerPedestal(name + "_pedestal", pedestal, slab, pillar);

View file

@ -40,7 +40,6 @@ import ru.betterend.blocks.BulbVineLanternColoredBlock;
import ru.betterend.blocks.ChandelierBlock;
import ru.betterend.blocks.basis.EndAnvilBlock;
import ru.betterend.config.Configs;
import ru.betterend.item.EndAnvilItem;
import ru.betterend.item.EndArmorItem;
import ru.betterend.item.tool.EndHammerItem;
import ru.betterend.item.tool.EndPickaxe;
@ -94,23 +93,61 @@ public class MetalMaterial {
public final Tag.Named<Item> alloyingOre;
public static MetalMaterial makeNormal(String name, MaterialColor color, Tier material, ArmorMaterial armor) {
return new MetalMaterial(name, true, FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).materialColor(color), EndItems.makeEndItemSettings(), material, armor);
return new MetalMaterial(
name,
true,
FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).materialColor(color),
EndItems.makeEndItemSettings(),
material,
armor
);
}
public static MetalMaterial makeNormal(String name, MaterialColor color, float hardness, float resistance, Tier material, ArmorMaterial armor) {
return new MetalMaterial(name, true, FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).materialColor(color).hardness(hardness).resistance(resistance), EndItems.makeEndItemSettings(), material, armor);
return new MetalMaterial(
name,
true,
FabricBlockSettings.copyOf(Blocks.IRON_BLOCK)
.materialColor(color)
.hardness(hardness)
.resistance(resistance),
EndItems.makeEndItemSettings(),
material,
armor
);
}
public static MetalMaterial makeOreless(String name, MaterialColor color, Tier material, ArmorMaterial armor) {
return new MetalMaterial(name, false, FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).materialColor(color), EndItems.makeEndItemSettings(), material, armor);
return new MetalMaterial(
name,
false,
FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).materialColor(color),
EndItems.makeEndItemSettings(),
material,
armor
);
}
public static MetalMaterial makeOreless(String name, MaterialColor color, float hardness, float resistance, Tier material, ArmorMaterial armor) {
return new MetalMaterial(name, false, FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).materialColor(color).hardness(hardness).resistance(resistance), EndItems.makeEndItemSettings(), material, armor);
return new MetalMaterial(
name,
false,
FabricBlockSettings.copyOf(Blocks.IRON_BLOCK)
.materialColor(color)
.hardness(hardness)
.resistance(resistance),
EndItems.makeEndItemSettings(),
material,
armor
);
}
private MetalMaterial(String name, boolean hasOre, FabricBlockSettings settings, Properties itemSettings, Tier material, ArmorMaterial armor) {
BlockBehaviour.Properties lanternProperties = FabricBlockSettings.copyOf(settings).hardness(1).resistance(1).luminance(15).sound(SoundType.LANTERN);
BlockBehaviour.Properties lanternProperties = FabricBlockSettings.copyOf(settings)
.hardness(1)
.resistance(1)
.luminance(15)
.sound(SoundType.LANTERN);
final int level = material.getLevel();
rawOre = hasOre ? EndItems.registerEndItem(name + "_raw", new ModelProviderItem(itemSettings)) : null;
@ -149,75 +186,304 @@ public class MetalMaterial {
pickaxe = EndItems.registerEndTool(name + "_pickaxe", new EndPickaxe(material, 1, -2.8F, itemSettings));
axe = EndItems.registerEndTool(name + "_axe", new BaseAxeItem(material, 6.0F, -3.0F, itemSettings));
hoe = EndItems.registerEndTool(name + "_hoe", new BaseHoeItem(material, -3, 0.0F, itemSettings));
hammer = EndItems.registerEndTool(name + "_hammer", new EndHammerItem(material, 5.0F, -3.2F, 0.3D, itemSettings));
hammer = EndItems.registerEndTool(
name + "_hammer",
new EndHammerItem(material, 5.0F, -3.2F, 0.3D, itemSettings)
);
forgedPlate = EndItems.registerEndItem(name + "_forged_plate");
helmet = EndItems.registerEndItem(name + "_helmet", new EndArmorItem(armor, EquipmentSlot.HEAD, itemSettings));
chestplate = EndItems.registerEndItem(name + "_chestplate", new EndArmorItem(armor, EquipmentSlot.CHEST, itemSettings));
leggings = EndItems.registerEndItem(name + "_leggings", new EndArmorItem(armor, EquipmentSlot.LEGS, itemSettings));
chestplate = EndItems.registerEndItem(
name + "_chestplate",
new EndArmorItem(armor, EquipmentSlot.CHEST, itemSettings)
);
leggings = EndItems.registerEndItem(
name + "_leggings",
new EndArmorItem(armor, EquipmentSlot.LEGS, itemSettings)
);
boots = EndItems.registerEndItem(name + "_boots", new EndArmorItem(armor, EquipmentSlot.FEET, itemSettings));
anvilBlock = EndBlocks.registerAnvil(name + "_anvil", new EndAnvilBlock(this, block.defaultMaterialColor(), level));
anvilBlock = EndBlocks.registerAnvil(
name + "_anvil",
new EndAnvilBlock(this, block.defaultMaterialColor(), level)
);
if (hasOre) {
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_ingot_furnace_ore", ore, ingot).checkConfig(Configs.RECIPE_CONFIG).setGroup("end_ingot").buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_ingot_furnace_raw", rawOre, ingot).checkConfig(Configs.RECIPE_CONFIG).setGroup("end_ingot").buildWithBlasting();
AlloyingRecipe.Builder.create(name + "_ingot_alloy").setInput(alloyingOre, alloyingOre).setOutput(ingot, 3).setExpiriense(2.1F).build();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_ingot_furnace_ore", ore, ingot)
.checkConfig(Configs.RECIPE_CONFIG)
.setGroup("end_ingot")
.buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_ingot_furnace_raw", rawOre, ingot)
.checkConfig(Configs.RECIPE_CONFIG)
.setGroup("end_ingot")
.buildWithBlasting();
AlloyingRecipe.Builder.create(name + "_ingot_alloy")
.setInput(alloyingOre, alloyingOre)
.setOutput(ingot, 3)
.setExpiriense(2.1F)
.build();
}
// Basic recipes
GridRecipe.make(BetterEnd.MOD_ID, name + "_ingot_from_nuggets", ingot).checkConfig(Configs.RECIPE_CONFIG).setShape("###", "###", "###").addMaterial('#', nugget).setGroup("end_metal_ingots_nug").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_nuggets_from_ingot", nugget).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(9).setList("#").addMaterial('#', ingot).setGroup("end_metal_nuggets_ing").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_block", block).checkConfig(Configs.RECIPE_CONFIG).setShape("###", "###", "###").addMaterial('#', ingot).setGroup("end_metal_blocks").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_ingot_from_block", ingot).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(9).setList("#").addMaterial('#', block).setGroup("end_metal_ingots").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_ingot_from_nuggets", ingot)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("###", "###", "###")
.addMaterial('#', nugget)
.setGroup("end_metal_ingots_nug")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_nuggets_from_ingot", nugget)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(9)
.setList("#")
.addMaterial('#', ingot)
.setGroup("end_metal_nuggets_ing")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_block", block)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("###", "###", "###")
.addMaterial('#', ingot)
.setGroup("end_metal_blocks")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_ingot_from_block", ingot)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(9)
.setList("#")
.addMaterial('#', block)
.setGroup("end_metal_ingots")
.build();
// Block recipes
GridRecipe.make(BetterEnd.MOD_ID, name + "_tile", tile).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("##", "##").addMaterial('#', block).setGroup("end_metal_tiles").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bars", bars).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(16).setShape("###", "###").addMaterial('#', ingot).setGroup("end_metal_bars").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_pressure_plate", pressurePlate).checkConfig(Configs.RECIPE_CONFIG).setShape("##").addMaterial('#', ingot).setGroup("end_metal_plates").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_door", door).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(3).setShape("##", "##", "##").addMaterial('#', ingot).setGroup("end_metal_doors").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_trapdoor", trapdoor).checkConfig(Configs.RECIPE_CONFIG).setShape("##", "##").addMaterial('#', ingot).setGroup("end_metal_trapdoors").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_stairs", stairs).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("# ", "## ", "###").addMaterial('#', block, tile).setGroup("end_metal_stairs").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_slab", slab).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###").addMaterial('#', block, tile).setGroup("end_metal_slabs").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_chain", chain).checkConfig(Configs.RECIPE_CONFIG).setShape("N", "#", "N").addMaterial('#', ingot).addMaterial('N', nugget).setGroup("end_metal_chain").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_anvil", anvilBlock).checkConfig(Configs.RECIPE_CONFIG).setShape("###", " I ", "III").addMaterial('#', block, tile).addMaterial('I', ingot).setGroup("end_metal_anvil").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bulb_lantern", bulb_lantern).checkConfig(Configs.RECIPE_CONFIG).setShape("C", "I", "#").addMaterial('C', chain).addMaterial('I', ingot).addMaterial('#', EndItems.GLOWING_BULB).build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_tile", tile)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(4)
.setShape("##", "##")
.addMaterial('#', block)
.setGroup("end_metal_tiles")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bars", bars)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(16)
.setShape("###", "###")
.addMaterial('#', ingot)
.setGroup("end_metal_bars")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_pressure_plate", pressurePlate)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("##")
.addMaterial('#', ingot)
.setGroup("end_metal_plates")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_door", door)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(3)
.setShape("##", "##", "##")
.addMaterial('#', ingot)
.setGroup("end_metal_doors")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_trapdoor", trapdoor)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("##", "##")
.addMaterial('#', ingot)
.setGroup("end_metal_trapdoors")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_stairs", stairs)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(4)
.setShape("# ", "## ", "###")
.addMaterial('#', block, tile)
.setGroup("end_metal_stairs")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_slab", slab)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(6)
.setShape("###")
.addMaterial('#', block, tile)
.setGroup("end_metal_slabs")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_chain", chain)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("N", "#", "N")
.addMaterial('#', ingot)
.addMaterial('N', nugget)
.setGroup("end_metal_chain")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_anvil", anvilBlock)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("###", " I ", "III")
.addMaterial('#', block, tile)
.addMaterial('I', ingot)
.setGroup("end_metal_anvil")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bulb_lantern", bulb_lantern)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("C", "I", "#")
.addMaterial('C', chain)
.addMaterial('I', ingot)
.addMaterial('#', EndItems.GLOWING_BULB)
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_chandelier", chandelier).checkConfig(Configs.RECIPE_CONFIG).setShape("I#I", " # ").addMaterial('#', ingot).addMaterial('I', EndItems.LUMECORN_ROD).setGroup("end_metal_chandelier").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_chandelier", chandelier)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("I#I", " # ")
.addMaterial('#', ingot)
.addMaterial('I', EndItems.LUMECORN_ROD)
.setGroup("end_metal_chandelier")
.build();
// Tools & armor into nuggets
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_axe_nugget", axe, nugget).checkConfig(Configs.RECIPE_CONFIG).setGroup("end_nugget").buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_hoe_nugget", hoe, nugget).checkConfig(Configs.RECIPE_CONFIG).setGroup("end_nugget").buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_pickaxe_nugget", pickaxe, nugget).checkConfig(Configs.RECIPE_CONFIG).setGroup("end_nugget").buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_sword_nugget", sword, nugget).checkConfig(Configs.RECIPE_CONFIG).setGroup("end_nugget").buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_hammer_nugget", hammer, nugget).checkConfig(Configs.RECIPE_CONFIG).setGroup("end_nugget").buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_helmet_nugget", helmet, nugget).checkConfig(Configs.RECIPE_CONFIG).setGroup("end_nugget").buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_chestplate_nugget", chestplate, nugget).checkConfig(Configs.RECIPE_CONFIG).setGroup("end_nugget").buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_leggings_nugget", leggings, nugget).checkConfig(Configs.RECIPE_CONFIG).setGroup("end_nugget").buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_boots_nugget", boots, nugget).checkConfig(Configs.RECIPE_CONFIG).setGroup("end_nugget").buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_axe_nugget", axe, nugget)
.checkConfig(Configs.RECIPE_CONFIG)
.setGroup("end_nugget")
.buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_hoe_nugget", hoe, nugget)
.checkConfig(Configs.RECIPE_CONFIG)
.setGroup("end_nugget")
.buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_pickaxe_nugget", pickaxe, nugget)
.checkConfig(Configs.RECIPE_CONFIG)
.setGroup("end_nugget")
.buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_sword_nugget", sword, nugget)
.checkConfig(Configs.RECIPE_CONFIG)
.setGroup("end_nugget")
.buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_hammer_nugget", hammer, nugget)
.checkConfig(Configs.RECIPE_CONFIG)
.setGroup("end_nugget")
.buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_helmet_nugget", helmet, nugget)
.checkConfig(Configs.RECIPE_CONFIG)
.setGroup("end_nugget")
.buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_chestplate_nugget", chestplate, nugget)
.checkConfig(Configs.RECIPE_CONFIG)
.setGroup("end_nugget")
.buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_leggings_nugget", leggings, nugget)
.checkConfig(Configs.RECIPE_CONFIG)
.setGroup("end_nugget")
.buildWithBlasting();
FurnaceRecipe.make(BetterEnd.MOD_ID, name + "_boots_nugget", boots, nugget)
.checkConfig(Configs.RECIPE_CONFIG)
.setGroup("end_nugget")
.buildWithBlasting();
// Tool parts from ingots
AnvilRecipe.Builder.create(name + "_shovel_head").setInput(ingot).setOutput(shovelHead).setAnvilLevel(level).setToolLevel(level).setDamage(level).build();
AnvilRecipe.Builder.create(name + "_pickaxe_head").setInput(ingot).setInputCount(3).setOutput(pickaxeHead).setAnvilLevel(level).setToolLevel(level).setDamage(level).build();
AnvilRecipe.Builder.create(name + "_axe_head").setInput(ingot).setInputCount(3).setOutput(axeHead).setAnvilLevel(level).setToolLevel(level).setDamage(level).build();
AnvilRecipe.Builder.create(name + "_hoe_head").setInput(ingot).setInputCount(2).setOutput(hoeHead).setAnvilLevel(level).setToolLevel(level).setDamage(level).build();
AnvilRecipe.Builder.create(name + "_sword_blade").setInput(ingot).setOutput(swordBlade).setAnvilLevel(level).setToolLevel(level).setDamage(level).build();
AnvilRecipe.Builder.create(name + "_forged_plate").setInput(ingot).setOutput(forgedPlate).setAnvilLevel(level).setToolLevel(level).setDamage(level).build();
AnvilRecipe.Builder.create(name + "_shovel_head")
.setInput(ingot)
.setOutput(shovelHead)
.setAnvilLevel(level)
.setToolLevel(level)
.setDamage(level)
.build();
AnvilRecipe.Builder.create(name + "_pickaxe_head")
.setInput(ingot)
.setInputCount(3)
.setOutput(pickaxeHead)
.setAnvilLevel(level)
.setToolLevel(level)
.setDamage(level)
.build();
AnvilRecipe.Builder.create(name + "_axe_head")
.setInput(ingot)
.setInputCount(3)
.setOutput(axeHead)
.setAnvilLevel(level)
.setToolLevel(level)
.setDamage(level)
.build();
AnvilRecipe.Builder.create(name + "_hoe_head")
.setInput(ingot)
.setInputCount(2)
.setOutput(hoeHead)
.setAnvilLevel(level)
.setToolLevel(level)
.setDamage(level)
.build();
AnvilRecipe.Builder.create(name + "_sword_blade")
.setInput(ingot)
.setOutput(swordBlade)
.setAnvilLevel(level)
.setToolLevel(level)
.setDamage(level)
.build();
AnvilRecipe.Builder.create(name + "_forged_plate")
.setInput(ingot)
.setOutput(forgedPlate)
.setAnvilLevel(level)
.setToolLevel(level)
.setDamage(level)
.build();
// Tools from parts
SmithingTableRecipe.create(BetterEnd.MOD_ID, name + "_hammer").checkConfig(Configs.RECIPE_CONFIG).setResult(hammer).setBase(block).setAddition(Items.STICK).build();
SmithingTableRecipe.create(BetterEnd.MOD_ID, name + "_axe").checkConfig(Configs.RECIPE_CONFIG).setResult(axe).setBase(axeHead).setAddition(Items.STICK).build();
SmithingTableRecipe.create(BetterEnd.MOD_ID, name + "_pickaxe").checkConfig(Configs.RECIPE_CONFIG).setResult(pickaxe).setBase(pickaxeHead).setAddition(Items.STICK).build();
SmithingTableRecipe.create(BetterEnd.MOD_ID, name + "_hoe").checkConfig(Configs.RECIPE_CONFIG).setResult(hoe).setBase(hoeHead).setAddition(Items.STICK).build();
SmithingTableRecipe.create(BetterEnd.MOD_ID, name + "_sword_handle").checkConfig(Configs.RECIPE_CONFIG).setResult(swordHandle).setBase(ingot).setAddition(Items.STICK).build();
SmithingTableRecipe.create(BetterEnd.MOD_ID, name + "_sword").checkConfig(Configs.RECIPE_CONFIG).setResult(sword).setBase(swordBlade).setAddition(swordHandle).build();
SmithingTableRecipe.create(BetterEnd.MOD_ID, name + "_shovel").checkConfig(Configs.RECIPE_CONFIG).setResult(shovel).setBase(shovelHead).setAddition(Items.STICK).build();
SmithingTableRecipe.create(BetterEnd.MOD_ID, name + "_hammer")
.checkConfig(Configs.RECIPE_CONFIG)
.setResult(hammer)
.setBase(block)
.setAddition(Items.STICK)
.build();
SmithingTableRecipe.create(BetterEnd.MOD_ID, name + "_axe")
.checkConfig(Configs.RECIPE_CONFIG)
.setResult(axe)
.setBase(axeHead)
.setAddition(Items.STICK)
.build();
SmithingTableRecipe.create(BetterEnd.MOD_ID, name + "_pickaxe")
.checkConfig(Configs.RECIPE_CONFIG)
.setResult(pickaxe)
.setBase(pickaxeHead)
.setAddition(Items.STICK)
.build();
SmithingTableRecipe.create(BetterEnd.MOD_ID, name + "_hoe")
.checkConfig(Configs.RECIPE_CONFIG)
.setResult(hoe)
.setBase(hoeHead)
.setAddition(Items.STICK)
.build();
SmithingTableRecipe.create(BetterEnd.MOD_ID, name + "_sword_handle")
.checkConfig(Configs.RECIPE_CONFIG)
.setResult(swordHandle)
.setBase(ingot)
.setAddition(Items.STICK)
.build();
SmithingTableRecipe.create(BetterEnd.MOD_ID, name + "_sword")
.checkConfig(Configs.RECIPE_CONFIG)
.setResult(sword)
.setBase(swordBlade)
.setAddition(swordHandle)
.build();
SmithingTableRecipe.create(BetterEnd.MOD_ID, name + "_shovel")
.checkConfig(Configs.RECIPE_CONFIG)
.setResult(shovel)
.setBase(shovelHead)
.setAddition(Items.STICK)
.build();
// Armor crafting
GridRecipe.make(BetterEnd.MOD_ID, name + "_helmet", helmet).checkConfig(Configs.RECIPE_CONFIG).setShape("###", "# #").addMaterial('#', forgedPlate).setGroup("end_metal_helmets").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_chestplate", chestplate).checkConfig(Configs.RECIPE_CONFIG).setShape("# #", "###", "###").addMaterial('#', forgedPlate).setGroup("end_metal_chestplates").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_leggings", leggings).checkConfig(Configs.RECIPE_CONFIG).setShape("###", "# #", "# #").addMaterial('#', forgedPlate).setGroup("end_metal_leggings").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_boots", boots).checkConfig(Configs.RECIPE_CONFIG).setShape("# #", "# #").addMaterial('#', forgedPlate).setGroup("end_metal_boots").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_helmet", helmet)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("###", "# #")
.addMaterial('#', forgedPlate)
.setGroup("end_metal_helmets")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_chestplate", chestplate)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("# #", "###", "###")
.addMaterial('#', forgedPlate)
.setGroup("end_metal_chestplates")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_leggings", leggings)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("###", "# #", "# #")
.addMaterial('#', forgedPlate)
.setGroup("end_metal_leggings")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_boots", boots)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("# #", "# #")
.addMaterial('#', forgedPlate)
.setGroup("end_metal_boots")
.build();
TagHelper.addTag(BlockTags.ANVIL, anvilBlock);
TagHelper.addTag(BlockTags.BEACON_BASE_BLOCKS, block);

View file

@ -70,24 +70,110 @@ public class StoneMaterial {
flowerPot = EndBlocks.registerBlock(name + "_flower_pot", new FlowerPotBlock(bricks));
// Recipes //
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks", bricks).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("##", "##").addMaterial('#', stone).setGroup("end_bricks").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_polished", polished).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("##", "##").addMaterial('#', bricks).setGroup("end_tile").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_tiles", tiles).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("##", "##").addMaterial('#', polished).setGroup("end_small_tile").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_pillar", pillar).checkConfig(Configs.RECIPE_CONFIG).setShape("#", "#").addMaterial('#', slab).setGroup("end_pillar").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks", bricks)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(4)
.setShape("##", "##")
.addMaterial('#', stone)
.setGroup("end_bricks")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_polished", polished)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(4)
.setShape("##", "##")
.addMaterial('#', bricks)
.setGroup("end_tile")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_tiles", tiles)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(4)
.setShape("##", "##")
.addMaterial('#', polished)
.setGroup("end_small_tile")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_pillar", pillar)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("#", "#")
.addMaterial('#', slab)
.setGroup("end_pillar")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_stairs", stairs).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("# ", "## ", "###").addMaterial('#', stone).setGroup("end_stone_stairs").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_slab", slab).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###").addMaterial('#', stone).setGroup("end_stone_slabs").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_stairs", brickStairs).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("# ", "## ", "###").addMaterial('#', bricks).setGroup("end_stone_stairs").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_slab", brickSlab).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###").addMaterial('#', bricks).setGroup("end_stone_slabs").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_stairs", stairs)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(4)
.setShape("# ", "## ", "###")
.addMaterial('#', stone)
.setGroup("end_stone_stairs")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_slab", slab)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(6)
.setShape("###")
.addMaterial('#', stone)
.setGroup("end_stone_slabs")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_stairs", brickStairs)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(4)
.setShape("# ", "## ", "###")
.addMaterial('#', bricks)
.setGroup("end_stone_stairs")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_slab", brickSlab)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(6)
.setShape("###")
.addMaterial('#', bricks)
.setGroup("end_stone_slabs")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_wall", wall).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###", "###").addMaterial('#', stone).setGroup("end_wall").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_wall", brickWall).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###", "###").addMaterial('#', bricks).setGroup("end_wall").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_wall", wall)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(6)
.setShape("###", "###")
.addMaterial('#', stone)
.setGroup("end_wall")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bricks_wall", brickWall)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(6)
.setShape("###", "###")
.addMaterial('#', bricks)
.setGroup("end_wall")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_button", button).checkConfig(Configs.RECIPE_CONFIG).setList("#").addMaterial('#', stone).setGroup("end_stone_buttons").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_pressure_plate", pressurePlate).checkConfig(Configs.RECIPE_CONFIG).setShape("##").addMaterial('#', stone).setGroup("end_stone_plates").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_lantern", lantern).checkConfig(Configs.RECIPE_CONFIG).setShape("S", "#", "S").addMaterial('#', EndItems.CRYSTAL_SHARDS).addMaterial('S', slab, brickSlab).setGroup("end_stone_lanterns").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_furnace", furnace).checkConfig(Configs.RECIPE_CONFIG).setShape("###", "# #", "###").addMaterial('#', stone).setGroup("end_stone_furnaces").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_flower_pot", flowerPot).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(3).setShape("# #", " # ").addMaterial('#', bricks).setGroup("end_pots").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_button", button)
.checkConfig(Configs.RECIPE_CONFIG)
.setList("#")
.addMaterial('#', stone)
.setGroup("end_stone_buttons")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_pressure_plate", pressurePlate)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("##")
.addMaterial('#', stone)
.setGroup("end_stone_plates")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_lantern", lantern)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("S", "#", "S")
.addMaterial('#', EndItems.CRYSTAL_SHARDS)
.addMaterial('S', slab, brickSlab)
.setGroup("end_stone_lanterns")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_furnace", furnace)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("###", "# #", "###")
.addMaterial('#', stone)
.setGroup("end_stone_furnaces")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_flower_pot", flowerPot)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(3)
.setShape("# #", " # ")
.addMaterial('#', bricks)
.setGroup("end_pots")
.build();
CraftingRecipes.registerPedestal(name + "_pedestal", pedestal, slab, pillar);

View file

@ -97,25 +97,133 @@ public class WoodenMaterial {
composter = EndBlocks.registerBlock(name + "_composter", new BaseComposterBlock(planks));
// Recipes //
GridRecipe.make(BetterEnd.MOD_ID, name + "_planks", planks).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setList("#").addMaterial('#', log, bark, log_stripped, bark_stripped).setGroup("end_planks").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_stairs", stairs).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(4).setShape("# ", "## ", "###").addMaterial('#', planks).setGroup("end_planks_stairs").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_slab", slab).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(6).setShape("###").addMaterial('#', planks).setGroup("end_planks_slabs").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_fence", fence).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(3).setShape("#I#", "#I#").addMaterial('#', planks).addMaterial('I', Items.STICK).setGroup("end_planks_fences").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_gate", gate).checkConfig(Configs.RECIPE_CONFIG).setShape("I#I", "I#I").addMaterial('#', planks).addMaterial('I', Items.STICK).setGroup("end_planks_gates").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_button", button).checkConfig(Configs.RECIPE_CONFIG).setList("#").addMaterial('#', planks).setGroup("end_planks_buttons").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_pressure_plate", pressurePlate).checkConfig(Configs.RECIPE_CONFIG).setShape("##").addMaterial('#', planks).setGroup("end_planks_plates").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_trapdoor", trapdoor).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(2).setShape("###", "###").addMaterial('#', planks).setGroup("end_trapdoors").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_door", door).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(3).setShape("##", "##", "##").addMaterial('#', planks).setGroup("end_doors").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_crafting_table", craftingTable).checkConfig(Configs.RECIPE_CONFIG).setShape("##", "##").addMaterial('#', planks).setGroup("end_tables").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_ladder", ladder).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(3).setShape("I I", "I#I", "I I").addMaterial('#', planks).addMaterial('I', Items.STICK).setGroup("end_ladders").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_sign", sign).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(3).setShape("###", "###", " I ").addMaterial('#', planks).addMaterial('I', Items.STICK).setGroup("end_signs").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_chest", chest).checkConfig(Configs.RECIPE_CONFIG).setShape("###", "# #", "###").addMaterial('#', planks).setGroup("end_chests").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_barrel", barrel).checkConfig(Configs.RECIPE_CONFIG).setShape("#S#", "# #", "#S#").addMaterial('#', planks).addMaterial('S', slab).setGroup("end_barrels").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bookshelf", shelf).checkConfig(Configs.RECIPE_CONFIG).setShape("###", "PPP", "###").addMaterial('#', planks).addMaterial('P', Items.BOOK).setGroup("end_bookshelves").build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bark", bark).checkConfig(Configs.RECIPE_CONFIG).setShape("##", "##").addMaterial('#', log).setOutputCount(3).build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_log", log).checkConfig(Configs.RECIPE_CONFIG).setShape("##", "##").addMaterial('#', bark).setOutputCount(3).build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_composter", composter).checkConfig(Configs.RECIPE_CONFIG).setShape("# #", "# #", "###").addMaterial('#', slab).build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_shulker", Items.SHULKER_BOX).checkConfig(Configs.RECIPE_CONFIG).setShape("S", "#", "S").addMaterial('S', Items.SHULKER_SHELL).addMaterial('#', chest).build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_planks", planks)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(4)
.setList("#")
.addMaterial('#', log, bark, log_stripped, bark_stripped)
.setGroup("end_planks")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_stairs", stairs)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(4)
.setShape("# ", "## ", "###")
.addMaterial('#', planks)
.setGroup("end_planks_stairs")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_slab", slab)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(6)
.setShape("###")
.addMaterial('#', planks)
.setGroup("end_planks_slabs")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_fence", fence)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(3)
.setShape("#I#", "#I#")
.addMaterial('#', planks)
.addMaterial('I', Items.STICK)
.setGroup("end_planks_fences")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_gate", gate)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("I#I", "I#I")
.addMaterial('#', planks)
.addMaterial('I', Items.STICK)
.setGroup("end_planks_gates")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_button", button)
.checkConfig(Configs.RECIPE_CONFIG)
.setList("#")
.addMaterial('#', planks)
.setGroup("end_planks_buttons")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_pressure_plate", pressurePlate)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("##")
.addMaterial('#', planks)
.setGroup("end_planks_plates")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_trapdoor", trapdoor)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(2)
.setShape("###", "###")
.addMaterial('#', planks)
.setGroup("end_trapdoors")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_door", door)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(3)
.setShape("##", "##", "##")
.addMaterial('#', planks)
.setGroup("end_doors")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_crafting_table", craftingTable)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("##", "##")
.addMaterial('#', planks)
.setGroup("end_tables")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_ladder", ladder)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(3)
.setShape("I I", "I#I", "I I")
.addMaterial('#', planks)
.addMaterial('I', Items.STICK)
.setGroup("end_ladders")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_sign", sign)
.checkConfig(Configs.RECIPE_CONFIG)
.setOutputCount(3)
.setShape("###", "###", " I ")
.addMaterial('#', planks)
.addMaterial('I', Items.STICK)
.setGroup("end_signs")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_chest", chest)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("###", "# #", "###")
.addMaterial('#', planks)
.setGroup("end_chests")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_barrel", barrel)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("#S#", "# #", "#S#")
.addMaterial('#', planks)
.addMaterial('S', slab)
.setGroup("end_barrels")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bookshelf", shelf)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("###", "PPP", "###")
.addMaterial('#', planks)
.addMaterial('P', Items.BOOK)
.setGroup("end_bookshelves")
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_bark", bark)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("##", "##")
.addMaterial('#', log)
.setOutputCount(3)
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_log", log)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("##", "##")
.addMaterial('#', bark)
.setOutputCount(3)
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_composter", composter)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("# #", "# #", "###")
.addMaterial('#', slab)
.build();
GridRecipe.make(BetterEnd.MOD_ID, name + "_shulker", Items.SHULKER_BOX)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("S", "#", "S")
.addMaterial('S', Items.SHULKER_SHELL)
.addMaterial('#', chest)
.build();
// Item Tags //
TagHelper.addTag(ItemTags.PLANKS, planks);

View file

@ -63,7 +63,10 @@ public class BlockEntityHydrothermalVent extends BlockEntity {
if (blockState.isAir()) {
double mult = active ? 3.0 : 5.0;
float force = (float) ((1.0 - (POS.getY() / box.maxY)) / mult);
entities.stream().filter(entity -> (int) entity.getY() == POS.getY() && blockEntity.hasElytra(entity) && entity.isFallFlying()).forEach(entity -> entity.moveRelative(force, POSITIVE_Y));
entities.stream()
.filter(entity -> (int) entity.getY() == POS.getY() && blockEntity.hasElytra(entity) && entity
.isFallFlying())
.forEach(entity -> entity.moveRelative(force, POSITIVE_Y));
}
POS.move(Direction.UP);
}

View file

@ -158,9 +158,15 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
protected int getSmeltTime() {
if (level == null) return 200;
int smeltTime = level.getRecipeManager().getRecipeFor(AlloyingRecipe.TYPE, this, level).map(AlloyingRecipe::getSmeltTime).orElse(0);
int smeltTime = level.getRecipeManager()
.getRecipeFor(AlloyingRecipe.TYPE, this, level)
.map(AlloyingRecipe::getSmeltTime)
.orElse(0);
if (smeltTime == 0) {
smeltTime = level.getRecipeManager().getRecipeFor(RecipeType.BLASTING, this, level).map(BlastingRecipe::getCookingTime).orElse(200);
smeltTime = level.getRecipeManager()
.getRecipeFor(RecipeType.BLASTING, this, level)
.map(BlastingRecipe::getCookingTime)
.orElse(200);
smeltTime /= 1.5;
}
return smeltTime;
@ -205,7 +211,11 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
if (level != null && level.getBlockEntity(worldPosition) != this) {
return false;
}
return player.distanceToSqr(worldPosition.getX() + 0.5D, worldPosition.getY() + 0.5D, worldPosition.getZ() + 0.5D) <= 64.0D;
return player.distanceToSqr(
worldPosition.getX() + 0.5D,
worldPosition.getY() + 0.5D,
worldPosition.getZ() + 0.5D
) <= 64.0D;
}
@Override
@ -234,15 +244,20 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
boolean burning = initialBurning;
if (!tickLevel.isClientSide) {
ItemStack fuel = blockEntity.inventory.get(2);
if (!burning && (fuel.isEmpty() || blockEntity.inventory.get(0).isEmpty() && blockEntity.inventory.get(1).isEmpty())) {
if (!burning && (fuel.isEmpty() || blockEntity.inventory.get(0).isEmpty() && blockEntity.inventory.get(1)
.isEmpty())) {
if (blockEntity.smeltTime > 0) {
blockEntity.smeltTime = Mth.clamp(blockEntity.smeltTime - 2, 0, blockEntity.smeltTimeTotal);
}
}
else {
Recipe<?> recipe = tickLevel.getRecipeManager().getRecipeFor(AlloyingRecipe.TYPE, blockEntity, tickLevel).orElse(null);
Recipe<?> recipe = tickLevel.getRecipeManager()
.getRecipeFor(AlloyingRecipe.TYPE, blockEntity, tickLevel)
.orElse(null);
if (recipe == null) {
recipe = tickLevel.getRecipeManager().getRecipeFor(RecipeType.BLASTING, blockEntity, tickLevel).orElse(null);
recipe = tickLevel.getRecipeManager()
.getRecipeFor(RecipeType.BLASTING, blockEntity, tickLevel)
.orElse(null);
}
boolean accepted = blockEntity.canAcceptRecipeOutput(recipe);
if (!burning && accepted) {
@ -255,7 +270,10 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
fuel.shrink(1);
if (fuel.isEmpty()) {
Item remainFuel = item.getCraftingRemainingItem();
blockEntity.inventory.set(2, remainFuel == null ? ItemStack.EMPTY : new ItemStack(remainFuel));
blockEntity.inventory.set(
2,
remainFuel == null ? ItemStack.EMPTY : new ItemStack(remainFuel)
);
}
}
blockEntity.setChanged();

View file

@ -1,10 +1,7 @@
package ru.betterend.client;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.minecraft.ChatFormatting;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.core.Registry;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
@ -12,10 +9,8 @@ import net.minecraft.world.level.block.Block;
import ru.bclib.BCLib;
import ru.bclib.blocks.BaseChestBlock;
import ru.bclib.blocks.BaseSignBlock;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.client.render.BaseChestBlockEntityRenderer;
import ru.bclib.client.render.BaseSignBlockEntityRenderer;
import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.util.TranslationHelper;
import ru.betterend.BetterEnd;
import ru.betterend.events.ItemTooltipCallback;
@ -33,7 +28,7 @@ import java.util.List;
public class BetterEndClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
registerRenderLayers();
//registerRenderLayers();
EndBlockEntityRenders.register();
EndScreens.register();
EndParticles.register();
@ -57,28 +52,35 @@ public class BetterEndClient implements ClientModInitializer {
hasSet = CrystaliteArmor.hasFullSet(player);
}
TranslatableComponent setDesc = new TranslatableComponent("tooltip.armor.crystalite_set");
setDesc.setStyle(Style.EMPTY.applyFormats(hasSet ? ChatFormatting.BLUE : ChatFormatting.DARK_GRAY, ChatFormatting.ITALIC));
setDesc.setStyle(Style.EMPTY.applyFormats(
hasSet ? ChatFormatting.BLUE : ChatFormatting.DARK_GRAY,
ChatFormatting.ITALIC
));
lines.add(TextComponent.EMPTY);
lines.add(setDesc);
}
});
}
private void registerRenderLayers() {
/*private void registerRenderLayers() {
RenderType cutout = RenderType.cutout();
RenderType translucent = RenderType.translucent();
Registry.BLOCK.forEach(block -> {
if (block instanceof IRenderTyped) {
BCLRenderLayer layer = ((IRenderTyped) block).getRenderLayer();
if (block instanceof RenderLayerProvider) {
BCLRenderLayer layer = ((RenderLayerProvider) block).getRenderLayer();
if (layer == BCLRenderLayer.CUTOUT) BlockRenderLayerMap.INSTANCE.putBlock(block, cutout);
else if (layer == BCLRenderLayer.TRANSLUCENT) BlockRenderLayerMap.INSTANCE.putBlock(block, translucent);
}
});
}
}*/
private static void registerRenderers() {
List<Block> modBlocks = EndBlocks.getModBlocks();
modBlocks.stream().filter(BaseChestBlock.class::isInstance).forEach(BaseChestBlockEntityRenderer::registerRenderLayer);
modBlocks.stream().filter(BaseSignBlock.class::isInstance).forEach(BaseSignBlockEntityRenderer::registerRenderLayer);
modBlocks.stream()
.filter(BaseChestBlock.class::isInstance)
.forEach(BaseChestBlockEntityRenderer::registerRenderLayer);
modBlocks.stream()
.filter(BaseSignBlock.class::isInstance)
.forEach(BaseSignBlockEntityRenderer::registerRenderLayer);
}
}

View file

@ -79,7 +79,13 @@ public class EndStoneSmelterRecipeBookScreen extends BlastingRecipeBookComponent
int slotY = this.fuelSlot.y + y;
GuiComponent.fill(matrices, slotX, slotY, slotX + 16, slotY + 16, 822018048);
//TODO: test k=0
this.minecraft.getItemRenderer().renderAndDecorateItem(minecraft.player, this.getFuel().getDefaultInstance(), slotX, slotY, 0);
this.minecraft.getItemRenderer()
.renderAndDecorateItem(minecraft.player,
this.getFuel().getDefaultInstance(),
slotX,
slotY,
0
);
RenderSystem.depthFunc(516);
GuiComponent.fill(matrices, slotX, slotY, slotX + 16, slotY + 16, 822083583);
RenderSystem.depthFunc(515);

View file

@ -35,12 +35,22 @@ public class EndStoneSmelterScreen extends AbstractContainerScreen<EndStoneSmelt
narrow = width < 379;
recipeBook.init(width, height, minecraft, narrow, menu);
leftPos = recipeBook.updateScreenPosition(width, imageWidth);
addRenderableWidget(new ImageButton(leftPos + 20, height / 2 - 49, 20, 18, 0, 0, 19, RECIPE_BUTTON_TEXTURE, (buttonWidget) -> {
addRenderableWidget(new ImageButton(
leftPos + 20,
height / 2 - 49,
20,
18,
0,
0,
19,
RECIPE_BUTTON_TEXTURE,
(buttonWidget) -> {
recipeBook.initVisuals();
recipeBook.toggleVisibility();
leftPos = recipeBook.updateScreenPosition(width, imageWidth);
((ImageButton) buttonWidget).setPosition(leftPos + 20, height / 2 - 49);
}));
}
));
titleLabelX = (imageWidth - font.width(title)) / 2;
}
@ -90,7 +100,15 @@ public class EndStoneSmelterScreen extends AbstractContainerScreen<EndStoneSmelt
@Override
protected boolean hasClickedOutside(double mouseX, double mouseY, int left, int top, int button) {
boolean isMouseOut = mouseX < left || mouseY < top || mouseX >= (left + imageWidth) || mouseY >= (top + imageHeight);
return this.recipeBook.hasClickedOutside(mouseX, mouseY, leftPos, topPos, imageWidth, imageHeight, button) && isMouseOut;
return this.recipeBook.hasClickedOutside(
mouseX,
mouseY,
leftPos,
topPos,
imageWidth,
imageHeight,
button
) && isMouseOut;
}
@Override

View file

@ -27,7 +27,10 @@ import ru.betterend.recipe.builders.AlloyingRecipe;
public class EndStoneSmelterScreenHandler extends RecipeBookMenu<Container> {
public final static MenuType<EndStoneSmelterScreenHandler> HANDLER_TYPE = ScreenHandlerRegistry.registerSimple(BetterEnd.makeID(EndStoneSmelter.ID), EndStoneSmelterScreenHandler::new);
public final static MenuType<EndStoneSmelterScreenHandler> HANDLER_TYPE = ScreenHandlerRegistry.registerSimple(
BetterEnd.makeID(EndStoneSmelter.ID),
EndStoneSmelterScreenHandler::new
);
private final Container inventory;
private final ContainerData propertyDelegate;
@ -117,7 +120,9 @@ public class EndStoneSmelterScreenHandler extends RecipeBookMenu<Container> {
}
protected boolean isSmeltable(ItemStack itemStack) {
return world.getRecipeManager().getRecipeFor(AlloyingRecipe.TYPE, new SimpleContainer(itemStack), world).isPresent();
return world.getRecipeManager()
.getRecipeFor(AlloyingRecipe.TYPE, new SimpleContainer(itemStack), world)
.isPresent();
}
public boolean isFuel(ItemStack itemStack) {

View file

@ -39,27 +39,35 @@ public class Patterns {
public final static ResourceLocation BLOCK_DOOR_TOP = BetterEnd.makeID("patterns/block/door_top.json");
public final static ResourceLocation BLOCK_DOOR_TOP_HINGE = BetterEnd.makeID("patterns/block/door_top_hinge.json");
public final static ResourceLocation BLOCK_DOOR_BOTTOM = BetterEnd.makeID("patterns/block/door_bottom.json");
public final static ResourceLocation BLOCK_DOOR_BOTTOM_HINGE = BetterEnd.makeID("patterns/block/door_bottom_hinge.json");
public final static ResourceLocation BLOCK_DOOR_BOTTOM_HINGE = BetterEnd.makeID(
"patterns/block/door_bottom_hinge.json");
public final static ResourceLocation BLOCK_CROSS = BetterEnd.makeID("patterns/block/cross.json");
public final static ResourceLocation BLOCK_CROSS_SHADED = BetterEnd.makeID("patterns/block/cross_shaded.json");
public final static ResourceLocation BLOCK_GATE_CLOSED = BetterEnd.makeID("patterns/block/fence_gate_closed.json");
public final static ResourceLocation BLOCK_GATE_CLOSED_WALL = BetterEnd.makeID("patterns/block/wall_gate_closed.json");
public final static ResourceLocation BLOCK_GATE_CLOSED_WALL = BetterEnd.makeID(
"patterns/block/wall_gate_closed.json");
public final static ResourceLocation BLOCK_GATE_OPEN = BetterEnd.makeID("patterns/block/fence_gate_open.json");
public final static ResourceLocation BLOCK_GATE_OPEN_WALL = BetterEnd.makeID("patterns/block/wall_gate_open.json");
public final static ResourceLocation BLOCK_TRAPDOOR = BetterEnd.makeID("patterns/block/trapdoor.json");
public final static ResourceLocation BLOCK_LADDER = BetterEnd.makeID("patterns/block/ladder.json");
public final static ResourceLocation BLOCK_BARREL_OPEN = BetterEnd.makeID("patterns/block/barrel_open.json");
public final static ResourceLocation BLOCK_PEDESTAL_DEFAULT = BetterEnd.makeID("patterns/block/pedestal_default.json");
public final static ResourceLocation BLOCK_PEDESTAL_DEFAULT = BetterEnd.makeID(
"patterns/block/pedestal_default.json");
public final static ResourceLocation BLOKC_PEDESTAL_COLUMN = BetterEnd.makeID("patterns/block/pedestal_column.json");
public final static ResourceLocation BLOCK_PEDESTAL_COLUMN_TOP = BetterEnd.makeID("patterns/block/pedestal_column_top.json");
public final static ResourceLocation BLOCK_PEDESTAL_COLUMN_TOP = BetterEnd.makeID(
"patterns/block/pedestal_column_top.json");
public final static ResourceLocation BLOCK_PEDESTAL_TOP = BetterEnd.makeID("patterns/block/pedestal_top.json");
public final static ResourceLocation BLOCK_PEDESTAL_BOTTOM = BetterEnd.makeID("patterns/block/pedestal_bottom.json");
public final static ResourceLocation BLOCK_PEDESTAL_PILLAR = BetterEnd.makeID("patterns/block/pedestal_pillar.json");
public final static ResourceLocation BLOCK_BOOKSHELF = BetterEnd.makeID("patterns/block/bookshelf.json");
public final static ResourceLocation BLOCK_STONE_LANTERN_CEIL = BetterEnd.makeID("patterns/block/stone_lantern_ceil.json");
public final static ResourceLocation BLOCK_STONE_LANTERN_FLOOR = BetterEnd.makeID("patterns/block/stone_lantern_floor.json");
public final static ResourceLocation BLOCK_BULB_LANTERN_FLOOR = BetterEnd.makeID("patterns/block/bulb_lantern_floor.json");
public final static ResourceLocation BLOCK_BULB_LANTERN_CEIL = BetterEnd.makeID("patterns/block/bulb_lantern_ceil.json");
public final static ResourceLocation BLOCK_STONE_LANTERN_CEIL = BetterEnd.makeID(
"patterns/block/stone_lantern_ceil.json");
public final static ResourceLocation BLOCK_STONE_LANTERN_FLOOR = BetterEnd.makeID(
"patterns/block/stone_lantern_floor.json");
public final static ResourceLocation BLOCK_BULB_LANTERN_FLOOR = BetterEnd.makeID(
"patterns/block/bulb_lantern_floor.json");
public final static ResourceLocation BLOCK_BULB_LANTERN_CEIL = BetterEnd.makeID(
"patterns/block/bulb_lantern_ceil.json");
public final static ResourceLocation BLOCK_PETAL_COLORED = BetterEnd.makeID("models/block/block_petal_colored.json");
public final static ResourceLocation BLOCK_COMPOSTER = BetterEnd.makeID("patterns/block/composter.json");
public final static ResourceLocation BLOCK_COLORED = BetterEnd.makeID("patterns/block/block_colored.json");
@ -67,7 +75,8 @@ public class Patterns {
public final static ResourceLocation BLOCK_BARS_SIDE = BetterEnd.makeID("patterns/block/bars_side.json");
public final static ResourceLocation BLOCK_ANVIL = BetterEnd.makeID("patterns/block/anvil.json");
public final static ResourceLocation BLOCK_CHAIN = BetterEnd.makeID("patterns/block/chain.json");
public final static ResourceLocation BLOCK_CHANDELIER_FLOOR = BetterEnd.makeID("patterns/block/chandelier_floor.json");
public final static ResourceLocation BLOCK_CHANDELIER_FLOOR = BetterEnd.makeID(
"patterns/block/chandelier_floor.json");
public final static ResourceLocation BLOCK_CHANDELIER_WALL = BetterEnd.makeID("patterns/block/chandelier_wall.json");
public final static ResourceLocation BLOCK_CHANDELIER_CEIL = BetterEnd.makeID("patterns/block/chandelier_ceil.json");
public final static ResourceLocation BLOCK_FURNACE = BetterEnd.makeID("patterns/block/furnace.json");
@ -128,7 +137,8 @@ public class Patterns {
public static Optional<String> createJson(ResourceLocation patternId, Map<String, String> textures) {
ResourceManager resourceManager = Minecraft.getInstance().getResourceManager();
try (InputStream input = resourceManager.getResource(patternId).getInputStream()) {
String json = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)).lines().collect(Collectors.joining());
String json = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)).lines()
.collect(Collectors.joining());
for (Entry<String, String> texture : textures.entrySet()) {
json = json.replace(texture.getKey(), texture.getValue());
}

View file

@ -37,7 +37,8 @@ public class ArmoredElytraLayer<T extends LivingEntity, M extends EntityModel<T>
if (abstractClientPlayer.isElytraLoaded() && abstractClientPlayer.getElytraTextureLocation() != null) {
wingsTexture = abstractClientPlayer.getElytraTextureLocation();
}
else if (abstractClientPlayer.isCapeLoaded() && abstractClientPlayer.getCloakTextureLocation() != null && abstractClientPlayer.isModelPartShown(PlayerModelPart.CAPE)) {
else if (abstractClientPlayer.isCapeLoaded() && abstractClientPlayer.getCloakTextureLocation() != null && abstractClientPlayer
.isModelPartShown(PlayerModelPart.CAPE)) {
wingsTexture = abstractClientPlayer.getCloakTextureLocation();
}
}
@ -46,7 +47,12 @@ public class ArmoredElytraLayer<T extends LivingEntity, M extends EntityModel<T>
poseStack.translate(0.0D, 0.0D, 0.125D);
getParentModel().copyPropertiesTo(elytraModel);
elytraModel.setupAnim(livingEntity, f, g, j, k, l);
VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer(multiBufferSource, RenderType.armorCutoutNoCull(wingsTexture), false, itemStack.hasFoil());
VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer(
multiBufferSource,
RenderType.armorCutoutNoCull(wingsTexture),
false,
itemStack.hasFoil()
);
elytraModel.renderToBuffer(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F);
poseStack.popPose();
}

View file

@ -31,11 +31,53 @@ public class BeamRenderer {
matrices.pushPose();
matrices.mulPose(Vector3f.YP.rotation(-rotation));
renderBeam(matrices, vertexConsumer, red, green, blue, alpha, minY, maxBY, beamIn, 0.0F, 0.0F, beamIn, 0.0F, xIn, xIn, 0.0F, 0.0F, 1.0F, minV, maxV);
renderBeam(
matrices,
vertexConsumer,
red,
green,
blue,
alpha,
minY,
maxBY,
beamIn,
0.0F,
0.0F,
beamIn,
0.0F,
xIn,
xIn,
0.0F,
0.0F,
1.0F,
minV,
maxV
);
float xOut = -beamOut;
maxV = (float) maxY + minV;
renderBeam(matrices, vertexConsumer, red, green, blue, alpha, minY, maxBY, xOut, xOut, beamOut, xOut, xOut, beamOut, beamOut, beamOut, 0.0F, 1.0F, minV, maxV);
renderBeam(
matrices,
vertexConsumer,
red,
green,
blue,
alpha,
minY,
maxBY,
xOut,
xOut,
beamOut,
xOut,
xOut,
beamOut,
beamOut,
beamOut,
0.0F,
1.0F,
minV,
maxV
);
matrices.popPose();
}
@ -43,10 +85,82 @@ public class BeamRenderer {
PoseStack.Pose entry = matrices.last();
Matrix4f matrix4f = entry.pose();
Matrix3f matrix3f = entry.normal();
renderBeam(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, maxY, minY, x1, d1, x2, d2, minU, maxU, minV, maxV);
renderBeam(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, maxY, minY, x4, d4, x3, d3, minU, maxU, minV, maxV);
renderBeam(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, maxY, minY, x2, d2, x4, d4, minU, maxU, minV, maxV);
renderBeam(matrix4f, matrix3f, vertexConsumer, red, green, blue, alpha, maxY, minY, x3, d3, x1, d1, minU, maxU, minV, maxV);
renderBeam(
matrix4f,
matrix3f,
vertexConsumer,
red,
green,
blue,
alpha,
maxY,
minY,
x1,
d1,
x2,
d2,
minU,
maxU,
minV,
maxV
);
renderBeam(
matrix4f,
matrix3f,
vertexConsumer,
red,
green,
blue,
alpha,
maxY,
minY,
x4,
d4,
x3,
d3,
minU,
maxU,
minV,
maxV
);
renderBeam(
matrix4f,
matrix3f,
vertexConsumer,
red,
green,
blue,
alpha,
maxY,
minY,
x2,
d2,
x4,
d4,
minU,
maxU,
minV,
maxV
);
renderBeam(
matrix4f,
matrix3f,
vertexConsumer,
red,
green,
blue,
alpha,
maxY,
minY,
x3,
d3,
x1,
d1,
minU,
maxU,
minV,
maxV
);
}
private static void renderBeam(Matrix4f matrix4f, Matrix3f matrix3f, VertexConsumer vertexConsumer, float red, float green, float blue, float alpha, int minY, int maxY, float minX, float minD, float maxX, float maxD, float minU, float maxU, float minV, float maxV) {
@ -57,6 +171,12 @@ public class BeamRenderer {
}
private static void addVertex(Matrix4f matrix4f, Matrix3f matrix3f, VertexConsumer vertexConsumer, float red, float green, float blue, float alpha, float x, float y, float d, float u, float v) {
vertexConsumer.vertex(matrix4f, x, y, d).color(red, green, blue, alpha).uv(u, v).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(15728880).normal(matrix3f, 0.0F, 1.0F, 0.0F).endVertex();
vertexConsumer.vertex(matrix4f, x, y, d)
.color(red, green, blue, alpha)
.uv(u, v)
.overlayCoords(OverlayTexture.NO_OVERLAY)
.uv2(15728880)
.normal(matrix3f, 0.0F, 1.0F, 0.0F)
.endVertex();
}
}

Some files were not shown because too many files have changed in this diff Show more