Skip to content

Commit

Permalink
Add CustomWallTorchBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
FirstMegaGame4 committed Feb 8, 2025
1 parent edd9f47 commit 06c06d3
Showing 1 changed file with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.mmodding.mmodding_lib.library.blocks;

import net.minecraft.block.WallTorchBlock;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.particle.ParticleEffect;
import org.quiltmc.qsl.item.setting.api.QuiltItemSettings;

import java.util.concurrent.atomic.AtomicBoolean;

public class CustomWallTorchBlock extends WallTorchBlock implements BlockRegistrable, BlockWithItem {

private final AtomicBoolean registered = new AtomicBoolean(false);

private BlockItem item = null;

public CustomWallTorchBlock(Settings settings, ParticleEffect particle) {
this(settings, particle, false);
}

public CustomWallTorchBlock(Settings settings, ParticleEffect particle, boolean hasItem) {
this(settings, particle, hasItem, (ItemGroup) null);
}

public CustomWallTorchBlock(Settings settings, ParticleEffect particle, boolean hasItem, ItemGroup itemGroup) {
this(settings, particle, hasItem, itemGroup != null ? new QuiltItemSettings().group(itemGroup) : new QuiltItemSettings());
}

public CustomWallTorchBlock(Settings settings, ParticleEffect particle, boolean hasItem, Item.Settings itemSettings) {
super(settings, particle);
if (hasItem) this.item = new BlockItem(this, itemSettings);
}

@Override
public BlockItem getItem() {
return this.item;
}

@Override
public boolean isNotRegistered() {
return !this.registered.get();
}

@Override
public void setRegistered() {
this.registered.set(true);
}
}

0 comments on commit 06c06d3

Please sign in to comment.