mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-24 15:14:26 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
960c60f5c7 | ||
|
|
f5de82bb4e | ||
|
|
e9fbc4ad8d | ||
|
|
dfa8ca7533 | ||
|
|
2bd5f25410 | ||
|
|
3ec10e9c49 | ||
|
|
ee72d22593 | ||
|
|
f7d62f6cdd | ||
|
|
8ca2cc58f0 | ||
|
|
adec63c763 | ||
|
|
e6786a985e | ||
|
|
9b82769d22 | ||
|
|
867a8a3d82 | ||
|
|
2c6fb0d15b | ||
|
|
6e1e9c189d | ||
|
|
6d187fdada | ||
|
|
6914f670bd | ||
|
|
aced231b55 | ||
|
|
996969bd2c | ||
|
|
2fe39c98fc | ||
|
|
99aa6bf7c1 | ||
|
|
1e8d578222 | ||
|
|
660573d891 | ||
|
|
f828e96674 | ||
|
|
2031d462bd | ||
|
|
0d3418af47 | ||
|
|
5d738987b2 | ||
|
|
36cd81e6e4 | ||
|
|
17566031d7 | ||
|
|
a3de45cd55 | ||
|
|
a7b9043021 | ||
|
|
c27cdf7950 | ||
|
|
8b0431340c | ||
|
|
a10e427c1c | ||
|
|
116dc23f2b | ||
|
|
09f36bb56c | ||
|
|
e102e652ae | ||
|
|
81b4715dca | ||
|
|
406a8012fc | ||
|
|
0ceb5dc3e2 | ||
|
|
0cabe6b623 | ||
|
|
22a768b8c2 | ||
|
|
864ce6befc | ||
|
|
947314787f | ||
|
|
fc9e85c35a | ||
|
|
7b1b304f75 | ||
|
|
ef4ec4aca0 | ||
|
|
319d7b0503 | ||
|
|
ffd25430c9 | ||
|
|
c30a9014f8 | ||
|
|
f9a4fc0d54 | ||
|
|
7dc5cc5e8c | ||
|
|
d3551dda36 | ||
|
|
53070b47c4 | ||
|
|
c4b9a5ca21 | ||
|
|
9d68a5e079 | ||
|
|
aa02580c28 | ||
|
|
fcfc01b2ab | ||
|
|
30b3f55e7c | ||
|
|
ac87f2c2c2 | ||
|
|
abb2d13e6e | ||
|
|
cc2e8805d8 | ||
|
|
81c752c483 | ||
|
|
df45247c89 | ||
|
|
6882838cf8 | ||
|
|
8842fdfbf6 | ||
|
|
41c4fc66d0 | ||
|
|
0943299384 | ||
|
|
f8b182008c | ||
|
|
270a9cbd46 | ||
|
|
a9f2fe4a0e | ||
|
|
214f0a4c00 | ||
|
|
69154bec24 | ||
|
|
2c349cb34c | ||
|
|
573aab23e5 | ||
|
|
89efe67f44 | ||
|
|
33e5071b11 | ||
|
|
418d345293 | ||
|
|
8ef4276865 | ||
|
|
f2190b350d | ||
|
|
1fc7c8ea50 | ||
|
|
a2af8ca0b2 | ||
|
|
eb11170a9b | ||
|
|
6714daa60a | ||
|
|
6e74bc0597 | ||
|
|
de4b169754 | ||
|
|
7b239ea6bd | ||
|
|
87949b62fa | ||
|
|
7bd14b06dd | ||
|
|
5d6da34717 | ||
|
|
44c0ecc3fd | ||
|
|
3df8acfaee | ||
|
|
545cece3e4 | ||
|
|
0f619d710a | ||
|
|
aba24fc93c | ||
|
|
9a6cf94c73 | ||
|
|
49edeee673 | ||
|
|
84433df94b | ||
|
|
8753c97a8e | ||
|
|
f52af0b19d | ||
|
|
891a3101c9 | ||
|
|
4302ac4a2b | ||
|
|
f91e62ee0f | ||
|
|
f27599075a | ||
|
|
84286794aa | ||
|
|
39a40c9603 | ||
|
|
7fdfd14174 | ||
|
|
c818f6ee4e | ||
|
|
c8d676c764 | ||
|
|
45217f3afc | ||
|
|
80352741b9 | ||
|
|
e3405d22e9 | ||
|
|
586c451f06 | ||
|
|
2c012f2693 | ||
|
|
f7576ffc90 | ||
|
|
b04a35efc4 | ||
|
|
6a5d84b9aa | ||
|
|
58aaaa158a | ||
|
|
f5aa6b58db | ||
|
|
6913cadc79 | ||
|
|
9a77e2f146 | ||
|
|
992e6fd169 | ||
|
|
f0b33cf913 | ||
|
|
2ef93dd35f | ||
|
|
df069c82c2 | ||
|
|
e58b494979 | ||
|
|
57bd628357 | ||
|
|
fd7f550316 | ||
|
|
f5cf78e1fb | ||
|
|
fe780d69ee | ||
|
|
29935a1c6d | ||
|
|
46d668f44c | ||
|
|
19e14983aa | ||
|
|
22a4082890 | ||
|
|
c12bb6508c | ||
|
|
daada3cb8a | ||
|
|
fb09c8c39e | ||
|
|
c16a90424a | ||
|
|
9eb2052bdb | ||
|
|
4976e059f5 | ||
|
|
cc0c83835c | ||
|
|
f788257b7d | ||
|
|
7db4d2649b | ||
|
|
b0c2dff2fe | ||
|
|
4cd6ac6b51 | ||
|
|
bfb771211f | ||
|
|
5b84a01c74 | ||
|
|
377e18a445 | ||
|
|
23916e88d8 | ||
|
|
e003e375db | ||
|
|
33dd07d941 | ||
|
|
daf06e8d55 | ||
|
|
d2612657c3 | ||
|
|
ae4b95731b | ||
|
|
e33d3fc5e4 | ||
|
|
fc94b851c1 | ||
|
|
c2d0b5322d | ||
|
|
1207a592d7 | ||
|
|
116c3db201 | ||
|
|
dc678bee86 | ||
|
|
8b89711403 | ||
|
|
3250a9e02b | ||
|
|
d28a523c49 | ||
|
|
58e129e0df | ||
|
|
f165e5172c | ||
|
|
5eeefedf6e | ||
|
|
23cfe66ecb | ||
|
|
5b589768f6 | ||
|
|
9b330007fd | ||
|
|
397620f36e | ||
|
|
0db96f9040 | ||
|
|
de6375c4cb | ||
|
|
79e13dfade | ||
|
|
b8dc090db8 | ||
|
|
0ddcd15162 | ||
|
|
bcfd44d8fe | ||
|
|
cacb4ebf85 | ||
|
|
e65ba59b8e | ||
|
|
354c9808e4 | ||
|
|
cfca59a48e | ||
|
|
30d73f91cf | ||
|
|
60ed5ab607 | ||
|
|
c90a5d9713 | ||
|
|
1a47b68621 | ||
|
|
0787a71197 | ||
|
|
6a7ce1bb5b | ||
|
|
60f8645c84 | ||
|
|
e558292360 | ||
|
|
74b0114555 | ||
|
|
667486fd71 | ||
|
|
78357165a2 | ||
|
|
9c7767312d | ||
|
|
1ddc316230 | ||
|
|
b8a3740ad2 | ||
|
|
96caf6e033 | ||
|
|
07175758a7 | ||
|
|
9f02d118cd | ||
|
|
d149b018e9 | ||
|
|
5e5bf2eb1c | ||
|
|
f504424fd2 | ||
|
|
cb143be559 | ||
|
|
3884b662fd | ||
|
|
7ff568b1be | ||
|
|
755dcbab03 | ||
|
|
bab359ea2b | ||
|
|
0d36c19c22 | ||
|
|
46ea214b64 | ||
|
|
17c6fe9728 | ||
|
|
e2c8550dc1 | ||
|
|
564a6ab6ba | ||
|
|
477cf03f1b | ||
|
|
4e5a12690e | ||
|
|
8f206ba500 | ||
|
|
f61001d32a | ||
|
|
9797a52af1 | ||
|
|
be18e756fc | ||
|
|
bda76bafe6 | ||
|
|
569c7790fc | ||
|
|
3e6e28d857 | ||
|
|
91bcd43942 | ||
|
|
54d53041ac | ||
|
|
1d94e5f1e7 | ||
|
|
adb581ea64 | ||
|
|
8e3440bc73 | ||
|
|
074f3ee88b | ||
|
|
816873dcd8 | ||
|
|
29f529a711 | ||
|
|
8f62daba3e | ||
|
|
c35c3cbb1d | ||
|
|
8905f5f42e | ||
|
|
974bf2ca66 | ||
|
|
4c2f033a04 | ||
|
|
26a1ad1dba | ||
|
|
5388a56b53 | ||
|
|
95f559c36b | ||
|
|
352a79d94c | ||
|
|
b203a244ec | ||
|
|
309f912f10 | ||
|
|
0772f427ef | ||
|
|
6897512a01 | ||
|
|
a1a382b67f | ||
|
|
3b69da5ef6 | ||
|
|
cbc0b82356 | ||
|
|
1aee4c06fc | ||
|
|
7f407c3c44 | ||
|
|
06ff9fc482 | ||
|
|
42c29f1d47 | ||
|
|
3573b7e71e | ||
|
|
25eafab3b1 | ||
|
|
d7d43f74b9 | ||
|
|
c3b3fc8370 | ||
|
|
4d17df936a | ||
|
|
6779bbc93f | ||
|
|
f29de8aaa3 | ||
|
|
9dfd562841 | ||
|
|
8b07aa41cd | ||
|
|
4375222a67 | ||
|
|
d87a37e017 | ||
|
|
6b0da818c6 | ||
|
|
a5903c24b9 | ||
|
|
780d382b3f | ||
|
|
94127e5fa4 | ||
|
|
5f595fa7b6 | ||
|
|
01848e82c8 | ||
|
|
c9ebeea7f9 | ||
|
|
bfb262a487 | ||
|
|
76761c4f3d | ||
|
|
1ac1cbcc2a | ||
|
|
0b5ffce55f | ||
|
|
a1c036c4bf | ||
|
|
ddbf84bc74 | ||
|
|
54d89bab39 | ||
|
|
c146a973f0 | ||
|
|
f98a1af2b2 | ||
|
|
0750f12a32 | ||
|
|
aed45fc119 | ||
|
|
928232fdd2 | ||
|
|
49f93dfce2 | ||
|
|
763a388947 | ||
|
|
83a13b96c4 | ||
|
|
ed284eb658 | ||
|
|
c522c08ac5 | ||
|
|
0b809e8210 | ||
|
|
bc6cc35fd6 | ||
|
|
2656081b1a | ||
|
|
06b938069a | ||
|
|
7ba95807e7 | ||
|
|
3b11ddb4b4 | ||
|
|
cfd724edf6 | ||
|
|
0db7ef8e66 | ||
|
|
235ddaa1ea | ||
|
|
d6ed069862 | ||
|
|
99403257f5 | ||
|
|
4346992f14 | ||
|
|
c9426682c0 | ||
|
|
6e92f08851 | ||
|
|
ef01b700da | ||
|
|
7564498cdf | ||
|
|
b4cb69000e | ||
|
|
e89e4d4c2b | ||
|
|
ff3b9131cf | ||
|
|
2e745fbda1 | ||
|
|
27b80037bd | ||
|
|
58afabc43b | ||
|
|
ad689440aa | ||
|
|
de92c6055d | ||
|
|
3bb1b4fcb0 | ||
|
|
695dfce7d0 | ||
|
|
28a1650c05 | ||
|
|
bb5b3f5f00 | ||
|
|
612a2d7593 | ||
|
|
d2611385de | ||
|
|
7b3dd8e7bd | ||
|
|
3c856458c4 | ||
|
|
51263a9f82 | ||
|
|
b167755cc0 | ||
|
|
d638c98d81 | ||
|
|
1df7819931 | ||
|
|
828d03a0cb | ||
|
|
7d4a59d45a | ||
|
|
5e8c234ac7 | ||
|
|
1ac0b3b0a3 | ||
|
|
25dcc975df | ||
|
|
699b24e467 | ||
|
|
8d52e9356c | ||
|
|
a82a06fe4d | ||
|
|
dbe956d973 | ||
|
|
2588f14105 | ||
|
|
5c81f3dd2e | ||
|
|
678ee8fc02 | ||
|
|
c950dcfa5a | ||
|
|
bb7b33bf95 | ||
|
|
4f553a9ee4 | ||
|
|
343721c87a | ||
|
|
74ed9d9de9 | ||
|
|
c0ad318573 | ||
|
|
037711893d | ||
|
|
1d6499ea48 | ||
|
|
5d520837b1 | ||
|
|
a895c8bd24 | ||
|
|
73ceeab907 | ||
|
|
808de24db4 | ||
|
|
cfac349265 | ||
|
|
3d498814f9 | ||
|
|
a47af08d0f | ||
|
|
51a556db23 | ||
|
|
6f33b9df92 | ||
|
|
7a715ef308 | ||
|
|
718a867411 | ||
|
|
3945e7ffb8 | ||
|
|
3152cf2379 | ||
|
|
958aeea46a | ||
|
|
68600d7d00 | ||
|
|
57920b02b7 | ||
|
|
8e6f5b10d1 |
No files matched your search
@@ -1,38 +1,43 @@
|
||||
|
||||
## 👋 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.
|
||||
|
||||
**CurseForge**: [Download](https://www.curseforge.com/minecraft/mc-mods/customnpc-plus)
|
||||
----------------
|
||||
|
||||
[](https://discord.gg/pQqRTvFeJ5)
|
||||
[](https://www.curseforge.com/minecraft/mc-mods/customnpc-plus)
|
||||
[](https://www.curseforge.com/minecraft/mc-mods/moreplayermodels-plus)
|
||||
<a href="https://discord.gg/pQqRTvFeJ5"> <img src="https://img.shields.io/badge/KAMKEEL_Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white" width="400" height="60"> </a>
|
||||
<a href="https://ko-fi.com/kamkeel"> <img src="https://img.shields.io/badge/Support_Me_|_Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white" alt="Support Me" width="400" height="60"> </a>
|
||||
|
||||
[](https://modrinth.com/mod/customnpc-plus)
|
||||
[](https://www.curseforge.com/minecraft/mc-mods/moreplayermodels-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" width="180" height="27"> </a>
|
||||
|
||||
----------------
|
||||
|
||||
### ❗ 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 and develop my own branch version for 1.7.10. 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)
|
||||
|
||||
### ⬇️ Downloads
|
||||
|
||||
- **Modrinth**: [Download](https://modrinth.com/mod/customnpc-plus)
|
||||
- **CurseForge**: [Download](https://www.curseforge.com/minecraft/mc-mods/customnpc-plus)
|
||||
|
||||
### 🔹 Installation
|
||||
This mod is an ***update*** to CustomNPC and not an add-on. Do not install CustomNPC with CustomNPC-Plus. CustomNPC-Plus does not remove any functional features from the original mod. It expands upon CustomNPC with original features and backported features from newer versions. Simply drag CustomNPC-Plus into any client/server mods folder to utilize. Please **backup** before using as this could still have unforeseen errors. Report any bugs if found, thank you and enjoy.
|
||||
|
||||
### ❓ Features:
|
||||
- Flying NPC (Smart Pathfinding)
|
||||
- 1.8 Skin Support (64x64) (3D Bodywear)
|
||||
- 1.8 Skin Support (64x64) (Alex/Steve64)
|
||||
- Full URL64 Selector (Downloads FULL Size Images for Custom Mob Skins)
|
||||
- Alex Model (64x64)
|
||||
- Additional Parts: [Wings, Fins, Capes, Horns, Tail]
|
||||
- Hide Body Parts [Arms, Legs, Head, Body]
|
||||
- Custom Overlays
|
||||
- Updated Cloner GUI (with more Tabs!)
|
||||
- Animation Maker
|
||||
- Enhanced Cloner GUI (More Tabs, Filters, Tags)
|
||||
- Markov Name Generator
|
||||
- Backported GUI Features
|
||||
- Dark Mode GUI (Link Below)
|
||||
- 1.12 Scripting Features (Details below)
|
||||
- Script Logging (See Config)
|
||||
|
||||
#### Scripting:
|
||||
- CustomNPC+ Api: [API](https://github.com/KAMKEEL/CustomNPC-Plus-API)
|
||||
@@ -41,7 +46,9 @@ This mod is an ***update*** to CustomNPC and not an add-on. Do not install Custo
|
||||
- Player Overlays
|
||||
- Script Timers
|
||||
- Global Scripts
|
||||
- Script Logging
|
||||
- GUI Overlays
|
||||
- Event Scripting
|
||||
(We never remove script functionality, only add on existing functions)
|
||||
|
||||
## 🔰 Skin Model Feature:
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ configurations {
|
||||
|
||||
apply plugin: 'forge'
|
||||
|
||||
version = "1.7"
|
||||
version = "1.8"
|
||||
group= "com.kamkeel.customnpc-plus" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "CustomNPC-Plus"
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 775 KiB |
File renamed without changes.
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
@@ -3,6 +3,7 @@ package foxz.command;
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.nashorn.internal.runtime.regexp.joni.Config;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockIce;
|
||||
import net.minecraft.block.BlockLeavesBase;
|
||||
@@ -10,6 +11,7 @@ import net.minecraft.block.BlockVine;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.controllers.ChunkController;
|
||||
import foxz.commandhelper.ChMcLogger;
|
||||
@@ -37,19 +39,22 @@ public class CmdConfig extends ChMcLogger {
|
||||
)
|
||||
public boolean leavesdecay(String[] args){
|
||||
if(args.length == 0){
|
||||
sendmessage("LeavesDecay: " + CustomNpcs.LeavesDecayEnabled);
|
||||
sendmessage("LeavesDecay: " + ConfigMain.LeavesDecayEnabled);
|
||||
}
|
||||
else{
|
||||
CustomNpcs.LeavesDecayEnabled = Boolean.parseBoolean(args[0]);
|
||||
CustomNpcs.Config.updateConfig();
|
||||
ConfigMain.LeavesDecayEnabled = Boolean.parseBoolean(args[0]);
|
||||
ConfigMain.LeavesDecayEnabledProperty.set(ConfigMain.LeavesDecayEnabled);
|
||||
if(ConfigMain.config.hasChanged()){
|
||||
ConfigMain.config.save();
|
||||
}
|
||||
Set<String> names = Block.blockRegistry.getKeys();
|
||||
for(String name : names){
|
||||
Block block = (Block) Block.blockRegistry.getObject(name);
|
||||
if(block instanceof BlockLeavesBase){
|
||||
block.setTickRandomly(CustomNpcs.LeavesDecayEnabled);
|
||||
block.setTickRandomly(ConfigMain.LeavesDecayEnabled);
|
||||
}
|
||||
}
|
||||
sendmessage("LeavesDecay is now " + CustomNpcs.LeavesDecayEnabled);
|
||||
sendmessage("LeavesDecay is now " + ConfigMain.LeavesDecayEnabled);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -62,19 +67,22 @@ public class CmdConfig extends ChMcLogger {
|
||||
)
|
||||
public boolean vinegrowth(String[] args){
|
||||
if(args.length == 0){
|
||||
sendmessage("VineGrowth: " + CustomNpcs.VineGrowthEnabled);
|
||||
sendmessage("VineGrowth: " + ConfigMain.VineGrowthEnabled);
|
||||
}
|
||||
else{
|
||||
CustomNpcs.VineGrowthEnabled = Boolean.parseBoolean(args[0]);
|
||||
CustomNpcs.Config.updateConfig();
|
||||
ConfigMain.VineGrowthEnabled = Boolean.parseBoolean(args[0]);
|
||||
ConfigMain.VineGrowthEnabledProperty.set(ConfigMain.VineGrowthEnabled);
|
||||
if(ConfigMain.config.hasChanged()){
|
||||
ConfigMain.config.save();
|
||||
}
|
||||
Set<String> names = Block.blockRegistry.getKeys();
|
||||
for(String name : names){
|
||||
Block block = (Block) Block.blockRegistry.getObject(name);
|
||||
if(block instanceof BlockVine){
|
||||
block.setTickRandomly(CustomNpcs.VineGrowthEnabled);
|
||||
block.setTickRandomly(ConfigMain.VineGrowthEnabled);
|
||||
}
|
||||
}
|
||||
sendmessage("VineGrowth is now " + CustomNpcs.VineGrowthEnabled);
|
||||
sendmessage("VineGrowth is now " + ConfigMain.VineGrowthEnabled);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -87,19 +95,22 @@ public class CmdConfig extends ChMcLogger {
|
||||
)
|
||||
public boolean icemelts(String[] args){
|
||||
if(args.length == 0){
|
||||
sendmessage("IceMelts: " + CustomNpcs.IceMeltsEnabled);
|
||||
sendmessage("IceMelts: " + ConfigMain.IceMeltsEnabled);
|
||||
}
|
||||
else{
|
||||
CustomNpcs.IceMeltsEnabled = Boolean.parseBoolean(args[0]);
|
||||
CustomNpcs.Config.updateConfig();
|
||||
ConfigMain.IceMeltsEnabled = Boolean.parseBoolean(args[0]);
|
||||
ConfigMain.IceMeltsEnabledProperty.set(ConfigMain.IceMeltsEnabled);
|
||||
if(ConfigMain.config.hasChanged()){
|
||||
ConfigMain.config.save();
|
||||
}
|
||||
Set<String> names = Block.blockRegistry.getKeys();
|
||||
for(String name : names){
|
||||
Block block = (Block) Block.blockRegistry.getObject(name);
|
||||
if(block instanceof BlockIce){
|
||||
block.setTickRandomly(CustomNpcs.IceMeltsEnabled);
|
||||
block.setTickRandomly(ConfigMain.IceMeltsEnabled);
|
||||
}
|
||||
}
|
||||
sendmessage("IceMelts is now " + CustomNpcs.IceMeltsEnabled);
|
||||
sendmessage("IceMelts is now " + ConfigMain.IceMeltsEnabled);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -112,12 +123,15 @@ public class CmdConfig extends ChMcLogger {
|
||||
)
|
||||
public boolean guns(String[] args){
|
||||
if(args.length == 0){
|
||||
sendmessage("GunsEnabled: " + CustomNpcs.GunsEnabled);
|
||||
sendmessage("GunsEnabled: " + ConfigMain.GunsEnabled);
|
||||
}
|
||||
else{
|
||||
CustomNpcs.GunsEnabled = Boolean.parseBoolean(args[0]);
|
||||
CustomNpcs.Config.updateConfig();
|
||||
sendmessage("GunsEnabled is now " + CustomNpcs.GunsEnabled);
|
||||
ConfigMain.GunsEnabled = Boolean.parseBoolean(args[0]);
|
||||
ConfigMain.GunsEnabledProperty.set(ConfigMain.GunsEnabled);
|
||||
if(ConfigMain.config.hasChanged()){
|
||||
ConfigMain.config.save();
|
||||
}
|
||||
sendmessage("GunsEnabled is now " + ConfigMain.GunsEnabled);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -147,24 +161,27 @@ public class CmdConfig extends ChMcLogger {
|
||||
)
|
||||
public boolean chunkloaders(String[] args){
|
||||
if(args.length == 0){
|
||||
sendmessage("ChunkLoaders: " + ChunkController.instance.size() + "/" + CustomNpcs.ChunkLoaders);
|
||||
sendmessage("ChunkLoaders: " + ChunkController.instance.size() + "/" + ConfigMain.ChunkLoaders);
|
||||
}
|
||||
else{
|
||||
try{
|
||||
CustomNpcs.ChunkLoaders = Integer.parseInt(args[0]);
|
||||
ConfigMain.ChunkLoaders = Integer.parseInt(args[0]);
|
||||
}
|
||||
catch(NumberFormatException ex){
|
||||
sendmessage("Didnt get a number");
|
||||
return false;
|
||||
}
|
||||
CustomNpcs.Config.updateConfig();
|
||||
|
||||
int size = ChunkController.instance.size();
|
||||
if(size > CustomNpcs.ChunkLoaders){
|
||||
ChunkController.instance.unload(size - CustomNpcs.ChunkLoaders);
|
||||
sendmessage(size - CustomNpcs.ChunkLoaders + " chunksloaders unloaded");
|
||||
|
||||
ConfigMain.ChunkLoadersProperty.set(ConfigMain.ChunkLoaders);
|
||||
if(ConfigMain.config.hasChanged()){
|
||||
ConfigMain.config.save();
|
||||
}
|
||||
sendmessage("ChunkLoaders: " + ChunkController.instance.size() + "/" + CustomNpcs.ChunkLoaders);
|
||||
int size = ChunkController.instance.size();
|
||||
if(size > ConfigMain.ChunkLoaders){
|
||||
ChunkController.instance.unload(size - ConfigMain.ChunkLoaders);
|
||||
sendmessage(size - ConfigMain.ChunkLoaders + " chunksloaders unloaded");
|
||||
}
|
||||
sendmessage("ChunkLoaders: " + ChunkController.instance.size() + "/" + ConfigMain.ChunkLoaders);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package foxz.command;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import noppes.npcs.api.ICommand;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ScriptedCommand extends CommandBase implements ICommand {
|
||||
private String commandName;
|
||||
private int permissionLevel;
|
||||
private String commandUsage;
|
||||
private ArrayList<String> aliases;
|
||||
|
||||
public ScriptedCommand(String commandName, int permissionLevel) {
|
||||
this.commandName = commandName;
|
||||
this.permissionLevel = permissionLevel;
|
||||
this.commandUsage = "";
|
||||
this.aliases = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void setCommandName(String commandName) {
|
||||
this.commandName = commandName;
|
||||
}
|
||||
|
||||
public void setCommandUsage(String commandUsage) {
|
||||
this.commandUsage = commandUsage;
|
||||
}
|
||||
|
||||
public void setPermissionLevel(int permissionLevel) {
|
||||
this.permissionLevel = permissionLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return this.commandName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender p_71518_1_) {
|
||||
return this.commandUsage;
|
||||
}
|
||||
|
||||
public String getCommandUsage() {
|
||||
return this.commandUsage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
|
||||
}
|
||||
|
||||
public int getRequiredPermissionLevel()
|
||||
{
|
||||
return this.permissionLevel;
|
||||
}
|
||||
|
||||
public int getPermissionLevel() { return this.getRequiredPermissionLevel(); }
|
||||
|
||||
public List<?> getCommandAliases() {
|
||||
return this.aliases;
|
||||
}
|
||||
|
||||
public String[] getAliases() {
|
||||
return this.aliases.toArray(new String[0]);
|
||||
}
|
||||
|
||||
public void addAliases(String... aliases) {
|
||||
this.aliases.addAll(Arrays.asList(aliases));
|
||||
}
|
||||
|
||||
public boolean hasAlias(String alias) {
|
||||
return this.aliases.contains(alias);
|
||||
}
|
||||
|
||||
public void removeAlias(String alias) {
|
||||
this.aliases.remove(alias);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package kamkeel;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import noppes.npcs.controllers.AnimationController;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.data.Animation;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.data.PlayerFactionData;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class AnimationCommand extends CommandKamkeelBase {
|
||||
|
||||
public Animation selectedAnimation;
|
||||
public List<PlayerData> data;
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "animation";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Animation operations";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage() {
|
||||
return "<player> <subcommand>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean runSubCommands(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
|
||||
String playername = args[0];
|
||||
|
||||
data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||
if (data.isEmpty()) {
|
||||
throw new CommandException("Unknown player: " + playername);
|
||||
}
|
||||
|
||||
processSubCommand(sender, args[1], Arrays.copyOfRange(args, 2, args.length));
|
||||
data.get(0).animationData.updateClient();
|
||||
data.get(0).savePlayerDataOnFile();
|
||||
}
|
||||
|
||||
@SubCommand(desc = "enable animation")
|
||||
public void on(ICommandSender sender, String[] args) throws CommandException {
|
||||
data.get(0).animationData.setEnabled(true);
|
||||
sendMessage(sender, String.format("Animations enabled for Player %s", data.get(0).player.getCommandSenderName()));
|
||||
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Set animation",
|
||||
usage = "<animation>"
|
||||
)
|
||||
public void set(ICommandSender sender, String[] args) throws CommandException {
|
||||
if(args.length != 1){
|
||||
throw new CommandException("Please include the animation name:" + "<player> set <animation name>");
|
||||
}
|
||||
String animationName = args[0];
|
||||
selectedAnimation = AnimationController.getInstance().getAnimationFromName(animationName);
|
||||
if (selectedAnimation == null) {
|
||||
throw new CommandException("Unknown animation: " + animationName);
|
||||
}
|
||||
|
||||
data.get(0).animationData.setAnimation(selectedAnimation);
|
||||
sendMessage(sender, String.format("Animation %s set for Player %s", selectedAnimation.getName(), data.get(0).player.getCommandSenderName()));
|
||||
}
|
||||
|
||||
@SubCommand(desc = "disable animation")
|
||||
public void off(ICommandSender sender, String[] args) throws CommandException {
|
||||
data.get(0).animationData.setEnabled(false);
|
||||
sendMessage(sender, String.format("Animations disabled for Player %s", data.get(0).player.getCommandSenderName()));
|
||||
}
|
||||
|
||||
@SubCommand(desc = "play animation")
|
||||
public void clear(ICommandSender sender, String[] args) throws CommandException {
|
||||
data.get(0).animationData.setEnabled(false);
|
||||
data.get(0).animationData.setAnimation(null);
|
||||
sendMessage(sender, String.format("Animations cleared for Player %s", data.get(0).player.getCommandSenderName()));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,308 @@
|
||||
package kamkeel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import foxz.utils.Utils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.controllers.ServerCloneController;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class CloneCommand extends CommandKamkeelBase {
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "clone";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Clone operation (server side)";
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Add NPC(s) to clone storage",
|
||||
usage = "<npc> <tab> [clonedname]",
|
||||
permission = 4
|
||||
)
|
||||
public void add(ICommandSender sender, String[] args) {
|
||||
int tab = 0;
|
||||
try{
|
||||
tab = Integer.parseInt(args[1]);
|
||||
}
|
||||
catch(NumberFormatException ex){
|
||||
|
||||
}
|
||||
|
||||
int x = sender.getPlayerCoordinates().posX;
|
||||
int y = sender.getPlayerCoordinates().posY;
|
||||
int z = sender.getPlayerCoordinates().posZ;
|
||||
List<EntityNPCInterface> list = getEntities(EntityNPCInterface.class, sender.getEntityWorld(), x, y, z, 80);
|
||||
for (EntityNPCInterface npc : list) {
|
||||
if (npc.display.getName().equalsIgnoreCase(args[0])) {
|
||||
String name = npc.display.getName();
|
||||
if (args.length > 2) {
|
||||
name = args[2];
|
||||
}
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
if(!npc.writeToNBTOptional(compound))
|
||||
return;
|
||||
ServerCloneController.Instance.addClone(compound, name, tab);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "List NPC from clone storage",
|
||||
usage = "<tab>",
|
||||
permission = 2
|
||||
)
|
||||
public void list(ICommandSender sender, String[] args) {
|
||||
sendMessage(sender, "--- Stored NPCs --- (server side)");
|
||||
int tab = 0;
|
||||
try{
|
||||
tab = Integer.parseInt(args[0]);
|
||||
}
|
||||
catch(NumberFormatException ex){
|
||||
|
||||
}
|
||||
for (String name : ServerCloneController.Instance.getClones(tab)) {
|
||||
sendMessage(sender, name);
|
||||
}
|
||||
sendMessage(sender, "------------------------------------");
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Remove NPC from clone storage",
|
||||
usage = "<name> <tab>",
|
||||
permission = 4
|
||||
)
|
||||
public void del(ICommandSender sender, String[] args) throws CommandException {
|
||||
String nametodel = args[0];
|
||||
int tab = 0;
|
||||
try{
|
||||
tab = Integer.parseInt(args[1]);
|
||||
}
|
||||
catch(NumberFormatException ex){
|
||||
|
||||
}
|
||||
boolean deleted = false;
|
||||
for(String name : ServerCloneController.Instance.getClones(tab)){
|
||||
if(nametodel.equalsIgnoreCase(name)){
|
||||
ServerCloneController.Instance.removeClone(name, tab);
|
||||
deleted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!ServerCloneController.Instance.removeClone(nametodel, tab)) {
|
||||
throw new CommandException(String.format("Npc '%s' wasn't found", nametodel));
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Spawn cloned NPC",
|
||||
usage = "<name> <tab> [[world:]x,y,z]] [newname]",
|
||||
permission = 2
|
||||
)
|
||||
public void spawn(ICommandSender sender, String[] args) throws CommandException {
|
||||
String name = args[0].replaceAll("%", " "); // if name of npc separed by space, user must use % in place of space
|
||||
int tab = 0;
|
||||
try{
|
||||
tab = Integer.parseInt(args[1]);
|
||||
}
|
||||
catch(NumberFormatException ex){
|
||||
|
||||
}
|
||||
String newname=null;
|
||||
NBTTagCompound compound = ServerCloneController.Instance.getCloneData(sender, name, tab);
|
||||
if(compound == null){
|
||||
sendMessage(sender, "Unknown npc");
|
||||
return;
|
||||
}
|
||||
World world = sender.getEntityWorld();
|
||||
double posX = sender.getPlayerCoordinates().posX;
|
||||
double posY = sender.getPlayerCoordinates().posY;
|
||||
double posZ = sender.getPlayerCoordinates().posZ;
|
||||
|
||||
if(args.length > 2){
|
||||
String location = args[2];
|
||||
String[] par;
|
||||
if (location.contains(":")){
|
||||
par = location.split(":");
|
||||
location = par[1];
|
||||
world = Utils.getWorld(par[0]);
|
||||
if (world == null){
|
||||
throw new CommandException(String.format("'%s' is an unknown world", par[0]));
|
||||
}
|
||||
}
|
||||
|
||||
if (location.contains(",")){
|
||||
par = location.split(",");
|
||||
if (par.length != 3){
|
||||
sendMessage(sender, "Location need be x,y,z");
|
||||
return;
|
||||
}
|
||||
try{
|
||||
posX = CommandBase.func_110666_a(sender, posX, par[0]);
|
||||
posY = CommandBase.func_110665_a(sender, posY, par[1].trim(), 0, 0);
|
||||
posZ = CommandBase.func_110666_a(sender, posZ, par[2]);
|
||||
} catch(NumberFormatException ex){
|
||||
sendMessage(sender, "Location should be in numbers");
|
||||
return;
|
||||
}
|
||||
if (args.length > 3){
|
||||
newname = args[3];
|
||||
}
|
||||
} else {
|
||||
newname = location;
|
||||
}
|
||||
}
|
||||
|
||||
if (posX == 0 && posY == 0 && posZ == 0){//incase it was called from the console and not pos was given
|
||||
sendMessage(sender, "Location needed");
|
||||
return;
|
||||
}
|
||||
|
||||
Entity entity = EntityList.createEntityFromNBT(compound, world);
|
||||
entity.setPosition(posX + 0.5, posY + 1, posZ + 0.5);
|
||||
if(entity instanceof EntityNPCInterface){
|
||||
EntityNPCInterface npc = (EntityNPCInterface) entity;
|
||||
npc.ai.startPos = new int[]{MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)};
|
||||
if(newname != null && !newname.isEmpty())
|
||||
npc.display.name = newname.replaceAll("%", " "); // like name, newname must use % in place of space to keep a logical way
|
||||
}
|
||||
world.spawnEntityInWorld(entity);
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Spawn cloned NPC",
|
||||
usage = "<name> <tab> [[world:]x,y,z]] [newname]",
|
||||
permission = 2
|
||||
)
|
||||
public void grid(ICommandSender sender, String[] args) throws CommandException {
|
||||
String name = args[0].replaceAll("%", " "); // if name of npc separed by space, user must use % in place of space
|
||||
int tab = 0;
|
||||
try{
|
||||
tab = Integer.parseInt(args[1]);
|
||||
}
|
||||
catch(NumberFormatException ex){
|
||||
|
||||
}
|
||||
|
||||
int width, height;
|
||||
try{
|
||||
width = Integer.parseInt(args[2]);
|
||||
height = Integer.parseInt(args[3]);
|
||||
}
|
||||
catch(NumberFormatException ex){
|
||||
sendMessage(sender, "length or width was not a number");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String newname=null;
|
||||
NBTTagCompound compound = ServerCloneController.Instance.getCloneData(sender, name, tab);
|
||||
if(compound == null){
|
||||
sendMessage(sender, "Unknown npc");
|
||||
return;
|
||||
}
|
||||
World world = sender.getEntityWorld();
|
||||
double posX = sender.getPlayerCoordinates().posX;
|
||||
double posY = sender.getPlayerCoordinates().posY;
|
||||
double posZ = sender.getPlayerCoordinates().posZ;
|
||||
|
||||
if(args.length > 4){
|
||||
String location = args[4];
|
||||
String[] par;
|
||||
if (location.contains(":")){
|
||||
par = location.split(":");
|
||||
location = par[1];
|
||||
world = Utils.getWorld(par[0]);
|
||||
if (world == null){
|
||||
throw new CommandException(String.format("'%s' is an unknown world", par[0]));
|
||||
}
|
||||
}
|
||||
|
||||
if (location.contains(",")){
|
||||
par = location.split(",");
|
||||
if (par.length != 3){
|
||||
sendMessage(sender, "Location need be x,y,z");
|
||||
return;
|
||||
}
|
||||
try{
|
||||
posX = CommandBase.func_110666_a(sender, posX, par[0]);
|
||||
posY = CommandBase.func_110665_a(sender, posY, par[1].trim(), 0, 0);
|
||||
posZ = CommandBase.func_110666_a(sender, posZ, par[2]);
|
||||
} catch(NumberFormatException ex){
|
||||
sendMessage(sender, "Location should be in numbers");
|
||||
return;
|
||||
}
|
||||
if (args.length > 5){
|
||||
newname = args[5];
|
||||
}
|
||||
} else {
|
||||
newname = location;
|
||||
}
|
||||
}
|
||||
|
||||
if (posX == 0 && posY == 0 && posZ == 0){//incase it was called from the console and not pos was given
|
||||
sendMessage(sender, "Location needed");
|
||||
return;
|
||||
}
|
||||
|
||||
for(int x = 0; x < width; x++){
|
||||
for(int z = 0; z < height; z++){
|
||||
Entity entity = EntityList.createEntityFromNBT(compound, world);
|
||||
int xx = MathHelper.floor_double(posX) + x;
|
||||
int yy = Math.max(MathHelper.floor_double(posY) - 2, 1);
|
||||
int zz = MathHelper.floor_double(posZ) + z;
|
||||
|
||||
for(int y = 0; y < 10; y++){
|
||||
Block b = world.getBlock(xx, yy + y, zz);
|
||||
Block b2 = world.getBlock(xx, yy + y + 1, zz);
|
||||
if(b != null && (b2 == null || b2.getCollisionBoundingBoxFromPool(world, xx, yy + y + 1, zz) == null)){
|
||||
yy += y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
entity.setPosition(posX + 0.5 + x, yy + 1, posZ + 0.5 + z);
|
||||
if(entity instanceof EntityNPCInterface){
|
||||
EntityNPCInterface npc = (EntityNPCInterface) entity;
|
||||
npc.ai.startPos = new int[]{xx, yy, zz};
|
||||
if(newname != null && !newname.isEmpty())
|
||||
npc.display.name = newname.replaceAll("%", " "); // like name, newname must use % in place of space to keep a logical way
|
||||
}
|
||||
world.spawnEntityInWorld(entity);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public World getWorld(String t){
|
||||
WorldServer[] ws=MinecraftServer.getServer().worldServers;
|
||||
for (WorldServer w:ws){
|
||||
if (w!=null){
|
||||
if ((w.provider.dimensionId + "").equalsIgnoreCase(t)){
|
||||
return w;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T extends Entity> List<T> getEntities(Class<? extends T> cls, World world, int x, int y, int z, int range) {
|
||||
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(range, range, range);
|
||||
List<T> list = world.getEntitiesWithinAABB(cls, bb);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package kamkeel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import noppes.npcs.scripted.CustomNPCsException;
|
||||
|
||||
public class CommandKamkeel extends CommandBase{
|
||||
|
||||
public Map<String, CommandKamkeelBase> map = new HashMap<String, CommandKamkeelBase>();
|
||||
public HelpCommand help = new HelpCommand(this);
|
||||
|
||||
public CommandKamkeel(){
|
||||
registerCommand(help);
|
||||
registerCommand(new ScriptCommand());
|
||||
registerCommand(new SlayCommand());
|
||||
registerCommand(new QuestCommand());
|
||||
registerCommand(new DialogCommand());
|
||||
registerCommand(new FactionCommand());
|
||||
registerCommand(new NpcCommand());
|
||||
registerCommand(new CloneCommand());
|
||||
registerCommand(new ConfigCommand());
|
||||
}
|
||||
|
||||
public void registerCommand(CommandKamkeelBase command){
|
||||
String name = command.getCommandName().toLowerCase();
|
||||
if(map.containsKey(name))
|
||||
throw new CustomNPCsException("Already a subcommand with the name: " + name);
|
||||
map.put(name, command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "kamkeel";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender sender) {
|
||||
return "Use as /kamkeel subcommand";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
|
||||
if(args.length == 0){
|
||||
help.processCommand(sender, args);
|
||||
return;
|
||||
}
|
||||
|
||||
CommandKamkeelBase command = getCommand(args);
|
||||
if(command == null)
|
||||
throw new CommandException("Unknown command " + args[0]);
|
||||
|
||||
args = Arrays.copyOfRange(args, 1, args.length);
|
||||
if(command.subcommands.isEmpty() || !command.runSubCommands()){
|
||||
if(!sender.canCommandSenderUseCommand(command.getRequiredPermissionLevel(), getCommandPermission(command.getCommandName())))
|
||||
throw new CommandException("You are not allowed to use this command: " + command);
|
||||
command.canRun(sender, command.getUsage(), args);
|
||||
command.processCommand(sender, args);
|
||||
return;
|
||||
}
|
||||
|
||||
if(args.length == 0){
|
||||
help.processCommand(sender, new String[]{command.getCommandName()});
|
||||
return;
|
||||
}
|
||||
|
||||
command.processSubCommand(sender, args[0], Arrays.copyOfRange(args, 1, args.length));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List addTabCompletionOptions(ICommandSender sender, String[] args){
|
||||
if(args.length == 1)
|
||||
return new ArrayList<String>(map.keySet());
|
||||
CommandKamkeelBase command = getCommand(args);
|
||||
if(command == null)
|
||||
return null;
|
||||
if(args.length == 2 && command.runSubCommands())
|
||||
return new ArrayList<String>(command.subcommands.keySet());
|
||||
return command.addTabCompletionOptions(sender, Arrays.copyOfRange(args, 1, args.length));
|
||||
}
|
||||
|
||||
public CommandKamkeelBase getCommand(String[] args){
|
||||
if(args.length == 0)
|
||||
return null;
|
||||
return map.get(args[0].toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRequiredPermissionLevel(){
|
||||
return 2;
|
||||
}
|
||||
|
||||
public static String getCommandPermission(String command){
|
||||
return "cnpc.kamkeel." + command.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
package kamkeel;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
|
||||
public abstract class CommandKamkeelBase extends CommandBase{
|
||||
public Map<String, Method> subcommands = new HashMap<String, Method>();
|
||||
|
||||
public CommandKamkeelBase(){
|
||||
for (Method m : this.getClass().getDeclaredMethods()) {
|
||||
SubCommand sc = m.getAnnotation(SubCommand.class);
|
||||
if (sc != null) {
|
||||
String name = sc.name();
|
||||
if (name.equals(""))
|
||||
name = m.getName();
|
||||
subcommands.put(name.toLowerCase(), m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender sender) {
|
||||
return getDescription();
|
||||
}
|
||||
|
||||
public abstract String getDescription();
|
||||
|
||||
/**
|
||||
* @return Should return a string in the format of <arg> <arg2> <arg3> [arg4] where <> is a required parameter and [] optional
|
||||
*/
|
||||
public String getUsage(){
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean runSubCommands(){
|
||||
return !subcommands.isEmpty();
|
||||
}
|
||||
|
||||
protected void sendMessage(ICommandSender sender, String message, Object... obs) {
|
||||
sender.addChatMessage(new ChatComponentTranslation(message, obs));
|
||||
}
|
||||
|
||||
@Retention(value = RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface SubCommand {
|
||||
|
||||
String name() default "";
|
||||
|
||||
/**
|
||||
* @return Should return a string in the format of <arg> <arg2> <arg3> [arg4] where <> is a required parameter and [] optional
|
||||
*/
|
||||
String usage() default "";
|
||||
|
||||
String desc();
|
||||
|
||||
int permission() default 2;
|
||||
}
|
||||
|
||||
public void processSubCommand(ICommandSender sender, String command, String[] args) throws CommandException {
|
||||
Method m = subcommands.get(command.toLowerCase());
|
||||
if(m == null)
|
||||
throw new CommandException("Unknown subcommand " + command);
|
||||
|
||||
SubCommand sc = m.getAnnotation(SubCommand.class);
|
||||
if(!sender.canCommandSenderUseCommand(sc.permission(), getSubCommandPermission(command)))
|
||||
throw new CommandException("You are not allowed to use this command: " + command);
|
||||
|
||||
canRun(sender, sc.usage(), args);
|
||||
try {
|
||||
m.invoke(this, sender, args);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void canRun(ICommandSender sender, String usage, String[] args) throws CommandException{
|
||||
String[] np = usage.split(" ");
|
||||
List<String> required = new ArrayList<String>();
|
||||
for(int i = 0; i < np.length; i++){
|
||||
String command = np[i];
|
||||
if(command.startsWith("<")){
|
||||
required.add(command);
|
||||
}
|
||||
if(command.equals("<player>") && args.length > i){
|
||||
CommandBase.getPlayer(sender, args[i]); //throws PlayerNotFoundException if no player is found
|
||||
}
|
||||
|
||||
}
|
||||
if (args.length < required.size()) {
|
||||
throw new CommandException("Missing parameter: " + required.get(args.length));
|
||||
}
|
||||
}
|
||||
|
||||
public int getRequiredPermissionLevel(){
|
||||
return 2;
|
||||
}
|
||||
|
||||
public String getSubCommandPermission(String subCommand){
|
||||
return "cnpc.kamkeel." + getCommandName().toLowerCase() + "." + subCommand.toLowerCase();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
package kamkeel;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockIce;
|
||||
import net.minecraft.block.BlockLeavesBase;
|
||||
import net.minecraft.block.BlockVine;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.controllers.ChunkController;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
|
||||
public class ConfigCommand extends CommandKamkeelBase {
|
||||
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "config";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Some config things you can set";
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Disable/Enable the natural leaves decay",
|
||||
usage = "[true/false]",
|
||||
permission = 4
|
||||
)
|
||||
public void leavesdecay(ICommandSender sender, String[] args){
|
||||
if(args.length == 0){
|
||||
sendMessage(sender, "LeavesDecay: " + ConfigMain.LeavesDecayEnabled);
|
||||
}
|
||||
else{
|
||||
ConfigMain.LeavesDecayEnabled = Boolean.parseBoolean(args[0]);
|
||||
ConfigMain.LeavesDecayEnabledProperty.set(ConfigMain.LeavesDecayEnabled);
|
||||
if(ConfigMain.config.hasChanged()){
|
||||
ConfigMain.config.save();
|
||||
}
|
||||
Set<ResourceLocation> names = Block.blockRegistry.getKeys();
|
||||
for(ResourceLocation name : names){
|
||||
Block block = (Block) Block.blockRegistry.getObject(name);
|
||||
if(block instanceof BlockLeavesBase){
|
||||
block.setTickRandomly(ConfigMain.LeavesDecayEnabled);
|
||||
}
|
||||
}
|
||||
sendMessage(sender, "LeavesDecay is now " + ConfigMain.LeavesDecayEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Disable/Enable the vines growing",
|
||||
usage = "[true/false]",
|
||||
permission = 4
|
||||
)
|
||||
public void vinegrowth(ICommandSender sender, String[] args){
|
||||
if(args.length == 0){
|
||||
sendMessage(sender, "VineGrowth: " + ConfigMain.VineGrowthEnabled);
|
||||
}
|
||||
else{
|
||||
ConfigMain.VineGrowthEnabled = Boolean.parseBoolean(args[0]);
|
||||
ConfigMain.VineGrowthEnabledProperty.set(ConfigMain.VineGrowthEnabled);
|
||||
if(ConfigMain.config.hasChanged()){
|
||||
ConfigMain.config.save();
|
||||
}
|
||||
Set<ResourceLocation> names = Block.blockRegistry.getKeys();
|
||||
for(ResourceLocation name : names){
|
||||
Block block = (Block) Block.blockRegistry.getObject(name);
|
||||
if(block instanceof BlockVine){
|
||||
block.setTickRandomly(ConfigMain.VineGrowthEnabled);
|
||||
}
|
||||
}
|
||||
sendMessage(sender, "VineGrowth is now " + ConfigMain.VineGrowthEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Disable/Enable the ice melting",
|
||||
usage = "[true/false]",
|
||||
permission = 4
|
||||
)
|
||||
public void icemelts(ICommandSender sender, String[] args){
|
||||
if(args.length == 0){
|
||||
sendMessage(sender, "IceMelts: " + ConfigMain.IceMeltsEnabled);
|
||||
}
|
||||
else{
|
||||
ConfigMain.IceMeltsEnabled = Boolean.parseBoolean(args[0]);
|
||||
ConfigMain.IceMeltsEnabledProperty.set(ConfigMain.IceMeltsEnabled);
|
||||
if(ConfigMain.config.hasChanged()){
|
||||
ConfigMain.config.save();
|
||||
}
|
||||
Set<ResourceLocation> names = Block.blockRegistry.getKeys();
|
||||
for(ResourceLocation name : names){
|
||||
Block block = (Block) Block.blockRegistry.getObject(name);
|
||||
if(block instanceof BlockIce){
|
||||
block.setTickRandomly(ConfigMain.IceMeltsEnabled);
|
||||
}
|
||||
}
|
||||
sendMessage(sender, "IceMelts is now " + ConfigMain.IceMeltsEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Disable/Enable guns shooting",
|
||||
usage = "[true/false]",
|
||||
permission = 4
|
||||
)
|
||||
public void guns(ICommandSender sender, String[] args){
|
||||
if(args.length == 0){
|
||||
sendMessage(sender, "GunsEnabled: " + ConfigMain.GunsEnabled);
|
||||
}
|
||||
else{
|
||||
ConfigMain.GunsEnabled = Boolean.parseBoolean(args[0]);
|
||||
ConfigMain.GunsEnabledProperty.set(ConfigMain.GunsEnabled);
|
||||
if(ConfigMain.config.hasChanged()){
|
||||
ConfigMain.config.save();
|
||||
}
|
||||
sendMessage(sender, "GunsEnabled is now " + ConfigMain.GunsEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Freezes/Unfreezes npcs",
|
||||
usage = "[true/false]",
|
||||
permission = 4
|
||||
)
|
||||
public void freezenpcs(ICommandSender sender, String[] args){
|
||||
if(args.length == 0){
|
||||
sendMessage(sender, "Frozen NPCs: " + CustomNpcs.FreezeNPCs);
|
||||
}
|
||||
else{
|
||||
CustomNpcs.FreezeNPCs = Boolean.parseBoolean(args[0]);
|
||||
sendMessage(sender, "FrozenNPCs is now " + CustomNpcs.FreezeNPCs);
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Set number of active chunkloaders",
|
||||
usage = "<number>",
|
||||
permission = 4
|
||||
)
|
||||
public void chunkloaders(ICommandSender sender, String[] args) throws CommandException{
|
||||
if(args.length == 0){
|
||||
sendMessage(sender, "ChunkLoaders: " + ChunkController.instance.size() + "/" + ConfigMain.ChunkLoaders);
|
||||
}
|
||||
else{
|
||||
try{
|
||||
ConfigMain.ChunkLoaders = Integer.parseInt(args[0]);
|
||||
}
|
||||
catch(NumberFormatException ex){
|
||||
throw new CommandException("Did not get a number: " + args[0]);
|
||||
}
|
||||
ConfigMain.ChunkLoadersProperty.set(ConfigMain.ChunkLoaders);
|
||||
if(ConfigMain.config.hasChanged()){
|
||||
ConfigMain.config.save();
|
||||
}
|
||||
|
||||
int size = ChunkController.instance.size();
|
||||
if(size > ConfigMain.ChunkLoaders){
|
||||
ChunkController.instance.unload(size - ConfigMain.ChunkLoaders);
|
||||
sendMessage(sender, size - ConfigMain.ChunkLoaders + " chunksloaders unloaded");
|
||||
}
|
||||
sendMessage(sender, "ChunkLoaders: " + ChunkController.instance.size() + "/" + ConfigMain.ChunkLoaders);
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Get/Set font",
|
||||
usage = "[type] [size]",
|
||||
permission = 4
|
||||
)
|
||||
public void font(ICommandSender sender, String[] args){
|
||||
if(!(sender instanceof EntityPlayerMP))
|
||||
return;
|
||||
int size = 18;
|
||||
if(args.length > 1){
|
||||
try{
|
||||
size = Integer.parseInt(args[args.length - 1]);
|
||||
args = Arrays.copyOfRange(args, 0, args.length - 1);
|
||||
}
|
||||
catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
String font = "";
|
||||
for(int i = 0; i < args.length; i++){
|
||||
font += " " + args[i];
|
||||
}
|
||||
Server.sendData((EntityPlayerMP)sender, EnumPacketClient.CONFIG, 0, font.trim(), size);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
package kamkeel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.client.EntityUtil;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.DialogOption;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.entity.EntityDialogNpc;
|
||||
|
||||
public class DialogCommand extends CommandKamkeelBase {
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "dialog";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Dialog operations";
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "force read",
|
||||
usage = "<player> <dialog>"
|
||||
)
|
||||
public void read(ICommandSender sender, String args[]) throws CommandException{
|
||||
String playername=args[0];
|
||||
int diagid;
|
||||
try {
|
||||
diagid = Integer.parseInt(args[1]);
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new CommandException("DialogID must be an integer: " + args[1]);
|
||||
}
|
||||
List<PlayerData> data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||
if (data.isEmpty()) {
|
||||
throw new CommandException("Unknown player: " + playername);
|
||||
}
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.dialogData.dialogsRead.add(diagid);
|
||||
playerdata.savePlayerDataOnFile();
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "force unread dialog",
|
||||
usage = "<player> <dialog>"
|
||||
)
|
||||
public void unread(ICommandSender sender, String args[]) throws CommandException{
|
||||
String playername=args[0];
|
||||
int diagid;
|
||||
try {
|
||||
diagid = Integer.parseInt(args[1]);
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new CommandException("DialogID must be an integer: " + args[1]);
|
||||
}
|
||||
List<PlayerData> data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||
if (data.isEmpty()) {
|
||||
throw new CommandException("Unknown player: " + playername);
|
||||
}
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.dialogData.dialogsRead.remove(diagid);
|
||||
playerdata.savePlayerDataOnFile();
|
||||
}
|
||||
}
|
||||
@SubCommand(
|
||||
desc="reload dialogs from disk",
|
||||
permission = 4
|
||||
)
|
||||
public void reload(ICommandSender sender, String args[]){
|
||||
new DialogController();
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc="show dialog",
|
||||
usage="<player> <dialog> <name>"
|
||||
)
|
||||
public void show(ICommandSender sender, String args[]) throws CommandException{
|
||||
EntityPlayer player = CommandBase.getPlayer(sender, args[0]);
|
||||
if(player == null){
|
||||
throw new CommandException("Unknown player: " + args[0]);
|
||||
}
|
||||
|
||||
int diagid;
|
||||
try {
|
||||
diagid = Integer.parseInt(args[1]);
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new CommandException("DialogID must be an integer: " + args[1]);
|
||||
}
|
||||
Dialog dialog = DialogController.instance.dialogs.get(diagid);
|
||||
if(dialog == null){
|
||||
throw new CommandException("Unknown dialog id: " + args[1]);
|
||||
}
|
||||
|
||||
EntityDialogNpc npc = new EntityDialogNpc(sender.getEntityWorld());
|
||||
npc.display.setName(args[2]);
|
||||
EntityUtil.Copy(player, npc);
|
||||
DialogOption option = new DialogOption();
|
||||
option.dialogId = diagid;
|
||||
option.title = dialog.title;
|
||||
npc.dialogs.put(0, option);
|
||||
NoppesUtilServer.openDialog(player, npc, dialog, 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package kamkeel;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import noppes.npcs.controllers.FactionController;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.data.Faction;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.data.PlayerFactionData;
|
||||
|
||||
public class FactionCommand extends CommandKamkeelBase {
|
||||
|
||||
public Faction selectedFaction;
|
||||
public List<PlayerData> data;
|
||||
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "faction";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Faction operations";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage() {
|
||||
return "<player> <faction> <command>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean runSubCommands(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
|
||||
String playername = args[0];
|
||||
String factionname = args[1];
|
||||
|
||||
data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||
if (data.isEmpty()) {
|
||||
throw new CommandException("Unknown player: " + playername);
|
||||
}
|
||||
|
||||
try{
|
||||
selectedFaction = FactionController.getInstance().getFaction(Integer.parseInt(factionname));
|
||||
}
|
||||
catch(NumberFormatException e){
|
||||
selectedFaction = FactionController.getInstance().getFactionFromName(factionname);
|
||||
}
|
||||
|
||||
if (selectedFaction == null) {
|
||||
throw new CommandException("Unknown faction: " + factionname);
|
||||
}
|
||||
|
||||
processSubCommand(sender, args[2], Arrays.copyOfRange(args, 3, args.length));
|
||||
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.savePlayerDataOnFile();
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Add points",
|
||||
usage = "<points>"
|
||||
)
|
||||
public void add(ICommandSender sender, String[] args) throws CommandException {
|
||||
int points;
|
||||
try {
|
||||
points = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new CommandException("Must be an integer: " + args[0]);
|
||||
}
|
||||
int factionid = this.selectedFaction.id;
|
||||
|
||||
for(PlayerData playerdata : data){
|
||||
PlayerFactionData playerfactiondata = playerdata.factionData;
|
||||
playerfactiondata.increasePoints(factionid, points, playerdata.player);
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Substract points",
|
||||
usage = "<points>"
|
||||
)
|
||||
public void subtract(ICommandSender sender, String[] args) throws CommandException {
|
||||
int points;
|
||||
try {
|
||||
points = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new CommandException("Must be an integer: " + args[0]);
|
||||
}
|
||||
int factionid = this.selectedFaction.id;
|
||||
for(PlayerData playerdata : data){
|
||||
PlayerFactionData playerfactiondata = playerdata.factionData;
|
||||
playerfactiondata.increasePoints(factionid, -points, playerdata.player);
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(desc = "Reset points to default")
|
||||
public void reset(ICommandSender sender, String[] args) {
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.factionData.factionData.put(this.selectedFaction.id, this.selectedFaction.defaultPoints);
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Set points",
|
||||
usage = "<points>"
|
||||
)
|
||||
public void set(ICommandSender sender, String[] args) throws CommandException {
|
||||
int points;
|
||||
try {
|
||||
points = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new CommandException("Must be an integer: " + args[0]);
|
||||
}
|
||||
for(PlayerData playerdata : data){
|
||||
PlayerFactionData playerfactiondata = playerdata.factionData;
|
||||
playerfactiondata.factionData.put(this.selectedFaction.id,points);
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(desc = "Drop relationship")
|
||||
public void drop(ICommandSender sender, String[] args){
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.factionData.factionData.remove(this.selectedFaction.id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List addTabCompletionOptions(ICommandSender par1, String[] args) {
|
||||
if(args.length == 3){
|
||||
return CommandBase.getListOfStringsMatchingLastWord(args, new String[]{"add", "subtract", "set", "reset", "drop", "create"});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package kamkeel;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
|
||||
public class HelpCommand extends CommandKamkeelBase{
|
||||
private CommandKamkeel parent;
|
||||
|
||||
public HelpCommand(CommandKamkeel parent){
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "help";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "help [command]";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
|
||||
if(args.length == 0){
|
||||
sendMessage(sender, "\u00A78------ \u00A7cKamkeel Commands \u00A78------");
|
||||
for(Entry<String, CommandKamkeelBase> entry : parent.map.entrySet()){
|
||||
sendMessage(sender, "\u00A77> " + "\u00A7e" + entry.getKey() + "\u00A78: \u00A77" + entry.getValue().getCommandUsage(sender));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
CommandKamkeelBase command = parent.getCommand(args);
|
||||
if(command == null)
|
||||
throw new CommandException("Unknown command " + args[0]);
|
||||
|
||||
if(command.subcommands.isEmpty()){
|
||||
sender.addChatMessage(new ChatComponentTranslation(command.getCommandUsage(sender)));
|
||||
return;
|
||||
}
|
||||
|
||||
Method m = null;
|
||||
if(args.length > 1){
|
||||
m = command.subcommands.get(args[1].toLowerCase());
|
||||
}
|
||||
if(m == null){
|
||||
sendMessage(sender, "\u00A78------ \u00A7a" + command.getCommandName().toUpperCase() + " SubCommands \u00A78------");
|
||||
sendMessage(sender, "\u00A77Usage: \u00A76" + command.getUsage());
|
||||
for(Entry<String, Method> entry : command.subcommands.entrySet()){
|
||||
sender.addChatMessage(new ChatComponentTranslation("\u00A77> " + "\u00A7e" + entry.getKey() + "\u00A78: \u00A77" + entry.getValue().getAnnotation(SubCommand.class).desc()));
|
||||
}
|
||||
sender.addChatMessage(new ChatComponentTranslation("\u00A78Permission:\u00A77 " + CommandKamkeel.getCommandPermission(command.getCommandName())));
|
||||
}
|
||||
else{
|
||||
sendMessage(sender, "\u00A78------ \u00A7b" + command.getCommandName().toUpperCase() + "." + args[1].toUpperCase() + " Command \u00A78------");
|
||||
SubCommand sc = m.getAnnotation(SubCommand.class);
|
||||
sender.addChatMessage(new ChatComponentTranslation("\u00A77" + sc.desc()));
|
||||
if(!sc.usage().isEmpty())
|
||||
sender.addChatMessage(new ChatComponentTranslation("\u00A77Usage: \u00A76" + sc.usage()));
|
||||
sender.addChatMessage(new ChatComponentTranslation("\u00A78Permission:\u00A77 " + getSubCommandPermission(args[1])));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
package kamkeel;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.PlayerNotFoundException;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.RoleCompanion;
|
||||
import noppes.npcs.roles.RoleFollower;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
public class NpcCommand extends CommandKamkeelBase {
|
||||
|
||||
public EntityNPCInterface selectedNpc;
|
||||
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "npc";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "NPC operation";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage() {
|
||||
return "<name> <command>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean runSubCommands(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
|
||||
String npcname = args[0].replace("%", " ");
|
||||
String command = args[1];
|
||||
args = Arrays.copyOfRange(args, 2, args.length);
|
||||
if(command.equalsIgnoreCase("create")){
|
||||
args = ArrayUtils.add(args, 0, npcname);
|
||||
processSubCommand(sender, command, args);
|
||||
return;
|
||||
}
|
||||
|
||||
int x = sender.getPlayerCoordinates().posX;
|
||||
int y = sender.getPlayerCoordinates().posY;
|
||||
int z = sender.getPlayerCoordinates().posZ;
|
||||
List<EntityNPCInterface> list = getEntities(EntityNPCInterface.class, sender.getEntityWorld(), x, y, z, 80);
|
||||
for (EntityNPCInterface npc : list) {
|
||||
String name = npc.display.getName().replace(" ", "_");
|
||||
if (name.equalsIgnoreCase(npcname)){
|
||||
if(selectedNpc == null || selectedNpc.getDistanceSq(x, y, z) > npc.getDistanceSq(x, y, z))
|
||||
selectedNpc = npc;
|
||||
}
|
||||
}
|
||||
if(selectedNpc == null)
|
||||
throw new CommandException("Npc " + npcname + " was not found");
|
||||
|
||||
processSubCommand(sender, command, args);
|
||||
selectedNpc = null;
|
||||
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Set Home (respawn place)",
|
||||
usage = "[x] [y] [z]"
|
||||
)
|
||||
public void home(ICommandSender sender, String[] args) {
|
||||
double posX = sender.getPlayerCoordinates().posX;
|
||||
double posY = sender.getPlayerCoordinates().posY;
|
||||
double posZ = sender.getPlayerCoordinates().posZ;
|
||||
|
||||
if(args.length == 3){
|
||||
posX = CommandBase.func_110666_a(sender, selectedNpc.posX, args[0]);
|
||||
posY = CommandBase.func_110665_a(sender, selectedNpc.posY, args[1].trim(), 0, 0);
|
||||
posZ = CommandBase.func_110666_a(sender, selectedNpc.posZ, args[2]);
|
||||
}
|
||||
|
||||
selectedNpc.ai.startPos = new int[]{MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)};
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Set NPC visibility",
|
||||
usage = "[true/false/semi]"
|
||||
)
|
||||
public void visible(ICommandSender sender, String[] args){
|
||||
if(args.length < 1)
|
||||
return;
|
||||
boolean bo = args[0].equalsIgnoreCase("true");
|
||||
boolean semi = args[0].equalsIgnoreCase("semi");
|
||||
|
||||
int current = selectedNpc.display.visible;
|
||||
if(semi)
|
||||
selectedNpc.display.visible = 2;
|
||||
else if(bo)
|
||||
selectedNpc.display.visible = 0;
|
||||
else
|
||||
selectedNpc.display.visible = 1;
|
||||
|
||||
if(current != selectedNpc.display.visible)
|
||||
selectedNpc.updateClient = true;
|
||||
|
||||
}
|
||||
|
||||
@SubCommand(desc = "Delete an NPC")
|
||||
public void delete(ICommandSender sender, String[] args){
|
||||
selectedNpc.delete();
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Sets the owner of an follower/companion",
|
||||
usage = "[player]"
|
||||
)
|
||||
public void owner(ICommandSender sender, String[] args){
|
||||
if(args.length < 1){
|
||||
EntityPlayer player = null;
|
||||
if(selectedNpc.roleInterface instanceof RoleFollower)
|
||||
player = ((RoleFollower)selectedNpc.roleInterface).owner;
|
||||
|
||||
if(selectedNpc.roleInterface instanceof RoleCompanion)
|
||||
player = ((RoleCompanion)selectedNpc.roleInterface).owner;
|
||||
|
||||
if(player == null)
|
||||
sendMessage(sender, "No owner");
|
||||
else
|
||||
sendMessage(sender, "Owner is: " + player.getDisplayName());
|
||||
}
|
||||
else{
|
||||
EntityPlayerMP player = null;
|
||||
try {
|
||||
player = CommandBase.getPlayer(sender, args[0]);
|
||||
} catch (PlayerNotFoundException e) {
|
||||
|
||||
}
|
||||
if(selectedNpc.roleInterface instanceof RoleFollower)
|
||||
((RoleFollower)selectedNpc.roleInterface).setOwner(player);
|
||||
|
||||
if(selectedNpc.roleInterface instanceof RoleCompanion)
|
||||
((RoleCompanion)selectedNpc.roleInterface).setOwner(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubCommand(
|
||||
desc = "Set NPC name",
|
||||
usage = "[name]"
|
||||
)
|
||||
public void name(ICommandSender sender, String[] args){
|
||||
if(args.length < 1)
|
||||
return;
|
||||
|
||||
String name = args[0];
|
||||
for(int i = 1; i < args.length; i++){
|
||||
name += " " + args[i];
|
||||
}
|
||||
|
||||
if(!selectedNpc.display.getName().equals(name)){
|
||||
selectedNpc.display.setName(name);
|
||||
selectedNpc.updateClient = true;
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Creates an NPC",
|
||||
usage = "[name]"
|
||||
)
|
||||
public void create(ICommandSender sender, String[] args) {
|
||||
EntityPlayerMP player = (EntityPlayerMP) sender;
|
||||
World pw = player.getEntityWorld();
|
||||
EntityCustomNpc npc = new EntityCustomNpc(pw);
|
||||
if(args.length > 0)
|
||||
npc.display.name = args[0];
|
||||
npc.setPositionAndRotation(player.posX, player.posY, player.posZ, player.cameraYaw, player.cameraPitch);
|
||||
npc.ai.startPos = new int[]{MathHelper.floor_double(player.posX),MathHelper.floor_double(player.posY),MathHelper.floor_double(player.posZ)};
|
||||
pw.spawnEntityInWorld(npc);
|
||||
npc.setHealth(npc.getMaxHealth());
|
||||
NoppesUtilServer.sendOpenGui(player, EnumGuiType.MainMenuDisplay, npc);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List addTabCompletionOptions(ICommandSender par1, String[] args) {
|
||||
if(args.length == 2){
|
||||
return CommandBase.getListOfStringsMatchingLastWord(args, new String[]{"create", "home", "visible", "delete", "owner", "name"});
|
||||
}
|
||||
if(args.length == 3 && args[1].equalsIgnoreCase("owner")){
|
||||
return CommandBase.getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRequiredPermissionLevel(){
|
||||
return 4;
|
||||
}
|
||||
|
||||
public <T extends Entity> List<T> getEntities(Class<? extends T> cls, World world, int x, int y, int z, int range) {
|
||||
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(range, range, range);
|
||||
List<T> list = world.getEntitiesWithinAABB(cls, bb);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
package kamkeel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.QuestController;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import noppes.npcs.controllers.data.QuestData;
|
||||
|
||||
public class QuestCommand extends CommandKamkeelBase {
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "quest";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Quest operations";
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Start a quest",
|
||||
usage = "<player> <quest>"
|
||||
)
|
||||
public void start(ICommandSender sender, String[] args) throws CommandException {
|
||||
String playername = args[0];
|
||||
int questid;
|
||||
try {
|
||||
questid = Integer.parseInt(args[1]);
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new CommandException("QuestID must be an integer: " + args[1]);
|
||||
}
|
||||
|
||||
List<PlayerData> data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||
|
||||
if (data.isEmpty()) {
|
||||
throw new CommandException("Unknown player: " + playername);
|
||||
}
|
||||
|
||||
Quest quest = QuestController.instance.quests.get(questid);
|
||||
if (quest == null){
|
||||
throw new CommandException("Unknown QuestID: " + questid);
|
||||
}
|
||||
|
||||
for(PlayerData playerdata : data){
|
||||
QuestData questdata = new QuestData(quest);
|
||||
playerdata.questData.activeQuests.put(questid, questdata);
|
||||
playerdata.savePlayerDataOnFile();
|
||||
Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.MESSAGE, "quest.newquest", quest.title);
|
||||
Server.sendData((EntityPlayerMP)playerdata.player, EnumPacketClient.CHAT, "quest.newquest", ": ", quest.title);
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Finish a quest",
|
||||
usage = "<player> <quest>"
|
||||
)
|
||||
public void finish(ICommandSender sender, String args[]) throws CommandException{
|
||||
String playername=args[0];
|
||||
int questid;
|
||||
try {
|
||||
questid = Integer.parseInt(args[1]);
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw new CommandException("QuestID must be an integer: " + args[1]);
|
||||
}
|
||||
|
||||
List<PlayerData> data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||
if (data.isEmpty()) {
|
||||
throw new CommandException(String.format("Unknow player '%s'", playername));
|
||||
}
|
||||
|
||||
Quest quest = QuestController.instance.quests.get(questid);
|
||||
if (quest == null){
|
||||
throw new CommandException("Unknown QuestID: " + questid);
|
||||
}
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.questData.finishedQuests.put(questid, System.currentTimeMillis());
|
||||
playerdata.savePlayerDataOnFile();
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Stop a started quest",
|
||||
usage = "<player> <quest>"
|
||||
)
|
||||
public void stop(ICommandSender sender, String[] args) throws CommandException {
|
||||
String playername=args[0];
|
||||
int questid;
|
||||
try {
|
||||
questid = Integer.parseInt(args[1]);
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new CommandException("QuestID must be an integer: " + args[1]);
|
||||
}
|
||||
List<PlayerData> data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||
if (data.isEmpty()) {
|
||||
throw new CommandException(String.format("Unknow player '%s'", playername));
|
||||
}
|
||||
Quest quest = QuestController.instance.quests.get(questid);
|
||||
if (quest == null){
|
||||
throw new CommandException("Unknown QuestID: " + questid);
|
||||
}
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.questData.activeQuests.remove(questid);
|
||||
playerdata.savePlayerDataOnFile();
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "Removes a quest from finished and active quests",
|
||||
usage = "<player> <quest>"
|
||||
)
|
||||
public void remove(ICommandSender sender, String[] args) throws CommandException {
|
||||
String playername=args[0];
|
||||
int questid;
|
||||
try {
|
||||
questid = Integer.parseInt(args[1]);
|
||||
} catch (NumberFormatException ex) {
|
||||
throw new CommandException("QuestID must be an integer: " + args[1]);
|
||||
}
|
||||
|
||||
List<PlayerData> data = PlayerDataController.instance.getPlayersData(sender, playername);
|
||||
if (data.isEmpty()) {
|
||||
throw new CommandException(String.format("Unknown player '%s'", playername));
|
||||
}
|
||||
|
||||
Quest quest = QuestController.instance.quests.get(questid);
|
||||
if (quest == null){
|
||||
throw new CommandException(String.format("Unknown QuestID"));
|
||||
}
|
||||
|
||||
for(PlayerData playerdata : data){
|
||||
playerdata.questData.activeQuests.remove(questid);
|
||||
playerdata.questData.finishedQuests.remove(questid);
|
||||
playerdata.savePlayerDataOnFile();
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc="reload quests from disk",
|
||||
permission = 4
|
||||
)
|
||||
public void reload(ICommandSender sender, String args[]){
|
||||
new DialogController();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package kamkeel;
|
||||
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
|
||||
|
||||
public class ScriptCommand extends CommandKamkeelBase {
|
||||
|
||||
@SubCommand(desc = "Reload scripts data and folders.")
|
||||
public Boolean reload(ICommandSender sender, String args[]) {
|
||||
ScriptController.Instance.loadCategories();
|
||||
|
||||
if(ScriptController.Instance.loadPlayerScripts())
|
||||
sendMessage(sender, "Reload player scripts successfully");
|
||||
else
|
||||
sendMessage(sender, "Failed reloading player scripts");
|
||||
|
||||
if(ScriptController.Instance.loadForgeScripts())
|
||||
sendMessage(sender, "Reload forge scripts successfully");
|
||||
else
|
||||
sendMessage(sender, "Failed reloading forge scripts");
|
||||
|
||||
if(ScriptController.Instance.loadStoredData())
|
||||
sendMessage(sender, "Reload stored data successfully");
|
||||
else
|
||||
sendMessage(sender, "Failed reloading stored data");
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "script";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Commands for scripts";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package kamkeel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.EntityXPOrb;
|
||||
import net.minecraft.entity.monster.EntityGhast;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.entity.passive.EntityTameable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class SlayCommand extends CommandKamkeelBase {
|
||||
public Map<String, Class<?>> SlayMap = new LinkedHashMap<String, Class<?>>();
|
||||
|
||||
public SlayCommand(){
|
||||
SlayMap.clear();
|
||||
|
||||
SlayMap.put("all",EntityLivingBase.class);
|
||||
SlayMap.put("mobs",EntityMob.class);
|
||||
SlayMap.put("animals", EntityAnimal.class);
|
||||
SlayMap.put("items", EntityItem.class);
|
||||
SlayMap.put("xporbs", EntityXPOrb.class);
|
||||
SlayMap.put("npcs", EntityNPCInterface.class);
|
||||
|
||||
HashMap<String,Class<?>> list = new HashMap<String,Class<?>>(EntityList.stringToClassMapping);
|
||||
for(String name : list.keySet()){
|
||||
Class<?> cls = list.get(name);
|
||||
if(EntityNPCInterface.class.isAssignableFrom(cls))
|
||||
continue;
|
||||
if(!EntityLivingBase.class.isAssignableFrom(cls))
|
||||
continue;
|
||||
SlayMap.put(name.toLowerCase(), list.get(name));
|
||||
}
|
||||
|
||||
SlayMap.remove("monster");
|
||||
SlayMap.remove("mob");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "slay";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Kills given entity within range. Tab to see options.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage(){
|
||||
return "<type>.. [range]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
|
||||
EntityPlayerMP player = (EntityPlayerMP) sender;
|
||||
ArrayList<Class<?>> toDelete = new ArrayList<Class<?>>();
|
||||
boolean deleteNPCs = false;
|
||||
for(String delete : args){
|
||||
delete = delete.toLowerCase();
|
||||
Class<?> cls = SlayMap.get(delete);
|
||||
if(cls != null)
|
||||
toDelete.add(cls);
|
||||
if(delete.equals("mobs")){
|
||||
toDelete.add(EntityGhast.class);
|
||||
toDelete.add(EntityDragon.class);
|
||||
}
|
||||
if(delete.equals("npcs"))
|
||||
deleteNPCs = true;
|
||||
}
|
||||
int count = 0;
|
||||
int range = 120;
|
||||
try{
|
||||
range = Integer.parseInt(args[args.length - 1]);
|
||||
}
|
||||
catch(NumberFormatException ex){
|
||||
|
||||
}
|
||||
AxisAlignedBB box = player.boundingBox.expand(range, range, range);
|
||||
List<? extends Entity> list = sender.getEntityWorld().getEntitiesWithinAABB(EntityLivingBase.class, box);
|
||||
|
||||
for(Entity entity : list){
|
||||
if(entity instanceof EntityPlayer)
|
||||
continue;
|
||||
if(entity instanceof EntityTameable && ((EntityTameable)entity).isTamed())
|
||||
continue;
|
||||
if(entity instanceof EntityNPCInterface && !deleteNPCs)
|
||||
continue;
|
||||
if(delete(entity,toDelete))
|
||||
count++;
|
||||
}
|
||||
if(toDelete.contains(EntityXPOrb.class)){
|
||||
list = sender.getEntityWorld().getEntitiesWithinAABB(EntityXPOrb.class, box);
|
||||
for(Entity entity : list){
|
||||
entity.isDead = true;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if(toDelete.contains(EntityItem.class)){
|
||||
list = sender.getEntityWorld().getEntitiesWithinAABB(EntityItem.class, box);
|
||||
for(Entity entity : list){
|
||||
entity.isDead = true;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
sender.addChatMessage(new ChatComponentTranslation(count + " entities deleted"));
|
||||
}
|
||||
|
||||
private boolean delete(Entity entity, ArrayList<Class<?>> toDelete) {
|
||||
for(Class<?> delete : toDelete){
|
||||
if(delete == EntityAnimal.class && (entity instanceof EntityHorse)){
|
||||
continue;
|
||||
}
|
||||
if(delete.isAssignableFrom(entity.getClass())){
|
||||
entity.isDead = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List addTabCompletionOptions(ICommandSender sender, String[] args){
|
||||
return CommandBase.getListOfStringsMatchingLastWord(args, SlayMap.keySet().toArray(new String[SlayMap.size()]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package noppes.npcs;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.handler.data.IAnimationData;
|
||||
import noppes.npcs.api.handler.data.IAnimation;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.controllers.data.Animation;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class AnimationData implements IAnimationData {
|
||||
//Server-side: DataDisplay, PlayerData
|
||||
//Client-side: DataDisplay, EntityPlayer
|
||||
public Object parent;
|
||||
|
||||
public Animation animation;
|
||||
public boolean allowAnimation = false;
|
||||
|
||||
public AnimationData(Object parent){
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public void updateClient() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound = this.writeToNBT(compound);
|
||||
compound.setTag("Animation",this.animation == null ? new NBTTagCompound() : this.animation.writeToNBT());
|
||||
if (parent instanceof PlayerData) {
|
||||
Server.sendToAll(EnumPacketClient.UPDATE_ANIMATIONS, compound, ((PlayerData) parent).player.getCommandSenderName());
|
||||
} else if (parent instanceof DataDisplay) {
|
||||
compound.setInteger("EntityId",((DataDisplay) parent).npc.getEntityId());
|
||||
Server.sendAssociatedData(((DataDisplay) parent).npc, EnumPacketClient.UPDATE_ANIMATIONS, compound);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
if (!this.allowAnimation || this.animation == null || this.animation.currentFrame == this.animation.frames.size() || animation.currentFrame() == null)
|
||||
return false;
|
||||
|
||||
if (this.parent instanceof DataDisplay) {
|
||||
EntityNPCInterface npc = ((DataDisplay)this.parent).npc;
|
||||
if (!npc.isEntityAlive())
|
||||
return false;
|
||||
|
||||
return animation.whileAttacking && npc.isAttacking() || animation.whileMoving && npc.isWalking() || animation.whileStanding && !npc.isWalking();
|
||||
} else {
|
||||
EntityPlayer player;
|
||||
if (this.parent instanceof PlayerData) {
|
||||
player = ((PlayerData) this.parent).player;
|
||||
} else {
|
||||
player = (EntityPlayer) this.parent;
|
||||
}
|
||||
if (!player.isEntityAlive())
|
||||
return false;
|
||||
|
||||
boolean moving = Math.sqrt(player.motionX*player.motionX + player.motionY*player.motionY + player.motionZ*player.motionZ) != 0.0D;
|
||||
|
||||
return animation.whileAttacking && player.getLastAttackerTime() - player.ticksExisted < 20 || animation.whileMoving && moving || animation.whileStanding && !moving;
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
compound.setBoolean("AllowAnimation", allowAnimation);
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
this.allowAnimation = compound.getBoolean("AllowAnimation");
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.allowAnimation = enabled;
|
||||
}
|
||||
|
||||
public boolean enabled() {
|
||||
return this.allowAnimation;
|
||||
}
|
||||
|
||||
public void setAnimation(IAnimation animation) {
|
||||
this.animation = (Animation) animation;
|
||||
}
|
||||
|
||||
public IAnimation getAnimation() {
|
||||
return animation;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -9,13 +10,12 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import noppes.npcs.api.IWorld;
|
||||
import noppes.npcs.blocks.tiles.TileNpcContainer;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.containers.*;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import noppes.npcs.api.IWorld;
|
||||
|
||||
public class CommonProxy implements IGuiHandler {
|
||||
|
||||
|
||||
@@ -1,79 +1,23 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
||||
import net.minecraft.dispenser.IBlockSource;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemFlintAndSteel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import noppes.npcs.blocks.BlockBanner;
|
||||
import noppes.npcs.blocks.BlockBarrel;
|
||||
import noppes.npcs.blocks.BlockBeam;
|
||||
import noppes.npcs.blocks.BlockBigSign;
|
||||
import noppes.npcs.blocks.BlockBlood;
|
||||
import noppes.npcs.blocks.BlockBook;
|
||||
import noppes.npcs.blocks.BlockBorder;
|
||||
import noppes.npcs.blocks.BlockCampfire;
|
||||
import noppes.npcs.blocks.BlockCandle;
|
||||
import noppes.npcs.blocks.BlockCarpentryBench;
|
||||
import noppes.npcs.blocks.BlockChair;
|
||||
import noppes.npcs.blocks.BlockCouchWood;
|
||||
import noppes.npcs.blocks.BlockCouchWool;
|
||||
import noppes.npcs.blocks.BlockCrate;
|
||||
import noppes.npcs.blocks.BlockCrystal;
|
||||
import noppes.npcs.blocks.BlockLamp;
|
||||
import noppes.npcs.blocks.BlockMailbox;
|
||||
import noppes.npcs.blocks.BlockNpcRedstone;
|
||||
import noppes.npcs.blocks.BlockPedestal;
|
||||
import noppes.npcs.blocks.BlockPlaceholder;
|
||||
import noppes.npcs.blocks.BlockShelf;
|
||||
import noppes.npcs.blocks.BlockSign;
|
||||
import noppes.npcs.blocks.BlockStool;
|
||||
import noppes.npcs.blocks.BlockTable;
|
||||
import noppes.npcs.blocks.BlockTallLamp;
|
||||
import noppes.npcs.blocks.BlockTombstone;
|
||||
import noppes.npcs.blocks.BlockWallBanner;
|
||||
import noppes.npcs.blocks.BlockWaypoint;
|
||||
import noppes.npcs.blocks.BlockWeaponRack;
|
||||
import noppes.npcs.blocks.tiles.TileBanner;
|
||||
import noppes.npcs.blocks.tiles.TileBarrel;
|
||||
import noppes.npcs.blocks.tiles.TileBeam;
|
||||
import noppes.npcs.blocks.tiles.TileBigSign;
|
||||
import noppes.npcs.blocks.tiles.TileBlockAnvil;
|
||||
import noppes.npcs.blocks.tiles.TileBook;
|
||||
import noppes.npcs.blocks.tiles.TileBorder;
|
||||
import noppes.npcs.blocks.tiles.TileCampfire;
|
||||
import noppes.npcs.blocks.tiles.TileCandle;
|
||||
import noppes.npcs.blocks.tiles.TileChair;
|
||||
import noppes.npcs.blocks.tiles.TileCouchWood;
|
||||
import noppes.npcs.blocks.tiles.TileCouchWool;
|
||||
import noppes.npcs.blocks.tiles.TileCrate;
|
||||
import noppes.npcs.blocks.tiles.TileLamp;
|
||||
import noppes.npcs.blocks.tiles.TileMailbox;
|
||||
import noppes.npcs.blocks.tiles.TilePedestal;
|
||||
import noppes.npcs.blocks.tiles.TileRedstoneBlock;
|
||||
import noppes.npcs.blocks.tiles.TileShelf;
|
||||
import noppes.npcs.blocks.tiles.TileSign;
|
||||
import noppes.npcs.blocks.tiles.TileStool;
|
||||
import noppes.npcs.blocks.tiles.TileTable;
|
||||
import noppes.npcs.blocks.tiles.TileTallLamp;
|
||||
import noppes.npcs.blocks.tiles.TileTombstone;
|
||||
import noppes.npcs.blocks.tiles.TileWallBanner;
|
||||
import noppes.npcs.blocks.tiles.TileWaypoint;
|
||||
import noppes.npcs.blocks.tiles.TileWeaponRack;
|
||||
import noppes.npcs.blocks.*;
|
||||
import noppes.npcs.blocks.tiles.*;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumNpcToolMaterial;
|
||||
import noppes.npcs.items.*;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class CustomItems {
|
||||
|
||||
@@ -261,7 +205,7 @@ public class CustomItems {
|
||||
GameRegistry.registerTileEntity(TileWaypoint.class, "TileWaypoint");
|
||||
GameRegistry.registerTileEntity(TileBanner.class, "TileNPCBanner");
|
||||
|
||||
if(!CustomNpcs.DisableExtraBlock){
|
||||
if(!ConfigMain.DisableExtraBlock){
|
||||
GameRegistry.registerTileEntity(TileWallBanner.class, "TileNPCWallBanner");
|
||||
GameRegistry.registerTileEntity(TileTallLamp.class, "TileNPCTallLamp");
|
||||
GameRegistry.registerTileEntity(TileChair.class, "TileNPCChair");
|
||||
@@ -324,7 +268,7 @@ public class CustomItems {
|
||||
|
||||
((ItemNpcBlock)Item.getItemFromBlock(carpentyBench)).names = new String[]{"tile.npcCarpentyBench", "tile.anvil"};
|
||||
|
||||
if(!CustomNpcs.DisableExtraBlock){
|
||||
if(!ConfigMain.DisableExtraBlock){
|
||||
blood = new BlockBlood().setBlockName("npcBloodBlock").setBlockTextureName("customnpcs:npcBloodBlock").setCreativeTab(tabBlocks);
|
||||
banner = new BlockBanner().setBlockName("npcBanner").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeMetal).setCreativeTab(tabBlocks);
|
||||
wallBanner = new BlockWallBanner().setBlockName("npcWallBanner").setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundTypeMetal).setCreativeTab(tabBlocks);
|
||||
@@ -413,7 +357,7 @@ public class CustomItems {
|
||||
clarinet = new ItemMusicClarinet().setUnlocalizedName("npcClarinet").setFull3D().setMaxStackSize(1).setTextureName("customnpcs:npcClarinet");
|
||||
|
||||
|
||||
if(!CustomNpcs.DisableExtraItems){
|
||||
if(!ConfigMain.DisableExtraItems){
|
||||
tabArmor = new CreativeTabNpcs("cnpcsa");
|
||||
tabWeapon = new CreativeTabNpcs("cnpcsw");
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import cpw.mods.fml.common.network.FMLEventChannel;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import foxz.command.CommandNoppes;
|
||||
import kamkeel.CommandKamkeel;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockIce;
|
||||
import net.minecraft.block.BlockLeavesBase;
|
||||
@@ -16,14 +17,13 @@ import net.minecraft.block.BlockVine;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import nikedemos.markovnames.generators.*;
|
||||
import noppes.npcs.config.ConfigLoader;
|
||||
import noppes.npcs.config.ConfigProp;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.config.LoadConfiguration;
|
||||
import noppes.npcs.config.legacy.LegacyConfig;
|
||||
import noppes.npcs.controllers.*;
|
||||
import noppes.npcs.enchants.EnchantInterface;
|
||||
import noppes.npcs.entity.*;
|
||||
@@ -35,163 +35,23 @@ import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.7")
|
||||
@Mod(modid = "customnpcs", name = "CustomNpcs", version = "1.8")
|
||||
public class CustomNpcs {
|
||||
|
||||
@ConfigProp(info = "Disable Chat Bubbles")
|
||||
public static boolean EnableChatBubbles = true;
|
||||
|
||||
private static int NewEntityStartId = 0;
|
||||
|
||||
@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/Disables the use of the the ECMA6 Javascript standard instead of ECMA5.1." +
|
||||
"\nEnabling this adds many more features to JS in scripts. Only use if on Java 8 or higher." +
|
||||
"\nNot all ECMA 6 language is supported through this functionality.")
|
||||
public static boolean ScriptingECMA6 = false;
|
||||
|
||||
@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 = "If scripts are too long (>65535 characters), they normally won't be saved in NBT data.\n" +
|
||||
"This config adds additional compound tags to scripts that need it, so you can store much larger scripts!\n" +
|
||||
"Every additional compound tag adds 65535 more characters to your script length limit. Use incrementally, with caution.")
|
||||
public static int ExpandedScriptLimit = 2;
|
||||
|
||||
@ConfigProp(info = "Enables if Player Information (WAND-USE) should be printed to CustomNPCs Logs. IF on Server \n" +
|
||||
"Logs will only be present SERVER-SIDE only in CustomNPCs-latest, -1, -2, and -3")
|
||||
public static boolean PlayerLogging = false;
|
||||
|
||||
@ConfigProp(info = "Enables if Scripting Information should be printed to CustomNPCs Logs. IF on Server \n" +
|
||||
"Logs will only be present SERVER-SIDE only in CustomNPCs-latest, -1, -2, and -3")
|
||||
public static boolean ScriptLogging = false;
|
||||
|
||||
@ConfigProp(info = "Amount of Messages marked as SPAM [5, 3000]. Lower Number means MORE accurate messages \n" +
|
||||
"This frequency will determine if the log will print a line with [SPAM] to warn the console.")
|
||||
public static int ScriptFrequency = 20;
|
||||
|
||||
@ConfigProp(info = "IN Milliseconds 1s = 1000s. If a recent LOG of the same event is SENT within this threshold it will be ignored.")
|
||||
public static int ScriptIgnoreTime = 2000;
|
||||
|
||||
@ConfigProp(info = "Comma separated list of NPC Script Types that will omit these from the logs,\n" +
|
||||
"INIT,TICK,INTERACT,DIALOG,DAMAGED,KILLED,ATTACK,TARGET,COLLIDE,KILLS,DIALOG_CLOSE,TIMER")
|
||||
public static String ScriptLogIgnoreType = "TICK";
|
||||
|
||||
@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;
|
||||
|
||||
@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")
|
||||
public static boolean NpcUseOpCommands = false;
|
||||
|
||||
@ConfigProp(info = "Client sided! Determines where tracking quest info shows up on the screen based on a number from 0 to 8. Default: 3")
|
||||
public static int TrackingInfoAlignment = 3;
|
||||
|
||||
@ConfigProp(info = "Client sided! Offsets the tracking info GUI by this amount in the X direction.")
|
||||
public static int TrackingInfoX = 0;
|
||||
|
||||
@ConfigProp(info = "Client sided! Offsets the tracking info GUI by this amount in the Y direction.")
|
||||
public static int TrackingInfoY = 0;
|
||||
|
||||
@ConfigProp
|
||||
public static boolean InventoryGuiEnabled = true;
|
||||
|
||||
@ConfigProp
|
||||
public static boolean DisableExtraItems = false;
|
||||
@ConfigProp
|
||||
public static boolean DisableExtraBlock = false;
|
||||
|
||||
public static long ticks;
|
||||
|
||||
@SidedProxy(clientSide = "noppes.npcs.client.ClientProxy", serverSide = "noppes.npcs.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@ConfigProp(info = "Enables CustomNpcs startup update message")
|
||||
public static boolean EnableUpdateChecker = true;
|
||||
public static File Dir;
|
||||
|
||||
private static int NewEntityStartId = 0;
|
||||
public static long ticks;
|
||||
public static CustomNpcs instance;
|
||||
|
||||
public static boolean FreezeNPCs = false;
|
||||
|
||||
@ConfigProp(info = "Only ops can create and edit npcs")
|
||||
public static boolean OpsOnly = false;
|
||||
|
||||
@ConfigProp(info = "Only ops can see and edit scripts")
|
||||
public static boolean ScriptOpsOnly = false;
|
||||
|
||||
@ConfigProp(info = "Comma separated list of player UUIDs that can see and edit scripts. If ScriptsOpsOnly is true,\n" +
|
||||
"ops and players with these IDs can see and edit scripts. Example:\n" +
|
||||
"b876ec32-e396-476b-a115-8438d83c67d4,069a79f4-44e9-4726-a5be-fca90e38aaf5,be951074-c7ea-4f02-a725-bf017bc88650\n" +
|
||||
"Get a player's UUID from a site like NameMC or the API IPlayer.getUniqueID() function!\n" +
|
||||
"If left empty and ScriptsOpsOnly is false, anyone can see and edit scripts with a scripter.")
|
||||
public static String ScriptDevIDs = "";
|
||||
|
||||
@ConfigProp(info = "Default interact line. Leave empty to not have one")
|
||||
public static String DefaultInteractLine = "Hello @p";
|
||||
|
||||
@ConfigProp
|
||||
public static boolean DisableEnchants = false;
|
||||
@ConfigProp(info = "Start Id for enchants. IDs can only range from 0-256")
|
||||
public static int EnchantStartId = 100;
|
||||
|
||||
@ConfigProp(info = "Number of chunk loading npcs that can be active at the same time")
|
||||
public static int ChunkLoaders = 20;
|
||||
|
||||
@ConfigProp(info = "The maximum number of images any dialog can hold.")
|
||||
public static int DialogImageLimit = 10;
|
||||
|
||||
@ConfigProp(info = "The maximum number of images any dialog can hold.")
|
||||
public static int SkinOverlayLimit = 10;
|
||||
|
||||
public static File Dir;
|
||||
|
||||
@ConfigProp(info = "Set to false if you want to disable guns")
|
||||
public static boolean GunsEnabled = true;
|
||||
|
||||
@ConfigProp(info = "Enables leaves decay")
|
||||
public static boolean LeavesDecayEnabled = true;
|
||||
|
||||
@ConfigProp(info = "Enables Vine Growth")
|
||||
public static boolean VineGrowthEnabled = true;
|
||||
|
||||
@ConfigProp(info = "Enables Ice Melting")
|
||||
public static boolean IceMeltsEnabled = true;
|
||||
|
||||
@ConfigProp(info = "Normal players can use soulstone on animals")
|
||||
public static boolean SoulStoneAnimals = true;
|
||||
|
||||
@ConfigProp(info = "Normal players can use soulstone on villagers")
|
||||
public static boolean SoulStoneVillagers = false;
|
||||
|
||||
@ConfigProp(info = "Normal players can use soulstone on all npcs")
|
||||
public static boolean SoulStoneNPCs = false;
|
||||
|
||||
@ConfigProp(info = "Normal players can use soulstone on friendly npcs")
|
||||
public static boolean SoulStoneFriendlyNPCs = false;
|
||||
|
||||
@ConfigProp(info="When set to Minecraft it will use minecrafts font, when Default it will use OpenSans. Can only use fonts installed on your PC")
|
||||
public static String FontType = "Default";
|
||||
|
||||
@ConfigProp(info="Font size for custom fonts (doesn't work with minecrafts font)")
|
||||
public static int FontSize = 18;
|
||||
|
||||
@ConfigProp(info = "Enables Overlay Mixins for Conflicts relating to Optifine or other Skin Renderers. If crashes occur, please disable.")
|
||||
public static boolean EntityRendererMixin = true;
|
||||
|
||||
public static FMLEventChannel Channel;
|
||||
public static FMLEventChannel ChannelPlayer;
|
||||
|
||||
public static ConfigLoader Config;
|
||||
|
||||
public static ArrayList<UUID> ScriptDevs = new ArrayList<>();
|
||||
|
||||
public static final MarkovGenerator[] MARKOV_GENERATOR = new MarkovGenerator[10];
|
||||
@@ -209,6 +69,12 @@ public class CustomNpcs {
|
||||
public static boolean DialogCloseIgnore = false;
|
||||
public static boolean TimerIgnore = false;
|
||||
|
||||
public static String configPath;
|
||||
public static String legacyPath;
|
||||
public static boolean legacyExist;
|
||||
|
||||
public static LegacyConfig legacyConfig;
|
||||
|
||||
public CustomNpcs() {
|
||||
instance = this;
|
||||
}
|
||||
@@ -228,99 +94,22 @@ public class CustomNpcs {
|
||||
Dir = new File(dir, "customnpcs");
|
||||
Dir.mkdir();
|
||||
|
||||
Config = new ConfigLoader(this.getClass(), new File(dir, "config"), "CustomNpcs");
|
||||
Config.loadConfig();
|
||||
configPath = ev.getModConfigurationDirectory() + File.separator + "CustomNpcPlus";
|
||||
legacyPath = ev.getModConfigurationDirectory() + "/CustomNpcs.cfg";
|
||||
|
||||
try {
|
||||
ScriptDevs.clear();
|
||||
String[] uuidStrings = ScriptDevIDs.split(",");
|
||||
for (String s : uuidStrings) {
|
||||
ScriptDevs.add(UUID.fromString(s));
|
||||
File configDir = new File(configPath);
|
||||
if(!configDir.exists()){
|
||||
// Convert Legacy Config to New Config if NO Config Folder Exists
|
||||
File legacyFile = new File(legacyPath);
|
||||
if(legacyFile.exists()){
|
||||
System.out.println("Loading Legacy Config");
|
||||
legacyExist = true;
|
||||
legacyConfig = new LegacyConfig();
|
||||
legacyConfig.init();
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
if (NpcNavRange < 16) {
|
||||
NpcNavRange = 16;
|
||||
}
|
||||
if (NpcNavRange > 96) {
|
||||
NpcNavRange = 96;
|
||||
}
|
||||
|
||||
if(NpcSizeLimit < 1)
|
||||
NpcSizeLimit = 1;
|
||||
|
||||
if (DialogImageLimit < 0) {
|
||||
DialogImageLimit = 0;
|
||||
}
|
||||
|
||||
if (SkinOverlayLimit < 0) {
|
||||
SkinOverlayLimit = 0;
|
||||
}
|
||||
|
||||
if (TrackingInfoAlignment < 0)
|
||||
TrackingInfoAlignment = 0;
|
||||
if (TrackingInfoAlignment > 8)
|
||||
TrackingInfoAlignment = 8;
|
||||
|
||||
if (ExpandedScriptLimit < 0)
|
||||
ExpandedScriptLimit = 0;
|
||||
|
||||
if (ScriptFrequency < 5)
|
||||
ScriptFrequency = 5;
|
||||
if (ScriptFrequency > 3000)
|
||||
ScriptFrequency = 3000;
|
||||
|
||||
if (ScriptIgnoreTime < 0)
|
||||
ScriptIgnoreTime = 0;
|
||||
|
||||
try {
|
||||
String[] ignoreTypes = ScriptLogIgnoreType.split(",");
|
||||
for (String s : ignoreTypes) {
|
||||
EnumScriptType type = EnumScriptType.valueOfIgnoreCase(s);
|
||||
if(type != null){
|
||||
switch (type){
|
||||
case INIT:
|
||||
InitIgnore = true;
|
||||
break;
|
||||
case TICK:
|
||||
TickIgnore = true;
|
||||
break;
|
||||
case INTERACT:
|
||||
InteractIgnore = true;
|
||||
break;
|
||||
case DIALOG:
|
||||
DialogIgnore = true;
|
||||
break;
|
||||
case DAMAGED:
|
||||
DamagedIgnore = true;
|
||||
break;
|
||||
case KILLED:
|
||||
KilledIgnore = true;
|
||||
break;
|
||||
case ATTACK:
|
||||
AttackIgnore = true;
|
||||
break;
|
||||
case TARGET:
|
||||
TargetIgnore = true;
|
||||
break;
|
||||
case COLLIDE:
|
||||
CollideIgnore = true;
|
||||
break;
|
||||
case KILLS:
|
||||
KillsIgnore = true;
|
||||
break;
|
||||
case DIALOG_CLOSE:
|
||||
DialogCloseIgnore = true;
|
||||
break;
|
||||
case TIMER:
|
||||
TimerIgnore = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
configPath += File.separator;
|
||||
LoadConfiguration.init(configPath);
|
||||
|
||||
EnchantInterface.load();
|
||||
CustomItems.load();
|
||||
@@ -405,13 +194,15 @@ public class CustomNpcs {
|
||||
new QuestController();
|
||||
new PlayerDataController();
|
||||
new FactionController();
|
||||
new TagController();
|
||||
new TransportController();
|
||||
new GlobalDataController();
|
||||
new SpawnController();
|
||||
new LinkedNpcController();
|
||||
new AnimationController();
|
||||
ScriptController.Instance.loadStoredData();
|
||||
ScriptController.Instance.loadForgeScripts();
|
||||
ScriptController.Instance.loadNPCScripts();
|
||||
ScriptController.Instance.loadGlobalNPCScripts();
|
||||
ScriptController.Instance.loadPlayerScripts();
|
||||
ScriptController.HasStart = false;
|
||||
NpcAPI.clearCache();
|
||||
@@ -420,13 +211,13 @@ public class CustomNpcs {
|
||||
for(String name : names){
|
||||
Block block = (Block) Block.blockRegistry.getObject(name);
|
||||
if(block instanceof BlockLeavesBase){
|
||||
block.setTickRandomly(LeavesDecayEnabled);
|
||||
block.setTickRandomly(ConfigMain.LeavesDecayEnabled);
|
||||
}
|
||||
if(block instanceof BlockVine){
|
||||
block.setTickRandomly(VineGrowthEnabled);
|
||||
block.setTickRandomly(ConfigMain.VineGrowthEnabled);
|
||||
}
|
||||
if(block instanceof BlockIce){
|
||||
block.setTickRandomly(IceMeltsEnabled);
|
||||
block.setTickRandomly(ConfigMain.IceMeltsEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -440,17 +231,22 @@ public class CustomNpcs {
|
||||
QuestController.instance.load();
|
||||
ScriptController.HasStart = true;
|
||||
ServerCloneController.Instance = new ServerCloneController();
|
||||
ServerTagMapController.Instance = new ServerTagMapController();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void stopped(FMLServerStoppedEvent event){
|
||||
ServerCloneController.Instance = null;
|
||||
GlobalDataController.instance.saveData();
|
||||
ScriptController.Instance.saveForgeScripts();
|
||||
ScriptController.Instance.savePlayerScripts();
|
||||
ScriptController.Instance.saveGlobalNpcScripts();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverstart(FMLServerStartingEvent event) {
|
||||
event.registerServerCommand(new CommandNoppes());
|
||||
event.registerServerCommand(new CommandKamkeel());
|
||||
}
|
||||
|
||||
private void registerNpc(Class<? extends Entity> cl, String name) {
|
||||
@@ -508,11 +304,4 @@ public class CustomNpcs {
|
||||
public static MinecraftServer getServer(){
|
||||
return MinecraftServer.getServer();
|
||||
}
|
||||
|
||||
public static boolean isScriptDev(EntityPlayer player) {
|
||||
if(CustomNpcs.ScriptOpsOnly && !MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile()) ||
|
||||
ScriptDevs.contains(player.getUniqueID())){
|
||||
return true;
|
||||
} else return ScriptDevIDs.isEmpty();
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,14 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.CustomNpcsPermissions.Permission;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
|
||||
public class CustomNpcsPermissions{
|
||||
@@ -38,6 +33,7 @@ public class CustomNpcsPermissions{
|
||||
public static final Permission GLOBAL_TRANSPORT = new Permission("customnpcs.global.transport");
|
||||
public static final Permission GLOBAL_RECIPE = new Permission("customnpcs.global.recipe");
|
||||
public static final Permission GLOBAL_NATURALSPAWN = new Permission("customnpcs.global.naturalspawn");
|
||||
public static final Permission GLOBAL_TAG = new Permission("customnpcs.global.tag");
|
||||
|
||||
public static final Permission SPAWNER_MOB = new Permission("customnpcs.spawner.mob");
|
||||
public static final Permission SPAWNER_CREATE = new Permission("customnpcs.spawner.create");
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
@@ -12,6 +9,9 @@ import noppes.npcs.constants.EnumNavType;
|
||||
import noppes.npcs.constants.EnumStandingType;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DataAI {
|
||||
private EntityNPCInterface npc;
|
||||
|
||||
@@ -256,8 +256,8 @@ public class DataAI {
|
||||
return npc.getDistanceSq(pos[0] + 0.5, pos[1], pos[2] + 0.5);
|
||||
}
|
||||
|
||||
public void setWalkingSpeed(int speed){
|
||||
this.moveSpeed = speed;
|
||||
public void setWalkingSpeed(double speed){
|
||||
this.moveSpeed = (int)speed;
|
||||
npc.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(npc.getSpeed());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import noppes.npcs.constants.EnumJobType;
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
import noppes.npcs.controllers.GlobalDataController;
|
||||
@@ -12,21 +11,11 @@ import noppes.npcs.controllers.data.FactionOptions;
|
||||
import noppes.npcs.controllers.data.Line;
|
||||
import noppes.npcs.controllers.data.Lines;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobBard;
|
||||
import noppes.npcs.roles.JobChunkLoader;
|
||||
import noppes.npcs.roles.JobConversation;
|
||||
import noppes.npcs.roles.JobFollower;
|
||||
import noppes.npcs.roles.JobGuard;
|
||||
import noppes.npcs.roles.JobHealer;
|
||||
import noppes.npcs.roles.JobItemGiver;
|
||||
import noppes.npcs.roles.JobPuppet;
|
||||
import noppes.npcs.roles.JobSpawner;
|
||||
import noppes.npcs.roles.RoleBank;
|
||||
import noppes.npcs.roles.RoleCompanion;
|
||||
import noppes.npcs.roles.RoleFollower;
|
||||
import noppes.npcs.roles.RolePostman;
|
||||
import noppes.npcs.roles.RoleTrader;
|
||||
import noppes.npcs.roles.RoleTransporter;
|
||||
import noppes.npcs.roles.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
public class DataAdvanced {
|
||||
|
||||
@@ -46,6 +35,7 @@ public class DataAdvanced {
|
||||
|
||||
private EntityNPCInterface npc;
|
||||
public FactionOptions factions = new FactionOptions();
|
||||
public HashSet<UUID> tagUUIDs = new HashSet<>();
|
||||
|
||||
public EnumRoleType role = EnumRoleType.None;
|
||||
public EnumJobType job = EnumJobType.None;
|
||||
@@ -92,6 +82,14 @@ public class DataAdvanced {
|
||||
compound.setBoolean("RefuseSoulStone", refuseSoulStone);
|
||||
compound.setString("SoulStonePlayerName", soulStonePlayerName);
|
||||
compound.setInteger("MinFactionPointsToSoulStone", minFactionPointsToSoulStone);
|
||||
|
||||
if(tagUUIDs.size() > 0){
|
||||
NBTTagList nbtTagList = new NBTTagList();
|
||||
for (UUID uuid : tagUUIDs) {
|
||||
nbtTagList.appendTag(new NBTTagString(uuid.toString()));
|
||||
}
|
||||
compound.setTag("TagUUIDs", nbtTagList);
|
||||
}
|
||||
|
||||
return compound;
|
||||
}
|
||||
@@ -127,6 +125,13 @@ public class DataAdvanced {
|
||||
refuseSoulStone = compound.getBoolean("RefuseSoulStone");
|
||||
soulStonePlayerName = compound.getString("SoulStonePlayerName");
|
||||
minFactionPointsToSoulStone = compound.getInteger("MinFactionPointsToSoulStone");
|
||||
|
||||
if(compound.hasKey("TagUUIDs")){
|
||||
NBTTagList nbtTagList = compound.getTagList("TagUUIDs",8);
|
||||
for (int i = 0; i < nbtTagList.tagCount(); i++) {
|
||||
tagUUIDs.add(UUID.fromString(nbtTagList.getStringTagAt(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private HashMap<Integer, DialogOption> getDialogs(NBTTagList tagList) {
|
||||
@@ -236,8 +241,6 @@ public class DataAdvanced {
|
||||
npc.jobInterface = new JobConversation(npc);
|
||||
else if (job == EnumJobType.ChunkLoader && !(npc.jobInterface instanceof JobChunkLoader))
|
||||
npc.jobInterface = new JobChunkLoader(npc);
|
||||
else if (job == EnumJobType.Puppet && !(npc.jobInterface instanceof JobPuppet))
|
||||
npc.jobInterface = new JobPuppet(npc);
|
||||
}
|
||||
|
||||
public boolean hasWorldLines() {
|
||||
|
||||
@@ -1,24 +1,26 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.StringUtils;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.entity.data.DataSkinOverlays;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
public class DataDisplay {
|
||||
EntityNPCInterface npc;
|
||||
public EntityNPCInterface npc;
|
||||
|
||||
public String name;
|
||||
public String title = "";
|
||||
@@ -37,6 +39,8 @@ public class DataDisplay {
|
||||
public DataSkinOverlays skinOverlayData;
|
||||
public long overlayRenderTicks = 0;
|
||||
|
||||
public AnimationData animationData;
|
||||
|
||||
public String glowTexture = "";
|
||||
|
||||
public int visible = 0; //0:visible 1:Invisible 2:semi-invisible
|
||||
@@ -61,6 +65,7 @@ public class DataDisplay {
|
||||
markovGeneratorId = new Random().nextInt(CustomNpcs.MARKOV_GENERATOR.length-1);
|
||||
skinOverlayData = new DataSkinOverlays(npc);
|
||||
name = getRandomName();
|
||||
animationData = new AnimationData(this);
|
||||
}
|
||||
|
||||
public String getRandomName() {
|
||||
@@ -80,6 +85,8 @@ public class DataDisplay {
|
||||
|
||||
nbttagcompound = skinOverlayData.writeToNBT(nbttagcompound);
|
||||
|
||||
nbttagcompound = animationData.writeToNBT(nbttagcompound);
|
||||
|
||||
if (this.playerProfile != null)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
@@ -154,9 +161,11 @@ public class DataDisplay {
|
||||
|
||||
skinOverlayData.readFromNBT(nbttagcompound);
|
||||
|
||||
modelSize = ValueUtil.CorrectInt(nbttagcompound.getInteger("Size"), 1, Integer.MAX_VALUE);
|
||||
if(modelSize > CustomNpcs.NpcSizeLimit)
|
||||
modelSize = CustomNpcs.NpcSizeLimit;
|
||||
animationData.readFromNBT(nbttagcompound);
|
||||
|
||||
modelSize = ValueUtil.clamp(nbttagcompound.getInteger("Size"), 1, Integer.MAX_VALUE);
|
||||
if(modelSize > ConfigMain.NpcSizeLimit)
|
||||
modelSize = ConfigMain.NpcSizeLimit;
|
||||
|
||||
modelType = nbttagcompound.getInteger("modelType");
|
||||
|
||||
@@ -244,7 +253,7 @@ public class DataDisplay {
|
||||
public void setMarkovGender(int gender) {
|
||||
if(markovGender == gender)
|
||||
return;
|
||||
this.markovGender = ValueUtil.CorrectInt(gender, 0, 2);
|
||||
this.markovGender = ValueUtil.clamp(gender, 0, 2);
|
||||
}
|
||||
|
||||
public int getMarkovGeneratorId(){
|
||||
@@ -254,7 +263,7 @@ public class DataDisplay {
|
||||
public void setMarkovGeneratorId(int id) {
|
||||
if(markovGeneratorId == id)
|
||||
return;
|
||||
this.markovGeneratorId = ValueUtil.CorrectInt(id, 0, CustomNpcs.MARKOV_GENERATOR.length-1);
|
||||
this.markovGeneratorId = ValueUtil.clamp(id, 0, CustomNpcs.MARKOV_GENERATOR.length-1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -16,6 +13,9 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class DataInventory implements IInventory{
|
||||
public HashMap<Integer,ItemStack> items = new HashMap<Integer,ItemStack>();
|
||||
public HashMap<Integer,Double> dropchance = new HashMap<Integer,Double>();
|
||||
|
||||
@@ -136,10 +136,10 @@ public class DataStats {
|
||||
|
||||
rangedRange = compound.getInteger("MaxFiringRange");
|
||||
fireRate = compound.getInteger("FireRate");
|
||||
minDelay = ValueUtil.CorrectInt(compound.getInteger("minDelay"), 1, 9999);
|
||||
maxDelay = ValueUtil.CorrectInt(compound.getInteger("maxDelay"), 1, 9999);
|
||||
minDelay = ValueUtil.clamp(compound.getInteger("minDelay"), 1, 9999);
|
||||
maxDelay = ValueUtil.clamp(compound.getInteger("maxDelay"), 1, 9999);
|
||||
burstCount = compound.getInteger("BurstCount");
|
||||
shotCount = ValueUtil.CorrectInt(compound.getInteger("ShotCount"), 1, 10);
|
||||
shotCount = ValueUtil.clamp(compound.getInteger("ShotCount"), 1, 10);
|
||||
accuracy = compound.getInteger("Accuracy");
|
||||
|
||||
pDamage = compound.getFloat("pDamage");
|
||||
@@ -178,7 +178,7 @@ public class DataStats {
|
||||
public float getAttackStrength(){
|
||||
return attackStrength;
|
||||
}
|
||||
public void setAttackStrength(float strength){
|
||||
public void setAttackStrength(double strength){
|
||||
attackStrength = (float)(Math.floor(strength));
|
||||
npc.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(attackStrength);
|
||||
}
|
||||
|
||||
@@ -15,33 +15,29 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import noppes.npcs.api.IPos;
|
||||
import noppes.npcs.api.IWorld;
|
||||
import noppes.npcs.controllers.*;
|
||||
import noppes.npcs.controllers.data.*;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.event.*;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.ChatEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.ContainerOpen;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.DamagedEntityEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.KeyPressedEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.LoginEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.LogoutEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.PickUpEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.DropEvent;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.entity.IProjectile;
|
||||
import noppes.npcs.api.gui.ICustomGui;
|
||||
import noppes.npcs.api.handler.data.INaturalSpawn;
|
||||
import noppes.npcs.api.gui.IItemSlot;
|
||||
import noppes.npcs.api.item.IItemCustom;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.client.gui.custom.components.CustomGuiSlot;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.controllers.CustomGuiController;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.*;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.entity.EntityProjectile;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.event.*;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.*;
|
||||
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -124,7 +120,7 @@ public class EventHooks {
|
||||
return;
|
||||
|
||||
noppes.npcs.scripted.event.NpcEvent.InitEvent event = new noppes.npcs.scripted.event.NpcEvent.InitEvent(npc.wrappedNPC);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.INIT, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.INIT, event);
|
||||
npc.script.callScript(EnumScriptType.INIT, event);
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
npc.advanced.soulStoneInit = false;
|
||||
@@ -135,7 +131,7 @@ public class EventHooks {
|
||||
return;
|
||||
|
||||
noppes.npcs.scripted.event.NpcEvent.UpdateEvent event = new noppes.npcs.scripted.event.NpcEvent.UpdateEvent(npc.wrappedNPC);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.TICK, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TICK, event);
|
||||
npc.script.callScript(EnumScriptType.TICK, event);
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
@@ -145,7 +141,7 @@ public class EventHooks {
|
||||
return false;
|
||||
|
||||
NpcEvent.DialogEvent event = new NpcEvent.DialogEvent(npc.wrappedNPC, player, dialogId, optionId, dialog);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.DIALOG, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.DIALOG, event);
|
||||
npc.script.callScript(EnumScriptType.DIALOG, event, "player", event.getPlayer(), "dialog", event.getDialogId(), "option", event.getOptionId(), "dialogObj", event.getDialog());
|
||||
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
@@ -156,7 +152,7 @@ public class EventHooks {
|
||||
return;
|
||||
|
||||
NpcEvent.DialogClosedEvent event = new NpcEvent.DialogClosedEvent(npc.wrappedNPC, player, dialogId, optionId, dialog);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.DIALOG_CLOSE, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.DIALOG_CLOSE, event);
|
||||
npc.script.callScript(EnumScriptType.DIALOG_CLOSE, event, "player", event.getPlayer(), "dialog", event.getDialogId(), "option", event.getOptionId(), "dialogObj", event.getDialog());
|
||||
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
@@ -167,7 +163,7 @@ public class EventHooks {
|
||||
return false;
|
||||
|
||||
NpcEvent.InteractEvent event = new NpcEvent.InteractEvent(npc.wrappedNPC,player);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.INTERACT, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.INTERACT, event);
|
||||
boolean result = npc.script.callScript(EnumScriptType.INTERACT, event, "player", player);
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
return result;
|
||||
@@ -177,7 +173,7 @@ public class EventHooks {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return false;
|
||||
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.ATTACK_MELEE, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.ATTACK_MELEE, event);
|
||||
npc.script.callScript(EnumScriptType.ATTACK, event, "target", event.target);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
@@ -186,7 +182,7 @@ public class EventHooks {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return false;
|
||||
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.RANGED_LAUNCHED, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.RANGED_LAUNCHED, event);
|
||||
npc.script.callScript(EnumScriptType.ATTACK, event, "target", event.target);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
@@ -196,7 +192,7 @@ public class EventHooks {
|
||||
return;
|
||||
|
||||
NpcEvent.KilledEntityEvent event = new NpcEvent.KilledEntityEvent(npc.wrappedNPC,entity);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.KILLS, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.KILLS, event);
|
||||
npc.script.callScript(EnumScriptType.KILLS, event, "target", entity);
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
@@ -205,17 +201,27 @@ public class EventHooks {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return false;
|
||||
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.TARGET, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TARGET, event);
|
||||
npc.script.callScript(EnumScriptType.TARGET, event);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onNPCTargetLost(EntityNPCInterface npc, EntityLivingBase prevtarget, EntityLivingBase newTarget) {
|
||||
if(npc.script.isClient())
|
||||
return false;
|
||||
NpcEvent.TargetLostEvent event = new NpcEvent.TargetLostEvent(npc.wrappedNPC, prevtarget, newTarget);
|
||||
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TARGET_LOST, event);
|
||||
npc.script.callScript(EnumScriptType.TARGET_LOST, event);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
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);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.COLLIDE, event);
|
||||
npc.script.callScript(EnumScriptType.COLLIDE, event, "entity", entity);
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
@@ -224,7 +230,7 @@ public class EventHooks {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return false;
|
||||
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.DAMAGED, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.DAMAGED, event);
|
||||
npc.script.callScript(EnumScriptType.DAMAGED, event);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
@@ -233,7 +239,7 @@ public class EventHooks {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return false;
|
||||
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.KILLED, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.KILLED, event);
|
||||
npc.script.callScript(EnumScriptType.KILLED, event);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
@@ -243,8 +249,29 @@ public class EventHooks {
|
||||
return;
|
||||
|
||||
NpcEvent.TimerEvent event = new NpcEvent.TimerEvent(npc.wrappedNPC, id);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TIMER, event);
|
||||
npc.script.callScript(EnumScriptType.TIMER, event);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.TIMER, event);
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onProjectileTick(EntityProjectile projectile) {
|
||||
ProjectileEvent.UpdateEvent event = new ProjectileEvent.UpdateEvent((IProjectile) NpcAPI.Instance().getIEntity(projectile));
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.PROJECTILE_TICK, event);
|
||||
for(ScriptContainer script : projectile.scripts) {
|
||||
if(script.isValid()) {
|
||||
script.run(EnumScriptType.PROJECTILE_TICK, event);
|
||||
}
|
||||
}
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onProjectileImpact(EntityProjectile projectile, ProjectileEvent.ImpactEvent event) {
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.PROJECTILE_IMPACT, event);
|
||||
for(ScriptContainer script : projectile.scripts) {
|
||||
if(script.isValid()) {
|
||||
script.run(EnumScriptType.PROJECTILE_IMPACT, event);
|
||||
}
|
||||
}
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
@@ -530,13 +557,13 @@ public class EventHooks {
|
||||
CustomGuiController.onButton(event);
|
||||
}
|
||||
|
||||
public static void onCustomGuiSlot(IPlayer player, ICustomGui gui, int slotId) {
|
||||
CustomGuiEvent.SlotEvent event = new CustomGuiEvent.SlotEvent(player, gui, slotId, player.getOpenContainer().getSlot(slotId));
|
||||
public static void onCustomGuiSlot(IPlayer player, ICustomGui gui, int slotId, ItemStack stack, IItemSlot slot) {
|
||||
CustomGuiEvent.SlotEvent event = new CustomGuiEvent.SlotEvent(player, gui, slotId, stack, slot);
|
||||
CustomGuiController.onSlotChange(event);
|
||||
}
|
||||
|
||||
public static boolean onCustomGuiSlotClicked(IPlayer player, ICustomGui gui, int slotId, int dragType, int clickType) {
|
||||
CustomGuiEvent.SlotClickEvent event = new CustomGuiEvent.SlotClickEvent(player, gui, slotId, player.getOpenContainer().getSlot(slotId), dragType, clickType);
|
||||
public static boolean onCustomGuiSlotClicked(IPlayer player, ICustomGui gui, int slotId, IItemSlot slot, int dragType, int clickType) {
|
||||
CustomGuiEvent.SlotClickEvent event = new CustomGuiEvent.SlotClickEvent(player, gui, slotId, slot, player.getOpenContainer().getSlot(slotId), dragType, clickType);
|
||||
return CustomGuiController.onSlotClick(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,15 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import noppes.npcs.config.ConfigDebug;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.io.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.ConsoleHandler;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.logging.Handler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.StreamHandler;
|
||||
import java.util.logging.*;
|
||||
|
||||
public class LogWriter {
|
||||
private final static String name = "CustomNPCs";
|
||||
@@ -170,7 +161,7 @@ public class LogWriter {
|
||||
long secondsSinceFirst = TimeUnit.MILLISECONDS.toSeconds(new Date().getTime() - stamp.makeDate.getTime());
|
||||
long millisecSinceLast = TimeUnit.MILLISECONDS.toMillis(stamp.recentDate.getTime() - stamp.makeDate.getTime());
|
||||
|
||||
double frequency = (float)CustomNpcs.ScriptFrequency / 60;
|
||||
double frequency = (float) ConfigDebug.ScriptFrequency / 60;
|
||||
// Reset Log if 2 Minutes Pass
|
||||
if (secondsSinceFirst > 120) {
|
||||
LogWriter.script(message);
|
||||
@@ -184,7 +175,7 @@ public class LogWriter {
|
||||
stamp.recentDate = new Date();
|
||||
}
|
||||
// IF event occurs to QUICKLY Ignore.
|
||||
else if (millisecSinceLast < CustomNpcs.ScriptIgnoreTime){
|
||||
else if (millisecSinceLast < ConfigDebug.ScriptIgnoreTime){
|
||||
stamp.recentDate = new Date();
|
||||
}
|
||||
else if(secondsSinceFirst > 10 && (double)stamp.counter / secondsSinceFirst > frequency){
|
||||
|
||||
@@ -1,203 +0,0 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.passive.EntityBat;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
public class ModelDataShared{
|
||||
public ModelPartConfig arms = new ModelPartConfig();
|
||||
public ModelPartConfig body = new ModelPartConfig();
|
||||
public ModelPartConfig legs = new ModelPartConfig();
|
||||
public ModelPartConfig head = new ModelPartConfig();
|
||||
|
||||
public ModelPartData legParts = new ModelPartData();
|
||||
|
||||
public Class<? extends EntityLivingBase> entityClass;
|
||||
public EntityLivingBase entity;
|
||||
|
||||
public NBTTagCompound extra = new NBTTagCompound();
|
||||
|
||||
private HashMap<String,ModelPartData> parts = new HashMap<String,ModelPartData>();
|
||||
public byte breasts = 0;
|
||||
|
||||
// Enabled vs Disabled
|
||||
public byte headwear = 2;
|
||||
public byte bodywear = 0;
|
||||
public byte armwear = 0;
|
||||
public byte legwear = 0;
|
||||
|
||||
// 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],
|
||||
public byte hideHead = 0;
|
||||
public byte hideBody = 0;
|
||||
public byte hideArms = 0;
|
||||
public byte hideLegs = 0;
|
||||
|
||||
public NBTTagCompound writeToNBT(){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
|
||||
if(entityClass != null)
|
||||
compound.setString("EntityClass", entityClass.getCanonicalName());
|
||||
|
||||
compound.setTag("ArmsConfig", arms.writeToNBT());
|
||||
compound.setTag("BodyConfig", body.writeToNBT());
|
||||
compound.setTag("LegsConfig", legs.writeToNBT());
|
||||
compound.setTag("HeadConfig", head.writeToNBT());
|
||||
|
||||
compound.setTag("LegParts", legParts.writeToNBT());
|
||||
|
||||
compound.setByte("Headwear", headwear);
|
||||
compound.setByte("Bodywear", bodywear);
|
||||
compound.setByte("Armwear", armwear);
|
||||
compound.setByte("Legwear", legwear);
|
||||
|
||||
compound.setByte("SolidArmwear", solidArmwear);
|
||||
compound.setByte("SolidLegwear", solidLegwear);
|
||||
|
||||
compound.setByte("hideHead", hideHead);
|
||||
compound.setByte("hideBody", hideBody);
|
||||
compound.setByte("hideArms", hideArms);
|
||||
compound.setByte("hideLegs", hideLegs);
|
||||
|
||||
compound.setByte("Breasts", breasts);
|
||||
compound.setTag("ExtraData", extra);
|
||||
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(String name : parts.keySet()){
|
||||
NBTTagCompound item = parts.get(name).writeToNBT();
|
||||
item.setString("PartName", name);
|
||||
list.appendTag(item);
|
||||
}
|
||||
compound.setTag("Parts", list);
|
||||
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
setEntityClass(compound.getString("EntityClass"));
|
||||
|
||||
arms.readFromNBT(compound.getCompoundTag("ArmsConfig"));
|
||||
body.readFromNBT(compound.getCompoundTag("BodyConfig"));
|
||||
legs.readFromNBT(compound.getCompoundTag("LegsConfig"));
|
||||
head.readFromNBT(compound.getCompoundTag("HeadConfig"));
|
||||
|
||||
legParts.readFromNBT(compound.getCompoundTag("LegParts"));
|
||||
|
||||
headwear = compound.getByte("Headwear");
|
||||
bodywear = compound.getByte("Bodywear");
|
||||
armwear = compound.getByte("Armwear");
|
||||
legwear = compound.getByte("Legwear");
|
||||
|
||||
solidArmwear = compound.getByte("SolidArmwear");
|
||||
solidLegwear = compound.getByte("SolidLegwear");
|
||||
|
||||
hideHead = compound.getByte("hideHead");
|
||||
hideBody = compound.getByte("hideBody");
|
||||
hideArms = compound.getByte("hideArms");
|
||||
hideLegs = compound.getByte("hideLegs");
|
||||
|
||||
breasts = compound.getByte("Breasts");
|
||||
extra = compound.getCompoundTag("ExtraData");
|
||||
|
||||
HashMap<String,ModelPartData> parts = new HashMap<String,ModelPartData>();
|
||||
NBTTagList list = compound.getTagList("Parts", 10);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound item = list.getCompoundTagAt(i);
|
||||
ModelPartData part = new ModelPartData();
|
||||
part.readFromNBT(item);
|
||||
parts.put(item.getString("PartName"), part);
|
||||
}
|
||||
this.parts = parts;
|
||||
|
||||
}
|
||||
|
||||
public void readPartsFromNBT(NBTTagCompound compound){
|
||||
legParts.readFromNBT(compound.getCompoundTag("LegParts"));
|
||||
|
||||
HashMap<String,ModelPartData> parts = new HashMap<String,ModelPartData>();
|
||||
NBTTagList list = compound.getTagList("Parts", 10);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound item = list.getCompoundTagAt(i);
|
||||
ModelPartData part = new ModelPartData();
|
||||
part.readFromNBT(item);
|
||||
parts.put(item.getString("PartName"), part);
|
||||
}
|
||||
this.parts = parts;
|
||||
}
|
||||
|
||||
private void setEntityClass(String string) {
|
||||
entityClass = null;
|
||||
entity = null;
|
||||
try {
|
||||
Class<?> cls = Class.forName(string);
|
||||
if (EntityLivingBase.class.isAssignableFrom(cls))
|
||||
entityClass = cls.asSubclass(EntityLivingBase.class);
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setEntityClass(Class<? extends EntityLivingBase> entityClass){
|
||||
this.entityClass = entityClass;
|
||||
entity = null;
|
||||
extra = new NBTTagCompound();
|
||||
if(entityClass == EntityHorse.class)
|
||||
extra.setInteger("Type", -1);
|
||||
}
|
||||
|
||||
public Class<? extends EntityLivingBase> getEntityClass(){
|
||||
return entityClass;
|
||||
}
|
||||
|
||||
public float offsetY() {
|
||||
if(entity == null)
|
||||
return -getBodyY();
|
||||
return entity.height - 1.8f;
|
||||
}
|
||||
|
||||
public void clearEntity() {
|
||||
entity = null;
|
||||
}
|
||||
|
||||
|
||||
public ModelPartData getPartData(String type){
|
||||
return parts.get(type);
|
||||
}
|
||||
|
||||
public void removePart(String type) {
|
||||
parts.remove(type);
|
||||
}
|
||||
|
||||
public ModelPartData getOrCreatePart(String type) {
|
||||
ModelPartData part = parts.get(type);
|
||||
if(part == null)
|
||||
parts.put(type, part = new ModelPartData());
|
||||
return part;
|
||||
}
|
||||
|
||||
public float getBodyY(){
|
||||
if(legParts.type == 3)
|
||||
return (0.9f - body.scaleY) * 0.75f + getLegsY();
|
||||
if(legParts.type == 3)
|
||||
return (0.5f - body.scaleY) * 0.75f + getLegsY();
|
||||
return (1 - body.scaleY) * 0.75f + getLegsY();
|
||||
}
|
||||
|
||||
public float getLegsY() {
|
||||
if(legParts.type == 3)
|
||||
return (0.87f - legs.scaleY) * 1f;
|
||||
return (1 - legs.scaleY) * 0.75f;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -10,6 +8,8 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.data.IScriptHandler;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class NBTTags {
|
||||
|
||||
public static HashMap<Integer, ItemStack> getItemStackList(
|
||||
@@ -144,7 +144,7 @@ public class NBTTags {
|
||||
|
||||
/**
|
||||
* @param tagList
|
||||
* @param arraySize if an int array is not this length a new int array with this length is made
|
||||
* @param arrayLength if an int array is not this length a new int array with this length is made
|
||||
* @return
|
||||
*/
|
||||
public static HashMap<String, int[]> getStringIntegerArrayMap(NBTTagList tagList, int arrayLength) {
|
||||
@@ -476,7 +476,7 @@ public class NBTTags {
|
||||
}
|
||||
}
|
||||
|
||||
public static List<ScriptContainer> GetScript(NBTTagList list, IScriptHandler handler) {
|
||||
public static List<ScriptContainer> GetScriptOld(NBTTagList list, IScriptHandler handler) {
|
||||
ArrayList scripts = new ArrayList();
|
||||
|
||||
for(int i = 0; i < list.tagCount(); ++i) {
|
||||
@@ -489,6 +489,19 @@ public class NBTTags {
|
||||
return scripts;
|
||||
}
|
||||
|
||||
public static List<ScriptContainer> GetScript(NBTTagCompound compound, IScriptHandler handler) {
|
||||
ArrayList<ScriptContainer> scripts = new ArrayList<>();
|
||||
|
||||
for(int i = 0; i < compound.getInteger("TotalScripts"); ++i) {
|
||||
NBTTagCompound containerCompound = compound.getCompoundTag("Tab"+i);
|
||||
ScriptContainer script = new ScriptContainer(handler);
|
||||
script.readFromNBT(containerCompound);
|
||||
scripts.add(script);
|
||||
}
|
||||
|
||||
return scripts;
|
||||
}
|
||||
|
||||
public static NBTTagList NBTScript(List<ScriptContainer> scripts) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
Iterator var2 = scripts.iterator();
|
||||
|
||||
@@ -1,24 +1,22 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.*;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
@@ -29,6 +27,8 @@ import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.event.CustomNPCsEvent;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class NPCSpawning {
|
||||
private static Set<ChunkCoordIntPair> eligibleChunksForSpawning = Sets.newHashSet();
|
||||
|
||||
@@ -78,13 +78,9 @@ public class NPCSpawning {
|
||||
|
||||
x += world.rand.nextInt(b1) - world.rand.nextInt(b1);
|
||||
z += world.rand.nextInt(b1) - world.rand.nextInt(b1);
|
||||
|
||||
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
|
||||
String name = world.getBiomeGenForCoords(x, z).biomeName;
|
||||
SpawnData data = SpawnController.instance.getRandomSpawnData(name, block.getMaterial() == Material.air);
|
||||
SpawnData data = SpawnController.instance.getRandomSpawnData(name, world.provider.dimensionId);
|
||||
if (data == null || !canCreatureTypeSpawnAtLocation(data, world, x, y, z) || world.getClosestPlayer(x, y, z, 24.0D) != null)
|
||||
continue;
|
||||
|
||||
@@ -115,7 +111,7 @@ public class NPCSpawning {
|
||||
public static void performWorldGenSpawning(World world, int x, int z, Random rand){
|
||||
BiomeGenBase biome = world.getBiomeGenForCoords(x + 8, z + 8);
|
||||
while (rand.nextFloat() < biome.getSpawningChance()){
|
||||
SpawnData data = SpawnController.instance.getRandomSpawnData(biome.biomeName, true);
|
||||
SpawnData data = SpawnController.instance.getRandomSpawnData(biome.biomeName, world.provider.dimensionId);
|
||||
if(data == null)
|
||||
continue;
|
||||
|
||||
@@ -153,7 +149,7 @@ public class NPCSpawning {
|
||||
EntityLiving entityliving;
|
||||
|
||||
try{
|
||||
NBTTagCompound[] allCompoundList = new NBTTagCompound[]{data.compound1,data.compound2,data.compound3,data.compound4,data.compound5};
|
||||
NBTTagCompound[] allCompoundList = data.spawnCompounds.values().toArray(new NBTTagCompound[0]);
|
||||
ArrayList<Entity> entities = new ArrayList<>();
|
||||
for (NBTTagCompound compound : allCompoundList) {
|
||||
Entity entity;
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.ClipboardOwner;
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.datatransfer.UnsupportedFlavorException;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.datatransfer.*;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class NoppesStringUtils {
|
||||
|
||||
final static int[] illegalChars = {34, 60, 62, 124, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 58, 42, 63, 92, 47};
|
||||
@@ -43,6 +38,7 @@ public class NoppesStringUtils {
|
||||
|
||||
}
|
||||
text = text.replace("&", Character.toChars(167)[0] + "");
|
||||
text = text.replace("%","%%");
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
@@ -21,10 +15,10 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import noppes.npcs.constants.EnumOptionType;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.EnumPlayerPacket;
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.data.IQuestObjective;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.constants.*;
|
||||
import noppes.npcs.containers.ContainerNPCBankInterface;
|
||||
import noppes.npcs.containers.ContainerNPCFollower;
|
||||
import noppes.npcs.containers.ContainerNPCFollowerHire;
|
||||
@@ -32,14 +26,16 @@ import noppes.npcs.controllers.*;
|
||||
import noppes.npcs.controllers.data.*;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.RoleFollower;
|
||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.ScriptSound;
|
||||
import noppes.npcs.scripted.event.DialogEvent;
|
||||
import noppes.npcs.scripted.event.QuestEvent;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.data.IQuestObjective;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class NoppesUtilPlayer {
|
||||
|
||||
@@ -92,7 +88,7 @@ public class NoppesUtilPlayer {
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
WorldServer wor = server.worldServerForDimension(dimension);
|
||||
if(wor == null){
|
||||
player.addChatMessage(new ChatComponentText("Broken transporter. Dimenion does not exist"));
|
||||
player.addChatMessage(new ChatComponentText("Broken transporter. Dimension does not exist"));
|
||||
return;
|
||||
}
|
||||
player.setLocationAndAngles(posX, posY, posZ, player.rotationYaw, player.rotationPitch);
|
||||
@@ -330,31 +326,33 @@ public class NoppesUtilPlayer {
|
||||
data.setData(player);
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, data.writeNBT());
|
||||
}
|
||||
public static void questCompletion(EntityPlayerMP player, int questId) {
|
||||
public static boolean questCompletion(EntityPlayerMP player, int questId) {
|
||||
if(player == null)
|
||||
return;
|
||||
return false;
|
||||
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
PlayerQuestData questData = playerData.questData;
|
||||
QuestData data = questData.activeQuests.get(questId);
|
||||
|
||||
if(data == null)
|
||||
return;
|
||||
if (data == null)
|
||||
return false;
|
||||
|
||||
if(!data.quest.questInterface.isCompleted(playerData))
|
||||
return;
|
||||
if (!data.quest.questInterface.isCompleted(playerData))
|
||||
return false;
|
||||
|
||||
if (data.quest.completion == EnumQuestCompletion.Instant) {
|
||||
EventHooks.onQuestFinished(player, data.quest);
|
||||
}
|
||||
|
||||
QuestEvent.QuestTurnedInEvent event = new QuestEvent.QuestTurnedInEvent((IPlayer) NpcAPI.Instance().getIEntity(player), data.quest);
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
event.expReward = data.quest.rewardExp;
|
||||
|
||||
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) {
|
||||
if (item != null && item.stackSize > 0) {
|
||||
IItemStack iStack = NpcAPI.Instance().getIItemStack(item);
|
||||
if (iStack != null){
|
||||
list.add(iStack);
|
||||
@@ -369,9 +367,11 @@ public class NoppesUtilPlayer {
|
||||
}
|
||||
|
||||
EventHooks.onQuestTurnedIn(event);
|
||||
if (event.isCancelled())
|
||||
return false;
|
||||
|
||||
IItemStack[] var12 = event.itemRewards;
|
||||
int var14 = var12.length;
|
||||
|
||||
for(int var10 = 0; var10 < var14; ++var10) {
|
||||
IItemStack item = var12[var10];
|
||||
if (item != null) {
|
||||
@@ -382,7 +382,6 @@ public class NoppesUtilPlayer {
|
||||
data.quest.questInterface.handleComplete(player);
|
||||
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.addExperience(data.quest.rewardExp);
|
||||
}
|
||||
data.quest.factionOptions.addPoints(player);
|
||||
@@ -395,7 +394,14 @@ public class NoppesUtilPlayer {
|
||||
}
|
||||
|
||||
PlayerQuestController.setQuestFinished(data.quest, player);
|
||||
if(data.quest.hasNewQuest()) PlayerQuestController.addActiveQuest(data.quest.getNextQuest(), player);
|
||||
if (data.quest.hasNewQuest()) {
|
||||
QuestData nextQuest = new QuestData(data.quest.getNextQuest());
|
||||
nextQuest.sendAlerts = data.quest.id != data.quest.getNextQuest().id || data.sendAlerts;
|
||||
PlayerQuestController.addActiveQuest(nextQuest, player);
|
||||
NoppesUtilPlayer.sendTrackedQuestData(player,nextQuest.quest);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean compareItems(ItemStack item, ItemStack item2, boolean ignoreDamage, boolean ignoreNBT){
|
||||
@@ -501,6 +507,13 @@ public class NoppesUtilPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
public static void playSoundTo(EntityPlayerMP player, ScriptSound sound) {
|
||||
NBTTagCompound compound = sound.writeToNBT();
|
||||
if (sound.sourceEntity == null || player.worldObj.provider.dimensionId == sound.sourceEntity.getDimension()) {
|
||||
Server.sendData(player, EnumPacketClient.PLAY_SOUND_TO_NO_ID, compound);
|
||||
}
|
||||
}
|
||||
|
||||
public static void stopSoundFor(EntityPlayerMP player, int id) {
|
||||
Server.sendData(player, EnumPacketClient.STOP_SOUND_FOR, id);
|
||||
}
|
||||
|
||||
@@ -1,19 +1,7 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import foxz.utils.Utils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
import net.minecraft.command.server.CommandBlockLogic;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
@@ -36,44 +24,29 @@ import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.EnumPlayerData;
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
import noppes.npcs.containers.ContainerManageBanks;
|
||||
import noppes.npcs.containers.ContainerManageRecipes;
|
||||
import noppes.npcs.controllers.data.Bank;
|
||||
import noppes.npcs.controllers.BankController;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.DialogCategory;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
import noppes.npcs.controllers.data.DialogOption;
|
||||
import noppes.npcs.controllers.data.Faction;
|
||||
import noppes.npcs.controllers.FactionController;
|
||||
import noppes.npcs.controllers.data.PlayerBankData;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.data.PlayerDialogData;
|
||||
import noppes.npcs.controllers.data.PlayerFactionData;
|
||||
import noppes.npcs.controllers.PlayerQuestController;
|
||||
import noppes.npcs.controllers.data.PlayerQuestData;
|
||||
import noppes.npcs.controllers.data.PlayerTransportData;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import noppes.npcs.controllers.data.QuestCategory;
|
||||
import noppes.npcs.controllers.QuestController;
|
||||
import noppes.npcs.controllers.data.RecipeCarpentry;
|
||||
import noppes.npcs.controllers.RecipeController;
|
||||
import noppes.npcs.controllers.ServerCloneController;
|
||||
import noppes.npcs.controllers.data.TransportCategory;
|
||||
import noppes.npcs.controllers.TransportController;
|
||||
import noppes.npcs.controllers.data.TransportLocation;
|
||||
import noppes.npcs.controllers.*;
|
||||
import noppes.npcs.controllers.data.*;
|
||||
import noppes.npcs.entity.EntityDialogNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.RoleTransporter;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.ScriptSound;
|
||||
import noppes.npcs.scripted.event.DialogEvent;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
public class NoppesUtilServer {
|
||||
private static HashMap<String,Quest> editingQuests = new HashMap<String,Quest>();
|
||||
@@ -113,6 +86,14 @@ public class NoppesUtilServer {
|
||||
}
|
||||
sendScrollData(player, map);
|
||||
}
|
||||
|
||||
public static void sendTagDataAll(EntityPlayerMP player) {
|
||||
Map<String,Integer> map = new HashMap<String,Integer>();
|
||||
for(Tag tag : TagController.getInstance().tags.values()){
|
||||
map.put(tag.name, tag.id);
|
||||
}
|
||||
sendScrollData(player, map);
|
||||
}
|
||||
|
||||
public static void sendBankDataAll(EntityPlayerMP player) {
|
||||
Map<String,Integer> map = new HashMap<String,Integer>();
|
||||
@@ -199,7 +180,7 @@ public class NoppesUtilServer {
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.DIALOG, npc.getEntityId(), dialog.writeToNBT(new NBTTagCompound()));
|
||||
dia.factionOptions.addPoints(player);
|
||||
if(dialog.hasQuest())
|
||||
PlayerQuestController.addActiveQuest(dialog.getQuest(),player);
|
||||
PlayerQuestController.addActiveQuest(new QuestData(dialog.getQuest()),player);
|
||||
if(!dialog.command.isEmpty()){
|
||||
runCommand(player, npc.getCommandSenderName(), dialog.command);
|
||||
}
|
||||
@@ -333,6 +314,13 @@ public class NoppesUtilServer {
|
||||
}
|
||||
}
|
||||
|
||||
public static void playSound(ScriptSound sound) {
|
||||
List<EntityPlayer> list = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
|
||||
for (EntityPlayer player : list) {
|
||||
NoppesUtilPlayer.playSoundTo((EntityPlayerMP) player, sound);
|
||||
}
|
||||
}
|
||||
|
||||
public static void stopSound(int id) {
|
||||
List<EntityPlayer> list = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
|
||||
for (EntityPlayer player : list) {
|
||||
@@ -393,10 +381,12 @@ public class NoppesUtilServer {
|
||||
Map<String,Integer> map = new HashMap<String,Integer>();
|
||||
|
||||
if(type == EnumPlayerData.Players){
|
||||
File loc = PlayerDataController.instance.getSaveDir();
|
||||
for(String username : PlayerDataController.instance.getUsernameData().keySet()){
|
||||
map.put(username, 0);
|
||||
}
|
||||
for(String username : PlayerDataController.instance.nameUUIDs.keySet()){
|
||||
map.put(username, 0);
|
||||
}
|
||||
for(String username : MinecraftServer.getServer().getConfigurationManager().getAllUsernames()){
|
||||
map.put(username, 0);
|
||||
}
|
||||
}
|
||||
else{
|
||||
PlayerData playerdata = PlayerDataController.instance.getDataFromUsername(name);
|
||||
@@ -483,6 +473,9 @@ public class NoppesUtilServer {
|
||||
playerdata.savePlayerDataOnFile();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
PlayerDataController.instance.nameUUIDs.remove(name);
|
||||
}
|
||||
}
|
||||
if(type == EnumPlayerData.Quest){
|
||||
PlayerQuestData data = playerdata.questData;
|
||||
@@ -672,7 +665,7 @@ public class NoppesUtilServer {
|
||||
}
|
||||
Server.sendData(player, EnumPacketClient.GUI_CLOSE, i, comp);
|
||||
}
|
||||
|
||||
|
||||
public static Entity spawnCloneWithProtection(NBTTagCompound compound, int x, int y,
|
||||
int z, World worldObj) {
|
||||
ServerCloneController.Instance.cleanTags(compound);
|
||||
@@ -716,8 +709,19 @@ public class NoppesUtilServer {
|
||||
if(entity == null){
|
||||
return null;
|
||||
}
|
||||
worldObj.spawnEntityInWorld(entity);
|
||||
return entity;
|
||||
int i = MathHelper.floor_double(entity.posX / 16.0D);
|
||||
int j = MathHelper.floor_double(entity.posZ / 16.0D);
|
||||
if (!entity.forceSpawn && !worldObj.checkChunksExist(
|
||||
(int)entity.posX,(int)entity.posY,(int)entity.posZ,(int)entity.posX,(int)entity.posY,(int)entity.posZ
|
||||
))
|
||||
{
|
||||
return null;
|
||||
} else {
|
||||
worldObj.getChunkFromChunkCoords(i, j).addEntity(entity);
|
||||
worldObj.loadedEntityList.add(entity);
|
||||
worldObj.onEntityAdded(entity);
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isOp(EntityPlayer player) {
|
||||
@@ -784,4 +788,41 @@ public class NoppesUtilServer {
|
||||
public static boolean IsItemStackNull(ItemStack is) {
|
||||
return is == null || is.stackSize == 0 || is.getItem() == null;
|
||||
}
|
||||
|
||||
public static String millisToTime(long millis) {
|
||||
long seconds = millis / 1000;
|
||||
long minutes = seconds / 60;
|
||||
long hours = minutes / 60;
|
||||
long days = hours / 24;
|
||||
long months = days / 30;
|
||||
long years = months / 12;
|
||||
|
||||
months = months % 12;
|
||||
days = days % 30;
|
||||
hours = hours % 24;
|
||||
minutes = minutes % 60;
|
||||
seconds = seconds % 60;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (years > 0) {
|
||||
sb.append(years + " year(s) ");
|
||||
}
|
||||
if (months > 0) {
|
||||
sb.append(months + " month(s) ");
|
||||
}
|
||||
if (days > 0) {
|
||||
sb.append(days + " day(s) ");
|
||||
}
|
||||
if (hours > 0) {
|
||||
sb.append(hours + " hour(s) ");
|
||||
}
|
||||
if (minutes > 0) {
|
||||
sb.append(minutes + " minute(s) ");
|
||||
}
|
||||
if (seconds > 0) {
|
||||
sb.append(seconds + " second(s)");
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class NpcMiscInventory implements IInventory {
|
||||
public HashMap<Integer,ItemStack> items = new HashMap<Integer,ItemStack>();
|
||||
public int stackLimit = 64;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemEditableBook;
|
||||
@@ -18,12 +16,15 @@ import noppes.npcs.blocks.tiles.TileBigSign;
|
||||
import noppes.npcs.blocks.tiles.TileBook;
|
||||
import noppes.npcs.constants.*;
|
||||
import noppes.npcs.containers.ContainerMail;
|
||||
import noppes.npcs.controllers.*;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.PlayerQuestController;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.*;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.RoleCompanion;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class PacketHandlerPlayer{
|
||||
|
||||
@@ -189,9 +190,6 @@ public class PacketHandlerPlayer{
|
||||
else if(type == EnumPlayerPacket.QuestLog){
|
||||
NoppesUtilPlayer.sendQuestLogData(player);
|
||||
}
|
||||
else if(type == EnumPlayerPacket.QuestCompletion){
|
||||
NoppesUtilPlayer.questCompletion(player, buffer.readInt());
|
||||
}
|
||||
else if(type == EnumPlayerPacket.FactionsGet){
|
||||
PlayerFactionData data = PlayerDataController.instance.getPlayerData(player).factionData;
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, data.getPlayerGuiData());
|
||||
@@ -269,7 +267,7 @@ public class PacketHandlerPlayer{
|
||||
if(mail.time == time && mail.sender.equals(username)){
|
||||
mail.beenRead = true;
|
||||
if(mail.hasQuest())
|
||||
PlayerQuestController.addActiveQuest(mail.getQuest(), player);
|
||||
PlayerQuestController.addActiveQuest(new QuestData(mail.getQuest()), player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import foxz.utils.Market;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
@@ -31,13 +27,12 @@ import net.minecraft.village.MerchantRecipeList;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import noppes.npcs.constants.EnumCompanionStage;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.constants.EnumJobType;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.constants.EnumPlayerData;
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.data.ITag;
|
||||
import noppes.npcs.config.ConfigDebug;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.config.ConfigScript;
|
||||
import noppes.npcs.constants.*;
|
||||
import noppes.npcs.containers.ContainerCustomGui;
|
||||
import noppes.npcs.containers.ContainerMail;
|
||||
import noppes.npcs.controllers.*;
|
||||
@@ -49,19 +44,19 @@ import noppes.npcs.roles.JobSpawner;
|
||||
import noppes.npcs.roles.RoleCompanion;
|
||||
import noppes.npcs.roles.RoleTrader;
|
||||
import noppes.npcs.roles.RoleTransporter;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.gui.ScriptGui;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
public class PacketHandlerServer{
|
||||
|
||||
@SubscribeEvent
|
||||
public void onServerPacket(ServerCustomPacketEvent event) {
|
||||
EntityPlayerMP player = ((NetHandlerPlayServer)event.handler).playerEntity;
|
||||
if(CustomNpcs.OpsOnly && !NoppesUtilServer.isOp(player)){
|
||||
if(ConfigMain.OpsOnly && !NoppesUtilServer.isOp(player)){
|
||||
warn(player, "tried to use custom npcs without being an op");
|
||||
return;
|
||||
}
|
||||
@@ -81,10 +76,6 @@ public class PacketHandlerServer{
|
||||
((ContainerCustomGui) player.openContainer).customGui.fromNBT(Server.readNBT(buffer));
|
||||
EventHooks.onCustomGuiButton((IPlayer) 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((IPlayer) 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((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui) player.openContainer).customGui, buffer.readInt());
|
||||
@@ -96,9 +87,29 @@ public class PacketHandlerServer{
|
||||
} else if (type == EnumPacketServer.CustomGuiClose) {
|
||||
EventHooks.onCustomGuiClose((IPlayer) NpcAPI.Instance().getIEntity(player), (new ScriptGui()).fromNBT(Server.readNBT(buffer)));
|
||||
return;
|
||||
} else if (type == EnumPacketServer.UpdateTrackedQuest) {
|
||||
updateTrackedQuest(buffer, player);
|
||||
} else if (type == EnumPacketServer.QuestLogToServer) {
|
||||
updateQuestLogData(buffer, player);
|
||||
return;
|
||||
} else if(type == EnumPacketServer.DimensionsGet){
|
||||
HashMap<String,Integer> map = new HashMap<String,Integer>();
|
||||
for(int id : DimensionManager.getStaticDimensionIDs()){
|
||||
WorldProvider provider = DimensionManager.createProviderFor(id);
|
||||
map.put(provider.getDimensionName(), id);
|
||||
}
|
||||
NoppesUtilServer.sendScrollData(player, map);
|
||||
} else if(type == EnumPacketServer.TagsGet){
|
||||
NoppesUtilServer.sendTagDataAll(player);
|
||||
} else if (type == EnumPacketServer.NpcTagsGet) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
for (UUID uuid : npc.advanced.tagUUIDs) {
|
||||
Tag tag = TagController.getInstance().getTagFromUUID(uuid);
|
||||
if (tag != null) {
|
||||
tagList.appendTag(new NBTTagString(tag.name));
|
||||
}
|
||||
}
|
||||
compound.setTag("TagNames",tagList);
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
}
|
||||
|
||||
if(type.needsNpc && npc == null){
|
||||
@@ -107,7 +118,7 @@ public class PacketHandlerServer{
|
||||
else if(type.hasPermission() && !CustomNpcsPermissions.hasPermission(player, type.permission)){
|
||||
//player doesnt have permission to do this
|
||||
}
|
||||
else if(item == null && (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave || type == EnumPacketServer.ScriptNPCGet || type == EnumPacketServer.ScriptNPCSave || type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave))
|
||||
else if(item == null && (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave || type == EnumPacketServer.ScriptGlobalNPCGet || type == EnumPacketServer.ScriptGlobalNPCSave || type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave))
|
||||
warn(player, "tried to use custom npcs without a tool in hand, probably a hacker");
|
||||
else {
|
||||
if (item != null) {
|
||||
@@ -123,11 +134,13 @@ public class PacketHandlerServer{
|
||||
featherPackets(type, buffer, player);
|
||||
else if (item.getItem() == Item.getItemFromBlock(CustomItems.waypoint) || item.getItem() == Item.getItemFromBlock(CustomItems.border) || item.getItem() == Item.getItemFromBlock(CustomItems.redstoneBlock))
|
||||
blockPackets(type, buffer, player);
|
||||
else if (CustomNpcs.isScriptDev(player)) {
|
||||
if (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave)
|
||||
else if (ConfigScript.isScriptDev(player)) {
|
||||
if (type == EnumPacketServer.EventScriptDataGet || type == EnumPacketServer.EventScriptDataSave)
|
||||
npcEventScriptPackets(type, buffer, player, npc);
|
||||
else if (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave)
|
||||
playerScriptPackets(type, buffer, player);
|
||||
else if (type == EnumPacketServer.ScriptNPCGet || type == EnumPacketServer.ScriptNPCSave)
|
||||
npcScriptPackets(type, buffer, player);
|
||||
else if (type == EnumPacketServer.ScriptGlobalNPCGet || type == EnumPacketServer.ScriptGlobalNPCSave)
|
||||
npcGlobalScriptPackets(type, buffer, player);
|
||||
else if (type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave)
|
||||
forgeScriptPackets(type, buffer, player);
|
||||
else if (type == EnumPacketServer.ScriptItemDataGet || type == EnumPacketServer.ScriptItemDataSave)
|
||||
@@ -144,12 +157,11 @@ public class PacketHandlerServer{
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTrackedQuest(ByteBuf buffer, EntityPlayerMP player) {
|
||||
String trackedQuestString = Server.readString(buffer);
|
||||
if (trackedQuestString != null && trackedQuestString.contains(":")) {
|
||||
String[] splitString = trackedQuestString.split(":");
|
||||
private Quest getQuestFromString(String string) {
|
||||
if (string != null && string.contains(":")) {
|
||||
String[] splitString = string.split(":");
|
||||
if(splitString.length < 2){
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
String categoryName = splitString[0];
|
||||
String questName = splitString[1];
|
||||
@@ -158,16 +170,35 @@ public class PacketHandlerServer{
|
||||
if (category.title.equals(categoryName)) {
|
||||
for (Quest quest : category.quests.values()) {
|
||||
if (quest.title.equals(questName)) {
|
||||
PlayerDataController.instance.getPlayerData(player).questData.trackedQuest = quest;
|
||||
NoppesUtilPlayer.sendTrackedQuestData(player, quest);
|
||||
return;
|
||||
return quest;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
PlayerDataController.instance.getPlayerData(player).questData.trackedQuest = null;
|
||||
private void updateQuestLogData(ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
HashMap<String,String> questAlerts = NBTTags.getStringStringMap(compound.getTagList("Alerts", 10));
|
||||
for (Map.Entry<String,String> entry : questAlerts.entrySet()) {
|
||||
Quest quest = this.getQuestFromString(entry.getKey());
|
||||
if (quest != null) {
|
||||
playerData.questData.activeQuests.get(quest.id).sendAlerts = Boolean.parseBoolean(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
String trackedQuestString = Server.readString(buffer);
|
||||
Quest trackedQuest = this.getQuestFromString(trackedQuestString);
|
||||
if (trackedQuest != null) {
|
||||
playerData.questData.trackedQuest = trackedQuest;
|
||||
NoppesUtilPlayer.sendTrackedQuestData(player, trackedQuest);
|
||||
}
|
||||
|
||||
playerData.questData.trackedQuest = null;
|
||||
Server.sendData(player, EnumPacketClient.OVERLAY_QUEST_TRACKING);
|
||||
}
|
||||
|
||||
@@ -178,18 +209,18 @@ public class PacketHandlerServer{
|
||||
private void getScriptsEnabled(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
||||
if (type == EnumPacketServer.ScriptGlobalGuiDataGet) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setBoolean("ScriptsEnabled", CustomNpcs.ScriptingEnabled);
|
||||
compound.setBoolean("PlayerScriptsEnabled", CustomNpcs.GlobalPlayerScripts);
|
||||
compound.setBoolean("GlobalNPCScriptsEnabled", CustomNpcs.GlobalNPCScripts);
|
||||
compound.setBoolean("ForgeScriptsEnabled", CustomNpcs.GlobalForgeScripts);
|
||||
compound.setBoolean("ScriptsEnabled", ConfigScript.ScriptingEnabled);
|
||||
compound.setBoolean("PlayerScriptsEnabled", ConfigScript.GlobalPlayerScripts);
|
||||
compound.setBoolean("GlobalNPCScriptsEnabled", ConfigScript.GlobalNPCScripts);
|
||||
compound.setBoolean("ForgeScriptsEnabled", ConfigScript.GlobalForgeScripts);
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
}
|
||||
else if (type == EnumPacketServer.ScriptGlobalGuiDataSave) {
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
CustomNpcs.ScriptingEnabled = compound.getBoolean("ScriptsEnabled");
|
||||
CustomNpcs.GlobalPlayerScripts = compound.getBoolean("PlayerScriptsEnabled");
|
||||
CustomNpcs.GlobalNPCScripts = compound.getBoolean("GlobalNPCScriptsEnabled");
|
||||
CustomNpcs.GlobalForgeScripts = compound.getBoolean("ForgeScriptsEnabled");
|
||||
ConfigScript.ScriptingEnabled = compound.getBoolean("ScriptsEnabled");
|
||||
ConfigScript.GlobalPlayerScripts = compound.getBoolean("PlayerScriptsEnabled");
|
||||
ConfigScript.GlobalNPCScripts = compound.getBoolean("GlobalNPCScriptsEnabled");
|
||||
ConfigScript.GlobalForgeScripts = compound.getBoolean("ForgeScriptsEnabled");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +229,7 @@ public class PacketHandlerServer{
|
||||
npc.script.readFromNBT(Server.readNBT(buffer));
|
||||
npc.updateAI = true;
|
||||
npc.script.hasInited = false;
|
||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
LogWriter.script(String.format("[%s] (Player) %s SAVED NPC %s (%s, %s, %s) [%s]", "SCRIPTER", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)(npc).posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName()));
|
||||
}
|
||||
}
|
||||
@@ -209,42 +240,94 @@ public class PacketHandlerServer{
|
||||
}
|
||||
}
|
||||
|
||||
private void getScripts(IScriptHandler data, ByteBuf buffer, EntityPlayerMP player) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setBoolean("ScriptEnabled", data.getEnabled());
|
||||
compound.setString("ScriptLanguage", data.getLanguage());
|
||||
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
|
||||
compound.setTag("ScriptConsole", NBTTags.NBTLongStringMap(data.getConsoleText()));
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
List<ScriptContainer> containers = data.getScripts();
|
||||
for (int i = 0; i < containers.size(); i++) {
|
||||
ScriptContainer container = containers.get(i);
|
||||
NBTTagCompound tabCompound = new NBTTagCompound();
|
||||
tabCompound.setInteger("Tab",i);
|
||||
tabCompound.setTag("Script",container.writeToNBT(new NBTTagCompound()));
|
||||
tabCompound.setInteger("TotalScripts",containers.size());
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, tabCompound);
|
||||
}
|
||||
}
|
||||
|
||||
private void saveScripts(IScriptHandler data, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
||||
int tab = buffer.readInt();
|
||||
int totalScripts = buffer.readInt();
|
||||
if (totalScripts == 0) {
|
||||
data.getScripts().clear();
|
||||
}
|
||||
|
||||
if (tab >= 0) {
|
||||
if (data.getScripts().size() > totalScripts) {
|
||||
data.setScripts(data.getScripts().subList(0,totalScripts));
|
||||
} else while (data.getScripts().size() < totalScripts) {
|
||||
data.getScripts().add(new ScriptContainer(data));
|
||||
}
|
||||
NBTTagCompound tabCompound = Server.readNBT(buffer);
|
||||
data.getScripts().get(tab).readFromNBT(tabCompound);
|
||||
} else {
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
data.setLanguage(compound.getString("ScriptLanguage"));
|
||||
if (!ScriptController.Instance.languages.containsKey(data.getLanguage())) {
|
||||
if (!ScriptController.Instance.languages.isEmpty()) {
|
||||
data.setLanguage((String) ScriptController.Instance.languages.keySet().toArray()[0]);
|
||||
} else {
|
||||
data.setLanguage("ECMAScript");
|
||||
}
|
||||
}
|
||||
data.setEnabled(compound.getBoolean("ScriptEnabled"));
|
||||
}
|
||||
}
|
||||
|
||||
private void npcEventScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player, EntityNPCInterface npc) throws Exception {
|
||||
DataScript data = npc.script;
|
||||
if(type == EnumPacketServer.EventScriptDataGet) {
|
||||
this.getScripts(data,buffer,player);
|
||||
} else if(type == EnumPacketServer.EventScriptDataSave) {
|
||||
this.saveScripts(data,buffer,player);
|
||||
npc.updateAI = true;
|
||||
npc.script.hasInited = false;
|
||||
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
LogWriter.script(String.format("[%s] (Player) %s SAVED NPC %s (%s, %s, %s) [%s]", "SCRIPTER", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)(npc).posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void playerScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
||||
NBTTagCompound compound;
|
||||
PlayerDataScript data = ScriptController.Instance.playerScripts;
|
||||
if(type == EnumPacketServer.ScriptPlayerGet) {
|
||||
PlayerDataScript data = ScriptController.Instance.playerScripts;
|
||||
compound = data.writeToNBT(new NBTTagCompound());
|
||||
compound.setBoolean("ScriptEnabled", ScriptController.Instance.playerScripts.getEnabled());
|
||||
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
this.getScripts(data,buffer,player);
|
||||
} else if(type == EnumPacketServer.ScriptPlayerSave) {
|
||||
ScriptController.Instance.setPlayerScripts(Server.readNBT(buffer));
|
||||
this.saveScripts(data,buffer,player);
|
||||
ScriptController.Instance.lastPlayerUpdate = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
private void forgeScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
||||
NBTTagCompound compound;
|
||||
ForgeDataScript data = ScriptController.Instance.forgeScripts;
|
||||
if (type == EnumPacketServer.ScriptForgeGet) {
|
||||
ForgeDataScript data = ScriptController.Instance.forgeScripts;
|
||||
compound = data.writeToNBT(new NBTTagCompound());
|
||||
compound.setBoolean("ScriptEnabled", ScriptController.Instance.forgeScripts.getEnabled());
|
||||
compound.setTag("Languages", ScriptController.Instance.nbtLanguages());
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, new Object[]{compound});
|
||||
this.getScripts(data,buffer,player);
|
||||
} else if (type == EnumPacketServer.ScriptForgeSave) {
|
||||
ScriptController.Instance.setForgeScripts(Server.readNBT(buffer));
|
||||
this.saveScripts(data,buffer,player);
|
||||
ScriptController.Instance.lastForgeUpdate = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
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.setBoolean("ScriptEnabled", ScriptController.Instance.npcScripts.getEnabled());
|
||||
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 npcGlobalScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
||||
GlobalNPCDataScript data = ScriptController.Instance.globalNpcScripts;
|
||||
if(type == EnumPacketServer.ScriptGlobalNPCGet) {
|
||||
this.getScripts(data,buffer,player);
|
||||
} else if(type == EnumPacketServer.ScriptGlobalNPCSave) {
|
||||
this.saveScripts(data,buffer,player);
|
||||
ScriptController.Instance.lastGlobalNpcUpdate = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,15 +352,7 @@ public class PacketHandlerServer{
|
||||
}
|
||||
|
||||
private void featherPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
||||
if(type == EnumPacketServer.DimensionsGet){
|
||||
HashMap<String,Integer> map = new HashMap<String,Integer>();
|
||||
for(int id : DimensionManager.getStaticDimensionIDs()){
|
||||
WorldProvider provider = DimensionManager.createProviderFor(id);
|
||||
map.put(provider.getDimensionName(), id);
|
||||
}
|
||||
NoppesUtilServer.sendScrollData(player, map);
|
||||
}
|
||||
else if(type == EnumPacketServer.DimensionTeleport){
|
||||
if(type == EnumPacketServer.DimensionTeleport){
|
||||
int dimension = buffer.readInt();
|
||||
WorldServer world = MinecraftServer.getServer().worldServerForDimension(dimension);
|
||||
ChunkCoordinates coords = world.getEntrancePortalLocation();
|
||||
@@ -369,11 +444,17 @@ public class PacketHandlerServer{
|
||||
faction.writeNBT(compound);
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
}
|
||||
else if(type == EnumPacketServer.TagGet){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
Tag tag = TagController.getInstance().get(buffer.readInt());
|
||||
tag.writeNBT(compound);
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
}
|
||||
}
|
||||
|
||||
private void wandPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player, EntityNPCInterface npc) throws IOException{
|
||||
if(type == EnumPacketServer.Delete){
|
||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
LogWriter.script(String.format("[%s] (Player) %s DELETE NPC %s (%s, %s, %s) [%s]", "WAND", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)npc.posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName()));
|
||||
}
|
||||
npc.delete();
|
||||
@@ -411,7 +492,7 @@ public class PacketHandlerServer{
|
||||
npc.reset();
|
||||
if(npc.linkedData != null)
|
||||
LinkedNpcController.Instance.saveNpcData(npc);
|
||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
LogWriter.script(String.format("[%s] (Player) %s CLOSE NPC %s (%s, %s, %s) [%s]", "WAND", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)npc.posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName()));
|
||||
}
|
||||
NoppesUtilServer.setEditingNpc(player, null);
|
||||
@@ -440,7 +521,7 @@ public class PacketHandlerServer{
|
||||
if(entity == null || !(entity instanceof EntityNPCInterface))
|
||||
return;
|
||||
NoppesUtilServer.sendOpenGui(player, EnumGuiType.MainMenuDisplay, (EntityNPCInterface) entity);
|
||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
LogWriter.script(String.format("[%s] (Player) %s OPEN NPC %s (%s, %s, %s) [%s]", "WAND", player.getCommandSenderName(), ((EntityNPCInterface)entity).display.getName(), entity.posX, entity.posY, entity.posZ, entity.worldObj.getWorldInfo().getWorldName()));
|
||||
}
|
||||
}
|
||||
@@ -449,7 +530,7 @@ public class PacketHandlerServer{
|
||||
if(entity == null || !(entity instanceof EntityNPCInterface))
|
||||
return;
|
||||
npc = (EntityNPCInterface) entity;
|
||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
LogWriter.script(String.format("[%s] (Player) %s DELETE NPC %s (%s, %s, %s) [%s]", "WAND", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)npc.posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName()));
|
||||
}
|
||||
npc.delete();
|
||||
@@ -681,6 +762,25 @@ public class PacketHandlerServer{
|
||||
(new Faction()).writeNBT(compound);
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
}
|
||||
else if(type == EnumPacketServer.TagSet){
|
||||
this.setTags(npc,buffer);
|
||||
}
|
||||
else if(type == EnumPacketServer.TagSave){
|
||||
Tag tag = new Tag();
|
||||
tag.readNBT(Server.readNBT(buffer));
|
||||
TagController.getInstance().saveTag(tag);
|
||||
NoppesUtilServer.sendTagDataAll(player);
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
tag.writeNBT(compound);
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
}
|
||||
else if(type == EnumPacketServer.TagRemove){
|
||||
TagController.getInstance().delete(buffer.readInt());
|
||||
NoppesUtilServer.sendTagDataAll(player);
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
(new Tag()).writeNBT(compound);
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
}
|
||||
else if(type == EnumPacketServer.PlayerDataGet){
|
||||
int id = buffer.readInt();
|
||||
if(EnumPlayerData.values().length <= id)
|
||||
@@ -833,6 +933,43 @@ public class PacketHandlerServer{
|
||||
//NoppesUtilServer.sendRoleData(player, npc);
|
||||
}
|
||||
}
|
||||
else if(type == EnumPacketServer.AnimationListGet) {
|
||||
Server.sendData(player, EnumPacketClient.SCROLL_LIST, new ArrayList<>(AnimationController.instance.animations.keySet()));
|
||||
}
|
||||
else if(type == EnumPacketServer.AnimationGet) {
|
||||
String animationName = Server.readString(buffer);
|
||||
Animation animation = (Animation) AnimationController.instance.get(animationName);
|
||||
if (animation != null) {
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, animation.writeToNBT());
|
||||
}
|
||||
}
|
||||
else if (type == EnumPacketServer.AnimationAdd) {
|
||||
String name = "Animation";
|
||||
if (AnimationController.instance.has(name)) {
|
||||
name += "_";
|
||||
int i = 1;
|
||||
while (AnimationController.instance.has(name + i)) {
|
||||
i++;
|
||||
}
|
||||
name += i;
|
||||
}
|
||||
Animation animation = new Animation(name);
|
||||
animation.save();
|
||||
Server.sendData(player, EnumPacketClient.SCROLL_LIST, new ArrayList<>(AnimationController.instance.animations.keySet()));
|
||||
}
|
||||
else if (type == EnumPacketServer.AnimationDelete) {
|
||||
String animationName = Server.readString(buffer);
|
||||
AnimationController.instance.delete(animationName);
|
||||
Server.sendData(player, EnumPacketClient.SCROLL_LIST, new ArrayList<>(AnimationController.instance.animations.keySet()));
|
||||
}
|
||||
else if (type == EnumPacketServer.AnimationSave) {
|
||||
String prevName = Server.readString(buffer);
|
||||
AnimationController.instance.delete(prevName);
|
||||
Animation animation = new Animation();
|
||||
animation.readFromNBT(Server.readNBT(buffer));
|
||||
animation.save();
|
||||
Server.sendData(player, EnumPacketClient.SCROLL_LIST, new ArrayList<>(AnimationController.instance.animations.keySet()));
|
||||
}
|
||||
else
|
||||
blockPackets(type, buffer, player);
|
||||
|
||||
@@ -848,17 +985,22 @@ public class PacketHandlerServer{
|
||||
}
|
||||
else if(type == EnumPacketServer.CloneList){
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
for(String name : ServerCloneController.Instance.getClones(buffer.readInt()))
|
||||
int tab = buffer.readInt();
|
||||
for(String name : ServerCloneController.Instance.getClones(tab))
|
||||
list.appendTag(new NBTTagString(name));
|
||||
|
||||
NBTTagList listDate = new NBTTagList();
|
||||
for(String name : ServerCloneController.Instance.getClonesDate(tab))
|
||||
listDate.appendTag(new NBTTagString(name));
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setTag("List", list);
|
||||
compound.setTag("ListDate", listDate);
|
||||
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
}
|
||||
else
|
||||
warn(player,"tried todo something with the wrong tool, probably a hacker");
|
||||
warn(player,"WE 1 tried todo something with the wrong tool, probably a hacker");
|
||||
}
|
||||
|
||||
private void clonePackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
||||
@@ -879,7 +1021,7 @@ public class PacketHandlerServer{
|
||||
player.addChatMessage(new ChatComponentText("Failed to create an entity out of your clone"));
|
||||
return;
|
||||
}
|
||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
LogWriter.script(String.format("[%s] (Player) %s SPAWNED ENTITY %s", "CLONER", player.getCommandSenderName(), entity));
|
||||
}
|
||||
}
|
||||
@@ -906,7 +1048,10 @@ public class PacketHandlerServer{
|
||||
PlayerData data = PlayerDataController.instance.getPlayerData(player);
|
||||
if(data.cloned == null)
|
||||
return;
|
||||
ServerCloneController.Instance.addClone(data.cloned, Server.readString(buffer), buffer.readInt());
|
||||
String name = Server.readString(buffer);
|
||||
int tab = buffer.readInt();
|
||||
NBTTagCompound tagExtra = Server.readNBT(buffer);
|
||||
ServerCloneController.Instance.addClone(data.cloned, name, tab, tagExtra);
|
||||
}
|
||||
else if(type == EnumPacketServer.CloneRemove){
|
||||
int tab = buffer.readInt();
|
||||
@@ -917,24 +1062,80 @@ public class PacketHandlerServer{
|
||||
for(String name : ServerCloneController.Instance.getClones(tab))
|
||||
list.appendTag(new NBTTagString(name));
|
||||
|
||||
NBTTagList listDate = new NBTTagList();
|
||||
for(String name : ServerCloneController.Instance.getClonesDate(tab))
|
||||
listDate.appendTag(new NBTTagString(name));
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setTag("List", list);
|
||||
compound.setTag("ListDate", listDate);
|
||||
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
}
|
||||
else if(type == EnumPacketServer.CloneList){
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
for(String name : ServerCloneController.Instance.getClones(buffer.readInt()))
|
||||
int tab = buffer.readInt();
|
||||
for(String name : ServerCloneController.Instance.getClones(tab))
|
||||
list.appendTag(new NBTTagString(name));
|
||||
|
||||
NBTTagList listDate = new NBTTagList();
|
||||
for(String name : ServerCloneController.Instance.getClonesDate(tab))
|
||||
listDate.appendTag(new NBTTagString(name));
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setTag("List", list);
|
||||
compound.setTag("ListDate", listDate);
|
||||
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
}
|
||||
else
|
||||
warn(player,"tried todo something with the wrong tool, probably a hacker");
|
||||
else if (type == EnumPacketServer.CloneTagList) {
|
||||
int tab = buffer.readInt();
|
||||
TagMap tagMap = ServerTagMapController.Instance.getTagMap(tab);
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setTag("CloneTags", tagMap.writeNBT());
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
}
|
||||
else if (type == EnumPacketServer.CloneAllTags) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
HashSet<Tag> validTags = TagController.getInstance().getAllTags();
|
||||
NBTTagList validTagList = new NBTTagList();
|
||||
for(Tag tag : validTags){
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
tag.writeNBT(tagCompound);
|
||||
validTagList.appendTag(tagCompound);
|
||||
}
|
||||
compound.setTag("AllTags", validTagList);
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
}
|
||||
else if (type == EnumPacketServer.CloneAllTagsShort) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
HashSet<Tag> validTags = TagController.getInstance().getAllTags();
|
||||
NBTTagList validTagList = new NBTTagList();
|
||||
for(Tag tag : validTags){
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
tag.writeShortNBT(tagCompound);
|
||||
validTagList.appendTag(tagCompound);
|
||||
}
|
||||
compound.setTag("ShortTags", validTagList);
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, compound);
|
||||
}
|
||||
else if (type == EnumPacketServer.TagSet) {
|
||||
EntityNPCInterface npc = NoppesUtilServer.getEditingNpc(player);
|
||||
this.setTags(npc,buffer);
|
||||
}
|
||||
else if (type != EnumPacketServer.NpcTagsGet && type != EnumPacketServer.TagsGet) {
|
||||
warn(player, "WE 2 tried todo something with the wrong tool, probably a hacker");
|
||||
}
|
||||
}
|
||||
|
||||
private void setTags(EntityNPCInterface npc, ByteBuf buffer) throws IOException {
|
||||
npc.advanced.tagUUIDs.removeIf(uuid -> TagController.getInstance().getTagFromUUID(uuid) != null);
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
NBTTagList list = compound.getTagList("TagNames",8);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
String tagName = list.getStringTagAt(i);
|
||||
npc.advanced.tagUUIDs.add(((Tag)TagController.getInstance().getTagFromName(tagName)).uuid);
|
||||
}
|
||||
}
|
||||
|
||||
private void warn(EntityPlayer player, String warning){
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.constants.EnumQuestCompletion;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.PlayerQuestController;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
|
||||
public class QuestLogData {
|
||||
public String trackedQuestKey = "";
|
||||
public HashMap<String,Vector<String>> categories = new HashMap<String,Vector<String>>();
|
||||
public String selectedQuest = "";
|
||||
public String selectedCategory = "";
|
||||
public HashMap<String,String> questText = new HashMap<String,String>();
|
||||
public HashMap<String,String> questAlerts = new HashMap<>();
|
||||
public HashMap<String,Vector<String>> questStatus = new HashMap<String,Vector<String>>();
|
||||
public HashMap<String,String> finish = new HashMap<String,String>();
|
||||
|
||||
@@ -24,6 +25,7 @@ public class QuestLogData {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setTag("Categories", NBTTags.nbtVectorMap(categories));
|
||||
compound.setTag("Logs", NBTTags.nbtStringStringMap(questText));
|
||||
compound.setTag("Alerts", NBTTags.nbtStringStringMap(questAlerts));
|
||||
compound.setTag("Status", NBTTags.nbtVectorMap(questStatus));
|
||||
compound.setTag("QuestFinisher", NBTTags.nbtStringStringMap(finish));
|
||||
compound.setString("TrackedQuestID", trackedQuestKey);
|
||||
@@ -33,6 +35,7 @@ public class QuestLogData {
|
||||
public void readNBT(NBTTagCompound compound){
|
||||
categories = NBTTags.getVectorMap(compound.getTagList("Categories", 10));
|
||||
questText = NBTTags.getStringStringMap(compound.getTagList("Logs", 10));
|
||||
questAlerts = NBTTags.getStringStringMap(compound.getTagList("Alerts", 10));
|
||||
questStatus = NBTTags.getVectorMap(compound.getTagList("Status", 10));
|
||||
finish = NBTTags.getStringStringMap(compound.getTagList("QuestFinisher", 10));
|
||||
trackedQuestKey = compound.getString("TrackedQuestID");
|
||||
@@ -49,7 +52,7 @@ public class QuestLogData {
|
||||
list.add(quest.title);
|
||||
|
||||
questText.put(category + ":" + quest.title, quest.logText);
|
||||
|
||||
questAlerts.put(category + ":" + quest.title, String.valueOf(playerData.questData.activeQuests.get(quest.id).sendAlerts));
|
||||
questStatus.put(category + ":" + quest.title, quest.questInterface.getQuestLogStatus(player));
|
||||
if(quest.completion == EnumQuestCompletion.Npc && quest.questInterface.isCompleted(playerData))
|
||||
finish.put(category + ":" + quest.title, quest.completerNpc);
|
||||
@@ -70,6 +73,14 @@ public class QuestLogData {
|
||||
return questText.get(selectedCategory + ":" + selectedQuest);
|
||||
}
|
||||
|
||||
public Boolean getQuestAlerts() {
|
||||
return Boolean.valueOf(questAlerts.get(selectedCategory+":"+selectedQuest));
|
||||
}
|
||||
|
||||
public void toggleQuestAlerts() {
|
||||
questAlerts.put(selectedCategory+":"+selectedQuest,String.valueOf(!getQuestAlerts()));
|
||||
}
|
||||
|
||||
public Vector<String> getQuestStatus() {
|
||||
return questStatus.get(selectedCategory + ":" + selectedQuest);
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@ import net.minecraftforge.event.entity.item.ItemTossEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.event.entity.player.EntityInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerUseItemEvent;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.items.ItemScripted;
|
||||
import noppes.npcs.scripted.event.ItemEvent;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.item.IItemCustom;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.items.ItemScripted;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.event.ItemEvent;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.ContainerPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
@@ -22,15 +23,17 @@ import net.minecraftforge.event.entity.PlaySoundAtEntityEvent;
|
||||
import net.minecraftforge.event.entity.item.ItemTossEvent;
|
||||
import net.minecraftforge.event.entity.living.*;
|
||||
import net.minecraftforge.event.entity.player.*;
|
||||
import net.minecraftforge.event.world.*;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.controllers.*;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||
|
||||
public class ScriptPlayerEventHandler {
|
||||
public ScriptPlayerEventHandler() {
|
||||
@@ -47,6 +50,14 @@ public class ScriptPlayerEventHandler {
|
||||
PlayerDataScript handler = ScriptController.Instance.playerScripts;
|
||||
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(player);
|
||||
EventHooks.onPlayerTick(handler, scriptPlayer);
|
||||
|
||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++){
|
||||
ItemStack item = player.inventory.getStackInSlot(i);
|
||||
if(item != null && item.getItem() == CustomItems.scripted_item){
|
||||
ScriptCustomItem isw = (ScriptCustomItem) NpcAPI.Instance().getIItemStack(item);
|
||||
EventHooks.onScriptItemUpdate(isw, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (PlayerDataController.instance != null) {
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
@@ -18,9 +13,10 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.village.MerchantRecipeList;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Server {
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -34,11 +30,15 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
|
||||
import noppes.npcs.blocks.tiles.TileBanner;
|
||||
import noppes.npcs.config.ConfigDebug;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.EnumQuestType;
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
import noppes.npcs.controllers.*;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.RecipeController;
|
||||
import noppes.npcs.controllers.ServerCloneController;
|
||||
import noppes.npcs.controllers.data.*;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.items.ItemExcalibur;
|
||||
@@ -48,6 +48,10 @@ import noppes.npcs.quests.QuestItem;
|
||||
import noppes.npcs.quests.QuestKill;
|
||||
import noppes.npcs.roles.RoleFollower;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class ServerEventsHandler {
|
||||
|
||||
public static EntityVillager Merchant;
|
||||
@@ -61,13 +65,13 @@ public class ServerEventsHandler {
|
||||
boolean isRemote = event.entityPlayer.worldObj.isRemote;
|
||||
boolean npcInteracted = event.target instanceof EntityNPCInterface;
|
||||
|
||||
if(!isRemote && CustomNpcs.OpsOnly && !MinecraftServer.getServer().getConfigurationManager().func_152596_g(event.entityPlayer.getGameProfile())){
|
||||
if(!isRemote && ConfigMain.OpsOnly && !MinecraftServer.getServer().getConfigurationManager().func_152596_g(event.entityPlayer.getGameProfile())){
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isRemote && item.getItem() == CustomItems.soulstoneEmpty && event.target instanceof EntityLivingBase) {
|
||||
((ItemSoulstoneEmpty)item.getItem()).store((EntityLivingBase)event.target, item, event.entityPlayer);
|
||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
LogWriter.script(String.format("[%s] (Player) %s PICKED ENTITY %s", "SOULSTONE", event.entityPlayer.getCommandSenderName(), event.target));
|
||||
}
|
||||
}
|
||||
@@ -78,7 +82,7 @@ public class ServerEventsHandler {
|
||||
}
|
||||
event.setCanceled(true);
|
||||
NoppesUtilServer.sendOpenGui(event.entityPlayer, EnumGuiType.MainMenuDisplay, (EntityNPCInterface) event.target);
|
||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
LogWriter.script(String.format("[%s] (Player) %s OPEN NPC %s (%s, %s, %s) [%s]", "WAND", event.entityPlayer.getCommandSenderName(), ((EntityNPCInterface)(event.target)).display.getName(), (int)(event.target).posX, (int)(event.target).posY, (int)(event.target).posZ, (event.target).worldObj.getWorldInfo().getWorldName()));
|
||||
}
|
||||
}
|
||||
@@ -91,6 +95,9 @@ public class ServerEventsHandler {
|
||||
if(!Server.sendData((EntityPlayerMP)event.entityPlayer, EnumPacketClient.CLONE, compound))
|
||||
event.entityPlayer.addChatMessage(new ChatComponentText("Entity too big to clone"));
|
||||
data.cloned = compound;
|
||||
if (event.target instanceof EntityNPCInterface) {
|
||||
NoppesUtilServer.setEditingNpc(event.entityPlayer, (EntityNPCInterface) event.target);
|
||||
}
|
||||
event.setCanceled(true);
|
||||
}
|
||||
else if(item.getItem() == CustomItems.scripter && !isRemote && npcInteracted){
|
||||
@@ -99,7 +106,7 @@ public class ServerEventsHandler {
|
||||
NoppesUtilServer.setEditingNpc(event.entityPlayer, (EntityNPCInterface)event.target);
|
||||
event.setCanceled(true);
|
||||
Server.sendData((EntityPlayerMP)event.entityPlayer, EnumPacketClient.GUI, EnumGuiType.Script.ordinal());
|
||||
if(CustomNpcs.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
LogWriter.script(String.format("[%s] (Player) %s OPEN NPC %s (%s, %s, %s) [%s]", "SCRIPTER", event.entityPlayer.getCommandSenderName(), ((EntityNPCInterface)(event.target)).display.getName(), (int)(event.target).posX, (int)(event.target).posY, (int)(event.target).posZ, (event.target).worldObj.getWorldInfo().getWorldName()));
|
||||
}
|
||||
}
|
||||
@@ -288,48 +295,54 @@ public class ServerEventsHandler {
|
||||
private void doQuest(EntityPlayer player, EntityLivingBase entity, boolean all) {
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
PlayerQuestData questData = playerData.questData;
|
||||
boolean change = false;
|
||||
boolean checkCompletion = false;
|
||||
String entityName = EntityList.getEntityString(entity);
|
||||
|
||||
ArrayList<QuestData> activeQuestValues = new ArrayList<>(questData.activeQuests.values());
|
||||
for(QuestData data : activeQuestValues){
|
||||
if(data.quest.type != EnumQuestType.Kill && data.quest.type != EnumQuestType.AreaKill)
|
||||
if (data.quest.type != EnumQuestType.Kill && data.quest.type != EnumQuestType.AreaKill)
|
||||
continue;
|
||||
if(data.quest.type == EnumQuestType.AreaKill && all){
|
||||
List<EntityPlayer> list = player.worldObj.getEntitiesWithinAABB(EntityPlayer.class, entity.boundingBox.expand(10, 10, 10));
|
||||
for(EntityPlayer pl : list)
|
||||
if(pl != player)
|
||||
doQuest(pl, entity, false);
|
||||
|
||||
if (data.quest.type == EnumQuestType.AreaKill && all) {
|
||||
List<EntityPlayer> list = player.worldObj.getEntitiesWithinAABB(EntityPlayer.class, entity.boundingBox.expand(10, 10, 10));
|
||||
for (EntityPlayer pl : list) {
|
||||
if (pl != player) {
|
||||
doQuest(pl, entity, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
String name = entityName;
|
||||
QuestKill quest = (QuestKill) data.quest.questInterface;
|
||||
|
||||
Class entityType = EntityNPCInterface.class;
|
||||
if(quest.targetType == 2) {
|
||||
if (quest.targetType == 2) {
|
||||
try {
|
||||
entityType = Class.forName(quest.customTargetType);
|
||||
} catch (ClassNotFoundException notFoundException) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(quest.targetType > 0 && !(entityType.isInstance(entity)))
|
||||
|
||||
if (quest.targetType > 0 && !(entityType.isInstance(entity)))
|
||||
continue;
|
||||
if(quest.targets.containsKey(entity.getCommandSenderName()))
|
||||
|
||||
if (quest.targets.containsKey(entity.getCommandSenderName()))
|
||||
name = entity.getCommandSenderName();
|
||||
else if(!quest.targets.containsKey(name))
|
||||
else if (!quest.targets.containsKey(name))
|
||||
continue;
|
||||
|
||||
checkCompletion = true;
|
||||
|
||||
HashMap<String, Integer> killed = quest.getKilled(data);
|
||||
if(killed.containsKey(name) && killed.get(name) >= quest.targets.get(name))
|
||||
continue;
|
||||
int amount = 0;
|
||||
if(killed.containsKey(name))
|
||||
amount = killed.get(name);
|
||||
killed.put(name, amount + 1);
|
||||
if (!killed.containsKey(name)) {
|
||||
killed.put(name, 1);
|
||||
} else if(killed.get(name) < quest.targets.get(name)) {
|
||||
int amount = killed.get(name);
|
||||
killed.put(name, amount + 1);
|
||||
}
|
||||
quest.setKilled(data, killed);
|
||||
change = true;
|
||||
}
|
||||
if(!change)
|
||||
if(!checkCompletion)
|
||||
return;
|
||||
|
||||
questData.checkQuestCompletion(playerData,EnumQuestType.Kill);
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.client.AnalyticsTracking;
|
||||
import noppes.npcs.controllers.SpawnController;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.client.AnalyticsTracking;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
public class ServerTickHandler {
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import net.minecraft.util.IChatComponent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.IChatComponent;
|
||||
|
||||
public class TextBlock {
|
||||
public List<IChatComponent> lines = new ArrayList<IChatComponent>();
|
||||
}
|
||||
@@ -1,20 +1,19 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.controllers.data.Line;
|
||||
import noppes.npcs.controllers.data.Lines;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import org.lwjgl.Sys;
|
||||
import noppes.npcs.entity.data.ModelRotate;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class VersionCompatibility {
|
||||
public static int ModRev = 19;
|
||||
public static int ModRev = 21;
|
||||
|
||||
public static void CheckNpcCompatibility(EntityNPCInterface npc, NBTTagCompound compound){
|
||||
if(npc.npcVersion == ModRev)
|
||||
@@ -115,21 +114,67 @@ public class VersionCompatibility {
|
||||
public static void CheckModelCompatibility(EntityNPCInterface npc, NBTTagCompound compound){
|
||||
if(npc.npcVersion == ModRev)
|
||||
return;
|
||||
if(npc.npcVersion < 19) {
|
||||
NBTTagCompound partData = compound.getCompoundTag("NpcModelData");
|
||||
NBTTagCompound modelData = compound.getCompoundTag("NpcModelData");
|
||||
if(npc.npcVersion < 20){
|
||||
// Convert Puppet Job
|
||||
if (compound.hasKey("NpcJob")) {
|
||||
if(compound.getInteger("NpcJob") == 9){
|
||||
// Remove Job
|
||||
compound.setInteger("NpcJob", 0);
|
||||
|
||||
// Get Puppet Data
|
||||
boolean moving = compound.getBoolean("PuppetMoving");
|
||||
boolean attacking = compound.getBoolean("PuppetAttacking");
|
||||
boolean standing = compound.getBoolean("PuppetStanding");
|
||||
NBTTagCompound head = compound.getCompoundTag("PuppetHead");
|
||||
NBTTagCompound body = compound.getCompoundTag("PuppetBody");
|
||||
NBTTagCompound larm = compound.getCompoundTag("PuppetLArm");
|
||||
NBTTagCompound rarm = compound.getCompoundTag("PuppetRArm");
|
||||
NBTTagCompound lleg = compound.getCompoundTag("PuppetLLeg");
|
||||
NBTTagCompound rleg = compound.getCompoundTag("PuppetRLeg");
|
||||
|
||||
// Enable Rotations
|
||||
modelData.setBoolean("EnableRotation", true);
|
||||
// Make New Rotation and Write It
|
||||
ModelRotate newRotation = new ModelRotate();
|
||||
newRotation.whileMoving = moving;
|
||||
newRotation.whileAttacking = attacking;
|
||||
newRotation.whileStanding = standing;
|
||||
NBTTagCompound rotation = newRotation.writeToNBT();
|
||||
rotation.setTag("PuppetHead", head);
|
||||
rotation.setTag("PuppetBody", body);
|
||||
rotation.setTag("PuppetLArm", larm);
|
||||
rotation.setTag("PuppetRArm", rarm);
|
||||
rotation.setTag("PuppetLLeg", lleg);
|
||||
rotation.setTag("PuppetRLeg", rleg);
|
||||
modelData.setTag("ModelRotation", rotation);
|
||||
|
||||
// Remove All Old Tags
|
||||
compound.removeTag("PuppetMoving");
|
||||
compound.removeTag("PuppetAttacking");
|
||||
compound.removeTag("PuppetStanding");
|
||||
compound.removeTag("PuppetHead");
|
||||
compound.removeTag("PuppetBody");
|
||||
compound.removeTag("PuppetLArm");
|
||||
compound.removeTag("PuppetRArm");
|
||||
compound.removeTag("PuppetLLeg");
|
||||
compound.removeTag("PuppetRLeg");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(npc.npcVersion < 19) {
|
||||
// Fix Leg MPM Dependency
|
||||
if(partData.hasKey("LegParts")){
|
||||
NBTTagCompound legParts = partData.getCompoundTag("LegParts");
|
||||
if(modelData.hasKey("LegParts")){
|
||||
NBTTagCompound legParts = modelData.getCompoundTag("LegParts");
|
||||
if(legParts.hasKey("Texture")){
|
||||
legParts.setString("Texture", legParts.getString("Texture").replace("moreplayermodels:textures", "customnpcs:textures/parts"));
|
||||
}
|
||||
partData.setTag("LegParts", legParts);
|
||||
modelData.setTag("LegParts", legParts);
|
||||
}
|
||||
|
||||
// Fix Part MPM Dependency
|
||||
if(partData.hasKey("Parts")){
|
||||
NBTTagList list = partData.getTagList("Parts", 10);
|
||||
if(modelData.hasKey("Parts")){
|
||||
NBTTagList list = modelData.getTagList("Parts", 10);
|
||||
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound item = list.getCompoundTagAt(i);
|
||||
@@ -139,10 +184,10 @@ public class VersionCompatibility {
|
||||
}
|
||||
list.func_150304_a(i, item);
|
||||
}
|
||||
partData.setTag("Parts", list);
|
||||
modelData.setTag("Parts", list);
|
||||
}
|
||||
compound.setTag("NpcModelData", partData);
|
||||
}
|
||||
compound.setTag("NpcModelData", modelData);
|
||||
}
|
||||
|
||||
public static void CheckAvailabilityCompatibility(ICompatibilty compatibilty, NBTTagCompound compound){
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package noppes.npcs.ai;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.pathfinding.PathEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
@@ -13,6 +9,8 @@ import net.minecraft.world.World;
|
||||
import noppes.npcs.constants.AiMutex;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class EntityAIAmbushTarget extends EntityAIBase
|
||||
{
|
||||
private EntityNPCInterface theEntity;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package noppes.npcs.ai;
|
||||
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import noppes.npcs.constants.AiMutex;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.constants.EnumMovingType;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.pathfinding.PathEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.AiMutex;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class EntityAIAttackTarget extends EntityAIBase
|
||||
this.entityTarget = entitylivingbase;
|
||||
this.attacker.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(((EntityNPCInterface) this.attacker).stats.aggroRange);
|
||||
this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase);
|
||||
this.attacker.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(CustomNpcs.NpcNavRange);
|
||||
this.attacker.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(ConfigMain.NpcNavRange);
|
||||
return this.entityPathEntity != null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
package noppes.npcs.ai;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.ai.RandomPositionGenerator;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.pathfinding.PathEntity;
|
||||
import net.minecraft.pathfinding.PathNavigate;
|
||||
@@ -14,6 +11,8 @@ import noppes.npcs.constants.AiMutex;
|
||||
import noppes.npcs.constants.EnumNavType;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EntityAIAvoidTarget extends EntityAIBase
|
||||
{
|
||||
/** The entity we are attached to */
|
||||
|
||||
@@ -2,7 +2,6 @@ package noppes.npcs.ai;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.ai.RandomPositionGenerator;
|
||||
import net.minecraft.util.Vec3;
|
||||
import noppes.npcs.constants.AiMutex;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package noppes.npcs.ai;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.util.MathHelper;
|
||||
@@ -9,6 +7,8 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.constants.AiMutex;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class EntityAIFindShade extends EntityAIBase
|
||||
{
|
||||
private EntityCreature theCreature;
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
package noppes.npcs.ai;
|
||||
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.ai.RandomPositionGenerator;
|
||||
import net.minecraft.pathfinding.PathEntity;
|
||||
import net.minecraft.pathfinding.PathPoint;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.constants.AiMutex;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package noppes.npcs.ai;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -9,6 +7,8 @@ import noppes.npcs.constants.AiMutex;
|
||||
import noppes.npcs.constants.EnumStandingType;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public class EntityAILook extends EntityAIBase{
|
||||
private final EntityNPCInterface npc;
|
||||
private int idle = 0;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package noppes.npcs.ai;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.util.MathHelper;
|
||||
@@ -9,6 +7,8 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.constants.AiMutex;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class EntityAIMoveIndoors extends EntityAIBase
|
||||
{
|
||||
private EntityCreature theCreature;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package noppes.npcs.ai;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import noppes.npcs.constants.AiMutex;
|
||||
import noppes.npcs.constants.EnumMovingType;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EntityAIMovingPath extends EntityAIBase
|
||||
{
|
||||
private EntityNPCInterface npc;
|
||||
|
||||
@@ -1,23 +1,13 @@
|
||||
package noppes.npcs.ai;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.monster.EntityPigZombie;
|
||||
import net.minecraft.entity.monster.EntityZombie;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.pathfinding.PathEntity;
|
||||
import net.minecraft.pathfinding.PathPoint;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import noppes.npcs.constants.AiMutex;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class EntityAIOrbitTarget extends EntityAIBase
|
||||
{
|
||||
private EntityNPCInterface theEntity;
|
||||
|
||||
@@ -2,7 +2,6 @@ package noppes.npcs.ai;
|
||||
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.ai.RandomPositionGenerator;
|
||||
import net.minecraft.util.Vec3;
|
||||
import noppes.npcs.constants.AiMutex;
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.IRangedAttackMob;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import noppes.npcs.constants.AiMutex;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.constants.EnumNavType;
|
||||
|
||||
@@ -2,7 +2,7 @@ package noppes.npcs.ai;
|
||||
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.util.Vec3;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumMovingType;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class EntityAIReturn extends EntityAIBase
|
||||
return false;
|
||||
}
|
||||
|
||||
if(npc.ai.movingType == EnumMovingType.MovingPath && npc.ai.getDistanceSqToPathPoint() < CustomNpcs.NpcNavRange * CustomNpcs.NpcNavRange)
|
||||
if(npc.ai.movingType == EnumMovingType.MovingPath && npc.ai.getDistanceSqToPathPoint() < ConfigMain.NpcNavRange * ConfigMain.NpcNavRange)
|
||||
return false;
|
||||
|
||||
if (npc.getNavigator().noPath() || (!npc.isAttacking() && wasAttacked)) {
|
||||
@@ -129,10 +129,10 @@ public class EntityAIReturn extends EntityAIBase
|
||||
double posY = endPosY;
|
||||
double posZ = endPosZ;
|
||||
double range = npc.getDistance(posX, posY, posZ);
|
||||
if(range > CustomNpcs.NpcNavRange || towards){
|
||||
if(range > ConfigMain.NpcNavRange || towards){
|
||||
int distance = (int) range;
|
||||
if(distance > CustomNpcs.NpcNavRange)
|
||||
distance = CustomNpcs.NpcNavRange / 2;
|
||||
if(distance > ConfigMain.NpcNavRange)
|
||||
distance = ConfigMain.NpcNavRange / 2;
|
||||
else
|
||||
distance /= 2;
|
||||
if(distance > 2){
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
package noppes.npcs.ai;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.constants.AiMutex;
|
||||
import noppes.npcs.constants.EnumNavType;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class EntityAIStalkTarget extends EntityAIBase
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
package noppes.npcs.ai;
|
||||
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.constants.AiMutex;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class EntityAITransform extends EntityAIBase {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package noppes.npcs.ai;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.IEntitySelector;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.ai.selector.NPCInteractSelector;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.AiMutex;
|
||||
import noppes.npcs.controllers.data.Line;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class EntityAIWander extends EntityAIBase
|
||||
{
|
||||
private EntityNPCInterface entity;
|
||||
@@ -84,12 +84,12 @@ public class EntityAIWander extends EntityAIBase
|
||||
if(entity.ai.walkingRange > 0){
|
||||
double distance = this.entity.getDistanceSq(this.entity.getStartXPos(), this.entity.getStartYPos(), this.entity.getStartZPos());
|
||||
int range = (int) MathHelper.sqrt_double(this.entity.ai.walkingRange * this.entity.ai.walkingRange - distance);
|
||||
if(range > CustomNpcs.NpcNavRange)
|
||||
range = CustomNpcs.NpcNavRange;
|
||||
if(range > ConfigMain.NpcNavRange)
|
||||
range = ConfigMain.NpcNavRange;
|
||||
if(range < 3){
|
||||
range = this.entity.ai.walkingRange;
|
||||
if(range > CustomNpcs.NpcNavRange)
|
||||
range = CustomNpcs.NpcNavRange;
|
||||
if(range > ConfigMain.NpcNavRange)
|
||||
range = ConfigMain.NpcNavRange;
|
||||
Vec3 start = Vec3.createVectorHelper(this.entity.getStartXPos(), this.entity.getStartYPos(), this.entity.getStartZPos());
|
||||
return RandomPositionGeneratorAlt.findRandomTargetBlockTowards(this.entity, range / 2, range / 2 > 7?7:range / 2, start);
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public class EntityAIWander extends EntityAIBase
|
||||
return RandomPositionGeneratorAlt.findRandomTarget(this.entity, range, range / 2 > 7?7:range / 2);
|
||||
}
|
||||
}
|
||||
return RandomPositionGeneratorAlt.findRandomTarget(this.entity, CustomNpcs.NpcNavRange, 7);
|
||||
return RandomPositionGeneratorAlt.findRandomTarget(this.entity, ConfigMain.NpcNavRange, 7);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,7 +3,6 @@ package noppes.npcs.ai;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.ai.RandomPositionGenerator;
|
||||
import net.minecraft.pathfinding.PathEntity;
|
||||
import net.minecraft.pathfinding.PathPoint;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package noppes.npcs.ai;
|
||||
|
||||
import java.util.Random;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class RandomPositionGeneratorAlt
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -8,7 +8,6 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.pathfinding.PathFinder;
|
||||
import net.minecraft.pathfinding.PathPoint;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.IntHashMap;
|
||||
@@ -16,7 +15,6 @@ import net.minecraft.world.IBlockAccess;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -2,7 +2,6 @@ package noppes.npcs.ai.pathfinder;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.EntityMoveHelper;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import noppes.npcs.entity.EntityNPCFlying;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -2,7 +2,6 @@ package noppes.npcs.ai.pathfinder;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.pathfinding.PathEntity;
|
||||
import net.minecraft.pathfinding.PathPoint;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class NPCPath extends PathEntity{
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class PathNavigateFlying extends PathNavigate {
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package noppes.npcs.ai.selector;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.IEntitySelector;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.potion.Potion;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.constants.EnumCompanionJobs;
|
||||
import noppes.npcs.constants.EnumJobType;
|
||||
import noppes.npcs.constants.EnumMovingType;
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
package noppes.npcs.ai.target;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.IEntitySelector;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
|
||||
import net.minecraft.entity.ai.EntityAITarget;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class EntityAIClearTarget extends EntityAITarget
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package noppes.npcs.ai.target;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.IEntitySelector;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -11,9 +8,12 @@ import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
|
||||
import net.minecraft.entity.ai.EntityAITarget;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class EntityAIClosestTarget extends EntityAITarget
|
||||
{
|
||||
private final Class targetClass;
|
||||
@@ -59,7 +59,7 @@ public class EntityAIClosestTarget extends EntityAITarget
|
||||
double d0 = this.getTargetDistance();
|
||||
List list = this.taskOwner.worldObj.selectEntitiesWithinAABB(this.targetClass, this.taskOwner.boundingBox.expand(d0, MathHelper.ceiling_double_int(d0 / 2.0D), d0), this.field_82643_g);
|
||||
Collections.sort(list, this.theNearestAttackableTargetSorter);
|
||||
taskOwner.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(CustomNpcs.NpcNavRange);
|
||||
taskOwner.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(ConfigMain.NpcNavRange);
|
||||
if (list.isEmpty())
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -2,7 +2,6 @@ package noppes.npcs.ai.target;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAITarget;
|
||||
import net.minecraft.entity.passive.EntityTameable;
|
||||
import noppes.npcs.constants.AiMutex;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package noppes.npcs.ai.target;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAITarget;
|
||||
import net.minecraft.entity.passive.EntityTameable;
|
||||
import noppes.npcs.constants.AiMutex;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockColored;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -21,8 +21,8 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.blocks.tiles.TileBanner;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockBanner extends BlockContainer{
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -16,6 +14,8 @@ import noppes.npcs.blocks.tiles.TileBarrel;
|
||||
import noppes.npcs.blocks.tiles.TileNpcContainer;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockBarrel extends BlockRotated{
|
||||
|
||||
public BlockBarrel() {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -13,6 +11,8 @@ import net.minecraft.world.World;
|
||||
import noppes.npcs.blocks.tiles.TileBeam;
|
||||
import noppes.npcs.blocks.tiles.TileColorable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockBeam extends BlockRotated{
|
||||
|
||||
public BlockBeam() {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -19,13 +19,9 @@ import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.blocks.tiles.TileBigSign;
|
||||
import noppes.npcs.blocks.tiles.TileColorable;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockBigSign extends BlockContainer{
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEnchantmentTable;
|
||||
import net.minecraft.block.BlockFence;
|
||||
import net.minecraft.block.BlockFenceGate;
|
||||
import net.minecraft.block.BlockFurnace;
|
||||
import net.minecraft.block.BlockGlowstone;
|
||||
import net.minecraft.block.BlockSapling;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -18,9 +15,6 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.CustomItems;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockBlood extends Block{
|
||||
|
||||
|
||||
@@ -2,27 +2,21 @@ package noppes.npcs.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.blocks.tiles.TileBorder;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
|
||||
public class BlockBorder extends BlockContainer{
|
||||
public int renderId = -1;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -14,11 +14,9 @@ import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.blocks.tiles.TileCampfire;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockCampfire extends BlockLightable{
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -12,8 +11,8 @@ import net.minecraft.world.World;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.blocks.tiles.TileCandle;
|
||||
import noppes.npcs.blocks.tiles.TileColorable;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockCandle extends BlockLightable{
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
@@ -15,11 +13,12 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.blocks.tiles.TileBlockAnvil;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCarpentryBench extends BlockContainer
|
||||
{
|
||||
public int renderId = -1;
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -14,17 +9,12 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import noppes.npcs.blocks.tiles.TileChair;
|
||||
import noppes.npcs.blocks.tiles.TileColorable;
|
||||
import noppes.npcs.entity.EntityChairMount;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockChair extends BlockRotated{
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockColored;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
@@ -22,8 +22,8 @@ import net.minecraft.world.World;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.blocks.tiles.TileColorable;
|
||||
import noppes.npcs.blocks.tiles.TileCouchWood;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCouchWood extends BlockContainer{
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockColored;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
@@ -22,8 +22,8 @@ import net.minecraft.world.World;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.blocks.tiles.TileColorable;
|
||||
import noppes.npcs.blocks.tiles.TileCouchWool;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCouchWool extends BlockContainer{
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -16,6 +14,8 @@ import noppes.npcs.blocks.tiles.TileCrate;
|
||||
import noppes.npcs.blocks.tiles.TileNpcContainer;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCrate extends BlockRotated{
|
||||
|
||||
public BlockCrate() {
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockBreakable;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -14,6 +10,8 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCrystal extends BlockBreakable{
|
||||
|
||||
public BlockCrystal() {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -10,8 +11,6 @@ import net.minecraft.world.World;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.blocks.tiles.TileColorable;
|
||||
import noppes.npcs.blocks.tiles.TileLamp;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockLamp extends BlockLightable{
|
||||
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class BlockLightable extends BlockRotated{
|
||||
|
||||
protected BlockLightable(Block block, boolean lit) {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -21,8 +20,9 @@ import noppes.npcs.Server;
|
||||
import noppes.npcs.blocks.tiles.TileMailbox;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockMailbox extends BlockContainer{
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -10,7 +10,6 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -18,8 +17,8 @@ import net.minecraft.world.World;
|
||||
import noppes.npcs.blocks.tiles.TileColorable;
|
||||
import noppes.npcs.blocks.tiles.TileNpcContainer;
|
||||
import noppes.npcs.blocks.tiles.TilePedestal;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockPedestal extends BlockTrigger{
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -11,8 +11,8 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockPlaceholder extends Block{
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -12,8 +14,6 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import noppes.npcs.blocks.tiles.TileColorable;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public abstract class BlockRotated extends BlockContainer{
|
||||
private Block block;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -14,6 +12,8 @@ import net.minecraft.world.World;
|
||||
import noppes.npcs.blocks.tiles.TileColorable;
|
||||
import noppes.npcs.blocks.tiles.TileShelf;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockShelf extends BlockRotated{
|
||||
|
||||
public BlockShelf() {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -17,6 +15,8 @@ import noppes.npcs.blocks.tiles.TileBanner;
|
||||
import noppes.npcs.blocks.tiles.TileColorable;
|
||||
import noppes.npcs.blocks.tiles.TileSign;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockSign extends BlockRotated{
|
||||
|
||||
public BlockSign() {
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -16,13 +15,11 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import noppes.npcs.blocks.tiles.TileColorable;
|
||||
import noppes.npcs.blocks.tiles.TileStool;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockStool extends BlockContainer{
|
||||
|
||||
|
||||
@@ -1,29 +1,15 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.blocks.tiles.TileColorable;
|
||||
import noppes.npcs.blocks.tiles.TileTable;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockTable extends BlockRotated{
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package noppes.npcs.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockColored;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -23,8 +22,8 @@ import net.minecraft.world.World;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.blocks.tiles.TileColorable;
|
||||
import noppes.npcs.blocks.tiles.TileTallLamp;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockTallLamp extends BlockContainer{
|
||||
|
||||
|
||||
Loaded 100 of 619 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user