diff --git a/src/main/java/de/dafuqs/spectrum/blocks/FluidLogging.java b/src/main/java/de/dafuqs/spectrum/blocks/FluidLogging.java index 6aa2db3f61..631dc01f41 100644 --- a/src/main/java/de/dafuqs/spectrum/blocks/FluidLogging.java +++ b/src/main/java/de/dafuqs/spectrum/blocks/FluidLogging.java @@ -20,7 +20,8 @@ public class FluidLogging { public enum State implements StringIdentifiable { NOT_LOGGED("none", 0), WATER("water", 0), - LIQUID_CRYSTAL("liquid_crystal", LiquidCrystalFluidBlock.LUMINANCE); + LIQUID_CRYSTAL("liquid_crystal", LiquidCrystalFluidBlock.LUMINANCE), + MUD("mud",0); private final String name; private final int luminance; @@ -43,19 +44,25 @@ public FluidState getFluidState() { case WATER -> { return Fluids.WATER.getStill(false); } + case MUD -> { + return SpectrumFluids.MUD.getStill(false); + } default -> { return Fluids.EMPTY.getDefaultState(); } } } - + public static State getForFluidState(FluidState fluidState) { if (fluidState.getFluid() == SpectrumFluids.LIQUID_CRYSTAL) { return LIQUID_CRYSTAL; + } else if (fluidState.getFluid() == SpectrumFluids.MUD) + { + return MUD; } else if (fluidState.isIn(FluidTags.WATER)) { return WATER; } - + return NOT_LOGGED; } @@ -80,13 +87,20 @@ public void onEntityCollision(BlockState state, World world, BlockPos pos, Entit if (this == State.LIQUID_CRYSTAL) { SpectrumFluids.LIQUID_CRYSTAL.onEntityCollision(state, world, pos, entity); } + else if (this == State.MUD) { + SpectrumFluids.MUD.onEntityCollision(state, world, pos, entity); + } } } public static final EnumProperty ANY_INCLUDING_NONE = EnumProperty.of("fluid_logged", State.class); - public static final EnumProperty ANY_EXCLUDING_NONE = EnumProperty.of("fluid_logged", State.class, State.WATER, State.LIQUID_CRYSTAL); + public static final EnumProperty ANY_EXCLUDING_NONE = EnumProperty.of("fluid_logged", State.class, State.WATER, State.LIQUID_CRYSTAL, State.MUD); + public static final EnumProperty WATER_AND_CRYSTAL = EnumProperty.of("fluid_logged", State.class, State.WATER, State.LIQUID_CRYSTAL); public static final EnumProperty NONE_AND_CRYSTAL = EnumProperty.of("fluid_logged", State.class, State.NOT_LOGGED, State.LIQUID_CRYSTAL); - + public static final EnumProperty NONE_WATER_AND_CRYSTAL = EnumProperty.of("fluid_logged", State.class, State.NOT_LOGGED, State.WATER, State.LIQUID_CRYSTAL); + public static final EnumProperty NONE_WATER_AND_MUD = EnumProperty.of("fluid_logged", State.class, State.NOT_LOGGED, State.WATER, State.MUD); + + public interface SpectrumFluidLoggable extends SpectrumFluidDrainable, SpectrumFluidFillable { } @@ -95,7 +109,7 @@ public interface SpectrumFluidFillable extends FluidFillable { @Override default boolean canFillWithFluid(BlockView world, BlockPos pos, BlockState state, Fluid fluid) { - return state.get(ANY_INCLUDING_NONE) == State.NOT_LOGGED && (fluid == Fluids.WATER || fluid == SpectrumFluids.LIQUID_CRYSTAL); + return state.get(ANY_INCLUDING_NONE) == State.NOT_LOGGED && (fluid == Fluids.WATER || fluid == SpectrumFluids.LIQUID_CRYSTAL || fluid == SpectrumFluids.MUD); } @Override @@ -108,6 +122,9 @@ default boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState sta } else if (fluidState.getFluid() == SpectrumFluids.LIQUID_CRYSTAL) { world.setBlockState(pos, state.with(ANY_INCLUDING_NONE, State.LIQUID_CRYSTAL), Block.NOTIFY_ALL); world.scheduleFluidTick(pos, fluidState.getFluid(), fluidState.getFluid().getTickRate(world)); + } else if (fluidState.getFluid() == SpectrumFluids.MUD) { + world.setBlockState(pos, state.with(ANY_INCLUDING_NONE, State.MUD), Block.NOTIFY_ALL); + world.scheduleFluidTick(pos, fluidState.getFluid(), fluidState.getFluid().getTickRate(world)); } } @@ -137,11 +154,17 @@ default ItemStack tryDrainFluid(WorldAccess world, BlockPos pos, BlockState stat world.breakBlock(pos, true); } return new ItemStack(SpectrumItems.LIQUID_CRYSTAL_BUCKET); + } else if (fluidLog == State.MUD) { + world.setBlockState(pos, state.with(ANY_INCLUDING_NONE, State.NOT_LOGGED), Block.NOTIFY_ALL); + if (!state.canPlaceAt(world, pos)) { + world.breakBlock(pos, true); + } + return new ItemStack(SpectrumItems.MUD_BUCKET); } - return ItemStack.EMPTY; } - + + //TODO: Remove this when we add custom fill sounds for our fluids. @Override default Optional getBucketFillSound() { return Fluids.WATER.getBucketFillSound(); diff --git a/src/main/java/de/dafuqs/spectrum/blocks/conditional/MermaidsBrushBlock.java b/src/main/java/de/dafuqs/spectrum/blocks/conditional/MermaidsBrushBlock.java index 71a45af713..f899698241 100644 --- a/src/main/java/de/dafuqs/spectrum/blocks/conditional/MermaidsBrushBlock.java +++ b/src/main/java/de/dafuqs/spectrum/blocks/conditional/MermaidsBrushBlock.java @@ -25,7 +25,7 @@ public class MermaidsBrushBlock extends PlantBlock implements Fertilizable, Reve private static final VoxelShape SHAPE = Block.createCuboidShape(1.0, 0.0, 1.0, 15.0, 16.0, 15.0); - public static final EnumProperty LOGGED = FluidLogging.ANY_EXCLUDING_NONE; + public static final EnumProperty LOGGED = FluidLogging.WATER_AND_CRYSTAL; public static final IntProperty AGE = Properties.AGE_7; public MermaidsBrushBlock(Settings settings) { diff --git a/src/main/java/de/dafuqs/spectrum/blocks/conditional/QuitoxicReedsBlock.java b/src/main/java/de/dafuqs/spectrum/blocks/conditional/QuitoxicReedsBlock.java index c3d16b0e82..777118ec6f 100644 --- a/src/main/java/de/dafuqs/spectrum/blocks/conditional/QuitoxicReedsBlock.java +++ b/src/main/java/de/dafuqs/spectrum/blocks/conditional/QuitoxicReedsBlock.java @@ -25,7 +25,7 @@ public class QuitoxicReedsBlock extends Block implements RevelationAware, FluidLogging.SpectrumFluidLoggable { - public static final EnumProperty LOGGED = FluidLogging.ANY_INCLUDING_NONE; + public static final EnumProperty LOGGED = FluidLogging.NONE_WATER_AND_CRYSTAL; public static final IntProperty AGE = Properties.AGE_7; // 'always drop' has no cloak and therefore drops normally even when broken 'via the world' @@ -70,7 +70,47 @@ public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Ran world.breakBlock(pos, true); } } - + + @Override + public boolean canFillWithFluid(BlockView world, BlockPos pos, BlockState state, Fluid fluid) { + return state.get(LOGGED) == FluidLogging.State.NOT_LOGGED && (fluid == Fluids.WATER || fluid == SpectrumFluids.LIQUID_CRYSTAL); + } + @Override + public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) { + if (state.get(LOGGED) == FluidLogging.State.NOT_LOGGED) { + if (!world.isClient()) { + if (fluidState.getFluid() == Fluids.WATER) { + world.setBlockState(pos, state.with(LOGGED, FluidLogging.State.WATER), Block.NOTIFY_ALL); + world.scheduleFluidTick(pos, fluidState.getFluid(), fluidState.getFluid().getTickRate(world)); + } else if (fluidState.getFluid() == SpectrumFluids.LIQUID_CRYSTAL) { + world.setBlockState(pos, state.with(LOGGED, FluidLogging.State.LIQUID_CRYSTAL), Block.NOTIFY_ALL); + world.scheduleFluidTick(pos, fluidState.getFluid(), fluidState.getFluid().getTickRate(world)); + } + } + return true; + } else { + return false; + } + } + @Override + public ItemStack tryDrainFluid(WorldAccess world, BlockPos pos, BlockState state) { + FluidLogging.State fluidLog = state.get(LOGGED); + + if (fluidLog == FluidLogging.State.WATER) { + world.setBlockState(pos, state.with(LOGGED, FluidLogging.State.NOT_LOGGED), Block.NOTIFY_ALL); + if (!state.canPlaceAt(world, pos)) { + world.breakBlock(pos, true); + } + return new ItemStack(Items.WATER_BUCKET); + } else if (fluidLog == FluidLogging.State.LIQUID_CRYSTAL) { + world.setBlockState(pos, state.with(LOGGED, FluidLogging.State.NOT_LOGGED), Block.NOTIFY_ALL); + if (!state.canPlaceAt(world, pos)) { + world.breakBlock(pos, true); + } + return new ItemStack(SpectrumItems.LIQUID_CRYSTAL_BUCKET); + } + return ItemStack.EMPTY; + } @Nullable @Override public BlockState getPlacementState(ItemPlacementContext ctx) { diff --git a/src/main/java/de/dafuqs/spectrum/blocks/redstone/DroopleafBlock.java b/src/main/java/de/dafuqs/spectrum/blocks/redstone/DroopleafBlock.java new file mode 100644 index 0000000000..8809e2358c --- /dev/null +++ b/src/main/java/de/dafuqs/spectrum/blocks/redstone/DroopleafBlock.java @@ -0,0 +1,318 @@ +package de.dafuqs.spectrum.blocks.redstone; + +import com.google.common.collect.ImmutableMap; +import de.dafuqs.spectrum.blocks.FluidLogging; +import de.dafuqs.spectrum.registries.SpectrumBlocks; +import de.dafuqs.spectrum.registries.SpectrumFluids; +import de.dafuqs.spectrum.registries.SpectrumItems; +import net.minecraft.block.*; +import net.minecraft.entity.Entity; +import net.minecraft.entity.projectile.ProjectileEntity; +import net.minecraft.fluid.Fluid; +import net.minecraft.fluid.FluidState; +import net.minecraft.fluid.Fluids; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvent; +import net.minecraft.sound.SoundEvents; +import net.minecraft.state.StateManager; +import net.minecraft.state.property.BooleanProperty; +import net.minecraft.state.property.EnumProperty; +import net.minecraft.state.property.Properties; +import net.minecraft.util.function.BooleanBiFunction; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockBox; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.random.Random; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; +import net.minecraft.world.*; +import net.minecraft.world.event.GameEvent; + +import java.util.Map; + +import static de.dafuqs.spectrum.blocks.FluidLogging.State.getForFluidState; + +@SuppressWarnings("deprecation") +public class DroopleafBlock extends HorizontalFacingBlock implements Fertilizable, FluidLogging.SpectrumFluidLoggable { + public static final EnumProperty LOGGED = FluidLogging.NONE_WATER_AND_MUD; + public static final BooleanProperty MUDDY = BooleanProperty.of("muddy"); + private static final VoxelShape BASE_SHAPE = Block.createCuboidShape(0.0, 13.0, 0.0, 16.0, 15.0, 16.0); + private static final VoxelShape SHORT_SHAPE = Block.createCuboidShape(0.0, 5.0, 0.0, 16.0, 7.0, 16.0); + private static final Map SHAPES_FOR_DIRECTION = ImmutableMap.of(Direction.NORTH, VoxelShapes.combine(DroopleafStemBlock.NORTH_SHAPE, BASE_SHAPE, BooleanBiFunction.ONLY_FIRST), Direction.SOUTH, VoxelShapes.combine(DroopleafStemBlock.SOUTH_SHAPE, BASE_SHAPE, BooleanBiFunction.ONLY_FIRST), Direction.EAST, VoxelShapes.combine(DroopleafStemBlock.EAST_SHAPE, BASE_SHAPE, BooleanBiFunction.ONLY_FIRST), Direction.WEST, VoxelShapes.combine(DroopleafStemBlock.WEST_SHAPE, BASE_SHAPE, BooleanBiFunction.ONLY_FIRST)); + private static final Map SHORT_SHAPES_FOR_DIRECTION = ImmutableMap.of(Direction.NORTH, VoxelShapes.combine(DroopleafStemBlock.NORTH_SHAPE, SHORT_SHAPE, BooleanBiFunction.ONLY_FIRST), Direction.SOUTH, VoxelShapes.combine(DroopleafStemBlock.SOUTH_SHAPE, SHORT_SHAPE, BooleanBiFunction.ONLY_FIRST), Direction.EAST, VoxelShapes.combine(DroopleafStemBlock.EAST_SHAPE, SHORT_SHAPE, BooleanBiFunction.ONLY_FIRST), Direction.WEST, VoxelShapes.combine(DroopleafStemBlock.WEST_SHAPE, SHORT_SHAPE, BooleanBiFunction.ONLY_FIRST)); + + private final Map shapes; + + + public DroopleafBlock(Settings settings) { + super(settings); + this.setDefaultState((this.stateManager.getDefaultState().with(LOGGED, FluidLogging.State.NOT_LOGGED).with(FACING, Direction.NORTH).with(Properties.UNSTABLE, false).with(Properties.SHORT, false).with(MUDDY,false))); + this.shapes = this.getShapesForStates(DroopleafBlock::getShapeForState); + } + @Override + protected void appendProperties(StateManager.Builder builder) { + builder.add(FACING, LOGGED, Properties.UNSTABLE, Properties.SHORT, MUDDY); + } + public BlockState getPlacementState(ItemPlacementContext ctx) { + BlockState blockState = ctx.getWorld().getBlockState(ctx.getBlockPos().down()); + FluidLogging.State preFluidState = getForFluidState(ctx.getWorld().getFluidState(ctx.getBlockPos())); + FluidLogging.State fluidState = preFluidState!=FluidLogging.State.LIQUID_CRYSTAL ? preFluidState : FluidLogging.State.NOT_LOGGED; + if(blockState.isOf(this) || blockState.isOf(SpectrumBlocks.DROOPLEAF_STEM)) + { + if(blockState.isOf(this) && !blockState.get(MUDDY)) + { + ctx.getWorld().setBlockState(ctx.getBlockPos().down(), blockState.with(Properties.UNSTABLE, false), Block.NOTIFY_LISTENERS); + ctx.getWorld().scheduleBlockTick(ctx.getBlockPos().down(), blockState.getBlock(), 50); + } + return SpectrumBlocks.DROOPLEAF_STEM.getStateWithProperties(blockState).with(LOGGED, fluidState); + } + else + { + return this.getDefaultState().with(LOGGED, fluidState).with(FACING, ctx.getHorizontalPlayerFacing().getOpposite()).with(Properties.UNSTABLE, false).with(MUDDY, fluidState == FluidLogging.State.MUD); + } + } + public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { + BlockPos blockPos = pos.down(); + BlockState blockState = world.getBlockState(blockPos); + return blockState.isOf(this) || blockState.isOf(SpectrumBlocks.DROOPLEAF_STEM) || blockState.isIn(BlockTags.BIG_DRIPLEAF_PLACEABLE); + } + public boolean canReplace(BlockState state, ItemPlacementContext context) { + return context.getStack().isOf(this.asItem()); + } + public boolean emitsRedstonePower(BlockState state) { + return true; + } + + public int getWeakRedstonePower(BlockState state, BlockView world, BlockPos pos, Direction direction) { + return state.get(FACING) == direction.getOpposite() || direction == Direction.UP ? 15 : 0; + } + + private static VoxelShape getShapeForState(BlockState state) { + if(state.get(Properties.SHORT)) + { + return VoxelShapes.union(Block.createCuboidShape(0.0, 3.0, 0.0, 16.0, 7.0, 16.0),SHORT_SHAPES_FOR_DIRECTION.get(state.get(FACING))); + } + return VoxelShapes.union(Block.createCuboidShape(0.0, 11.0, 0.0, 16.0, 15.0, 16.0),SHAPES_FOR_DIRECTION.get(state.get(FACING))); + } + @Override + public boolean canFillWithFluid(BlockView world, BlockPos pos, BlockState state, Fluid fluid) { + return state.get(LOGGED) == FluidLogging.State.NOT_LOGGED && (fluid == Fluids.WATER || fluid == SpectrumFluids.MUD); + } + @Override + public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) { + if (state.get(LOGGED) == FluidLogging.State.NOT_LOGGED) { + if (!world.isClient()) { + if (fluidState.getFluid() == Fluids.WATER) { + world.setBlockState(pos, state.with(LOGGED, FluidLogging.State.WATER), Block.NOTIFY_ALL); + world.scheduleFluidTick(pos, fluidState.getFluid(), fluidState.getFluid().getTickRate(world)); + } else if (fluidState.getFluid() == SpectrumFluids.MUD) { + if (world.getBlockState(pos.down()).getBlock() != SpectrumBlocks.DROOPLEAF_STEM) { + world.setBlockState(pos, state.with(MUDDY, true).with(LOGGED, FluidLogging.State.MUD), Block.NOTIFY_ALL); + } + else{ + world.setBlockState(pos, state.with(LOGGED, FluidLogging.State.MUD), Block.NOTIFY_ALL); + } + world.scheduleFluidTick(pos, fluidState.getFluid(), fluidState.getFluid().getTickRate(world)); + } + } + + return true; + } else { + return false; + } + } + @Override + public ItemStack tryDrainFluid(WorldAccess world, BlockPos pos, BlockState state) { + FluidLogging.State fluidLog = state.get(LOGGED); + + if (fluidLog == FluidLogging.State.WATER) { + world.setBlockState(pos, state.with(LOGGED, FluidLogging.State.NOT_LOGGED), Block.NOTIFY_ALL); + if (!state.canPlaceAt(world, pos)) { + world.breakBlock(pos, true); + } + return new ItemStack(Items.WATER_BUCKET); + } else if (fluidLog == FluidLogging.State.MUD) { + if(world.getBlockState(pos.down()).getBlock() != SpectrumBlocks.DROOPLEAF_STEM) + { + world.setBlockState(pos, state.with(MUDDY, false).with(LOGGED, FluidLogging.State.NOT_LOGGED), Block.NOTIFY_ALL); + world.scheduleBlockTick(pos, this, 50); + } + else + { + world.setBlockState(pos, state.with(LOGGED, FluidLogging.State.NOT_LOGGED), Block.NOTIFY_ALL); + } + if (!state.canPlaceAt(world, pos)) { + world.breakBlock(pos, true); + } + return new ItemStack(SpectrumItems.MUD_BUCKET); + } + return ItemStack.EMPTY; + } + public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state, boolean isClient) { + if(state.get(MUDDY)) + { + return false; + } + BlockState blockState = world.getBlockState(pos.up()); + return state.get(Properties.SHORT) || canGrowInto(blockState); + } + public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { + return true; + } + public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) { + BlockPos blockPos = pos.up(); + BlockState blockState = world.getBlockState(blockPos); + if(state.get(Properties.SHORT)) + { + world.setBlockState(pos, state.with(Properties.SHORT, false), Block.NOTIFY_LISTENERS); + world.scheduleBlockTick(pos, SpectrumBlocks.DROOPLEAF, 50); + } + else if (canGrowInto(world, blockPos, blockState)) { + Direction direction = state.get(FACING); + DroopleafStemBlock.placeStemAt(world, pos, getForFluidState(state.getFluidState()), direction); + placeDroopleafAt(world, blockPos, getForFluidState(blockState.getFluidState()), direction); + } + + } + + private static boolean canGrowInto(BlockState state) { + return state.isOf(SpectrumBlocks.DROOPLEAF_STEM); + } + protected static boolean canGrowInto(HeightLimitView world, BlockPos pos, BlockState state) { + return !world.isOutOfHeightLimit(pos) && canGrowInto(state); + } + protected static void placeDroopleafAt(WorldAccess world, BlockPos pos, FluidLogging.State fluidState, Direction direction) { + BlockState blockState = SpectrumBlocks.DROOPLEAF.getDefaultState().with(LOGGED, fluidState).with(FACING, direction).with(Properties.UNSTABLE, false).with(Properties.SHORT,true); + world.scheduleBlockTick(pos, SpectrumBlocks.DROOPLEAF, 50); + world.setBlockState(pos, blockState, 3); + } + public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { + if (direction == Direction.DOWN && !state.canPlaceAt(world, pos)) { + return Blocks.AIR.getDefaultState(); + } else { + return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); + } + } + @Override + public FluidState getFluidState(BlockState state) { + return state.get(LOGGED).getFluidState(); + } + private static boolean isEntityAbove(BlockPos pos, Entity entity, boolean isShort) { + if(isShort) + { + return entity.isOnGround() && entity.getPos().y > (double)((float)pos.getY() + 0.1875F); + } + return entity.isOnGround() && entity.getPos().y > (double)((float)pos.getY() + 0.6875F); + } + public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) { + if (!world.isClient) { + if (!state.get(Properties.UNSTABLE) && !state.get(MUDDY)) { + if (isEntityAbove(pos, entity, state.get(Properties.SHORT))) { + world.setBlockState(pos, state.with(Properties.UNSTABLE, true), Block.NOTIFY_LISTENERS); + if(world.getBlockTickScheduler().isQueued(pos,this)) + { + ((ServerWorld)world).getBlockTickScheduler().clearNextTicks(BlockBox.create(pos,pos)); + } + world.scheduleBlockTick(pos, this, 10); + } + } + + } + } + public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { + if (!state.get(Properties.UNSTABLE) && !state.get(MUDDY)) { + BlockPos pos = hit.getBlockPos(); + if(!state.get(Properties.SHORT)) + { + playDropSound(world, pos, SoundEvents.BLOCK_BIG_DRIPLEAF_TILT_DOWN); + world.setBlockState(pos, state.with(Properties.SHORT, true).with(Properties.UNSTABLE,false), Block.NOTIFY_LISTENERS); + world.scheduleBlockTick(pos, this, 50); + world.emitGameEvent(null, GameEvent.BLOCK_CHANGE, pos); + } + else if(world.getBlockState(pos.down()).getBlock() == SpectrumBlocks.DROOPLEAF_STEM) { + world.setBlockState(pos, state.with(Properties.UNSTABLE, true), Block.NOTIFY_LISTENERS); + dropLeaf(state, world, pos); + } + } + } + private static void dropLeaf(BlockState state, World world, BlockPos pos) { + playDropSound(world, pos, SoundEvents.BLOCK_BIG_DRIPLEAF_TILT_DOWN); + world.setBlockState(pos, SpectrumBlocks.DROOPLEAF_STEM.getStateWithProperties(state), Block.NOTIFY_LISTENERS); + world.setBlockState(pos.down(), state.with(Properties.UNSTABLE, false).with(Properties.SHORT, false).with(LOGGED, getForFluidState(world.getFluidState(pos.down()))), Block.NOTIFY_LISTENERS); + world.updateNeighbors(pos, SpectrumBlocks.DROOPLEAF_STEM); + world.updateNeighbors(pos.down(), SpectrumBlocks.DROOPLEAF); + world.emitGameEvent(null, GameEvent.BLOCK_CHANGE, pos); + world.emitGameEvent(null, GameEvent.BLOCK_CHANGE, pos.down()); + world.scheduleBlockTick(pos.down(), state.getBlock(), 50); + } + private static void riseLeaf(BlockState state, World world, BlockPos pos) + { + playDropSound(world, pos, SoundEvents.BLOCK_BIG_DRIPLEAF_TILT_UP); + world.setBlockState(pos, SpectrumBlocks.DROOPLEAF_STEM.getStateWithProperties(state), Block.NOTIFY_LISTENERS); + world.setBlockState(pos.up(), state.with(Properties.SHORT, true).with(LOGGED, getForFluidState(world.getFluidState(pos.up()))), Block.NOTIFY_LISTENERS); + world.updateNeighbors(pos, SpectrumBlocks.DROOPLEAF_STEM); + world.updateNeighbors(pos.up(), SpectrumBlocks.DROOPLEAF); + world.emitGameEvent(null, GameEvent.BLOCK_CHANGE, pos); + world.emitGameEvent(null, GameEvent.BLOCK_CHANGE, pos.up()); + world.scheduleBlockTick(pos.up(), state.getBlock(), 50); + } + private static void playDropSound(World world, BlockPos pos, SoundEvent soundEvent) { + float f = MathHelper.nextBetween(world.random, 0.8F, 1.2F); + world.playSound(null, pos, soundEvent, SoundCategory.BLOCKS, 1.0F, f); + } + public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + if (!state.get(MUDDY)) { + if (state.get(Properties.UNSTABLE)) { + if(!state.get(Properties.SHORT)) + { + playDropSound(world, pos, SoundEvents.BLOCK_BIG_DRIPLEAF_TILT_DOWN); + world.setBlockState(pos, state.with(Properties.SHORT, true).with(Properties.UNSTABLE,false), Block.NOTIFY_LISTENERS); + world.scheduleBlockTick(pos, this, 50); + world.emitGameEvent(null, GameEvent.BLOCK_CHANGE, pos); + } + else if(world.getBlockState(pos.down()).getBlock() == SpectrumBlocks.DROOPLEAF_STEM) + { + dropLeaf(state, world, pos); + } + else{ + world.setBlockState(pos, state.with(Properties.UNSTABLE, false), Block.NOTIFY_LISTENERS); + world.scheduleBlockTick(pos, state.getBlock(), 50); + } + } else { + if(state.get(Properties.SHORT)) + { + playDropSound(world, pos, SoundEvents.BLOCK_BIG_DRIPLEAF_TILT_UP); + world.setBlockState(pos, state.with(Properties.SHORT, false), Block.NOTIFY_LISTENERS); + world.scheduleBlockTick(pos, this, 50); + world.emitGameEvent(null, GameEvent.BLOCK_CHANGE, pos); + } + else if(world.getBlockState(pos.up()).getBlock() == SpectrumBlocks.DROOPLEAF_STEM) + { + world.scheduleBlockTick(pos.up(), this, 50); + riseLeaf(state, world, pos); + } + } + } + else if (state.get(Properties.UNSTABLE)){ + world.setBlockState(pos, state.with(Properties.UNSTABLE, false), Block.NOTIFY_LISTENERS); + } + } + public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + if(state.get(Properties.SHORT)) + { + return Block.createCuboidShape(0.0, 3.0, 0.0, 16.0, 7.0, 16.0); + } + return Block.createCuboidShape(0.0, 11.0, 0.0, 16.0, 15.0, 16.0); + } + + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return this.shapes.get(state); + } +} diff --git a/src/main/java/de/dafuqs/spectrum/blocks/redstone/DroopleafStemBlock.java b/src/main/java/de/dafuqs/spectrum/blocks/redstone/DroopleafStemBlock.java new file mode 100644 index 0000000000..902f35e045 --- /dev/null +++ b/src/main/java/de/dafuqs/spectrum/blocks/redstone/DroopleafStemBlock.java @@ -0,0 +1,186 @@ +package de.dafuqs.spectrum.blocks.redstone; + +import de.dafuqs.spectrum.blocks.FluidLogging; +import de.dafuqs.spectrum.registries.SpectrumBlocks; +import de.dafuqs.spectrum.registries.SpectrumFluids; +import de.dafuqs.spectrum.registries.SpectrumItems; +import net.minecraft.block.*; +import net.minecraft.fluid.Fluid; +import net.minecraft.fluid.FluidState; +import net.minecraft.fluid.Fluids; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.state.StateManager; +import net.minecraft.state.property.EnumProperty; +import net.minecraft.state.property.Properties; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.random.Random; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.*; +import java.util.Optional; +import static de.dafuqs.spectrum.blocks.FluidLogging.State.getForFluidState; + +@SuppressWarnings("deprecation") +public class DroopleafStemBlock extends HorizontalFacingBlock implements Fertilizable, FluidLogging.SpectrumFluidLoggable { + public static final EnumProperty LOGGED = FluidLogging.NONE_WATER_AND_MUD; + protected static final VoxelShape NORTH_SHAPE = Block.createCuboidShape(5.0, 0.0, 9.0, 11.0, 16.0, 15.0); + protected static final VoxelShape SOUTH_SHAPE = Block.createCuboidShape(5.0, 0.0, 1.0, 11.0, 16.0, 7.0); + protected static final VoxelShape EAST_SHAPE = Block.createCuboidShape(1.0, 0.0, 5.0, 7.0, 16.0, 11.0); + protected static final VoxelShape WEST_SHAPE = Block.createCuboidShape(9.0, 0.0, 5.0, 15.0, 16.0, 11.0); + public DroopleafStemBlock(Settings settings) { + super(settings); + this.setDefaultState((this.stateManager.getDefaultState().with(LOGGED, FluidLogging.State.NOT_LOGGED).with(FACING, Direction.NORTH))); + } + @Override + protected void appendProperties(StateManager.Builder builder) { + builder.add(FACING, LOGGED); + } + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + switch (state.get(FACING)) { + case SOUTH: + return SOUTH_SHAPE; + case NORTH: + default: + return NORTH_SHAPE; + case WEST: + return WEST_SHAPE; + case EAST: + return EAST_SHAPE; + } + } + public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state, boolean isClient) { + Optional optional = BlockLocating.findColumnEnd(world, pos, state.getBlock(), Direction.UP, SpectrumBlocks.DROOPLEAF); + if (optional.isEmpty()) { + return false; + } else { + BlockPos blockPos = optional.get().up(); + BlockState blockState = world.getBlockState(blockPos); + if(world.getBlockState(optional.get()).get(DroopleafBlock.MUDDY)) + { + return false; + } + return world.getBlockState(optional.get()).get(Properties.SHORT) || DroopleafBlock.canGrowInto(world, blockPos, blockState); + } + } + @Override + public boolean canFillWithFluid(BlockView world, BlockPos pos, BlockState state, Fluid fluid) { + return state.get(LOGGED) == FluidLogging.State.NOT_LOGGED && (fluid == Fluids.WATER || fluid == SpectrumFluids.MUD); + } + @Override + public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) { + if (state.get(LOGGED) == FluidLogging.State.NOT_LOGGED) { + if (!world.isClient()) { + if (fluidState.getFluid() == Fluids.WATER) { + world.setBlockState(pos, state.with(LOGGED, FluidLogging.State.WATER), Block.NOTIFY_ALL); + world.scheduleFluidTick(pos, fluidState.getFluid(), fluidState.getFluid().getTickRate(world)); + } else if (fluidState.getFluid() == SpectrumFluids.MUD) { + Block soilBlock = world.getBlockState(pos.down()).getBlock(); + if(soilBlock != SpectrumBlocks.DROOPLEAF_STEM && soilBlock != SpectrumBlocks.DROOPLEAF) + { + Optional optional = BlockLocating.findColumnEnd(world, pos, state.getBlock(), Direction.UP, SpectrumBlocks.DROOPLEAF); + if(optional.isPresent()) + { + world.setBlockState(optional.get(), world.getBlockState(optional.get()).with(DroopleafBlock.MUDDY, true), Block.NOTIFY_ALL); + } + } + world.setBlockState(pos, state.with(LOGGED, FluidLogging.State.MUD), Block.NOTIFY_ALL); + world.scheduleFluidTick(pos, fluidState.getFluid(), fluidState.getFluid().getTickRate(world)); + } + } + + return true; + } else { + return false; + } + } + @Override + public ItemStack tryDrainFluid(WorldAccess world, BlockPos pos, BlockState state) { + FluidLogging.State fluidLog = state.get(LOGGED); + + if (fluidLog == FluidLogging.State.WATER) { + world.setBlockState(pos, state.with(LOGGED, FluidLogging.State.NOT_LOGGED), Block.NOTIFY_ALL); + if (!state.canPlaceAt(world, pos)) { + world.breakBlock(pos, true); + } + return new ItemStack(Items.WATER_BUCKET); + } else if (fluidLog == FluidLogging.State.MUD) { + Block soilBlock = world.getBlockState(pos.down()).getBlock(); + if(soilBlock != SpectrumBlocks.DROOPLEAF_STEM && soilBlock != SpectrumBlocks.DROOPLEAF) + { + Optional optional = BlockLocating.findColumnEnd(world, pos, state.getBlock(), Direction.UP, SpectrumBlocks.DROOPLEAF); + if(optional.isPresent()) + { + world.setBlockState(optional.get(), world.getBlockState(optional.get()).with(DroopleafBlock.MUDDY, false), Block.NOTIFY_ALL); + world.scheduleBlockTick(optional.get(), SpectrumBlocks.DROOPLEAF, 50); + + } + } + world.setBlockState(pos, state.with(LOGGED, FluidLogging.State.NOT_LOGGED), Block.NOTIFY_ALL); + if (!state.canPlaceAt(world, pos)) { + world.breakBlock(pos, true); + } + return new ItemStack(SpectrumItems.MUD_BUCKET); + } + return ItemStack.EMPTY; + } + public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { + BlockPos blockPos = pos.down(); + BlockState blockState = world.getBlockState(blockPos); + return (blockState.isOf(this) || blockState.isIn(BlockTags.BIG_DRIPLEAF_PLACEABLE) || blockState.isOf(SpectrumBlocks.DROOPLEAF)) && (BlockLocating.findColumnEnd(world, pos, state.getBlock(), Direction.DOWN, SpectrumBlocks.DROOPLEAF).isPresent() || BlockLocating.findColumnEnd(world, pos, state.getBlock(), Direction.UP, SpectrumBlocks.DROOPLEAF).isPresent()); + } + public boolean canReplace(BlockState state, ItemPlacementContext context) { + return context.getStack().isOf(SpectrumItems.DROOPLEAF); + } + public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { + if ((direction == Direction.DOWN || direction == Direction.UP) && !state.canPlaceAt(world, pos)) { + world.scheduleBlockTick(pos, this, 1); + } + else if (BlockLocating.findColumnEnd(world, pos, state.getBlock(), Direction.DOWN, SpectrumBlocks.DROOPLEAF).isEmpty()) + { + world.scheduleBlockTick(pos, this, 1); + } + return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); + } + public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + if (!state.canPlaceAt(world, pos)) { + world.breakBlock(pos, true); + } + + } + public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { + return true; + } + public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) { + Optional optional = BlockLocating.findColumnEnd(world, pos, state.getBlock(), Direction.UP, SpectrumBlocks.DROOPLEAF); + if (optional.isPresent()) { + BlockPos blockPos = optional.get(); + BlockPos blockPos2 = blockPos.up(); + if(world.getBlockState(blockPos).get(Properties.SHORT)) + { + world.setBlockState(blockPos, world.getBlockState(blockPos).with(Properties.SHORT, false), Block.NOTIFY_LISTENERS); + world.scheduleBlockTick(blockPos, SpectrumBlocks.DROOPLEAF, 50); + } + else + { + Direction direction = state.get(FACING); + placeStemAt(world, blockPos, getForFluidState(world.getFluidState(blockPos)), direction); + DroopleafBlock.placeDroopleafAt(world, blockPos2, getForFluidState(world.getFluidState(blockPos2)), direction); + } + } + } + protected static boolean placeStemAt(WorldAccess world, BlockPos pos, FluidLogging.State fluidState, Direction direction) { + BlockState blockState = SpectrumBlocks.DROOPLEAF_STEM.getDefaultState().with(LOGGED, fluidState).with(FACING, direction); + return world.setBlockState(pos, blockState, 3); + } + public ItemStack getPickStack(BlockView world, BlockPos pos, BlockState state) { + return new ItemStack(SpectrumBlocks.DROOPLEAF); + } + @Override + public FluidState getFluidState(BlockState state) { + return state.get(LOGGED).getFluidState(); + } +} diff --git a/src/main/java/de/dafuqs/spectrum/items/DroopleafItem.java b/src/main/java/de/dafuqs/spectrum/items/DroopleafItem.java new file mode 100644 index 0000000000..07f9eef395 --- /dev/null +++ b/src/main/java/de/dafuqs/spectrum/items/DroopleafItem.java @@ -0,0 +1,57 @@ +package de.dafuqs.spectrum.items; + +import de.dafuqs.spectrum.blocks.redstone.DroopleafBlock; +import de.dafuqs.spectrum.registries.SpectrumBlocks; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.text.Text; +import net.minecraft.util.Formatting; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.World; +import org.jetbrains.annotations.Nullable; + +public class DroopleafItem extends BlockItem { + public DroopleafItem(Block block, Item.Settings settings) { + super(block, settings); + } + @Nullable + public ItemPlacementContext getPlacementContext(ItemPlacementContext context) { + BlockPos blockPos = context.getBlockPos(); + World world = context.getWorld(); + BlockState blockState = world.getBlockState(blockPos); + if (!blockState.isOf(SpectrumBlocks.DROOPLEAF) && !blockState.isOf(SpectrumBlocks.DROOPLEAF_STEM)) { + return this.getBlock().canPlaceAt(blockState,world,blockPos) ? context : null; + } else { + BlockPos.Mutable mutable = blockPos.mutableCopy().move(Direction.UP); + while(true) { + if (!world.isClient && !world.isInBuildLimit(mutable)) { + PlayerEntity playerEntity = context.getPlayer(); + int j = world.getTopY(); + if (playerEntity instanceof ServerPlayerEntity && mutable.getY() >= j) { + ((ServerPlayerEntity)playerEntity).sendMessageToClient(Text.translatable("build.tooHigh", j - 1).formatted(Formatting.RED), true); + } + break; + } + blockState = world.getBlockState(mutable); + if (!blockState.isOf(SpectrumBlocks.DROOPLEAF) && !blockState.isOf(SpectrumBlocks.DROOPLEAF_STEM)) { + if (blockState.canReplace(context)) { + return ItemPlacementContext.offset(context, mutable, Direction.UP); + } + break; + } + mutable.move(Direction.UP); + } + return null; + } + } + + protected boolean checkStatePlacement() { + return false; + } +} diff --git a/src/main/java/de/dafuqs/spectrum/mixin/BucketItemMixin.java b/src/main/java/de/dafuqs/spectrum/mixin/BucketItemMixin.java new file mode 100644 index 0000000000..b00a99570d --- /dev/null +++ b/src/main/java/de/dafuqs/spectrum/mixin/BucketItemMixin.java @@ -0,0 +1,53 @@ +package de.dafuqs.spectrum.mixin; + +import com.llamalad7.mixinextras.sugar.Local; +import de.dafuqs.spectrum.blocks.FluidLogging; +import de.dafuqs.spectrum.mixin.accessors.BucketItemAccessor; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.fluid.FlowableFluid; +import net.minecraft.item.BucketItem; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Debug; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyVariable; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Debug(export = true) +@Mixin(BucketItem.class) +public class BucketItemMixin { + @Unique + BucketItemAccessor thisObject = (BucketItemAccessor) this; + + @Inject(method = "placeFluid(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/hit/BlockHitResult;)Z", + at = @At(value="FIELD", target= "Lnet/minecraft/world/World;isClient:Z", ordinal=0), cancellable = true) + private void spectrum$BucketItemPlaceFluids(PlayerEntity player, World world, BlockPos pos, BlockHitResult hitResult, CallbackInfoReturnable cir) + { + + Block block = world.getBlockState(pos).getBlock(); + if (block instanceof FluidLogging.SpectrumFluidFillable && ((FluidLogging.SpectrumFluidFillable) block).canFillWithFluid(world,pos,world.getBlockState(pos),thisObject.getFluid())) { + ((FluidLogging.SpectrumFluidFillable) block).tryFillWithFluid(world, pos, world.getBlockState(pos), ((FlowableFluid) thisObject.getFluid()).getStill(false)); + thisObject.callPlayEmptyingSound(player, world, pos); + cir.setReturnValue(true); + } + } + @ModifyVariable(method = "use(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/TypedActionResult;", at= @At(value="STORE", ordinal= 0), ordinal = 2) + private BlockPos spectrum$BucketItemPlacementPos(BlockPos blockPos3, World world, PlayerEntity user, Hand hand, @Local(ordinal=0) BlockPos blockPos) + { + BlockState blockState = world.getBlockState(blockPos); + BlockPos newPos = blockPos3; + if(blockPos3!=blockPos) + { + newPos = (blockState.getBlock() instanceof FluidLogging.SpectrumFluidFillable && ((FluidLogging.SpectrumFluidFillable) blockState.getBlock()).canFillWithFluid(world,blockPos,blockState,thisObject.getFluid())) ? blockPos : blockPos3; + } + return newPos; + } + +} diff --git a/src/main/java/de/dafuqs/spectrum/mixin/accessors/BucketItemAccessor.java b/src/main/java/de/dafuqs/spectrum/mixin/accessors/BucketItemAccessor.java new file mode 100644 index 0000000000..84b63611df --- /dev/null +++ b/src/main/java/de/dafuqs/spectrum/mixin/accessors/BucketItemAccessor.java @@ -0,0 +1,20 @@ +package de.dafuqs.spectrum.mixin.accessors; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.fluid.Fluid; +import net.minecraft.item.BucketItem; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.WorldAccess; +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; +import org.spongepowered.asm.mixin.gen.Invoker; + +@Mixin(BucketItem.class) +public interface BucketItemAccessor { + @Invoker + void callPlayEmptyingSound(@Nullable PlayerEntity player, WorldAccess world, BlockPos pos); + + @Accessor + Fluid getFluid(); +} diff --git a/src/main/java/de/dafuqs/spectrum/registries/SpectrumBlocks.java b/src/main/java/de/dafuqs/spectrum/registries/SpectrumBlocks.java index 235d051619..6c95dfcff9 100644 --- a/src/main/java/de/dafuqs/spectrum/registries/SpectrumBlocks.java +++ b/src/main/java/de/dafuqs/spectrum/registries/SpectrumBlocks.java @@ -441,6 +441,8 @@ private static Settings decostone(AbstractBlock block) { public static final Block GLISTERING_MELON_STEM = new GlisteringStemBlock((GourdBlock) GLISTERING_MELON, () -> SpectrumItems.GLISTERING_MELON_SEEDS, FabricBlockSettings.copyOf(Blocks.MELON_STEM)); public static final Block ATTACHED_GLISTERING_MELON_STEM = new AttachedGlisteringStemBlock((GourdBlock) GLISTERING_MELON, () -> SpectrumItems.GLISTERING_MELON_SEEDS, FabricBlockSettings.copyOf(Blocks.ATTACHED_MELON_STEM)); + public static final Block DROOPLEAF = new DroopleafBlock(FabricBlockSettings.copyOf(BIG_DRIPLEAF)); + public static final Block DROOPLEAF_STEM = new DroopleafStemBlock(FabricBlockSettings.copyOf(BIG_DRIPLEAF_STEM)); public static final Block OMINOUS_SAPLING = new OminousSaplingBlock(FabricBlockSettings.copyOf(Blocks.OAK_SAPLING)); public static final Block PRESENT = new PresentBlock(FabricBlockSettings.copyOf(Blocks.WHITE_WOOL)); public static final Block TITRATION_BARREL = new TitrationBarrelBlock(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).mapColor(MapColor.RED)); @@ -1642,6 +1644,8 @@ public static void register() { registerBlock("deeper_down_portal", DEEPER_DOWN_PORTAL); registerBlock("glistering_melon_stem", GLISTERING_MELON_STEM); registerBlock("attached_glistering_melon_stem", ATTACHED_GLISTERING_MELON_STEM); + registerBlock("droopleaf", DROOPLEAF); + registerBlock("droopleaf_stem", DROOPLEAF_STEM); registerBlock("stuck_storm_stone", STUCK_STORM_STONE); registerBlock("wand_light", WAND_LIGHT_BLOCK); registerBlock("decaying_light", DECAYING_LIGHT_BLOCK); @@ -3025,6 +3029,8 @@ public static void registerClient() { BlockRenderLayerMap.INSTANCE.putBlock(SpectrumBlocks.GLISTERING_MELON_STEM, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(SpectrumBlocks.ATTACHED_GLISTERING_MELON_STEM, RenderLayer.getCutout()); + BlockRenderLayerMap.INSTANCE.putBlock(SpectrumBlocks.DROOPLEAF, RenderLayer.getCutout()); + BlockRenderLayerMap.INSTANCE.putBlock(SpectrumBlocks.DROOPLEAF_STEM, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(SpectrumBlocks.OMINOUS_SAPLING, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(SpectrumBlocks.ITEM_BOWL_BASALT, RenderLayer.getCutout()); diff --git a/src/main/java/de/dafuqs/spectrum/registries/SpectrumCompostableBlocks.java b/src/main/java/de/dafuqs/spectrum/registries/SpectrumCompostableBlocks.java index 1c4d06d0f3..e21228d374 100644 --- a/src/main/java/de/dafuqs/spectrum/registries/SpectrumCompostableBlocks.java +++ b/src/main/java/de/dafuqs/spectrum/registries/SpectrumCompostableBlocks.java @@ -24,6 +24,7 @@ public static void register() { CompostingChanceRegistry.INSTANCE.add(SpectrumBlocks.FOUR_LEAF_CLOVER, MEDIUM); CompostingChanceRegistry.INSTANCE.add(SpectrumBlocks.BRISTLE_SPROUTS, MEDIUM); CompostingChanceRegistry.INSTANCE.add(SpectrumBlocks.SNAPPING_IVY, HIGHER); + CompostingChanceRegistry.INSTANCE.add(SpectrumItems.DROOPLEAF, HIGHER); CompostingChanceRegistry.INSTANCE.add(SpectrumItems.HIBERNATING_JADE_VINE_BULB, HIGH); CompostingChanceRegistry.INSTANCE.add(SpectrumItems.GERMINATED_JADE_VINE_BULB, HIGH); diff --git a/src/main/java/de/dafuqs/spectrum/registries/SpectrumFlammableBlocks.java b/src/main/java/de/dafuqs/spectrum/registries/SpectrumFlammableBlocks.java index 933d738699..1221391f41 100644 --- a/src/main/java/de/dafuqs/spectrum/registries/SpectrumFlammableBlocks.java +++ b/src/main/java/de/dafuqs/spectrum/registries/SpectrumFlammableBlocks.java @@ -26,15 +26,18 @@ public static void register() { FlammableBlockRegistry.getDefaultInstance().add(ColoredStrippedLogBlock.byColor(dyeColor), 5, 20); FlammableBlockRegistry.getDefaultInstance().add(ColoredStrippedWoodBlock.byColor(dyeColor), 5, 20); } - - FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.VEGETAL_BLOCK, 30, 60); - + + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.VEGETAL_BLOCK,30,60); + + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.DROOPLEAF, 60, 100); + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.DROOPLEAF_STEM, 60, 100); + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.SWEET_PEA, 60, 100); FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.APRICOTTI, 60, 100); FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.HUMMING_BELL, 60, 100); FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.BLOOD_ORCHID, 60, 100); FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.RESONANT_LILY, 60, 100); - + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.NEPHRITE_BLOSSOM_STEM, 5, 5); FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.NEPHRITE_BLOSSOM_LEAVES, 30, 60); FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.JADE_VINES, 5, 5); @@ -44,10 +47,10 @@ public static void register() { FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.JADE_VINE_PETAL_CARPET, 60, 20); FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.JADEITE_PETAL_BLOCK, 30, 60); FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.JADEITE_PETAL_CARPET, 60, 20); - - FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.NIGHTDEW, 15, 60); - FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.ABYSSAL_VINES, 15, 60); - + + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.NIGHTDEW,15,60); + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.ABYSSAL_VINES,15,60); + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.SLATE_NOXCAP_STEM, 5, 5); FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.STRIPPED_SLATE_NOXCAP_STEM, 5, 5); FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.SLATE_NOXCAP_HYPHAE, 5, 5); @@ -105,21 +108,24 @@ public static void register() { FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.CHESTNUT_NOXWOOD_BEAM, 5, 20); FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.CHESTNUT_NOXWOOD_LIGHT, 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_LOG, 2, 2); - FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_LEAVES, 10, 20); - FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_PLANKS, 2, 8); - FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_SLAB, 2, 8); - FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_FENCE, 2, 8); - FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_FENCE_GATE, 2, 8); - FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_STAIRS, 2, 8); - FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.STRIPPED_WEEPING_GALA_LOG, 2, 8); - FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.STRIPPED_WEEPING_GALA_WOOD, 2, 8); - FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_PILLAR, 2, 8); - FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_LIGHT, 2, 8); - FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_LAMP, 2, 8); - + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_LOG, 5, 5); + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_LEAVES, 30, 60); + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_PLANKS, 5, 20); + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_SLAB, 5, 20); + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_FENCE, 5, 20); + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_FENCE_GATE, 5, 20); + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_STAIRS, 5, 20); + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.STRIPPED_WEEPING_GALA_LOG, 5, 20); + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.STRIPPED_WEEPING_GALA_WOOD, 5, 20); + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_PILLAR, 5, 20); + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_LIGHT, 5, 20); + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.WEEPING_GALA_LAMP, 5, 20); + + FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.MOSS_BALL, 30, 60); FlammableBlockRegistry.getDefaultInstance().add(SpectrumBlocks.GIANT_MOSS_BALL, 30, 60); + + // Gala wood is intentionally non-flammable } } diff --git a/src/main/java/de/dafuqs/spectrum/registries/SpectrumItemGroups.java b/src/main/java/de/dafuqs/spectrum/registries/SpectrumItemGroups.java index ae2b70450b..39bd18cb0a 100644 --- a/src/main/java/de/dafuqs/spectrum/registries/SpectrumItemGroups.java +++ b/src/main/java/de/dafuqs/spectrum/registries/SpectrumItemGroups.java @@ -10,7 +10,7 @@ import de.dafuqs.spectrum.blocks.mob_head.*; import de.dafuqs.spectrum.compat.*; import de.dafuqs.spectrum.compat.ae2.*; -import de.dafuqs.spectrum.compat.create.*; +import de.dafuqs.spectrum.compat.create.CreateCompat; import de.dafuqs.spectrum.compat.gobber.*; import de.dafuqs.spectrum.helpers.*; import de.dafuqs.spectrum.items.food.beverages.*; @@ -257,6 +257,7 @@ public static void register() { entries.add(SpectrumBlocks.PARTICLE_SPAWNER); entries.add(SpectrumBlocks.GLISTERING_MELON); + entries.add(SpectrumItems.DROOPLEAF); entries.add(SpectrumBlocks.LAVA_SPONGE); entries.add(SpectrumBlocks.WET_LAVA_SPONGE); entries.add(SpectrumBlocks.ETHEREAL_PLATFORM); diff --git a/src/main/java/de/dafuqs/spectrum/registries/SpectrumItems.java b/src/main/java/de/dafuqs/spectrum/registries/SpectrumItems.java index 6033313979..c46b010e6e 100644 --- a/src/main/java/de/dafuqs/spectrum/registries/SpectrumItems.java +++ b/src/main/java/de/dafuqs/spectrum/registries/SpectrumItems.java @@ -362,6 +362,7 @@ public Map getDefaultEnchantments() { public static final Item GLISTERING_MELON_SEEDS = new AliasedBlockItem(SpectrumBlocks.GLISTERING_MELON_STEM, IS.of()); public static final Item AMARANTH_GRAINS = new AliasedBlockItem(SpectrumBlocks.AMARANTH, IS.of()); + public static final Item DROOPLEAF = new DroopleafItem(SpectrumBlocks.DROOPLEAF, IS.of()); public static final Item MELOCHITES_COOKBOOK_VOL_1 = new CookbookItem(IS.of().maxCount(1).rarity(Rarity.UNCOMMON), "cuisine/cookbooks/melochites_cookbook_vol_1"); public static final Item MELOCHITES_COOKBOOK_VOL_2 = new CookbookItem(IS.of().maxCount(1).rarity(Rarity.UNCOMMON), "cuisine/cookbooks/melochites_cookbook_vol_2"); @@ -678,6 +679,7 @@ public static void registerResources() { register("glistering_melon_seeds", GLISTERING_MELON_SEEDS, DyeColor.LIME); register("amaranth_grains", AMARANTH_GRAINS, DyeColor.LIME); + register("droopleaf", DROOPLEAF, DyeColor.LIME); register("vegetal", VEGETAL, DyeColor.LIME); register("neolith", NEOLITH, DyeColor.PINK); diff --git a/src/main/resources/assets/spectrum/blockstates/droopleaf.json b/src/main/resources/assets/spectrum/blockstates/droopleaf.json new file mode 100644 index 0000000000..db2f18c5aa --- /dev/null +++ b/src/main/resources/assets/spectrum/blockstates/droopleaf.json @@ -0,0 +1,124 @@ +{ + "variants": { + "facing=east,unstable=false,short=false,muddy=false": { + "model": "spectrum:block/droopleaf", + "y": 90 + }, + "facing=east,unstable=false,short=true,muddy=false": { + "model": "spectrum:block/droopleaf_short", + "y": 90 + }, + "facing=east,unstable=true,short=false,muddy=false": { + "model": "spectrum:block/droopleaf", + "y": 90 + }, + "facing=east,unstable=true,short=true,muddy=false": { + "model": "spectrum:block/droopleaf_short", + "y": 90 + }, + "facing=north,unstable=false,short=false,muddy=false": { + "model": "spectrum:block/droopleaf" + }, + "facing=north,unstable=false,short=true,muddy=false": { + "model": "spectrum:block/droopleaf_short" + }, + "facing=north,unstable=true,short=false,muddy=false": { + "model": "spectrum:block/droopleaf" + }, + "facing=north,unstable=true,short=true,muddy=false": { + "model": "spectrum:block/droopleaf_short" + }, + "facing=south,unstable=false,short=false,muddy=false": { + "model": "spectrum:block/droopleaf", + "y": 180 + }, + "facing=south,unstable=false,short=true,muddy=false": { + "model": "spectrum:block/droopleaf_short", + "y": 180 + }, + "facing=south,unstable=true,short=false,muddy=false": { + "model": "spectrum:block/droopleaf", + "y": 180 + }, + "facing=south,unstable=true,short=true,muddy=false": { + "model": "spectrum:block/droopleaf_short", + "y": 180 + }, + "facing=west,unstable=false,short=false,muddy=false": { + "model": "spectrum:block/droopleaf", + "y": 270 + }, + "facing=west,unstable=false,short=true,muddy=false": { + "model": "spectrum:block/droopleaf_short", + "y": 270 + }, + "facing=west,unstable=true,short=false,muddy=false": { + "model": "spectrum:block/droopleaf", + "y": 270 + }, + "facing=west,unstable=true,short=true,muddy=false": { + "model": "spectrum:block/droopleaf_short", + "y": 270 + }, + "facing=east,unstable=false,short=false,muddy=true": { + "model": "spectrum:block/droopleaf", + "y": 90 + }, + "facing=east,unstable=false,short=true,muddy=true": { + "model": "spectrum:block/droopleaf_short", + "y": 90 + }, + "facing=east,unstable=true,short=false,muddy=true": { + "model": "spectrum:block/droopleaf", + "y": 90 + }, + "facing=east,unstable=true,short=true,muddy=true": { + "model": "spectrum:block/droopleaf_short", + "y": 90 + }, + "facing=north,unstable=false,short=false,muddy=true": { + "model": "spectrum:block/droopleaf" + }, + "facing=north,unstable=false,short=true,muddy=true": { + "model": "spectrum:block/droopleaf_short" + }, + "facing=north,unstable=true,short=false,muddy=true": { + "model": "spectrum:block/droopleaf" + }, + "facing=north,unstable=true,short=true,muddy=true": { + "model": "spectrum:block/droopleaf_short" + }, + "facing=south,unstable=false,short=false,muddy=true": { + "model": "spectrum:block/droopleaf", + "y": 180 + }, + "facing=south,unstable=false,short=true,muddy=true": { + "model": "spectrum:block/droopleaf_short", + "y": 180 + }, + "facing=south,unstable=true,short=false,muddy=true": { + "model": "spectrum:block/droopleaf", + "y": 180 + }, + "facing=south,unstable=true,short=true,muddy=true": { + "model": "spectrum:block/droopleaf_short", + "y": 180 + }, + "facing=west,unstable=false,short=false,muddy=true": { + "model": "spectrum:block/droopleaf", + "y": 270 + }, + "facing=west,unstable=false,short=true,muddy=true": { + "model": "spectrum:block/droopleaf_short", + "y": 270 + }, + "facing=west,unstable=true,short=false,muddy=true": { + "model": "spectrum:block/droopleaf", + "y": 270 + }, + "facing=west,unstable=true,short=true,muddy=true": { + "model": "spectrum:block/droopleaf_short", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/spectrum/blockstates/droopleaf_stem.json b/src/main/resources/assets/spectrum/blockstates/droopleaf_stem.json new file mode 100644 index 0000000000..04bcd54a08 --- /dev/null +++ b/src/main/resources/assets/spectrum/blockstates/droopleaf_stem.json @@ -0,0 +1,19 @@ +{ + "variants": { + "facing=east": { + "model": "spectrum:block/droopleaf_stem", + "y": 90 + }, + "facing=north": { + "model": "spectrum:block/droopleaf_stem" + }, + "facing=south": { + "model": "spectrum:block/droopleaf_stem", + "y": 180 + }, + "facing=west": { + "model": "spectrum:block/droopleaf_stem", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/spectrum/lang/de_de.json b/src/main/resources/assets/spectrum/lang/de_de.json index 371f8b33c7..38e378f55c 100644 --- a/src/main/resources/assets/spectrum/lang/de_de.json +++ b/src/main/resources/assets/spectrum/lang/de_de.json @@ -528,6 +528,9 @@ "block.spectrum.glistering_melon_stem": "Glänzender Melonenstiel", "block.spectrum.attached_glistering_melon_stem": "Glänzender Melonenstiel", + "block.spectrum.droopleaf": "Knopfblatt", + "block.spectrum.droopleaf_stem": "Knopfblattstiel", + "block.spectrum.spectral_shard_block": "Spektralsplitter Block", "block.spectrum.small_citrine_bud": "Kleiner Citrin Bud", "block.spectrum.medium_citrine_bud": "Mittlerer Citrin Bud", diff --git a/src/main/resources/assets/spectrum/lang/en_us.json b/src/main/resources/assets/spectrum/lang/en_us.json index 98d1d7d257..891ee59f56 100644 --- a/src/main/resources/assets/spectrum/lang/en_us.json +++ b/src/main/resources/assets/spectrum/lang/en_us.json @@ -1162,6 +1162,8 @@ "block.spectrum.downstone": "Downstone", "block.spectrum.dragonbone": "Dragonbone", "block.spectrum.dragonrot": "Dragonrot", + "block.spectrum.droopleaf": "Droopleaf", + "block.spectrum.droopleaf_stem": "Droopleaf Stem", "block.spectrum.drowned_head": "Drowned Head", "block.spectrum.ebony_noxcap_block": "Ebony Noxcap Block", "block.spectrum.ebony_noxcap_gills": "Ebony Noxcap Gills", @@ -2527,6 +2529,10 @@ "book.spectrum.guidebook.dragonrot_swamp.page3.text": "It's not dirt, it's not mud, it's... something - I don't know what. In any case, I sink in a little when I step on it.", "book.spectrum.guidebook.dreamflayer.page0.text": "A truly exceptional weapon, it embodies the definition of \"offense is the best defense.\"\\\nIt is in the nature of the Dreamflayer to balance forces:\\\nThe more armored my opponent is compared to me, the more damage it will deal.[#]()\\\n\\\nSneak-Use to empower it, allowing it to slice through even the strongest armor while consuming [#](8f2121)Red Ink[#]() at an alarming rate.", "book.spectrum.guidebook.dreamflayer.page1.text": "Requires a full moon night.\\\n\\\n*If I ever needed a reason to go on a rampage lightly clad, here it is.*", + "book.spectrum.guidebook.droopleaf.page0.text": "Dripleaves may be fun to jump across, but they're just too *frail* at times. While pondering this, I was struck with a thought: they remind me of pressure plates! With this in mind, I tried infusing them with redstone, but that resulted in a useless, saggy leaf.\\\nA touch of [Vegetal](entry://general/vegetal) did the trick though, and resulted in quite the intriguing plant.", + "book.spectrum.guidebook.droopleaf.page1.text": "What immediately struck me was the raw [#](eded00)energy[#]() coursing from the leaf, constantly emitting redstone from its front and top.\\\n\\\nLike a dripleaf, anything touching the leaf causes it to fall... but instead of merely tilting, this one keeps on going **down**, making for a gentle trip to the root. With nothing atop, the leaf will slowly climb its way back up. Fertilizer helps it climb faster, but sadly like [my other attempt](entry://cuisine/glistering_melons), will not produce more Droopleaves.", + "book.spectrum.guidebook.droopleaf.page2.text": "*Droopy looks in a cave\\\nNo one is there\\\nDroopy looks under a tree\\\nDroopy is enormous.*", + "book.spectrum.guidebook.droopleaf.page3.text": "As it turns out, much like myself, this plant finds it hard to move when drenched in [mud](entry://magical_blocks/mud). Covering the roots of a Droopleaf vine in this viscous, sticky fluid completely stops the leaf in its tracks: no amount of pushing and shoving will make it move. It still emits redstone just the same, though.", "book.spectrum.guidebook.effect_prolonging.name": "Effect Prolonging (Stacking)", "book.spectrum.guidebook.effect_prolonging.page0.text": "When I get other status effects, while this is active, they last longer.", "book.spectrum.guidebook.effect_prolonging.page1.text": "Instead, when I get a level of Effect Prolonging, additional levels are stacked on top of existing levels, increasing the potency of the effect rather than resetting it's duration.", diff --git a/src/main/resources/assets/spectrum/lang/pt_br.json b/src/main/resources/assets/spectrum/lang/pt_br.json index 0081966192..16b4c05f6a 100644 --- a/src/main/resources/assets/spectrum/lang/pt_br.json +++ b/src/main/resources/assets/spectrum/lang/pt_br.json @@ -674,6 +674,9 @@ "block.spectrum.glistering_melon_stem": "Caule de Melancia Reluzente", "block.spectrum.attached_glistering_melon_stem": "Caule de Melancia Reluzente", + "block.spectrum.droopleaf": "Plantagota", + "block.spectrum.droopleaf_stem": "Caule de Plantagota", + "block.spectrum.spectral_shard_block": "Bloco de Fragmento Espectral", "block.spectrum.small_citrine_bud": "Cristal de Citrino Pequeno", "block.spectrum.medium_citrine_bud": "Cristal de Citrino Médio", diff --git a/src/main/resources/assets/spectrum/lang/ru_ru.json b/src/main/resources/assets/spectrum/lang/ru_ru.json index 56aa9a0dd2..df9adb6523 100644 --- a/src/main/resources/assets/spectrum/lang/ru_ru.json +++ b/src/main/resources/assets/spectrum/lang/ru_ru.json @@ -1337,6 +1337,8 @@ "block.spectrum.glistering_melon": "Сверкающий Арбуз", "block.spectrum.glistering_melon_stem": "Стебель Сверкающего Арбуза", "block.spectrum.attached_glistering_melon_stem": "Стебель Сверкающего Арбуза", + "block.spectrum.droopleaf": "Droopleaf", + "block.spectrum.droopleaf_stem": "Стебель Droopleaf", "block.spectrum.spectral_shard_block": "Блок Спектральных Осколков", "block.spectrum.small_citrine_bud": "Малый Цитриновый Бутон", "block.spectrum.medium_citrine_bud": "Средний Цитриновый Бутон", diff --git a/src/main/resources/assets/spectrum/models/block/droopleaf.json b/src/main/resources/assets/spectrum/models/block/droopleaf.json new file mode 100644 index 0000000000..1b20c825a4 --- /dev/null +++ b/src/main/resources/assets/spectrum/models/block/droopleaf.json @@ -0,0 +1,62 @@ +{ + "parent": "block/block", + "textures": { + "top": "spectrum:block/droopleaf_top", + "stem": "spectrum:block/droopleaf_stem", + "side": "spectrum:block/droopleaf_side", + "tip": "spectrum:block/droopleaf_tip", + "particle": "spectrum:block/droopleaf_top" + }, + "elements": [ + { "from": [ 0, 15, 0 ], + "to": [ 16, 15, 16 ], + "shade": false, + "faces": { + "down": { "uv": [ 0, 16, 16, 0 ], "texture": "#top" }, + "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#top" } + } + }, + { "from": [ 0, 11, 0 ], + "to": [ 16, 15, 0.002 ], + "shade": false, + "faces": { + "north": { "uv": [ 0, 0, 16, 4 ], "texture": "#tip", "cullface": "north" }, + "south": { "uv": [ 16, 0, 0, 4 ], "texture": "#tip" } + } + }, + { "from": [ 0, 11, 0 ], + "to": [ 0.002, 15, 16 ], + "shade": false, + "faces": { + "east": { "uv": [ 16, 0, 0, 4 ], "texture": "#side" }, + "west": { "uv": [ 0, 0, 16, 4 ], "texture": "#side", "cullface": "west" } + } + }, + { "from": [ 15.998, 11, 0 ], + "to": [ 16, 15, 16 ], + "shade": false, + "faces": { + "east": { "uv": [ 16, 0, 0, 4 ], "texture": "#side", "cullface": "east" }, + "west": { "uv": [ 0, 0, 16, 4 ], "texture": "#side" } + } + }, + { "from": [ 5, 0, 12 ], + "to": [ 11, 16, 12 ], + "rotation": { "origin": [ 8, 8, 12 ], "axis": "y", "angle": 45, "rescale": true }, + "shade": false, + "faces": { + "north": { "uv": [ 3, 0, 14, 16 ], "texture": "#stem" }, + "south": { "uv": [ 3, 0, 14, 16 ], "texture": "#stem" } + } + }, + { "from": [ 5, 0, 12 ], + "to": [ 11, 16, 12 ], + "rotation": { "origin": [ 8, 8, 12 ], "axis": "y", "angle": -45, "rescale": true }, + "shade": false, + "faces": { + "north": { "uv": [ 3, 0, 14, 16 ], "texture": "#stem" }, + "south": { "uv": [ 3, 0, 14, 16 ], "texture": "#stem" } + } + } + ] +} diff --git a/src/main/resources/assets/spectrum/models/block/droopleaf_short.json b/src/main/resources/assets/spectrum/models/block/droopleaf_short.json new file mode 100644 index 0000000000..69096f49f8 --- /dev/null +++ b/src/main/resources/assets/spectrum/models/block/droopleaf_short.json @@ -0,0 +1,62 @@ +{ + "parent": "block/block", + "textures": { + "top": "spectrum:block/droopleaf_top", + "stem": "spectrum:block/droopleaf_stem", + "side": "spectrum:block/droopleaf_side", + "tip": "spectrum:block/droopleaf_tip", + "particle": "spectrum:block/droopleaf_top" + }, + "elements": [ + { "from": [ 0, 7, 0 ], + "to": [ 16, 7, 16 ], + "shade": false, + "faces": { + "down": { "uv": [ 0, 16, 16, 0 ], "texture": "#top" }, + "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#top" } + } + }, + { "from": [ 0, 3, 0 ], + "to": [ 16, 7, 0.002 ], + "shade": false, + "faces": { + "north": { "uv": [ 0, 0, 16, 4 ], "texture": "#tip", "cullface": "north" }, + "south": { "uv": [ 16, 0, 0, 4 ], "texture": "#tip" } + } + }, + { "from": [ 0, 3, 0 ], + "to": [ 0.002, 7, 16 ], + "shade": false, + "faces": { + "east": { "uv": [ 16, 0, 0, 4 ], "texture": "#side" }, + "west": { "uv": [ 0, 0, 16, 4 ], "texture": "#side", "cullface": "west" } + } + }, + { "from": [ 15.998, 3, 0 ], + "to": [ 16, 7, 16 ], + "shade": false, + "faces": { + "east": { "uv": [ 16, 0, 0, 4 ], "texture": "#side", "cullface": "east" }, + "west": { "uv": [ 0, 0, 16, 4 ], "texture": "#side" } + } + }, + { "from": [ 5, 0, 12 ], + "to": [ 11, 16, 12 ], + "rotation": { "origin": [ 8, 8, 12 ], "axis": "y", "angle": 45, "rescale": true }, + "shade": false, + "faces": { + "north": { "uv": [ 3, 0, 14, 16 ], "texture": "#stem" }, + "south": { "uv": [ 3, 0, 14, 16 ], "texture": "#stem" } + } + }, + { "from": [ 5, 0, 12 ], + "to": [ 11, 16, 12 ], + "rotation": { "origin": [ 8, 8, 12 ], "axis": "y", "angle": -45, "rescale": true }, + "shade": false, + "faces": { + "north": { "uv": [ 3, 0, 14, 16 ], "texture": "#stem" }, + "south": { "uv": [ 3, 0, 14, 16 ], "texture": "#stem" } + } + } + ] +} diff --git a/src/main/resources/assets/spectrum/models/block/droopleaf_stem.json b/src/main/resources/assets/spectrum/models/block/droopleaf_stem.json new file mode 100644 index 0000000000..30b71d77fa --- /dev/null +++ b/src/main/resources/assets/spectrum/models/block/droopleaf_stem.json @@ -0,0 +1,27 @@ +{ + "parent": "block/block", + "textures": { + "stem": "spectrum:block/droopleaf_stem", + "particle": "spectrum:block/droopleaf_stem" + }, + "elements": [ + { "from": [ 5, 0, 12 ], + "to": [ 11, 16, 12 ], + "rotation": { "origin": [ 8, 8, 12 ], "axis": "y", "angle": 45, "rescale": true }, + "shade": false, + "faces": { + "north": { "uv": [ 3, 0, 14, 16 ], "texture": "#stem" }, + "south": { "uv": [ 3, 0, 14, 16 ], "texture": "#stem" } + } + }, + { "from": [ 5, 0, 12 ], + "to": [ 11, 16, 12 ], + "rotation": { "origin": [ 8, 8, 12 ], "axis": "y", "angle": -45, "rescale": true }, + "shade": false, + "faces": { + "north": { "uv": [ 3, 0, 14, 16 ], "texture": "#stem" }, + "south": { "uv": [ 3, 0, 14, 16 ], "texture": "#stem" } + } + } + ] +} diff --git a/src/main/resources/assets/spectrum/models/item/droopleaf.json b/src/main/resources/assets/spectrum/models/item/droopleaf.json new file mode 100644 index 0000000000..663672fba4 --- /dev/null +++ b/src/main/resources/assets/spectrum/models/item/droopleaf.json @@ -0,0 +1,3 @@ +{ + "parent": "spectrum:block/droopleaf" +} \ No newline at end of file diff --git a/src/main/resources/assets/spectrum/textures/block/droopleaf_side.png b/src/main/resources/assets/spectrum/textures/block/droopleaf_side.png new file mode 100644 index 0000000000..270ab9f1f4 Binary files /dev/null and b/src/main/resources/assets/spectrum/textures/block/droopleaf_side.png differ diff --git a/src/main/resources/assets/spectrum/textures/block/droopleaf_stem.png b/src/main/resources/assets/spectrum/textures/block/droopleaf_stem.png new file mode 100644 index 0000000000..6ef93a44bf Binary files /dev/null and b/src/main/resources/assets/spectrum/textures/block/droopleaf_stem.png differ diff --git a/src/main/resources/assets/spectrum/textures/block/droopleaf_tip.png b/src/main/resources/assets/spectrum/textures/block/droopleaf_tip.png new file mode 100644 index 0000000000..883b6a1d18 Binary files /dev/null and b/src/main/resources/assets/spectrum/textures/block/droopleaf_tip.png differ diff --git a/src/main/resources/assets/spectrum/textures/block/droopleaf_top.png b/src/main/resources/assets/spectrum/textures/block/droopleaf_top.png new file mode 100644 index 0000000000..271c4f19a3 Binary files /dev/null and b/src/main/resources/assets/spectrum/textures/block/droopleaf_top.png differ diff --git a/src/main/resources/data/minecraft/tags/blocks/frog_prefer_jump_to.json b/src/main/resources/data/minecraft/tags/blocks/frog_prefer_jump_to.json new file mode 100644 index 0000000000..778c23350a --- /dev/null +++ b/src/main/resources/data/minecraft/tags/blocks/frog_prefer_jump_to.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "spectrum:droopleaf" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/mineable/axe.json b/src/main/resources/data/minecraft/tags/blocks/mineable/axe.json index 95bfe6ba17..1dbca06327 100644 --- a/src/main/resources/data/minecraft/tags/blocks/mineable/axe.json +++ b/src/main/resources/data/minecraft/tags/blocks/mineable/axe.json @@ -19,6 +19,8 @@ "spectrum:clover", "spectrum:glistering_melon_stem", "spectrum:attached_glistering_melon_stem", + "spectrum:droopleaf", + "spectrum:droopleaf_stem", "spectrum:bottomless_bundle", "spectrum:amaranth", "spectrum:amaranth_bushel", diff --git a/src/main/resources/data/minecraft/tags/blocks/sword_efficient.json b/src/main/resources/data/minecraft/tags/blocks/sword_efficient.json index a486725e85..5ca1acc887 100644 --- a/src/main/resources/data/minecraft/tags/blocks/sword_efficient.json +++ b/src/main/resources/data/minecraft/tags/blocks/sword_efficient.json @@ -6,6 +6,8 @@ "spectrum:jadeite_lotus_flower", "spectrum:abyssal_vines", "spectrum:weeping_gala_fronds", - "spectrum:weeping_gala_fronds_plant" + "spectrum:weeping_gala_fronds_plant", + "spectrum:droopleaf", + "spectrum:droopleaf_stem" ] } \ No newline at end of file diff --git a/src/main/resources/data/spectrum/loot_tables/blocks/droopleaf.json b/src/main/resources/data/spectrum/loot_tables/blocks/droopleaf.json new file mode 100644 index 0000000000..50ed03ddcc --- /dev/null +++ b/src/main/resources/data/spectrum/loot_tables/blocks/droopleaf.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "spectrum:droopleaf" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "spectrum:blocks/droopleaf" +} \ No newline at end of file diff --git a/src/main/resources/data/spectrum/loot_tables/blocks/droopleaf_stem.json b/src/main/resources/data/spectrum/loot_tables/blocks/droopleaf_stem.json new file mode 100644 index 0000000000..2839297ad3 --- /dev/null +++ b/src/main/resources/data/spectrum/loot_tables/blocks/droopleaf_stem.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "spectrum:droopleaf" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "spectrum:blocks/droopleaf_stem" +} \ No newline at end of file diff --git a/src/main/resources/data/spectrum/modonomicon/books/guidebook/entries/magical_blocks/droopleaf.json b/src/main/resources/data/spectrum/modonomicon/books/guidebook/entries/magical_blocks/droopleaf.json new file mode 100644 index 0000000000..9c930d39d6 --- /dev/null +++ b/src/main/resources/data/spectrum/modonomicon/books/guidebook/entries/magical_blocks/droopleaf.json @@ -0,0 +1,47 @@ +{ + "name": "block.spectrum.droopleaf", + "condition": { + "type": "modonomicon:advancement", + "advancement_id": "spectrum:collect_vegetal" + }, + "icon": "spectrum:droopleaf", + "category": "spectrum:magical_blocks", + "hide_while_locked": true, + "parents": [], + "background_u_index": 0, + "background_v_index": 0, + "x": 5, + "y": 3, + "pages": [ + { + "type": "modonomicon:spotlight", + "title": "block.spectrum.droopleaf", + "item": { + "item": "spectrum:droopleaf" + }, + "text": "book.spectrum.guidebook.droopleaf.page0.text" + }, + { + "type": "modonomicon:text", + "text": "book.spectrum.guidebook.droopleaf.page1.text" + }, + { + "type": "spectrum:pedestal_crafting", + "text": "book.spectrum.guidebook.droopleaf.page2.text", + "title": "container.spectrum.rei.pedestal_recipe", + "recipe_id": "spectrum:pedestal/tier1/droopleaf" + }, + { + "type": "modonomicon:spotlight", + "title": "block.spectrum.mud", + "item": { + "item": "spectrum:mud_bucket" + }, + "condition": { + "type": "modonomicon:advancement", + "advancement_id": "spectrum:unlocks/blocks/mud" + }, + "text": "book.spectrum.guidebook.droopleaf.page3.text" + } + ] +} diff --git a/src/main/resources/data/spectrum/recipes/pedestal/tier1/droopleaf.json b/src/main/resources/data/spectrum/recipes/pedestal/tier1/droopleaf.json new file mode 100644 index 0000000000..ededd75c6b --- /dev/null +++ b/src/main/resources/data/spectrum/recipes/pedestal/tier1/droopleaf.json @@ -0,0 +1,32 @@ +{ + "type": "spectrum:pedestal", + "time":100, + "tier": "basic", + "magenta": 0, + "yellow": 4, + "cyan": 0, + "black": 0, + "white": 0, + "experience": 1, + "pattern": [ + "VGV", + "GMG", + "VGV" + ], + "key": { + "G": { + "item": "minecraft:big_dripleaf" + }, + "M": { + "item": "minecraft:redstone_block" + }, + "V": { + "item": "spectrum:vegetal" + } + }, + "result": { + "item": "spectrum:droopleaf", + "count": 4 + }, + "required_advancement": "spectrum:collect_vegetal" +} \ No newline at end of file diff --git a/src/main/resources/spectrum.mixins.json b/src/main/resources/spectrum.mixins.json index b4b6260079..f82272ae4c 100644 --- a/src/main/resources/spectrum.mixins.json +++ b/src/main/resources/spectrum.mixins.json @@ -16,6 +16,7 @@ "BlockMixin", "BrainMixin", "BrewingRecipeRegistryMixin", + "BucketItemMixin", "CatEntityMixin", "ChunkNoiseSamplerMixin", "CropAndStemBlockMixin", @@ -84,6 +85,7 @@ "WitherEntityMixin", "WorldMixin", "accessors.BiomeAccessor", + "accessors.BucketItemAccessor", "accessors.DensityCapAccessor", "accessors.ExplosionAccessor", "accessors.FluidBlockAccessor",