Skip to content

Commit

Permalink
Several minor fixes and mapping fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
maxanier committed Apr 16, 2019
1 parent 8c99b0e commit d9077a7
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 13 deletions.
8 changes: 8 additions & 0 deletions src/main/java/de/teamlapen/vampirism/core/ModEntities.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.datafix.IFixableData;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.common.registry.EntityEntryBuilder;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
Expand Down Expand Up @@ -283,4 +284,11 @@ private static <T extends Entity> EntityEntryBuilder<T> prepareEntityEntry(Class
}


static void fixMapping(RegistryEvent.MissingMappings.Mapping<EntityEntry> m) {
if (new ResourceLocation("vampirism", "hunter_villager").equals(m.key)) {
m.ignore(); //No need to replace
} else if (new ResourceLocation("vampirism", "converted_villager").equals(m.key)) {
m.ignore();
}
}
}
23 changes: 19 additions & 4 deletions src/main/java/de/teamlapen/vampirism/core/RegistryManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.registries.ObjectHolderRegistry;


/**
* Handles registrations of all registrable things as well as a few additional
* dependent things
Expand Down Expand Up @@ -87,10 +88,9 @@ public void onInitStep(Step step, FMLStateEvent event) {
}

@SubscribeEvent
public void onMissinMappingsPotion(RegistryEvent.MissingMappings<SoundEvent> event) {

for (RegistryEvent.MissingMappings.Mapping<SoundEvent> m : event.getMappings()) {
m.ignore();
public void onMissingMappingsEntity(RegistryEvent.MissingMappings<EntityEntry> event) {
for (RegistryEvent.MissingMappings.Mapping<EntityEntry> m : event.getMappings()) {
ModEntities.fixMapping(m);
}
}

Expand Down Expand Up @@ -120,6 +120,21 @@ public void onMissingMappingsPotion(RegistryEvent.MissingMappings<Potion> event)
}
}

@SubscribeEvent
public void onMissingMappingsSkill(RegistryEvent.MissingMappings<ISkill> event) {
for (RegistryEvent.MissingMappings.Mapping<ISkill> m : event.getMappings()) {
VampireSkills.fixMapping(m);
}
}

@SubscribeEvent
public void onMissingMappingsSoundEvent(RegistryEvent.MissingMappings<SoundEvent> event) {

for (RegistryEvent.MissingMappings.Mapping<SoundEvent> m : event.getMappings()) {
m.ignore();
}
}

@SubscribeEvent
public void onRegisterActions(RegistryEvent.Register<IAction> event) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ protected ResourceLocation getLootTable() {

@Override
public void attackVillage(AxisAlignedBB area) {
this.setCustomNameTag("Attacking Village");
this.village_attack_area = area;
}

Expand Down Expand Up @@ -416,7 +415,6 @@ protected boolean processInteract(EntityPlayer player, EnumHand hand) {

@Override
public void defendVillage(AxisAlignedBB area) {
this.setCustomNameTag("Defending Village");
this.village_defense_area = area;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import de.teamlapen.vampirism.config.Balance;
import de.teamlapen.vampirism.core.ModPotions;
import de.teamlapen.vampirism.core.ModSounds;
import de.teamlapen.vampirism.entity.ai.EntityAIDefendVillage;
import de.teamlapen.vampirism.entity.action.EntityActionHandler;
import de.teamlapen.vampirism.entity.ai.EntityAIDefendVillage;
import de.teamlapen.vampirism.entity.ai.*;
import de.teamlapen.vampirism.entity.hunter.EntityHunterBase;
import de.teamlapen.vampirism.world.loot.LootHandler;
Expand All @@ -38,6 +38,7 @@
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.FMLCommonHandler;

import javax.annotation.Nullable;

/**
Expand Down Expand Up @@ -293,14 +294,12 @@ protected ResourceLocation getLootTable() {
public void attackVillage(AxisAlignedBB area) {
this.tasks.removeTask(tasks_avoidHunter);
village_attack_area = area;
this.setCustomNameTag("Attacking Village");//TODO Debug
}

@Override
public void defendVillage(AxisAlignedBB area) {
this.tasks.removeTask(tasks_avoidHunter);
village_defense_area = area;
this.setCustomNameTag("Defending Village"); //TODO Debug
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ public void biteEntity(int entityId) {
if (e instanceof EntityLivingBase) {
if (e.getDistance(player) <= player.getEntityAttribute(EntityPlayer.REACH_DISTANCE).getAttributeValue() + 1) {
feed_victim_bite_type = determineBiteType((EntityLivingBase) e);
VampirismMod.log.t("bitetype: %s", feed_victim_bite_type.name());
if (feed_victim_bite_type == BITE_TYPE.ATTACK || feed_victim_bite_type == BITE_TYPE.ATTACK_HUNTER || feed_victim_bite_type == BITE_TYPE.HUNTER_CREATURE) {
biteAttack((EntityLivingBase) e, feed_victim_bite_type == BITE_TYPE.ATTACK_HUNTER);
} else if (feed_victim_bite_type == BITE_TYPE.NONE) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.teamlapen.vampirism.player.vampire.actions;

import de.teamlapen.vampirism.advancements.VampireActionTrigger;
import de.teamlapen.vampirism.api.EnumStrength;
import de.teamlapen.vampirism.api.entity.player.actions.ILastingAction;
import de.teamlapen.vampirism.api.entity.player.vampire.DefaultVampireAction;
import de.teamlapen.vampirism.api.entity.player.vampire.IVampirePlayer;
Expand Down Expand Up @@ -83,7 +84,7 @@ public boolean activate(IVampirePlayer vampire) {

@Override
public boolean canBeUsedBy(IVampirePlayer vampire) {
return !vampire.isGettingSundamage() && !vampire.getActionHandler().isActionActive(VampireActions.vampire_rage) && !vampire.getRepresentingPlayer().isInWater() && (Configs.bat_mode_in_end || !(vampire.getRepresentingPlayer().getEntityWorld().provider instanceof WorldProviderEnd));
return !vampire.isGettingSundamage() && vampire.isGettingGarlicDamage() == EnumStrength.NONE && !vampire.getActionHandler().isActionActive(VampireActions.vampire_rage) && !vampire.getRepresentingPlayer().isInWater() && (Configs.bat_mode_in_end || !(vampire.getRepresentingPlayer().getEntityWorld().provider instanceof WorldProviderEnd));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.registries.IForgeRegistry;

Expand Down Expand Up @@ -266,4 +267,10 @@ private static void registerDefensiveSkills(ISkillManager skillManager, SkillNod


}

public static void fixMapping(RegistryEvent.MissingMappings.Mapping<ISkill> m) {
if (new ResourceLocation("vampirism:bite1").equals(m.key) || new ResourceLocation("vampirism:bite2").equals(m.key)) {
m.ignore();
}
}
}
4 changes: 2 additions & 2 deletions src/main/resources/assets/vampirism/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ entity.vampirism.hunter_trainer.name=Vampire Hunter Trainer
entity.vampirism.hunter_trainer_dummy.name=Undercover Hunter Trainer
entity.vampirism.advanced_vampire.name=Advanced Vampire
entity.vampirism.advanced_hunter.name=Advanced Hunter
entity.vampirism.hunter_villager.name=Angry Villager
entity.vampirism.villager_angry.name=Angry Villager
entity.vampirism.vampire_hunter.name=Vampire Hunter
entity.vampirism.vampire.name=Vampire
entity.vampirism.ghost.name=Ghost
Expand All @@ -146,7 +146,7 @@ entity.vampirism.blinding_bat.name=Bat
entity.vampirism.dracula.name=Dracula
entity.vampirism.dead_mob.name=Dead mob
entity.vampirism.portal_guard.name=Portal Guard
entity.vampirism.converted_villager.name=Vampire Villager
entity.vampirism.villager_converted.name=Vampire Villager
entity.vampirism.villager_vampire_faction.name=Vampire Expert
entity.vampirism.villager_hunter_faction.name=Hunter Expert
text.vampirism.entity_level=Level
Expand Down

0 comments on commit d9077a7

Please sign in to comment.