Skip to content

Commit

Permalink
[2.0] Add DaylightDetector block entity (#1337) (#1345)
Browse files Browse the repository at this point in the history
* Add DaylightDetector block entity

* Removed saveAdditionalData()

Co-authored-by: CiviledCode <[email protected]>
  • Loading branch information
CiviledCode and CiviledCode authored Apr 17, 2020
1 parent 4bce2d1 commit b5573b9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cn.nukkit.blockentity.impl;

import cn.nukkit.block.BlockIds;
import cn.nukkit.blockentity.BlockEntityType;
import cn.nukkit.blockentity.DaylightDetector;
import cn.nukkit.level.chunk.Chunk;
import cn.nukkit.utils.Identifier;
import com.nukkitx.math.vector.Vector3i;

public class DaylightDetectorBlockEntity extends BaseBlockEntity implements DaylightDetector {


public DaylightDetectorBlockEntity(BlockEntityType<?> type, Chunk chunk, Vector3i position) {
super(type, chunk, position);
}

@Override
public boolean isValid() {
Identifier blockId = getBlock().getId();
return blockId == BlockIds.DAYLIGHT_DETECTOR || blockId == BlockIds.DAYLIGHT_DETECTOR_INVERTED;
}

}
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/registry/BlockEntityRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private void registerVanillaEntities() {
registerVanilla(SKULL, SkullBlockEntity::new, "Skull");
registerVanilla(FLOWER_POT, FlowerPotBlockEntity::new, "FlowerPot");
registerVanilla(BREWING_STAND, BrewingStandBlockEntity::new, "BrewingStand");
//registerVanilla(DAYLIGHT_DETECTOR, DaylightDetectorBlockEntity::new, "DaylightDetector");
registerVanilla(DAYLIGHT_DETECTOR, DaylightDetectorBlockEntity::new, "DaylightDetector");
registerVanilla(NOTEBLOCK, MusicBlockEntity::new, "Music");
registerVanilla(ITEM_FRAME, ItemFrameBlockEntity::new, "ItemFrame");
registerVanilla(CAULDRON, CauldronBlockEntity::new, "Cauldron");
Expand Down

0 comments on commit b5573b9

Please sign in to comment.