Compare commits

..
65 Commits
Author SHA1 Message Date
KAMKEEL 3454ecb78a Update Version 2022-04-03 14:37:50 -04:00
KAMKEEL 57de575d42 Merge branch 'dev' 2022-04-03 14:36:11 -04:00
Kamron Vaswani 8ab652361e Merge pull request #41 from c0508383/master
Alex Solid Armor Fix & GLOBAL NPC SCRIPTS
2022-04-03 14:35:27 -04:00
Luis C.M 694afb7b6b Possible fix for instant complete kill quests having their progress stuck. 2022-03-24 20:42:38 -05:00
Luis C.M 464f5ecb1e Fixed scaling issue on custom gui textured rectangles 2022-03-24 01:58:39 -05:00
Luis C.M 3066e1dfbc Global event script buttons and the script GUI for an NPC are enabled/disabled/darkened based on their respective configs. 2022-03-23 18:54:55 -05:00
Luis C.M 286f6862cb Small clarifications in the new scripting configs, and removed some unused imports. 2022-03-23 17:48:58 -05:00
Luis C.M 9a244ca2fe Renamed NPCs button on GUI, added configs for enabling player, forge, NPC, and all scripts. 2022-03-23 17:42:35 -05:00
Luis C.M 33378fba59 Merge remote-tracking branch 'origin/master' 2022-03-23 04:02:20 -05:00
Luis C.M e26a0a1bd5 null NPC check for NPC events 2022-03-23 04:02:01 -05:00
Luis C.M 50fe08ce2e Merge branch 'KAMKEEL:master' into master 2022-03-23 03:55:08 -05:00
Luis C.M 18ff2bff78 Implemented Global NPC Events!
All NPCs activate these scripts. If a player wants to create a script that's universally used by all NPCs, this allows for that to happen with a lot of ease!
2022-03-23 03:54:06 -05:00
Luis C.M 092592bd27 Fixed Alex solid armwear 2022-03-23 01:24:24 -05:00
Luis C.M 769a574210 Fixed setHunger/Saturation using client-side functions from FoodStats 2022-03-19 22:51:39 -05:00
Luis C.M df2e742cbb Added overloaded spawnParticle functions for ScriptEntity 2022-03-16 23:15:30 -05:00
KAMKEEL c0bac481ad [WIP] Arm Fix 2022-03-15 02:03:58 -04:00
KAMKEEL d867017871 Merge branch 'master' of https://github.com/KAMKEEL/CustomNPC-Plus 2022-03-15 00:21:00 -04:00
Kamron Vaswani 1752cdd14d Merge pull request #40 from c0508383/master
Spring Pull Request
2022-03-15 00:18:12 -04:00
KAMKEEL 1e771bce8a Update GuiContainerNPCInterface2.java
Cleanup
2022-03-15 00:16:44 -04:00
KAMKEEL a507f06d7f Fix Texture Issue in Menu 2022-03-14 03:15:42 -04:00
KAMKEEL df5c6afd2e Update Version 2022-03-14 02:24:43 -04:00
KAMKEEL dafd5f4460 Fix Sizing for Clone Menu 2022-03-14 02:24:32 -04:00
KAMKEEL 08fb12f716 Fixed Compressor Messages 2022-03-14 00:26:19 -04:00
Kamron Vaswani c0fa3935cd Update README.md 2022-03-14 00:10:06 -04:00
Kamron Vaswani a10d79da9b Merge pull request #36 from luiz-otavio/feat/zstd-compressor
feat: add config property to use `Zstd` compression instead of `JSON`
2022-03-14 00:08:54 -04:00
Kamron Vaswani 0226001596 Merge branch 'dev' into feat/zstd-compressor 2022-03-14 00:07:23 -04:00
luisc 60e14f548e Custom GUIs now only close when the ESC key is pressed. 2022-03-09 00:33:55 -06:00
luisc 16321dd4ff Added hasLore() function to ScriptItemStack
Fixed getLore() null pointer error
2022-03-06 13:47:47 -06:00
luisc 1cb27a9e7a Implemented XYZ rotations correctly, now clearly rotate around an axis respective to the player's camera. 2022-03-04 18:08:05 -06:00
Kamron Vaswani 89b7019e29 Delete CompressorTest.java
Not needed in final version
2022-03-03 16:02:02 -05:00
Kamron Vaswani 3339488a6f Version Correction 2022-03-03 15:59:17 -05:00
Kamron Vaswani 1a7267349f Update Config Description with Warning 2022-03-03 15:58:21 -05:00
luiz-otavio 5578f2055e fix(gradle): assign resourcesDir to classesDir from sourcesSets 2022-03-03 17:50:28 -03:00
luiz-otavio e23620d724 refactor: use JSONas default codec for PlayerData instead of .dat files 2022-03-03 17:43:18 -03:00
KAMKEEL 3bc9686816 ReadMe | Texture Pack | Version Change
Updated ReadME with Donation Link
Added CNPCs TexturePack
Updated Version for future 1.5.1 full release
2022-03-03 15:38:01 -05:00
KAMKEEL 805054ceb0 Merge branch 'master' into dev 2022-03-03 14:51:35 -05:00
luisc 75b7c01f87 Removed some unnecessary fields in ScriptEntityParticle 2022-03-02 19:36:15 -06:00
luisc f1741b4660 Removed some unnecessary lines of OpenGL code 2022-03-02 19:35:24 -06:00
luisc 7f8246e04e PARTICLE ROTATION 2022-03-02 18:18:03 -06:00
luisc 65ab37158f Fixed flying limits not working on flying NPCs with the new smoother flight 2022-02-27 23:23:41 -06:00
luisc d2d3cef681 When setMaxTicks() is called and the remaining ticks in a timer are greater than that value, the remaining ticks are updated to the new max tick value. 2022-02-27 23:11:52 -06:00
luisc 403738262c Added timer functions.
ticks(int id):
Gets the remaining ticks in the timer that matches this id.

setTicks(int id, int ticks):
Sets the remaining ticks in the timer that matches this id.

maxTicks(int id):
Gets the maximum ticks that must elapse for the timer that matches this id to finish.

setMaxTicks(int id, int ticks):
Sets the maximum ticks that must elapse for the timer that matches this id to finish.

repeats(int id):
Returns true if the timer with the given id is set to repeat, false otherwise.

setRepeats(int id, bool repeat):
Sets whether the timer with the given id should repeat. If true, the timer will repeat, and not repeat otherwise.
2022-02-27 23:08:24 -06:00
luiz-otavio 90c6574125 fix: ensure playerdata type and remove useless checking about transforming 2022-02-27 08:12:24 -03:00
luiz-otavio 7b0a6b7497 feat: add some utilities messages on each case of compressor command 2022-02-27 08:11:48 -03:00
luiz-otavio 54fa6d106f chore: add shade configuration 2022-02-27 08:10:53 -03:00
luiz-otavio 451a60f297 test: make CompressorTest to retrieve the measure time of compression to see how much each one will take 2022-02-27 07:00:42 -03:00
luiz-otavio 3ac531a49d feat: add compressor command to convert data files to zstd or json 2022-02-27 06:59:24 -03:00
luiz-otavio 34b6eb05e5 feat: integrate the compressor type to config property and add number of IO-Workers to write compressed files 2022-02-27 06:58:53 -03:00
luiz-otavio 4bdbe0efee refactor: ensure almost compression types to load/write each NBTTagCompound 2022-02-27 06:57:37 -03:00
luiz-otavio c3bba543f0 feat: add ZstdCompressor to write/read almost compressed data 2022-02-27 06:56:57 -03:00
luiz-otavio d4f6df5a81 chore: add zstd and modify encoding on compile time to UTF-8 2022-02-27 06:56:20 -03:00
luisc 22b622d46c Fixed hovering text for custom GUI labels and textured rectangles. 2022-02-23 00:39:01 -06:00
luisc ee02988d8c Removed client-side imports from EntityNPCFlying 2022-02-22 22:14:05 -06:00
luisc 450e065e27 Slightly improved flight pathing downwards. 2022-02-22 01:52:47 -06:00
luisc c2a669fbeb The setForm() function in ScriptDBCPlayer prevents crashes from form levels that are out of bounds now. 2022-02-21 20:16:42 -06:00
luisc 732e97e0fe Override updateLeashedState() function in EntityNPCInterface.
NPCs can't be leashed anyway. This should avoid the "does not know how to add entity" crash with NPCs.
2022-02-20 00:56:57 -06:00
luisc 33e884c217 Flying is now smoother, NPCs can pathfind downwards easier while flying. 2022-02-18 03:34:20 -06:00
luisc 3d1caf494b Small fix to min XP and max XP text fields in NPC inventory menu 2022-02-16 12:57:46 -06:00
luisc 18e02461a6 Added misspelled cancel functions to player & forge events, and correctly spelled cancel functions to npc events 2022-02-06 12:39:07 -06:00
Luis C.M 6bfbffb0e6 Merge branch 'KAMKEEL:master' into master 2022-02-05 23:58:11 -06:00
KAMKEEL e42c4cab7e Update ScriptLivingBase.java 2022-02-05 20:35:44 -05:00
luisc 47f41ff5b7 Added custom kill types 2022-02-02 22:11:49 -06:00
KAMKEEL 5a86d1cc6f Delete Scripting_Documentation.pdf 2022-02-02 19:58:36 -05:00
KAMKEEL 7d647d788f Version Update 2022-02-02 19:42:58 -05:00
KAMKEEL 01e568d0c7 Remove More Print Statements 2022-02-02 19:41:34 -05:00
65 changed files with 1783 additions and 512 deletions

No files matched your search

