Skip to content

Commit

Permalink
need boyfriend
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySemicolon committed Dec 10, 2023
1 parent c054895 commit 87ccc0a
Show file tree
Hide file tree
Showing 19 changed files with 131 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,26 @@
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.*;
import net.minecraft.world.item.*;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraftforge.event.*;
import team.lodestar.lodestone.registry.common.*;

public class HauntedEnchantment extends Enchantment {
public HauntedEnchantment() {
super(Rarity.UNCOMMON, EnchantmentRegistry.SCYTHE, new EquipmentSlot[]{EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND});
super(Rarity.UNCOMMON, EnchantmentRegistry.SCYTHE_OR_STAFF, new EquipmentSlot[]{EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND});
}

@Override
public void doPostAttack(LivingEntity user, Entity target, int level) {
if (target instanceof LivingEntity entity) {
if (entity.isAlive()) {
entity.invulnerableTime = 0;
entity.hurt(DamageTypeRegistry.create(user.level(), DamageTypeRegistry.VOODOO, user), level + 1);
public static void addMagicDamage(ItemAttributeModifierEvent event) {
if (event.getSlotType().equals(EquipmentSlot.MAINHAND)) {
ItemStack itemStack = event.getItemStack();
int enchantmentLevel = itemStack.getEnchantmentLevel(EnchantmentRegistry.HAUNTED.get());
if (enchantmentLevel > 0) {
event.addModifier(LodestoneAttributeRegistry.MAGIC_DAMAGE.get(),
new AttributeModifier(LodestoneAttributeRegistry.UUIDS.get(LodestoneAttributeRegistry.MAGIC_DAMAGE), "Weapon magic damage", enchantmentLevel, AttributeModifier.Operation.ADDITION));
}
}
super.doPostAttack(user, target, level);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.sammy.malum.common.enchantment;

import com.sammy.malum.registry.common.item.*;
import net.minecraft.world.entity.*;
import net.minecraft.world.item.enchantment.*;

public class ReplenishingEnchantment extends Enchantment {
public ReplenishingEnchantment() {
super(Rarity.UNCOMMON, EnchantmentRegistry.STAFF, new EquipmentSlot[]{EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND});
}

@Override
public int getMaxLevel() {
return 5;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,25 @@ public void tick() {
Vec3 nearestPosition = nearest.position().add(0, nearest.getBbHeight() / 2, 0);
Vec3 diff = nearestPosition.subtract(position());
double speed = motion.length();
final double length = diff.length();
if (length < 2f) {
Vec3 nextPosition = position().add(getDeltaMovement());
if (nearest.distanceToSqr(nextPosition) > nearest.distanceToSqr(position())) {
return;
}
Vec3 maybeTowards = nearestPosition.add(getDeltaMovement());
if (distanceToSqr(maybeTowards) < distanceToSqr(nearestPosition)) { //Homing should only happen if we're moving towards the target, which this checks relatively close enough
return;
}
Vec3 newmotion = diff.normalize().scale(speed);
Vec3 newMotion = diff.normalize().scale(speed);
final double dot = motion.normalize().dot(diff.normalize());
if (dot < 0.9f) {
return;
}
if (newmotion.length() == 0) {
newmotion = newmotion.add(0.01, 0, 0);
if (newMotion.length() == 0) {
newMotion = newMotion.add(0.01, 0, 0);
}
float angleScalar = (float) ((dot - 0.9f) * 10f);
float distanceScalar = (float) (0.2f + 1f - Math.min(25f, length) / 25f);
float distanceScalar = (float) (0.2f + 1f - Math.min(25f, diff.length()) / 25f);
float horizontalFactor = 0.4f * distanceScalar * angleScalar;
float verticalFactor = 0.6f * distanceScalar * angleScalar;
final double x = Mth.lerp(horizontalFactor, motion.x, newmotion.x);
final double y = Mth.lerp(verticalFactor, motion.y, newmotion.y);
final double z = Mth.lerp(horizontalFactor, motion.z, newmotion.z);
final double x = Mth.lerp(horizontalFactor, motion.x, newMotion.x);
final double y = Mth.lerp(verticalFactor, motion.y, newMotion.y);
final double z = Mth.lerp(horizontalFactor, motion.z, newMotion.z);
setDeltaMovement(new Vec3(x, y, z));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,4 @@ public CurioCurativeRing(Properties builder) {
public void pickupSpirit(LivingEntity collector, ItemStack stack, double arcaneResonance) {
collector.heal(collector.getMaxHealth() * 0.1f + (float) (arcaneResonance * 0.05f));
}

@Override
public void addAttributeModifiers(Multimap<Attribute, AttributeModifier> map, SlotContext slotContext, ItemStack stack) {
addAttributeModifier(map, Attributes.MAX_HEALTH, uuid -> new AttributeModifier(uuid,
"Curio Max Health", 4f, AttributeModifier.Operation.ADDITION));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.sammy.malum.common.item.curiosities.curios.soulward;

import com.google.common.collect.*;
import com.sammy.malum.common.capability.*;
import com.sammy.malum.common.item.curiosities.curios.*;
import com.sammy.malum.config.*;
import com.sammy.malum.core.handlers.*;
import com.sammy.malum.core.systems.item.*;
import com.sammy.malum.registry.common.*;
import net.minecraft.world.damagesource.*;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.ai.attributes.*;
import net.minecraft.world.entity.player.*;
import net.minecraft.world.item.*;
import net.minecraftforge.event.entity.living.*;
import team.lodestar.lodestone.registry.common.tag.*;
import top.theillusivec4.curios.api.*;

public class CurioLimitlessBelt extends MalumCurioItem implements IMalumEventResponderItem {

public CurioLimitlessBelt(Properties builder) {
super(builder, MalumTrinketType.VOID);
}

@Override
public float overrideSoulwardDamageAbsorbPercentage(LivingHurtEvent event, LivingEntity wardedEntity, ItemStack stack, float original) {
if (event.getSource().is(LodestoneDamageTypeTags.IS_MAGIC)) {
return CommonConfig.SOUL_WARD_MAGIC.getConfigValue().floatValue();
}
return IMalumEventResponderItem.super.overrideSoulwardDamageAbsorbPercentage(event, wardedEntity, stack, original);
}

@Override
public void addAttributeModifiers(Multimap<Attribute, AttributeModifier> map, SlotContext slotContext, ItemStack stack) {
addAttributeModifier(map, AttributeRegistry.SOUL_WARD_CAP.get(), uuid -> new AttributeModifier(uuid,
"Curio Soul Ward Capacity", 1f, AttributeModifier.Operation.MULTIPLY_TOTAL));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ public CurioMagebaneBelt(Properties builder) {
public void onSoulwardAbsorbDamage(LivingHurtEvent event, Player wardedPlayer, ItemStack stack, float soulwardLost, float damageAbsorbed) {
DamageSource source = event.getSource();
if (source.getEntity() != null) {
if (true) {
if (source.is(LodestoneDamageTypeTags.IS_MAGIC) && !source.is(DamageTypes.THORNS)) {
SoulWardHandler handler = MalumPlayerDataCapability.getCapability(wardedPlayer).soulWardHandler;
handler.soulWardProgress = 0;
}
if (source.is(LodestoneDamageTypeTags.IS_MAGIC) && !source.is(DamageTypes.THORNS)) {
SoulWardHandler handler = MalumPlayerDataCapability.getCapability(wardedPlayer).soulWardHandler;
handler.soulWardProgress = 0;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.sammy.malum.common.item.curiosities.curios.soulward;

import com.google.common.collect.*;
import com.sammy.malum.common.capability.*;
import com.sammy.malum.common.item.curiosities.curios.*;
import com.sammy.malum.core.handlers.*;
import com.sammy.malum.core.systems.item.*;
import com.sammy.malum.registry.common.*;
import net.minecraft.world.damagesource.*;
import net.minecraft.world.entity.ai.attributes.*;
import net.minecraft.world.entity.player.*;
import net.minecraft.world.item.*;
import net.minecraftforge.event.entity.living.*;
import team.lodestar.lodestone.registry.common.tag.*;
import top.theillusivec4.curios.api.*;

public class CurioReinforcementRing extends MalumCurioItem {

public CurioReinforcementRing(Properties builder) {
super(builder, MalumTrinketType.ORNATE);
}

@Override
public void addAttributeModifiers(Multimap<Attribute, AttributeModifier> map, SlotContext slotContext, ItemStack stack) {
addAttributeModifier(map, AttributeRegistry.SOUL_WARD_CAP.get(), uuid -> new AttributeModifier(uuid,
"Curio Soul Ward Capacity", 3f, AttributeModifier.Operation.ADDITION));
addAttributeModifier(map, AttributeRegistry.SOUL_WARD_STRENGTH.get(), uuid -> new AttributeModifier(uuid,
"Curio Soul Ward Strength", 1f, AttributeModifier.Operation.ADDITION));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public void spawnSweepParticles(Player player, SimpleParticleType type) {

public Vec3 getProjectileSpawnPos(LivingEntity player, InteractionHand hand, float distance, float spread) {
int angle = hand == InteractionHand.MAIN_HAND ? 225 : 90;
return player.position().add(player.getLookAngle().scale(distance)).add(spread * Math.sin(Math.toRadians(angle - player.yHeadRot)), player.getBbHeight() * 0.9f, spread * Math.cos(Math.toRadians(angle - player.yHeadRot)));
double radians = Math.toRadians(angle - player.yHeadRot);
return player.position().add(player.getLookAngle().scale(distance)).add(spread * Math.sin(radians), player.getBbHeight() * 0.9f, spread * Math.cos(radians));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class AuricFlameStaffItem extends AbstractStaffItem {
public static final ColorParticleData REVERSE_AURIC_COLOR_DATA = ColorParticleData.create(AURIC_BLUE, AURIC_YELLOW).setEasing(Easing.SINE_IN_OUT).setCoefficient(1.25f).build();

public AuricFlameStaffItem(Tier tier, float magicDamage, Properties builderIn) {
super(tier, 40, magicDamage, builderIn);
super(tier, 20, magicDamage, builderIn);
}

@OnlyIn(Dist.CLIENT)
Expand Down Expand Up @@ -71,7 +71,7 @@ public void fireProjectile(LivingEntity player, ItemStack stack, Level level, In
final float ceil = (float) Math.ceil(count / 2f);
float spread = count > 0 ? ceil * 0.2f * (count % 2L == 0 ? 1 : -1) : 0f;
float pitchOffset = 6f - (3f + ceil);
int spawnDelay = (int) (ceil * 2);
int spawnDelay = (int) (ceil * 4);
float velocity = 2f;
float magicDamage = (float) player.getAttributes().getValue(LodestoneAttributeRegistry.MAGIC_DAMAGE.get());
Vec3 pos = getProjectileSpawnPos(player, hand, 0.5f, 0.5f);
Expand Down
11 changes: 7 additions & 4 deletions src/main/java/com/sammy/malum/core/events/RuntimeEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.sammy.malum.common.effect.GluttonyEffect;
import com.sammy.malum.common.effect.InfernalAura;
import com.sammy.malum.common.effect.WickedIntentEffect;
import com.sammy.malum.common.enchantment.ReboundEnchantment;
import com.sammy.malum.common.enchantment.*;
import com.sammy.malum.common.entity.nitrate.EthericExplosion;
import com.sammy.malum.common.item.cosmetic.curios.CurioTokenOfGratitude;
import com.sammy.malum.common.item.curiosities.curios.alchemical.CurioAlchemicalRing;
Expand All @@ -30,9 +30,7 @@
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraftforge.event.AddReloadListenerEvent;
import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.*;
import net.minecraftforge.event.entity.EntityJoinLevelEvent;
import net.minecraftforge.event.entity.item.ItemExpireEvent;
import net.minecraftforge.event.entity.living.*;
Expand Down Expand Up @@ -148,6 +146,11 @@ public static void onRightClickItem(PlayerInteractEvent.RightClickItem event) {
ReboundEnchantment.onRightClickItem(event);
}

@SubscribeEvent
public static void addItemAttributes(ItemAttributeModifierEvent event) {
HauntedEnchantment.addMagicDamage(event);
}

@SubscribeEvent
public static void isPotionApplicable(MobEffectEvent.Applicable event) {
GluttonyEffect.canApplyPotion(event);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/sammy/malum/data/item/MalumItemTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ protected void addTags(HolderLookup.Provider pProvider) {
tag(SOULWOOD_LOGS).add(SOULWOOD_LOG.get(), STRIPPED_SOULWOOD_LOG.get(), SOULWOOD.get(), STRIPPED_SOULWOOD.get(), EXPOSED_SOULWOOD_LOG.get(), REVEALED_SOULWOOD_LOG.get(), BLIGHTED_SOULWOOD.get());

tag(SCYTHE).add(CRUDE_SCYTHE.get(), SOUL_STAINED_STEEL_SCYTHE.get(), CREATIVE_SCYTHE.get());
tag(STAFF).add(SOUL_STAINED_STEEL_STAFF.get(), STAFF_OF_THE_AURIC_FLAME.get());

tag(SOUL_HUNTER_WEAPON).add(SOUL_STAINED_STEEL_STAFF.get(), STAFF_OF_THE_AURIC_FLAME.get());
tag(SOUL_HUNTER_WEAPON).add(TYRVING.get(), CRUDE_SCYTHE.get(), SOUL_STAINED_STEEL_SCYTHE.get(), CREATIVE_SCYTHE.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class EnchantmentRegistry {
public static final EnchantmentCategory SOUL_HUNTER_WEAPON = EnchantmentCategory.create(MalumMod.MALUM + ":soul_hunter_only", i -> i.getDefaultInstance().is(ItemTagRegistry.SOUL_HUNTER_WEAPON));
public static final EnchantmentCategory SCYTHE = EnchantmentCategory.create(MalumMod.MALUM + ":scythe_only", i -> i.getDefaultInstance().is(ItemTagRegistry.SCYTHE));
public static final EnchantmentCategory REBOUND_SCYTHE = EnchantmentCategory.create(MalumMod.MALUM + ":rebound_scythe_only", i -> i.getDefaultInstance().is(ItemTagRegistry.SCYTHE) || (CommonConfig.ULTIMATE_REBOUND.getConfigValue() && i instanceof TieredItem));
public static final EnchantmentCategory STAFF = EnchantmentCategory.create(MalumMod.MALUM + ":staff_only", i -> i.getDefaultInstance().is(ItemTagRegistry.STAFF));
public static final EnchantmentCategory SCYTHE_OR_STAFF = EnchantmentCategory.create(MalumMod.MALUM + ":scythe_or_staff", i -> i.getDefaultInstance().is(ItemTagRegistry.SCYTHE) || i.getDefaultInstance().is(ItemTagRegistry.STAFF));

public static final RegistryObject<Enchantment> REBOUND = ENCHANTMENTS.register("rebound", ReboundEnchantment::new);
public static final RegistryObject<Enchantment> HAUNTED = ENCHANTMENTS.register("haunted", HauntedEnchantment::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ public static <T extends Item> RegistryObject<T> register(String name, Item.Prop
public static final RegistryObject<Item> ORNATE_RING = register("ornate_ring", GEAR_PROPERTIES(), CurioOrnateRing::new);
public static final RegistryObject<Item> ORNATE_NECKLACE = register("ornate_necklace", GEAR_PROPERTIES(), CurioOrnateNecklace::new);

public static final RegistryObject<Item> RING_OF_REINFORCEMENT = register("ring_of_reinforcement", GEAR_PROPERTIES(), CurioReinforcementRing::new);
public static final RegistryObject<Item> RING_OF_ESOTERIC_SPOILS = register("ring_of_esoteric_spoils", GEAR_PROPERTIES(), CurioArcaneSpoilRing::new);
public static final RegistryObject<Item> RING_OF_CURATIVE_TALENT = register("ring_of_curative_talent", GEAR_PROPERTIES(), CurioCurativeRing::new);
public static final RegistryObject<Item> RING_OF_ARCANE_PROWESS = register("ring_of_arcane_prowess", GEAR_PROPERTIES(), CurioRingOfProwess::new);
Expand Down Expand Up @@ -543,6 +544,8 @@ public static <T extends Item> RegistryObject<T> register(String name, Item.Prop
public static final RegistryObject<Item> SOUL_STAINED_STEEL_STAFF = register("soul_stained_steel_staff", VOID_GEAR_PROPERTIES(), (p) -> new HexStaffItem(SOUL_STAINED_STEEL, 4, p));
public static final RegistryObject<Item> STAFF_OF_THE_AURIC_FLAME = register("staff_of_the_auric_flame", VOID_GEAR_PROPERTIES(), (p) -> new AuricFlameStaffItem(SOUL_STAINED_STEEL, 6, p));

public static final RegistryObject<Item> BELT_OF_THE_LIMITLESS = register("belt_of_the_limitless", VOID_GEAR_PROPERTIES(), CurioLimitlessBelt::new);

public static final RegistryObject<Item> RING_OF_GROWING_FLESH = register("ring_of_growing_flesh", VOID_GEAR_PROPERTIES(), CurioGrowingFleshRing::new);
public static final RegistryObject<Item> RING_OF_GRUESOME_SATIATION = register("ring_of_gruesome_satiation", VOID_GEAR_PROPERTIES(), CurioGruesomeSatiationRing::new);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
public class ItemTagRegistry {
public static final TagKey<Item> SOUL_HUNTER_WEAPON = malumTag("soul_hunter_weapon");
public static final TagKey<Item> SCYTHE = malumTag("scythe");
public static final TagKey<Item> STAFF = malumTag("staff");
public static final TagKey<Item> RUNEWOOD_LOGS = malumTag("runewood_logs");
public static final TagKey<Item> SOULWOOD_LOGS = malumTag("soulwood_logs");
public static final TagKey<Item> SAPBALLS = malumTag("sapballs");
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/main/resources/data/curios/tags/items/belt.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"malum:gilded_belt",
"malum:belt_of_the_starved",
"malum:belt_of_the_prospector",
"malum:belt_of_the_magebane"]
"malum:belt_of_the_magebane",
"malum:belt_of_the_limitless"]
}
3 changes: 2 additions & 1 deletion src/main/resources/data/curios/tags/items/ring.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"values": [
"malum:gilded_ring",
"malum:ornate_ring",
"malum:ring_of_desperate_voracity",
"malum:ring_of_reinforcement",
"malum:ring_of_esoteric_spoils",
"malum:ring_of_desperate_voracity",
"malum:ring_of_alchemical_mastery",
"malum:ring_of_arcane_prowess",
"malum:ring_of_curative_talent",
Expand Down

0 comments on commit 87ccc0a

Please sign in to comment.