diff --git a/src/main/build.bat b/src/main/build.bat deleted file mode 100644 index 7798a82..0000000 --- a/src/main/build.bat +++ /dev/null @@ -1,14 +0,0 @@ -@echo off - -set WORKDIR=%CD% - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. - -cd /d "%DIRNAME%" - -call gradlew.bat clean build - -cd /d "%WORKDIR%" - -pause \ No newline at end of file diff --git a/src/main/build.gradle b/src/main/build.gradle deleted file mode 100644 index 2f4f598..0000000 --- a/src/main/build.gradle +++ /dev/null @@ -1,77 +0,0 @@ -buildscript { - repositories { - maven { url = 'https://files.minecraftforge.net/maven' } - jcenter() - mavenCentral() - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.+' - } -} -apply plugin: 'net.minecraftforge.gradle.forge' -//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. -apply plugin: 'eclipse' - -version = project.mod_version -group = project.group_name -archivesBaseName = "${project.mod_id}-${project.minecraft_version}-${project.tektopia_version}" - -sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. - -println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) - -minecraft { - version = "${project.minecraft_version}-${project.forge_version}" - mappings = project.forge_mappings - makeObfSourceJar = true - runDir = "run" -} - -repositories { -} - -dependencies { - compile files('../../../../JavaWorkspaces/_craftstudio/CraftStudioAPI-1.0.0.93-mc1.12-alpha-dev.jar') - compile files('../../../../JavaWorkspaces/tektopia/Tektopia-1.12.2-1.1.0-deobf.jar') -} - -//Creates a compiled de-obfuscated jar -task deobfJar(type: Jar) { - from sourceSets.main.output - classifier = 'deobf' -} - -tasks.build.dependsOn('deobfJar') - -processResources { - // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version - - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - - // replace version and mcversion - expand ([ - 'mod_version': project.mod_version, - 'tektopia_version': project.tektopia_version, - 'forge_version': project.forge_version, - 'minecraft_version': project.minecraft_version - ]) - } - - // copy everything else except the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } -} - -sourceSets { - main { - java { - srcDir '../../../TektopiaCommon/src/main/java' - } - } -} - diff --git a/src/main/gradle.properties b/src/main/gradle.properties deleted file mode 100644 index 2869b68..0000000 --- a/src/main/gradle.properties +++ /dev/null @@ -1,13 +0,0 @@ -#forge -minecraft_version=1.12.2 -forge_version=14.23.5.2768 -forge_mappings=snapshot_20180504 - -#general -mod_version=1.0.0 -mod_id=TektopiaThief -group_name=bletch.tektopiathief - -#other mods -tektopia_version=1.1.0 -craftstudio_version=1.0.0.93 diff --git a/src/main/gradle/wrapper/gradle-wrapper.jar b/src/main/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 94336fc..0000000 Binary files a/src/main/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/src/main/gradle/wrapper/gradle-wrapper.properties b/src/main/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 290541c..0000000 --- a/src/main/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/src/main/gradlew b/src/main/gradlew deleted file mode 100644 index cccdd3d..0000000 --- a/src/main/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/src/main/gradlew.bat b/src/main/gradlew.bat deleted file mode 100644 index f955316..0000000 --- a/src/main/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/src/main/settings.gradle b/src/main/settings.gradle deleted file mode 100644 index 4e564b1..0000000 --- a/src/main/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'TektopiaThief' \ No newline at end of file diff --git a/src/main/setup.bat b/src/main/setup.bat deleted file mode 100644 index be19434..0000000 --- a/src/main/setup.bat +++ /dev/null @@ -1,14 +0,0 @@ -@echo off - -set WORKDIR=%CD% - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. - -cd /d "%DIRNAME%" - -call gradlew.bat setupdecompworkspace eclipse - -cd /d "%WORKDIR%" - -pause diff --git a/src/main/src/main/java/bletch/tektopiathief/TektopiaThief.java b/src/main/src/main/java/bletch/tektopiathief/TektopiaThief.java deleted file mode 100644 index 5efbf5c..0000000 --- a/src/main/src/main/java/bletch/tektopiathief/TektopiaThief.java +++ /dev/null @@ -1,113 +0,0 @@ -package bletch.tektopiathief; - -import bletch.common.schedulers.ScheduleManager; -import bletch.tektopiathief.commands.ThiefCommands; -import bletch.tektopiathief.core.ModCommonProxy; -import bletch.tektopiathief.core.ModDetails; -import bletch.tektopiathief.core.ModEntities; -import bletch.tektopiathief.schedulers.ThiefScheduler; -import bletch.tektopiathief.utils.LoggerUtils; -import com.leviathanstudio.craftstudio.client.registry.CraftStudioLoader; -import net.minecraft.world.World; -import net.minecraftforge.client.event.ModelRegistryEvent; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventBusSubscriber; -import net.minecraftforge.fml.common.Mod.Instance; -import net.minecraftforge.fml.common.SidedProxy; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.event.FMLServerStartingEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; -import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; -import net.minecraftforge.fml.common.registry.EntityEntry; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import javax.annotation.ParametersAreNonnullByDefault; - -@Mod(modid = ModDetails.MOD_ID, name = ModDetails.MOD_NAME, version = ModDetails.MOD_VERSION, dependencies = ModDetails.MOD_DEPENDENCIES, acceptableRemoteVersions = "*", acceptedMinecraftVersions = "[1.12.2]", updateJSON = ModDetails.MOD_UPDATE_URL) -@ParametersAreNonnullByDefault -public class TektopiaThief { - - @Instance(ModDetails.MOD_ID) - public static TektopiaThief instance; - - @SidedProxy(clientSide = ModDetails.MOD_CLIENT_PROXY_CLASS, serverSide = ModDetails.MOD_SERVER_PROXY_CLASS) - public static ModCommonProxy proxy; - - public static ScheduleManager scheduleManager; - - @Mod.EventHandler - public void preInitialize(FMLPreInitializationEvent e) { - instance = this; - - proxy.resetDebug(); - proxy.preInitialize(e); - } - - @Mod.EventHandler - public void initialize(FMLInitializationEvent e) { - proxy.initialize(e); - } - - @Mod.EventHandler - public void postInitialize(FMLPostInitializationEvent e) { - proxy.postInitialize(e); - } - - @Mod.EventHandler - public void onServerStarting(final FMLServerStartingEvent e) { - - LoggerUtils.instance.info("Starting command registrations..."); - - LoggerUtils.instance.info("Registering thief commands"); - ThiefCommands commands = new ThiefCommands(); - e.registerServerCommand(commands); - commands.registerNodes(); - - LoggerUtils.instance.info("Finished command registrations"); - - World world = e.getServer().getEntityWorld(); - - LoggerUtils.instance.info("Starting ScheduleManager setup..."); - - // create the schedule manager - scheduleManager = new ScheduleManager(world); - scheduleManager.addScheduler(new ThiefScheduler()); - - LoggerUtils.instance.info("Finished ScheduleManager setup"); - } - - @EventBusSubscriber - public static class RegistrationHandler { - - @SubscribeEvent - public static void worldTick(WorldTickEvent e) { - if (e.phase == Phase.START) { - scheduleManager.onWorldTick(e); - } - } - - @CraftStudioLoader - public static void registerCraftStudio() { - proxy.registerCraftStudioModels(); - proxy.registerCraftStudioAnimations(); - } - - @SubscribeEvent - public static void registerEntities(RegistryEvent.Register event) { - ModEntities.register(event.getRegistry()); - } - - @SubscribeEvent - @SideOnly(Side.CLIENT) - public static void registerModels(ModelRegistryEvent event) { - ModEntities.registerModels(); - } - - } - -} diff --git a/src/main/src/main/java/bletch/tektopiathief/commands/CommandThiefKill.java b/src/main/src/main/java/bletch/tektopiathief/commands/CommandThiefKill.java deleted file mode 100644 index 1fef433..0000000 --- a/src/main/src/main/java/bletch/tektopiathief/commands/CommandThiefKill.java +++ /dev/null @@ -1,62 +0,0 @@ -package bletch.tektopiathief.commands; - -import bletch.common.commands.CommonCommandBase; -import bletch.common.utils.TextUtils; -import bletch.tektopiathief.core.ModDetails; -import bletch.tektopiathief.entities.EntityThief; -import bletch.tektopiathief.utils.LoggerUtils; -import net.minecraft.command.CommandException; -import net.minecraft.command.ICommandSender; -import net.minecraft.command.WrongUsageException; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.server.MinecraftServer; -import net.minecraft.world.World; -import net.tangotek.tektopia.Village; -import net.tangotek.tektopia.VillageManager; - -import java.util.List; - -public class CommandThiefKill extends CommonCommandBase { - - private static final String COMMAND_NAME = "kill"; - - public CommandThiefKill() { - super(ModDetails.MOD_ID, ThiefCommands.COMMAND_PREFIX, COMMAND_NAME); - } - - @Override - public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { - if (args.length > 0) { - throw new WrongUsageException(this.prefix + COMMAND_NAME + ".usage"); - } - - EntityPlayer entityPlayer = getCommandSenderAsPlayer(sender); - World world = entityPlayer != null ? entityPlayer.getEntityWorld() : null; - - VillageManager villageManager = world != null ? VillageManager.get(world) : null; - Village village = villageManager != null && entityPlayer != null ? villageManager.getVillageAt(entityPlayer.getPosition()) : null; - if (village == null) { - notifyCommandListener(sender, this, this.prefix + COMMAND_NAME + ".novillage"); - LoggerUtils.instance.info(TextUtils.translate(this.prefix + COMMAND_NAME + ".novillage"), true); - return; - } - - List entityList = world.getEntitiesWithinAABB(EntityThief.class, village.getAABB().grow(Village.VILLAGE_SIZE)); - if (entityList.size() == 0) { - notifyCommandListener(sender, this, this.prefix + COMMAND_NAME + ".noexists"); - LoggerUtils.instance.info(TextUtils.translate(this.prefix + COMMAND_NAME + ".noexists"), true); - return; - } - - for (EntityThief entity : entityList) { - if (entity.isDead) - continue; - - entity.setDead(); - - notifyCommandListener(sender, this, this.prefix + COMMAND_NAME + ".success"); - LoggerUtils.instance.info(TextUtils.translate(this.prefix + COMMAND_NAME + ".success"), true); - } - } - -} diff --git a/src/main/src/main/java/bletch/tektopiathief/commands/CommandThiefSpawn.java b/src/main/src/main/java/bletch/tektopiathief/commands/CommandThiefSpawn.java deleted file mode 100644 index a92ece1..0000000 --- a/src/main/src/main/java/bletch/tektopiathief/commands/CommandThiefSpawn.java +++ /dev/null @@ -1,105 +0,0 @@ -package bletch.tektopiathief.commands; - -import bletch.common.commands.CommonCommandBase; -import bletch.common.utils.TektopiaUtils; -import bletch.common.utils.TextUtils; -import bletch.tektopiathief.core.ModConfig; -import bletch.tektopiathief.core.ModDetails; -import bletch.tektopiathief.entities.EntityThief; -import bletch.tektopiathief.utils.LoggerUtils; -import net.minecraft.command.CommandException; -import net.minecraft.command.ICommandSender; -import net.minecraft.command.WrongUsageException; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.EnumDifficulty; -import net.minecraft.world.World; -import net.tangotek.tektopia.Village; -import net.tangotek.tektopia.VillageManager; - -import java.util.List; - -public class CommandThiefSpawn extends CommonCommandBase { - - private static final String COMMAND_NAME = "spawn"; - - public CommandThiefSpawn() { - super(ModDetails.MOD_ID, ThiefCommands.COMMAND_PREFIX, COMMAND_NAME); - } - - @Override - public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { - if (args.length < 1 || args.length > 2) { - throw new WrongUsageException(this.prefix + COMMAND_NAME + ".usage"); - } - - boolean spawnNearMe = false; - if (args.length > 1) { - if (!args[1].equalsIgnoreCase("me")) { - throw new WrongUsageException(this.prefix + COMMAND_NAME + ".usage"); - } - - spawnNearMe = true; - } - - int argValue; - try { - argValue = Integer.parseInt(args[0]); - argValue = Math.max(Math.min(argValue, EntityThief.MAX_LEVEL), EntityThief.MIN_LEVEL); - } catch (Exception ex) { - throw new WrongUsageException(this.prefix + COMMAND_NAME + ".usage"); - } - - int level = argValue; - - EntityPlayer entityPlayer = getCommandSenderAsPlayer(sender); - World world = entityPlayer != null ? entityPlayer.getEntityWorld() : null; - - if (world == null || world.isRaining()) { - notifyCommandListener(sender, this, this.prefix + COMMAND_NAME + ".badconditions"); - LoggerUtils.instance.info(TextUtils.translate(this.prefix + COMMAND_NAME + ".badconditions"), true); - return; - } - - if (world.getDifficulty() == EnumDifficulty.PEACEFUL && !ModConfig.thief.thiefSpawnsWhenPeaceful) { - notifyCommandListener(sender, this, this.prefix + COMMAND_NAME + ".peaceful"); - LoggerUtils.instance.info(TextUtils.translate(this.prefix + COMMAND_NAME + ".peaceful"), true); - return; - } - - VillageManager villageManager = world != null ? VillageManager.get(world) : null; - Village village = villageManager != null && entityPlayer != null ? villageManager.getVillageAt(entityPlayer.getPosition()) : null; - if (village == null) { - notifyCommandListener(sender, this, this.prefix + COMMAND_NAME + ".novillage"); - LoggerUtils.instance.info(TextUtils.translate(this.prefix + COMMAND_NAME + ".novillage"), true); - return; - } - - BlockPos spawnPosition = spawnNearMe ? entityPlayer.getPosition() : TektopiaUtils.getVillageSpawnPoint(world, village); - - if (spawnPosition == null) { - notifyCommandListener(sender, this, this.prefix + COMMAND_NAME + ".noposition"); - LoggerUtils.instance.info(TextUtils.translate(this.prefix + COMMAND_NAME + ".noposition"), true); - return; - } - - List entityList = world.getEntitiesWithinAABB(EntityThief.class, village.getAABB().grow(Village.VILLAGE_SIZE)); - if (entityList.size() > 0) { - notifyCommandListener(sender, this, this.prefix + COMMAND_NAME + ".exists"); - LoggerUtils.instance.info(TextUtils.translate(this.prefix + COMMAND_NAME + ".exists"), true); - return; - } - - // attempt to spawn the thief - if (!TektopiaUtils.trySpawnPersistenceEntity(world, spawnPosition, (World w) -> new EntityThief(w, level))) { - notifyCommandListener(sender, this, this.prefix + COMMAND_NAME + ".failed"); - LoggerUtils.instance.info(TextUtils.translate(this.prefix + COMMAND_NAME + ".failed"), true); - return; - } - - notifyCommandListener(sender, this, this.prefix + COMMAND_NAME + ".success", TektopiaUtils.formatBlockPos(spawnPosition)); - LoggerUtils.instance.info(TextUtils.translate(this.prefix + COMMAND_NAME + ".success", TektopiaUtils.formatBlockPos(spawnPosition)), true); - } - -} diff --git a/src/main/src/main/java/bletch/tektopiathief/commands/ThiefCommands.java b/src/main/src/main/java/bletch/tektopiathief/commands/ThiefCommands.java deleted file mode 100644 index 1672a14..0000000 --- a/src/main/src/main/java/bletch/tektopiathief/commands/ThiefCommands.java +++ /dev/null @@ -1,45 +0,0 @@ -package bletch.tektopiathief.commands; - -import bletch.tektopiathief.core.ModDetails; -import net.minecraft.command.ICommandSender; -import net.minecraft.server.MinecraftServer; -import net.minecraftforge.server.command.CommandTreeBase; -import net.minecraftforge.server.permission.DefaultPermissionLevel; -import net.minecraftforge.server.permission.PermissionAPI; - -public class ThiefCommands extends CommandTreeBase { - - public static final String COMMAND_PREFIX = "commands.thief."; - public static final String COMMAND_PREFIX_WITH_MODID = ModDetails.MOD_ID + "." + COMMAND_PREFIX; - - public ThiefCommands() { - super.addSubcommand(new CommandThiefKill()); - super.addSubcommand(new CommandThiefSpawn()); - } - - public void registerNodes() { - this.getSubCommands().forEach((c) -> { - PermissionAPI.registerNode(COMMAND_PREFIX_WITH_MODID + c.getName(), DefaultPermissionLevel.OP, c.getName()); - }); - } - - @Override - public String getName() { - return "thief"; - } - - @Override - public int getRequiredPermissionLevel() { - return 0; - } - - @Override - public boolean checkPermission(MinecraftServer server, ICommandSender sender) { - return true; - } - - @Override - public String getUsage(ICommandSender sender) { - return COMMAND_PREFIX + "usage"; - } -} diff --git a/src/main/src/main/java/bletch/tektopiathief/core/ModClientProxy.java b/src/main/src/main/java/bletch/tektopiathief/core/ModClientProxy.java deleted file mode 100644 index 7698a1b..0000000 --- a/src/main/src/main/java/bletch/tektopiathief/core/ModClientProxy.java +++ /dev/null @@ -1,52 +0,0 @@ -package bletch.tektopiathief.core; - -import bletch.tektopiathief.entities.EntityThief; -import bletch.tektopiathief.utils.LoggerUtils; -import com.leviathanstudio.craftstudio.client.registry.CSRegistryHelper; -import com.leviathanstudio.craftstudio.client.util.EnumRenderType; -import com.leviathanstudio.craftstudio.client.util.EnumResourceType; -import net.minecraft.client.Minecraft; - -import javax.annotation.ParametersAreNonnullByDefault; -import java.io.File; - -@ParametersAreNonnullByDefault -public class ModClientProxy extends ModCommonProxy { - - protected CSRegistryHelper registry = new CSRegistryHelper(ModDetails.MOD_ID); - - @Override - public boolean isRemote() { - return true; - } - - @Override - public File getMinecraftDirectory() { - return Minecraft.getMinecraft().mcDataDir; - } - - @Override - public void registerCraftStudioAnimations() { - super.registerCraftStudioAnimations(); - - LoggerUtils.instance.info("Starting registerCraftStudioAnimations..."); - - this.registry.register(EnumResourceType.ANIM, EnumRenderType.ENTITY, ModEntities.ANIMATION_VILLAGER_WALK); - this.registry.register(EnumResourceType.ANIM, EnumRenderType.ENTITY, ModEntities.ANIMATION_VILLAGER_RUN); - this.registry.register(EnumResourceType.ANIM, EnumRenderType.ENTITY, ModEntities.ANIMATION_VILLAGER_CREEP); - - LoggerUtils.instance.info("Finished registerCraftStudioAnimations..."); - } - - @Override - public void registerCraftStudioModels() { - super.registerCraftStudioModels(); - - LoggerUtils.instance.info("Starting registerCraftStudioModels..."); - - registry.register(EnumResourceType.MODEL, EnumRenderType.ENTITY, EntityThief.ANIMATION_MODEL_NAME); - - LoggerUtils.instance.info("Finished registerCraftStudioModels..."); - } - -} diff --git a/src/main/src/main/java/bletch/tektopiathief/core/ModCommonProxy.java b/src/main/src/main/java/bletch/tektopiathief/core/ModCommonProxy.java deleted file mode 100644 index 38f93da..0000000 --- a/src/main/src/main/java/bletch/tektopiathief/core/ModCommonProxy.java +++ /dev/null @@ -1,45 +0,0 @@ -package bletch.tektopiathief.core; - -import bletch.tektopiathief.utils.LoggerUtils; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; - -import javax.annotation.ParametersAreNonnullByDefault; -import java.io.File; - -@ParametersAreNonnullByDefault -public class ModCommonProxy { - - public boolean isRemote() { - return false; - } - - public File getMinecraftDirectory() { - return FMLCommonHandler.instance().getMinecraftServerInstance().getFile(""); - } - - public void preInitialize(FMLPreInitializationEvent e) { - MinecraftForge.EVENT_BUS.register(new ModConfig()); - } - - public void initialize(FMLInitializationEvent e) { - } - - public void postInitialize(FMLPostInitializationEvent e) { - } - - public void registerCraftStudioAnimations() { - } - - public void registerCraftStudioModels() { - } - - public void resetDebug() { - LoggerUtils.instance.Initialise(getMinecraftDirectory() + ModDetails.FILE_DEBUGLOG); - LoggerUtils.instance.resetDebug(); - } - -} diff --git a/src/main/src/main/java/bletch/tektopiathief/core/ModConfig.java b/src/main/src/main/java/bletch/tektopiathief/core/ModConfig.java deleted file mode 100644 index 42d04ab..0000000 --- a/src/main/src/main/java/bletch/tektopiathief/core/ModConfig.java +++ /dev/null @@ -1,62 +0,0 @@ -package bletch.tektopiathief.core; - -import net.minecraftforge.common.config.Config; -import net.minecraftforge.common.config.Config.Type; -import net.minecraftforge.common.config.ConfigManager; -import net.minecraftforge.fml.client.event.ConfigChangedEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import javax.annotation.ParametersAreNonnullByDefault; - -@Config(modid = ModDetails.MOD_ID, category = "") -@ParametersAreNonnullByDefault -public class ModConfig { - - @SideOnly(Side.CLIENT) - @SubscribeEvent - public void onConfigChanged(ConfigChangedEvent event) { - - if (event.getModID().equals(ModDetails.MOD_ID)) { - ConfigManager.sync(ModDetails.MOD_ID, Type.INSTANCE); - } - - } - - @Config.LangKey("config.debug") - public static final Debug debug = new Debug(); - - @Config.LangKey("config.thief") - public static final Thief thief = new Thief(); - - public static class Debug { - - @Config.Comment("If true, debug information will be output to the console.") - @Config.LangKey("config.debug.enableDebug") - public boolean enableDebug = false; - - } - - public static class Thief { - - @Config.Comment("If enabled, when trying to spawn a thief it will check the size of the village. The more villagers the more often the thief will spawn. Default: True") - @Config.LangKey("config.thief.checksvillagesize") - public Boolean checksVillageSize = true; - - @Config.Comment("If enabled, the Thief will spawn even if the difficulty is set to Peaceful. Default: True") - @Config.LangKey("config.thief.thiefspawnswhenpeaceful") - public Boolean thiefSpawnsWhenPeaceful = true; - - @Config.Comment("If enabled, the Thief will detect players and flee from them. Default: False") - @Config.LangKey("config.thief.thiefdetectsplayer") - public Boolean thiefdetectsplayer = false; - - @Config.Comment("The number of days before the thief visits the village again after they were successful. Set the 0 to disable to grace period. Default: 2") - @Config.LangKey("config.thief.thiefgraceperiod") - @Config.RangeInt(min = 0, max = 365) - public int thiefgraceperiod = 2; - - } - -} diff --git a/src/main/src/main/java/bletch/tektopiathief/core/ModDetails.java b/src/main/src/main/java/bletch/tektopiathief/core/ModDetails.java deleted file mode 100644 index ccb52cc..0000000 --- a/src/main/src/main/java/bletch/tektopiathief/core/ModDetails.java +++ /dev/null @@ -1,26 +0,0 @@ -package bletch.tektopiathief.core; - -import javax.annotation.ParametersAreNonnullByDefault; - -import bletch.common.core.CommonDetails; - -@ParametersAreNonnullByDefault -public class ModDetails extends CommonDetails { - private static final int VersionMajor = 1; - private static final int VersionMinor = 0; - private static final int VersionRevision = 0; - - public static final String MOD_ID = "tektopiathief"; - public static final String MOD_NAME = "TektopiaThief"; - - public static final String MOD_VERSION = VersionMajor + "." + VersionMinor + "." + VersionRevision; - public static final String MOD_DEPENDENCIES = "required-after:minecraft@[1.12.2];required-after:forge@[14.23.5.2768,);required-after:tektopia@[1.0.0,);before:tektopiainformation"; - - public static final String MOD_UPDATE_URL = "https://raw.githubusercontent.com/Bletch1971/" + MOD_NAME + "/master/1.0/updateforge.json"; - - public static final String MOD_SERVER_PROXY_CLASS = "bletch." + MOD_ID + ".core.ModCommonProxy"; - public static final String MOD_CLIENT_PROXY_CLASS = "bletch." + MOD_ID + ".core.ModClientProxy"; - - public static final String PATH_DEBUG = "/debug"; - public static final String FILE_DEBUGLOG = PATH_DEBUG + "/" + MOD_ID + ".txt"; -} diff --git a/src/main/src/main/java/bletch/tektopiathief/core/ModEntities.java b/src/main/src/main/java/bletch/tektopiathief/core/ModEntities.java deleted file mode 100644 index 8ad848b..0000000 --- a/src/main/src/main/java/bletch/tektopiathief/core/ModEntities.java +++ /dev/null @@ -1,34 +0,0 @@ -package bletch.tektopiathief.core; - -import bletch.common.core.CommonEntities; -import bletch.tektopiathief.entities.EntityThief; -import bletch.tektopiathief.entities.render.RenderThief; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.client.registry.RenderingRegistry; -import net.minecraftforge.fml.common.registry.EntityEntry; -import net.minecraftforge.fml.common.registry.EntityEntryBuilder; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import net.minecraftforge.registries.IForgeRegistry; - -public class ModEntities extends CommonEntities { - - public static void register(IForgeRegistry registry) { - int id = 1; - - registry.register(EntityEntryBuilder.create() - .entity(EntityThief.class) - .id(new ResourceLocation(ModDetails.MOD_ID, EntityThief.RESOURCE_PATH), id++) - .name(EntityThief.ENTITY_NAME) - .egg(2697513, 7494986) - .tracker(128, 1, true) - .build() - ); - } - - @SideOnly(Side.CLIENT) - public static void registerModels() { - RenderingRegistry.registerEntityRenderingHandler(EntityThief.class, RenderThief.FACTORY); - } - -} diff --git a/src/main/src/main/java/bletch/tektopiathief/entities/EntityThief.java b/src/main/src/main/java/bletch/tektopiathief/entities/EntityThief.java deleted file mode 100644 index b0bc0e5..0000000 --- a/src/main/src/main/java/bletch/tektopiathief/entities/EntityThief.java +++ /dev/null @@ -1,588 +0,0 @@ -package bletch.tektopiathief.entities; - -import bletch.common.MovementMode; -import bletch.common.Interfaces.IDesireEntity; -import bletch.common.Interfaces.IInventoryEntity; -import bletch.common.core.CommonEntities; -import bletch.common.entities.EntityEnemyBase; -import bletch.common.storage.ItemDesire; -import bletch.common.storage.ItemDesireSet; -import bletch.common.storage.ModInventory; -import bletch.common.utils.TextUtils; -import bletch.tektopiathief.core.ModConfig; -import bletch.tektopiathief.core.ModDetails; -import bletch.tektopiathief.entities.ai.*; -import bletch.tektopiathief.schedulers.ThiefScheduler; -import bletch.tektopiathief.utils.LoggerUtils; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.init.MobEffects; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.datasync.DataParameter; -import net.minecraft.network.datasync.DataSerializers; -import net.minecraft.network.datasync.EntityDataManager; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.DamageSource; -import net.minecraft.util.EntitySelectors; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentTranslation; -import net.minecraft.world.EnumDifficulty; -import net.minecraft.world.EnumSkyBlock; -import net.minecraft.world.World; -import net.tangotek.tektopia.Village; -import net.tangotek.tektopia.VillagerRole; -import net.tangotek.tektopia.entities.EntityVillagerTek; -import net.tangotek.tektopia.structures.VillageStructure; -import net.tangotek.tektopia.structures.VillageStructureType; -import net.tangotek.tektopia.tickjob.TickJob; - -import java.util.Iterator; - -@SuppressWarnings("unchecked") -public class EntityThief extends EntityEnemyBase implements IInventoryEntity, IDesireEntity { - - public static final String ENTITY_NAME = "thief"; - public static final String MODEL_NAME = "thief"; - public static final String RESOURCE_PATH = "thief"; - public static final String ANIMATION_MODEL_NAME = MODEL_NAME + "_m"; - - public static long WORK_START_TIME = 16000L; // 22:00 (10:00 PM) - public static long WORK_END_TIME = 23500L; // 05:30 (5:30 AM) - - protected static final DataParameter ACTION_ITEM; - protected static final DataParameter SEEN; - - protected ModInventory inventory; - protected ItemDesireSet desireSet; - - public EntityThief(World worldIn) { - super(worldIn, ModDetails.MOD_ID); - - this.inventory = new ModInventory(this, "Items", false, 1); - } - - public EntityThief(World worldIn, int level) { - super(worldIn, ModDetails.MOD_ID, level); - - this.inventory = new ModInventory(this, "Items", false, 1); - } - - @Override - protected void attachToVillage(Village village) { - super.attachToVillage(village); - - LoggerUtils.instance.info("Attaching to village", true); - } - - @Override - public boolean attackEntityFrom(DamageSource source, float amount) { - float beforeHealth = this.getHealth(); - - if (super.attackEntityFrom(source, amount)) { - float afterHealth = this.getHealth(); - float actualDamage = beforeHealth - afterHealth; - - if (this.hasVillage() && actualDamage > 0.0F) { - String message = TextUtils.translate("message.thief.damage", String.format("%.2f", actualDamage)); - Entity damagedBy = source.getTrueSource(); - - if (damagedBy != null) { - message += " " + TextUtils.translate("message.thief.damagefrom", damagedBy.getDisplayName().getUnformattedText()); - - if (damagedBy instanceof EntityVillagerTek) { - this.addPotionEffect(new PotionEffect(MobEffects.GLOWING, 60)); - - // only output the damage message if a villager is responsible for the damage - this.village.sendChatMessage(message); - } - } - - LoggerUtils.instance.info(message, true); - } - - return true; - } else { - return false; - } - } - - @Override - protected void checkStuck() { - if (this.hasVillage() && this.firstCheck.distanceSq(this.getPosition()) < 10.0D) { - LoggerUtils.instance.info("Killing self...failed to find a way to the village", true); - this.setDead(); - } - } - - @Override - protected void detachVillage() { - super.detachVillage(); - - LoggerUtils.instance.info("Detaching from village", true); - } - - protected void dropAllItems(DamageSource cause) { - LoggerUtils.instance.info("Dropping all items", true); - - IInventory inventory = this.getInventory(); - Entity damagedBy = cause.getTrueSource(); - - for (int slot = 0; slot < inventory.getSizeInventory(); ++slot) { - ItemStack itemStack = inventory.getStackInSlot(slot); - - if (!itemStack.isEmpty()) { - String message = "Thief has dropped " + itemStack.getDisplayName(); - if (itemStack.getCount() > 1) { - message += " x " + itemStack.getCount(); - } - - if (damagedBy != null) { - // only show the message if killed by a villager - this.village.sendChatMessage(message); - } - LoggerUtils.instance.info(message, true); - - this.entityDropItem(itemStack, 0.5f); - } - } - - inventory.clear(); - } - - public void equipActionItem(ItemStack actionItem) { - this.dataManager.set(ACTION_ITEM, actionItem.copy()); - } - - public ItemStack getActionItem() { - return this.dataManager.get(ACTION_ITEM); - } - - @Override - public float getAIMoveSpeed() { - MovementMode movementMode = this.getMovementMode(); - - switch (movementMode) { - case CREEP: - if (this.hasVillage()) { - // find the nearest storage structure - VillageStructure storage = this.getVillage().getNearestStructure(VillageStructureType.STORAGE, this.getPosition()); - if (storage != null) { - // get distance to nearest storage structure - double distanceTo = storage.getItemFrame().getDistance(this); - // check if near the storage structure - if (distanceTo > (Village.VILLAGE_SIZE / 2)) { - // not close to storage, so move a little faster - return (0.30F + this.getLevel() * 0.02F) * movementMode.speedMultiplier; - } - } - } - default: - break; - } - - return (0.20F + this.getLevel() * 0.02F) * movementMode.speedMultiplier; - } - - public ItemStack getAquiredItem() { - return this.inventory.getStackInSlot(0); - } - - public float getAvoidanceDistance() { - float avoidDistance = this.getAvoidanceDistanceBase() - this.getLevel(); - - int light = this.world.getLightFor(EnumSkyBlock.BLOCK, this.getPosition()); - // check for minecraft day time (6am - 7pm) - if (Village.isTimeOfDay(this.world, 0, 13000)) { - // light level is the maximum of Sky and block light - light = Math.max(light, this.world.getLightFor(EnumSkyBlock.SKY, this.getPosition())); - } - - light = (Math.max(0, Math.min(15, light)) + 1) / 2; - avoidDistance -= 8 - light; - - LoggerUtils.instance.info("EntityThief - getAvoidanceDistance called; avoidDistanceBase=" + this.getAvoidanceDistanceBase() + "; Level=" + this.getLevel() + "; light=" + light + "; avoidDistance=" + avoidDistance, true); - - return Math.max(1.0F, avoidDistance); - } - - public float getAvoidanceDistanceBase() { - return 24.0F; - } - - @Override - public ItemDesireSet getDesireSet() { - if (this.desireSet == null) - this.setupDesires(); - - return this.desireSet; - } - - public float getDetectionDistance() { - float avoidDistance = this.getAvoidanceDistance(); - float detectDistance = avoidDistance - 5.0F; - - LoggerUtils.instance.info("EntityThief - getDetectionDistance called; avoidDistance=" + avoidDistance + "; detectDistance=" + detectDistance, true); - - return Math.max(1.0F, detectDistance); - } - - @Override - public ITextComponent getDisplayName() { - ITextComponent itextcomponent = new TextComponentTranslation("entity." + MODEL_NAME + ".name"); - itextcomponent.getStyle().setHoverEvent(this.getHoverEvent()); - itextcomponent.getStyle().setInsertion(this.getCachedUniqueIdString()); - return itextcomponent; - } - - @Override - public ModInventory getInventory() { - return this.inventory; - } - - public Boolean getSeen() { - return this.dataManager.get(SEEN); - } - - public Boolean hasAcquiredItem() { - return !this.inventory.hasSlotFree(); - } - - @Override - protected void initEntityAI() { - setupAITasks(); - setupDesires(); - } - - public com.google.common.base.Predicate isEnemy() { - return (e) -> e instanceof EntityVillagerTek && ((EntityVillagerTek) e).isRole(VillagerRole.DEFENDER) - || ModConfig.thief.thiefdetectsplayer && e instanceof EntityPlayer; - } - - public boolean isFleeFrom(Entity e) { - return this.isEnemy().test(e) - || e instanceof EntityVillagerTek && ((EntityVillagerTek) e).isRole(VillagerRole.VILLAGER); - } - - @Override - public boolean isStoragePriority() { - return this.hasVillage() && this.isWorkTime() && !this.getSeen() && !this.hasAcquiredItem(); - } - - @Override - public boolean isWorkTime() { - return isWorkTime(this.world, 0) && !this.world.isRaining(); - } - - @Override - public void onDeath(DamageSource cause) { - super.onDeath(cause); - - if (!this.world.isRemote) { - String message = TextUtils.translate("message.thief.killed"); - Entity damagedBy = cause.getTrueSource(); - - if (damagedBy != null) { - message += " " + TextUtils.translate("message.thief.killedby", damagedBy.getDisplayName().getUnformattedComponentText()); - - if (damagedBy instanceof EntityVillagerTek) { - // only show the message if killed by a villager - this.village.sendChatMessage(message); - } - } - - LoggerUtils.instance.info(message, true); - - this.dropAllItems(cause); - } - } - - @Override - public void onInventoryUpdated(ItemStack updatedItem) { - this.desireSet.onInventoryUpdated(this, updatedItem); - } - - public void onStorageChange(ItemStack storageItem) { - this.desireSet.onStorageUpdated(this, storageItem); - } - - @Override - public void onUpdate() { - super.onUpdate(); - - if (!this.world.isRemote && this.world.getDifficulty() == EnumDifficulty.PEACEFUL && !ModConfig.thief.thiefSpawnsWhenPeaceful) { - LoggerUtils.instance.info("Killing self...difficulty is peaceful", true); - this.setDead(); - } - } - - @Override - public void pickupDesiredItem(ItemStack desiredItem) { - this.equipActionItem(desiredItem); - } - - protected void scanForEnemies() { - if (!this.hasVillage()) - return; - - float detectionDistance = this.getDetectionDistance(); - if (detectionDistance == 0) - return; - - Predicate entityPredicate = Predicates.and(EntitySelectors.CAN_AI_TARGET, - e -> e.isEntityAlive() && e.canEntityBeSeen(this), - this.isEnemy()); - - AxisAlignedBB boundingBox = this.getEntityBoundingBox().grow(detectionDistance, 6.0F, detectionDistance); - Iterator entityList = this.world.getEntitiesWithinAABB(EntityLivingBase.class, boundingBox, entityPredicate).stream() - .filter((e) -> e.getDistance(this) <= detectionDistance) - .iterator(); - - while (entityList.hasNext()) { - EntityLivingBase entity = entityList.next(); - - LoggerUtils.instance.info("EntityThief - scanForEnemies called, seen by entity" - + "; entity=" + entity.getName() - + "; detection distance=" + detectionDistance - + "; distance=" + entity.getDistance(this) - , true); - - this.village.addOrRenewEnemy(this, 1); - - if (!this.getSeen()) { - this.setSeen(true); - this.addPotionEffect(new PotionEffect(MobEffects.GLOWING, 120)); - this.village.sendChatMessage(TextUtils.translate("message.thief.seen")); - } - } - } - - public void setSeen(Boolean seen) { - LoggerUtils.instance.info("EntityThief - setSeen called; seen=" + seen, true); - - this.dataManager.set(SEEN, seen); - } - - @Override - protected void setupAITasks() { - super.setupAITasks(); - - this.addTask(1, new EntityAIFleeEntity(this, - (e) -> e.isWorkTime() && !e.getSeen() && !e.hasAcquiredItem(), - (e) -> this.isFleeFrom(e))); - - this.addTask(30, new EntityAILeaveVillage(this, - (e) -> !e.isWorkTime() && !e.getSeen() && !e.hasAcquiredItem(), - (e) -> e.getVillage().getEdgeNode(), - MovementMode.WALK, null, - () -> { - LoggerUtils.instance.info("Killing Self...left the village", true); - this.setDead(); - })); - - this.addTask(40, new EntityAIEscapeVillage(this, - (e) -> e.getSeen() || e.hasAcquiredItem(), - (e) -> e.getVillage().getEdgeNode(), - MovementMode.RUN, null, - () -> { - - if (this.hasAcquiredItem()) { - String message = this.getSeen() - ? TextUtils.translate("message.thief.escapedseen") - : TextUtils.translate("message.thief.escaped"); - ItemStack aquiredItem = this.getAquiredItem(); - - if (aquiredItem != null && !aquiredItem.isEmpty()) { - ThiefScheduler.resetGracePeriod(this.village); - - String aquiredItemDescription = aquiredItem.getDisplayName(); - if (aquiredItem.getCount() > 1) { - aquiredItemDescription += " x " + aquiredItem.getCount(); - } - message += " " + TextUtils.translate("message.thief.escapedwith", aquiredItemDescription); - } - - this.village.sendChatMessage(message); - LoggerUtils.instance.info(message, true); - } else if (this.getSeen()) { - String message = TextUtils.translate("message.thief.escapedseen"); - - this.village.sendChatMessage(message); - LoggerUtils.instance.info(message, true); - } - - LoggerUtils.instance.info("Killing Self...escaped the village", true); - this.setDead(); - })); - - this.addTask(50, new EntityAIRetrieveFromStorage(this)); - } - - @Override - public void setupDesires() { - this.desireSet = new ItemDesireSet(); - - // CROPS - this.desireSet.addItemDesire(new ItemDesire(Items.BEETROOT, 5, e -> e.isMale())); - this.desireSet.addItemDesire(new ItemDesire(Items.CARROT, 5, e -> !e.isMale())); - this.desireSet.addItemDesire(new ItemDesire(Items.POTATO, 5, null)); - this.desireSet.addItemDesire(new ItemDesire(Items.WHEAT, 5, e -> e.getLevel() < 3)); - - // FOOD - this.desireSet.addItemDesire(new ItemDesire(Items.APPLE, 4, null)); - this.desireSet.addItemDesire(new ItemDesire(Items.BAKED_POTATO, 3, e -> e.getLevel() > 1)); - this.desireSet.addItemDesire(new ItemDesire(Items.BEEF, 1, e -> e.isMale())); - this.desireSet.addItemDesire(new ItemDesire(Items.BEETROOT_SOUP, 1, e -> e.getLevel() > 2)); - this.desireSet.addItemDesire(new ItemDesire(Items.BREAD, 2, null)); - this.desireSet.addItemDesire(new ItemDesire(Items.CAKE, 1, e -> e.getLevel() > 3)); - this.desireSet.addItemDesire(new ItemDesire(Items.CHICKEN, 1, e -> !e.isMale())); - this.desireSet.addItemDesire(new ItemDesire(Items.COOKED_BEEF, 1, e -> e.getLevel() > 1 && e.isMale())); - this.desireSet.addItemDesire(new ItemDesire(Items.COOKED_CHICKEN, 1, e -> !e.isMale())); - this.desireSet.addItemDesire(new ItemDesire(Items.COOKED_MUTTON, 1, e -> e.getLevel() > 1 && !e.isMale())); - this.desireSet.addItemDesire(new ItemDesire(Items.COOKED_PORKCHOP, 1, e -> e.getLevel() > 1)); - this.desireSet.addItemDesire(new ItemDesire(Items.COOKIE, 1, e -> e.getLevel() > 3)); - this.desireSet.addItemDesire(new ItemDesire(Items.EGG, 4, e -> e.getLevel() < 3)); - this.desireSet.addItemDesire(new ItemDesire(Items.GOLDEN_APPLE, 1, e -> e.getLevel() > 3 && !e.isMale())); - this.desireSet.addItemDesire(new ItemDesire(Items.GOLDEN_CARROT, 1, e -> e.getLevel() > 3 && e.isMale())); - this.desireSet.addItemDesire(new ItemDesire(Items.MILK_BUCKET, 1, e -> e.getLevel() > 2)); - this.desireSet.addItemDesire(new ItemDesire(Items.MUTTON, 1, e -> !e.isMale())); - this.desireSet.addItemDesire(new ItemDesire(Items.PORKCHOP, 1, e -> e.isMale())); - this.desireSet.addItemDesire(new ItemDesire(Items.PUMPKIN_PIE, 1, e -> e.getLevel() > 3)); - this.desireSet.addItemDesire(new ItemDesire(Items.SUGAR, 5, null)); - - // RESOURCES - this.desireSet.addItemDesire(new ItemDesire(Items.COAL, 5, null)); - this.desireSet.addItemDesire(new ItemDesire(Items.DIAMOND, 1, e -> e.getLevel() > 3)); - this.desireSet.addItemDesire(new ItemDesire(Items.FEATHER, 5, null)); - this.desireSet.addItemDesire(new ItemDesire(Blocks.GOLD_ORE, 2, e -> !e.isMale())); - this.desireSet.addItemDesire(new ItemDesire(Items.GOLD_INGOT, 2, e -> !e.isMale())); - this.desireSet.addItemDesire(new ItemDesire(Blocks.IRON_ORE, 2, e -> e.isMale())); - this.desireSet.addItemDesire(new ItemDesire(Items.IRON_INGOT, 2, e -> e.isMale())); - this.desireSet.addItemDesire(new ItemDesire(Items.LEATHER, 4, null)); - this.desireSet.addItemDesire(new ItemDesire(Blocks.LOG, 3, null)); - this.desireSet.addItemDesire(new ItemDesire(Items.REDSTONE, 5, e -> e.getLevel() > 2)); - this.desireSet.addItemDesire(new ItemDesire(Blocks.WOOL, 2, null)); - - // TOOLS - this.desireSet.addItemDesire(new ItemDesire(Items.BOOK, 1, e -> !e.isMale())); - this.desireSet.addItemDesire(new ItemDesire(Items.BUCKET, 1, null)); - this.desireSet.addItemDesire(new ItemDesire(Items.PAPER, 4, e -> e.getLevel() > 1)); - this.desireSet.addItemDesire(new ItemDesire(Items.SHEARS, 1, e -> e.isMale())); - - this.desireSet.addItemDesire(new ItemDesire(Items.IRON_AXE, 1, e -> e.getLevel() > 1)); - this.desireSet.addItemDesire(new ItemDesire(Items.IRON_HOE, 1, e -> e.getLevel() > 1)); - this.desireSet.addItemDesire(new ItemDesire(Items.IRON_PICKAXE, 1, e -> e.getLevel() > 1)); - this.desireSet.addItemDesire(new ItemDesire(Items.IRON_SHOVEL, 1, e -> e.getLevel() > 1)); - this.desireSet.addItemDesire(new ItemDesire(Items.DIAMOND_AXE, 1, e -> e.getLevel() > 3)); - this.desireSet.addItemDesire(new ItemDesire(Items.DIAMOND_HOE, 1, e -> e.getLevel() > 3)); - this.desireSet.addItemDesire(new ItemDesire(Items.DIAMOND_PICKAXE, 1, e -> e.getLevel() > 3)); - this.desireSet.addItemDesire(new ItemDesire(Items.DIAMOND_SHOVEL, 1, e -> e.getLevel() > 3)); - - // WEAPONS - this.desireSet.addItemDesire(new ItemDesire(Items.IRON_SWORD, 1, e -> e.getLevel() > 1)); - this.desireSet.addItemDesire(new ItemDesire(Items.DIAMOND_SWORD, 1, e -> e.getLevel() > 3)); - - // ARMOR - this.desireSet.addItemDesire(new ItemDesire(Items.IRON_HELMET, 1, e -> e.getLevel() > 1)); - this.desireSet.addItemDesire(new ItemDesire(Items.IRON_CHESTPLATE, 1, e -> e.getLevel() > 1)); - this.desireSet.addItemDesire(new ItemDesire(Items.IRON_LEGGINGS, 1, e -> e.getLevel() > 1)); - this.desireSet.addItemDesire(new ItemDesire(Items.IRON_BOOTS, 1, e -> e.getLevel() > 1)); - this.desireSet.addItemDesire(new ItemDesire(Items.DIAMOND_HELMET, 1, e -> e.getLevel() > 3)); - this.desireSet.addItemDesire(new ItemDesire(Items.DIAMOND_CHESTPLATE, 1, e -> e.getLevel() > 3)); - this.desireSet.addItemDesire(new ItemDesire(Items.DIAMOND_LEGGINGS, 1, e -> e.getLevel() > 3)); - this.desireSet.addItemDesire(new ItemDesire(Items.DIAMOND_BOOTS, 1, e -> e.getLevel() > 3)); - } - - @Override - protected void setupServerJobs() { - super.setupServerJobs(); - - this.addJob(new TickJob(100, 0, false, - () -> this.prepStuck())); - - this.addJob(new TickJob(400, 0, false, - () -> this.checkStuck())); - - this.addJob(new TickJob(30, 30, true, - () -> this.scanForEnemies())); - - this.addJob(new TickJob(300, 100, true, - () -> { - if (!this.hasVillage() || !this.getVillage().isValid()) { - LoggerUtils.instance.info("Killing self...no village", true); - this.setDead(); - } - } - )); - } - - public void unequipActionItem() { - this.dataManager.set(ACTION_ITEM, ItemStack.EMPTY); - } - - public void unequipActionItem(ItemStack actionItem) { - if (actionItem != null && actionItem.getItem() == this.getActionItem().getItem()) { - this.dataManager.set(ACTION_ITEM, ItemStack.EMPTY); - } - } - - @Override - public void readEntityFromNBT(NBTTagCompound compound) { - super.readEntityFromNBT(compound); - - if (compound.hasKey("seen")) - this.setSeen(compound.getBoolean("seen")); - - this.inventory.readNBT(compound); - this.getDesireSet().forceUpdate(); - } - - @Override - public void writeEntityToNBT(NBTTagCompound compound) { - super.writeEntityToNBT(compound); - - compound.setBoolean("seen", this.getSeen()); - - this.inventory.writeNBT(compound); - } - - static { - ACTION_ITEM = EntityDataManager.createKey(EntityThief.class, DataSerializers.ITEM_STACK); - SEEN = EntityDataManager.createKey(EntityThief.class, DataSerializers.BOOLEAN); - - setupCraftStudioAnimations(ModDetails.MOD_ID, ANIMATION_MODEL_NAME); - } - - protected static void setupCraftStudioAnimations(String modId, String modelName) { - EntityEnemyBase.setupCraftStudioAnimations(modId, modelName); - - animationHandler.addAnim(modId, CommonEntities.ANIMATION_VILLAGER_CREEP, modelName, true); - } - - public static boolean isWorkTime(World world, int sleepOffset) { - return Village.isTimeOfDay(world, WORK_START_TIME, WORK_END_TIME, sleepOffset); - } - - @Override - protected void applyEntityAttributes() { - super.applyEntityAttributes(); - - this.dataManager.set(ACTION_ITEM, ItemStack.EMPTY); - } - - @Override - protected void entityInit() { - this.dataManager.register(ACTION_ITEM, ItemStack.EMPTY); - this.dataManager.register(SEEN, false); - - super.entityInit(); - } - -} diff --git a/src/main/src/main/java/bletch/tektopiathief/entities/ai/EntityAIEscapeVillage.java b/src/main/src/main/java/bletch/tektopiathief/entities/ai/EntityAIEscapeVillage.java deleted file mode 100644 index 230f7a4..0000000 --- a/src/main/src/main/java/bletch/tektopiathief/entities/ai/EntityAIEscapeVillage.java +++ /dev/null @@ -1,104 +0,0 @@ -package bletch.tektopiathief.entities.ai; - -import bletch.common.MovementMode; -import bletch.common.entities.ai.EntityAIMoveToBlock; -import bletch.tektopiathief.entities.EntityThief; -import bletch.tektopiathief.utils.LoggerUtils; -import net.minecraft.util.math.BlockPos; - -import java.util.function.Function; -import java.util.function.Predicate; - -public class EntityAIEscapeVillage extends EntityAIMoveToBlock { - protected final Function whereFunc; - protected final Predicate shouldPred; - protected final Runnable resetRunner; - protected final Runnable startRunner; - protected final EntityThief entity; - protected final MovementMode moveMode; - protected boolean active = false; - - public EntityAIEscapeVillage(EntityThief entity, Predicate shouldPred, Function whereFunc, MovementMode moveMode, Runnable startRunner, Runnable resetRunner) { - super(entity); - this.entity = entity; - this.shouldPred = shouldPred; - this.whereFunc = whereFunc; - this.resetRunner = resetRunner; - this.startRunner = startRunner; - this.moveMode = moveMode; - } - - public boolean shouldExecute() { - if (this.entity.isAITick() && this.entity.hasVillage() && this.shouldPred.test(this.entity)) - return super.shouldExecute(); - return false; - } - - public void startExecuting() { - LoggerUtils.instance.info("EntityAIEscapeVillage - startExecuting called", true); - - this.active = true; - if (this.startRunner != null) { - this.startRunner.run(); - } - - super.startExecuting(); - } - - public boolean shouldContinueExecuting() { - boolean result = this.active && this.navigator.canNavigate(); - if (!result) - LoggerUtils.instance.info("EntityAIEscapeVillage - shouldContinueExecuting called; this.active=" + this.active + "; this.arrived=" + this.arrived + "; this.stuck=" + this.stuck + " (" + this.stuckCount + "); canNavigate=" + this.navigator.canNavigate(), true); - return result; - } - - public void resetTask() { - LoggerUtils.instance.info("EntityAIEscapeVillage - resetTask called", true); - - if (this.resetRunner != null) { - this.resetRunner.run(); - } - this.active = false; - - super.resetTask(); - } - - protected boolean attemptStuckFix() { - return true; - } - - protected BlockPos getDestinationBlock() { - return this.whereFunc.apply(this.entity); - } - - protected boolean isNearWalkPos() { - return this.entity.getPosition().distanceSq(this.destinationPos) < 4.0D; - } - - protected void onArrival() { - LoggerUtils.instance.info("EntityAIEscapeVillage - onArrival called", true); - - this.active = false; - super.onArrival(); - } - - protected void onPathFailed(BlockPos pos) { - LoggerUtils.instance.info("EntityAIEscapeVillage - onPathFailed called", true); - - this.active = false; - super.onPathFailed(pos); - } - - protected void onStuck() { - LoggerUtils.instance.info("EntityAIEscapeVillage - onStuck called", true); - - this.active = false; - super.onStuck(); - } - - protected void updateMovementMode() { - LoggerUtils.instance.info("EntityAIEscapeVillage - updateMovementMode called with mode " + this.moveMode.name(), true); - - this.entity.setMovementMode(this.moveMode); - } -} diff --git a/src/main/src/main/java/bletch/tektopiathief/entities/ai/EntityAIFleeEntity.java b/src/main/src/main/java/bletch/tektopiathief/entities/ai/EntityAIFleeEntity.java deleted file mode 100644 index 6f85642..0000000 --- a/src/main/src/main/java/bletch/tektopiathief/entities/ai/EntityAIFleeEntity.java +++ /dev/null @@ -1,145 +0,0 @@ -package bletch.tektopiathief.entities.ai; - -import bletch.common.MovementMode; -import bletch.common.entities.ai.EntityAIMoveToBlock; -import bletch.tektopiathief.entities.EntityThief; -import bletch.tektopiathief.utils.LoggerUtils; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.EntitySelectors; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.tangotek.tektopia.ModSoundEvents; -import net.tangotek.tektopia.pathing.BasePathingNode; - -import java.util.Comparator; -import java.util.List; -import java.util.stream.Collectors; - -public class EntityAIFleeEntity extends EntityAIMoveToBlock { - protected final EntityThief entity; - protected final Predicate entityPredicate; - protected final Predicate shouldPred; - protected EntityLivingBase fleeEntity; - protected BlockPos destinationPosition; - protected final MovementMode moveMode; - - @SuppressWarnings("unchecked") - public EntityAIFleeEntity(EntityThief entity, Predicate shouldPred, Predicate filterPred) { - super(entity); - this.entity = entity; - this.shouldPred = shouldPred; - this.moveMode = MovementMode.RUN; - this.setMutexBits(1); - this.entityPredicate = Predicates.and(EntitySelectors.CAN_AI_TARGET, - e -> e.isEntityAlive() && e.canEntityBeSeen(this.entity), - filterPred); - } - - public boolean shouldExecute() { - if (this.entity.isAITick() && this.entity.hasVillage() && this.shouldPred.test(this.entity)) { - - double avoidDistance = this.entity.getAvoidanceDistance(); - if (avoidDistance == 0) - return false; - - AxisAlignedBB boundingBox = this.entity.getEntityBoundingBox().grow(avoidDistance, 6.0F, avoidDistance); - List fleeEntities = this.entity.world.getEntitiesWithinAABB(EntityLivingBase.class, boundingBox, this.entityPredicate).stream() - .filter((e) -> e.getDistance(this.entity) <= avoidDistance) - .sorted(Comparator.comparingDouble(e -> e.getDistance(this.entity))) - .collect(Collectors.toList()); - - if (fleeEntities == null || fleeEntities.isEmpty()) - return false; - - this.fleeEntity = fleeEntities.get(0); - LoggerUtils.instance.info("EntityAIFleeEntity - shouldExecute called" - + "; entity=" + this.fleeEntity.getName() - + "; avoid Distance=" + avoidDistance - + "; distance=" + this.fleeEntity.getDistance(this.entity) - , true); - - BlockPos fleeBlock = this.findRandomPositionAwayFrom(this.fleeEntity); - - if (fleeBlock != null) { - this.destinationPosition = fleeBlock; - return super.shouldExecute(); - } - } - - return false; - } - - public void startExecuting() { - LoggerUtils.instance.info("EntityAIFleeEntity - startExecuting called", true); - - if (this.entityPredicate.test(this.fleeEntity)) { - if (this.entity.getRNG().nextInt(2) == 0) { - this.entity.playSound(ModSoundEvents.villagerAfraid); - } - } - - super.startExecuting(); - } - - public void resetTask() { - LoggerUtils.instance.info("EntityAIFleeEntity - resetTask called", true); - - this.fleeEntity = null; - - super.resetTask(); - } - - protected BlockPos findRandomPositionAwayFrom(Entity fleeEntity) { - Vec3d entityPosition = this.entity.getPositionVector(); - Vec3d enemyPosition = fleeEntity.getPositionVector(); - Vec3d fleeDelta; - - if (this.entity.hasVillage()) { - if (this.entity.getPosition().distanceSq(this.entity.getVillage().getOrigin()) < 1600.0D) { - fleeDelta = entityPosition.subtract(enemyPosition); - } else { - fleeDelta = this.entity.getPositionVector().subtract(new Vec3d(this.entity.getVillage().getOrigin())); - } - } else { - fleeDelta = entityPosition.subtract(enemyPosition); - } - - Vec3d fleeDeltaNorm = fleeDelta.normalize(); - Vec3d fleeDir = new Vec3d(fleeDeltaNorm.x, 0.0D, fleeDeltaNorm.y); - - if (this.entity.hasVillage() && this.entity.getVillage().getAABB().contains(entityPosition) && entityPosition.add(fleeDir).squareDistanceTo(enemyPosition) < entityPosition.squareDistanceTo(enemyPosition)) { - fleeDir = fleeDir.rotateYaw(60.0F); - if (entityPosition.add(fleeDir).squareDistanceTo(enemyPosition) < entityPosition.squareDistanceTo(enemyPosition)) { - fleeDir = fleeDir.rotateYaw(-120.0F); - } - } - - Vec3d fleePos = this.entity.getPositionVector().add(fleeDir.scale(16.0D)); - BlockPos fleeBlock = new BlockPos(fleePos.x, fleePos.y, fleePos.z); - - for (int i = 0; i < 20; ++i) { - BlockPos testBlock = fleeBlock.add(this.entity.getRNG().nextInt((i + 3) * 2) - (i + 3), 0, this.entity.getRNG().nextInt((i + 3) * 2) - (i + 3)); - BasePathingNode baseNode = this.entity.getVillage().getPathingGraph().getNodeYRange(testBlock.getX(), testBlock.getY() - 5, testBlock.getY() + 5, testBlock.getZ()); - - if (baseNode != null) { - return baseNode.getBlockPos(); - } - } - - return null; - } - - protected BlockPos getDestinationBlock() { - return this.destinationPosition; - } - - protected void updateMovementMode() { - LoggerUtils.instance.info("EntityAIFleeEntity - updateMovementMode called with mode " + this.moveMode.name(), true); - - this.entity.setMovementMode(this.moveMode); - } -} diff --git a/src/main/src/main/java/bletch/tektopiathief/entities/ai/EntityAILeaveVillage.java b/src/main/src/main/java/bletch/tektopiathief/entities/ai/EntityAILeaveVillage.java deleted file mode 100644 index d5e6b47..0000000 --- a/src/main/src/main/java/bletch/tektopiathief/entities/ai/EntityAILeaveVillage.java +++ /dev/null @@ -1,69 +0,0 @@ -package bletch.tektopiathief.entities.ai; - -import bletch.common.MovementMode; -import bletch.common.entities.ai.EntityAIMoveToBlock; -import bletch.tektopiathief.entities.EntityThief; -import bletch.tektopiathief.utils.LoggerUtils; -import net.minecraft.util.math.BlockPos; - -import java.util.function.Function; -import java.util.function.Predicate; - -public class EntityAILeaveVillage extends EntityAIMoveToBlock { - protected final Function whereFunc; - protected final Predicate shouldPred; - protected final Runnable resetRunner; - protected final Runnable startRunner; - protected final EntityThief entity; - protected final MovementMode moveMode; - - public EntityAILeaveVillage(EntityThief entity, Predicate shouldPred, Function whereFunc, MovementMode moveMode, Runnable startRunner, Runnable resetRunner) { - super(entity); - this.entity = entity; - this.shouldPred = shouldPred; - this.whereFunc = whereFunc; - this.resetRunner = resetRunner; - this.startRunner = startRunner; - this.moveMode = moveMode; - } - - public boolean shouldExecute() { - if (this.entity.isAITick() && this.entity.hasVillage() && this.shouldPred.test(this.entity)) - return super.shouldExecute(); - return false; - } - - public void startExecuting() { - LoggerUtils.instance.info("EntityAILeaveVillage - startExecuting called", true); - - if (this.startRunner != null) { - this.startRunner.run(); - } - - super.startExecuting(); - } - - public void resetTask() { - LoggerUtils.instance.info("EntityAILeaveVillage - resetTask called", true); - - if (this.resetRunner != null) { - this.resetRunner.run(); - } - - super.resetTask(); - } - - protected BlockPos getDestinationBlock() { - return this.whereFunc.apply(this.entity); - } - - protected boolean isNearWalkPos() { - return this.entity.getPosition().distanceSq(this.destinationPos) < 4.0D; - } - - protected void updateMovementMode() { - LoggerUtils.instance.info("EntityAILeaveVillage - updateMovementMode called with mode " + this.moveMode.name(), true); - - this.entity.setMovementMode(this.moveMode); - } -} diff --git a/src/main/src/main/java/bletch/tektopiathief/entities/ai/EntityAIRetrieveFromStorage.java b/src/main/src/main/java/bletch/tektopiathief/entities/ai/EntityAIRetrieveFromStorage.java deleted file mode 100644 index 46b2593..0000000 --- a/src/main/src/main/java/bletch/tektopiathief/entities/ai/EntityAIRetrieveFromStorage.java +++ /dev/null @@ -1,179 +0,0 @@ -package bletch.tektopiathief.entities.ai; - -import bletch.common.MovementMode; -import bletch.common.entities.ai.EntityAIMoveToBlock; -import bletch.common.storage.ItemDesire; -import bletch.tektopiathief.entities.EntityThief; -import bletch.tektopiathief.utils.LoggerUtils; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.EntitySelectors; -import net.minecraft.util.math.BlockPos; - -public class EntityAIRetrieveFromStorage extends EntityAIMoveToBlock { - private TileEntityChest chest = null; - protected ItemDesire retrieveDesire = null; - protected final EntityThief entity; - private int pickUpTick = 0; - protected boolean autoCheck = false; - protected ItemStack itemTaken = null; - protected final MovementMode moveMode; - - public EntityAIRetrieveFromStorage(EntityThief entity) { - super(entity); - - this.entity = entity; - this.moveMode = MovementMode.CREEP; - } - - public boolean shouldExecute() { - if ((this.entity.isAITick() || this.entity.isStoragePriority()) && this.entity.hasVillage()) { - this.autoCheck = false; - this.retrieveDesire = this.entity.getDesireSet().getNeededDesire(this.entity); - - if (this.retrieveDesire != null) { - this.chest = this.retrieveDesire.getPickUpChest(this.entity); - - if (this.chest != null) { - return super.shouldExecute(); - } - } - } - - return false; - } - - public void startExecuting() { - super.startExecuting(); - } - - public boolean shouldContinueExecuting() { - if (this.pickUpTick > 0) { - return true; - } else { - return this.chest == this.retrieveDesire.getPickUpChest(this.entity) && super.shouldContinueExecuting(); - } - } - - public void updateTask() { - super.updateTask(); - - --this.pickUpTick; - if (this.pickUpTick == 15) { - this.pickUpItems(); - } else if (this.pickUpTick == 1) { - this.closeChest(); - } - } - - public void resetTask() { - this.pickUpTick = 0; - - if (this.itemTaken != null) { - //this.entity.unequipActionItem(this.itemTaken); - this.itemTaken = null; - this.entity.setStoragePriority(); - } - - super.resetTask(); - } - - protected void closeChest() { - TileEntity tileEntity = this.entity.world.getTileEntity(this.destinationPos); - - if (tileEntity instanceof TileEntityChest) { - TileEntityChest tileEntityChest = (TileEntityChest) tileEntity; - this.entity.world.playerEntities.stream() - .filter(EntitySelectors.NOT_SPECTATING) - .findFirst().ifPresent(tileEntityChest::closeInventory); - } - } - - protected BlockPos findWalkPos() { - BlockPos result = super.findWalkPos(); - - if (result == null) { - BlockPos pos = this.destinationPos; - - BlockPos testPos = pos.west(2); - if (this.isWalkable(testPos, this.entity)) { - return testPos; - } - - testPos = pos.east(2); - if (this.isWalkable(testPos, this.entity)) { - return testPos; - } - - testPos = pos.north(2); - if (this.isWalkable(testPos, this.entity)) { - return testPos; - } - - testPos = pos.south(2); - if (this.isWalkable(testPos, this.entity)) { - return testPos; - } - } - - return result; - } - - protected BlockPos getDestinationBlock() { - return this.chest != null ? this.chest.getPos() : null; - } - - public boolean isInterruptible() { - return this.pickUpTick <= 0 || this.entity.getSeen(); - } - - protected void onArrival() { - super.onArrival(); - this.pickUpTick = 30; - this.openChest(); - } - - protected void openChest() { - TileEntity tileEntity = this.entity.world.getTileEntity(this.destinationPos); - - if (tileEntity instanceof TileEntityChest) { - TileEntityChest tileEntityChest = (TileEntityChest) tileEntity; - this.entity.world.playerEntities.stream() - .filter(EntitySelectors.NOT_SPECTATING) - .findFirst().ifPresent(tileEntityChest::openInventory); - } - } - - protected void pickUpItems() { - if (this.isNearDestination(5.0D) && !this.chest.isInvalid()) { - this.itemTaken = this.retrieveDesire.pickUpItems(this.entity); - - if (this.itemTaken == null || this.itemTaken.isEmpty()) { - this.entity.getDesireSet().forceUpdate(); - } else { - this.itemAcquired(this.itemTaken); - } - } - } - - protected boolean itemAcquired(ItemStack itemStack) { - this.autoCheck = true; - this.entity.setStoragePriority(); - - boolean acquired = this.entity.getInventory().addItem(itemStack).isEmpty(); - if (acquired) { - String aquiredItemDescription = itemStack.getDisplayName() + " x " + itemStack.getCount(); - LoggerUtils.instance.info("EntityAIRetrieveFromStorage - itemAcquired called; acquired=" + aquiredItemDescription, true); - } else { - LoggerUtils.instance.info("EntityAIRetrieveFromStorage - itemAcquired called; acquire failed", true); - } - return acquired; - } - - protected void updateMovementMode() { - LoggerUtils.instance.info("EntityAIRetrieveFromStorage - updateMovementMode called with mode " + this.moveMode.name(), true); - - this.entity.setMovementMode(this.moveMode); - } -} diff --git a/src/main/src/main/java/bletch/tektopiathief/entities/render/RenderThief.java b/src/main/src/main/java/bletch/tektopiathief/entities/render/RenderThief.java deleted file mode 100644 index 17db4bd..0000000 --- a/src/main/src/main/java/bletch/tektopiathief/entities/render/RenderThief.java +++ /dev/null @@ -1,71 +0,0 @@ -package bletch.tektopiathief.entities.render; - -import bletch.tektopiathief.core.ModDetails; -import bletch.tektopiathief.entities.EntityThief; -import com.leviathanstudio.craftstudio.client.model.ModelCraftStudio; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.client.renderer.entity.RenderLiving; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.client.registry.IRenderFactory; -import net.tangotek.tektopia.client.LayerVillagerHeldItem; - -public class RenderThief extends RenderLiving { - public static final RenderThief.Factory FACTORY; - - protected final String textureName; - protected final ModelCraftStudio maleModel; - protected final ModelCraftStudio femaleModel; - protected ResourceLocation[] maleTextures; - protected ResourceLocation[] femaleTextures; - - public RenderThief(RenderManager manager) { - this(manager, EntityThief.MODEL_NAME, false, 64, 64, EntityThief.MODEL_NAME, 0.4F); - } - - public RenderThief(RenderManager manager, String modelName, boolean hasGenderModels, int textureWidth, int textureHeight, String textureName, float shadowSize) { - super(manager, new ModelCraftStudio(ModDetails.MOD_ID, modelName + "_m", textureWidth, textureHeight), shadowSize); - - this.addLayer(new LayerVillagerHeldItem(this)); - this.textureName = textureName; - this.maleModel = (ModelCraftStudio) this.mainModel; - if (hasGenderModels) { - this.femaleModel = new ModelCraftStudio(ModDetails.MOD_ID, modelName + "_f", textureWidth, textureHeight); - } else { - this.femaleModel = null; - } - - this.setupTextures(); - } - - protected void setupTextures() { - this.maleTextures = new ResourceLocation[]{new ResourceLocation(ModDetails.MOD_ID, "textures/entity/" + this.textureName + "_m.png")}; - this.femaleTextures = new ResourceLocation[]{new ResourceLocation(ModDetails.MOD_ID, "textures/entity/" + this.textureName + "_f.png")}; - } - - public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) { - if (!entity.isMale() && this.femaleModel != null) { - this.mainModel = this.femaleModel; - } else { - this.mainModel = this.maleModel; - } - - super.doRender(entity, x, y, z, entityYaw, partialTicks); - } - - @Override - protected ResourceLocation getEntityTexture(T entity) { - return entity.isMale() ? this.maleTextures[0] : this.femaleTextures[0]; - } - - public static class Factory implements IRenderFactory { - public Render createRenderFor(RenderManager manager) { - return new RenderThief(manager); - } - } - - static { - FACTORY = new RenderThief.Factory<>(); - } - -} diff --git a/src/main/src/main/java/bletch/tektopiathief/schedulers/ThiefScheduler.java b/src/main/src/main/java/bletch/tektopiathief/schedulers/ThiefScheduler.java deleted file mode 100644 index 21bcac0..0000000 --- a/src/main/src/main/java/bletch/tektopiathief/schedulers/ThiefScheduler.java +++ /dev/null @@ -1,147 +0,0 @@ -package bletch.tektopiathief.schedulers; - -import bletch.common.schedulers.IScheduler; -import bletch.common.utils.TektopiaUtils; -import bletch.common.utils.TextUtils; -import bletch.tektopiathief.core.ModConfig; -import bletch.tektopiathief.entities.EntityThief; -import bletch.tektopiathief.utils.LoggerUtils; -import net.minecraft.entity.item.EntityItemFrame; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.EnumDifficulty; -import net.minecraft.world.World; -import net.tangotek.tektopia.Village; -import net.tangotek.tektopia.structures.VillageStructure; -import net.tangotek.tektopia.structures.VillageStructureType; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class ThiefScheduler implements IScheduler { - - protected static Map gracePeriods = new HashMap<>(); - - protected Boolean checkedVillages = false; - protected Boolean resetDay = false; - - @Override - public void resetDay() { - if (this.resetDay) - return; - - LoggerUtils.instance.info("ThiefScheduler - resetDay called", true); - - // if it is day time, then clear the village checks - this.checkedVillages = false; - this.resetDay = true; - - reduceGracePeriods(); - } - - @Override - public void resetNight() { - } - - @Override - public void update(World world) { - // do not process any further if we have already performed the check, it is raining, or it is day - if (this.checkedVillages || world == null || world.isRaining() || !EntityThief.isWorkTime(world, 0)) - return; - - LoggerUtils.instance.info("ThiefScheduler - update called", true); - - this.resetDay = false; - this.checkedVillages = true; - - if (world.getDifficulty() == EnumDifficulty.PEACEFUL && !ModConfig.thief.thiefSpawnsWhenPeaceful) { - LoggerUtils.instance.info(TextUtils.translate("message.thief.peaceful"), true); - return; - } - - // get a list of the villages from the VillageManager - List villages = TektopiaUtils.getVillages(world); - if (villages == null || villages.isEmpty()) - return; - - // cycle through each village - villages.forEach((v) -> { - - String villageName = v.getName(); - - int gracePeriod = getGracePeriod(v); - if (gracePeriod > 0) { - LoggerUtils.instance.info(TextUtils.translate("message.thief.graceperiod", villageName), true); - return; - } - - VillageStructure storage = v.getNearestStructure(VillageStructureType.STORAGE, v.getOrigin()); - if (storage != null) { - EntityItemFrame frame = storage.getItemFrame(); - if (frame != null && frame.getRotation() != 0) { - LoggerUtils.instance.info(TextUtils.translate("message.thief.spawnblocked", villageName), true); - return; - } - } - - // get the village level (1-5) and test to spawn - bigger villages will increase the number of spawns of the Thief. - int villageLevel = TektopiaUtils.getVillageLevel(v); - int villageCheck = ModConfig.thief.checksVillageSize ? world.rand.nextInt(TektopiaUtils.MAX_VILLAGE_LEVEL - villageLevel + 1) : 0; - - if (villageLevel > 0 && villageCheck == 0) { - - LoggerUtils.instance.info(TextUtils.translate("message.thief.villagechecksuccess", villageName, villageLevel, villageCheck), true); - - // get a list of the Thieves in the village - List entityList = world.getEntitiesWithinAABB(EntityThief.class, v.getAABB().grow(Village.VILLAGE_SIZE)); - if (entityList.size() == 0) { - - BlockPos spawnPosition = TektopiaUtils.getVillageSpawnPoint(world, v); - - // attempt spawn - if (TektopiaUtils.trySpawnPersistenceEntity(world, spawnPosition, (World w) -> new EntityThief(w, villageLevel))) { - LoggerUtils.instance.info(TextUtils.translate("message.thief.spawned.village", villageLevel, villageName, TektopiaUtils.formatBlockPos(spawnPosition)), true); - } else { - LoggerUtils.instance.info(TextUtils.translate("message.thief.noposition.village", villageName), true); - } - - } else { - LoggerUtils.instance.info(TextUtils.translate("message.thief.exists", villageName), true); - } - - } else { - LoggerUtils.instance.info(TextUtils.translate("message.thief.villagecheckfailed", villageName, villageLevel, villageCheck), true); - } - }); - } - - public static int getGracePeriod(Village village) { - return village == null ? 0 : gracePeriods.getOrDefault(village, 0); - } - - public static void reduceGracePeriods() { - List villages = new ArrayList(gracePeriods.keySet()); - - for (int index = villages.size() - 1; index >= 0; index--) { - setGracePeriod(villages.get(index), gracePeriods.getOrDefault(villages.get(index), 0) - 1); - } - } - - public static void resetGracePeriod(Village village) { - if (village == null) - return; - - setGracePeriod(village, ModConfig.thief.thiefgraceperiod); - } - - public static void setGracePeriod(Village village, int gracePeriod) { - if (village == null) - return; - - if (gracePeriod <= 0) - gracePeriods.remove(village); - else - gracePeriods.put(village, gracePeriod); - } -} diff --git a/src/main/src/main/java/bletch/tektopiathief/utils/LoggerUtils.java b/src/main/src/main/java/bletch/tektopiathief/utils/LoggerUtils.java deleted file mode 100644 index e1b6bf4..0000000 --- a/src/main/src/main/java/bletch/tektopiathief/utils/LoggerUtils.java +++ /dev/null @@ -1,31 +0,0 @@ -package bletch.tektopiathief.utils; - -import bletch.common.utils.LoggerBase; -import bletch.tektopiathief.core.ModConfig; -import bletch.tektopiathief.core.ModDetails; - -public class LoggerUtils extends LoggerBase { - - public static LoggerUtils instance = new LoggerUtils(); - - public void Initialise(String debugLogFile) { - Initialise(ModDetails.MOD_NAME, debugLogFile); - } - - @Override - public void debug(String message, Boolean checkConfig) { - if (checkConfig && !ModConfig.debug.enableDebug) - return; - - debug(message); - } - - @Override - public void info(String message, Boolean checkConfig) { - if (checkConfig && !ModConfig.debug.enableDebug) - return; - - info(message); - } - -} diff --git a/src/main/src/main/resources/assets/tektopiathief/craftstudio/animations/entity/villager_creep.csjsmodelanim b/src/main/src/main/resources/assets/tektopiathief/craftstudio/animations/entity/villager_creep.csjsmodelanim deleted file mode 100644 index 0298644..0000000 --- a/src/main/src/main/resources/assets/tektopiathief/craftstudio/animations/entity/villager_creep.csjsmodelanim +++ /dev/null @@ -1,199 +0,0 @@ -{ - "title": "villager_creep", - "duration": 60, - "holdLastKeyframe": false, - "nodeAnimations": { - "LegRight": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 10, 0, 0 ], - "14": [ 20, 0, 0 ], - "30": [ -66, 0, 0 ], - "44": [ -38, 0, 0 ], - "60": [ 10, 0, 0 ] - }, - "stretch": { - } - }, - "LegLeft": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ -66, 0, 0 ], - "14": [ -38, 0, 0 ], - "30": [ 10, 0, 0 ], - "44": [ 20, 0, 0 ], - "60": [ -66, 0, 0 ] - }, - "stretch": { - } - }, - "LegLeftLow": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 70, 0, 0 ], - "14": [ 40, 0, 0 ], - "30": [ 15, 0, 0 ], - "44": [ 40, 0, 0 ], - "60": [ 70, 0, 0 ] - }, - "stretch": { - } - }, - "LegRightLow": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 15, 0, 0 ], - "14": [ 40, 0, 0 ], - "30": [ 70, 0, 0 ], - "44": [ 40, 0, 0 ], - "60": [ 15, 0, 0 ] - }, - "stretch": { - } - }, - "BodyInner": { - "position": { - "0": [ 0, 0, 0 ], - "14": [ 0, -2, 0 ], - "30": [ 0, 0, 0 ], - "44": [ 0, -2, 0 ], - "60": [ 0, 0, 0 ] - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 6, 0, 0 ], - "14": [ 6, -3, 0 ], - "30": [ 6, 0, 0 ], - "44": [ 6, 3, 0 ], - "60": [ 6, 0, 0 ] - }, - "stretch": { - } - }, - "ArmRight": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ -17, 0, 0 ], - "14": [ -37, 0, 0 ], - "30": [ 13, 0, 0 ], - "44": [ 37, 0, 0 ], - "60": [ -17, 0, 0 ] - }, - "stretch": { - } - }, - "ArmRightLower": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ -80, 0, 0 ], - "14": [ -85, 0, 0 ], - "30": [ -75, 0, 0 ], - "44": [ -70, 0, 0 ], - "60": [ -80, 0, 0 ] - }, - "stretch": { - } - }, - "ArmLeft": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 15, 0, 0 ], - "14": [ 30, 0, 0 ], - "30": [ -13, 0, 0 ], - "44": [ -37, 0, 0 ], - "60": [ 15, 0, 0 ] - }, - "stretch": { - } - }, - "ArmLeftLower": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ -75, 0, 0 ], - "14": [ -70, 0, 0 ], - "30": [ -80, 0, 0 ], - "44": [ -85, 0, 0 ], - "60": [ -75, 0, 0 ] - }, - "stretch": { - } - }, - "Waist": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 0, 0, 0 ], - "14": [ 0, 3, 0 ], - "30": [ 0, 0, 0 ], - "44": [ 0, -3, 0 ], - "60": [ 0, 0, 0 ] - }, - "stretch": { - } - }, - "Head": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 3, 0, 0 ], - "14": [ 5, 3, 0 ], - "30": [ 3, 0, 0 ], - "44": [ 5, -3, 0 ], - "60": [ 3, 0, 0 ] - }, - "stretch": { - } - } - } -} \ No newline at end of file diff --git a/src/main/src/main/resources/assets/tektopiathief/craftstudio/animations/entity/villager_run.csjsmodelanim b/src/main/src/main/resources/assets/tektopiathief/craftstudio/animations/entity/villager_run.csjsmodelanim deleted file mode 100644 index 230cdd7..0000000 --- a/src/main/src/main/resources/assets/tektopiathief/craftstudio/animations/entity/villager_run.csjsmodelanim +++ /dev/null @@ -1,225 +0,0 @@ -{ - "title": "villager_run", - "duration": 48, - "holdLastKeyframe": false, - "nodeAnimations": { - "ArmRight": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 84.83739, 180, 180 ], - "6": [ 11.78185, 0, 0 ], - "12": [ -3.300033, 0, 0 ], - "18": [ -22.03195, 0, 0 ], - "24": [ -27.6759, 0, 0 ], - "30": [ -11, 0, 0 ], - "36": [ 22, 0, 0 ], - "42": [ 82.00001, 0, 0 ], - "48": [ 84.84001, -180, -180 ] - }, - "stretch": { - } - }, - "ArmRightLower": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ -76.26399, 0, 0 ], - "6": [ -5.551117, 0, 0 ], - "12": [ -58.02976, 0, 0 ], - "18": [ -73.98796, 0, 0 ], - "24": [ -74.44, 0, 0 ], - "30": [ -20, 0, 0 ], - "36": [ -29, 0, 0 ], - "42": [ -53, 0, 0 ] - }, - "stretch": { - } - }, - "ArmLeft": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ -30.62553, 0, 0 ], - "6": [ -12.24518, 0, 0 ], - "12": [ 20.73323, 0, 0 ], - "18": [ 81.43279, 0, 0 ], - "24": [ 72.72844, 0, 0 ], - "30": [ 10.96364, 0, 0 ], - "36": [ -4.036357, 0, 0 ], - "42": [ -23.03635, 0, 0 ] - }, - "stretch": { - } - }, - "ArmLeftLower": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ -81.69748, 0, 0 ], - "6": [ -19.71957, 0, 0 ], - "12": [ -28.57, 0, 0 ], - "18": [ -53.4287, 0, 0 ], - "24": [ -35.17767, 0, 0 ], - "30": [ -5, 0, 0 ], - "36": [ -58, 0, 0 ], - "42": [ -74, 0, 0 ] - }, - "stretch": { - } - }, - "LegRight": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ -26.61, 0, 0 ], - "6": [ -22.34, 0, 0 ], - "12": [ 21.7469, 0, 0 ], - "18": [ 29.11156, 0, 0 ], - "24": [ 27.38299, 0, 0 ], - "30": [ -23.97653, 0, 0 ], - "36": [ -54, 0, 0 ], - "42": [ -53, 0, 0 ], - "48": [ -26.61, 0, 0 ] - }, - "stretch": { - } - }, - "LegRightLow": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 0, 0, 0 ], - "6": [ 40.90926, 0, 0 ], - "12": [ 0, 0, 0 ], - "18": [ 67.17234, 0, 0 ], - "24": [ 73.81545, 0, 0 ], - "30": [ 86.58116, 0, 0 ], - "36": [ 80.99999, 0, 0 ], - "42": [ 14, 0, 0 ], - "48": [ 0, 0, 0 ] - }, - "stretch": { - } - }, - "LegLeft": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 28.5528, 0, 0 ], - "6": [ -34.67481, 0, 0 ], - "12": [ -54.0908, 0, 0 ], - "18": [ -52.69171, 0, 0 ], - "24": [ -26.90387, 0, 0 ], - "30": [ -22, 0, 0 ], - "36": [ 22, 0, 0 ], - "42": [ 29, 0, 0 ], - "48": [ 28.55, 0, 0 ] - }, - "stretch": { - } - }, - "LegLeftLow": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 83.50278, 0, 0 ], - "6": [ 73.61281, -180, -180 ], - "12": [ 81.09483, 7.125579E-06, 7.344866E-06 ], - "18": [ 13.993, 0, 0 ], - "24": [ 2.754015, 0, 0 ], - "30": [ 40, 0, 0 ], - "36": [ 0, 0, 0 ], - "42": [ 66.99999, 0, 0 ], - "48": [ 83.49998, 0, 0 ] - }, - "stretch": { - } - }, - "BodyInner": { - "position": { - "0": [ 0, -0.5, 0 ], - "6": [ 0, -1.5, 0 ], - "14": [ 0, 0, 0 ], - "18": [ 0, 0.5, 0 ], - "24": [ 0, -0.5, 0 ], - "30": [ 0, -1.5, 0 ], - "38": [ 0, 0, 0 ], - "48": [ 0, -0.5, 0 ] - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 8, -5, -4.4521E-09 ], - "24": [ 8, 5, 4.4521E-09 ], - "48": [ 8, -5, -4.4521E-09 ] - }, - "stretch": { - } - }, - "Waist": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ -8, 5, -4.4521E-09 ], - "24": [ -8, -5, 4.4521E-09 ], - "48": [ -8, 5, -4.4521E-09 ] - }, - "stretch": { - } - }, - "Head": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 0, 2, 0 ], - "24": [ 0, -2, 0 ], - "48": [ 0, 2, 0 ] - }, - "stretch": { - } - } - } -} \ No newline at end of file diff --git a/src/main/src/main/resources/assets/tektopiathief/craftstudio/animations/entity/villager_walk.csjsmodelanim b/src/main/src/main/resources/assets/tektopiathief/craftstudio/animations/entity/villager_walk.csjsmodelanim deleted file mode 100644 index 48cd4c3..0000000 --- a/src/main/src/main/resources/assets/tektopiathief/craftstudio/animations/entity/villager_walk.csjsmodelanim +++ /dev/null @@ -1,199 +0,0 @@ -{ - "title": "villager_walk", - "duration": 60, - "holdLastKeyframe": false, - "nodeAnimations": { - "LegRight": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 0, 0, 0 ], - "14": [ 38, 0, 0 ], - "30": [ -43.98011, 0, 0 ], - "44": [ -38, 0, 0 ], - "60": [ 0, 0, 0 ] - }, - "stretch": { - } - }, - "LegLeft": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ -48, 0, 0 ], - "14": [ -38, 0, 0 ], - "30": [ 0, 0, 0 ], - "44": [ 38, 0, 0 ], - "60": [ -48.36, 0, 0 ] - }, - "stretch": { - } - }, - "LegLeftLow": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 61.16214, 0, 0 ], - "14": [ 1.89483, 0, 0 ], - "30": [ 0, 0, 0 ], - "44": [ 0, 0, 0 ], - "60": [ 61.15999, 0, 0 ] - }, - "stretch": { - } - }, - "LegRightLow": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 0, 0, 0 ], - "14": [ 0, 0, 0 ], - "30": [ 49.78373, 0, 0 ], - "44": [ 0, 0, 0 ], - "60": [ 0, 0, 0 ] - }, - "stretch": { - } - }, - "BodyInner": { - "position": { - "0": [ 0, 0, 0 ], - "14": [ 0, -2, 0 ], - "30": [ 0, 0, 0 ], - "44": [ 0, -2, 0 ], - "60": [ 0, 0, 0 ] - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 0, 0, 0 ], - "14": [ 0, -3, 0 ], - "30": [ 0, 0, 0 ], - "44": [ 0, 3, 0 ], - "60": [ 0, 0, 0 ] - }, - "stretch": { - } - }, - "ArmRight": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ -17.25, 0, 0 ], - "14": [ -37.12, 0, 0 ], - "30": [ 13.77, 0, 0 ], - "44": [ 37.2, 0, 0 ], - "60": [ -17.25, 0, 0 ] - }, - "stretch": { - } - }, - "ArmRightLower": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ -7.199999, 0, 0 ], - "14": [ -24.56, 0, 0 ], - "30": [ 0, 0, 0 ], - "44": [ -38.24001, 0, 0 ], - "60": [ -7.199999, 0, 0 ] - }, - "stretch": { - } - }, - "ArmLeft": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 12.73364, 0, 0 ], - "14": [ 36.16364, 0, 0 ], - "30": [ -18.28636, 0, 0 ], - "44": [ -38.15636, 0, 0 ], - "60": [ 12.73364, 0, 0 ] - }, - "stretch": { - } - }, - "ArmLeftLower": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 0, 0, 0 ], - "14": [ -38.24001, 0, 0 ], - "30": [ -7.199999, 0, 0 ], - "44": [ -24.56, 0, 0 ], - "60": [ 0, 0, 0 ] - }, - "stretch": { - } - }, - "Waist": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 0, 0, 0 ], - "14": [ 0, 3, 0 ], - "30": [ 0, 0, 0 ], - "44": [ 0, -3, 0 ], - "60": [ 0, 0, 0 ] - }, - "stretch": { - } - }, - "Head": { - "position": { - }, - "offsetFromPivot": { - }, - "size": { - }, - "rotation": { - "0": [ 0, 0, 0 ], - "14": [ 0, 3, 0 ], - "30": [ 0, 0, 0 ], - "44": [ 0, -3, 0 ], - "60": [ 0, 0, 0 ] - }, - "stretch": { - } - } - } -} \ No newline at end of file diff --git a/src/main/src/main/resources/assets/tektopiathief/craftstudio/models/entity/thief_m.csjsmodel b/src/main/src/main/resources/assets/tektopiathief/craftstudio/models/entity/thief_m.csjsmodel deleted file mode 100644 index ee3e8c3..0000000 --- a/src/main/src/main/resources/assets/tektopiathief/craftstudio/models/entity/thief_m.csjsmodel +++ /dev/null @@ -1,149 +0,0 @@ -{ - "title": "Thief", - "tree": [ - { - "name": "BodyInner", - "position": [ 0, 13, 0 ], - "offsetFromPivot": [ 0, 5, 0 ], - "size": [ 8, 12, 6 ], - "rotation": [ 0, 0, 0 ], - "texOffset": [ 16, 20 ], - "children": [ - { - "name": "ArmLeft", - "position": [ 6, 5, 0 ], - "offsetFromPivot": [ 0, -3.5, 0 ], - "size": [ 4, 7, 4 ], - "rotation": [ 1.036357, 0, 0 ], - "texOffset": [ 44, 22 ], - "children": [ - { - "name": "ArmLeftLower", - "position": [ -4.768372E-07, -3, 0 ], - "offsetFromPivot": [ 0, -3.5, 0 ], - "size": [ 4, 6, 4 ], - "rotation": [ 0, 0, 0 ], - "texOffset": [ 44, 37 ], - "children": [] - } - ] - }, - { - "name": "ArmRight", - "position": [ -6, 5, 0 ], - "offsetFromPivot": [ 0, -3.5, 0 ], - "size": [ 4, 7, 4 ], - "rotation": [ 0, 0, 0 ], - "vertexCoords": [ - [ 2, 3.5, -2 ], - [ -2, 3.5, -2 ], - [ -2, -3.5, -2 ], - [ 2, -3.5, -2 ], - [ -2, 3.5, 2 ], - [ 2, 3.5, 2 ], - [ 2, -3.5, 2 ], - [ -2, -3.5, 2 ] - ], - "texOffset": [ 44, 22 ], - "children": [ - { - "name": "ArmRightLower", - "position": [ 4.768372E-07, -3, 0 ], - "offsetFromPivot": [ 0, -3.5, 0 ], - "size": [ 4, 6, 4 ], - "rotation": [ 0, 0, 0 ], - "vertexCoords": [ - [ 2, 3, -2 ], - [ -2, 3, -2 ], - [ -2, -3, -2 ], - [ 2, -3, -2 ], - [ -2, 3, 2 ], - [ 2, 3, 2 ], - [ 2, -3, 2 ], - [ -2, -3, 2 ] - ], - "texOffset": [ 44, 37 ], - "children": [] - } - ] - }, - { - "name": "Head", - "position": [ 0, 11, 0 ], - "offsetFromPivot": [ 0, 0, 0 ], - "size": [ 8, 10, 8 ], - "rotation": [ 0, 0, 0 ], - "texOffset": [ 0, 0 ], - "children": [ - { - "name": "Nose", - "position": [ 0, -3, 5 ], - "offsetFromPivot": [ 0, 0, 0 ], - "size": [ 2, 4, 2 ], - "rotation": [ 0, 0, 0 ], - "texOffset": [ 24, 0 ], - "children": [] - }, - { - "name": "EyeLids", - "position": [ 0, -1.5, 3 ], - "offsetFromPivot": [ 0, 0, 0 ], - "size": [ 6, 1, 1 ], - "rotation": [ 0, 0, 0 ], - "texOffset": [ 1, 19 ], - "children": [] - } - ] - }, - { - "name": "Waist", - "position": [ 0, -5, 0 ], - "offsetFromPivot": [ 0, 0, 0 ], - "size": [ 1, 1, 1 ], - "rotation": [ 0, 0, 0 ], - "texOffset": [ 15, 15 ], - "children": [ - { - "name": "LegLeft", - "position": [ 2, 1, 0 ], - "offsetFromPivot": [ 0, -5, 0 ], - "size": [ 4, 6, 4 ], - "rotation": [ 0, 0, 0 ], - "texOffset": [ 0, 22 ], - "children": [ - { - "name": "LegLeftLow", - "position": [ 0, -1, 0 ], - "offsetFromPivot": [ 0, -5, 0 ], - "size": [ 4, 6, 4 ], - "rotation": [ 0, 0, 0 ], - "texOffset": [ 0, 32 ], - "children": [] - } - ] - }, - { - "name": "LegRight", - "position": [ -2, 1, 0 ], - "offsetFromPivot": [ 0, -5, 0 ], - "size": [ 4, 6, 4 ], - "rotation": [ 0, 0, 0 ], - "texOffset": [ 0, 22 ], - "children": [ - { - "name": "LegRightLow", - "position": [ 0, -1, 0 ], - "offsetFromPivot": [ 0, -5, 0 ], - "size": [ 4, 6, 4 ], - "rotation": [ 0, 0, 0 ], - "texOffset": [ 0, 32 ], - "children": [] - } - ] - } - ] - } - ] - } - ] -} diff --git a/src/main/src/main/resources/assets/tektopiathief/lang/en_US.lang b/src/main/src/main/resources/assets/tektopiathief/lang/en_US.lang deleted file mode 100644 index 829c707..0000000 --- a/src/main/src/main/resources/assets/tektopiathief/lang/en_US.lang +++ /dev/null @@ -1,105 +0,0 @@ -#en_US -#This is the Main language configuration file -# -#If you want to color code the text then I recommend you visit http://www.minecraftwiki.net/wiki/Formatting_codes#Color_codes -#To create the § symbol which is used for assigning a color to the following text press Alt + 21 on Windows. For other OSes, view the above link. -#This file needs to be UTF-8 encoded to work with MC 1.7+ - -# Formatting codes -# Code Name -# §0 black -# §1 dark_blue -# §2 dark_green -# §3 dark_aqua -# §4 dark_red -# §5 dark_purple -# §6 gold -# §7 gray -# §8 dark_gray -# §9 blue -# §a green -# §b aqua -# §c red -# §d light_purple -# §e yellow -# §f white - -# §k Obfuscated -# §l Bold -# §m Strikethrough -# §n Underline -# §o Italic -# §r Reset - - -#========== -#= Config = -#========== - -#== Debug == -config.debug=Debug -config.debug.tooltip=Debug settings - -config.debug.enableDebug=Enable Debug -config.debug.enableDebug.tooltip=If true, debug information will be output to the console. - -#== Thief == -config.thief=Thief -config.thief.tooltip=Thief settings - -config.thief.checksvillagesize=Checks Village Size -config.thief.checksvillagesize.tooltip=If enabled, when trying to spawn a thief it will check the size of the village. The more villagers the more often the thief will spawn. -config.thief.thiefspawnswhenpeaceful=Thief Spawns on Peaceful Difficulty -config.thief.thiefspawnswhenpeaceful.tooltop=If enabled, the Thief will spawn even if the difficulty is set to Peaceful. -config.thief.thiefdetectsplayer=Thief Detects Players -config.thief.thiefdetectsplayer.tooltop=If enabled, the Thief will detect players and flee from them. -config.thief.thiefgraceperiod=Thief Grace Period -config.thief.thiefgraceperiod.tooltip=The number of days before the thief visits the village again after they were successful. Set the 0 to disable to grace period. - -#============ -#= Commands = -#============ -commands.thief.usage=/thief - -commands.thief.spawn.usage=/thief spawn [me] -commands.thief.spawn.success=§aThief has appeared at %s -commands.thief.spawn.failed=§cThief spawn failed -commands.thief.spawn.badconditions=§cThief spawn failed...spawn conditions not valid -commands.thief.spawn.exists=§eThief spawn failed...Thief already located in the village -commands.thief.spawn.noposition=§cThief spawn failed...no spawn position found -commands.thief.spawn.novillage=§cThief spawn failed...no village found -commands.thief.spawn.peaceful=§cThief spawn failed...difficulty set to Peaceful - -commands.thief.kill.usage=/thief kill -commands.thief.kill.novillage=§cThief kill failed...no village found -commands.thief.kill.noexists=§eThief kill failed...Thief not located in the village -commands.thief.kill.success=§aThief has been killed - -#================= -#= Chat Messages = -#================= - -message.thief.exists=§cThief already located in village %s -message.thief.noposition.village=§cCould not find a spawn location for the Thief in village %s -message.thief.spawned.village=§aThief (level %s) has appeared in village %s at %s -message.thief.villagecheckfailed=§cThief village check failed, village %s; size %s; check value %s -message.thief.villagechecksuccess=§cThief village check success, village %s; size %s; check value %s -message.thief.spawnblocked=§cThief spawn blocked by storage marker rotation in village %s -message.thief.peaceful=§cThief spawn schedule skipped, difficulty set to Peaceful -message.thief.graceperiod=§cThief spawn skipped due to grace period in village %s - -message.thief.seen=§6A Thief has been spotted in the village -message.thief.escaped=§6A Thief has escaped the village -message.thief.escapedseen=§6The Thief has escaped the village -message.thief.escapedwith=with %s -message.thief.killed=§dThe Thief has been killed -message.thief.killedby=by %s -message.thief.damage=§dThe Thief has taken %s damage -message.thief.damagefrom=from %s - -#============ -#= Entities = -#============ - -entity.thief.name=Thief -entity.thief.information=§bThe Thief is a passive enemy that wanders into your village. The thief will try to steal items from your storage. diff --git a/src/main/src/main/resources/assets/tektopiathief/textures/enemies/entitythief_f.png b/src/main/src/main/resources/assets/tektopiathief/textures/enemies/entitythief_f.png deleted file mode 100644 index 690b35b..0000000 Binary files a/src/main/src/main/resources/assets/tektopiathief/textures/enemies/entitythief_f.png and /dev/null differ diff --git a/src/main/src/main/resources/assets/tektopiathief/textures/enemies/entitythief_m.png b/src/main/src/main/resources/assets/tektopiathief/textures/enemies/entitythief_m.png deleted file mode 100644 index 6c59e49..0000000 Binary files a/src/main/src/main/resources/assets/tektopiathief/textures/enemies/entitythief_m.png and /dev/null differ diff --git a/src/main/src/main/resources/assets/tektopiathief/textures/entity/thief_f.png b/src/main/src/main/resources/assets/tektopiathief/textures/entity/thief_f.png deleted file mode 100644 index 5cb04c0..0000000 Binary files a/src/main/src/main/resources/assets/tektopiathief/textures/entity/thief_f.png and /dev/null differ diff --git a/src/main/src/main/resources/assets/tektopiathief/textures/entity/thief_m.png b/src/main/src/main/resources/assets/tektopiathief/textures/entity/thief_m.png deleted file mode 100644 index 79d34f6..0000000 Binary files a/src/main/src/main/resources/assets/tektopiathief/textures/entity/thief_m.png and /dev/null differ diff --git a/src/main/src/main/resources/assets/tektopiathief/textures/entity_icon/thief.png b/src/main/src/main/resources/assets/tektopiathief/textures/entity_icon/thief.png deleted file mode 100644 index e8c2338..0000000 Binary files a/src/main/src/main/resources/assets/tektopiathief/textures/entity_icon/thief.png and /dev/null differ diff --git a/src/main/src/main/resources/assets/tektopiathief/textures/entity_icon/thief_f.png b/src/main/src/main/resources/assets/tektopiathief/textures/entity_icon/thief_f.png deleted file mode 100644 index e8c2338..0000000 Binary files a/src/main/src/main/resources/assets/tektopiathief/textures/entity_icon/thief_f.png and /dev/null differ diff --git a/src/main/src/main/resources/assets/tektopiathief/textures/entity_icon/thief_m.png b/src/main/src/main/resources/assets/tektopiathief/textures/entity_icon/thief_m.png deleted file mode 100644 index e8c2338..0000000 Binary files a/src/main/src/main/resources/assets/tektopiathief/textures/entity_icon/thief_m.png and /dev/null differ diff --git a/src/main/src/main/resources/assets/tektopiathief/textures/logo.png b/src/main/src/main/resources/assets/tektopiathief/textures/logo.png deleted file mode 100644 index 4272195..0000000 Binary files a/src/main/src/main/resources/assets/tektopiathief/textures/logo.png and /dev/null differ diff --git a/src/main/src/main/resources/mcmod.info b/src/main/src/main/resources/mcmod.info deleted file mode 100644 index 37b7083..0000000 --- a/src/main/src/main/resources/mcmod.info +++ /dev/null @@ -1,23 +0,0 @@ -{ - "modListVersion": 2, - "modList": [{ - "modid": "tektopiathief", - "name": "Tektopia Thief", - "description": "§fThis extension adds a thief for use with §bTektopia§a ${tektopia_version}§f. -§fBuilt with: - §bForge§f ${forge_version}", - "version": "${mod_version}", - "mcversion": "${minecraft_version}", - "url": "https://www.curseforge.com/minecraft/mc-mods/tektopia-thief", - "updateUrl": "https://github.com/Bletch1971/TektopiaThief", - "authorList": ["§6Bletch§r"], - "credits": "TangoTek for creating the TekTopia mod", - "logoFile": "assets/tektopiathief/textures/logo.png", - "screenshots": [], - "parent": "", - "requiredMods": ["tektopia"], - "dependencies": [], - "dependants": [], - "useDependencyInformation": true - }] -} \ No newline at end of file diff --git a/src/main/updateforge.json b/src/main/updateforge.json deleted file mode 100644 index 1562df0..0000000 --- a/src/main/updateforge.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "homepage": "https://minecraft.curseforge.com/projects/tektopia-thief", - "promos": { - "1.12.2-latest": "1.3.0", - "1.12.2-recommended": "1.3.0" - }, - "1.12.2":{ - "1.0.0": "Initial alpha release.", - "1.1.0": "Updated entity models.\nAdded config option for Thief to detect players.\nFixed escape notification.\nWhen killed will notify player of any dropped items.\nSpawn and Kill command clean-up.", - "1.2.0": "Added glowing effect to the thief when seen or injured.\nMinor adjustments to the desire counts.\nChanged start time of thief to 10:00pm.\nAdded a grace period of 2 days after the thief successfully steals an item from the village.", - "1.2.1": "Fixed a crashing bug when setting the thief's grace period.\nAdded a config option to set the grace period.", - "1.3.0": "Fixed a crashing bug when trying to calculate the creep speed of the thief and no village has been assigned." - } -} diff --git a/src/main/upgrade.bat b/src/main/upgrade.bat deleted file mode 100644 index 6e5b8b2..0000000 --- a/src/main/upgrade.bat +++ /dev/null @@ -1,14 +0,0 @@ -@echo off - -set WORKDIR=%CD% - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. - -cd /d "%DIRNAME%" - -call gradlew.bat wrapper --gradle-version=4.10.3 - -cd /d "%WORKDIR%" - -pause \ No newline at end of file