added curio registration
This commit is contained in:
parent
81955929d0
commit
fa5306fd9e
7 changed files with 51 additions and 18 deletions
|
|
@ -2,6 +2,7 @@ package com.skdevstudios.util_rings.init;
|
||||||
|
|
||||||
import com.skdevstudios.util_rings.UtilRings;
|
import com.skdevstudios.util_rings.UtilRings;
|
||||||
import com.skdevstudios.util_rings.items.GrowthRing;
|
import com.skdevstudios.util_rings.items.GrowthRing;
|
||||||
|
import com.skdevstudios.util_rings.items.IronRing;
|
||||||
import com.skdevstudios.util_rings.items.MagnetRing;
|
import com.skdevstudios.util_rings.items.MagnetRing;
|
||||||
import com.skdevstudios.util_rings.items.VolcanicGlassRing;
|
import com.skdevstudios.util_rings.items.VolcanicGlassRing;
|
||||||
|
|
||||||
|
|
@ -15,7 +16,7 @@ public class ItemsInit {
|
||||||
// Create a Deferred Register to hold Items which will all be registered under the "examplemod" namespace
|
// Create a Deferred Register to hold Items which will all be registered under the "examplemod" namespace
|
||||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, UtilRings.MODID);
|
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, UtilRings.MODID);
|
||||||
|
|
||||||
public static final RegistryObject<Item> IRON_RING = ITEMS.register("iron_ring", () -> new Item(new Item.Properties().stacksTo(1)));
|
public static final RegistryObject<Item> IRON_RING = ITEMS.register("iron_ring", () -> new IronRing());
|
||||||
public static final RegistryObject<Item> IRON_RING_LEFT = ITEMS.register("iron_ring_left", () -> new Item(new Item.Properties().stacksTo(1)));
|
public static final RegistryObject<Item> IRON_RING_LEFT = ITEMS.register("iron_ring_left", () -> new Item(new Item.Properties().stacksTo(1)));
|
||||||
public static final RegistryObject<Item> IRON_RING_TOP = ITEMS.register("iron_ring_top", () -> new Item(new Item.Properties().stacksTo(1)));
|
public static final RegistryObject<Item> IRON_RING_TOP = ITEMS.register("iron_ring_top", () -> new Item(new Item.Properties().stacksTo(1)));
|
||||||
public static final RegistryObject<Item> IRON_RING_BOTTOM = ITEMS.register("iron_ring_bottom", () -> new Item(new Item.Properties().stacksTo(1)));
|
public static final RegistryObject<Item> IRON_RING_BOTTOM = ITEMS.register("iron_ring_bottom", () -> new Item(new Item.Properties().stacksTo(1)));
|
||||||
|
|
@ -38,9 +39,9 @@ public class ItemsInit {
|
||||||
public static final RegistryObject<Item> SOLDER_SPOOL = ITEMS.register("solder_spool", () -> new Item(new Item.Properties().stacksTo(1)));
|
public static final RegistryObject<Item> SOLDER_SPOOL = ITEMS.register("solder_spool", () -> new Item(new Item.Properties().stacksTo(1)));
|
||||||
public static final RegistryObject<Item> SOLDER_WIRE = ITEMS.register("solder_wire", () -> new Item(new Item.Properties().stacksTo(64)));
|
public static final RegistryObject<Item> SOLDER_WIRE = ITEMS.register("solder_wire", () -> new Item(new Item.Properties().stacksTo(64)));
|
||||||
public static final RegistryObject<Item> IRON_PLATE = ITEMS.register("iron_plate", () -> new Item(new Item.Properties().stacksTo(64)));
|
public static final RegistryObject<Item> IRON_PLATE = ITEMS.register("iron_plate", () -> new Item(new Item.Properties().stacksTo(64)));
|
||||||
public static final RegistryObject<Item> VOLCANIC_GLASS_RING = ITEMS.register("volcanic_glass_ring", () -> new VolcanicGlassRing(new Item.Properties().stacksTo(1)));
|
public static final RegistryObject<Item> VOLCANIC_GLASS_RING = ITEMS.register("volcanic_glass_ring", () -> new VolcanicGlassRing());
|
||||||
public static final RegistryObject<Item> MAGNET_RING = ITEMS.register("magnet_ring", () -> new MagnetRing(new Item.Properties().stacksTo(1)));
|
public static final RegistryObject<Item> MAGNET_RING = ITEMS.register("magnet_ring", () -> new MagnetRing());
|
||||||
public static final RegistryObject<Item> GROWTH_RING = ITEMS.register("growth_ring", () -> new GrowthRing(new Item.Properties().stacksTo(1)));
|
public static final RegistryObject<Item> GROWTH_RING = ITEMS.register("growth_ring", () -> new GrowthRing());
|
||||||
public static final RegistryObject<BlockItem> LEAD_ORE_ITEM = ITEMS.register("lead_ore", () -> new BlockItem(BlockInit.LEAD_ORE.get(), new Item.Properties()));
|
public static final RegistryObject<BlockItem> LEAD_ORE_ITEM = ITEMS.register("lead_ore", () -> new BlockItem(BlockInit.LEAD_ORE.get(), new Item.Properties()));
|
||||||
public static final RegistryObject<BlockItem> TIN_ORE_ITEM = ITEMS.register("tin_ore", () -> new BlockItem(BlockInit.TIN_ORE.get(), new Item.Properties()));
|
public static final RegistryObject<BlockItem> TIN_ORE_ITEM = ITEMS.register("tin_ore", () -> new BlockItem(BlockInit.TIN_ORE.get(), new Item.Properties()));
|
||||||
public static final RegistryObject<BlockItem> PINE_LOG_ITEM = ITEMS.register("pine_log", () -> new BlockItem(BlockInit.PINE_LOG.get(), new Item.Properties()));
|
public static final RegistryObject<BlockItem> PINE_LOG_ITEM = ITEMS.register("pine_log", () -> new BlockItem(BlockInit.PINE_LOG.get(), new Item.Properties()));
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ import top.theillusivec4.curios.api.SlotContext;
|
||||||
import top.theillusivec4.curios.api.type.capability.ICurioItem;
|
import top.theillusivec4.curios.api.type.capability.ICurioItem;
|
||||||
|
|
||||||
public class GrowthRing extends Item implements ICurioItem {
|
public class GrowthRing extends Item implements ICurioItem {
|
||||||
public GrowthRing(Item.Properties properties) {
|
public GrowthRing() {
|
||||||
super(properties);
|
super(new Item.Properties().stacksTo(1).defaultDurability(0));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void curioTick(SlotContext slotContext, ItemStack stack) {
|
public void curioTick(SlotContext slotContext, ItemStack stack) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.skdevstudios.util_rings.items;
|
||||||
|
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import top.theillusivec4.curios.api.SlotContext;
|
||||||
|
import top.theillusivec4.curios.api.type.capability.ICurioItem;
|
||||||
|
|
||||||
|
public class IronRing extends Item implements ICurioItem{
|
||||||
|
public IronRing() {
|
||||||
|
super(new Item.Properties().stacksTo(1).defaultDurability(0));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void curioTick(SlotContext slotContext, ItemStack stack) {
|
||||||
|
//TODO: add bling effect
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,8 +6,8 @@ import top.theillusivec4.curios.api.SlotContext;
|
||||||
import top.theillusivec4.curios.api.type.capability.ICurioItem;
|
import top.theillusivec4.curios.api.type.capability.ICurioItem;
|
||||||
|
|
||||||
public class MagnetRing extends Item implements ICurioItem {
|
public class MagnetRing extends Item implements ICurioItem {
|
||||||
public MagnetRing(Item.Properties properties) {
|
public MagnetRing() {
|
||||||
super(properties);
|
super(new Item.Properties().stacksTo(1).defaultDurability(0));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void curioTick(SlotContext slotContext, ItemStack stack) {
|
public void curioTick(SlotContext slotContext, ItemStack stack) {
|
||||||
|
|
|
||||||
|
|
@ -14,29 +14,36 @@ import top.theillusivec4.curios.api.SlotContext;
|
||||||
import top.theillusivec4.curios.api.type.capability.ICurioItem;
|
import top.theillusivec4.curios.api.type.capability.ICurioItem;
|
||||||
|
|
||||||
public class VolcanicGlassRing extends Item implements ICurioItem {
|
public class VolcanicGlassRing extends Item implements ICurioItem {
|
||||||
public VolcanicGlassRing(Item.Properties properties) {
|
|
||||||
super(properties);
|
public VolcanicGlassRing() {
|
||||||
|
super(new Item.Properties().stacksTo(1).defaultDurability(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Replace with util_rings:hot_obsidian->minecraft:obsidian
|
||||||
@Override
|
@Override
|
||||||
public InteractionResult useOn(UseOnContext context) {
|
public InteractionResult useOn(UseOnContext context) {
|
||||||
Level world = context.getLevel();
|
Level world = context.getLevel();
|
||||||
BlockPos pos = context.getClickedPos().relative(context.getClickedFace());
|
BlockPos pos = context.getClickedPos().relative(context.getClickedFace());
|
||||||
|
|
||||||
BlockState targetState = world.getBlockState(pos);
|
BlockState targetState = world.getBlockState(pos);
|
||||||
|
|
||||||
if (targetState.isAir() && !world.isClientSide()) {
|
if (targetState.isAir() && !world.isClientSide()) {
|
||||||
// Check if the target block is air and place obsidian
|
BlockState obsidian = Blocks.OBSIDIAN.defaultBlockState(); // Check if the target block is air
|
||||||
BlockState obsidian = Blocks.OBSIDIAN.defaultBlockState();
|
world.setBlockAndUpdate(pos, obsidian); // if it is air replace it with obisidian
|
||||||
world.setBlockAndUpdate(pos, obsidian);
|
world.playSound(
|
||||||
|
null,
|
||||||
// Play a sound effect at the placed block position
|
pos,
|
||||||
world.playSound(null, pos, SoundEvents.STONE_PLACE, SoundSource.BLOCKS, 1.0F, 1.0F);
|
SoundEvents.STONE_PLACE,
|
||||||
|
SoundSource.BLOCKS,
|
||||||
|
1.0F,
|
||||||
|
1.0F
|
||||||
|
); // Play a sound effect at the placed block position
|
||||||
|
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return InteractionResult.FAIL;
|
return InteractionResult.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void curioTick(SlotContext slotContext, ItemStack stack) {
|
public void curioTick(SlotContext slotContext, ItemStack stack) {
|
||||||
//TODO: Add Ticking Logic to check for lava within 1 block of player
|
//TODO: Add Ticking Logic to check for lava within 1 block of player
|
||||||
|
|
|
||||||
9
src/main/resources/data/curios/tags/items/ring.json
Normal file
9
src/main/resources/data/curios/tags/items/ring.json
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
"util_rings:volcanic_glass_ring",
|
||||||
|
"util_rings:magnet_ring",
|
||||||
|
"util_rings:growth_ring",
|
||||||
|
"util_rings:iron_ring"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"result": {
|
"result": {
|
||||||
"item": "minecraft:stone"
|
"item": "util_rings:jewelers_hammer"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in a new issue