Skip to content

Commit

Permalink
Fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed Jul 13, 2023
1 parent 0f59da6 commit e03b732
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ Items.LIGHT, new ResourceLocation("level")
}
final TwoByTwo twoByTwo = useItem.findValidPlacement(
worldRenderContext.world(),
useItem.getBlock().getStateForPlacement(blockPlaceContext),
useItem.getMultiblockBlock().getStateForPlacement(blockPlaceContext),
pos,
blockPlaceContext.getHorizontalDirection()
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.fusionflux.portalcubed.items;

import com.fusionflux.portalcubed.blocks.funnel.ExcursionFunnelEmitterBlock;
import com.fusionflux.portalcubed.blocks.funnel.TwoByTwoFacingMultiblockBlock;
import com.fusionflux.portalcubed.util.TwoByTwo;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
Expand Down Expand Up @@ -88,4 +89,10 @@ public static Direction getDownOf(Direction facing, Direction perspectiveFacing)
return Direction.DOWN;
return facing == Direction.DOWN ? perspectiveFacing.getOpposite() : perspectiveFacing;
}

@Override
@SuppressWarnings("unchecked")
public <T extends Block & TwoByTwoFacingMultiblockBlock> T getMultiblockBlock() {
return (T)getBlock();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.fusionflux.portalcubed.items;

import com.fusionflux.portalcubed.blocks.funnel.TwoByTwoFacingMultiblockBlock;
import com.fusionflux.portalcubed.util.TwoByTwo;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
Expand All @@ -9,7 +10,7 @@
import org.jetbrains.annotations.Nullable;

public interface MultiblockItem {
Block getBlock();
<T extends Block & TwoByTwoFacingMultiblockBlock> T getMultiblockBlock();

@Nullable
TwoByTwo findValidPlacement(Level level, BlockState state, BlockPos initial, Direction playerFacing);
Expand Down

0 comments on commit e03b732

Please sign in to comment.