Added MarkovNameGenerator, Added Disable Body Part Feature

Two New Features >>

+ Added Markov Name Generate
+ Corrected Hide Body Parts
This commit is contained in:
KAMKEEL committed 2021-06-13 19:26:00 -04:00
1 parent f155ef2481
commit 3a36be0ae4
47 files changed
+14517 -93

No files matched your search

@@ -0,0 +1,81 @@
package nikedemos.markovnames;
import java.util.HashMap;
import java.util.Map;
public class HashMap2D<T1, T2, T3> {
public final Map<T1, Map<T2, T3>> mMap;
/*
https://stackoverflow.com/a/10299689/9355344
*/
public HashMap2D() {
mMap = new HashMap<T1, Map<T2, T3>>();
}
/**
* Associates the specified value with the specified keys in this map (optional operation). If the map previously
* contained a mapping for the key, the old value is replaced by the specified value.
*
* @param key1
* the first key
* @param key2
* the second key
* @param value
* the value to be set
* @return the value previously associated with (key1,key2), or <code>null</code> if none
* @see Map#put(Object, Object)
*/
public T3 put(T1 key1, T2 key2, T3 value) {
Map<T2, T3> map;
if (mMap.containsKey(key1)) {
map = mMap.get(key1);
} else {
map = new HashMap<T2, T3>();
mMap.put(key1, map);
}
return map.put(key2, value);
}
/**
* Returns the value to which the specified key is mapped, or <code>null</code> if this map contains no mapping for
* the key.
*
* @param key1
* the first key whose associated value is to be returned
* @param key2
* the second key whose associated value is to be returned
* @return the value to which the specified key is mapped, or <code>null</code> if this map contains no mapping for
* the key
* @see Map#get(Object)
*/
public T3 get(T1 key1, T2 key2) {
if (mMap.containsKey(key1)) {
return mMap.get(key1).get(key2);
} else {
return null;
}
}
/**
* Returns <code>true</code> if this map contains a mapping for the specified key
*
* @param key1
* the first key whose presence in this map is to be tested
* @param key2
* the second key whose presence in this map is to be tested
* @return Returns true if this map contains a mapping for the specified key
* @see Map#containsKey(Object)
*/
public boolean containsKeys(T1 key1, T2 key2) {
return mMap.containsKey(key1) && mMap.get(key1).containsKey(key2);
}
public void clear() {
mMap.clear();
}
}
@@ -0,0 +1,53 @@
package nikedemos.markovnames;
import nikedemos.markovnames.generators.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
public class Main {
public static final int GENDER_RANDOM=0;
public static final int GENDER_MALE=1;
public static final int GENDER_FEMALE=2;
public static HashMap<String, MarkovGenerator> GENERATORS = new HashMap<String, MarkovGenerator>();
public static void main(String[] args){
//all the generators neatly in one HashMap, so you can iterate or w/e
GENERATORS.put("ROMAN", new MarkovRoman(3));
GENERATORS.put("JAPANESE", new MarkovJapanese(4));
GENERATORS.put("SLAVIC", new MarkovSlavic(3));
GENERATORS.put("WELSH", new MarkovWelsh(3));
GENERATORS.put("SAAMI", new MarkovSaami(3));
GENERATORS.put("OLDNORSE", new MarkovOldNorse(4));
GENERATORS.put("ANCIENTGREEK", new MarkovAncientGreek(3));
GENERATORS.put("AZTEC", new MarkovAztec(3));
//iterate through generators, generate 5 male and 5 female names, move on to the next
Iterator<Entry<String, MarkovGenerator>> g = GENERATORS.entrySet().iterator();
while (g.hasNext()) {
Entry<String, MarkovGenerator> pair = (Entry<String, MarkovGenerator>) g.next();
System.out.println("==="+pair.getKey()+"===");
for (int i=0; i<16; i++)
{
if (i==0)
System.out.println("GENTLEMEN-----------");
int gender = i<8 ? 1 : 2;
String random_name = pair.getValue().fetch(gender);
System.out.println(random_name);
if (i==15) //extra padding
System.out.println("\n");
else if (i==7) //separate genders
System.out.println("LADIES--------------");
}
}
}
}
@@ -0,0 +1,270 @@
package nikedemos.markovnames;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
public class MarkovDictionary {
private Random rng;
private int sequenceLen = 3;
private HashMap2D<String, String, Integer> occurrences = new HashMap2D<String, String, Integer>();
public MarkovDictionary(String dictionary, int seqlen, Random rng) {
this.rng = rng;
try {
applyDictionary(dictionary, seqlen);
} catch (Exception e) {
e.printStackTrace();
}
}
public MarkovDictionary(String dictionary, int seqlen) {
this(dictionary, seqlen, new Random());
}
public MarkovDictionary(String dictionary) {
this(dictionary, 3, new Random()); // 3 is the default, anyway
}
public MarkovDictionary(String dictionary, Random rng) {
this(dictionary, 3, rng); // 3 is the default, anyway
}
// Blatantly copied from EnderIO:
// https://github.com/SleepyTrousers/EnderIO/blob/master/enderio-base/src/main/java/crazypants/enderio/base/config/recipes/RecipeFactory.java#L44-L57
// Thanks again for your help, Henry Loenwind!
private InputStream getResource(ResourceLocation resourceLocation) {
final ModContainer container = Loader.instance().activeModContainer();
if (container != null) {
final String resourcePath = String.format("/%s/%s/%s", "assets", resourceLocation.getResourceDomain(),
resourceLocation.getResourcePath());
InputStream resourceAsStream = null;
try {
resourceAsStream = container.getMod().getClass().getResourceAsStream(resourcePath);
} catch (Exception e) {
e.printStackTrace();
}
if (resourceAsStream != null) {
return resourceAsStream;
} else {
throw new RuntimeException("Could not find resource " + resourceLocation);
}
} else {
throw new RuntimeException("Failed to find current mod while looking for resource " + resourceLocation);
}
}
public String getCapitalized(String str) {
if (str == null || str.isEmpty())
return str;
char[] chars = str.toCharArray();
chars[0] = Character.toUpperCase(chars[0]);
return new String(chars);
}
public static String readFile(String path) throws IOException {
byte[] encoded = Files.readAllBytes(Paths.get(path));
return new String(encoded, StandardCharsets.UTF_8);
}
public void incrementSafe(String str1, String str2) {
// so for instance, "_DUP_AUX", "_TOTAL" will count how many "DUP" seqCurrs we have
if (occurrences.containsKeys(str1, str2))
{
int curr = occurrences.get(str1, str2).intValue();
occurrences.put(str1, str2, Integer.valueOf(curr + 1));
} else {
occurrences.put(str1, str2, Integer.valueOf(1));
}
}
public String generateWord() {
// let's pick the first element, from which further picking shall proceed.
// first, we need to know how many top-level sequences (sequenceLen length)
// strings
// we have. So just take into account those surrounded by "_" - and count them.
// From that we'll get the weights.
int allEntries = 0;
// first iteration: we count top level entries. There's just no other way.
Iterator<Entry<String, Map<String, Integer>>> i = occurrences.mMap.entrySet().iterator();
while (i.hasNext()) {
Entry<String, Map<String, Integer>> pair = (Entry<String, Map<String, Integer>>) i.next();
String k = pair.getKey();
if (k.startsWith("_[") && k.endsWith("_")) // dealing with meta entry here
{
allEntries += occurrences.get(k, "_TOTAL_");
}
}
if(allEntries == 0) {
return "Kamkeel"; //shouldnt happen
}
int topLevelEntries;
int randomNumber = rng.nextInt(allEntries);
// ok, so how does this weighted random work?
// easy. Check if the randomNumber is LESS than
// topLevelEntries variable for that entry (see below).
// If it is, break the while loop - we got our first element,
// from which we will go further. Just remember to
// remove the underscores at both ends!
Iterator<Entry<String, Map<String, Integer>>> it = occurrences.mMap.entrySet().iterator();
StringBuilder sequence = new StringBuilder("");
while (it.hasNext()) {
Entry<String, Map<String, Integer>> pair = (Entry<String, Map<String, Integer>>) it.next();
String k = pair.getKey();
if (k.startsWith("_[") && k.endsWith("_")) // dealing with meta entry here
{
topLevelEntries = occurrences.get(k, "_TOTAL_");
if (randomNumber < topLevelEntries) {
sequence.append(k.substring(1, sequenceLen + 1)); // removing the underscores
break;
} else {
// keep going
randomNumber -= topLevelEntries;
}
}
}
// great! now that we have the first element, time for some generic iterations.
// in a very similar manner. Basically - perform this loop till you encounter
// "]" at the end
StringBuilder word = new StringBuilder("");
word.append(sequence); // now we're gonna use firstElement to keep the sequence
while (sequence.charAt(sequence.length() - 1) != ']') {
// sequence is now your HashMap key for the 1st dimension.
// for that sequence:
// - get total elements that are not meta (not surrounded by underscores)
// and count their total occurrences
int subSize = 0;
Iterator<Entry<String, Integer>> j = occurrences.mMap.get(sequence.toString()).entrySet().iterator();
while (j.hasNext()) {
Entry<String, Integer> entry = j.next();
subSize += entry.getValue();
}
// and now, the last iterator, with a random, just like before
randomNumber = rng.nextInt(subSize);
Iterator<Entry<String, Integer>> k = occurrences.mMap.get(sequence.toString()).entrySet().iterator();
String chosen = "";
while (k.hasNext()) {
Entry<String, Integer> entry = k.next();
int occu = occurrences.get(sequence.toString(), entry.getKey());
if (randomNumber < occu) {
chosen = entry.getKey();
break;
} else { // keep going!
randomNumber -= occu;
}
}
// now, append the word...
word.append(chosen);
// delete the first character of the sequence,
// and also append it with chosen character.
// So if the Sequence is ABC, and chosen is D,
// it now becomes BCD.
sequence.delete(0, 1);
sequence.append(chosen);
// System.out.println("FINAL: "+sequence);
// System.out.println("CHOSEN: "+chosen);
}
// and now remove the square brackets surrounding it.
return this.getPost(word.substring(1, word.length() - 1));
}
public String getPost(String str) {
return getCapitalized(str);
}
public void applyDictionary(String dictionaryFile, int seqLen) throws IOException {
StringBuilder input = new StringBuilder();
ResourceLocation resource = new ResourceLocation("customnpcs:markovnames/" + dictionaryFile);
BufferedReader readIn = new BufferedReader(new InputStreamReader(getResource(resource), "UTF-8"));
// Thread.currentThread().getContextClassLoader().getResourceAsStream("path/to/resource/file.ext");
for (String line = readIn.readLine(); line != null; line = readIn.readLine()) {
input.append(line).append(" ");
}
readIn.close();
if (input.length() == 0) {
throw new RuntimeException("Resource was empty: + " + resource);
}
// if seqLen != this.sequenceLen, we must clear occurrences
if (this.sequenceLen != seqLen) {
sequenceLen = seqLen;
this.occurrences.clear();
}
String input_str = '[' + input.toString().toLowerCase().replaceAll("[\\t\\n\\r\\s]+", "][") + ']';
int maxCursorPos = input_str.length() - 1 - sequenceLen;
for (int i = 0; i <= maxCursorPos; i++) {
String seqCurr = input_str.substring(i, i + (sequenceLen)); // i plus 2 characters next to it
String seqNext = input_str.substring(i + sequenceLen, i + sequenceLen + 1); // next character after that
incrementSafe(seqCurr, seqNext);
// aux counters
StringBuilder meta = new StringBuilder("_").append(seqCurr).append("_");
// String aux1="_"+seqCurr+"_";
incrementSafe(meta.toString(), "_TOTAL_");
// String aux2="_"+seqNext+"_";
// incrementSafe(aux1, aux2);
// debug, feel free to uncomment
/*
* System.out.println("<"+seqCurr+"><"+seqNext+"> => "+occurrences.get(seqCurr,
* seqNext));
* System.out.println("<"+aux1+"><"+"_TOTAL_"+"> => "+occurrences.get(aux1,
* "_TOTAL_"));
* System.out.println("<"+aux1+"><"+aux2+"> => "+occurrences.get(aux1, aux2));
* System.out.println("");
*/
}
// by now, we should have
}
}
@@ -0,0 +1,41 @@
package nikedemos.markovnames;
import java.util.Random;
//used exclusively by the Spanish surname dictionary - because the capitalization is a little bit different
public class MarkovDictionarySPA extends MarkovDictionary {
public MarkovDictionarySPA(String dictionary, int seqlen, Random rng) {
super(dictionary, seqlen, rng);
// TODO Auto-generated constructor stub
}
@Override
public String getPost(String str) {
return getCapitalizedSPA(str);
}
public String getCapitalizedSPA(String str) {
// for spanish capitalization
String[] parts = str.split("#");
StringBuilder build = new StringBuilder("");
for (int p = 0; p < parts.length; p++) {
// capitalize this part, but only if it's not "de", "del", "la" or "los"
if (!parts[p].equals("de") && !parts[p].equals("del") && !parts[p].equals("la")
&& !parts[p].equals("los")) {
parts[p] = getCapitalized(parts[p]);
}
if (p > 0) // don't add spaces before the first part
build.append(" ");
build.append(parts[p]);
}
return build.toString();
}
}
@@ -0,0 +1,58 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovAncientGreek extends MarkovGenerator {
public MarkovDictionary markov2;
public MarkovAncientGreek(int seqlen, Random rng)
{
this.rng = rng;
this.markov = new MarkovDictionary("ancient_greek_male.txt",seqlen,rng);
this.markov2 = new MarkovDictionary("ancient_greek_female.txt",seqlen,rng);
}
public MarkovAncientGreek(int seqlen)
{
this(seqlen,new Random());
}
public MarkovAncientGreek()
{
this(3, new Random()); //3 seems best-suited for Welsh
}
@Override
public String fetch(int gender)
{
String seq1;
//check the gender.
//0 = random gender, 1 = male, 2 = female
//if there's no gender specified (0),
//now it's time to pick it at random
//
if (gender==0)
{
gender = rng.nextBoolean()==true? 1 : 2;
}
//now if it's 2 - a lady - feminize the 3 sequences
if (gender==2)
{
seq1 = markov2.generateWord();
}
else
{
seq1 = markov.generateWord();
}
return seq1;
}
}
@@ -0,0 +1,31 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovAztec extends MarkovGenerator {
public MarkovAztec(int seqlen, Random rng)
{
this.rng = rng;
this.markov = new MarkovDictionary("aztec_given.txt",seqlen,rng);
}
public MarkovAztec(int seqlen)
{
this(seqlen,new Random());
}
public MarkovAztec()
{
this(3, new Random()); //3 seems best-suited for Aztec
}
@Override
public String fetch(int gender) //Aztec names are genderless
{
return markov.generateWord();
}
}
@@ -0,0 +1,40 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
/* This implementation is made specifically for
* CustomNPCs, one of the best Minecraft mods ever...
* I'm a huge fan and would recommend it to anyone.
* Check it out if you haven't yet, at
* http://www.kodevelopment.nl/minecraft/category/customnpcs/
* Minecraft 1.12.2 Java Edition + Forge required.
* Also, you have to like cats, it's in CNPCs EULA, I'm quite sure
*/
public class MarkovCustomNPCsClassic extends MarkovGenerator {
public MarkovCustomNPCsClassic(int seqlen, Random rng)
{
this.rng = rng;
this.markov = new MarkovDictionary("customnpcs_classic.txt",seqlen,rng);
}
public MarkovCustomNPCsClassic(int seqlen)
{
this(seqlen,new Random());
}
public MarkovCustomNPCsClassic()
{
this(3, new Random());
}
@Override
public String fetch(int gender)
{
return markov.generateWord();
}
}
@@ -0,0 +1,46 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovGenerator {
public MarkovDictionary markov;
public Random rng;
public String name;
public String symbol;
public MarkovGenerator(int seqlen, Random rng)
{
this.rng = rng;
}
public MarkovGenerator(int seqlen)
{
this(seqlen, new Random());
}
public MarkovGenerator()
{
this(3, new Random());
}
public String fetch(int gender) {
return stylize(markov.generateWord());
}
public String fetch()
{
return fetch(0); //0 = random gender, 1 = male, 2 = female
}
public String stylize(String str)
{
return str;
}
public String feminize(String element, boolean flag) {
return element;
}
}
@@ -0,0 +1,51 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovJapanese extends MarkovGenerator {
public MarkovDictionary markov2;
public MarkovDictionary markov3;
public MarkovJapanese(int seqlen, Random rng) {
this.rng = rng;
this.markov = new MarkovDictionary("japanese_surnames.txt", seqlen, rng);
this.markov2 = new MarkovDictionary("japanese_given_male.txt", seqlen, rng);
this.markov3 = new MarkovDictionary("japanese_given_female.txt", seqlen, rng);
}
public MarkovJapanese(int seqlen) {
this(seqlen, new Random());
}
public MarkovJapanese() {
this(4, new Random()); // 4 seems best suited for Japanese
}
@Override
public String fetch(int gender) {
StringBuilder name = new StringBuilder(markov.generateWord());
name.append(" ");
// check the gender.
// 0 = random gender, 1 = male, 2 = female
// if there's no gender specified (0),
// now it's time to pick it at random
//
if (gender == 0) {
gender = rng.nextBoolean() == true ? 1 : 2;
}
if (gender == 2) {
name.append(markov3.generateWord());
}
else {
name.append(markov2.generateWord());
}
return name.toString();
}
}
@@ -0,0 +1,32 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovOldNorse extends MarkovGenerator {
public MarkovDictionary markov2;
public MarkovOldNorse(int seqlen, Random rng)
{
this.rng = rng;
this.markov = new MarkovDictionary("old_norse_bothgenders.txt",seqlen,rng);
}
public MarkovOldNorse(int seqlen)
{
this(seqlen,new Random());
}
public MarkovOldNorse()
{
this(4, new Random()); //4 seems best-suited for Old Norse
}
@Override
public String fetch(int gender) //Old Norse names are genderless
{
return markov.generateWord();
}
}
@@ -0,0 +1,65 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovRoman extends MarkovGenerator {
public MarkovDictionary markov2;
public MarkovDictionary markov3;
public MarkovRoman(int seqlen, Random rng) {
this.rng = rng;
this.markov = new MarkovDictionary("roman_praenomina.txt", seqlen, rng);
this.markov2 = new MarkovDictionary("roman_nomina.txt", seqlen, rng);
this.markov3 = new MarkovDictionary("roman_cognomina.txt", seqlen, rng);
}
public MarkovRoman(int seqlen) {
this(seqlen, new Random());
}
public MarkovRoman() {
this(3, new Random());
}
@Override
public String feminize(String element, boolean flag) {
// change "us" into "a" and "o" at the end into "a"
if (element.endsWith("us")) {
element = element.substring(0, element.length() - 2) + "a";
}
else if (element.endsWith("o")) {
element = element.substring(0, element.length() - 2) + "a";
}
return element;
}
@Override
public String fetch(int gender) {
String seq1 = markov.generateWord();
String seq2 = markov2.generateWord();
String seq3 = markov3.generateWord();
// check the gender.
// 0 = random gender, 1 = male, 2 = female
// if there's no gender specified (0),
// now it's time to pick it at random
//
if (gender == 0) {
gender = rng.nextBoolean() == true ? 1 : 2;
}
// now if it's 2 - a lady - feminize the 3 sequences
if (gender == 2) {
seq1 = feminize(seq1, false);
seq2 = feminize(seq2, false);
seq3 = feminize(seq3, true);
}
return (new StringBuilder(seq1).append(" ").append(seq2).append(" ").append(seq3).toString());
}
}
@@ -0,0 +1,33 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovSaami extends MarkovGenerator {
public MarkovDictionary markov2;
public MarkovSaami(int seqlen, Random rng)
{
this.rng = rng;
this.markov = new MarkovDictionary("saami_bothgenders.txt",seqlen,rng);
}
public MarkovSaami(int seqlen)
{
this(seqlen,new Random());
}
public MarkovSaami()
{
this(3, new Random()); //3 seems best-suited for Saami
}
@Override
public String fetch(int gender) //Saami names are genderless
{
return markov.generateWord();
}
}
@@ -0,0 +1,59 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovSlavic extends MarkovGenerator {
public MarkovSlavic(int seqlen, Random rng) {
this.rng = rng;
this.markov = new MarkovDictionary("slavic_given.txt", seqlen, rng);
}
public MarkovSlavic(int seqlen) {
this(seqlen, new Random());
}
public MarkovSlavic() {
this(3, new Random()); // 3 seems best-suited for Slavic
}
@Override
public String feminize(String element, boolean flag) {
// add "a" at the end, if there isn't one
String lastChar = element.substring(element.length() - 1);
if (element.endsWith("o")) {
element = element.substring(0, element.length() - 1) + "a";
}
else if (!lastChar.endsWith("a")) {
element += "a";
}
return element;
}
@Override
public String fetch(int gender) {
String seq1 = markov.generateWord();
// check the gender.
// 0 = random gender, 1 = male, 2 = female
// if there's no gender specified (0),
// now it's time to pick it at random
//
if (gender == 0) {
gender = rng.nextBoolean() == true ? 1 : 2;
}
// now if it's 2 - a lady - feminize the 3 sequences
if (gender == 2) {
seq1 = feminize(seq1, false);
}
return seq1;
}
}
@@ -0,0 +1,52 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import nikedemos.markovnames.MarkovDictionarySPA;
import java.util.Random;
public class MarkovSpanish extends MarkovGenerator {
public MarkovDictionary markov2;
public MarkovDictionary markov3;
public MarkovSpanish(int seqlen, Random rng) {
this.rng = rng;
this.markov = new MarkovDictionary("spanish_given_male.txt", seqlen, rng);
this.markov2 = new MarkovDictionary("spanish_given_female.txt", seqlen, rng);
this.markov3 = new MarkovDictionarySPA("spanish_surnames.txt", seqlen, rng);
}
public MarkovSpanish(int seqlen) {
this(seqlen, new Random());
}
public MarkovSpanish() {
this(3, new Random());
}
@Override
public String fetch(int gender) {
String giv = "";
String sur = markov3.generateWord();
// check the gender.
// 0 = random gender, 1 = male, 2 = female
// if there's no gender specified (0),
// now it's time to pick it at random
//
if (gender == 0) {
gender = rng.nextBoolean() == true ? 1 : 2;
}
if (gender == 1) {
giv = markov.generateWord();
}
else {
giv = markov2.generateWord();
}
return new StringBuilder(giv).append(" ").append(sur).toString();
}
}
@@ -0,0 +1,50 @@
package nikedemos.markovnames.generators;
import nikedemos.markovnames.MarkovDictionary;
import java.util.Random;
public class MarkovWelsh extends MarkovGenerator {
public MarkovDictionary markov2;
public MarkovWelsh(int seqlen, Random rng) {
this.rng = rng;
this.markov = new MarkovDictionary("welsh_male.txt", seqlen, rng);
this.markov2 = new MarkovDictionary("welsh_female.txt", seqlen, rng);
}
public MarkovWelsh(int seqlen) {
this(seqlen, new Random());
}
public MarkovWelsh() {
this(3, new Random()); // 3 seems best-suited for Welsh
}
@Override
public String fetch(int gender) {
String seq1;
// check the gender.
// 0 = random gender, 1 = male, 2 = female
// if there's no gender specified (0),
// now it's time to pick it at random
//
if (gender == 0) {
gender = rng.nextBoolean() == true ? 1 : 2;
}
// now if it's 2 - a lady - feminize the 3 sequences
if (gender == 2) {
seq1 = markov2.generateWord();
}
else {
seq1 = markov.generateWord();
}
return seq1;
}
}
+21 -6
View File
@@ -7,11 +7,7 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.network.FMLEventChannel;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
@@ -26,6 +22,7 @@ import net.minecraft.entity.EntityList;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.MinecraftForge;
import nikedemos.markovnames.generators.*;
import noppes.npcs.config.ConfigLoader;
import noppes.npcs.config.ConfigProp;
import noppes.npcs.controllers.BankController;
@@ -63,7 +60,7 @@ import noppes.npcs.entity.old.EntityNpcNagaFemale;
import noppes.npcs.entity.old.EntityNpcNagaMale;
import noppes.npcs.entity.old.EntityNpcSkeleton;
@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.0.1")
@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.2")
public class CustomNpcs {
@ConfigProp(info = "Disable Chat Bubbles")
@@ -142,6 +139,8 @@ public class CustomNpcs {
public static ConfigLoader Config;
public static final MarkovGenerator[] MARKOV_GENERATOR = new MarkovGenerator[10];
public CustomNpcs() {
instance = this;
}
@@ -218,6 +217,22 @@ public class CustomNpcs {
PixelmonHelper.load();
}
@EventHandler
public void load(FMLInitializationEvent ev) {
MARKOV_GENERATOR[0] = new MarkovRoman(3);
MARKOV_GENERATOR[1] = new MarkovJapanese(4);
MARKOV_GENERATOR[2] = new MarkovSlavic(3);
MARKOV_GENERATOR[3] = new MarkovWelsh(3);
MARKOV_GENERATOR[4] = new MarkovSaami(3);
MARKOV_GENERATOR[5] = new MarkovOldNorse(4);
MARKOV_GENERATOR[6] = new MarkovAncientGreek(3);
MARKOV_GENERATOR[7] = new MarkovAztec(3);
MARKOV_GENERATOR[8] = new MarkovCustomNPCsClassic(3);
MARKOV_GENERATOR[9] = new MarkovSpanish(3);
}
@EventHandler
public void setAboutToStart(FMLServerAboutToStartEvent event) {
ChunkController.instance.clear();
+65 -11
View File
@@ -19,6 +19,9 @@ public class DataDisplay {
public String name;
public String title = "";
private int markovGeneratorId = 8; //roman,japanese,slavic,welsh,sami,oldnorse,ancientgreek,aztec,classic,spanish (0 - 9 inclusively)
private int markovGender = 0; //0:random, 1:male, 2:female
public byte skinType = 0; //0:normal, 1:player, 2:url, 3:url64
public String url = "";
@@ -42,6 +45,12 @@ public class DataDisplay {
public DataDisplay(EntityNPCInterface npc){
this.npc = npc;
/*
Implementing MarkovNames generator. You can blame this blunder on Nikedemos.
Please refer to nikedemos.markovnames.generators.MarkovCustomNPCsClassic.java
String[] names = { "Noppes", "Noppes", "Noppes", "Noppes", "Atesson",
"Rothcersul", "Achdranys", "Pegato", "Chald", "Gareld",
"Nalworche", "Ineald", "Tia'kim", "Torerod", "Turturdar",
@@ -52,23 +61,34 @@ public class DataDisplay {
"Issraya", "Arisotura", "Honf", "Rilfom", "Estz", "Ghatroth",
"Yosil", "Darage", "Aldny", "Tyltran", "Armos", "Loxiku",
"Burhat", "Tinlt", "Ightyd", "Mia",
"Ken", "Karla", "Lily", "Carina", "Daniel", "Slater", "Zidane", "Valentine", "Eirina",
"Carnow", "Grave", "Shadow", "Drakken", "Kaoz", "Silk", "Drake", "Oldam", "Lynxx", "Lenyx",
"Winter", "Seth", "Apolitho", "Amethyst", "Ankin", "Seinkan", "Ayumu", "Sakamoto", "Divina",
"Div", "Magia", "Magnus", "Tiakono", "Ruin", "Hailinx", "Ethan", "Wate", "Carter", "William",
"Ken", "Karla", "Lily", "Carina", "Daniel", "Slater", "Zidane", "Valentine", "Eirina",
"Carnow", "Grave", "Shadow", "Drakken", "Kaoz", "Silk", "Drake", "Oldam", "Lynxx", "Lenyx",
"Winter", "Seth", "Apolitho", "Amethyst", "Ankin", "Seinkan", "Ayumu", "Sakamoto", "Divina",
"Div", "Magia", "Magnus", "Tiakono", "Ruin", "Hailinx", "Ethan", "Wate", "Carter", "William",
"Brion", "Sparrow", "Basrrelen", "Gyaku", "Claire", "Crowfeather", "Blackwell", "Raven", "Farcri",
"Lucas", "Bangheart", "Kamoku", "Kyoukan", "Blaze", "Benjamin", "Larianne", "Kakaragon",
"Melancholy", "Epodyno", "Thanato", "Mika", "Dacks", "Ylander", "Neve", "Meadow", "Cuero",
"Embrera", "Eldamore", "Faolan", "Chim", "Nasu", "Kathrine", "Ariel", "Arei", "Demytrix",
"Kora", "Ava", "Larson", "Leonardo", "Wyrl", "Sakiama", "Lambton", "Kederath", "Malus", "Riplette",
"Andern", "Ezall", "Lucien", "Droco", "Cray", "Tymen", "Zenix", "Entranger",
"Lucas", "Bangheart", "Kamoku", "Kyoukan", "Blaze", "Benjamin", "Larianne", "Kakaragon",
"Melancholy", "Epodyno", "Thanato", "Mika", "Dacks", "Ylander", "Neve", "Meadow", "Cuero",
"Embrera", "Eldamore", "Faolan", "Chim", "Nasu", "Kathrine", "Ariel", "Arei", "Demytrix",
"Kora", "Ava", "Larson", "Leonardo", "Wyrl", "Sakiama", "Lambton", "Kederath", "Malus", "Riplette",
"Andern", "Ezall", "Lucien", "Droco", "Cray", "Tymen", "Zenix", "Entranger",
"Saenorath", "Chris", "Christine", "Marble", "Mable", "Ross", "Rose", "Xalgan ", "Kennet", "Kamkeel"
};
name = names[new Random().nextInt(names.length)];
*/
markovGeneratorId = new Random().nextInt(CustomNpcs.MARKOV_GENERATOR.length-1);
name = getRandomName();
}
public String getRandomName() {
return CustomNpcs.MARKOV_GENERATOR[markovGeneratorId].fetch(markovGender);
}
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setString("Name", name);
nbttagcompound.setInteger("MarkovGeneratorId", markovGeneratorId);
nbttagcompound.setInteger("MarkovGender", markovGender);
nbttagcompound.setString("Title", title);
nbttagcompound.setString("SkinUrl", url);
nbttagcompound.setString("Texture", texture);
@@ -95,7 +115,10 @@ public class DataDisplay {
return nbttagcompound;
}
public void readToNBT(NBTTagCompound nbttagcompound) {
name = nbttagcompound.getString("Name");
setName(nbttagcompound.getString("Name"));
setMarkovGeneratorId(nbttagcompound.getInteger("MarkovGeneratorId"));
setMarkovGender(nbttagcompound.getInteger("MarkovGender"));
title = nbttagcompound.getString("Title");
url = nbttagcompound.getString("SkinUrl");
@@ -173,4 +196,35 @@ public class DataDisplay {
npc.updateClient = true;
}
public String getName(){
return name;
}
public void setName(String name){
if(this.name.equals(name))
return;
this.name = name;
npc.updateClient = true;
}
public int getMarkovGender(){
return markovGender;
}
public void setMarkovGender(int gender) {
if(markovGender == gender)
return;
this.markovGender = ValueUtil.CorrectInt(gender, 0, 2);
}
public int getMarkovGeneratorId(){
return markovGeneratorId;
}
public void setMarkovGeneratorId(int id) {
if(markovGeneratorId == id)
return;
this.markovGeneratorId = ValueUtil.CorrectInt(id, 0, CustomNpcs.MARKOV_GENERATOR.length-1);
}
}
@@ -27,13 +27,18 @@ public class ModelDataShared{
private HashMap<String,ModelPartData> parts = new HashMap<String,ModelPartData>();
public byte breasts = 0;
// Enabled vs Disabled
public byte headwear = 2;
public byte bodywear = 0;
public byte armwear = 0;
public byte legwear = 0;
// Hide Body Parts [0: None, 1: Both, 2: Right, 3: Left],
public byte hideHead = 0;
public byte hideBody = 0;
public byte hideArms = 0;
public byte hideLegs = 0;
public NBTTagCompound writeToNBT(){
NBTTagCompound compound = new NBTTagCompound();
@@ -0,0 +1,63 @@
package noppes.npcs.client.gui;
import net.minecraft.client.gui.GuiButton;
import noppes.npcs.DataDisplay;
import noppes.npcs.client.gui.mainmenu.GuiNpcDisplay;
import noppes.npcs.client.gui.util.*;
public class SubGuiNpcName extends SubGuiInterface implements ITextfieldListener {
private DataDisplay display;
public SubGuiNpcName(DataDisplay display){
this.display = display;
setBackground("menubg.png");
xSize = 256;
ySize = 216;
closeOnEsc = true;
}
@Override
public void initGui(){
super.initGui();
int y = guiTop + 4;
addButton(new GuiNpcButton(66, guiLeft + xSize - 24, y, 20, 20, "X"));
addTextField(new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 4, y += 50, 226, 20, display.name));
this.addButton(new GuiButtonBiDirectional(1, guiLeft + 4, y += 22 , 200, 20, new String[] {"markov.roman.name", "markov.japanese.name", "markov.slavic.name", "markov.welsh.name", "markov.sami.name", "markov.oldNorse.name", "markov.ancientGreek.name", "markov.aztec.name", "markov.classicCNPCs.name", "markov.spanish.name"}, display.getMarkovGeneratorId()));
this.addButton(new GuiButtonBiDirectional(2, guiLeft + 64, y += 22 , 120, 20, new String[] {"markov.gender.either", "markov.gender.male", "markov.gender.female"}, display.getMarkovGender()));
addLabel(new GuiNpcLabel(2,"markov.gender.name", guiLeft + 5, y + 5));
addButton(new GuiNpcButton(3, guiLeft + 4, y += 42, 70, 20, "markov.generate"));
}
@Override
public void unFocused(GuiNpcTextField textfield) {
if(textfield.id == 0){
if(!textfield.isEmpty())
display.setName(textfield.getText());
else
textfield.setText(display.getName());
}
}
@Override
protected void actionPerformed(GuiButton guibutton){
GuiNpcButton button = (GuiNpcButton) guibutton;
if(button.id == 1) {
display.setMarkovGeneratorId(button.getValue());
}
if(button.id == 2) {
display.setMarkovGender(button.getValue());
}
if(button.id == 3) {
String name = display.getRandomName();
display.setName(name);
getTextField(0).setText(name);
((GuiNpcDisplay)parent).nameText.setText(name);
}
if(button.id == 66){
close();
}
}
}
@@ -10,14 +10,9 @@ import noppes.npcs.client.NoppesUtil;
import noppes.npcs.client.gui.GuiNPCTextures;
import noppes.npcs.client.gui.GuiNpcTextureCloaks;
import noppes.npcs.client.gui.GuiNpcTextureOverlays;
import noppes.npcs.client.gui.SubGuiNpcName;
import noppes.npcs.client.gui.model.GuiCreationScreen;
import noppes.npcs.client.gui.util.GuiHoverText;
import noppes.npcs.client.gui.util.GuiNPCInterface2;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.client.gui.util.ITextfieldListener;
import noppes.npcs.client.gui.util.*;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityNPCInterface;
@@ -25,6 +20,7 @@ import noppes.npcs.entity.EntityNPCInterface;
public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListener, IGuiData{
private DataDisplay display;
public GuiNpcTextField nameText;
public GuiNpcDisplay(EntityNPCInterface npc) {
super(npc,1);
@@ -35,9 +31,20 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
public void initGui(){
super.initGui();
int y = guiTop + 4;
addLabel(new GuiNpcLabel(0,"gui.name", guiLeft + 5, y + 5));
addTextField(new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 50, y, 200, 20, display.name));
this.addButton(new GuiNpcButton(0, guiLeft + 253, y , 110, 20, new String[]{"display.show","display.hide","display.showAttacking"} ,display.showName));
// Old Implementation
// addLabel(new GuiNpcLabel(0,"gui.name", guiLeft + 5, y + 5));
// addTextField(new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 50, y, 200, 20, display.name));
// this.addButton(new GuiNpcButton(0, guiLeft + 253, y , 110, 20, new String[]{"display.show","display.hide","display.showAttacking"} ,display.showName));
addLabel(new GuiNpcLabel(0,"gui.name", guiLeft + 5, y + 5));
nameText = new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 50, y, 206, 20, display.name);
addTextField(nameText);
this.addButton(new GuiNpcButton(0, guiLeft + 253+52, y , 110, 20, new String[]{"display.show","display.hide","display.showAttacking"} ,display.showName));
this.addButton(new GuiNpcButton(14, guiLeft + 259, y , 20, 20, Character.toString('\u21bb')));
this.addButton(new GuiNpcButton(15, guiLeft + 259 + 22, y , 20, 20, Character.toString('\u22EE')));
y+=23;
addLabel(new GuiNpcLabel(11,"gui.title", guiLeft + 5, y + 5));
@@ -163,6 +170,14 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
else if(button.id == 10){
display.showBossBar = (byte)button.getValue();
}
else if(button.id == 14){
String name = display.getRandomName();
display.setName(name);
getTextField(0).setText(name);
}
else if(button.id == 15){
setSubGui(new SubGuiNpcName(display));
}
}
@Override
@@ -10,8 +10,9 @@ import noppes.npcs.entity.EntityCustomNpc;
public class GuiModelArms extends GuiModelInterface{
private final String[] arrArm = new String[]{"gui.no","Both","Right","Left"};
private final String[] arrArmwear = new String[]{"gui.no","Both","Left","Right"};
private final String[] arrParticles = new String[]{"gui.no","Both","Left","Right"};
private final String[] arrClaws = new String[]{"gui.no","Both","Left","Right"};
private GuiScreen parent;
public GuiModelArms(GuiScreen parent, EntityCustomNpc npc){
@@ -25,13 +26,16 @@ public class GuiModelArms extends GuiModelInterface{
super.initGui();
int y = guiTop + 20;
addButton(new GuiNpcButton(30, guiLeft + 50, y += 22, 70, 20, arrArm, playerdata.hideArms));
addLabel(new GuiNpcLabel(30, "Hide", guiLeft, y + 5, 0xFFFFFF));
if (npc.display.modelType == 1 || npc.display.modelType == 2) {
addButton(new GuiNpcButton(8, guiLeft + 50, y += 22, 70, 20, arrArmwear, playerdata.armwear));
addLabel(new GuiNpcLabel(8, "Armwear", guiLeft, y + 5, 0xFFFFFF));
}
ModelPartData claws = playerdata.getPartData("claws");
addButton(new GuiNpcButton(0, guiLeft + 50, y += 22, 70, 20, arrParticles, claws == null?0:claws.type + 1));
addButton(new GuiNpcButton(0, guiLeft + 50, y += 22, 70, 20, arrClaws, claws == null?0:claws.type + 1));
addLabel(new GuiNpcLabel(0, "Claws", guiLeft, y + 5, 0xFFFFFF));
if(claws != null)
addButton(new GuiNpcButton(10, guiLeft + 122, y, 40, 20, claws.getColor()));
@@ -46,6 +50,9 @@ public class GuiModelArms extends GuiModelInterface{
if(button.id == 8){
playerdata.armwear = (byte) button.getValue();
}
if(button.id == 30){
playerdata.hideArms = (byte) button.getValue();
}
if(button.id == 0){
if(button.getValue() == 0)
playerdata.removePart("claws");
@@ -11,6 +11,7 @@ import noppes.npcs.entity.EntityCustomNpc;
public class GuiModelBody extends GuiModelInterface{
private GuiScreen parent;
private final String[] arrBody = new String[]{"gui.no","gui.yes"};
private final String[] arrBodywear = new String[]{"gui.no","gui.yes"};
private final String[] arrWing = new String[]{"gui.no","Player","Type1","Type2","Type3","Type4","Type5","Type6","Type7","Type8","Type9",
"Type10","Type11","Type12","Type13"};
@@ -31,6 +32,9 @@ public class GuiModelBody extends GuiModelInterface{
int y = guiTop + 20;
addButton(new GuiNpcButton(30, guiLeft + 50, y += 22, 70, 20, arrBody, playerdata.hideBody));
addLabel(new GuiNpcLabel(30, "Hide", guiLeft, y + 5, 0xFFFFFF));
if (npc.display.modelType == 1 || npc.display.modelType == 2) {
addButton(new GuiNpcButton(8, guiLeft + 50, y += 22, 70, 20, arrBodywear, playerdata.bodywear));
addLabel(new GuiNpcLabel(8, "Bodywear", guiLeft, y + 5, 0xFFFFFF));
@@ -87,17 +91,27 @@ public class GuiModelBody extends GuiModelInterface{
return 0;
}
private int getSkirtindex(ModelPartData skirt) {
if (skirt == null)
return 0;
if (skirt.type == 0) {
if (skirt.playerTexture)
return 1;
if (skirt.texture.contains("1"))
return 2;
}
return 0;
}
private int getSkirtindex(ModelPartData skirt) {
if(skirt == null)
return 0;
if(skirt.type == 0){
if(skirt.playerTexture)
return 1;
if(skirt.texture.contains("1"))
return 2;
if(skirt.texture.contains("2"))
return 3;
if(skirt.texture.contains("3"))
return 4;
if(skirt.texture.contains("4"))
return 5;
if(skirt.texture.contains("5"))
return 6;
if(skirt.texture.contains("6"))
return 7;
}
return 0;
}
private int getParticleIndex(ModelPartData particles) {
if(particles == null)
@@ -202,11 +216,11 @@ public class GuiModelBody extends GuiModelInterface{
if(value == 0)
playerdata.removePart("skirt");
else{
ModelPartData particles = playerdata.getOrCreatePart("skirt");
ModelPartData skirt = playerdata.getOrCreatePart("skirt");
if(value == 1)
particles.setTexture("", 0);
skirt.setTexture("", 0);
if(value == 2)
particles.setTexture("skirt/skirt1", 0);
skirt.setTexture("skirt/skirt1", 0);
}
initGui();
}
@@ -215,6 +229,10 @@ public class GuiModelBody extends GuiModelInterface{
playerdata.bodywear = (byte) button.getValue();
}
if(button.id == 30){
playerdata.hideBody = (byte) button.getValue();
}
if(button.id == 11){
this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("wings"), npc));
}
@@ -12,6 +12,7 @@ public class GuiModelHead extends GuiModelInterface{
private GuiScreen parent;
private final String[] arrHead = new String[]{"gui.no","gui.yes"};
private final String[] arrHeadwear = new String[]{"gui.no","gui.yes","Solid"};
private final String[] arrHair = new String[]{"gui.no","Player","Long","Thin","Stylish","Ponytail"};
private final String[] arrBeard = new String[]{"gui.no","Player","Standard","Viking","Long","Short"};
@@ -33,6 +34,9 @@ public class GuiModelHead extends GuiModelInterface{
int y = guiTop + 20;
addButton(new GuiNpcButton(30, guiLeft + 50, y += 22, 70, 20, arrHead, playerdata.hideHead));
addLabel(new GuiNpcLabel(30, "Hide", guiLeft, y + 5, 0xFFFFFF));
addButton(new GuiNpcButton(0, guiLeft + 50, y += 22, 70, 20, arrHeadwear, playerdata.headwear));
addLabel(new GuiNpcLabel(0, "Headwear", guiLeft, y + 5, 0xFFFFFF));
@@ -108,6 +112,10 @@ public class GuiModelHead extends GuiModelInterface{
playerdata.headwear = (byte) button.getValue();
}
if(button.id == 30){
playerdata.hideHead = (byte) button.getValue();
}
if(button.id == 1){
if(button.getValue() == 0)
playerdata.removePart("hair");
@@ -11,6 +11,7 @@ import noppes.npcs.entity.EntityCustomNpc;
public class GuiModelLegs extends GuiModelInterface{
private GuiScreen parent;
private final String[] arrLeg = new String[]{"gui.no","Both","Right","Left"};
private final String[] arrLegwear = new String[]{"gui.no","Both","Left","Right"};
private final String[] arrLegs = new String[]{"gui.no","Player","Player Naga","Spider","Horse","Naga", "Mermaid", "Mermaid 2", "Digitigrade"};
private final String[] arrTail = new String[]{"gui.no","Player", "Player Dragon","Cat","Wolf","Horse","Dragon", "Squirrel", "Fin", "Rodent", "Feather"};
@@ -25,6 +26,9 @@ public class GuiModelLegs extends GuiModelInterface{
super.initGui();
int y = guiTop + 20;
addButton(new GuiNpcButton(30, guiLeft + 50, y += 22, 70, 20, arrLeg, playerdata.hideLegs));
addLabel(new GuiNpcLabel(30, "Hide", guiLeft, y + 5, 0xFFFFFF));
if (npc.display.modelType == 1 || npc.display.modelType == 2) {
addButton(new GuiNpcButton(8, guiLeft + 50, y += 22, 70, 20, arrLegwear, playerdata.legwear));
addLabel(new GuiNpcLabel(8, "Legwear", guiLeft, y + 5, 0xFFFFFF));
@@ -47,23 +51,11 @@ public class GuiModelLegs extends GuiModelInterface{
return 5;
if(data.type == 4)
return 6;
// if(data.type == 6)
// return 7;
if(data.type == 5)
return 8;
return data.type + 1;
}
// private int getLegIndex(ModelPartData data) {
// if(!data.playerTexture && data.type == 1)
// return 5;
// if(data.type == 4)
// return 6;
// if(data.type == 5)
// return 7;
// return data.type + 1;
// }
private int getTailIndex(ModelPartData data){
if(data == null)
return 0;
@@ -99,6 +91,9 @@ public class GuiModelLegs extends GuiModelInterface{
if(button.id == 8){
playerdata.legwear = (byte) button.getValue();
}
if(button.id == 30){
playerdata.hideLegs = (byte) button.getValue();
}
if(button.id == 1){
ModelPartData data = playerdata.legParts;
int value = button.getValue() - 1;
@@ -489,6 +489,10 @@ public class ModelMPM extends ModelNPCMale{
GL11.glTranslatef((float)Math.sin(dancing) * 0.075F, (float)Math.abs(Math.cos(dancing)) * 0.125F - 0.02F, (float)(-Math.abs(Math.cos(dancing))) * 0.075F);
}
ModelPartConfig head = entity.modelData.head;
// Hide Head
((ModelScaleRenderer)this.bipedHead).isHidden = entity.modelData.hideHead == 1;
if(bipedHeadwear.showModel && !bipedHeadwear.isHidden){
if(entity.modelData.headwear == 1 || isArmor){
((ModelScaleRenderer)this.bipedHeadwear).setConfig(head,x,y,z);
@@ -524,28 +528,13 @@ public class ModelMPM extends ModelNPCMale{
}
ModelPartConfig body = entity.modelData.body;
// if(bipedBodywear.showModel && !bipedBodywear.isHidden){
// if(entity.modelData.bodywear == 1 || isArmor){
// ((ModelScaleRenderer)this.bipedBodywear).setConfig(body,x,y,z);
// ((ModelScaleRenderer)this.bipedBodywear).render(f);
// }
//// else if(entity.modelData.bodywear == 2){
//// this.bodywear.rotateAngleX = bipedBodywear.rotateAngleX;
//// this.bodywear.rotateAngleY = bipedBodywear.rotateAngleY;
//// this.bodywear.rotateAngleZ = bipedBodywear.rotateAngleZ;
//// this.bodywear.rotationPointX = bipedBodywear.rotationPointX;
//// this.bodywear.rotationPointY = bipedBodywear.rotationPointY;
//// this.bodywear.rotationPointZ = bipedBodywear.rotationPointZ;
//// this.bodywear.setConfig(body,x,y,z);
//// this.bodywear.render(f);
//// }
// }
if(entity.modelData.bodywear == 1){
((ModelScaleRenderer)this.bipedBodywear).isHidden = false;
}
else{
((ModelScaleRenderer)this.bipedBodywear).isHidden = true;
}
// Hide Body
((ModelScaleRenderer)this.bipedBody).isHidden = entity.modelData.hideBody == 1;
// Hide Bodywear
((ModelScaleRenderer)this.bipedBodywear).isHidden = entity.modelData.bodywear != 1;
((ModelScaleRenderer)this.bipedBody).setConfig(body,x,y,z);
((ModelScaleRenderer)this.bipedBody).render(f);
GL11.glPopMatrix();
@@ -566,21 +555,40 @@ public class ModelMPM extends ModelNPCMale{
GL11.glTranslatef((float)Math.sin(dancing) * 0.025F, (float)Math.abs(Math.cos(dancing)) * 0.125F - 0.02F, 0.0F);
}
if(entity.modelData.armwear == 1){
this.bipedRightArmwear.isHidden = false;
this.bipedLeftArmwear.isHidden = false;
// Hide Arms
if(entity.modelData.hideArms == 1){
((ModelScaleRenderer)this.bipedRightArm).isHidden = true;
((ModelScaleRenderer)this.bipedLeftArm).isHidden = true;
}
else if(entity.modelData.armwear == 2){
this.bipedRightArmwear.isHidden = true;
this.bipedLeftArmwear.isHidden = false;
else if(entity.modelData.hideArms == 2){
((ModelScaleRenderer)this.bipedRightArm).isHidden = true;
((ModelScaleRenderer)this.bipedLeftArm).isHidden = false;
}
else if(entity.modelData.armwear == 3){
this.bipedRightArmwear.isHidden = false;
this.bipedLeftArmwear.isHidden = true;
else if(entity.modelData.hideArms == 3){
((ModelScaleRenderer)this.bipedRightArm).isHidden = false;
((ModelScaleRenderer)this.bipedLeftArm).isHidden = true;
}
else{
this.bipedRightArmwear.isHidden = true;
this.bipedLeftArmwear.isHidden = true;
((ModelScaleRenderer)this.bipedRightArm).isHidden = false;
((ModelScaleRenderer)this.bipedLeftArm).isHidden = false;
}
// Hide Armwear
if(entity.modelData.armwear == 1){
((ModelScaleRenderer)this.bipedRightArmwear).isHidden = false;
((ModelScaleRenderer)this.bipedLeftArmwear).isHidden = false;
}
else if(entity.modelData.armwear == 2){
((ModelScaleRenderer)this.bipedRightArmwear).isHidden = true;
((ModelScaleRenderer)this.bipedLeftArmwear).isHidden = false;
}
else if(entity.modelData.armwear == 3){
((ModelScaleRenderer)this.bipedRightArmwear).isHidden = false;
((ModelScaleRenderer)this.bipedLeftArmwear).isHidden = true;
}
else{
((ModelScaleRenderer)this.bipedRightArmwear).isHidden = true;
((ModelScaleRenderer)this.bipedLeftArmwear).isHidden = true;
}
if(!bo){
@@ -606,6 +614,26 @@ public class ModelMPM extends ModelNPCMale{
GL11.glPushMatrix();
// Hide Legs
if(entity.modelData.hideLegs == 1){
((ModelScaleRenderer)this.bipedRightLeg).isHidden = true;
((ModelScaleRenderer)this.bipedLeftLeg).isHidden = true;
}
else if(entity.modelData.hideLegs == 2){
((ModelScaleRenderer)this.bipedRightLeg).isHidden = true;
((ModelScaleRenderer)this.bipedLeftLeg).isHidden = false;
}
else if(entity.modelData.hideLegs == 3){
((ModelScaleRenderer)this.bipedRightLeg).isHidden = false;
((ModelScaleRenderer)this.bipedLeftLeg).isHidden = true;
}
else{
((ModelScaleRenderer)this.bipedRightLeg).isHidden = false;
((ModelScaleRenderer)this.bipedLeftLeg).isHidden = false;
}
// Hide Legwear
if(entity.modelData.legwear == 1){
((ModelScaleRenderer)this.bipedRightLegWear).isHidden = false;
((ModelScaleRenderer)this.bipedLeftLegWear).isHidden = false;
@@ -21,10 +21,15 @@ public class ModelSkirt extends ModelPartInterface {
super(base);
float pi = (float) (Math.PI / 5);
textureWidth = 64;
textureHeight = 32;
Shape1 = new ModelPlaneRenderer(base, 58, 18);
Shape1.setTextureSize(64,32);
Shape1.addSidePlane(0, 0, 0, 9, 2);
ModelPlaneRenderer part1 = new ModelPlaneRenderer(base, 58, 18);
part1.setTextureSize(64,32);
part1.addSidePlane(2, 0, 0, 9, 2);
part1.rotateAngleY = -(float) (Math.PI/2);
Shape1.addChild(part1);