forked from DaFuqs/Spectrum
-
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
Showing
28 changed files
with
167 additions
and
30 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/main/java/de/dafuqs/spectrum/blocks/PaintbrushTriggered.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,29 @@ | ||
package de.dafuqs.spectrum.blocks; | ||
|
||
import de.dafuqs.spectrum.items.magic_items.PaintBrushItem; | ||
import de.dafuqs.spectrum.registries.SpectrumSoundEvents; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.sound.SoundCategory; | ||
import net.minecraft.util.ActionResult; | ||
import net.minecraft.util.Hand; | ||
import net.minecraft.util.hit.BlockHitResult; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
|
||
public interface PaintbrushTriggered { | ||
|
||
default ActionResult checkAndDoPaintbrushTrigger(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { | ||
if(player.getStackInHand(hand).getItem() instanceof PaintBrushItem) { | ||
ActionResult actionResult = onPaintBrushTrigger(state, world, pos, player, hand, hit); | ||
if(actionResult.isAccepted()) { | ||
world.playSound(null, pos, SpectrumSoundEvents.ENCHANTER_DING, SoundCategory.PLAYERS, 1.0F, 1.0F); | ||
} | ||
return actionResult; | ||
} | ||
return ActionResult.PASS; | ||
} | ||
|
||
ActionResult onPaintBrushTrigger(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit); | ||
|
||
} |
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
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
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
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
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
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
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
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
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
32 changes: 32 additions & 0 deletions
32
src/main/java/de/dafuqs/spectrum/items/magic_items/PaintBrushItem.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,32 @@ | ||
package de.dafuqs.spectrum.items.magic_items; | ||
|
||
import de.dafuqs.spectrum.energy.color.InkColor; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NbtCompound; | ||
|
||
import java.util.Optional; | ||
|
||
public class PaintBrushItem extends Item { | ||
|
||
public static final String COLOR_NBT_STRING = "Color"; | ||
|
||
public PaintBrushItem(Settings settings) { | ||
super(settings); | ||
} | ||
|
||
static void setColor(ItemStack stack, InkColor color) { | ||
NbtCompound compound = stack.getOrCreateNbt(); | ||
compound.putString(COLOR_NBT_STRING, color.toString()); | ||
stack.setNbt(compound); | ||
} | ||
|
||
static Optional<InkColor> getColor(ItemStack stack) { | ||
NbtCompound compound = stack.getNbt(); | ||
if (compound != null && compound.contains(COLOR_NBT_STRING)) { | ||
return Optional.of(InkColor.of(compound.getString(COLOR_NBT_STRING))); | ||
} | ||
return Optional.empty(); | ||
} | ||
|
||
} |
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
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
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
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
5 changes: 5 additions & 0 deletions
5
src/main/resources/assets/spectrum/textures/block/citrine_cluster.png.mcmeta
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,5 @@ | ||
{ | ||
"shimmer": { | ||
"bloom": true | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/resources/assets/spectrum/textures/block/large_citrine_bud.png.mcmeta
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,5 @@ | ||
{ | ||
"shimmer": { | ||
"bloom": true | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/resources/assets/spectrum/textures/block/large_moonstone_bud.png.mcmeta
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,5 @@ | ||
{ | ||
"shimmer": { | ||
"bloom": true | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/resources/assets/spectrum/textures/block/large_onyx_bud.png.mcmeta
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,5 @@ | ||
{ | ||
"shimmer": { | ||
"bloom": true | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/resources/assets/spectrum/textures/block/large_topaz_bud.png.mcmeta
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,5 @@ | ||
{ | ||
"shimmer": { | ||
"bloom": true | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/resources/assets/spectrum/textures/block/moonstone_cluster.png.mcmeta
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,5 @@ | ||
{ | ||
"shimmer": { | ||
"bloom": true | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/resources/assets/spectrum/textures/block/onyx_cluster.png.mcmeta
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,5 @@ | ||
{ | ||
"shimmer": { | ||
"bloom": true | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/resources/assets/spectrum/textures/block/small_citrine_bud.png.mcmeta
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,5 @@ | ||
{ | ||
"shimmer": { | ||
"bloom": true | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/resources/assets/spectrum/textures/block/small_moonstone_bud.png.mcmeta
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,5 @@ | ||
{ | ||
"shimmer": { | ||
"bloom": true | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/resources/assets/spectrum/textures/block/small_onyx_bud.png.mcmeta
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,5 @@ | ||
{ | ||
"shimmer": { | ||
"bloom": true | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/resources/assets/spectrum/textures/block/small_topaz_bud.png.mcmeta
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,5 @@ | ||
{ | ||
"shimmer": { | ||
"bloom": true | ||
} | ||
} |
Oops, something went wrong.