Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
There's a Yin to every Yang
Browse files Browse the repository at this point in the history
  • Loading branch information
kckarnige committed Aug 21, 2024
1 parent 59d2e0c commit 48590f2
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 55 deletions.
33 changes: 33 additions & 0 deletions src/main/java/com/kckarnige/oye/item/AntiCatalyst.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.kckarnige.oye.item;

import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;

public class AntiCatalyst extends Item {

public AntiCatalyst(Settings settings) {
super(settings);
}

@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
if (!world.isClient()) {
world.playSound(null, player.getBlockPos(), SoundEvents.ENTITY_PLAYER_BREATH, SoundCategory.VOICE);
player.addStatusEffect(new StatusEffectInstance(StatusEffects.STRENGTH, 120, 2, false, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.SPEED, 120, 3, false, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 120, 3, false, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.RESISTANCE, 120, 2, false, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.SATURATION, 120, 2, false, false, false));
}
return TypedActionResult.consume(ItemStack.EMPTY);
}

}
51 changes: 12 additions & 39 deletions src/main/java/com/kckarnige/oye/item/EndCatalyst.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
package com.kckarnige.oye.item;

import com.kckarnige.oye.oye;
import net.minecraft.block.WitherRoseBlock;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;

import java.util.Objects;

public class EndCatalyst extends Item {

public EndCatalyst(Settings settings) {
Expand All @@ -27,47 +22,25 @@ public EndCatalyst(Settings settings) {
@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
if (!world.isClient()) {
player.equipStack(EquipmentSlot.HEAD, getDefaultStack());
world.playSound(null, player.getBlockPos(), SoundEvents.BLOCK_ENCHANTMENT_TABLE_USE, SoundCategory.BLOCKS);
world.playSound(null, player.getBlockPos(), SoundEvents.BLOCK_ENCHANTMENT_TABLE_USE, SoundCategory.PLAYERS);
player.addStatusEffect(new StatusEffectInstance(StatusEffects.DARKNESS, 100, 3, false, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.BLINDNESS, 100, 3, false, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.WEAKNESS, 100, 1, false, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 100, 2, false, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.WITHER, 100, 1, false, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.INSTANT_DAMAGE, 20, 3, false, false, false));
}
return TypedActionResult.success(ItemStack.EMPTY);
return TypedActionResult.consume(ItemStack.EMPTY);
}

public void inventoryTick(ItemStack nullStack, World world, Entity entity, int slot, boolean selected) {
if (!world.isClient()) {
if (entity instanceof PlayerEntity player) {
if (player.getEquippedStack(EquipmentSlot.HEAD).isOf(ModItems.VOID_MATTER)) {
if (String.valueOf(player.getEquippedStack(EquipmentSlot.OFFHAND)).contains("minecraft:wither_rose")||
String.valueOf(player.getEquippedStack(EquipmentSlot.MAINHAND)).contains("minecraft:wither_rose")) {
player.addStatusEffect(new StatusEffectInstance(StatusEffects.STRENGTH, 30, 2, true, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.SPEED, 30, 3, true, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 30, 3, true, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.RESISTANCE, 30, 2, true, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.SATURATION, 30, 2, true, false, false));
player.removeStatusEffect(StatusEffects.DARKNESS);
player.removeStatusEffect(StatusEffects.BLINDNESS);
player.removeStatusEffect(StatusEffects.WEAKNESS);
player.removeStatusEffect(StatusEffects.SLOWNESS);
player.removeStatusEffect(StatusEffects.WITHER);
player.removeStatusEffect(StatusEffects.HUNGER);
} else {
player.addStatusEffect(new StatusEffectInstance(StatusEffects.DARKNESS, 100, 3, false, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.BLINDNESS, 100, 3, false, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.WEAKNESS, 30, 1, false, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 30, 2, false, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.WITHER, 100, 2, false, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.HUNGER, 100, 1, false, false, false));
world.addParticle(ParticleTypes.HEART, player.getX(), player.getY(), player.getZ(), 0.0, 0.0, 0.0);
}
}
else if (player.getEquippedStack(EquipmentSlot.OFFHAND).isOf(ModItems.VOID_MATTER)
if (player.getEquippedStack(EquipmentSlot.OFFHAND).isOf(ModItems.VOID_MATTER)
|| player.getEquippedStack(EquipmentSlot.HEAD).isOf(ModItems.VOID_MATTER)
|| player.getInventory().main.stream().anyMatch(stack -> stack.isOf(ModItems.VOID_MATTER))) {
if (String.valueOf(player.getEquippedStack(EquipmentSlot.OFFHAND)).contains("minecraft:wither_rose")
|| player.getInventory().main.stream().anyMatch(stack -> String.valueOf(stack).contains("minecraft:wither_rose"))) {}
else {
player.addStatusEffect(new StatusEffectInstance(StatusEffects.WITHER, 100, 1, false, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.HUNGER, 100, 1, false, false, false));
}
player.addStatusEffect(new StatusEffectInstance(StatusEffects.WITHER, 100, 1, false, false, false));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.HUNGER, 100, 1, false, false, false));
}
}
}
Expand Down
13 changes: 0 additions & 13 deletions src/main/java/com/kckarnige/oye/item/ItsInYourHead.java

This file was deleted.

4 changes: 3 additions & 1 deletion src/main/java/com/kckarnige/oye/item/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@

public class ModItems {

public static final Item VOID_MATTER = registerItem("end_matter", new EndCatalyst(new Item.Settings().equipmentSlot(new ItsInYourHead()).maxCount(1).rarity(Rarity.EPIC)));
public static final Item VOID_MATTER = registerItem("end_matter", new EndCatalyst(new Item.Settings().maxCount(1)));
public static final Item ANTIV_MATTER = registerItem("anti_end_matter", new AntiCatalyst(new Item.Settings().maxCount(1).rarity(Rarity.EPIC)));

private static void addItemToItemGroup(FabricItemGroupEntries entries) {
entries.add(VOID_MATTER);
entries.add(ANTIV_MATTER);
}

private static Item registerItem (String name, Item item) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/assets/openyoureye/lang/en_gb.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"item.openyoureye.end_matter": "End Catalyst"
"item.openyoureye.end_matter": "End Catalyst",
"item.openyoureye.anti_end_matter": "Soul of the End"
}
3 changes: 2 additions & 1 deletion src/main/resources/assets/openyoureye/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"item.openyoureye.end_matter": "End Catalyst"
"item.openyoureye.end_matter": "End Catalyst",
"item.openyoureye.anti_end_matter": "Breath of Life"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"parent": "item/generated",
"textures": {
"layer0": "openyoureye:item/anti_end_matter"
},
"display": {
"head": {
"translation": [0, -0.5, -7]
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_nether_star": {
"conditions": {
"items": [
{
"items": "minecraft:dragon_breath"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "openyoureye:anti_end_matter"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_nether_star"
]
],
"rewards": {
"recipes": [
"openyoureye:anti_end_matter"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_nether_star": {
"conditions": {
"items": [
{
"items": "minecraft:nether_star"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "openyoureye:end_matter"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_nether_star"
]
],
"rewards": {
"recipes": [
"openyoureye:end_matter"
]
}
}
19 changes: 19 additions & 0 deletions src/main/resources/data/openyoureye/recipe/anti_end_matter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": [
{
"item": "minecraft:wither_rose"
},
{
"item": "openyoureye:end_matter"
},
{
"item": "minecraft:dragon_breath"
}
],
"result": {
"id": "openyoureye:anti_end_matter",
"count": 1
}
}

0 comments on commit 48590f2

Please sign in to comment.