Skip to content

Commit

Permalink
Changed how item settings are given
Browse files Browse the repository at this point in the history
  • Loading branch information
pluto7073 committed Feb 2, 2023
1 parent 65f9135 commit 6cd4461
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions src/main/java/ml/pluto7073/plutoscoffee/blocks/CoffeeCrop.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
import ml.pluto7073.plutoscoffee.registry.ModItems;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.*;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.CropBlock;
import net.minecraft.block.ShapeContext;
import net.minecraft.item.ItemConvertible;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.block.Block;

public class CoffeeCrop extends CropBlock {
private static final VoxelShape[] AGE_TO_SHAPE = new VoxelShape[]{Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D), Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 3.0D, 16.0D), Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 4.0D, 16.0D), Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 5.0D, 16.0D), Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 6.0D, 16.0D), Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 7.0D, 16.0D), Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D), Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 9.0D, 16.0D)};

public CoffeeCrop() {
super(Settings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP).nonOpaque());
public CoffeeCrop(Settings settings) {
super(settings);
}

@Environment(EnvType.CLIENT)
Expand All @@ -25,31 +25,22 @@ protected ItemConvertible getSeedsItem() {
}

public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return AGE_TO_SHAPE[(Integer)state.get(this.getAgeProperty())];
return AGE_TO_SHAPE[state.get(this.getAgeProperty())];
}

@Override
public boolean emitsRedstonePower(BlockState state) {
return true;
return false;
}

@Override
public boolean hasSidedTransparency(BlockState state) {
return true;
}

@Override
public int getStrongRedstonePower(BlockState state, BlockView world, BlockPos pos, Direction direction) {
return 15;
}

@Override
public int getOpacity(BlockState state, BlockView world, BlockPos pos) {
return 0;
}

@Override
public int getWeakRedstonePower(BlockState state, BlockView world, BlockPos pos, Direction direction) {
return 15;
}
}

0 comments on commit 6cd4461

Please sign in to comment.