mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 16:06:48 +01:00
Implement IHaveColorHandler on WindowInABlockBlock
https://discordapp.com/channels/620934202875183104/689866656914210897/700713829407129620
This commit is contained in:
parent
1378418593
commit
485e6c529d
1 changed files with 17 additions and 1 deletions
|
@ -4,6 +4,7 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.foundation.block.IHaveColorHandler;
|
||||
import com.simibubi.create.foundation.block.IHaveCustomBlockModel;
|
||||
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
|
||||
import com.simibubi.create.foundation.block.ITE;
|
||||
|
@ -15,6 +16,8 @@ import net.minecraft.block.FourWayBlock;
|
|||
import net.minecraft.block.PaneBlock;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.material.MaterialColor;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
@ -47,7 +50,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
|||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class WindowInABlockBlock extends PaneBlock
|
||||
implements ITE<WindowInABlockTileEntity>, IHaveNoBlockItem, IHaveCustomBlockModel {
|
||||
implements ITE<WindowInABlockTileEntity>, IHaveNoBlockItem, IHaveCustomBlockModel, IHaveColorHandler {
|
||||
|
||||
public WindowInABlockBlock() {
|
||||
super(Properties.create(Material.ROCK));
|
||||
|
@ -210,6 +213,7 @@ public class WindowInABlockBlock extends PaneBlock
|
|||
return Blocks.AIR.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) {
|
||||
return false;
|
||||
|
@ -226,4 +230,16 @@ public class WindowInABlockBlock extends PaneBlock
|
|||
return WindowInABlockTileEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public IBlockColor getColorHandler() {
|
||||
return (state, world, pos, index) -> {
|
||||
try {
|
||||
BlockState surrounding = getSurroundingBlockState(world, pos);
|
||||
return Minecraft.getInstance().getBlockColors().getColor(surrounding, world, pos, index);
|
||||
} catch (Exception e) {}
|
||||
return -1;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue