Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheaterpaul committed Jun 30, 2024
1 parent df27f5f commit cb24d65
Show file tree
Hide file tree
Showing 404 changed files with 40,102 additions and 11,093 deletions.
6 changes: 2 additions & 4 deletions src/api/java/de/teamlapen/vampirism/api/APIUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
import de.teamlapen.vampirism.api.entity.factions.IFaction;
import de.teamlapen.vampirism.api.entity.factions.IFactionEntity;
import de.teamlapen.vampirism.api.registries.DeferredFaction;
import net.minecraft.core.Holder;
import de.teamlapen.vampirism.api.util.VResourceLocation;
import net.minecraft.core.Registry;
import net.minecraft.core.component.DataComponentType;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.RegistryManager;
import net.neoforged.neoforge.registries.datamaps.DataMapType;

Expand All @@ -26,8 +24,8 @@ static <T> Supplier<DataComponentType<T>> supplyDataComponent(ResourceLocation k
}

@SuppressWarnings({"unchecked", "UnstableApiUsage"})
static <T, Z> Supplier<DataMapType<T,Z>> supplyDataMap(ResourceKey<Registry<T>> registry, ResourceLocation key) {
return Suppliers.memoize(() -> Objects.requireNonNull((DataMapType<T,Z>) RegistryManager.getDataMap(registry, key)));
static <T, Z> Supplier<DataMapType<T, Z>> supplyDataMap(ResourceKey<Registry<T>> registry, ResourceLocation key) {
return Suppliers.memoize(() -> Objects.requireNonNull((DataMapType<T, Z>) RegistryManager.getDataMap(registry, key)));
}

@SuppressWarnings({"unchecked", "rawtypes"})
Expand Down
2 changes: 1 addition & 1 deletion src/api/java/de/teamlapen/vampirism/api/EnumStrength.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Can be used to determine which strength/tier something is of. e.g. used for holy water and garlic
*/
public enum EnumStrength implements StringRepresentable {
NONE("none",0),
NONE("none", 0),
WEAK("weak", 1),
MEDIUM("medium", 2),
STRONG("strong", 3);
Expand Down
2 changes: 1 addition & 1 deletion src/api/java/de/teamlapen/vampirism/api/VReference.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ public class VReference {
public static IPlayableFaction<IHunterPlayer> HUNTER_FACTION;
public static IVampireVision vision_nightVision;
public static IVampireVision vision_bloodVision;
public static final ResourceLocation PERMANENT_INVISIBLE_MOB_EFFECT =VResourceLocation.mod("permanent");
public static final ResourceLocation PERMANENT_INVISIBLE_MOB_EFFECT = VResourceLocation.mod("permanent");
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static class Keys {
public static final ResourceLocation HUNTER_PLAYER = VResourceLocation.mod("hunter_player");
public static final ResourceLocation GARLIC_HANDLER = VResourceLocation.mod("garlic_handler");
public static final ResourceLocation FOG_HANDLER = VResourceLocation.mod("fog_handler");
public static final ResourceLocation DAMAGE_HANDLER = VResourceLocation.mod( "damage_handler");
public static final ResourceLocation VAMPIRE_BAT = VResourceLocation.mod( "vampire_bat");
public static final ResourceLocation DAMAGE_HANDLER = VResourceLocation.mod("damage_handler");
public static final ResourceLocation VAMPIRE_BAT = VResourceLocation.mod("vampire_bat");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ public class VampirismDataComponents {


public static class Keys {
public static final ResourceLocation OIL_CONTENTS = VResourceLocation.mod( "oil_contents");
public static final ResourceLocation APPLIED_OIL = VResourceLocation.mod( "applied_oil");
public static final ResourceLocation VAMPIRE_BOOK = VResourceLocation.mod( "vampire_book");
public static final ResourceLocation BLOOD_CONTAINER = VResourceLocation.mod( "blood_container");
public static final ResourceLocation CONTAINED_PROJECTILES = VResourceLocation.mod( "contained_projectiles");
public static final ResourceLocation REFINEMENT_SET = VResourceLocation.mod( "refinement_set");
public static final ResourceLocation DO_NOT_NAME = VResourceLocation.mod( "do_not_name");
public static final ResourceLocation VAMPIRE_SWORD = VResourceLocation.mod( "vampire_sword");
public static final ResourceLocation TRAINING_CACHE = VResourceLocation.mod( "training_cache");
public static final ResourceLocation SELECTED_AMMUNITION = VResourceLocation.mod( "selected_ammunition");
public static final ResourceLocation BLOOD_CHARGED = VResourceLocation.mod( "blood_charged");
public static final ResourceLocation BOTTLE_BLOOD = VResourceLocation.mod( "bottle_blood");
public static final ResourceLocation IS_FACTION_BANNER = VResourceLocation.mod( "is_faction_banner");
public static final ResourceLocation OIL_CONTENTS = VResourceLocation.mod("oil_contents");
public static final ResourceLocation APPLIED_OIL = VResourceLocation.mod("applied_oil");
public static final ResourceLocation VAMPIRE_BOOK = VResourceLocation.mod("vampire_book");
public static final ResourceLocation BLOOD_CONTAINER = VResourceLocation.mod("blood_container");
public static final ResourceLocation CONTAINED_PROJECTILES = VResourceLocation.mod("contained_projectiles");
public static final ResourceLocation REFINEMENT_SET = VResourceLocation.mod("refinement_set");
public static final ResourceLocation DO_NOT_NAME = VResourceLocation.mod("do_not_name");
public static final ResourceLocation VAMPIRE_SWORD = VResourceLocation.mod("vampire_sword");
public static final ResourceLocation TRAINING_CACHE = VResourceLocation.mod("training_cache");
public static final ResourceLocation SELECTED_AMMUNITION = VResourceLocation.mod("selected_ammunition");
public static final ResourceLocation BLOOD_CHARGED = VResourceLocation.mod("blood_charged");
public static final ResourceLocation BOTTLE_BLOOD = VResourceLocation.mod("bottle_blood");
public static final ResourceLocation IS_FACTION_BANNER = VResourceLocation.mod("is_faction_banner");
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
package de.teamlapen.vampirism.api;

import com.google.common.base.Suppliers;
import de.teamlapen.vampirism.api.datamaps.IConverterEntry;
import de.teamlapen.vampirism.api.datamaps.IEntityBlood;
import de.teamlapen.vampirism.api.datamaps.IFluidBloodConversion;
import de.teamlapen.vampirism.api.datamaps.IItemBlood;
import de.teamlapen.vampirism.api.util.VResourceLocation;
import com.google.common.base.Suppliers;
import de.teamlapen.vampirism.api.datamaps.*;
import de.teamlapen.vampirism.api.util.VResourceLocation;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.material.Fluid;
import net.neoforged.neoforge.registries.RegistryManager;
import net.neoforged.neoforge.registries.datamaps.DataMapType;

import java.util.function.Supplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* Interface for item components. An item with this component may have an oil applied to it.
* <p>
* For storing {@link de.teamlapen.vampirism.api.items.oil.IOil} in an item (use as an oil bottle) use {@link IOilContent}
*
*/
public interface IAppliedOilContent {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package de.teamlapen.vampirism.api.datamaps;

public interface IFogDiffuserFuel extends IDiffuserFuel{
public interface IFogDiffuserFuel extends IDiffuserFuel {

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.teamlapen.vampirism.api.entity;

import de.teamlapen.vampirism.api.VampirismRegistries;
import de.teamlapen.vampirism.api.datamaps.IConverterEntry;
import de.teamlapen.vampirism.api.datamaps.IEntityBlood;
import de.teamlapen.vampirism.api.entity.convertible.IConvertedCreature;
Expand All @@ -8,7 +9,6 @@
import net.minecraft.world.entity.PathfinderMob;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import de.teamlapen.vampirism.api.VampirismRegistries;
import org.jetbrains.annotations.Unmodifiable;

import java.util.Map;
Expand All @@ -28,10 +28,10 @@ public interface IVampirismEntityRegistry {
/**
* Create a converted creature from the given entity.
*
* @apiNote This will not replace the entity in the world. It will only create a new instance of the converted creature.
* @implSpec This will copy all relevant data from the original entity to the converted entity using {@link de.teamlapen.vampirism.api.entity.convertible.IConvertingHandler#createFrom(net.minecraft.world.entity.PathfinderMob)}
* @param entity the entity to convert
* @return the converted creature or null if the entity cannot be converted
* @apiNote This will not replace the entity in the world. It will only create a new instance of the converted creature.
* @implSpec This will copy all relevant data from the original entity to the converted entity using {@link de.teamlapen.vampirism.api.entity.convertible.IConvertingHandler#createFrom(net.minecraft.world.entity.PathfinderMob)}
*/
@Nullable
IConvertedCreature<?> convert(PathfinderMob entity);
Expand Down Expand Up @@ -81,8 +81,9 @@ public interface IVampirismEntityRegistry {
* - no animals<br>
* - entities added to the config values of Server#blacklistedBloodEntity<br>
* <br>
* @implNote The blood value of entities without an explicit entry is calculated based on the entity's size and the entity's type.
*
* @return a new or existing entry
* @implNote The blood value of entities without an explicit entry is calculated based on the entity's size and the entity's type.
*/
@NotNull
IEntityBlood getOrCreateEntry(PathfinderMob creature);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@

public interface VampireBookLootProvider {

@NotNull Optional<String> getBookLootId();
@NotNull
Optional<String> getBookLootId();
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public interface IConvertingHandler<T extends PathfinderMob> {

/**
* updates the attributes of the converted creature
*
* @param creature the converted creature
*/
default void updateEntityAttributes(PathfinderMob creature) {
Expand All @@ -34,6 +35,6 @@ default void updateEntityAttributes(PathfinderMob creature) {
*/
interface IDefaultHelper {

Map<Holder<Attribute>, Pair<FloatProvider,Double>> getAttributeModifier();
Map<Holder<Attribute>, Pair<FloatProvider, Double>> getAttributeModifier();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ default boolean handleSound(byte id, @NotNull PathfinderMob entity) {
* @return the action result
*/
default @NotNull InteractionResult interactWithCureItem(@NotNull Player player, @NotNull ItemStack stack, @NotNull PathfinderMob entity) {
if(isConverting(entity)) return InteractionResult.CONSUME;
if (isConverting(entity)) return InteractionResult.CONSUME;
if (!entity.hasEffect(MobEffects.WEAKNESS)) return InteractionResult.CONSUME;
if (!player.getAbilities().instabuild) {
stack.shrink(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public interface IFactionBuilder<T extends IFactionEntity> {
* Marks the tag as a faction tag
*
* @param registryKey the registry key for the tag registry
* @param tag the faction tag
* @param tag the faction tag
* @return the builder
*/
<Z> IFactionBuilder<T> addTag(ResourceKey<? extends Registry<Z>> registryKey, TagKey<Z> tag);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public interface IFactionRegistry {
*/
@Deprecated
@Nullable
IMinionEntry<?,?> getMinion(ResourceLocation minionId);
IMinionEntry<?, ?> getMinion(ResourceLocation minionId);

/**
* @return all minion entries from {@link de.teamlapen.vampirism.api.VampirismRegistries#MINION} registry
Expand All @@ -77,6 +77,6 @@ public interface IFactionRegistry {
* @return a map of all minion entries from {@link de.teamlapen.vampirism.api.VampirismRegistries#MINION} registry, grouped by faction
*/
@Unmodifiable
Map<Holder<? extends IPlayableFaction<?>>, List<Pair<ResourceKey<IMinionEntry<?,?>>, IMinionEntry<?, ?>>>> getFactionMinionEntries();
Map<Holder<? extends IPlayableFaction<?>>, List<Pair<ResourceKey<IMinionEntry<?, ?>>, IMinionEntry<?, ?>>>> getFactionMinionEntries();

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
* Builder for faction village related attributes.
* <br>
* used for {@link IFactionBuilder}
*
*/
public interface IFactionVillageBuilder {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public interface ILordTitleProvider {
/**
* Get a lord title.
*
* @param level the lord level
* @param level the lord level
* @param titleGender the gender of the title
* @return the lord title
*/
Expand All @@ -17,7 +17,8 @@ public interface ILordTitleProvider {

/**
* Get a short lord title.
* @param level the lord level
*
* @param level the lord level
* @param titleGender the gender of the title
* @return the short lord title
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
import java.util.function.BiFunction;
import java.util.function.Supplier;

public interface IMinionEntryBuilder<T extends IFactionPlayer<T>,Z extends IMinionData> {
public interface IMinionEntryBuilder<T extends IFactionPlayer<T>, Z extends IMinionData> {

IMinionEntryBuilder<T, Z> commandBuilder(@NotNull IMinionCommandBuilder<T,Z> builder);
IMinionEntryBuilder<T, Z> commandBuilder(@NotNull IMinionCommandBuilder<T, Z> builder);

IMinionEntry<T, Z> build();

interface IMinionCommandBuilder<T extends IFactionPlayer<T>,Z extends IMinionData> {
interface IMinionCommandBuilder<T extends IFactionPlayer<T>, Z extends IMinionData> {

<L> IMinionCommandBuilder<T,Z> with(@NotNull String name, L defaultValue, @NotNull ArgumentType<L> type, BiConsumer<Z,L> setter, BiFunction<CommandContext<CommandSourceStack>, String, L> getter);
<L> IMinionCommandBuilder<T, Z> with(@NotNull String name, L defaultValue, @NotNull ArgumentType<L> type, BiConsumer<Z, L> setter, BiFunction<CommandContext<CommandSourceStack>, String, L> getter);

Supplier<EntityType<? extends IMinionEntity>> type();

List<ICommandEntry<Z,?>> commandArguments();
List<ICommandEntry<Z, ?>> commandArguments();

interface ICommandEntry<Z extends IMinionData,T> {
interface ICommandEntry<Z extends IMinionData, T> {

String name();

Expand All @@ -39,7 +39,7 @@ interface ICommandEntry<Z extends IMinionData,T> {

BiFunction<CommandContext<CommandSourceStack>, String, T> getter();

BiConsumer<Z,T> setter();
BiConsumer<Z, T> setter();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package de.teamlapen.vampirism.api.entity.factions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public interface IAdvancedHunter extends IHunterMob, IAdjustableLevel, IVillageC
/**
* The type integer declares multiple things about the hunter. This the different values are stored in the different bits of the integer.
* <br>
* - bit 0 defines if the hunter has a cloak<br>
* - bits 1-9 are used for the hunter body texture<br>
* - bit 0 defines if the hunter has a cloak<br>
* - bits 1-9 are used for the hunter body texture<br>
*/
int getHunterType();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package de.teamlapen.vampirism.api.entity.hunter;

import de.teamlapen.vampirism.api.VReference;
import de.teamlapen.vampirism.api.VampirismFactions;
import de.teamlapen.vampirism.api.VampirismRegistries;
import de.teamlapen.vampirism.api.entity.factions.IFaction;
import de.teamlapen.vampirism.api.entity.factions.IFactionEntity;
import net.minecraft.core.Holder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public interface IVampirismCrossbowUser extends CrossbowAttackMob, RangedAttackM

boolean isChargingCrossbow();

default boolean canUseCrossbow(ItemStack stack){
default boolean canUseCrossbow(ItemStack stack) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
public interface IFactionMinionTask<T extends IMinionTask.IMinionTaskDesc<Q>, Q extends IMinionData> extends IMinionTask<T, Q> {

/**
*
* @return The faction that is required to use this task. Null if no faction is required
*/
@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ default IFaction<?> getDisguisedAs() {
int getMaxLevel();

@Override
@NotNull Holder<? extends IPlayableFaction<?>> getFaction();
@NotNull
Holder<? extends IPlayableFaction<?>> getFaction();

/**
* Careful this selects all {@link LivingEntity}'s including etc. Items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ default float getPercentageForAction(@NotNull IAction<T> action) {
/**
* Returns +Ticks_Left/Total_Duration(Positive) if action is active
* Returns -Cooldown_Left/Total_Cooldown(Negative) if action is in cooldown
*
* @deprecated Use {@link #getCooldownPercentage(Holder)} or {@link #getDurationPercentage(Holder)} instead
*/
@Deprecated(since = "1.11")
Expand Down Expand Up @@ -83,7 +84,8 @@ default float getPercentageForAction(@NotNull IAction<T> action) {
@Unmodifiable
List<Holder<? extends IAction<T>>> getUnlockedActionHolder();

@NotNull List<Holder<? extends ILastingAction<T>>> getActiveActions();
@NotNull
List<Holder<? extends ILastingAction<T>>> getActiveActions();

@Deprecated(forRemoval = true, since = "1.11")
default boolean isActionActive(@NotNull ILastingAction<T> action) {
Expand Down Expand Up @@ -180,9 +182,10 @@ default void deactivateAction(@NotNull ILastingAction<T> action, boolean ignoreC

/**
* Lasting actions are deactivated here, which fires the {@link de.teamlapen.vampirism.api.event.ActionEvent.ActionDeactivatedEvent}
* @param action - The lasting action being deactivated
*
* @param action - The lasting action being deactivated
* @param ignoreCooldown - Whether the cooldown is ignored for the action
* @param fullCooldown - Whether the lasting action should get the full or reduced cooldown
* @param fullCooldown - Whether the lasting action should get the full or reduced cooldown
*/
void deactivateAction(@NotNull Holder<? extends ILastingAction<T>> action, boolean ignoreCooldown, boolean fullCooldown);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

import net.minecraft.core.Holder;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.UUID;

public interface IRefinement {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.Locale;
import java.util.Optional;
import java.util.Set;
import java.util.function.Supplier;

public interface IRefinementSet {

Expand Down
Loading

0 comments on commit cb24d65

Please sign in to comment.