-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update channeled logic for substitution
- Loading branch information
Showing
16 changed files
with
164 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/java/com/sekwah/narutomod/abilities/jutsus/SubstitutionJutsuAbility.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.sekwah.narutomod.abilities.jutsus; | ||
|
||
import com.sekwah.narutomod.abilities.Ability; | ||
import com.sekwah.narutomod.capabilities.INinjaData; | ||
import com.sekwah.narutomod.sounds.NarutoSounds; | ||
import com.sekwah.sekclib.player.PlayerUtil; | ||
import net.minecraft.ChatFormatting; | ||
import net.minecraft.network.chat.TranslatableComponent; | ||
import net.minecraft.sounds.SoundEvent; | ||
import net.minecraft.sounds.SoundSource; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.phys.Vec3; | ||
|
||
public class SubstitutionJutsuAbility extends Ability implements Ability.Channeled { | ||
@Override | ||
public ActivationType activationType() { | ||
return ActivationType.CHANNELED; | ||
} | ||
|
||
@Override | ||
public long defaultCombo() { | ||
return 12; | ||
} | ||
|
||
@Override | ||
public boolean handleCost(Player player, INinjaData ninjaData, int chargeAmount) { | ||
return true; | ||
} | ||
|
||
/** | ||
* Due to the nature of this ability all costs and other things will be handled here. | ||
*/ | ||
@Override | ||
public void performServer(Player player, INinjaData ninjaData, int ticksActive) { | ||
if(ticksActive == 0) { | ||
player.displayClientMessage(new TranslatableComponent("jutsu.cast.substitution"), false); | ||
// Activate | ||
ninjaData.useSubstitution(1); | ||
} else { | ||
player.displayClientMessage(new TranslatableComponent("jutsu.cast.substitution_mark"), false); | ||
// Mark | ||
} | ||
} | ||
|
||
@Override | ||
public boolean hideChannelMessages() { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/main/java/com/sekwah/narutomod/capabilities/lingerabilitydata/LingerAbilityData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.sekwah.narutomod.capabilities.lingerabilitydata; | ||
|
||
import com.sekwah.narutomod.abilities.Ability; | ||
import com.sekwah.narutomod.capabilities.INinjaData; | ||
import net.minecraft.ChatFormatting; | ||
import net.minecraft.network.chat.TranslatableComponent; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.entity.player.Player; | ||
|
||
import java.util.HashSet; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Tracks ability references and other information for the server side. | ||
* | ||
* On client side the ticks tracked will be since the client knows the ability is active. | ||
* Do not use it for reliable triggering for effects or behavior when the user is not the player itssself. | ||
* | ||
* Try to keep as much behavior solely to server side as you can. | ||
*/ | ||
public class LingerAbilityData { | ||
|
||
private HashSet<ResourceLocation> abilities; | ||
|
||
public LingerAbilityData(int size) { | ||
this.abilities = new HashSet<>(size); | ||
} | ||
|
||
public LingerAbilityData() { | ||
this.abilities = new HashSet<>(); | ||
} | ||
|
||
public boolean addAbility(ResourceLocation ability) { | ||
return this.abilities.add(ability); | ||
} | ||
|
||
public boolean addAbilityStarted(Player player, INinjaData ninjaData, Ability ability) { | ||
if (ability.activationType() == Ability.ActivationType.TOGGLE && ability.logInChat()) { | ||
player.sendMessage(new TranslatableComponent("jutsu.toggle.enabled", new TranslatableComponent(ability.getTranslationKey()).withStyle(ChatFormatting.YELLOW)).withStyle(ChatFormatting.GREEN), player.getUUID()); | ||
} | ||
return this.addAbility(ability.getRegistryName()); | ||
} | ||
|
||
public boolean removeAbilityEnded(Player player, INinjaData ninjaData, Ability ability) { | ||
if(ability instanceof Ability.HandleEnded endedAbility) endedAbility.handleAbilityEnded(player, ninjaData, 0); | ||
if (ability.activationType() == Ability.ActivationType.TOGGLE && ability.logInChat()) { | ||
player.sendMessage(new TranslatableComponent("jutsu.toggle.disabled", new TranslatableComponent(ability.getTranslationKey()).withStyle(ChatFormatting.YELLOW)).withStyle(ChatFormatting.RED), player.getUUID()); | ||
} | ||
return this.removeAbility(ability.getRegistryName()); | ||
} | ||
|
||
public boolean removeAbility(ResourceLocation ability) { | ||
return this.abilities.remove(ability); | ||
} | ||
|
||
public HashSet<ResourceLocation> getAbilitiesHashSet() { | ||
return abilities; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(abilities); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (!(o instanceof LingerAbilityData)) return false; | ||
LingerAbilityData that = (LingerAbilityData) o; | ||
return abilities.equals(that.abilities); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...sekwah/narutomod/config/NarutoConfig.java → .../renderer/entity/config/NarutoConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
.../java/com/sekwah/narutomod/client/renderer/worldinfo/SubstitutionWorldMarkerRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.sekwah.narutomod.client.renderer.worldinfo; | ||
|
||
public class SubstitutionWorldMarkerRenderer { | ||
public static void render() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/com/sekwah/narutomod/entity/item/PaperBombEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/com/sekwah/narutomod/entity/projectile/ExplosiveKunaiEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters