-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
edd9f47
commit 06c06d3
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
src/main/java/com/mmodding/mmodding_lib/library/blocks/CustomWallTorchBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |