Skip to content

Commit

Permalink
another set of re-organising
Browse files Browse the repository at this point in the history
  • Loading branch information
Thutmose committed Oct 24, 2022
1 parent efab8ca commit 641b4e5
Show file tree
Hide file tree
Showing 9,625 changed files with 6,936 additions and 4,067 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
32 changes: 31 additions & 1 deletion processing_scripts/database_update/moves_converter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import json
from utils import get_moves_index, get_move, trim, default_or_latest
import utils
import os
from utils import get_moves_index, get_move, trim, default_or_latest, url_to_id

MANUAL_RENAMES = {
"lastout": "lash-out",
Expand Down Expand Up @@ -49,6 +51,7 @@ def __init__(self, move) -> None:
self.accuracy = move.accuracy
self.target = move.target.name
self.damage_class = move.damage_class.name
self.names = move.names

flavor_text = default_or_latest(move.flavor_text_entries, is_english)
if flavor_text is not None:
Expand Down Expand Up @@ -132,17 +135,44 @@ def convert_moves():
for var in old_animations["moves"]:
anims_dex[var["name"]] = var

lang_files = {}

move_entries = []
for name, index in index_map.items():
move = get_move(index)
entry = MoveEntry(move)

for __name in entry.names:
_name = __name.name
lang = utils.get('language', url_to_id(__name.language))
key = f'{lang.iso639}_{lang.iso3166}.json'
items = {}
if key in lang_files:
items = lang_files[key]
items[f"pokemob.move.{entry.name}"] = _name
lang_files[key] = items
del entry.names

move_entries.append(entry)

file = f'./new/moves/entries/{name}.json'
file = open(file, 'w', encoding='utf-8')
json.dump(entry.__dict__, file, indent=2, ensure_ascii=False)
file.close()


for key, dict in lang_files.items():
file = f'./new/assets/pokecube_moves/lang/{key}'
if not os.path.exists(os.path.dirname(file)):
os.makedirs(os.path.dirname(file))
try:
file = open(file, 'w', encoding='utf-8')
json.dump(dict, file, indent=2, ensure_ascii=False)
file.close()
except Exception as err:
print(f'error saving for {key}')
print(err)

for name, value in anims_dex.items():
new_name = convert_old_move_name(name)
if new_name is not None:
Expand Down
6 changes: 3 additions & 3 deletions processing_scripts/database_update/pokedex_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from ignore_list import isIgnored
from legacy_renamer import find_old_name, to_model_form, find_new_name
import utils
from utils import get_form, get_pokemon, get_species, DEFAULT_GENERATION, default_or_latest, get_pokemon_index, url_to_id
from utils import get_form, get_pokemon, get_species, default_or_latest, get_pokemon_index, url_to_id
from moves_converter import convert_old_move_name
import os
from glob import glob
Expand Down Expand Up @@ -436,7 +436,7 @@ def convert_moves(old_moves, name):
values = get_species(i)

for key, dict in lang_files.items():
file = f'./new/lang/{key}'
file = f'./new/assets/pokecube_mobs/lang/{key}'
if not os.path.exists(os.path.dirname(file)):
os.makedirs(os.path.dirname(file))
try:
Expand Down Expand Up @@ -471,4 +471,4 @@ def convert_moves(old_moves, name):
if __name__ == "__main__":
convert_pokedex()
convert_tags()
# convert_assets()
convert_assets()
10 changes: 5 additions & 5 deletions src/main/java/pokecube/api/data/PokedexEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,8 @@ public void postInit()
}
}

public static final String TEXTUREPATH = "entity/textures/";
public static final String TEXTUREPATH = "textures/entity/pokemob/";
public static final String MODELPATH = "models/entity/pokemob/";

public static TimePeriod dawn = new TimePeriod(0.85, 0.05);
public static TimePeriod day = new TimePeriod(0.0, 0.5);
Expand All @@ -773,11 +774,10 @@ public void postInit()

private static final PokedexEntry BLANK = new PokedexEntry(true);

public static final ResourceLocation MODELNO = new ResourceLocation(PokecubeCore.MODID, "entity/models/missingno");
public static final ResourceLocation MODELNO = new ResourceLocation(PokecubeCore.MODID, MODELPATH + "missingno");
public static final ResourceLocation TEXNO = new ResourceLocation(PokecubeCore.MODID,
"entity/textures/missingno.png");
public static final ResourceLocation ANIMNO = new ResourceLocation(PokecubeCore.MODID,
"entity/animations/missingno.xml");
TEXTUREPATH + "missingno.png");
public static final ResourceLocation ANIMNO = new ResourceLocation(PokecubeCore.MODID, MODELPATH + "missingno.xml");

private static void addFromEvolution(final PokedexEntry a, final PokedexEntry b)
{
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/pokecube/core/client/render/mobs/RenderEgg.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
public class RenderEgg extends LivingEntityRenderer<EntityPokemobEgg, ModelWrapper<EntityPokemobEgg>>
implements IModelRenderer<EntityPokemobEgg>
{
static final ResourceLocation TEXTURE = new ResourceLocation(PokecubeCore.MODID, "entity/textures/egg.png");
static final ResourceLocation MODEL = new ResourceLocation(PokecubeCore.MODID, "entity/models/egg");
static final ResourceLocation ANIM = new ResourceLocation(PokecubeCore.MODID, "entity/animations/egg.xml");
static final ResourceLocation TEXTURE = new ResourceLocation(PokecubeCore.MODID, "textures/entity/egg/egg.png");
static final ResourceLocation MODEL = new ResourceLocation(PokecubeCore.MODID, "models/entity/egg/egg");
static final ResourceLocation ANIM = new ResourceLocation(PokecubeCore.MODID, "models/entity/egg/egg.xml");

private static class EggColourer implements IAnimationChanger
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ public void render(final Mob entity, final float entityYaw, final float partialT
}
holder = temp;
}

if (holder.wrapper == null || !holder.wrapper.isLoaded())
{
holder.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ public void accept(PokedexEntry entry)

private void initStage2(PokedexEntry entry)
{
// This can be the case if the entry was removed earlier.
if (entry == null) return;

if (this.interactions != null) entry._loaded_interactions.addAll(this.interactions);
if (this.mega_rules != null) entry._loaded_megarules.addAll(this.mega_rules);

Expand Down Expand Up @@ -297,6 +300,8 @@ private void initStage2(PokedexEntry entry)
entry.model = new ResourceLocation(model + entry.getTrimmedName() + entry.modelExt);
entry.texture = new ResourceLocation(tex + entry.getTrimmedName() + ".png");
entry.animation = new ResourceLocation(anim + entry.getTrimmedName() + ".xml");

PokecubeAPI.LOGGER.info("Paths for {}: {} {} {}", entry.model, entry.texture, entry.animation);
}

if (this.pose_shapes != null && !this.pose_shapes.isEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,8 @@ public static void initFormeModels(final PokedexEntry entry, final List<DefaultF
for (final DefaultFormeHolder holder : list)
{
holder.getForme(entry);
PokecubeAPI.LOGGER.debug("Loaded Forme: " + holder.key + " " + holder.model + " " + holder.tex);
if (PokecubeMod.debug)
PokecubeAPI.LOGGER.debug("Loaded Forme: " + holder.key + " " + holder.model + " " + holder.tex);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/pokecube/core/entity/npc/NpcType.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ public NpcType(String string)

// We will set these as a default here, sub-classes can replace them
// later, or by calling their setters.
this.maleTex = new ResourceLocation(PokecubeMod.ID + ":textures/entity/" + string + "_male.png");
this.femaleTex = new ResourceLocation(PokecubeMod.ID + ":textures/entity/" + string + "_female.png");
this.maleTex = new ResourceLocation(PokecubeMod.ID + ":textures/entity/npc/" + string + "_male.png");
this.femaleTex = new ResourceLocation(PokecubeMod.ID + ":textures/entity/npc/" + string + "_female.png");

if (ForgeRegistries.PROFESSIONS.containsKey(new ResourceLocation(string)))
{
Expand Down
87 changes: 2 additions & 85 deletions src/main/java/pokecube/mobs/PokecubeMobs.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import net.minecraftforge.registries.ForgeRegistries;
import pokecube.api.PokecubeAPI;
import pokecube.api.data.PokedexEntry;
import pokecube.api.data.PokedexEntry.EvolutionData;
import pokecube.api.entity.pokemob.IPokemob;
import pokecube.api.entity.pokemob.IPokemob.Stats;
import pokecube.api.entity.pokemob.PokemobCaps;
Expand Down Expand Up @@ -110,88 +109,6 @@ public void evolveTyrogue(final EvolveEvent.Pre evt)
}
}

private int getGen(PokedexEntry entry)
{
int gen;
if (this.genMap.containsKey(entry)) gen = this.genMap.get(entry);
else
{
gen = entry.getGen();
final PokedexEntry real = entry;
if (entry.getBaseForme() != null) entry = entry.getBaseForme();
for (final EvolutionData d : entry.getEvolutions())
{
int gen1 = d.evolution.getGen();
if (this.genMap.containsKey(d.evolution)) gen1 = this.genMap.get(d.evolution);
if (gen1 < gen) gen = gen1;
for (final EvolutionData d1 : d.evolution.getEvolutions())
{
gen1 = d1.evolution.getGen();
if (this.genMap.containsKey(d1.evolution)) gen1 = this.genMap.get(d1.evolution);
if (d.evolution == entry && gen1 < gen) gen = gen1;
}
}
for (final PokedexEntry e : Database.getSortedFormes())
{
int gen1 = e.getGen();
if (this.genMap.containsKey(e)) gen1 = this.genMap.get(e);
for (final EvolutionData d : e.getEvolutions()) if (d.evolution == entry && gen1 < gen) gen = gen1;
}
this.genMap.put(real, gen);
}
return gen;
}

public String getModelDirectory(final PokedexEntry entry)
{
final int gen = this.getGen(entry);
switch (gen)
{
case 1:
return "gen_1/entity/models/";
case 2:
return "gen_2/entity/models/";
case 3:
return "gen_3/entity/models/";
case 4:
return "gen_4/entity/models/";
case 5:
return "gen_5/entity/models/";
case 6:
return "gen_6/entity/models/";
case 7:
return "gen_7/entity/models/";
case 8:
return "gen_8/entity/models/";
}
return "entity/models/";
}

public String getTextureDirectory(final PokedexEntry entry)
{
final int gen = this.getGen(entry);
switch (gen)
{
case 1:
return "gen_1/entity/textures/";
case 2:
return "gen_2/entity/textures/";
case 3:
return "gen_3/entity/textures/";
case 4:
return "gen_4/entity/textures/";
case 5:
return "gen_5/entity/textures/";
case 6:
return "gen_6/entity/textures/";
case 7:
return "gen_7/entity/textures/";
case 8:
return "gen_8/entity/textures/";
}
return "entity/textures/";
}

@SubscribeEvent
public void livingUpdate(final LivingUpdateEvent evt)
{
Expand Down Expand Up @@ -695,8 +612,8 @@ public void RegisterPokemobsEvent(final RegisterPokemobsEvent.Register event)
{
if (entry == Database.missingno) continue;
if (entry.model != PokedexEntry.MODELNO) continue;
final String tex = this.getTextureDirectory(entry);
final String model = this.getModelDirectory(entry);
final String tex = PokedexEntry.TEXTUREPATH;
final String model = PokedexEntry.MODELPATH;
entry.setModId(PokecubeMobs.MODID);
entry.texturePath = PokecubeMobs.MODID + ":" + tex;
entry.model = new ResourceLocation(PokecubeMobs.MODID, model + entry.getTrimmedName() + entry.modelExt);
Expand Down
85 changes: 85 additions & 0 deletions src/main/resources/assets/pokecube/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,91 @@
{
"_comment": "Pokécube translation",

"_comment": "#Move Messages",

"pokemob.status.curse.user": "%1$s §cwas hurt by the curse",
"pokemob.status.flinch.user": "%1$s §cflinched",
"pokemob.status.confuse.add.user": "%1$s §cis confused",
"pokemob.status.confuse.remove.user": "%1$s §ais no longer confused",
"pokemob.status.confusion.user": "%1$s §churt itself in confusion",
"pokemob.status.infatuate.user": "%1$s §cis immobilized by love",
"pokemob.move.stat.fail.user": "§cThe status effect failed!",

"pokemob.status.curse.target": "%1$s §awas hurt by the curse",
"pokemob.status.flinch.target": "%1$s §aflinched",
"pokemob.status.confuse.add.target": "%1$s §ais confused",
"pokemob.status.confuse.remove.target": "%1$s §cis no longer confused",
"pokemob.status.confusion.target": "%1$s §ahurt itself in confusion",
"pokemob.status.infatuate.target": "%1$s §ais immobilized by love",
"pokemob.move.stat.fail.target": "§aThe status effect failed!",

"pokemob.move.super.effective.user": "§aIt's super effective!",
"pokemob.move.not.very.effective.user": "§cIt's not very effective!",
"pokemob.move.doesnt.affect.user": "§cIt doesn't affect§r %1$s!",
"pokemob.move.critical.hit.user": "§aCritical hit!",

"pokemob.move.super.effective.target": "§cIt's super effective!",
"pokemob.move.not.very.effective.target": "§aIt's not very effective!",
"pokemob.move.doesnt.affect.target": "§aIt doesn't affect§r %1$s!",
"pokemob.move.critical.hit.target": "§cCritical hit!",

"pokemob.move.used.user": "%1$s §aused §c%2$s!",
"pokemob.move.used.target": "%1$s §cenemy used §6%2$s!",

"pokemob.move.stat.fail.user": "§cBut it failed",
"pokemob.move.stat.rise1.user": "%1$s's §6%2$s §arose",
"pokemob.move.stat.rise2.user": "%1$s's §6%2$s §asharply rose",
"pokemob.move.stat.rise3.user": "%1$s's §6%2$s §adrastically rose",
"pokemob.move.stat.fall1.user": "%1$s's §6%2$s §cfell",
"pokemob.move.stat.fall2.user": "%1$s's §6%2$s §charshly fell",
"pokemob.move.stat.fall3.user": "%1$s's §6%2$s §cdrastically fell",

"pokemob.move.stat.fail.target": "§aBut it failed",
"pokemob.move.stat.rise1.target": "%1$s's §6%2$s §crose",
"pokemob.move.stat.rise2.target": "%1$s's §6%2$s §csharply rose",
"pokemob.move.stat.rise3.target": "%1$s's §6%2$s §cdrastically rose",
"pokemob.move.stat.fall1.target": "%1$s's §6%2$s §afell",
"pokemob.move.stat.fall2.target": "%1$s's §6%2$s §aharshly fell",
"pokemob.move.stat.fall3.target": "%1$s's §6%2$s §adrastically fell",

"pokemob.move.stat1": "Attack",
"pokemob.move.stat2": "Defense",
"pokemob.move.stat3": "Special Attack",
"pokemob.move.stat4": "Special Defense",
"pokemob.move.stat5": "Speed",
"pokemob.move.stat6": "Accuracy",
"pokemob.move.stat7": "Evasion",

"pokemob.move.notify.learn": "%1$s Learned %2$s",
"pokemob.move.terraindamage": "%1$s was hurt by the %2$s",

"pokemob.move.missed.user": "§cIt missed§r %1$s!",
"pokemob.move.missed.target": "§aIt missed§r %1$s!",

"pokemob.move.failed.user": "%1$s's §cattack failed!",
"pokemob.move.failed.target": "%1$s's §aattack failed!",

"pokemob.move.isfrozen.user": "%1$s §cis frozen.",
"pokemob.move.issleeping.user": "%1$s §cis sleeping.",
"pokemob.move.isfullyparalyzed.user": "%1$s §cis fully paralyzed.",
"pokemob.move.paralyzed.user": "%1$s §cis paralyzed.",
"pokemob.move.isburned.user": "%1$s §cis burned.",
"pokemob.move.ispoisoned.user": "%1$s §cis poisoned.",
"pokemob.move.isbadlypoisoned.user": "%1$s §cis badly poisoned.",

"pokemob.move.isfrozen.target": "%1$s §ais frozen.",
"pokemob.move.issleeping.target": "%1$s §ais sleeping.",
"pokemob.move.isfullyparalyzed.target": "%1$s §ais fully paralyzed.",
"pokemob.move.paralyzed.target": "%1$s §ais paralyzed.",
"pokemob.move.isburned.target": "%1$s §ais burned.",
"pokemob.move.ispoisoned.target": "%1$s §ais poisoned.",
"pokemob.move.isbadlypoisoned.target": "%1$s §ais badly poisoned.",

"pokemob.move.sketched": "%1$s Sketched %2$s",

"pokemob.move.cooldown": "%1$s §ccannot use %2$s §cright now.",


"_comment": "Key Bindings",

"key.pokemob.next": "Next Pokémob",
Expand Down
Loading

0 comments on commit 641b4e5

Please sign in to comment.