Skip to content

Commit

Permalink
modify freeze action to use the vanilla freeze property
Browse files Browse the repository at this point in the history
new action/effect texture by Zeyke
  • Loading branch information
Cheaterpaul committed Sep 18, 2023
1 parent 7713ad6 commit d5b7255
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"#vampirism:armo/hunter_coat"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"values": [
"vampirism:hunter_coat_head_normal",
"vampirism:hunter_coat_head_enhanced",
"vampirism:hunter_coat_head_ultimate",
"vampirism:hunter_coat_chest_normal",
"vampirism:hunter_coat_chest_enhanced",
"vampirism:hunter_coat_chest_ultimate",
"vampirism:hunter_coat_legs_normal",
"vampirism:hunter_coat_legs_enhanced",
"vampirism:hunter_coat_legs_ultimate",
"vampirism:hunter_coat_feet_normal",
"vampirism:hunter_coat_feet_enhanced",
"vampirism:hunter_coat_feet_ultimate"
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package de.teamlapen.vampirism.client.gui.overlay;

import com.mojang.blaze3d.systems.RenderSystem;
import de.teamlapen.vampirism.api.VampirismAPI;
import de.teamlapen.vampirism.api.entity.player.actions.IAction;
import de.teamlapen.vampirism.api.entity.player.actions.IActionHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public class BalanceConfig {
//Vampire actions
builder.category("vampireActions", "va");
vaFreezeCooldown = builder.comment("In seconds").defineInRange("freezeCooldown", 60, 1, Integer.MAX_VALUE);
vaFreezeDuration = builder.comment("In seconds").defineInRange("freezeDuration", 6, 1, 30);
vaFreezeDuration = builder.comment("In seconds").defineInRange("freezeDuration", 3, 1, 30);
vaFreezeEnabled = builder.define("freezeEnabled", true);
vaInvisibilityCooldown = builder.comment("In seconds").defineInRange("invisibilityCooldown", 25, 1, Integer.MAX_VALUE);
vaInvisibilityDuration = builder.comment("In seconds").defineInRange("invisibilityDuration", 25, 1, Integer.MAX_VALUE);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/de/teamlapen/vampirism/core/ModTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public static class Items {
public static final TagKey<Item> APPLICABLE_OIL_SWORD = tag("applicable_oil/sword");
public static final TagKey<Item> APPLICABLE_OIL_PICKAXE = tag("applicable_oil/pickaxe");
public static final TagKey<Item> APPLICABLE_OIL_ARMOR = tag("applicable_oil/armor");
public static final TagKey<Item> HUNTER_COAT = tag("armo/hunter_coat");

private static @NotNull TagKey<Item> tag(@NotNull ResourceLocation resourceLocation) {
return ItemTags.create(resourceLocation);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/de/teamlapen/vampirism/data/TagGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ protected void addTags(HolderLookup.@NotNull Provider holderProvider) {
tag(ModTags.Items.APPLICABLE_OIL_SWORD);
tag(ItemTags.SIGNS).add(ModItems.DARK_SPRUCE_SIGN.get(), ModItems.CURSED_SPRUCE_SIGN.get());
tag(ItemTags.HANGING_SIGNS).add(ModItems.DARK_SPRUCE_HANGING_SIGN.get(), ModItems.CURSED_SPRUCE_HANGING_SIGN.get());
tag(ModTags.Items.HUNTER_COAT).add(ModItems.HUNTER_COAT_HEAD_NORMAL.get(),ModItems.HUNTER_COAT_HEAD_ENHANCED.get(),ModItems.HUNTER_COAT_HEAD_ULTIMATE.get(), ModItems.HUNTER_COAT_CHEST_NORMAL.get(),ModItems.HUNTER_COAT_CHEST_ENHANCED.get(),ModItems.HUNTER_COAT_CHEST_ULTIMATE.get(), ModItems.HUNTER_COAT_LEGS_NORMAL.get(),ModItems.HUNTER_COAT_LEGS_ENHANCED.get(),ModItems.HUNTER_COAT_LEGS_ULTIMATE.get(), ModItems.HUNTER_COAT_FEET_NORMAL.get(),ModItems.HUNTER_COAT_FEET_ENHANCED.get(),ModItems.HUNTER_COAT_FEET_ULTIMATE.get());
tag(ItemTags.FREEZE_IMMUNE_WEARABLES).addTag(ModTags.Items.HUNTER_COAT);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ public FreezeEffect() {

@Override
public void applyEffectTick(@NotNull LivingEntity entityLivingBaseIn, int amplifier) {
entityLivingBaseIn.setDeltaMovement(0, Math.min(0, entityLivingBaseIn.getDeltaMovement().y()), 0);
if (entityLivingBaseIn.canFreeze()) {
entityLivingBaseIn.setTicksFrozen(Math.max(entityLivingBaseIn.getTicksRequiredToFreeze() + 40, entityLivingBaseIn.getTicksFrozen()));
}
}


@Override
public boolean isDurationEffectTick(int duration, int amplifier) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,9 @@ protected void customServerAiStep() {
}

}

@Override
public boolean canFreeze() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
import de.teamlapen.vampirism.core.ModParticles;
import de.teamlapen.vampirism.core.ModRefinements;
import de.teamlapen.vampirism.core.ModSounds;
import de.teamlapen.vampirism.entity.BlindingBatEntity;
import de.teamlapen.vampirism.entity.player.VampirismPlayerAttributes;
import de.teamlapen.vampirism.particle.GenericParticleOptions;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.LivingEntity;
Expand All @@ -32,21 +29,22 @@ public FreezeVampireAction() {
public boolean activate(final @NotNull IVampirePlayer vampire, ActivationContext context) {
Player player = vampire.getRepresentingPlayer();
List<LivingEntity> l = player.getCommandSenderWorld().getEntitiesOfClass(LivingEntity.class, player.getBoundingBox().inflate(10, 5, 10), vampire.getNonFriendlySelector(true, false));
for (LivingEntity e : l) {
if (player.equals(e)) continue;
if (e instanceof BlindingBatEntity) continue;
if (e instanceof Player && VampirismPlayerAttributes.get((Player) e).getHuntSpecial().fullHunterCoat != null) {
continue;
}
for (LivingEntity entity : l) {
if (player.equals(entity)) continue;

entity.getCommandSenderWorld().playSound(null, entity.getX(), entity.getY(), entity.getZ(), ModSounds.FREEZE.get(), SoundSource.PLAYERS, 1f, 1f);
ModParticles.spawnParticlesServer(player.level(), ParticleTypes.SNOWFLAKE, entity.getX(), entity.getY(), entity.getZ(), 20, 1, 1, 1, 0);

if (!entity.canFreeze()) continue;

int dur = VampirismConfig.BALANCE.vaFreezeDuration.get() * 20;
if (vampire.getSkillHandler().isRefinementEquipped(ModRefinements.FREEZE_DURATION.get())) {
dur *= VampirismConfig.BALANCE.vrFreezeDurationMod.get();
}
e.addEffect(new MobEffectInstance(ModEffects.FREEZE.get(), dur));
e.getCommandSenderWorld().playSound(null, e.getX(), e.getY(), e.getZ(), ModSounds.FREEZE.get(), SoundSource.PLAYERS, 1f, 1f);
ModParticles.spawnParticlesServer(player.getCommandSenderWorld(), new GenericParticleOptions(new ResourceLocation("minecraft", "generic_2"), 20, 0xF0F0F0, 0.4F), e.getX(), e.getY(), e.getZ(), 20, 1, 1, 1, 0);
entity.addEffect(new MobEffectInstance(ModEffects.FREEZE.get(), dur));
entity.setSharedFlagOnFire(false);
}
return l.size() > 0;
return !l.isEmpty();
}

@Override
Expand Down
Binary file modified src/main/resources/assets/vampirism/textures/actions/freeze.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/assets/vampirism/textures/mob_effect/freeze.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d5b7255

Please sign in to comment.