mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-24 21:04:27 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0732d98ff8 | ||
|
|
32f89f8e92 | ||
|
|
65bb3b5939 | ||
|
|
e95eb0ee98 | ||
|
|
ea3669fed8 | ||
|
|
6294062d23 | ||
|
|
5aa5fb335c | ||
|
|
be44db63d3 | ||
|
|
993e7a9d7c | ||
|
|
ebc0b96582 | ||
|
|
6101e75306 | ||
|
|
4abe8dca92 | ||
|
|
8749ba0280 | ||
|
|
6a0af3b0a0 | ||
|
|
f59b5d1e87 | ||
|
|
cddada1984 | ||
|
|
917f0d030a | ||
|
|
3454ecb78a | ||
|
|
57de575d42 | ||
|
|
8ab652361e | ||
|
|
694afb7b6b | ||
|
|
464f5ecb1e | ||
|
|
3066e1dfbc | ||
|
|
286f6862cb | ||
|
|
9a244ca2fe | ||
|
|
33378fba59 | ||
|
|
e26a0a1bd5 | ||
|
|
50fe08ce2e | ||
|
|
18ff2bff78 | ||
|
|
092592bd27 | ||
|
|
769a574210 | ||
|
|
df2e742cbb | ||
|
|
c0bac481ad | ||
|
|
d867017871 | ||
|
|
1752cdd14d | ||
|
|
1e771bce8a | ||
|
|
a507f06d7f | ||
|
|
df5c6afd2e | ||
|
|
dafd5f4460 | ||
|
|
08fb12f716 | ||
|
|
c0fa3935cd | ||
|
|
a10d79da9b | ||
|
|
0226001596 | ||
|
|
60e14f548e | ||
|
|
16321dd4ff | ||
|
|
1cb27a9e7a | ||
|
|
89b7019e29 | ||
|
|
3339488a6f | ||
|
|
1a7267349f | ||
|
|
5578f2055e | ||
|
|
e23620d724 | ||
|
|
3bc9686816 | ||
|
|
805054ceb0 | ||
|
|
75b7c01f87 | ||
|
|
f1741b4660 | ||
|
|
7f8246e04e | ||
|
|
65ab37158f | ||
|
|
d2d3cef681 | ||
|
|
403738262c | ||
|
|
90c6574125 | ||
|
|
7b0a6b7497 | ||
|
|
54fa6d106f | ||
|
|
451a60f297 | ||
|
|
3ac531a49d | ||
|
|
34b6eb05e5 | ||
|
|
4bdbe0efee | ||
|
|
c3bba543f0 | ||
|
|
d4f6df5a81 | ||
|
|
22b622d46c | ||
|
|
ee02988d8c | ||
|
|
450e065e27 | ||
|
|
c2a669fbeb | ||
|
|
732e97e0fe | ||
|
|
33e884c217 | ||
|
|
3d1caf494b | ||
|
|
18e02461a6 | ||
|
|
6bfbffb0e6 | ||
|
|
e42c4cab7e | ||
|
|
47f41ff5b7 | ||
|
|
5a86d1cc6f | ||
|
|
7d647d788f | ||
|
|
01e568d0c7 | ||
|
|
6d6daeb345 | ||
|
|
3844a26e8b | ||
|
|
2a4ace286e | ||
|
|
79ef0e07a1 | ||
|
|
7e0ff3c836 | ||
|
|
e3e55e4256 | ||
|
|
0c4ead5752 | ||
|
|
5d39c5b356 | ||
|
|
19ccdd60d2 | ||
|
|
d3145f4868 | ||
|
|
70536de655 | ||
|
|
1ebf747302 | ||
|
|
632e92f82e | ||
|
|
90ca1a0200 | ||
|
|
9109c134c1 | ||
|
|
1af875aea9 | ||
|
|
7de585843d | ||
|
|
67c83b1ce9 | ||
|
|
bc54e8cd7b | ||
|
|
8675d22ebb | ||
|
|
83e13285f9 | ||
|
|
3be088c4cc | ||
|
|
54fadbe63f | ||
|
|
da3b04e78e | ||
|
|
e7a19264b2 | ||
|
|
966ab4bf72 | ||
|
|
e5e1aa1972 | ||
|
|
be61bd4e17 | ||
|
|
534f716991 | ||
|
|
8b24dad211 | ||
|
|
6974476d92 | ||
|
|
fcaafe4b26 | ||
|
|
f876f13d77 | ||
|
|
989effb5c5 | ||
|
|
f14337f1bb | ||
|
|
eb45a6a959 | ||
|
|
a04f023d53 | ||
|
|
092b3ce0c1 | ||
|
|
971010bda8 | ||
|
|
06c730b166 | ||
|
|
b9bc1e5ed7 | ||
|
|
83756381e4 | ||
|
|
52f342302c | ||
|
|
0788b2750f | ||
|
|
8a9defd3a1 | ||
|
|
dff71c5a98 | ||
|
|
cb72f6c50e | ||
|
|
dd22f604cc | ||
|
|
05e6a97721 | ||
|
|
f8a6fe3d75 | ||
|
|
f9ab885ddd | ||
|
|
e0f77bdcff | ||
|
|
6ff2678f26 | ||
|
|
a1a0864692 | ||
|
|
b3098053ec | ||
|
|
2155566113 | ||
|
|
9d88da30cf | ||
|
|
24e8648a1d | ||
|
|
e1c283a19e | ||
|
|
aba9dd250a | ||
|
|
f508fbed1a | ||
|
|
007660f16f | ||
|
|
e10aa09728 | ||
|
|
4f38edc147 | ||
|
|
6a6548845b | ||
|
|
0aef0827ec | ||
|
|
791adfc1b4 | ||
|
|
2874643c84 | ||
|
|
b0da137db5 | ||
|
|
c28a9156d5 | ||
|
|
4ba6f3086f | ||
|
|
555ceb741f | ||
|
|
04def38b63 | ||
|
|
b024f800ae | ||
|
|
8919a182c5 | ||
|
|
6b9cfb9d25 | ||
|
|
d50f51e208 | ||
|
|
69f96519dc | ||
|
|
7808e4a433 | ||
|
|
d74a1f2bee | ||
|
|
c3541df1dc | ||
|
|
32792e7d6f | ||
|
|
73db2da124 | ||
|
|
6459e7fe2a | ||
|
|
a32db79a0b | ||
|
|
de5f119fd7 | ||
|
|
b330678104 | ||
|
|
e6f97784ff | ||
|
|
e676c808e3 | ||
|
|
e5edbe002e | ||
|
|
ce9b9fb59d | ||
|
|
c8f6a24baf | ||
|
|
2743fa17d8 |
No files matched your search
Binary file not shown.
@@ -1,44 +1,47 @@
|
|||||||
|
|
||||||
|
## 👋 Welcome to the CustomNPC+ Repository.
|
||||||

|

|
||||||
|
|
||||||
Welcome to the CustomNPC+ Repository.
|
> CustomNPC+ is a [Minecraft](https://minecraft.net/) mod that allows you to add custom NPCs to your world. It is developed for creative and storytelling players who want to make their Minecraft worlds more in-depth and unique. CustomNPC+ is only a branch version of the **1.7.10** Forge version of the original (down below) and has no plans to add or update any other version. This is not an official version of CustomNPC.
|
||||||
|
|
||||||
CustomNPC+ is a [Minecraft](https://minecraft.net/) mod that allows you to add custom NPCs to your world. It is developed for creative and storytelling players who want to make their Minecraft worlds more in-depth and unique. CustomNPC+ is only a branch version of the **1.7.10** Forge version of the original (down below) and has no plans to add or update any other version. This is not an official version of CustomNPC.
|
|
||||||
|
|
||||||
Link to CurseForge: [HERE](https://www.curseforge.com/minecraft/mc-mods/customnpc-plus)
|
Link to CurseForge: [HERE](https://www.curseforge.com/minecraft/mc-mods/customnpc-plus)
|
||||||
|
|
||||||
#### Notice
|
### ❗ 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)
|
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.
|
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:
|
### ❓ Features:
|
||||||
- [x] More Wing Types
|
- More Wing Types
|
||||||
- [x] More Fin Types
|
- More Fin Types
|
||||||
- [x] More Capes*
|
- More Capes*
|
||||||
- [x] More Overlays
|
- More Overlays
|
||||||
- [x] Added Horns
|
- Added Horns
|
||||||
- [x] Added Dolphin Tail
|
- Added Dolphin Tail
|
||||||
- [x] Larger Clone GUI
|
- Larger Clone GUI
|
||||||
- [x] More Clone Tabs
|
- More Clone Tabs
|
||||||
- [x] Increased Resolution to Additional Body Parts
|
- Increased Resolution to Additional Body Parts
|
||||||
- [x] ~~Update Local Skin Textures (64x64) [WIP]~~
|
- ~~Update Local Skin Textures (64x64) [WIP]~~
|
||||||
- [x] Added (New) Local 64x64 Skin Textures
|
- Added (New) Local 64x64 Skin Textures
|
||||||
- [x] 1.8 Skins (64x64)
|
- 1.8 Skins (64x64)
|
||||||
- [x] Alex Model (64x64)
|
- Alex Model (64x64)
|
||||||
- [x] Fix Part Rendering
|
- Fix Part Rendering
|
||||||
- [x] Backported GUI Features
|
- Backported GUI Features
|
||||||
- [x] Backported New Part Models
|
- Backported New Part Models
|
||||||
- [X] Custom Part Disabling
|
- Custom Part Disabling
|
||||||
- [X] Markov Name Generator
|
- Markov Name Generator
|
||||||
- [X] Flying NPCS
|
- Flying NPCS
|
||||||
- [X] 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!
|
--- Please Suggest New Features!
|
||||||
|
|
||||||
###### **Majority of these cape designs are taken from the internet with fair-usage.*
|
|
||||||
|
|
||||||
#### Skin Model Feature:
|
## 🔰 Skin Model Feature:
|
||||||
##### Please note all *local* skins in this version of CustomNPC, must match the model selected.
|
###### **Majority of these cape designs are taken from the internet with fair-usage.*
|
||||||
|
##### ❔ Please note all *local* skins in this version of CustomNPC, must match the model selected.
|
||||||
<img src="images/skinAnimation.gif" width="474" height="260"/>
|
<img src="images/skinAnimation.gif" width="474" height="260"/>
|
||||||
|
|
||||||
#### Scale/Puppet Reset:
|
#### Scale/Puppet Reset:
|
||||||
@@ -48,6 +51,12 @@ This mod is an ***update*** to CustomNPC and not an add-on. Do not install Custo
|
|||||||
<img src="images/Url64Example.gif" width="474" height="260"/>
|
<img src="images/Url64Example.gif" width="474" height="260"/>
|
||||||
|
|
||||||
|
|
||||||
#### Want to check out my other mods?
|
## 🔗 Want to check out my other mods?
|
||||||
[Plugin Mod](https://github.com/KAMKEEL/Plugin-Mod) is a mod designed to add more aesthetic items for RPG and storytelling. It is compatible with CustomNPC+ and has many items intended to be used and wielded by created NPCs.
|
[Plugin Mod](https://github.com/KAMKEEL/Plugin-Mod) is a mod designed to add more aesthetic items for RPG and storytelling. It is compatible with CustomNPC+ and has many items intended to be used and wielded by created NPCs.
|
||||||
|
|
||||||
|
[](https://discord.gg/rgeWsmQaKa)
|
||||||
|
[](https://discord.gg/pQqRTvFeJ5)
|
||||||
|
[](https://www.curseforge.com/minecraft/mc-mods/customnpc-plus)
|
||||||
|
[](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.
+33
-1
@@ -17,7 +17,7 @@ buildscript {
|
|||||||
|
|
||||||
apply plugin: 'forge'
|
apply plugin: 'forge'
|
||||||
|
|
||||||
version = "1.4-beta"
|
version = "1.5.3"
|
||||||
group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
archivesBaseName = "CustomNPC-Plus"
|
archivesBaseName = "CustomNPC-Plus"
|
||||||
|
|
||||||
@@ -29,6 +29,21 @@ minecraft {
|
|||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
targetCompatibility = 1.8
|
targetCompatibility = 1.8
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
shade
|
||||||
|
compile.extendsFrom shade
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of all supported OS for zstd compression (This is include only for anyone which is not using the default compression)
|
||||||
|
def supportedOS = [
|
||||||
|
"linux_amd64",
|
||||||
|
"linux_i386",
|
||||||
|
"win_amd64",
|
||||||
|
"win_x86",
|
||||||
|
"darwin_x86_64",
|
||||||
|
"darwin_aarch64"
|
||||||
|
]
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// you may put jars on which you depend on in ./libs
|
// you may put jars on which you depend on in ./libs
|
||||||
// or you may define them like so..
|
// or you may define them like so..
|
||||||
@@ -42,6 +57,11 @@ dependencies {
|
|||||||
// for more info...
|
// for more info...
|
||||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||||
|
// shade 'com.github.luben:zstd-jni:1.5.2-2' - Remove almost implementations of zstd
|
||||||
|
|
||||||
|
for (os in supportedOS) {
|
||||||
|
shade ("com.github.luben:zstd-jni:1.5.2-2:${os}")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,4 +85,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 }}
|
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 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 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -123,6 +123,6 @@ public class CmdDialog extends ChMcLogger {
|
|||||||
option.dialogId = diagid;
|
option.dialogId = diagid;
|
||||||
option.title = dialog.title;
|
option.title = dialog.title;
|
||||||
npc.dialogs.put(0, option);
|
npc.dialogs.put(0, option);
|
||||||
NoppesUtilServer.openDialog(player, npc, dialog);
|
NoppesUtilServer.openDialog(player, npc, dialog, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,10 @@ package foxz.command;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import noppes.npcs.EventHooks;
|
||||||
import noppes.npcs.controllers.Faction;
|
import noppes.npcs.controllers.Faction;
|
||||||
|
import noppes.npcs.controllers.FactionController;
|
||||||
import noppes.npcs.controllers.PlayerData;
|
import noppes.npcs.controllers.PlayerData;
|
||||||
import noppes.npcs.controllers.PlayerFactionData;
|
import noppes.npcs.controllers.PlayerFactionData;
|
||||||
import foxz.commandhelper.ChMcLogger;
|
import foxz.commandhelper.ChMcLogger;
|
||||||
@@ -10,6 +13,8 @@ import foxz.commandhelper.annotations.Command;
|
|||||||
import foxz.commandhelper.annotations.SubCommand;
|
import foxz.commandhelper.annotations.SubCommand;
|
||||||
import foxz.commandhelper.permissions.OpOnly;
|
import foxz.commandhelper.permissions.OpOnly;
|
||||||
import foxz.commandhelper.permissions.ParamCheck;
|
import foxz.commandhelper.permissions.ParamCheck;
|
||||||
|
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||||
|
import noppes.npcs.scripted.event.FactionEvent;
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "faction",
|
name = "faction",
|
||||||
@@ -43,7 +48,7 @@ public class CmdFaction extends ChMcLogger {
|
|||||||
|
|
||||||
for(PlayerData playerdata : data){
|
for(PlayerData playerdata : data){
|
||||||
PlayerFactionData playerfactiondata = playerdata.factionData;
|
PlayerFactionData playerfactiondata = playerdata.factionData;
|
||||||
playerfactiondata.increasePoints(factionid, points);
|
playerfactiondata.increasePoints(factionid, points, playerdata.player);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -64,7 +69,7 @@ public class CmdFaction extends ChMcLogger {
|
|||||||
int factionid = this.selectedFaction.id;
|
int factionid = this.selectedFaction.id;
|
||||||
for(PlayerData playerdata : data){
|
for(PlayerData playerdata : data){
|
||||||
PlayerFactionData playerfactiondata = playerdata.factionData;
|
PlayerFactionData playerfactiondata = playerdata.factionData;
|
||||||
playerfactiondata.increasePoints(factionid, -points);
|
playerfactiondata.increasePoints(factionid, -points, playerdata.player);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,12 +33,11 @@ import foxz.commandhelper.annotations.SubCommand;
|
|||||||
import foxz.commandhelper.permissions.OpOnly;
|
import foxz.commandhelper.permissions.OpOnly;
|
||||||
import foxz.commandhelper.permissions.ParamCheck;
|
import foxz.commandhelper.permissions.ParamCheck;
|
||||||
import foxz.commandhelper.permissions.PlayerOnly;
|
import foxz.commandhelper.permissions.PlayerOnly;
|
||||||
import foxz.utils.Utils;
|
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "noppes",
|
name = "noppes",
|
||||||
desc = "noppes root command",
|
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 {
|
public class CmdNoppes extends ChMcLogger {
|
||||||
|
|
||||||
@@ -89,7 +88,7 @@ public class CmdNoppes extends ChMcLogger {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
cmdfaction.selectedFaction = FactionController.getInstance().getFaction(Integer.parseInt(factionname));
|
cmdfaction.selectedFaction = FactionController.getInstance().get(Integer.parseInt(factionname));
|
||||||
}
|
}
|
||||||
catch(NumberFormatException e){
|
catch(NumberFormatException e){
|
||||||
cmdfaction.selectedFaction = FactionController.getInstance().getFactionFromName(factionname); // get faction data
|
cmdfaction.selectedFaction = FactionController.getInstance().getFactionFromName(factionname); // get faction data
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package 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 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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,32 +4,14 @@ import net.minecraft.client.model.ModelBiped;
|
|||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.inventory.InventoryBasic;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.stats.Achievement;
|
import net.minecraft.stats.Achievement;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.FakePlayer;
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
import noppes.npcs.blocks.tiles.TileNpcContainer;
|
import noppes.npcs.blocks.tiles.TileNpcContainer;
|
||||||
import noppes.npcs.constants.EnumGuiType;
|
import noppes.npcs.constants.EnumGuiType;
|
||||||
import noppes.npcs.containers.ContainerCarpentryBench;
|
import noppes.npcs.containers.*;
|
||||||
import noppes.npcs.containers.ContainerCrate;
|
|
||||||
import noppes.npcs.containers.ContainerMail;
|
|
||||||
import noppes.npcs.containers.ContainerManageBanks;
|
|
||||||
import noppes.npcs.containers.ContainerManageRecipes;
|
|
||||||
import noppes.npcs.containers.ContainerMerchantAdd;
|
|
||||||
import noppes.npcs.containers.ContainerNPCBankLarge;
|
|
||||||
import noppes.npcs.containers.ContainerNPCBankSmall;
|
|
||||||
import noppes.npcs.containers.ContainerNPCBankUnlock;
|
|
||||||
import noppes.npcs.containers.ContainerNPCBankUpgrade;
|
|
||||||
import noppes.npcs.containers.ContainerNPCCompanion;
|
|
||||||
import noppes.npcs.containers.ContainerNPCFollower;
|
|
||||||
import noppes.npcs.containers.ContainerNPCFollowerHire;
|
|
||||||
import noppes.npcs.containers.ContainerNPCFollowerSetup;
|
|
||||||
import noppes.npcs.containers.ContainerNPCInv;
|
|
||||||
import noppes.npcs.containers.ContainerNPCTrader;
|
|
||||||
import noppes.npcs.containers.ContainerNPCTraderSetup;
|
|
||||||
import noppes.npcs.containers.ContainerNpcItemGiver;
|
|
||||||
import noppes.npcs.containers.ContainerNpcQuestReward;
|
|
||||||
import noppes.npcs.containers.ContainerNpcQuestTypeItem;
|
|
||||||
import noppes.npcs.controllers.PlayerData;
|
import noppes.npcs.controllers.PlayerData;
|
||||||
import noppes.npcs.entity.EntityCustomNpc;
|
import noppes.npcs.entity.EntityCustomNpc;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
@@ -59,6 +41,9 @@ public class CommonProxy implements IGuiHandler {
|
|||||||
return getContainer(gui, player, x, y, z, npc);
|
return getContainer(gui, player, x, y, z, npc);
|
||||||
}
|
}
|
||||||
public Container getContainer(EnumGuiType gui,EntityPlayer player, int x, int y, int z,EntityNPCInterface npc){
|
public Container getContainer(EnumGuiType gui,EntityPlayer player, int x, int y, int z,EntityNPCInterface npc){
|
||||||
|
if(gui == EnumGuiType.CustomGui)
|
||||||
|
return new ContainerCustomGui(new InventoryBasic("", false, x));
|
||||||
|
|
||||||
if(gui == EnumGuiType.MainMenuInv)
|
if(gui == EnumGuiType.MainMenuInv)
|
||||||
return new ContainerNPCInv(npc, player);
|
return new ContainerNPCInv(npc, player);
|
||||||
|
|
||||||
|
|||||||
@@ -445,6 +445,9 @@ public class CustomItems {
|
|||||||
Item.getItemFromBlock(sign).setHasSubtypes(true);
|
Item.getItemFromBlock(sign).setHasSubtypes(true);
|
||||||
Item.getItemFromBlock(beam).setHasSubtypes(true);
|
Item.getItemFromBlock(beam).setHasSubtypes(true);
|
||||||
Item.getItemFromBlock(pedestal).setHasSubtypes(true);
|
Item.getItemFromBlock(pedestal).setHasSubtypes(true);
|
||||||
|
|
||||||
|
tabBlocks.item = Item.getItemFromBlock(couchWool);
|
||||||
|
tabBlocks.meta = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
banjo = new ItemMusicBanjo().setUnlocalizedName("npcBanjo").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBanjo");
|
banjo = new ItemMusicBanjo().setUnlocalizedName("npcBanjo").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcBanjo");
|
||||||
@@ -887,8 +890,6 @@ public class CustomItems {
|
|||||||
tabArmor.item = cowarmor;
|
tabArmor.item = cowarmor;
|
||||||
tabWeapon.item = CustomItems.shuriken;
|
tabWeapon.item = CustomItems.shuriken;
|
||||||
tabMisc.item = CustomItems.coinGold;
|
tabMisc.item = CustomItems.coinGold;
|
||||||
tabBlocks.item = Item.getItemFromBlock(couchWool);
|
|
||||||
tabBlocks.meta = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tab.item = wand;
|
tab.item = wand;
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package noppes.npcs;
|
package noppes.npcs;
|
||||||
|
|
||||||
import java.io.File;
|
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import cpw.mods.fml.common.Mod.EventHandler;
|
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.network.NetworkRegistry;
|
||||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||||
import foxz.command.CommandNoppes;
|
import foxz.command.CommandNoppes;
|
||||||
|
import luizotavio.compressor.executor.IOExecutor;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockIce;
|
import net.minecraft.block.BlockIce;
|
||||||
import net.minecraft.block.BlockLeavesBase;
|
import net.minecraft.block.BlockLeavesBase;
|
||||||
@@ -25,56 +24,53 @@ import net.minecraftforge.common.MinecraftForge;
|
|||||||
import nikedemos.markovnames.generators.*;
|
import nikedemos.markovnames.generators.*;
|
||||||
import noppes.npcs.config.ConfigLoader;
|
import noppes.npcs.config.ConfigLoader;
|
||||||
import noppes.npcs.config.ConfigProp;
|
import noppes.npcs.config.ConfigProp;
|
||||||
import noppes.npcs.controllers.BankController;
|
import noppes.npcs.controllers.*;
|
||||||
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.enchants.EnchantInterface;
|
import noppes.npcs.enchants.EnchantInterface;
|
||||||
import noppes.npcs.entity.*;
|
import noppes.npcs.entity.*;
|
||||||
import noppes.npcs.entity.old.EntityNPCDwarfFemale;
|
import noppes.npcs.entity.old.*;
|
||||||
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.scripted.wrapper.WrapperNpcAPI;
|
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.4-beta")
|
@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.5.3")
|
||||||
public class CustomNpcs {
|
public class CustomNpcs {
|
||||||
|
|
||||||
@ConfigProp(info = "Disable Chat Bubbles")
|
@ConfigProp(info = "Disable Chat Bubbles")
|
||||||
public static boolean EnableChatBubbles = true;
|
public static boolean EnableChatBubbles = true;
|
||||||
|
|
||||||
private static int NewEntityStartId = 0;
|
private static int NewEntityStartId = 0;
|
||||||
|
|
||||||
@ConfigProp(info = "Navigation search range for NPCs. Not recommended to increase if you have a slow pc or on a server")
|
@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;
|
public static int NpcNavRange = 32;
|
||||||
|
|
||||||
|
@ConfigProp(info = "Size limit for NPCs. Default 100, larger sizes may cause lag on clients and servers that can't take it!")
|
||||||
|
public static int NpcSizeLimit = 100;
|
||||||
|
|
||||||
@ConfigProp(info = "Set to true if you want the dialog command option to be able to use op commands like tp etc")
|
@ConfigProp(info = "Set to true if you want the dialog command option to be able to use op commands like tp etc")
|
||||||
public static boolean NpcUseOpCommands = false;
|
public static boolean NpcUseOpCommands = false;
|
||||||
|
|
||||||
|
@ConfigProp(info = "The amount of time that passes before a player's quests are checked for completion in seconds.")
|
||||||
|
public static int PlayerQuestCheck = 300;
|
||||||
|
|
||||||
@ConfigProp
|
@ConfigProp
|
||||||
public static boolean InventoryGuiEnabled = true;
|
public static boolean InventoryGuiEnabled = true;
|
||||||
|
|
||||||
@@ -167,6 +163,16 @@ public class CustomNpcs {
|
|||||||
if (NpcNavRange < 16) {
|
if (NpcNavRange < 16) {
|
||||||
NpcNavRange = 16;
|
NpcNavRange = 16;
|
||||||
}
|
}
|
||||||
|
if (NpcNavRange > 96) {
|
||||||
|
NpcNavRange = 96;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(NpcSizeLimit < 1)
|
||||||
|
NpcSizeLimit = 1;
|
||||||
|
|
||||||
|
if(PlayerQuestCheck < 1)
|
||||||
|
PlayerQuestCheck = 1;
|
||||||
|
|
||||||
EnchantInterface.load();
|
EnchantInterface.load();
|
||||||
CustomItems.load();
|
CustomItems.load();
|
||||||
|
|
||||||
@@ -180,7 +186,10 @@ public class CustomNpcs {
|
|||||||
MinecraftForge.EVENT_BUS.register(scriptPlayerEventHandler);
|
MinecraftForge.EVENT_BUS.register(scriptPlayerEventHandler);
|
||||||
FMLCommonHandler.instance().bus().register(scriptPlayerEventHandler);
|
FMLCommonHandler.instance().bus().register(scriptPlayerEventHandler);
|
||||||
|
|
||||||
FMLCommonHandler.instance().bus().register(new ScriptForgeEventHandler().registerForgeEvents());
|
ScriptForgeEventHandler forgeEventHandler = (new ScriptForgeEventHandler()).registerForgeEvents();
|
||||||
|
MinecraftForge.EVENT_BUS.register(forgeEventHandler);
|
||||||
|
FMLCommonHandler.instance().bus().register(forgeEventHandler);
|
||||||
|
|
||||||
FMLCommonHandler.instance().bus().register(new ServerTickHandler());
|
FMLCommonHandler.instance().bus().register(new ServerTickHandler());
|
||||||
|
|
||||||
registerNpc(EntityNPCHumanMale.class, "npchumanmale");
|
registerNpc(EntityNPCHumanMale.class, "npchumanmale");
|
||||||
@@ -208,7 +217,12 @@ public class CustomNpcs {
|
|||||||
registerNpc(EntityNPCGolem.class, "npcGolem");
|
registerNpc(EntityNPCGolem.class, "npcGolem");
|
||||||
registerNpc(EntityCustomNpc.class, "CustomNpc");
|
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(EntityChairMount.class, "CustomNpcChairMount", 64, 10, false);
|
||||||
registerNewEntity(EntityProjectile.class, "throwableitem", 64, 3, true);
|
registerNewEntity(EntityProjectile.class, "throwableitem", 64, 3, true);
|
||||||
@@ -251,6 +265,7 @@ public class CustomNpcs {
|
|||||||
new LinkedNpcController();
|
new LinkedNpcController();
|
||||||
ScriptController.Instance.loadStoredData();
|
ScriptController.Instance.loadStoredData();
|
||||||
ScriptController.Instance.loadForgeScripts();
|
ScriptController.Instance.loadForgeScripts();
|
||||||
|
ScriptController.Instance.loadNPCScripts();
|
||||||
ScriptController.Instance.loadPlayerScripts();
|
ScriptController.Instance.loadPlayerScripts();
|
||||||
ScriptController.HasStart = false;
|
ScriptController.HasStart = false;
|
||||||
WrapperNpcAPI.clearCache();
|
WrapperNpcAPI.clearCache();
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ public class DataAI {
|
|||||||
public int movementType = 0;
|
public int movementType = 0;
|
||||||
public double flySpeed = 1.0D;
|
public double flySpeed = 1.0D;
|
||||||
public double flyGravity = 0.0D;
|
public double flyGravity = 0.0D;
|
||||||
|
public boolean hasFlyLimit = true;
|
||||||
|
public int flyHeightLimit = 2;
|
||||||
|
|
||||||
public EnumAnimation animationType = EnumAnimation.NONE;
|
public EnumAnimation animationType = EnumAnimation.NONE;
|
||||||
public EnumStandingType standingType = EnumStandingType.RotateBody;
|
public EnumStandingType standingType = EnumStandingType.RotateBody;
|
||||||
@@ -110,6 +112,16 @@ public class DataAI {
|
|||||||
else
|
else
|
||||||
flyGravity = compound.getDouble("FlyGravity");
|
flyGravity = compound.getDouble("FlyGravity");
|
||||||
|
|
||||||
|
if(!compound.hasKey("HasFlyLimit"))
|
||||||
|
hasFlyLimit = false;
|
||||||
|
else
|
||||||
|
hasFlyLimit = compound.getBoolean("HasFlyLimit");
|
||||||
|
|
||||||
|
if(!compound.hasKey("FlyHeightLimit"))
|
||||||
|
flyHeightLimit = 5;
|
||||||
|
else
|
||||||
|
flyHeightLimit = compound.getInteger("FlyHeightLimit");
|
||||||
|
|
||||||
startPos = compound.getIntArray("StartPosNew");
|
startPos = compound.getIntArray("StartPosNew");
|
||||||
if (startPos == null || startPos.length != 3){
|
if (startPos == null || startPos.length != 3){
|
||||||
startPos = new int[] {
|
startPos = new int[] {
|
||||||
@@ -159,6 +171,8 @@ public class DataAI {
|
|||||||
compound.setInteger("MovingType", movementType);
|
compound.setInteger("MovingType", movementType);
|
||||||
compound.setDouble("FlySpeed",flySpeed);
|
compound.setDouble("FlySpeed",flySpeed);
|
||||||
compound.setDouble("FlyGravity",flyGravity);
|
compound.setDouble("FlyGravity",flyGravity);
|
||||||
|
compound.setBoolean("HasFlyLimit",hasFlyLimit);
|
||||||
|
compound.setInteger("FlyHeightLimit", flyHeightLimit);
|
||||||
|
|
||||||
npc.setAvoidWater(avoidsWater);
|
npc.setAvoidWater(avoidsWater);
|
||||||
|
|
||||||
|
|||||||
@@ -52,39 +52,11 @@ public class DataDisplay {
|
|||||||
|
|
||||||
public ArrayList<UUID> invisibleToList = new ArrayList<>();
|
public ArrayList<UUID> invisibleToList = new ArrayList<>();
|
||||||
|
|
||||||
|
//0 - Yes, 1 - No, 2 - Only NPCs, 3 - Only Players, 4 - NPCs and Players
|
||||||
|
public int collidesWith = 1;
|
||||||
|
|
||||||
public DataDisplay(EntityNPCInterface npc){
|
public DataDisplay(EntityNPCInterface npc){
|
||||||
this.npc = npc;
|
this.npc = npc;
|
||||||
|
|
||||||
/*
|
|
||||||
Implementing MarkovNames generator. You can blame this blunder on Nikedemos.
|
|
||||||
|
|
||||||
Please refer to nikedemos.markovnames.generators.MarkovCustomNPCsClassic.java
|
|
||||||
|
|
||||||
String[] names = { "Noppes", "Noppes", "Noppes", "Noppes", "Atesson",
|
|
||||||
"Rothcersul", "Achdranys", "Pegato", "Chald", "Gareld",
|
|
||||||
"Nalworche", "Ineald", "Tia'kim", "Torerod", "Turturdar",
|
|
||||||
"Ranler", "Dyntan", "Oldrake", "Gharis", "Elmn", "Tanal",
|
|
||||||
"Waran-ess", "Ach-aldhat", "Athi", "Itageray", "Tasr",
|
|
||||||
"Ightech", "Gakih", "Adkal", "Qua'an", "Sieq", "Urnp", "Rods",
|
|
||||||
"Vorbani", "Smaik", "Fian", "Hir", "Ristai", "Kineth", "Naif",
|
|
||||||
"Issraya", "Arisotura", "Honf", "Rilfom", "Estz", "Ghatroth",
|
|
||||||
"Yosil", "Darage", "Aldny", "Tyltran", "Armos", "Loxiku",
|
|
||||||
"Burhat", "Tinlt", "Ightyd", "Mia",
|
|
||||||
"Ken", "Karla", "Lily", "Carina", "Daniel", "Slater", "Zidane", "Valentine", "Eirina",
|
|
||||||
"Carnow", "Grave", "Shadow", "Drakken", "Kaoz", "Silk", "Drake", "Oldam", "Lynxx", "Lenyx",
|
|
||||||
"Winter", "Seth", "Apolitho", "Amethyst", "Ankin", "Seinkan", "Ayumu", "Sakamoto", "Divina",
|
|
||||||
"Div", "Magia", "Magnus", "Tiakono", "Ruin", "Hailinx", "Ethan", "Wate", "Carter", "William",
|
|
||||||
"Brion", "Sparrow", "Basrrelen", "Gyaku", "Claire", "Crowfeather", "Blackwell", "Raven", "Farcri",
|
|
||||||
"Lucas", "Bangheart", "Kamoku", "Kyoukan", "Blaze", "Benjamin", "Larianne", "Kakaragon",
|
|
||||||
"Melancholy", "Epodyno", "Thanato", "Mika", "Dacks", "Ylander", "Neve", "Meadow", "Cuero",
|
|
||||||
"Embrera", "Eldamore", "Faolan", "Chim", "Nasu", "Kathrine", "Ariel", "Arei", "Demytrix",
|
|
||||||
"Kora", "Ava", "Larson", "Leonardo", "Wyrl", "Sakiama", "Lambton", "Kederath", "Malus", "Riplette",
|
|
||||||
"Andern", "Ezall", "Lucien", "Droco", "Cray", "Tymen", "Zenix", "Entranger",
|
|
||||||
"Saenorath", "Chris", "Christine", "Marble", "Mable", "Ross", "Rose", "Xalgan ", "Kennet", "Kamkeel"
|
|
||||||
};
|
|
||||||
name = names[new Random().nextInt(names.length)];
|
|
||||||
*/
|
|
||||||
|
|
||||||
markovGeneratorId = new Random().nextInt(CustomNpcs.MARKOV_GENERATOR.length-1);
|
markovGeneratorId = new Random().nextInt(CustomNpcs.MARKOV_GENERATOR.length-1);
|
||||||
name = getRandomName();
|
name = getRandomName();
|
||||||
}
|
}
|
||||||
@@ -120,6 +92,8 @@ public class DataDisplay {
|
|||||||
nbttagcompound.setBoolean("NoLivingAnimation", disableLivingAnimation);
|
nbttagcompound.setBoolean("NoLivingAnimation", disableLivingAnimation);
|
||||||
nbttagcompound.setByte("BossBar", showBossBar);
|
nbttagcompound.setByte("BossBar", showBossBar);
|
||||||
|
|
||||||
|
nbttagcompound.setInteger("CollidesWith",collidesWith);
|
||||||
|
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagList list = new NBTTagList();
|
||||||
for(UUID uuid : invisibleToList){
|
for(UUID uuid : invisibleToList){
|
||||||
list.appendTag(new NBTTagString(uuid.toString()));
|
list.appendTag(new NBTTagString(uuid.toString()));
|
||||||
@@ -159,6 +133,9 @@ public class DataDisplay {
|
|||||||
glowTexture = nbttagcompound.getString("GlowTexture");
|
glowTexture = nbttagcompound.getString("GlowTexture");
|
||||||
|
|
||||||
modelSize = ValueUtil.CorrectInt(nbttagcompound.getInteger("Size"), 1, Integer.MAX_VALUE);
|
modelSize = ValueUtil.CorrectInt(nbttagcompound.getInteger("Size"), 1, Integer.MAX_VALUE);
|
||||||
|
if(modelSize > CustomNpcs.NpcSizeLimit)
|
||||||
|
modelSize = CustomNpcs.NpcSizeLimit;
|
||||||
|
|
||||||
modelType = nbttagcompound.getInteger("modelType");
|
modelType = nbttagcompound.getInteger("modelType");
|
||||||
|
|
||||||
showName = nbttagcompound.getInteger("ShowName");
|
showName = nbttagcompound.getInteger("ShowName");
|
||||||
@@ -179,6 +156,11 @@ public class DataDisplay {
|
|||||||
invisibleToList = new ArrayList<>();
|
invisibleToList = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(nbttagcompound.hasKey("CollidesWith"))
|
||||||
|
collidesWith = nbttagcompound.getInteger("CollidesWith");
|
||||||
|
else
|
||||||
|
collidesWith = 1;
|
||||||
|
|
||||||
if(prevSkinType != skinType || !texture.equals(prevTexture))
|
if(prevSkinType != skinType || !texture.equals(prevTexture))
|
||||||
npc.textureLocation = null;
|
npc.textureLocation = null;
|
||||||
npc.textureGlowLocation = null;
|
npc.textureGlowLocation = null;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import noppes.npcs.entity.EntityNPCInterface;
|
|||||||
|
|
||||||
public class DataInventory implements IInventory{
|
public class DataInventory implements IInventory{
|
||||||
public HashMap<Integer,ItemStack> items = new HashMap<Integer,ItemStack>();
|
public HashMap<Integer,ItemStack> items = new HashMap<Integer,ItemStack>();
|
||||||
public HashMap<Integer,Integer> dropchance = new HashMap<Integer,Integer>();
|
public HashMap<Integer,Double> dropchance = new HashMap<Integer,Double>();
|
||||||
public HashMap<Integer, ItemStack> weapons = new HashMap<Integer, ItemStack>();
|
public HashMap<Integer, ItemStack> weapons = new HashMap<Integer, ItemStack>();
|
||||||
public HashMap<Integer, ItemStack> armor = new HashMap<Integer, ItemStack>();
|
public HashMap<Integer, ItemStack> armor = new HashMap<Integer, ItemStack>();
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ public class DataInventory implements IInventory{
|
|||||||
nbttagcompound.setTag("NpcInv", NBTTags.nbtItemStackList(items));
|
nbttagcompound.setTag("NpcInv", NBTTags.nbtItemStackList(items));
|
||||||
nbttagcompound.setTag("Armor", NBTTags.nbtItemStackList(getArmor()));
|
nbttagcompound.setTag("Armor", NBTTags.nbtItemStackList(getArmor()));
|
||||||
nbttagcompound.setTag("Weapons", NBTTags.nbtItemStackList(getWeapons()));
|
nbttagcompound.setTag("Weapons", NBTTags.nbtItemStackList(getWeapons()));
|
||||||
nbttagcompound.setTag("DropChance", NBTTags.nbtIntegerIntegerMap(dropchance));
|
nbttagcompound.setTag("DoubleDropChance", NBTTags.nbtIntegerDoubleMap(dropchance));
|
||||||
nbttagcompound.setInteger("LootMode", lootMode);
|
nbttagcompound.setInteger("LootMode", lootMode);
|
||||||
|
|
||||||
return nbttagcompound;
|
return nbttagcompound;
|
||||||
@@ -49,7 +49,17 @@ public class DataInventory implements IInventory{
|
|||||||
items = NBTTags.getItemStackList(nbttagcompound.getTagList("NpcInv", 10));
|
items = NBTTags.getItemStackList(nbttagcompound.getTagList("NpcInv", 10));
|
||||||
setArmor(NBTTags.getItemStackList(nbttagcompound.getTagList("Armor", 10)));
|
setArmor(NBTTags.getItemStackList(nbttagcompound.getTagList("Armor", 10)));
|
||||||
setWeapons(NBTTags.getItemStackList(nbttagcompound.getTagList("Weapons", 10)));
|
setWeapons(NBTTags.getItemStackList(nbttagcompound.getTagList("Weapons", 10)));
|
||||||
dropchance = NBTTags.getIntegerIntegerMap(nbttagcompound.getTagList("DropChance", 10));
|
|
||||||
|
if(!nbttagcompound.hasKey("DoubleDropChance")) {
|
||||||
|
dropchance.clear();
|
||||||
|
HashMap<Integer, Integer> oldDropChance = NBTTags.getIntegerIntegerMap(nbttagcompound.getTagList("DropChance", 10));
|
||||||
|
for(int i = 0; i < oldDropChance.entrySet().size(); i++){
|
||||||
|
dropchance.put(i, Double.valueOf(oldDropChance.get(i)));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dropchance = NBTTags.getIntegerDoubleMap(nbttagcompound.getTagList("DoubleDropChance", 10));
|
||||||
|
}
|
||||||
|
|
||||||
lootMode = nbttagcompound.getInteger("LootMode");
|
lootMode = nbttagcompound.getInteger("LootMode");
|
||||||
}
|
}
|
||||||
public HashMap<Integer, ItemStack> getWeapons() {
|
public HashMap<Integer, ItemStack> getWeapons() {
|
||||||
@@ -89,10 +99,10 @@ public class DataInventory implements IInventory{
|
|||||||
ItemStack item = items.get(i);
|
ItemStack item = items.get(i);
|
||||||
if(item == null)
|
if(item == null)
|
||||||
continue;
|
continue;
|
||||||
int dchance = 100;
|
double dchance = 100;
|
||||||
if(dropchance.containsKey(i))
|
if(dropchance.containsKey(i))
|
||||||
dchance = dropchance.get(i);
|
dchance = dropchance.get(i);
|
||||||
int chance = npc.worldObj.rand.nextInt(100) + dchance;
|
double chance = Math.random()*100 + dchance;
|
||||||
if(chance >= 100){
|
if(chance >= 100){
|
||||||
EntityItem e = getEntityItem(item.copy());
|
EntityItem e = getEntityItem(item.copy());
|
||||||
if(e != null)
|
if(e != null)
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import noppes.npcs.scripted.ScriptWorld;
|
|||||||
import noppes.npcs.scripted.constants.EntityType;
|
import noppes.npcs.scripted.constants.EntityType;
|
||||||
import noppes.npcs.scripted.constants.JobType;
|
import noppes.npcs.scripted.constants.JobType;
|
||||||
import noppes.npcs.scripted.constants.RoleType;
|
import noppes.npcs.scripted.constants.RoleType;
|
||||||
|
import noppes.npcs.scripted.interfaces.ICustomNpc;
|
||||||
import noppes.npcs.scripted.interfaces.IWorld;
|
import noppes.npcs.scripted.interfaces.IWorld;
|
||||||
import noppes.npcs.scripted.wrapper.WrapperNpcAPI;
|
import noppes.npcs.scripted.wrapper.WrapperNpcAPI;
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ public class DataScript implements IScriptHandler {
|
|||||||
private EntityNPCInterface npc;
|
private EntityNPCInterface npc;
|
||||||
public boolean enabled = false;
|
public boolean enabled = false;
|
||||||
|
|
||||||
public ScriptNpc dummyNpc;
|
public ICustomNpc dummyNpc;
|
||||||
public IWorld dummyWorld;
|
public IWorld dummyWorld;
|
||||||
public boolean clientNeedsUpdate = false;
|
public boolean clientNeedsUpdate = false;
|
||||||
public boolean aiNeedsUpdate = false;
|
public boolean aiNeedsUpdate = false;
|
||||||
@@ -48,8 +49,8 @@ public class DataScript implements IScriptHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.npc = npc;
|
this.npc = npc;
|
||||||
if(npc instanceof EntityCustomNpc)
|
dummyNpc = new ScriptNpc<>(npc);
|
||||||
dummyNpc = new ScriptNpc((EntityCustomNpc) npc);
|
|
||||||
if(npc.worldObj instanceof WorldServer)
|
if(npc.worldObj instanceof WorldServer)
|
||||||
dummyWorld = NpcAPI.Instance().getIWorld((WorldServer) npc.worldObj);//new ScriptWorld((WorldServer) npc.worldObj);
|
dummyWorld = NpcAPI.Instance().getIWorld((WorldServer) npc.worldObj);//new ScriptWorld((WorldServer) npc.worldObj);
|
||||||
}
|
}
|
||||||
@@ -108,6 +109,7 @@ public class DataScript implements IScriptHandler {
|
|||||||
return false;
|
return false;
|
||||||
if(!hasInited){
|
if(!hasInited){
|
||||||
hasInited = true;
|
hasInited = true;
|
||||||
|
EventHooks.onNPCInit(this.npc);
|
||||||
callScript(EnumScriptType.INIT);
|
callScript(EnumScriptType.INIT);
|
||||||
}
|
}
|
||||||
ScriptContainer script = scripts.get(type.ordinal());
|
ScriptContainer script = scripts.get(type.ordinal());
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import net.minecraft.entity.Entity;
|
|||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.item.EntityXPOrb;
|
import net.minecraft.entity.item.EntityXPOrb;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -18,11 +19,13 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
import net.minecraftforge.event.entity.EntityEvent;
|
import net.minecraftforge.event.entity.EntityEvent;
|
||||||
import net.minecraftforge.event.world.WorldEvent;
|
import net.minecraftforge.event.world.WorldEvent;
|
||||||
import noppes.npcs.controllers.ScriptController;
|
import noppes.npcs.controllers.*;
|
||||||
import noppes.npcs.controllers.data.ForgeDataScript;
|
import noppes.npcs.controllers.data.ForgeDataScript;
|
||||||
|
import noppes.npcs.controllers.data.NPCDataScript;
|
||||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
import noppes.npcs.scripted.*;
|
import noppes.npcs.scripted.*;
|
||||||
|
import noppes.npcs.scripted.entity.ScriptNpc;
|
||||||
import noppes.npcs.scripted.entity.ScriptPlayer;
|
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||||
import noppes.npcs.scripted.event.*;
|
import noppes.npcs.scripted.event.*;
|
||||||
import noppes.npcs.scripted.event.PlayerEvent.ChatEvent;
|
import noppes.npcs.scripted.event.PlayerEvent.ChatEvent;
|
||||||
@@ -33,12 +36,12 @@ import noppes.npcs.scripted.event.PlayerEvent.LoginEvent;
|
|||||||
import noppes.npcs.scripted.event.PlayerEvent.LogoutEvent;
|
import noppes.npcs.scripted.event.PlayerEvent.LogoutEvent;
|
||||||
import noppes.npcs.scripted.event.PlayerEvent.PickUpEvent;
|
import noppes.npcs.scripted.event.PlayerEvent.PickUpEvent;
|
||||||
import noppes.npcs.scripted.event.PlayerEvent.DropEvent;
|
import noppes.npcs.scripted.event.PlayerEvent.DropEvent;
|
||||||
|
import noppes.npcs.scripted.interfaces.ICustomGui;
|
||||||
import noppes.npcs.scripted.interfaces.IEntity;
|
import noppes.npcs.scripted.interfaces.IEntity;
|
||||||
import noppes.npcs.scripted.interfaces.IItemStack;
|
import noppes.npcs.scripted.interfaces.IItemStack;
|
||||||
import noppes.npcs.scripted.interfaces.IWorld;
|
import noppes.npcs.scripted.interfaces.IWorld;
|
||||||
import noppes.npcs.scripted.wrapper.WrapperNpcAPI;
|
import noppes.npcs.scripted.wrapper.WrapperNpcAPI;
|
||||||
import noppes.npcs.constants.EnumScriptType;
|
import noppes.npcs.constants.EnumScriptType;
|
||||||
import noppes.npcs.controllers.PlayerData;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -47,10 +50,140 @@ public class EventHooks {
|
|||||||
public 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);
|
||||||
|
npc.script.callScript(EnumScriptType.INIT);
|
||||||
|
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 dialogId, int optionId, Dialog dialog) {
|
||||||
|
if(npc == null || npc.wrappedNPC == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
NpcEvent.DialogEvent event = new NpcEvent.DialogEvent(npc.wrappedNPC, player, dialogId, optionId, dialog);
|
||||||
|
ScriptController.Instance.npcScripts.callScript(EnumScriptType.DIALOG, event);
|
||||||
|
npc.script.callScript(EnumScriptType.DIALOG, "event", new ScriptEventDialog(player,dialogId,optionId,dialog));
|
||||||
|
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, "event", new ScriptEventDialog(player,dialogId,optionId,dialog));
|
||||||
|
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", new ScriptEventAttack(damage,target,false), "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", new ScriptEventAttack(damage,target,true), "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", new ScriptEventTarget(target));
|
||||||
|
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) {
|
public static void onNPCTimer(EntityNPCInterface npc, int id) {
|
||||||
|
if(npc == null || npc.wrappedNPC == null)
|
||||||
|
return;
|
||||||
|
|
||||||
NpcEvent.TimerEvent event = new NpcEvent.TimerEvent(npc.wrappedNPC, id);
|
NpcEvent.TimerEvent event = new NpcEvent.TimerEvent(npc.wrappedNPC, id);
|
||||||
ScriptEventTimer scriptEvent = new ScriptEventTimer(id);
|
ScriptEventTimer scriptEvent = new ScriptEventTimer(id);
|
||||||
npc.script.callScript(EnumScriptType.TIMER, "event", scriptEvent);
|
npc.script.callScript(EnumScriptType.TIMER, "event", scriptEvent);
|
||||||
|
ScriptController.Instance.npcScripts.callScript(EnumScriptType.TIMER, event);
|
||||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,9 +389,9 @@ public class EventHooks {
|
|||||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onPlayerKeyPressed(EntityPlayerMP player, int button, boolean isCtrlPressed, boolean isShiftPressed, boolean isAltPressed, boolean isMetaPressed, boolean buttonDown) {
|
public static void onPlayerKeyPressed(EntityPlayerMP player, int button, boolean isCtrlPressed, boolean isShiftPressed, boolean isAltPressed, boolean isMetaPressed, boolean buttonDown, int[] heldKeys) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
KeyPressedEvent event = new KeyPressedEvent((ScriptPlayer)ScriptController.Instance.getScriptForEntity(player), button, isCtrlPressed, isAltPressed, isShiftPressed, isMetaPressed, buttonDown);
|
KeyPressedEvent event = new KeyPressedEvent((ScriptPlayer)ScriptController.Instance.getScriptForEntity(player), button, isCtrlPressed, isAltPressed, isShiftPressed, isMetaPressed, buttonDown, heldKeys);
|
||||||
handler.callScript(EnumScriptType.KEY_PRESSED, event);
|
handler.callScript(EnumScriptType.KEY_PRESSED, event);
|
||||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||||
}
|
}
|
||||||
@@ -311,4 +444,73 @@ public class EventHooks {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void onCustomGuiButton(ScriptPlayer player, ICustomGui gui, int buttonId) {
|
||||||
|
CustomGuiEvent.ButtonEvent event = new CustomGuiEvent.ButtonEvent(player, gui, buttonId);
|
||||||
|
CustomGuiController.onButton(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onCustomGuiSlot(ScriptPlayer player, ICustomGui gui, int slotId) {
|
||||||
|
CustomGuiEvent.SlotEvent event = new CustomGuiEvent.SlotEvent(player, gui, slotId, player.getOpenContainer().getSlot(slotId));
|
||||||
|
CustomGuiController.onSlotChange(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onCustomGuiUnfocused(ScriptPlayer player, ICustomGui gui, int textfieldId) {
|
||||||
|
CustomGuiEvent.UnfocusedEvent event = new CustomGuiEvent.UnfocusedEvent(player, gui, textfieldId);
|
||||||
|
CustomGuiController.onCustomGuiUnfocused(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onCustomGuiScrollClick(ScriptPlayer player, ICustomGui gui, int scrollId, int scrollIndex, String[] selection, boolean doubleClick) {
|
||||||
|
CustomGuiEvent.ScrollEvent event = new CustomGuiEvent.ScrollEvent(player, gui, scrollId, scrollIndex, selection, doubleClick);
|
||||||
|
CustomGuiController.onScrollClick(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onCustomGuiClose(ScriptPlayer player, ICustomGui gui) {
|
||||||
|
noppes.npcs.scripted.event.CustomGuiEvent.CloseEvent event = new noppes.npcs.scripted.event.CustomGuiEvent.CloseEvent(player, gui);
|
||||||
|
CustomGuiController.onClose(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onQuestFinished(EntityPlayer player, Quest quest){
|
||||||
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
|
QuestEvent.QuestCompletedEvent event = new QuestEvent.QuestCompletedEvent(new ScriptPlayer((EntityPlayerMP) player), quest);
|
||||||
|
handler.callScript(EnumScriptType.QUEST_COMPLETED, event);
|
||||||
|
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean onQuestStarted(EntityPlayer player, Quest quest){
|
||||||
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
|
QuestEvent.QuestStartEvent event = new QuestEvent.QuestStartEvent(new ScriptPlayer((EntityPlayerMP) player), quest);
|
||||||
|
handler.callScript(EnumScriptType.QUEST_START, event);
|
||||||
|
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onQuestTurnedIn(QuestEvent.QuestTurnedInEvent event){
|
||||||
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
|
handler.callScript(EnumScriptType.QUEST_TURNIN, event);
|
||||||
|
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onFactionPoints(FactionEvent.FactionPoints event){
|
||||||
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
|
handler.callScript(EnumScriptType.FACTION_POINTS, event);
|
||||||
|
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onDialogOpen(DialogEvent.DialogOpen event){
|
||||||
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
|
handler.callScript(EnumScriptType.DIALOG_OPEN, event);
|
||||||
|
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onDialogOption(DialogEvent.DialogOption event){
|
||||||
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
|
handler.callScript(EnumScriptType.DIALOG_OPTION, event);
|
||||||
|
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onDialogClosed(DialogEvent.DialogClosed event){
|
||||||
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
|
handler.callScript(EnumScriptType.DIALOG_CLOSE, event);
|
||||||
|
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -34,6 +34,10 @@ public class ModelDataShared{
|
|||||||
public byte armwear = 0;
|
public byte armwear = 0;
|
||||||
public byte legwear = 0;
|
public byte legwear = 0;
|
||||||
|
|
||||||
|
// Solid or normal arm/legwear [0: None, 1: Both, 2: Right, 3: Left]
|
||||||
|
public byte solidArmwear = 0;
|
||||||
|
public byte solidLegwear = 0;
|
||||||
|
|
||||||
// Hide Body Parts [0: None, 1: Both, 2: Right, 3: Left],
|
// Hide Body Parts [0: None, 1: Both, 2: Right, 3: Left],
|
||||||
public byte hideHead = 0;
|
public byte hideHead = 0;
|
||||||
public byte hideBody = 0;
|
public byte hideBody = 0;
|
||||||
@@ -58,6 +62,9 @@ public class ModelDataShared{
|
|||||||
compound.setByte("Armwear", armwear);
|
compound.setByte("Armwear", armwear);
|
||||||
compound.setByte("Legwear", legwear);
|
compound.setByte("Legwear", legwear);
|
||||||
|
|
||||||
|
compound.setByte("SolidArmwear", solidArmwear);
|
||||||
|
compound.setByte("SolidLegwear", solidLegwear);
|
||||||
|
|
||||||
compound.setByte("hideHead", hideHead);
|
compound.setByte("hideHead", hideHead);
|
||||||
compound.setByte("hideBody", hideBody);
|
compound.setByte("hideBody", hideBody);
|
||||||
compound.setByte("hideArms", hideArms);
|
compound.setByte("hideArms", hideArms);
|
||||||
@@ -92,6 +99,9 @@ public class ModelDataShared{
|
|||||||
armwear = compound.getByte("Armwear");
|
armwear = compound.getByte("Armwear");
|
||||||
legwear = compound.getByte("Legwear");
|
legwear = compound.getByte("Legwear");
|
||||||
|
|
||||||
|
solidArmwear = compound.getByte("SolidArmwear");
|
||||||
|
solidLegwear = compound.getByte("SolidLegwear");
|
||||||
|
|
||||||
hideHead = compound.getByte("hideHead");
|
hideHead = compound.getByte("hideHead");
|
||||||
hideBody = compound.getByte("hideBody");
|
hideBody = compound.getByte("hideBody");
|
||||||
hideArms = compound.getByte("hideArms");
|
hideArms = compound.getByte("hideArms");
|
||||||
|
|||||||
@@ -24,8 +24,9 @@ public class ModelPartData {
|
|||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
compound.setByte("Type", type);
|
compound.setByte("Type", type);
|
||||||
compound.setInteger("Color", color);
|
compound.setInteger("Color", color);
|
||||||
if(texture != null && !texture.isEmpty())
|
if(texture != null && !texture.isEmpty()) {
|
||||||
compound.setString("Texture", texture);
|
compound.setString("Texture", texture);
|
||||||
|
}
|
||||||
compound.setBoolean("PlayerTexture", playerTexture);
|
compound.setBoolean("PlayerTexture", playerTexture);
|
||||||
return compound;
|
return compound;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,17 @@ public class NBTTags {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HashMap<Integer, Double> getIntegerDoubleMap(
|
||||||
|
NBTTagList tagList) {
|
||||||
|
HashMap<Integer, Double> list = new HashMap<Integer, Double>();
|
||||||
|
for(int i = 0; i < tagList.tagCount(); i++)
|
||||||
|
{
|
||||||
|
NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i);
|
||||||
|
list.put(nbttagcompound.getInteger("Slot"), nbttagcompound.getDouble("Double"));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
public static HashMap<Integer, Long> getIntegerLongMap(
|
public static HashMap<Integer, Long> getIntegerLongMap(
|
||||||
NBTTagList tagList) {
|
NBTTagList tagList) {
|
||||||
HashMap<Integer, Long> list = new HashMap<Integer, Long>();
|
HashMap<Integer, Long> list = new HashMap<Integer, Long>();
|
||||||
@@ -239,6 +250,19 @@ public class NBTTags {
|
|||||||
return nbttaglist;
|
return nbttaglist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static NBTTagList nbtIntegerDoubleMap(HashMap<Integer, Double> lines) {
|
||||||
|
NBTTagList nbttaglist = new NBTTagList();
|
||||||
|
if(lines == null)
|
||||||
|
return nbttaglist;
|
||||||
|
for (int slot : lines.keySet()) {
|
||||||
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
|
nbttagcompound.setInteger("Slot", slot);
|
||||||
|
nbttagcompound.setDouble("Double", lines.get(slot));
|
||||||
|
nbttaglist.appendTag(nbttagcompound);
|
||||||
|
}
|
||||||
|
return nbttaglist;
|
||||||
|
}
|
||||||
|
|
||||||
public static NBTTagList nbtIntegerLongMap(HashMap<Integer, Long> lines) {
|
public static NBTTagList nbtIntegerLongMap(HashMap<Integer, Long> lines) {
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagList nbttaglist = new NBTTagList();
|
||||||
if(lines == null)
|
if(lines == null)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import io.netty.buffer.Unpooled;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -25,24 +26,15 @@ import noppes.npcs.constants.EnumScriptType;
|
|||||||
import noppes.npcs.containers.ContainerNPCBankInterface;
|
import noppes.npcs.containers.ContainerNPCBankInterface;
|
||||||
import noppes.npcs.containers.ContainerNPCFollower;
|
import noppes.npcs.containers.ContainerNPCFollower;
|
||||||
import noppes.npcs.containers.ContainerNPCFollowerHire;
|
import noppes.npcs.containers.ContainerNPCFollowerHire;
|
||||||
import noppes.npcs.controllers.Bank;
|
import noppes.npcs.controllers.*;
|
||||||
import noppes.npcs.controllers.BankController;
|
|
||||||
import noppes.npcs.controllers.BankData;
|
|
||||||
import noppes.npcs.controllers.Dialog;
|
|
||||||
import noppes.npcs.controllers.DialogController;
|
|
||||||
import noppes.npcs.controllers.DialogOption;
|
|
||||||
import noppes.npcs.controllers.Line;
|
|
||||||
import noppes.npcs.controllers.PlayerBankData;
|
|
||||||
import noppes.npcs.controllers.PlayerDataController;
|
|
||||||
import noppes.npcs.controllers.PlayerQuestController;
|
|
||||||
import noppes.npcs.controllers.PlayerQuestData;
|
|
||||||
import noppes.npcs.controllers.PlayerTransportData;
|
|
||||||
import noppes.npcs.controllers.QuestData;
|
|
||||||
import noppes.npcs.controllers.TransportController;
|
|
||||||
import noppes.npcs.controllers.TransportLocation;
|
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
import noppes.npcs.roles.RoleFollower;
|
import noppes.npcs.roles.RoleFollower;
|
||||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||||
|
import noppes.npcs.scripted.NpcAPI;
|
||||||
|
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||||
|
import noppes.npcs.scripted.event.DialogEvent;
|
||||||
|
import noppes.npcs.scripted.event.QuestEvent;
|
||||||
|
import noppes.npcs.scripted.interfaces.IItemStack;
|
||||||
|
|
||||||
public class NoppesUtilPlayer {
|
public class NoppesUtilPlayer {
|
||||||
|
|
||||||
@@ -259,13 +251,19 @@ public class NoppesUtilPlayer {
|
|||||||
Dialog dialog = DialogController.instance.dialogs.get(dialogId);
|
Dialog dialog = DialogController.instance.dialogs.get(dialogId);
|
||||||
if(dialog == null)
|
if(dialog == null)
|
||||||
return;
|
return;
|
||||||
npc.script.callScript(EnumScriptType.DIALOG_OPTION, "player", player, "dialog", dialogId, "option", optionId + 1);
|
|
||||||
|
|
||||||
if(!dialog.hasDialogs(player) && !dialog.hasOtherOptions())
|
EventHooks.onDialogOption(new DialogEvent.DialogOption(new ScriptPlayer((EntityPlayerMP) player), dialog));
|
||||||
|
EventHooks.onNPCDialogClosed(npc,player,dialogId,optionId+1,dialog);
|
||||||
|
|
||||||
|
if(!dialog.hasDialogs(player) && !dialog.hasOtherOptions()) {
|
||||||
|
EventHooks.onDialogClosed(new DialogEvent.DialogClosed(new ScriptPlayer((EntityPlayerMP) player), dialog));
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
DialogOption option = dialog.options.get(optionId);
|
DialogOption option = dialog.options.get(optionId);
|
||||||
if(option == null || option.optionType == EnumOptionType.DialogOption && (!option.isAvailable(player) || !option.hasDialog()) || option.optionType == EnumOptionType.Disabled || option.optionType == EnumOptionType.QuitOption)
|
if(option == null || option.optionType == EnumOptionType.DialogOption && (!option.isAvailable(player) || !option.hasDialog()) || option.optionType == EnumOptionType.Disabled || option.optionType == EnumOptionType.QuitOption) {
|
||||||
return;
|
EventHooks.onDialogClosed(new DialogEvent.DialogClosed(new ScriptPlayer((EntityPlayerMP) player), dialog));
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(option.optionType == EnumOptionType.RoleOption){
|
if(option.optionType == EnumOptionType.RoleOption){
|
||||||
if(npc.roleInterface != null)
|
if(npc.roleInterface != null)
|
||||||
npc.roleInterface.interact(player);
|
npc.roleInterface.interact(player);
|
||||||
@@ -273,7 +271,7 @@ public class NoppesUtilPlayer {
|
|||||||
Server.sendData(player, EnumPacketClient.GUI_CLOSE);
|
Server.sendData(player, EnumPacketClient.GUI_CLOSE);
|
||||||
}
|
}
|
||||||
else if(option.optionType == EnumOptionType.DialogOption){
|
else if(option.optionType == EnumOptionType.DialogOption){
|
||||||
NoppesUtilServer.openDialog(player, npc, option.getDialog());
|
NoppesUtilServer.openDialog(player, npc, option.getDialog(), optionId+1);
|
||||||
}
|
}
|
||||||
else if(option.optionType == EnumOptionType.CommandBlock){
|
else if(option.optionType == EnumOptionType.CommandBlock){
|
||||||
Server.sendData(player, EnumPacketClient.GUI_CLOSE);
|
Server.sendData(player, EnumPacketClient.GUI_CLOSE);
|
||||||
@@ -291,43 +289,61 @@ public class NoppesUtilPlayer {
|
|||||||
Server.sendData(player, EnumPacketClient.GUI_DATA, data.writeNBT());
|
Server.sendData(player, EnumPacketClient.GUI_DATA, data.writeNBT());
|
||||||
}
|
}
|
||||||
public static void questCompletion(EntityPlayerMP player, int questId) {
|
public static void questCompletion(EntityPlayerMP player, int questId) {
|
||||||
PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData;
|
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||||
QuestData data = playerdata.activeQuests.get(questId);
|
PlayerQuestData questData = playerData.questData;
|
||||||
|
QuestData data = questData.activeQuests.get(questId);
|
||||||
|
|
||||||
if(data == null)
|
if(data == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!data.quest.questInterface.isCompleted(player))
|
if(!data.quest.questInterface.isCompleted(playerData))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
QuestEvent.QuestTurnedInEvent event = new QuestEvent.QuestTurnedInEvent(new ScriptPlayer(player), data.quest);
|
||||||
|
event.expReward = data.quest.rewardExp;
|
||||||
|
|
||||||
|
List<IItemStack> list = new ArrayList();
|
||||||
|
Iterator var8 = data.quest.rewardItems.items.values().iterator();
|
||||||
|
|
||||||
|
while(var8.hasNext()) {
|
||||||
|
ItemStack item = (ItemStack)var8.next();
|
||||||
|
if (item.stackSize > 0) {
|
||||||
|
list.add(NpcAPI.Instance().getIItemStack(item));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data.quest.randomReward) {
|
||||||
|
event.itemRewards = (IItemStack[])list.toArray(new IItemStack[list.size()]);
|
||||||
|
} else if (!list.isEmpty()) {
|
||||||
|
event.itemRewards = new IItemStack[]{(IItemStack)list.get(player.getRNG().nextInt(list.size()))};
|
||||||
|
}
|
||||||
|
|
||||||
|
EventHooks.onQuestTurnedIn(event);
|
||||||
|
IItemStack[] var12 = event.itemRewards;
|
||||||
|
int var14 = var12.length;
|
||||||
|
|
||||||
|
for(int var10 = 0; var10 < var14; ++var10) {
|
||||||
|
IItemStack item = var12[var10];
|
||||||
|
if (item != null) {
|
||||||
|
NoppesUtilServer.GivePlayerItem(player, player, item.getMCItemStack());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data.quest.questInterface.handleComplete(player);
|
data.quest.questInterface.handleComplete(player);
|
||||||
if(data.quest.rewardExp > 0){
|
if(data.quest.rewardExp > 0){
|
||||||
player.worldObj.playSoundAtEntity(player, "random.orb", 0.1F, 0.5F * ((player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.7F + 1.8F));
|
player.worldObj.playSoundAtEntity(player, "random.orb", 0.1F, 0.5F * ((player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.7F + 1.8F));
|
||||||
|
|
||||||
player.addExperience(data.quest.rewardExp);
|
player.addExperience(data.quest.rewardExp);
|
||||||
}
|
}
|
||||||
data.quest.factionOptions.addPoints(player);
|
data.quest.factionOptions.addPoints(player);
|
||||||
if(data.quest.mail.isValid()){
|
if(data.quest.mail.isValid()){
|
||||||
PlayerDataController.instance.addPlayerMessage(player.getCommandSenderName(), data.quest.mail);
|
PlayerDataController.instance.addPlayerMessage(player.getCommandSenderName(), data.quest.mail);
|
||||||
}
|
}
|
||||||
if(!data.quest.randomReward){
|
|
||||||
for(ItemStack item : data.quest.rewardItems.items.values()){
|
|
||||||
NoppesUtilServer.GivePlayerItem(player, player, item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
List<ItemStack> list = new ArrayList<ItemStack>();
|
|
||||||
for(ItemStack item : data.quest.rewardItems.items.values()){
|
|
||||||
if(item != null && item.getItem() != null)
|
|
||||||
list.add(item);
|
|
||||||
}
|
|
||||||
if(!list.isEmpty()){
|
|
||||||
NoppesUtilServer.GivePlayerItem(player, player, list.get(player.getRNG().nextInt(list.size())));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!data.quest.command.isEmpty()){
|
if(!data.quest.command.isEmpty()){
|
||||||
NoppesUtilServer.runCommand(player, "QuestCompletion", data.quest.command);
|
NoppesUtilServer.runCommand(player, "QuestCompletion", data.quest.command);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerQuestController.setQuestFinished(data.quest, player);
|
PlayerQuestController.setQuestFinished(data.quest, player);
|
||||||
if(data.quest.hasNewQuest()) PlayerQuestController.addActiveQuest(data.quest.getNextQuest(), player);
|
if(data.quest.hasNewQuest()) PlayerQuestController.addActiveQuest(data.quest.getNextQuest(), player);
|
||||||
}
|
}
|
||||||
@@ -400,4 +416,31 @@ public class NoppesUtilPlayer {
|
|||||||
public static void isGUIOpen(EntityPlayerMP player){
|
public static void isGUIOpen(EntityPlayerMP player){
|
||||||
Server.sendData(player, EnumPacketClient.ISGUIOPEN);
|
Server.sendData(player, EnumPacketClient.ISGUIOPEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<ItemStack> countStacks(IInventory inv, boolean ignoreDamage, boolean ignoreNBT) {
|
||||||
|
List<ItemStack> list = new ArrayList();
|
||||||
|
|
||||||
|
for(int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||||
|
ItemStack item = inv.getStackInSlot(i);
|
||||||
|
if (!NoppesUtilServer.IsItemStackNull(item)) {
|
||||||
|
boolean found = false;
|
||||||
|
Iterator var7 = list.iterator();
|
||||||
|
|
||||||
|
while(var7.hasNext()) {
|
||||||
|
ItemStack is = (ItemStack)var7.next();
|
||||||
|
if (compareItems(item, is, ignoreDamage, ignoreNBT)) {
|
||||||
|
is.stackSize = is.stackSize + item.stackSize;
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found) {
|
||||||
|
list.add(item.copy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -72,6 +72,8 @@ import noppes.npcs.controllers.TransportLocation;
|
|||||||
import noppes.npcs.entity.EntityDialogNpc;
|
import noppes.npcs.entity.EntityDialogNpc;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
import noppes.npcs.roles.RoleTransporter;
|
import noppes.npcs.roles.RoleTransporter;
|
||||||
|
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||||
|
import noppes.npcs.scripted.event.DialogEvent;
|
||||||
import noppes.npcs.scripted.event.ScriptEventDialog;
|
import noppes.npcs.scripted.event.ScriptEventDialog;
|
||||||
|
|
||||||
public class NoppesUtilServer {
|
public class NoppesUtilServer {
|
||||||
@@ -178,8 +180,11 @@ public class NoppesUtilServer {
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openDialog(EntityPlayer player, EntityNPCInterface npc, Dialog dia){
|
public static void openDialog(EntityPlayer player, EntityNPCInterface npc, Dialog dia, int optionId){
|
||||||
Dialog dialog = dia.copy(player);
|
Dialog dialog = dia.copy(player);
|
||||||
|
|
||||||
|
EventHooks.onDialogOpen(new DialogEvent.DialogOpen(new ScriptPlayer((EntityPlayerMP) player), dialog));
|
||||||
|
|
||||||
if(npc instanceof EntityDialogNpc){
|
if(npc instanceof EntityDialogNpc){
|
||||||
dialog.hideNPC = true;
|
dialog.hideNPC = true;
|
||||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.DIALOG_DUMMY, npc.getCommandSenderName(), dialog.writeToNBT(new NBTTagCompound()));
|
Server.sendData((EntityPlayerMP)player, EnumPacketClient.DIALOG_DUMMY, npc.getCommandSenderName(), dialog.writeToNBT(new NBTTagCompound()));
|
||||||
@@ -198,7 +203,7 @@ public class NoppesUtilServer {
|
|||||||
if(!data.dialogsRead.contains(dialog.id))
|
if(!data.dialogsRead.contains(dialog.id))
|
||||||
data.dialogsRead.add(dialog.id);
|
data.dialogsRead.add(dialog.id);
|
||||||
setEditingNpc(player, npc);
|
setEditingNpc(player, npc);
|
||||||
npc.script.callScript(EnumScriptType.DIALOG, "event", new ScriptEventDialog(), "player", player, "dialog", dialog.id);
|
EventHooks.onNPCDialog(npc, player, dialog.id, optionId, dialog);
|
||||||
}
|
}
|
||||||
public static void runCommand(EntityPlayer player, String name, String command){
|
public static void runCommand(EntityPlayer player, String name, String command){
|
||||||
runCommand(player, name, command, player);
|
runCommand(player, name, command, player);
|
||||||
@@ -307,19 +312,25 @@ public class NoppesUtilServer {
|
|||||||
Server.sendAssociatedData(entity, EnumPacketClient.PARTICLE, entity.posX, entity.posY, entity.posZ, entity.height, entity.width, entity.yOffset, particle);
|
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 x, double y, double z,
|
||||||
double motionX, double motionY, double motionZ, float gravity,
|
double motionX, double motionY, double motionZ, float gravity,
|
||||||
float scale1, float scale2, float scaleRate, int scaleRateStart,
|
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 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
|
int entityID
|
||||||
){
|
){
|
||||||
Server.sendAssociatedData(entity, EnumPacketClient.SCRIPTED_PARTICLE,
|
Server.sendToAll(EnumPacketClient.SCRIPTED_PARTICLE,
|
||||||
directory, HEXcolor, amount, maxAge,
|
directory, HEXcolor, amount, maxAge,
|
||||||
x, y, z,
|
x, y, z,
|
||||||
motionX, motionY, motionZ, gravity,
|
motionX, motionY, motionZ, gravity,
|
||||||
scale1, scale2, scaleRate, scaleRateStart,
|
scale1, scale2, scaleRate, scaleRateStart,
|
||||||
alpha1, alpha2, alphaRate, alphaRateStart,
|
alpha1, alpha2, alphaRate, alphaRateStart,
|
||||||
|
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
|
||||||
|
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
|
||||||
|
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
|
||||||
entityID
|
entityID
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -711,4 +722,8 @@ public class NoppesUtilServer {
|
|||||||
boolean isGUIOpen = buffer.readBoolean();
|
boolean isGUIOpen = buffer.readBoolean();
|
||||||
playerdata.setGUIOpen(isGUIOpen);
|
playerdata.setGUIOpen(isGUIOpen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean IsItemStackNull(ItemStack is) {
|
||||||
|
return is == null || is.stackSize == 0 || is.getItem() == null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,8 @@ package noppes.npcs;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
@@ -16,11 +18,7 @@ import net.minecraft.network.NetHandlerPlayServer;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import noppes.npcs.blocks.tiles.TileBigSign;
|
import noppes.npcs.blocks.tiles.TileBigSign;
|
||||||
import noppes.npcs.blocks.tiles.TileBook;
|
import noppes.npcs.blocks.tiles.TileBook;
|
||||||
import noppes.npcs.constants.EnumCompanionTalent;
|
import noppes.npcs.constants.*;
|
||||||
import noppes.npcs.constants.EnumGuiType;
|
|
||||||
import noppes.npcs.constants.EnumPacketClient;
|
|
||||||
import noppes.npcs.constants.EnumPlayerPacket;
|
|
||||||
import noppes.npcs.constants.EnumRoleType;
|
|
||||||
import noppes.npcs.containers.ContainerMail;
|
import noppes.npcs.containers.ContainerMail;
|
||||||
import noppes.npcs.controllers.*;
|
import noppes.npcs.controllers.*;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
@@ -66,7 +64,31 @@ public class PacketHandlerPlayer{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EventHooks.onPlayerKeyPressed(player, buffer.readInt(), buffer.readBoolean(), buffer.readBoolean(), buffer.readBoolean(), buffer.readBoolean(), buffer.readBoolean());
|
int button = buffer.readInt();
|
||||||
|
boolean isCtrlPressed = buffer.readBoolean();
|
||||||
|
boolean isShiftPressed = buffer.readBoolean();
|
||||||
|
boolean isAltPressed = buffer.readBoolean();
|
||||||
|
boolean isMetaPressed = buffer.readBoolean();
|
||||||
|
boolean buttonDown = buffer.readBoolean();
|
||||||
|
|
||||||
|
String ints = Server.readString(buffer);
|
||||||
|
String[] split = ints.split(",");
|
||||||
|
int[] keysDown;
|
||||||
|
|
||||||
|
if(ints.length() > 0) {
|
||||||
|
keysDown = new int[split.length];
|
||||||
|
try {
|
||||||
|
for (int i = 0; i < split.length; i++) {
|
||||||
|
keysDown[i] = Integer.parseInt(split[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (NumberFormatException ignored){
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
keysDown = new int[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
EventHooks.onPlayerKeyPressed(player, button, isCtrlPressed, isShiftPressed, isAltPressed, isMetaPressed, buttonDown, keysDown);
|
||||||
}
|
}
|
||||||
else if(type == EnumPlayerPacket.MouseClicked) {
|
else if(type == EnumPlayerPacket.MouseClicked) {
|
||||||
if(ScriptController.Instance.languages.isEmpty()) {
|
if(ScriptController.Instance.languages.isEmpty()) {
|
||||||
@@ -135,8 +157,9 @@ public class PacketHandlerPlayer{
|
|||||||
NoppesUtilPlayer.dialogSelected(buffer.readInt(), buffer.readInt(), player, npc);
|
NoppesUtilPlayer.dialogSelected(buffer.readInt(), buffer.readInt(), player, npc);
|
||||||
}
|
}
|
||||||
else if(type == EnumPlayerPacket.CheckQuestCompletion){
|
else if(type == EnumPlayerPacket.CheckQuestCompletion){
|
||||||
PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData;
|
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||||
playerdata.checkQuestCompletion(player, null);
|
PlayerQuestData questData = PlayerDataController.instance.getPlayerData(player).questData;
|
||||||
|
questData.checkQuestCompletion(playerData, null);
|
||||||
}
|
}
|
||||||
else if(type == EnumPlayerPacket.QuestLog){
|
else if(type == EnumPlayerPacket.QuestLog){
|
||||||
NoppesUtilPlayer.sendQuestLogData(player);
|
NoppesUtilPlayer.sendQuestLogData(player);
|
||||||
|
|||||||
@@ -36,32 +36,12 @@ import noppes.npcs.constants.EnumPacketClient;
|
|||||||
import noppes.npcs.constants.EnumPacketServer;
|
import noppes.npcs.constants.EnumPacketServer;
|
||||||
import noppes.npcs.constants.EnumPlayerData;
|
import noppes.npcs.constants.EnumPlayerData;
|
||||||
import noppes.npcs.constants.EnumRoleType;
|
import noppes.npcs.constants.EnumRoleType;
|
||||||
|
import noppes.npcs.containers.ContainerCustomGui;
|
||||||
import noppes.npcs.containers.ContainerMail;
|
import noppes.npcs.containers.ContainerMail;
|
||||||
import noppes.npcs.controllers.Bank;
|
import noppes.npcs.controllers.*;
|
||||||
import noppes.npcs.controllers.BankController;
|
|
||||||
import noppes.npcs.controllers.Dialog;
|
|
||||||
import noppes.npcs.controllers.DialogCategory;
|
|
||||||
import noppes.npcs.controllers.DialogController;
|
|
||||||
import noppes.npcs.controllers.DialogOption;
|
|
||||||
import noppes.npcs.controllers.Faction;
|
|
||||||
import noppes.npcs.controllers.FactionController;
|
|
||||||
import noppes.npcs.controllers.LinkedNpcController;
|
|
||||||
import noppes.npcs.controllers.LinkedNpcController.LinkedData;
|
import noppes.npcs.controllers.LinkedNpcController.LinkedData;
|
||||||
import noppes.npcs.controllers.PlayerData;
|
|
||||||
import noppes.npcs.controllers.PlayerDataController;
|
|
||||||
import noppes.npcs.controllers.PlayerMail;
|
|
||||||
import noppes.npcs.controllers.Quest;
|
|
||||||
import noppes.npcs.controllers.QuestCategory;
|
|
||||||
import noppes.npcs.controllers.QuestController;
|
|
||||||
import noppes.npcs.controllers.RecipeCarpentry;
|
|
||||||
import noppes.npcs.controllers.RecipeController;
|
|
||||||
import noppes.npcs.controllers.ScriptController;
|
|
||||||
import noppes.npcs.controllers.ServerCloneController;
|
|
||||||
import noppes.npcs.controllers.SpawnController;
|
|
||||||
import noppes.npcs.controllers.SpawnData;
|
|
||||||
import noppes.npcs.controllers.TransportController;
|
|
||||||
import noppes.npcs.controllers.TransportLocation;
|
|
||||||
import noppes.npcs.controllers.data.ForgeDataScript;
|
import noppes.npcs.controllers.data.ForgeDataScript;
|
||||||
|
import noppes.npcs.controllers.data.NPCDataScript;
|
||||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||||
import noppes.npcs.entity.EntityCustomNpc;
|
import noppes.npcs.entity.EntityCustomNpc;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
@@ -71,6 +51,9 @@ import noppes.npcs.roles.RoleTrader;
|
|||||||
import noppes.npcs.roles.RoleTransporter;
|
import noppes.npcs.roles.RoleTransporter;
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
||||||
|
import noppes.npcs.scripted.NpcAPI;
|
||||||
|
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||||
|
import noppes.npcs.scripted.gui.ScriptGui;
|
||||||
|
|
||||||
public class PacketHandlerServer{
|
public class PacketHandlerServer{
|
||||||
|
|
||||||
@@ -93,6 +76,25 @@ public class PacketHandlerServer{
|
|||||||
if(type == EnumPacketServer.IsGuiOpen) {
|
if(type == EnumPacketServer.IsGuiOpen) {
|
||||||
isGuiOpenPacket(buffer, player);
|
isGuiOpenPacket(buffer, player);
|
||||||
return;
|
return;
|
||||||
|
} else if (type == EnumPacketServer.CustomGuiButton && player.openContainer instanceof ContainerCustomGui) {
|
||||||
|
((ContainerCustomGui)player.openContainer).customGui.fromNBT(Server.readNBT(buffer));
|
||||||
|
EventHooks.onCustomGuiButton((ScriptPlayer)NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui)player.openContainer).customGui, buffer.readInt());
|
||||||
|
return;
|
||||||
|
} else if (type == EnumPacketServer.CustomGuiSlotChange && player.openContainer instanceof ContainerCustomGui) {
|
||||||
|
((ContainerCustomGui)player.openContainer).customGui.fromNBT(Server.readNBT(buffer));
|
||||||
|
EventHooks.onCustomGuiSlot((ScriptPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui)player.openContainer).customGui, buffer.readInt());
|
||||||
|
return;
|
||||||
|
} else if(type == EnumPacketServer.CustomGuiUnfocused && player.openContainer instanceof ContainerCustomGui) {
|
||||||
|
((ContainerCustomGui)player.openContainer).customGui.fromNBT(Server.readNBT(buffer));
|
||||||
|
EventHooks.onCustomGuiUnfocused((ScriptPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui) player.openContainer).customGui, buffer.readInt());
|
||||||
|
return;
|
||||||
|
} else if (type == EnumPacketServer.CustomGuiScrollClick && player.openContainer instanceof ContainerCustomGui) {
|
||||||
|
((ContainerCustomGui) player.openContainer).customGui.fromNBT(Server.readNBT(buffer));
|
||||||
|
EventHooks.onCustomGuiScrollClick((ScriptPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui) player.openContainer).customGui, buffer.readInt(), buffer.readInt(), CustomGuiController.readScrollSelection(buffer), buffer.readBoolean());
|
||||||
|
return;
|
||||||
|
} else if (type == EnumPacketServer.CustomGuiClose) {
|
||||||
|
EventHooks.onCustomGuiClose((ScriptPlayer)NpcAPI.Instance().getIEntity(player), (new ScriptGui()).fromNBT(Server.readNBT(buffer)));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(type.needsNpc && npc == null){
|
if(type.needsNpc && npc == null){
|
||||||
@@ -101,26 +103,32 @@ public class PacketHandlerServer{
|
|||||||
else if(type.hasPermission() && !CustomNpcsPermissions.Instance.hasPermission(player, type.permission)){
|
else if(type.hasPermission() && !CustomNpcsPermissions.Instance.hasPermission(player, type.permission)){
|
||||||
//player doesnt have permission to do this
|
//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");
|
warn(player, "tried to use custom npcs without a tool in hand, probably a hacker");
|
||||||
else if(item.getItem() == CustomItems.wand)
|
else {
|
||||||
wandPackets(type, buffer, player, npc);
|
if (item != null) {
|
||||||
else if(item.getItem() == CustomItems.moving)
|
if (item.getItem() == CustomItems.wand)
|
||||||
movingPackets(type, buffer, player, npc);
|
wandPackets(type, buffer, player, npc);
|
||||||
else if(item.getItem() == CustomItems.mount)
|
else if (item.getItem() == CustomItems.moving)
|
||||||
mountPackets(type, buffer, player);
|
movingPackets(type, buffer, player, npc);
|
||||||
else if(item.getItem() == CustomItems.cloner)
|
else if (item.getItem() == CustomItems.mount)
|
||||||
clonePackets(type, buffer, player);
|
mountPackets(type, buffer, player);
|
||||||
else if(item.getItem() == CustomItems.teleporter)
|
else if (item.getItem() == CustomItems.cloner)
|
||||||
featherPackets(type, buffer, player);
|
clonePackets(type, buffer, player);
|
||||||
else if(type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave)
|
else if (item.getItem() == CustomItems.teleporter)
|
||||||
playerScriptPackets(type, buffer, player);
|
featherPackets(type, buffer, player);
|
||||||
else if(type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave)
|
else if (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave)
|
||||||
forgeScriptPackets(type, buffer, player);
|
playerScriptPackets(type, buffer, player);
|
||||||
else if(item.getItem() == CustomItems.scripter)
|
else if (type == EnumPacketServer.ScriptNPCGet || type == EnumPacketServer.ScriptNPCSave)
|
||||||
scriptPackets(type, buffer, player, npc);
|
npcScriptPackets(type, buffer, player);
|
||||||
else if(item.getItem() == Item.getItemFromBlock(CustomItems.waypoint) || item.getItem() == Item.getItemFromBlock(CustomItems.border) || item.getItem() == Item.getItemFromBlock(CustomItems.redstoneBlock))
|
else if (type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave)
|
||||||
blockPackets(type, buffer, player);
|
forgeScriptPackets(type, buffer, player);
|
||||||
|
else if (item.getItem() == CustomItems.scripter)
|
||||||
|
scriptPackets(type, buffer, player, npc);
|
||||||
|
else if (item.getItem() == Item.getItemFromBlock(CustomItems.waypoint) || item.getItem() == Item.getItemFromBlock(CustomItems.border) || item.getItem() == Item.getItemFromBlock(CustomItems.redstoneBlock))
|
||||||
|
blockPackets(type, buffer, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogWriter.error("Error with EnumPacketServer." + type, e);
|
LogWriter.error("Error with EnumPacketServer." + type, e);
|
||||||
}
|
}
|
||||||
@@ -167,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 {
|
private void featherPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
||||||
if(type == EnumPacketServer.DimensionsGet){
|
if(type == EnumPacketServer.DimensionsGet){
|
||||||
HashMap<String,Integer> map = new HashMap<String,Integer>();
|
HashMap<String,Integer> map = new HashMap<String,Integer>();
|
||||||
@@ -264,7 +284,7 @@ public class PacketHandlerServer{
|
|||||||
}
|
}
|
||||||
else if(type == EnumPacketServer.FactionGet){
|
else if(type == EnumPacketServer.FactionGet){
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
Faction faction = FactionController.getInstance().getFaction(buffer.readInt());
|
Faction faction = FactionController.getInstance().get(buffer.readInt());
|
||||||
faction.writeNBT(compound);
|
faction.writeNBT(compound);
|
||||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||||
}
|
}
|
||||||
@@ -380,7 +400,7 @@ public class PacketHandlerServer{
|
|||||||
NoppesUtilServer.setRecipeGui(player,recipe);
|
NoppesUtilServer.setRecipeGui(player,recipe);
|
||||||
}
|
}
|
||||||
else if(type == EnumPacketServer.RecipeRemove){
|
else if(type == EnumPacketServer.RecipeRemove){
|
||||||
RecipeCarpentry recipe = RecipeController.instance.removeRecipe(buffer.readInt());
|
RecipeCarpentry recipe = RecipeController.instance.delete(buffer.readInt());
|
||||||
NoppesUtilServer.sendRecipeData(player, recipe.isGlobal?3:4);
|
NoppesUtilServer.sendRecipeData(player, recipe.isGlobal?3:4);
|
||||||
NoppesUtilServer.setRecipeGui(player,new RecipeCarpentry(""));
|
NoppesUtilServer.setRecipeGui(player,new RecipeCarpentry(""));
|
||||||
}
|
}
|
||||||
@@ -562,7 +582,7 @@ public class PacketHandlerServer{
|
|||||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||||
}
|
}
|
||||||
else if(type == EnumPacketServer.FactionRemove){
|
else if(type == EnumPacketServer.FactionRemove){
|
||||||
FactionController.getInstance().removeFaction(buffer.readInt());
|
FactionController.getInstance().delete(buffer.readInt());
|
||||||
NoppesUtilServer.sendFactionDataAll(player);
|
NoppesUtilServer.sendFactionDataAll(player);
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
(new Faction()).writeNBT(compound);
|
(new Faction()).writeNBT(compound);
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import java.util.Vector;
|
|||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import noppes.npcs.constants.EnumQuestCompletion;
|
import noppes.npcs.constants.EnumQuestCompletion;
|
||||||
|
import noppes.npcs.controllers.PlayerData;
|
||||||
|
import noppes.npcs.controllers.PlayerDataController;
|
||||||
import noppes.npcs.controllers.PlayerQuestController;
|
import noppes.npcs.controllers.PlayerQuestController;
|
||||||
import noppes.npcs.controllers.Quest;
|
import noppes.npcs.controllers.Quest;
|
||||||
|
|
||||||
@@ -34,7 +36,7 @@ public class QuestLogData {
|
|||||||
|
|
||||||
}
|
}
|
||||||
public void setData(EntityPlayer player){
|
public void setData(EntityPlayer player){
|
||||||
|
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||||
for(Quest quest : PlayerQuestController.getActiveQuests(player))
|
for(Quest quest : PlayerQuestController.getActiveQuests(player))
|
||||||
{
|
{
|
||||||
String category = quest.category.title;
|
String category = quest.category.title;
|
||||||
@@ -46,7 +48,7 @@ public class QuestLogData {
|
|||||||
questText.put(category + ":" + quest.title, quest.logText);
|
questText.put(category + ":" + quest.title, quest.logText);
|
||||||
|
|
||||||
questStatus.put(category + ":" + quest.title, quest.questInterface.getQuestLogStatus(player));
|
questStatus.put(category + ":" + quest.title, quest.questInterface.getQuestLogStatus(player));
|
||||||
if(quest.completion == EnumQuestCompletion.Npc && quest.questInterface.isCompleted(player))
|
if(quest.completion == EnumQuestCompletion.Npc && quest.questInterface.isCompleted(playerData))
|
||||||
finish.put(category + ":" + quest.title, quest.completerNpc);
|
finish.put(category + ":" + quest.title, quest.completerNpc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class ScriptForgeEventHandler {
|
|||||||
} else if(!(event instanceof TickEvent) || ((TickEvent)event).side != Side.CLIENT) {
|
} else if(!(event instanceof TickEvent) || ((TickEvent)event).side != Side.CLIENT) {
|
||||||
if (event instanceof PlayerEvent) {
|
if (event instanceof PlayerEvent) {
|
||||||
PlayerEvent ev = (PlayerEvent) event;
|
PlayerEvent ev = (PlayerEvent) event;
|
||||||
if (!(ev.player.worldObj instanceof WorldServer)) {
|
if (ev.player == null || !(ev.player.worldObj instanceof WorldServer)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,15 +46,13 @@ import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
|||||||
import net.minecraftforge.event.entity.player.*;
|
import net.minecraftforge.event.entity.player.*;
|
||||||
import net.minecraftforge.event.world.*;
|
import net.minecraftforge.event.world.*;
|
||||||
import net.minecraftforge.event.world.WorldEvent.PotentialSpawns;
|
import net.minecraftforge.event.world.WorldEvent.PotentialSpawns;
|
||||||
import noppes.npcs.controllers.PlayerData;
|
import noppes.npcs.constants.EnumQuestType;
|
||||||
import noppes.npcs.controllers.PlayerDataController;
|
import noppes.npcs.controllers.*;
|
||||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
import noppes.npcs.scripted.NpcAPI;
|
import noppes.npcs.scripted.NpcAPI;
|
||||||
import noppes.npcs.scripted.entity.ScriptPlayer;
|
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||||
import noppes.npcs.scripted.event.ForgeEvent;
|
import noppes.npcs.scripted.event.ForgeEvent;
|
||||||
import noppes.npcs.controllers.PixelmonHelper;
|
|
||||||
import noppes.npcs.controllers.ScriptController;
|
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
public class ScriptPlayerEventHandler {
|
public class ScriptPlayerEventHandler {
|
||||||
@@ -62,6 +60,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
}
|
}
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onServerTick(TickEvent.PlayerTickEvent event) {
|
public void onServerTick(TickEvent.PlayerTickEvent event) {
|
||||||
|
if(event.player == null || event.player.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.side == Side.SERVER && event.phase == TickEvent.Phase.START) {
|
if(event.side == Side.SERVER && event.phase == TickEvent.Phase.START) {
|
||||||
EntityPlayer player = event.player;
|
EntityPlayer player = event.player;
|
||||||
|
|
||||||
@@ -71,15 +72,25 @@ public class ScriptPlayerEventHandler {
|
|||||||
EventHooks.onPlayerTick(handler, scriptPlayer);
|
EventHooks.onPlayerTick(handler, scriptPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||||
if(PlayerDataController.instance != null) {
|
if(PlayerDataController.instance != null) {
|
||||||
if(PlayerDataController.instance.getPlayerData(player).timers.size() > 0)
|
if(playerData.timers.size() > 0)
|
||||||
PlayerDataController.instance.getPlayerData(player).timers.update();
|
playerData.timers.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(player.ticksExisted%(20*CustomNpcs.PlayerQuestCheck) == 0){
|
||||||
|
PlayerQuestData questData = playerData.questData;
|
||||||
|
for(EnumQuestType e : EnumQuestType.values())
|
||||||
|
questData.checkQuestCompletion(playerData, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(EntityInteractEvent event) {
|
public void invoke(EntityInteractEvent event) {
|
||||||
|
if(event.entityPlayer == null || event.entityPlayer.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!event.entityPlayer.worldObj.isRemote && event.entityPlayer.worldObj instanceof WorldServer) {
|
if(!event.entityPlayer.worldObj.isRemote && event.entityPlayer.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
||||||
@@ -90,6 +101,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(ArrowNockEvent event) {
|
public void invoke(ArrowNockEvent event) {
|
||||||
|
if(event.entityPlayer == null || event.entityPlayer.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!event.entityPlayer.worldObj.isRemote && event.entityPlayer.worldObj instanceof WorldServer) {
|
if(!event.entityPlayer.worldObj.isRemote && event.entityPlayer.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
||||||
@@ -100,6 +114,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(ArrowLooseEvent event) {
|
public void invoke(ArrowLooseEvent event) {
|
||||||
|
if(event.entityPlayer == null || event.entityPlayer.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!event.entityPlayer.worldObj.isRemote && event.entityPlayer.worldObj instanceof WorldServer) {
|
if(!event.entityPlayer.worldObj.isRemote && event.entityPlayer.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
||||||
@@ -110,6 +127,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(BlockEvent.BreakEvent event) {
|
public void invoke(BlockEvent.BreakEvent event) {
|
||||||
|
if(event.getPlayer() == null || event.getPlayer().worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(!event.getPlayer().worldObj.isRemote && event.world instanceof WorldServer) {
|
if(!event.getPlayer().worldObj.isRemote && event.world instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.getPlayer());
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.getPlayer());
|
||||||
@@ -121,6 +141,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(PlayerUseItemEvent.Start event) {
|
public void invoke(PlayerUseItemEvent.Start event) {
|
||||||
|
if(event.entityPlayer == null || event.entityPlayer.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
||||||
@@ -129,6 +152,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
}
|
}
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(PlayerUseItemEvent.Tick event) {
|
public void invoke(PlayerUseItemEvent.Tick event) {
|
||||||
|
if(event.entityPlayer == null || event.entityPlayer.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
||||||
@@ -137,6 +163,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
}
|
}
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(PlayerUseItemEvent.Stop event) {
|
public void invoke(PlayerUseItemEvent.Stop event) {
|
||||||
|
if(event.entityPlayer == null || event.entityPlayer.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
||||||
@@ -145,6 +174,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
}
|
}
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(PlayerUseItemEvent.Finish event) {
|
public void invoke(PlayerUseItemEvent.Finish event) {
|
||||||
|
if(event.entityPlayer == null || event.entityPlayer.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
||||||
@@ -154,6 +186,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(PlayerDropsEvent event) {
|
public void invoke(PlayerDropsEvent event) {
|
||||||
|
if(event.entityPlayer == null || event.entityPlayer.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
||||||
@@ -163,6 +198,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(PlayerPickupXpEvent event) {
|
public void invoke(PlayerPickupXpEvent event) {
|
||||||
|
if(event.entityPlayer == null || event.entityPlayer.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
||||||
@@ -172,6 +210,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(PlayerEvent.PlayerChangedDimensionEvent event) {
|
public void invoke(PlayerEvent.PlayerChangedDimensionEvent event) {
|
||||||
|
if(event.player == null || event.player.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.player.worldObj instanceof WorldServer) {
|
if(event.player.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.player);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.player);
|
||||||
@@ -181,6 +222,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(PlayerEvent.ItemPickupEvent event) {
|
public void invoke(PlayerEvent.ItemPickupEvent event) {
|
||||||
|
if(event.player == null || event.player.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.player.worldObj instanceof WorldServer) {
|
if(event.player.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.player);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.player);
|
||||||
@@ -190,6 +234,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(PlayerOpenContainerEvent event) {
|
public void invoke(PlayerOpenContainerEvent event) {
|
||||||
|
if(event.entityPlayer == null || event.entityPlayer.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entityPlayer.worldObj instanceof WorldServer && !(event.entityPlayer.openContainer instanceof ContainerPlayer)) {
|
if(event.entityPlayer.worldObj instanceof WorldServer && !(event.entityPlayer.openContainer instanceof ContainerPlayer)) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
||||||
@@ -199,6 +246,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(UseHoeEvent event) {
|
public void invoke(UseHoeEvent event) {
|
||||||
|
if(event.entityPlayer == null || event.entityPlayer.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
||||||
@@ -208,6 +258,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(PlayerSleepInBedEvent event) {
|
public void invoke(PlayerSleepInBedEvent event) {
|
||||||
|
if(event.entityPlayer == null || event.entityPlayer.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
||||||
@@ -217,6 +270,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(PlayerWakeUpEvent event) {
|
public void invoke(PlayerWakeUpEvent event) {
|
||||||
|
if(event.entityPlayer == null || event.entityPlayer.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
||||||
@@ -226,6 +282,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(FillBucketEvent event) {
|
public void invoke(FillBucketEvent event) {
|
||||||
|
if(event.entityPlayer == null || event.entityPlayer.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
||||||
@@ -235,6 +294,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(BonemealEvent event) {
|
public void invoke(BonemealEvent event) {
|
||||||
|
if(event.entityPlayer == null || event.entityPlayer.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
||||||
@@ -244,6 +306,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(AchievementEvent event) {
|
public void invoke(AchievementEvent event) {
|
||||||
|
if(event.entityPlayer == null || event.entityPlayer.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
if(event.entityPlayer.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.entityPlayer);
|
||||||
@@ -253,6 +318,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(ItemTossEvent event) {
|
public void invoke(ItemTossEvent event) {
|
||||||
|
if(event.player == null || event.player.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.player.worldObj instanceof WorldServer) {
|
if(event.player.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.player);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.player);
|
||||||
@@ -262,6 +330,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(LivingFallEvent event) {
|
public void invoke(LivingFallEvent event) {
|
||||||
|
if(event.entityLiving == null || event.entityLiving.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entityLiving.worldObj instanceof WorldServer) {
|
if(event.entityLiving.worldObj instanceof WorldServer) {
|
||||||
if (event.entityLiving instanceof EntityPlayer) {
|
if (event.entityLiving instanceof EntityPlayer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
@@ -273,6 +344,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(LivingEvent.LivingJumpEvent event) {
|
public void invoke(LivingEvent.LivingJumpEvent event) {
|
||||||
|
if(event.entityLiving == null || event.entityLiving.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entityLiving.worldObj instanceof WorldServer) {
|
if(event.entityLiving.worldObj instanceof WorldServer) {
|
||||||
if (event.entityLiving instanceof EntityPlayer) {
|
if (event.entityLiving instanceof EntityPlayer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
@@ -284,6 +358,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(EntityStruckByLightningEvent event) {
|
public void invoke(EntityStruckByLightningEvent event) {
|
||||||
|
if(event.entity == null || event.entity.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entity.worldObj instanceof WorldServer) {
|
if(event.entity.worldObj instanceof WorldServer) {
|
||||||
if (event.entity instanceof EntityPlayer) {
|
if (event.entity instanceof EntityPlayer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
@@ -295,6 +372,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(PlaySoundAtEntityEvent event) {
|
public void invoke(PlaySoundAtEntityEvent event) {
|
||||||
|
if(event.entity == null || event.entity.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entity.worldObj instanceof WorldServer) {
|
if(event.entity.worldObj instanceof WorldServer) {
|
||||||
if (event.entity instanceof EntityPlayer) {
|
if (event.entity instanceof EntityPlayer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
@@ -306,6 +386,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(LivingDeathEvent event) {
|
public void invoke(LivingDeathEvent event) {
|
||||||
|
if(event.entityLiving == null || event.entityLiving.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entityLiving.worldObj instanceof WorldServer) {
|
if(event.entityLiving.worldObj instanceof WorldServer) {
|
||||||
Entity source = NoppesUtilServer.GetDamageSourcee(event.source);
|
Entity source = NoppesUtilServer.GetDamageSourcee(event.source);
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
@@ -324,6 +407,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(LivingHurtEvent event) {
|
public void invoke(LivingHurtEvent event) {
|
||||||
|
if(event.entityLiving == null || event.entityLiving.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.entityLiving.worldObj instanceof WorldServer) {
|
if(event.entityLiving.worldObj instanceof WorldServer) {
|
||||||
Entity source = NoppesUtilServer.GetDamageSourcee(event.source);
|
Entity source = NoppesUtilServer.GetDamageSourcee(event.source);
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
@@ -344,6 +430,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(PlayerEvent.PlayerRespawnEvent event) {
|
public void invoke(PlayerEvent.PlayerRespawnEvent event) {
|
||||||
|
if(event.player == null || event.player.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.player.worldObj instanceof WorldServer) {
|
if(event.player.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.player);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.player);
|
||||||
@@ -353,6 +442,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(PlayerEvent.PlayerLoggedInEvent event) {
|
public void invoke(PlayerEvent.PlayerLoggedInEvent event) {
|
||||||
|
if(event.player == null || event.player.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.player.worldObj instanceof WorldServer) {
|
if(event.player.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.player);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.player);
|
||||||
@@ -362,6 +454,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void invoke(PlayerEvent.PlayerLoggedOutEvent event) {
|
public void invoke(PlayerEvent.PlayerLoggedOutEvent event) {
|
||||||
|
if(event.player == null || event.player.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.player.worldObj instanceof WorldServer) {
|
if(event.player.worldObj instanceof WorldServer) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.player);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.player);
|
||||||
@@ -373,6 +468,9 @@ public class ScriptPlayerEventHandler {
|
|||||||
priority = EventPriority.HIGHEST
|
priority = EventPriority.HIGHEST
|
||||||
)
|
)
|
||||||
public void invoke(net.minecraftforge.event.ServerChatEvent event) {
|
public void invoke(net.minecraftforge.event.ServerChatEvent event) {
|
||||||
|
if(event.player == null || event.player.worldObj == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if(event.player.worldObj instanceof WorldServer && !event.player.equals(EntityNPCInterface.chateventPlayer)) {
|
if(event.player.worldObj instanceof WorldServer && !event.player.equals(EntityNPCInterface.chateventPlayer)) {
|
||||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||||
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.player);
|
ScriptPlayer scriptPlayer = (ScriptPlayer) ScriptController.Instance.getScriptForEntity(event.player);
|
||||||
|
|||||||
@@ -35,14 +35,7 @@ import noppes.npcs.constants.EnumPacketClient;
|
|||||||
import noppes.npcs.constants.EnumQuestType;
|
import noppes.npcs.constants.EnumQuestType;
|
||||||
import noppes.npcs.constants.EnumRoleType;
|
import noppes.npcs.constants.EnumRoleType;
|
||||||
import noppes.npcs.constants.EnumScriptType;
|
import noppes.npcs.constants.EnumScriptType;
|
||||||
import noppes.npcs.controllers.Line;
|
import noppes.npcs.controllers.*;
|
||||||
import noppes.npcs.controllers.PlayerData;
|
|
||||||
import noppes.npcs.controllers.PlayerDataController;
|
|
||||||
import noppes.npcs.controllers.PlayerQuestData;
|
|
||||||
import noppes.npcs.controllers.QuestData;
|
|
||||||
import noppes.npcs.controllers.RecipeCarpentry;
|
|
||||||
import noppes.npcs.controllers.RecipeController;
|
|
||||||
import noppes.npcs.controllers.ServerCloneController;
|
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
import noppes.npcs.items.ItemExcalibur;
|
import noppes.npcs.items.ItemExcalibur;
|
||||||
import noppes.npcs.items.ItemShield;
|
import noppes.npcs.items.ItemShield;
|
||||||
@@ -111,17 +104,17 @@ public class ServerEventsHandler {
|
|||||||
else if(item.getItem() == CustomItems.scripter && !isRemote && npcInteracted){
|
else if(item.getItem() == CustomItems.scripter && !isRemote && npcInteracted){
|
||||||
if(!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.NPC_GUI))
|
if(!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.NPC_GUI))
|
||||||
return;
|
return;
|
||||||
NoppesUtilServer.setEditingNpc(event.entityPlayer, (EntityNPCInterface)event.target);
|
NoppesUtilServer.setEditingNpc(event.entityPlayer, (EntityNPCInterface)event.target);
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
Server.sendData((EntityPlayerMP)event.entityPlayer, EnumPacketClient.GUI, EnumGuiType.Script.ordinal());
|
Server.sendData((EntityPlayerMP)event.entityPlayer, EnumPacketClient.GUI, EnumGuiType.Script.ordinal());
|
||||||
}
|
}
|
||||||
else if(item.getItem() == CustomItems.mount){
|
else if(item.getItem() == CustomItems.mount){
|
||||||
if(!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.TOOL_MOUNTER))
|
if(!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.TOOL_MOUNTER))
|
||||||
return;
|
return;
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
mounted = event.target;
|
mounted = event.target;
|
||||||
if(isRemote)
|
if(isRemote)
|
||||||
CustomNpcs.proxy.openGui(MathHelper.floor_double(mounted.posX), MathHelper.floor_double(mounted.posY), MathHelper.floor_double(mounted.posZ), EnumGuiType.MobSpawnerMounter, event.entityPlayer);
|
CustomNpcs.proxy.openGui(MathHelper.floor_double(mounted.posX), MathHelper.floor_double(mounted.posY), MathHelper.floor_double(mounted.posZ), EnumGuiType.MobSpawnerMounter, event.entityPlayer);
|
||||||
}
|
}
|
||||||
else if(item.getItem() == CustomItems.wand && event.target instanceof EntityVillager){
|
else if(item.getItem() == CustomItems.wand && event.target instanceof EntityVillager){
|
||||||
if(!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.EDIT_VILLAGER))
|
if(!CustomNpcsPermissions.Instance.hasPermission(event.entityPlayer, CustomNpcsPermissions.EDIT_VILLAGER))
|
||||||
@@ -132,12 +125,12 @@ public class ServerEventsHandler {
|
|||||||
if(!isRemote){
|
if(!isRemote){
|
||||||
EntityPlayerMP player = (EntityPlayerMP) event.entityPlayer;
|
EntityPlayerMP player = (EntityPlayerMP) event.entityPlayer;
|
||||||
player.openGui(CustomNpcs.instance, EnumGuiType.MerchantAdd.ordinal(), player.worldObj, 0, 0, 0);
|
player.openGui(CustomNpcs.instance, EnumGuiType.MerchantAdd.ordinal(), player.worldObj, 0, 0, 0);
|
||||||
MerchantRecipeList merchantrecipelist = Merchant.getRecipes(player);
|
MerchantRecipeList merchantrecipelist = Merchant.getRecipes(player);
|
||||||
|
|
||||||
if (merchantrecipelist != null)
|
if (merchantrecipelist != null)
|
||||||
{
|
{
|
||||||
Server.sendData(player, EnumPacketClient.VILLAGER_LIST, merchantrecipelist);
|
Server.sendData(player, EnumPacketClient.VILLAGER_LIST, merchantrecipelist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,47 +173,47 @@ public class ServerEventsHandler {
|
|||||||
|
|
||||||
if(block == Blocks.crafting_table && event.action == Action.RIGHT_CLICK_BLOCK && !player.worldObj.isRemote){
|
if(block == Blocks.crafting_table && event.action == Action.RIGHT_CLICK_BLOCK && !player.worldObj.isRemote){
|
||||||
RecipeController controller = RecipeController.instance;
|
RecipeController controller = RecipeController.instance;
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagList list = new NBTTagList();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(RecipeCarpentry recipe : controller.globalRecipes.values()){
|
for(RecipeCarpentry recipe : controller.globalRecipes.values()){
|
||||||
list.appendTag(recipe.writeNBT());
|
list.appendTag(recipe.writeNBT());
|
||||||
i++;
|
i++;
|
||||||
if(i % 10 == 0){
|
if(i % 10 == 0){
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
compound.setTag("recipes", list);
|
compound.setTag("recipes", list);
|
||||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_ADD, compound);
|
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_ADD, compound);
|
||||||
list = new NBTTagList();
|
list = new NBTTagList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i % 10 != 0){
|
if(i % 10 != 0){
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
compound.setTag("recipes", list);
|
compound.setTag("recipes", list);
|
||||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_ADD, compound);
|
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_ADD, compound);
|
||||||
}
|
}
|
||||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_WORKBENCH);
|
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_WORKBENCH);
|
||||||
}
|
}
|
||||||
if(block == CustomItems.carpentyBench && event.action == Action.RIGHT_CLICK_BLOCK && !player.worldObj.isRemote){
|
if(block == CustomItems.carpentyBench && event.action == Action.RIGHT_CLICK_BLOCK && !player.worldObj.isRemote){
|
||||||
RecipeController controller = RecipeController.instance;
|
RecipeController controller = RecipeController.instance;
|
||||||
NBTTagList list = new NBTTagList();
|
NBTTagList list = new NBTTagList();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(RecipeCarpentry recipe : controller.anvilRecipes.values()){
|
for(RecipeCarpentry recipe : controller.anvilRecipes.values()){
|
||||||
list.appendTag(recipe.writeNBT());
|
list.appendTag(recipe.writeNBT());
|
||||||
i++;
|
i++;
|
||||||
if(i % 10 == 0){
|
if(i % 10 == 0){
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
compound.setTag("recipes", list);
|
compound.setTag("recipes", list);
|
||||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_ADD, compound);
|
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_ADD, compound);
|
||||||
list = new NBTTagList();
|
list = new NBTTagList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i % 10 != 0){
|
if(i % 10 != 0){
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
compound.setTag("recipes", list);
|
compound.setTag("recipes", list);
|
||||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_ADD, compound);
|
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_ADD, compound);
|
||||||
}
|
}
|
||||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_CARPENTRYBENCH);
|
Server.sendData((EntityPlayerMP)player, EnumPacketClient.SYNCRECIPES_CARPENTRYBENCH);
|
||||||
}
|
}
|
||||||
if((block == CustomItems.banner || block == CustomItems.wallBanner || block == CustomItems.sign) && event.action == Action.RIGHT_CLICK_BLOCK){
|
if((block == CustomItems.banner || block == CustomItems.wallBanner || block == CustomItems.sign) && event.action == Action.RIGHT_CLICK_BLOCK){
|
||||||
ItemStack item = player.inventory.getCurrentItem();
|
ItemStack item = player.inventory.getCurrentItem();
|
||||||
@@ -232,19 +225,19 @@ public class ServerEventsHandler {
|
|||||||
y--;
|
y--;
|
||||||
TileBanner tile = (TileBanner)player.worldObj.getTileEntity(event.x, y, event.z);
|
TileBanner tile = (TileBanner)player.worldObj.getTileEntity(event.x, y, event.z);
|
||||||
if(!tile.canEdit()){
|
if(!tile.canEdit()){
|
||||||
if(item.getItem() == CustomItems.wand && CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.EDIT_BLOCKS)){
|
if(item.getItem() == CustomItems.wand && CustomNpcsPermissions.hasPermission(player, CustomNpcsPermissions.EDIT_BLOCKS)){
|
||||||
tile.time = System.currentTimeMillis();
|
tile.time = System.currentTimeMillis();
|
||||||
if(player.worldObj.isRemote)
|
if(player.worldObj.isRemote)
|
||||||
player.addChatComponentMessage(new ChatComponentTranslation("availability.editIcon"));
|
player.addChatComponentMessage(new ChatComponentTranslation("availability.editIcon"));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!player.worldObj.isRemote){
|
if(!player.worldObj.isRemote){
|
||||||
tile.icon = item.copy();
|
tile.icon = item.copy();
|
||||||
player.worldObj.markBlockForUpdate(event.x, y, event.z);
|
player.worldObj.markBlockForUpdate(event.x, y, event.z);
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -264,7 +257,7 @@ public class ServerEventsHandler {
|
|||||||
if(line != null)
|
if(line != null)
|
||||||
npc.saySurrounding(line.formatTarget(event.entityLiving));
|
npc.saySurrounding(line.formatTarget(event.entityLiving));
|
||||||
|
|
||||||
npc.script.callScript(EnumScriptType.KILLS, "target", event.entityLiving);
|
EventHooks.onNPCKilledEntity(npc,event.entityLiving);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityPlayer player = null;
|
EntityPlayer player = null;
|
||||||
@@ -298,11 +291,12 @@ public class ServerEventsHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void doQuest(EntityPlayer player, EntityLivingBase entity, boolean all) {
|
private void doQuest(EntityPlayer player, EntityLivingBase entity, boolean all) {
|
||||||
PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData;
|
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||||
|
PlayerQuestData questData = playerData.questData;
|
||||||
boolean change = false;
|
boolean change = false;
|
||||||
String entityName = EntityList.getEntityString(entity);
|
String entityName = EntityList.getEntityString(entity);
|
||||||
|
|
||||||
for(QuestData data : playerdata.activeQuests.values()){
|
for(QuestData data : questData.activeQuests.values()){
|
||||||
if(data.quest.type != EnumQuestType.Kill && data.quest.type != EnumQuestType.AreaKill)
|
if(data.quest.type != EnumQuestType.Kill && data.quest.type != EnumQuestType.AreaKill)
|
||||||
continue;
|
continue;
|
||||||
if(data.quest.type == EnumQuestType.AreaKill && all){
|
if(data.quest.type == EnumQuestType.AreaKill && all){
|
||||||
@@ -314,6 +308,17 @@ public class ServerEventsHandler {
|
|||||||
}
|
}
|
||||||
String name = entityName;
|
String name = entityName;
|
||||||
QuestKill quest = (QuestKill) data.quest.questInterface;
|
QuestKill quest = (QuestKill) data.quest.questInterface;
|
||||||
|
|
||||||
|
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()))
|
if(quest.targets.containsKey(entity.getCommandSenderName()))
|
||||||
name = entity.getCommandSenderName();
|
name = entity.getCommandSenderName();
|
||||||
else if(!quest.targets.containsKey(name))
|
else if(!quest.targets.containsKey(name))
|
||||||
@@ -331,15 +336,16 @@ public class ServerEventsHandler {
|
|||||||
if(!change)
|
if(!change)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
playerdata.checkQuestCompletion(player,EnumQuestType.Kill);
|
questData.checkQuestCompletion(playerData,EnumQuestType.Kill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void pickUp(EntityItemPickupEvent event){
|
public void pickUp(EntityItemPickupEvent event){
|
||||||
if(event.entityPlayer.worldObj.isRemote)
|
if(event.entityPlayer.worldObj.isRemote)
|
||||||
return;
|
return;
|
||||||
PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(event.entityPlayer).questData;
|
PlayerData playerData = PlayerDataController.instance.getPlayerData(event.entityPlayer);
|
||||||
playerdata.checkQuestCompletion(event.entityPlayer, EnumQuestType.Item);
|
PlayerQuestData questData = playerData.questData;
|
||||||
|
questData.checkQuestCompletion(playerData, EnumQuestType.Item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|||||||
@@ -12,11 +12,21 @@ import noppes.npcs.controllers.Lines;
|
|||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
public class VersionCompatibility {
|
public class VersionCompatibility {
|
||||||
public static int ModRev = 16;
|
public static int ModRev = 17;
|
||||||
|
|
||||||
public static void CheckNpcCompatibility(EntityNPCInterface npc, NBTTagCompound compound){
|
public static void CheckNpcCompatibility(EntityNPCInterface npc, NBTTagCompound compound){
|
||||||
if(npc.npcVersion == ModRev)
|
if(npc.npcVersion == ModRev)
|
||||||
return;
|
return;
|
||||||
|
if(npc.npcVersion < 17){
|
||||||
|
// Fix DialogDarkenScreen
|
||||||
|
if(compound.hasKey("DialogDarkenScreen")){
|
||||||
|
compound.removeTag("DialogDarkenScreen");
|
||||||
|
}
|
||||||
|
// Remove MPM Texture Requirement
|
||||||
|
String texture = compound.getString("Texture");
|
||||||
|
texture = texture.replace("moreplayermodels:textures", "customnpcs:textures/parts");
|
||||||
|
compound.setString("Texture", texture);
|
||||||
|
}
|
||||||
if(npc.npcVersion < 12){
|
if(npc.npcVersion < 12){
|
||||||
CompatabilityFix(compound, npc.advanced.writeToNBT(new NBTTagCompound()));
|
CompatabilityFix(compound, npc.advanced.writeToNBT(new NBTTagCompound()));
|
||||||
CompatabilityFix(compound, npc.ai.writeToNBT(new NBTTagCompound()));
|
CompatabilityFix(compound, npc.ai.writeToNBT(new NBTTagCompound()));
|
||||||
|
|||||||
@@ -166,79 +166,27 @@ public class FlyPathFinder extends PathFinder
|
|||||||
b0 = 1;
|
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);
|
for(int y = -1; y <= 1; y ++) {
|
||||||
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 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 pathpoint5 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord + 1, p_75860_2_.yCoord, p_75860_2_.zCoord, 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 pathpoint6 = this.getSafePoint(p_75860_1_, p_75860_2_.xCoord, p_75860_2_.yCoord, p_75860_2_.zCoord - 1, 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);
|
if (pathpoint3 != null && !pathpoint3.isFirst && pathpoint3.distanceTo(p_75860_4_) < p_75860_5_) {
|
||||||
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);
|
this.pathOptions[i++] = pathpoint3;
|
||||||
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);
|
|
||||||
|
|
||||||
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);
|
if (pathpoint4 != null && !pathpoint4.isFirst && pathpoint4.distanceTo(p_75860_4_) < p_75860_5_) {
|
||||||
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);
|
this.pathOptions[i++] = pathpoint4;
|
||||||
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 (pathpoint3 != null && !pathpoint3.isFirst && pathpoint3.distanceTo(p_75860_4_) < p_75860_5_)
|
if (pathpoint5 != null && !pathpoint5.isFirst && pathpoint5.distanceTo(p_75860_4_) < p_75860_5_) {
|
||||||
{
|
this.pathOptions[i++] = pathpoint5;
|
||||||
this.pathOptions[i++] = pathpoint3;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (pathpoint4 != null && !pathpoint4.isFirst && pathpoint4.distanceTo(p_75860_4_) < p_75860_5_)
|
if (pathpoint6 != null && !pathpoint6.isFirst && pathpoint6.distanceTo(p_75860_4_) < p_75860_5_) {
|
||||||
{
|
this.pathOptions[i++] = pathpoint6;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package noppes.npcs.ai.pathfinder;
|
|||||||
|
|
||||||
import net.minecraft.entity.SharedMonsterAttributes;
|
import net.minecraft.entity.SharedMonsterAttributes;
|
||||||
import net.minecraft.entity.ai.EntityMoveHelper;
|
import net.minecraft.entity.ai.EntityMoveHelper;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
@@ -28,37 +29,36 @@ public class FlyingMoveHelper extends EntityMoveHelper{
|
|||||||
if (this.update) {
|
if (this.update) {
|
||||||
this.update = false;
|
this.update = false;
|
||||||
|
|
||||||
double speed = this.entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue();
|
double speed = this.speed * this.entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue() * this.entity.ai.flySpeed;
|
||||||
double speedMult = 0.6000000238418579D / 0.5D;
|
|
||||||
|
|
||||||
double d0 = this.posX - this.entity.posX;
|
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 d2 = this.posZ - this.entity.posZ;
|
||||||
double d4 = d0 * d0 + d1 * d1 + d2 * d2;
|
double d4 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||||
|
double d5 = MathHelper.sqrt_double(d4);
|
||||||
|
|
||||||
if (this.entity.hurtTime == 0 && d4 > 0.5D) {
|
double heightOffGround = 0;
|
||||||
if (this.posY != this.entity.posY) {
|
if(this.entity.ai.hasFlyLimit) {
|
||||||
if (this.entity.motionY * Math.signum(this.entity.posY - this.posY) > 0.0D) {
|
for (int blockY = (int) this.posY; blockY > 0; blockY--) {
|
||||||
this.entity.motionY = 0.0D;
|
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);
|
|
||||||
|
|
||||||
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,32 +289,15 @@ public class PathNavigateFlying extends PathNavigate {
|
|||||||
|
|
||||||
private Vec3 getEntityPosition()
|
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
|
* Gets the safe pathing Y position for the entity depending on if it can path swim or not
|
||||||
*/
|
*/
|
||||||
private int getPathableYPos()
|
private double getPathableYPos()
|
||||||
{
|
{
|
||||||
int i = (int)this.theEntity.boundingBox.minY;
|
return this.theEntity.boundingBox.minY + 0.05D;
|
||||||
Block block = this.worldObj.getBlock(MathHelper.floor_double(this.theEntity.posX), i, MathHelper.floor_double(this.theEntity.posZ));
|
|
||||||
int j = 0;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (block != Blocks.air)
|
|
||||||
{
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
++i;
|
|
||||||
block = this.worldObj.getBlock(MathHelper.floor_double(this.theEntity.posX), i, MathHelper.floor_double(this.theEntity.posZ));
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
while (j <= 16);
|
|
||||||
|
|
||||||
return (int)(this.theEntity.boundingBox.minY + 0.5D);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||||||
import net.minecraft.util.ChatComponentTranslation;
|
import net.minecraft.util.ChatComponentTranslation;
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
import noppes.npcs.constants.EnumQuestType;
|
import noppes.npcs.constants.EnumQuestType;
|
||||||
|
import noppes.npcs.controllers.PlayerData;
|
||||||
import noppes.npcs.controllers.PlayerDataController;
|
import noppes.npcs.controllers.PlayerDataController;
|
||||||
import noppes.npcs.controllers.PlayerQuestData;
|
import noppes.npcs.controllers.PlayerQuestData;
|
||||||
import noppes.npcs.controllers.QuestData;
|
import noppes.npcs.controllers.QuestData;
|
||||||
@@ -43,15 +44,16 @@ public class TileWaypoint extends TileEntity {
|
|||||||
if(toCheck.isEmpty())
|
if(toCheck.isEmpty())
|
||||||
return;
|
return;
|
||||||
for(EntityPlayer player : toCheck){
|
for(EntityPlayer player : toCheck){
|
||||||
PlayerQuestData playerdata = PlayerDataController.instance.getPlayerData(player).questData;
|
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||||
for(QuestData data : playerdata.activeQuests.values()){
|
PlayerQuestData questData = playerData.questData;
|
||||||
|
for(QuestData data : questData.activeQuests.values()){
|
||||||
if(data.quest.type != EnumQuestType.Location)
|
if(data.quest.type != EnumQuestType.Location)
|
||||||
continue;
|
continue;
|
||||||
QuestLocation quest = (QuestLocation) data.quest.questInterface;
|
QuestLocation quest = (QuestLocation) data.quest.questInterface;
|
||||||
if(quest.setFound(data, name)){
|
if(quest.setFound(data, name)){
|
||||||
player.addChatMessage(new ChatComponentTranslation(name + " " + StatCollector.translateToLocal("quest.found")));
|
player.addChatMessage(new ChatComponentTranslation(name + " " + StatCollector.translateToLocal("quest.found")));
|
||||||
|
|
||||||
playerdata.checkQuestCompletion(player, EnumQuestType.Location);
|
questData.checkQuestCompletion(playerData, EnumQuestType.Location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,16 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
import noppes.npcs.CustomNpcs;
|
import noppes.npcs.CustomNpcs;
|
||||||
import noppes.npcs.Server;
|
import noppes.npcs.Server;
|
||||||
|
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
|
||||||
import noppes.npcs.constants.EnumPacketServer;
|
import noppes.npcs.constants.EnumPacketServer;
|
||||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||||
|
|
||||||
public class Client {
|
public class Client {
|
||||||
|
public static HashMap<Integer, OverlayCustom> customOverlays = new HashMap<>();
|
||||||
|
|
||||||
public static void sendData(EnumPacketServer enu, Object... obs) {
|
public static void sendData(EnumPacketServer enu, Object... obs) {
|
||||||
ByteBuf buffer = Unpooled.buffer();
|
ByteBuf buffer = Unpooled.buffer();
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
package noppes.npcs.client;
|
package noppes.npcs.client;
|
||||||
|
|
||||||
public class ClientEventHandler {
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||||
|
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
public class ClientEventHandler {
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onOverlayRender(RenderGameOverlayEvent.Post event){
|
||||||
|
if(event.type == RenderGameOverlayEvent.ElementType.ALL) {
|
||||||
|
for (OverlayCustom overlayCustom : Client.customOverlays.values()) {
|
||||||
|
overlayCustom.renderGameOverlay(event.partialTicks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -65,6 +65,7 @@ import noppes.npcs.client.fx.EntityElementalStaffFX;
|
|||||||
import noppes.npcs.client.fx.EntityEnderFX;
|
import noppes.npcs.client.fx.EntityEnderFX;
|
||||||
import noppes.npcs.client.fx.EntityRainbowFX;
|
import noppes.npcs.client.fx.EntityRainbowFX;
|
||||||
import noppes.npcs.client.gui.*;
|
import noppes.npcs.client.gui.*;
|
||||||
|
import noppes.npcs.client.gui.custom.GuiCustom;
|
||||||
import noppes.npcs.client.gui.global.GuiNPCManageBanks;
|
import noppes.npcs.client.gui.global.GuiNPCManageBanks;
|
||||||
import noppes.npcs.client.gui.global.GuiNPCManageDialogs;
|
import noppes.npcs.client.gui.global.GuiNPCManageDialogs;
|
||||||
import noppes.npcs.client.gui.global.GuiNPCManageFactions;
|
import noppes.npcs.client.gui.global.GuiNPCManageFactions;
|
||||||
@@ -128,22 +129,7 @@ import noppes.npcs.client.renderer.blocks.BlockWallBannerRenderer;
|
|||||||
import noppes.npcs.client.renderer.blocks.BlockWeaponRackRenderer;
|
import noppes.npcs.client.renderer.blocks.BlockWeaponRackRenderer;
|
||||||
import noppes.npcs.config.StringCache;
|
import noppes.npcs.config.StringCache;
|
||||||
import noppes.npcs.constants.EnumGuiType;
|
import noppes.npcs.constants.EnumGuiType;
|
||||||
import noppes.npcs.containers.ContainerCarpentryBench;
|
import noppes.npcs.containers.*;
|
||||||
import noppes.npcs.containers.ContainerCrate;
|
|
||||||
import noppes.npcs.containers.ContainerMail;
|
|
||||||
import noppes.npcs.containers.ContainerManageBanks;
|
|
||||||
import noppes.npcs.containers.ContainerManageRecipes;
|
|
||||||
import noppes.npcs.containers.ContainerNPCBankInterface;
|
|
||||||
import noppes.npcs.containers.ContainerNPCCompanion;
|
|
||||||
import noppes.npcs.containers.ContainerNPCFollower;
|
|
||||||
import noppes.npcs.containers.ContainerNPCFollowerHire;
|
|
||||||
import noppes.npcs.containers.ContainerNPCFollowerSetup;
|
|
||||||
import noppes.npcs.containers.ContainerNPCInv;
|
|
||||||
import noppes.npcs.containers.ContainerNPCTrader;
|
|
||||||
import noppes.npcs.containers.ContainerNPCTraderSetup;
|
|
||||||
import noppes.npcs.containers.ContainerNpcItemGiver;
|
|
||||||
import noppes.npcs.containers.ContainerNpcQuestReward;
|
|
||||||
import noppes.npcs.containers.ContainerNpcQuestTypeItem;
|
|
||||||
import noppes.npcs.controllers.PlayerData;
|
import noppes.npcs.controllers.PlayerData;
|
||||||
import noppes.npcs.entity.*;
|
import noppes.npcs.entity.*;
|
||||||
|
|
||||||
@@ -369,7 +355,7 @@ public class ClientProxy extends CommonProxy {
|
|||||||
else if(gui == EnumGuiType.PlayerTransporter)
|
else if(gui == EnumGuiType.PlayerTransporter)
|
||||||
return new GuiTransportSelection(npc);
|
return new GuiTransportSelection(npc);
|
||||||
|
|
||||||
else if(gui == EnumGuiType.Script)
|
else if(gui == EnumGuiType.Script && CustomNpcs.ScriptingEnabled)
|
||||||
return new GuiScript(npc);
|
return new GuiScript(npc);
|
||||||
|
|
||||||
else if(gui == EnumGuiType.PlayerAnvil)
|
else if(gui == EnumGuiType.PlayerAnvil)
|
||||||
@@ -437,6 +423,10 @@ public class ClientProxy extends CommonProxy {
|
|||||||
|
|
||||||
else if (gui == EnumGuiType.CompanionInv)
|
else if (gui == EnumGuiType.CompanionInv)
|
||||||
return new GuiNpcCompanionInv(npc, (ContainerNPCCompanion) container);
|
return new GuiNpcCompanionInv(npc, (ContainerNPCCompanion) container);
|
||||||
|
|
||||||
|
else if (gui == EnumGuiType.CustomGui)
|
||||||
|
return new GuiCustom((ContainerCustomGui)container);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,18 @@ public class ClientTickHandler{
|
|||||||
boolean isAltPressed = Keyboard.isKeyDown(184) || Keyboard.isKeyDown(56);
|
boolean isAltPressed = Keyboard.isKeyDown(184) || Keyboard.isKeyDown(56);
|
||||||
boolean isMetaPressed = Keyboard.isKeyDown(220) || Keyboard.isKeyDown(219);
|
boolean isMetaPressed = Keyboard.isKeyDown(220) || Keyboard.isKeyDown(219);
|
||||||
boolean keyDown = Keyboard.isKeyDown(key);
|
boolean keyDown = Keyboard.isKeyDown(key);
|
||||||
NoppesUtilPlayer.sendData(EnumPlayerPacket.KeyPressed, new Object[]{Integer.valueOf(key), Boolean.valueOf(isCtrlPressed), Boolean.valueOf(isShiftPressed), Boolean.valueOf(isAltPressed), Boolean.valueOf(isMetaPressed), Boolean.valueOf(keyDown)});
|
|
||||||
|
StringBuilder keysDownString = new StringBuilder();
|
||||||
|
for(int i = 0; i < Keyboard.getKeyCount(); i++){//Creates a comma separated string of the integer IDs of held keys
|
||||||
|
if(Keyboard.isKeyDown(i)){
|
||||||
|
keysDownString.append(Integer.valueOf(i)).append(",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(keysDownString.length() > 0){//Removes last comma for later parsing
|
||||||
|
keysDownString.deleteCharAt(keysDownString.length()-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
NoppesUtilPlayer.sendData(EnumPlayerPacket.KeyPressed, new Object[]{Integer.valueOf(key), Boolean.valueOf(isCtrlPressed), Boolean.valueOf(isShiftPressed), Boolean.valueOf(isAltPressed), Boolean.valueOf(isMetaPressed), Boolean.valueOf(keyDown), keysDownString.toString()});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,21 @@ public class NoppesUtil {
|
|||||||
float alphaRate = buffer.readFloat();
|
float alphaRate = buffer.readFloat();
|
||||||
int alphaRateStart = buffer.readInt();
|
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();
|
int entityID = buffer.readInt();
|
||||||
|
|
||||||
World worldObj = Minecraft.getMinecraft().theWorld;
|
World worldObj = Minecraft.getMinecraft().theWorld;
|
||||||
@@ -113,6 +128,9 @@ public class NoppesUtil {
|
|||||||
motionX, motionY, motionZ, gravity,
|
motionX, motionY, motionZ, gravity,
|
||||||
scale1, scale2, scaleRate, scaleRateStart,
|
scale1, scale2, scaleRate, scaleRateStart,
|
||||||
alpha1, alpha2, alphaRate, alphaRateStart,
|
alpha1, alpha2, alphaRate, alphaRateStart,
|
||||||
|
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
|
||||||
|
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
|
||||||
|
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
|
||||||
maxAge
|
maxAge
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import noppes.npcs.ServerEventsHandler;
|
|||||||
import noppes.npcs.client.ClientProxy.FontContainer;
|
import noppes.npcs.client.ClientProxy.FontContainer;
|
||||||
import noppes.npcs.client.controllers.MusicController;
|
import noppes.npcs.client.controllers.MusicController;
|
||||||
import noppes.npcs.client.gui.GuiNpcMobSpawnerAdd;
|
import noppes.npcs.client.gui.GuiNpcMobSpawnerAdd;
|
||||||
|
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
|
||||||
import noppes.npcs.client.gui.player.GuiBook;
|
import noppes.npcs.client.gui.player.GuiBook;
|
||||||
import noppes.npcs.client.gui.util.GuiContainerNPCInterface;
|
import noppes.npcs.client.gui.util.GuiContainerNPCInterface;
|
||||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||||
@@ -259,5 +260,15 @@ public class PacketHandlerClient extends PacketHandlerServer{
|
|||||||
|
|
||||||
NoppesUtil.isGUIOpen(isGUIOpen);
|
NoppesUtil.isGUIOpen(isGUIOpen);
|
||||||
}
|
}
|
||||||
|
else if(type == EnumPacketClient.OVERLAY_DATA){
|
||||||
|
OverlayCustom overlayCustom = new OverlayCustom(Minecraft.getMinecraft());
|
||||||
|
overlayCustom.setOverlayData(Server.readNBT(buffer));
|
||||||
|
|
||||||
|
Client.customOverlays.put(overlayCustom.overlay.getID(),overlayCustom);
|
||||||
|
}
|
||||||
|
else if(type == EnumPacketClient.OVERLAY_CLOSE){
|
||||||
|
int id = buffer.readInt();
|
||||||
|
Client.customOverlays.remove(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,7 +99,7 @@ public class TranslateUtil {
|
|||||||
return null;
|
return null;
|
||||||
element = array.get(0);
|
element = array.get(0);
|
||||||
}
|
}
|
||||||
System.out.println(element.getAsString());
|
// System.out.println(element.getAsString());
|
||||||
return element.getAsString();
|
return element.getAsString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,6 @@ import net.minecraft.entity.Entity;
|
|||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import noppes.npcs.client.ClientProxy;
|
import noppes.npcs.client.ClientProxy;
|
||||||
import org.lwjgl.Sys;
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
public class EntityCustomFX extends EntityFX {
|
public class EntityCustomFX extends EntityFX {
|
||||||
@@ -27,10 +26,31 @@ public class EntityCustomFX extends EntityFX {
|
|||||||
public float alphaRate = 0.0F;
|
public float alphaRate = 0.0F;
|
||||||
public int alphaRateStart = 0;
|
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,
|
public EntityCustomFX(Entity entity, String directory, int HEXColor, double x, double y, double z,
|
||||||
double motionX, double motionY, double motionZ, float gravity,
|
double motionX, double motionY, double motionZ, float gravity,
|
||||||
float scale1, float scale2, float scaleRate, int scaleRateStart,
|
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 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) {
|
int age) {
|
||||||
super(entity.worldObj, x, y, z, motionX, motionY, motionZ);
|
super(entity.worldObj, x, y, z, motionX, motionY, motionZ);
|
||||||
|
|
||||||
@@ -50,6 +70,30 @@ public class EntityCustomFX extends EntityFX {
|
|||||||
if(alpha1 > alpha2)
|
if(alpha1 > alpha2)
|
||||||
this.alphaRate *= -1;
|
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;
|
particleGravity = gravity/0.04F;
|
||||||
particleMaxAge = age;
|
particleMaxAge = age;
|
||||||
|
|
||||||
@@ -75,85 +119,91 @@ public class EntityCustomFX extends EntityFX {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
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 yaw = (player.rotationYaw/180)*Math.PI;
|
|
||||||
double pitch = (player.rotationPitch/180)*Math.PI;
|
|
||||||
|
|
||||||
double angle = Minecraft.getMinecraft().theWorld.getWorldTime()%360;
|
|
||||||
double angleRad = (angle/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 translateX = 0;
|
|
||||||
double translateY = 0;
|
|
||||||
double translateZ = 0;
|
|
||||||
*/
|
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
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();
|
tessellator.draw();
|
||||||
ClientProxy.bindTexture(resource);
|
|
||||||
tessellator.startDrawingQuads();
|
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
GL11.glColor4f(1, 1, 1, 1.0F);
|
||||||
|
ClientProxy.bindTexture(resource);
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFXLayer(){
|
public int getFXLayer(){
|
||||||
|
|||||||
@@ -39,8 +39,7 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
|
|||||||
|
|
||||||
public GuiNpcMobSpawner(int i, int j, int k) {
|
public GuiNpcMobSpawner(int i, int j, int k) {
|
||||||
super();
|
super();
|
||||||
xSize = 384;
|
xSize = 354;
|
||||||
|
|
||||||
posX = i;
|
posX = i;
|
||||||
posY = j;
|
posY = j;
|
||||||
posZ = k;
|
posZ = k;
|
||||||
@@ -53,6 +52,7 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
|
|||||||
{
|
{
|
||||||
super.initGui();
|
super.initGui();
|
||||||
guiTop += 10;
|
guiTop += 10;
|
||||||
|
guiLeft += 30;
|
||||||
|
|
||||||
if(scroll == null){
|
if(scroll == null){
|
||||||
scroll = new GuiCustomScroll(this,0);
|
scroll = new GuiCustomScroll(this,0);
|
||||||
@@ -69,36 +69,37 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData{
|
|||||||
GuiMenuTopButton button;
|
GuiMenuTopButton button;
|
||||||
addTopButton(button = new GuiMenuTopButton(3,guiLeft + 4, guiTop - 17, "spawner.clones"));
|
addTopButton(button = new GuiMenuTopButton(3,guiLeft + 4, guiTop - 17, "spawner.clones"));
|
||||||
button.active = showingClones == 0;
|
button.active = showingClones == 0;
|
||||||
addTopButton(button = new GuiMenuTopButton(4, button, "spawner.entities"));
|
|
||||||
button.active = showingClones == 1;
|
|
||||||
addTopButton(button = new GuiMenuTopButton(5, button, "gui.server"));
|
addTopButton(button = new GuiMenuTopButton(5, button, "gui.server"));
|
||||||
button.active = showingClones == 2;
|
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){
|
if(showingClones == 0 || showingClones == 2){
|
||||||
|
|
||||||
addSideButton(new GuiMenuSideButton(21,guiLeft - 90, this.guiTop + 2, 90,22, "1"));
|
addSideButton(new GuiMenuSideButton(21,guiLeft - 70, this.guiTop + 2, 70,22, "1"));
|
||||||
addSideButton(new GuiMenuSideButton(22,guiLeft - 90, this.guiTop + 23, 90,22, "2"));
|
addSideButton(new GuiMenuSideButton(22,guiLeft - 70, this.guiTop + 23, 70,22, "2"));
|
||||||
addSideButton(new GuiMenuSideButton(23,guiLeft - 90, this.guiTop + 44, 90,22, "3"));
|
addSideButton(new GuiMenuSideButton(23,guiLeft - 70, this.guiTop + 44, 70,22, "3"));
|
||||||
addSideButton(new GuiMenuSideButton(24,guiLeft - 90, this.guiTop + 65, 90,22, "4"));
|
addSideButton(new GuiMenuSideButton(24,guiLeft - 70, this.guiTop + 65, 70,22, "4"));
|
||||||
addSideButton(new GuiMenuSideButton(25,guiLeft - 90, this.guiTop + 86, 90,22, "5"));
|
addSideButton(new GuiMenuSideButton(25,guiLeft - 70, this.guiTop + 86, 70,22, "5"));
|
||||||
addSideButton(new GuiMenuSideButton(26,guiLeft - 90, this.guiTop + 107, 45,22, "6"));
|
addSideButton(new GuiMenuSideButton(26,guiLeft - 70, this.guiTop + 107, 35,22, "6"));
|
||||||
addSideButton(new GuiMenuSideButton(27,guiLeft - 45, this.guiTop + 107, 45,22, "7"));
|
addSideButton(new GuiMenuSideButton(27,guiLeft - 35, this.guiTop + 107, 35,22, "7"));
|
||||||
addSideButton(new GuiMenuSideButton(28,guiLeft - 90, this.guiTop + 128, 45,22, "8"));
|
addSideButton(new GuiMenuSideButton(28,guiLeft - 70, this.guiTop + 128, 35,22, "8"));
|
||||||
addSideButton(new GuiMenuSideButton(29,guiLeft - 45, this.guiTop + 128, 45,22, "9"));
|
addSideButton(new GuiMenuSideButton(29,guiLeft - 35, this.guiTop + 128, 35,22, "9"));
|
||||||
addSideButton(new GuiMenuSideButton(30,guiLeft - 90, this.guiTop + 149, 45,22, "10"));
|
addSideButton(new GuiMenuSideButton(30,guiLeft - 70, this.guiTop + 149, 35,22, "10"));
|
||||||
addSideButton(new GuiMenuSideButton(31,guiLeft - 45, this.guiTop + 149, 45,22, "11"));
|
addSideButton(new GuiMenuSideButton(31,guiLeft - 35, this.guiTop + 149, 35,22, "11"));
|
||||||
addSideButton(new GuiMenuSideButton(32,guiLeft - 90, this.guiTop + 170, 45,22, "12"));
|
addSideButton(new GuiMenuSideButton(32,guiLeft - 70, this.guiTop + 170, 35,22, "12"));
|
||||||
addSideButton(new GuiMenuSideButton(33,guiLeft - 45, this.guiTop + 170, 45,22, "13"));
|
addSideButton(new GuiMenuSideButton(33,guiLeft - 35, this.guiTop + 170, 35,22, "13"));
|
||||||
addSideButton(new GuiMenuSideButton(34,guiLeft - 90, this.guiTop + 191, 45,22, "14"));
|
addSideButton(new GuiMenuSideButton(34,guiLeft - 70, this.guiTop + 191, 35,22, "14"));
|
||||||
addSideButton(new GuiMenuSideButton(35,guiLeft - 45, this.guiTop + 191, 45,22, "15"));
|
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;
|
getSideButton(20 + activeTab).active = true;
|
||||||
showClones();
|
showClones();
|
||||||
|
|||||||
@@ -12,11 +12,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import noppes.npcs.client.Client;
|
import noppes.npcs.client.Client;
|
||||||
import noppes.npcs.client.NoppesUtil;
|
import noppes.npcs.client.NoppesUtil;
|
||||||
import noppes.npcs.client.controllers.ClientCloneController;
|
import noppes.npcs.client.controllers.ClientCloneController;
|
||||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
import noppes.npcs.client.gui.util.*;
|
||||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
|
||||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
|
||||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
|
||||||
import noppes.npcs.client.gui.util.IGuiData;
|
|
||||||
import noppes.npcs.constants.EnumPacketServer;
|
import noppes.npcs.constants.EnumPacketServer;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
@@ -44,7 +40,8 @@ public class GuiNpcMobSpawnerAdd extends GuiNPCInterface implements GuiYesNoCall
|
|||||||
|
|
||||||
|
|
||||||
addLabel(new GuiNpcLabel(1, "Tab", guiLeft + 10, guiTop + 50));
|
addLabel(new GuiNpcLabel(1, "Tab", guiLeft + 10, guiTop + 50));
|
||||||
addButton(new GuiNpcButton(2, guiLeft + 40, guiTop + 45, 20, 20, new String[]{"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"}, tab - 1));
|
// addButton(new GuiNpcButton(2, guiLeft + 40, guiTop + 45, 20, 20, new String[]{"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"}, tab - 1));
|
||||||
|
addButton(new GuiButtonBiDirectional(2, guiLeft + 40, guiTop + 45, 60, 20, new String[]{"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"}, tab - 1));
|
||||||
|
|
||||||
addButton(new GuiNpcButton(3, guiLeft + 4, guiTop + 95, new String[]{"Client side", "Server side"}, serverSide?1:0));
|
addButton(new GuiNpcButton(3, guiLeft + 4, guiTop + 95, new String[]{"Client side", "Server side"}, serverSide?1:0));
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import net.minecraft.client.gui.GuiYesNoCallback;
|
|||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import noppes.npcs.CustomNpcs;
|
||||||
import noppes.npcs.DataScript;
|
import noppes.npcs.DataScript;
|
||||||
import noppes.npcs.NoppesStringUtils;
|
import noppes.npcs.NoppesStringUtils;
|
||||||
import noppes.npcs.client.Client;
|
import noppes.npcs.client.Client;
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ public class SubGuiNpcDialogExtra extends SubGuiInterface implements ISubGuiList
|
|||||||
addButton(new GuiNpcButtonYesNo(15, guiLeft + 120, y += 22, dialog.disableEsc));
|
addButton(new GuiNpcButtonYesNo(15, guiLeft + 120, y += 22, dialog.disableEsc));
|
||||||
addLabel(new GuiNpcLabel(15, "dialog.disableEsc", guiLeft + 4, y + 5));
|
addLabel(new GuiNpcLabel(15, "dialog.disableEsc", guiLeft + 4, y + 5));
|
||||||
|
|
||||||
|
addButton(new GuiNpcButtonYesNo(16, guiLeft + 120, y += 22, dialog.darkenScreen));
|
||||||
|
addLabel(new GuiNpcLabel(16, "Darken Screen", guiLeft + 4, y + 5));
|
||||||
|
|
||||||
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 192,98, 20, "gui.done"));
|
this.addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 192,98, 20, "gui.done"));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -76,6 +79,9 @@ public class SubGuiNpcDialogExtra extends SubGuiInterface implements ISubGuiList
|
|||||||
if(button.id == 15){
|
if(button.id == 15){
|
||||||
dialog.disableEsc = button.getValue() == 1;
|
dialog.disableEsc = button.getValue() == 1;
|
||||||
}
|
}
|
||||||
|
if(button.id == 16){
|
||||||
|
dialog.darkenScreen = button.getValue() == 1;
|
||||||
|
}
|
||||||
if(button.id == 13){
|
if(button.id == 13){
|
||||||
setSubGui(new SubGuiMailmanSendSetup(dialog.mail, getParent()));
|
setSubGui(new SubGuiMailmanSendSetup(dialog.mail, getParent()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class SubGuiNpcMeleeProperties extends SubGuiInterface implements ITextfi
|
|||||||
{
|
{
|
||||||
super.initGui();
|
super.initGui();
|
||||||
addLabel(new GuiNpcLabel(1,"stats.meleestrength", guiLeft + 5, guiTop + 15));
|
addLabel(new GuiNpcLabel(1,"stats.meleestrength", guiLeft + 5, guiTop + 15));
|
||||||
addTextField(new GuiNpcTextField(1,this, fontRendererObj, guiLeft + 85, guiTop + 10, 50, 18, stats.getAttackStrength()+""));
|
addTextField(new GuiNpcTextField(1,this, fontRendererObj, guiLeft + 85, guiTop + 10, 50, 18, String.format("%.0f", stats.getAttackStrength()) + ""));
|
||||||
getTextField(1).floatsOnly = true;
|
getTextField(1).floatsOnly = true;
|
||||||
getTextField(1).setMinMaxDefaultFloat(0,Float.MAX_VALUE,5);
|
getTextField(1).setMinMaxDefaultFloat(0,Float.MAX_VALUE,5);
|
||||||
addLabel(new GuiNpcLabel(2,"stats.meleerange", guiLeft + 5, guiTop + 45));
|
addLabel(new GuiNpcLabel(2,"stats.meleerange", guiLeft + 5, guiTop + 45));
|
||||||
|
|||||||
@@ -42,6 +42,16 @@ public class SubGuiNpcMovement extends SubGuiInterface implements ITextfieldList
|
|||||||
addTextField(new GuiNpcTextField(19,this, guiLeft + 80, y + 155, 40, 20, ai.flyGravity + ""));
|
addTextField(new GuiNpcTextField(19,this, guiLeft + 80, y + 155, 40, 20, ai.flyGravity + ""));
|
||||||
getTextField(19).doublesOnly = true;
|
getTextField(19).doublesOnly = true;
|
||||||
getTextField(19).setMinMaxDefaultDouble(0.0D,1.0D,0.0D);
|
getTextField(19).setMinMaxDefaultDouble(0.0D,1.0D,0.0D);
|
||||||
|
|
||||||
|
this.addLabel(new GuiNpcLabel(20, "Limit Height", guiLeft + 150, y + 116));
|
||||||
|
addButton(new GuiNpcButton(20, guiLeft + 210, y + 110, 40, 20, new String[]{"gui.no","gui.yes"}, ai.hasFlyLimit?1:0));
|
||||||
|
|
||||||
|
if(ai.hasFlyLimit) {
|
||||||
|
this.addLabel(new GuiNpcLabel(21, "Height", guiLeft + 150, y + 140));
|
||||||
|
addTextField(new GuiNpcTextField(21, this, guiLeft + 185, y + 135, 40, 20, ai.flyHeightLimit + ""));
|
||||||
|
getTextField(21).integersOnly = true;
|
||||||
|
getTextField(21).setMinMaxDefaultDouble(0.0D, Double.MAX_VALUE, 1.0D);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ai.movingType == EnumMovingType.Wandering){
|
if(ai.movingType == EnumMovingType.Wandering){
|
||||||
@@ -159,10 +169,12 @@ public class SubGuiNpcMovement extends SubGuiInterface implements ITextfieldList
|
|||||||
else if (button.id == 15) {
|
else if (button.id == 15) {
|
||||||
ai.movementType = button.getValue();
|
ai.movementType = button.getValue();
|
||||||
initGui();
|
initGui();
|
||||||
|
} else if (button.id == 20) {
|
||||||
|
ai.hasFlyLimit = button.getValue() == 1;
|
||||||
|
initGui();
|
||||||
|
} else if (button.id == 66) {
|
||||||
|
close();
|
||||||
}
|
}
|
||||||
else if(button.id == 66){
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -191,6 +203,9 @@ public class SubGuiNpcMovement extends SubGuiInterface implements ITextfieldList
|
|||||||
else if(textfield.id == 19){
|
else if(textfield.id == 19){
|
||||||
ai.flyGravity = textfield.getDouble();
|
ai.flyGravity = textfield.getDouble();
|
||||||
}
|
}
|
||||||
|
else if(textfield.id == 21){
|
||||||
|
ai.flyHeightLimit = textfield.getInteger();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -28,7 +28,7 @@ public class SubGuiNpcProjectiles extends SubGuiInterface implements ITextfieldL
|
|||||||
{
|
{
|
||||||
super.initGui();
|
super.initGui();
|
||||||
addLabel(new GuiNpcLabel(1,"enchantment.arrowDamage", guiLeft + 5, guiTop + 15));
|
addLabel(new GuiNpcLabel(1,"enchantment.arrowDamage", guiLeft + 5, guiTop + 15));
|
||||||
addTextField(new GuiNpcTextField(1,this, fontRendererObj, guiLeft + 45, guiTop + 10, 50, 18, stats.pDamage+""));
|
addTextField(new GuiNpcTextField(1,this, fontRendererObj, guiLeft + 45, guiTop + 10, 50, 18, String.format("%.0f", stats.pDamage) +""));
|
||||||
getTextField(1).setFloatsOnly();
|
getTextField(1).setFloatsOnly();
|
||||||
getTextField(1).setMinMaxDefaultFloat(0, Float.MAX_VALUE, 5);
|
getTextField(1).setMinMaxDefaultFloat(0, Float.MAX_VALUE, 5);
|
||||||
addLabel(new GuiNpcLabel(2,"enchantment.arrowKnockback", guiLeft + 110, guiTop + 15));
|
addLabel(new GuiNpcLabel(2,"enchantment.arrowKnockback", guiLeft + 110, guiTop + 15));
|
||||||
|
|||||||
@@ -0,0 +1,910 @@
|
|||||||
|
package noppes.npcs.client.gui.custom;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.nbt.NBTTagString;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import noppes.npcs.client.Client;
|
||||||
|
import noppes.npcs.client.gui.custom.components.*;
|
||||||
|
import noppes.npcs.client.gui.custom.interfaces.IClickListener;
|
||||||
|
import noppes.npcs.client.gui.custom.interfaces.IDataHolder;
|
||||||
|
import noppes.npcs.client.gui.custom.interfaces.IGuiComponent;
|
||||||
|
import noppes.npcs.client.gui.util.GuiCustomScroll;
|
||||||
|
import noppes.npcs.client.gui.util.ICustomScrollListener;
|
||||||
|
import noppes.npcs.client.gui.util.IGuiData;
|
||||||
|
import noppes.npcs.constants.EnumPacketServer;
|
||||||
|
import noppes.npcs.containers.ContainerCustomGui;
|
||||||
|
import noppes.npcs.scripted.gui.*;
|
||||||
|
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
import org.lwjgl.opengl.GL12;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiData {
|
||||||
|
ScriptGui gui;
|
||||||
|
int xSize;
|
||||||
|
int ySize;
|
||||||
|
public static int guiLeft;
|
||||||
|
public static int guiTop;
|
||||||
|
ResourceLocation background;
|
||||||
|
public String[] hoverText;
|
||||||
|
Map<Integer, IGuiComponent> components = new HashMap();
|
||||||
|
List<IClickListener> clickListeners = new ArrayList();
|
||||||
|
List<CustomGuiTextField> keyListeners = new ArrayList();
|
||||||
|
List<IDataHolder> dataHolders = new ArrayList();
|
||||||
|
|
||||||
|
public Container inventorySlots;
|
||||||
|
private Slot theSlot;
|
||||||
|
private Slot clickedSlot;
|
||||||
|
private boolean isRightMouseClick;
|
||||||
|
private ItemStack draggedStack;
|
||||||
|
private int field_147011_y;
|
||||||
|
private int field_147010_z;
|
||||||
|
private Slot returningStackDestSlot;
|
||||||
|
private long returningStackTime;
|
||||||
|
private ItemStack returningStack;
|
||||||
|
private Slot field_146985_D;
|
||||||
|
private long field_146986_E;
|
||||||
|
protected final Set field_147008_s = new HashSet();
|
||||||
|
protected boolean field_147007_t;
|
||||||
|
private int field_146987_F;
|
||||||
|
private int field_146988_G;
|
||||||
|
private boolean field_146995_H;
|
||||||
|
private int field_146996_I;
|
||||||
|
private long field_146997_J;
|
||||||
|
private Slot field_146998_K;
|
||||||
|
private int field_146992_L;
|
||||||
|
private boolean field_146993_M;
|
||||||
|
private ItemStack field_146994_N;
|
||||||
|
|
||||||
|
public GuiCustom(ContainerCustomGui container) {
|
||||||
|
this.inventorySlots = container;
|
||||||
|
this.field_146995_H = true;
|
||||||
|
this.allowUserInput = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
this.mc.thePlayer.openContainer = this.inventorySlots;
|
||||||
|
if (this.gui != null) {
|
||||||
|
guiLeft = (this.width - this.xSize)/2;
|
||||||
|
guiTop = (this.height - this.ySize)/2;
|
||||||
|
this.components.clear();
|
||||||
|
this.clickListeners.clear();
|
||||||
|
this.keyListeners.clear();
|
||||||
|
this.dataHolders.clear();
|
||||||
|
Iterator var1 = this.gui.getComponents().iterator();
|
||||||
|
|
||||||
|
while(var1.hasNext()) {
|
||||||
|
ICustomGuiComponent c = (ICustomGuiComponent)var1.next();
|
||||||
|
this.addComponent(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateScreen() {
|
||||||
|
super.updateScreen();
|
||||||
|
|
||||||
|
Iterator var1 = this.dataHolders.iterator();
|
||||||
|
|
||||||
|
while(var1.hasNext()) {
|
||||||
|
IDataHolder component = (IDataHolder)var1.next();
|
||||||
|
if (component instanceof GuiTextField) {
|
||||||
|
((GuiTextField)component).updateCursorCounter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.mc.thePlayer.isEntityAlive() || this.mc.thePlayer.isDead)
|
||||||
|
{
|
||||||
|
this.mc.thePlayer.closeScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||||
|
this.hoverText = null;
|
||||||
|
//this.drawDefaultBackground();
|
||||||
|
if (this.background != null) {
|
||||||
|
this.drawBackgroundTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator var4 = this.components.values().iterator();
|
||||||
|
|
||||||
|
while(var4.hasNext()) {
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||||
|
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||||
|
|
||||||
|
IGuiComponent component = (IGuiComponent)var4.next();
|
||||||
|
component.onRender(this.mc, mouseX, mouseY, Mouse.getDWheel(), partialTicks);
|
||||||
|
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hoverText != null) {
|
||||||
|
this.func_146283_a(Arrays.asList(this.hoverText), mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
drawScreenSuper(mouseX, mouseY, partialTicks);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawScreenSuper(int mouseX, int mouseY, float partialTicks)
|
||||||
|
{
|
||||||
|
//this.drawDefaultBackground();
|
||||||
|
int k = this.guiLeft;
|
||||||
|
int l = this.guiTop;
|
||||||
|
//this.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
|
||||||
|
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||||
|
RenderHelper.disableStandardItemLighting();
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||||
|
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||||
|
RenderHelper.enableGUIStandardItemLighting();
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslatef((float)k, (float)l, 0.0F);
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||||
|
this.theSlot = null;
|
||||||
|
short short1 = 240;
|
||||||
|
short short2 = 240;
|
||||||
|
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)short1 / 1.0F, (float)short2 / 1.0F);
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
int k1;
|
||||||
|
|
||||||
|
for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1)
|
||||||
|
{
|
||||||
|
Slot slot = (Slot)this.inventorySlots.inventorySlots.get(i1);
|
||||||
|
this.drawSlot(slot);
|
||||||
|
|
||||||
|
if (this.isMouseOverSlot(slot, mouseX, mouseY) && slot.func_111238_b())
|
||||||
|
{
|
||||||
|
this.theSlot = slot;
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||||
|
int j1 = slot.xDisplayPosition;
|
||||||
|
k1 = slot.yDisplayPosition;
|
||||||
|
GL11.glColorMask(true, true, true, false);
|
||||||
|
this.drawGradientRect(j1, k1, j1 + 16, k1 + 16, -2130706433, -2130706433);
|
||||||
|
GL11.glColorMask(true, true, true, true);
|
||||||
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Forge: Force lighting to be disabled as there are some issue where lighting would
|
||||||
|
//incorrectly be applied based on items that are in the inventory.
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
//this.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||||
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
InventoryPlayer inventoryplayer = this.mc.thePlayer.inventory;
|
||||||
|
ItemStack itemstack = this.draggedStack == null ? inventoryplayer.getItemStack() : this.draggedStack;
|
||||||
|
|
||||||
|
if (itemstack != null)
|
||||||
|
{
|
||||||
|
byte b0 = 8;
|
||||||
|
k1 = this.draggedStack == null ? 8 : 16;
|
||||||
|
String s = null;
|
||||||
|
|
||||||
|
if (this.draggedStack != null && this.isRightMouseClick)
|
||||||
|
{
|
||||||
|
itemstack = itemstack.copy();
|
||||||
|
itemstack.stackSize = MathHelper.ceiling_float_int((float)itemstack.stackSize / 2.0F);
|
||||||
|
}
|
||||||
|
else if (this.field_147007_t && this.field_147008_s.size() > 1)
|
||||||
|
{
|
||||||
|
itemstack = itemstack.copy();
|
||||||
|
itemstack.stackSize = this.field_146996_I;
|
||||||
|
|
||||||
|
if (itemstack.stackSize == 0)
|
||||||
|
{
|
||||||
|
s = "" + EnumChatFormatting.YELLOW + "0";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.drawItemStack(itemstack, mouseX - k - b0, mouseY - l - k1, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.returningStack != null)
|
||||||
|
{
|
||||||
|
float f1 = (float)(Minecraft.getSystemTime() - this.returningStackTime) / 100.0F;
|
||||||
|
|
||||||
|
if (f1 >= 1.0F)
|
||||||
|
{
|
||||||
|
f1 = 1.0F;
|
||||||
|
this.returningStack = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
k1 = this.returningStackDestSlot.xDisplayPosition - this.field_147011_y;
|
||||||
|
int j2 = this.returningStackDestSlot.yDisplayPosition - this.field_147010_z;
|
||||||
|
int l1 = this.field_147011_y + (int)((float)k1 * f1);
|
||||||
|
int i2 = this.field_147010_z + (int)((float)j2 * f1);
|
||||||
|
this.drawItemStack(this.returningStack, l1, i2, (String)null);
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
if (inventoryplayer.getItemStack() == null && this.theSlot != null && this.theSlot.getHasStack())
|
||||||
|
{
|
||||||
|
ItemStack itemstack1 = this.theSlot.getStack();
|
||||||
|
this.renderToolTip(itemstack1, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||||
|
RenderHelper.enableStandardItemLighting();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawItemStack(ItemStack p_146982_1_, int p_146982_2_, int p_146982_3_, String p_146982_4_)
|
||||||
|
{
|
||||||
|
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
|
||||||
|
this.zLevel = 200.0F;
|
||||||
|
itemRender.zLevel = 200.0F;
|
||||||
|
FontRenderer font = null;
|
||||||
|
if (p_146982_1_ != null) font = p_146982_1_.getItem().getFontRenderer(p_146982_1_);
|
||||||
|
if (font == null) font = fontRendererObj;
|
||||||
|
itemRender.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), p_146982_1_, p_146982_2_, p_146982_3_);
|
||||||
|
itemRender.renderItemOverlayIntoGUI(font, this.mc.getTextureManager(), p_146982_1_, p_146982_2_, p_146982_3_ - (this.draggedStack == null ? 0 : 8), p_146982_4_);
|
||||||
|
this.zLevel = 0.0F;
|
||||||
|
itemRender.zLevel = 0.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isMouseOverSlot(Slot slot, int posX, int posY)
|
||||||
|
{
|
||||||
|
return this.isPointInRegion(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, posX, posY);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isPointInRegion(int slotDisplayX, int slotDisplayY, int slotSizeX, int slotSizeY, int posX, int posY)
|
||||||
|
{
|
||||||
|
int k1 = this.guiLeft;
|
||||||
|
int l1 = this.guiTop;
|
||||||
|
posX -= k1;
|
||||||
|
posY -= l1;
|
||||||
|
return posX >= slotDisplayX - 1 && posX < slotDisplayX + slotSizeX + 1 && posY >= slotDisplayY - 1 && posY < slotDisplayY + slotSizeY + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawSlot(Slot p_146977_1_)
|
||||||
|
{
|
||||||
|
int i = p_146977_1_.xDisplayPosition;
|
||||||
|
int j = p_146977_1_.yDisplayPosition;
|
||||||
|
ItemStack itemstack = p_146977_1_.getStack();
|
||||||
|
boolean flag = false;
|
||||||
|
boolean flag1 = p_146977_1_ == this.clickedSlot && this.draggedStack != null && !this.isRightMouseClick;
|
||||||
|
ItemStack itemstack1 = this.mc.thePlayer.inventory.getItemStack();
|
||||||
|
String s = null;
|
||||||
|
|
||||||
|
if (p_146977_1_ == this.clickedSlot && this.draggedStack != null && this.isRightMouseClick && itemstack != null)
|
||||||
|
{
|
||||||
|
itemstack = itemstack.copy();
|
||||||
|
itemstack.stackSize /= 2;
|
||||||
|
}
|
||||||
|
else if (this.field_147007_t && this.field_147008_s.contains(p_146977_1_) && itemstack1 != null)
|
||||||
|
{
|
||||||
|
if (this.field_147008_s.size() == 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Container.func_94527_a(p_146977_1_, itemstack1, true) && this.inventorySlots.canDragIntoSlot(p_146977_1_))
|
||||||
|
{
|
||||||
|
itemstack = itemstack1.copy();
|
||||||
|
flag = true;
|
||||||
|
Container.func_94525_a(this.field_147008_s, this.field_146987_F, itemstack, p_146977_1_.getStack() == null ? 0 : p_146977_1_.getStack().stackSize);
|
||||||
|
|
||||||
|
if (itemstack.stackSize > itemstack.getMaxStackSize())
|
||||||
|
{
|
||||||
|
s = EnumChatFormatting.YELLOW + "" + itemstack.getMaxStackSize();
|
||||||
|
itemstack.stackSize = itemstack.getMaxStackSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemstack.stackSize > p_146977_1_.getSlotStackLimit())
|
||||||
|
{
|
||||||
|
s = EnumChatFormatting.YELLOW + "" + p_146977_1_.getSlotStackLimit();
|
||||||
|
itemstack.stackSize = p_146977_1_.getSlotStackLimit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.field_147008_s.remove(p_146977_1_);
|
||||||
|
this.func_146980_g();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.zLevel = 100.0F;
|
||||||
|
itemRender.zLevel = 100.0F;
|
||||||
|
|
||||||
|
if (itemstack == null)
|
||||||
|
{
|
||||||
|
IIcon iicon = p_146977_1_.getBackgroundIconIndex();
|
||||||
|
|
||||||
|
if (iicon != null)
|
||||||
|
{
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glEnable(GL11.GL_BLEND); // Forge: Blending needs to be enabled for this.
|
||||||
|
this.mc.getTextureManager().bindTexture(TextureMap.locationItemsTexture);
|
||||||
|
this.drawTexturedModelRectFromIcon(i, j, iicon, 16, 16);
|
||||||
|
GL11.glDisable(GL11.GL_BLEND); // Forge: And clean that up
|
||||||
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
flag1 = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!flag1)
|
||||||
|
{
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
drawRect(i, j, i + 16, j + 16, -2130706433);
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||||
|
itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), itemstack, i, j);
|
||||||
|
itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), itemstack, i, j, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
itemRender.zLevel = 0.0F;
|
||||||
|
this.zLevel = 0.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void func_146980_g()
|
||||||
|
{
|
||||||
|
ItemStack itemstack = this.mc.thePlayer.inventory.getItemStack();
|
||||||
|
|
||||||
|
if (itemstack != null && this.field_147007_t)
|
||||||
|
{
|
||||||
|
this.field_146996_I = itemstack.stackSize;
|
||||||
|
ItemStack itemstack1;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (Iterator iterator = this.field_147008_s.iterator(); iterator.hasNext(); this.field_146996_I -= itemstack1.stackSize - i)
|
||||||
|
{
|
||||||
|
Slot slot = (Slot)iterator.next();
|
||||||
|
itemstack1 = itemstack.copy();
|
||||||
|
i = slot.getStack() == null ? 0 : slot.getStack().stackSize;
|
||||||
|
Container.func_94525_a(this.field_147008_s, this.field_146987_F, itemstack1, i);
|
||||||
|
|
||||||
|
if (itemstack1.stackSize > itemstack1.getMaxStackSize())
|
||||||
|
{
|
||||||
|
itemstack1.stackSize = itemstack1.getMaxStackSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemstack1.stackSize > slot.getSlotStackLimit())
|
||||||
|
{
|
||||||
|
itemstack1.stackSize = slot.getSlotStackLimit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawBackgroundTexture() {
|
||||||
|
this.mc.getTextureManager().bindTexture(this.background);
|
||||||
|
this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, this.xSize, this.ySize);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addComponent(ICustomGuiComponent component) {
|
||||||
|
ScriptGuiComponent c = (ScriptGuiComponent)component;
|
||||||
|
switch(c.getType()) {
|
||||||
|
case 0:
|
||||||
|
CustomGuiButton button = CustomGuiButton.fromComponent((ScriptGuiButton)component);
|
||||||
|
button.setParent(this);
|
||||||
|
this.components.put(button.getID(), button);
|
||||||
|
this.addClickListener(button);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
CustomGuiLabel lbl = CustomGuiLabel.fromComponent((ScriptGuiLabel)component);
|
||||||
|
lbl.setParent(this);
|
||||||
|
this.components.put(lbl.getID(), lbl);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
CustomGuiTexturedRect rect = CustomGuiTexturedRect.fromComponent((ScriptGuiTexturedRect)component);
|
||||||
|
rect.setParent(this);
|
||||||
|
this.components.put(rect.getID(), rect);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
CustomGuiTextField textField = CustomGuiTextField.fromComponent((ScriptGuiTextField)component);
|
||||||
|
textField.setParent(this);
|
||||||
|
this.components.put(textField.getID(), textField);
|
||||||
|
this.addDataHolder(textField);
|
||||||
|
this.addClickListener(textField);
|
||||||
|
this.addKeyListener(textField);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
CustomGuiScrollComponent scroll = new CustomGuiScrollComponent(this.mc, this, component.getID(), ((ScriptGuiScroll)component).isMultiSelect());
|
||||||
|
scroll.fromComponent((ScriptGuiScroll)component);
|
||||||
|
scroll.setParent(this);
|
||||||
|
this.components.put(scroll.getID(), scroll);
|
||||||
|
this.addDataHolder(scroll);
|
||||||
|
this.addClickListener(scroll);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
CustomGuiLine line = CustomGuiLine.fromComponent((ScriptGuiLine) component);
|
||||||
|
this.components.put(line.getID(),line);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void actionPerformed(GuiButton button) {
|
||||||
|
super.actionPerformed(button);
|
||||||
|
Client.sendData(EnumPacketServer.CustomGuiButton, new Object[]{this.updateGui().toNBT(), button.id});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void buttonClick(CustomGuiButton button) {
|
||||||
|
Client.sendData(EnumPacketServer.CustomGuiButton, new Object[]{this.updateGui().toNBT(), button.id});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void slotChange(CustomGuiSlot slot) {
|
||||||
|
Client.sendData(EnumPacketServer.CustomGuiSlotChange, new Object[]{this.updateGui().toNBT(), slot.slotNumber});
|
||||||
|
}
|
||||||
|
|
||||||
|
public String prevScrollClicked = null;
|
||||||
|
public void customScrollClicked(int i, int j, int k, GuiCustomScroll scroll) {
|
||||||
|
Client.sendData(EnumPacketServer.CustomGuiScrollClick, new Object[]{this.updateGui().toNBT(), scroll.id, scroll.selected, this.getScrollSelection((CustomGuiScrollComponent)scroll), false});
|
||||||
|
if(Integer.toString(scroll.selected).equals(prevScrollClicked)){
|
||||||
|
Client.sendData(EnumPacketServer.CustomGuiScrollClick, new Object[]{this.updateGui().toNBT(), scroll.id, scroll.selected, this.getScrollSelection((CustomGuiScrollComponent)scroll), true});
|
||||||
|
}
|
||||||
|
prevScrollClicked = Integer.toString(scroll.selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onGuiClosed() {
|
||||||
|
if (this.gui != null) {
|
||||||
|
Client.sendData(EnumPacketServer.CustomGuiClose, new Object[]{this.updateGui().toNBT()});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.mc.thePlayer != null)
|
||||||
|
{
|
||||||
|
this.inventorySlots.onContainerClosed(this.mc.thePlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onTextFieldUnfocused(CustomGuiTextField textField){
|
||||||
|
Client.sendData(EnumPacketServer.CustomGuiUnfocused, new Object[]{this.updateGui().toNBT(), textField.getID()});
|
||||||
|
}
|
||||||
|
|
||||||
|
ScriptGui updateGui() {
|
||||||
|
Iterator var1 = this.dataHolders.iterator();
|
||||||
|
|
||||||
|
while(var1.hasNext()) {
|
||||||
|
IDataHolder component = (IDataHolder)var1.next();
|
||||||
|
this.gui.updateComponent(component.toComponent());
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.gui;
|
||||||
|
}
|
||||||
|
|
||||||
|
NBTTagCompound getScrollSelection(CustomGuiScrollComponent scroll) {
|
||||||
|
NBTTagList list = new NBTTagList();
|
||||||
|
if (scroll.multiSelect) {
|
||||||
|
Iterator var3 = scroll.getSelectedList().iterator();
|
||||||
|
|
||||||
|
while(var3.hasNext()) {
|
||||||
|
String s = (String)var3.next();
|
||||||
|
list.appendTag(new NBTTagString(s));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
list.appendTag(new NBTTagString(scroll.getSelected()));
|
||||||
|
}
|
||||||
|
|
||||||
|
NBTTagCompound selection = new NBTTagCompound();
|
||||||
|
selection.setTag("selection", list);
|
||||||
|
return selection;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void keyTyped(char typedChar, int keyCode) {
|
||||||
|
if (keyCode == 1)
|
||||||
|
{
|
||||||
|
this.mc.thePlayer.closeScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.checkHotbarKeys(keyCode);
|
||||||
|
|
||||||
|
if (this.theSlot != null && this.theSlot.getHasStack())
|
||||||
|
{
|
||||||
|
if (keyCode == this.mc.gameSettings.keyBindPickBlock.getKeyCode())
|
||||||
|
{
|
||||||
|
this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, 0, 3);
|
||||||
|
}
|
||||||
|
else if (keyCode == this.mc.gameSettings.keyBindDrop.getKeyCode())
|
||||||
|
{
|
||||||
|
this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, isCtrlKeyDown() ? 1 : 0, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator var3 = this.keyListeners.iterator();
|
||||||
|
|
||||||
|
while(var3.hasNext()) {
|
||||||
|
CustomGuiTextField listener = (CustomGuiTextField) var3.next();
|
||||||
|
listener.keyTyped(typedChar, keyCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.mc.gameSettings.keyBindInventory.getKeyCode() != keyCode && !this.mc.gameSettings.keyBindInventory.getIsKeyPressed()) {
|
||||||
|
super.keyTyped(typedChar, keyCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||||
|
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
|
||||||
|
boolean flag = mouseButton == this.mc.gameSettings.keyBindPickBlock.getKeyCode() + 100;
|
||||||
|
Slot slot = this.getSlotAtPosition(mouseX, mouseY);
|
||||||
|
long l = Minecraft.getSystemTime();
|
||||||
|
this.field_146993_M = this.field_146998_K == slot && l - this.field_146997_J < 250L && this.field_146992_L == mouseButton;
|
||||||
|
this.field_146995_H = false;
|
||||||
|
|
||||||
|
if (mouseButton == 0 || mouseButton == 1 || flag) {
|
||||||
|
boolean flag1 = true;
|
||||||
|
int k1 = -1;
|
||||||
|
|
||||||
|
for (int i = 0; i < this.inventorySlots.inventorySlots.size(); ++i)
|
||||||
|
{
|
||||||
|
Slot invSlot = (Slot)this.inventorySlots.inventorySlots.get(i);
|
||||||
|
|
||||||
|
if (invSlot.equals(slot))
|
||||||
|
{
|
||||||
|
flag1 = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slot != null) {
|
||||||
|
k1 = slot.slotNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag1) {
|
||||||
|
k1 = -999;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.mc.gameSettings.touchscreen && flag1 && this.mc.thePlayer.inventory.getItemStack() == null) {
|
||||||
|
this.mc.displayGuiScreen((GuiScreen) null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (k1 != -1) {
|
||||||
|
if (this.mc.gameSettings.touchscreen) {
|
||||||
|
if (slot != null && slot.getHasStack()) {
|
||||||
|
this.clickedSlot = slot;
|
||||||
|
this.draggedStack = null;
|
||||||
|
this.isRightMouseClick = mouseButton == 1;
|
||||||
|
} else {
|
||||||
|
this.clickedSlot = null;
|
||||||
|
}
|
||||||
|
} else if (!this.field_147007_t) {
|
||||||
|
if (this.mc.thePlayer.inventory.getItemStack() == null) {
|
||||||
|
if (mouseButton == this.mc.gameSettings.keyBindPickBlock.getKeyCode() + 100) {
|
||||||
|
this.handleMouseClick(slot, k1, mouseButton, 3);
|
||||||
|
} else {
|
||||||
|
boolean flag2 = k1 != -999 && (Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54));
|
||||||
|
byte b0 = 0;
|
||||||
|
|
||||||
|
if (flag2) {
|
||||||
|
this.field_146994_N = slot != null && slot.getHasStack() ? slot.getStack() : null;
|
||||||
|
b0 = 1;
|
||||||
|
} else if (k1 == -999) {
|
||||||
|
b0 = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.handleMouseClick(slot, k1, mouseButton, b0);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field_146995_H = true;
|
||||||
|
} else {
|
||||||
|
this.field_147007_t = true;
|
||||||
|
this.field_146988_G = mouseButton;
|
||||||
|
this.field_147008_s.clear();
|
||||||
|
|
||||||
|
if (mouseButton == 0) {
|
||||||
|
this.field_146987_F = 0;
|
||||||
|
} else if (mouseButton == 1) {
|
||||||
|
this.field_146987_F = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field_146998_K = slot;
|
||||||
|
this.field_146997_J = l;
|
||||||
|
this.field_146992_L = mouseButton;
|
||||||
|
|
||||||
|
Iterator var4 = this.clickListeners.iterator();
|
||||||
|
|
||||||
|
while(var4.hasNext()) {
|
||||||
|
IClickListener listener = (IClickListener)var4.next();
|
||||||
|
listener.mouseClicked(this, mouseX, mouseY, mouseButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean doesGuiPauseGame() {
|
||||||
|
return this.gui == null || this.gui.getDoesPauseGame();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addDataHolder(IDataHolder component) {
|
||||||
|
this.dataHolders.add(component);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addKeyListener(CustomGuiTextField component) {
|
||||||
|
this.keyListeners.add(component);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addClickListener(IClickListener component) {
|
||||||
|
this.clickListeners.add(component);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGuiData(NBTTagCompound compound) {
|
||||||
|
Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
ScriptGui gui = (ScriptGui)(new ScriptGui()).fromNBT(compound);
|
||||||
|
((ContainerCustomGui)this.inventorySlots).setGui(gui, mc.thePlayer);
|
||||||
|
this.gui = gui;
|
||||||
|
this.xSize = gui.getWidth();
|
||||||
|
this.ySize = gui.getHeight();
|
||||||
|
if (!gui.getBackgroundTexture().isEmpty()) {
|
||||||
|
this.background = new ResourceLocation(gui.getBackgroundTexture());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.initGui();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is what controls the hotbar shortcut check when you press a number key when hovering a stack.
|
||||||
|
*/
|
||||||
|
protected boolean checkHotbarKeys(int p_146983_1_)
|
||||||
|
{
|
||||||
|
if (this.mc.thePlayer.inventory.getItemStack() == null && this.theSlot != null)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 9; ++j)
|
||||||
|
{
|
||||||
|
if (p_146983_1_ == this.mc.gameSettings.keyBindsHotbar[j].getKeyCode())
|
||||||
|
{
|
||||||
|
this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, j, 2);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void handleMouseClick(Slot slot, int index, int p_146984_3_, int p_146984_4_)
|
||||||
|
{
|
||||||
|
if (slot != null)
|
||||||
|
{
|
||||||
|
index = slot.slotNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mc.playerController.windowClick(this.inventorySlots.windowId, index, p_146984_3_, p_146984_4_, this.mc.thePlayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void mouseMovedOrUp(int p_146286_1_, int p_146286_2_, int p_146286_3_)
|
||||||
|
{
|
||||||
|
super.mouseMovedOrUp(p_146286_1_, p_146286_2_, p_146286_3_); //Forge, Call parent to release buttons
|
||||||
|
Slot slot = this.getSlotAtPosition(p_146286_1_, p_146286_2_);
|
||||||
|
int l = this.guiLeft;
|
||||||
|
int i1 = this.guiTop;
|
||||||
|
boolean flag = p_146286_1_ < l || p_146286_2_ < i1 || p_146286_1_ >= l + this.xSize || p_146286_2_ >= i1 + this.ySize;
|
||||||
|
int j1 = -1;
|
||||||
|
|
||||||
|
if (slot != null)
|
||||||
|
{
|
||||||
|
j1 = slot.slotNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
j1 = -999;
|
||||||
|
}
|
||||||
|
|
||||||
|
Slot slot1;
|
||||||
|
Iterator iterator;
|
||||||
|
|
||||||
|
if (this.field_146993_M && slot != null && p_146286_3_ == 0 && this.inventorySlots.func_94530_a((ItemStack)null, slot))
|
||||||
|
{
|
||||||
|
if (isShiftKeyDown())
|
||||||
|
{
|
||||||
|
if (slot != null && slot.inventory != null && this.field_146994_N != null)
|
||||||
|
{
|
||||||
|
iterator = this.inventorySlots.inventorySlots.iterator();
|
||||||
|
|
||||||
|
while (iterator.hasNext())
|
||||||
|
{
|
||||||
|
slot1 = (Slot)iterator.next();
|
||||||
|
|
||||||
|
if (slot1 != null && slot1.canTakeStack(this.mc.thePlayer) && slot1.getHasStack() && slot1.inventory == slot.inventory && Container.func_94527_a(slot1, this.field_146994_N, true))
|
||||||
|
{
|
||||||
|
this.handleMouseClick(slot1, slot1.slotNumber, p_146286_3_, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.handleMouseClick(slot, j1, p_146286_3_, 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field_146993_M = false;
|
||||||
|
this.field_146997_J = 0L;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (this.field_147007_t && this.field_146988_G != p_146286_3_)
|
||||||
|
{
|
||||||
|
this.field_147007_t = false;
|
||||||
|
this.field_147008_s.clear();
|
||||||
|
this.field_146995_H = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.field_146995_H)
|
||||||
|
{
|
||||||
|
this.field_146995_H = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean flag1;
|
||||||
|
|
||||||
|
if (this.clickedSlot != null && this.mc.gameSettings.touchscreen)
|
||||||
|
{
|
||||||
|
if (p_146286_3_ == 0 || p_146286_3_ == 1)
|
||||||
|
{
|
||||||
|
if (this.draggedStack == null && slot != this.clickedSlot)
|
||||||
|
{
|
||||||
|
this.draggedStack = this.clickedSlot.getStack();
|
||||||
|
}
|
||||||
|
|
||||||
|
flag1 = Container.func_94527_a(slot, this.draggedStack, false);
|
||||||
|
|
||||||
|
if (j1 != -1 && this.draggedStack != null && flag1)
|
||||||
|
{
|
||||||
|
this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, p_146286_3_, 0);
|
||||||
|
this.handleMouseClick(slot, j1, 0, 0);
|
||||||
|
|
||||||
|
if (this.mc.thePlayer.inventory.getItemStack() != null)
|
||||||
|
{
|
||||||
|
this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, p_146286_3_, 0);
|
||||||
|
this.field_147011_y = p_146286_1_ - l;
|
||||||
|
this.field_147010_z = p_146286_2_ - i1;
|
||||||
|
this.returningStackDestSlot = this.clickedSlot;
|
||||||
|
this.returningStack = this.draggedStack;
|
||||||
|
this.returningStackTime = Minecraft.getSystemTime();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.returningStack = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (this.draggedStack != null)
|
||||||
|
{
|
||||||
|
this.field_147011_y = p_146286_1_ - l;
|
||||||
|
this.field_147010_z = p_146286_2_ - i1;
|
||||||
|
this.returningStackDestSlot = this.clickedSlot;
|
||||||
|
this.returningStack = this.draggedStack;
|
||||||
|
this.returningStackTime = Minecraft.getSystemTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.draggedStack = null;
|
||||||
|
this.clickedSlot = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (this.field_147007_t && !this.field_147008_s.isEmpty())
|
||||||
|
{
|
||||||
|
this.handleMouseClick((Slot)null, -999, Container.func_94534_d(0, this.field_146987_F), 5);
|
||||||
|
iterator = this.field_147008_s.iterator();
|
||||||
|
|
||||||
|
while (iterator.hasNext())
|
||||||
|
{
|
||||||
|
slot1 = (Slot)iterator.next();
|
||||||
|
this.handleMouseClick(slot1, slot1.slotNumber, Container.func_94534_d(1, this.field_146987_F), 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.handleMouseClick((Slot)null, -999, Container.func_94534_d(2, this.field_146987_F), 5);
|
||||||
|
}
|
||||||
|
else if (this.mc.thePlayer.inventory.getItemStack() != null)
|
||||||
|
{
|
||||||
|
if (p_146286_3_ == this.mc.gameSettings.keyBindPickBlock.getKeyCode() + 100)
|
||||||
|
{
|
||||||
|
this.handleMouseClick(slot, j1, p_146286_3_, 3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flag1 = j1 != -999 && (Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54));
|
||||||
|
|
||||||
|
if (flag1)
|
||||||
|
{
|
||||||
|
this.field_146994_N = slot != null && slot.getHasStack() ? slot.getStack() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.handleMouseClick(slot, j1, p_146286_3_, flag1 ? 1 : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.mc.thePlayer.inventory.getItemStack() == null)
|
||||||
|
{
|
||||||
|
this.field_146997_J = 0L;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field_147007_t = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Slot getSlotAtPosition(int posX, int posY)
|
||||||
|
{
|
||||||
|
for (int k = 0; k < this.inventorySlots.inventorySlots.size(); ++k)
|
||||||
|
{
|
||||||
|
Slot slot = (Slot)this.inventorySlots.inventorySlots.get(k);
|
||||||
|
|
||||||
|
if (this.isMouseOverSlot(slot, posX, posY))
|
||||||
|
{
|
||||||
|
return slot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void mouseClickMove(int p_146273_1_, int p_146273_2_, int p_146273_3_, long p_146273_4_)
|
||||||
|
{
|
||||||
|
Slot slot = this.getSlotAtPosition(p_146273_1_, p_146273_2_);
|
||||||
|
ItemStack itemstack = this.mc.thePlayer.inventory.getItemStack();
|
||||||
|
|
||||||
|
if (this.clickedSlot != null && this.mc.gameSettings.touchscreen)
|
||||||
|
{
|
||||||
|
if (p_146273_3_ == 0 || p_146273_3_ == 1)
|
||||||
|
{
|
||||||
|
if (this.draggedStack == null)
|
||||||
|
{
|
||||||
|
if (slot != this.clickedSlot)
|
||||||
|
{
|
||||||
|
this.draggedStack = this.clickedSlot.getStack().copy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (this.draggedStack.stackSize > 1 && slot != null && Container.func_94527_a(slot, this.draggedStack, false))
|
||||||
|
{
|
||||||
|
long i1 = Minecraft.getSystemTime();
|
||||||
|
|
||||||
|
if (this.field_146985_D == slot)
|
||||||
|
{
|
||||||
|
if (i1 - this.field_146986_E > 500L)
|
||||||
|
{
|
||||||
|
this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, 0, 0);
|
||||||
|
this.handleMouseClick(slot, slot.slotNumber, 1, 0);
|
||||||
|
this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, 0, 0);
|
||||||
|
this.field_146986_E = i1 + 750L;
|
||||||
|
--this.draggedStack.stackSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.field_146985_D = slot;
|
||||||
|
this.field_146986_E = i1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (this.field_147007_t && slot != null && itemstack != null && itemstack.stackSize > this.field_147008_s.size() && Container.func_94527_a(slot, itemstack, true) && slot.isItemValid(itemstack) && this.inventorySlots.canDragIntoSlot(slot))
|
||||||
|
{
|
||||||
|
this.field_147008_s.add(slot);
|
||||||
|
this.func_146980_g();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,168 @@
|
|||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by FernFlower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package noppes.npcs.client.gui.custom.components;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.renderer.texture.ITextureObject;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureManager;
|
||||||
|
import net.minecraft.client.resources.SkinManager;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import noppes.npcs.client.ImageDownloadAlt;
|
||||||
|
import noppes.npcs.client.gui.custom.GuiCustom;
|
||||||
|
import noppes.npcs.client.gui.custom.interfaces.IClickListener;
|
||||||
|
import noppes.npcs.client.renderer.ImageBufferDownloadAlt;
|
||||||
|
import noppes.npcs.scripted.gui.ScriptGuiButton;
|
||||||
|
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
public class CustomGuiButton extends GuiButton implements IClickListener {
|
||||||
|
GuiCustom parent;
|
||||||
|
ResourceLocation texture;
|
||||||
|
public int textureX;
|
||||||
|
public int textureY;
|
||||||
|
boolean field_146123_n;
|
||||||
|
String label;
|
||||||
|
String[] hoverText;
|
||||||
|
|
||||||
|
int color;
|
||||||
|
float alpha;
|
||||||
|
|
||||||
|
public CustomGuiButton(int id, String buttonText, int x, int y) {
|
||||||
|
super(id, GuiCustom.guiLeft + x, GuiCustom.guiTop + y, buttonText);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomGuiButton(int id, String buttonText, int x, int y, int width, int height) {
|
||||||
|
super(id, GuiCustom.guiLeft + x, GuiCustom.guiTop + y, width, height, buttonText);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomGuiButton(int buttonId, String buttonText, int x, int y, int width, int height, String texture) {
|
||||||
|
this(buttonId, buttonText, x, y, width, height, texture, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomGuiButton(int buttonId, String buttonText, int x, int y, int width, int height, String texture, int textureX, int textureY) {
|
||||||
|
this(buttonId, buttonText, x, y, width, height);
|
||||||
|
this.textureX = textureX;
|
||||||
|
this.textureY = textureY;
|
||||||
|
this.label = buttonText;
|
||||||
|
this.texture = new ResourceLocation(texture);
|
||||||
|
|
||||||
|
if(texture.startsWith("https://")){
|
||||||
|
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||||
|
ITextureObject object = new ImageDownloadAlt(null, texture, SkinManager.field_152793_a, new ImageBufferDownloadAlt(false));
|
||||||
|
texturemanager.loadTexture(this.texture, object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent(GuiCustom parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CustomGuiButton fromComponent(ScriptGuiButton component) {
|
||||||
|
CustomGuiButton btn;
|
||||||
|
if (component.hasTexture()) {
|
||||||
|
if (component.getTextureX() >= 0 && component.getTextureY() >= 0) {
|
||||||
|
btn = new CustomGuiButton(component.getID(), component.getLabel(), component.getPosX(), component.getPosY(), component.getWidth(), component.getHeight(), component.getTexture(), component.getTextureX(), component.getTextureY());
|
||||||
|
} else {
|
||||||
|
btn = new CustomGuiButton(component.getID(), component.getLabel(), component.getPosX(), component.getPosY(), component.getWidth(), component.getHeight(), component.getTexture());
|
||||||
|
}
|
||||||
|
} else if (component.getWidth() >= 0 && component.getHeight() >= 0) {
|
||||||
|
btn = new CustomGuiButton(component.getID(), component.getLabel(), component.getPosX(), component.getPosY(), component.getWidth(), component.getHeight());
|
||||||
|
} else {
|
||||||
|
btn = new CustomGuiButton(component.getID(), component.getLabel(), component.getPosX(), component.getPosY());
|
||||||
|
}
|
||||||
|
|
||||||
|
btn.color = component.getColor();
|
||||||
|
btn.alpha = component.getAlpha();
|
||||||
|
|
||||||
|
if (component.hasHoverText()) {
|
||||||
|
btn.hoverText = component.getHoverText();
|
||||||
|
}
|
||||||
|
|
||||||
|
return btn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getID() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRender(Minecraft mc, int mouseX, int mouseY, int mouseWheel, float partialTicks) {
|
||||||
|
//GL11.func_179094_E();
|
||||||
|
//GL11.func_179109_b(0.0F, 0.0F, (float)this.id);
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
float red = (color >> 16 & 255) / 255f;
|
||||||
|
float green = (color >> 8 & 255) / 255f;
|
||||||
|
float blue = (color & 255) / 255f;
|
||||||
|
GL11.glColor4f(red,green,blue,this.alpha);
|
||||||
|
|
||||||
|
GL11.glTranslatef(0.0F, 0.0F, (float)this.id);
|
||||||
|
FontRenderer fontRenderer = mc.fontRenderer;
|
||||||
|
int i;
|
||||||
|
if (this.texture == null) {
|
||||||
|
mc.getTextureManager().bindTexture(buttonTextures);
|
||||||
|
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||||
|
i = this.getHoverState(this.field_146123_n);
|
||||||
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
//GL11.func_187428_a(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO);
|
||||||
|
//GL11.func_187401_a(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||||
|
this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + i * 20, this.width / 2, this.height);
|
||||||
|
this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
|
||||||
|
this.mouseDragged(mc, mouseX, mouseY);
|
||||||
|
int j = 14737632;
|
||||||
|
if (this.packedFGColour != 0) {
|
||||||
|
j = this.packedFGColour;
|
||||||
|
} else if (!this.enabled) {
|
||||||
|
j = 10526880;
|
||||||
|
} else if (this.field_146123_n) {
|
||||||
|
j = 16777120;
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glTranslated(0.0D, 0.0D, 0.1D);
|
||||||
|
this.drawCenteredString(fontRenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, j);
|
||||||
|
} else {
|
||||||
|
mc.getTextureManager().bindTexture(this.texture);
|
||||||
|
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||||
|
i = this.hoverState(this.field_146123_n);
|
||||||
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
//GL11.func_187428_a(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO);
|
||||||
|
//GL11.func_187401_a(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||||
|
this.drawTexturedModalRect(this.xPosition, this.yPosition, this.textureX, this.textureY + i * this.height, this.width, this.height);
|
||||||
|
this.drawCenteredString(fontRenderer, this.label, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, this.color);
|
||||||
|
if (this.field_146123_n && this.hoverText != null && this.hoverText.length > 0) {
|
||||||
|
this.parent.hoverText = this.hoverText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICustomGuiComponent toComponent() {
|
||||||
|
ScriptGuiButton component = new ScriptGuiButton(this.id, this.label, this.xPosition, this.yPosition, this.width, this.height, this.texture.toString(), this.textureX, this.textureY);
|
||||||
|
component.setHoverText(this.hoverText);
|
||||||
|
component.setColor(this.color);
|
||||||
|
component.setAlpha(this.alpha);
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int hoverState(boolean mouseOver) {
|
||||||
|
int i = 0;
|
||||||
|
if (mouseOver) {
|
||||||
|
i = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean mouseClicked(GuiCustom gui, int mouseX, int mouseY, int mouseButton) {
|
||||||
|
if (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height) {
|
||||||
|
//Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147673_a(SoundEvents.field_187909_gi, 1.0F));
|
||||||
|
gui.buttonClick(this);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,570 @@
|
|||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by FernFlower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package noppes.npcs.client.gui.custom.components;
|
||||||
|
|
||||||
|
import com.ibm.icu.text.ArabicShaping;
|
||||||
|
import com.ibm.icu.text.ArabicShapingException;
|
||||||
|
import com.ibm.icu.text.Bidi;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
|
import net.minecraft.client.gui.GuiLabel;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import noppes.npcs.client.gui.custom.GuiCustom;
|
||||||
|
import noppes.npcs.client.gui.custom.interfaces.IGuiComponent;
|
||||||
|
import noppes.npcs.scripted.gui.ScriptGuiLabel;
|
||||||
|
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class CustomGuiLabel extends Gui implements IGuiComponent {
|
||||||
|
int x, y, width, height;
|
||||||
|
GuiCustom parent;
|
||||||
|
String fullLabel;
|
||||||
|
String[] hoverText;
|
||||||
|
float scale;
|
||||||
|
int id;
|
||||||
|
int border = 2;
|
||||||
|
boolean labelBgEnabled = true;
|
||||||
|
boolean labelShadowEnabled = false;
|
||||||
|
|
||||||
|
int color;
|
||||||
|
float alpha;
|
||||||
|
float rotation;
|
||||||
|
|
||||||
|
protected int field_146167_a;
|
||||||
|
protected int field_146161_f;
|
||||||
|
public int field_146162_g;
|
||||||
|
public int field_146174_h;
|
||||||
|
|
||||||
|
private boolean randomStyle = false;
|
||||||
|
private boolean boldStyle = false;
|
||||||
|
private boolean italicStyle = false;
|
||||||
|
private boolean underlineStyle = false;
|
||||||
|
private boolean strikethroughStyle = false;
|
||||||
|
private boolean bidiFlag = false;
|
||||||
|
private boolean unicodeFlag = false;
|
||||||
|
|
||||||
|
private static final ResourceLocation[] unicodePageLocations = new ResourceLocation[256];
|
||||||
|
protected final ResourceLocation locationFontTexture;
|
||||||
|
protected int[] charWidth = new int[256];
|
||||||
|
protected byte[] glyphWidth = new byte[65536];
|
||||||
|
private final int[] colorCode = new int[32];
|
||||||
|
|
||||||
|
|
||||||
|
private float red;
|
||||||
|
private float green;
|
||||||
|
private float blue;
|
||||||
|
|
||||||
|
private float posX;
|
||||||
|
private float posY;
|
||||||
|
|
||||||
|
public CustomGuiLabel(int id, String fullLabel, int x, int y, int width, int height, boolean shadow){
|
||||||
|
this.id = id;
|
||||||
|
this.fullLabel = fullLabel;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
this.labelShadowEnabled = shadow;
|
||||||
|
|
||||||
|
locationFontTexture = new ResourceLocation("textures/font/ascii.png");
|
||||||
|
readFontTexture();
|
||||||
|
readGlyphSizes();
|
||||||
|
for (int i = 0; i < 32; ++i)
|
||||||
|
{
|
||||||
|
int j = (i >> 3 & 1) * 85;
|
||||||
|
int k = (i >> 2 & 1) * 170 + j;
|
||||||
|
int l = (i >> 1 & 1) * 170 + j;
|
||||||
|
int i1 = (i >> 0 & 1) * 170 + j;
|
||||||
|
|
||||||
|
if (i == 6)
|
||||||
|
{
|
||||||
|
k += 85;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Minecraft.getMinecraft().gameSettings.anaglyph)
|
||||||
|
{
|
||||||
|
int j1 = (k * 30 + l * 59 + i1 * 11) / 100;
|
||||||
|
int k1 = (k * 30 + l * 70) / 100;
|
||||||
|
int l1 = (k * 30 + i1 * 70) / 100;
|
||||||
|
k = j1;
|
||||||
|
l = k1;
|
||||||
|
i1 = l1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i >= 16)
|
||||||
|
{
|
||||||
|
k /= 4;
|
||||||
|
l /= 4;
|
||||||
|
i1 /= 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.colorCode[i] = (k & 255) << 16 | (l & 255) << 8 | i1 & 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent(GuiCustom parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
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.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getID() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScale(float scale) {
|
||||||
|
this.scale = scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CustomGuiLabel fromComponent(ScriptGuiLabel component) {
|
||||||
|
CustomGuiLabel lbl = new CustomGuiLabel(component.getID(), component.getText(), GuiCustom.guiLeft + component.getPosX(), GuiCustom.guiTop + component.getPosY(), component.getWidth(), component.getHeight(), component.hasShadow());
|
||||||
|
lbl.scale = 1.0F;
|
||||||
|
lbl.color = component.getColor();
|
||||||
|
lbl.setScale(component.getScale());
|
||||||
|
if (component.hasHoverText()) {
|
||||||
|
lbl.hoverText = component.getHoverText();
|
||||||
|
}
|
||||||
|
lbl.labelShadowEnabled = component.hasShadow();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICustomGuiComponent toComponent() {
|
||||||
|
ScriptGuiLabel component = new ScriptGuiLabel(this.id, this.fullLabel, this.field_146162_g, this.field_146174_h, this.field_146167_a, this.field_146161_f, this.color);
|
||||||
|
component.setHoverText(this.hoverText);
|
||||||
|
component.enableShadow(this.labelShadowEnabled);
|
||||||
|
component.setColor(this.color);
|
||||||
|
component.setAlpha(this.alpha);
|
||||||
|
component.setRotation(this.rotation);
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawLabel()
|
||||||
|
{
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
red = (color >> 16 & 255) / 255f;
|
||||||
|
green = (color >> 8 & 255) / 255f;
|
||||||
|
blue = (color & 255) / 255f;
|
||||||
|
|
||||||
|
GL11.glTranslatef(this.x,this.y,0.0F);
|
||||||
|
GL11.glRotated(rotation,0.0D,0.0D,1.0D);
|
||||||
|
GL11.glScalef(this.scale, this.scale, this.scale);
|
||||||
|
this.drawString(fullLabel, 0, 0, this.color, this.labelShadowEnabled);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int drawString(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_, boolean p_85187_5_)
|
||||||
|
{
|
||||||
|
this.resetStyles();
|
||||||
|
int l;
|
||||||
|
|
||||||
|
if (p_85187_5_)
|
||||||
|
{
|
||||||
|
l = this.renderString(p_85187_1_, p_85187_2_ + 1, p_85187_3_ + 1, p_85187_4_, true);
|
||||||
|
l = Math.max(l, this.renderString(p_85187_1_, p_85187_2_, p_85187_3_, p_85187_4_, false));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
l = this.renderString(p_85187_1_, p_85187_2_, p_85187_3_, p_85187_4_, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetStyles()
|
||||||
|
{
|
||||||
|
this.randomStyle = false;
|
||||||
|
this.boldStyle = false;
|
||||||
|
this.italicStyle = false;
|
||||||
|
this.underlineStyle = false;
|
||||||
|
this.strikethroughStyle = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int renderString(String p_78258_1_, int p_78258_2_, int p_78258_3_, int p_78258_4_, boolean p_78258_5_)
|
||||||
|
{
|
||||||
|
if (p_78258_1_ == null)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (this.bidiFlag)
|
||||||
|
{
|
||||||
|
p_78258_1_ = this.bidiReorder(p_78258_1_);
|
||||||
|
}
|
||||||
|
|
||||||
|
setColor(this.red, this.green, this.blue, this.alpha);
|
||||||
|
this.posX = (float)p_78258_2_;
|
||||||
|
this.posY = (float)p_78258_3_;
|
||||||
|
this.renderStringAtPos(p_78258_1_, p_78258_5_);
|
||||||
|
return (int)this.posX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderStringAtPos(String p_78255_1_, boolean p_78255_2_)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < p_78255_1_.length(); ++i)
|
||||||
|
{
|
||||||
|
char c0 = p_78255_1_.charAt(i);
|
||||||
|
int j;
|
||||||
|
int k;
|
||||||
|
|
||||||
|
if (c0 == 38 && i + 1 < p_78255_1_.length())
|
||||||
|
{
|
||||||
|
j = "0123456789abcdefklmnor".indexOf(p_78255_1_.toLowerCase().charAt(i + 1));
|
||||||
|
|
||||||
|
if(j < 16){
|
||||||
|
this.randomStyle = false;
|
||||||
|
this.boldStyle = false;
|
||||||
|
this.strikethroughStyle = false;
|
||||||
|
this.underlineStyle = false;
|
||||||
|
this.italicStyle = false;
|
||||||
|
|
||||||
|
if (j < 0 || j > 15)
|
||||||
|
{
|
||||||
|
j = 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_78255_2_)
|
||||||
|
{
|
||||||
|
j += 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
k = this.colorCode[j];
|
||||||
|
setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha);
|
||||||
|
}
|
||||||
|
else if (j == 16)
|
||||||
|
{
|
||||||
|
this.randomStyle = true;
|
||||||
|
}
|
||||||
|
else if (j == 17)
|
||||||
|
{
|
||||||
|
this.boldStyle = true;
|
||||||
|
}
|
||||||
|
else if (j == 18)
|
||||||
|
{
|
||||||
|
this.strikethroughStyle = true;
|
||||||
|
}
|
||||||
|
else if (j == 19)
|
||||||
|
{
|
||||||
|
this.underlineStyle = true;
|
||||||
|
}
|
||||||
|
else if (j == 20)
|
||||||
|
{
|
||||||
|
this.italicStyle = true;
|
||||||
|
}
|
||||||
|
else if (j == 21)
|
||||||
|
{
|
||||||
|
this.randomStyle = false;
|
||||||
|
this.boldStyle = false;
|
||||||
|
this.strikethroughStyle = false;
|
||||||
|
this.underlineStyle = false;
|
||||||
|
this.italicStyle = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
j = "\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000".indexOf(c0);
|
||||||
|
|
||||||
|
if (this.randomStyle && j != -1)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
k = Minecraft.getMinecraft().fontRenderer.fontRandom.nextInt(this.charWidth.length);
|
||||||
|
}
|
||||||
|
while (this.charWidth[j] != this.charWidth[k]);
|
||||||
|
|
||||||
|
j = k;
|
||||||
|
}
|
||||||
|
|
||||||
|
float f1 = this.unicodeFlag ? 0.5F : 1.0F;
|
||||||
|
boolean flag1 = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_;
|
||||||
|
|
||||||
|
if (flag1)
|
||||||
|
{
|
||||||
|
this.posX -= f1;
|
||||||
|
this.posY -= f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
float f = this.renderCharAtPos(j, c0, this.italicStyle);
|
||||||
|
|
||||||
|
if (flag1)
|
||||||
|
{
|
||||||
|
this.posX += f1;
|
||||||
|
this.posY += f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.boldStyle)
|
||||||
|
{
|
||||||
|
this.posX += f1;
|
||||||
|
|
||||||
|
if (flag1)
|
||||||
|
{
|
||||||
|
this.posX -= f1;
|
||||||
|
this.posY -= f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.renderCharAtPos(j, c0, this.italicStyle);
|
||||||
|
this.posX -= f1;
|
||||||
|
|
||||||
|
if (flag1)
|
||||||
|
{
|
||||||
|
this.posX += f1;
|
||||||
|
this.posY += f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
++f;
|
||||||
|
}
|
||||||
|
|
||||||
|
doDraw(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doDraw(float f)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
Tessellator tessellator;
|
||||||
|
|
||||||
|
if (this.strikethroughStyle)
|
||||||
|
{
|
||||||
|
tessellator = Tessellator.instance;
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.addVertex((double)this.posX, (double)(this.posY + (float)(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2)), 0.0D);
|
||||||
|
tessellator.addVertex((double)(this.posX + f), (double)(this.posY + (float)(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2)), 0.0D);
|
||||||
|
tessellator.addVertex((double)(this.posX + f), (double)(this.posY + (float)(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2) - 1.0F), 0.0D);
|
||||||
|
tessellator.addVertex((double)this.posX, (double)(this.posY + (float)(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2) - 1.0F), 0.0D);
|
||||||
|
tessellator.draw();
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.underlineStyle)
|
||||||
|
{
|
||||||
|
tessellator = Tessellator.instance;
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
int l = this.underlineStyle ? -1 : 0;
|
||||||
|
tessellator.addVertex((double)(this.posX + (float)l), (double)(this.posY + (float)Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT), 0.0D);
|
||||||
|
tessellator.addVertex((double)(this.posX + f), (double)(this.posY + (float)Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT), 0.0D);
|
||||||
|
tessellator.addVertex((double)(this.posX + f), (double)(this.posY + (float)Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT - 1.0F), 0.0D);
|
||||||
|
tessellator.addVertex((double)(this.posX + (float)l), (double)(this.posY + (float)Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT - 1.0F), 0.0D);
|
||||||
|
tessellator.draw();
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.posX += (float)((int)f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private float renderCharAtPos(int p_78278_1_, char p_78278_2_, boolean p_78278_3_)
|
||||||
|
{
|
||||||
|
return p_78278_2_ == 32 ? 4.0F : ("\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000".indexOf(p_78278_2_) != -1 && !this.unicodeFlag ? this.renderDefaultChar(p_78278_1_, p_78278_3_) : this.renderUnicodeChar(p_78278_2_, p_78278_3_));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected float renderDefaultChar(int p_78266_1_, boolean p_78266_2_)
|
||||||
|
{
|
||||||
|
float f = (float)(p_78266_1_ % 16 * 8);
|
||||||
|
float f1 = (float)(p_78266_1_ / 16 * 8);
|
||||||
|
float f2 = p_78266_2_ ? 1.0F : 0.0F;
|
||||||
|
bindTexture(this.locationFontTexture);
|
||||||
|
float f3 = (float)this.charWidth[p_78266_1_] - 0.01F;
|
||||||
|
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
|
||||||
|
GL11.glTexCoord2f(f / 128.0F, f1 / 128.0F);
|
||||||
|
GL11.glVertex3f(this.posX + f2, this.posY, 0.0F);
|
||||||
|
GL11.glTexCoord2f(f / 128.0F, (f1 + 7.99F) / 128.0F);
|
||||||
|
GL11.glVertex3f(this.posX - f2, this.posY + 7.99F, 0.0F);
|
||||||
|
GL11.glTexCoord2f((f + f3 - 1.0F) / 128.0F, f1 / 128.0F);
|
||||||
|
GL11.glVertex3f(this.posX + f3 - 1.0F + f2, this.posY, 0.0F);
|
||||||
|
GL11.glTexCoord2f((f + f3 - 1.0F) / 128.0F, (f1 + 7.99F) / 128.0F);
|
||||||
|
GL11.glVertex3f(this.posX + f3 - 1.0F - f2, this.posY + 7.99F, 0.0F);
|
||||||
|
GL11.glEnd();
|
||||||
|
return (float)this.charWidth[p_78266_1_];
|
||||||
|
}
|
||||||
|
|
||||||
|
private ResourceLocation getUnicodePageLocation(int p_111271_1_)
|
||||||
|
{
|
||||||
|
if (unicodePageLocations[p_111271_1_] == null)
|
||||||
|
{
|
||||||
|
unicodePageLocations[p_111271_1_] = new ResourceLocation(String.format("textures/font/unicode_page_%02x.png", new Object[] {Integer.valueOf(p_111271_1_)}));
|
||||||
|
}
|
||||||
|
|
||||||
|
return unicodePageLocations[p_111271_1_];
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadGlyphTexture(int p_78257_1_)
|
||||||
|
{
|
||||||
|
bindTexture(this.getUnicodePageLocation(p_78257_1_));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render a single Unicode character at current (posX,posY) location using one of the /font/glyph_XX.png files...
|
||||||
|
*/
|
||||||
|
protected float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_)
|
||||||
|
{
|
||||||
|
if (this.glyphWidth[p_78277_1_] == 0)
|
||||||
|
{
|
||||||
|
return 0.0F;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int i = p_78277_1_ / 256;
|
||||||
|
this.loadGlyphTexture(i);
|
||||||
|
int j = this.glyphWidth[p_78277_1_] >>> 4;
|
||||||
|
int k = this.glyphWidth[p_78277_1_] & 15;
|
||||||
|
float f = (float)j;
|
||||||
|
float f1 = (float)(k + 1);
|
||||||
|
float f2 = (float)(p_78277_1_ % 16 * 16) + f;
|
||||||
|
float f3 = (float)((p_78277_1_ & 255) / 16 * 16);
|
||||||
|
float f4 = f1 - f - 0.02F;
|
||||||
|
float f5 = p_78277_2_ ? 1.0F : 0.0F;
|
||||||
|
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
|
||||||
|
GL11.glTexCoord2f(f2 / 256.0F, f3 / 256.0F);
|
||||||
|
GL11.glVertex3f(this.posX + f5, this.posY, 0.0F);
|
||||||
|
GL11.glTexCoord2f(f2 / 256.0F, (f3 + 15.98F) / 256.0F);
|
||||||
|
GL11.glVertex3f(this.posX - f5, this.posY + 7.99F, 0.0F);
|
||||||
|
GL11.glTexCoord2f((f2 + f4) / 256.0F, f3 / 256.0F);
|
||||||
|
GL11.glVertex3f(this.posX + f4 / 2.0F + f5, this.posY, 0.0F);
|
||||||
|
GL11.glTexCoord2f((f2 + f4) / 256.0F, (f3 + 15.98F) / 256.0F);
|
||||||
|
GL11.glVertex3f(this.posX + f4 / 2.0F - f5, this.posY + 7.99F, 0.0F);
|
||||||
|
GL11.glEnd();
|
||||||
|
return (f1 - f) / 2.0F + 1.0F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setColor(float r, float g, float b, float a)
|
||||||
|
{
|
||||||
|
GL11.glColor4f(r, g, b, a);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void bindTexture(ResourceLocation location)
|
||||||
|
{
|
||||||
|
Minecraft.getMinecraft().renderEngine.bindTexture(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readFontTexture()
|
||||||
|
{
|
||||||
|
BufferedImage bufferedimage;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bufferedimage = ImageIO.read(getResourceInputStream(this.locationFontTexture));
|
||||||
|
}
|
||||||
|
catch (IOException ioexception)
|
||||||
|
{
|
||||||
|
throw new RuntimeException(ioexception);
|
||||||
|
}
|
||||||
|
|
||||||
|
int i = bufferedimage.getWidth();
|
||||||
|
int j = bufferedimage.getHeight();
|
||||||
|
int[] aint = new int[i * j];
|
||||||
|
bufferedimage.getRGB(0, 0, i, j, aint, 0, i);
|
||||||
|
int k = j / 16;
|
||||||
|
int l = i / 16;
|
||||||
|
byte b0 = 1;
|
||||||
|
float f = 8.0F / (float)l;
|
||||||
|
int i1 = 0;
|
||||||
|
|
||||||
|
while (i1 < 256)
|
||||||
|
{
|
||||||
|
int j1 = i1 % 16;
|
||||||
|
int k1 = i1 / 16;
|
||||||
|
|
||||||
|
if (i1 == 32)
|
||||||
|
{
|
||||||
|
this.charWidth[i1] = 3 + b0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int l1 = l - 1;
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (l1 >= 0)
|
||||||
|
{
|
||||||
|
int i2 = j1 * l + l1;
|
||||||
|
boolean flag = true;
|
||||||
|
|
||||||
|
for (int j2 = 0; j2 < k && flag; ++j2)
|
||||||
|
{
|
||||||
|
int k2 = (k1 * l + j2) * i;
|
||||||
|
|
||||||
|
if ((aint[i2 + k2] >> 24 & 255) != 0)
|
||||||
|
{
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
--l1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
++l1;
|
||||||
|
this.charWidth[i1] = (int)(0.5D + (double)((float)l1 * f)) + b0;
|
||||||
|
++i1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readGlyphSizes()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
InputStream inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin"));
|
||||||
|
inputstream.read(this.glyphWidth);
|
||||||
|
}
|
||||||
|
catch (IOException ioexception)
|
||||||
|
{
|
||||||
|
throw new RuntimeException(ioexception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected InputStream getResourceInputStream(ResourceLocation location) throws IOException
|
||||||
|
{
|
||||||
|
return Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String bidiReorder(String p_147647_1_)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Bidi bidi = new Bidi((new ArabicShaping(8)).shape(p_147647_1_), 127);
|
||||||
|
bidi.setReorderingMode(0);
|
||||||
|
return bidi.writeReordered(2);
|
||||||
|
}
|
||||||
|
catch (ArabicShapingException arabicshapingexception)
|
||||||
|
{
|
||||||
|
return p_147647_1_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package noppes.npcs.client.gui.custom.components;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import noppes.npcs.client.gui.custom.GuiCustom;
|
||||||
|
import noppes.npcs.client.gui.custom.interfaces.IGuiComponent;
|
||||||
|
import noppes.npcs.scripted.gui.ScriptGuiLine;
|
||||||
|
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA;
|
||||||
|
import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
|
||||||
|
|
||||||
|
public class CustomGuiLine extends Gui implements IGuiComponent {
|
||||||
|
int id;
|
||||||
|
GuiCustom parent;
|
||||||
|
int x1;
|
||||||
|
int y1;
|
||||||
|
int x2;
|
||||||
|
int y2;
|
||||||
|
int color;
|
||||||
|
float alpha;
|
||||||
|
float rotation;
|
||||||
|
int thickness;
|
||||||
|
|
||||||
|
public CustomGuiLine(int id, int x1, int y1, int x2, int y2, int color, int thickness){
|
||||||
|
this.id = id;
|
||||||
|
this.x1 = x1;
|
||||||
|
this.y1 = y1;
|
||||||
|
this.x2 = x2;
|
||||||
|
this.y2 = y2;
|
||||||
|
this.color = color;
|
||||||
|
this.thickness = thickness;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent(GuiCustom parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getID() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRender(Minecraft mc, int mouseX, int mouseY, int mouseWheel, float partialTicks) {
|
||||||
|
double distance = Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2));
|
||||||
|
|
||||||
|
mc.getTextureManager().bindTexture(new ResourceLocation("customnpcs:textures/gui/misc.png"));
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
float red = (color >> 16 & 255) / 255f;
|
||||||
|
float green = (color >> 8 & 255) / 255f;
|
||||||
|
float blue = (color & 255) / 255f;
|
||||||
|
GL11.glColor4f(red,green,blue,this.alpha);
|
||||||
|
|
||||||
|
GL11.glTranslatef(GuiCustom.guiLeft+this.x1,GuiCustom.guiTop+this.y1,0.0F);
|
||||||
|
GL11.glRotated(-Math.toDegrees(Math.atan2(x2-x1,y2-y1)),0.0F,0.0F,1.0F);
|
||||||
|
GL11.glRotated(rotation,0.0D,0.0D,1.0D);
|
||||||
|
GL11.glScaled(thickness, distance,0.0D);
|
||||||
|
this.drawTexturedModalRect(0,0,0,0, 1, 1);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICustomGuiComponent toComponent() {
|
||||||
|
ScriptGuiLine line = new ScriptGuiLine(this.id, this.x1,this.y1,this.x2,this.y2,this.color,this.thickness);
|
||||||
|
line.setColor(this.color);
|
||||||
|
line.setAlpha(this.alpha);
|
||||||
|
line.setRotation(this.rotation);
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CustomGuiLine fromComponent(ScriptGuiLine component) {
|
||||||
|
CustomGuiLine line = new CustomGuiLine(component.getID(), component.getX1(), component.getY1(), component.getX2(), component.getY2(), component.getColor(), component.getThickness());
|
||||||
|
line.color = component.getColor();
|
||||||
|
line.alpha = component.getAlpha();
|
||||||
|
line.rotation = component.getRotation();
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by FernFlower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package noppes.npcs.client.gui.custom.components;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.nbt.NBTTagString;
|
||||||
|
import noppes.npcs.client.gui.custom.GuiCustom;
|
||||||
|
import noppes.npcs.client.gui.custom.interfaces.IClickListener;
|
||||||
|
import noppes.npcs.client.gui.custom.interfaces.IDataHolder;
|
||||||
|
import noppes.npcs.client.gui.util.GuiCustomScroll;
|
||||||
|
import noppes.npcs.scripted.gui.ScriptGuiScroll;
|
||||||
|
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
public class CustomGuiScrollComponent extends GuiCustomScroll implements IDataHolder, IClickListener {
|
||||||
|
GuiCustom parent;
|
||||||
|
String[] hoverText;
|
||||||
|
public boolean multiSelect = false;
|
||||||
|
|
||||||
|
int color;
|
||||||
|
float alpha;
|
||||||
|
|
||||||
|
public CustomGuiScrollComponent(Minecraft mc, GuiScreen parent, int id) {
|
||||||
|
super(parent, id);
|
||||||
|
this.mc = mc;
|
||||||
|
this.fontRendererObj = mc.fontRenderer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomGuiScrollComponent(Minecraft mc, GuiScreen parent, int id, boolean multiSelect) {
|
||||||
|
super(parent, id, multiSelect);
|
||||||
|
this.mc = mc;
|
||||||
|
this.fontRendererObj = mc.fontRenderer;
|
||||||
|
this.multiSelect = multiSelect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent(GuiCustom parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getID() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRender(Minecraft mc, int mouseX, int mouseY, int mouseWheel, float partialTicks) {
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
float red = (color >> 16 & 255) / 255f;
|
||||||
|
float green = (color >> 8 & 255) / 255f;
|
||||||
|
float blue = (color & 255) / 255f;
|
||||||
|
GL11.glColor4f(red,green,blue,this.alpha);
|
||||||
|
|
||||||
|
GL11.glTranslatef(0.0F, 0.0F, (float)this.id);
|
||||||
|
boolean hovered = mouseX >= this.guiLeft && mouseY >= this.guiTop && mouseX < this.guiLeft + this.xSize && mouseY < this.guiTop + this.ySize;
|
||||||
|
super.drawScreen(mouseX, mouseY, partialTicks, mouseWheel);
|
||||||
|
if (hovered && this.hoverText != null && this.hoverText.length > 0) {
|
||||||
|
this.parent.hoverText = this.hoverText;
|
||||||
|
}
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean mouseClicked(GuiCustom gui, int mouseX, int mouseY, int mouseButton) {
|
||||||
|
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
return this.isMouseOver(mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fromComponent(ScriptGuiScroll component) {
|
||||||
|
this.guiLeft = GuiCustom.guiLeft + component.getPosX();
|
||||||
|
this.guiTop = GuiCustom.guiTop + component.getPosY();
|
||||||
|
this.setSize(component.getWidth(), component.getHeight());
|
||||||
|
this.setUnsortedList(Arrays.asList(component.getList()));
|
||||||
|
if (component.getDefaultSelection() >= 0) {
|
||||||
|
int defaultSelect = component.getDefaultSelection();
|
||||||
|
if (defaultSelect < this.getList().size()) {
|
||||||
|
this.selected = defaultSelect;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (component.hasHoverText()) {
|
||||||
|
this.hoverText = component.getHoverText();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.color = component.getColor();
|
||||||
|
this.alpha = component.getAlpha();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICustomGuiComponent toComponent() {
|
||||||
|
ScriptGuiScroll component = new ScriptGuiScroll(this.id, this.guiLeft - GuiCustom.guiLeft, this.guiTop - GuiCustom.guiTop, this.width, this.height, (String[])this.getList().toArray(new String[0]));
|
||||||
|
component.setHoverText(this.hoverText);
|
||||||
|
component.setColor(color);
|
||||||
|
component.setAlpha(alpha);
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagCompound toNBT() {
|
||||||
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
|
nbt.setInteger("id", this.id);
|
||||||
|
if (!this.getSelectedList().isEmpty()) {
|
||||||
|
NBTTagList tagList = new NBTTagList();
|
||||||
|
Iterator var3 = this.getSelectedList().iterator();
|
||||||
|
|
||||||
|
while(var3.hasNext()) {
|
||||||
|
String s = (String)var3.next();
|
||||||
|
tagList.appendTag(new NBTTagString(s));
|
||||||
|
}
|
||||||
|
|
||||||
|
nbt.setTag("selectedList", tagList);
|
||||||
|
} else if (this.getSelected() != null && !this.getSelected().isEmpty()) {
|
||||||
|
nbt.setString("selected", this.getSelected());
|
||||||
|
} else {
|
||||||
|
nbt.setString("selected", "Null");
|
||||||
|
}
|
||||||
|
|
||||||
|
return nbt;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by FernFlower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package noppes.npcs.client.gui.custom.components;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import noppes.npcs.client.gui.custom.GuiCustom;
|
||||||
|
|
||||||
|
public class CustomGuiSlot extends Slot {
|
||||||
|
public boolean clientSide;
|
||||||
|
public int slotNumber;
|
||||||
|
|
||||||
|
public CustomGuiSlot(IInventory inventoryIn, int index, int xPosition, int yPosition, boolean clientSide) {
|
||||||
|
super(inventoryIn, index, xPosition, yPosition);
|
||||||
|
this.clientSide = clientSide;
|
||||||
|
this.slotNumber = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSlotChanged() {
|
||||||
|
if (this.clientSide) {
|
||||||
|
((GuiCustom)Minecraft.getMinecraft().currentScreen).slotChange(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
super.onSlotChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by FernFlower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package noppes.npcs.client.gui.custom.components;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import noppes.npcs.client.Client;
|
||||||
|
import noppes.npcs.client.gui.custom.GuiCustom;
|
||||||
|
import noppes.npcs.client.gui.custom.interfaces.IClickListener;
|
||||||
|
import noppes.npcs.client.gui.custom.interfaces.IDataHolder;
|
||||||
|
import noppes.npcs.client.gui.custom.interfaces.IKeyListener;
|
||||||
|
import noppes.npcs.constants.EnumPacketServer;
|
||||||
|
import noppes.npcs.scripted.gui.ScriptGuiTextField;
|
||||||
|
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
public class CustomGuiTextField extends GuiTextField implements IKeyListener, IDataHolder, IClickListener {
|
||||||
|
GuiCustom parent;
|
||||||
|
String[] hoverText;
|
||||||
|
int id;
|
||||||
|
|
||||||
|
int color;
|
||||||
|
float alpha;
|
||||||
|
|
||||||
|
public CustomGuiTextField(int id, int x, int y, int width, int height) {
|
||||||
|
super(Minecraft.getMinecraft().fontRenderer, GuiCustom.guiLeft + x, GuiCustom.guiTop + y, width, height);
|
||||||
|
this.id = id;
|
||||||
|
this.setMaxStringLength(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void keyTyped(char typedChar, int keyCode) {
|
||||||
|
this.textboxKeyTyped(typedChar, keyCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRender(Minecraft mc, int mouseX, int mouseY, int mouseWheel, float partialTicks) {
|
||||||
|
boolean hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||||
|
float red = (color >> 16 & 255) / 255f;
|
||||||
|
float green = (color >> 8 & 255) / 255f;
|
||||||
|
float blue = (color & 255) / 255f;
|
||||||
|
GL11.glColor4f(red,green,blue,this.alpha);
|
||||||
|
this.drawTextBox();
|
||||||
|
GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
|
||||||
|
if (hovered && this.hoverText != null && this.hoverText.length > 0) {
|
||||||
|
this.parent.hoverText = this.hoverText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent(GuiCustom parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getID() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagCompound toNBT() {
|
||||||
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
|
tag.setInteger("id", this.id);
|
||||||
|
tag.setString("text", this.getText());
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICustomGuiComponent toComponent() {
|
||||||
|
ScriptGuiTextField component = new ScriptGuiTextField(this.id, this.xPosition - GuiCustom.guiLeft, this.yPosition - GuiCustom.guiTop, this.width, this.height);
|
||||||
|
component.setText(this.getText());
|
||||||
|
component.setHoverText(this.hoverText);
|
||||||
|
component.setColor(color);
|
||||||
|
component.setAlpha(alpha);
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CustomGuiTextField fromComponent(ScriptGuiTextField component) {
|
||||||
|
CustomGuiTextField txt = new CustomGuiTextField(component.getID(), component.getPosX(), component.getPosY(), component.getWidth(), component.getHeight());
|
||||||
|
if (component.hasHoverText()) {
|
||||||
|
txt.hoverText = component.getHoverText();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (component.getText() != null && !component.getText().isEmpty()) {
|
||||||
|
txt.setText(component.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
txt.color = component.getColor();
|
||||||
|
txt.alpha = component.getAlpha();
|
||||||
|
|
||||||
|
return txt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean mouseClicked(GuiCustom gui, int mouseX, int mouseY, int mouseButton) {
|
||||||
|
boolean flag = mouseX >= this.xPosition && mouseX < this.xPosition + this.width && mouseY >= this.yPosition && mouseY < this.yPosition + this.height;
|
||||||
|
|
||||||
|
if (this.isFocused() && mouseButton == 0 && !flag){
|
||||||
|
parent.onTextFieldUnfocused(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by FernFlower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package noppes.npcs.client.gui.custom.components;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.texture.ITextureObject;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureManager;
|
||||||
|
import net.minecraft.client.resources.SkinManager;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import noppes.npcs.client.ImageDownloadAlt;
|
||||||
|
import noppes.npcs.client.gui.custom.GuiCustom;
|
||||||
|
import noppes.npcs.client.gui.custom.interfaces.IGuiComponent;
|
||||||
|
import noppes.npcs.client.renderer.ImageBufferDownloadAlt;
|
||||||
|
import noppes.npcs.scripted.gui.ScriptGuiTexturedRect;
|
||||||
|
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA;
|
||||||
|
import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
|
||||||
|
|
||||||
|
public class CustomGuiTexturedRect extends Gui implements IGuiComponent {
|
||||||
|
GuiCustom parent;
|
||||||
|
ResourceLocation texture;
|
||||||
|
int id;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int textureX;
|
||||||
|
int textureY;
|
||||||
|
float scale;
|
||||||
|
String[] hoverText;
|
||||||
|
|
||||||
|
int color;
|
||||||
|
float alpha;
|
||||||
|
float rotation;
|
||||||
|
|
||||||
|
public CustomGuiTexturedRect(int id, String texture, int x, int y, int width, int height) {
|
||||||
|
this(id, texture, x, y, width, height, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomGuiTexturedRect(int id, String texture, int x, int y, int width, int height, int textureX, int textureY) {
|
||||||
|
this.scale = 1.0F;
|
||||||
|
this.id = id;
|
||||||
|
this.texture = new ResourceLocation(texture);
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
this.textureX = textureX;
|
||||||
|
this.textureY = textureY;
|
||||||
|
|
||||||
|
if(texture.startsWith("https://")){
|
||||||
|
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||||
|
ITextureObject object = new ImageDownloadAlt(null, texture, SkinManager.field_152793_a, new ImageBufferDownloadAlt(false));
|
||||||
|
texturemanager.loadTexture(this.texture, object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent(GuiCustom parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getID() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRender(Minecraft mc, int mouseX, int mouseY, int mouseWheel, float partialTicks) {
|
||||||
|
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();
|
||||||
|
float red = (color >> 16 & 255) / 255f;
|
||||||
|
float green = (color >> 8 & 255) / 255f;
|
||||||
|
float blue = (color & 255) / 255f;
|
||||||
|
GL11.glColor4f(red,green,blue,this.alpha);
|
||||||
|
|
||||||
|
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);
|
||||||
|
int p_73729_3_ = this.textureX;
|
||||||
|
int p_73729_4_ = this.textureY;
|
||||||
|
int p_73729_5_ = (int)(this.width);
|
||||||
|
int p_73729_6_ = (int)(this.height);
|
||||||
|
|
||||||
|
float f = 0.00390625F;
|
||||||
|
float f1 = 0.00390625F;
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setColorOpaque_F(1, 1, 1);
|
||||||
|
tessellator.setColorRGBA_F(red, green, blue, alpha);
|
||||||
|
tessellator.addVertexWithUV((double)(p_73729_1_ + 0), (double)(p_73729_2_ + p_73729_6_), (double)this.zLevel, (double)((float)(p_73729_3_ + 0) * f), (double)((float)(p_73729_4_ + p_73729_6_) * f1));
|
||||||
|
tessellator.addVertexWithUV((double)(p_73729_1_ + p_73729_5_), (double)(p_73729_2_ + p_73729_6_), (double)this.zLevel, (double)((float)(p_73729_3_ + p_73729_5_) * f), (double)((float)(p_73729_4_ + p_73729_6_) * f1));
|
||||||
|
tessellator.addVertexWithUV((double)(p_73729_1_ + p_73729_5_), (double)(p_73729_2_ + 0), (double)this.zLevel, (double)((float)(p_73729_3_ + p_73729_5_) * f), (double)((float)(p_73729_4_ + 0) * f1));
|
||||||
|
tessellator.addVertexWithUV((double)(p_73729_1_ + 0), (double)(p_73729_2_ + 0), (double)this.zLevel, (double)((float)(p_73729_3_ + 0) * f), (double)((float)(p_73729_4_ + 0) * f1));
|
||||||
|
tessellator.draw();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
if (hovered && this.hoverText != null && this.hoverText.length > 0) {
|
||||||
|
this.parent.hoverText = this.hoverText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICustomGuiComponent toComponent() {
|
||||||
|
ScriptGuiTexturedRect component = new ScriptGuiTexturedRect(this.id, this.texture.toString(), this.x, this.y, this.width, this.height, this.textureX, this.textureY);
|
||||||
|
component.setHoverText(this.hoverText);
|
||||||
|
component.setScale(this.scale);
|
||||||
|
component.setColor(color);
|
||||||
|
component.setAlpha(alpha);
|
||||||
|
component.setRotation(rotation);
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CustomGuiTexturedRect fromComponent(ScriptGuiTexturedRect component) {
|
||||||
|
CustomGuiTexturedRect rect;
|
||||||
|
if (component.getTextureX() >= 0 && component.getTextureY() >= 0) {
|
||||||
|
rect = new CustomGuiTexturedRect(component.getID(), component.getTexture(), component.getPosX(), component.getPosY(), component.getWidth(), component.getHeight(), component.getTextureX(), component.getTextureY());
|
||||||
|
} else {
|
||||||
|
rect = new CustomGuiTexturedRect(component.getID(), component.getTexture(), component.getPosX(), component.getPosY(), component.getWidth(), component.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
rect.scale = component.getScale();
|
||||||
|
if (component.hasHoverText()) {
|
||||||
|
rect.hoverText = component.getHoverText();
|
||||||
|
}
|
||||||
|
|
||||||
|
rect.color = component.getColor();
|
||||||
|
rect.alpha = component.getAlpha();
|
||||||
|
rect.rotation = component.getRotation();
|
||||||
|
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by FernFlower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package noppes.npcs.client.gui.custom.interfaces;
|
||||||
|
|
||||||
|
import noppes.npcs.client.gui.custom.GuiCustom;
|
||||||
|
|
||||||
|
public interface IClickListener extends IGuiComponent {
|
||||||
|
boolean mouseClicked(GuiCustom var1, int var2, int var3, int var4);
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by FernFlower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package noppes.npcs.client.gui.custom.interfaces;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
public interface IDataHolder extends IGuiComponent {
|
||||||
|
NBTTagCompound toNBT();
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by FernFlower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package noppes.npcs.client.gui.custom.interfaces;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import noppes.npcs.scripted.interfaces.ICustomGuiComponent;
|
||||||
|
|
||||||
|
public interface IGuiComponent {
|
||||||
|
int getID();
|
||||||
|
|
||||||
|
void onRender(Minecraft var1, int var2, int var3, int var4, float var5);
|
||||||
|
|
||||||
|
ICustomGuiComponent toComponent();
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by FernFlower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package noppes.npcs.client.gui.custom.interfaces;
|
||||||
|
|
||||||
|
public interface IKeyListener extends IGuiComponent {
|
||||||
|
void keyTyped(char var1, int var2);
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package noppes.npcs.client.gui.customoverlay;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
|
import net.minecraft.client.gui.ScaledResolution;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import noppes.npcs.client.gui.customoverlay.components.CustomOverlayLabel;
|
||||||
|
import noppes.npcs.client.gui.customoverlay.components.CustomOverlayLine;
|
||||||
|
import noppes.npcs.client.gui.customoverlay.components.CustomOverlayTexturedRect;
|
||||||
|
import noppes.npcs.client.gui.customoverlay.interfaces.IOverlayComponent;
|
||||||
|
import noppes.npcs.scripted.interfaces.ICustomOverlayComponent;
|
||||||
|
import noppes.npcs.scripted.overlay.*;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class OverlayCustom extends Gui {
|
||||||
|
protected final Minecraft mc;
|
||||||
|
|
||||||
|
private ScaledResolution res = null;
|
||||||
|
public static int scaledWidth = 0;
|
||||||
|
public static int scaledHeight = 0;
|
||||||
|
|
||||||
|
public ScriptOverlay overlay;
|
||||||
|
Map<Integer, IOverlayComponent> components = new HashMap();
|
||||||
|
|
||||||
|
public OverlayCustom(Minecraft mc) {
|
||||||
|
this.mc = mc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initOverlay(){
|
||||||
|
res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||||
|
if(this.overlay != null){
|
||||||
|
scaledWidth = res.getScaledWidth();
|
||||||
|
scaledHeight = res.getScaledHeight();
|
||||||
|
|
||||||
|
this.components.clear();
|
||||||
|
Iterator var1 = this.overlay.getComponents().iterator();
|
||||||
|
|
||||||
|
while(var1.hasNext()) {
|
||||||
|
ICustomOverlayComponent c = (ICustomOverlayComponent)var1.next();
|
||||||
|
this.addComponent(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addComponent(ICustomOverlayComponent component) {
|
||||||
|
ScriptOverlayComponent c = (ScriptOverlayComponent)component;
|
||||||
|
switch(c.getType()) {
|
||||||
|
case 0:
|
||||||
|
CustomOverlayTexturedRect rect = CustomOverlayTexturedRect.fromComponent((ScriptOverlayTexturedRect) component);
|
||||||
|
rect.setParent(this);
|
||||||
|
this.components.put(rect.getID(), rect);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
CustomOverlayLabel lbl = CustomOverlayLabel.fromComponent((ScriptOverlayLabel)component);
|
||||||
|
lbl.setParent(this);
|
||||||
|
this.components.put(lbl.getID(), lbl);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
CustomOverlayLine line = CustomOverlayLine.fromComponent((ScriptOverlayLine) component);
|
||||||
|
line.setParent(this);
|
||||||
|
this.components.put(line.getID(), line);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderGameOverlay(float partialTicks){
|
||||||
|
res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||||
|
scaledWidth = res.getScaledWidth();
|
||||||
|
scaledHeight = res.getScaledHeight();
|
||||||
|
|
||||||
|
Iterator var4 = this.components.values().iterator();
|
||||||
|
|
||||||
|
while(var4.hasNext()) {
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||||
|
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||||
|
|
||||||
|
IOverlayComponent component = (IOverlayComponent)var4.next();
|
||||||
|
component.onRender(this.mc, partialTicks);
|
||||||
|
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOverlayData(NBTTagCompound compound) {
|
||||||
|
this.overlay = (ScriptOverlay)(new ScriptOverlay()).fromNBT(compound);
|
||||||
|
this.initOverlay();
|
||||||
|
}
|
||||||
|
}
|
||||||
+553
@@ -0,0 +1,553 @@
|
|||||||
|
package noppes.npcs.client.gui.customoverlay.components;
|
||||||
|
|
||||||
|
import com.ibm.icu.text.ArabicShaping;
|
||||||
|
import com.ibm.icu.text.ArabicShapingException;
|
||||||
|
import com.ibm.icu.text.Bidi;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
|
||||||
|
import noppes.npcs.client.gui.customoverlay.interfaces.IOverlayComponent;
|
||||||
|
import noppes.npcs.scripted.interfaces.ICustomOverlayComponent;
|
||||||
|
import noppes.npcs.scripted.overlay.ScriptOverlayLabel;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
public class CustomOverlayLabel extends Gui implements IOverlayComponent {
|
||||||
|
OverlayCustom parent;
|
||||||
|
int id;
|
||||||
|
|
||||||
|
String fullLabel;
|
||||||
|
int x, y, width, height, alignment;
|
||||||
|
float scale, rotation;
|
||||||
|
int color;
|
||||||
|
float alpha;
|
||||||
|
|
||||||
|
int border = 2;
|
||||||
|
boolean labelBgEnabled = true;
|
||||||
|
boolean labelShadowEnabled = false;
|
||||||
|
|
||||||
|
protected int field_146167_a;
|
||||||
|
protected int field_146161_f;
|
||||||
|
public int field_146162_g;
|
||||||
|
public int field_146174_h;
|
||||||
|
|
||||||
|
private boolean randomStyle = false;
|
||||||
|
private boolean boldStyle = false;
|
||||||
|
private boolean italicStyle = false;
|
||||||
|
private boolean underlineStyle = false;
|
||||||
|
private boolean strikethroughStyle = false;
|
||||||
|
private boolean bidiFlag = false;
|
||||||
|
private boolean unicodeFlag = false;
|
||||||
|
|
||||||
|
private static final ResourceLocation[] unicodePageLocations = new ResourceLocation[256];
|
||||||
|
protected final ResourceLocation locationFontTexture;
|
||||||
|
protected int[] charWidth = new int[256];
|
||||||
|
protected byte[] glyphWidth = new byte[65536];
|
||||||
|
private final int[] colorCode = new int[32];
|
||||||
|
|
||||||
|
private float red;
|
||||||
|
private float green;
|
||||||
|
private float blue;
|
||||||
|
|
||||||
|
private float posX;
|
||||||
|
private float posY;
|
||||||
|
|
||||||
|
public CustomOverlayLabel(int id, String fullLabel, int x, int y, int width, int height, boolean shadow){
|
||||||
|
this.id = id;
|
||||||
|
this.fullLabel = fullLabel;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
this.labelShadowEnabled = shadow;
|
||||||
|
|
||||||
|
locationFontTexture = new ResourceLocation("textures/font/ascii.png");
|
||||||
|
readFontTexture();
|
||||||
|
readGlyphSizes();
|
||||||
|
for (int i = 0; i < 32; ++i)
|
||||||
|
{
|
||||||
|
int j = (i >> 3 & 1) * 85;
|
||||||
|
int k = (i >> 2 & 1) * 170 + j;
|
||||||
|
int l = (i >> 1 & 1) * 170 + j;
|
||||||
|
int i1 = (i >> 0 & 1) * 170 + j;
|
||||||
|
|
||||||
|
if (i == 6)
|
||||||
|
{
|
||||||
|
k += 85;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Minecraft.getMinecraft().gameSettings.anaglyph)
|
||||||
|
{
|
||||||
|
int j1 = (k * 30 + l * 59 + i1 * 11) / 100;
|
||||||
|
int k1 = (k * 30 + l * 70) / 100;
|
||||||
|
int l1 = (k * 30 + i1 * 70) / 100;
|
||||||
|
k = j1;
|
||||||
|
l = k1;
|
||||||
|
i1 = l1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i >= 16)
|
||||||
|
{
|
||||||
|
k /= 4;
|
||||||
|
l /= 4;
|
||||||
|
i1 /= 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.colorCode[i] = (k & 255) << 16 | (l & 255) << 8 | i1 & 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent(OverlayCustom parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRender(Minecraft mc, float partialTicks) {
|
||||||
|
this.drawLabel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getID() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScale(float scale) {
|
||||||
|
this.scale = scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CustomOverlayLabel fromComponent(ScriptOverlayLabel component) {
|
||||||
|
CustomOverlayLabel lbl = new CustomOverlayLabel(component.getID(), component.getText(), component.getPosX(), component.getPosY(), component.getWidth(), component.getHeight(), component.getShadow());
|
||||||
|
lbl.scale = 1.0F;
|
||||||
|
lbl.color = component.getColor();
|
||||||
|
lbl.labelShadowEnabled = component.getShadow();
|
||||||
|
lbl.alignment = component.getAlignment();
|
||||||
|
lbl.alpha = component.getAlpha();
|
||||||
|
lbl.rotation = component.getRotation();
|
||||||
|
lbl.setScale(component.getScale());
|
||||||
|
|
||||||
|
return lbl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICustomOverlayComponent toComponent() {
|
||||||
|
ScriptOverlayLabel component = new ScriptOverlayLabel(this.id, this.fullLabel, this.field_146162_g, this.field_146174_h, this.field_146167_a, this.field_146161_f, this.color);
|
||||||
|
component.setShadow(this.labelShadowEnabled);
|
||||||
|
component.setAlignment(alignment);
|
||||||
|
component.setAlpha(alpha);
|
||||||
|
component.setColor(color);
|
||||||
|
component.setRotation(rotation);
|
||||||
|
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawLabel()
|
||||||
|
{
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslatef(this.alignment%3*((float)(OverlayCustom.scaledWidth)/2), (float) (Math.floor((float)(alignment/3))*((float)(OverlayCustom.scaledHeight)/2)),0.0F);//alignment%3 * width/2 Math.floor(alignment/3) * height/2
|
||||||
|
|
||||||
|
red = (color >> 16 & 255) / 255f;
|
||||||
|
green = (color >> 8 & 255) / 255f;
|
||||||
|
blue = (color & 255) / 255f;
|
||||||
|
|
||||||
|
GL11.glTranslatef(this.x,this.y,0.0F);
|
||||||
|
GL11.glRotated(rotation,0.0D,0.0D,1.0D);
|
||||||
|
GL11.glScalef(this.scale, this.scale, this.scale);
|
||||||
|
this.drawString(fullLabel, 0, 0, this.color, this.labelShadowEnabled);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int drawString(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_, boolean p_85187_5_)
|
||||||
|
{
|
||||||
|
this.resetStyles();
|
||||||
|
int l;
|
||||||
|
|
||||||
|
if (p_85187_5_)
|
||||||
|
{
|
||||||
|
l = this.renderString(p_85187_1_, p_85187_2_ + 1, p_85187_3_ + 1, p_85187_4_, true);
|
||||||
|
l = Math.max(l, this.renderString(p_85187_1_, p_85187_2_, p_85187_3_, p_85187_4_, false));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
l = this.renderString(p_85187_1_, p_85187_2_, p_85187_3_, p_85187_4_, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetStyles()
|
||||||
|
{
|
||||||
|
this.randomStyle = false;
|
||||||
|
this.boldStyle = false;
|
||||||
|
this.italicStyle = false;
|
||||||
|
this.underlineStyle = false;
|
||||||
|
this.strikethroughStyle = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int renderString(String p_78258_1_, int p_78258_2_, int p_78258_3_, int p_78258_4_, boolean p_78258_5_)
|
||||||
|
{
|
||||||
|
if (p_78258_1_ == null)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (this.bidiFlag)
|
||||||
|
{
|
||||||
|
p_78258_1_ = this.bidiReorder(p_78258_1_);
|
||||||
|
}
|
||||||
|
|
||||||
|
setColor(this.red, this.green, this.blue, this.alpha);
|
||||||
|
this.posX = (float)p_78258_2_;
|
||||||
|
this.posY = (float)p_78258_3_;
|
||||||
|
this.renderStringAtPos(p_78258_1_, p_78258_5_);
|
||||||
|
return (int)this.posX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderStringAtPos(String p_78255_1_, boolean p_78255_2_)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < p_78255_1_.length(); ++i)
|
||||||
|
{
|
||||||
|
char c0 = p_78255_1_.charAt(i);
|
||||||
|
int j;
|
||||||
|
int k;
|
||||||
|
|
||||||
|
if (c0 == 38 && i + 1 < p_78255_1_.length())
|
||||||
|
{
|
||||||
|
j = "0123456789abcdefklmnor".indexOf(p_78255_1_.toLowerCase().charAt(i + 1));
|
||||||
|
|
||||||
|
if(j < 16){
|
||||||
|
this.randomStyle = false;
|
||||||
|
this.boldStyle = false;
|
||||||
|
this.strikethroughStyle = false;
|
||||||
|
this.underlineStyle = false;
|
||||||
|
this.italicStyle = false;
|
||||||
|
|
||||||
|
if (j < 0 || j > 15)
|
||||||
|
{
|
||||||
|
j = 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_78255_2_)
|
||||||
|
{
|
||||||
|
j += 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
k = this.colorCode[j];
|
||||||
|
setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha);
|
||||||
|
}
|
||||||
|
else if (j == 16)
|
||||||
|
{
|
||||||
|
this.randomStyle = true;
|
||||||
|
}
|
||||||
|
else if (j == 17)
|
||||||
|
{
|
||||||
|
this.boldStyle = true;
|
||||||
|
}
|
||||||
|
else if (j == 18)
|
||||||
|
{
|
||||||
|
this.strikethroughStyle = true;
|
||||||
|
}
|
||||||
|
else if (j == 19)
|
||||||
|
{
|
||||||
|
this.underlineStyle = true;
|
||||||
|
}
|
||||||
|
else if (j == 20)
|
||||||
|
{
|
||||||
|
this.italicStyle = true;
|
||||||
|
}
|
||||||
|
else if (j == 21)
|
||||||
|
{
|
||||||
|
this.randomStyle = false;
|
||||||
|
this.boldStyle = false;
|
||||||
|
this.strikethroughStyle = false;
|
||||||
|
this.underlineStyle = false;
|
||||||
|
this.italicStyle = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
j = "\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000".indexOf(c0);
|
||||||
|
|
||||||
|
if (this.randomStyle && j != -1)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
k = Minecraft.getMinecraft().fontRenderer.fontRandom.nextInt(this.charWidth.length);
|
||||||
|
}
|
||||||
|
while (this.charWidth[j] != this.charWidth[k]);
|
||||||
|
|
||||||
|
j = k;
|
||||||
|
}
|
||||||
|
|
||||||
|
float f1 = this.unicodeFlag ? 0.5F : 1.0F;
|
||||||
|
boolean flag1 = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_;
|
||||||
|
|
||||||
|
if (flag1)
|
||||||
|
{
|
||||||
|
this.posX -= f1;
|
||||||
|
this.posY -= f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
float f = this.renderCharAtPos(j, c0, this.italicStyle);
|
||||||
|
|
||||||
|
if (flag1)
|
||||||
|
{
|
||||||
|
this.posX += f1;
|
||||||
|
this.posY += f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.boldStyle)
|
||||||
|
{
|
||||||
|
this.posX += f1;
|
||||||
|
|
||||||
|
if (flag1)
|
||||||
|
{
|
||||||
|
this.posX -= f1;
|
||||||
|
this.posY -= f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.renderCharAtPos(j, c0, this.italicStyle);
|
||||||
|
this.posX -= f1;
|
||||||
|
|
||||||
|
if (flag1)
|
||||||
|
{
|
||||||
|
this.posX += f1;
|
||||||
|
this.posY += f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
++f;
|
||||||
|
}
|
||||||
|
|
||||||
|
doDraw(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doDraw(float f)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{
|
||||||
|
Tessellator tessellator;
|
||||||
|
|
||||||
|
if (this.strikethroughStyle)
|
||||||
|
{
|
||||||
|
tessellator = Tessellator.instance;
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.addVertex((double)this.posX, (double)(this.posY + (float)(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2)), 0.0D);
|
||||||
|
tessellator.addVertex((double)(this.posX + f), (double)(this.posY + (float)(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2)), 0.0D);
|
||||||
|
tessellator.addVertex((double)(this.posX + f), (double)(this.posY + (float)(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2) - 1.0F), 0.0D);
|
||||||
|
tessellator.addVertex((double)this.posX, (double)(this.posY + (float)(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2) - 1.0F), 0.0D);
|
||||||
|
tessellator.draw();
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.underlineStyle)
|
||||||
|
{
|
||||||
|
tessellator = Tessellator.instance;
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
int l = this.underlineStyle ? -1 : 0;
|
||||||
|
tessellator.addVertex((double)(this.posX + (float)l), (double)(this.posY + (float)Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT), 0.0D);
|
||||||
|
tessellator.addVertex((double)(this.posX + f), (double)(this.posY + (float)Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT), 0.0D);
|
||||||
|
tessellator.addVertex((double)(this.posX + f), (double)(this.posY + (float)Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT - 1.0F), 0.0D);
|
||||||
|
tessellator.addVertex((double)(this.posX + (float)l), (double)(this.posY + (float)Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT - 1.0F), 0.0D);
|
||||||
|
tessellator.draw();
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.posX += (float)((int)f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private float renderCharAtPos(int p_78278_1_, char p_78278_2_, boolean p_78278_3_)
|
||||||
|
{
|
||||||
|
return p_78278_2_ == 32 ? 4.0F : ("\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000".indexOf(p_78278_2_) != -1 && !this.unicodeFlag ? this.renderDefaultChar(p_78278_1_, p_78278_3_) : this.renderUnicodeChar(p_78278_2_, p_78278_3_));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected float renderDefaultChar(int p_78266_1_, boolean p_78266_2_)
|
||||||
|
{
|
||||||
|
float f = (float)(p_78266_1_ % 16 * 8);
|
||||||
|
float f1 = (float)(p_78266_1_ / 16 * 8);
|
||||||
|
float f2 = p_78266_2_ ? 1.0F : 0.0F;
|
||||||
|
bindTexture(this.locationFontTexture);
|
||||||
|
float f3 = (float)this.charWidth[p_78266_1_] - 0.01F;
|
||||||
|
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
|
||||||
|
GL11.glTexCoord2f(f / 128.0F, f1 / 128.0F);
|
||||||
|
GL11.glVertex3f(this.posX + f2, this.posY, 0.0F);
|
||||||
|
GL11.glTexCoord2f(f / 128.0F, (f1 + 7.99F) / 128.0F);
|
||||||
|
GL11.glVertex3f(this.posX - f2, this.posY + 7.99F, 0.0F);
|
||||||
|
GL11.glTexCoord2f((f + f3 - 1.0F) / 128.0F, f1 / 128.0F);
|
||||||
|
GL11.glVertex3f(this.posX + f3 - 1.0F + f2, this.posY, 0.0F);
|
||||||
|
GL11.glTexCoord2f((f + f3 - 1.0F) / 128.0F, (f1 + 7.99F) / 128.0F);
|
||||||
|
GL11.glVertex3f(this.posX + f3 - 1.0F - f2, this.posY + 7.99F, 0.0F);
|
||||||
|
GL11.glEnd();
|
||||||
|
return (float)this.charWidth[p_78266_1_];
|
||||||
|
}
|
||||||
|
|
||||||
|
private ResourceLocation getUnicodePageLocation(int p_111271_1_)
|
||||||
|
{
|
||||||
|
if (unicodePageLocations[p_111271_1_] == null)
|
||||||
|
{
|
||||||
|
unicodePageLocations[p_111271_1_] = new ResourceLocation(String.format("textures/font/unicode_page_%02x.png", new Object[] {Integer.valueOf(p_111271_1_)}));
|
||||||
|
}
|
||||||
|
|
||||||
|
return unicodePageLocations[p_111271_1_];
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadGlyphTexture(int p_78257_1_)
|
||||||
|
{
|
||||||
|
bindTexture(this.getUnicodePageLocation(p_78257_1_));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render a single Unicode character at current (posX,posY) location using one of the /font/glyph_XX.png files...
|
||||||
|
*/
|
||||||
|
protected float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_)
|
||||||
|
{
|
||||||
|
if (this.glyphWidth[p_78277_1_] == 0)
|
||||||
|
{
|
||||||
|
return 0.0F;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int i = p_78277_1_ / 256;
|
||||||
|
this.loadGlyphTexture(i);
|
||||||
|
int j = this.glyphWidth[p_78277_1_] >>> 4;
|
||||||
|
int k = this.glyphWidth[p_78277_1_] & 15;
|
||||||
|
float f = (float)j;
|
||||||
|
float f1 = (float)(k + 1);
|
||||||
|
float f2 = (float)(p_78277_1_ % 16 * 16) + f;
|
||||||
|
float f3 = (float)((p_78277_1_ & 255) / 16 * 16);
|
||||||
|
float f4 = f1 - f - 0.02F;
|
||||||
|
float f5 = p_78277_2_ ? 1.0F : 0.0F;
|
||||||
|
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
|
||||||
|
GL11.glTexCoord2f(f2 / 256.0F, f3 / 256.0F);
|
||||||
|
GL11.glVertex3f(this.posX + f5, this.posY, 0.0F);
|
||||||
|
GL11.glTexCoord2f(f2 / 256.0F, (f3 + 15.98F) / 256.0F);
|
||||||
|
GL11.glVertex3f(this.posX - f5, this.posY + 7.99F, 0.0F);
|
||||||
|
GL11.glTexCoord2f((f2 + f4) / 256.0F, f3 / 256.0F);
|
||||||
|
GL11.glVertex3f(this.posX + f4 / 2.0F + f5, this.posY, 0.0F);
|
||||||
|
GL11.glTexCoord2f((f2 + f4) / 256.0F, (f3 + 15.98F) / 256.0F);
|
||||||
|
GL11.glVertex3f(this.posX + f4 / 2.0F - f5, this.posY + 7.99F, 0.0F);
|
||||||
|
GL11.glEnd();
|
||||||
|
return (f1 - f) / 2.0F + 1.0F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setColor(float r, float g, float b, float a)
|
||||||
|
{
|
||||||
|
GL11.glColor4f(r, g, b, a);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void bindTexture(ResourceLocation location)
|
||||||
|
{
|
||||||
|
Minecraft.getMinecraft().renderEngine.bindTexture(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readFontTexture()
|
||||||
|
{
|
||||||
|
BufferedImage bufferedimage;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bufferedimage = ImageIO.read(getResourceInputStream(this.locationFontTexture));
|
||||||
|
}
|
||||||
|
catch (IOException ioexception)
|
||||||
|
{
|
||||||
|
throw new RuntimeException(ioexception);
|
||||||
|
}
|
||||||
|
|
||||||
|
int i = bufferedimage.getWidth();
|
||||||
|
int j = bufferedimage.getHeight();
|
||||||
|
int[] aint = new int[i * j];
|
||||||
|
bufferedimage.getRGB(0, 0, i, j, aint, 0, i);
|
||||||
|
int k = j / 16;
|
||||||
|
int l = i / 16;
|
||||||
|
byte b0 = 1;
|
||||||
|
float f = 8.0F / (float)l;
|
||||||
|
int i1 = 0;
|
||||||
|
|
||||||
|
while (i1 < 256)
|
||||||
|
{
|
||||||
|
int j1 = i1 % 16;
|
||||||
|
int k1 = i1 / 16;
|
||||||
|
|
||||||
|
if (i1 == 32)
|
||||||
|
{
|
||||||
|
this.charWidth[i1] = 3 + b0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int l1 = l - 1;
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (l1 >= 0)
|
||||||
|
{
|
||||||
|
int i2 = j1 * l + l1;
|
||||||
|
boolean flag = true;
|
||||||
|
|
||||||
|
for (int j2 = 0; j2 < k && flag; ++j2)
|
||||||
|
{
|
||||||
|
int k2 = (k1 * l + j2) * i;
|
||||||
|
|
||||||
|
if ((aint[i2 + k2] >> 24 & 255) != 0)
|
||||||
|
{
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
--l1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
++l1;
|
||||||
|
this.charWidth[i1] = (int)(0.5D + (double)((float)l1 * f)) + b0;
|
||||||
|
++i1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readGlyphSizes()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
InputStream inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin"));
|
||||||
|
inputstream.read(this.glyphWidth);
|
||||||
|
}
|
||||||
|
catch (IOException ioexception)
|
||||||
|
{
|
||||||
|
throw new RuntimeException(ioexception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected InputStream getResourceInputStream(ResourceLocation location) throws IOException
|
||||||
|
{
|
||||||
|
return Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String bidiReorder(String p_147647_1_)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Bidi bidi = new Bidi((new ArabicShaping(8)).shape(p_147647_1_), 127);
|
||||||
|
bidi.setReorderingMode(0);
|
||||||
|
return bidi.writeReordered(2);
|
||||||
|
}
|
||||||
|
catch (ArabicShapingException arabicshapingexception)
|
||||||
|
{
|
||||||
|
return p_147647_1_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package noppes.npcs.client.gui.customoverlay.components;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
|
||||||
|
import noppes.npcs.client.gui.customoverlay.interfaces.IOverlayComponent;
|
||||||
|
import noppes.npcs.scripted.interfaces.ICustomOverlayComponent;
|
||||||
|
import noppes.npcs.scripted.overlay.ScriptOverlayLine;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA;
|
||||||
|
import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
|
||||||
|
|
||||||
|
public class CustomOverlayLine extends Gui implements IOverlayComponent {
|
||||||
|
OverlayCustom parent;
|
||||||
|
int alignment;
|
||||||
|
int id;
|
||||||
|
|
||||||
|
int x1;
|
||||||
|
int y1;
|
||||||
|
int x2;
|
||||||
|
int y2;
|
||||||
|
int color;
|
||||||
|
int thickness;
|
||||||
|
float alpha;
|
||||||
|
float rotation;
|
||||||
|
|
||||||
|
public CustomOverlayLine(int id, int x1, int y1, int x2, int y2, int color, int thickness){
|
||||||
|
this.id = id;
|
||||||
|
this.x1 = x1;
|
||||||
|
this.y1 = y1;
|
||||||
|
this.x2 = x2;
|
||||||
|
this.y2 = y2;
|
||||||
|
this.color = color;
|
||||||
|
this.thickness = thickness;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent(OverlayCustom parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getID() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRender(Minecraft mc, float partialTicks) {
|
||||||
|
double distance = Math.hypot(x1-x2, y1-y2);
|
||||||
|
|
||||||
|
mc.getTextureManager().bindTexture(new ResourceLocation("customnpcs:textures/gui/misc.png"));
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
float red = (color >> 16 & 255) / 255f;
|
||||||
|
float green = (color >> 8 & 255) / 255f;
|
||||||
|
float blue = (color & 255) / 255f;
|
||||||
|
|
||||||
|
GL11.glTranslatef(this.alignment%3*((float)(OverlayCustom.scaledWidth)/2), (float) (Math.floor((float)(alignment/3))*((float)(OverlayCustom.scaledHeight)/2)),0.0F);//alignment%3 * width/2 Math.floor(alignment/3) * height/2
|
||||||
|
GL11.glTranslatef(this.x1,this.y1,0.0F);
|
||||||
|
|
||||||
|
GL11.glRotated(-Math.toDegrees(Math.atan2(x2-x1,y2-y1)),0.0F,0.0F,1.0F);
|
||||||
|
GL11.glRotated(rotation,0.0D,0.0D,1.0D);
|
||||||
|
GL11.glScaled(thickness, distance,0.0D);
|
||||||
|
|
||||||
|
int p_73729_1_ = 0;
|
||||||
|
int p_73729_2_ = 0;
|
||||||
|
int p_73729_3_ = 0;
|
||||||
|
int p_73729_4_ = 0;
|
||||||
|
int p_73729_5_ = 1;
|
||||||
|
int p_73729_6_ = 1;
|
||||||
|
|
||||||
|
float f = 0.00390625F;
|
||||||
|
float f1 = 0.00390625F;
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setColorOpaque_F(1, 1, 1);
|
||||||
|
tessellator.setColorRGBA_F(red, green, blue, alpha);
|
||||||
|
tessellator.addVertexWithUV((double)(p_73729_1_ + 0), (double)(p_73729_2_ + p_73729_6_), (double)this.zLevel, (double)((float)(p_73729_3_ + 0) * f), (double)((float)(p_73729_4_ + p_73729_6_) * f1));
|
||||||
|
tessellator.addVertexWithUV((double)(p_73729_1_ + p_73729_5_), (double)(p_73729_2_ + p_73729_6_), (double)this.zLevel, (double)((float)(p_73729_3_ + p_73729_5_) * f), (double)((float)(p_73729_4_ + p_73729_6_) * f1));
|
||||||
|
tessellator.addVertexWithUV((double)(p_73729_1_ + p_73729_5_), (double)(p_73729_2_ + 0), (double)this.zLevel, (double)((float)(p_73729_3_ + p_73729_5_) * f), (double)((float)(p_73729_4_ + 0) * f1));
|
||||||
|
tessellator.addVertexWithUV((double)(p_73729_1_ + 0), (double)(p_73729_2_ + 0), (double)this.zLevel, (double)((float)(p_73729_3_ + 0) * f), (double)((float)(p_73729_4_ + 0) * f1));
|
||||||
|
tessellator.draw();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICustomOverlayComponent toComponent() {
|
||||||
|
ScriptOverlayLine line = new ScriptOverlayLine(this.id, this.x1,this.y1,this.x2,this.y2,this.color,this.thickness);
|
||||||
|
line.setAlignment(alignment);
|
||||||
|
line.setAlpha(alpha);
|
||||||
|
line.setColor(color);
|
||||||
|
line.setRotation(rotation);
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CustomOverlayLine fromComponent(ScriptOverlayLine component) {
|
||||||
|
CustomOverlayLine line = new CustomOverlayLine(component.getID(), component.getX1(), component.getY1(), component.getX2(), component.getY2(), component.getColor(), component.getThickness());
|
||||||
|
line.alignment = component.getAlignment();
|
||||||
|
line.alpha = component.getAlpha();
|
||||||
|
line.color = component.getColor();
|
||||||
|
line.rotation = component.getRotation();
|
||||||
|
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
}
|
||||||
+132
@@ -0,0 +1,132 @@
|
|||||||
|
package noppes.npcs.client.gui.customoverlay.components;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.texture.ITextureObject;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureManager;
|
||||||
|
import net.minecraft.client.resources.SkinManager;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import noppes.npcs.client.ImageDownloadAlt;
|
||||||
|
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
|
||||||
|
import noppes.npcs.client.gui.customoverlay.interfaces.IOverlayComponent;
|
||||||
|
import noppes.npcs.client.renderer.ImageBufferDownloadAlt;
|
||||||
|
import noppes.npcs.scripted.interfaces.ICustomOverlayComponent;
|
||||||
|
import noppes.npcs.scripted.overlay.ScriptOverlayTexturedRect;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import static org.lwjgl.opengl.GL11.*;
|
||||||
|
import static org.lwjgl.opengl.GL14.glBlendFuncSeparate;
|
||||||
|
|
||||||
|
public class CustomOverlayTexturedRect extends Gui implements IOverlayComponent {
|
||||||
|
OverlayCustom parent;
|
||||||
|
int alignment;
|
||||||
|
int id;
|
||||||
|
|
||||||
|
ResourceLocation texture;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int textureX;
|
||||||
|
int textureY;
|
||||||
|
float scale;
|
||||||
|
|
||||||
|
int color;
|
||||||
|
float alpha;
|
||||||
|
float rotation;
|
||||||
|
|
||||||
|
public CustomOverlayTexturedRect(int id, String texture, int x, int y, int width, int height) {
|
||||||
|
this(id, texture, x, y, width, height, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomOverlayTexturedRect(int id, String texture, int x, int y, int width, int height, int textureX, int textureY) {
|
||||||
|
this.scale = 1.0F;
|
||||||
|
this.alignment = 0;
|
||||||
|
this.id = id;
|
||||||
|
this.texture = new ResourceLocation(texture);
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
this.textureX = textureX;
|
||||||
|
this.textureY = textureY;
|
||||||
|
|
||||||
|
if(texture.startsWith("https://")){
|
||||||
|
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||||
|
ITextureObject object = new ImageDownloadAlt(null, texture, SkinManager.field_152793_a, new ImageBufferDownloadAlt(false));
|
||||||
|
texturemanager.loadTexture(this.texture, object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent(OverlayCustom parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getID() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRender(Minecraft mc, float partialTicks) {
|
||||||
|
mc.getTextureManager().bindTexture(this.texture);
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
float red = (color >> 16 & 255) / 255f;
|
||||||
|
float green = (color >> 8 & 255) / 255f;
|
||||||
|
float blue = (color & 255) / 255f;
|
||||||
|
|
||||||
|
GL11.glTranslatef(this.alignment%3*((float)(OverlayCustom.scaledWidth)/2), (float) (Math.floor((float)(alignment/3))*((float)(OverlayCustom.scaledHeight)/2)),0.0F);//alignment%3 * width/2 Math.floor(alignment/3) * height/2
|
||||||
|
|
||||||
|
GL11.glScalef(this.scale, this.scale, this.scale);
|
||||||
|
|
||||||
|
GL11.glRotatef(this.rotation,0.0F,0.0F,1.0F);
|
||||||
|
|
||||||
|
int p_73729_1_ = (int) (this.x/this.scale);
|
||||||
|
int p_73729_2_ = (int) (this.y/this.scale);
|
||||||
|
int p_73729_3_ = this.textureX;
|
||||||
|
int p_73729_4_ = this.textureY;
|
||||||
|
int p_73729_5_ = (int)(this.width);
|
||||||
|
int p_73729_6_ = (int)(this.height);
|
||||||
|
|
||||||
|
float f = 0.00390625F;
|
||||||
|
float f1 = 0.00390625F;
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setColorOpaque_F(1, 1, 1);
|
||||||
|
tessellator.setColorRGBA_F(red, green, blue, alpha);
|
||||||
|
tessellator.addVertexWithUV((double)(p_73729_1_ + 0), (double)(p_73729_2_ + p_73729_6_), (double)this.zLevel, (double)((float)(p_73729_3_ + 0) * f), (double)((float)(p_73729_4_ + p_73729_6_) * f1));
|
||||||
|
tessellator.addVertexWithUV((double)(p_73729_1_ + p_73729_5_), (double)(p_73729_2_ + p_73729_6_), (double)this.zLevel, (double)((float)(p_73729_3_ + p_73729_5_) * f), (double)((float)(p_73729_4_ + p_73729_6_) * f1));
|
||||||
|
tessellator.addVertexWithUV((double)(p_73729_1_ + p_73729_5_), (double)(p_73729_2_ + 0), (double)this.zLevel, (double)((float)(p_73729_3_ + p_73729_5_) * f), (double)((float)(p_73729_4_ + 0) * f1));
|
||||||
|
tessellator.addVertexWithUV((double)(p_73729_1_ + 0), (double)(p_73729_2_ + 0), (double)this.zLevel, (double)((float)(p_73729_3_ + 0) * f), (double)((float)(p_73729_4_ + 0) * f1));
|
||||||
|
tessellator.draw();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICustomOverlayComponent toComponent() {
|
||||||
|
ScriptOverlayTexturedRect component = new ScriptOverlayTexturedRect(this.id, this.texture.toString(), this.x, this.y, this.width, this.height, this.textureX, this.textureY);
|
||||||
|
component.setScale(scale);
|
||||||
|
component.setAlignment(alignment);
|
||||||
|
component.setAlpha(alpha);
|
||||||
|
component.setColor(color);
|
||||||
|
component.setRotation(rotation);
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CustomOverlayTexturedRect fromComponent(ScriptOverlayTexturedRect component) {
|
||||||
|
CustomOverlayTexturedRect rect;
|
||||||
|
if (component.getTextureX() >= 0 && component.getTextureY() >= 0) {
|
||||||
|
rect = new CustomOverlayTexturedRect(component.getID(), component.getTexture(), component.getPosX(), component.getPosY(), component.getWidth(), component.getHeight(), component.getTextureX(), component.getTextureY());
|
||||||
|
} else {
|
||||||
|
rect = new CustomOverlayTexturedRect(component.getID(), component.getTexture(), component.getPosX(), component.getPosY(), component.getWidth(), component.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
rect.scale = component.getScale();
|
||||||
|
rect.alignment = component.getAlignment();
|
||||||
|
rect.alpha = component.getAlpha();
|
||||||
|
rect.color = component.getColor();
|
||||||
|
rect.rotation = component.getRotation();
|
||||||
|
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package noppes.npcs.client.gui.customoverlay.interfaces;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
|
public interface IOverlayComponent {
|
||||||
|
void onRender(Minecraft mc, float partialTicks);
|
||||||
|
}
|
||||||
@@ -6,29 +6,30 @@ import net.minecraft.client.gui.GuiButton;
|
|||||||
import net.minecraft.client.renderer.OpenGlHelper;
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
import noppes.npcs.client.Client;
|
import noppes.npcs.client.Client;
|
||||||
import noppes.npcs.client.gui.util.GuiContainerNPCInterface2;
|
import noppes.npcs.client.gui.util.*;
|
||||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
|
||||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
|
||||||
import noppes.npcs.client.gui.util.GuiNpcSlider;
|
|
||||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
|
||||||
import noppes.npcs.client.gui.util.IGuiData;
|
|
||||||
import noppes.npcs.client.gui.util.ISliderListener;
|
|
||||||
import noppes.npcs.constants.EnumPacketServer;
|
import noppes.npcs.constants.EnumPacketServer;
|
||||||
import noppes.npcs.containers.ContainerNPCInv;
|
import noppes.npcs.containers.ContainerNPCInv;
|
||||||
import noppes.npcs.entity.EntityNPCInterface;
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
public class GuiNPCInv extends GuiContainerNPCInterface2 implements ISliderListener, IGuiData
|
public class GuiNPCInv extends GuiContainerNPCInterface2 implements IGuiData, ITextfieldListener
|
||||||
{
|
{
|
||||||
private HashMap<Integer,Integer> chances = new HashMap<Integer, Integer>();
|
private HashMap<Integer,Double> chances = new HashMap<Integer, Double>();
|
||||||
private ContainerNPCInv container;
|
private ContainerNPCInv container;
|
||||||
private ResourceLocation slot;
|
private ResourceLocation slot;
|
||||||
|
private int inventoryTab = 0;
|
||||||
|
|
||||||
public GuiNPCInv(EntityNPCInterface npc,ContainerNPCInv container)
|
public GuiNPCInv(EntityNPCInterface npc,ContainerNPCInv container)
|
||||||
{
|
{
|
||||||
super(npc,container,3);
|
super(npc,container,3);
|
||||||
@@ -45,36 +46,70 @@ public class GuiNPCInv extends GuiContainerNPCInterface2 implements ISliderListe
|
|||||||
addLabel(new GuiNpcLabel(0,"inv.minExp", guiLeft + 118, guiTop + 18));
|
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 + ""));
|
addTextField(new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 108, guiTop + 29, 60, 20, npc.inventory.minExp + ""));
|
||||||
getTextField(0).integersOnly = true;
|
getTextField(0).integersOnly = true;
|
||||||
getTextField(0).setMinMaxDefault(0, npc.inventory.maxExp, 0);
|
|
||||||
|
|
||||||
addLabel(new GuiNpcLabel(1,"inv.maxExp", guiLeft + 118, guiTop + 52));
|
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 + ""));
|
addTextField(new GuiNpcTextField(1,this, fontRendererObj, guiLeft + 108, guiTop + 63, 60, 20, npc.inventory.maxExp + ""));
|
||||||
getTextField(1).integersOnly = true;
|
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));
|
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));
|
addLabel(new GuiNpcLabel(2,"inv.npcInventory", guiLeft + 191, guiTop + 5));
|
||||||
addLabel(new GuiNpcLabel(3,"inv.inventory", guiLeft + 8, guiTop + 101));
|
addLabel(new GuiNpcLabel(3,"inv.inventory", guiLeft + 8, guiTop + 101));
|
||||||
|
|
||||||
for(int i = 0; i < 9; i++){
|
addLabel(new GuiNpcLabel(4,"Tab", guiLeft + 381, guiTop + 5));
|
||||||
int chance = 100;
|
addButton(new GuiNpcButton(11, guiLeft + 375, guiTop + 13, 30, 20, "1"));
|
||||||
if(npc.inventory.dropchance.containsKey(i)){
|
addButton(new GuiNpcButton(12, guiLeft + 375, guiTop + 34, 30, 20, "2"));
|
||||||
chance = npc.inventory.dropchance.get(i);
|
|
||||||
}
|
for(int c = 0; c < 4; c++) {
|
||||||
if(chance <= 0 || chance > 100)
|
for (int r = 0; r < 9; r++) {
|
||||||
chance = 100;
|
double chance = 100;
|
||||||
chances.put(i, chance);
|
if (npc.inventory.dropchance.containsKey(r + c*9)) {
|
||||||
GuiNpcSlider slider = new GuiNpcSlider(this, i, guiLeft + 211, guiTop + 14 + i * 21, ((float)chance)/100);
|
chance = npc.inventory.dropchance.get(r + c*9);
|
||||||
addSlider(slider);
|
}
|
||||||
|
if (chance <= 0 || chance > 100)
|
||||||
|
chance = 100;
|
||||||
|
chances.put(r + c*9, chance);
|
||||||
|
|
||||||
|
if(Math.floor((float)c/2) != this.inventoryTab) {
|
||||||
|
container.getSlot(r + c*9 + 7).xDisplayPosition = 10000;
|
||||||
|
container.getSlot(r + c*9 + 7).yDisplayPosition = 10000;
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
container.getSlot(r + c*9 + 7).xDisplayPosition = 191 + (c-this.inventoryTab*2) * 90;
|
||||||
|
container.getSlot(r + c*9 + 7).yDisplayPosition = 16 + r * 21;
|
||||||
|
}
|
||||||
|
|
||||||
|
GuiNpcTextField textField = new GuiNpcTextField(2 + r + c*9, this, fontRendererObj, guiLeft + 210 + (c-this.inventoryTab*2)*90, guiTop + 14 + r * 21, 60, 18, chance + "");
|
||||||
|
addLabel(new GuiNpcLabel(c*9 + r + 5,"%", guiLeft + 272 + (c-this.inventoryTab*2)*90, guiTop + 16 + r * 21));
|
||||||
|
textField.doublesOnly = true;
|
||||||
|
textField.setMinMaxDefaultDouble(0, 100, 100);
|
||||||
|
addTextField(textField);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void drawSlot(int x, int y)
|
||||||
|
{
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glEnable(GL11.GL_BLEND); // Forge: Blending needs to be enabled for this.
|
||||||
|
this.mc.getTextureManager().bindTexture(slot);
|
||||||
|
this.drawTexturedModalRect(x, y, 0,0,18, 18);
|
||||||
|
GL11.glDisable(GL11.GL_BLEND); // Forge: And clean that up
|
||||||
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void actionPerformed(GuiButton guibutton) {
|
protected void actionPerformed(GuiButton guibutton) {
|
||||||
if(guibutton.id == 10){
|
if(guibutton.id == 10){
|
||||||
npc.inventory.lootMode = ((GuiNpcButton)guibutton).getValue();
|
npc.inventory.lootMode = ((GuiNpcButton)guibutton).getValue();
|
||||||
}
|
}
|
||||||
|
if(guibutton.id == 11 || guibutton.id == 12){
|
||||||
|
this.inventoryTab = Integer.parseInt(guibutton.displayString)-1;
|
||||||
|
initGui();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
||||||
@@ -88,6 +123,12 @@ public class GuiNPCInv extends GuiContainerNPCInterface2 implements ISliderListe
|
|||||||
if(slot.getHasStack())
|
if(slot.getHasStack())
|
||||||
drawTexturedModalRect(guiLeft + slot.xDisplayPosition - 1, guiTop + slot.yDisplayPosition -1, 0, 0, 18, 18);
|
drawTexturedModalRect(guiLeft + slot.xDisplayPosition - 1, guiTop + slot.yDisplayPosition -1, 0, 0, 18, 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(int c = 0; c < 2; c++) {
|
||||||
|
for (int r = 0; r < 9; r++) {
|
||||||
|
this.drawSlot(guiLeft + 190 + c*90, guiTop + 15 + r * 21);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void drawScreen(int i, int j, float f)
|
public void drawScreen(int i, int j, float f)
|
||||||
{
|
{
|
||||||
@@ -150,17 +191,13 @@ public class GuiNPCInv extends GuiContainerNPCInterface2 implements ISliderListe
|
|||||||
initGui();
|
initGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseDragged(GuiNpcSlider guiNpcSlider) {
|
public void unFocused(GuiNpcTextField textfield) {
|
||||||
guiNpcSlider.displayString = StatCollector.translateToLocal("inv.dropChance") + ": " + (int) (guiNpcSlider.sliderValue * 100) + "%";
|
if(textfield.id >= 2){
|
||||||
}
|
chances.put(textfield.id-2, Double.parseDouble(textfield.getText()));
|
||||||
|
}
|
||||||
@Override
|
getTextField(0).setMinMaxDefault(0, getTextField(1).getInteger(), 0);
|
||||||
public void mousePressed(GuiNpcSlider guiNpcSlider) {
|
getTextField(1).setMinMaxDefault(getTextField(0).getInteger(), Short.MAX_VALUE, 0);
|
||||||
}
|
this.save();
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public void mouseReleased(GuiNpcSlider guiNpcSlider) {
|
|
||||||
chances.put(guiNpcSlider.id, (int) (guiNpcSlider.sliderValue * 100));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -141,7 +141,7 @@ public class GuiNpcAI extends GuiNPCInterface2 implements ITextfieldListener, IG
|
|||||||
}
|
}
|
||||||
else if (button.id == 17) {
|
else if (button.id == 17) {
|
||||||
ai.tacticalVariant = EnumNavType.values()[button.getValue()];
|
ai.tacticalVariant = EnumNavType.values()[button.getValue()];
|
||||||
ai.directLOS = EnumNavType.values()[button.getValue()] == EnumNavType.Stalk ? false : this.ai.directLOS;
|
ai.directLOS = EnumNavType.values()[button.getValue()] != EnumNavType.Stalk && this.ai.directLOS;
|
||||||
initGui();
|
initGui();
|
||||||
}
|
}
|
||||||
else if (button.id == 22) {
|
else if (button.id == 22) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.mojang.authlib.GameProfile;
|
|||||||
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import noppes.npcs.CustomNpcs;
|
||||||
import noppes.npcs.DataDisplay;
|
import noppes.npcs.DataDisplay;
|
||||||
import noppes.npcs.client.Client;
|
import noppes.npcs.client.Client;
|
||||||
import noppes.npcs.client.NoppesUtil;
|
import noppes.npcs.client.NoppesUtil;
|
||||||
@@ -56,7 +57,7 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
|||||||
addLabel(new GuiNpcLabel(2,"display.size", guiLeft + 175, y + 5));
|
addLabel(new GuiNpcLabel(2,"display.size", guiLeft + 175, y + 5));
|
||||||
addTextField(new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 203, y, 40, 20, display.modelSize + ""));
|
addTextField(new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 203, y, 40, 20, display.modelSize + ""));
|
||||||
getTextField(2).integersOnly = true;
|
getTextField(2).integersOnly = true;
|
||||||
getTextField(2).setMinMaxDefault(1, Integer.MAX_VALUE, 5);
|
getTextField(2).setMinMaxDefault(1, CustomNpcs.NpcSizeLimit, 5);
|
||||||
//addLabel(new GuiNpcLabel(3,"(1-30)", guiLeft + 246 , y + 5));
|
//addLabel(new GuiNpcLabel(3,"(1-30)", guiLeft + 246 , y + 5));
|
||||||
|
|
||||||
y+=23;
|
y+=23;
|
||||||
@@ -82,6 +83,9 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
|||||||
addLabel(new GuiNpcLabel(5,"display.livingAnimation", guiLeft + 5, y + 5));
|
addLabel(new GuiNpcLabel(5,"display.livingAnimation", guiLeft + 5, y + 5));
|
||||||
this.addButton(new GuiNpcButton(5, guiLeft + 120, y, 50, 20, new String[]{"gui.yes","gui.no"}, display.disableLivingAnimation?1:0));
|
this.addButton(new GuiNpcButton(5, guiLeft + 120, y, 50, 20, new String[]{"gui.yes","gui.no"}, display.disableLivingAnimation?1:0));
|
||||||
|
|
||||||
|
addLabel(new GuiNpcLabel(6,"Collides With Entities", guiLeft + 185, y + 5));
|
||||||
|
this.addButton(new GuiNpcButton(6, guiLeft + 300, y, 100, 20, new String[]{"gui.yes","gui.no","Only CNPCs","Only Players","CNPCs & Players"}, display.collidesWith));
|
||||||
|
|
||||||
y+=23;
|
y+=23;
|
||||||
addLabel(new GuiNpcLabel(7,"display.visible", guiLeft + 5, y + 5));
|
addLabel(new GuiNpcLabel(7,"display.visible", guiLeft + 5, y + 5));
|
||||||
this.addButton(new GuiNpcButton(7, guiLeft + 120, y, 50, 20, new String[]{"gui.yes","gui.no","gui.partly"}, display.visible));
|
this.addButton(new GuiNpcButton(7, guiLeft + 120, y, 50, 20, new String[]{"gui.yes","gui.no","gui.partly"}, display.visible));
|
||||||
@@ -155,6 +159,9 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
|||||||
else if(button.id == 5){
|
else if(button.id == 5){
|
||||||
display.disableLivingAnimation = button.getValue() == 1;
|
display.disableLivingAnimation = button.getValue() == 1;
|
||||||
}
|
}
|
||||||
|
else if(button.id == 6){
|
||||||
|
display.collidesWith = button.getValue();
|
||||||
|
}
|
||||||
else if(button.id == 7){
|
else if(button.id == 7){
|
||||||
display.visible = button.getValue();
|
display.visible = button.getValue();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package noppes.npcs.client.gui.mainmenu;
|
|||||||
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.entity.EnumCreatureAttribute;
|
import net.minecraft.entity.EnumCreatureAttribute;
|
||||||
import net.minecraft.entity.SharedMonsterAttributes;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import noppes.npcs.DataStats;
|
import noppes.npcs.DataStats;
|
||||||
import noppes.npcs.client.Client;
|
import noppes.npcs.client.Client;
|
||||||
@@ -34,13 +33,13 @@ public class GuiNpcStats extends GuiNPCInterface2 implements ITextfieldListener,
|
|||||||
super.initGui();
|
super.initGui();
|
||||||
int y = guiTop + 10;
|
int y = guiTop + 10;
|
||||||
addLabel(new GuiNpcLabel(0,"stats.health", guiLeft + 5, y + 5));
|
addLabel(new GuiNpcLabel(0,"stats.health", guiLeft + 5, y + 5));
|
||||||
addTextField(new GuiNpcTextField(0,this, guiLeft + 85, y, 50, 18, stats.maxHealth+""));
|
addTextField(new GuiNpcTextField(0,this, guiLeft + 85, y, 50, 18, String.format("%.0f", stats.maxHealth) + ""));
|
||||||
getTextField(0).doublesOnly = true;
|
getTextField(0).doublesOnly = true;
|
||||||
getTextField(0).setMinMaxDefaultDouble(0,Double.MAX_VALUE,20);
|
getTextField(0).setMinMaxDefaultDouble(0, Double.MAX_VALUE,20);
|
||||||
addLabel(new GuiNpcLabel(1,"stats.aggro", guiLeft + 140, y + 5));
|
addLabel(new GuiNpcLabel(1,"stats.aggro", guiLeft + 140, y + 5));
|
||||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 220, y, 50, 18, stats.aggroRange+""));
|
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 220, y, 50, 18, stats.aggroRange+""));
|
||||||
getTextField(1).integersOnly = true;
|
getTextField(1).integersOnly = true;
|
||||||
getTextField(1).setMinMaxDefault(1, Integer.MAX_VALUE, 2);
|
getTextField(1).setMinMaxDefault(1, 96, 2); // Doesn't work past 32 technically (MC Limitations)
|
||||||
addLabel(new GuiNpcLabel(34,"stats.creaturetype", guiLeft + 275, y + 5));
|
addLabel(new GuiNpcLabel(34,"stats.creaturetype", guiLeft + 275, y + 5));
|
||||||
addButton(new GuiNpcButton(8,guiLeft + 355, y, 56, 20, new String[]{"stats.normal","stats.undead","stats.arthropod"} ,stats.creatureType.ordinal()));
|
addButton(new GuiNpcButton(8,guiLeft + 355, y, 56, 20, new String[]{"stats.normal","stats.undead","stats.arthropod"} ,stats.creatureType.ordinal()));
|
||||||
|
|
||||||
@@ -64,10 +63,10 @@ public class GuiNpcStats extends GuiNPCInterface2 implements ITextfieldListener,
|
|||||||
addLabel(new GuiNpcLabel(10,"stats.fireimmune", guiLeft + 5, y + 5));
|
addLabel(new GuiNpcLabel(10,"stats.fireimmune", guiLeft + 5, y + 5));
|
||||||
addButton(new GuiNpcButton(5,guiLeft + 217, y, 56, 20, new String[]{"gui.no","gui.yes"} ,stats.canDrown? 1:0));
|
addButton(new GuiNpcButton(5,guiLeft + 217, y, 56, 20, new String[]{"gui.no","gui.yes"} ,stats.canDrown? 1:0));
|
||||||
addLabel(new GuiNpcLabel(11,"stats.candrown", guiLeft + 140, y + 5));
|
addLabel(new GuiNpcLabel(11,"stats.candrown", guiLeft + 140, y + 5));
|
||||||
addTextField(new GuiNpcTextField(14, this, guiLeft + 355, y, 56, 20, stats.healthRegen + "").setFloatsOnly());
|
addTextField(new GuiNpcTextField(14, this, guiLeft + 355, y, 56, 20, String.format("%.0f", stats.healthRegen) + "").setFloatsOnly());
|
||||||
addLabel(new GuiNpcLabel(14,"stats.regenhealth", guiLeft + 275, y + 5));
|
addLabel(new GuiNpcLabel(14,"stats.regenhealth", guiLeft + 275, y + 5));
|
||||||
|
|
||||||
addTextField(new GuiNpcTextField(16, this, guiLeft + 355, y+=22, 56, 20, stats.combatRegen + "").setFloatsOnly());
|
addTextField(new GuiNpcTextField(16, this, guiLeft + 355, y+=22, 56, 20, String.format("%.0f", stats.combatRegen) + "").setFloatsOnly());
|
||||||
addLabel(new GuiNpcLabel(16,"stats.combatregen", guiLeft + 275, y + 5));
|
addLabel(new GuiNpcLabel(16,"stats.combatregen", guiLeft + 275, y + 5));
|
||||||
addButton(new GuiNpcButton(6,guiLeft + 82, y, 56, 20, new String[]{"gui.no","gui.yes"} ,stats.burnInSun? 1:0));
|
addButton(new GuiNpcButton(6,guiLeft + 82, y, 56, 20, new String[]{"gui.no","gui.yes"} ,stats.burnInSun? 1:0));
|
||||||
addLabel(new GuiNpcLabel(12,"stats.burninsun", guiLeft + 5, y + 5));
|
addLabel(new GuiNpcLabel(12,"stats.burninsun", guiLeft + 5, y + 5));
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public class GuiModelArms extends GuiModelInterface{
|
|||||||
|
|
||||||
private final String[] arrArm = new String[]{"gui.no","Both","Right","Left"};
|
private final String[] arrArm = new String[]{"gui.no","Both","Right","Left"};
|
||||||
private final String[] arrArmwear = new String[]{"gui.no","Both","Left","Right"};
|
private final String[] arrArmwear = new String[]{"gui.no","Both","Left","Right"};
|
||||||
|
private final String[] arrSolidArmwear = new String[]{"gui.no","Both","Left","Right"};
|
||||||
private final String[] arrClaws = new String[]{"gui.no","Both","Left","Right"};
|
private final String[] arrClaws = new String[]{"gui.no","Both","Left","Right"};
|
||||||
|
|
||||||
private GuiScreen parent;
|
private GuiScreen parent;
|
||||||
@@ -32,6 +33,9 @@ public class GuiModelArms extends GuiModelInterface{
|
|||||||
if (npc.display.modelType == 1 || npc.display.modelType == 2) {
|
if (npc.display.modelType == 1 || npc.display.modelType == 2) {
|
||||||
addButton(new GuiNpcButton(8, guiLeft + 50, y += 22, 70, 20, arrArmwear, playerdata.armwear));
|
addButton(new GuiNpcButton(8, guiLeft + 50, y += 22, 70, 20, arrArmwear, playerdata.armwear));
|
||||||
addLabel(new GuiNpcLabel(8, "Armwear", guiLeft, y + 5, 0xFFFFFF));
|
addLabel(new GuiNpcLabel(8, "Armwear", guiLeft, y + 5, 0xFFFFFF));
|
||||||
|
|
||||||
|
addButton(new GuiNpcButton(9, guiLeft + 50, y += 22, 70, 20, arrSolidArmwear, playerdata.solidArmwear));
|
||||||
|
addLabel(new GuiNpcLabel(9, "Solid", guiLeft, y + 5, 0xFFFFFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelPartData claws = playerdata.getPartData("claws");
|
ModelPartData claws = playerdata.getPartData("claws");
|
||||||
@@ -50,6 +54,9 @@ public class GuiModelArms extends GuiModelInterface{
|
|||||||
if(button.id == 8){
|
if(button.id == 8){
|
||||||
playerdata.armwear = (byte) button.getValue();
|
playerdata.armwear = (byte) button.getValue();
|
||||||
}
|
}
|
||||||
|
if(button.id == 9){
|
||||||
|
playerdata.solidArmwear = (byte) button.getValue();
|
||||||
|
}
|
||||||
if(button.id == 30){
|
if(button.id == 30){
|
||||||
playerdata.hideArms = (byte) button.getValue();
|
playerdata.hideArms = (byte) button.getValue();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class GuiModelBody extends GuiModelInterface{
|
|||||||
|
|
||||||
private GuiScreen parent;
|
private GuiScreen parent;
|
||||||
private final String[] arrBody = new String[]{"gui.no","gui.yes"};
|
private final String[] arrBody = new String[]{"gui.no","gui.yes"};
|
||||||
private final String[] arrBodywear = new String[]{"gui.no","gui.yes"};
|
private final String[] arrBodywear = new String[]{"gui.no","gui.yes","Solid"};
|
||||||
private final String[] arrWing = new String[]{"gui.no","Player","Type1","Type2","Type3","Type4","Type5","Type6","Type7","Type8","Type9",
|
private final String[] arrWing = new String[]{"gui.no","Player","Type1","Type2","Type3","Type4","Type5","Type6","Type7","Type8","Type9",
|
||||||
"Type10","Type11","Type12","Type13"};
|
"Type10","Type11","Type12","Type13"};
|
||||||
private final String[] arrBreasts = new String[]{"gui.no","Type1","Type2","Type3"};
|
private final String[] arrBreasts = new String[]{"gui.no","Type1","Type2","Type3"};
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public class GuiModelLegs extends GuiModelInterface{
|
|||||||
private GuiScreen parent;
|
private GuiScreen parent;
|
||||||
private final String[] arrLeg = new String[]{"gui.no","Both","Right","Left"};
|
private final String[] arrLeg = new String[]{"gui.no","Both","Right","Left"};
|
||||||
private final String[] arrLegwear = new String[]{"gui.no","Both","Left","Right"};
|
private final String[] arrLegwear = new String[]{"gui.no","Both","Left","Right"};
|
||||||
|
private final String[] arrSolidLegwear = new String[]{"gui.no","Both","Left","Right"};
|
||||||
private final String[] arrLegs = new String[]{"gui.no","Player","Player Naga","Spider","Horse","Naga", "Mermaid", "Mermaid 2", "Digitigrade"};
|
private final String[] arrLegs = new String[]{"gui.no","Player","Player Naga","Spider","Horse","Naga", "Mermaid", "Mermaid 2", "Digitigrade"};
|
||||||
private final String[] arrTail = new String[]{"gui.no","Player", "Player Dragon","Cat","Wolf","Horse","Dragon", "Squirrel", "Fin", "Rodent", "Feather"};
|
private final String[] arrTail = new String[]{"gui.no","Player", "Player Dragon","Cat","Wolf","Horse","Dragon", "Squirrel", "Fin", "Rodent", "Feather"};
|
||||||
public GuiModelLegs(GuiScreen parent, EntityCustomNpc npc){
|
public GuiModelLegs(GuiScreen parent, EntityCustomNpc npc){
|
||||||
@@ -32,6 +33,9 @@ public class GuiModelLegs extends GuiModelInterface{
|
|||||||
if (npc.display.modelType == 1 || npc.display.modelType == 2) {
|
if (npc.display.modelType == 1 || npc.display.modelType == 2) {
|
||||||
addButton(new GuiNpcButton(8, guiLeft + 50, y += 22, 70, 20, arrLegwear, playerdata.legwear));
|
addButton(new GuiNpcButton(8, guiLeft + 50, y += 22, 70, 20, arrLegwear, playerdata.legwear));
|
||||||
addLabel(new GuiNpcLabel(8, "Legwear", guiLeft, y + 5, 0xFFFFFF));
|
addLabel(new GuiNpcLabel(8, "Legwear", guiLeft, y + 5, 0xFFFFFF));
|
||||||
|
|
||||||
|
addButton(new GuiNpcButton(9, guiLeft + 50, y += 22, 70, 20, arrSolidLegwear, playerdata.solidLegwear));
|
||||||
|
addLabel(new GuiNpcLabel(9, "Solid", guiLeft, y + 5, 0xFFFFFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
addButton(new GuiNpcButton(1, guiLeft + 50, y += 22, 70, 20, arrLegs, getLegIndex(playerdata.legParts)));
|
addButton(new GuiNpcButton(1, guiLeft + 50, y += 22, 70, 20, arrLegs, getLegIndex(playerdata.legParts)));
|
||||||
@@ -91,6 +95,9 @@ public class GuiModelLegs extends GuiModelInterface{
|
|||||||
if(button.id == 8){
|
if(button.id == 8){
|
||||||
playerdata.legwear = (byte) button.getValue();
|
playerdata.legwear = (byte) button.getValue();
|
||||||
}
|
}
|
||||||
|
if(button.id == 9){
|
||||||
|
playerdata.solidLegwear = (byte) button.getValue();
|
||||||
|
}
|
||||||
if(button.id == 30){
|
if(button.id == 30){
|
||||||
playerdata.hideLegs = (byte) button.getValue();
|
playerdata.hideLegs = (byte) button.getValue();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
|
|||||||
grabMouse(dialog.showWheel);
|
grabMouse(dialog.showWheel);
|
||||||
guiTop = (height - ySize);
|
guiTop = (height - ySize);
|
||||||
calculateRowHeight();
|
calculateRowHeight();
|
||||||
|
this.drawDefaultBackground = dialog.darkenScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void grabMouse(boolean grab){
|
public void grabMouse(boolean grab){
|
||||||
|
|||||||
@@ -37,29 +37,35 @@ public class GuiNpcQuestTypeKill extends SubGuiInterface implements ITextfieldLi
|
|||||||
|
|
||||||
quest = (QuestKill) q.questInterface;
|
quest = (QuestKill) q.questInterface;
|
||||||
|
|
||||||
setBackground("menubg.png");
|
setBackground("largebg.png");
|
||||||
xSize = 356;
|
bgScale = 1.7F;
|
||||||
ySize = 216;
|
bgScaleX = 1.1F;
|
||||||
|
|
||||||
|
xSize = 300;
|
||||||
|
ySize = 300;
|
||||||
closeOnEsc = true;
|
closeOnEsc = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
super.initGui();
|
super.initGui();
|
||||||
|
|
||||||
|
guiTop -= 20;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
addLabel(new GuiNpcLabel(0, "You can fill in npc or player names too", guiLeft + 4, guiTop + 50));
|
addLabel(new GuiNpcLabel(0, "You can fill in npc or player names too", guiLeft + 4, guiTop + 20));
|
||||||
for (String name : quest.targets.keySet()) {
|
for (String name : quest.targets.keySet()) {
|
||||||
this.addTextField(new GuiNpcTextField(i, this, fontRendererObj, guiLeft + 4, guiTop + 70 + i * 22, 180, 20, name));
|
this.addTextField(new GuiNpcTextField(i, this, fontRendererObj, guiLeft + 4, guiTop + 40 + i * 22, 180, 20, name));
|
||||||
this.addTextField(new GuiNpcTextField(i + 3, this, fontRendererObj, guiLeft + 186, guiTop + 70 + i * 22, 24, 20, quest.targets.get(name) + ""));
|
this.addTextField(new GuiNpcTextField(i + 12, this, fontRendererObj, guiLeft + 186, guiTop + 40 + i * 22, 24, 20, quest.targets.get(name) + ""));
|
||||||
this.getTextField(i+3).integersOnly = true;
|
this.getTextField(i+12).integersOnly = true;
|
||||||
this.getTextField(i+3).setMinMaxDefault(1, Integer.MAX_VALUE, 1);
|
this.getTextField(i+12).setMinMaxDefault(1, Integer.MAX_VALUE, 1);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(;i < 3; i++){
|
for(;i < 12; i++){
|
||||||
this.addTextField(new GuiNpcTextField(i, this, fontRendererObj, guiLeft + 4, guiTop + 70 + i * 22, 180, 20, ""));
|
this.addTextField(new GuiNpcTextField(i, this, fontRendererObj, guiLeft + 4, guiTop + 40 + i * 22, 180, 20, ""));
|
||||||
this.addTextField(new GuiNpcTextField(i + 3, this, fontRendererObj, guiLeft + 186, guiTop + 70 + i * 22, 24, 20, "1"));
|
this.addTextField(new GuiNpcTextField(i + 12, this, fontRendererObj, guiLeft + 186, guiTop + 40 + i * 22, 24, 20, "1"));
|
||||||
this.getTextField(i+3).integersOnly = true;
|
this.getTextField(i+12).integersOnly = true;
|
||||||
this.getTextField(i+3).setMinMaxDefault(1, Integer.MAX_VALUE, 1);
|
this.getTextField(i+12).setMinMaxDefault(1, Integer.MAX_VALUE, 1);
|
||||||
}
|
}
|
||||||
Map<?,?> data = EntityList.stringToClassMapping;
|
Map<?,?> data = EntityList.stringToClassMapping;
|
||||||
ArrayList<String> list = new ArrayList<String>();
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
@@ -78,9 +84,17 @@ public class GuiNpcQuestTypeKill extends SubGuiInterface implements ITextfieldLi
|
|||||||
scroll.setList(list);
|
scroll.setList(list);
|
||||||
scroll.setSize(130, 198);
|
scroll.setSize(130, 198);
|
||||||
scroll.guiLeft = guiLeft + 220;
|
scroll.guiLeft = guiLeft + 220;
|
||||||
scroll.guiTop = guiTop + 14;
|
scroll.guiTop = guiTop + 40;
|
||||||
addScroll(scroll);
|
addScroll(scroll);
|
||||||
this.addButton(new GuiNpcButton(0, guiLeft + 4, guiTop + 140, 98, 20, "gui.back"));
|
|
||||||
|
guiTop += 50;
|
||||||
|
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();
|
scroll.visible = GuiNpcTextField.isFieldActive();
|
||||||
}
|
}
|
||||||
@@ -90,6 +104,10 @@ public class GuiNpcQuestTypeKill extends SubGuiInterface implements ITextfieldLi
|
|||||||
if (guibutton.id == 0) {
|
if (guibutton.id == 0) {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
if (guibutton.id == 1) {
|
||||||
|
quest.targetType = this.getButton(1).getValue();
|
||||||
|
this.getTextField(36).setVisible(this.getButton(1).getValue() == 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void mouseClicked(int i, int j, int k)
|
public void mouseClicked(int i, int j, int k)
|
||||||
{
|
{
|
||||||
@@ -101,18 +119,21 @@ public class GuiNpcQuestTypeKill extends SubGuiInterface implements ITextfieldLi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unFocused(GuiNpcTextField guiNpcTextField) {
|
public void unFocused(GuiNpcTextField guiNpcTextField) {
|
||||||
if(guiNpcTextField.id < 3)
|
if(guiNpcTextField.id < 12)
|
||||||
lastSelected = guiNpcTextField;
|
lastSelected = guiNpcTextField;
|
||||||
|
|
||||||
|
if(guiNpcTextField.id == 36)
|
||||||
|
quest.customTargetType = guiNpcTextField.getText();
|
||||||
|
|
||||||
saveTargets();
|
saveTargets();
|
||||||
}
|
}
|
||||||
private void saveTargets(){
|
private void saveTargets(){
|
||||||
HashMap<String,Integer> map = new HashMap<String,Integer>();
|
HashMap<String,Integer> map = new HashMap<String,Integer>();
|
||||||
for(int i = 0; i< 3; i++){
|
for(int i = 0; i< 12; i++){
|
||||||
String name = getTextField(i).getText();
|
String name = getTextField(i).getText();
|
||||||
if(name.isEmpty())
|
if(name.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
map.put(name, getTextField(i+3).getInteger());
|
map.put(name, getTextField(i+12).getInteger());
|
||||||
}
|
}
|
||||||
quest.targets = map;
|
quest.targets = map;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 || btn.id == 171 || btn.id == 172){
|
||||||
if(btn.id == 170){
|
if(btn.id == 170){
|
||||||
System.out.println(part.rotationX);
|
|
||||||
System.out.println(rotateX.sliderValue);
|
|
||||||
part.rotationX = 0.0f;
|
part.rotationX = 0.0f;
|
||||||
rotateX.sliderValue = 0.5f;
|
rotateX.sliderValue = 0.5f;
|
||||||
int percent = (int) ((rotateX.sliderValue) * 360);
|
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.client.gui.GuiButton;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import noppes.npcs.CustomNpcs;
|
||||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
@@ -23,8 +24,17 @@ public class GuiScriptGlobal extends GuiNPCInterface {
|
|||||||
|
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
super.initGui();
|
super.initGui();
|
||||||
this.addButton(new GuiNpcButton(0, this.guiLeft + 38, this.guiTop + 20, 100, 20, "Players"));
|
GuiNpcButton playerButton = 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"));
|
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) {
|
public void drawScreen(int i, int j, float f) {
|
||||||
@@ -42,6 +52,9 @@ public class GuiScriptGlobal extends GuiNPCInterface {
|
|||||||
if (guibutton.id == 1) {
|
if (guibutton.id == 1) {
|
||||||
this.displayGuiScreen(new GuiScriptForge());
|
this.displayGuiScreen(new GuiScriptForge());
|
||||||
}
|
}
|
||||||
|
if (guibutton.id == 2) {
|
||||||
|
this.displayGuiScreen(new GuiScriptAllNPCs());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void keyTyped(char c, int i) {
|
public void keyTyped(char c, int i) {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import net.minecraft.client.gui.GuiYesNo;
|
|||||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraftforge.event.CommandEvent;
|
||||||
import net.minecraftforge.event.entity.EntityEvent;
|
import net.minecraftforge.event.entity.EntityEvent;
|
||||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||||
import net.minecraftforge.event.world.ChunkDataEvent;
|
import net.minecraftforge.event.world.ChunkDataEvent;
|
||||||
@@ -34,6 +35,7 @@ import noppes.npcs.client.gui.util.*;
|
|||||||
import noppes.npcs.controllers.IScriptHandler;
|
import noppes.npcs.controllers.IScriptHandler;
|
||||||
import noppes.npcs.controllers.ScriptController;
|
import noppes.npcs.controllers.ScriptController;
|
||||||
import noppes.npcs.controllers.data.ForgeDataScript;
|
import noppes.npcs.controllers.data.ForgeDataScript;
|
||||||
|
import noppes.npcs.controllers.data.NPCDataScript;
|
||||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@@ -134,6 +136,34 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
|||||||
hookList.add("playSound");
|
hookList.add("playSound");
|
||||||
hookList.add("lightning");
|
hookList.add("lightning");
|
||||||
hookList.add("changedDim");
|
hookList.add("changedDim");
|
||||||
|
hookList.add("questStart");
|
||||||
|
hookList.add("questCompleted");
|
||||||
|
hookList.add("questTurnIn");
|
||||||
|
hookList.add("factionPoints");
|
||||||
|
hookList.add("dialogOpen");
|
||||||
|
hookList.add("dialogOption");
|
||||||
|
hookList.add("dialogClose");
|
||||||
|
hookList.add("customGuiClosed");
|
||||||
|
hookList.add("customGuiButton");
|
||||||
|
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) {
|
else if(handler instanceof ForgeDataScript) {
|
||||||
hooks.setSize(238, 198);
|
hooks.setSize(238, 198);
|
||||||
@@ -240,9 +270,7 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unFocused(GuiNpcTextField textfield) {
|
public void unFocused(GuiNpcTextField textfield) {
|
||||||
/*if(textfield.id == 1){
|
|
||||||
this.handler.getScripts().get(this.activeTab - 1).setType(textfield.getText());
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getConsoleText() {
|
private String getConsoleText() {
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ public abstract class GuiContainerNPCInterface2 extends GuiContainerNPCInterface
|
|||||||
{
|
{
|
||||||
private ResourceLocation background = new ResourceLocation("customnpcs","textures/gui/menubg.png");
|
private ResourceLocation background = new ResourceLocation("customnpcs","textures/gui/menubg.png");
|
||||||
private final ResourceLocation defaultBackground = 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 int menuYOffset = 0;
|
||||||
|
|
||||||
public GuiContainerNPCInterface2(EntityNPCInterface npc,Container cont)
|
public GuiContainerNPCInterface2(EntityNPCInterface npc,Container cont)
|
||||||
@@ -74,18 +76,12 @@ public abstract class GuiContainerNPCInterface2 extends GuiContainerNPCInterface
|
|||||||
mc.renderEngine.bindTexture(background);
|
mc.renderEngine.bindTexture(background);
|
||||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 256, 256);
|
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 256, 256);
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
mc.renderEngine.bindTexture(defaultBackground);
|
mc.renderEngine.bindTexture(defaultBackground2);
|
||||||
drawTexturedModalRect(guiLeft + xSize-200, guiTop, 26, 0, 200, 220);
|
drawTexturedModalRect(guiLeft + xSize-256, guiTop, 0, 0, 256, 220);
|
||||||
|
|
||||||
menu.drawElements(fontRendererObj, i, j, mc, f);
|
menu.drawElements(fontRendererObj, i, j, mc, f);
|
||||||
|
|
||||||
super.drawGuiContainerBackgroundLayer(f, i, j);
|
super.drawGuiContainerBackgroundLayer(f, i, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
|
||||||
// protected void drawSlotInventory(Slot par1Slot)
|
|
||||||
// {this.dra
|
|
||||||
// if(subgui == null)
|
|
||||||
// super.drawSlotInventory(par1Slot);
|
|
||||||
// } //TODO fix
|
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ public class GuiCustomScroll extends GuiScreen
|
|||||||
public int id;
|
public int id;
|
||||||
public int guiLeft = 0;
|
public int guiLeft = 0;
|
||||||
public int guiTop = 0;
|
public int guiTop = 0;
|
||||||
private int xSize, ySize;
|
public int xSize, ySize;
|
||||||
public int selected;
|
public int selected;
|
||||||
private HashSet<String> selectedList;
|
private HashSet<String> selectedList;
|
||||||
private int hover;
|
private int hover;
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ public abstract class GuiNPCInterface extends GuiScreen
|
|||||||
public int mouseX, mouseY;
|
public int mouseX, mouseY;
|
||||||
|
|
||||||
public float bgScale = 1;
|
public float bgScale = 1;
|
||||||
|
public float bgScaleX = 1;
|
||||||
|
public float bgScaleY = 1;
|
||||||
|
public float bgScaleZ = 1;
|
||||||
|
|
||||||
public GuiNPCInterface(EntityNPCInterface npc)
|
public GuiNPCInterface(EntityNPCInterface npc)
|
||||||
{
|
{
|
||||||
@@ -228,7 +231,7 @@ public abstract class GuiNPCInterface extends GuiScreen
|
|||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glTranslatef(guiLeft, guiTop, 0);
|
GL11.glTranslatef(guiLeft, guiTop, 0);
|
||||||
GL11.glScalef(bgScale, bgScale, bgScale);
|
GL11.glScalef(bgScale*bgScaleX, bgScale*bgScaleY, bgScale*bgScaleZ);
|
||||||
mc.renderEngine.bindTexture(background);
|
mc.renderEngine.bindTexture(background);
|
||||||
if(xSize > 256){
|
if(xSize > 256){
|
||||||
drawTexturedModalRect(0, 0, 0, 0, 250, ySize);
|
drawTexturedModalRect(0, 0, 0, 0, 250, ySize);
|
||||||
|
|||||||
@@ -126,12 +126,12 @@ public class GuiNpcTextField extends GuiTextField{
|
|||||||
setText(max+"");
|
setText(max+"");
|
||||||
}
|
}
|
||||||
else if(doublesOnly && !floatsOnly){
|
else if(doublesOnly && !floatsOnly){
|
||||||
if(isEmpty() || !isDouble())
|
if (isEmpty() || !isDouble())
|
||||||
setText(defDouble +"");
|
setText(defDouble + "");
|
||||||
else if(getDouble() < minDouble)
|
else if (getDouble() < minDouble)
|
||||||
setText(minDouble +"");
|
setText(minDouble + "");
|
||||||
else if(getDouble() > maxDouble)
|
else if (getDouble() > maxDouble)
|
||||||
setText(maxDouble +"");
|
setText(maxDouble + "");
|
||||||
}
|
}
|
||||||
else if(floatsOnly){
|
else if(floatsOnly){
|
||||||
if(isEmpty() || !isFloat())
|
if(isEmpty() || !isFloat())
|
||||||
|
|||||||
@@ -43,17 +43,18 @@ public class ModelMPM extends ModelNPCMale{
|
|||||||
|
|
||||||
// New
|
// New
|
||||||
public ModelRenderer bipedBodywear;
|
public ModelRenderer bipedBodywear;
|
||||||
public ModelRenderer bipedRightArmwear;
|
public ModelRenderer bipedRightArmWear;
|
||||||
public ModelRenderer bipedLeftArmwear;
|
public ModelRenderer bipedLeftArmwear;
|
||||||
public ModelRenderer bipedRightLegWear;
|
public ModelRenderer bipedRightLegWear;
|
||||||
public ModelRenderer bipedLeftLegWear;
|
public ModelRenderer bipedLeftLegWear;
|
||||||
|
|
||||||
private ModelLegs legs;
|
private ModelLegs legs;
|
||||||
private ModelScaleRenderer headwear;
|
private ModelScaleRenderer headwear;
|
||||||
|
private ModelScaleRenderer bodywear;
|
||||||
// private ModelScaleRenderer bodywear;
|
private final ModelScaleRenderer solidLeftArmWear;
|
||||||
// private ModelScaleRenderer armwear;
|
private final ModelScaleRenderer solidRightArmWear;
|
||||||
// private ModelScaleRenderer legwear;
|
private final ModelScaleRenderer solidLeftLegWear;
|
||||||
|
private final ModelScaleRenderer solidRightLegWear;
|
||||||
|
|
||||||
private ModelTail tail;
|
private ModelTail tail;
|
||||||
public ModelBase entityModel;
|
public ModelBase entityModel;
|
||||||
@@ -110,15 +111,17 @@ public class ModelMPM extends ModelNPCMale{
|
|||||||
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 3, 12, 4, par1);
|
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 3, 12, 4, par1);
|
||||||
this.bipedLeftArm.setRotationPoint(5.0F, 2.5F + par2, 0.0F);
|
this.bipedLeftArm.setRotationPoint(5.0F, 2.5F + par2, 0.0F);
|
||||||
|
|
||||||
this.bipedRightArmwear = (new ModelScaleRenderer(this, 40, 32));
|
this.bipedRightArmWear = (new ModelScaleRenderer(this, 40, 32));
|
||||||
this.bipedRightArmwear.addBox(-2.0F, -2.0F, -2.0F, 3, 12, 4, par1 + 0.25F);
|
this.bipedRightArmWear.addBox(-2.0F, -2.0F, -2.0F, 3, 12, 4, par1 + 0.25F);
|
||||||
this.bipedRightArm.addChild(this.bipedRightArmwear);
|
this.bipedRightArm.addChild(this.bipedRightArmWear);
|
||||||
// this.bipedRightArmWear.setRotationPoint(-5.0F, 2.5F + par2, 0.0F);
|
this.solidRightArmWear = new ModelLimbWear(this,"arm","right","Alex");
|
||||||
|
this.bipedRightArm.addChild(this.solidRightArmWear);
|
||||||
|
|
||||||
this.bipedLeftArmwear = new ModelScaleRenderer(this, 48, 48);
|
this.bipedLeftArmwear = new ModelScaleRenderer(this, 48, 48);
|
||||||
this.bipedLeftArmwear.addBox(-1.0F, -2.0F, -2.0F, 3, 12, 4, par1 + 0.25F);
|
this.bipedLeftArmwear.addBox(-1.0F, -2.0F, -2.0F, 3, 12, 4, par1 + 0.25F);
|
||||||
this.bipedLeftArm.addChild(this.bipedLeftArmwear);
|
this.bipedLeftArm.addChild(this.bipedLeftArmwear);
|
||||||
// this.bipedLeftArmWear.setRotationPoint(5.0F, 2.5F + par2, 0.0F);
|
this.solidLeftArmWear = new ModelLimbWear(this,"arm","left","Alex");
|
||||||
|
this.bipedLeftArm.addChild(this.solidLeftArmWear);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// Steve Version
|
// Steve Version
|
||||||
@@ -130,15 +133,17 @@ public class ModelMPM extends ModelNPCMale{
|
|||||||
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1);
|
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1);
|
||||||
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + par2, 0.0F);
|
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + par2, 0.0F);
|
||||||
|
|
||||||
this.bipedRightArmwear = (new ModelScaleRenderer(this, 40, 32));
|
this.bipedRightArmWear = (new ModelScaleRenderer(this, 40, 32));
|
||||||
this.bipedRightArmwear.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
|
this.bipedRightArmWear.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
|
||||||
this.bipedRightArm.addChild(this.bipedRightArmwear);
|
this.bipedRightArm.addChild(this.bipedRightArmWear);
|
||||||
//this.bipedRightArmWear.setRotationPoint(-5.0F, 2.0F + par2, 0.0F);
|
this.solidRightArmWear = new ModelLimbWear(this,"arm","right","Steve");
|
||||||
|
this.bipedRightArm.addChild(this.solidRightArmWear);
|
||||||
|
|
||||||
this.bipedLeftArmwear = new ModelScaleRenderer(this, 48, 48);
|
this.bipedLeftArmwear = new ModelScaleRenderer(this, 48, 48);
|
||||||
this.bipedLeftArmwear.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
|
this.bipedLeftArmwear.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
|
||||||
this.bipedLeftArm.addChild(this.bipedLeftArmwear);
|
this.bipedLeftArm.addChild(this.bipedLeftArmwear);
|
||||||
//this.bipedLeftArmWear.setRotationPoint(5.0F, 2.0F + par2, 0.0F);
|
this.solidLeftArmWear = new ModelLimbWear(this,"arm","left","Steve");
|
||||||
|
this.bipedLeftArm.addChild(this.solidLeftArmWear);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bipedRightLeg = (new ModelScaleRenderer(this, 0, 16));
|
this.bipedRightLeg = (new ModelScaleRenderer(this, 0, 16));
|
||||||
@@ -152,15 +157,19 @@ public class ModelMPM extends ModelNPCMale{
|
|||||||
this.bipedRightLegWear = (new ModelScaleRenderer(this, 0, 32));
|
this.bipedRightLegWear = (new ModelScaleRenderer(this, 0, 32));
|
||||||
this.bipedRightLegWear.addBox(-2.08F, 0.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
|
this.bipedRightLegWear.addBox(-2.08F, 0.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
|
||||||
this.bipedRightLeg.addChild(this.bipedRightLegWear);
|
this.bipedRightLeg.addChild(this.bipedRightLegWear);
|
||||||
// this.bipedRightLegWear.setRotationPoint(-1.9F, 12.0F + par2, 0.0F);
|
this.solidRightLegWear = new ModelLimbWear(this,"leg","right","Steve");
|
||||||
|
this.bipedRightLeg.addChild(this.solidRightLegWear);
|
||||||
|
|
||||||
this.bipedLeftLegWear = new ModelScaleRenderer(this, 0, 48);
|
this.bipedLeftLegWear = new ModelScaleRenderer(this, 0, 48);
|
||||||
this.bipedLeftLegWear.addBox(-1.92F, 0.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
|
this.bipedLeftLegWear.addBox(-1.92F, 0.0F, -2.0F, 4, 12, 4, par1 + 0.25F);
|
||||||
this.bipedLeftLeg.addChild(this.bipedLeftLegWear);
|
this.bipedLeftLeg.addChild(this.bipedLeftLegWear);
|
||||||
|
this.solidLeftLegWear = new ModelLimbWear(this,"leg","left","Steve");
|
||||||
|
this.bipedLeftLeg.addChild(this.solidLeftLegWear);
|
||||||
|
|
||||||
|
|
||||||
headwear = new ModelHeadwear(this);
|
headwear = new ModelHeadwear(this);
|
||||||
legs = new ModelLegs(this, (ModelScaleRenderer)bipedRightLeg, (ModelScaleRenderer)bipedLeftLeg, 64, 64);
|
legs = new ModelLegs(this, (ModelScaleRenderer)bipedRightLeg, (ModelScaleRenderer)bipedLeftLeg, 64, 64);
|
||||||
// bodywear = new ModelBodywear(this);
|
bodywear = new ModelBodywear(this);
|
||||||
|
|
||||||
this.bipedBody.addChild(breasts = new ModelBreasts(this, 64, 64));
|
this.bipedBody.addChild(breasts = new ModelBreasts(this, 64, 64));
|
||||||
if(!isArmor){
|
if(!isArmor){
|
||||||
@@ -235,16 +244,24 @@ public class ModelMPM extends ModelNPCMale{
|
|||||||
this.bipedBody.addChild(this.bipedBodywear);
|
this.bipedBody.addChild(this.bipedBodywear);
|
||||||
|
|
||||||
// Arms
|
// Arms
|
||||||
this.bipedRightArmwear = (new ModelScaleRenderer(this, 0, 0));
|
this.bipedRightArmWear = (new ModelScaleRenderer(this, 0, 0));
|
||||||
this.bipedRightArm.addChild(this.bipedRightArmwear);
|
this.bipedRightArm.addChild(this.bipedRightArmWear);
|
||||||
|
this.solidRightArmWear = (new ModelScaleRenderer(this, 0, 0));
|
||||||
|
this.bipedRightArm.addChild(this.solidRightArmWear);
|
||||||
this.bipedLeftArmwear = new ModelScaleRenderer(this, 0, 0);
|
this.bipedLeftArmwear = new ModelScaleRenderer(this, 0, 0);
|
||||||
this.bipedLeftArm.addChild(this.bipedLeftArmwear);
|
this.bipedLeftArm.addChild(this.bipedLeftArmwear);
|
||||||
|
this.solidLeftArmWear = (new ModelScaleRenderer(this, 0, 0));
|
||||||
|
this.bipedLeftArm.addChild(this.solidLeftArmWear);
|
||||||
|
|
||||||
// Legs
|
// Legs
|
||||||
this.bipedRightLegWear = (new ModelScaleRenderer(this, 0, 0));
|
this.bipedRightLegWear = (new ModelScaleRenderer(this, 0, 0));
|
||||||
this.bipedRightLeg.addChild(this.bipedRightLegWear);
|
this.bipedRightLeg.addChild(this.bipedRightLegWear);
|
||||||
|
this.solidRightLegWear = new ModelScaleRenderer(this, 0, 0);
|
||||||
|
this.bipedRightLeg.addChild(this.solidRightLegWear);
|
||||||
this.bipedLeftLegWear = new ModelScaleRenderer(this, 0, 0);
|
this.bipedLeftLegWear = new ModelScaleRenderer(this, 0, 0);
|
||||||
this.bipedLeftLeg.addChild(this.bipedLeftLegWear);
|
this.bipedLeftLeg.addChild(this.bipedLeftLegWear);
|
||||||
|
this.solidLeftLegWear = new ModelScaleRenderer(this, 0, 0);
|
||||||
|
this.bipedLeftLeg.addChild(this.solidLeftLegWear);
|
||||||
|
|
||||||
headwear = new ModelHeadwear(this, true);
|
headwear = new ModelHeadwear(this, true);
|
||||||
legs = new ModelLegs(this, (ModelScaleRenderer)bipedRightLeg, (ModelScaleRenderer)bipedLeftLeg, 64, 32);
|
legs = new ModelLegs(this, (ModelScaleRenderer)bipedRightLeg, (ModelScaleRenderer)bipedLeftLeg, 64, 32);
|
||||||
@@ -539,7 +556,24 @@ public class ModelMPM extends ModelNPCMale{
|
|||||||
((ModelScaleRenderer)this.bipedBody).isHidden = entity.modelData.hideBody == 1;
|
((ModelScaleRenderer)this.bipedBody).isHidden = entity.modelData.hideBody == 1;
|
||||||
|
|
||||||
// Hide Bodywear
|
// Hide Bodywear
|
||||||
((ModelScaleRenderer)this.bipedBodywear).isHidden = entity.modelData.bodywear != 1;
|
((ModelScaleRenderer)this.bipedBodywear).isHidden = entity.modelData.bodywear == 0;
|
||||||
|
|
||||||
|
if(bipedBodywear.showModel && !bipedBodywear.isHidden){
|
||||||
|
if(entity.modelData.bodywear == 1 || isArmor){
|
||||||
|
((ModelScaleRenderer)this.bipedBodywear).setConfig(entity.modelData.body,x,y,z);
|
||||||
|
((ModelScaleRenderer)this.bipedBodywear).render(f);
|
||||||
|
}
|
||||||
|
else if(entity.modelData.bodywear == 2){
|
||||||
|
this.bodywear.rotateAngleX = bipedBodywear.rotateAngleX;
|
||||||
|
this.bodywear.rotateAngleY = bipedBodywear.rotateAngleY;
|
||||||
|
this.bodywear.rotateAngleZ = bipedBodywear.rotateAngleZ;
|
||||||
|
this.bodywear.rotationPointX = bipedBodywear.rotationPointX;
|
||||||
|
this.bodywear.rotationPointY = bipedBodywear.rotationPointY;
|
||||||
|
this.bodywear.rotationPointZ = bipedBodywear.rotationPointZ;
|
||||||
|
this.bodywear.setConfig(entity.modelData.body,x,y,z);
|
||||||
|
this.bodywear.render(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
((ModelScaleRenderer)this.bipedBody).setConfig(body,x,y,z);
|
((ModelScaleRenderer)this.bipedBody).setConfig(body,x,y,z);
|
||||||
((ModelScaleRenderer)this.bipedBody).render(f);
|
((ModelScaleRenderer)this.bipedBody).render(f);
|
||||||
@@ -581,20 +615,31 @@ public class ModelMPM extends ModelNPCMale{
|
|||||||
|
|
||||||
// Hide Armwear
|
// Hide Armwear
|
||||||
if(entity.modelData.armwear == 1){
|
if(entity.modelData.armwear == 1){
|
||||||
((ModelScaleRenderer)this.bipedRightArmwear).isHidden = false;
|
((ModelScaleRenderer)this.bipedRightArmWear).isHidden = entity.modelData.solidArmwear == 1 || entity.modelData.solidArmwear == 3;
|
||||||
((ModelScaleRenderer)this.bipedLeftArmwear).isHidden = false;
|
((ModelScaleRenderer)this.bipedLeftArmwear).isHidden = entity.modelData.solidArmwear == 1 || entity.modelData.solidArmwear == 2;
|
||||||
|
|
||||||
|
this.solidRightArmWear.isHidden = entity.modelData.solidArmwear == 0 || entity.modelData.solidArmwear == 2;
|
||||||
|
this.solidLeftArmWear.isHidden = entity.modelData.solidArmwear == 0 || entity.modelData.solidArmwear == 3;
|
||||||
}
|
}
|
||||||
else if(entity.modelData.armwear == 2){
|
else if(entity.modelData.armwear == 2){
|
||||||
((ModelScaleRenderer)this.bipedRightArmwear).isHidden = true;
|
((ModelScaleRenderer)this.bipedRightArmWear).isHidden = true;
|
||||||
((ModelScaleRenderer)this.bipedLeftArmwear).isHidden = false;
|
((ModelScaleRenderer)this.bipedLeftArmwear).isHidden = entity.modelData.solidArmwear == 1 || entity.modelData.solidArmwear == 2;
|
||||||
|
|
||||||
|
this.solidRightArmWear.isHidden = true;
|
||||||
|
this.solidLeftArmWear.isHidden = entity.modelData.solidArmwear == 0 || entity.modelData.solidArmwear == 3;
|
||||||
}
|
}
|
||||||
else if(entity.modelData.armwear == 3){
|
else if(entity.modelData.armwear == 3){
|
||||||
((ModelScaleRenderer)this.bipedRightArmwear).isHidden = false;
|
((ModelScaleRenderer)this.bipedRightArmWear).isHidden = entity.modelData.solidArmwear == 1 || entity.modelData.solidArmwear == 3;
|
||||||
((ModelScaleRenderer)this.bipedLeftArmwear).isHidden = true;
|
((ModelScaleRenderer)this.bipedLeftArmwear).isHidden = true;
|
||||||
|
|
||||||
|
this.solidRightArmWear.isHidden = entity.modelData.solidArmwear == 0 || entity.modelData.solidArmwear == 2;
|
||||||
|
this.solidLeftArmWear.isHidden = true;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
((ModelScaleRenderer)this.bipedRightArmwear).isHidden = true;
|
((ModelScaleRenderer)this.bipedRightArmWear).isHidden = true;
|
||||||
((ModelScaleRenderer)this.bipedLeftArmwear).isHidden = true;
|
((ModelScaleRenderer)this.bipedLeftArmwear).isHidden = true;
|
||||||
|
this.solidRightArmWear.isHidden = true;
|
||||||
|
this.solidLeftArmWear.isHidden = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!bo){
|
if(!bo){
|
||||||
@@ -641,20 +686,31 @@ public class ModelMPM extends ModelNPCMale{
|
|||||||
|
|
||||||
// Hide Legwear
|
// Hide Legwear
|
||||||
if(entity.modelData.legwear == 1){
|
if(entity.modelData.legwear == 1){
|
||||||
((ModelScaleRenderer)this.bipedRightLegWear).isHidden = false;
|
((ModelScaleRenderer)this.bipedRightLegWear).isHidden = entity.modelData.solidLegwear == 1 || entity.modelData.solidLegwear == 3;
|
||||||
((ModelScaleRenderer)this.bipedLeftLegWear).isHidden = false;
|
((ModelScaleRenderer)this.bipedLeftLegWear).isHidden = entity.modelData.solidLegwear == 1 || entity.modelData.solidLegwear == 2;
|
||||||
|
|
||||||
|
this.solidRightLegWear.isHidden = entity.modelData.solidLegwear == 0 || entity.modelData.solidLegwear == 2;
|
||||||
|
this.solidLeftLegWear.isHidden = entity.modelData.solidLegwear == 0 || entity.modelData.solidLegwear == 3;
|
||||||
}
|
}
|
||||||
else if(entity.modelData.legwear == 2){
|
else if(entity.modelData.legwear == 2){
|
||||||
((ModelScaleRenderer)this.bipedRightLegWear).isHidden = true;
|
((ModelScaleRenderer)this.bipedRightLegWear).isHidden = true;
|
||||||
((ModelScaleRenderer)this.bipedLeftLegWear).isHidden = false;
|
((ModelScaleRenderer)this.bipedLeftLegWear).isHidden = entity.modelData.solidLegwear == 1 || entity.modelData.solidLegwear == 2;
|
||||||
|
|
||||||
|
this.solidRightLegWear.isHidden = true;
|
||||||
|
this.solidLeftLegWear.isHidden = entity.modelData.solidLegwear == 0 || entity.modelData.solidLegwear == 3;
|
||||||
}
|
}
|
||||||
else if(entity.modelData.legwear == 3){
|
else if(entity.modelData.legwear == 3){
|
||||||
((ModelScaleRenderer)this.bipedRightLegWear).isHidden = false;
|
((ModelScaleRenderer)this.bipedRightLegWear).isHidden = entity.modelData.solidLegwear == 1 || entity.modelData.solidLegwear == 3;
|
||||||
((ModelScaleRenderer)this.bipedLeftLegWear).isHidden = true;
|
((ModelScaleRenderer)this.bipedLeftLegWear).isHidden = true;
|
||||||
|
|
||||||
|
this.solidRightLegWear.isHidden = entity.modelData.solidLegwear == 0 || entity.modelData.solidLegwear == 2;
|
||||||
|
this.solidLeftLegWear.isHidden = true;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
((ModelScaleRenderer)this.bipedRightLegWear).isHidden = true;
|
((ModelScaleRenderer)this.bipedRightLegWear).isHidden = true;
|
||||||
((ModelScaleRenderer)this.bipedLeftLegWear).isHidden = true;
|
((ModelScaleRenderer)this.bipedLeftLegWear).isHidden = true;
|
||||||
|
this.solidRightLegWear.isHidden = true;
|
||||||
|
this.solidLeftLegWear.isHidden = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.legs.setConfig(legs,x,y,z);
|
this.legs.setConfig(legs,x,y,z);
|
||||||
|
|||||||
@@ -10,54 +10,47 @@ public class ModelBodywear extends ModelScaleRenderer{
|
|||||||
public ModelBodywear(ModelBase base) {
|
public ModelBodywear(ModelBase base) {
|
||||||
super(base);
|
super(base);
|
||||||
|
|
||||||
float scaler = 0.81f;
|
float thick = 0.50f;
|
||||||
float thick = 0.65f;
|
|
||||||
|
|
||||||
float x = -0.10f;
|
|
||||||
float y = 12.76f;
|
|
||||||
float z = -0.5f;
|
|
||||||
|
|
||||||
float z1 = 0.27f;
|
|
||||||
|
|
||||||
Model2DRenderer front = new Model2DRenderer(base, 20, 36, 8, 12, 64, 64);
|
Model2DRenderer front = new Model2DRenderer(base, 20, 36, 8, 12, 64, 64);
|
||||||
front.setRotationPoint(-4.588f, 0 + y, -2.302f + z);
|
front.setRotationPoint(-4.53f, 12.535f, -2.52f);
|
||||||
front.setScale(scaler);
|
front.setScale(0.85f,0.8175f);
|
||||||
front.setThickness(thick);
|
front.setThickness(thick);
|
||||||
setRotation(front, 0, 0, 0);
|
setRotation(front, 0, 0, 0);
|
||||||
this.addChild(front);
|
this.addChild(front);
|
||||||
|
|
||||||
Model2DRenderer back = new Model2DRenderer(base, 32, 36, 8, 12, 64, 64);
|
Model2DRenderer back = new Model2DRenderer(base, 32, 36, 8, 12, 64, 64);
|
||||||
back.setRotationPoint(4.588f, 0 + y, 2.302f);
|
back.setRotationPoint(4.53f, 12.535f, 2.52f);
|
||||||
back.setScale(scaler);
|
back.setScale(0.85f,0.8175f);
|
||||||
back.setThickness(thick);
|
back.setThickness(thick);
|
||||||
setRotation(back, 0, (float)(Math.PI), 0);
|
setRotation(back, 0, (float)(Math.PI), 0);
|
||||||
this.addChild(back);
|
this.addChild(back);
|
||||||
|
|
||||||
Model2DRenderer right = new Model2DRenderer(base, 28, 36, 4, 12, 64, 64);
|
Model2DRenderer right = new Model2DRenderer(base, 28, 36, 4, 12, 64, 64);
|
||||||
right.setRotationPoint(3.9425f, 0 + y, 2.29695f);
|
right.setRotationPoint(4.03f, 12.55f, 2.55f);
|
||||||
right.setScale(scaler);
|
right.setScale(0.96f,0.82f);
|
||||||
right.setThickness(thick);
|
right.setThickness(thick);
|
||||||
setRotation(right, 0, (float)(Math.PI/2f), 0);
|
setRotation(right, 0, (float)(Math.PI/2f), 0);
|
||||||
this.addChild(right);
|
this.addChild(right);
|
||||||
|
|
||||||
Model2DRenderer left = new Model2DRenderer(base, 16, 36, 4, 12, 64, 64);
|
Model2DRenderer left = new Model2DRenderer(base, 16, 36, 4, 12, 64, 64);
|
||||||
left.setRotationPoint(-3.9425f, 0 + y, -2.29695f + z);
|
left.setRotationPoint(-4.03f, 12.55f, -2.55f);
|
||||||
left.setScale(scaler);
|
left.setScale(0.96f,0.82f);
|
||||||
left.setThickness(thick);
|
left.setThickness(thick);
|
||||||
setRotation(left, 0, (float)(Math.PI/-2f), 0);
|
setRotation(left, 0, (float)(Math.PI/-2f), 0);
|
||||||
this.addChild(left);
|
this.addChild(left);
|
||||||
|
|
||||||
|
|
||||||
Model2DRenderer top = new Model2DRenderer(base, 20, 32, 8, 4, 64, 64);
|
Model2DRenderer top = new Model2DRenderer(base, 20, 32, 8, 4, 64, 64);
|
||||||
top.setRotationPoint(-4.588f, -13.0f + y, -2.29695f);
|
top.setRotationPoint(-4.5f, -0.6f, -2.525f);
|
||||||
top.setScale(scaler/3);
|
top.setScale(0.2815f,0.315f);
|
||||||
top.setThickness(thick);
|
top.setThickness(thick);
|
||||||
setRotation(top, (float)(Math.PI / -2), 0, 0);
|
setRotation(top, (float)(Math.PI / -2), 0, 0);
|
||||||
this.addChild(top);
|
this.addChild(top);
|
||||||
|
|
||||||
Model2DRenderer bottom = new Model2DRenderer(base, 28, 32, 8, 4, 64, 64);
|
Model2DRenderer bottom = new Model2DRenderer(base, 28, 32, 8, 4, 64, 64);
|
||||||
bottom.setRotationPoint(-4.588f, -0.65f + y, -2.29695f);
|
bottom.setRotationPoint(-4.5f, 12.11f, -2.525f);
|
||||||
bottom.setScale(scaler/3);
|
bottom.setScale(0.2815f,0.315f);
|
||||||
bottom.setThickness(thick);
|
bottom.setThickness(thick);
|
||||||
setRotation(bottom, (float)(Math.PI / -2), 0, 0);
|
setRotation(bottom, (float)(Math.PI / -2), 0, 0);
|
||||||
this.addChild(bottom);
|
this.addChild(bottom);
|
||||||
|
|||||||
@@ -0,0 +1,345 @@
|
|||||||
|
|
||||||
|
|
||||||
|
package noppes.npcs.client.model.part;
|
||||||
|
|
||||||
|
import net.minecraft.client.model.ModelBase;
|
||||||
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
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, String type) {
|
||||||
|
super(base);
|
||||||
|
|
||||||
|
float thick = 0.55f;
|
||||||
|
switch (limb){
|
||||||
|
case "arm":
|
||||||
|
switch(type) {
|
||||||
|
case "Steve":
|
||||||
|
switch (side) {
|
||||||
|
case "right":
|
||||||
|
rightArm(base, thick);
|
||||||
|
break;
|
||||||
|
case "left":
|
||||||
|
leftArm(base, thick);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "Alex":
|
||||||
|
switch (side) {
|
||||||
|
case "right":
|
||||||
|
rightArmAlex(base, thick);
|
||||||
|
break;
|
||||||
|
case "left":
|
||||||
|
leftArmAlex(base, thick);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "leg":
|
||||||
|
switch (side){
|
||||||
|
case "right":
|
||||||
|
rightLeg(base,thick);
|
||||||
|
break;
|
||||||
|
case "left":
|
||||||
|
leftLeg(base,thick);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
Model2DRenderer front = new Model2DRenderer(base, 44, 36, 4, 12, 64, 64);
|
||||||
|
front.setRotationPoint(-4.52f+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, 52, 36, 4, 12, 64, 64);
|
||||||
|
back.setRotationPoint(0.6f+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, 48, 36, 4, 12, 64, 64);
|
||||||
|
right.setRotationPoint(0.62f+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(-4.56f+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, 4, 4, 64, 64);
|
||||||
|
top.setRotationPoint(-4.525f+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, 48, 32, 4, 4, 64, 64);
|
||||||
|
bottom.setRotationPoint(-4.5f+x, 12.0f+y, -2.525f);
|
||||||
|
bottom.setScale(0.32f);
|
||||||
|
bottom.setThickness(thick);
|
||||||
|
setRotation(bottom, (float)(Math.PI / -2), 0, 0);
|
||||||
|
this.addChild(bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void leftArm(ModelBase base,float thick){
|
||||||
|
float x = 2.95f;
|
||||||
|
float y = -2.0f;
|
||||||
|
|
||||||
|
Model2DRenderer front = new Model2DRenderer(base, 52, 52, 4, 12, 64, 64);
|
||||||
|
front.setRotationPoint(-4.52f+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, 60, 52, 4, 12, 64, 64);
|
||||||
|
back.setRotationPoint(0.6f+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, 56, 52, 4, 12, 64, 64);
|
||||||
|
right.setRotationPoint(0.62f+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, 48, 52, 4, 12, 64, 64);
|
||||||
|
left.setRotationPoint(-4.56f+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, 52, 48, 4, 4, 64, 64);
|
||||||
|
top.setRotationPoint(-4.525f+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, 56, 48, 4, 4, 64, 64);
|
||||||
|
bottom.setRotationPoint(-4.56f+x, 12.0f+y, -2.55f);
|
||||||
|
bottom.setScale(0.32f);
|
||||||
|
bottom.setThickness(thick);
|
||||||
|
setRotation(bottom, (float)(Math.PI / -2), 0, 0);
|
||||||
|
this.addChild(bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void rightLeg(ModelBase base, float thick){
|
||||||
|
float x = 1.8f;
|
||||||
|
float y = 0.0f;
|
||||||
|
|
||||||
|
Model2DRenderer front = new Model2DRenderer(base, 4, 36, 4, 12, 64, 64);
|
||||||
|
front.setRotationPoint(-4.52f+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, 12, 36, 4, 12, 64, 64);
|
||||||
|
back.setRotationPoint(0.6f+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, 8, 36, 4, 12, 64, 64);
|
||||||
|
right.setRotationPoint(0.62f+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, 0, 36, 4, 12, 64, 64);
|
||||||
|
left.setRotationPoint(-4.53f+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, 4, 32, 4, 4, 64, 64);
|
||||||
|
top.setRotationPoint(-4.525f+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, 8, 32, 4, 4, 64, 64);
|
||||||
|
bottom.setRotationPoint(-4.5f+x, 12.11f+y, -2.525f);
|
||||||
|
bottom.setScale(0.32f);
|
||||||
|
bottom.setThickness(thick);
|
||||||
|
setRotation(bottom, (float)(Math.PI / -2), 0, 0);
|
||||||
|
this.addChild(bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void leftLeg(ModelBase base,float thick){
|
||||||
|
float x = 2.05f;
|
||||||
|
float y = 0.0f;
|
||||||
|
|
||||||
|
Model2DRenderer front = new Model2DRenderer(base, 4, 52, 4, 12, 64, 64);
|
||||||
|
front.setRotationPoint(-4.52f+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, 12, 52, 4, 12, 64, 64);
|
||||||
|
back.setRotationPoint(0.6f+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, 8, 52, 4, 12, 64, 64);
|
||||||
|
right.setRotationPoint(0.62f+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, 0, 52, 4, 12, 64, 64);
|
||||||
|
left.setRotationPoint(-4.53f+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, 4, 48, 4, 4, 64, 64);
|
||||||
|
top.setRotationPoint(-4.525f+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, 8, 48, 4, 4, 64, 64);
|
||||||
|
bottom.setRotationPoint(-4.5f+x, 12.11f+y, -2.525f);
|
||||||
|
bottom.setScale(0.32f);
|
||||||
|
bottom.setThickness(thick);
|
||||||
|
setRotation(bottom, (float)(Math.PI / -2), 0, 0);
|
||||||
|
this.addChild(bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||||
|
model.rotateAngleX = x;
|
||||||
|
model.rotateAngleY = y;
|
||||||
|
model.rotateAngleZ = z;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -112,8 +112,6 @@ public class RenderCustomNpc extends RenderNPCHumanMale{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doRender(EntityLiving entityliving, double d, double d1, double d2, float f, float f1){
|
public void doRender(EntityLiving entityliving, double d, double d1, double d2, float f, float f1){
|
||||||
EntityNPCInterface npc = (EntityNPCInterface) entityliving;
|
|
||||||
|
|
||||||
super.doRender(entityliving, d, d1, d2, f, f1);
|
super.doRender(entityliving, d, d1, d2, f, f1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -255,7 +255,13 @@ public class RenderNPCHumanMale extends RenderNPCInterface
|
|||||||
GL11.glTranslatef(x, cnpc.modelData.getBodyY(), 0);
|
GL11.glTranslatef(x, cnpc.modelData.getBodyY(), 0);
|
||||||
}
|
}
|
||||||
this.modelBipedMain.bipedRightArm.postRender(0.0625F);
|
this.modelBipedMain.bipedRightArm.postRender(0.0625F);
|
||||||
GL11.glTranslatef(-0.0625F, 0.4375F + y, 0.0625F);
|
|
||||||
|
if(npc.getModelType() == 2){
|
||||||
|
GL11.glTranslatef(-0.0125F, 0.4375F + y, 0.0625F);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
GL11.glTranslatef(-0.0625F, 0.4375F + y, 0.0625F);
|
||||||
|
}
|
||||||
|
|
||||||
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack2, EQUIPPED);
|
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack2, EQUIPPED);
|
||||||
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack2, BLOCK_3D));
|
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack2, BLOCK_3D));
|
||||||
@@ -269,8 +275,7 @@ public class RenderNPCHumanMale extends RenderNPCInterface
|
|||||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||||
GL11.glScalef(-var6, -var6, var6);
|
GL11.glScalef(-var6, -var6, var6);
|
||||||
}
|
}
|
||||||
// CHANGE HERE
|
else if (itemstack2.getItem() instanceof ItemBow && customRenderer == null)
|
||||||
else if (itemstack2.getItem() instanceof ItemBow)
|
|
||||||
{
|
{
|
||||||
var6 = 0.625F;
|
var6 = 0.625F;
|
||||||
GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
|
GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
|
||||||
@@ -343,8 +348,15 @@ public class RenderNPCHumanMale extends RenderNPCInterface
|
|||||||
GL11.glTranslatef(x, cnpc.modelData.getBodyY(), 0);
|
GL11.glTranslatef(x, cnpc.modelData.getBodyY(), 0);
|
||||||
}
|
}
|
||||||
this.modelBipedMain.bipedLeftArm.postRender(0.0625F);
|
this.modelBipedMain.bipedLeftArm.postRender(0.0625F);
|
||||||
GL11.glTranslatef(0.0625F, 0.4375F + y, 0.0625F);
|
|
||||||
float var6;
|
if(npc.getModelType() == 2){
|
||||||
|
GL11.glTranslatef(0.0125F, 0.4375F + y, 0.0625F);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
GL11.glTranslatef(0.0625F, 0.4375F + y, 0.0625F);
|
||||||
|
}
|
||||||
|
|
||||||
|
float var6;
|
||||||
|
|
||||||
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack2, EQUIPPED);
|
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack2, EQUIPPED);
|
||||||
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack2, BLOCK_3D));
|
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack2, BLOCK_3D));
|
||||||
@@ -362,7 +374,7 @@ public class RenderNPCHumanMale extends RenderNPCInterface
|
|||||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||||
GL11.glScalef(var6, -var6, var6);
|
GL11.glScalef(var6, -var6, var6);
|
||||||
}
|
}
|
||||||
else if (itemstack2.getItem() instanceof ItemBow)
|
else if (itemstack2.getItem() instanceof ItemBow && customRenderer == null)
|
||||||
{
|
{
|
||||||
var6 = 0.625F;
|
var6 = 0.625F;
|
||||||
GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
|
GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
|
||||||
|
|||||||
@@ -219,7 +219,6 @@ public class RenderNPCPony extends RenderNPCInterface
|
|||||||
float f4 = 0.375F * f;
|
float f4 = 0.375F * f;
|
||||||
GL11.glScalef(f4, -f4, f4);
|
GL11.glScalef(f4, -f4, f4);
|
||||||
} else
|
} else
|
||||||
// CHANGE HERE
|
|
||||||
if(itemstack.getItem() instanceof ItemBow)
|
if(itemstack.getItem() instanceof ItemBow)
|
||||||
{
|
{
|
||||||
GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
|
GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package noppes.npcs.constants;
|
package noppes.npcs.constants;
|
||||||
|
|
||||||
public enum EnumGuiType {
|
public enum EnumGuiType {
|
||||||
MainMenuDisplay, MainMenuInv, MainMenuStats, ManageFactions, MainMenuAdvanced, MainMenuGlobal, PlayerBankSmall, PlayerFollowerHire, PlayerFollower, SetupItemGiver, SetupTrader, SetupFollower, PlayerTrader, PlayerTransporter, RedstoneBlock, SetupTransporter, ManageTransport, ManageBanks, MobSpawner, SetupBank, ManageDialogs, ManageQuests, PlayerAnvil, QuestReward, ManageRecipes, QuestItem, NpcRemote, ScriptEvent, MoneyBag, MainMenuAI, MovingPath, PlayerBankUnlock, PlayerBankUprade, PlayerBankLarge, MobSpawnerAdd, PlayerMailbox, PlayerMailman, Waypoint, MerchantAdd, MobSpawnerMounter, Crate, NpcDimensions, Border, BigSign, Script, Companion, CompanionInv, CompanionTalent, CompanionTrader, ManageLinked
|
MainMenuDisplay, MainMenuInv, MainMenuStats, ManageFactions, MainMenuAdvanced, MainMenuGlobal, PlayerBankSmall, PlayerFollowerHire, PlayerFollower, SetupItemGiver, SetupTrader, SetupFollower, PlayerTrader, PlayerTransporter, RedstoneBlock, SetupTransporter, ManageTransport, ManageBanks, MobSpawner, SetupBank, ManageDialogs, ManageQuests, PlayerAnvil, QuestReward, ManageRecipes, QuestItem, NpcRemote, ScriptEvent, MoneyBag, MainMenuAI, MovingPath, PlayerBankUnlock, PlayerBankUprade, PlayerBankLarge, MobSpawnerAdd, PlayerMailbox, PlayerMailman, Waypoint, MerchantAdd, MobSpawnerMounter, Crate, NpcDimensions, Border, BigSign, Script, Companion, CompanionInv, CompanionTalent, CompanionTrader, ManageLinked, CustomGui;
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package noppes.npcs.constants;
|
package noppes.npcs.constants;
|
||||||
|
|
||||||
public enum EnumPacketClient {
|
public enum EnumPacketClient {
|
||||||
CHAT, MESSAGE, SYNCRECIPES_ADD, SYNCRECIPES_WORKBENCH, DIALOG, QUEST_COMPLETION, EDIT_NPC, PLAY_SOUND, PLAY_MUSIC, UPDATE_NPC, ROLE, GUI, SCRIPTED_PARTICLE, PARTICLE, DELETE_NPC, SCROLL_LIST, SCROLL_DATA, SCROLL_DATA_PART, SCROLL_SELECTED, GUI_REDSTONE, GUI_WAYPOINT, GUI_DATA, GUI_ERROR, GUI_CLOSE, VILLAGER_LIST, CHATBUBBLE, SYNCRECIPES_CARPENTRYBENCH, CLONE, OPEN_BOOK, DIALOG_DUMMY, CONFIG, ISGUIOPEN
|
CHAT, MESSAGE, SYNCRECIPES_ADD, SYNCRECIPES_WORKBENCH, DIALOG, QUEST_COMPLETION, EDIT_NPC, PLAY_SOUND, PLAY_MUSIC, UPDATE_NPC, ROLE, GUI, SCRIPTED_PARTICLE, PARTICLE, DELETE_NPC, SCROLL_LIST, SCROLL_DATA, SCROLL_DATA_PART, SCROLL_SELECTED, GUI_REDSTONE, GUI_WAYPOINT, GUI_DATA, GUI_ERROR, GUI_CLOSE, VILLAGER_LIST, CHATBUBBLE, SYNCRECIPES_CARPENTRYBENCH, CLONE, OPEN_BOOK, DIALOG_DUMMY, CONFIG, ISGUIOPEN, OVERLAY_DATA, OVERLAY_CLOSE
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -40,6 +40,9 @@ public enum EnumPacketServer {
|
|||||||
ScriptForgeSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
|
ScriptForgeSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
|
||||||
ScriptForgeGet(false),
|
ScriptForgeGet(false),
|
||||||
|
|
||||||
|
ScriptNPCSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
|
||||||
|
ScriptNPCGet(false),
|
||||||
|
|
||||||
LinkedGetAll, LinkedRemove(CustomNpcsPermissions.GLOBAL_LINKED), LinkedAdd(CustomNpcsPermissions.GLOBAL_LINKED),
|
LinkedGetAll, LinkedRemove(CustomNpcsPermissions.GLOBAL_LINKED), LinkedAdd(CustomNpcsPermissions.GLOBAL_LINKED),
|
||||||
ScriptDataSave(CustomNpcsPermissions.TOOL_SCRIPTER, true), ScriptDataGet(true),
|
ScriptDataSave(CustomNpcsPermissions.TOOL_SCRIPTER, true), ScriptDataGet(true),
|
||||||
PlayerDataRemove(CustomNpcsPermissions.GLOBAL_PLAYERDATA),
|
PlayerDataRemove(CustomNpcsPermissions.GLOBAL_PLAYERDATA),
|
||||||
@@ -76,7 +79,9 @@ public enum EnumPacketServer {
|
|||||||
RemoteTpToNpc,QuestGet, QuestCategoryGet,
|
RemoteTpToNpc,QuestGet, QuestCategoryGet,
|
||||||
SaveTileEntity,
|
SaveTileEntity,
|
||||||
NaturalSpawnGetAll, MailOpenSetup,
|
NaturalSpawnGetAll, MailOpenSetup,
|
||||||
DimensionsGet, DimensionTeleport, GetTileEntity, Gui, IsGuiOpen;
|
DimensionsGet, DimensionTeleport, GetTileEntity, Gui, IsGuiOpen,
|
||||||
|
|
||||||
|
CustomGuiButton,CustomGuiSlotChange,CustomGuiScrollClick,CustomGuiClose,CustomGuiUnfocused;
|
||||||
|
|
||||||
public CustomNpcsPermissions.Permission permission = null;
|
public CustomNpcsPermissions.Permission permission = null;
|
||||||
public boolean needsNpc = false;
|
public boolean needsNpc = false;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public enum EnumScriptType {
|
|||||||
TARGET("target"),
|
TARGET("target"),
|
||||||
COLLIDE("collide"),
|
COLLIDE("collide"),
|
||||||
KILLS("kills"),
|
KILLS("kills"),
|
||||||
DIALOG_OPTION("dialogOption"),
|
DIALOG_CLOSE("dialogClose"),
|
||||||
TIMER("timer"),
|
TIMER("timer"),
|
||||||
|
|
||||||
ATTACK_MELEE("meleeAttack"),
|
ATTACK_MELEE("meleeAttack"),
|
||||||
@@ -36,7 +36,6 @@ public enum EnumScriptType {
|
|||||||
LOGOUT("logout"),
|
LOGOUT("logout"),
|
||||||
CHAT("chat"),
|
CHAT("chat"),
|
||||||
DAMAGED_ENTITY("damagedEntity"),
|
DAMAGED_ENTITY("damagedEntity"),
|
||||||
DIALOG_CLOSE("dialogClose"),
|
|
||||||
SPAWN("spawn"),
|
SPAWN("spawn"),
|
||||||
TOSSED("tossed"),
|
TOSSED("tossed"),
|
||||||
PICKEDUP("pickedUp"),
|
PICKEDUP("pickedUp"),
|
||||||
@@ -44,10 +43,13 @@ public enum EnumScriptType {
|
|||||||
PROJECTILE_TICK("projectileTick"),
|
PROJECTILE_TICK("projectileTick"),
|
||||||
PROJECTILE_IMPACT("projectileImpact"),
|
PROJECTILE_IMPACT("projectileImpact"),
|
||||||
LEVEL_UP("levelUp"),
|
LEVEL_UP("levelUp"),
|
||||||
|
KEY_PRESSED("keyPressed"),
|
||||||
QUEST_START("questStart"),
|
QUEST_START("questStart"),
|
||||||
QUEST_COMPLETED("questCompleted"),
|
QUEST_COMPLETED("questCompleted"),
|
||||||
QUEST_TURNIN("questTurnIn"),
|
QUEST_TURNIN("questTurnIn"),
|
||||||
KEY_PRESSED("keyPressed"),
|
FACTION_POINTS("factionPoints"),
|
||||||
|
DIALOG_OPEN("dialogOpen"),
|
||||||
|
DIALOG_OPTION("dialogOption"),
|
||||||
CUSTOM_CHEST_CLOSED("customChestClosed"),
|
CUSTOM_CHEST_CLOSED("customChestClosed"),
|
||||||
CUSTOM_CHEST_CLICKED("customChestClicked"),
|
CUSTOM_CHEST_CLICKED("customChestClicked"),
|
||||||
SCRIPT_COMMAND("scriptCommand"),
|
SCRIPT_COMMAND("scriptCommand"),
|
||||||
@@ -55,6 +57,7 @@ public enum EnumScriptType {
|
|||||||
CUSTOM_GUI_BUTTON("customGuiButton"),
|
CUSTOM_GUI_BUTTON("customGuiButton"),
|
||||||
CUSTOM_GUI_SLOT("customGuiSlot"),
|
CUSTOM_GUI_SLOT("customGuiSlot"),
|
||||||
CUSTOM_GUI_SCROLL("customGuiScroll"),
|
CUSTOM_GUI_SCROLL("customGuiScroll"),
|
||||||
|
CUSTOM_GUI_TEXTFIELD("customGuiTextfield"),
|
||||||
PICKUP_XP("pickupXP"),
|
PICKUP_XP("pickupXP"),
|
||||||
MOUSE_CLICKED("mouseClicked"),
|
MOUSE_CLICKED("mouseClicked"),
|
||||||
START_USING_ITEM("startItem"),
|
START_USING_ITEM("startItem"),
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by FernFlower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package noppes.npcs.containers;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import noppes.npcs.scripted.interfaces.IItemSlot;
|
||||||
|
import noppes.npcs.scripted.gui.ScriptGui;
|
||||||
|
import noppes.npcs.client.gui.custom.components.CustomGuiSlot;
|
||||||
|
|
||||||
|
public class ContainerCustomGui extends Container {
|
||||||
|
public ScriptGui customGui;
|
||||||
|
public IInventory guiInventory;
|
||||||
|
int slotCount = 0;
|
||||||
|
|
||||||
|
public int playerInvX;
|
||||||
|
public int playerInvY;
|
||||||
|
|
||||||
|
public ContainerCustomGui(IInventory inventory) {
|
||||||
|
this.guiInventory = inventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGui(ScriptGui gui, EntityPlayer player) {
|
||||||
|
this.customGui = gui;
|
||||||
|
|
||||||
|
if (this.customGui.getShowPlayerInv()) {
|
||||||
|
this.addPlayerInventory(player, this.customGui.getPlayerInvX(), this.customGui.getPlayerInvY());
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator var3 = this.customGui.getSlots().iterator();
|
||||||
|
|
||||||
|
while(var3.hasNext()) {
|
||||||
|
IItemSlot slot = (IItemSlot)var3.next();
|
||||||
|
if (slot.hasStack()) {
|
||||||
|
this.addSlot(slot.getPosX(), slot.getPosY(), slot.getStack().getMCItemStack(), player.worldObj.isRemote);
|
||||||
|
} else {
|
||||||
|
this.addSlot(slot.getPosX(), slot.getPosY(), player.worldObj.isRemote);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
|
||||||
|
ItemStack itemstack = null;
|
||||||
|
Slot slot = (Slot)this.inventorySlots.get(index);
|
||||||
|
if (slot != null && slot.getHasStack()) {
|
||||||
|
ItemStack itemstack1 = slot.getStack();
|
||||||
|
itemstack = itemstack1.copy();
|
||||||
|
if (index < this.guiInventory.getSizeInventory()) {
|
||||||
|
if (!this.mergeItemStack(itemstack1, this.guiInventory.getSizeInventory(), this.inventorySlots.size(), true)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else if (!this.mergeItemStack(itemstack1, 0, this.guiInventory.getSizeInventory(), false)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemstack1.stackSize <= 0) {
|
||||||
|
slot.putStack(null);
|
||||||
|
} else {
|
||||||
|
slot.onSlotChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemstack;
|
||||||
|
}
|
||||||
|
|
||||||
|
void addSlot(int x, int y, boolean clientSide) {
|
||||||
|
this.addSlotToContainer(new CustomGuiSlot(this.guiInventory, this.slotCount++, x, y, clientSide));
|
||||||
|
}
|
||||||
|
|
||||||
|
void addSlot(int x, int y, ItemStack itemStack, boolean clientSide) {
|
||||||
|
this.guiInventory.setInventorySlotContents(this.slotCount, itemStack);
|
||||||
|
this.addSlotToContainer(new CustomGuiSlot(this.guiInventory, this.slotCount++, x, y, clientSide));
|
||||||
|
}
|
||||||
|
|
||||||
|
void addPlayerInventory(EntityPlayer player, int x, int y) {
|
||||||
|
this.playerInvX = x;
|
||||||
|
this.playerInvY = y;
|
||||||
|
|
||||||
|
int row;
|
||||||
|
for(row = 0; row < 3; ++row) {
|
||||||
|
for(int col = 0; col < 9; ++col) {
|
||||||
|
this.addSlotToContainer(new Slot(player.inventory, col + row * 9 + 9, x + col * 18, y + row * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(row = 0; row < 9; ++row) {
|
||||||
|
this.addSlotToContainer(new Slot(player.inventory, row, x + row * 18, y + 58));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canInteractWith(EntityPlayer p_75145_1_) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canDragIntoSlot(Slot p_94531_1_) { return true; }
|
||||||
|
}
|
||||||
@@ -16,15 +16,16 @@ public class ContainerNPCInv extends Container{
|
|||||||
addSlotToContainer(new Slot(npc.inventory, 5, 81, 40));
|
addSlotToContainer(new Slot(npc.inventory, 5, 81, 40));
|
||||||
addSlotToContainer(new Slot(npc.inventory, 6, 81, 58));
|
addSlotToContainer(new Slot(npc.inventory, 6, 81, 58));
|
||||||
|
|
||||||
for(int l = 0; l < 9; l++){
|
for(int c = 0; c < 4; c++) {
|
||||||
addSlotToContainer(new Slot(npc.inventory, l + 7 , 191 , 16 + l * 21));
|
for (int r = 0; r < 9; r++) {
|
||||||
|
addSlotToContainer(new Slot(npc.inventory, c*9 + r + 7, 191 + (c%2)*90, 16 + r * 21));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i1 = 0; i1 < 3; i1++){
|
for(int i1 = 0; i1 < 3; i1++){
|
||||||
for(int l1 = 0; l1 < 9; l1++){
|
for(int l1 = 0; l1 < 9; l1++){
|
||||||
addSlotToContainer(new Slot(player.inventory, l1 + i1 * 9 + 9, l1 * 18 + 8, 113 + i1 * 18));
|
addSlotToContainer(new Slot(player.inventory, l1 + i1 * 9 + 9, l1 * 18 + 8, 113 + i1 * 18));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int j1 = 0; j1 < 9; j1++){
|
for(int j1 = 0; j1 < 9; j1++){
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package noppes.npcs.controllers;
|
|||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import noppes.npcs.ICompatibilty;
|
import noppes.npcs.ICompatibilty;
|
||||||
import noppes.npcs.VersionCompatibility;
|
import noppes.npcs.VersionCompatibility;
|
||||||
import noppes.npcs.constants.EnumAvailabilityDialog;
|
import noppes.npcs.constants.EnumAvailabilityDialog;
|
||||||
@@ -9,8 +10,11 @@ import noppes.npcs.constants.EnumAvailabilityFaction;
|
|||||||
import noppes.npcs.constants.EnumAvailabilityFactionType;
|
import noppes.npcs.constants.EnumAvailabilityFactionType;
|
||||||
import noppes.npcs.constants.EnumAvailabilityQuest;
|
import noppes.npcs.constants.EnumAvailabilityQuest;
|
||||||
import noppes.npcs.constants.EnumDayTime;
|
import noppes.npcs.constants.EnumDayTime;
|
||||||
|
import noppes.npcs.scripted.CustomNPCsException;
|
||||||
|
import noppes.npcs.scripted.handler.data.IAvailability;
|
||||||
|
import noppes.npcs.scripted.interfaces.IPlayer;
|
||||||
|
|
||||||
public class Availability implements ICompatibilty {
|
public class Availability implements ICompatibilty, IAvailability {
|
||||||
public int version = VersionCompatibility.ModRev;
|
public int version = VersionCompatibility.ModRev;
|
||||||
|
|
||||||
public EnumAvailabilityDialog dialogAvailable = EnumAvailabilityDialog.Always;
|
public EnumAvailabilityDialog dialogAvailable = EnumAvailabilityDialog.Always;
|
||||||
@@ -178,7 +182,7 @@ public class Availability implements ICompatibilty {
|
|||||||
if(available == EnumAvailabilityFactionType.Always)
|
if(available == EnumAvailabilityFactionType.Always)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Faction faction = FactionController.getInstance().getFaction(id);
|
Faction faction = FactionController.getInstance().get(id);
|
||||||
if(faction == null)
|
if(faction == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -233,4 +237,170 @@ public class Availability implements ICompatibilty {
|
|||||||
public void setVersion(int version) {
|
public void setVersion(int version) {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAvailable(IPlayer player) {
|
||||||
|
return this.isAvailable((EntityPlayer)player.getMCEntity());
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDaytime() {
|
||||||
|
return this.daytime.ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDaytime(int type) {
|
||||||
|
this.daytime = EnumDayTime.values()[MathHelper.clamp_int(type, 0, 2)];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMinPlayerLevel() {
|
||||||
|
return this.minPlayerLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinPlayerLevel(int level) {
|
||||||
|
this.minPlayerLevel = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDialog(int i) {
|
||||||
|
if (i < 0 && i > 3) {
|
||||||
|
throw new CustomNPCsException(i + " isnt between 0 and 3", new Object[0]);
|
||||||
|
} else if (i == 0) {
|
||||||
|
return this.dialogId;
|
||||||
|
} else if (i == 1) {
|
||||||
|
return this.dialog2Id;
|
||||||
|
} else {
|
||||||
|
return i == 2 ? this.dialog3Id : this.dialog4Id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDialog(int i, int id, int type) {
|
||||||
|
if (i < 0 && i > 3) {
|
||||||
|
throw new CustomNPCsException(i + " isnt between 0 and 3", new Object[0]);
|
||||||
|
} else {
|
||||||
|
EnumAvailabilityDialog e = EnumAvailabilityDialog.values()[MathHelper.clamp_int(type, 0, 2)];
|
||||||
|
if (i == 0) {
|
||||||
|
this.dialogId = id;
|
||||||
|
this.dialogAvailable = e;
|
||||||
|
} else if (i == 1) {
|
||||||
|
this.dialog2Id = id;
|
||||||
|
this.dialog2Available = e;
|
||||||
|
} else if (i == 2) {
|
||||||
|
this.dialog3Id = id;
|
||||||
|
this.dialog3Available = e;
|
||||||
|
} else if (i == 3) {
|
||||||
|
this.dialog4Id = id;
|
||||||
|
this.dialog4Available = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeDialog(int i) {
|
||||||
|
if (i < 0 && i > 3) {
|
||||||
|
throw new CustomNPCsException(i + " isnt between 0 and 3", new Object[0]);
|
||||||
|
} else {
|
||||||
|
if (i == 0) {
|
||||||
|
this.dialogId = -1;
|
||||||
|
this.dialogAvailable = EnumAvailabilityDialog.Always;
|
||||||
|
} else if (i == 1) {
|
||||||
|
this.dialog2Id = -1;
|
||||||
|
this.dialog2Available = EnumAvailabilityDialog.Always;
|
||||||
|
} else if (i == 2) {
|
||||||
|
this.dialog3Id = -1;
|
||||||
|
this.dialog3Available = EnumAvailabilityDialog.Always;
|
||||||
|
} else if (i == 3) {
|
||||||
|
this.dialog4Id = -1;
|
||||||
|
this.dialog4Available = EnumAvailabilityDialog.Always;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getQuest(int i) {
|
||||||
|
if (i < 0 && i > 3) {
|
||||||
|
throw new CustomNPCsException(i + " isnt between 0 and 3", new Object[0]);
|
||||||
|
} else if (i == 0) {
|
||||||
|
return this.questId;
|
||||||
|
} else if (i == 1) {
|
||||||
|
return this.quest2Id;
|
||||||
|
} else {
|
||||||
|
return i == 2 ? this.quest3Id : this.quest4Id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuest(int i, int id, int type) {
|
||||||
|
if (i < 0 && i > 3) {
|
||||||
|
throw new CustomNPCsException(i + " isnt between 0 and 3", new Object[0]);
|
||||||
|
} else {
|
||||||
|
EnumAvailabilityQuest e = EnumAvailabilityQuest.values()[MathHelper.clamp_int(type, 0, 5)];
|
||||||
|
if (i == 0) {
|
||||||
|
this.questId = id;
|
||||||
|
this.questAvailable = e;
|
||||||
|
} else if (i == 1) {
|
||||||
|
this.quest2Id = id;
|
||||||
|
this.quest2Available = e;
|
||||||
|
} else if (i == 2) {
|
||||||
|
this.quest3Id = id;
|
||||||
|
this.quest3Available = e;
|
||||||
|
} else if (i == 3) {
|
||||||
|
this.quest4Id = id;
|
||||||
|
this.quest4Available = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeQuest(int i) {
|
||||||
|
if (i < 0 && i > 3) {
|
||||||
|
throw new CustomNPCsException(i + " isnt between 0 and 3", new Object[0]);
|
||||||
|
} else {
|
||||||
|
if (i == 0) {
|
||||||
|
this.questId = -1;
|
||||||
|
this.questAvailable = EnumAvailabilityQuest.Always;
|
||||||
|
} else if (i == 1) {
|
||||||
|
this.quest2Id = -1;
|
||||||
|
this.quest2Available = EnumAvailabilityQuest.Always;
|
||||||
|
} else if (i == 2) {
|
||||||
|
this.quest3Id = -1;
|
||||||
|
this.quest3Available = EnumAvailabilityQuest.Always;
|
||||||
|
} else if (i == 3) {
|
||||||
|
this.quest4Id = -1;
|
||||||
|
this.quest4Available = EnumAvailabilityQuest.Always;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFaction(int i, int id, int type, int stance) {
|
||||||
|
if (i < 0 && i > 1) {
|
||||||
|
throw new CustomNPCsException(i + " isnt between 0 and 1", new Object[0]);
|
||||||
|
} else {
|
||||||
|
EnumAvailabilityFactionType e = EnumAvailabilityFactionType.values()[MathHelper.clamp_int(type, 0, 2)];
|
||||||
|
EnumAvailabilityFaction ee = EnumAvailabilityFaction.values()[MathHelper.clamp_int(stance, 0, 2)];
|
||||||
|
if (i == 0) {
|
||||||
|
this.factionId = id;
|
||||||
|
this.factionAvailable = e;
|
||||||
|
this.factionStance = ee;
|
||||||
|
} else if (i == 1) {
|
||||||
|
this.faction2Id = id;
|
||||||
|
this.faction2Available = e;
|
||||||
|
this.faction2Stance = ee;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeFaction(int i) {
|
||||||
|
if (i < 0 && i > 1) {
|
||||||
|
throw new CustomNPCsException(i + " isnt between 0 and 1", new Object[0]);
|
||||||
|
} else {
|
||||||
|
if (i == 0) {
|
||||||
|
this.factionId = -1;
|
||||||
|
this.factionAvailable = EnumAvailabilityFactionType.Always;
|
||||||
|
this.factionStance = EnumAvailabilityFaction.Friendly;
|
||||||
|
} else if (i == 1) {
|
||||||
|
this.faction2Id = -1;
|
||||||
|
this.faction2Available = EnumAvailabilityFactionType.Always;
|
||||||
|
this.faction2Stance = EnumAvailabilityFaction.Friendly;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
package noppes.npcs.controllers;
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import noppes.npcs.CustomNpcs;
|
||||||
|
import noppes.npcs.Server;
|
||||||
|
import noppes.npcs.constants.EnumGuiType;
|
||||||
|
import noppes.npcs.constants.EnumPacketClient;
|
||||||
|
import noppes.npcs.constants.EnumScriptType;
|
||||||
|
import noppes.npcs.containers.ContainerCustomGui;
|
||||||
|
import noppes.npcs.scripted.NpcAPI;
|
||||||
|
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||||
|
import noppes.npcs.scripted.event.CustomGuiEvent;
|
||||||
|
import noppes.npcs.scripted.gui.ScriptGui;
|
||||||
|
import noppes.npcs.scripted.interfaces.IItemStack;
|
||||||
|
import noppes.npcs.scripted.overlay.ScriptOverlay;
|
||||||
|
import noppes.npcs.scripted.wrapper.WrapperNpcAPI;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class CustomGuiController {
|
||||||
|
public CustomGuiController() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void openGui(ScriptPlayer player, ScriptGui gui) {
|
||||||
|
EntityPlayerMP entityPlayerMP = (EntityPlayerMP) player.getMCEntity();
|
||||||
|
entityPlayerMP.openGui(CustomNpcs.instance, EnumGuiType.CustomGui.ordinal(), player.getWorld().getMCWorld(), gui.getSlots().size(), 0, 0);
|
||||||
|
((ContainerCustomGui)((EntityPlayerMP)player.getMCEntity()).openContainer).setGui(gui, (EntityPlayer)player.getMCEntity());
|
||||||
|
Server.sendData((EntityPlayerMP)player.getMCEntity(), EnumPacketClient.GUI_DATA, new Object[]{gui.toNBT()});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean updateGui(ScriptPlayer player, ScriptGui gui) {
|
||||||
|
if (((EntityPlayerMP)player.getMCEntity()).openContainer instanceof ContainerCustomGui) {
|
||||||
|
Server.sendData((EntityPlayerMP)player.getMCEntity(), EnumPacketClient.GUI_DATA, new Object[]{gui.toNBT()});
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void openOverlay(ScriptPlayer player, ScriptOverlay gui) {
|
||||||
|
Server.sendData((EntityPlayerMP)player.getMCEntity(), EnumPacketClient.OVERLAY_DATA, new Object[]{gui.toNBT()});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean updateOverlay(ScriptPlayer player, ScriptOverlay gui) {
|
||||||
|
Server.sendData((EntityPlayerMP)player.getMCEntity(), EnumPacketClient.OVERLAY_DATA, new Object[]{gui.toNBT()});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean checkGui(CustomGuiEvent event) {
|
||||||
|
EntityPlayer player = (EntityPlayer) event.player.getMCEntity();
|
||||||
|
if (!(player.openContainer instanceof ContainerCustomGui)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return ((ContainerCustomGui)player.openContainer).customGui.getID() == event.gui.getID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IItemStack[] getSlotContents(EntityPlayer player) {
|
||||||
|
IItemStack[] slotContents = new IItemStack[0];
|
||||||
|
if (player.openContainer instanceof ContainerCustomGui) {
|
||||||
|
ContainerCustomGui container = (ContainerCustomGui)player.openContainer;
|
||||||
|
slotContents = new IItemStack[container.guiInventory.getSizeInventory()];
|
||||||
|
|
||||||
|
for(int i = 0; i < container.guiInventory.getSizeInventory(); ++i) {
|
||||||
|
slotContents[i] = NpcAPI.Instance().getIItemStack(container.guiInventory.getStackInSlot(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return slotContents;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onButton(CustomGuiEvent.ButtonEvent event) {
|
||||||
|
EntityPlayer player = (EntityPlayer) event.player.getMCEntity();
|
||||||
|
if (checkGui(event) && getOpenGui(player).getScriptHandler() != null) {
|
||||||
|
getOpenGui(player).getScriptHandler().callScript(EnumScriptType.CUSTOM_GUI_BUTTON, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onSlotChange(CustomGuiEvent.SlotEvent event) {
|
||||||
|
EntityPlayer player = (EntityPlayer) event.player.getMCEntity();
|
||||||
|
if (checkGui(event) && getOpenGui(player).getScriptHandler() != null) {
|
||||||
|
getOpenGui(player).getScriptHandler().callScript(EnumScriptType.CUSTOM_GUI_SLOT, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onCustomGuiUnfocused(CustomGuiEvent.UnfocusedEvent event) {
|
||||||
|
EntityPlayer player = (EntityPlayer) event.player.getMCEntity();
|
||||||
|
if (checkGui(event) && getOpenGui(player).getScriptHandler() != null) {
|
||||||
|
getOpenGui(player).getScriptHandler().callScript(EnumScriptType.CUSTOM_GUI_TEXTFIELD, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onScrollClick(CustomGuiEvent.ScrollEvent event) {
|
||||||
|
EntityPlayer player = (EntityPlayer) event.player.getMCEntity();
|
||||||
|
if (checkGui(event) && getOpenGui(player).getScriptHandler() != null) {
|
||||||
|
getOpenGui(player).getScriptHandler().callScript(EnumScriptType.CUSTOM_GUI_SCROLL, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onClose(CustomGuiEvent.CloseEvent event) {
|
||||||
|
if (ScriptController.Instance.playerScripts != null) {
|
||||||
|
ScriptController.Instance.playerScripts.callScript(EnumScriptType.CUSTOM_GUI_CLOSED, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ScriptGui getOpenGui(EntityPlayer player) {
|
||||||
|
return player.openContainer instanceof ContainerCustomGui ? ((ContainerCustomGui)player.openContainer).customGui : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String[] readScrollSelection(ByteBuf buffer) {
|
||||||
|
try {
|
||||||
|
NBTTagList list = Server.readNBT(buffer).getTagList("selection", 8);
|
||||||
|
String[] selection = new String[list.tagCount()];
|
||||||
|
|
||||||
|
for(int i = 0; i < list.tagCount(); ++i) {
|
||||||
|
selection[i] = list.getStringTagAt(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return selection;
|
||||||
|
} catch (IOException var4) {
|
||||||
|
var4.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package noppes.npcs.controllers;
|
package noppes.npcs.controllers;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@@ -8,8 +10,10 @@ import net.minecraft.nbt.NBTTagList;
|
|||||||
import noppes.npcs.ICompatibilty;
|
import noppes.npcs.ICompatibilty;
|
||||||
import noppes.npcs.VersionCompatibility;
|
import noppes.npcs.VersionCompatibility;
|
||||||
import noppes.npcs.constants.EnumOptionType;
|
import noppes.npcs.constants.EnumOptionType;
|
||||||
|
import noppes.npcs.scripted.CustomNPCsException;
|
||||||
|
import noppes.npcs.scripted.handler.data.*;
|
||||||
|
|
||||||
public class Dialog implements ICompatibilty {
|
public class Dialog implements ICompatibilty, IDialog {
|
||||||
public int version = VersionCompatibility.ModRev;
|
public int version = VersionCompatibility.ModRev;
|
||||||
public int id = -1;
|
public int id = -1;
|
||||||
public String title = "";
|
public String title = "";
|
||||||
@@ -26,6 +30,7 @@ public class Dialog implements ICompatibilty {
|
|||||||
public boolean hideNPC = false;
|
public boolean hideNPC = false;
|
||||||
public boolean showWheel = false;
|
public boolean showWheel = false;
|
||||||
public boolean disableEsc = false;
|
public boolean disableEsc = false;
|
||||||
|
public boolean darkenScreen = true;
|
||||||
|
|
||||||
public boolean hasDialogs(EntityPlayer player) {
|
public boolean hasDialogs(EntityPlayer player) {
|
||||||
for(DialogOption option: options.values())
|
for(DialogOption option: options.values())
|
||||||
@@ -56,6 +61,14 @@ public class Dialog implements ICompatibilty {
|
|||||||
showWheel = true;
|
showWheel = true;
|
||||||
disableEsc = compound.getBoolean("DialogDisableEsc");
|
disableEsc = compound.getBoolean("DialogDisableEsc");
|
||||||
|
|
||||||
|
if(compound.hasKey("DialogDarkScreen")) {
|
||||||
|
darkenScreen = compound.getBoolean("DialogDarkScreen");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
darkenScreen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NBTTagList options = compound.getTagList("Options", 10);
|
NBTTagList options = compound.getTagList("Options", 10);
|
||||||
HashMap<Integer,DialogOption> newoptions = new HashMap<Integer,DialogOption>();
|
HashMap<Integer,DialogOption> newoptions = new HashMap<Integer,DialogOption>();
|
||||||
for(int iii = 0; iii < options.tagCount();iii++){
|
for(int iii = 0; iii < options.tagCount();iii++){
|
||||||
@@ -87,6 +100,8 @@ public class Dialog implements ICompatibilty {
|
|||||||
compound.setBoolean("DialogShowWheel", showWheel);
|
compound.setBoolean("DialogShowWheel", showWheel);
|
||||||
compound.setBoolean("DialogDisableEsc", disableEsc);
|
compound.setBoolean("DialogDisableEsc", disableEsc);
|
||||||
|
|
||||||
|
compound.setBoolean("DialogDarkScreen", darkenScreen);
|
||||||
|
|
||||||
if(sound != null && !sound.isEmpty())
|
if(sound != null && !sound.isEmpty())
|
||||||
compound.setString("DialogSound", sound);
|
compound.setString("DialogSound", sound);
|
||||||
|
|
||||||
@@ -108,9 +123,7 @@ public class Dialog implements ICompatibilty {
|
|||||||
public boolean hasQuest() {
|
public boolean hasQuest() {
|
||||||
return getQuest() != null;
|
return getQuest() != null;
|
||||||
}
|
}
|
||||||
public Quest getQuest() {
|
|
||||||
return QuestController.instance.quests.get(quest);
|
|
||||||
}
|
|
||||||
public boolean hasOtherOptions() {
|
public boolean hasOtherOptions() {
|
||||||
for(DialogOption option: options.values())
|
for(DialogOption option: options.values())
|
||||||
if(option != null && option.optionType != EnumOptionType.Disabled)
|
if(option != null && option.optionType != EnumOptionType.Disabled)
|
||||||
@@ -131,6 +144,7 @@ public class Dialog implements ICompatibilty {
|
|||||||
dialog.hideNPC = hideNPC;
|
dialog.hideNPC = hideNPC;
|
||||||
dialog.showWheel = showWheel;
|
dialog.showWheel = showWheel;
|
||||||
dialog.disableEsc = disableEsc;
|
dialog.disableEsc = disableEsc;
|
||||||
|
dialog.darkenScreen = darkenScreen;
|
||||||
|
|
||||||
for(int slot : options.keySet()){
|
for(int slot : options.keySet()){
|
||||||
DialogOption option = options.get(slot);
|
DialogOption option = options.get(slot);
|
||||||
@@ -149,4 +163,108 @@ public class Dialog implements ICompatibilty {
|
|||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IDialogOption> getOptions() {
|
||||||
|
return new ArrayList(this.options.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDialogOption getOption(int slot) {
|
||||||
|
IDialogOption option = (IDialogOption)this.options.get(slot);
|
||||||
|
if (option == null) {
|
||||||
|
throw new CustomNPCsException("There is no DialogOption for slot: " + slot, new Object[0]);
|
||||||
|
} else {
|
||||||
|
return option;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IAvailability getAvailability() {
|
||||||
|
return this.availability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDialogCategory getCategory() {
|
||||||
|
return this.category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save() {
|
||||||
|
DialogController.instance.saveDialog(this.category.id, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.title = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText() {
|
||||||
|
return this.text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(String text) {
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuest(IQuest quest) {
|
||||||
|
if (quest == null) {
|
||||||
|
this.quest = -1;
|
||||||
|
} else {
|
||||||
|
if (quest.getId() < 0) {
|
||||||
|
throw new CustomNPCsException("Quest id is lower than 0", new Object[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.quest = quest.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Quest getQuest() {
|
||||||
|
return QuestController.instance == null ? null : (Quest)QuestController.instance.quests.get(this.quest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCommand() {
|
||||||
|
return this.command;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommand(String command) {
|
||||||
|
this.command = command;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDarkenScreen(boolean darkenScreen) {
|
||||||
|
this.darkenScreen = darkenScreen;
|
||||||
|
}
|
||||||
|
public boolean getDarkenScreen() {
|
||||||
|
return this.darkenScreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisableEsc(boolean disableEsc) {
|
||||||
|
this.disableEsc = disableEsc;
|
||||||
|
}
|
||||||
|
public boolean getDisableEsc() {
|
||||||
|
return this.disableEsc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShowWheel(boolean showWheel) {
|
||||||
|
this.showWheel = showWheel;
|
||||||
|
}
|
||||||
|
public boolean getShowWheel() {
|
||||||
|
return this.showWheel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHideNPC(boolean hideNPC) {
|
||||||
|
this.hideNPC = hideNPC;
|
||||||
|
}
|
||||||
|
public boolean getHideNPC() {
|
||||||
|
return this.hideNPC;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSound(String sound) {
|
||||||
|
this.sound = sound;
|
||||||
|
}
|
||||||
|
public String getSound() {
|
||||||
|
return this.sound;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,15 @@
|
|||||||
package noppes.npcs.controllers;
|
package noppes.npcs.controllers;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import noppes.npcs.scripted.handler.data.IDialog;
|
||||||
|
import noppes.npcs.scripted.handler.data.IDialogCategory;
|
||||||
|
|
||||||
public class DialogCategory {
|
public class DialogCategory implements IDialogCategory {
|
||||||
|
|
||||||
public int id = -1;
|
public int id = -1;
|
||||||
public String title = "";
|
public String title = "";
|
||||||
@@ -43,4 +47,18 @@ public class DialogCategory {
|
|||||||
nbtfactions.setTag("Dialogs", dialogs);
|
nbtfactions.setTag("Dialogs", dialogs);
|
||||||
return nbtfactions;
|
return nbtfactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<IDialog> dialogs() {
|
||||||
|
return new ArrayList(this.dialogs.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDialog create() {
|
||||||
|
Dialog dialog = new Dialog();
|
||||||
|
dialog.category = this;
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,9 +2,7 @@ package noppes.npcs.controllers;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.CompressedStreamTools;
|
import net.minecraft.nbt.CompressedStreamTools;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@@ -13,9 +11,12 @@ import noppes.npcs.CustomNpcs;
|
|||||||
import noppes.npcs.LogWriter;
|
import noppes.npcs.LogWriter;
|
||||||
import noppes.npcs.NoppesStringUtils;
|
import noppes.npcs.NoppesStringUtils;
|
||||||
import noppes.npcs.constants.EnumOptionType;
|
import noppes.npcs.constants.EnumOptionType;
|
||||||
|
import noppes.npcs.scripted.handler.IDialogHandler;
|
||||||
|
import noppes.npcs.scripted.handler.data.IDialog;
|
||||||
|
import noppes.npcs.scripted.handler.data.IDialogCategory;
|
||||||
import noppes.npcs.util.NBTJsonUtil;
|
import noppes.npcs.util.NBTJsonUtil;
|
||||||
|
|
||||||
public class DialogController {
|
public class DialogController implements IDialogHandler {
|
||||||
public HashMap<Integer,DialogCategory> categories = new HashMap<Integer, DialogCategory>();
|
public HashMap<Integer,DialogCategory> categories = new HashMap<Integer, DialogCategory>();
|
||||||
public HashMap<Integer,Dialog> dialogs = new HashMap<Integer, Dialog>();
|
public HashMap<Integer,Dialog> dialogs = new HashMap<Integer, Dialog>();
|
||||||
public static DialogController instance;
|
public static DialogController instance;
|
||||||
@@ -312,4 +313,12 @@ public class DialogController {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<IDialogCategory> categories() {
|
||||||
|
return new ArrayList(this.categories.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDialog get(int id) {
|
||||||
|
return (IDialog)this.dialogs.get(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loaded 100 of 231 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user