Skip to content

Commit 4ee7be7

Browse files
committed
changed recipe for exalter and its feature
1 parent 5852210 commit 4ee7be7

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

src/main/java/crystallized/modid/item/ModItems.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class ModItems {
1818
new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of(CrystallizedMod.MOD_ID, "raw_crystallized")))));
1919

2020
public static final Item EXALTER = registerItem("exalter", new ExalterItem(
21-
new Item.Settings().maxDamage(16).registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of(CrystallizedMod.MOD_ID, "exalter")))));
21+
new Item.Settings().maxDamage(8).registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of(CrystallizedMod.MOD_ID, "exalter")))));
2222

2323
public static final Item ENDO_INGOT = registerItem("endo_ingot", new Item(
2424
new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of(CrystallizedMod.MOD_ID, "endo_ingot")))));

src/main/java/crystallized/modid/item/custom/ExalterItem.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package crystallized.modid.item.custom;
22

33
import crystallized.modid.block.ModBlocks;
4+
import crystallized.modid.item.ModItems;
45
import net.minecraft.block.Block;
56
import net.minecraft.block.Blocks;
67
import net.minecraft.entity.EquipmentSlot;
@@ -30,21 +31,27 @@ public ActionResult useOnBlock(ItemUsageContext context) {
3031
World world = context.getWorld();
3132
Block clickBlock = world.getBlockState(context.getBlockPos()).getBlock();
3233

33-
if(EXALTER_MAP.containsKey(clickBlock)) {
34-
if(!world.isClient()) {
35-
world.setBlockState(context.getBlockPos(), EXALTER_MAP.get(clickBlock).getDefaultState());
36-
37-
34+
if (clickBlock == Blocks.NETHERITE_BLOCK) {
35+
if (!world.isClient()) {
36+
world.breakBlock(context.getBlockPos(), false);
37+
38+
Item itemToDrop = ModItems.ENDO_INGOT;
39+
world.spawnEntity(new net.minecraft.entity.ItemEntity(
40+
world,
41+
context.getBlockPos().getX() + 0.5,
42+
context.getBlockPos().getY() + 0.5,
43+
context.getBlockPos().getZ() + 0.5,
44+
new net.minecraft.item.ItemStack(itemToDrop)
45+
));
3846
context.getStack().damage(1, ((ServerWorld) world), ((ServerPlayerEntity) context.getPlayer()),
3947
item -> {
4048
assert context.getPlayer() != null;
4149
context.getPlayer().sendEquipmentBreakStatus(item, EquipmentSlot.MAINHAND);
4250
});
43-
44-
world.playSound(null, context.getBlockPos(), SoundEvents.BLOCK_BELL_USE, SoundCategory.BLOCKS);
51+
world.playSound(null, context.getBlockPos(), SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.BLOCKS);
4552
}
53+
return ActionResult.SUCCESS;
4654
}
47-
48-
return ActionResult.SUCCESS;
55+
return ActionResult.PASS;
4956
}
5057
}

src/main/resources/data/crystallized-mod/recipe/exalter.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
"X": "crystallized-mod:crystallized_ingot"
77
},
88
"pattern": [
9-
" X",
10-
" #",
11-
" #"
9+
"X",
10+
"#"
1211
],
1312
"result": {
1413
"count": 1,

0 commit comments

Comments
 (0)