This commit is contained in:
modmuss50 2019-09-15 13:30:05 +01:00
parent cc51e9b016
commit ab15533351
2 changed files with 9 additions and 12 deletions

View file

@ -24,11 +24,8 @@
package techreborn.blocks.lighting; package techreborn.blocks.lighting;
import net.minecraft.block.Block; import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.BlockRenderLayer; import net.minecraft.block.*;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
@ -59,14 +56,13 @@ public class BlockLamp extends BaseBlockEntityProvider {
protected final VoxelShape[] shape; protected final VoxelShape[] shape;
private int cost; private int cost;
private int brightness; private static int brightness = 15;
public BlockLamp(int brightness, int cost, double depth, double width) { public BlockLamp(int cost, double depth, double width) {
super(Block.Settings.of(Material.REDSTONE_LAMP).strength(2f, 2f)); super(FabricBlockSettings.of(Material.REDSTONE_LAMP).strength(2f, 2f).lightLevel(brightness).build());
this.setDefaultState(this.stateFactory.getDefaultState().with(FACING, Direction.NORTH).with(ACTIVE, false));
this.shape = GenCuboidShapes(depth, width); this.shape = GenCuboidShapes(depth, width);
this.cost = cost; this.cost = cost;
this.brightness = brightness; this.setDefaultState(this.stateFactory.getDefaultState().with(FACING, Direction.NORTH).with(ACTIVE, false));
BlockWrenchEventHandler.wrenableBlocks.add(this); BlockWrenchEventHandler.wrenableBlocks.add(this);
} }
@ -135,6 +131,7 @@ public class BlockLamp extends BaseBlockEntityProvider {
return state.get(ACTIVE) ? brightness : 0; return state.get(ACTIVE) ? brightness : 0;
} }
@Override @Override
public BlockRenderLayer getRenderLayer() { public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;

View file

@ -444,8 +444,8 @@ public class TRContent {
ALARM(new BlockAlarm()), ALARM(new BlockAlarm()),
CHUNK_LOADER(new GenericMachineBlock(EGui.CHUNK_LOADER, ChunkLoaderBlockEntity::new)), CHUNK_LOADER(new GenericMachineBlock(EGui.CHUNK_LOADER, ChunkLoaderBlockEntity::new)),
LAMP_INCANDESCENT(new BlockLamp(14, 4, 10, 8)), LAMP_INCANDESCENT(new BlockLamp(4, 10, 8)),
LAMP_LED(new BlockLamp(15, 1, 1, 12)), LAMP_LED(new BlockLamp(1, 1, 12)),
PLAYER_DETECTOR(new BlockPlayerDetector()); PLAYER_DETECTOR(new BlockPlayerDetector());
public final String name; public final String name;