Skip to content

Commit

Permalink
remove unused mobeffect, raise shockwave particle
Browse files Browse the repository at this point in the history
  • Loading branch information
iron431 committed Nov 26, 2023
1 parent 634098e commit e0107b7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
26 changes: 13 additions & 13 deletions src/main/java/io/redspace/ironsspellbooks/mixin/EntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ public void isAlliedTo(Entity entity, CallbackInfoReturnable<Boolean> cir) {
cir.setReturnValue(self.isAlliedTo(summon.getSummoner()) || self.equals(summon.getSummoner()));

}

@Inject(method = "setTicksFrozen", at = @At(value = "HEAD"), cancellable = true)
public void setTicksFrozen(int pTicksFrozen, CallbackInfo ci) {
if ((Object) (this) instanceof LivingEntity livingEntity && livingEntity.hasEffect(MobEffectRegistry.CHILLED.get())) {
int currentTicks = ((Entity) (Object) this).getTicksFrozen();
int deltaTicks = pTicksFrozen - currentTicks;
if (deltaTicks > 0) {
deltaTicks *= 2;
entityData.set(DATA_TICKS_FROZEN, currentTicks + deltaTicks);
ci.cancel();
}
}
}
// TODO:
// @Inject(method = "setTicksFrozen", at = @At(value = "HEAD"), cancellable = true)
// public void setTicksFrozen(int pTicksFrozen, CallbackInfo ci) {
// if ((Object) (this) instanceof LivingEntity livingEntity && livingEntity.hasEffect(MobEffectRegistry.CHILLED.get())) {
// int currentTicks = ((Entity) (Object) this).getTicksFrozen();
// int deltaTicks = pTicksFrozen - currentTicks;
// if (deltaTicks > 0) {
// deltaTicks *= 2;
// entityData.set(DATA_TICKS_FROZEN, currentTicks + deltaTicks);
// ci.cancel();
// }
// }
// }

/**
* Necessary see all invisible mobs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public static void register(IEventBus eventBus) {
public static final RegistryObject<MobEffect> OAKSKIN = MOB_EFFECT_DEFERRED_REGISTER.register("oakskin", () -> new OakskinEffect(MobEffectCategory.BENEFICIAL, 0xffef95) );
public static final RegistryObject<MobEffect> PLANAR_SIGHT = MOB_EFFECT_DEFERRED_REGISTER.register("planar_sight", () -> new PlanarSightEffect(MobEffectCategory.BENEFICIAL, 0x6c42f5));
public static final RegistryObject<MobEffect> ANTIGRAVITY = MOB_EFFECT_DEFERRED_REGISTER.register("antigravity", () -> new MobEffect(MobEffectCategory.NEUTRAL, 0x6c42f5){}.addAttributeModifier(ForgeMod.ENTITY_GRAVITY.get(), "d2b7228b-3ded-412e-940b-8f9f1e2cf882", -1.02, AttributeModifier.Operation.MULTIPLY_BASE));
public static final RegistryObject<MobEffect> CHILLED = MOB_EFFECT_DEFERRED_REGISTER.register("chilled", () -> new MobEffect(MobEffectCategory.HARMFUL, 0x6c42f5){}.addAttributeModifier(Attributes.MOVEMENT_SPEED, "d2b7229b-3ded-412e-940b-8f9f1e2cf882", -.1, AttributeModifier.Operation.MULTIPLY_TOTAL));
//TODO: uncomment mixin, uncomment spell logic
// public static final RegistryObject<MobEffect> CHILLED = MOB_EFFECT_DEFERRED_REGISTER.register("chilled", () -> new MobEffect(MobEffectCategory.HARMFUL, 0x6c42f5){}.addAttributeModifier(Attributes.MOVEMENT_SPEED, "d2b7229b-3ded-412e-940b-8f9f1e2cf882", -.1, AttributeModifier.Operation.MULTIPLY_TOTAL));
//public static final RegistryObject<MobEffect> ROOT = MOB_EFFECT_DEFERRED_REGISTER.register("root", () -> new RootEffect(MobEffectCategory.HARMFUL, 0x604730));
//public static final RegistryObject<MobEffect> ENCHANTED_WARD = MOB_EFFECT_DEFERRED_REGISTER.register("enchanted_ward", () -> new EnchantedWardEffect(MobEffectCategory.HARMFUL, 3311322));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public Optional<SoundEvent> getCastFinishSound() {
public void onCast(Level level, int spellLevel, LivingEntity entity, MagicData playerMagicData) {
float radius = 1.75f;
Vec3 smiteLocation = Utils.moveToRelativeGroundLevel(level, entity.getEyePosition().add(entity.getForward().multiply(1, 0, 1).normalize().scale(1.35f)), 2);
MagicManager.spawnParticles(level, new ShockwaveParticleOptions(SchoolRegistry.HOLY.get().getTargetingColor(), radius * 2), smiteLocation.x, smiteLocation.y, smiteLocation.z, 1, 0, 0, 0, 0, true);
MagicManager.spawnParticles(level, new ShockwaveParticleOptions(SchoolRegistry.HOLY.get().getTargetingColor(), radius * 2), smiteLocation.x, smiteLocation.y + .15f, smiteLocation.z, 1, 0, 0, 0, 0, true);
MagicManager.spawnParticles(level, ParticleTypes.ELECTRIC_SPARK, smiteLocation.x, smiteLocation.y + .15f, smiteLocation.z, 50, 0, 0, 0, 1, false);
CameraShakeManager.addCameraShake(new CameraShakeData(10, smiteLocation, 10));
var entities = level.getEntities(entity, AABB.ofSize(smiteLocation, radius * 2, radius * 4, radius * 2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ public void onCast(Level level, int spellLevel, LivingEntity entity, MagicData p
float radius = getRadius(spellLevel, entity);
MagicManager.spawnParticles(level, new ShockwaveParticleOptions(SchoolRegistry.ICE.get().getTargetingColor(), radius), entity.getX(), entity.getY() + .15f, entity.getZ(), 1, 0, 0, 0, 0, true);
level.getEntities(entity, entity.getBoundingBox().inflate(radius, 4, radius), (target) -> DamageSources.isFriendlyFireBetween(target, entity)).forEach(target -> {
if (target instanceof LivingEntity livingEntity && livingEntity.distanceToSqr(entity) < radius * radius) {
livingEntity.addEffect(new MobEffectInstance(MobEffectRegistry.CHILLED.get(), getDuration(spellLevel, entity)));
}
// if (target instanceof LivingEntity livingEntity && livingEntity.distanceToSqr(entity) < radius * radius) {
// livingEntity.addEffect(new MobEffectInstance(MobEffectRegistry.CHILLED.get(), getDuration(spellLevel, entity)));
// }
});
super.onCast(level, spellLevel, entity, playerMagicData);
}
Expand Down

0 comments on commit e0107b7

Please sign in to comment.