forked from cpw/ironchest
-
Notifications
You must be signed in to change notification settings - Fork 87
/
AbstractTrappedIronChestBlockEntity.java
30 lines (23 loc) · 1.24 KB
/
AbstractTrappedIronChestBlockEntity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.progwml6.ironchest.common.block.trapped.entity;
import com.progwml6.ironchest.common.block.IronChestsTypes;
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import java.util.function.Supplier;
public abstract class AbstractTrappedIronChestBlockEntity extends AbstractIronChestBlockEntity {
protected AbstractTrappedIronChestBlockEntity(BlockEntityType<?> blockEntityType, BlockPos blockPos, BlockState blockState, IronChestsTypes chestTypeIn, Supplier<Block> blockToUseIn) {
super(blockEntityType, blockPos, blockState, chestTypeIn, blockToUseIn);
}
@Override
protected void signalOpenCount(Level level, BlockPos blockPos, BlockState blockState, int previousCount, int newCount) {
super.signalOpenCount(level, blockPos, blockState, previousCount, newCount);
if (previousCount != newCount) {
Block block = blockState.getBlock();
level.updateNeighborsAt(blockPos, block);
level.updateNeighborsAt(blockPos.below(), block);
}
}
}