Binary file not shown.
+5 -3
View File
@@ -9,7 +9,7 @@ Link to CurseForge: [HERE](https://www.curseforge.com/minecraft/mc-mods/customnp
### ❗ Notice
I am not the original creator of CustomNPC. The original creator is @[Noppes](https://github.com/Noppes). I have been permitted to update the 1.7.10 and post my results on GitHub. The original mod that is updated to the latest versions of Minecraft can be found on these links: [CurseForge](https://www.curseforge.com/minecraft/mc-mods/custom-npcs), [kodevelopment](http://www.kodevelopment.nl/minecraft/customnpcs)
### 🔹 First Release! V1.0 (Installation)
### 🔹 Installation
This mod is an ***update*** to CustomNPC and not an add-on. Do not install CustomNPC with CustomNPC-Plus. CustomNPC-Plus does not remove any functional features from the original mod. It expands upon CustomNPC with original features and backported features from newer versions. Simply drag CustomNPC-Plus into any client/server mods folder to utilize. Please **backup** before using as this could still have unforeseen errors. Report any bugs if found, thank you and enjoy.
### ❓ Features:
@@ -32,7 +32,8 @@ This mod is an ***update*** to CustomNPC and not an add-on. Do not install Custo
- Custom Part Disabling
- Markov Name Generator
- Flying NPCS
- Better Script Speeds
- PlayerData Storage Options [JSON/Zstd]
- Script Enchanments and Fixes
- Scripting Additions: [Documentation](https://github.com/PewDizinho/CustomNPCPlus-Script-Documentation)
--- Please Suggest New Features!
@@ -56,5 +57,6 @@ This mod is an ***update*** to CustomNPC and not an add-on. Do not install Custo
[![Discord Badge](https://img.shields.io/badge/CustomNPC-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/rgeWsmQaKa)
[![Discord Badge](https://img.shields.io/badge/CustomNPC+-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/pQqRTvFeJ5)
[![Download CustomNPC+](https://img.shields.io/badge/Download⠀CustomNPC⠀Plus!-0081CB?style=for-the-badge&logo=material-ui&logoColor=white)](https://www.curseforge.com/minecraft/mc-mods/customnpc-plus)
[![Download CustomNPC+](https://img.shields.io/badge/Download⠀Plugin⠀Mod!-0081CB?style=for-the-badge&logo=material-ui&logoColor=white)](https://github.com/KAMKEEL/Plugin-Mod)
[![Download PluginMod](https://img.shields.io/badge/Download⠀Plugin⠀Mod!-0081CB?style=for-the-badge&logo=material-ui&logoColor=white)](https://github.com/KAMKEEL/Plugin-Mod)
<a href="https://ko-fi.com/kamkeel"> <img src="https://i.imgur.com/zvdVbeW.png" alt="Support Me on Kofi" width="180" height="27"> </a>
Binary file not shown.
+19 -2
View File
@@ -17,7 +17,7 @@ buildscript {
apply plugin: 'forge'
version = "1.5.1-beta"
version = "1.5.2"
group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "CustomNPC-Plus"
@@ -29,6 +29,11 @@ minecraft {
sourceCompatibility = 1.8
targetCompatibility = 1.8
configurations {
shade
compile.extendsFrom shade
}
dependencies {
// you may put jars on which you depend on in ./libs
// or you may define them like so..
@@ -42,7 +47,7 @@ dependencies {
// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
shade 'com.github.luben:zstd-jni:1.5.2-2'
}
processResources
@@ -65,4 +70,16 @@ processResources
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
jar {
configurations.shade.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
}
sourceSets {main { output.resourcesDir = output.classesDir }}
@@ -0,0 +1,187 @@
package foxz.command;
import foxz.commandhelper.ChMcLogger;
import foxz.commandhelper.annotations.Command;
import foxz.commandhelper.annotations.SubCommand;
import foxz.commandhelper.permissions.OpOnly;
import me.luizotavio.compressor.ZstdCompressor;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.controllers.PlayerDataController;
import noppes.npcs.util.NBTJsonUtil;
import java.io.File;
import java.io.RandomAccessFile;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import static me.luizotavio.compressor.executor.IOExecutor.IO_EXECUTOR;
@Command(
name = "compressor",
desc = "Convert a file to a compressed file or back to json",
usage = "update [file|all] [json|zstd]"
)
public class CmdCompressor extends ChMcLogger {
public CmdCompressor(Object sender) {
super(sender);
}
@SubCommand(
name = "update",
desc = "Convert all files in the current directory to compressed files",
permissions = {OpOnly.class}
)
public boolean onConvert(String[] args) throws ExecutionException, InterruptedException, TimeoutException {
if (args.length == 0) {
sendmessage("Usage: /noppes compressor update [<filename>|all] [json|zstd]");
return true;
}
if (args.length == 1) {
sendmessage("Please specify the type of compression to use");
return true;
}
String type;
if (args[1].equalsIgnoreCase("json")) {
type = "json";
} else if (args[1].equalsIgnoreCase("zstd")) {
type = "zstd";
} else {
sendmessage("Please specify the type of compression to use");
return true;
}
File directory = PlayerDataController.instance.getSaveDir();
if (args[0].equalsIgnoreCase("all")) {
sendmessage("Converting all files in the current directory to " + type + " files");
for (File file : directory.listFiles()) {
if (file.isDirectory()) {
continue;
}
if (file.getName().endsWith(".json") && type.equalsIgnoreCase("zstd")) {
submit(() -> {
try {
NBTTagCompound compound = NBTJsonUtil.LoadFile(file);
File compressed = new File(file.getParentFile(), file.getName().replace(".json", ".zstd"));
byte[] bytes = ZstdCompressor.writeCompound(compound);
Files.write(
compressed.toPath(),
bytes,
StandardOpenOption.CREATE,
StandardOpenOption.WRITE
);
} catch (Exception exception) {
exception.printStackTrace();
}
});
}
if (file.getName().endsWith(".zstd") && type.equalsIgnoreCase("json")) {
submit(() -> {
try {
NBTTagCompound compound = ZstdCompressor.readCompressCompound(
new RandomAccessFile(file, "r")
);
File compressed = new File(file.getParentFile(), file.getName().replace(".zstd", ".json"));
NBTJsonUtil.SaveFile(compressed, compound);
} catch (Exception e) {
e.printStackTrace();
}
});
}
}
sendmessage("Done! All files were converted.");
} else {
File file = new File(directory, args[0] + ".json");
if (!file.exists()) {
file = new File(directory, args[0] + ".zstd");
}
if (!file.exists()) {
sendmessage("File not found");
return true;
}
File finalFile = file;
if (file.getName().endsWith(".json")) {
if (type.equalsIgnoreCase("json")) {
sendmessage("File is already in json format");
return true;
}
submit(() -> {
try {
NBTTagCompound compound = NBTJsonUtil.LoadFile(finalFile);
File compressed = new File(finalFile.getParentFile(), finalFile.getName().replace(".json", ".zstd"));
byte[] bytes = ZstdCompressor.writeCompound(compound);
Files.write(
compressed.toPath(),
bytes,
StandardOpenOption.CREATE,
StandardOpenOption.WRITE
);
sendmessage("File compressed to zstd!");
} catch (Exception exception) {
exception.printStackTrace();
}
});
}
if (file.getName().endsWith(".zstd")) {
if (type.equalsIgnoreCase("zstd")) {
sendmessage("File is already in zstd format");
return true;
}
submit(() -> {
try {
NBTTagCompound compound = ZstdCompressor.readCompressCompound(
new RandomAccessFile(finalFile, "r")
);
if (compound == null) {
return;
}
File compressed = new File(finalFile.getParentFile(), finalFile.getName().replace(".zstd", ".json"));
NBTJsonUtil.SaveFile(compressed, compound);
sendmessage("File converted to json!");
} catch (Exception e) {
e.printStackTrace();
}
});
}
}
return true;
}
private void submit(Runnable runnable) throws ExecutionException, InterruptedException, TimeoutException {
CompletableFuture.runAsync(runnable, IO_EXECUTOR).get(5, TimeUnit.MINUTES);
}
}
+1 -1
View File
@@ -37,7 +37,7 @@ import foxz.commandhelper.permissions.PlayerOnly;
@Command(
name = "noppes",
desc = "noppes root command",
sub = {CmdClone.class, CmdScript.class, CmdQuest.class, CmdDialog.class, CmdConfig.class}
sub = {CmdClone.class, CmdScript.class, CmdQuest.class, CmdDialog.class, CmdConfig.class, CmdCompressor.class}
)
public class CmdNoppes extends ChMcLogger {
@@ -0,0 +1,61 @@
package me.luizotavio.compressor;
import com.github.luben.zstd.Zstd;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTSizeTracker;
import net.minecraft.nbt.NBTTagCompound;
import java.io.*;
public class ZstdCompressor {
public static byte[] readCompressed(DataInput inputStream) throws IOException {
int compressedLength = inputStream.readInt();
int uncompressedLength = inputStream.readInt();
if (compressedLength < 0 || uncompressedLength < 0) {
throw new IllegalArgumentException("Invalid length");
}
byte[] compressed = new byte[compressedLength];
inputStream.readFully(compressed);
return Zstd.decompress(compressed, uncompressedLength);
}
public static NBTTagCompound readCompressCompound(DataInput inputStream) throws IOException {
NBTTagCompound compound;
byte[] compressed = readCompressed(inputStream);
try (DataInputStream dataInputStream = new DataInputStream(new ByteArrayInputStream(compressed))) {
compound = CompressedStreamTools.func_152456_a(dataInputStream, NBTSizeTracker.field_152451_a);
}
return compound;
}
public static byte[] writeCompound(NBTTagCompound compound) throws IOException {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(),
copy = new ByteArrayOutputStream();
try (DataOutputStream dataOutputStream = new DataOutputStream(outputStream)) {
CompressedStreamTools.write(compound, dataOutputStream);
}
byte[] uncompressed = outputStream.toByteArray();
byte[] compress = Zstd.compress(uncompressed);
try (DataOutputStream dataOutputStream = new DataOutputStream(copy)) {
dataOutputStream.writeInt(compress.length);
dataOutputStream.writeInt(uncompressed.length);
dataOutputStream.write(compress);
return copy.toByteArray();
}
}
}
@@ -0,0 +1,16 @@
package me.luizotavio.compressor.executor;
import java.util.concurrent.ExecutorService;
public class IOExecutor {
/**
* Please, do not change this value unless you know what you are doing.
* This value is used to define the number of threads that will be used to
* compress the files.
*
* If you want to change this value, please, do it with care.
*/
public static ExecutorService IO_EXECUTOR;
}
+37 -41
View File
@@ -1,8 +1,6 @@
package noppes.npcs;
import java.io.File;
import java.util.Set;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
@@ -12,6 +10,7 @@ import cpw.mods.fml.common.network.FMLEventChannel;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import foxz.command.CommandNoppes;
import me.luizotavio.compressor.executor.IOExecutor;
import net.minecraft.block.Block;
import net.minecraft.block.BlockIce;
import net.minecraft.block.BlockLeavesBase;
@@ -25,50 +24,41 @@ import net.minecraftforge.common.MinecraftForge;
import nikedemos.markovnames.generators.*;
import noppes.npcs.config.ConfigLoader;
import noppes.npcs.config.ConfigProp;
import noppes.npcs.controllers.BankController;
import noppes.npcs.controllers.ChunkController;
import noppes.npcs.controllers.DialogController;
import noppes.npcs.controllers.FactionController;
import noppes.npcs.controllers.GlobalDataController;
import noppes.npcs.controllers.LinkedNpcController;
import noppes.npcs.controllers.PixelmonHelper;
import noppes.npcs.controllers.PlayerDataController;
import noppes.npcs.controllers.QuestController;
import noppes.npcs.controllers.RecipeController;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.controllers.ServerCloneController;
import noppes.npcs.controllers.SpawnController;
import noppes.npcs.controllers.TransportController;
import noppes.npcs.controllers.*;
import noppes.npcs.enchants.EnchantInterface;
import noppes.npcs.entity.*;
import noppes.npcs.entity.old.EntityNPCDwarfFemale;
import noppes.npcs.entity.old.EntityNPCDwarfMale;
import noppes.npcs.entity.old.EntityNPCElfFemale;
import noppes.npcs.entity.old.EntityNPCElfMale;
import noppes.npcs.entity.old.EntityNPCEnderman;
import noppes.npcs.entity.old.EntityNPCFurryFemale;
import noppes.npcs.entity.old.EntityNPCFurryMale;
import noppes.npcs.entity.old.EntityNPCHumanFemale;
import noppes.npcs.entity.old.EntityNPCHumanMale;
import noppes.npcs.entity.old.EntityNPCOrcFemale;
import noppes.npcs.entity.old.EntityNPCOrcMale;
import noppes.npcs.entity.old.EntityNPCVillager;
import noppes.npcs.entity.old.EntityNpcEnderchibi;
import noppes.npcs.entity.old.EntityNpcMonsterFemale;
import noppes.npcs.entity.old.EntityNpcMonsterMale;
import noppes.npcs.entity.old.EntityNpcNagaFemale;
import noppes.npcs.entity.old.EntityNpcNagaMale;
import noppes.npcs.entity.old.EntityNpcSkeleton;
import noppes.npcs.entity.old.*;
import noppes.npcs.scripted.wrapper.WrapperNpcAPI;
import java.io.File;
import java.util.Set;
import java.util.concurrent.Executors;
@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.5.1-beta")
@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.5.2")
public class CustomNpcs {
@ConfigProp(info = "Disable Chat Bubbles")
@ConfigProp(info = "Disable Chat Bubbles")
public static boolean EnableChatBubbles = true;
private static int NewEntityStartId = 0;
@ConfigProp(info = "*BACKUP BEFORE CHANGING* File Type used with PlayerData. Converting files may reduce lag. To convert existing files: /noppes compressor update [<filename>|all] [json|zstd]")
public static String CompressorType = "json";
@ConfigProp(info = "The size of IO executors used for compression and decompression. This is the number of threads used for compression and decompression. If you are experiencing issues with the server lagging/crashing, try changing this to a higher number.")
public static int CompressorThreads = 2;
@ConfigProp(info = "Enables/Disables ALL scripting. You can still see and write code in the scripter, but these scripts won't run. True by default")
public static boolean ScriptingEnabled = true;
@ConfigProp(info = "Enables global player event scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. True by default.")
public static boolean GlobalPlayerScripts = true;
@ConfigProp(info = "Enables global forge event scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. True by default.")
public static boolean GlobalForgeScripts = true;
@ConfigProp(info = "Enables global NPC scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. False by default, use with caution!")
public static boolean GlobalNPCScripts = false;
@ConfigProp(info = "Navigation search range for NPCs. Not recommended to increase if you have a slow pc or on a server. Minimum of 16, maximum of 96.")
public static int NpcNavRange = 32;
@@ -227,14 +217,19 @@ public class CustomNpcs {
registerNpc(EntityNPCGolem.class, "npcGolem");
registerNpc(EntityCustomNpc.class, "CustomNpc");
IOExecutor.IO_EXECUTOR = Executors.newFixedThreadPool(
CompressorThreads,
new ThreadFactoryBuilder()
.setNameFormat("CustomNpcs-IO-%d")
.build()
);
registerNewEntity(EntityChairMount.class, "CustomNpcChairMount", 64, 10, false);
registerNewEntity(EntityProjectile.class, "throwableitem", 64, 3, true);
registerNewEntity(EntityMagicProjectile.class, "magicprojectile", 64, 3, true);
new RecipeController();
ForgeChunkManager.setForcedChunkLoadingCallback(this, new ChunkController());
new CustomNpcsPermissions();
@@ -270,6 +265,7 @@ public class CustomNpcs {
new LinkedNpcController();
ScriptController.Instance.loadStoredData();
ScriptController.Instance.loadForgeScripts();
ScriptController.Instance.loadNPCScripts();
ScriptController.Instance.loadPlayerScripts();
ScriptController.HasStart = false;
WrapperNpcAPI.clearCache();
@@ -109,6 +109,7 @@ public class DataScript implements IScriptHandler {
return false;
if(!hasInited){
hasInited = true;
EventHooks.onNPCInit(this.npc);
callScript(EnumScriptType.INIT);
}
ScriptContainer script = scripts.get(type.ordinal());
+131 -5
View File
@@ -19,13 +19,13 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.event.world.WorldEvent;
import noppes.npcs.controllers.CustomGuiController;
import noppes.npcs.controllers.Quest;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.controllers.*;
import noppes.npcs.controllers.data.ForgeDataScript;
import noppes.npcs.controllers.data.NPCDataScript;
import noppes.npcs.controllers.data.PlayerDataScript;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.*;
import noppes.npcs.scripted.entity.ScriptNpc;
import noppes.npcs.scripted.entity.ScriptPlayer;
import noppes.npcs.scripted.event.*;
import noppes.npcs.scripted.event.PlayerEvent.ChatEvent;
@@ -42,7 +42,6 @@ import noppes.npcs.scripted.interfaces.IItemStack;
import noppes.npcs.scripted.interfaces.IWorld;
import noppes.npcs.scripted.wrapper.WrapperNpcAPI;
import noppes.npcs.constants.EnumScriptType;
import noppes.npcs.controllers.PlayerData;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
@@ -51,12 +50,139 @@ public class EventHooks {
public EventHooks() {
}
public static void onNPCInit(EntityNPCInterface npc) {
if(npc == null || npc.wrappedNPC == null)
return;
noppes.npcs.scripted.event.NpcEvent.InitEvent event = new noppes.npcs.scripted.event.NpcEvent.InitEvent(npc.wrappedNPC);
ScriptController.Instance.npcScripts.callScript(EnumScriptType.INIT, event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onNPCUpdate(EntityNPCInterface npc) {
if(npc == null || npc.wrappedNPC == null)
return;
noppes.npcs.scripted.event.NpcEvent.UpdateEvent event = new noppes.npcs.scripted.event.NpcEvent.UpdateEvent(npc.wrappedNPC);
ScriptController.Instance.npcScripts.callScript(EnumScriptType.TICK, event);
npc.script.callScript(EnumScriptType.TICK);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onNPCDialog(EntityNPCInterface npc, EntityPlayer player, int id, Dialog dialog) {
if(npc == null || npc.wrappedNPC == null)
return;
NpcEvent.DialogEvent event = new NpcEvent.DialogEvent(npc.wrappedNPC, player, id, dialog);
ScriptController.Instance.npcScripts.callScript(EnumScriptType.DIALOG, event);
npc.script.callScript(EnumScriptType.DIALOG, "event", new ScriptEventDialog(), "player", player, "dialog", dialog.id);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static void onNPCDialogClosed(EntityNPCInterface npc, EntityPlayer player, int dialogId, int optionId, Dialog dialog) {
if(npc == null || npc.wrappedNPC == null)
return;
NpcEvent.DialogClosedEvent event = new NpcEvent.DialogClosedEvent(npc.wrappedNPC, player, dialogId, optionId, dialog);
ScriptController.Instance.npcScripts.callScript(EnumScriptType.DIALOG_CLOSE, event);
npc.script.callScript(EnumScriptType.DIALOG_CLOSE, "player", player, "dialog", dialogId, "option", optionId + 1);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static boolean onNPCInteract(EntityNPCInterface npc, EntityPlayer player) {
if(npc == null || npc.wrappedNPC == null)
return false;
NpcEvent.InteractEvent event = new NpcEvent.InteractEvent(npc.wrappedNPC,player);
ScriptController.Instance.npcScripts.callScript(EnumScriptType.INTERACT, event);
boolean result = npc.script.callScript(EnumScriptType.INTERACT, "player", player);
WrapperNpcAPI.EVENT_BUS.post(event);
return result;
}
public static boolean onNPCMeleeAttack(EntityNPCInterface npc, float damage, EntityLivingBase target){
if(npc == null || npc.wrappedNPC == null)
return false;
NpcEvent.MeleeAttackEvent event = new NpcEvent.MeleeAttackEvent(npc.wrappedNPC,damage,target);
ScriptController.Instance.npcScripts.callScript(EnumScriptType.ATTACK_MELEE, event);
boolean result = npc.script.callScript(EnumScriptType.ATTACK, "event", event, "target", target);
WrapperNpcAPI.EVENT_BUS.post(event);
return result;
}
public static boolean onNPCRangedAttack(EntityNPCInterface npc, float damage, EntityLivingBase target){
if(npc == null || npc.wrappedNPC == null)
return false;
NpcEvent.RangedLaunchedEvent event = new NpcEvent.RangedLaunchedEvent(npc.wrappedNPC,damage,target);
ScriptController.Instance.npcScripts.callScript(EnumScriptType.RANGED_LAUNCHED, event);
boolean result = npc.script.callScript(EnumScriptType.ATTACK, "event", event, "target", target);
WrapperNpcAPI.EVENT_BUS.post(event);
return result;
}
public static void onNPCKilledEntity(EntityNPCInterface npc, EntityLivingBase entity){
if(npc == null || npc.wrappedNPC == null)
return;
NpcEvent.KilledEntityEvent event = new NpcEvent.KilledEntityEvent(npc.wrappedNPC,entity);
ScriptController.Instance.npcScripts.callScript(EnumScriptType.KILLS, event);
npc.script.callScript(EnumScriptType.KILLS, "target", entity);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static boolean onNPCTarget(EntityNPCInterface npc, EntityLivingBase target){
if(npc == null || npc.wrappedNPC == null)
return false;
NpcEvent.TargetEvent event = new NpcEvent.TargetEvent(npc.wrappedNPC,target);
ScriptController.Instance.npcScripts.callScript(EnumScriptType.TARGET, event);
boolean result = npc.script.callScript(EnumScriptType.TARGET, "event", event);
WrapperNpcAPI.EVENT_BUS.post(event);
return result;
}
public static void onNPCCollide(EntityNPCInterface npc, Entity entity){
if(npc == null || npc.wrappedNPC == null)
return;
NpcEvent.CollideEvent event = new NpcEvent.CollideEvent(npc.wrappedNPC,entity);
ScriptController.Instance.npcScripts.callScript(EnumScriptType.COLLIDE, event);
npc.script.callScript(EnumScriptType.COLLIDE, "entity", entity);
WrapperNpcAPI.EVENT_BUS.post(event);
}
public static boolean onNPCDamaged(EntityNPCInterface npc, Entity source, float damage, DamageSource damagesource, ScriptEventDamaged damagedEvent){
if(npc == null || npc.wrappedNPC == null)
return false;
NpcEvent.DamagedEvent event = new NpcEvent.DamagedEvent(npc.wrappedNPC,source,damage,damagesource);
ScriptController.Instance.npcScripts.callScript(EnumScriptType.DAMAGED, event);
boolean result = npc.script.callScript(EnumScriptType.DAMAGED, "event", damagedEvent);
WrapperNpcAPI.EVENT_BUS.post(event);
return result;
}
public static boolean onNPCKilled(EntityNPCInterface npc, DamageSource damagesource, Entity entity, ScriptEventKilled killedEvent){
if(npc == null || npc.wrappedNPC == null)
return false;
NpcEvent.DiedEvent event = new NpcEvent.DiedEvent(npc.wrappedNPC,damagesource,entity);
ScriptController.Instance.npcScripts.callScript(EnumScriptType.KILLED, event);
boolean result = npc.script.callScript(EnumScriptType.KILLED, "event", killedEvent);
WrapperNpcAPI.EVENT_BUS.post(event);
return result;
}
public static void onNPCTimer(EntityNPCInterface npc, int id) {
if(npc == null || npc.wrappedNPC == null)
return;
NpcEvent.TimerEvent event = new NpcEvent.TimerEvent(npc.wrappedNPC, id);
ScriptEventTimer scriptEvent = new ScriptEventTimer(id);
npc.script.callScript(EnumScriptType.TIMER, "event", scriptEvent);
ScriptController.Instance.npcScripts.callScript(EnumScriptType.TIMER, event);
WrapperNpcAPI.EVENT_BUS.post(event);
}
@@ -253,7 +253,7 @@ public class NoppesUtilPlayer {
return;
EventHooks.onDialogOption(new DialogEvent.DialogOption(new ScriptPlayer((EntityPlayerMP) player), dialog));
npc.script.callScript(EnumScriptType.DIALOG_CLOSE, "player", player, "dialog", dialogId, "option", optionId + 1);
EventHooks.onNPCDialogClosed(npc,player,dialogId,optionId+1,dialog);
if(!dialog.hasDialogs(player) && !dialog.hasOtherOptions()) {
EventHooks.onDialogClosed(new DialogEvent.DialogClosed(new ScriptPlayer((EntityPlayerMP) player), dialog));
@@ -203,7 +203,7 @@ public class NoppesUtilServer {
if(!data.dialogsRead.contains(dialog.id))
data.dialogsRead.add(dialog.id);
setEditingNpc(player, npc);
npc.script.callScript(EnumScriptType.DIALOG, "event", new ScriptEventDialog(), "player", player, "dialog", dialog.id);
EventHooks.onNPCDialog(npc, player, dialog.id, dialog);
}
public static void runCommand(EntityPlayer player, String name, String command){
runCommand(player, name, command, player);
@@ -312,11 +312,14 @@ public class NoppesUtilServer {
Server.sendAssociatedData(entity, EnumPacketClient.PARTICLE, entity.posX, entity.posY, entity.posZ, entity.height, entity.width, entity.yOffset, particle);
}
public static void spawnScriptedParticle(Entity entity, String directory, int HEXcolor, int amount, int maxAge,
public static void spawnScriptedParticle(String directory, int HEXcolor, int amount, int maxAge,
double x, double y, double z,
double motionX, double motionY, double motionZ, float gravity,
float scale1, float scale2, float scaleRate, int scaleRateStart,
float alpha1, float alpha2, float alphaRate, int alphaRateStart,
float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart,
float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart,
float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart,
int entityID
){
Server.sendToAll(EnumPacketClient.SCRIPTED_PARTICLE,
@@ -325,6 +328,9 @@ public class NoppesUtilServer {
motionX, motionY, motionZ, gravity,
scale1, scale2, scaleRate, scaleRateStart,
alpha1, alpha2, alphaRate, alphaRateStart,
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
entityID
);
}
@@ -41,6 +41,7 @@ import noppes.npcs.containers.ContainerMail;
import noppes.npcs.controllers.*;
import noppes.npcs.controllers.LinkedNpcController.LinkedData;
import noppes.npcs.controllers.data.ForgeDataScript;
import noppes.npcs.controllers.data.NPCDataScript;
import noppes.npcs.controllers.data.PlayerDataScript;
import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityNPCInterface;
@@ -102,7 +103,7 @@ public class PacketHandlerServer{
else if(type.hasPermission() && !CustomNpcsPermissions.Instance.hasPermission(player, type.permission)){
//player doesnt have permission to do this
}
else if(item == null && (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave || type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave))
else if(item == null && (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave || type == EnumPacketServer.ScriptNPCGet || type == EnumPacketServer.ScriptNPCSave || type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave))
warn(player, "tried to use custom npcs without a tool in hand, probably a hacker");
else {
if (item != null) {
@@ -118,6 +119,8 @@ public class PacketHandlerServer{
featherPackets(type, buffer, player);
else if (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave)
playerScriptPackets(type, buffer, player);
else if (type == EnumPacketServer.ScriptNPCGet || type == EnumPacketServer.ScriptNPCSave)
npcScriptPackets(type, buffer, player);
else if (type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave)
forgeScriptPackets(type, buffer, player);
else if (item.getItem() == CustomItems.scripter)
@@ -172,6 +175,18 @@ public class PacketHandlerServer{
}
}
private void npcScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
NBTTagCompound compound;
if(type == EnumPacketServer.ScriptNPCGet) {
NPCDataScript data = ScriptController.Instance.npcScripts;
compound = data.writeToNBT(new NBTTagCompound());
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
} else if(type == EnumPacketServer.ScriptNPCSave) {
ScriptController.Instance.setNPCScripts(Server.readNBT(buffer));
}
}
private void featherPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException {
if(type == EnumPacketServer.DimensionsGet){
HashMap<String,Integer> map = new HashMap<String,Integer>();
@@ -257,7 +257,7 @@ public class ServerEventsHandler {
if(line != null)
npc.saySurrounding(line.formatTarget(event.entityLiving));
npc.script.callScript(EnumScriptType.KILLS, "target", event.entityLiving);
EventHooks.onNPCKilledEntity(npc,event.entityLiving);
}
EntityPlayer player = null;
@@ -308,7 +308,16 @@ public class ServerEventsHandler {
}
String name = entityName;
QuestKill quest = (QuestKill) data.quest.questInterface;
if(quest.targetType == 1 && !(entity instanceof EntityNPCInterface))
Class entityType = EntityNPCInterface.class;
if(quest.targetType == 2) {
try {
entityType = Class.forName(quest.customTargetType);
} catch (ClassNotFoundException notFoundException) {
continue;
}
}
if(quest.targetType > 0 && !(entityType.isInstance(entity)))
continue;
if(quest.targets.containsKey(entity.getCommandSenderName()))
name = entity.getCommandSenderName();
@@ -166,79 +166,27 @@ public class FlyPathFinder extends PathFinder
b0 = 1;
}
FlyPathPoint pathpoint3 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord, p_75860_2_.zCoord + 1, p_75860_3_, b0);
FlyPathPoint pathpoint4 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord - 1, p_75860_2_.yCoord, p_75860_2_.zCoord, p_75860_3_, b0);
FlyPathPoint pathpoint5 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord + 1, p_75860_2_.yCoord, p_75860_2_.zCoord, p_75860_3_, b0);
FlyPathPoint pathpoint6 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord, p_75860_2_.zCoord - 1, p_75860_3_, b0);
for(int y = -1; y <= 1; y ++) {
FlyPathPoint pathpoint3 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord + y, p_75860_2_.zCoord + 1, p_75860_3_, b0);
FlyPathPoint pathpoint4 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord - 1, p_75860_2_.yCoord + y, p_75860_2_.zCoord, p_75860_3_, b0);
FlyPathPoint pathpoint5 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord + 1, p_75860_2_.yCoord + y, p_75860_2_.zCoord, p_75860_3_, b0);
FlyPathPoint pathpoint6 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord + y, p_75860_2_.zCoord - 1, p_75860_3_, b0);
FlyPathPoint pathpoint7 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord + 1, p_75860_2_.zCoord + 1, p_75860_3_, b0);
FlyPathPoint pathpoint8 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord - 1, p_75860_2_.yCoord + 1, p_75860_2_.zCoord, p_75860_3_, b0);
FlyPathPoint pathpoint9 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord + 1, p_75860_2_.yCoord + 1, p_75860_2_.zCoord, p_75860_3_, b0);
FlyPathPoint pathpoint10 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord + 1, p_75860_2_.zCoord - 1, p_75860_3_, b0);
if (pathpoint3 != null && !pathpoint3.isFirst && pathpoint3.distanceTo(p_75860_4_) < p_75860_5_) {
this.pathOptions[i++] = pathpoint3;
}
FlyPathPoint pathpoint11 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord - 1, p_75860_2_.zCoord + 1, p_75860_3_, b0);
FlyPathPoint pathpoint12 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord - 1, p_75860_2_.yCoord - 1, p_75860_2_.zCoord, p_75860_3_, b0);
FlyPathPoint pathpoint13 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord + 1, p_75860_2_.yCoord - 1, p_75860_2_.zCoord, p_75860_3_, b0);
FlyPathPoint pathpoint14 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord - 1, p_75860_2_.zCoord - 1, p_75860_3_, b0);
if (pathpoint4 != null && !pathpoint4.isFirst && pathpoint4.distanceTo(p_75860_4_) < p_75860_5_) {
this.pathOptions[i++] = pathpoint4;
}
if (pathpoint3 != null && !pathpoint3.isFirst && pathpoint3.distanceTo(p_75860_4_) < p_75860_5_)
{
this.pathOptions[i++] = pathpoint3;
}
if (pathpoint5 != null && !pathpoint5.isFirst && pathpoint5.distanceTo(p_75860_4_) < p_75860_5_) {
this.pathOptions[i++] = pathpoint5;
}
if (pathpoint4 != null && !pathpoint4.isFirst && pathpoint4.distanceTo(p_75860_4_) < p_75860_5_)
{
this.pathOptions[i++] = pathpoint4;
}
if (pathpoint5 != null && !pathpoint5.isFirst && pathpoint5.distanceTo(p_75860_4_) < p_75860_5_)
{
this.pathOptions[i++] = pathpoint5;
}
if (pathpoint6 != null && !pathpoint6.isFirst && pathpoint6.distanceTo(p_75860_4_) < p_75860_5_)
{
this.pathOptions[i++] = pathpoint6;
}
if (pathpoint7 != null && !pathpoint7.isFirst && pathpoint7.distanceTo(p_75860_4_) < p_75860_5_)
{
this.pathOptions[i++] = pathpoint7;
}
if (pathpoint8 != null && !pathpoint8.isFirst && pathpoint8.distanceTo(p_75860_4_) < p_75860_5_)
{
this.pathOptions[i++] = pathpoint8;
}
if (pathpoint9 != null && !pathpoint9.isFirst && pathpoint9.distanceTo(p_75860_4_) < p_75860_5_)
{
this.pathOptions[i++] = pathpoint9;
}
if (pathpoint10 != null && !pathpoint10.isFirst && pathpoint10.distanceTo(p_75860_4_) < p_75860_5_)
{
this.pathOptions[i++] = pathpoint10;
}
if (pathpoint11 != null && !pathpoint11.isFirst && pathpoint11.distanceTo(p_75860_4_) < p_75860_5_)
{
this.pathOptions[i++] = pathpoint11;
}
if (pathpoint12 != null && !pathpoint12.isFirst && pathpoint12.distanceTo(p_75860_4_) < p_75860_5_)
{
this.pathOptions[i++] = pathpoint12;
}
if (pathpoint13 != null && !pathpoint13.isFirst && pathpoint13.distanceTo(p_75860_4_) < p_75860_5_)
{
this.pathOptions[i++] = pathpoint13;
}
if (pathpoint14 != null && !pathpoint14.isFirst && pathpoint14.distanceTo(p_75860_4_) < p_75860_5_)
{
this.pathOptions[i++] = pathpoint14;
if (pathpoint6 != null && !pathpoint6.isFirst && pathpoint6.distanceTo(p_75860_4_) < p_75860_5_) {
this.pathOptions[i++] = pathpoint6;
}
}
return i;
@@ -29,48 +29,36 @@ public class FlyingMoveHelper extends EntityMoveHelper{
if (this.update) {
this.update = false;
double speed = this.entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue();
double speedMult = 0.6000000238418579D / 0.5D;
double speed = this.speed * this.entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue() * this.entity.ai.flySpeed;
double d0 = this.posX - this.entity.posX;
double d1 = this.posY - this.entity.posY;
double d1 = this.posY - MathHelper.floor_double(this.entity.boundingBox.minY + 0.05D);
double d2 = this.posZ - this.entity.posZ;
double d4 = d0 * d0 + d1 * d1 + d2 * d2;
double d5 = MathHelper.sqrt_double(d4);
if (this.entity.hurtTime == 0 && d4 > 0.5D) {
if (this.posY != this.entity.posY) {
if (this.entity.motionY * Math.signum(this.entity.posY - this.posY) > 0.0D) {
this.entity.motionY = 0.0D;
double heightOffGround = 0;
if(this.entity.ai.hasFlyLimit) {
for (int blockY = (int) this.posY; blockY > 0; blockY--) {
heightOffGround = this.posY - blockY;
if (this.entity.worldObj.getBlock((int) this.posX, blockY, (int) this.posZ) != Blocks.air || heightOffGround > this.entity.ai.flyHeightLimit){
break;
}
double verticalSpeed = Math.abs(this.entity.posY - this.posY);
if(verticalSpeed > speed * speedMult)
verticalSpeed = speed * speedMult;
verticalSpeed += this.entity.ai.flySpeed/2.0D;
if(verticalSpeed > Math.abs(this.entity.posY - this.posY))
verticalSpeed = Math.abs(this.entity.posY - this.posY);
int blockY = (int) this.posY;
double heightOffGround = 0;
if(this.entity.ai.hasFlyLimit) {
for (blockY = (int) this.posY; blockY > 0; blockY--) {
heightOffGround = this.posY - blockY;
if (this.entity.worldObj.getBlock((int) this.posX, blockY, (int) this.posZ) != Blocks.air || heightOffGround > this.entity.ai.flyHeightLimit){
break;
}
}
}
if(heightOffGround < this.entity.ai.flyHeightLimit || !this.entity.ai.hasFlyLimit)
this.entity.motionY -= Math.signum(this.entity.posY - this.posY) * verticalSpeed;
}
double d5 = MathHelper.sqrt_double(d4);
this.entity.motionX += (d0 / d5 * speed - this.entity.motionX) * speed * speedMult;
this.entity.motionZ += (d2 / d5 * speed - this.entity.motionZ) * speed * speedMult;
}
this.entity.rotationYaw = this.limitAngle(this.entity.rotationYaw,(float) ((Math.atan2(-d0, -d2) + Math.PI) * -(180F / Math.PI)),30.0F);
if (this.entity.hurtTime == 0 && d4 > 0.5D) {
this.entity.motionX += (d0 / d5 * speed - this.entity.motionX) * speed;
this.entity.motionZ += (d2 / d5 * speed - this.entity.motionZ) * speed;
if (heightOffGround < this.entity.ai.flyHeightLimit || !this.entity.ai.hasFlyLimit) {
this.entity.motionY += (d1 / d5 * speed - this.entity.motionY) * speed;
}
this.entity.velocityChanged = true;
}
this.entity.rotationYaw = this.limitAngle(this.entity.rotationYaw,(float) ((Math.atan2(-d0, -d2) + Math.PI) * -(180F / Math.PI)),18.0F);
}
}
@@ -289,15 +289,15 @@ public class PathNavigateFlying extends PathNavigate {
private Vec3 getEntityPosition()
{
return Vec3.createVectorHelper(this.theEntity.posX, (double)this.getPathableYPos(), this.theEntity.posZ);
return Vec3.createVectorHelper(this.theEntity.posX, this.getPathableYPos(), this.theEntity.posZ);
}
/**
* Gets the safe pathing Y position for the entity depending on if it can path swim or not
*/
private int getPathableYPos()
private double getPathableYPos()
{
return (int)(this.theEntity.boundingBox.minY + 0.5D);
return this.theEntity.boundingBox.minY + 0.05D;
}
/**
@@ -355,7 +355,7 @@ public class ClientProxy extends CommonProxy {
else if(gui == EnumGuiType.PlayerTransporter)
return new GuiTransportSelection(npc);
else if(gui == EnumGuiType.Script)
else if(gui == EnumGuiType.Script && CustomNpcs.ScriptingEnabled)
return new GuiScript(npc);
else if(gui == EnumGuiType.PlayerAnvil)
@@ -98,6 +98,21 @@ public class NoppesUtil {
float alphaRate = buffer.readFloat();
int alphaRateStart = buffer.readInt();
float rotationX1 = buffer.readFloat();
float rotationX2 = buffer.readFloat();
float rotationXRate = buffer.readFloat();
int rotationXRateStart = buffer.readInt();
float rotationY1 = buffer.readFloat();
float rotationY2 = buffer.readFloat();
float rotationYRate = buffer.readFloat();
int rotationYRateStart = buffer.readInt();
float rotationZ1 = buffer.readFloat();
float rotationZ2 = buffer.readFloat();
float rotationZRate = buffer.readFloat();
int rotationZRateStart = buffer.readInt();
int entityID = buffer.readInt();
World worldObj = Minecraft.getMinecraft().theWorld;
@@ -113,6 +128,9 @@ public class NoppesUtil {
motionX, motionY, motionZ, gravity,
scale1, scale2, scaleRate, scaleRateStart,
alpha1, alpha2, alphaRate, alphaRateStart,
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
maxAge
);
@@ -99,7 +99,7 @@ public class TranslateUtil {
return null;
element = array.get(0);
}
System.out.println(element.getAsString());
// System.out.println(element.getAsString());
return element.getAsString();
}
}
@@ -7,7 +7,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.client.ClientProxy;
import org.lwjgl.Sys;
import org.lwjgl.opengl.GL11;
public class EntityCustomFX extends EntityFX {
@@ -27,10 +26,31 @@ public class EntityCustomFX extends EntityFX {
public float alphaRate = 0.0F;
public int alphaRateStart = 0;
public float rotationX = 0;
public float rotationX1 = 0;
public float rotationX2 = 0;
public float rotationXRate = 0.0F;
public int rotationXRateStart = 0;
public float rotationY = 0;
public float rotationY1 = 0;
public float rotationY2 = 0;
public float rotationYRate = 0.0F;
public int rotationYRateStart = 0;
public float rotationZ = 0;
public float rotationZ1 = 0;
public float rotationZ2 = 0;
public float rotationZRate = 0.0F;
public int rotationZRateStart = 0;
public EntityCustomFX(Entity entity, String directory, int HEXColor, double x, double y, double z,
double motionX, double motionY, double motionZ, float gravity,
float scale1, float scale2, float scaleRate, int scaleRateStart,
float alpha1, float alpha2, float alphaRate, int alphaRateStart,
float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart,
float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart,
float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart,
int age) {
super(entity.worldObj, x, y, z, motionX, motionY, motionZ);
@@ -50,6 +70,30 @@ public class EntityCustomFX extends EntityFX {
if(alpha1 > alpha2)
this.alphaRate *= -1;
this.rotationX1 = rotationX1;
this.rotationX2 = rotationX2;
this.rotationXRate = Math.abs(rotationXRate);
this.rotationXRateStart = rotationXRateStart;
rotationX = rotationX1;
if(rotationX1 > rotationX2)
this.rotationXRate *= -1;
this.rotationY1 = rotationY1;
this.rotationY2 = rotationY2;
this.rotationYRate = Math.abs(rotationYRate);
this.rotationYRateStart = rotationYRateStart;
rotationY = rotationY1;
if(rotationY1 > rotationY2)
this.rotationYRate *= -1;
this.rotationZ1 = rotationZ1;
this.rotationZ2 = rotationZ2;
this.rotationZRate = Math.abs(rotationZRate);
this.rotationZRateStart = rotationZRateStart;
rotationZ = rotationZ1;
if(rotationZ1 > rotationZ2)
this.rotationZRate *= -1;
particleGravity = gravity/0.04F;
particleMaxAge = age;
@@ -74,148 +118,92 @@ public class EntityCustomFX extends EntityFX {
location = new ResourceLocation(directory);
}
/*
par2 = partial tick time
par3 = ActiveRenderInfo.rotationX;
par4 = ActiveRenderInfo.rotationZ;
par5 = ActiveRenderInfo.rotationYZ;
par6 = ActiveRenderInfo.rotationXY;
par7 = ActiveRenderInfo.rotationXZ;
*/
@Override
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
public void renderParticle(Tessellator tessellator, float partialTick, float cosYaw, float cosPitch, float sinYaw, float sinSinPitch, float cosSinPitch)
{
if(move){
startX = (float)(entity.prevPosX + (entity.posX - entity.prevPosX) * (double)par2);
startY = (float)(entity.prevPosY + (entity.posY - entity.prevPosY) * (double)par2);
startZ = (float)(entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)par2);
}
Tessellator tessellator = Tessellator.instance;
tessellator.draw();
float scale = this.scaleRate / (float)particleMaxAge;
if((this.scaleRate < 0 && particleScale+scale < this.scale2) || (this.scaleRate > 0 && particleScale+scale > this.scale2))
particleScale = this.scale2;
else if(particleAge >= this.scaleRateStart)
particleScale += scale;
float alpha = this.alphaRate / (float)particleMaxAge;
if((this.alphaRate < 0 && particleAlpha+alpha < this.alpha2) || (this.alphaRate > 0 && particleAlpha+alpha > this.alpha2))
particleAlpha = this.alpha2;
else if(particleAge >= this.alphaRateStart)
particleAlpha += alpha;
ClientProxy.bindTexture(location);
float f = 0.0f;
float f1 = 1.0f;
float f2 = 0.0f;
float f3 = 1.0f;
float f4 = 0.1F * particleScale;
float f5 = (float)(((prevPosX + (posX - prevPosX) * (double)par2) - interpPosX) + startX);
float f6 = (float)(((prevPosY + (posY - prevPosY) * (double)par2) - interpPosY) + startY);
float f7 = (float)(((prevPosZ + (posZ - prevPosZ) * (double)par2) - interpPosZ) + startZ);
tessellator.startDrawingQuads();
tessellator.setBrightness(240);
par1Tessellator.setColorOpaque_F(1, 1, 1);
par1Tessellator.setColorRGBA_F(particleRed, particleGreen, particleBlue, particleAlpha);
par1Tessellator.addVertexWithUV(f5 - par3 * f4 - par6 * f4, f6 - par4 * f4, f7 - par5 * f4 - par7 * f4, f1, f3);
par1Tessellator.addVertexWithUV((f5 - par3 * f4) + par6 * f4, f6 + par4 * f4, (f7 - par5 * f4) + par7 * f4, f1, f2);
par1Tessellator.addVertexWithUV(f5 + par3 * f4 + par6 * f4, f6 + par4 * f4, f7 + par5 * f4 + par7 * f4, f, f2);
par1Tessellator.addVertexWithUV((f5 + par3 * f4) - par6 * f4, f6 - par4 * f4, (f7 + par5 * f4) - par7 * f4, f, f3);
/*
Minecraft minecraft = Minecraft.getMinecraft();
EntityPlayer player = minecraft.thePlayer;
double angle = Minecraft.getMinecraft().theWorld.getWorldTime()%360;
double angleRad = (angle/180)*Math.PI;
double diffX = player.posX - this.startX;
double diffY = player.posY - player.getYOffset() - this.startY;
double diffZ = player.posZ - this.startZ;
double yaw = (player.rotationYaw/180)*Math.PI;
double pitch = (player.rotationPitch/180)*Math.PI;
double angleX = Math.sin(yaw)*Math.cos(pitch);
if(Math.abs(angleX) < 0.0001){
angleX = 0.0D;
}
double angleY = Math.sin(pitch);
if(Math.abs(angleY) < 0.0001){
angleY = 0.0D;
}
double angleZ = -Math.cos(yaw)*Math.cos(pitch);
if(Math.abs(angleZ) < 0.0001){
angleZ = 0.0D;
}
double angleXtranslateX = 0.0D;
double angleXtranslateY = 0.0D;//(-diffY + Math.cos(angleRad)*diffY) + (-Math.sin(angleRad)*diffZ);
double angleXtranslateZ = 0.0D;//(Math.sin(angleRad)*diffY) + (-diffZ + Math.cos(angleRad)*diffZ);
double angleYtranslateX = 0.0D;//(-diffX + Math.cos(angleRad)*diffX) + (Math.sin(angleRad)*diffZ);
double angleYtranslateY = 0.0D;
double angleYtranslateZ = 0.0D;//(-Math.sin(angleRad)*diffX) + (-diffZ + Math.cos(angleRad)*diffZ);
double angleZtranslateX = 0.0D;//(-diffX + Math.cos(angleRad)*diffX) + (-Math.sin(angleRad)*diffY);
double angleZtranslateY = 0.0D;//(Math.sin(angleRad)*diffX) + (-diffY + Math.cos(angleRad)*diffY);
double angleZtranslateZ = 0.0D;
double translateX = angleXtranslateX + angleYtranslateX + angleZtranslateX;
double translateY = angleXtranslateY + angleYtranslateY + angleZtranslateY;
double translateZ = angleXtranslateZ + angleYtranslateZ + angleZtranslateZ;
//distance in the X & Z plane
double distXZ = Math.sqrt(Math.pow(diffX,2) + Math.pow(diffZ,2));
//distance in the X & Y plane
double distXY = Math.sqrt(Math.pow(diffX,2) + Math.pow(diffY,2));
//distance in the Y & Z plane
double distYZ = Math.sqrt(Math.pow(diffY,2) + Math.pow(diffZ,2));
double signDiffX = Math.signum(diffX);
double signDiffY = Math.signum(diffY);
double signDiffZ = Math.signum(diffZ);
double angleXtoNorm = Math.sin(Math.acos(diffX/distXZ));
double angleZtoNorm = Math.sin(Math.acos(diffZ/distXZ));
double angleDiffX = (Math.abs(Math.cos(yaw))-angleXtoNorm);
double angleDiffZ = (Math.abs(Math.cos(yaw))-angleZtoNorm);
double translateX = -Math.abs(angleDiffX*angleZ*distXZ)*signDiffX;
double translateY = 0;
double translateZ = -Math.abs(angleDiffX*angleX*distXZ)*signDiffZ + Math.cos(angleRad)*Math.abs(angleDiffX*angleX*distXZ)*signDiffZ;
if(minecraft.currentScreen == null) {
System.out.println();
//System.out.printf("diffX: %f, diffY: %f, diffZ: %f\n", diffX, diffY, diffZ);
//System.out.printf("angleX: %f, angleY: %f, angleZ: %f\n", angleX, angleY, angleZ);
//System.out.printf("angleXtoNorm: %f, angleZtoNorm: %f\n", angleXtoNorm, angleZtoNorm);
System.out.printf("Math.sin(yaw): %f\n", Math.sin(yaw));
System.out.printf("Math.cos(yaw): %f\n", Math.cos(yaw));
//System.out.printf("Math.sin(pitch): %f\n", Math.sin(pitch));
//System.out.printf("Math.cos(pitch): %f\n", Math.cos(pitch));
System.out.printf("angleDiffX: %f\n", angleDiffX);
System.out.printf("angleDiffZ: %f\n", angleDiffZ);
System.out.printf("translateX: %f\n", Math.cos(angleRad)*Math.abs(angleDiffX*angleZ*distXZ)*signDiffX);
System.out.printf("translateZ: %f\n", Math.cos(angleRad)*Math.abs(angleDiffX*angleX*distXZ)*signDiffZ);
}
*/
GL11.glPushMatrix();
GL11.glColor4f(1, 1, 1, 1.0F);
ClientProxy.bindTexture(location);
//GL11.glTranslated(translateX,translateY,translateZ);
//GL11.glRotated(angle, angleX, angleY, angleZ);
if(move){
startX = (float)(entity.prevPosX + (entity.posX - entity.prevPosX) * (double)partialTick);
startY = (float)(entity.prevPosY + (entity.posY - entity.prevPosY) * (double)partialTick);
startZ = (float)(entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)partialTick);
}
float scaleChange = this.scaleRate / (float)particleMaxAge;
if((this.scaleRate < 0 && particleScale+scaleChange < this.scale2) || (this.scaleRate > 0 && particleScale+scaleChange > this.scale2))
particleScale = this.scale2;
else if(particleAge >= this.scaleRateStart)
particleScale += scaleChange;
float alphaChange = this.alphaRate / (float)particleMaxAge;
if((this.alphaRate < 0 && particleAlpha+alphaChange < this.alpha2) || (this.alphaRate > 0 && particleAlpha+alphaChange > this.alpha2))
particleAlpha = this.alpha2;
else if(particleAge >= this.alphaRateStart)
particleAlpha += alphaChange;
float rotationXChange = this.rotationXRate / (float)particleMaxAge;
if((this.rotationXRate < 0 && rotationX+rotationXChange < this.rotationX2) || (this.rotationXRate > 0 && rotationX+rotationXChange > this.rotationX2))
rotationX = this.rotationX2;
else if(particleAge >= this.rotationXRateStart)
rotationX += rotationXChange;
float rotationYChange = this.rotationYRate / (float)particleMaxAge;
if((this.rotationYRate < 0 && rotationY+rotationYChange < this.rotationY2) || (this.rotationYRate > 0 && rotationY+rotationYChange > this.rotationY2))
rotationY = this.rotationY2;
else if(particleAge >= this.rotationYRateStart)
rotationY += rotationYChange;
float rotationZChange = this.rotationZRate / (float)particleMaxAge;
if((this.rotationZRate < 0 && rotationZ+rotationZChange < this.rotationZ2) || (this.rotationZRate > 0 && rotationZ+rotationZChange > this.rotationZ2))
rotationZ = this.rotationZ2;
else if(particleAge >= this.rotationZRateStart)
rotationZ += rotationZChange;
float u1 = 0.0f;
float u2 = 1.0f;
float v1 = 0.0f;
float v2 = 1.0f;
float renderScale = 0.1F * particleScale;
float posX = (float)(((prevPosX + (this.posX - prevPosX) * (double)partialTick) - interpPosX) + startX);
float posY = (float)(((prevPosY + (this.posY - prevPosY) * (double)partialTick) - interpPosY) + startY);
float posZ = (float)(((prevPosZ + (this.posZ - prevPosZ) * (double)partialTick) - interpPosZ) + startZ);
GL11.glTranslated((double)posX, (double)posY, (double)posZ);
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
double yaw = (player.rotationYaw/180)*Math.PI;
double pitch = (player.rotationPitch/180)*Math.PI;
if(Math.abs(rotationX%360) >= 90 && Math.abs(rotationX%360) < 270) {
rotationX += 180*Math.signum(rotationX);
}
if(Math.abs(rotationY%360) >= 90 && Math.abs(rotationY%360) < 270) {
rotationY += 180*Math.signum(rotationY);
}
GL11.glRotated(rotationX, Math.cos(yaw)*Math.cos(pitch),0.0,Math.sin(yaw)*Math.cos(pitch));
GL11.glRotated(rotationY, -Math.sin(yaw)*Math.sin(pitch), Math.cos(pitch), Math.cos(yaw)*Math.sin(pitch));
GL11.glRotated(rotationZ, Math.sin(yaw)*Math.cos(pitch), Math.sin(pitch), -Math.cos(yaw)*Math.cos(pitch));
tessellator.startDrawingQuads();
tessellator.setBrightness(240);
tessellator.setColorOpaque_F(1, 1, 1);
tessellator.setColorRGBA_F(particleRed, particleGreen, particleBlue, particleAlpha);
tessellator.addVertexWithUV( - cosYaw * renderScale - sinSinPitch * renderScale, - cosPitch * renderScale, - sinYaw * renderScale - cosSinPitch * renderScale, u2, v2);
tessellator.addVertexWithUV(( - cosYaw * renderScale) + sinSinPitch * renderScale, + cosPitch * renderScale, ( - sinYaw * renderScale) + cosSinPitch * renderScale, u2, v1);
tessellator.addVertexWithUV( + cosYaw * renderScale + sinSinPitch * renderScale, + cosPitch * renderScale, + sinYaw * renderScale + cosSinPitch * renderScale, u1, v1);
tessellator.addVertexWithUV(( + cosYaw * renderScale) - sinSinPitch * renderScale, - cosPitch * renderScale, ( + sinYaw * renderScale) - cosSinPitch * renderScale, u1, v2);
tessellator.draw();
ClientProxy.bindTexture(resource);
tessellator.startDrawingQuads();
GL11.glPopMatrix();
GL11.glColor4f(1, 1, 1, 1.0F);
ClientProxy.bindTexture(resource);
tessellator.startDrawingQuads();
}
public int getFXLayer(){
@@ -39,8 +39,7 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
public GuiNpcMobSpawner(int i, int j, int k) {
super();
xSize = 384;
xSize = 354;
posX = i;
posY = j;
posZ = k;
@@ -53,6 +52,7 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
{
super.initGui();
guiTop += 10;
guiLeft += 30;
if(scroll == null){
scroll = new GuiCustomScroll(this,0);
@@ -69,36 +69,37 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
GuiMenuTopButton button;
addTopButton(button = new GuiMenuTopButton(3,guiLeft + 4, guiTop - 17, "spawner.clones"));
button.active = showingClones == 0;
addTopButton(button = new GuiMenuTopButton(4, button, "spawner.entities"));
button.active = showingClones == 1;
addTopButton(button = new GuiMenuTopButton(5, button, "gui.server"));
button.active = showingClones == 2;
addTopButton(button = new GuiMenuTopButton(4, button, "spawner.entities"));
button.active = showingClones == 1;
addButton(new GuiNpcButton(1, guiLeft + 298, guiTop + 6, 82, 20, "item.monsterPlacer.name"));
addButton(new GuiNpcButton(1, guiLeft + 298, guiTop + 6, 52, 20, "item.monsterPlacer.name"));
addButton(new GuiNpcButton(2, guiLeft + 298, guiTop + 100, 82, 20, "spawner.mobspawner"));
addButton(new GuiNpcButton(2, guiLeft + 298, guiTop + 100, 52, 20, "spawner.mobspawner"));
if(showingClones == 0 || showingClones == 2){
addSideButton(new GuiMenuSideButton(21,guiLeft - 90, this.guiTop + 2, 90,22, "1"));
addSideButton(new GuiMenuSideButton(22,guiLeft - 90, this.guiTop + 23, 90,22, "2"));
addSideButton(new GuiMenuSideButton(23,guiLeft - 90, this.guiTop + 44, 90,22, "3"));
addSideButton(new GuiMenuSideButton(24,guiLeft - 90, this.guiTop + 65, 90,22, "4"));
addSideButton(new GuiMenuSideButton(25,guiLeft - 90, this.guiTop + 86, 90,22, "5"));
addSideButton(new GuiMenuSideButton(26,guiLeft - 90, this.guiTop + 107, 45,22, "6"));
addSideButton(new GuiMenuSideButton(27,guiLeft - 45, this.guiTop + 107, 45,22, "7"));
addSideButton(new GuiMenuSideButton(28,guiLeft - 90, this.guiTop + 128, 45,22, "8"));
addSideButton(new GuiMenuSideButton(29,guiLeft - 45, this.guiTop + 128, 45,22, "9"));
addSideButton(new GuiMenuSideButton(30,guiLeft - 90, this.guiTop + 149, 45,22, "10"));
addSideButton(new GuiMenuSideButton(31,guiLeft - 45, this.guiTop + 149, 45,22, "11"));
addSideButton(new GuiMenuSideButton(32,guiLeft - 90, this.guiTop + 170, 45,22, "12"));
addSideButton(new GuiMenuSideButton(33,guiLeft - 45, this.guiTop + 170, 45,22, "13"));
addSideButton(new GuiMenuSideButton(34,guiLeft - 90, this.guiTop + 191, 45,22, "14"));
addSideButton(new GuiMenuSideButton(35,guiLeft - 45, this.guiTop + 191, 45,22, "15"));
addSideButton(new GuiMenuSideButton(21,guiLeft - 70, this.guiTop + 2, 70,22, "1"));
addSideButton(new GuiMenuSideButton(22,guiLeft - 70, this.guiTop + 23, 70,22, "2"));
addSideButton(new GuiMenuSideButton(23,guiLeft - 70, this.guiTop + 44, 70,22, "3"));
addSideButton(new GuiMenuSideButton(24,guiLeft - 70, this.guiTop + 65, 70,22, "4"));
addSideButton(new GuiMenuSideButton(25,guiLeft - 70, this.guiTop + 86, 70,22, "5"));
addSideButton(new GuiMenuSideButton(26,guiLeft - 70, this.guiTop + 107, 35,22, "6"));
addSideButton(new GuiMenuSideButton(27,guiLeft - 35, this.guiTop + 107, 35,22, "7"));
addSideButton(new GuiMenuSideButton(28,guiLeft - 70, this.guiTop + 128, 35,22, "8"));
addSideButton(new GuiMenuSideButton(29,guiLeft - 35, this.guiTop + 128, 35,22, "9"));
addSideButton(new GuiMenuSideButton(30,guiLeft - 70, this.guiTop + 149, 35,22, "10"));
addSideButton(new GuiMenuSideButton(31,guiLeft - 35, this.guiTop + 149, 35,22, "11"));
addSideButton(new GuiMenuSideButton(32,guiLeft - 70, this.guiTop + 170, 35,22, "12"));
addSideButton(new GuiMenuSideButton(33,guiLeft - 35, this.guiTop + 170, 35,22, "13"));
addSideButton(new GuiMenuSideButton(34,guiLeft - 70, this.guiTop + 191, 35,22, "14"));
addSideButton(new GuiMenuSideButton(35,guiLeft - 35, this.guiTop + 191, 35,22, "15"));
addButton(new GuiNpcButton(6, guiLeft + 298, guiTop + 190, 82, 20, "gui.remove"));
// addButton(new GuiNpcButton(6, guiLeft + 298, guiTop + 190, 82, 20, "gui.remove"));
addButton(new GuiNpcButton(6, guiLeft + 298, guiTop + 190, 52, 20, "gui.remove"));
getSideButton(20 + activeTab).active = true;
showClones();
@@ -8,6 +8,7 @@ import net.minecraft.client.gui.GuiYesNoCallback;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.server.MinecraftServer;
import noppes.npcs.CustomNpcs;
import noppes.npcs.DataScript;
import noppes.npcs.NoppesStringUtils;
import noppes.npcs.client.Client;
@@ -513,7 +513,7 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
}
protected void keyTyped(char typedChar, int keyCode) {
if (keyCode == 1 || keyCode == this.mc.gameSettings.keyBindInventory.getKeyCode())
if (keyCode == 1)
{
this.mc.thePlayer.closeScreen();
}
@@ -119,7 +119,7 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
}
public void onRender(Minecraft mc, int mouseX, int mouseY, int mouseWheel, float partialTicks) {
boolean hovered = mouseX >= this.field_146162_g && mouseY >= this.field_146174_h && mouseX < this.field_146162_g + this.field_146167_a && mouseY < this.field_146174_h + this.field_146161_f;
boolean hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.field_146167_a && mouseY < this.y + this.field_146161_f;
this.drawLabel();
if (hovered && this.hoverText != null && this.hoverText.length > 0) {
this.parent.hoverText = this.hoverText;
@@ -146,6 +146,8 @@ public class CustomGuiLabel extends Gui implements IGuiComponent {
lbl.color = component.getColor();
lbl.alpha = component.getAlpha();
lbl.rotation = component.getRotation();
lbl.field_146167_a = component.getWidth();
lbl.field_146161_f = component.getHeight();
return lbl;
}
@@ -71,7 +71,7 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent {
}
public void onRender(Minecraft mc, int mouseX, int mouseY, int mouseWheel, float partialTicks) {
boolean hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
boolean hovered = mouseX >= this.x + GuiCustom.guiLeft && mouseY >= this.y + GuiCustom.guiTop && mouseX < this.x + GuiCustom.guiLeft + this.width && mouseY < this.y + GuiCustom.guiTop + this.height;
mc.getTextureManager().bindTexture(this.texture);
GL11.glPushMatrix();
@@ -80,10 +80,9 @@ public class CustomGuiTexturedRect extends Gui implements IGuiComponent {
float blue = (color & 255) / 255f;
GL11.glColor4f(red,green,blue,this.alpha);
GL11.glScalef(this.scale, this.scale, this.scale);
GL11.glTranslatef(GuiCustom.guiLeft,GuiCustom.guiTop,0.0F);
GL11.glRotatef(this.rotation,0.0F,0.0F,1.0F);
GL11.glScalef(this.scale, this.scale, this.scale);
int p_73729_1_ = (int) (this.x/this.scale);
int p_73729_2_ = (int) (this.y/this.scale);
@@ -46,13 +46,14 @@ public class GuiNPCInv extends GuiContainerNPCInterface2 implements IGuiData, IT
addLabel(new GuiNpcLabel(0,"inv.minExp", guiLeft + 118, guiTop + 18));
addTextField(new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 108, guiTop + 29, 60, 20, npc.inventory.minExp + ""));
getTextField(0).integersOnly = true;
getTextField(0).setMinMaxDefault(0, npc.inventory.maxExp, 0);
addLabel(new GuiNpcLabel(1,"inv.maxExp", guiLeft + 118, guiTop + 52));
addTextField(new GuiNpcTextField(1,this, fontRendererObj, guiLeft + 108, guiTop + 63, 60, 20, npc.inventory.maxExp + ""));
getTextField(1).integersOnly = true;
getTextField(1).setMinMaxDefault(npc.inventory.maxExp, Short.MAX_VALUE, 0);
getTextField(0).setMinMaxDefault(0, getTextField(1).getInteger(), 0);
getTextField(1).setMinMaxDefault(getTextField(0).getInteger(), Short.MAX_VALUE, 0);
addButton(new GuiNpcButton(10, guiLeft + 88, guiTop + 88, 80, 20, new String[]{"stats.normal", "inv.auto"}, npc.inventory.lootMode));
addLabel(new GuiNpcLabel(2,"inv.npcInventory", guiLeft + 191, guiTop + 5));
@@ -194,7 +195,9 @@ public class GuiNPCInv extends GuiContainerNPCInterface2 implements IGuiData, IT
public void unFocused(GuiNpcTextField textfield) {
if(textfield.id >= 2){
chances.put(textfield.id-2, Double.parseDouble(textfield.getText()));
this.save();
}
getTextField(0).setMinMaxDefault(0, getTextField(1).getInteger(), 0);
getTextField(1).setMinMaxDefault(getTextField(0).getInteger(), Short.MAX_VALUE, 0);
this.save();
}
}
@@ -88,8 +88,12 @@ public class GuiNpcQuestTypeKill extends SubGuiInterface implements ITextfieldLi
addScroll(scroll);
guiTop += 50;
this.addButton(new GuiNpcButton(0, guiLeft + 4, guiTop + 300, 98, 20, "gui.back"));
this.addButton(new GuiNpcButton(1, guiLeft + 4, guiTop + 260, 98, 20, new String[]{"Any", "NPCs"}, quest.targetType));
this.addButton(new GuiNpcButton(0, guiLeft + 4, guiTop + 310, 98, 20, "gui.back"));
this.addButton(new GuiNpcButton(1, guiLeft + 4, guiTop + 260, 98, 20, new String[]{"Any", "NPCs", "Custom"}, quest.targetType));
this.addTextField(new GuiNpcTextField(36, this, fontRendererObj, guiLeft + 4, guiTop + 282, 180, 20, quest.customTargetType));
this.getTextField(36).setVisible(this.getButton(1).getValue() == 2);
guiTop -= 50;
scroll.visible = GuiNpcTextField.isFieldActive();
@@ -101,7 +105,8 @@ public class GuiNpcQuestTypeKill extends SubGuiInterface implements ITextfieldLi
close();
}
if (guibutton.id == 1) {
quest.targetType = guibutton.displayString.equals("NPCs") ? 1 : 0;
quest.targetType = this.getButton(1).getValue();
this.getTextField(36).setVisible(this.getButton(1).getValue() == 2);
}
}
public void mouseClicked(int i, int j, int k)
@@ -117,6 +122,9 @@ public class GuiNpcQuestTypeKill extends SubGuiInterface implements ITextfieldLi
if(guiNpcTextField.id < 12)
lastSelected = guiNpcTextField;
if(guiNpcTextField.id == 36)
quest.customTargetType = guiNpcTextField.getText();
saveTargets();
}
private void saveTargets(){
@@ -163,8 +163,6 @@ public class GuiNpcPuppet extends GuiModelInterface implements ISliderListener{
}
if(btn.id == 170 || btn.id == 171 || btn.id == 172){
if(btn.id == 170){
System.out.println(part.rotationX);
System.out.println(rotateX.sliderValue);
part.rotationX = 0.0f;
rotateX.sliderValue = 0.5f;
int percent = (int) ((rotateX.sliderValue) * 360);
@@ -0,0 +1,31 @@
package noppes.npcs.client.gui.script;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.Client;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.controllers.data.NPCDataScript;
public class GuiScriptAllNPCs extends GuiScriptInterface {
private NPCDataScript script = new NPCDataScript(null);
public GuiScriptAllNPCs() {
this.handler = this.script;
Client.sendData(EnumPacketServer.ScriptNPCGet, new Object[0]);
}
public void setGuiData(NBTTagCompound compound) {
this.script.readFromNBT(compound);
super.setGuiData(compound);
}
public void save() {
super.save();
Client.sendData(EnumPacketServer.ScriptNPCSave, new Object[]{this.script.writeToNBT(new NBTTagCompound())});
}
public void close() {
super.close();
ScriptController.Instance.npcScripts.errored.clear();
}
}
@@ -7,6 +7,7 @@ package noppes.npcs.client.gui.script;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.CustomNpcs;
import noppes.npcs.client.gui.util.GuiNPCInterface;
import noppes.npcs.client.gui.util.GuiNpcButton;
import org.lwjgl.opengl.GL11;
@@ -23,8 +24,17 @@ public class GuiScriptGlobal extends GuiNPCInterface {
public void initGui() {
super.initGui();
this.addButton(new GuiNpcButton(0, this.guiLeft + 38, this.guiTop + 20, 100, 20, "Players"));
this.addButton(new GuiNpcButton(1, this.guiLeft + 38, this.guiTop + 50, 100, 20, "Forge"));
GuiNpcButton playerButton = new GuiNpcButton(0, this.guiLeft + 38, this.guiTop + 20, 100, 20, "Players");
playerButton.setEnabled(CustomNpcs.GlobalPlayerScripts && CustomNpcs.ScriptingEnabled);
this.addButton(playerButton);
GuiNpcButton forgeButton = new GuiNpcButton(1, this.guiLeft + 38, this.guiTop + 50, 100, 20, "Forge");
forgeButton.setEnabled(CustomNpcs.GlobalForgeScripts && CustomNpcs.ScriptingEnabled);
this.addButton(forgeButton);
GuiNpcButton npcButton = new GuiNpcButton(2, this.guiLeft + 38, this.guiTop + 80, 100, 20, "All NPCs");
npcButton.setEnabled(CustomNpcs.GlobalNPCScripts && CustomNpcs.ScriptingEnabled);
this.addButton(npcButton);
}
public void drawScreen(int i, int j, float f) {
@@ -42,6 +52,9 @@ public class GuiScriptGlobal extends GuiNPCInterface {
if (guibutton.id == 1) {
this.displayGuiScreen(new GuiScriptForge());
}
if (guibutton.id == 2) {
this.displayGuiScreen(new GuiScriptAllNPCs());
}
}
public void keyTyped(char c, int i) {
@@ -35,6 +35,7 @@ import noppes.npcs.client.gui.util.*;
import noppes.npcs.controllers.IScriptHandler;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.controllers.data.ForgeDataScript;
import noppes.npcs.controllers.data.NPCDataScript;
import noppes.npcs.controllers.data.PlayerDataScript;
import org.apache.commons.lang3.StringUtils;
@@ -147,6 +148,22 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
hookList.add("customGuiSlot");
hookList.add("customGuiScroll");
hookList.add("customGuiTextfield");
}
else if(handler instanceof NPCDataScript) {
hookList.add("init");
hookList.add("tick");
hookList.add("interact");
hookList.add("dialog");
hookList.add("damaged");
hookList.add("killed");
hookList.add("meleeAttack");
hookList.add("rangedLaunched");
hookList.add("target");
hookList.add("collide");
hookList.add("kills");
hookList.add("dialogClose");
hookList.add("timer");
}
else if(handler instanceof ForgeDataScript) {
hooks.setSize(238, 198);
@@ -24,7 +24,9 @@ public abstract class GuiContainerNPCInterface2 extends GuiContainerNPCInterface
{
private ResourceLocation background = new ResourceLocation("customnpcs","textures/gui/menubg.png");
private final ResourceLocation defaultBackground = new ResourceLocation("customnpcs","textures/gui/menubg.png");
private GuiNpcMenu menu;
private final ResourceLocation defaultBackground2 = new ResourceLocation("customnpcs","textures/gui/menubg2.png");
private GuiNpcMenu menu;
public int menuYOffset = 0;
public GuiContainerNPCInterface2(EntityNPCInterface npc,Container cont)
@@ -74,18 +76,12 @@ public abstract class GuiContainerNPCInterface2 extends GuiContainerNPCInterface
mc.renderEngine.bindTexture(background);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 256, 256);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(defaultBackground);
drawTexturedModalRect(guiLeft + xSize-200, guiTop, 26, 0, 200, 220);
mc.renderEngine.bindTexture(defaultBackground2);
drawTexturedModalRect(guiLeft + xSize-256, guiTop, 0, 0, 256, 220);
menu.drawElements(fontRendererObj, i, j, mc, f);
super.drawGuiContainerBackgroundLayer(f, i, j);
}
// @Override
// protected void drawSlotInventory(Slot par1Slot)
// {this.dra
// if(subgui == null)
// super.drawSlotInventory(par1Slot);
// } //TODO fix
}
@@ -114,13 +114,13 @@ public class ModelMPM extends ModelNPCMale{
this.bipedRightArmWear = (new ModelScaleRenderer(this, 40, 32));
this.bipedRightArmWear.addBox(-2.0F, -2.0F, -2.0F, 3, 12, 4, par1 + 0.25F);
this.bipedRightArm.addChild(this.bipedRightArmWear);
this.solidRightArmWear = new ModelLimbWear(this,"arm","right");
this.solidRightArmWear = new ModelLimbWear(this,"arm","right","Alex");
this.bipedRightArm.addChild(this.solidRightArmWear);
this.bipedLeftArmwear = new ModelScaleRenderer(this, 48, 48);
this.bipedLeftArmwear.addBox(-1.0F, -2.0F, -2.0F, 3, 12, 4, par1 + 0.25F);
this.bipedLeftArm.addChild(this.bipedLeftArmwear);
this.solidLeftArmWear = new ModelLimbWear(this,"arm","left");
this.solidLeftArmWear = new ModelLimbWear(this,"arm","left","Alex");
this.bipedLeftArm.addChild(this.solidLeftArmWear);
}
else{
@@ -136,13 +136,13 @@ public class ModelMPM extends ModelNPCMale{
this.bipedRightArmWear = (new ModelScaleRenderer(this, 40, 32));
this.bipedRightArmWear.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
this.bipedRightArm.addChild(this.bipedRightArmWear);
this.solidRightArmWear = new ModelLimbWear(this,"arm","right");
this.solidRightArmWear = new ModelLimbWear(this,"arm","right","Steve");
this.bipedRightArm.addChild(this.solidRightArmWear);
this.bipedLeftArmwear = new ModelScaleRenderer(this, 48, 48);
this.bipedLeftArmwear.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
this.bipedLeftArm.addChild(this.bipedLeftArmwear);
this.solidLeftArmWear = new ModelLimbWear(this,"arm","left");
this.solidLeftArmWear = new ModelLimbWear(this,"arm","left","Steve");
this.bipedLeftArm.addChild(this.solidLeftArmWear);
}
@@ -157,13 +157,13 @@ public class ModelMPM extends ModelNPCMale{
this.bipedRightLegWear = (new ModelScaleRenderer(this, 0, 32));
this.bipedRightLegWear.addBox(-2.08F, 0.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
this.bipedRightLeg.addChild(this.bipedRightLegWear);
this.solidRightLegWear = new ModelLimbWear(this,"leg","right");
this.solidRightLegWear = new ModelLimbWear(this,"leg","right","Steve");
this.bipedRightLeg.addChild(this.solidRightLegWear);
this.bipedLeftLegWear = new ModelScaleRenderer(this, 0, 48);
this.bipedLeftLegWear.addBox(-1.92F, 0.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
this.bipedLeftLeg.addChild(this.bipedLeftLegWear);
this.solidLeftLegWear = new ModelLimbWear(this,"leg","left");
this.solidLeftLegWear = new ModelLimbWear(this,"leg","left","Steve");
this.bipedLeftLeg.addChild(this.solidLeftLegWear);
@@ -6,18 +6,32 @@ import noppes.npcs.client.model.util.Model2DRenderer;
import noppes.npcs.client.model.util.ModelScaleRenderer;
public class ModelLimbWear extends ModelScaleRenderer {
public ModelLimbWear(ModelBase base, String limb, String side) {
public ModelLimbWear(ModelBase base, String limb, String side, String type) {
super(base);
float thick = 0.55f;
switch (limb){
case "arm":
switch (side){
case "right":
rightArm(base,thick);
switch(type) {
case "Steve":
switch (side) {
case "right":
rightArm(base, thick);
break;
case "left":
leftArm(base, thick);
break;
}
break;
case "left":
leftArm(base,thick);
case "Alex":
switch (side) {
case "right":
rightArmAlex(base, thick);
break;
case "left":
leftArmAlex(base, thick);
break;
}
break;
}
break;
@@ -36,6 +50,100 @@ public class ModelLimbWear extends ModelScaleRenderer {
}
public void rightArmAlex(ModelBase base, float thick){
float x = 0.95f;
float y = -2.0f;
Model2DRenderer front = new Model2DRenderer(base, 44, 36, 3, 12, 64, 64);
front.setRotationPoint(-3.39375f+x, 12.535f+y, -2.58f);
front.setScale(0.96f,0.8175f);
front.setThickness(thick);
setRotation(front, 0, 0, 0);
this.addChild(front);
Model2DRenderer back = new Model2DRenderer(base, 51, 36, 3, 12, 64, 64);
back.setRotationPoint(0.44f+x, 12.535f+y, 2.58f);
back.setScale(0.96f,0.8175f);
back.setThickness(thick);
setRotation(back, 0, (float)(Math.PI), 0);
this.addChild(back);
Model2DRenderer right = new Model2DRenderer(base, 47, 36, 4, 12, 64, 64);
right.setRotationPoint(0.45f+x, 12.55f+y, -2.55f);
right.setScale(0.96f,0.82f);
right.setThickness(thick);
setRotation(right, 0, (float)(Math.PI/-2f), 0);
this.addChild(right);
Model2DRenderer left = new Model2DRenderer(base, 40, 36, 4, 12, 64, 64);
left.setRotationPoint(-3.405f+x, 12.55f+y, 2.55f);
left.setScale(0.96f,0.82f);
left.setThickness(thick);
setRotation(left, 0, (float)(Math.PI/2f), 0);
this.addChild(left);
Model2DRenderer top = new Model2DRenderer(base, 44, 32, 3, 4, 64, 64);
top.setRotationPoint(-3.39375f+x, -0.6f+y, -2.55f);
top.setScale(0.32f);
top.setThickness(thick);
setRotation(top, (float)(Math.PI / -2), 0, 0);
this.addChild(top);
Model2DRenderer bottom = new Model2DRenderer(base, 47, 32, 3, 4, 64, 64);
bottom.setRotationPoint(-3.39375f+x, 12.0f+y, -2.545f);
bottom.setScale(0.32f);
bottom.setThickness(thick);
setRotation(bottom, (float)(Math.PI / -2), 0, 0);
this.addChild(bottom);
}
public void leftArmAlex(ModelBase base,float thick){
float x = 1.95f;
float y = -2.0f;
Model2DRenderer front = new Model2DRenderer(base, 44+8, 36+16, 3, 12, 64, 64);
front.setRotationPoint(-3.39375f+x, 12.535f+y, -2.58f);
front.setScale(0.96f,0.8175f);
front.setThickness(thick);
setRotation(front, 0, 0, 0);
this.addChild(front);
Model2DRenderer back = new Model2DRenderer(base, 51+8, 36+16, 3, 12, 64, 64);
back.setRotationPoint(0.44f+x, 12.535f+y, 2.58f);
back.setScale(0.96f,0.8175f);
back.setThickness(thick);
setRotation(back, 0, (float)(Math.PI), 0);
this.addChild(back);
Model2DRenderer right = new Model2DRenderer(base, 47+8, 36+16, 4, 12, 64, 64);
right.setRotationPoint(0.45f+x, 12.55f+y, -2.55f);
right.setScale(0.96f,0.82f);
right.setThickness(thick);
setRotation(right, 0, (float)(Math.PI/-2f), 0);
this.addChild(right);
Model2DRenderer left = new Model2DRenderer(base, 40+8, 36+16, 4, 12, 64, 64);
left.setRotationPoint(-3.405f+x, 12.55f+y, 2.55f);
left.setScale(0.96f,0.82f);
left.setThickness(thick);
setRotation(left, 0, (float)(Math.PI/2f), 0);
this.addChild(left);
Model2DRenderer top = new Model2DRenderer(base, 44+8, 32+16, 3, 4, 64, 64);
top.setRotationPoint(-3.39375f+x, -0.6f+y, -2.55f);
top.setScale(0.32f);
top.setThickness(thick);
setRotation(top, (float)(Math.PI / -2), 0, 0);
this.addChild(top);
Model2DRenderer bottom = new Model2DRenderer(base, 47+8, 32+16, 3, 4, 64, 64);
bottom.setRotationPoint(-3.39375f+x, 12.0f+y, -2.545f);
bottom.setScale(0.32f);
bottom.setThickness(thick);
setRotation(bottom, (float)(Math.PI / -2), 0, 0);
this.addChild(bottom);
}
public void rightArm(ModelBase base, float thick){
float x = 0.95f;
float y = -2.0f;
@@ -76,7 +184,7 @@ public class ModelLimbWear extends ModelScaleRenderer {
this.addChild(top);
Model2DRenderer bottom = new Model2DRenderer(base, 48, 32, 4, 4, 64, 64);
bottom.setRotationPoint(-4.5f+x, 12.0f+y, -2.525f);
bottom.setRotationPoint(-4.5f+x, 12.0f+y, -2.545f);
bottom.setScale(0.32f);
bottom.setThickness(thick);
setRotation(bottom, (float)(Math.PI / -2), 0, 0);
@@ -40,6 +40,9 @@ public enum EnumPacketServer {
ScriptForgeSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
ScriptForgeGet(false),
ScriptNPCSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
ScriptNPCGet(false),
LinkedGetAll, LinkedRemove(CustomNpcsPermissions.GLOBAL_LINKED), LinkedAdd(CustomNpcsPermissions.GLOBAL_LINKED),
ScriptDataSave(CustomNpcsPermissions.TOOL_SCRIPTER, true), ScriptDataGet(true),
PlayerDataRemove(CustomNpcsPermissions.GLOBAL_PLAYERDATA),
@@ -1,21 +1,24 @@
package noppes.npcs.controllers;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import me.luizotavio.compressor.ZstdCompressor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTSizeTracker;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import noppes.npcs.CustomNpcs;
import noppes.npcs.LogWriter;
import noppes.npcs.util.JsonException;
import noppes.npcs.util.NBTJsonUtil;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.util.HashMap;
import java.util.Map;
import static me.luizotavio.compressor.executor.IOExecutor.IO_EXECUTOR;
public class PlayerDataController {
public static PlayerDataController instance;
@@ -70,14 +73,20 @@ public class PlayerDataController {
public NBTTagCompound loadPlayerData(String player){
File saveDir = getSaveDir();
String filename = player;
if(filename.isEmpty())
filename = "noplayername";
filename += ".json";
if(filename.isEmpty()) {
return new NBTTagCompound();
}
if(CustomNpcs.CompressorType.equalsIgnoreCase("zstd")) {
filename += ".zstd";
} else {
filename += ".json";
}
try {
File file = new File(saveDir, filename);
if(file.exists()){
return NBTJsonUtil.LoadFile(file);
}
return ensureCompressor(
new File(saveDir, filename)
);
} catch (Exception e) {
LogWriter.error("Error loading: " + filename, e);
}
@@ -87,16 +96,24 @@ public class PlayerDataController {
public void savePlayerData(PlayerData data){
NBTTagCompound compound = data.getNBT();
String filename = data.uuid + ".json";
String filename;
if (CustomNpcs.CompressorType.equalsIgnoreCase("zstd")) {
filename = data.uuid + ".zstd";
} else {
filename = data.uuid + ".json";
}
try {
File saveDir = getSaveDir();
File file = new File(saveDir, filename+"_new");
File file1 = new File(saveDir, filename);
NBTJsonUtil.SaveFile(file, compound);
if(file1.exists()){
file1.delete();
}
file.renameTo(file1);
File file = new File(saveDir, filename);
if (file.exists()) {
file.delete();
}
writeCompressor(file, compound);
} catch (Exception e) {
LogWriter.except(e);
}
@@ -164,7 +181,8 @@ public class PlayerDataController {
if(file.isDirectory() || !file.getName().endsWith(".json"))
continue;
try {
NBTTagCompound compound = NBTJsonUtil.LoadFile(file);
NBTTagCompound compound = ensureCompressor(file);
if(compound.hasKey("PlayerName")){
map.put(compound.getString("PlayerName"), compound);
}
@@ -178,4 +196,57 @@ public class PlayerDataController {
public boolean hasMail(EntityPlayer player) {
return getPlayerData(player).mailData.hasMail();
}
private void writeCompressor(File file, NBTTagCompound compound) {
if (compound == null) {
throw new IllegalArgumentException("Compound cannot be null!");
}
if (CustomNpcs.CompressorType.equalsIgnoreCase("json")) {
IO_EXECUTOR.submit(() -> {
try {
NBTJsonUtil.SaveFile(file, compound);
} catch (IOException | JsonException e) {
e.printStackTrace();
}
});
} else if (CustomNpcs.CompressorType.equalsIgnoreCase("zstd")) {
IO_EXECUTOR.submit(() -> {
try {
byte[] compressed = ZstdCompressor.writeCompound(compound);
Files.write(
file.toPath(),
compressed,
StandardOpenOption.CREATE,
StandardOpenOption.WRITE
);
} catch (Exception e) {
e.printStackTrace();
}
});
}
}
private NBTTagCompound ensureCompressor(File file) throws JsonException, IOException {
if (!file.exists()) {
return new NBTTagCompound();
}
if (CustomNpcs.CompressorType.equalsIgnoreCase("json")) {
return NBTJsonUtil.LoadFile(file);
}
if (CustomNpcs.CompressorType.equalsIgnoreCase("zstd")) {
byte[] readCompressed = ZstdCompressor.readCompressed(
new RandomAccessFile(file, "r")
);
try (DataInputStream dataInputStream = new DataInputStream(new ByteArrayInputStream(readCompressed))) {
return CompressedStreamTools.func_152456_a(dataInputStream, NBTSizeTracker.field_152451_a);
}
}
throw new IOException("Unknown compressor type: " + CustomNpcs.CompressorType);
}
}
@@ -110,10 +110,16 @@ public class ScriptContainer {
}
public void run(EnumScriptType type, Event event) {
if(!CustomNpcs.ScriptingEnabled)
return;
this.run((String)type.function, (Object)event);
}
public void run(String type, Object event) {
if(!CustomNpcs.ScriptingEnabled)
return;
if (!this.errored && this.hasCode() && !this.unknownFunctions.contains(type)) {
this.setEngine(this.handler.getLanguage());
if (this.engine != null) {
@@ -29,6 +29,7 @@ import net.minecraftforge.event.world.WorldEvent;
import noppes.npcs.CustomNpcs;
import noppes.npcs.LogWriter;
import noppes.npcs.controllers.data.ForgeDataScript;
import noppes.npcs.controllers.data.NPCDataScript;
import noppes.npcs.controllers.data.PlayerDataScript;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.entity.*;
@@ -56,6 +57,8 @@ public class ScriptController {
public ForgeDataScript forgeScripts = new ForgeDataScript();
public NPCDataScript npcScripts = new NPCDataScript((EntityNPCInterface) null);
public ScriptController(){
loaded = false;
Instance = this;
@@ -111,6 +114,10 @@ public class ScriptController {
return new File(dir, "player_scripts.json");
}
private File npcScriptsFile() {
return new File(dir, "npc_scripts.json");
}
public boolean loadPlayerScripts() {
this.playerScripts.clear();
File file = this.playerScriptsFile();
@@ -143,6 +150,37 @@ public class ScriptController {
}
}
public boolean loadNPCScripts() {
this.npcScripts.clear();
File file = this.npcScriptsFile();
try {
if(!file.exists()) {
return false;
} else {
this.npcScripts.readFromNBT(NBTJsonUtil.LoadFile(file));
shouldSave = false;
return true;
}
} catch (Exception var3) {
LogWriter.error("Error loading: " + file.getAbsolutePath(), var3);
return false;
}
}
public void setNPCScripts(NBTTagCompound compound) {
this.npcScripts.readFromNBT(compound);
File file = this.npcScriptsFile();
try {
NBTJsonUtil.SaveFile(file, compound);
} catch (IOException var4) {
var4.printStackTrace();
} catch (JsonException var5) {
var5.printStackTrace();
}
}
private void loadCategories(){
dir = new File(CustomNpcs.getWorldSaveDirectory(), "scripts");
if(!dir.exists())
@@ -42,8 +42,8 @@ public class ServerCloneController implements ICloneHandler {
try {
File dir = new File(getDir(), "..");
File file = new File(dir, "clonednpcs.dat");
System.out.println(file.getAbsolutePath());
System.out.println(file.exists());
// System.out.println(file.getAbsolutePath());
// System.out.println(file.exists());
if(file.exists()){
Map<Integer, Map<String, NBTTagCompound>> clones = loadOldClones(file);
file.delete();
@@ -14,6 +14,7 @@ import java.util.Map.Entry;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.CustomNpcs;
import noppes.npcs.EventHooks;
import noppes.npcs.controllers.ScriptContainer;
import noppes.npcs.NBTTags;
@@ -84,7 +85,7 @@ public class ForgeDataScript implements IScriptHandler {
}
public boolean getEnabled() {
return this.enabled;
return CustomNpcs.GlobalForgeScripts && this.enabled;
}
public void setEnabled(boolean bo) {
@@ -0,0 +1,297 @@
package noppes.npcs.controllers.data;
import com.google.common.base.Preconditions;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.BlockPos;
import noppes.npcs.CustomNpcs;
import noppes.npcs.NBTTags;
import noppes.npcs.constants.EnumScriptType;
import noppes.npcs.controllers.IScriptHandler;
import noppes.npcs.controllers.ScriptContainer;
import noppes.npcs.controllers.ScriptController;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.interfaces.ICustomNpc;
import javax.annotation.CheckForNull;
import java.lang.reflect.Array;
import java.util.*;
public class NPCDataScript implements IScriptHandler {
public List<ScriptContainer> scripts = new ArrayList();
public String scriptLanguage = "ECMAScript";
private EntityNPCInterface npc;
private ICustomNpc npcAPI;
public long lastInited = -1L;
public boolean enabled = false;
private Map<Long, String> console = new TreeMap();
public List<Integer> errored = new ArrayList();
public NPCDataScript(EntityNPCInterface npc) {
if(npc != null) {
this.npc = npc;
}
}
public void clear() {
this.console = new TreeMap();
this.errored = new ArrayList();
this.scripts = new ArrayList();
}
public void readFromNBT(NBTTagCompound compound) {
this.scripts = NBTTags.GetScript(compound.getTagList("Scripts", 10), this);
this.scriptLanguage = compound.getString("ScriptLanguage");
this.enabled = compound.getBoolean("ScriptEnabled");
this.console = NBTTags.GetLongStringMap(compound.getTagList("ScriptConsole", 10));
}
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
compound.setTag("Scripts", NBTTags.NBTScript(this.scripts));
compound.setString("ScriptLanguage", this.scriptLanguage);
compound.setBoolean("ScriptEnabled", this.enabled);
compound.setTag("ScriptConsole", NBTTags.NBTLongStringMap(this.console));
return compound;
}
public void callScript(EnumScriptType type, Event event) {
if (this.isEnabled()) {
ScriptContainer script;
if (ScriptController.Instance.lastLoaded > this.lastInited) {
this.lastInited = ScriptController.Instance.lastLoaded;
errored.clear();
}
for(int i = 0; i < ScriptController.Instance.npcScripts.scripts.size(); ++i) {
script = (ScriptContainer)ScriptController.Instance.npcScripts.scripts.get(i);
if (!errored.contains(i)) {
if(script == null || script.errored || !script.hasCode() || ScriptController.Instance.npcScripts.errored.contains(i))
return;
script.run(type, event);
if (script.errored) {
ScriptController.Instance.npcScripts.errored.add(i);
}
Iterator var8 = script.console.entrySet().iterator();
while(var8.hasNext()) {
Map.Entry<Long, String> entry = (Map.Entry)var8.next();
if (!ScriptController.Instance.npcScripts.console.containsKey(entry.getKey())) {
ScriptController.Instance.npcScripts.console.put(entry.getKey(), " tab " + (i + 1) + ":\n" + (String)entry.getValue());
}
}
script.console.clear();
}
}
}
}
public boolean isEnabled() {
return CustomNpcs.GlobalNPCScripts && ScriptController.Instance.npcScripts.enabled && ScriptController.HasStart && (this.npc == null || !this.npc.worldObj.isRemote);
}
public boolean isClient() {
return this.npc.isClientWorld();
}
public boolean getEnabled() {
return ScriptController.Instance.npcScripts.enabled;
}
public void setEnabled(boolean bo) {
ScriptController.Instance.npcScripts.enabled = bo;
this.enabled = bo;
}
public String getLanguage() {
return ScriptController.Instance.npcScripts.scriptLanguage;
}
public void setLanguage(String lang) {
this.scriptLanguage = lang;
}
public List<ScriptContainer> getScripts() {
return this.scripts;
}
public String noticeString() {
if(this.npc == null) {
return "Global script";
} else {
BlockPos pos = new BlockPos(this.npc);
return NPCDataScript.toStringHelper(this.npc).add("x", pos.getX()).add("y", pos.getY()).add("z", pos.getZ()).toString();
}
}
public ICustomNpc getNpc() {
if (this.npcAPI == null) {
this.npcAPI = (ICustomNpc) NpcAPI.Instance().getIEntity(this.npc);
}
return this.npcAPI;
}
public Map<Long, String> getConsoleText() {
return this.console;
}
public void clearConsole() {
this.console.clear();
}
public static final class ToStringHelper {
private final String className;
private final NPCDataScript.ToStringHelper.ValueHolder holderHead;
private NPCDataScript.ToStringHelper.ValueHolder holderTail;
private boolean omitNullValues;
private boolean omitEmptyValues;
private ToStringHelper(String className) {
this.holderHead = new NPCDataScript.ToStringHelper.ValueHolder();
this.holderTail = this.holderHead;
this.omitNullValues = false;
this.omitEmptyValues = false;
this.className = (String) Preconditions.checkNotNull(className);
}
public NPCDataScript.ToStringHelper omitNullValues() {
this.omitNullValues = true;
return this;
}
public NPCDataScript.ToStringHelper add(String name, @CheckForNull Object value) {
return this.addHolder(name, value);
}
public NPCDataScript.ToStringHelper add(String name, boolean value) {
return this.addUnconditionalHolder(name, String.valueOf(value));
}
public NPCDataScript.ToStringHelper add(String name, char value) {
return this.addUnconditionalHolder(name, String.valueOf(value));
}
public NPCDataScript.ToStringHelper add(String name, double value) {
return this.addUnconditionalHolder(name, String.valueOf(value));
}
public NPCDataScript.ToStringHelper add(String name, float value) {
return this.addUnconditionalHolder(name, String.valueOf(value));
}
public NPCDataScript.ToStringHelper add(String name, int value) {
return this.addUnconditionalHolder(name, String.valueOf(value));
}
public NPCDataScript.ToStringHelper add(String name, long value) {
return this.addUnconditionalHolder(name, String.valueOf(value));
}
public NPCDataScript.ToStringHelper addValue(@CheckForNull Object value) {
return this.addHolder(value);
}
public NPCDataScript.ToStringHelper addValue(boolean value) {
return this.addUnconditionalHolder(String.valueOf(value));
}
public NPCDataScript.ToStringHelper addValue(char value) {
return this.addUnconditionalHolder(String.valueOf(value));
}
public NPCDataScript.ToStringHelper addValue(double value) {
return this.addUnconditionalHolder(String.valueOf(value));
}
public NPCDataScript.ToStringHelper addValue(float value) {
return this.addUnconditionalHolder(String.valueOf(value));
}
public NPCDataScript.ToStringHelper addValue(int value) {
return this.addUnconditionalHolder(String.valueOf(value));
}
public NPCDataScript.ToStringHelper addValue(long value) {
return this.addUnconditionalHolder(String.valueOf(value));
}
private static boolean isEmpty(Object value) {
if (value instanceof CharSequence) {
return ((CharSequence)value).length() == 0;
} else if (value instanceof Collection) {
return ((Collection)value).isEmpty();
} else if (value instanceof Map) {
return ((Map)value).isEmpty();
} else if (value instanceof Optional) {
return !((Optional)value).isPresent();
} else if (value instanceof OptionalInt) {
return !((OptionalInt)value).isPresent();
} else if (value instanceof OptionalLong) {
return !((OptionalLong)value).isPresent();
} else if (value instanceof OptionalDouble) {
return !((OptionalDouble)value).isPresent();
} else if (value instanceof com.google.common.base.Optional) {
return !((com.google.common.base.Optional)value).isPresent();
} else if (value.getClass().isArray()) {
return Array.getLength(value) == 0;
} else {
return false;
}
}
public String toString() {
boolean omitNullValuesSnapshot = this.omitNullValues;
boolean omitEmptyValuesSnapshot = this.omitEmptyValues;
String nextSeparator = "";
StringBuilder builder = (new StringBuilder(32)).append(this.className).append('{');
for(NPCDataScript.ToStringHelper.ValueHolder valueHolder = this.holderHead.next; valueHolder != null; valueHolder = valueHolder.next) {
Object value = valueHolder.value;
if (!(valueHolder instanceof NPCDataScript.ToStringHelper.UnconditionalValueHolder)) {
if (value == null) {
if (omitNullValuesSnapshot) {
continue;
}
} else if (omitEmptyValuesSnapshot && isEmpty(value)) {
continue;
}
}
builder.append(nextSeparator);
nextSeparator = ", ";
if (valueHolder.name != null) {
builder.append(valueHolder.name).append('=');
}
if (value != null && value.getClass().isArray()) {
Object[] objectArray = new Object[]{value};
String arrayString = Arrays.deepToString(objectArray);
builder.append(arrayString, 1, arrayString.length() - 1);
} else {
builder.append(value);
}
}
return builder.append('}').toString();
}
private NPCDataScript.ToStringHelper.ValueHolder addHolder() {
NPCDataScript.ToStringHelper.ValueHolder valueHolder = new NPCDataScript.ToStringHelper.ValueHolder();
this.holderTail = this.holderTail.next = valueHolder;
return valueHolder;
}
private NPCDataScript.ToStringHelper addHolder(@CheckForNull Object value) {
NPCDataScript.ToStringHelper.ValueHolder valueHolder = this.addHolder();
valueHolder.value = value;
return this;
}
private NPCDataScript.ToStringHelper addHolder(String name, @CheckForNull Object value) {
NPCDataScript.ToStringHelper.ValueHolder valueHolder = this.addHolder();
valueHolder.value = value;
valueHolder.name = (String)Preconditions.checkNotNull(name);
return this;
}
private NPCDataScript.ToStringHelper.UnconditionalValueHolder addUnconditionalHolder() {
NPCDataScript.ToStringHelper.UnconditionalValueHolder valueHolder = new NPCDataScript.ToStringHelper.UnconditionalValueHolder();
this.holderTail = this.holderTail.next = valueHolder;
return valueHolder;
}
private NPCDataScript.ToStringHelper addUnconditionalHolder(Object value) {
NPCDataScript.ToStringHelper.UnconditionalValueHolder valueHolder = this.addUnconditionalHolder();
valueHolder.value = value;
return this;
}
private NPCDataScript.ToStringHelper addUnconditionalHolder(String name, Object value) {
NPCDataScript.ToStringHelper.UnconditionalValueHolder valueHolder = this.addUnconditionalHolder();
valueHolder.value = value;
valueHolder.name = (String)Preconditions.checkNotNull(name);
return this;
}
private static final class UnconditionalValueHolder extends NPCDataScript.ToStringHelper.ValueHolder {
private UnconditionalValueHolder() {
super();
}
}
private static class ValueHolder {
@CheckForNull
String name;
@CheckForNull
Object value;
@CheckForNull
NPCDataScript.ToStringHelper.ValueHolder next;
private ValueHolder() {
}
}
}
public static NPCDataScript.ToStringHelper toStringHelper(Object self) {
return new NPCDataScript.ToStringHelper(self.getClass().getSimpleName());
}
}
@@ -13,6 +13,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.BlockPos;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.world.WorldServer;
import noppes.npcs.CustomNpcs;
import noppes.npcs.EventHooks;
import noppes.npcs.controllers.ScriptContainer;
import noppes.npcs.NBTTags;
@@ -106,7 +107,7 @@ public class PlayerDataScript implements IScriptHandler {
}
public boolean isEnabled() {
return ScriptController.Instance.playerScripts.enabled && ScriptController.HasStart && (this.player == null || !this.player.worldObj.isRemote);
return CustomNpcs.GlobalPlayerScripts && ScriptController.Instance.playerScripts.enabled && ScriptController.HasStart && (this.player == null || !this.player.worldObj.isRemote);
}
public boolean isClient() {
return this.player.isClientWorld();
@@ -1,10 +1,6 @@
package noppes.npcs.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public abstract class EntityNPCFlying extends EntityNPCInterface {
@@ -30,17 +26,21 @@ public abstract class EntityNPCFlying extends EntityNPCInterface {
super.updateFallState(p_180433_1_, p_180433_3_);
}
public void onLivingUpdate()
@Override
public boolean isOnLadder(){
return false;
}
public void moveEntityWithHeading(float p_70612_1_, float p_70612_2_)
{
super.onLivingUpdate();
if(!canFly()){
if(!this.canFly() || this.hurtTime != 0) {
super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
return;
}
int blockY = (int) this.posY;
double heightOffGround = 0;
if(this.ai.hasFlyLimit) {
for (blockY = (int) this.posY; blockY > 0; blockY--) {
for (int blockY = (int) this.posY; blockY > 0; blockY--) {
heightOffGround = this.posY - blockY;
if (this.worldObj.getBlock((int) this.posX, blockY, (int) this.posZ) != Blocks.air || heightOffGround > this.ai.flyHeightLimit){
break;
@@ -48,24 +48,19 @@ public abstract class EntityNPCFlying extends EntityNPCInterface {
}
}
if (!this.onGround && !this.velocityChanged && this.motionY < 0 && this.hurtTime == 0)
{
if(heightOffGround >= this.ai.flyHeightLimit && this.ai.hasFlyLimit){
this.motionY *= 0.8D;
this.velocityChanged = true;
} else {
this.motionY *= this.ai.flyGravity;
this.velocityChanged = true;
}
if(heightOffGround > this.ai.flyHeightLimit && this.ai.hasFlyLimit){
super.moveEntityWithHeading(p_70612_1_,p_70612_2_);
return;
}
double d3 = this.motionY;
super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
this.motionY = d3;
this.fallDistance = 0.0F;
this.velocityChanged = true;
if(this.getNavigator().noPath())
this.motionY = 0.0D;
}
@Override
public boolean isOnLadder(){
return false;
}
}
@@ -40,20 +40,7 @@ import net.minecraft.world.WorldServer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.event.ServerChatEvent;
import noppes.npcs.CustomItems;
import noppes.npcs.CustomNpcs;
import noppes.npcs.DataAI;
import noppes.npcs.DataAdvanced;
import noppes.npcs.DataDisplay;
import noppes.npcs.DataInventory;
import noppes.npcs.DataScript;
import noppes.npcs.DataStats;
import noppes.npcs.IChatMessages;
import noppes.npcs.NBTTags;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.NpcDamageSource;
import noppes.npcs.Server;
import noppes.npcs.VersionCompatibility;
import noppes.npcs.*;
import noppes.npcs.ai.*;
import noppes.npcs.ai.EntityAIMoveIndoors;
import noppes.npcs.ai.EntityAIPanic;
@@ -233,8 +220,9 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
@Override
public void onUpdate(){
super.onUpdate();
if(this.ticksExisted % 10 == 0)
script.callScript(EnumScriptType.TICK);
if(this.ticksExisted % 10 == 0) {
EventHooks.onNPCUpdate(this);
}
this.timers.update();
}
@@ -243,6 +231,11 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
script.setWorld(world);
}
public int getMaxSafePointTries()
{
return 5;
}
@Override
public boolean attackEntityAsMob(Entity par1Entity){
float f = stats.getAttackStrength();
@@ -252,7 +245,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
}
if(par1Entity instanceof EntityLivingBase){
ScriptEventAttack event = new ScriptEventAttack(f, (EntityLivingBase)par1Entity, false);
if(script.callScript(EnumScriptType.ATTACK, "event", event, "target", par1Entity))
if(EventHooks.onNPCMeleeAttack(this, f, (EntityLivingBase)par1Entity))
return false;
f = event.getDamage();
}
@@ -393,8 +386,8 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
return true;
}
}
if(script.callScript(EnumScriptType.INTERACT, "player", player) || isAttacking() || isKilled() || faction.isAggressiveToPlayer(player))
if(EventHooks.onNPCInteract(this, player) || isAttacking() || isKilled() || faction.isAggressiveToPlayer(player))
return false;
addInteract(player);
@@ -510,7 +503,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
else if (attackingEntity instanceof EntityPlayer && faction.isFriendlyToPlayer((EntityPlayer) attackingEntity))
return false;
ScriptEventDamaged result = new ScriptEventDamaged(i, attackingEntity, damagesource);
if(script.callScript(EnumScriptType.DAMAGED, "event", result) || isKilled())
if(EventHooks.onNPCDamaged(this, attackingEntity, i, damagesource, result) || isKilled())
return false;
i = result.getDamage();
@@ -560,7 +553,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
return;
if(getAttackTarget() != entity && entity != null){
ScriptEventTarget event = new ScriptEventTarget(entity);
if(script.callScript(EnumScriptType.TARGET, "event", event))
if(EventHooks.onNPCTarget(this,entity))
return;
if(event.getTarget() == null)
@@ -585,7 +578,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
return;
}
ScriptEventAttack event = new ScriptEventAttack(stats.pDamage, entity, true);
if(script.callScript(EnumScriptType.ATTACK, "event", event, "target", entity))
if(EventHooks.onNPCRangedAttack(this, f, (EntityLivingBase)entity))
return;
for(int i = 0; i < this.stats.shotCount; i++)
{
@@ -914,7 +907,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
}
public void saySurrounding(Line line) {
if (line == null || line.text == null)
if (line == null || line.text == null || getFakePlayer() == null)
return;
ServerChatEvent event = new ServerChatEvent(getFakePlayer(), line.text, new ChatComponentTranslation(line.text.replace("%", "%%")));
if (MinecraftForge.EVENT_BUS.post(event) || event.component == null){
@@ -1067,7 +1060,8 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
if(jobInterface != null)
jobInterface.reset();
EventHooks.onNPCInit(this);
script.callScript(EnumScriptType.INIT);
}
@@ -1090,8 +1084,9 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
for (int i = 0; i < list.size(); ++i){
Entity entity = (Entity)list.get(i);
if (entity.isEntityAlive())
script.callScript(EnumScriptType.COLLIDE, "entity", entity);
if (entity.isEntityAlive()) {
EventHooks.onNPCCollide(this,entity);
}
}
}
@@ -1218,7 +1213,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
attackingEntity = ((EntityThrowable) entity).getThrower();
ScriptEventKilled result = new ScriptEventKilled(attackingEntity, damagesource);
if(script.callScript(EnumScriptType.KILLED, "event", result))
if(EventHooks.onNPCKilled(this,damagesource,attackingEntity,result))
return;
if(!isRemote()){
if(this.recentlyHit > 0)
@@ -1812,4 +1807,6 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
{
this.display.modelType = val;
}
protected void updateLeashedState(){}
}
@@ -55,6 +55,42 @@ public class DataTimers implements ITimers {
}
}
public int ticks(int id){
return this.timers.get(Integer.valueOf(id)).ticks;
}
public void setTicks(int id, int ticks){
DataTimers.Timer timer = (DataTimers.Timer)this.timers.get(Integer.valueOf(id));
if(ticks < 0)
ticks = 0;
if(ticks > timer.timerTicks)
ticks = timer.timerTicks;
timer.ticks = ticks;
}
public int maxTicks(int id){
return this.timers.get(Integer.valueOf(id)).timerTicks;
}
public void setMaxTicks(int id, int maxTicks){
DataTimers.Timer timer = (DataTimers.Timer)this.timers.get(Integer.valueOf(id));
if(maxTicks < 0)
maxTicks = 0;
if(timer.ticks > maxTicks)
timer.ticks = maxTicks;
timer.timerTicks = maxTicks;
}
public boolean repeats(int id){
return this.timers.get(Integer.valueOf(id)).repeat;
}
public void setRepeats(int id, boolean repeat){
this.timers.get(Integer.valueOf(id)).repeat = repeat;
}
public void writeToNBT(NBTTagCompound compound) {
NBTTagList list = new NBTTagList();
Iterator var3 = this.timers.values().iterator();
@@ -20,12 +20,14 @@ import noppes.npcs.scripted.handler.data.IQuestObjective;
public class QuestKill extends QuestInterface implements IQuestKill {
public HashMap<String,Integer> targets = new HashMap<String,Integer>();
public int targetType = 0;
public String customTargetType = "noppes.npcs.entity.EntityCustomNpc";
@Override
public void writeEntityToNBT(NBTTagCompound compound) {
compound.setTag("QuestKills", NBTTags.nbtStringIntegerMap(targets));
//compound.setTag("QuestDialogs", NBTTags.nbtStringIntegerMap(targets));
compound.setInteger("TargetType",targetType);
compound.setString("CustomTargetType",customTargetType);
}
@Override
@@ -40,6 +42,7 @@ public class QuestKill extends QuestInterface implements IQuestKill {
//targets = NBTTags.getStringIntegerMap(compound.getTagList("QuestDialogs", 10));
targetType = compound.getInteger("TargetType");
customTargetType = compound.getString("CustomTargetType");
}
@Override
@@ -48,7 +51,20 @@ public class QuestKill extends QuestInterface implements IQuestKill {
QuestData data = playerdata.activeQuests.get(questId);
if(data == null)
return false;
HashMap<String,Integer> killed = getKilled(data);
int completed = 0;
for(String entityName : targets.keySet()){
int amount = 0;
if(killed.containsKey(entityName))
amount = killed.get(entityName);
if(amount >= targets.get(entityName)){
completed++;
}
}
if(completed >= targets.keySet().size())
return true;
if(killed.size() != targets.size())
return false;
for(String entity : killed.keySet()){
@@ -106,8 +122,8 @@ public class QuestKill extends QuestInterface implements IQuestKill {
public void setTargetType(int type) {
if(type < 0)
type = 0;
if(type > 1)
type = 1;
if(type > 2)
type = 2;
this.targetType = type;
}
@@ -18,17 +18,35 @@ public class ScriptEntityParticle {
private float alpha1 = 1.0f,alpha2 = 1.0f,alphaRate = 0.0f;
private int scaleRateStart = 0, alphaRateStart = 0;
public float rotationX1 = 0;
public float rotationX2 = 0;
public float rotationXRate = 0.0F;
public int rotationXRateStart = 0;
public float rotationY1 = 0;
public float rotationY2 = 0;
public float rotationYRate = 0.0F;
public int rotationYRateStart = 0;
public float rotationZ1 = 0;
public float rotationZ2 = 0;
public float rotationZRate = 0.0F;
public int rotationZRateStart = 0;
public ScriptEntityParticle(String directory){
this.directory = directory;
}
public void spawnOnEntity(ScriptEntity entity){
int entityID = entity.getMCEntity().getEntityId();
NoppesUtilServer.spawnScriptedParticle(entity.getMCEntity(), directory, HEXcolor, amount, maxAge,
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
x, y, z,
motionX, motionY, motionZ, gravity,
scale1, scale2, scaleRate, scaleRateStart,
alpha1, alpha2, alphaRate, alphaRateStart,
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
entityID
);
}
@@ -52,11 +70,9 @@ public class ScriptEntityParticle {
public double getX() {
return x;
}
public double getY() {
return y;
}
public double getZ() {
return z;
}
@@ -64,50 +80,56 @@ public class ScriptEntityParticle {
public double getMotionX() {
return motionX;
}
public double getMotionY() {
return motionY;
}
public double getMotionZ() {
return motionZ;
}
public float getGravity() {
return gravity;
}
public float getScale1() {
return scale1;
}
public float getScale2() {
return scale2;
}
public float getScaleRate() {
return scaleRate;
}
public float getAlpha1() {
return alpha1;
}
public float getAlpha2() {
return alpha2;
}
public float getAlphaRate() {
return alphaRate;
}
public int getAlphaRateStart() {
return alphaRateStart;
}
public float getScale1() {
return scale1;
}
public float getScale2() {
return scale2;
}
public float getScaleRate() {
return scaleRate;
}
public int getScaleRateStart() {
return scaleRateStart;
}
public int getAlphaRateStart() {
return alphaRateStart;
}
public float getRotationX1() {return rotationX1;}
public float getRotationX2() {return rotationX2;}
public float getRotationXRate() {return rotationXRate;}
public int getRotationXRateStart() {return rotationXRateStart;}
public float getRotationY1() {return rotationY1;}
public float getRotationY2() {return rotationY2;}
public float getRotationYRate() {return rotationYRate;}
public int getRotationYRateStart() {return rotationYRateStart;}
public float getRotationZ1() {return rotationZ1;}
public float getRotationZ2() {return rotationZ2;}
public float getRotationZRate() {return rotationZRate;}
public int getRotationZRateStart() {return rotationZRateStart;}
public void setDirectory(String directory) {
this.directory = directory;
@@ -130,15 +152,12 @@ public class ScriptEntityParticle {
this.y = y;
this.z = z;
}
public void setX(double x) {
this.x = x;
}
public void setY(double y) {
this.y = y;
}
public void setZ(double z) {
this.z = z;
}
@@ -149,19 +168,15 @@ public class ScriptEntityParticle {
this.motionZ = motionZ;
this.gravity = gravity;
}
public void setMotionX(double motionX) {
this.motionX = motionX;
}
public void setMotionY(double motionY) {
this.motionY = motionY;
}
public void setMotionZ(double motionZ) {
this.motionZ = motionZ;
}
public void setGravity(float gravity) {
this.gravity = gravity;
}
@@ -172,19 +187,15 @@ public class ScriptEntityParticle {
this.scaleRate = scaleRate;
this.scaleRateStart = scaleRateStart;
}
public void setScale1(float scale1) {
this.scale1 = scale1;
}
public void setScale2(float scale2) {
this.scale2 = scale2;
}
public void setScaleRate(float scaleRate) {
this.scaleRate = scaleRate;
}
public void setScaleRateStart(int scaleRateStart) {
this.scaleRateStart = scaleRateStart;
}
@@ -195,20 +206,49 @@ public class ScriptEntityParticle {
this.alphaRate = alphaRate;
this.alphaRateStart = alphaRateStart;
}
public void setAlpha1(float alpha1) {
this.alpha1 = alpha1;
}
public void setAlpha2(float alpha2) {
this.alpha2 = alpha2;
}
public void setAlphaRate(float alphaRate) {
this.alphaRate = alphaRate;
}
public void setAlphaRateStart(int alphaRateStart) {
this.alphaRateStart = alphaRateStart;
}
public void setRotationX(float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart){
this.rotationX1 = rotationX1;
this.rotationX2 = rotationX2;
this.rotationXRate = rotationXRate;
this.rotationXRateStart = rotationXRateStart;
}
public void setRotationX1(float rotationX1) {this.rotationX1 = rotationX1;}
public void setRotationX2(float rotationX2) {this.rotationX2 = rotationX2;}
public void setRotationXRate(float rotationXRate) {this.rotationXRate = rotationXRate;}
public void setRotationXRateStart(int rotationXRateStart) {this.rotationXRateStart = rotationXRateStart;}
public void setRotationY(float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart){
this.rotationY1 = rotationY1;
this.rotationY2 = rotationY2;
this.rotationYRate = rotationYRate;
this.rotationYRateStart = rotationYRateStart;
}
public void setRotationY1(float rotationY1) {this.rotationY1 = rotationY1;}
public void setRotationY2(float rotationY2) {this.rotationY2 = rotationY2;}
public void setRotationYRate(float rotationYRate) {this.rotationYRate = rotationYRate;}
public void setRotationYRateStart(int rotationYRateStart) {this.rotationYRateStart = rotationYRateStart;}
public void setRotationZ(float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart){
this.rotationZ1 = rotationZ1;
this.rotationZ2 = rotationZ2;
this.rotationZRate = rotationZRate;
this.rotationZRateStart = rotationZRateStart;
}
public void setRotationZ1(float rotationZ1) {this.rotationZ1 = rotationZ1;}
public void setRotationZ2(float rotationZ2) {this.rotationZ2 = rotationZ2;}
public void setRotationZRate(float rotationZRate) {this.rotationZRate = rotationZRate;}
public void setRotationZRateStart(int rotationZRateStart) {this.rotationZRateStart = rotationZRateStart;}
}
@@ -224,23 +224,33 @@ public class ScriptItemStack implements IItemStack {
}
public String[] getLore() {
NBTTagCompound compound = this.item.getTagCompound().getCompoundTag("display");
if (compound != null && compound.func_150299_b("Lore") == 9) {
NBTTagList nbttaglist = compound.getTagList("Lore", 8);
if (nbttaglist.tagCount() < 1) {
return new String[0];
} else {
List<String> lore = new ArrayList();
if (this.item.getTagCompound() != null) {
NBTTagCompound compound = this.item.getTagCompound().getCompoundTag("display");
if(compound != null && compound.func_150299_b("Lore") == 9) {
NBTTagList nbttaglist = compound.getTagList("Lore", 8);
if (nbttaglist.tagCount() > 0) {
List<String> lore = new ArrayList();
for(int i = 0; i < nbttaglist.tagCount(); ++i) {
lore.add(nbttaglist.getStringTagAt(i));
for (int i = 0; i < nbttaglist.tagCount(); ++i) {
lore.add(nbttaglist.getStringTagAt(i));
}
return (String[]) ((String[]) lore.toArray(new String[lore.size()]));
}
return (String[])((String[])lore.toArray(new String[lore.size()]));
}
} else {
return new String[0];
}
return new String[0];
}
public boolean hasLore() {
if (this.item.getTagCompound() != null) {
NBTTagCompound compound = this.item.getTagCompound().getCompoundTag("display");
if (compound != null && compound.func_150299_b("Lore") == 9) {
NBTTagList nbttaglist = compound.getTagList("Lore", 8);
return nbttaglist.tagCount() > 0;
}
}
return false;
}
public void setLore(String[] lore) {
@@ -445,6 +445,26 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T>{
}
public void setForm(byte form){
if(form < 0)
return;
switch(getRace()){
case 0:
case 3:
if(form > 3)
return;
break;
case 1:
case 2:
if(form > 15)
return;
break;
case 4:
if(form > 7)
return;
break;
}
player.getEntityData().getCompoundTag("PlayerPersisted").setByte("jrmcState",form);
}
public byte getForm(){
@@ -67,14 +67,101 @@ public class ScriptEntity<T extends Entity> implements IEntity {
double x, double y, double z,
double motionX, double motionY, double motionZ, float gravity,
float scale1, float scale2, float scaleRate, int scaleRateStart,
float alpha1, float alpha2, float alphaRate, int alphaRateStart
float alpha1, float alpha2, float alphaRate, int alphaRateStart,
float rotation1, float rotation2, float rotationRate, int rotationRateStart,
float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart,
float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart,
float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart
) {
int entityID = entity.getEntityId();
NoppesUtilServer.spawnScriptedParticle(entity, directory, HEXcolor, amount, maxAge,
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
x, y, z,
motionX, motionY, motionZ, gravity,
scale1, scale2, scaleRate, scaleRateStart,
alpha1, alpha2, alphaRate, alphaRateStart,
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
entityID
);
}
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
double x, double y, double z,
double motionX, double motionY, double motionZ, float gravity,
float scale1, float scale2, float scaleRate, int scaleRateStart,
float alpha1, float alpha2, float alphaRate, int alphaRateStart
) {
int entityID = entity.getEntityId();
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
x, y, z,
motionX, motionY, motionZ, gravity,
scale1, scale2, scaleRate, scaleRateStart,
alpha1, alpha2, alphaRate, alphaRateStart,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
entityID
);
}
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
double x, double y, double z,
double motionX, double motionY, double motionZ, float gravity,
float scale1, float scale2, float scaleRate, int scaleRateStart
) {
int entityID = entity.getEntityId();
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
x, y, z,
motionX, motionY, motionZ, gravity,
scale1, scale2, scaleRate, scaleRateStart,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
entityID
);
}
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
double x, double y, double z,
double motionX, double motionY, double motionZ, float gravity
) {
int entityID = entity.getEntityId();
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
x, y, z,
motionX, motionY, motionZ, gravity,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
entityID
);
}
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
double x, double y, double z
) {
int entityID = entity.getEntityId();
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
x, y, z,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
entityID
);
}
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge
) {
int entityID = entity.getEntityId();
NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge,
0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
entityID
);
}
@@ -106,7 +106,11 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
public T getMCEntity(){
return entity;
}
public T getMinecraftEntity(){
return getMCEntity();
}
/**
* Makes the entity swing its hand
*/
@@ -74,7 +74,11 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
}
public void setHunger(int hunger){
player.getFoodStats().setFoodLevel(hunger);
int prevHunger = this.getHunger();
if(hunger < 0)
hunger = 0;
player.getFoodStats().addStats(hunger-prevHunger,0);
}
public float getSaturation(){
@@ -82,7 +86,11 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
}
public void setSaturation(float saturation){
player.getFoodStats().setFoodSaturationLevel(saturation);
float prevSaturation = this.getHunger();
if(saturation < 0)
saturation = 0;
player.getFoodStats().addStats(0,saturation-prevSaturation);
}
public int getDimension(){
@@ -13,4 +13,10 @@ public class CustomNPCsEvent extends Event{
public CustomNPCsEvent() {
}
public void setCancelled(boolean bo){
this.setCanceled(bo);
}
public boolean isCancelled(){return this.isCanceled();}
}
@@ -10,6 +10,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.DamageSource;
import noppes.npcs.controllers.Dialog;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.interfaces.*;
@@ -51,6 +52,10 @@ public class NpcEvent extends CustomNPCsEvent {
this.damage = damage;
this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource);
}
public String getType(){
return damageSource.getMCDamageSource().damageType;
}
}
public static class RangedLaunchedEvent extends NpcEvent {
@@ -58,7 +63,7 @@ public class NpcEvent extends CustomNPCsEvent {
public float damage;
//public List<IProjectile> projectiles = new ArrayList();
public RangedLaunchedEvent(ICustomNpc npc, EntityLivingBase target, float damage) {
public RangedLaunchedEvent(ICustomNpc npc, float damage, EntityLivingBase target) {
super(npc);
this.target = (IEntityLivingBase)NpcAPI.Instance().getIEntity(target);
this.damage = damage;
@@ -70,7 +75,7 @@ public class NpcEvent extends CustomNPCsEvent {
public final IEntityLivingBase target;
public float damage;
public MeleeAttackEvent(ICustomNpc npc, EntityLivingBase target, float damage) {
public MeleeAttackEvent(ICustomNpc npc, float damage, EntityLivingBase target) {
super(npc);
this.target = (IEntityLivingBase)NpcAPI.Instance().getIEntity(target);
this.damage = damage;
@@ -99,6 +104,10 @@ public class NpcEvent extends CustomNPCsEvent {
this.type = damagesource.damageType;
this.source = NpcAPI.Instance().getIEntity(entity);
}
public String getType(){
return damageSource.getMCDamageSource().damageType;
}
}
@Cancelable
@@ -111,6 +120,34 @@ public class NpcEvent extends CustomNPCsEvent {
}
}
public static class DialogEvent extends NpcEvent {
public final IPlayer player;
public final int id;
public final Dialog dialog;
public DialogEvent(ICustomNpc npc, EntityPlayer player, int id, Dialog dialog) {
super(npc);
this.player = (IPlayer)NpcAPI.Instance().getIEntity(player);
this.id = id;
this.dialog = dialog;
}
}
public static class DialogClosedEvent extends NpcEvent {
public final IPlayer player;
public final int id;
public final int optionId;
public final Dialog dialog;
public DialogClosedEvent(ICustomNpc npc, EntityPlayer player, int id, int optionId, Dialog dialog) {
super(npc);
this.player = (IPlayer)NpcAPI.Instance().getIEntity(player);
this.id = id;
this.optionId = optionId;
this.dialog = dialog;
}
}
@Cancelable
public static class TargetLostEvent extends NpcEvent {
public final IEntityLivingBase entity;
@@ -11,4 +11,12 @@ class ScriptEvent{
public boolean isCancelled(){
return isCancelled;
}
public void setCanceled(boolean bo){
isCancelled = bo;
}
public boolean isCanceled(){
return isCancelled;
}
}
@@ -1,7 +1,6 @@
package noppes.npcs.scripted.gui;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.gui.custom.GuiCustom;
import noppes.npcs.scripted.interfaces.ITexturedRect;
public class ScriptGuiTexturedRect extends ScriptGuiComponent implements ITexturedRect {
@@ -34,12 +34,36 @@ public interface IEntity<T extends Entity> {
* @param alpha2 The particle's ending transparency
* @param scaleRate Multiplier for the particle's transparency growth rate
* @param alphaRateStart The time at which the particle begins appearing/fading
*
* @param rotation1 The particle's starting rotation angle with respect to the player's vision
* @param rotation2 The particle's final rotation angle with respect to the player's vision
* @param rotationRate The rate at which the particle rotates with respect to the player's vision
* @param rotationRateStart The time at which the particle begins rotating
* @param rotationX1 The particle's starting rotation angle with respect to the X-axis
* @param rotationX2 The particle's final rotation angle with respect to the X-axis
* @param rotationXRate The rate at which the particle rotates with respect to the X-axis
* @param rotationXRateStart The time at which the particle begins rotating over the X-axis
* @param rotationY1 The particle's starting rotation angle with respect to the Y-axis
* @param rotationY2 The particle's final rotation angle with respect to the Y-axis
* @param rotationYRate The rate at which the particle rotates with respect to the Y-axis
* @param rotationYRateStart The time at which the particle begins rotating over the Y-axis
* @param rotationZ1 The particle's starting rotation angle with respect to the Z-axis
* @param rotationZ2 The particle's final rotation angle with respect to the Z-axis
* @param rotationZRate The rate at which the particle rotates with respect to the Z-axis
* @param rotationZRateStart The time at which the particle begins rotating over the Z-axis
*/
public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
double x, double y, double z,
double motionX, double motionY, double motionZ, float gravity,
float scale1, float scale2, float scaleRate, int scaleRateStart,
float alpha1, float alpha2, float alphaRate, int alphaRateStart
void spawnParticle(String directory, int HEXcolor, int amount, int maxAge,
double x, double y, double z,
double motionX, double motionY, double motionZ, float gravity,
float scale1, float scale2, float scaleRate, int scaleRateStart,
float alpha1, float alpha2, float alphaRate, int alphaRateStart,
float rotation1, float rotation2, float rotationRate, int rotationRateStart,
float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart,
float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart,
float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart
);
public double getYOffset();
@@ -18,5 +18,17 @@ public interface ITimers {
void clear();
int ticks(int id);
void setTicks(int id, int ticks);
int maxTicks(int id);
void setMaxTicks(int id, int maxTicks);
boolean repeats(int id);
void setRepeats(int id, boolean repeat);
int size();
}
@@ -121,7 +121,7 @@ remote.freeze=NPCs einfrieren
spawner.entities=Unternehmen
spawner.clones=Klone
spawner.mobspawner=MobSpawner
spawner.mobspawner=Spawner
spawner.mount=Geritten von...
spawner.mountplayer=Geritten von selbst
@@ -128,7 +128,7 @@ spawner.clones=Clones
spawner.clones2=Clones 2
spawner.clones3=Clones 3
spawner.clones4=Clones 4
spawner.mobspawner=MobSpawner
spawner.mobspawner=Spawner
spawner.mount=Mount by
spawner.mountplayer=Player mounts
@@ -55,7 +55,7 @@ remote.freeze=Geler Pnj
spawner.entities=Entités
spawner.clones=Clones
spawner.mobspawner=MobSpawner
spawner.mobspawner=Spawner
display.model=Modèle
display.show=Montrer
@@ -54,7 +54,7 @@ remote.freeze=NPC-lefagyasztása
spawner.entities=Entitások
spawner.clones=Klónok
spawner.mobspawner=MobSpawner
spawner.mobspawner=Spawner
display.model=Model
display.show=Mutat
Binary file not shown.

After

Width:  |  Height:  |  Size: 700 B