Skip to content

Commit

Permalink
Merge pull request #157 from GrowthcraftCE/114-redo-getshape-method-f…
Browse files Browse the repository at this point in the history
…or-hops-crop

Fixed #114 Removed redundant rope block checking logic
  • Loading branch information
Alatyami authored Sep 6, 2024
2 parents fa441fe + a055e12 commit dec9854
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/main/java/growthcraft/cellar/block/HopsCropBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import growthcraft.core.block.RopeBlock;
import growthcraft.core.init.GrowthcraftTags;
import growthcraft.lib.block.GrowthcraftCropsRopeBlock;
import growthcraft.lib.utils.BlockStateUtils;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
Expand All @@ -29,10 +28,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.NotNull;

import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class HopsCropBlock extends GrowthcraftCropsRopeBlock {

Expand All @@ -55,16 +52,7 @@ public HopsCropBlock() {
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
VoxelShape ropeVoxel = super.getShape(state, worldIn, pos, context);

ArrayList<VoxelShape> voxelShapeArrayList = new ArrayList<VoxelShape>();
Map<String, BlockState> blockMap = BlockStateUtils.getSurroundingBlockState(worldIn, pos);

if (blockMap.get("north").is(GrowthcraftTags.Blocks.ROPE)) voxelShapeArrayList.add(NORTH_BOUNDING_BOX);
if (blockMap.get("east").is(GrowthcraftTags.Blocks.ROPE)) voxelShapeArrayList.add(EAST_BOUNDING_BOX);
if (blockMap.get("south").is(GrowthcraftTags.Blocks.ROPE)) voxelShapeArrayList.add(SOUTH_BOUNDING_BOX);
if (blockMap.get("west").is(GrowthcraftTags.Blocks.ROPE)) voxelShapeArrayList.add(WEST_BOUNDING_BOX);
if (blockMap.get("above").is(GrowthcraftTags.Blocks.ROPE)) voxelShapeArrayList.add(UP_BOUNDING_BOX);
if (blockMap.get("below").is(GrowthcraftTags.Blocks.ROPE)) voxelShapeArrayList.add(DOWN_BOUNDING_BOX);

ArrayList<VoxelShape> voxelShapeArrayList = new ArrayList<>();
voxelShapeArrayList.add(CUSTOM_SHAPE_BY_AGE[state.getValue(AGE)]);
voxelShapeArrayList.add(ropeVoxel);

Expand Down

0 comments on commit dec9854

Please sign in to comment.