Search in sources :

Example 1 with RecordItem

use of net.minecraft.world.item.RecordItem in project SpongeCommon by SpongePowered.

the class SpongeRegistryLoaders method musicDisc.

public static RegistryLoader<MusicDisc> musicDisc() {
    return RegistryLoader.of(l -> {
        l.add(MusicDiscs.BLOCKS, k -> new SpongeMusicDisc((RecordItem) Items.MUSIC_DISC_BLOCKS));
        l.add(MusicDiscs.CAT, k -> new SpongeMusicDisc((RecordItem) Items.MUSIC_DISC_CAT));
        l.add(MusicDiscs.CHIRP, k -> new SpongeMusicDisc((RecordItem) Items.MUSIC_DISC_CHIRP));
        l.add(MusicDiscs.FAR, k -> new SpongeMusicDisc((RecordItem) Items.MUSIC_DISC_FAR));
        l.add(MusicDiscs.MALL, k -> new SpongeMusicDisc((RecordItem) Items.MUSIC_DISC_MALL));
        l.add(MusicDiscs.MELLOHI, k -> new SpongeMusicDisc((RecordItem) Items.MUSIC_DISC_MELLOHI));
        l.add(MusicDiscs.MUSIC_DISC_11, k -> new SpongeMusicDisc((RecordItem) Items.MUSIC_DISC_11));
        l.add(MusicDiscs.MUSIC_DISC_13, k -> new SpongeMusicDisc((RecordItem) Items.MUSIC_DISC_13));
        l.add(MusicDiscs.PIGSTEP, k -> new SpongeMusicDisc((RecordItem) Items.MUSIC_DISC_PIGSTEP));
        l.add(MusicDiscs.STAL, k -> new SpongeMusicDisc((RecordItem) Items.MUSIC_DISC_STAL));
        l.add(MusicDiscs.STRAD, k -> new SpongeMusicDisc((RecordItem) Items.MUSIC_DISC_STRAD));
        l.add(MusicDiscs.WAIT, k -> new SpongeMusicDisc((RecordItem) Items.MUSIC_DISC_WAIT));
        l.add(MusicDiscs.WARD, k -> new SpongeMusicDisc((RecordItem) Items.MUSIC_DISC_WARD));
    });
}
Also used : SpongeMusicDisc(org.spongepowered.common.effect.record.SpongeMusicDisc) RecordItem(net.minecraft.world.item.RecordItem)

Example 2 with RecordItem

use of net.minecraft.world.item.RecordItem in project SpongeCommon by SpongePowered.

the class JukeboxBlockEntityMixin_API method insert.

@Override
public void insert(final ItemStack record) {
    final net.minecraft.world.item.ItemStack itemStack = ItemStackUtil.toNative(record);
    if (!(itemStack.getItem() instanceof RecordItem)) {
        return;
    }
    final BlockState block = this.level.getBlockState(this.shadow$getBlockPos());
    if (block.getBlock() == Blocks.JUKEBOX) {
        // Don't use BlockJukebox#insertRecord - it looses item data
        this.shadow$setRecord(itemStack);
        this.level.setBlock(this.shadow$getBlockPos(), block.setValue(JukeboxBlock.HAS_RECORD, true), Constants.BlockChangeFlags.NOTIFY_CLIENTS);
    }
}
Also used : BlockState(net.minecraft.world.level.block.state.BlockState) RecordItem(net.minecraft.world.item.RecordItem)

Aggregations

RecordItem (net.minecraft.world.item.RecordItem)2 BlockState (net.minecraft.world.level.block.state.BlockState)1 SpongeMusicDisc (org.spongepowered.common.effect.record.SpongeMusicDisc)1