Create/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/EncasedBlock.java
Cyvack c907454be9
Overhaul to how encasing blocks works (#4458)
* Make Encasing utilize Interfaces

* Add Javadoc to IEncasable and IEncased interfaces

* Fix Weird block.block issues (No clue where those came from)

* Final Touch ups for now and made requirement for casing normal Block instead of CasingBlock

* Make requested changes

* Add more parameters for tryEncasing, for use in handleEncasing
Move handleEncasing to Encased Interface for more flexability

* Simplify and organize

- Rename:
  - Encasable -> EncasableBlock
  - Encased -> EncasedBlock
  - EncasableRegistry -> EncasingRegistry
- Remove EncasedBlock#setCasing
- Remove encasedBlock argument from EncasedBlock#handleEncasing
- Add Registrate builder transformer to EncasingRegistry for easy use

---------

Co-authored-by: PepperCode1 <44146161+PepperCode1@users.noreply.github.com>
2023-02-22 13:09:11 -08:00

24 lines
902 B
Java

package com.simibubi.create.content.contraptions.relays.elementary;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
/**
* Implement this interface to indicate that this block is encased.
*/
public interface EncasedBlock {
Block getCasing();
/**
* Handles how encasing should be done if {@link EncasableBlock#tryEncase(BlockState, Level, BlockPos, ItemStack, Player, InteractionHand, BlockHitResult)} is successful.
*/
default void handleEncasing(BlockState state, Level level, BlockPos pos, ItemStack heldItem, Player player, InteractionHand hand, BlockHitResult ray) {
}
}