mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-10-26 14:24:22 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0642754886 | ||
|
|
2d225337af | ||
|
|
9f66216832 | ||
|
|
ed1cbbe9dd | ||
|
|
6db2aa7dee | ||
|
|
4ce5b40ebb | ||
|
|
c969ea3f72 | ||
|
|
90085c4379 | ||
|
|
14851e751d | ||
|
|
c3da70b52e | ||
|
|
29868d7d8e | ||
|
|
656c0de2a3 | ||
|
|
b777e5856e | ||
|
|
f3dea919a6 | ||
|
|
af9588ff11 | ||
|
|
8d52bb686f | ||
|
|
d4d42208a2 | ||
|
|
fb34e7e848 | ||
|
|
53a582e188 | ||
|
|
bffa5a1171 | ||
|
|
a47619879a | ||
|
|
6545845850 | ||
|
|
8809524d6d | ||
|
|
a9062856d1 | ||
|
|
ddcff076a7 | ||
|
|
9e56e04e6c | ||
|
|
b91ab69cea | ||
|
|
d12717c29f | ||
|
|
808d80affa | ||
|
|
6478eb907e | ||
|
|
334d910086 | ||
|
|
1b97974d0e | ||
|
|
2fe7d5e025 | ||
|
|
360a398fca | ||
|
|
a9171cd215 | ||
|
|
815cdc9f52 | ||
|
|
0a235cf5e8 | ||
|
|
25a4877e1a | ||
|
|
28febcac08 | ||
|
|
757abbe6d7 | ||
|
|
28aa8bc0d5 | ||
|
|
5392f00ff9 | ||
|
|
64712d315f | ||
|
|
789832bdc1 | ||
|
|
a0a7428116 | ||
|
|
37eb1a781c | ||
|
|
a0a78ea203 | ||
|
|
ba3f337520 | ||
|
|
9e13eda148 | ||
|
|
4f26ea9893 | ||
|
|
878c0dbeba | ||
|
|
687d475aeb | ||
|
|
1eafb2e85e | ||
|
|
2877d304ce | ||
|
|
dc1eab4dd8 | ||
|
|
f71b4b6cf2 | ||
|
|
2b3cfd985c | ||
|
|
2a4b489eca | ||
|
|
348b52eb9f | ||
|
|
12be321b73 | ||
|
|
07f68b37da | ||
|
|
8d9996cb6b | ||
|
|
32a28e83a5 | ||
|
|
0b34fe7193 | ||
|
|
a3e8d88f1c | ||
|
|
8423607b29 | ||
|
|
90c42b25c7 | ||
|
|
ddda9db4ac | ||
|
|
16615ce429 | ||
|
|
aeaa2a76c4 | ||
|
|
921825aca3 | ||
|
|
c3e4a02825 | ||
|
|
3d7c9e8b94 | ||
|
|
a0aac5a9bf | ||
|
|
acd5cce7ce | ||
|
|
8eccfad65e | ||
|
|
59771083d2 | ||
|
|
3a5e78a4c6 | ||
|
|
b648c36111 | ||
|
|
5e8eaf8c77 | ||
|
|
6cde8299c4 | ||
|
|
947a225d23 | ||
|
|
67ef25de09 | ||
|
|
4656680250 | ||
|
|
072e3a693b | ||
|
|
b29c810a80 | ||
|
|
3f8e3f72d9 | ||
|
|
5041e23ede | ||
|
|
21a35c9c92 | ||
|
|
6d542dec5a | ||
|
|
4552a451ae | ||
|
|
5c33e95a54 | ||
|
|
1e2bd1d4cd | ||
|
|
1cc995c986 | ||
|
|
1799380064 | ||
|
|
0d3ffa2598 | ||
|
|
f8abe9d7b1 | ||
|
|
3dc65c80d8 | ||
|
|
bc0da61058 | ||
|
|
c9e1647070 | ||
|
|
d622f0cd58 | ||
|
|
32a505a575 | ||
|
|
7ce589c6db | ||
|
|
f0aa44999f | ||
|
|
88f99a636c | ||
|
|
568139fd17 | ||
|
|
cf0189c3ee | ||
|
|
2ee0d7f0ed | ||
|
|
6997a96460 | ||
|
|
179ca23f6c | ||
|
|
e7e5b1b484 | ||
|
|
fbd9917fd4 | ||
|
|
881e271a0b | ||
|
|
3b5c500bc9 | ||
|
|
4751da9e7b | ||
|
|
1c4ae58377 | ||
|
|
9f0c710479 | ||
|
|
8a13a03016 | ||
|
|
7ef27df0bc | ||
|
|
01a913c96c | ||
|
|
110396f39e | ||
|
|
233bc705b0 | ||
|
|
6264ebddbc | ||
|
|
bedbf55b33 | ||
|
|
a5d688883e | ||
|
|
83d0b8dc12 | ||
|
|
c05c1ef8bf | ||
|
|
c5d5e59b96 | ||
|
|
1fd48994d7 | ||
|
|
cf56634a91 | ||
|
|
1344bb8c08 | ||
|
|
2bf69eaa56 | ||
|
|
b242d43861 | ||
|
|
404c39c8f8 | ||
|
|
d8bdb6a31d | ||
|
|
c5208175d7 | ||
|
|
a0d0fefe8d | ||
|
|
87172ea3f2 | ||
|
|
16381383cb | ||
|
|
252e3191dc | ||
|
|
ce0ba85397 | ||
|
|
aa8dc5d16c | ||
|
|
dff2cf2bf1 | ||
|
|
347c100e93 | ||
|
|
003fb22733 | ||
|
|
7f5d3859e4 | ||
|
|
124fdeeee3 | ||
|
|
611f33a133 | ||
|
|
a76efcc6fc | ||
|
|
cd3daf2b47 | ||
|
|
dc05115497 | ||
|
|
44a4657cd8 | ||
|
|
8e70e9fa68 | ||
|
|
0b635c5bc7 | ||
|
|
6f69d5d154 | ||
|
|
589b4e49b6 | ||
|
|
b30ad911fa | ||
|
|
be667b2ee3 | ||
|
|
bea1c6ecdc | ||
|
|
971b1ee3e2 | ||
|
|
4172637bcc | ||
|
|
2650813f95 | ||
|
|
1fbcb0b39b | ||
|
|
e28f82dc7d | ||
|
|
d3d94e46d7 | ||
|
|
b2d7bc2794 | ||
|
|
2afaac9f20 | ||
|
|
28b3e5d22b | ||
|
|
da3958a414 | ||
|
|
4ddf3767c5 | ||
|
|
81c45fb079 | ||
|
|
49d79abb83 | ||
|
|
1a3b6833b5 | ||
|
|
38cd0fbf55 | ||
|
|
9d1e7f86cf | ||
|
|
5863b165ad | ||
|
|
f7a1f629be | ||
|
|
6f348e7db1 | ||
|
|
b6ddefcaf4 | ||
|
|
c6df7c260a | ||
|
|
9a11ebef1f | ||
|
|
1bb254a4fc | ||
|
|
8600b75691 | ||
|
|
337851994f | ||
|
|
b232d8bb93 | ||
|
|
2a2971f75a | ||
|
|
dced32bf4c | ||
|
|
420d4b0aa4 | ||
|
|
d4b0d0aec9 | ||
|
|
e37b3ac3e6 | ||
|
|
6a4f8e9f4b | ||
|
|
d7929eed08 | ||
|
|
028f0c4c82 | ||
|
|
71edb3abb1 | ||
|
|
4fede6f49e | ||
|
|
4ef18f3347 | ||
|
|
eaa9c89684 | ||
|
|
37c2adece1 | ||
|
|
9f94407be0 | ||
|
|
7b6d2e843e | ||
|
|
7d87732ccb | ||
|
|
3c9388702c | ||
|
|
e338735814 | ||
|
|
d34fc5a3e1 | ||
|
|
d9522fcc18 | ||
|
|
53147606c1 | ||
|
|
cfb368f67e | ||
|
|
6c307d16f4 | ||
|
|
3a8fc10cc9 | ||
|
|
f2544a6fa4 | ||
|
|
b7e77936b3 | ||
|
|
8767180a7b | ||
|
|
bc52c67c89 | ||
|
|
0001f9c8f1 | ||
|
|
9fef518968 | ||
|
|
6b10ada28a | ||
|
|
f3a3e80334 | ||
|
|
5cdd2ee32f | ||
|
|
a9cc76576a | ||
|
|
fc23dedd05 | ||
|
|
65bf209835 | ||
|
|
d2e84babb7 | ||
|
|
850ea37f4d | ||
|
|
2d0af453b3 | ||
|
|
d5c9c7815e | ||
|
|
25cd574662 | ||
|
|
3cf1619b2e | ||
|
|
73c06c10eb | ||
|
|
1d5dfa149e | ||
|
|
c1fff324d1 | ||
|
|
95f1e768fe | ||
|
|
ec9496b0e7 | ||
|
|
5f3951c7fa | ||
|
|
47ac6fc65a | ||
|
|
ae0894a8d0 | ||
|
|
96bf87333b | ||
|
|
9e09a3f42d | ||
|
|
bc0ca77960 | ||
|
|
8bca8bb5f6 | ||
|
|
ece95aca1c | ||
|
|
c357ab68c3 | ||
|
|
cfc1ba8baf | ||
|
|
f56eca23fc | ||
|
|
b7aab995db | ||
|
|
ec5fcef90c | ||
|
|
f4d7a80e49 | ||
|
|
c289edd825 | ||
|
|
5ac09b830d | ||
|
|
709fc130d5 | ||
|
|
873aedf4e5 | ||
|
|
27410530d6 | ||
|
|
491452ac7b | ||
|
|
4e905ede36 | ||
|
|
6afc33c57b | ||
|
|
5f35b8aef0 | ||
|
|
699ee5027a | ||
|
|
7c32f5fbaf | ||
|
|
3c0fe199d5 | ||
|
|
c15f08b066 | ||
|
|
c47de38ec9 | ||
|
|
9b3c1d721d | ||
|
|
5d19a0dd6c | ||
|
|
89834b4053 | ||
|
|
85eef6c461 | ||
|
|
9897d3ed80 | ||
|
|
02cfe14d94 | ||
|
|
4b4b9a308c | ||
|
|
55df4f0619 | ||
|
|
c83578b920 | ||
|
|
39517588e7 | ||
|
|
14f0c43850 | ||
|
|
05c6a07bc2 | ||
|
|
d241f95bee | ||
|
|
49a6f00b41 | ||
|
|
14b2a35862 | ||
|
|
4aeed07f75 | ||
|
|
cdcfe75325 | ||
|
|
303e89f6c5 | ||
|
|
c9e501fd02 | ||
|
|
3049ac9767 | ||
|
|
11c0e4b274 | ||
|
|
fab5fc0087 | ||
|
|
a5df917d5a | ||
|
|
c2931d1517 | ||
|
|
b71cb163a7 | ||
|
|
ff69a2e458 | ||
|
|
4cfd420cc1 | ||
|
|
95bd4689d6 | ||
|
|
d2aa4e0ebc | ||
|
|
1bff638075 | ||
|
|
78f296d0cf | ||
|
|
6014df2b12 | ||
|
|
30c208aa55 | ||
|
|
96a2da61f5 | ||
|
|
fd35d25423 | ||
|
|
2065f01b8d | ||
|
|
6c52c4f5f9 | ||
|
|
307068c9c4 | ||
|
|
688da731ab | ||
|
|
ac003f1307 | ||
|
|
3e0f5da01d | ||
|
|
cc1b66f3cd | ||
|
|
c08fa024a0 | ||
|
|
4f0d63f5a0 | ||
|
|
8ef557e51b | ||
|
|
974e8d0316 | ||
|
|
cf82603f04 | ||
|
|
1d54442e01 | ||
|
|
a07f7914ae | ||
|
|
51c7d310a7 | ||
|
|
e3e6f8996f | ||
|
|
7f759c1b88 | ||
|
|
57e1fd5b41 | ||
|
|
8b88289789 | ||
|
|
ff2afbf037 | ||
|
|
41b3e6cd4f | ||
|
|
930703b5c1 | ||
|
|
f52dca111f | ||
|
|
9694664922 | ||
|
|
e2e00f7ef1 | ||
|
|
c9de3bcc03 | ||
|
|
995c19c04a | ||
|
|
96983a1d6b | ||
|
|
8f00e9bdd6 | ||
|
|
5495271fa2 | ||
|
|
588a02f385 | ||
|
|
da11e497fc | ||
|
|
b7fead0e4d | ||
|
|
3fb76acf57 | ||
|
|
2471642df7 |
No files matched your search
+30
-11
@@ -1,3 +1,6 @@
|
||||
import groovy.json.JsonSlurper
|
||||
import groovy.json.JsonOutput
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -43,7 +46,7 @@ minecraft {
|
||||
version = "${config.mc_version}-${config.forge_version}"
|
||||
runDir = "eclipse/assets"
|
||||
|
||||
mappings = "snapshot_20160518"
|
||||
mappings = "snapshot_20160718"
|
||||
//This, does the token replacement.
|
||||
//Though, I reccomend this to be replaced with a token such as @VERSION@
|
||||
replace 'GRADLE:BUILD', config.build_number
|
||||
@@ -64,7 +67,7 @@ dependencies {
|
||||
compile files(
|
||||
'Baubles-deobf.jar'
|
||||
)
|
||||
deobfCompile "mezz.jei:jei_1.9.4:3.4.0.202"
|
||||
deobfCompile "mezz.jei:jei_1.10.2:3.7.8.234"
|
||||
|
||||
//and a bit more for SCP
|
||||
sshAntTask "org.apache.ant:ant-jsch:1.7.1", "jsch:jsch:0.1.29"
|
||||
@@ -75,6 +78,9 @@ compileJava {
|
||||
targetCompatibility = 1.8
|
||||
}
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
processResources {
|
||||
// replace stuff in mcmod.info, nothing else
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
@@ -110,10 +116,27 @@ task incrementBuildNumber(dependsOn: 'reobfJar') << {
|
||||
config.toProperties().store(it, "")
|
||||
}
|
||||
|
||||
// todo make this flexibile - collection of supported mc versions
|
||||
|
||||
file('web/versions.ini').append("\n${version}=${minecraft.version}")
|
||||
file("${config.dir_repo}/version/${minecraft.version}.txt").write("${version}")
|
||||
|
||||
def updateJsonFile = file('version/update.json')
|
||||
def updateJson = new JsonSlurper().parse(updateJsonFile) as Map
|
||||
|
||||
// todo detect if the mcversion is absent
|
||||
|
||||
// Add to version section
|
||||
updateJson."${minecraft.version}"."${version}" = "See https://github.com/williewillus/Botania/releases/${version}"
|
||||
|
||||
// Update promos
|
||||
updateJson.promos."${minecraft.version}-latest" = "${version}"
|
||||
updateJson.promos."${minecraft.version}-recommended" = "${version}"
|
||||
|
||||
updateJsonFile.write(JsonOutput.prettyPrint(JsonOutput.toJson(updateJson)))
|
||||
}
|
||||
|
||||
/* Unused - Forgecraft and web server stuff
|
||||
// I have no idea what I'm doing
|
||||
task wtfGradle2(type: Copy) {
|
||||
from(jar.destinationDir)
|
||||
@@ -151,9 +174,7 @@ task sort(type: Delete) {
|
||||
delete "${config.dir_output}/${deobfJar.archiveName}", "${config.dir_output}/wtf"
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the upload task from the build.xml
|
||||
*/
|
||||
// This is the upload task from the build.xml
|
||||
task upload() << {
|
||||
scp('/files') {
|
||||
fileset(file: jar.archivePath)
|
||||
@@ -169,9 +190,7 @@ task upload() << {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is deply_web task
|
||||
*/
|
||||
// This is deploy_web task
|
||||
task deployWeb << {
|
||||
scp('/') {
|
||||
fileset(dir: 'web') //everything from the web directory
|
||||
@@ -199,6 +218,7 @@ def scp(String dir, Closure antFileset = {}) {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
def parseConfig(File config) {
|
||||
config.withReader {
|
||||
@@ -220,9 +240,8 @@ curseforge {
|
||||
changelog = """
|
||||
See https://github.com/williewillus/Botania/releases/tag/${version}
|
||||
"""
|
||||
releaseType = "beta"
|
||||
addGameVersion '1.9'
|
||||
addGameVersion 'Java 8'
|
||||
releaseType = "release"
|
||||
addGameVersion "${minecraft.version}"
|
||||
relations {
|
||||
requiredLibrary 'baubles'
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
#
|
||||
#Tue May 10 23:24:10 CDT 2016
|
||||
#Sat Aug 27 12:56:20 CDT 2016
|
||||
version=r1.8
|
||||
dir_output=../Build Output/Botania/
|
||||
dir_repo=./
|
||||
mc_version=1.9.4
|
||||
forge_version=12.17.0.1909-1.9.4
|
||||
build_number=306
|
||||
mc_version=1.10.2
|
||||
forge_version=12.18.1.2056
|
||||
build_number=320
|
||||
mod_name=Botania
|
||||
@@ -56,3 +56,4 @@ loraanicus=10
|
||||
samerater=8
|
||||
coolcabbage16=13
|
||||
eladkay=3
|
||||
tobiasling=9
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
#Mon Sep 14 12:28:28 PDT 2015
|
||||
#Sat May 28 11:56:22 CDT 2016
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip
|
||||
@@ -6,7 +6,7 @@ import java.util.Map;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTBase.NBTPrimitive;
|
||||
import net.minecraft.nbt.NBTPrimitive;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
@@ -103,24 +103,20 @@ public final class BotaniaAPI {
|
||||
public static final Set<Class<? extends Entity>> gravityRodBlacklist = new LinkedHashSet<>();
|
||||
|
||||
|
||||
public static final ArmorMaterial manasteelArmorMaterial = EnumHelper.addEnum(ArmorMaterial.class, "MANASTEEL",
|
||||
new Class[] { String.class, int.class, int[].class, int.class, SoundEvent.class, float.class },
|
||||
"manasteel", 16, new int[] { 2, 6, 5, 2 }, 18, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 1.0F); // todo 1.9.4 toughness
|
||||
public static final ArmorMaterial manasteelArmorMaterial = EnumHelper.addArmorMaterial("MANASTEEL", "manasteel", 16,
|
||||
new int[] { 2, 6, 5, 2 }, 18, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0);
|
||||
public static final ToolMaterial manasteelToolMaterial = EnumHelper.addToolMaterial("MANASTEEL", 3, 300, 6.2F, 2F, 20);
|
||||
|
||||
public static final ArmorMaterial elementiumArmorMaterial = EnumHelper.addEnum(ArmorMaterial.class, "B_ELEMENTIUM",
|
||||
new Class[] { String.class, int.class, int[].class, int.class, SoundEvent.class, float.class },
|
||||
"b_elementium", 18, new int[] { 2, 6, 5, 2 }, 18, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 1.0F); // todo 1.9.4 toughness
|
||||
public static final ArmorMaterial elementiumArmorMaterial = EnumHelper.addArmorMaterial("B_ELEMENTIUM", "b_elementium", 18,
|
||||
new int[] { 2, 6, 5, 2 }, 18, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0);
|
||||
public static final ToolMaterial elementiumToolMaterial = EnumHelper.addToolMaterial("B_ELEMENTIUM", 3, 720, 6.2F, 2F, 20);
|
||||
|
||||
public static final ArmorMaterial terrasteelArmorMaterial = EnumHelper.addEnum(ArmorMaterial.class, "TERRASTEEL",
|
||||
new Class[] { String.class, int.class, int[].class, int.class, SoundEvent.class, float.class },
|
||||
"terrasteel", 34, new int[] {3, 8, 6, 3}, 26, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 1.0F); // todo 1.9.4 toughness
|
||||
public static final ArmorMaterial terrasteelArmorMaterial = EnumHelper.addArmorMaterial("TERRASTEEL", "terrasteel", 34,
|
||||
new int[] { 3, 8, 6, 3 }, 26, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 3F);
|
||||
public static final ToolMaterial terrasteelToolMaterial = EnumHelper.addToolMaterial("TERRASTEEL", 4, 2300, 9F, 3F, 26);
|
||||
|
||||
public static final ArmorMaterial manaweaveArmorMaterial = EnumHelper.addEnum(ArmorMaterial.class, "MANAWEAVE",
|
||||
new Class[] { String.class, int.class, int[].class, int.class, SoundEvent.class, float.class },
|
||||
"manaweave", 5, new int[] { 1, 2, 2, 1 }, 18, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, 1.0F); // todo 1.9.4 toughness
|
||||
public static final ArmorMaterial manaweaveArmorMaterial = EnumHelper.addArmorMaterial("MANAWEAVE", "manaweave", 5,
|
||||
new int[] { 1, 2, 2, 1 }, 18, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, 0);
|
||||
|
||||
public static final EnumRarity rarityRelic = EnumHelper.addRarity("RELIC", TextFormatting.GOLD, "Relic");
|
||||
|
||||
@@ -499,16 +495,26 @@ public final class BotaniaAPI {
|
||||
|
||||
/**
|
||||
* Registers a Elven Trade recipe (throw an item in an Alfheim Portal).
|
||||
* @param output The ItemStack to return.
|
||||
* @param outputs The ItemStacks to return.
|
||||
* @param inputs The items required, can be ItemStack or ore dictionary entry string.
|
||||
* @return The recipe created.
|
||||
*/
|
||||
public static RecipeElvenTrade registerElvenTradeRecipe(ItemStack output, Object... inputs) {
|
||||
RecipeElvenTrade recipe = new RecipeElvenTrade(output, inputs);
|
||||
public static RecipeElvenTrade registerElvenTradeRecipe(ItemStack[] outputs, Object... inputs) {
|
||||
RecipeElvenTrade recipe = new RecipeElvenTrade(outputs, inputs);
|
||||
elvenTradeRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Elven Trade recipe (throw an item into an Alfeim Portal).
|
||||
* @param output The ItemStack to return
|
||||
* @param inputs The items required, can be an ItemStack or an Ore Dictionary entry string.
|
||||
* @return The recipe created.
|
||||
*/
|
||||
public static RecipeElvenTrade registerElvenTradeRecipe(ItemStack output, Object... inputs) {
|
||||
return registerElvenTradeRecipe(new ItemStack[]{ output }, inputs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Brew Recipe (for the Botanical Brewery).
|
||||
* @param brew The brew in to be set in this recipe.
|
||||
|
||||
@@ -11,9 +11,7 @@
|
||||
package vazkii.botania.api.boss;
|
||||
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.BossInfo;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.internal.ShaderCallback;
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
package vazkii.botania.api.corporea;
|
||||
|
||||
public class CorporeaRequest {
|
||||
public Object matcher;
|
||||
public boolean checkNBT;
|
||||
public final Object matcher;
|
||||
public final boolean checkNBT;
|
||||
public int count;
|
||||
public int foundItems = 0;
|
||||
public int extractedItems = 0;
|
||||
|
||||
@@ -23,9 +23,7 @@ public class DummyManaNetwork implements IManaNetwork {
|
||||
public static final DummyManaNetwork instance = new DummyManaNetwork();
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
// NO-OP
|
||||
}
|
||||
public void clear() {}
|
||||
|
||||
@Override
|
||||
public TileEntity getClosestPool(BlockPos pos, World world, int limit) {
|
||||
|
||||
@@ -25,7 +25,6 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import vazkii.botania.api.boss.IBotaniaBoss;
|
||||
import vazkii.botania.api.corporea.IWrappedInventory;
|
||||
import vazkii.botania.api.corporea.InvWithLocation;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
@@ -151,14 +150,10 @@ public class DummyMethodHandler implements IInternalMethodHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) {
|
||||
// NO-OP
|
||||
}
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) {}
|
||||
|
||||
@Override
|
||||
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res, ItemStack bindDisplay, boolean properlyBound) {
|
||||
// NO-OP
|
||||
}
|
||||
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res, ItemStack bindDisplay, boolean properlyBound) {}
|
||||
|
||||
@Override
|
||||
public ItemStack getBindDisplayForFlowerType(SubTileEntity e) {
|
||||
@@ -166,14 +161,10 @@ public class DummyMethodHandler implements IInternalMethodHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderLexiconText(int x, int y, int width, int height, String unlocalizedText) {
|
||||
// NO-OP
|
||||
}
|
||||
public void renderLexiconText(int x, int y, int width, int height, String unlocalizedText) {}
|
||||
|
||||
@Override
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) {
|
||||
// NO-OP
|
||||
}
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) {}
|
||||
|
||||
@Override
|
||||
public IInventory getBaublesInventory(EntityPlayer player) {
|
||||
@@ -206,9 +197,7 @@ public class DummyMethodHandler implements IInternalMethodHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakOnAllCursors(EntityPlayer player, Item item, ItemStack stack, BlockPos pos, EnumFacing side) {
|
||||
// NO-OP
|
||||
}
|
||||
public void breakOnAllCursors(EntityPlayer player, Item item, ItemStack stack, BlockPos pos, EnumFacing side) {}
|
||||
|
||||
@Override
|
||||
public boolean hasSolegnoliaAround(Entity e) {
|
||||
@@ -226,9 +215,7 @@ public class DummyMethodHandler implements IInternalMethodHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaubleUpdatePacket(EntityPlayer player, int slot) {
|
||||
// NO-OP
|
||||
}
|
||||
public void sendBaubleUpdatePacket(EntityPlayer player, int slot) {}
|
||||
|
||||
@Override
|
||||
public List<IWrappedInventory> wrapInventory(List<InvWithLocation> inventories) {
|
||||
|
||||
@@ -27,8 +27,6 @@ public class DummyPage extends LexiconPage {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderScreen(IGuiLexiconEntry gui, int x, int y) {
|
||||
// NO-OP
|
||||
}
|
||||
public void renderScreen(IGuiLexiconEntry gui, int x, int y) {}
|
||||
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import vazkii.botania.api.boss.IBotaniaBoss;
|
||||
import vazkii.botania.api.corporea.IWrappedInventory;
|
||||
import vazkii.botania.api.corporea.InvWithLocation;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.server.management.PlayerChunkMapEntry;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -22,23 +22,8 @@ import net.minecraft.world.WorldServer;
|
||||
public final class VanillaPacketDispatcher {
|
||||
|
||||
public static void dispatchTEToNearbyPlayers(TileEntity tile) {
|
||||
if(tile.getWorld() instanceof WorldServer) {
|
||||
WorldServer ws = ((WorldServer) tile.getWorld());
|
||||
PlayerChunkMapEntry chunk = ws.getPlayerChunkMap().getEntry(tile.getPos().getX() >> 4, tile.getPos().getZ() >> 4);
|
||||
|
||||
if(chunk == null)
|
||||
return;
|
||||
|
||||
for (EntityPlayer player : ws.playerEntities) {
|
||||
EntityPlayerMP playerMP = ((EntityPlayerMP) player);
|
||||
|
||||
if (playerMP.getDistanceSq(tile.getPos()) < 64 * 64
|
||||
&& chunk.containsPlayer(playerMP)) {
|
||||
playerMP.connection.sendPacket(tile.getUpdatePacket());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
|
||||
tile.getWorld().notifyBlockUpdate(tile.getPos(), state, state, 8);
|
||||
}
|
||||
|
||||
public static void dispatchTEToNearbyPlayers(World world, BlockPos pos) {
|
||||
|
||||
@@ -13,6 +13,7 @@ package vazkii.botania.api.item;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
/**
|
||||
* A Bauble Item that implements this will be have hooks to render something on
|
||||
@@ -34,24 +35,67 @@ public interface IBaubleRender {
|
||||
/**
|
||||
* A few helper methods for the render.
|
||||
*/
|
||||
public static class Helper {
|
||||
final class Helper {
|
||||
|
||||
/**
|
||||
* Rotates the render for a bauble correctly if the player is sneaking.
|
||||
* Use for renders under {@link RenderType#BODY}.
|
||||
*/
|
||||
public static void rotateIfSneaking(EntityPlayer player) {
|
||||
if(player.isSneaking())
|
||||
applySneakingRotation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates the render for a bauble correctly for a sneaking player.
|
||||
* Use for renders under {@link RenderType#BODY}.
|
||||
*/
|
||||
public static void applySneakingRotation() {
|
||||
GlStateManager.rotate(28.64789F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.translate(0F, 0.2F, 0F);
|
||||
GlStateManager.rotate(90F / (float) Math.PI, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shifts the render for a bauble correctly to the head, including sneaking rotation.
|
||||
* Use for renders under {@link RenderType#HEAD}.
|
||||
*/
|
||||
public static void translateToHeadLevel(EntityPlayer player) {
|
||||
GlStateManager.translate(0, -player.getDefaultEyeHeight() + (player.isSneaking() ? 0.25 : 0), 0);
|
||||
GlStateManager.translate(0, -player.getDefaultEyeHeight(), 0);
|
||||
if (player.isSneaking())
|
||||
GlStateManager.translate(0.25F * MathHelper.sin(player.rotationPitch * (float) Math.PI / 180), 0.25F * MathHelper.cos(player.rotationPitch * (float) Math.PI / 180), 0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shifts the render for a bauble correctly to the face.
|
||||
* Use for renders under {@link RenderType#HEAD}, and usually after calling {@link Helper#translateToHeadLevel(EntityPlayer)}.
|
||||
*/
|
||||
public static void translateToFace() {
|
||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||
GlStateManager.translate(0f, -4.35f, -1.27f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scales down the render to a correct size.
|
||||
* Use for any render.
|
||||
*/
|
||||
public static void defaultTransforms() {
|
||||
GlStateManager.translate(0.0, 3.0, 1.0);
|
||||
GlStateManager.scale(0.55, 0.55, 0.55);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shifts the render for a bauble correctly to the chest.
|
||||
* Use for renders under {@link RenderType#BODY}, and usually after calling {@link Helper#rotateIfSneaking(EntityPlayer)}.
|
||||
*/
|
||||
public static void translateToChest() {
|
||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
||||
GlStateManager.translate(0F, -3.2F, -0.85F);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static enum RenderType {
|
||||
enum RenderType {
|
||||
/**
|
||||
* Render Type for the player's body, translations apply on the player's rotation.
|
||||
* Sneaking is not handled and should be done during the render.
|
||||
@@ -61,7 +105,7 @@ public interface IBaubleRender {
|
||||
|
||||
/**
|
||||
* Render Type for the player's body, translations apply on the player's head rotations.
|
||||
* Sneaking is not handled and should be done during the render.~
|
||||
* Sneaking is not handled and should be done during the render.
|
||||
* @see IBaubleRender.Helper
|
||||
*/
|
||||
HEAD;
|
||||
|
||||
@@ -23,7 +23,7 @@ public interface IFloatingFlower {
|
||||
public void setIslandType(IslandType type);
|
||||
|
||||
public class IslandType {
|
||||
private static HashMap<String, IslandType> registry = new HashMap<>();
|
||||
private static final HashMap<String, IslandType> registry = new HashMap<>();
|
||||
|
||||
public static final IslandType GRASS = new IslandType("GRASS");
|
||||
public static final IslandType PODZOL = new IslandType("PODZOL");
|
||||
|
||||
@@ -22,7 +22,7 @@ public interface IManaDissolvable {
|
||||
|
||||
/**
|
||||
* Called for every tick the item is on a mana pool. If the stack has stack
|
||||
* size 0 the item is killed. This is called in both the server and client.
|
||||
* size 0 the item is killed. This is called serverside.
|
||||
*/
|
||||
public void onDissolveTick(IManaPool pool, ItemStack stack, EntityItem item);
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
|
||||
|
||||
private KnowledgeType type = BotaniaAPI.basicKnowledge;
|
||||
|
||||
public List<LexiconPage> pages = new ArrayList<>();
|
||||
public final List<LexiconPage> pages = new ArrayList<>();
|
||||
private boolean priority = false;
|
||||
private ItemStack icon = null;
|
||||
|
||||
private List<ItemStack> extraDisplayedRecipes = new ArrayList<>();
|
||||
private final List<ItemStack> extraDisplayedRecipes = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* @param unlocalizedName The unlocalized name of this entry. This will be localized by the client display.
|
||||
|
||||
@@ -40,9 +40,7 @@ public abstract class LexiconPage {
|
||||
* Called per update tick. Non gui-sensitive version, kept for backwards compatibility only.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateScreen() {
|
||||
// NO-OP
|
||||
}
|
||||
public void updateScreen() {}
|
||||
|
||||
/**
|
||||
* Called per update tick. Feel free to override fully, the
|
||||
@@ -58,41 +56,31 @@ public abstract class LexiconPage {
|
||||
* You can add buttons and whatever you'd do on initGui() here.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onOpened(IGuiLexiconEntry gui) {
|
||||
// NO-OP
|
||||
}
|
||||
public void onOpened(IGuiLexiconEntry gui) {}
|
||||
|
||||
/**
|
||||
* Called when this page is opened, be it via closing the gui or when the player changes page.
|
||||
* Make sure to dispose of anything you don't use any more, such as buttons in the gui's buttonList.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onClosed(IGuiLexiconEntry gui) {
|
||||
// NO-OP
|
||||
}
|
||||
public void onClosed(IGuiLexiconEntry gui) {}
|
||||
|
||||
/**
|
||||
* Called when a button is pressed, equivalent to GuiScreen.actionPerformed.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onActionPerformed(IGuiLexiconEntry gui, GuiButton button) {
|
||||
// NO-OP
|
||||
}
|
||||
public void onActionPerformed(IGuiLexiconEntry gui, GuiButton button) {}
|
||||
|
||||
/**
|
||||
* Called when a key is pressed.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onKeyPressed(char c, int key) {
|
||||
// NO-OP
|
||||
}
|
||||
public void onKeyPressed(char c, int key) {}
|
||||
|
||||
/**
|
||||
* Called when {@link LexiconEntry#setLexiconPages(LexiconPage...)} is called.
|
||||
*/
|
||||
public void onPageAdded(LexiconEntry entry, int index) {
|
||||
// NO-OP
|
||||
}
|
||||
public void onPageAdded(LexiconEntry entry, int index) {}
|
||||
|
||||
/**
|
||||
* Shows the list of recipes present in this page for display in the category
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.api.lexicon;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.mana.IManaItem;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -23,7 +24,7 @@ import java.util.Map;
|
||||
*/
|
||||
public final class LexiconRecipeMappings {
|
||||
|
||||
private static Map<String, EntryData> mappings = new HashMap<>();
|
||||
private static final Map<String, EntryData> mappings = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Maps the given stack to the given page of the entry.
|
||||
@@ -47,21 +48,28 @@ public final class LexiconRecipeMappings {
|
||||
}
|
||||
|
||||
public static EntryData getDataForStack(ItemStack stack) {
|
||||
String wildKey = stackToString(stack, true);
|
||||
if (mappings.containsKey(wildKey))
|
||||
return mappings.get(wildKey);
|
||||
return mappings.get(stackToString(stack));
|
||||
}
|
||||
|
||||
public static String stackToString(ItemStack stack) {
|
||||
return stackToString(stack, false);
|
||||
}
|
||||
|
||||
public static String stackToString(ItemStack stack, boolean forceIgnore) {
|
||||
if(stack == null || stack.getItem() == null)
|
||||
return "NULL";
|
||||
|
||||
|
||||
if(stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider)
|
||||
return ((IRecipeKeyProvider) stack.getItem()).getKey(stack);
|
||||
|
||||
return stack.getUnlocalizedName() + (ignoreMeta(stack) ? "" : "~" + stack.getItemDamage());
|
||||
return stack.getUnlocalizedName() + (forceIgnore || ignoreMeta(stack) ? "" : "~" + stack.getItemDamage());
|
||||
}
|
||||
|
||||
public static boolean ignoreMeta(ItemStack stack) {
|
||||
return stack.isItemStackDamageable() || stack.getItem() instanceof IManaItem;
|
||||
return stack.isItemStackDamageable() || stack.getItem() instanceof IManaItem || stack.getItemDamage() == OreDictionary.WILDCARD_VALUE;
|
||||
}
|
||||
|
||||
public static class EntryData {
|
||||
|
||||
@@ -29,14 +29,14 @@ import java.util.Map;
|
||||
*/
|
||||
public class Multiblock {
|
||||
|
||||
public List<MultiblockComponent> components = new ArrayList<>();
|
||||
public List<ItemStack> materials = new ArrayList<>();
|
||||
public final List<MultiblockComponent> components = new ArrayList<>();
|
||||
public final List<ItemStack> materials = new ArrayList<>();
|
||||
|
||||
public BlockPos minPos = BlockPos.ORIGIN;
|
||||
public BlockPos maxPos = BlockPos.ORIGIN;
|
||||
public BlockPos offPos = BlockPos.ORIGIN;
|
||||
|
||||
public HashMap<BlockPos, MultiblockComponent> locationCache = new HashMap<>();
|
||||
public final HashMap<BlockPos, MultiblockComponent> locationCache = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Adds a multiblock component to this multiblock. The component's x y z
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public class MultiblockComponent {
|
||||
protected BlockPos relPos;
|
||||
protected final IBlockState state;
|
||||
protected final TileEntity tileEntity;
|
||||
private boolean doFancyRender;
|
||||
private final boolean doFancyRender;
|
||||
|
||||
public MultiblockComponent(BlockPos relPos, IBlockState state) {
|
||||
this(relPos, state, null);
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* This class was created by <Flaxbeard>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Jul 25, 2016, 9:02:12 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
public class ManaDiscountEvent extends Event {
|
||||
|
||||
private final EntityPlayer entityPlayer;
|
||||
private float discount;
|
||||
|
||||
public ManaDiscountEvent(EntityPlayer entityPlayer, float discount) {
|
||||
this.entityPlayer = entityPlayer;
|
||||
this.discount = discount;
|
||||
}
|
||||
|
||||
public EntityPlayer getEntityPlayer() {
|
||||
return entityPlayer;
|
||||
}
|
||||
|
||||
public float getDiscount() {
|
||||
return discount;
|
||||
}
|
||||
|
||||
public void setDiscount(float discount) {
|
||||
this.discount = discount;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ package vazkii.botania.api.mana;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
public final class ManaItemHandler {
|
||||
@@ -145,7 +146,7 @@ public final class ManaItemHandler {
|
||||
if(stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canExportManaToItem(stack, stackInSlot))
|
||||
continue;
|
||||
|
||||
int received = 0;
|
||||
int received;
|
||||
if(manaItemSlot.getMana(stackInSlot) + manaToSend <= manaItemSlot.getMaxMana(stackInSlot))
|
||||
received = manaToSend;
|
||||
else received = manaToSend - (manaItemSlot.getMana(stackInSlot) + manaToSend - manaItemSlot.getMaxMana(stackInSlot));
|
||||
@@ -249,6 +250,10 @@ public final class ManaItemHandler {
|
||||
if(armor != null && armor.getItem() instanceof IManaDiscountArmor)
|
||||
discount += ((IManaDiscountArmor) armor.getItem()).getDiscount(armor, i, player);
|
||||
}
|
||||
|
||||
ManaDiscountEvent event = new ManaDiscountEvent(player, discount);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
discount = event.getDiscount();
|
||||
|
||||
return discount;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,11 @@ import java.util.List;
|
||||
|
||||
public class RecipeElvenTrade {
|
||||
|
||||
private final ItemStack output;
|
||||
private final ImmutableList<ItemStack> outputs;
|
||||
private final ImmutableList<Object> inputs;
|
||||
|
||||
public RecipeElvenTrade(ItemStack output, Object... inputs) {
|
||||
this.output = output;
|
||||
public RecipeElvenTrade(ItemStack[] outputs, Object... inputs) {
|
||||
this.outputs = ImmutableList.copyOf(outputs);
|
||||
|
||||
ImmutableList.Builder<Object> inputsToSet = ImmutableList.builder();
|
||||
for(Object obj : inputs) {
|
||||
@@ -88,8 +88,8 @@ public class RecipeElvenTrade {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return output;
|
||||
public List<ItemStack> getOutputs() {
|
||||
return outputs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,14 +30,11 @@ import vazkii.botania.api.state.enums.CratePattern;
|
||||
import vazkii.botania.api.state.enums.CrateVariant;
|
||||
import vazkii.botania.api.state.enums.CustomBrickVariant;
|
||||
import vazkii.botania.api.state.enums.DrumVariant;
|
||||
import vazkii.botania.api.state.enums.EndBrickVariant;
|
||||
import vazkii.botania.api.state.enums.FutureStoneVariant;
|
||||
import vazkii.botania.api.state.enums.LivingRockVariant;
|
||||
import vazkii.botania.api.state.enums.LivingWoodVariant;
|
||||
import vazkii.botania.api.state.enums.LuminizerVariant;
|
||||
import vazkii.botania.api.state.enums.PlatformVariant;
|
||||
import vazkii.botania.api.state.enums.PoolVariant;
|
||||
import vazkii.botania.api.state.enums.PrismarineVariant;
|
||||
import vazkii.botania.api.state.enums.PylonVariant;
|
||||
import vazkii.botania.api.state.enums.QuartzVariant;
|
||||
import vazkii.botania.api.state.enums.SpreaderVariant;
|
||||
@@ -90,18 +87,6 @@ public final class BotaniaStateProps {
|
||||
|
||||
/** Properties for individual blocks **/
|
||||
|
||||
// Block18Stone
|
||||
public static final PropertyEnum<FutureStoneVariant> FUTURESTONE_VARIANT = PropertyEnum.create("variant", FutureStoneVariant.class);
|
||||
|
||||
// Block18StoneWall
|
||||
public static final PropertyEnum<FutureStoneVariant> FUTURESTONEWALL_VARIANT = PropertyEnum.create("fswall_variant", FutureStoneVariant.class, new Predicate<FutureStoneVariant>() {
|
||||
@Override
|
||||
public boolean apply(FutureStoneVariant variant) {
|
||||
// Just the four kinds (no polished, chiseled, etc.)
|
||||
return variant.ordinal() >= 0 && variant.ordinal() <= 3;
|
||||
}
|
||||
});
|
||||
|
||||
// BlockAlfPortal
|
||||
public static final PropertyEnum<AlfPortalState> ALFPORTAL_STATE = PropertyEnum.create("state", AlfPortalState.class);
|
||||
|
||||
@@ -134,9 +119,6 @@ public final class BotaniaStateProps {
|
||||
// BlockEnchanter
|
||||
public static final PropertyEnum<EnumFacing.Axis> ENCHANTER_DIRECTION = PropertyEnum.create("facing", EnumFacing.Axis.class, Predicates.not(Predicates.equalTo(EnumFacing.Axis.Y)));
|
||||
|
||||
// BlockEndStoneBrick
|
||||
public static final PropertyEnum<EndBrickVariant> ENDBRICK_VARIANT = PropertyEnum.create("variant", EndBrickVariant.class);
|
||||
|
||||
// BlockForestDrum
|
||||
public static final PropertyEnum<DrumVariant> DRUM_VARIANT = PropertyEnum.create("variant", DrumVariant.class);
|
||||
|
||||
@@ -188,9 +170,6 @@ public final class BotaniaStateProps {
|
||||
// BlockPrism
|
||||
public static final PropertyBool HAS_LENS = PropertyBool.create("has_lens");
|
||||
|
||||
// BlockPrismarine
|
||||
public static final PropertyEnum<PrismarineVariant> PRISMARINE_VARIANT = PropertyEnum.create("variant", PrismarineVariant.class);
|
||||
|
||||
// BlockPylon
|
||||
public static final PropertyEnum<PylonVariant> PYLON_VARIANT = PropertyEnum.create("variant", PylonVariant.class);
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.api.state.enums;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EndBrickVariant implements IStringSerializable {
|
||||
END_STONE_BRICKS,
|
||||
CHISELED_END_STONE_BRICKS,
|
||||
ENDER_BRICKS,
|
||||
PILLAR_ENDER_BRICKS;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.api.state.enums;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum FutureStoneVariant implements IStringSerializable {
|
||||
ANDESITE,
|
||||
BASALT,
|
||||
DIORITE,
|
||||
GRANITE,
|
||||
POLISHED_ANDESITE,
|
||||
POLISHED_BASALT,
|
||||
POLISHED_DIORITE,
|
||||
POLISHED_GRANITE,
|
||||
ANDESITE_BRICK,
|
||||
BASALT_BRICK,
|
||||
DIORITE_BRICK,
|
||||
GRANITE_BRICK,
|
||||
CHISELED_ANDESITE,
|
||||
CHISELED_BASALT,
|
||||
CHISELED_DIORITE,
|
||||
CHISELED_GRANITE;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* This class was created by <williewillus>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
* <p>
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.api.state.enums;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum PrismarineVariant implements IStringSerializable {
|
||||
PRISMARINE,
|
||||
PRISMARINE_BRICKS,
|
||||
DARK_PRISMARINE;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -52,6 +52,14 @@ public class SubTileEntity {
|
||||
public static final String TAG_TYPE = "type";
|
||||
public static final String TAG_TICKS_EXISTED = "ticksExisted";
|
||||
|
||||
public final BlockPos getPos() {
|
||||
return supertile.getPos();
|
||||
}
|
||||
|
||||
public final World getWorld() {
|
||||
return supertile.getWorld();
|
||||
}
|
||||
|
||||
public void setSupertile(TileEntity tile) {
|
||||
supertile = tile;
|
||||
}
|
||||
@@ -120,9 +128,7 @@ public class SubTileEntity {
|
||||
/**
|
||||
* Called when this sub tile is placed in the world (by an entity).
|
||||
*/
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||
// NO-OP
|
||||
}
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {}
|
||||
|
||||
/**
|
||||
* Called when a player right clicks this sub tile.
|
||||
@@ -132,16 +138,12 @@ public class SubTileEntity {
|
||||
/**
|
||||
* Called when this sub tile is added to the world.
|
||||
*/
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
||||
//NO-OP
|
||||
}
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {}
|
||||
|
||||
/**
|
||||
* Called when this sub tile is harvested
|
||||
*/
|
||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
//NO-OP
|
||||
}
|
||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {}
|
||||
|
||||
/**
|
||||
* Allows additional processing of sub tile drops
|
||||
@@ -201,15 +203,13 @@ public class SubTileEntity {
|
||||
* Used to render a HUD portraying some data from this sub tile.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
// NO-OP
|
||||
}
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {}
|
||||
|
||||
/**
|
||||
* Gets the light value for this SubTileEntity, this is a int (-1 to default to the flower)
|
||||
*/
|
||||
public int getLightValue() {
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,6 +12,7 @@ package vazkii.botania.api.subtile;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -19,7 +20,8 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.internal.IManaNetwork;
|
||||
import vazkii.botania.api.mana.IManaPool;
|
||||
@@ -32,7 +34,7 @@ import java.awt.*;
|
||||
*/
|
||||
public class SubTileFunctional extends SubTileEntity {
|
||||
|
||||
public static final int RANGE = 10;
|
||||
public static final int LINK_RANGE = 10;
|
||||
|
||||
private static final String TAG_MANA = "mana";
|
||||
|
||||
@@ -115,7 +117,7 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
IManaNetwork network = BotaniaAPI.internalHandler.getManaNetworkInstance();
|
||||
int size = network.getAllPoolsInWorld(supertile.getWorld()).size();
|
||||
if(BotaniaAPI.internalHandler.shouldForceCheck() || size != sizeLastCheck) {
|
||||
linkedPool = network.getClosestPool(supertile.getPos(), supertile.getWorld(), RANGE);
|
||||
linkedPool = network.getClosestPool(supertile.getPos(), supertile.getWorld(), LINK_RANGE);
|
||||
sizeLastCheck = size;
|
||||
}
|
||||
}
|
||||
@@ -211,9 +213,10 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
return linkedPool != null && linkedPool.hasWorldObj() && !linkedPool.isInvalid() && supertile.getWorld().isBlockLoaded(linkedPool.getPos(), false) && supertile.getWorld().getTileEntity(linkedPool.getPos()) == linkedPool;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
String name = I18n.translateToLocal("tile.botania:flower." + getUnlocalizedName() + ".name");
|
||||
String name = I18n.format("tile.botania:flower." + getUnlocalizedName() + ".name");
|
||||
int color = getColor();
|
||||
BotaniaAPI.internalHandler.drawComplexManaHUD(color, knownMana, getMaxMana(), name, res, BotaniaAPI.internalHandler.getBindDisplayForFlowerType(this), isValidBinding());
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -23,8 +24,9 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.internal.IManaNetwork;
|
||||
import vazkii.botania.api.mana.IManaCollector;
|
||||
@@ -38,7 +40,7 @@ import java.util.List;
|
||||
*/
|
||||
public class SubTileGenerating extends SubTileEntity {
|
||||
|
||||
public static final int RANGE = 6;
|
||||
public static final int LINK_RANGE = 6;
|
||||
|
||||
private static final String TAG_MANA = "mana";
|
||||
|
||||
@@ -140,7 +142,7 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
IManaNetwork network = BotaniaAPI.internalHandler.getManaNetworkInstance();
|
||||
int size = network.getAllCollectorsInWorld(supertile.getWorld()).size();
|
||||
if(BotaniaAPI.internalHandler.shouldForceCheck() || size != sizeLastCheck) {
|
||||
linkedCollector = network.getClosestCollector(supertile.getPos(), supertile.getWorld(), RANGE);
|
||||
linkedCollector = network.getClosestCollector(supertile.getPos(), supertile.getWorld(), LINK_RANGE);
|
||||
sizeLastCheck = size;
|
||||
}
|
||||
}
|
||||
@@ -302,9 +304,10 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
return linkedCollector != null && !linkedCollector.isInvalid() && supertile.getWorld().getTileEntity(linkedCollector.getPos()) == linkedCollector;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
String name = I18n.translateToLocal("tile.botania:flower." + getUnlocalizedName() + ".name");
|
||||
String name = I18n.format("tile.botania:flower." + getUnlocalizedName() + ".name");
|
||||
int color = getColor();
|
||||
BotaniaAPI.internalHandler.drawComplexManaHUD(color, knownMana, getMaxMana(), name, res, BotaniaAPI.internalHandler.getBindDisplayForFlowerType(this), isValidBinding());
|
||||
}
|
||||
|
||||
@@ -37,8 +37,6 @@ public abstract class SubTileSignature {
|
||||
/**
|
||||
* Adds additional text to the tooltip. This text is added after getUnlocalizedLoreTextForStack.
|
||||
*/
|
||||
public void addTooltip(ItemStack stack, EntityPlayer player, List<String> tooltip) {
|
||||
// NO-OP
|
||||
}
|
||||
public void addTooltip(ItemStack stack, EntityPlayer player, List<String> tooltip) {}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,8 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Any block that implements this has a HUD rendered when being hovered
|
||||
@@ -21,6 +23,7 @@ import net.minecraft.world.World;
|
||||
*/
|
||||
public interface IWandHUD {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos);
|
||||
|
||||
}
|
||||
@@ -17,7 +17,7 @@ public enum EnumChallengeLevel {
|
||||
HARD("botania.challengelevel.hard"),
|
||||
LUNATIC("botania.challengelevel.lunatic");
|
||||
|
||||
String name;
|
||||
final String name;
|
||||
|
||||
private EnumChallengeLevel(String name) {
|
||||
this.name = name;
|
||||
|
||||
@@ -38,7 +38,7 @@ import javax.annotation.Nonnull;
|
||||
public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(@Nonnull EntityPlayer player, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
|
||||
public void doRenderLayer(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
if(!ConfigHandler.renderBaubles || player.getActivePotionEffect(MobEffects.INVISIBILITY) != null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -25,20 +25,21 @@ import vazkii.botania.client.lib.LibResources;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
public final class BossBarHandler {
|
||||
|
||||
private BossBarHandler() {}
|
||||
|
||||
// Only access on the client thread!
|
||||
public static final Set<IBotaniaBoss> bosses = Collections.newSetFromMap(new WeakHashMap<>());
|
||||
public static final ResourceLocation defaultBossBar = new ResourceLocation(LibResources.GUI_BOSS_BAR);
|
||||
private static final BarCallback barUniformCallback = new BarCallback();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBarRender(RenderGameOverlayEvent.BossInfo evt) {
|
||||
public static void onBarRender(RenderGameOverlayEvent.BossInfo evt) {
|
||||
UUID infoUuid = evt.getBossInfo().getUniqueId();
|
||||
for(IBotaniaBoss currentBoss : bosses) {
|
||||
if(currentBoss.getBossInfoUuid().equals(infoUuid)) {
|
||||
|
||||
@@ -22,8 +22,8 @@ public class BotaniaPlayerController extends PlayerControllerMP implements IExte
|
||||
|
||||
private float distance = 0F;
|
||||
|
||||
public BotaniaPlayerController(Minecraft p_i45062_1_, NetHandlerPlayClient p_i45062_2_) {
|
||||
super(p_i45062_1_, p_i45062_2_);
|
||||
public BotaniaPlayerController(Minecraft mc, NetHandlerPlayClient netHandler) {
|
||||
super(mc, netHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,10 +39,12 @@ import java.util.List;
|
||||
|
||||
public final class BoundTileRenderer {
|
||||
|
||||
private BoundTileRenderer() {}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
public static void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
GlStateManager.pushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.enableBlend();
|
||||
@@ -89,11 +91,11 @@ public final class BoundTileRenderer {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
private void renderBlockOutlineAt(BlockPos pos, int color) {
|
||||
private static void renderBlockOutlineAt(BlockPos pos, int color) {
|
||||
renderBlockOutlineAt(pos, color, 1F);
|
||||
}
|
||||
|
||||
private void renderBlockOutlineAt(BlockPos pos, int color, float thickness) {
|
||||
private static void renderBlockOutlineAt(BlockPos pos, int color, float thickness) {
|
||||
double renderPosX, renderPosY, renderPosZ;
|
||||
|
||||
try {
|
||||
@@ -140,7 +142,7 @@ public final class BoundTileRenderer {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
private void renderBlockOutline(AxisAlignedBB aabb) {
|
||||
private static void renderBlockOutline(AxisAlignedBB aabb) {
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
|
||||
double ix = aabb.minX;
|
||||
|
||||
@@ -3,8 +3,8 @@ package vazkii.botania.client.core.handler;
|
||||
import com.google.common.base.Throwables;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
@@ -15,11 +15,7 @@ import java.lang.reflect.Method;
|
||||
public final class ClientMethodHandles {
|
||||
|
||||
public static final MethodHandle
|
||||
renderPosX_getter, renderPosY_getter, renderPosZ_getter, // RenderManager
|
||||
farPlaneDistance_getter,
|
||||
hurtCameraEffect, setupViewBobbing, getFOVModifier,
|
||||
enableLightmap, disableLightmap; // EntityRenderer
|
||||
//prevEquippedProgress_getter, equippedProgress_getter; // ItemRenderer
|
||||
renderPosX_getter, renderPosY_getter, renderPosZ_getter; // RenderManager
|
||||
|
||||
static {
|
||||
try {
|
||||
@@ -34,40 +30,8 @@ public final class ClientMethodHandles {
|
||||
f = ReflectionHelper.findField(RenderManager.class, LibObfuscation.RENDERPOSZ);
|
||||
f.setAccessible(true);
|
||||
renderPosZ_getter = MethodHandles.publicLookup().unreflectGetter(f);
|
||||
|
||||
f = ReflectionHelper.findField(EntityRenderer.class, LibObfuscation.FAR_PLANE_DISTANCE);
|
||||
f.setAccessible(true);
|
||||
farPlaneDistance_getter = MethodHandles.publicLookup().unreflectGetter(f);
|
||||
|
||||
Method m = ReflectionHelper.findMethod(EntityRenderer.class, null, LibObfuscation.HURT_CAMERA_EFFECT, float.class);
|
||||
m.setAccessible(true);
|
||||
hurtCameraEffect = MethodHandles.publicLookup().unreflect(m);
|
||||
|
||||
m = ReflectionHelper.findMethod(EntityRenderer.class, null, LibObfuscation.SETUP_VIEW_BOBBING, float.class);
|
||||
m.setAccessible(true);
|
||||
setupViewBobbing = MethodHandles.publicLookup().unreflect(m);
|
||||
|
||||
m = ReflectionHelper.findMethod(EntityRenderer.class, null, LibObfuscation.ENABLE_LIGHTMAP);
|
||||
m.setAccessible(true);
|
||||
enableLightmap = MethodHandles.publicLookup().unreflect(m);
|
||||
|
||||
m = ReflectionHelper.findMethod(EntityRenderer.class, null, LibObfuscation.DISABLE_LIGHTMAP);
|
||||
m.setAccessible(true);
|
||||
disableLightmap = MethodHandles.publicLookup().unreflect(m);
|
||||
|
||||
m = ReflectionHelper.findMethod(EntityRenderer.class, null, LibObfuscation.GET_FOV_MODIFIER, float.class, boolean.class);
|
||||
m.setAccessible(true);
|
||||
getFOVModifier = MethodHandles.publicLookup().unreflect(m);
|
||||
|
||||
// f = ReflectionHelper.findField(ItemRenderer.class, LibObfuscation.PREV_EQUIPPED_PROGRESS);
|
||||
// f.setAccessible(true);
|
||||
// prevEquippedProgress_getter = MethodHandles.publicLookup().unreflectGetter(f);
|
||||
//
|
||||
// f = ReflectionHelper.findField(ItemRenderer.class, LibObfuscation.EQUIPPED_PROGRESS);
|
||||
// f.setAccessible(true);
|
||||
// equippedProgress_getter = MethodHandles.publicLookup().unreflectGetter(f);
|
||||
} catch (IllegalAccessException e) {
|
||||
FMLLog.severe("[Botania]: Couldn't initialize client methodhandles! Things will be broken!");
|
||||
Botania.LOGGER.fatal("Couldn't initialize client methodhandles! Things will be broken!");
|
||||
e.printStackTrace();
|
||||
throw Throwables.propagate(e);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent;
|
||||
import vazkii.botania.api.mana.IManaCollector;
|
||||
import vazkii.botania.api.mana.TileSignature;
|
||||
import vazkii.botania.client.core.handler.LightningHandler.LightningBolt;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileVinculotus;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
|
||||
@@ -29,7 +28,9 @@ import vazkii.botania.common.core.handler.ManaNetworkHandler;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
public class ClientTickHandler {
|
||||
public final class ClientTickHandler {
|
||||
|
||||
private ClientTickHandler() {}
|
||||
|
||||
public static int ticksWithLexicaOpen = 0;
|
||||
public static int pageFlipTicks = 0;
|
||||
@@ -38,26 +39,24 @@ public class ClientTickHandler {
|
||||
public static float delta = 0;
|
||||
public static float total = 0;
|
||||
|
||||
private void calcDelta() {
|
||||
private static void calcDelta() {
|
||||
float oldTotal = total;
|
||||
total = ticksInGame + partialTicks;
|
||||
delta = total - oldTotal;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void renderTick(RenderTickEvent event) {
|
||||
public static void renderTick(RenderTickEvent event) {
|
||||
if(event.phase == Phase.START)
|
||||
partialTicks = event.renderTickTime;
|
||||
else {
|
||||
TooltipAdditionDisplayHandler.render();
|
||||
calcDelta();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void clientTickEnd(ClientTickEvent event) {
|
||||
public static void clientTickEnd(ClientTickEvent event) {
|
||||
if(event.phase == Phase.END) {
|
||||
LightningBolt.update();
|
||||
RedStringRenderer.tick();
|
||||
ItemsRemainingRenderHandler.tick();
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fml.common.registry.RegistryDelegate;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
@@ -25,6 +26,7 @@ import vazkii.botania.common.item.IColorable;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.awt.*;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -39,25 +41,17 @@ public final class ColorHandler {
|
||||
|
||||
// 16 colors
|
||||
blocks.registerBlockColorHandler(
|
||||
new IBlockColor() {
|
||||
@Override
|
||||
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess p_186720_2_, BlockPos pos, int tintIndex) {
|
||||
return state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
|
||||
}
|
||||
},
|
||||
(state, world, pos, tintIndex) -> state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue,
|
||||
ModBlocks.specialFlower, ModBlocks.manaBeacon, ModBlocks.petalBlock, ModBlocks.unstableBlock);
|
||||
|
||||
// Pool
|
||||
blocks.registerBlockColorHandler(
|
||||
new IBlockColor() {
|
||||
@Override
|
||||
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess p_186720_2_, BlockPos pos, int tintIndex) {
|
||||
if (state.getValue(BotaniaStateProps.POOL_VARIANT) == PoolVariant.FABULOUS) {
|
||||
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
|
||||
return Color.getHSBColor(time * 0.005F, 0.6F, 1F).hashCode();
|
||||
} else {
|
||||
return state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
|
||||
}
|
||||
(state, world, pos, tintIndex) -> {
|
||||
if (state.getValue(BotaniaStateProps.POOL_VARIANT) == PoolVariant.FABULOUS) {
|
||||
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
|
||||
return Color.HSBtoRGB(time * 0.005F, 0.6F, 1F);
|
||||
} else {
|
||||
return state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
|
||||
}
|
||||
},
|
||||
ModBlocks.pool
|
||||
@@ -65,45 +59,40 @@ public final class ColorHandler {
|
||||
|
||||
// Spreader
|
||||
blocks.registerBlockColorHandler(
|
||||
new IBlockColor() {
|
||||
@Override
|
||||
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess p_186720_2_, BlockPos pos, int tintIndex) {
|
||||
if(state.getValue(BotaniaStateProps.SPREADER_VARIANT) != SpreaderVariant.GAIA)
|
||||
return 0xFFFFFF;
|
||||
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
|
||||
return Color.getHSBColor((time * 5) % 360 / 360F, 0.4F, 0.9F).hashCode();
|
||||
}
|
||||
(state, world, pos, tintIndex) -> {
|
||||
if(state.getValue(BotaniaStateProps.SPREADER_VARIANT) != SpreaderVariant.GAIA)
|
||||
return 0xFFFFFF;
|
||||
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
|
||||
return Color.HSBtoRGB((time * 5) % 360 / 360F, 0.4F, 0.9F);
|
||||
},
|
||||
ModBlocks.spreader
|
||||
);
|
||||
|
||||
// Platforms
|
||||
blocks.registerBlockColorHandler(
|
||||
new IBlockColor() {
|
||||
@Override
|
||||
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex) {
|
||||
(state, world, pos, tintIndex) -> {
|
||||
if (world != null && pos != null) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileCamo) {
|
||||
TileCamo camo = (TileCamo) tile;
|
||||
IBlockState camoState = camo.camoState;
|
||||
if(camoState != null)
|
||||
return camoState.getBlock() instanceof BlockCamo ? 0xFFFFFF : Minecraft.getMinecraft().getBlockColors().colorMultiplier(camoState, world, pos, tintIndex);
|
||||
return camoState.getBlock() instanceof BlockCamo
|
||||
? 0xFFFFFF
|
||||
: Minecraft.getMinecraft().getBlockColors().colorMultiplier(camoState, world, pos, tintIndex);
|
||||
}
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
return 0xFFFFFF;
|
||||
}, ModBlocks.platform);
|
||||
|
||||
ItemColors items = Minecraft.getMinecraft().getItemColors();
|
||||
|
||||
items.registerItemColorHandler(new IItemColor() {
|
||||
@Override
|
||||
public int getColorFromItemstack(@Nonnull ItemStack stack, int tintIndex) {
|
||||
Item item = stack.getItem();
|
||||
if (item instanceof IColorable) {
|
||||
return ((IColorable) item).getColorFromItemStack(stack, tintIndex);
|
||||
} else {
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
items.registerItemColorHandler((stack, tintIndex) -> {
|
||||
Item item = stack.getItem();
|
||||
if (item instanceof IColorable) {
|
||||
return ((IColorable) item).getColorFromItemStack(stack, tintIndex);
|
||||
} else {
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
}, ModItems.manaResource, ModItems.twigWand, ModItems.dye, ModItems.petal, ModItems.manaGun, ModItems.manaMirror, ModItems.manaTablet, ModItems.signalFlare,
|
||||
ModItems.spellCloth, ModItems.brewFlask, ModItems.brewVial, ModItems.incenseStick, ModItems.bloodPendant, ModItems.enderDagger,
|
||||
|
||||
@@ -19,13 +19,15 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EnumPlayerModelParts;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.BotaniaAPIClient;
|
||||
import vazkii.botania.api.item.IBaubleRender.Helper;
|
||||
import vazkii.botania.api.subtile.signature.SubTileSignature;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.core.version.VersionChecker;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
@@ -43,10 +45,10 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
|
||||
public volatile static Map<String, ItemStack> flowerMap = null;
|
||||
private volatile static boolean startedLoading = false;
|
||||
|
||||
public static final boolean phi = false;
|
||||
private static final boolean phi = false;
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(@Nonnull EntityPlayer player, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
|
||||
public void doRenderLayer(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
String name = player.getDisplayName().getUnformattedText();
|
||||
|
||||
float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks;
|
||||
@@ -97,9 +99,7 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
|
||||
throw new NumberFormatException();
|
||||
flowerMap.put(key, new ItemStack(ModBlocks.flower, 1, i));
|
||||
} catch(NumberFormatException e) {
|
||||
SubTileSignature sig = BotaniaAPI.getSignatureForName(value);
|
||||
if(sig != null)
|
||||
flowerMap.put(key, ItemBlockSpecialFlower.ofType(value));
|
||||
flowerMap.put(key, ItemBlockSpecialFlower.ofType(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -205,7 +205,7 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
|
||||
load(props);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
FMLLog.info("[Botania] Could not load contributors list. Either you're offline or github is down. Nothing to worry about, carry on~");
|
||||
Botania.LOGGER.info("Could not load contributors list. Either you're offline or github is down. Nothing to worry about, carry on~");
|
||||
}
|
||||
VersionChecker.doneChecking = true;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class CorporeaAutoCompleteHandler {
|
||||
private List<CompletionData> completions = new ArrayList<>();
|
||||
private int position;
|
||||
|
||||
static TreeSet<String> itemNames = new TreeSet<>(String::compareToIgnoreCase);
|
||||
static final TreeSet<String> itemNames = new TreeSet<>(String::compareToIgnoreCase);
|
||||
|
||||
private boolean tabLastTick = false;
|
||||
|
||||
@@ -165,8 +165,8 @@ public class CorporeaAutoCompleteHandler {
|
||||
|
||||
private static class CompletionData implements Comparable<CompletionData> {
|
||||
|
||||
private String string;
|
||||
private int prefixLength;
|
||||
private final String string;
|
||||
private final int prefixLength;
|
||||
|
||||
public CompletionData(String string, int prefixLength) {
|
||||
this.string = string;
|
||||
|
||||
@@ -10,12 +10,17 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import org.lwjgl.opengl.ARBFragmentShader;
|
||||
import org.lwjgl.opengl.ContextCapabilities;
|
||||
@@ -27,17 +32,20 @@ import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.handler.ManaNetworkHandler;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class DebugHandler {
|
||||
|
||||
private DebugHandler() {}
|
||||
|
||||
private static final String PREFIX = TextFormatting.GREEN + "[Botania] " + TextFormatting.RESET;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDrawDebugText(RenderGameOverlayEvent.Text event) {
|
||||
public static void onDrawDebugText(RenderGameOverlayEvent.Text event) {
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
if(Minecraft.getMinecraft().gameSettings.showDebugInfo) {
|
||||
event.getLeft().add(null);
|
||||
event.getLeft().add("");
|
||||
String version = LibMisc.VERSION;
|
||||
if(version.contains("GRADLE"))
|
||||
version = "N/A";
|
||||
@@ -68,6 +76,23 @@ public final class DebugHandler {
|
||||
event.getLeft().add(" GL_ARB_multitexture: " + caps.GL_ARB_multitexture);
|
||||
event.getLeft().add(" GL_ARB_texture_non_power_of_two: " + caps.GL_ARB_texture_non_power_of_two);
|
||||
event.getLeft().add(" OpenGL13: " + caps.OpenGL13);
|
||||
|
||||
if (Minecraft.getMinecraft().objectMouseOver != null
|
||||
&& Minecraft.getMinecraft().objectMouseOver.getBlockPos() != null) {
|
||||
BlockPos pos = Minecraft.getMinecraft().objectMouseOver.getBlockPos();
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
state = state.getActualState(world, pos);
|
||||
state = state.getBlock().getExtendedState(state, world, pos);
|
||||
if (state instanceof IExtendedBlockState) {
|
||||
try {
|
||||
for (Map.Entry<IUnlistedProperty<?>, Optional<?>> e : ((IExtendedBlockState) state).getUnlistedProperties().entrySet()) {
|
||||
event.getRight().add(TextFormatting.LIGHT_PURPLE + e.getKey().getName() + ": " + TextFormatting.RESET + e.getValue().orNull());
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
event.getRight().add("Error getting extended state");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(Minecraft.IS_RUNNING_ON_MAC)
|
||||
event.getLeft().add(PREFIX + "SHIFT+CMD for context");
|
||||
else event.getLeft().add(PREFIX + "SHIFT+CTRL for context");
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.client.gui.GuiChat;
|
||||
import net.minecraft.client.gui.GuiIngame;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -30,14 +31,12 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.ILexicon;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -71,10 +70,12 @@ import java.awt.*;
|
||||
|
||||
public final class HUDHandler {
|
||||
|
||||
private HUDHandler() {}
|
||||
|
||||
public static final ResourceLocation manaBar = new ResourceLocation(LibResources.GUI_MANA_HUD);
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public void onDrawScreenPre(RenderGameOverlayEvent.Pre event) {
|
||||
public static void onDrawScreenPre(RenderGameOverlayEvent.Pre event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Profiler profiler = mc.mcProfiler;
|
||||
|
||||
@@ -91,7 +92,7 @@ public final class HUDHandler {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDrawScreenPost(RenderGameOverlayEvent.Post event) {
|
||||
public static void onDrawScreenPost(RenderGameOverlayEvent.Post event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Profiler profiler = mc.mcProfiler;
|
||||
ItemStack main = mc.thePlayer.getHeldItemMainhand();
|
||||
@@ -137,15 +138,19 @@ public final class HUDHandler {
|
||||
|
||||
if(MultiblockRenderHandler.currentMultiblock != null && MultiblockRenderHandler.anchor == null) {
|
||||
profiler.startSection("multiblockRightClick");
|
||||
String s = I18n.translateToLocal("botaniamisc.rightClickToAnchor");
|
||||
String s = I18n.format("botaniamisc.rightClickToAnchor");
|
||||
mc.fontRendererObj.drawStringWithShadow(s, event.getResolution().getScaledWidth() / 2 - mc.fontRendererObj.getStringWidth(s) / 2, event.getResolution().getScaledHeight() / 2 - 30, 0xFFFFFF);
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
if(main != null && main.getItem() instanceof ItemCraftingHalo) {
|
||||
profiler.startSection("craftingHalo");
|
||||
profiler.startSection("craftingHalo_main");
|
||||
ItemCraftingHalo.renderHUD(event.getResolution(), mc.thePlayer, main);
|
||||
profiler.endSection();
|
||||
} else if(offhand != null && offhand.getItem() instanceof ItemCraftingHalo) {
|
||||
profiler.startSection("craftingHalo_off");
|
||||
ItemCraftingHalo.renderHUD(event.getResolution(), mc.thePlayer, offhand);
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
if(main != null && main.getItem() instanceof ItemSextant) {
|
||||
@@ -167,44 +172,47 @@ public final class HUDHandler {
|
||||
}
|
||||
|
||||
profiler.startSection("manaBar");
|
||||
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
int totalMana = 0;
|
||||
int totalMaxMana = 0;
|
||||
boolean anyRequest = false;
|
||||
boolean creative = false;
|
||||
if(!player.isSpectator()) {
|
||||
int totalMana = 0;
|
||||
int totalMaxMana = 0;
|
||||
boolean anyRequest = false;
|
||||
boolean creative = false;
|
||||
|
||||
IInventory mainInv = player.inventory;
|
||||
IInventory baublesInv = PlayerHandler.getPlayerBaubles(player);
|
||||
IInventory mainInv = player.inventory;
|
||||
IInventory baublesInv = PlayerHandler.getPlayerBaubles(player);
|
||||
|
||||
int invSize = mainInv.getSizeInventory();
|
||||
int size = invSize;
|
||||
if(baublesInv != null)
|
||||
size += baublesInv.getSizeInventory();
|
||||
int invSize = mainInv.getSizeInventory();
|
||||
int size = invSize;
|
||||
if(baublesInv != null)
|
||||
size += baublesInv.getSizeInventory();
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
boolean useBaubles = i >= invSize;
|
||||
IInventory inv = useBaubles ? baublesInv : mainInv;
|
||||
ItemStack stack = inv.getStackInSlot(i - (useBaubles ? invSize : 0));
|
||||
for(int i = 0; i < size; i++) {
|
||||
boolean useBaubles = i >= invSize;
|
||||
IInventory inv = useBaubles ? baublesInv : mainInv;
|
||||
ItemStack stack = inv.getStackInSlot(i - (useBaubles ? invSize : 0));
|
||||
|
||||
if(stack != null) {
|
||||
Item item = stack.getItem();
|
||||
if(item instanceof IManaUsingItem)
|
||||
anyRequest = anyRequest || ((IManaUsingItem) item).usesMana(stack);
|
||||
if(stack != null) {
|
||||
Item item = stack.getItem();
|
||||
if(item instanceof IManaUsingItem)
|
||||
anyRequest = anyRequest || ((IManaUsingItem) item).usesMana(stack);
|
||||
|
||||
if(item instanceof IManaItem) {
|
||||
if(!((IManaItem) item).isNoExport(stack)) {
|
||||
totalMana += ((IManaItem) item).getMana(stack);
|
||||
totalMaxMana += ((IManaItem) item).getMaxMana(stack);
|
||||
if(item instanceof IManaItem) {
|
||||
if(!((IManaItem) item).isNoExport(stack)) {
|
||||
totalMana += ((IManaItem) item).getMana(stack);
|
||||
totalMaxMana += ((IManaItem) item).getMaxMana(stack);
|
||||
}
|
||||
}
|
||||
|
||||
if(item instanceof ICreativeManaProvider && ((ICreativeManaProvider) item).isCreative(stack))
|
||||
creative = true;
|
||||
}
|
||||
|
||||
if(item instanceof ICreativeManaProvider && ((ICreativeManaProvider) item).isCreative(stack))
|
||||
creative = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(anyRequest)
|
||||
renderManaInvBar(event.getResolution(), creative, totalMana, totalMaxMana);
|
||||
if(anyRequest)
|
||||
renderManaInvBar(event.getResolution(), creative, totalMana, totalMaxMana);
|
||||
}
|
||||
|
||||
profiler.endStartSection("itemsRemaining");
|
||||
ItemsRemainingRenderHandler.render(event.getResolution(), event.getPartialTicks());
|
||||
@@ -215,7 +223,7 @@ public final class HUDHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private void renderWandModeDisplay(ItemStack stack, ScaledResolution res) {
|
||||
private static void renderWandModeDisplay(ItemStack stack, ScaledResolution res) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Profiler profiler = mc.mcProfiler;
|
||||
|
||||
@@ -225,7 +233,7 @@ public final class HUDHandler {
|
||||
if(ticks > 0) {
|
||||
int alpha = Math.min(255, (int) (ticks * 256.0F / 10.0F));
|
||||
int color = 0x00CC00 + (alpha << 24);
|
||||
String disp = I18n.translateToLocal(ItemTwigWand.getModeString(stack));
|
||||
String disp = I18n.format(ItemTwigWand.getModeString(stack));
|
||||
|
||||
int x = res.getScaledWidth() / 2 - mc.fontRendererObj.getStringWidth(disp) / 2;
|
||||
int y = res.getScaledHeight() - 70;
|
||||
@@ -238,7 +246,7 @@ public final class HUDHandler {
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
private void renderManaInvBar(ScaledResolution res, boolean hasCreative, int totalMana, int totalMaxMana) {
|
||||
private static void renderManaInvBar(ScaledResolution res, boolean hasCreative, int totalMana, int totalMaxMana) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
int width = 182;
|
||||
int x = res.getScaledWidth() / 2 - width / 2;
|
||||
@@ -267,46 +275,39 @@ public final class HUDHandler {
|
||||
GL11.glColor4ub(((byte) 255), ((byte) 255), ((byte) 255), ((byte) 255));
|
||||
}
|
||||
|
||||
private void renderPoolRecipeHUD(ScaledResolution res, TilePool tile, ItemStack stack) {
|
||||
private static void renderPoolRecipeHUD(ScaledResolution res, TilePool tile, ItemStack stack) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Profiler profiler = mc.mcProfiler;
|
||||
|
||||
profiler.startSection("poolRecipe");
|
||||
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
|
||||
if(recipe.matches(stack)) {
|
||||
if(recipe.getCatalyst() == null || recipe.getCatalyst() == tile.getWorld().getBlockState(tile.getPos().down())) {
|
||||
int x = res.getScaledWidth() / 2 - 11;
|
||||
int y = res.getScaledHeight() / 2 + 10;
|
||||
RecipeManaInfusion recipe = TilePool.getMatchingRecipe(stack, tile.getWorld().getBlockState(tile.getPos().down()));
|
||||
if(recipe != null) {
|
||||
int x = res.getScaledWidth() / 2 - 11;
|
||||
int y = res.getScaledHeight() / 2 + 10;
|
||||
|
||||
int u = tile.getCurrentMana() >= recipe.getManaToConsume() ? 0 : 22;
|
||||
int v = mc.thePlayer.getName().equals("haighyorkie") && mc.thePlayer.isSneaking() ? 23 : 8;
|
||||
int u = tile.getCurrentMana() >= recipe.getManaToConsume() ? 0 : 22;
|
||||
int v = mc.thePlayer.getName().equals("haighyorkie") && mc.thePlayer.isSneaking() ? 23 : 8;
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
mc.renderEngine.bindTexture(manaBar);
|
||||
RenderHelper.drawTexturedModalRect(x, y, 0, u, v, 22, 15);
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
mc.renderEngine.bindTexture(manaBar);
|
||||
RenderHelper.drawTexturedModalRect(x, y, 0, u, v, 22, 15);
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(stack, x - 20, y);
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(recipe.getOutput(), x + 26, y);
|
||||
mc.getRenderItem().renderItemOverlayIntoGUI(mc.fontRendererObj, recipe.getOutput(), x + 26, y, "");
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(stack, x - 20, y);
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(recipe.getOutput(), x + 26, y);
|
||||
mc.getRenderItem().renderItemOverlayIntoGUI(mc.fontRendererObj, recipe.getOutput(), x + 26, y, "");
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableBlend();
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
private void renderCrystalCubeHUD(ScaledResolution res, TileCorporeaCrystalCube tile) {
|
||||
private static void renderCrystalCubeHUD(ScaledResolution res, TileCorporeaCrystalCube tile) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Profiler profiler = mc.mcProfiler;
|
||||
|
||||
@@ -332,7 +333,7 @@ public final class HUDHandler {
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
private void drawLexiconHUD(ItemStack stack, IBlockState state, RayTraceResult pos, ScaledResolution res) {
|
||||
private static void drawLexiconHUD(ItemStack stack, IBlockState state, RayTraceResult pos, ScaledResolution res) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Block block = state.getBlock();
|
||||
Profiler profiler = mc.mcProfiler;
|
||||
@@ -354,8 +355,8 @@ public final class HUDHandler {
|
||||
if(!((ILexicon) stack.getItem()).isKnowledgeUnlocked(stack, entry.getKnowledgeType()))
|
||||
font = mc.standardGalacticFontRenderer;
|
||||
|
||||
drawStr = I18n.translateToLocal(entry.getUnlocalizedName());
|
||||
secondLine = TextFormatting.ITALIC + I18n.translateToLocal(entry.getTagline());
|
||||
drawStr = I18n.format(entry.getUnlocalizedName());
|
||||
secondLine = TextFormatting.ITALIC + I18n.format(entry.getTagline());
|
||||
draw = true;
|
||||
}
|
||||
}
|
||||
@@ -399,11 +400,11 @@ public final class HUDHandler {
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
private void renderNearIndexDisplay(ScaledResolution res) {
|
||||
private static void renderNearIndexDisplay(ScaledResolution res) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
String txt0 = I18n.translateToLocal("botaniamisc.nearIndex0");
|
||||
String txt1 = TextFormatting.GRAY + I18n.translateToLocal("botaniamisc.nearIndex1");
|
||||
String txt2 = TextFormatting.GRAY + I18n.translateToLocal("botaniamisc.nearIndex2");
|
||||
String txt0 = I18n.format("botaniamisc.nearIndex0");
|
||||
String txt1 = TextFormatting.GRAY + I18n.format("botaniamisc.nearIndex1");
|
||||
String txt2 = TextFormatting.GRAY + I18n.format("botaniamisc.nearIndex2");
|
||||
|
||||
int l = Math.max(mc.fontRendererObj.getStringWidth(txt0), Math.max(mc.fontRendererObj.getStringWidth(txt1), mc.fontRendererObj.getStringWidth(txt2))) + 20;
|
||||
int x = res.getScaledWidth() - l - 20;
|
||||
@@ -436,7 +437,7 @@ public final class HUDHandler {
|
||||
renderManaBar(x, y, color, mana < 0 ? 0.5F : 1F, mana, maxMana);
|
||||
|
||||
if(mana < 0) {
|
||||
String text = I18n.translateToLocal("botaniamisc.statusUnknown");
|
||||
String text = I18n.format("botaniamisc.statusUnknown");
|
||||
x = res.getScaledWidth() / 2 - mc.fontRendererObj.getStringWidth(text) / 2;
|
||||
y -= 1;
|
||||
mc.fontRendererObj.drawString(text, x, y, color);
|
||||
|
||||
@@ -25,8 +25,8 @@ import java.util.regex.Pattern;
|
||||
|
||||
public final class ItemsRemainingRenderHandler {
|
||||
|
||||
private static int maxTicks = 30;
|
||||
private static int leaveTicks = 20;
|
||||
private static final int maxTicks = 30;
|
||||
private static final int leaveTicks = 20;
|
||||
|
||||
private static ItemStack stack;
|
||||
private static int ticks, count;
|
||||
|
||||
@@ -10,51 +10,35 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import gnu.trove.map.hash.TIntIntHashMap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.client.core.handler.LightningHandler.LightningBolt.Segment;
|
||||
import vazkii.botania.client.fx.FXLightning;
|
||||
import vazkii.botania.client.fx.ParticleRenderDispatcher;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
|
||||
public class LightningHandler {
|
||||
|
||||
private LightningHandler() {}
|
||||
|
||||
private static final int BATCH_THRESHOLD = 200;
|
||||
private static final ResourceLocation outsideResource = new ResourceLocation(LibResources.MISC_WISP_LARGE);
|
||||
private static final ResourceLocation insideResource = new ResourceLocation(LibResources.MISC_WISP_SMALL);
|
||||
|
||||
private static Vector3 getRelativeViewVector(Vector3 pos) {
|
||||
Entity renderEntity = Minecraft.getMinecraft().getRenderViewEntity();
|
||||
return new Vector3((float) renderEntity.posX - pos.x, (float) renderEntity.posY + renderEntity.getEyeHeight() - pos.y, (float) renderEntity.posZ - pos.z);
|
||||
}
|
||||
public static final Deque<FXLightning> queuedLightningBolts = new ArrayDeque<>();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderWorldLast(RenderWorldLastEvent event) {
|
||||
public static void onRenderWorldLast(RenderWorldLastEvent event) {
|
||||
Profiler profiler = Minecraft.getMinecraft().mcProfiler;
|
||||
|
||||
profiler.startSection("botania-particles");
|
||||
@@ -83,17 +67,35 @@ public class LightningHandler {
|
||||
ParticleRenderDispatcher.lightningCount = 0;
|
||||
|
||||
render.bindTexture(outsideResource);
|
||||
int counter = 0;
|
||||
|
||||
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
|
||||
for(LightningBolt bolt : LightningBolt.boltlist)
|
||||
renderBolt(bolt, tessellator, frame, ActiveRenderInfo.getRotationX(), ActiveRenderInfo.getRotationXZ(), ActiveRenderInfo.getRotationZ(), ActiveRenderInfo.getRotationXY(), 0, false);
|
||||
for (FXLightning bolt : queuedLightningBolts) {
|
||||
bolt.renderBolt(0, false);
|
||||
if(counter % BATCH_THRESHOLD == BATCH_THRESHOLD - 1) {
|
||||
tessellator.draw();
|
||||
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
tessellator.draw();
|
||||
|
||||
render.bindTexture(insideResource);
|
||||
counter = 0;
|
||||
|
||||
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
|
||||
for(LightningBolt bolt : LightningBolt.boltlist)
|
||||
renderBolt(bolt, tessellator, frame, ActiveRenderInfo.getRotationX(), ActiveRenderInfo.getRotationXZ(), ActiveRenderInfo.getRotationZ(), ActiveRenderInfo.getRotationXY(), 1, true);
|
||||
for (FXLightning bolt : queuedLightningBolts) {
|
||||
bolt.renderBolt(1, true);
|
||||
if(counter % BATCH_THRESHOLD == BATCH_THRESHOLD - 1) {
|
||||
tessellator.draw();
|
||||
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
tessellator.draw();
|
||||
|
||||
queuedLightningBolts.clear();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.depthMask(true);
|
||||
|
||||
@@ -104,386 +106,4 @@ public class LightningHandler {
|
||||
profiler.endSection();
|
||||
|
||||
}
|
||||
|
||||
public static void spawnLightningBolt(World world, Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
|
||||
LightningBolt bolt = new LightningBolt(world, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner);
|
||||
bolt.defaultFractal();
|
||||
bolt.finalizeBolt();
|
||||
LightningBolt.boltlist.add(bolt);
|
||||
}
|
||||
|
||||
private void renderBolt(LightningBolt bolt, Tessellator tessellator, float partialframe, float cosyaw, float cospitch, float sinyaw, float cossinpitch, int pass, boolean inner) {
|
||||
ParticleRenderDispatcher.lightningCount++;
|
||||
float boltage = bolt.particleAge < 0 ? 0 : (float) bolt.particleAge / (float) bolt.particleMaxAge;
|
||||
float mainalpha = 1;
|
||||
if(pass == 0)
|
||||
mainalpha = (1 - boltage) * 0.4F;
|
||||
else mainalpha = 1 - boltage * 0.5F;
|
||||
|
||||
int expandTime = (int) (bolt.length * bolt.speed);
|
||||
|
||||
int renderstart = (int) ((expandTime / 2 - bolt.particleMaxAge + bolt.particleAge) / (float) (expandTime / 2) * bolt.numsegments0);
|
||||
int renderend = (int) ((bolt.particleAge + expandTime) / (float) expandTime * bolt.numsegments0);
|
||||
|
||||
for(Segment rendersegment : bolt.segments) {
|
||||
if(rendersegment.segmentno < renderstart || rendersegment.segmentno > renderend)
|
||||
continue;
|
||||
|
||||
Vector3 playervec = getRelativeViewVector(rendersegment.startpoint.point).multiply(-1);
|
||||
|
||||
double width = 0.025F * (playervec.mag() / 5 + 1) * (1 + rendersegment.light) * 0.5F;
|
||||
|
||||
Vector3 diff1 = playervec.copy().crossProduct(rendersegment.prevdiff).normalize().multiply(width / rendersegment.sinprev);
|
||||
Vector3 diff2 = playervec.copy().crossProduct(rendersegment.nextdiff).normalize().multiply(width / rendersegment.sinnext);
|
||||
|
||||
Vector3 startvec = rendersegment.startpoint.point;
|
||||
Vector3 endvec = rendersegment.endpoint.point;
|
||||
|
||||
int color = inner ? bolt.colorInner : bolt.colorOuter;
|
||||
int r = (color & 0xFF0000) >> 16;
|
||||
int g = (color & 0xFF00) >> 8;
|
||||
int b = (color & 0xFF);
|
||||
int a = (int) (mainalpha * rendersegment.light * new Color(color).getAlpha());
|
||||
|
||||
tessellator.getBuffer().pos(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
tessellator.getBuffer().pos(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
tessellator.getBuffer().pos(startvec.x + diff1.x, startvec.y + diff1.y, startvec.z + diff1.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
tessellator.getBuffer().pos(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
|
||||
if(rendersegment.next == null) {
|
||||
Vector3 roundend = rendersegment.endpoint.point.copy().add(rendersegment.diff.copy().normalize().multiply(width));
|
||||
|
||||
tessellator.getBuffer().pos(roundend.x - diff2.x, roundend.y - diff2.y, roundend.z - diff2.z).tex(0, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
tessellator.getBuffer().pos(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
tessellator.getBuffer().pos(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
tessellator.getBuffer().pos(roundend.x + diff2.x, roundend.y + diff2.y, roundend.z + diff2.z).tex(0, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
}
|
||||
|
||||
if(rendersegment.prev == null) {
|
||||
Vector3 roundend = rendersegment.startpoint.point.copy().subtract(rendersegment.diff.copy().normalize().multiply(width));
|
||||
|
||||
tessellator.getBuffer().pos(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
tessellator.getBuffer().pos(roundend.x - diff1.x, roundend.y - diff1.y, roundend.z - diff1.z).tex(0, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
tessellator.getBuffer().pos(roundend.x + diff1.x, roundend.y + diff1.y, roundend.z + diff1.z).tex(0, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
tessellator.getBuffer().pos(startvec.x + diff1.x, startvec.y + diff1.y, startvec.z + diff1.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class LightningBolt {
|
||||
|
||||
public ArrayList<Segment> segments = new ArrayList<>();
|
||||
public Vector3 start;
|
||||
public Vector3 end;
|
||||
BlockPos target;
|
||||
TIntIntHashMap splitparents = new TIntIntHashMap();
|
||||
|
||||
public double length;
|
||||
public int numsegments0;
|
||||
private int numsplits;
|
||||
private boolean finalized;
|
||||
private Random rand;
|
||||
public long seed;
|
||||
|
||||
public int particleAge;
|
||||
public int particleMaxAge;
|
||||
public boolean isDead;
|
||||
private AxisAlignedBB boundingBox;
|
||||
|
||||
private World world;
|
||||
private Entity source;
|
||||
|
||||
public static final ConcurrentLinkedQueue<LightningBolt> boltlist = new ConcurrentLinkedQueue<>();
|
||||
|
||||
public float speed = 1.5F;
|
||||
public static final int fadetime = 20;
|
||||
|
||||
public static int playerdamage = 1;
|
||||
public static int entitydamage = 1;
|
||||
|
||||
public int colorOuter;
|
||||
public int colorInner;
|
||||
|
||||
public static class BoltPoint {
|
||||
|
||||
public BoltPoint(Vector3 basepoint, Vector3 offsetvec) {
|
||||
point = basepoint.copy().add(offsetvec);
|
||||
this.basepoint = basepoint;
|
||||
this.offsetvec = offsetvec;
|
||||
}
|
||||
|
||||
public Vector3 point;
|
||||
Vector3 basepoint;
|
||||
Vector3 offsetvec;
|
||||
}
|
||||
|
||||
private static final Comparator<Segment> SEGMENT_SORTER = (o1, o2) -> {
|
||||
int comp = Integer.valueOf(o1.splitno).compareTo(o2.splitno);
|
||||
if(comp == 0)
|
||||
return Integer.valueOf(o1.segmentno).compareTo(o2.segmentno);
|
||||
else return comp;
|
||||
};
|
||||
|
||||
private static final Comparator<Segment> SEGMENT_LIGHT_SORTER = (o1, o2) -> Float.compare(o2.light, o1.light);
|
||||
|
||||
public class Segment {
|
||||
public Segment(BoltPoint start, BoltPoint end, float light, int segmentnumber, int splitnumber) {
|
||||
startpoint = start;
|
||||
endpoint = end;
|
||||
this.light = light;
|
||||
segmentno = segmentnumber;
|
||||
splitno = splitnumber;
|
||||
|
||||
calcDiff();
|
||||
}
|
||||
|
||||
public Segment(Vector3 start, Vector3 end) {
|
||||
this(new BoltPoint(start, new Vector3(0, 0, 0)), new BoltPoint(end, new Vector3(0, 0, 0)), 1, 0, 0);
|
||||
}
|
||||
|
||||
public void calcDiff() {
|
||||
diff = endpoint.point.copy().subtract(startpoint.point);
|
||||
}
|
||||
|
||||
public void calcEndDiffs() {
|
||||
if(prev != null) {
|
||||
Vector3 prevdiffnorm = prev.diff.copy().normalize();
|
||||
Vector3 thisdiffnorm = diff.copy().normalize();
|
||||
|
||||
prevdiff = thisdiffnorm.copy().add(prevdiffnorm).normalize();
|
||||
sinprev = (float) Math.sin(thisdiffnorm.angle(prevdiffnorm.multiply(-1)) / 2);
|
||||
} else {
|
||||
prevdiff = diff.copy().normalize();
|
||||
sinprev = 1;
|
||||
}
|
||||
|
||||
if(next != null) {
|
||||
Vector3 nextdiffnorm = next.diff.copy().normalize();
|
||||
Vector3 thisdiffnorm = diff.copy().normalize();
|
||||
|
||||
nextdiff = thisdiffnorm.add(nextdiffnorm).normalize();
|
||||
sinnext = (float) Math.sin(thisdiffnorm.angle(nextdiffnorm.multiply(-1)) / 2);
|
||||
} else {
|
||||
nextdiff = diff.copy().normalize();
|
||||
sinnext = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return startpoint.point.toString() + " " + endpoint.point.toString();
|
||||
}
|
||||
|
||||
public BoltPoint startpoint;
|
||||
public BoltPoint endpoint;
|
||||
|
||||
public Vector3 diff;
|
||||
|
||||
public Segment prev;
|
||||
public Segment next;
|
||||
|
||||
public Vector3 nextdiff;
|
||||
public Vector3 prevdiff;
|
||||
|
||||
public float sinprev;
|
||||
public float sinnext;
|
||||
public float light;
|
||||
|
||||
public int segmentno;
|
||||
public int splitno;
|
||||
}
|
||||
|
||||
public LightningBolt(World world, Vector3 sourcevec, Vector3 targetvec, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
|
||||
this.world = world;
|
||||
this.seed = seed;
|
||||
rand = new Random(seed);
|
||||
|
||||
start = sourcevec;
|
||||
end = targetvec;
|
||||
|
||||
speed = ticksPerMeter;
|
||||
|
||||
this.colorOuter = colorOuter;
|
||||
this.colorInner = colorInner;
|
||||
|
||||
numsegments0 = 1;
|
||||
|
||||
length = end.copy().subtract(start).mag();
|
||||
particleMaxAge = fadetime + rand.nextInt(fadetime) - fadetime / 2;
|
||||
particleAge = -(int) (length * speed);
|
||||
|
||||
boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
|
||||
boundingBox = new AxisAlignedBB(Math.min(start.x, end.x), Math.min(start.y, end.y), Math.min(start.z, end.z), Math.max(start.x, end.x), Math.max(start.y, end.y), Math.max(start.z, end.z)).expand(length / 2, length / 2, length / 2);
|
||||
|
||||
segments.add(new Segment(start, end));
|
||||
}
|
||||
|
||||
public static Vector3 getFocalPoint(TileEntity tile) {
|
||||
return Vector3.fromTileEntityCenter(tile);
|
||||
}
|
||||
|
||||
public LightningBolt(World world, Vector3 sourcevec, TileEntity target, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
|
||||
this(world, sourcevec, getFocalPoint(target), ticksPerMeter, seed, colorOuter, colorInner);
|
||||
this.target = target.getPos();
|
||||
}
|
||||
|
||||
public void setWrapper(Entity entity) {
|
||||
source = entity;
|
||||
}
|
||||
|
||||
public void fractal(int splits, double amount, double splitchance, double splitlength, double splitangle) {
|
||||
if(finalized)
|
||||
return;
|
||||
|
||||
ArrayList<Segment> oldsegments = segments;
|
||||
segments = new ArrayList<>();
|
||||
|
||||
Segment prev = null;
|
||||
|
||||
for(Segment segment : oldsegments) {
|
||||
prev = segment.prev;
|
||||
|
||||
Vector3 subsegment = segment.diff.copy().multiply(1F / splits);
|
||||
|
||||
BoltPoint[] newpoints = new BoltPoint[splits + 1];
|
||||
|
||||
Vector3 startpoint = segment.startpoint.point;
|
||||
newpoints[0] = segment.startpoint;
|
||||
newpoints[splits] = segment.endpoint;
|
||||
|
||||
for(int i = 1; i < splits; i++) {
|
||||
Vector3 randoff = segment.diff.copy().perpendicular().normalize().rotate(rand.nextFloat() * 360, segment.diff);
|
||||
randoff.multiply((rand.nextFloat() - 0.5F) * amount * 2);
|
||||
|
||||
Vector3 basepoint = startpoint.copy().add(subsegment.copy().multiply(i));
|
||||
|
||||
newpoints[i] = new BoltPoint(basepoint, randoff);
|
||||
}
|
||||
|
||||
for(int i = 0; i < splits; i++) {
|
||||
Segment next = new Segment(newpoints[i], newpoints[i + 1], segment.light, segment.segmentno * splits + i, segment.splitno);
|
||||
next.prev = prev;
|
||||
if (prev != null)
|
||||
prev.next = next;
|
||||
|
||||
if(i != 0 && rand.nextFloat() < splitchance) {
|
||||
Vector3 splitrot = next.diff.copy().xCrossProduct().rotate(rand.nextFloat() * 360, next.diff);
|
||||
Vector3 diff = next.diff.copy().rotate((rand.nextFloat() * 0.66F + 0.33F) * splitangle, splitrot).multiply(splitlength);
|
||||
|
||||
numsplits++;
|
||||
splitparents.put(numsplits, next.splitno);
|
||||
|
||||
Segment split = new Segment(newpoints[i], new BoltPoint(newpoints[i + 1].basepoint, newpoints[i + 1].offsetvec.copy().add(diff)), segment.light / 2F, next.segmentno, numsplits);
|
||||
split.prev = prev;
|
||||
|
||||
segments.add(split);
|
||||
}
|
||||
|
||||
prev = next;
|
||||
segments.add(next);
|
||||
}
|
||||
|
||||
if(segment.next != null)
|
||||
segment.next.prev = prev;
|
||||
}
|
||||
|
||||
numsegments0 *= splits;
|
||||
}
|
||||
|
||||
public void defaultFractal() {
|
||||
fractal(2, length / 1.5, 0.7F, 0.7F, 45);
|
||||
fractal(2, length / 4, 0.5F, 0.8F, 50);
|
||||
fractal(2, length / 15, 0.5F, 0.9F, 55);
|
||||
fractal(2, length / 30, 0.5F, 1.0F, 60);
|
||||
fractal(2, length / 60, 0, 0, 0);
|
||||
fractal(2, length / 100, 0, 0, 0);
|
||||
fractal(2, length / 400, 0, 0, 0);
|
||||
}
|
||||
|
||||
private float rayTraceResistance(Vector3 start, Vector3 end, float prevresistance) {
|
||||
RayTraceResult mop = world.rayTraceBlocks(start.toVec3D(), end.toVec3D());
|
||||
|
||||
if(mop == null)
|
||||
return prevresistance;
|
||||
|
||||
if(mop.typeOfHit == RayTraceResult.Type.BLOCK) {
|
||||
Block block = world.getBlockState(mop.getBlockPos()).getBlock();
|
||||
|
||||
if(world.isAirBlock(mop.getBlockPos()))
|
||||
return prevresistance;
|
||||
|
||||
return prevresistance + block.getExplosionResistance(source) + 0.3F;
|
||||
} else return prevresistance;
|
||||
}
|
||||
|
||||
private void calculateCollisionAndDiffs() {
|
||||
TIntIntHashMap lastactivesegment = new TIntIntHashMap();
|
||||
|
||||
Collections.sort(segments, SEGMENT_SORTER);
|
||||
|
||||
int lastsplitcalc = 0;
|
||||
int lastactiveseg = 0;// unterminated
|
||||
float splitresistance = 0;
|
||||
|
||||
for(Segment segment : segments) {
|
||||
if(segment.splitno > lastsplitcalc) {
|
||||
lastactivesegment.put(lastsplitcalc, lastactiveseg);
|
||||
lastsplitcalc = segment.splitno;
|
||||
lastactiveseg = lastactivesegment.get(splitparents.get(segment.splitno));
|
||||
splitresistance = lastactiveseg < segment.segmentno ? 50 : 0;
|
||||
}
|
||||
|
||||
if(splitresistance >= 40 * segment.light)
|
||||
continue;
|
||||
|
||||
splitresistance = rayTraceResistance(segment.startpoint.point, segment.endpoint.point, splitresistance);
|
||||
lastactiveseg = segment.segmentno;
|
||||
}
|
||||
lastactivesegment.put(lastsplitcalc, lastactiveseg);
|
||||
|
||||
lastsplitcalc = 0;
|
||||
lastactiveseg = lastactivesegment.get(0);
|
||||
for(Iterator<Segment> iterator = segments.iterator(); iterator.hasNext();) {
|
||||
Segment segment = iterator.next();
|
||||
if(lastsplitcalc != segment.splitno) {
|
||||
lastsplitcalc = segment.splitno;
|
||||
lastactiveseg = lastactivesegment.get(segment.splitno);
|
||||
}
|
||||
|
||||
if(segment.segmentno > lastactiveseg)
|
||||
iterator.remove();
|
||||
segment.calcEndDiffs();
|
||||
}
|
||||
}
|
||||
|
||||
public void finalizeBolt() {
|
||||
if(finalized)
|
||||
return;
|
||||
finalized = true;
|
||||
|
||||
calculateCollisionAndDiffs();
|
||||
|
||||
Collections.sort(segments, SEGMENT_LIGHT_SORTER);
|
||||
|
||||
boltlist.add(this);
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
particleAge++;
|
||||
|
||||
if (particleAge >= particleMaxAge)
|
||||
isDead = true;
|
||||
}
|
||||
|
||||
// Called in ClientTickHandler
|
||||
public static void update() {
|
||||
for(Iterator<LightningBolt> iterator = boltlist.iterator(); iterator.hasNext();) {
|
||||
LightningBolt bolt = iterator.next();
|
||||
|
||||
bolt.onUpdate();
|
||||
if(bolt.isDead)
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ package vazkii.botania.client.core.handler;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
@@ -17,7 +18,6 @@ import net.minecraft.launchwrapper.Launch;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import org.lwjgl.BufferUtils;
|
||||
@@ -25,8 +25,10 @@ import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.client.model.FloatingFlowerModel;
|
||||
import vazkii.botania.client.model.GunModel;
|
||||
import vazkii.botania.client.model.LexiconModel;
|
||||
import vazkii.botania.client.model.PlatformModel;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.integration.buildcraft.TriggerManaLevel;
|
||||
import vazkii.botania.common.item.ItemSparkUpgrade;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
|
||||
@@ -63,7 +65,7 @@ public class MiscellaneousIcons {
|
||||
|
||||
public TextureAtlasSprite[] sparkUpgradeIcons;
|
||||
public TextureAtlasSprite[] kingKeyWeaponIcons;
|
||||
public Map<TriggerManaLevel.State, TextureAtlasSprite> manaLevelTriggerIcons = Maps.newEnumMap(TriggerManaLevel.State.class);
|
||||
public final Map<TriggerManaLevel.State, TextureAtlasSprite> manaLevelTriggerIcons = Maps.newEnumMap(TriggerManaLevel.State.class);
|
||||
public TextureAtlasSprite[] tiaraWingIcons;
|
||||
|
||||
// begin dank_memes
|
||||
@@ -97,6 +99,15 @@ public class MiscellaneousIcons {
|
||||
|
||||
// Lexicon
|
||||
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:lexicon", "inventory"), new LexiconModel());
|
||||
|
||||
// Mana Blaster
|
||||
ModelResourceLocation key = new ModelResourceLocation("botania:manaGun", "inventory");
|
||||
IBakedModel originalModel = evt.getModelRegistry().getObject(key);
|
||||
evt.getModelRegistry().putObject(key, new GunModel(originalModel));
|
||||
|
||||
key = new ModelResourceLocation("botania:manaGunClip", "inventory");
|
||||
originalModel = evt.getModelRegistry().getObject(key);
|
||||
evt.getModelRegistry().putObject(key, new GunModel(originalModel));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -161,7 +172,7 @@ public class MiscellaneousIcons {
|
||||
int width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
|
||||
int height = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);
|
||||
|
||||
FMLLog.info("[Botania]: Dumped atlas %d wide by %d tall%n", width, height);
|
||||
Botania.LOGGER.debug("Dumped atlas %d wide by %d tall%n", width, height);
|
||||
|
||||
int pixels = width * height;
|
||||
|
||||
@@ -191,7 +202,7 @@ public class MiscellaneousIcons {
|
||||
try {
|
||||
ImageIO.write(bufferedimage, "png", result);
|
||||
} catch (IOException e) {
|
||||
FMLLog.warning("[Botania]: Failed to dump debug atlas");
|
||||
Botania.LOGGER.warn("Failed to dump debug atlas");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,60 +8,31 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDoublePlant;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.BlockSkull;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.BlockWall;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMap;
|
||||
import net.minecraft.client.resources.IReloadableResourceManager;
|
||||
import net.minecraft.client.renderer.block.statemap.DefaultStateMapper;
|
||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.client.model.obj.OBJLoader;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.fml.common.registry.RegistryDelegate;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import vazkii.botania.api.BotaniaAPIClient;
|
||||
import vazkii.botania.api.item.IFloatingFlower;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.AltGrassVariant;
|
||||
import vazkii.botania.api.state.enums.AltarVariant;
|
||||
import vazkii.botania.api.state.enums.BiomeBrickVariant;
|
||||
import vazkii.botania.api.state.enums.BiomeStoneVariant;
|
||||
import vazkii.botania.api.state.enums.CrateVariant;
|
||||
import vazkii.botania.api.state.enums.CustomBrickVariant;
|
||||
import vazkii.botania.api.state.enums.DrumVariant;
|
||||
import vazkii.botania.api.state.enums.EndBrickVariant;
|
||||
import vazkii.botania.api.state.enums.FutureStoneVariant;
|
||||
import vazkii.botania.api.state.enums.LivingRockVariant;
|
||||
import vazkii.botania.api.state.enums.LivingWoodVariant;
|
||||
import vazkii.botania.api.state.enums.LuminizerVariant;
|
||||
import vazkii.botania.api.state.enums.PlatformVariant;
|
||||
import vazkii.botania.api.state.enums.PoolVariant;
|
||||
import vazkii.botania.api.state.enums.PrismarineVariant;
|
||||
import vazkii.botania.api.state.enums.PylonVariant;
|
||||
import vazkii.botania.api.state.enums.SpreaderVariant;
|
||||
import vazkii.botania.api.state.enums.StorageVariant;
|
||||
import vazkii.botania.client.model.FloatingFlowerModel;
|
||||
import vazkii.botania.client.model.SpecialFlowerModel;
|
||||
import vazkii.botania.client.render.IModelRegister;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.ModFluffBlocks;
|
||||
import vazkii.botania.common.block.decor.slabs.BlockModSlab;
|
||||
import vazkii.botania.common.block.subtile.SubTileDecor;
|
||||
import vazkii.botania.common.block.subtile.SubTileManastar;
|
||||
import vazkii.botania.common.block.subtile.SubTilePureDaisy;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileAgricarnation;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileBellethorn;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileBergamute;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileBubbell;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileClayconia;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileDaffomill;
|
||||
@@ -99,118 +70,30 @@ import vazkii.botania.common.block.subtile.generating.SubTileNightshade;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileRafflowsia;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileSpectrolus;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileThermalily;
|
||||
import vazkii.botania.common.block.tile.TileAvatar;
|
||||
import vazkii.botania.common.block.tile.TileBrewery;
|
||||
import vazkii.botania.common.block.tile.TileGaiaHead;
|
||||
import vazkii.botania.common.block.tile.TileHourglass;
|
||||
import vazkii.botania.common.block.tile.TileTeruTeruBozu;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaCrystalCube;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
|
||||
import vazkii.botania.common.block.tile.mana.TileBellows;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.brew.ItemBrewBase;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
|
||||
import vazkii.botania.common.item.relic.ItemInfiniteFruit;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import static vazkii.botania.common.item.ModItems.*;
|
||||
import java.util.Map;
|
||||
import java.util.function.IntFunction;
|
||||
|
||||
public final class ModelHandler {
|
||||
|
||||
// todo reorganize, alphabetize
|
||||
public static void registerModels() {
|
||||
ModelLoaderRegistry.registerLoader(SpecialFlowerModel.Loader.INSTANCE);
|
||||
OBJLoader.INSTANCE.addDomain(LibMisc.MOD_ID.toLowerCase(Locale.ROOT));
|
||||
|
||||
/** Subtile block models **/
|
||||
registerSubtiles();
|
||||
|
||||
/** Custom statemappers **/
|
||||
registerStateMappers();
|
||||
for(Block block : Block.REGISTRY) {
|
||||
if(block instanceof IModelRegister)
|
||||
((IModelRegister) block).registerModels();
|
||||
}
|
||||
|
||||
/** ItemBlocks **/
|
||||
registerStandardBlocks();
|
||||
registerMushrooms();
|
||||
registerFlowers();
|
||||
registerPavement();
|
||||
registerStairs();
|
||||
registerSlabs();
|
||||
registerWalls();
|
||||
registerPanes();
|
||||
registerAltars();
|
||||
registerQuartzBlocks();
|
||||
registerLuminizers();
|
||||
|
||||
/** Normal Items **/
|
||||
registerStandardItems();
|
||||
registerTESRItems();
|
||||
registerManaResources();
|
||||
registerRunes();
|
||||
registerLens();
|
||||
registerBrews();
|
||||
|
||||
/** Special Item Meshers **/
|
||||
// Cannot use lambdas directly yet because FG/SS can't reobfuscate them, need a dummy wrapper
|
||||
// See https://github.com/MinecraftForge/ForgeGradle/issues/314.
|
||||
|
||||
ModelLoader.registerItemVariants(Item.getItemFromBlock(ModBlocks.pool),
|
||||
new ModelResourceLocation("botania:pool", "variant=default"),
|
||||
new ModelResourceLocation("botania:pool", "variant=diluted"),
|
||||
new ModelResourceLocation("botania:pool", "variant=creative"),
|
||||
new ModelResourceLocation("botania:pool", "variant=fabulous"),
|
||||
new ModelResourceLocation("botania:pool", "default_full"),
|
||||
new ModelResourceLocation("botania:pool", "diluted_full"),
|
||||
new ModelResourceLocation("botania:pool", "creative_full"),
|
||||
new ModelResourceLocation("botania:pool", "fabulous_full"));
|
||||
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(ModBlocks.pool), MesherWrapper.of(stack -> {
|
||||
int meta = stack.getMetadata();
|
||||
if (meta < 0 || meta > 3)
|
||||
meta = 0;
|
||||
PoolVariant v = PoolVariant.values()[meta];
|
||||
boolean renderFull = v == PoolVariant.CREATIVE || (stack.hasTagCompound() && stack.getTagCompound().getBoolean("RenderFull"));
|
||||
return new ModelResourceLocation("botania:pool", renderFull ? v.getName() + "_full" : "variant=" + v.getName());
|
||||
}));
|
||||
|
||||
ModelLoader.registerItemVariants(elementiumShears,
|
||||
new ModelResourceLocation("botania:elementiumShears", "inventory"),
|
||||
new ModelResourceLocation("botania:dammitReddit", "inventory"));
|
||||
ModelLoader.setCustomMeshDefinition(elementiumShears, MesherWrapper.of(stack ->
|
||||
stack.getDisplayName().equalsIgnoreCase("dammit reddit")
|
||||
? new ModelResourceLocation("botania:dammitReddit", "inventory")
|
||||
: new ModelResourceLocation("botania:elementiumShears", "inventory")));
|
||||
|
||||
ModelLoader.registerItemVariants(grassHorn,
|
||||
new ModelResourceLocation("botania:grassHorn0", "inventory"),
|
||||
new ModelResourceLocation("botania:grassHorn1", "inventory"),
|
||||
new ModelResourceLocation("botania:grassHorn2", "inventory"),
|
||||
new ModelResourceLocation("botania:vuvuzela", "inventory"));
|
||||
ModelLoader.setCustomMeshDefinition(grassHorn, MesherWrapper.of(stack ->
|
||||
stack.getDisplayName().toLowerCase().contains("vuvuzela")
|
||||
? new ModelResourceLocation("botania:vuvuzela", "inventory")
|
||||
: new ModelResourceLocation("botania:grassHorn" + stack.getMetadata(), "inventory")));
|
||||
|
||||
ModelLoader.registerItemVariants(infiniteFruit,
|
||||
new ModelResourceLocation("botania:infiniteFruit", "inventory"),
|
||||
new ModelResourceLocation("botania:infiniteFruitBoot", "inventory"));
|
||||
ModelLoader.setCustomMeshDefinition(infiniteFruit, MesherWrapper.of(stack ->
|
||||
ItemInfiniteFruit.isBoot(stack)
|
||||
? new ModelResourceLocation("botania:infiniteFruitBoot", "inventory")
|
||||
: new ModelResourceLocation("botania:infiniteFruit", "inventory")));
|
||||
|
||||
ModelLoader.registerItemVariants(manaCookie,
|
||||
new ModelResourceLocation("botania:manaCookie", "inventory"),
|
||||
new ModelResourceLocation("botania:totalBiscuit", "inventory"));
|
||||
ModelLoader.setCustomMeshDefinition(manaCookie, MesherWrapper.of(stack ->
|
||||
stack.getDisplayName().toLowerCase().equals("totalbiscuit")
|
||||
? new ModelResourceLocation("botania:totalBiscuit", "inventory")
|
||||
: new ModelResourceLocation("botania:manaCookie", "inventory")));
|
||||
for(Item item : Item.REGISTRY) {
|
||||
if(item instanceof IModelRegister)
|
||||
((IModelRegister) item).registerModels();
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerSubtiles() {
|
||||
@@ -281,690 +164,70 @@ public final class ModelHandler {
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileBubbell.Mini.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_BUBBELL + "Chibi"));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileSolegnolia.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_SOLEGNOLIA));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileSolegnolia.Mini.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_SOLEGNOLIA + "Chibi"));
|
||||
BotaniaAPIClient.registerSubtileModel(SubTileBergamute.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_BERGAMUTE));
|
||||
}
|
||||
|
||||
private static void registerStandardBlocks() {
|
||||
registerItemModel(ModBlocks.alchemyCatalyst);
|
||||
registerItemModel(ModBlocks.alfPortal);
|
||||
registerItemModel(ModBlocks.bifrost);
|
||||
registerItemModel(ModBlocks.bifrostPerm);
|
||||
registerItemModel(ModBlocks.blazeBlock);
|
||||
registerItemModel(ModBlocks.cacophonium);
|
||||
registerItemModel(ModBlocks.cellBlock);
|
||||
registerItemModel(ModBlocks.conjurationCatalyst);
|
||||
registerItemModel(ModBlocks.cocoon);
|
||||
registerItemModel(ModBlocks.corporeaFunnel);
|
||||
registerItemModel(ModBlocks.corporeaInterceptor);
|
||||
registerItemModel(ModBlocks.corporeaRetainer);
|
||||
registerItemModel(ModBlocks.dirtPath);
|
||||
registerItemModel(ModBlocks.distributor);
|
||||
registerItemModel(ModBlocks.elfGlass);
|
||||
registerItemModel(ModBlocks.enchantedSoil);
|
||||
registerItemModel(ModBlocks.enchanter);
|
||||
registerItemModel(ModBlocks.enderEye);
|
||||
registerItemModel(ModBlocks.felPumpkin);
|
||||
registerItemModel(ModBlocks.floatingSpecialFlower);
|
||||
registerItemModel(ModBlocks.forestEye);
|
||||
registerItemModel(ModBlocks.ghostRail);
|
||||
registerItemModel(ModBlocks.incensePlate);
|
||||
registerItemModel(ModBlocks.lightLauncher);
|
||||
registerItemModel(ModBlocks.manaBomb);
|
||||
registerItemModel(ModBlocks.manaDetector);
|
||||
registerItemModel(ModBlocks.manaGlass);
|
||||
registerItemModel(ModBlocks.manaVoid);
|
||||
registerItemModel(ModBlocks.prism);
|
||||
registerItemModel(ModBlocks.pistonRelay);
|
||||
registerItemModel(ModBlocks.pump);
|
||||
registerItemModel(ModBlocks.redStringComparator);
|
||||
registerItemModel(ModBlocks.redStringContainer);
|
||||
registerItemModel(ModBlocks.redStringDispenser);
|
||||
registerItemModel(ModBlocks.redStringFertilizer);
|
||||
registerItemModel(ModBlocks.redStringInterceptor);
|
||||
registerItemModel(ModBlocks.redStringRelay);
|
||||
registerItemModel(ModBlocks.reedBlock);
|
||||
registerItemModel(ModBlocks.rfGenerator);
|
||||
registerItemModel(ModBlocks.root);
|
||||
registerItemModel(ModBlocks.runeAltar);
|
||||
registerItemModel(ModBlocks.seaLamp);
|
||||
registerItemModel(ModBlocks.shimmerrock);
|
||||
registerItemModel(ModBlocks.shimmerwoodPlanks);
|
||||
registerItemModel(ModBlocks.sparkChanger);
|
||||
registerItemModel(ModBlocks.spawnerClaw);
|
||||
registerItemModel(ModBlocks.specialFlower);
|
||||
registerItemModel(ModBlocks.starfield);
|
||||
registerItemModel(ModBlocks.thatch);
|
||||
registerItemModel(ModBlocks.terraPlate);
|
||||
registerItemModel(ModBlocks.tinyPlanet);
|
||||
registerItemModel(ModBlocks.tinyPotato);
|
||||
registerItemModel(ModBlocks.turntable);
|
||||
|
||||
// Register all metas to variant inventory, so the smartmodel can take over from there. See MiscellaneousIcons
|
||||
registerItemModelAllMeta(Item.getItemFromBlock(ModBlocks.floatingFlower), EnumDyeColor.values().length);
|
||||
|
||||
// Item models which all use the same base model and recolored by render layer
|
||||
registerItemModelAllMeta(Item.getItemFromBlock(ModBlocks.manaBeacon), EnumDyeColor.values().length);
|
||||
registerItemModelAllMeta(Item.getItemFromBlock(ModBlocks.petalBlock), EnumDyeColor.values().length);
|
||||
registerItemModelAllMeta(Item.getItemFromBlock(ModBlocks.unstableBlock), EnumDyeColor.values().length);
|
||||
|
||||
// Blocks which share models with their item, and have only one variant to switch over
|
||||
registerVariantsDefaulted(ModBlocks.pylon, PylonVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.altGrass, AltGrassVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModFluffBlocks.biomeStoneA, BiomeStoneVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModFluffBlocks.biomeStoneB, BiomeBrickVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.customBrick, CustomBrickVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.endStoneBrick, EndBrickVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.dreamwood, LivingWoodVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.forestDrum, DrumVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.livingrock, LivingRockVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.livingwood, LivingWoodVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.openCrate, CrateVariant.class, "pattern=none,variant");
|
||||
registerVariantsDefaulted(ModBlocks.platform, PlatformVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.prismarine, PrismarineVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.spreader, SpreaderVariant.class, "variant");
|
||||
// todo 1.8 this is temporary until animation API is done, currnetly item model textures will not match true spreader texture
|
||||
registerVariantsDefaulted(ModFluffBlocks.stone, FutureStoneVariant.class, "variant");
|
||||
registerVariantsDefaulted(ModBlocks.storage, StorageVariant.class, "variant");
|
||||
public static void registerItemAllMeta(Item item, int range) {
|
||||
registerItemMetas(item, range, i -> item.getRegistryName().getResourcePath());
|
||||
}
|
||||
|
||||
private static void registerStandardItems() {
|
||||
registerItemModel(manasteelSword);
|
||||
registerItemModel(spawnerMover);
|
||||
registerItemModel(terraPick);
|
||||
registerItemModel(magnetRing);
|
||||
registerItemModel(magnetRingGreater);
|
||||
registerItemModel(manaGun);
|
||||
registerItemModel(tornadoRod);
|
||||
|
||||
registerItemModel(twigWand);
|
||||
registerItemModel(pestleAndMortar);
|
||||
registerItemModel(blackLotus);
|
||||
registerItemModel(blackLotus, 1);
|
||||
ModelLoader.registerItemVariants(lexicon, new ModelResourceLocation("botania:lexicon_default", "inventory"));
|
||||
registerItemModel(lexicon);
|
||||
|
||||
registerItemModel(manasteelHelm);
|
||||
registerItemModel(manasteelHelmRevealing);
|
||||
registerItemModel(manasteelChest);
|
||||
registerItemModel(manasteelLegs);
|
||||
registerItemModel(manasteelBoots);
|
||||
|
||||
registerItemModel(manasteelPick);
|
||||
registerItemModel(manasteelShovel);
|
||||
registerItemModel(manasteelAxe);
|
||||
registerItemModel(manasteelShears);
|
||||
|
||||
registerItemModel(manaweaveHelm);
|
||||
registerItemModel(manaweaveChest);
|
||||
registerItemModel(manaweaveLegs);
|
||||
registerItemModel(manaweaveBoots);
|
||||
|
||||
registerItemModel(elementiumHelm);
|
||||
registerItemModel(elementiumHelmRevealing);
|
||||
registerItemModel(elementiumChest);
|
||||
registerItemModel(elementiumLegs);
|
||||
registerItemModel(elementiumBoots);
|
||||
|
||||
registerItemModel(elementiumPick);
|
||||
registerItemModel(elementiumShovel);
|
||||
registerItemModel(elementiumAxe);
|
||||
registerItemModel(elementiumSword);
|
||||
|
||||
registerItemModel(terrasteelHelm);
|
||||
registerItemModel(terrasteelHelmRevealing);
|
||||
registerItemModel(terrasteelChest);
|
||||
registerItemModel(terrasteelLegs);
|
||||
registerItemModel(terrasteelBoots);
|
||||
registerItemModel(terraSword);
|
||||
registerItemModel(terraAxe);
|
||||
|
||||
registerItemModel(starSword);
|
||||
registerItemModel(thunderSword);
|
||||
registerItemModel(crystalBow);
|
||||
registerItemModel(livingwoodBow);
|
||||
registerItemModel(glassPick);
|
||||
|
||||
registerItemModel(flowerBag);
|
||||
registerItemModel(fertilizer);
|
||||
registerItemModel(obedienceStick);
|
||||
|
||||
registerItemModel(dirtRod);
|
||||
registerItemModel(waterRod);
|
||||
registerItemModel(cobbleRod);
|
||||
registerItemModel(fireRod);
|
||||
registerItemModel(rainbowRod);
|
||||
registerItemModel(skyDirtRod);
|
||||
registerItemModel(terraformRod);
|
||||
registerItemModel(diviningRod);
|
||||
registerItemModel(gravityRod);
|
||||
registerItemModel(missileRod);
|
||||
registerItemModel(smeltRod);
|
||||
registerItemModel(exchangeRod);
|
||||
|
||||
registerItemModel(openBucket);
|
||||
registerItemModel(bloodPendant);
|
||||
registerItemModel(manaTablet);
|
||||
registerItemModel(enderDagger);
|
||||
registerItemModel(slingshot);
|
||||
registerItemModel(vineBall);
|
||||
registerItemModel(regenIvy);
|
||||
registerItemModel(keepIvy);
|
||||
registerItemModel(recordGaia1);
|
||||
registerItemModel(recordGaia2);
|
||||
registerItemModel(overgrowthSeed);
|
||||
registerItemModel(worldSeed);
|
||||
registerItemModel(incenseStick);
|
||||
registerItemModel(enderHand);
|
||||
registerItemModel(craftingHalo);
|
||||
registerItemModel(spellCloth);
|
||||
registerItemModel(autocraftingHalo);
|
||||
registerItemModel(sextant);
|
||||
registerItemModel(cacophonium);
|
||||
registerItemModel(clip);
|
||||
registerItemModel(phantomInk);
|
||||
registerItemModel(poolMinecart);
|
||||
registerItemModel(pinkinator);
|
||||
registerItemModel(dice);
|
||||
registerItemModel(kingKey);
|
||||
registerItemModel(flugelEye);
|
||||
registerItemModel(thorRing);
|
||||
registerItemModel(lokiRing);
|
||||
registerItemModel(odinRing);
|
||||
registerItemModel(aesirRing);
|
||||
registerItemModel(baubleBox);
|
||||
registerItemModel(tinyPlanet);
|
||||
registerItemModel(manaRing);
|
||||
registerItemModel(manaRingGreater);
|
||||
registerItemModel(auraRing);
|
||||
registerItemModel(auraRingGreater);
|
||||
registerItemModel(spark);
|
||||
|
||||
registerItemModel(waterRing);
|
||||
registerItemModel(miningRing);
|
||||
registerItemModel(reachRing);
|
||||
registerItemModel(swapRing);
|
||||
registerItemModel(pixieRing);
|
||||
registerItemModel(travelBelt);
|
||||
registerItemModel(superTravelBelt);
|
||||
registerItemModel(speedUpBelt);
|
||||
registerItemModel(knockbackBelt);
|
||||
registerItemModel(itemFinder);
|
||||
registerItemModel(monocle);
|
||||
registerItemModel(icePendant);
|
||||
registerItemModel(lavaPendant);
|
||||
registerItemModel(superLavaPendant);
|
||||
registerItemModel(holyCloak);
|
||||
registerItemModel(unholyCloak);
|
||||
registerItemModel(goldLaurel);
|
||||
registerItemModel(flightTiara);
|
||||
registerItemModel(divaCharm);
|
||||
registerItemModel(manaMirror);
|
||||
registerItemModel(manaInkwell);
|
||||
registerItemModel(waterBowl);
|
||||
|
||||
registerItemModelAllMeta(flightTiara, ItemFlightTiara.WING_TYPES);
|
||||
registerItemModelAllMeta(laputaShard, 20);
|
||||
registerItemModelAllMeta(signalFlare, EnumDyeColor.values().length);
|
||||
registerItemModelAllMeta(dye, EnumDyeColor.values().length);
|
||||
registerItemModelAllMeta(petal, EnumDyeColor.values().length);
|
||||
|
||||
registerItemModelMetas(sparkUpgrade, LibItemNames.SPARK_UPGRADE, 4);
|
||||
registerItemModelMetas(corporeaSpark, LibItemNames.CORPOREA_SPARK, 2);
|
||||
registerItemModelMetas(manaBottle, LibItemNames.MANA_BOTTLE, 6);
|
||||
registerItemModelMetas(ancientWill, LibItemNames.ANCIENT_WILL, 6);
|
||||
registerItemModelMetas(temperanceStone, LibItemNames.TEMPERANCE_STONE, 2);
|
||||
registerItemModelMetas(thornChakram, LibItemNames.THORN_CHAKRAM, 2);
|
||||
registerItemModelMetas(blackHoleTalisman, LibItemNames.BLACK_HOLE_TALISMAN, 2);
|
||||
registerItemModelMetas(slimeBottle, LibItemNames.SLIME_BOTTLE, 2);
|
||||
registerItemModelMetas(grassSeeds, LibItemNames.GRASS_SEEDS, 9);
|
||||
registerItemModelMetas(quartz, LibItemNames.QUARTZ, 7);
|
||||
registerItemModelMetas(cosmetic, LibItemNames.COSMETIC, 32);
|
||||
registerItemModelMetas(craftPattern, LibItemNames.CRAFT_PATTERN, 9);
|
||||
registerItemModelMetas(virus, LibItemNames.VIRUS, 2);
|
||||
public static void registerItemAppendMeta(Item item, int maxExclusive, String loc) {
|
||||
registerItemMetas(item, maxExclusive, i -> loc + i);
|
||||
}
|
||||
|
||||
// Only for models that absolutely can't be converted to JSON. Use VERY sparingly
|
||||
@SuppressWarnings("deprecation")
|
||||
private static void registerTESRItems() {
|
||||
registerItemModel(ModBlocks.avatar);
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.avatar), 0, TileAvatar.class);
|
||||
|
||||
registerItemModel(ModBlocks.bellows); // todo await animation api
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.bellows), 0, TileBellows.class);
|
||||
|
||||
registerItemModel(ModBlocks.brewery);
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.brewery), 0, TileBrewery.class);
|
||||
|
||||
registerItemModel(ModBlocks.corporeaCrystalCube);
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.corporeaCrystalCube), 0, TileCorporeaCrystalCube.class);
|
||||
|
||||
registerItemModel(ModBlocks.corporeaIndex); // todo json maybe? await animation api
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.corporeaIndex), 0, TileCorporeaIndex.class);
|
||||
|
||||
registerItemModel(ModItems.gaiaHead);
|
||||
ForgeHooksClient.registerTESRItemStack(ModItems.gaiaHead, 0, TileGaiaHead.class);
|
||||
|
||||
registerItemModel(ModBlocks.hourglass); // todo json maybe?
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.hourglass), 0, TileHourglass.class);
|
||||
|
||||
registerItemModel(ModBlocks.teruTeruBozu);
|
||||
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.teruTeruBozu), 0, TileTeruTeruBozu.class);
|
||||
}
|
||||
|
||||
private static void registerManaResources() {
|
||||
Item item = manaResource;
|
||||
for (int i = 0; i < LibItemNames.MANA_RESOURCE_NAMES.length; i++) {
|
||||
String name = "botania:" + LibItemNames.MANA_RESOURCE_NAMES[i];
|
||||
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(name, "inventory"));
|
||||
public static void registerItemMetas(Item item, int maxExclusive, IntFunction<String> metaToName) {
|
||||
for (int i = 0; i < maxExclusive; i++) {
|
||||
ModelLoader.setCustomModelResourceLocation(
|
||||
item, i,
|
||||
new ModelResourceLocation(LibMisc.MOD_ID + ":" + metaToName.apply(i), "inventory")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerRunes() {
|
||||
List<String> variantNames = ImmutableList.of("water", "fire", "earth", "air", "spring", "summer", "autumn", "winter", "mana", "lust", "gluttony", "greed", "sloth", "wrath", "envy", "pride");
|
||||
for (int i = 0; i < variantNames.size(); i++) {
|
||||
ModelLoader.setCustomModelResourceLocation(rune, i, new ModelResourceLocation("botania:rune_" + variantNames.get(i), "inventory"));
|
||||
}
|
||||
private static final Map<RegistryDelegate<Block>, IStateMapper> customStateMappers = ReflectionHelper.getPrivateValue(ModelLoader.class, null, "customStateMappers");
|
||||
private static final DefaultStateMapper fallbackMapper = new DefaultStateMapper();
|
||||
|
||||
private static ModelResourceLocation getMrlForState(IBlockState state) {
|
||||
return customStateMappers
|
||||
.getOrDefault(state.getBlock().delegate, fallbackMapper)
|
||||
.putStateModelLocations(state.getBlock())
|
||||
.get(state);
|
||||
}
|
||||
|
||||
private static void registerLens() {
|
||||
int counter = 0;
|
||||
for (String s : LibItemNames.LENS_NAMES) {
|
||||
ModelLoader.setCustomModelResourceLocation(lens, counter++, new ModelResourceLocation("botania:" + s, "inventory"));
|
||||
}
|
||||
public static void registerBlockToState(Block b, int meta, IBlockState state) {
|
||||
ModelLoader.setCustomModelResourceLocation(
|
||||
Item.getItemFromBlock(b),
|
||||
meta,
|
||||
getMrlForState(state)
|
||||
);
|
||||
}
|
||||
|
||||
private static void registerBrews() {
|
||||
ModelLoader.setCustomModelResourceLocation(vial, 0, new ModelResourceLocation("botania:vial", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(vial, 1, new ModelResourceLocation("botania:flask", "inventory"));
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
ModelLoader.registerItemVariants(brewFlask, new ModelResourceLocation("botania:flask1_" + i, "inventory"));
|
||||
}
|
||||
|
||||
ModelLoader.setCustomMeshDefinition(brewFlask, MesherWrapper.of(stack -> {
|
||||
int swigsTaken = 6 - ((ItemBrewBase) brewFlask).getSwigsLeft(stack);
|
||||
return new ModelResourceLocation("botania:flask1_" + swigsTaken, "inventory");
|
||||
}));
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
ModelLoader.registerItemVariants(brewVial, new ModelResourceLocation("botania:vial1_" + i, "inventory"));
|
||||
}
|
||||
|
||||
ModelLoader.setCustomMeshDefinition(brewVial, MesherWrapper.of(stack -> {
|
||||
int swigsTaken = 4 - ((ItemBrewBase) brewVial).getSwigsLeft(stack);
|
||||
return new ModelResourceLocation("botania:vial1_" + swigsTaken, "inventory");
|
||||
}));
|
||||
public static void registerBlockToState(Block b, int maxExclusive) {
|
||||
for(int i = 0; i < maxExclusive; i++)
|
||||
registerBlockToState(b, i, b.getStateFromMeta(i));
|
||||
}
|
||||
|
||||
private static void registerStateMappers() {
|
||||
// Override to let custom model loader work, see SpecialFlowerModel
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.specialFlower, new StateMap.Builder().ignore(BotaniaStateProps.COLOR).ignore(((BlockFlower) ModBlocks.specialFlower).getTypeProperty()).build());
|
||||
|
||||
// Override to let smart models work, see MiscellaneousIcons
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.floatingSpecialFlower, new StateMap.Builder().ignore(BotaniaStateProps.COLOR).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.floatingFlower, new StateMap.Builder().ignore(BotaniaStateProps.COLOR).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.platform, new StateMap.Builder().ignore(BotaniaStateProps.PLATFORM_VARIANT).build());
|
||||
|
||||
// Ignore vanilla facing, variant in double flower
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.doubleFlower1, (new StateMap.Builder()).ignore(BlockDoublePlant.VARIANT, BlockDoublePlant.FACING).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.doubleFlower2, (new StateMap.Builder()).ignore(BlockDoublePlant.VARIANT, BlockDoublePlant.FACING).build());
|
||||
|
||||
// Ignore color in pool, unstable cube, mana beacon, special flower, and petals (handled by Block.colorMultiplier)
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.pool, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.unstableBlock, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.manaBeacon, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.petalBlock, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.specialFlower, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR, ((BlockFlower) ModBlocks.specialFlower).getTypeProperty()).build());
|
||||
|
||||
// Ignore vanilla variant in flowers
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.flower, (new StateMap.Builder()).ignore(((BlockFlower) ModBlocks.flower).getTypeProperty()).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.shinyFlower, (new StateMap.Builder()).ignore(((BlockFlower) ModBlocks.shinyFlower).getTypeProperty()).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.buriedPetals, (new StateMap.Builder()).ignore(((BlockFlower) ModBlocks.buriedPetals).getTypeProperty()).build());
|
||||
|
||||
// Ignore vanilla variant in walls
|
||||
ModelLoader.setCustomStateMapper(ModFluffBlocks.biomeStoneWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
|
||||
ModelLoader.setCustomStateMapper(ModFluffBlocks.dreamwoodWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
|
||||
ModelLoader.setCustomStateMapper(ModFluffBlocks.livingrockWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
|
||||
ModelLoader.setCustomStateMapper(ModFluffBlocks.livingwoodWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
|
||||
ModelLoader.setCustomStateMapper(ModFluffBlocks.prismarineWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
|
||||
ModelLoader.setCustomStateMapper(ModFluffBlocks.reedWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
|
||||
ModelLoader.setCustomStateMapper(ModFluffBlocks.stoneWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
|
||||
|
||||
// Ignore dummy variant in slabs
|
||||
for (Block b : ModFluffBlocks.biomeStoneSlabs) {
|
||||
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY).build());
|
||||
}
|
||||
|
||||
for (Block b : ModFluffBlocks.pavementSlabs) {
|
||||
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY).build());
|
||||
}
|
||||
|
||||
for (Block b : ModFluffBlocks.stoneSlabs) {
|
||||
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY).build());
|
||||
}
|
||||
|
||||
List<Block> otherSlabs = Lists.newArrayList(ModFluffBlocks.livingwoodSlab, ModFluffBlocks.livingwoodPlankSlab, ModFluffBlocks.livingrockSlab, ModFluffBlocks.dreamwoodSlab, ModFluffBlocks.livingrockBrickSlab,
|
||||
ModFluffBlocks.dreamwoodPlankSlab, ModFluffBlocks.prismarineSlab, ModFluffBlocks.prismarineBrickSlab, ModFluffBlocks.darkPrismarineSlab,
|
||||
ModFluffBlocks.reedSlab, ModFluffBlocks.thatchSlab, ModFluffBlocks.netherBrickSlab, ModFluffBlocks.soulBrickSlab, ModFluffBlocks.snowBrickSlab,
|
||||
ModFluffBlocks.tileSlab, ModFluffBlocks.manaQuartzSlab, ModFluffBlocks.blazeQuartzSlab, ModFluffBlocks.darkQuartzSlab,
|
||||
ModFluffBlocks.lavenderQuartzSlab, ModFluffBlocks.redQuartzSlab, ModFluffBlocks.elfQuartzSlab, ModFluffBlocks.sunnyQuartzSlab, ModFluffBlocks.dirtPathSlab,
|
||||
ModFluffBlocks.shimmerrockSlab, ModFluffBlocks.shimmerwoodPlankSlab, ModFluffBlocks.endStoneSlab, ModFluffBlocks.enderBrickSlab);
|
||||
|
||||
for (Block b : otherSlabs) {
|
||||
if (b == null) // Dark quartz disabled
|
||||
continue;
|
||||
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY).build());
|
||||
}
|
||||
|
||||
// Ignore both dummy variant and half prop in full slabs
|
||||
for (Block b : ModFluffBlocks.biomeStoneFullSlabs) {
|
||||
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY, BlockSlab.HALF).build());
|
||||
}
|
||||
|
||||
for (Block b : ModFluffBlocks.pavementFullSlabs) {
|
||||
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY, BlockSlab.HALF).build());
|
||||
}
|
||||
|
||||
for (Block b : ModFluffBlocks.stoneFullSlabs) {
|
||||
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY, BlockSlab.HALF).build());
|
||||
}
|
||||
|
||||
List<Block> otherFullSlabs = Lists.newArrayList(ModFluffBlocks.livingwoodSlabFull, ModFluffBlocks.livingwoodPlankSlabFull, ModFluffBlocks.livingrockSlabFull, ModFluffBlocks.dreamwoodSlabFull, ModFluffBlocks.livingrockBrickSlabFull,
|
||||
ModFluffBlocks.dreamwoodPlankSlabFull, ModFluffBlocks.prismarineSlabFull, ModFluffBlocks.prismarineBrickSlabFull, ModFluffBlocks.darkPrismarineSlabFull,
|
||||
ModFluffBlocks.reedSlabFull, ModFluffBlocks.thatchSlabFull, ModFluffBlocks.netherBrickSlabFull, ModFluffBlocks.soulBrickSlabFull, ModFluffBlocks.snowBrickSlabFull,
|
||||
ModFluffBlocks.tileSlabFull, ModFluffBlocks.darkQuartzSlabFull, ModFluffBlocks.manaQuartzSlabFull, ModFluffBlocks.blazeQuartzSlabFull,
|
||||
ModFluffBlocks.lavenderQuartzSlabFull, ModFluffBlocks.redQuartzSlabFull, ModFluffBlocks.elfQuartzSlabFull, ModFluffBlocks.sunnyQuartzSlabFull, ModFluffBlocks.dirtPathSlabFull,
|
||||
ModFluffBlocks.shimmerrockSlabFull, ModFluffBlocks.shimmerwoodPlankSlabFull, ModFluffBlocks.endStoneSlabFull, ModFluffBlocks.enderBrickSlabFull);
|
||||
|
||||
for (Block b : otherFullSlabs) {
|
||||
if (b == null) // Dark quartz disabled
|
||||
continue;
|
||||
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY, BlockSlab.HALF).build());
|
||||
}
|
||||
|
||||
// Ignore everything in TESR items to suppress missing model errors
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.avatar, new StateMap.Builder().ignore(BotaniaStateProps.CARDINALS).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.bellows, new StateMap.Builder().ignore(BotaniaStateProps.CARDINALS).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.brewery, new StateMap.Builder().ignore(BotaniaStateProps.POWERED).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.gaiaHead, new StateMap.Builder().ignore(BlockSkull.FACING, BlockSkull.NODROP).build());
|
||||
ModelLoader.setCustomStateMapper(ModBlocks.hourglass, new StateMap.Builder().ignore(BotaniaStateProps.POWERED).build());
|
||||
// Registers the ItemBlock to models/item/<registryname>#inventory
|
||||
public static void registerInventoryVariant(Block b) {
|
||||
ModelLoader.setCustomModelResourceLocation(
|
||||
Item.getItemFromBlock(b), 0,
|
||||
new ModelResourceLocation(b.getRegistryName(), "inventory"));
|
||||
}
|
||||
|
||||
private static void registerMushrooms() {
|
||||
Item item = Item.getItemFromBlock(ModBlocks.mushroom);
|
||||
for (EnumDyeColor color : EnumDyeColor.values()) {
|
||||
String name = ForgeRegistries.BLOCKS.getKey(ModBlocks.mushroom).toString();
|
||||
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, "inventory_" + color.getName()));
|
||||
}
|
||||
// Registers the ItemBlock to a custom path in models/item/itemblock/
|
||||
public static void registerCustomItemblock(Block b, String path) {
|
||||
registerCustomItemblock(b, 1, i -> path);
|
||||
}
|
||||
|
||||
private static void registerFlowers() {
|
||||
Item item = Item.getItemFromBlock(ModBlocks.flower);
|
||||
for (EnumDyeColor color : EnumDyeColor.values()) {
|
||||
String name = ForgeRegistries.BLOCKS.getKey(ModBlocks.flower).toString();
|
||||
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, "inventory_" + color.getName()));
|
||||
}
|
||||
|
||||
item = Item.getItemFromBlock(ModBlocks.shinyFlower);
|
||||
for (EnumDyeColor color : EnumDyeColor.values()) {
|
||||
String name = ForgeRegistries.BLOCKS.getKey(ModBlocks.shinyFlower).toString();
|
||||
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, "inventory_" + color.getName()));
|
||||
}
|
||||
|
||||
item = Item.getItemFromBlock(ModBlocks.doubleFlower1);
|
||||
for (EnumDyeColor color : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1.getAllowedValues()) {
|
||||
String name = ForgeRegistries.BLOCKS.getKey(ModBlocks.doubleFlower1).toString();
|
||||
String variant = "inventory_" + color.getName();
|
||||
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, variant));
|
||||
}
|
||||
|
||||
item = Item.getItemFromBlock(ModBlocks.doubleFlower2);
|
||||
for (EnumDyeColor color : BotaniaStateProps.DOUBLEFLOWER_VARIANT_2.getAllowedValues()) {
|
||||
String name = ForgeRegistries.BLOCKS.getKey(ModBlocks.doubleFlower2).toString();
|
||||
String variant = "inventory_" + color.getName();
|
||||
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata() - 8, new ModelResourceLocation(name, variant));
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerPavement() {
|
||||
Item item = Item.getItemFromBlock(ModFluffBlocks.pavement);
|
||||
String name = ForgeRegistries.BLOCKS.getKey(ModFluffBlocks.pavement).toString();
|
||||
|
||||
for (EnumDyeColor e : BotaniaStateProps.PAVEMENT_COLOR.getAllowedValues()) {
|
||||
String variant = "color=" + e.getName();
|
||||
switch (e) { // Explicit switch needed because saved meta does not match EnumDyeColor
|
||||
case BLACK: {
|
||||
ModelLoader.setCustomModelResourceLocation(item, 1, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
case BLUE: {
|
||||
ModelLoader.setCustomModelResourceLocation(item, 2, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
case RED: {
|
||||
ModelLoader.setCustomModelResourceLocation(item, 3, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
case YELLOW: {
|
||||
ModelLoader.setCustomModelResourceLocation(item, 4, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
case GREEN: {
|
||||
ModelLoader.setCustomModelResourceLocation(item, 5, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
case WHITE:
|
||||
default: {
|
||||
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(name, variant));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerStairs() {
|
||||
for (Block b : ModFluffBlocks.stoneStairs) {
|
||||
registerItemModel(b);
|
||||
}
|
||||
|
||||
for (Block b : ModFluffBlocks.pavementStairs) {
|
||||
registerItemModel(b);
|
||||
}
|
||||
|
||||
for (Block b : ModFluffBlocks.biomeStoneStairs) {
|
||||
registerItemModel(b);
|
||||
}
|
||||
|
||||
registerItemModel(ModFluffBlocks.blazeQuartzStairs);
|
||||
registerItemModel(ModFluffBlocks.darkPrismarineStairs);
|
||||
if (ConfigHandler.darkQuartzEnabled)
|
||||
registerItemModel(ModFluffBlocks.darkQuartzStairs);
|
||||
registerItemModel(ModFluffBlocks.dreamwoodStairs);
|
||||
registerItemModel(ModFluffBlocks.dreamwoodPlankStairs);
|
||||
registerItemModel(ModFluffBlocks.elfQuartzStairs);
|
||||
registerItemModel(ModFluffBlocks.enderBrickStairs);
|
||||
registerItemModel(ModFluffBlocks.endStoneStairs);
|
||||
registerItemModel(ModFluffBlocks.lavenderQuartzStairs);
|
||||
registerItemModel(ModFluffBlocks.livingrockStairs);
|
||||
registerItemModel(ModFluffBlocks.livingrockBrickStairs);
|
||||
registerItemModel(ModFluffBlocks.livingwoodStairs);
|
||||
registerItemModel(ModFluffBlocks.livingwoodPlankStairs);
|
||||
registerItemModel(ModFluffBlocks.manaQuartzStairs);
|
||||
registerItemModel(ModFluffBlocks.netherBrickStairs);
|
||||
registerItemModel(ModFluffBlocks.prismarineStairs);
|
||||
registerItemModel(ModFluffBlocks.prismarineBrickStairs);
|
||||
registerItemModel(ModFluffBlocks.redQuartzStairs);
|
||||
registerItemModel(ModFluffBlocks.reedStairs);
|
||||
registerItemModel(ModFluffBlocks.shimmerrockStairs);
|
||||
registerItemModel(ModFluffBlocks.shimmerwoodPlankStairs);
|
||||
registerItemModel(ModFluffBlocks.snowBrickStairs);
|
||||
registerItemModel(ModFluffBlocks.soulBrickStairs);
|
||||
registerItemModel(ModFluffBlocks.sunnyQuartzStairs);
|
||||
registerItemModel(ModFluffBlocks.thatchStairs);
|
||||
registerItemModel(ModFluffBlocks.tileStairs);
|
||||
}
|
||||
|
||||
private static void registerSlabs() {
|
||||
for (Block b : ModFluffBlocks.biomeStoneSlabs) {
|
||||
registerItemModel(b);
|
||||
}
|
||||
|
||||
for (Block b : ModFluffBlocks.pavementSlabs) {
|
||||
registerItemModel(b);
|
||||
}
|
||||
|
||||
for (Block b : ModFluffBlocks.stoneSlabs) {
|
||||
registerItemModel(b);
|
||||
}
|
||||
|
||||
registerItemModel(ModFluffBlocks.livingwoodSlab);
|
||||
registerItemModel(ModFluffBlocks.livingwoodPlankSlab);
|
||||
registerItemModel(ModFluffBlocks.livingrockSlab);
|
||||
registerItemModel(ModFluffBlocks.livingrockBrickSlab);
|
||||
|
||||
registerItemModel(ModFluffBlocks.blazeQuartzSlab);
|
||||
if (ConfigHandler.darkQuartzEnabled)
|
||||
registerItemModel(ModFluffBlocks.darkQuartzSlab);
|
||||
registerItemModel(ModFluffBlocks.elfQuartzSlab);
|
||||
registerItemModel(ModFluffBlocks.lavenderQuartzSlab);
|
||||
registerItemModel(ModFluffBlocks.manaQuartzSlab);
|
||||
registerItemModel(ModFluffBlocks.redQuartzSlab);
|
||||
registerItemModel(ModFluffBlocks.sunnyQuartzSlab);
|
||||
|
||||
registerItemModel(ModFluffBlocks.dreamwoodSlab);
|
||||
registerItemModel(ModFluffBlocks.dreamwoodPlankSlab);
|
||||
registerItemModel(ModFluffBlocks.prismarineSlab);
|
||||
registerItemModel(ModFluffBlocks.prismarineBrickSlab);
|
||||
registerItemModel(ModFluffBlocks.darkPrismarineSlab);
|
||||
registerItemModel(ModFluffBlocks.dirtPathSlab);
|
||||
registerItemModel(ModFluffBlocks.shimmerrockSlab);
|
||||
registerItemModel(ModFluffBlocks.shimmerwoodPlankSlab);
|
||||
registerItemModel(ModFluffBlocks.endStoneSlab);
|
||||
registerItemModel(ModFluffBlocks.enderBrickSlab);
|
||||
registerItemModel(ModFluffBlocks.netherBrickSlab);
|
||||
registerItemModel(ModFluffBlocks.soulBrickSlab);
|
||||
registerItemModel(ModFluffBlocks.snowBrickSlab);
|
||||
registerItemModel(ModFluffBlocks.tileSlab);
|
||||
registerItemModel(ModFluffBlocks.reedSlab);
|
||||
registerItemModel(ModFluffBlocks.thatchSlab);
|
||||
|
||||
}
|
||||
|
||||
private static void registerWalls() {
|
||||
Item item = Item.getItemFromBlock(ModFluffBlocks.biomeStoneWall);
|
||||
for (BiomeStoneVariant variant : BotaniaStateProps.BIOMESTONEWALL_VARIANT.getAllowedValues()) {
|
||||
String variantName = "inventory_" + variant.getName();
|
||||
ModelLoader.setCustomModelResourceLocation(item, variant.ordinal() - 8, new ModelResourceLocation("botania:biomeStoneA0Wall", variantName));
|
||||
}
|
||||
|
||||
item = Item.getItemFromBlock(ModFluffBlocks.stoneWall);
|
||||
for (FutureStoneVariant variant : BotaniaStateProps.FUTURESTONEWALL_VARIANT.getAllowedValues()) {
|
||||
String variantName = "inventory_" + variant.getName();
|
||||
ModelLoader.setCustomModelResourceLocation(item, variant.ordinal(), new ModelResourceLocation("botania:stone0Wall", variantName));
|
||||
}
|
||||
|
||||
registerItemModel(ModFluffBlocks.livingrockWall);
|
||||
registerItemModel(ModFluffBlocks.livingwoodWall);
|
||||
registerItemModel(ModFluffBlocks.dreamwoodWall);
|
||||
registerItemModel(ModFluffBlocks.prismarineWall);
|
||||
registerItemModel(ModFluffBlocks.reedWall);
|
||||
}
|
||||
|
||||
private static void registerPanes() {
|
||||
registerItemModel(ModFluffBlocks.alfglassPane);
|
||||
registerItemModel(ModFluffBlocks.bifrostPane);
|
||||
registerItemModel(ModFluffBlocks.managlassPane);
|
||||
}
|
||||
|
||||
private static void registerAltars() {
|
||||
Item item = Item.getItemFromBlock(ModBlocks.altar);
|
||||
String name = ForgeRegistries.BLOCKS.getKey(ModBlocks.altar).toString();
|
||||
for (int i = 0; i < AltarVariant.values().length - 1; i++) { // Off by one on purpose to exclude MOSSY
|
||||
String variantName = "variant=" + AltarVariant.values()[i].getName();
|
||||
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(name, variantName));
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerQuartzBlocks() {
|
||||
for (Block b : Lists.newArrayList(ModFluffBlocks.blazeQuartz, ModFluffBlocks.darkQuartz, ModFluffBlocks.elfQuartz, ModFluffBlocks.lavenderQuartz, ModFluffBlocks.manaQuartz, ModFluffBlocks.redQuartz, ModFluffBlocks.sunnyQuartz)) {
|
||||
if (b == null) // Dark quartz disabled
|
||||
continue;
|
||||
Item item = Item.getItemFromBlock(b);
|
||||
String name = ForgeRegistries.BLOCKS.getKey(b).toString();
|
||||
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(name, "variant=normal"));
|
||||
ModelLoader.setCustomModelResourceLocation(item, 1, new ModelResourceLocation(name, "variant=chiseled"));
|
||||
ModelLoader.setCustomModelResourceLocation(item, 2, new ModelResourceLocation(name, "variant=pillar_y"));
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerLuminizers() {
|
||||
Item item = Item.getItemFromBlock(ModBlocks.lightRelay);
|
||||
String name = ForgeRegistries.BLOCKS.getKey(ModBlocks.lightRelay).toString();
|
||||
for (LuminizerVariant v : LuminizerVariant.values()) {
|
||||
ModelLoader.setCustomModelResourceLocation(item, v.ordinal(), new ModelResourceLocation(name, "powered=false,variant=" + v.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
private static <T extends Enum<T> & IStringSerializable> void registerVariantsDefaulted(Block b, Class<T> enumclazz, String variantHeader) {
|
||||
public static void registerCustomItemblock(Block b, int maxExclusive, IntFunction<String> metaToPath) {
|
||||
Item item = Item.getItemFromBlock(b);
|
||||
for (T e : enumclazz.getEnumConstants()) {
|
||||
String baseName = ForgeRegistries.BLOCKS.getKey(b).toString();
|
||||
String variantName = variantHeader + "=" + e.getName();
|
||||
ModelLoader.setCustomModelResourceLocation(item, e.ordinal(), new ModelResourceLocation(baseName, variantName));
|
||||
for (int i = 0; i < maxExclusive; i++) {
|
||||
ModelLoader.setCustomModelResourceLocation(
|
||||
item, i,
|
||||
new ModelResourceLocation(LibMisc.MOD_ID + ":itemblock/" + metaToPath.apply(i), "inventory")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers all metas of the given item to models/item/registryname.json
|
||||
*/
|
||||
private static void registerItemModelAllMeta(Item item, int range) {
|
||||
String loc = ForgeRegistries.ITEMS.getKey(item).toString();
|
||||
for(int i = 0; i < range; i++) {
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(loc, "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(loc, "inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers each meta of an item to models/item/registryname<meta>.json
|
||||
* Range is exclusive upper bound
|
||||
*/
|
||||
private static void registerItemModelMetas(Item item, String loc, int range) {
|
||||
for(int i = 0; i < range; i++) {
|
||||
String name = "botania:" + loc + i;
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(name, "inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerItemModel(Block b) {
|
||||
registerItemModel(Item.getItemFromBlock(b));
|
||||
}
|
||||
|
||||
private static void registerItemModel(Item i,int meta) {
|
||||
ResourceLocation loc = i.getRegistryName();
|
||||
ModelLoader.setCustomModelResourceLocation(i, meta, new ModelResourceLocation(loc, "inventory"));
|
||||
}
|
||||
|
||||
private static void registerItemModel(Item i) {
|
||||
registerItemModel(i, 0);
|
||||
}
|
||||
|
||||
private ModelHandler() {}
|
||||
|
||||
private interface MesherWrapper extends ItemMeshDefinition {
|
||||
|
||||
static MesherWrapper of(MesherWrapper w) {
|
||||
return w;
|
||||
}
|
||||
|
||||
ModelResourceLocation getLocation(ItemStack stack);
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
default ModelResourceLocation getModelLocation(@Nonnull ItemStack stack) {
|
||||
return getLocation(stack);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -56,9 +56,9 @@ public class MultiblockBlockAccess implements IBlockAccess {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCombinedLight(@Nonnull BlockPos pos, int p_72802_4_) {
|
||||
public int getCombinedLight(@Nonnull BlockPos pos, int lightValue) {
|
||||
if(hasBlockAccess)
|
||||
return originalBlockAccess.getCombinedLight(pos, p_72802_4_);
|
||||
return originalBlockAccess.getCombinedLight(pos, lightValue);
|
||||
return 15728640;
|
||||
}
|
||||
|
||||
@@ -85,17 +85,12 @@ public class MultiblockBlockAccess implements IBlockAccess {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Biome getBiomeGenForCoords(@Nonnull BlockPos pos) {
|
||||
public Biome getBiome(@Nonnull BlockPos pos) {
|
||||
if(hasBlockAccess)
|
||||
return originalBlockAccess.getBiomeGenForCoords(pos);
|
||||
return originalBlockAccess.getBiome(pos);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean extendedLevelsInChunkCache() {
|
||||
return hasBlockAccess && originalBlockAccess.extendedLevelsInChunkCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(@Nonnull BlockPos pos, @Nonnull EnumFacing side, boolean _default) {
|
||||
if(hasBlockAccess)
|
||||
|
||||
@@ -40,7 +40,9 @@ import vazkii.botania.common.block.ModBlocks;
|
||||
|
||||
public final class MultiblockRenderHandler {
|
||||
|
||||
private static MultiblockBlockAccess blockAccess = new MultiblockBlockAccess();
|
||||
private MultiblockRenderHandler() {}
|
||||
|
||||
private static final MultiblockBlockAccess blockAccess = new MultiblockBlockAccess();
|
||||
private static int dimension;
|
||||
|
||||
public static boolean rendering = false;
|
||||
@@ -79,7 +81,7 @@ public final class MultiblockRenderHandler {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
public static void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(mc.thePlayer != null && mc.objectMouseOver != null && mc.objectMouseOver.getBlockPos() != null && (!mc.thePlayer.isSneaking() || anchor != null)) {
|
||||
renderPlayerLook(mc.thePlayer, mc.objectMouseOver);
|
||||
@@ -87,7 +89,7 @@ public final class MultiblockRenderHandler {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerInteract(PlayerInteractEvent.RightClickBlock event) {
|
||||
public static void onPlayerInteract(PlayerInteractEvent.RightClickBlock event) {
|
||||
if(currentMultiblock != null && anchor == null && event.getEntityPlayer() == Minecraft.getMinecraft().thePlayer) {
|
||||
anchor = event.getPos();
|
||||
angle = event.getEntityPlayer().getHorizontalFacing();
|
||||
@@ -95,12 +97,12 @@ public final class MultiblockRenderHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private void renderPlayerLook(EntityPlayer player, RayTraceResult src) {
|
||||
private static void renderPlayerLook(EntityPlayer player, RayTraceResult src) {
|
||||
if(currentMultiblock != null && dimension == player.worldObj.provider.getDimension()) {
|
||||
BlockPos anchorPos = anchor != null ? anchor : src.getBlockPos();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.disableLighting();
|
||||
@@ -133,7 +135,7 @@ public final class MultiblockRenderHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean renderComponentInWorld(World world, Multiblock mb, MultiblockComponent comp, BlockPos anchorPos) {
|
||||
private static boolean renderComponentInWorld(World world, Multiblock mb, MultiblockComponent comp, BlockPos anchorPos) {
|
||||
double renderPosX, renderPosY, renderPosZ;
|
||||
|
||||
try {
|
||||
|
||||
@@ -37,7 +37,7 @@ public final class RedStringRenderer {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.enableBlend();
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.color(1F, 0F, 0F, sizeAlpha);
|
||||
@@ -81,9 +81,9 @@ public final class RedStringRenderer {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(tile.getPos().getX() + 0.5 - renderPosX, tile.getPos().getY() + 0.5 - renderPosY, tile.getPos().getZ() + 0.5 - renderPosZ);
|
||||
Vector3 vecOrig = new Vector3(bind.getX() - tile.getPos().getX(), bind.getY() - tile.getPos().getY(), bind.getZ() - tile.getPos().getZ());
|
||||
Vector3 vecNorm = vecOrig.copy().normalize();
|
||||
Vector3 vecMag = vecNorm.copy().multiply(0.025);
|
||||
Vector3 vecApply = vecMag.copy();
|
||||
Vector3 vecNorm = vecOrig.normalize();
|
||||
Vector3 vecMag = vecNorm.multiply(0.025);
|
||||
Vector3 vecApply = vecMag;
|
||||
|
||||
int stages = (int) (vecOrig.mag() / vecMag.mag());
|
||||
|
||||
@@ -97,7 +97,7 @@ public final class RedStringRenderer {
|
||||
for(int i = 0; i < stages; i++) {
|
||||
addVertexAtWithTranslation(tessellator, dir, vecApply.x, vecApply.y, vecApply.z, rand, len);
|
||||
rand = Math.random() - 0.5;
|
||||
vecApply.add(vecMag);
|
||||
vecApply = vecApply.add(vecMag);
|
||||
len += add;
|
||||
addVertexAtWithTranslation(tessellator, dir, vecApply.x, vecApply.y, vecApply.z, rand, len);
|
||||
}
|
||||
|
||||
@@ -8,20 +8,23 @@ import net.minecraft.client.model.ModelBook;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.client.event.RenderSpecificHandEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import org.lwjgl.util.glu.Project;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.item.ItemLexicon;
|
||||
@@ -30,115 +33,59 @@ import vazkii.botania.common.item.ModItems;
|
||||
// Hacky way to render 3D lexicon, will be reevaluated in the future.
|
||||
public class RenderLexicon {
|
||||
|
||||
ModelBook model = new ModelBook();
|
||||
ResourceLocation texture = new ResourceLocation(LibResources.MODEL_LEXICA);
|
||||
private final ModelBook model = new ModelBook();
|
||||
private final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_LEXICA);
|
||||
|
||||
@SubscribeEvent
|
||||
public void renderItem(RenderHandEvent evt) {
|
||||
public void renderItem(RenderSpecificHandEvent evt) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(true || !ConfigHandler.lexicon3dModel || mc.gameSettings.thirdPersonView != 0 || !PlayerHelper.hasHeldItem(mc.thePlayer, ModItems.lexicon))
|
||||
if(!ConfigHandler.lexicon3dModel
|
||||
|| mc.gameSettings.thirdPersonView != 0
|
||||
|| mc.thePlayer.getHeldItem(evt.getHand()) == null
|
||||
|| mc.thePlayer.getHeldItem(evt.getHand()).getItem() != ModItems.lexicon)
|
||||
return;
|
||||
evt.setCanceled(true);
|
||||
|
||||
try {
|
||||
// Called immediately before EntityRenderer.renderHand
|
||||
GlStateManager.clear(256);
|
||||
// Begin copy EntityRenderer.renderHand
|
||||
GlStateManager.matrixMode(5889);
|
||||
GlStateManager.loadIdentity();
|
||||
float f = 0.07F;
|
||||
|
||||
if (mc.gameSettings.anaglyph)
|
||||
{
|
||||
GlStateManager.translate((float)(-(/*xOffset*/0 * 2 - 1)) * f, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
float fovModifier = ((float) ClientMethodHandles.getFOVModifier.invokeExact(mc.entityRenderer, ClientTickHandler.partialTicks, false));
|
||||
float farPlane = ((float) ClientMethodHandles.farPlaneDistance_getter.invokeExact(mc.entityRenderer));
|
||||
Project.gluPerspective(fovModifier, (float)mc.displayWidth / (float)mc.displayHeight, 0.05F, farPlane * 2.0F);
|
||||
GlStateManager.matrixMode(5888);
|
||||
GlStateManager.loadIdentity();
|
||||
|
||||
if (mc.gameSettings.anaglyph)
|
||||
{
|
||||
GlStateManager.translate((float)(/*xOffset*/0 * 2 - 1) * 0.1F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
ClientMethodHandles.hurtCameraEffect.invokeExact(mc.entityRenderer, ClientTickHandler.partialTicks);
|
||||
|
||||
if (mc.gameSettings.viewBobbing)
|
||||
{
|
||||
ClientMethodHandles.setupViewBobbing.invokeExact(mc.entityRenderer, ClientTickHandler.partialTicks);
|
||||
}
|
||||
|
||||
boolean flag = mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)mc.getRenderViewEntity()).isPlayerSleeping();
|
||||
|
||||
if (mc.gameSettings.thirdPersonView == 0 && !flag && !mc.gameSettings.hideGUI && !mc.playerController.isSpectator())
|
||||
{
|
||||
ClientMethodHandles.enableLightmap.invokeExact(mc.entityRenderer);
|
||||
renderItemInFirstPerson();
|
||||
ClientMethodHandles.disableLightmap.invokeExact(mc.entityRenderer);
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
if (mc.gameSettings.thirdPersonView == 0 && !flag)
|
||||
{
|
||||
mc.getItemRenderer().renderOverlays(ClientTickHandler.partialTicks);
|
||||
ClientMethodHandles.hurtCameraEffect.invokeExact(mc.entityRenderer, ClientTickHandler.partialTicks);
|
||||
}
|
||||
|
||||
if (mc.gameSettings.viewBobbing)
|
||||
{
|
||||
ClientMethodHandles.setupViewBobbing.invokeExact(mc.entityRenderer, ClientTickHandler.partialTicks);
|
||||
}
|
||||
// End EntityRenderer.renderHand copy
|
||||
renderItemInFirstPerson(mc.thePlayer, evt.getPartialTicks(), evt.getInterpolatedPitch(), evt.getHand(), evt.getSwingProgress(), evt.getItemStack(), evt.getEquipProgress());
|
||||
} catch (Throwable throwable) {
|
||||
FMLLog.warning("[Botania]: Failed to render lexicon");
|
||||
throwable.printStackTrace();
|
||||
Botania.LOGGER.warn("Failed to render lexicon");
|
||||
}
|
||||
}
|
||||
|
||||
private void renderItemInFirstPerson() throws Throwable {
|
||||
private void renderItemInFirstPerson(AbstractClientPlayer player, float partialTicks, float interpPitch, EnumHand hand, float swingProgress, ItemStack stack, float equipProgress) throws Throwable {
|
||||
// Cherry picked from ItemRenderer.renderItemInFirstPerson
|
||||
float prevEquippedProgress = 0;//((float) ClientMethodHandles.prevEquippedProgress_getter.invokeExact(Minecraft.getMinecraft().getItemRenderer()));
|
||||
float equippedProgress = 0;//((float) ClientMethodHandles.equippedProgress_getter.invokeExact(Minecraft.getMinecraft().getItemRenderer()));
|
||||
float f = 1.0F - (prevEquippedProgress + (equippedProgress - prevEquippedProgress) * ClientTickHandler.partialTicks);
|
||||
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
|
||||
float f1 = player.getSwingProgress(ClientTickHandler.partialTicks);
|
||||
float f2 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * ClientTickHandler.partialTicks;
|
||||
float f3 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * ClientTickHandler.partialTicks;
|
||||
this.func_178101_a(f2, f3);
|
||||
this.func_178109_a(player);
|
||||
this.func_178110_a(player, ClientTickHandler.partialTicks);
|
||||
GlStateManager.enableRescaleNormal();
|
||||
boolean flag = hand == EnumHand.MAIN_HAND;
|
||||
EnumHandSide enumhandside = flag ? player.getPrimaryHand() : player.getPrimaryHand().opposite();
|
||||
GlStateManager.pushMatrix();
|
||||
this.func_178105_d(f1);
|
||||
this.transformFirstPersonItem(f, f1);
|
||||
|
||||
doRender();
|
||||
|
||||
boolean flag1 = enumhandside == EnumHandSide.RIGHT;
|
||||
float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float)Math.PI);
|
||||
float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt_float(swingProgress) * ((float)Math.PI * 2F));
|
||||
float f2 = -0.2F * MathHelper.sin(swingProgress * (float)Math.PI);
|
||||
int i = flag1 ? 1 : -1;
|
||||
GlStateManager.translate((float)i * f, f1, f2);
|
||||
this.transformSideFirstPerson(enumhandside, equipProgress);
|
||||
this.transformFirstPerson(enumhandside, swingProgress);
|
||||
doRender(enumhandside, partialTicks, stack);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
|
||||
private void doRender() {
|
||||
private void doRender(EnumHandSide side, float partialTicks, ItemStack stack) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
float opening = 0F;
|
||||
float pageFlip = 0F;
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
float opening;
|
||||
float pageFlip;
|
||||
|
||||
float ticks = ClientTickHandler.ticksWithLexicaOpen;
|
||||
if(ticks > 0 && ticks < 10) {
|
||||
if(Minecraft.getMinecraft().currentScreen instanceof GuiLexicon)
|
||||
ticks += ClientTickHandler.partialTicks;
|
||||
else ticks -= ClientTickHandler.partialTicks;
|
||||
ticks += partialTicks;
|
||||
else ticks -= partialTicks;
|
||||
}
|
||||
|
||||
GlStateManager.translate(0.3F + 0.02F * ticks, 0.475F + 0.01F * ticks, -0.2F - 0.01F * ticks);
|
||||
GlStateManager.rotate(87.5F + ticks * 5, 0F, 1F, 0F);
|
||||
GlStateManager.rotate(87.5F + ticks * (side == EnumHandSide.RIGHT ? 5 : 10), 0F, 1F, 0F);
|
||||
GlStateManager.rotate(ticks * 2.85F, 0F, 0F, 1F);
|
||||
opening = ticks / 12F;
|
||||
|
||||
@@ -154,91 +101,71 @@ public class RenderLexicon {
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.translate(-0.3F, -0.21F, -0.07F);
|
||||
GlStateManager.scale(0.0035F, 0.0035F, -0.0035F);
|
||||
boolean bevo = Minecraft.getMinecraft().thePlayer.getName().equalsIgnoreCase("BevoLJ");
|
||||
boolean saice = Minecraft.getMinecraft().thePlayer.getName().equalsIgnoreCase("saice");
|
||||
boolean bevo = mc.thePlayer.getName().equalsIgnoreCase("BevoLJ");
|
||||
boolean saice = mc.thePlayer.getName().equalsIgnoreCase("saice");
|
||||
|
||||
String title = ModItems.lexicon.getItemStackDisplayName(null);
|
||||
String origTitle = title;
|
||||
|
||||
ItemStack stack = PlayerHelper.getFirstHeldItemClass(Minecraft.getMinecraft().thePlayer, Item.class);
|
||||
if(stack != null)
|
||||
title = stack.getDisplayName();
|
||||
if(title.equals(origTitle) && bevo)
|
||||
title = I18n.translateToLocal("item.botania:lexicon.bevo");
|
||||
title = I18n.format("item.botania:lexicon.bevo");
|
||||
if(title.equals(origTitle) && saice)
|
||||
title = I18n.translateToLocal("item.botania:lexicon.saice");
|
||||
title = I18n.format("item.botania:lexicon.saice");
|
||||
|
||||
font.drawString(font.trimStringToWidth(title, 80), 0, 0, 0xD69700);
|
||||
GlStateManager.translate(0F, 10F, 0F);
|
||||
GlStateManager.scale(0.6F, 0.6F, 0.6F);
|
||||
font.drawString(TextFormatting.ITALIC + "" + TextFormatting.BOLD + String.format(I18n.translateToLocal("botaniamisc.edition"), ItemLexicon.getEdition()), 0, 0, 0xA07100);
|
||||
font.drawString(TextFormatting.ITALIC + "" + TextFormatting.BOLD + I18n.format("botaniamisc.edition", ItemLexicon.getEdition()), 0, 0, 0xA07100);
|
||||
|
||||
GlStateManager.translate(0F, 15F, 0F);
|
||||
font.drawString(I18n.translateToLocal("botaniamisc.lexiconcover0"), 0, 0, 0x79ff92);
|
||||
font.drawString(I18n.format("botaniamisc.lexiconcover0"), 0, 0, 0x79ff92);
|
||||
|
||||
GlStateManager.translate(0F, 10F, 0F);
|
||||
font.drawString(I18n.translateToLocal("botaniamisc.lexiconcover1"), 0, 0, 0x79ff92);
|
||||
font.drawString(I18n.format("botaniamisc.lexiconcover1"), 0, 0, 0x79ff92);
|
||||
|
||||
GlStateManager.translate(0F, 50F, 0F);
|
||||
font.drawString(I18n.translateToLocal("botaniamisc.lexiconcover2"), 0, 0, 0x79ff92);
|
||||
font.drawString(I18n.format("botaniamisc.lexiconcover2"), 0, 0, 0x79ff92);
|
||||
|
||||
GlStateManager.translate(0F, 10F, 0F);
|
||||
font.drawString(TextFormatting.UNDERLINE + "" + TextFormatting.ITALIC + I18n.translateToLocal("botaniamisc.lexiconcover3"), 0, 0, 0x79ff92);
|
||||
font.drawString(TextFormatting.UNDERLINE + "" + TextFormatting.ITALIC + I18n.format("botaniamisc.lexiconcover3"), 0, 0, 0x79ff92);
|
||||
|
||||
if(bevo || saice) {
|
||||
GlStateManager.translate(0F, 10F, 0F);
|
||||
font.drawString(I18n.translateToLocal("botaniamisc.lexiconcover" + (bevo ? 4 : 5)), 0, 0, 0x79ff92);
|
||||
font.drawString(I18n.format("botaniamisc.lexiconcover" + (bevo ? 4 : 5)), 0, 0, 0x79ff92);
|
||||
}
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F);
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
// Copy - ItemRenderer.func_178101_a
|
||||
private void func_178101_a(float angle, float p_178101_2_) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.rotate(angle, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate(p_178101_2_, 0.0F, 1.0F, 0.0F);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GlStateManager.popMatrix();
|
||||
// Copy - ItemRenderer.transformSideFirstPerson
|
||||
// Arg - Side, EquipProgress
|
||||
private void transformSideFirstPerson(EnumHandSide p_187459_1_, float p_187459_2_)
|
||||
{
|
||||
int i = p_187459_1_ == EnumHandSide.RIGHT ? 1 : -1;
|
||||
GlStateManager.translate((float)i * 0.56F, -0.52F + p_187459_2_ * -0.6F, -0.72F);
|
||||
}
|
||||
|
||||
// Copy - ItemRenderer.func_178109_a
|
||||
private void func_178109_a(AbstractClientPlayer clientPlayer) {
|
||||
int i = Minecraft.getMinecraft().theWorld.getCombinedLight(new BlockPos(clientPlayer.posX, clientPlayer.posY + (double)clientPlayer.getEyeHeight(), clientPlayer.posZ), 0);
|
||||
float f = (float)(i & 65535);
|
||||
float f1 = (float)(i >> 16);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f, f1);
|
||||
}
|
||||
|
||||
// Copy - ItemRenderer.func_178110_a
|
||||
private void func_178110_a(EntityPlayerSP entityplayerspIn, float partialTicks) {
|
||||
float f = entityplayerspIn.prevRenderArmPitch + (entityplayerspIn.renderArmPitch - entityplayerspIn.prevRenderArmPitch) * partialTicks;
|
||||
float f1 = entityplayerspIn.prevRenderArmYaw + (entityplayerspIn.renderArmYaw - entityplayerspIn.prevRenderArmYaw) * partialTicks;
|
||||
GlStateManager.rotate((entityplayerspIn.rotationPitch - f) * 0.1F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate((entityplayerspIn.rotationYaw - f1) * 0.1F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
// Copy - ItemRenderer.func_178105_d
|
||||
private void func_178105_d(float p_178105_1_) {
|
||||
float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(p_178105_1_) * (float)Math.PI);
|
||||
float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt_float(p_178105_1_) * (float)Math.PI * 2.0F);
|
||||
float f2 = -0.2F * MathHelper.sin(p_178105_1_ * (float)Math.PI);
|
||||
GlStateManager.translate(f, f1, f2);
|
||||
}
|
||||
|
||||
// Copy with modification - ItemRenderer.transformFirstPersonItem
|
||||
private void transformFirstPersonItem(float equipProgress, float swingProgress) {
|
||||
GlStateManager.translate(1.2F, -1F, -0.71999997F); // Botania - x(0.56) -> 1; y(-0.52) -> -1
|
||||
GlStateManager.translate(0.0F, equipProgress * -0.6F, 0.0F);
|
||||
GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); // Botania - 45 -> 90
|
||||
GlStateManager.rotate(-20, 0, 0, 1); // Botania - added
|
||||
float f = MathHelper.sin(swingProgress * swingProgress * (float)Math.PI);
|
||||
float f1 = MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float)Math.PI);
|
||||
GlStateManager.rotate(f * -20.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotate(f1 * -20.0F, 0.0F, 0.0F, 1.0F);
|
||||
// Copy with modification - ItemRenderer.transformFirstPerson
|
||||
// Arg - Side, SwingProgress
|
||||
private void transformFirstPerson(EnumHandSide p_187453_1_, float p_187453_2_)
|
||||
{
|
||||
int i = p_187453_1_ == EnumHandSide.RIGHT ? 1 : -1;
|
||||
// Botania - added
|
||||
GlStateManager.translate(p_187453_1_ == EnumHandSide.RIGHT ? 0.5F : 0.3F, -0.25F, 0.2F);
|
||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||
GlStateManager.rotate(12F, 0F, 0F, -1F);
|
||||
// End add
|
||||
float f = MathHelper.sin(p_187453_2_ * p_187453_2_ * (float)Math.PI);
|
||||
GlStateManager.rotate((float)i * (45.0F + f * -20.0F), 0.0F, 1.0F, 0.0F);
|
||||
float f1 = MathHelper.sin(MathHelper.sqrt_float(p_187453_2_) * (float)Math.PI);
|
||||
GlStateManager.rotate((float)i * f1 * -20.0F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.rotate(f1 * -80.0F, 1.0F, 0.0F, 0.0F);
|
||||
// GlStateManager.scale(0.4F, 0.4F, 0.4F); Botania - removed
|
||||
GlStateManager.rotate((float)i * -45.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,8 +34,10 @@ import java.awt.*;
|
||||
|
||||
public final class SubTileRadiusRenderHandler {
|
||||
|
||||
private SubTileRadiusRenderHandler() {}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
public static void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
RayTraceResult pos = mc.objectMouseOver;
|
||||
|
||||
@@ -64,7 +66,7 @@ public final class SubTileRadiusRenderHandler {
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.disableTexture2D();
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -79,7 +81,7 @@ public final class SubTileRadiusRenderHandler {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
private void renderRectangle(AxisAlignedBB aabb) {
|
||||
private static void renderRectangle(AxisAlignedBB aabb) {
|
||||
double renderPosX, renderPosY, renderPosZ;
|
||||
|
||||
try {
|
||||
@@ -124,7 +126,7 @@ public final class SubTileRadiusRenderHandler {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
private void renderCircle(BlockPos center, double radius) {
|
||||
private static void renderCircle(BlockPos center, double radius) {
|
||||
double renderPosX, renderPosY, renderPosZ;
|
||||
|
||||
try {
|
||||
|
||||
+107
-129
@@ -17,11 +17,16 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.client.event.RenderTooltipEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -44,132 +49,105 @@ public final class TooltipAdditionDisplayHandler {
|
||||
|
||||
private static float lexiconLookupTime = 0F;
|
||||
|
||||
public static void render() {
|
||||
@SubscribeEvent
|
||||
public static void onToolTipRender(RenderTooltipEvent.PostText evt) {
|
||||
if(evt.getStack() == null)
|
||||
return;
|
||||
|
||||
ItemStack stack = evt.getStack();
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
GuiScreen gui = mc.currentScreen;
|
||||
if(gui != null && gui instanceof GuiContainer && mc.thePlayer != null && mc.thePlayer.inventory.getItemStack() == null) {
|
||||
GuiContainer container = (GuiContainer) gui;
|
||||
Slot slot = ReflectionHelper.getPrivateValue(GuiContainer.class, container, LibObfuscation.THE_SLOT);
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
if(stack != null) {
|
||||
ScaledResolution res = new ScaledResolution(mc);
|
||||
FontRenderer font = mc.fontRendererObj;
|
||||
int mouseX = Mouse.getX() * res.getScaledWidth() / mc.displayWidth;
|
||||
int mouseY = res.getScaledHeight() - Mouse.getY() * res.getScaledHeight() / mc.displayHeight;
|
||||
int width = evt.getWidth();
|
||||
int height = 3;
|
||||
int tooltipX = evt.getX();
|
||||
int tooltipY = evt.getY() - 4;
|
||||
FontRenderer font = evt.getFontRenderer();
|
||||
|
||||
List<String> tooltip;
|
||||
try {
|
||||
tooltip = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips);
|
||||
} catch(Exception e) {
|
||||
tooltip = new ArrayList<>();
|
||||
if(stack.getItem() instanceof ItemTerraPick)
|
||||
drawTerraPick(stack, tooltipX, tooltipY, width, height, font);
|
||||
else if(stack.getItem() instanceof IManaTooltipDisplay)
|
||||
drawManaBar(stack, (IManaTooltipDisplay) stack.getItem(), tooltipX, tooltipY, width, height);
|
||||
|
||||
EntryData data = LexiconRecipeMappings.getDataForStack(stack);
|
||||
if(data != null) {
|
||||
int lexSlot = -1;
|
||||
ItemStack lexiconStack = null;
|
||||
|
||||
for(int i = 0; i < InventoryPlayer.getHotbarSize(); i++) {
|
||||
ItemStack stackAt = mc.thePlayer.inventory.getStackInSlot(i);
|
||||
if(stackAt != null && stackAt.getItem() instanceof ILexicon && ((ILexicon) stackAt.getItem()).isKnowledgeUnlocked(stackAt, data.entry.getKnowledgeType())) {
|
||||
lexiconStack = stackAt;
|
||||
lexSlot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(lexSlot > -1) {
|
||||
int x = tooltipX - 34;
|
||||
GlStateManager.disableDepth();
|
||||
|
||||
Gui.drawRect(x - 4, tooltipY - 4, x + 20, tooltipY + 26, 0x44000000);
|
||||
Gui.drawRect(x - 6, tooltipY - 6, x + 22, tooltipY + 28, 0x44000000);
|
||||
|
||||
if(ConfigHandler.useShiftForQuickLookup ? GuiScreen.isShiftKeyDown() : GuiScreen.isCtrlKeyDown()) {
|
||||
lexiconLookupTime += ClientTickHandler.delta;
|
||||
|
||||
int cx = x + 8;
|
||||
int cy = tooltipY + 8;
|
||||
float r = 12;
|
||||
float time = 20F;
|
||||
float angles = lexiconLookupTime / time * 360F;
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.shadeModel(GL11.GL_SMOOTH);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
VertexBuffer buf = Tessellator.getInstance().getBuffer();
|
||||
buf.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
|
||||
|
||||
float a = 0.5F + 0.2F * ((float) Math.cos((double) (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) / 10) * 0.5F + 0.5F);
|
||||
buf.pos(cx, cy, 0).color(0F, 0.5F, 0F, a).endVertex();
|
||||
|
||||
for(float i = angles; i > 0; i--) {
|
||||
double rad = (i - 90) / 180F * Math.PI;
|
||||
buf.pos(cx + Math.cos(rad) * r, cy + Math.sin(rad) * r, 0).color(0F, 1F, 0F, 1F).endVertex();
|
||||
}
|
||||
int width = 0;
|
||||
for(String s : tooltip)
|
||||
width = Math.max(width, font.getStringWidth(s) + 2);
|
||||
int tooltipHeight = (tooltip.size() - 1) * 10 + 5;
|
||||
|
||||
int height = 3;
|
||||
int offx = 11;
|
||||
int offy = 17;
|
||||
buf.pos(cx, cy, 0).color(0F, 1F, 0F, 0F).endVertex();
|
||||
Tessellator.getInstance().draw();
|
||||
|
||||
boolean offscreen = mouseX + width + 19 >= res.getScaledWidth();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableTexture2D();
|
||||
GlStateManager.shadeModel(GL11.GL_FLAT);
|
||||
|
||||
int fixY = res.getScaledHeight() - (mouseY + tooltipHeight);
|
||||
if(fixY < 0)
|
||||
offy -= fixY;
|
||||
if(offscreen)
|
||||
offx = -13 - width;
|
||||
if(lexiconLookupTime >= time) {
|
||||
mc.thePlayer.inventory.currentItem = lexSlot;
|
||||
Botania.proxy.setEntryToOpen(data.entry);
|
||||
Botania.proxy.setLexiconStack(lexiconStack);
|
||||
mc.thePlayer.closeScreen();
|
||||
ItemLexicon.openBook(mc.thePlayer, lexiconStack, mc.theWorld, false);
|
||||
|
||||
if(stack.getItem() instanceof ItemTerraPick)
|
||||
drawTerraPick(stack, mouseX, mouseY, offx, offy, width, height, font);
|
||||
else if(stack.getItem() instanceof IManaTooltipDisplay)
|
||||
drawManaBar(stack, (IManaTooltipDisplay) stack.getItem(), mouseX, mouseY, offx, offy, width, height);
|
||||
|
||||
EntryData data = LexiconRecipeMappings.getDataForStack(stack);
|
||||
if(data != null) {
|
||||
int lexSlot = -1;
|
||||
ItemStack lexiconStack = null;
|
||||
|
||||
for(int i = 0; i < InventoryPlayer.getHotbarSize(); i++) {
|
||||
ItemStack stackAt = mc.thePlayer.inventory.getStackInSlot(i);
|
||||
if(stackAt != null && stackAt.getItem() instanceof ILexicon && ((ILexicon) stackAt.getItem()).isKnowledgeUnlocked(stackAt, data.entry.getKnowledgeType())) {
|
||||
lexiconStack = stackAt;
|
||||
lexSlot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(lexSlot > -1) {
|
||||
int x = mouseX + offx - 34;
|
||||
int y = mouseY - offy;
|
||||
GlStateManager.disableDepth();
|
||||
|
||||
Gui.drawRect(x - 4, y - 4, x + 20, y + 26, 0x44000000);
|
||||
Gui.drawRect(x - 6, y - 6, x + 22, y + 28, 0x44000000);
|
||||
|
||||
if(ConfigHandler.useShiftForQuickLookup ? GuiScreen.isShiftKeyDown() : GuiScreen.isCtrlKeyDown()) {
|
||||
lexiconLookupTime += ClientTickHandler.delta;
|
||||
|
||||
int cx = x + 8;
|
||||
int cy = y + 8;
|
||||
float r = 12;
|
||||
float time = 20F;
|
||||
float angles = lexiconLookupTime / time * 360F;
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.shadeModel(GL11.GL_SMOOTH);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glBegin(GL11.GL_TRIANGLE_FAN);
|
||||
|
||||
float a = 0.5F + 0.2F * ((float) Math.cos((double) (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) / 10) * 0.5F + 0.5F);
|
||||
GlStateManager.color(0F, 0.5F, 0F, a);
|
||||
GL11.glVertex2i(cx, cy);
|
||||
GlStateManager.color(0F, 1F, 0F, 1F);
|
||||
|
||||
for(float i = angles; i > 0; i--) {
|
||||
double rad = (i - 90) / 180F * Math.PI;
|
||||
GL11.glVertex2d(cx + Math.cos(rad) * r, cy + Math.sin(rad) * r);
|
||||
}
|
||||
GL11.glVertex2i(cx, cy);
|
||||
GL11.glEnd();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableTexture2D();
|
||||
GlStateManager.shadeModel(GL11.GL_FLAT);
|
||||
|
||||
if(lexiconLookupTime >= time) {
|
||||
mc.thePlayer.inventory.currentItem = lexSlot;
|
||||
Botania.proxy.setEntryToOpen(data.entry);
|
||||
Botania.proxy.setLexiconStack(lexiconStack);
|
||||
mc.thePlayer.closeScreen();
|
||||
ItemLexicon.openBook(mc.thePlayer, lexiconStack, mc.theWorld, false);
|
||||
|
||||
}
|
||||
} else lexiconLookupTime = 0F;
|
||||
|
||||
mc.getRenderItem().renderItemIntoGUI(new ItemStack(ModItems.lexicon), x, y);
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
font.drawStringWithShadow("?", x + 10, y + 8, 0xFFFFFFFF);
|
||||
GlStateManager.scale(0.5F, 0.5F, 1F);
|
||||
boolean mac = Minecraft.IS_RUNNING_ON_MAC;
|
||||
|
||||
mc.fontRendererObj.drawStringWithShadow(TextFormatting.BOLD + (ConfigHandler.useShiftForQuickLookup ? "Shift" : mac ? "Cmd" : "Ctrl"), (x + 10) * 2 - 16, (y + 8) * 2 + 20, 0xFFFFFFFF);
|
||||
GlStateManager.scale(2F, 2F, 1F);
|
||||
|
||||
|
||||
GlStateManager.enableDepth();
|
||||
} else lexiconLookupTime = 0F;
|
||||
} else lexiconLookupTime = 0F;
|
||||
}
|
||||
} else lexiconLookupTime = 0F;
|
||||
|
||||
mc.getRenderItem().renderItemIntoGUI(new ItemStack(ModItems.lexicon), x, tooltipY);
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
font.drawStringWithShadow("?", x + 10, tooltipY + 8, 0xFFFFFFFF);
|
||||
GlStateManager.scale(0.5F, 0.5F, 1F);
|
||||
boolean mac = Minecraft.IS_RUNNING_ON_MAC;
|
||||
|
||||
mc.fontRendererObj.drawStringWithShadow(TextFormatting.BOLD + (ConfigHandler.useShiftForQuickLookup ? "Shift" : mac ? "Cmd" : "Ctrl"), (x + 10) * 2 - 16, (tooltipY + 8) * 2 + 20, 0xFFFFFFFF);
|
||||
GlStateManager.scale(2F, 2F, 1F);
|
||||
|
||||
|
||||
GlStateManager.enableDepth();
|
||||
} else lexiconLookupTime = 0F;
|
||||
} else lexiconLookupTime = 0F;
|
||||
}
|
||||
|
||||
private static void drawTerraPick(ItemStack stack, int mouseX, int mouseY, int offx, int offy, int width, int height, FontRenderer font) {
|
||||
private static void drawTerraPick(ItemStack stack, int mouseX, int mouseY, int width, int height, FontRenderer font) {
|
||||
int level = ItemTerraPick.getLevel(stack);
|
||||
int max = ItemTerraPick.LEVELS[Math.min(ItemTerraPick.LEVELS.length - 1, level + 1)];
|
||||
boolean ss = level >= ItemTerraPick.LEVELS.length - 1;
|
||||
@@ -180,33 +158,33 @@ public final class TooltipAdditionDisplayHandler {
|
||||
float hueOff = (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.01F;
|
||||
|
||||
GlStateManager.disableDepth();
|
||||
Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, 0xFF000000);
|
||||
Gui.drawRect(mouseX - 1, mouseY - height - 1, mouseX + width + 1, mouseY, 0xFF000000);
|
||||
for(int i = 0; i < rainbowWidth; i++)
|
||||
Gui.drawRect(mouseX + offx + i, mouseY - offy - height, mouseX + offx + i + 1, mouseY - offy, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
|
||||
Gui.drawRect(mouseX + offx + rainbowWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, 0xFF555555);
|
||||
Gui.drawRect(mouseX + i, mouseY - height, mouseX + i + 1, mouseY, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
|
||||
Gui.drawRect(mouseX + rainbowWidth, mouseY - height, mouseX + width, mouseY, 0xFF555555);
|
||||
|
||||
String rank = I18n.translateToLocal("botania.rank" + level).replaceAll("&", "\u00a7");
|
||||
String rank = I18n.format("botania.rank" + level).replaceAll("&", "\u00a7");
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
font.drawStringWithShadow(rank, mouseX + offx, mouseY - offy - 12, 0xFFFFFF);
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
GlStateManager.disableLighting();
|
||||
font.drawStringWithShadow(rank, mouseX, mouseY - 12, 0xFFFFFF);
|
||||
if(!ss) {
|
||||
rank = I18n.translateToLocal("botania.rank" + (level + 1)).replaceAll("&", "\u00a7");
|
||||
font.drawStringWithShadow(rank, mouseX + offx + width - font.getStringWidth(rank), mouseY - offy - 12, 0xFFFFFF);
|
||||
rank = I18n.format("botania.rank" + (level + 1)).replaceAll("&", "\u00a7");
|
||||
font.drawStringWithShadow(rank, mouseX + width - font.getStringWidth(rank), mouseY - 12, 0xFFFFFF);
|
||||
}
|
||||
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableDepth();
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
private static void drawManaBar(ItemStack stack, IManaTooltipDisplay display, int mouseX, int mouseY, int offx, int offy, int width, int height) {
|
||||
private static void drawManaBar(ItemStack stack, IManaTooltipDisplay display, int mouseX, int mouseY, int width, int height) {
|
||||
float fraction = display.getManaFractionForDisplay(stack);
|
||||
int manaBarWidth = (int) Math.ceil(width * fraction);
|
||||
|
||||
GlStateManager.disableDepth();
|
||||
Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, 0xFF000000);
|
||||
Gui.drawRect(mouseX + offx, mouseY - offy - height, mouseX + offx + manaBarWidth, mouseY - offy, Color.HSBtoRGB(0.528F, ((float) Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2) + 1F) * 0.3F + 0.4F, 1F));
|
||||
Gui.drawRect(mouseX + offx + manaBarWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, 0xFF555555);
|
||||
Gui.drawRect(mouseX - 1, mouseY - height - 1, mouseX + width + 1, mouseY, 0xFF000000);
|
||||
Gui.drawRect(mouseX, mouseY - height, mouseX + manaBarWidth, mouseY, Color.HSBtoRGB(0.528F, ((float) Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2) + 1F) * 0.3F + 0.4F, 1F));
|
||||
Gui.drawRect(mouseX + manaBarWidth, mouseY - height, mouseX + width, mouseY, 0xFF555555);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,9 +10,9 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -23,17 +23,11 @@ import vazkii.botania.common.item.ItemRegenIvy;
|
||||
public final class TooltipHandler {
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public void onTooltipEvent(ItemTooltipEvent event) {
|
||||
if(event.getItemStack().getItem() == Item.getItemFromBlock(Blocks.DIRT) && event.getItemStack().getItemDamage() == 1) {
|
||||
event.getToolTip().add(I18n.translateToLocal("botaniamisc.coarseDirt0"));
|
||||
event.getToolTip().add(I18n.translateToLocal("botaniamisc.coarseDirt1"));
|
||||
} else if(event.getItemStack().getItem() == Item.getItemFromBlock(Blocks.MOB_SPAWNER) && event.getEntityPlayer().capabilities.isCreativeMode)
|
||||
event.getToolTip().add(I18n.translateToLocal("botaniamisc.spawnerTip"));
|
||||
|
||||
public static void onTooltipEvent(ItemTooltipEvent event) {
|
||||
if(ItemNBTHelper.detectNBT(event.getItemStack()) && ItemNBTHelper.getBoolean(event.getItemStack(), ItemRegenIvy.TAG_REGEN, false))
|
||||
event.getToolTip().add(I18n.translateToLocal("botaniamisc.hasIvy"));
|
||||
event.getToolTip().add(I18n.format("botaniamisc.hasIvy"));
|
||||
if(ItemNBTHelper.detectNBT(event.getItemStack()) && ItemNBTHelper.getBoolean(event.getItemStack(), ItemKeepIvy.TAG_KEEP, false))
|
||||
event.getToolTip().add(I18n.translateToLocal("botaniamisc.hasKeepIvy"));
|
||||
event.getToolTip().add(I18n.format("botaniamisc.hasKeepIvy"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -220,16 +221,19 @@ public final class RenderHelper {
|
||||
GlStateManager.depthMask(true);
|
||||
GL11.glStencilMask(0x00);
|
||||
GL11.glStencilFunc(GL11.GL_EQUAL, 1, 0xFF);
|
||||
GL11.glBegin(GL11.GL_TRIANGLE_FAN);
|
||||
GlStateManager.color(0F, 0.5F, 0.5F, a);
|
||||
GL11.glVertex2i(centerX, centerY);
|
||||
GlStateManager.color(0F, 1F, 0.5F, a);
|
||||
|
||||
VertexBuffer buf = Tessellator.getInstance().getBuffer();
|
||||
buf.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
|
||||
buf.pos(centerX, centerY, 0).color(0, 0.5F, 0.5F, a).endVertex();
|
||||
|
||||
for(int i = degs; i > 0; i--) {
|
||||
double rad = (i - 90) / 180F * Math.PI;
|
||||
GL11.glVertex2d(centerX + Math.cos(rad) * r, centerY + Math.sin(rad) * r);
|
||||
buf.pos(centerX + Math.cos(rad) * r, centerY + Math.sin(rad) * r, 0).color(0F, 1F, 0.5F, a).endVertex();
|
||||
}
|
||||
GL11.glVertex2i(centerX, centerY);
|
||||
GL11.glEnd();
|
||||
|
||||
buf.pos(centerX, centerY, 0).color(0F, 1F, 0.5F, a).endVertex();
|
||||
Tessellator.getInstance().draw();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableTexture2D();
|
||||
GlStateManager.shadeModel(GL11.GL_FLAT);
|
||||
@@ -241,7 +245,7 @@ public final class RenderHelper {
|
||||
KeyBinding[] keys = Minecraft.getMinecraft().gameSettings.keyBindings;
|
||||
for(KeyBinding otherKey : keys)
|
||||
if(otherKey.getKeyDescription().equals(keyName)) {
|
||||
key = Keyboard.getKeyName(otherKey.getKeyCode());
|
||||
key = otherKey.getDisplayName();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
package vazkii.botania.client.core.helper;
|
||||
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.lwjgl.opengl.ARBFragmentShader;
|
||||
import org.lwjgl.opengl.ARBShaderObjects;
|
||||
import org.lwjgl.opengl.ARBVertexShader;
|
||||
@@ -20,6 +18,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.internal.ShaderCallback;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -92,7 +91,7 @@ public final class ShaderHelper {
|
||||
// http://lwjgl.org/wiki/index.php?title=GLSL_Shaders_with_LWJGL
|
||||
|
||||
private static int createProgram(String vert, String frag) {
|
||||
int vertId = 0, fragId = 0, program = 0;
|
||||
int vertId = 0, fragId = 0, program;
|
||||
if(vert != null)
|
||||
vertId = createShader(vert, VERT);
|
||||
if(frag != null)
|
||||
@@ -109,13 +108,13 @@ public final class ShaderHelper {
|
||||
|
||||
ARBShaderObjects.glLinkProgramARB(program);
|
||||
if(ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE) {
|
||||
FMLLog.log(Level.ERROR, getLogInfo(program));
|
||||
Botania.LOGGER.error(getLogInfo(program));
|
||||
return 0;
|
||||
}
|
||||
|
||||
ARBShaderObjects.glValidateProgramARB(program);
|
||||
if (ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE) {
|
||||
FMLLog.log(Level.ERROR, getLogInfo(program));
|
||||
Botania.LOGGER.error(getLogInfo(program));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ package vazkii.botania.client.core.proxy;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.multiplayer.PlayerControllerMP;
|
||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
@@ -25,16 +26,16 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSettings.GameType;
|
||||
import net.minecraftforge.client.model.animation.AnimationTESR;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import vazkii.botania.api.boss.IBotaniaBoss;
|
||||
import vazkii.botania.api.item.IExtendedPlayerController;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -61,13 +62,16 @@ import vazkii.botania.client.core.handler.MultiblockRenderHandler;
|
||||
import vazkii.botania.client.core.handler.PersistentVariableHelper;
|
||||
import vazkii.botania.client.core.handler.RenderLexicon;
|
||||
import vazkii.botania.client.core.handler.SubTileRadiusRenderHandler;
|
||||
import vazkii.botania.client.core.handler.TooltipAdditionDisplayHandler;
|
||||
import vazkii.botania.client.core.handler.TooltipHandler;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.client.fx.FXLightning;
|
||||
import vazkii.botania.client.fx.FXSparkle;
|
||||
import vazkii.botania.client.fx.FXWisp;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexiconEntry;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexiconIndex;
|
||||
import vazkii.botania.client.render.entity.LayerGaiaHead;
|
||||
import vazkii.botania.client.render.entity.RenderBabylonWeapon;
|
||||
import vazkii.botania.client.render.entity.RenderCorporeaSpark;
|
||||
import vazkii.botania.client.render.entity.RenderDoppleganger;
|
||||
@@ -95,7 +99,7 @@ import vazkii.botania.client.render.tile.RenderTilePrism;
|
||||
import vazkii.botania.client.render.tile.RenderTilePylon;
|
||||
import vazkii.botania.client.render.tile.RenderTileRedString;
|
||||
import vazkii.botania.client.render.tile.RenderTileRuneAltar;
|
||||
import vazkii.botania.client.render.tile.RenderTileSkullOverride;
|
||||
import vazkii.botania.client.render.tile.RenderTileGaiaHead;
|
||||
import vazkii.botania.client.render.tile.RenderTileSparkChanger;
|
||||
import vazkii.botania.client.render.tile.RenderTileSpreader;
|
||||
import vazkii.botania.client.render.tile.RenderTileStarfield;
|
||||
@@ -103,6 +107,8 @@ import vazkii.botania.client.render.tile.RenderTileTerraPlate;
|
||||
import vazkii.botania.client.render.tile.RenderTileTeruTeruBozu;
|
||||
import vazkii.botania.client.render.tile.RenderTileTinyPotato;
|
||||
import vazkii.botania.client.render.world.SkyblockRenderEvents;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.subtile.functional.BergamuteEventHandler;
|
||||
import vazkii.botania.common.block.tile.TileAlfPortal;
|
||||
import vazkii.botania.common.block.tile.TileAltar;
|
||||
import vazkii.botania.common.block.tile.TileAvatar;
|
||||
@@ -133,7 +139,7 @@ import vazkii.botania.common.block.tile.string.TileRedString;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.helper.MathHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.core.proxy.CommonProxy;
|
||||
import vazkii.botania.common.core.proxy.IProxy;
|
||||
import vazkii.botania.common.core.version.AdaptorNotifier;
|
||||
import vazkii.botania.common.core.version.VersionChecker;
|
||||
import vazkii.botania.common.entity.EntityBabylonWeapon;
|
||||
@@ -161,11 +167,16 @@ import java.time.LocalDateTime;
|
||||
import java.time.Month;
|
||||
import java.util.Map;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
public class ClientProxy implements IProxy {
|
||||
|
||||
public static boolean jingleTheBells = false;
|
||||
public static boolean dootDoot = false;
|
||||
|
||||
private static final ModelBiped EMPTY_MODEL = new ModelBiped();
|
||||
static {
|
||||
EMPTY_MODEL.setInvisible(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
PersistentVariableHelper.setCacheFile(new File(Minecraft.getMinecraft().mcDataDir, "BotaniaVars.dat"));
|
||||
@@ -173,12 +184,9 @@ public class ClientProxy extends CommonProxy {
|
||||
PersistentVariableHelper.load();
|
||||
PersistentVariableHelper.save();
|
||||
} catch (IOException e) {
|
||||
FMLLog.severe("Botania's persistent Variables couldn't load!");
|
||||
e.printStackTrace();
|
||||
Botania.LOGGER.fatal("Persistent Variables couldn't load!!");
|
||||
}
|
||||
|
||||
super.preInit(event);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(MiscellaneousIcons.INSTANCE);
|
||||
ModelHandler.registerModels();
|
||||
initRenderers();
|
||||
@@ -186,29 +194,30 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
super.init(event);
|
||||
ColorHandler.init();
|
||||
initAuxiliaryRender();
|
||||
|
||||
ModChallenges.init();
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new ClientTickHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new HUDHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new LightningHandler());
|
||||
MinecraftForge.EVENT_BUS.register(ClientTickHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(HUDHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(LightningHandler.class);
|
||||
if(ConfigHandler.boundBlockWireframe)
|
||||
MinecraftForge.EVENT_BUS.register(new BoundTileRenderer());
|
||||
MinecraftForge.EVENT_BUS.register(new TooltipHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new DebugHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new SubTileRadiusRenderHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new MultiblockRenderHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new SkyblockRenderEvents());
|
||||
MinecraftForge.EVENT_BUS.register(BoundTileRenderer.class);
|
||||
MinecraftForge.EVENT_BUS.register(TooltipHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(TooltipAdditionDisplayHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(DebugHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(SubTileRadiusRenderHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(MultiblockRenderHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(SkyblockRenderEvents.class);
|
||||
MinecraftForge.EVENT_BUS.register(new RenderLexicon());
|
||||
MinecraftForge.EVENT_BUS.register(new BossBarHandler());
|
||||
MinecraftForge.EVENT_BUS.register(BossBarHandler.class);
|
||||
MinecraftForge.EVENT_BUS.register(BergamuteEventHandler.class);
|
||||
|
||||
if(ConfigHandler.useAdaptativeConfig)
|
||||
MinecraftForge.EVENT_BUS.register(new AdaptorNotifier());
|
||||
MinecraftForge.EVENT_BUS.register(AdaptorNotifier.class);
|
||||
if(ConfigHandler.versionCheckEnabled)
|
||||
new VersionChecker().init();
|
||||
VersionChecker.init();
|
||||
|
||||
if(ConfigHandler.enableSeasonalFeatures) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
@@ -222,7 +231,6 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
super.postInit(event);
|
||||
CorporeaAutoCompleteHandler.updateItemList();
|
||||
}
|
||||
|
||||
@@ -252,7 +260,7 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCocoon.class, new RenderTileCocoon());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileLightRelay.class, new RenderTileLightRelay());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileBellows.class, new RenderTileBellows());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileGaiaHead.class, new RenderTileSkullOverride());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileGaiaHead.class, new RenderTileGaiaHead());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTeruTeruBozu.class, new RenderTileTeruTeruBozu());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileAvatar.class, new RenderTileAvatar());
|
||||
|
||||
@@ -278,10 +286,12 @@ public class ClientProxy extends CommonProxy {
|
||||
render = skinMap.get("default");
|
||||
render.addLayer(new ContributorFancinessHandler());
|
||||
render.addLayer(new BaubleRenderHandler());
|
||||
render.addLayer(new LayerGaiaHead(render.getMainModel().bipedHead));
|
||||
|
||||
render = skinMap.get("slim");
|
||||
render.addLayer(new ContributorFancinessHandler());
|
||||
render.addLayer(new BaubleRenderHandler());
|
||||
render.addLayer(new LayerGaiaHead(render.getMainModel().bipedHead));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -317,17 +327,15 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public void setExtraReach(EntityLivingBase entity, float reach) {
|
||||
super.setExtraReach(entity, reach);
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
if(entity == player) {
|
||||
if(!(mc.playerController instanceof IExtendedPlayerController)) {
|
||||
GameType type = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, LibObfuscation.CURRENT_GAME_TYPE);
|
||||
NetHandlerPlayClient net = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, LibObfuscation.NET_CLIENT_HANDLER);
|
||||
BotaniaPlayerController controller = new BotaniaPlayerController(mc, net);
|
||||
boolean isFlying = player.capabilities.isFlying;
|
||||
boolean allowFlying = player.capabilities.allowFlying;
|
||||
controller.setGameType(type);
|
||||
controller.setGameType(mc.playerController.getCurrentGameType());
|
||||
player.capabilities.isFlying = isFlying;
|
||||
player.capabilities.allowFlying = allowFlying;
|
||||
mc.playerController = controller;
|
||||
@@ -424,11 +432,11 @@ public class ClientProxy extends CommonProxy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) {
|
||||
if(!doParticle(world) && !fake)
|
||||
public void sparkleFX(double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) {
|
||||
if(!doParticle() && !fake)
|
||||
return;
|
||||
|
||||
FXSparkle sparkle = new FXSparkle(world, x, y, z, size, r, g, b, m);
|
||||
FXSparkle sparkle = new FXSparkle(Minecraft.getMinecraft().theWorld, x, y, z, size, r, g, b, m);
|
||||
sparkle.fake = sparkle.noClip = fake;
|
||||
if(noclipEnabled)
|
||||
sparkle.noClip = true;
|
||||
@@ -451,17 +459,17 @@ public class ClientProxy extends CommonProxy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz, float maxAgeMul) {
|
||||
if(!doParticle(world))
|
||||
public void wispFX(double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz, float maxAgeMul) {
|
||||
if(!doParticle())
|
||||
return;
|
||||
|
||||
FXWisp wisp = new FXWisp(world, x, y, z, size, r, g, b, distanceLimit, depthTest, maxAgeMul);
|
||||
FXWisp wisp = new FXWisp(Minecraft.getMinecraft().theWorld, x, y, z, size, r, g, b, distanceLimit, depthTest, maxAgeMul);
|
||||
wisp.setSpeed(motionx, motiony, motionz);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(wisp);
|
||||
}
|
||||
|
||||
private boolean doParticle(World world) {
|
||||
if(!world.isRemote)
|
||||
private boolean doParticle() {
|
||||
if(FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER)
|
||||
return false;
|
||||
|
||||
if(!ConfigHandler.useVanillaParticleLimiter)
|
||||
@@ -477,8 +485,8 @@ public class ClientProxy extends CommonProxy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lightningFX(World world, Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
|
||||
LightningHandler.spawnLightningBolt(world, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner);
|
||||
public void lightningFX(Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new FXLightning(Minecraft.getMinecraft().theWorld, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -490,5 +498,15 @@ public class ClientProxy extends CommonProxy {
|
||||
public void removeBoss(IBotaniaBoss boss) {
|
||||
BossBarHandler.bosses.remove(boss);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getClientRenderDistance() {
|
||||
return Minecraft.getMinecraft().gameSettings.renderDistanceChunks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelBiped getEmptyModelBiped() {
|
||||
return EMPTY_MODEL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,7 @@ import java.util.Set;
|
||||
public class GuiFactory implements IModGuiFactory {
|
||||
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance) {
|
||||
// NO-OP
|
||||
}
|
||||
public void initialize(Minecraft minecraftInstance) {}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
||||
|
||||
@@ -0,0 +1,248 @@
|
||||
package vazkii.botania.client.fx;
|
||||
|
||||
import gnu.trove.map.hash.TIntIntHashMap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.client.core.handler.LightningHandler;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
// Originally taken with permission from WRCBE - heavily modified
|
||||
public class FXLightning extends Particle {
|
||||
|
||||
private static final int fadetime = 20;
|
||||
private final TIntIntHashMap splitParents = new TIntIntHashMap();
|
||||
private final double length;
|
||||
private final Random rand;
|
||||
private final int colorOuter;
|
||||
private final int colorInner;
|
||||
|
||||
private List<FXLightningSegment> segments = new ArrayList<>();
|
||||
private int segmentCount = 1;
|
||||
private int splitCount;
|
||||
private float speed = 1.5F;
|
||||
|
||||
public FXLightning(World world, Vector3 sourcevec, Vector3 targetvec, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
|
||||
super(world, sourcevec.x, sourcevec.y, sourcevec.z);
|
||||
this.rand = new Random(seed);
|
||||
this.speed = ticksPerMeter;
|
||||
this.colorOuter = colorOuter;
|
||||
this.colorInner = colorInner;
|
||||
this.length = targetvec.subtract(sourcevec).mag();
|
||||
this.particleMaxAge = fadetime + rand.nextInt(fadetime) - fadetime / 2;
|
||||
this.particleAge = -(int) (length * speed);
|
||||
|
||||
segments.add(new FXLightningSegment(sourcevec, targetvec));
|
||||
|
||||
fractal(2, length / 1.5, 0.7F, 0.7F, 45);
|
||||
fractal(2, length / 4, 0.5F, 0.8F, 50);
|
||||
fractal(2, length / 15, 0.5F, 0.9F, 55);
|
||||
fractal(2, length / 30, 0.5F, 1.0F, 60);
|
||||
fractal(2, length / 60, 0, 0, 0);
|
||||
fractal(2, length / 100, 0, 0, 0);
|
||||
fractal(2, length / 400, 0, 0, 0);
|
||||
|
||||
calculateCollisionAndDiffs();
|
||||
|
||||
Collections.sort(segments, (o1, o2) -> Float.compare(o2.light, o1.light));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(VertexBuffer wr, Entity entity, float partialTicks, float rotX, float rotZ, float rotYZ, float rotXY, float rotXZ) {
|
||||
LightningHandler.queuedLightningBolts.offer(this);
|
||||
}
|
||||
|
||||
public void renderBolt(int pass, boolean inner) {
|
||||
ParticleRenderDispatcher.lightningCount++;
|
||||
VertexBuffer wr = Tessellator.getInstance().getBuffer();
|
||||
|
||||
float boltAge = particleAge < 0 ? 0 : (float) particleAge / (float) particleMaxAge;
|
||||
float mainAlpha;
|
||||
if(pass == 0)
|
||||
mainAlpha = (1 - boltAge) * 0.4F;
|
||||
else mainAlpha = 1 - boltAge * 0.5F;
|
||||
|
||||
int expandTime = (int) (length * speed);
|
||||
|
||||
int renderstart = (int) ((expandTime / 2 - particleMaxAge + particleAge) / (float) (expandTime / 2) * segmentCount);
|
||||
int renderend = (int) ((particleAge + expandTime) / (float) expandTime * segmentCount);
|
||||
|
||||
for(FXLightningSegment rendersegment : segments) {
|
||||
if(rendersegment.segmentNo < renderstart || rendersegment.segmentNo > renderend)
|
||||
continue;
|
||||
|
||||
Vector3 playerVec = getRelativeViewVector(rendersegment.startPoint.point).multiply(-1);
|
||||
|
||||
double width = 0.025F * (playerVec.mag() / 5 + 1) * (1 + rendersegment.light) * 0.5F;
|
||||
|
||||
Vector3 diff1 = playerVec.crossProduct(rendersegment.prevDiff).normalize().multiply(width / rendersegment.sinPrev);
|
||||
Vector3 diff2 = playerVec.crossProduct(rendersegment.nextDiff).normalize().multiply(width / rendersegment.sinNext);
|
||||
|
||||
Vector3 startvec = rendersegment.startPoint.point;
|
||||
Vector3 endvec = rendersegment.endPoint.point;
|
||||
|
||||
int color = inner ? colorInner : colorOuter;
|
||||
int r = (color & 0xFF0000) >> 16;
|
||||
int g = (color & 0xFF00) >> 8;
|
||||
int b = (color & 0xFF);
|
||||
int a = (int) (mainAlpha * rendersegment.light * 0xFF);
|
||||
|
||||
wr.pos(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
wr.pos(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
wr.pos(startvec.x + diff1.x, startvec.y + diff1.y, startvec.z + diff1.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
wr.pos(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
|
||||
if(rendersegment.next == null) {
|
||||
Vector3 roundend = rendersegment.endPoint.point.add(rendersegment.diff.normalize().multiply(width));
|
||||
|
||||
wr.pos(roundend.x - diff2.x, roundend.y - diff2.y, roundend.z - diff2.z).tex(0, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
wr.pos(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
wr.pos(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
wr.pos(roundend.x + diff2.x, roundend.y + diff2.y, roundend.z + diff2.z).tex(0, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
}
|
||||
|
||||
if(rendersegment.prev == null) {
|
||||
Vector3 roundend = rendersegment.startPoint.point.subtract(rendersegment.diff.normalize().multiply(width));
|
||||
|
||||
wr.pos(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
wr.pos(roundend.x - diff1.x, roundend.y - diff1.y, roundend.z - diff1.z).tex(0, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
wr.pos(roundend.x + diff1.x, roundend.y + diff1.y, roundend.z + diff1.z).tex(0, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
wr.pos(startvec.x + diff1.x, startvec.y + diff1.y, startvec.z + diff1.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fractal(int splits, double amount, double splitChance, double splitLength, double splitAngle) {
|
||||
List<FXLightningSegment> oldSegments = segments;
|
||||
segments = new ArrayList<>();
|
||||
|
||||
FXLightningSegment prev;
|
||||
|
||||
for(FXLightningSegment segment : oldSegments) {
|
||||
prev = segment.prev;
|
||||
|
||||
Vector3 subsegment = segment.diff.multiply(1F / splits);
|
||||
|
||||
FXLightningBoltPoint[] newpoints = new FXLightningBoltPoint[splits + 1];
|
||||
|
||||
Vector3 startpoint = segment.startPoint.point;
|
||||
newpoints[0] = segment.startPoint;
|
||||
newpoints[splits] = segment.endPoint;
|
||||
|
||||
for(int i = 1; i < splits; i++) {
|
||||
Vector3 randoff = segment.diff.perpendicular().normalize().rotate(rand.nextFloat() * 360, segment.diff);
|
||||
randoff = randoff.multiply((rand.nextFloat() - 0.5F) * amount * 2);
|
||||
|
||||
Vector3 basepoint = startpoint.add(subsegment.multiply(i));
|
||||
|
||||
newpoints[i] = new FXLightningBoltPoint(basepoint, randoff);
|
||||
}
|
||||
|
||||
for(int i = 0; i < splits; i++) {
|
||||
FXLightningSegment next = new FXLightningSegment(newpoints[i], newpoints[i + 1], segment.light, segment.segmentNo * splits + i, segment.splitNo);
|
||||
next.prev = prev;
|
||||
if (prev != null)
|
||||
prev.next = next;
|
||||
|
||||
if(i != 0 && rand.nextFloat() < splitChance) {
|
||||
Vector3 splitrot = next.diff.xCrossProduct().rotate(rand.nextFloat() * 360, next.diff);
|
||||
Vector3 diff = next.diff.rotate((rand.nextFloat() * 0.66F + 0.33F) * splitAngle, splitrot).multiply(splitLength);
|
||||
|
||||
splitCount++;
|
||||
splitParents.put(splitCount, next.splitNo);
|
||||
|
||||
FXLightningSegment split = new FXLightningSegment(newpoints[i], new FXLightningBoltPoint(newpoints[i + 1].basepoint, newpoints[i + 1].offsetvec.add(diff)), segment.light / 2F, next.segmentNo, splitCount);
|
||||
split.prev = prev;
|
||||
|
||||
segments.add(split);
|
||||
}
|
||||
|
||||
prev = next;
|
||||
segments.add(next);
|
||||
}
|
||||
|
||||
if(segment.next != null)
|
||||
segment.next.prev = prev;
|
||||
}
|
||||
|
||||
segmentCount *= splits;
|
||||
}
|
||||
|
||||
private float rayTraceResistance(Vector3 start, Vector3 end, float prevresistance) {
|
||||
RayTraceResult mop = worldObj.rayTraceBlocks(start.toVec3D(), end.toVec3D());
|
||||
|
||||
if(mop == null)
|
||||
return prevresistance;
|
||||
|
||||
if(mop.typeOfHit == RayTraceResult.Type.BLOCK) {
|
||||
Block block = worldObj.getBlockState(mop.getBlockPos()).getBlock();
|
||||
|
||||
if(worldObj.isAirBlock(mop.getBlockPos()))
|
||||
return prevresistance;
|
||||
|
||||
return prevresistance + block.getExplosionResistance(null) + 0.3F;
|
||||
} else return prevresistance;
|
||||
}
|
||||
|
||||
private void calculateCollisionAndDiffs() {
|
||||
TIntIntHashMap lastactivesegment = new TIntIntHashMap();
|
||||
|
||||
Collections.sort(segments, (o1, o2) -> {
|
||||
int comp = Integer.valueOf(o1.splitNo).compareTo(o2.splitNo);
|
||||
if(comp == 0)
|
||||
return Integer.valueOf(o1.segmentNo).compareTo(o2.segmentNo);
|
||||
else return comp;
|
||||
});
|
||||
|
||||
int lastSplitCalc = 0;
|
||||
int lastActiveSegment = 0;// unterminated
|
||||
float splitResistance = 0;
|
||||
|
||||
for(FXLightningSegment segment : segments) {
|
||||
if(segment.splitNo > lastSplitCalc) {
|
||||
lastactivesegment.put(lastSplitCalc, lastActiveSegment);
|
||||
lastSplitCalc = segment.splitNo;
|
||||
lastActiveSegment = lastactivesegment.get(splitParents.get(segment.splitNo));
|
||||
splitResistance = lastActiveSegment < segment.segmentNo ? 50 : 0;
|
||||
}
|
||||
|
||||
if(splitResistance >= 40 * segment.light)
|
||||
continue;
|
||||
|
||||
splitResistance = rayTraceResistance(segment.startPoint.point, segment.endPoint.point, splitResistance);
|
||||
lastActiveSegment = segment.segmentNo;
|
||||
}
|
||||
lastactivesegment.put(lastSplitCalc, lastActiveSegment);
|
||||
|
||||
lastSplitCalc = 0;
|
||||
lastActiveSegment = lastactivesegment.get(0);
|
||||
for(Iterator<FXLightningSegment> iterator = segments.iterator(); iterator.hasNext();) {
|
||||
FXLightningSegment segment = iterator.next();
|
||||
if(lastSplitCalc != segment.splitNo) {
|
||||
lastSplitCalc = segment.splitNo;
|
||||
lastActiveSegment = lastactivesegment.get(segment.splitNo);
|
||||
}
|
||||
|
||||
if(segment.segmentNo > lastActiveSegment)
|
||||
iterator.remove();
|
||||
segment.calcEndDiffs();
|
||||
}
|
||||
}
|
||||
|
||||
private static Vector3 getRelativeViewVector(Vector3 pos) {
|
||||
Entity renderEntity = Minecraft.getMinecraft().getRenderViewEntity();
|
||||
return new Vector3((float) renderEntity.posX - pos.x, (float) renderEntity.posY + renderEntity.getEyeHeight() - pos.y, (float) renderEntity.posZ - pos.z);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package vazkii.botania.client.fx;
|
||||
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
|
||||
public class FXLightningBoltPoint {
|
||||
|
||||
public final Vector3 point;
|
||||
public final Vector3 basepoint;
|
||||
public final Vector3 offsetvec;
|
||||
|
||||
public FXLightningBoltPoint(Vector3 basepoint, Vector3 offsetvec) {
|
||||
point = basepoint.add(offsetvec);
|
||||
this.basepoint = basepoint;
|
||||
this.offsetvec = offsetvec;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package vazkii.botania.client.fx;
|
||||
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
|
||||
public class FXLightningSegment {
|
||||
|
||||
public final FXLightningBoltPoint startPoint;
|
||||
public final FXLightningBoltPoint endPoint;
|
||||
|
||||
public Vector3 diff;
|
||||
|
||||
public FXLightningSegment prev;
|
||||
public FXLightningSegment next;
|
||||
|
||||
public Vector3 nextDiff;
|
||||
public Vector3 prevDiff;
|
||||
|
||||
public float sinPrev;
|
||||
public float sinNext;
|
||||
public final float light;
|
||||
|
||||
public final int segmentNo;
|
||||
public final int splitNo;
|
||||
|
||||
public FXLightningSegment(FXLightningBoltPoint start, FXLightningBoltPoint end, float light, int segmentnumber, int splitnumber) {
|
||||
startPoint = start;
|
||||
endPoint = end;
|
||||
this.light = light;
|
||||
segmentNo = segmentnumber;
|
||||
splitNo = splitnumber;
|
||||
|
||||
calcDiff();
|
||||
}
|
||||
|
||||
public FXLightningSegment(Vector3 start, Vector3 end) {
|
||||
this(new FXLightningBoltPoint(start, new Vector3(0, 0, 0)), new FXLightningBoltPoint(end, new Vector3(0, 0, 0)), 1, 0, 0);
|
||||
}
|
||||
|
||||
public void calcDiff() {
|
||||
diff = endPoint.point.subtract(startPoint.point);
|
||||
}
|
||||
|
||||
public void calcEndDiffs() {
|
||||
if(prev != null) {
|
||||
Vector3 prevdiffnorm = prev.diff.normalize();
|
||||
Vector3 thisdiffnorm = diff.normalize();
|
||||
|
||||
prevDiff = thisdiffnorm.add(prevdiffnorm).normalize();
|
||||
sinPrev = (float) Math.sin(thisdiffnorm.angle(prevdiffnorm.multiply(-1)) / 2);
|
||||
} else {
|
||||
prevDiff = diff.normalize();
|
||||
sinPrev = 1;
|
||||
}
|
||||
|
||||
if(next != null) {
|
||||
Vector3 nextdiffnorm = next.diff.normalize();
|
||||
Vector3 thisdiffnorm = diff.normalize();
|
||||
|
||||
nextDiff = thisdiffnorm.add(nextdiffnorm).normalize();
|
||||
sinNext = (float) Math.sin(thisdiffnorm.angle(nextdiffnorm.multiply(-1)) / 2);
|
||||
} else {
|
||||
nextDiff = diff.normalize();
|
||||
sinNext = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return startPoint.point.toString() + " " + endPoint.point.toString();
|
||||
}
|
||||
}
|
||||
@@ -18,9 +18,9 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -36,8 +36,8 @@ public class FXSparkle extends Particle {
|
||||
|
||||
public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_PARTICLES);
|
||||
|
||||
private static Queue<FXSparkle> queuedRenders = new ArrayDeque<>();
|
||||
private static Queue<FXSparkle> queuedCorruptRenders = new ArrayDeque<>();
|
||||
private static final Queue<FXSparkle> queuedRenders = new ArrayDeque<>();
|
||||
private static final Queue<FXSparkle> queuedCorruptRenders = new ArrayDeque<>();
|
||||
|
||||
// Queue values
|
||||
private float f;
|
||||
@@ -117,7 +117,7 @@ public class FXSparkle extends Particle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(VertexBuffer worldRendererIn, Entity p_180434_2_, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
public void renderParticle(VertexBuffer worldRendererIn, Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
this.f = f;
|
||||
this.f1 = f1;
|
||||
this.f2 = f2;
|
||||
@@ -142,7 +142,7 @@ public class FXSparkle extends Particle {
|
||||
motionY -= 0.04D * particleGravity;
|
||||
|
||||
if (!noClip && !fake)
|
||||
pushOutOfBlocks(posX, (getEntityBoundingBox().minY + getEntityBoundingBox().maxY) / 2.0D, posZ);
|
||||
wiggleAround(posX, (getEntityBoundingBox().minY + getEntityBoundingBox().maxY) / 2.0D, posZ);
|
||||
|
||||
posX += motionX;
|
||||
posY += motionY;
|
||||
@@ -167,98 +167,83 @@ public class FXSparkle extends Particle {
|
||||
particleGravity = value;
|
||||
}
|
||||
|
||||
private boolean pushOutOfBlocks(double par1, double par3, double par5) {
|
||||
int var7 = MathHelper.floor_double(par1);
|
||||
int var8 = MathHelper.floor_double(par3);
|
||||
int var9 = MathHelper.floor_double(par5);
|
||||
double var10 = par1 - var7;
|
||||
double var12 = par3 - var8;
|
||||
double var14 = par5 - var9;
|
||||
// Copy of Entity.pushOutOfBlocks with several important changes
|
||||
private boolean wiggleAround(double x, double y, double z)
|
||||
{
|
||||
BlockPos blockpos = new BlockPos(x, y, z);
|
||||
double d0 = x - (double)blockpos.getX();
|
||||
double d1 = y - (double)blockpos.getY();
|
||||
double d2 = z - (double)blockpos.getZ();
|
||||
|
||||
BlockPos bPos = new BlockPos(var7, var8, var9);
|
||||
if (!worldObj.isAirBlock(bPos)) {
|
||||
boolean var16 = !worldObj.isBlockNormalCube(bPos.west(), false);
|
||||
boolean var17 = !worldObj.isBlockNormalCube(bPos.east(), false);
|
||||
boolean var18 = !worldObj.isBlockNormalCube(bPos.down(), false);
|
||||
boolean var19 = !worldObj.isBlockNormalCube(bPos.up(), false);
|
||||
boolean var20 = !worldObj.isBlockNormalCube(bPos.north(), false);
|
||||
boolean var21 = !worldObj.isBlockNormalCube(bPos.south(), false);
|
||||
byte var22 = -1;
|
||||
double var23 = 9999.0D;
|
||||
// Botania - change collision box list check to !airblock check
|
||||
if (!worldObj.isAirBlock(blockpos))
|
||||
{
|
||||
EnumFacing enumfacing = EnumFacing.UP;
|
||||
double d3 = Double.MAX_VALUE;
|
||||
|
||||
if (var16 && var10 < var23) {
|
||||
var23 = var10;
|
||||
var22 = 0;
|
||||
if (!this.worldObj.isBlockFullCube(blockpos.west()) && d0 < d3)
|
||||
{
|
||||
d3 = d0;
|
||||
enumfacing = EnumFacing.WEST;
|
||||
}
|
||||
|
||||
if (var17 && 1.0D - var10 < var23) {
|
||||
var23 = 1.0D - var10;
|
||||
var22 = 1;
|
||||
if (!this.worldObj.isBlockFullCube(blockpos.east()) && 1.0D - d0 < d3)
|
||||
{
|
||||
d3 = 1.0D - d0;
|
||||
enumfacing = EnumFacing.EAST;
|
||||
}
|
||||
|
||||
if (var18 && var12 < var23) {
|
||||
var23 = var12;
|
||||
var22 = 2;
|
||||
|
||||
if (!this.worldObj.isBlockFullCube(blockpos.north()) && d2 < d3)
|
||||
{
|
||||
d3 = d2;
|
||||
enumfacing = EnumFacing.NORTH;
|
||||
}
|
||||
|
||||
if (var19 && 1.0D - var12 < var23) {
|
||||
var23 = 1.0D - var12;
|
||||
var22 = 3;
|
||||
if (!this.worldObj.isBlockFullCube(blockpos.south()) && 1.0D - d2 < d3)
|
||||
{
|
||||
d3 = 1.0D - d2;
|
||||
enumfacing = EnumFacing.SOUTH;
|
||||
}
|
||||
|
||||
if (var20 && var14 < var23) {
|
||||
var23 = var14;
|
||||
var22 = 4;
|
||||
if (!this.worldObj.isBlockFullCube(blockpos.up()) && 1.0D - d1 < d3)
|
||||
{
|
||||
d3 = 1.0D - d1;
|
||||
enumfacing = EnumFacing.UP;
|
||||
}
|
||||
|
||||
if (var21 && 1.0D - var14 < var23) {
|
||||
var23 = 1.0D - var14;
|
||||
var22 = 5;
|
||||
float f = this.rand.nextFloat() * 0.05F + 0.01F; // Botania - made multiplier and add both smaller
|
||||
float f1 = (float)enumfacing.getAxisDirection().getOffset();
|
||||
float secondary = (rand.nextFloat() - rand.nextFloat()) * 0.1F; // Botania - Make and use a secondary movement variable below
|
||||
|
||||
if (enumfacing.getAxis() == EnumFacing.Axis.X)
|
||||
{
|
||||
this.motionX += (double)(f1 * f);
|
||||
this.motionY = this.motionZ = secondary;
|
||||
}
|
||||
|
||||
float var25 = rand.nextFloat() * 0.05F + 0.025F;
|
||||
float var26 = (rand.nextFloat() - rand.nextFloat()) * 0.1F;
|
||||
|
||||
if (var22 == 0) {
|
||||
motionX = -var25;
|
||||
motionY=motionZ=var26;
|
||||
else if (enumfacing.getAxis() == EnumFacing.Axis.Y)
|
||||
{
|
||||
this.motionY += (double)(f1 * f);
|
||||
this.motionX = this.motionZ = secondary;
|
||||
}
|
||||
|
||||
if (var22 == 1) {
|
||||
motionX = var25;
|
||||
motionY=motionZ=var26;
|
||||
}
|
||||
|
||||
if (var22 == 2) {
|
||||
motionY = -var25;
|
||||
motionX=motionZ=var26;
|
||||
}
|
||||
|
||||
if (var22 == 3) {
|
||||
motionY = var25;
|
||||
motionX=motionZ=var26;
|
||||
}
|
||||
|
||||
if (var22 == 4) {
|
||||
motionZ = -var25;
|
||||
motionY=motionX=var26;
|
||||
}
|
||||
|
||||
if (var22 == 5) {
|
||||
motionZ = var25;
|
||||
motionY=motionX=var26;
|
||||
else if (enumfacing.getAxis() == EnumFacing.Axis.Z)
|
||||
{
|
||||
this.motionZ += (double)(f1 * f);
|
||||
this.motionX = this.motionY = secondary;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean corrupt = false;
|
||||
public boolean fake = false;
|
||||
private int multiplier = 2;
|
||||
private boolean shrink = true;
|
||||
public int particle = 16;
|
||||
private final boolean shrink = true;
|
||||
public final int particle = 16;
|
||||
public boolean tinkle = false;
|
||||
public boolean slowdown = true;
|
||||
public final boolean slowdown = true;
|
||||
public int currentColor = 0;
|
||||
}
|
||||
@@ -34,8 +34,8 @@ public class FXWisp extends Particle {
|
||||
|
||||
public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_WISP_LARGE);
|
||||
|
||||
private static Queue<FXWisp> queuedRenders = new ArrayDeque<>();
|
||||
private static Queue<FXWisp> queuedDepthIgnoringRenders = new ArrayDeque<>();
|
||||
private static final Queue<FXWisp> queuedRenders = new ArrayDeque<>();
|
||||
private static final Queue<FXWisp> queuedDepthIgnoringRenders = new ArrayDeque<>();
|
||||
|
||||
// Queue values
|
||||
private float f;
|
||||
@@ -171,8 +171,8 @@ public class FXWisp extends Particle {
|
||||
|
||||
private boolean depthTest = true;
|
||||
public boolean distanceLimit = true;
|
||||
private float moteParticleScale;
|
||||
private int moteHalfLife;
|
||||
private final float moteParticleScale;
|
||||
private final int moteHalfLife;
|
||||
public boolean tinkle = false;
|
||||
public int blendmode = 1;
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public final class ParticleRenderDispatcher {
|
||||
|
||||
Profiler profiler = Minecraft.getMinecraft().mcProfiler;
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
GlStateManager.depthMask(false);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
|
||||
@@ -18,8 +18,8 @@ import vazkii.botania.common.achievement.ModAchievements;
|
||||
|
||||
public class GuiAchievementsHacky extends GuiAchievements {
|
||||
|
||||
public GuiAchievementsHacky(GuiScreen p_i45026_1_, StatisticsManager p_i45026_2_) {
|
||||
super(p_i45026_1_, p_i45026_2_);
|
||||
public GuiAchievementsHacky(GuiScreen screen, StatisticsManager stats) {
|
||||
super(screen, stats);
|
||||
ReflectionHelper.setPrivateValue(GuiAchievements.class, this, ModAchievements.pageIndex, "currentPage");
|
||||
}
|
||||
|
||||
|
||||
@@ -17,17 +17,17 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotLocked extends Slot {
|
||||
|
||||
public SlotLocked(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
|
||||
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
|
||||
public SlotLocked(IInventory inv, int index, int xPos, int yPos) {
|
||||
super(inv, index, xPos, yPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer p_82869_1_) {
|
||||
public boolean canTakeStack(EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack p_75214_1_) {
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,30 +11,31 @@
|
||||
package vazkii.botania.client.gui.bag;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ClickType;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
import vazkii.botania.client.gui.SlotLocked;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ContainerFlowerBag extends Container {
|
||||
|
||||
InventoryFlowerBag flowerBagInv;
|
||||
private final InventoryFlowerBag flowerBagInv;
|
||||
|
||||
public ContainerFlowerBag(EntityPlayer player) {
|
||||
public ContainerFlowerBag(InventoryPlayer playerInv, InventoryFlowerBag flowerBagInv) {
|
||||
int i;
|
||||
int j;
|
||||
|
||||
int slot = player.inventory.currentItem;
|
||||
IInventory playerInv = player.inventory;
|
||||
flowerBagInv = new InventoryFlowerBag(player, slot);
|
||||
this.flowerBagInv = flowerBagInv;
|
||||
|
||||
for(i = 0; i < 2; ++i)
|
||||
for(j = 0; j < 8; ++j) {
|
||||
int k = j + i * 8;
|
||||
addSlotToContainer(new SlotFlower(flowerBagInv, k, 17 + j * 18, 26 + i * 18, k));
|
||||
addSlotToContainer(new SlotItemHandler(flowerBagInv, k, 17 + j * 18, 26 + i * 18));
|
||||
}
|
||||
|
||||
for(i = 0; i < 3; ++i)
|
||||
@@ -42,7 +43,7 @@ public class ContainerFlowerBag extends Container {
|
||||
addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
|
||||
for(i = 0; i < 9; ++i) {
|
||||
if(player.inventory.currentItem == i)
|
||||
if(playerInv.getStackInSlot(i) == flowerBagInv.bag)
|
||||
addSlotToContainer(new SlotLocked(playerInv, i, 8 + i * 18, 142));
|
||||
else addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142));
|
||||
}
|
||||
@@ -51,29 +52,20 @@ public class ContainerFlowerBag extends Container {
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(@Nonnull EntityPlayer player) {
|
||||
boolean can = flowerBagInv.isUseableByPlayer(player);
|
||||
if(!can)
|
||||
onContainerClosed(player);
|
||||
|
||||
return can;
|
||||
return player.getHeldItemMainhand() == flowerBagInv.bag
|
||||
|| player.getHeldItemOffhand() == flowerBagInv.bag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer player) {
|
||||
super.onContainerClosed(player);
|
||||
flowerBagInv.pushInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = inventorySlots.get(p_82846_2_);
|
||||
Slot slot = inventorySlots.get(slotIndex);
|
||||
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if(p_82846_2_ < 16) {
|
||||
if(slotIndex < 16) {
|
||||
if(!mergeItemStack(itemstack1, 16, 52, true))
|
||||
return null;
|
||||
} else {
|
||||
@@ -92,7 +84,7 @@ public class ContainerFlowerBag extends Container {
|
||||
if(itemstack1.stackSize == itemstack.stackSize)
|
||||
return null;
|
||||
|
||||
slot.onPickupFromSlot(p_82846_1_, itemstack1);
|
||||
slot.onPickupFromSlot(player, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
||||
@@ -13,11 +13,13 @@ package vazkii.botania.client.gui.bag;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
|
||||
@@ -27,19 +29,19 @@ public class GuiFlowerBag extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_FLOWER_BAG);
|
||||
|
||||
public GuiFlowerBag(EntityPlayer player) {
|
||||
super(new ContainerFlowerBag(player));
|
||||
public GuiFlowerBag(InventoryPlayer playerInv, InventoryFlowerBag flowerBagInv) {
|
||||
super(new ContainerFlowerBag(playerInv, flowerBagInv));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
String s = I18n.translateToLocal("item.botania:flowerBag.name");
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
String s = I18n.format("item.botania:flowerBag.name");
|
||||
fontRendererObj.drawString(s, xSize / 2 - fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
|
||||
fontRendererObj.drawString(I18n.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 4210752);
|
||||
fontRendererObj.drawString(I18n.format("container.inventory"), 8, ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.getTextureManager().bindTexture(texture);
|
||||
int k = (width - xSize) / 2;
|
||||
@@ -48,10 +50,10 @@ public class GuiFlowerBag extends GuiContainer {
|
||||
|
||||
List<Slot> slotList = inventorySlots.inventorySlots;
|
||||
for(Slot slot : slotList)
|
||||
if(slot instanceof SlotFlower) {
|
||||
SlotFlower slotf = (SlotFlower) slot;
|
||||
if(slot instanceof SlotItemHandler) {
|
||||
SlotItemHandler slotf = (SlotItemHandler) slot;
|
||||
if(!slotf.getHasStack()) {
|
||||
ItemStack stack = new ItemStack(ModBlocks.flower, 0, slotf.color);
|
||||
ItemStack stack = new ItemStack(ModBlocks.flower, 0, slotf.getSlotIndex()); // index matches colors
|
||||
int x = guiLeft + slotf.xDisplayPosition;
|
||||
int y = guiTop + slotf.yDisplayPosition;
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -62,9 +64,4 @@ public class GuiFlowerBag extends GuiContainer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkHotbarKeys(int p_146983_1_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,183 +10,42 @@
|
||||
*/
|
||||
package vazkii.botania.client.gui.bag;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import vazkii.botania.common.item.ItemFlowerBag;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Arrays;
|
||||
public class InventoryFlowerBag implements IItemHandlerModifiable {
|
||||
|
||||
public class InventoryFlowerBag implements IInventory {
|
||||
private final IItemHandlerModifiable bagInv;
|
||||
final ItemStack bag;
|
||||
|
||||
private static final ItemStack[] FALLBACK_INVENTORY = new ItemStack[16];
|
||||
|
||||
EntityPlayer player;
|
||||
int slot;
|
||||
ItemStack[] stacks = null;
|
||||
|
||||
boolean invPushed = false;
|
||||
ItemStack storedInv = null;
|
||||
|
||||
public InventoryFlowerBag(EntityPlayer player, int slot) {
|
||||
this.player = player;
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
public static boolean isFlowerBag(ItemStack stack) {
|
||||
return stack != null && stack.getItem() == ModItems.flowerBag;
|
||||
}
|
||||
|
||||
ItemStack getStack() {
|
||||
ItemStack stack = player.inventory.getStackInSlot(slot);
|
||||
if(stack != null)
|
||||
storedInv = stack;
|
||||
return stack;
|
||||
}
|
||||
|
||||
ItemStack[] getInventory() {
|
||||
if(stacks != null)
|
||||
return stacks;
|
||||
|
||||
ItemStack stack = getStack();
|
||||
if(isFlowerBag(getStack())) {
|
||||
stacks = ItemFlowerBag.loadStacks(stack);
|
||||
return stacks;
|
||||
}
|
||||
|
||||
return FALLBACK_INVENTORY;
|
||||
}
|
||||
|
||||
public void pushInventory() {
|
||||
if(invPushed)
|
||||
return;
|
||||
|
||||
ItemStack stack = getStack();
|
||||
if(stack == null)
|
||||
stack = storedInv;
|
||||
|
||||
if(stack != null) {
|
||||
ItemStack[] inv = getInventory();
|
||||
ItemFlowerBag.setStacks(stack, inv);
|
||||
}
|
||||
|
||||
invPushed = true;
|
||||
public InventoryFlowerBag(ItemStack bag) {
|
||||
this.bag = bag;
|
||||
this.bagInv = (IItemHandlerModifiable) bag.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return 16;
|
||||
public void setStackInSlot(int slot, ItemStack stack) {
|
||||
bagInv.setStackInSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return getInventory()[i];
|
||||
public int getSlots() {
|
||||
return bagInv.getSlots();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
ItemStack[] inventorySlots = getInventory();
|
||||
if (inventorySlots[i] != null) {
|
||||
ItemStack stackAt;
|
||||
|
||||
if (inventorySlots[i].stackSize <= j) {
|
||||
stackAt = inventorySlots[i];
|
||||
inventorySlots[i] = null;
|
||||
return stackAt;
|
||||
} else {
|
||||
stackAt = inventorySlots[i].splitStack(j);
|
||||
|
||||
if (inventorySlots[i].stackSize == 0)
|
||||
inventorySlots[i] = null;
|
||||
|
||||
return stackAt;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return bagInv.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeStackFromSlot(int i) {
|
||||
return getStackInSlot(i);
|
||||
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
|
||||
return bagInv.insertItem(slot, stack, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
ItemStack[] inventorySlots = getInventory();
|
||||
inventorySlots[i] = itemstack;
|
||||
public ItemStack extractItem(int slot, int amount, boolean simulate) {
|
||||
return bagInv.extractItem(slot, amount, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return isFlowerBag(getStack()) ? 64 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(@Nonnull EntityPlayer entityplayer) {
|
||||
return isFlowerBag(getStack());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, @Nonnull ItemStack itemstack) {
|
||||
return isFlowerBag(getStack());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField(int id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(int id, int value) {}
|
||||
|
||||
@Override
|
||||
public int getFieldCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
if (stacks != null) {
|
||||
Arrays.fill(stacks, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ITextComponent getDisplayName() {
|
||||
return new TextComponentString(getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(@Nonnull EntityPlayer player) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory(@Nonnull EntityPlayer player) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getName() {
|
||||
return LibItemNames.FLOWER_BAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Mar 16, 2015, 7:20:05 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.gui.bag;
|
||||
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
|
||||
public class SlotFlower extends Slot {
|
||||
|
||||
InventoryFlowerBag inv;
|
||||
int color;
|
||||
|
||||
public SlotFlower(InventoryFlowerBag p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_, int color) {
|
||||
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
|
||||
this.color = color;
|
||||
inv = p_i1824_1_;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotChange(ItemStack oldStack, ItemStack newStack) {
|
||||
inv.setInventorySlotContents(color, newStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return stack.getItem() == Item.getItemFromBlock(ModBlocks.flower) && stack.getItemDamage() == color;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
import vazkii.botania.api.mana.IManaItem;
|
||||
import vazkii.botania.client.gui.SlotLocked;
|
||||
|
||||
@@ -27,16 +28,15 @@ import javax.annotation.Nonnull;
|
||||
|
||||
public class ContainerBaubleBox extends Container {
|
||||
|
||||
InventoryBaubleBox baubleBoxInv;
|
||||
InventoryBaubles baubles;
|
||||
private final InventoryBaubleBox baubleBoxInv;
|
||||
private final InventoryBaubles baubles;
|
||||
|
||||
public ContainerBaubleBox(EntityPlayer player) {
|
||||
public ContainerBaubleBox(EntityPlayer player, InventoryBaubleBox boxInv) {
|
||||
int i;
|
||||
int j;
|
||||
|
||||
int slot = player.inventory.currentItem;
|
||||
IInventory playerInv = player.inventory;
|
||||
baubleBoxInv = new InventoryBaubleBox(player, slot);
|
||||
baubleBoxInv = boxInv;
|
||||
|
||||
baubles = new InventoryBaubles(player);
|
||||
baubles.setEventHandler(this);
|
||||
@@ -51,7 +51,7 @@ public class ContainerBaubleBox extends Container {
|
||||
for(i = 0; i < 4; ++i)
|
||||
for(j = 0; j < 6; ++j) {
|
||||
int k = j + i * 6;
|
||||
addSlotToContainer(new SlotAnyBauble(baubleBoxInv, k, 62 + j * 18, 8 + i * 18));
|
||||
addSlotToContainer(new SlotItemHandler(baubleBoxInv, k, 62 + j * 18, 8 + i * 18));
|
||||
}
|
||||
|
||||
for(i = 0; i < 3; ++i)
|
||||
@@ -59,7 +59,7 @@ public class ContainerBaubleBox extends Container {
|
||||
addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
|
||||
for(i = 0; i < 9; ++i) {
|
||||
if(player.inventory.currentItem == i)
|
||||
if(playerInv.getStackInSlot(i) == baubleBoxInv.box)
|
||||
addSlotToContainer(new SlotLocked(playerInv, i, 8 + i * 18, 142));
|
||||
else addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142));
|
||||
}
|
||||
@@ -68,39 +68,34 @@ public class ContainerBaubleBox extends Container {
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(@Nonnull EntityPlayer player) {
|
||||
boolean can = baubleBoxInv.isUseableByPlayer(player);
|
||||
if(!can)
|
||||
onContainerClosed(player);
|
||||
|
||||
return can;
|
||||
return player.getHeldItemMainhand() == baubleBoxInv.box
|
||||
|| player.getHeldItemOffhand() == baubleBoxInv.box;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer player) {
|
||||
super.onContainerClosed(player);
|
||||
baubleBoxInv.pushInventory();
|
||||
|
||||
if(!player.worldObj.isRemote)
|
||||
PlayerHandler.setPlayerBaubles(player, baubles);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStacksInSlots(ItemStack[] p_75131_1_) {
|
||||
public void putStacksInSlots(ItemStack[] arr) {
|
||||
baubles.blockEvents = true;
|
||||
super.putStacksInSlots(p_75131_1_);
|
||||
super.putStacksInSlots(arr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = inventorySlots.get(p_82846_2_);
|
||||
Slot slot = inventorySlots.get(slotIndex);
|
||||
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
System.out.println(p_82846_2_ + " " + itemstack);
|
||||
if(p_82846_2_ < 28) {
|
||||
if(slotIndex < 28) {
|
||||
if(!mergeItemStack(itemstack1, 28, 64, true))
|
||||
return null;
|
||||
} else {
|
||||
@@ -115,7 +110,7 @@ public class ContainerBaubleBox extends Container {
|
||||
if(itemstack1.stackSize == itemstack.stackSize)
|
||||
return null;
|
||||
|
||||
slot.onPickupFromSlot(p_82846_1_, itemstack1);
|
||||
slot.onPickupFromSlot(player, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
||||
@@ -22,17 +22,12 @@ public class GuiBaubleBox extends InventoryEffectRenderer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_BAUBLE_BOX);
|
||||
|
||||
public GuiBaubleBox(EntityPlayer player) {
|
||||
super(new ContainerBaubleBox(player));
|
||||
public GuiBaubleBox(EntityPlayer player, InventoryBaubleBox box) {
|
||||
super(new ContainerBaubleBox(player, box));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkHotbarKeys(int p_146983_1_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
@@ -43,7 +38,7 @@ public class GuiBaubleBox extends InventoryEffectRenderer {
|
||||
drawTexturedModalRect(guiLeft+slot.xDisplayPosition, guiTop+slot.yDisplayPosition, 200, 0, 16, 16);
|
||||
}
|
||||
|
||||
GuiInventory.drawEntityOnScreen(guiLeft + 43, guiTop + 61, 20, guiLeft + 43 - p_146976_2_, guiTop + 45 - 30 - p_146976_3_, mc.thePlayer);
|
||||
GuiInventory.drawEntityOnScreen(guiLeft + 43, guiTop + 61, 20, guiLeft + 43 - mouseX, guiTop + 45 - 30 - mouseY, mc.thePlayer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,182 +10,43 @@
|
||||
*/
|
||||
package vazkii.botania.client.gui.box;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import vazkii.botania.common.item.ItemBaubleBox;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Arrays;
|
||||
public class InventoryBaubleBox implements IItemHandlerModifiable {
|
||||
|
||||
public class InventoryBaubleBox implements IInventory {
|
||||
private final IItemHandlerModifiable boxInv;
|
||||
final ItemStack box;
|
||||
|
||||
private static final ItemStack[] FALLBACK_INVENTORY = new ItemStack[16];
|
||||
|
||||
EntityPlayer player;
|
||||
int slot;
|
||||
ItemStack[] stacks = null;
|
||||
|
||||
boolean invPushed = false;
|
||||
ItemStack storedInv = null;
|
||||
|
||||
public InventoryBaubleBox(EntityPlayer player, int slot) {
|
||||
this.player = player;
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
public static boolean isBaubleBox(ItemStack stack) {
|
||||
return stack != null && stack.getItem() == ModItems.baubleBox;
|
||||
}
|
||||
|
||||
ItemStack getStack() {
|
||||
ItemStack stack = player.inventory.getStackInSlot(slot);
|
||||
if(stack != null)
|
||||
storedInv = stack;
|
||||
return stack;
|
||||
}
|
||||
|
||||
ItemStack[] getInventory() {
|
||||
if(stacks != null)
|
||||
return stacks;
|
||||
|
||||
ItemStack stack = getStack();
|
||||
if(isBaubleBox(getStack())) {
|
||||
stacks = ItemBaubleBox.loadStacks(stack);
|
||||
return stacks;
|
||||
}
|
||||
|
||||
return FALLBACK_INVENTORY;
|
||||
}
|
||||
|
||||
public void pushInventory() {
|
||||
if(invPushed)
|
||||
return;
|
||||
|
||||
ItemStack stack = getStack();
|
||||
if(stack == null)
|
||||
stack = storedInv;
|
||||
|
||||
if(stack != null) {
|
||||
ItemStack[] inv = getInventory();
|
||||
ItemBaubleBox.setStacks(stack, inv);
|
||||
}
|
||||
|
||||
invPushed = true;
|
||||
public InventoryBaubleBox(ItemStack box) {
|
||||
this.box = box;
|
||||
this.boxInv = (IItemHandlerModifiable) box.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return 16;
|
||||
public void setStackInSlot(int slot, ItemStack stack) {
|
||||
boxInv.setStackInSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return getInventory()[i];
|
||||
public int getSlots() {
|
||||
return boxInv.getSlots();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
ItemStack[] inventorySlots = getInventory();
|
||||
if (inventorySlots[i] != null) {
|
||||
ItemStack stackAt;
|
||||
|
||||
if (inventorySlots[i].stackSize <= j) {
|
||||
stackAt = inventorySlots[i];
|
||||
inventorySlots[i] = null;
|
||||
return stackAt;
|
||||
} else {
|
||||
stackAt = inventorySlots[i].splitStack(j);
|
||||
|
||||
if (inventorySlots[i].stackSize == 0)
|
||||
inventorySlots[i] = null;
|
||||
|
||||
return stackAt;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return boxInv.getStackInSlot(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack removeStackFromSlot(int i) {
|
||||
return getStackInSlot(i);
|
||||
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
|
||||
return boxInv.insertItem(slot, stack, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack itemstack) {
|
||||
ItemStack[] inventorySlots = getInventory();
|
||||
inventorySlots[slot] = itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return isBaubleBox(getStack()) ? 64 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(@Nonnull EntityPlayer entityplayer) {
|
||||
return isBaubleBox(getStack());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, @Nonnull ItemStack itemstack) {
|
||||
return isBaubleBox(getStack());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField(int id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(int id, int value) {}
|
||||
|
||||
@Override
|
||||
public int getFieldCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
if (stacks != null)
|
||||
Arrays.fill(stacks, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ITextComponent getDisplayName() {
|
||||
return new TextComponentString(getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(@Nonnull EntityPlayer player) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory(@Nonnull EntityPlayer player) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getName() {
|
||||
return LibItemNames.BAUBLE_BOX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
// NO-OP
|
||||
public ItemStack extractItem(int slot, int amount, boolean simulate) {
|
||||
return boxInv.extractItem(slot, amount, simulate);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [25/11/2015, 19:59:22 (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.gui.box;
|
||||
|
||||
import baubles.api.IBauble;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.mana.IManaItem;
|
||||
|
||||
public class SlotAnyBauble extends Slot {
|
||||
|
||||
InventoryBaubleBox inv;
|
||||
|
||||
public SlotAnyBauble(InventoryBaubleBox p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
|
||||
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
|
||||
inv = p_i1824_1_;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotChange(ItemStack oldStack, ItemStack newStack) {
|
||||
inv.setInventorySlotContents(slotNumber, newStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return stack.getItem() instanceof IBauble || stack.getItem() instanceof IManaItem;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,8 +22,8 @@ import javax.annotation.Nonnull;
|
||||
|
||||
public class ContainerCraftingHalo extends ContainerWorkbench {
|
||||
|
||||
public ContainerCraftingHalo(InventoryPlayer p_i1808_1_, World p_i1808_2_) {
|
||||
super(p_i1808_1_, p_i1808_2_, BlockPos.ORIGIN);
|
||||
public ContainerCraftingHalo(InventoryPlayer playerInv, World world) {
|
||||
super(playerInv, world, BlockPos.ORIGIN);
|
||||
|
||||
craftMatrix = new InventoryCraftingHalo(this, 3, 3);
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ContainerCraftingHalo extends ContainerWorkbench {
|
||||
inventoryItemStacks.clear();
|
||||
|
||||
// Le copypasta
|
||||
addSlotToContainer(new SlotCrafting(p_i1808_1_.player, craftMatrix, craftResult, 0, 124, 35));
|
||||
addSlotToContainer(new SlotCrafting(playerInv.player, craftMatrix, craftResult, 0, 124, 35));
|
||||
int l;
|
||||
int i1;
|
||||
|
||||
@@ -47,20 +47,20 @@ public class ContainerCraftingHalo extends ContainerWorkbench {
|
||||
{
|
||||
for (i1 = 0; i1 < 9; ++i1)
|
||||
{
|
||||
addSlotToContainer(new Slot(p_i1808_1_, i1 + l * 9 + 9, 8 + i1 * 18, 84 + l * 18));
|
||||
addSlotToContainer(new Slot(playerInv, i1 + l * 9 + 9, 8 + i1 * 18, 84 + l * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (l = 0; l < 9; ++l)
|
||||
{
|
||||
addSlotToContainer(new Slot(p_i1808_1_, l, 8 + l * 18, 142));
|
||||
addSlotToContainer(new Slot(playerInv, l, 8 + l * 18, 142));
|
||||
}
|
||||
|
||||
onCraftMatrixChanged(craftMatrix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(@Nonnull EntityPlayer p_75145_1_) {
|
||||
public boolean canInteractWith(@Nonnull EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -22,18 +22,18 @@ public class GuiCraftingHalo extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation("textures/gui/container/crafting_table.png");
|
||||
|
||||
public GuiCraftingHalo(InventoryPlayer p_i1084_1_, World p_i1084_2_) {
|
||||
super(new ContainerCraftingHalo(p_i1084_1_, p_i1084_2_));
|
||||
public GuiCraftingHalo(InventoryPlayer playerInv, World world) {
|
||||
super(new ContainerCraftingHalo(playerInv, world));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(I18n.format("container.crafting"), 28, 6, 4210752);
|
||||
fontRendererObj.drawString(I18n.format("container.inventory"), 8, ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.getTextureManager().bindTexture(craftingTableGuiTextures);
|
||||
int k = (width - xSize) / 2;
|
||||
|
||||
@@ -15,8 +15,8 @@ import net.minecraft.inventory.InventoryCrafting;
|
||||
|
||||
public class InventoryCraftingHalo extends InventoryCrafting {
|
||||
|
||||
public InventoryCraftingHalo(Container p_i1807_1_, int p_i1807_2_, int p_i1807_3_) {
|
||||
super(p_i1807_1_, p_i1807_2_, p_i1807_3_);
|
||||
public InventoryCraftingHalo(Container container, int width, int height) {
|
||||
super(container, width, height);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,12 +16,12 @@ import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChatAllowedCharacters;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -110,8 +110,8 @@ public class GuiLexicon extends GuiScreen {
|
||||
List<LexiconCategory> allCategories;
|
||||
|
||||
String title;
|
||||
int guiWidth = 146;
|
||||
int guiHeight = 180;
|
||||
final int guiWidth = 146;
|
||||
final int guiHeight = 180;
|
||||
int left, top;
|
||||
|
||||
@Override
|
||||
@@ -155,7 +155,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
} else if(isCategoryIndex()) {
|
||||
int categories = allCategories.size();
|
||||
for(int i = 0; i < categories + 1; i++) {
|
||||
LexiconCategory category = null;
|
||||
LexiconCategory category;
|
||||
category = i >= categories ? null : allCategories.get(i);
|
||||
int perline = 5;
|
||||
int x = i % perline;
|
||||
@@ -285,7 +285,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
if(notesEnabled && ClientTickHandler.ticksInGame % 20 < 10)
|
||||
noteDisplay += "&r_";
|
||||
|
||||
fontRendererObj.drawString(I18n.translateToLocal("botaniamisc.notes"), x + 5, y - 7, 0x666666);
|
||||
fontRendererObj.drawString(I18n.format("botaniamisc.notes"), x + 5, y - 7, 0x666666);
|
||||
|
||||
boolean unicode = fontRendererObj.getUnicodeFlag();
|
||||
fontRendererObj.setUnicodeFlag(true);
|
||||
@@ -340,7 +340,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
boolean unicode = fontRendererObj.getUnicodeFlag();
|
||||
fontRendererObj.drawString(title, left + 18, top + 13, color);
|
||||
fontRendererObj.setUnicodeFlag(true);
|
||||
fontRendererObj.drawString(String.format(I18n.translateToLocal("botaniamisc.edition"), ItemLexicon.getEdition()), left + 24, top + 22, color);
|
||||
fontRendererObj.drawString(I18n.format("botaniamisc.edition", ItemLexicon.getEdition()), left + 24, top + 22, color);
|
||||
|
||||
String s = TextFormatting.BOLD + categoryHighlight;
|
||||
fontRendererObj.drawString(s, left + guiWidth / 2 - fontRendererObj.getStringWidth(s) / 2, top + 36, 0);
|
||||
@@ -481,9 +481,9 @@ public class GuiLexicon extends GuiScreen {
|
||||
GuiButtonInvisible button = (GuiButtonInvisible) buttonList.get(i);
|
||||
LexiconCategory category = i_ >= categoryList.size() ? null : categoryList.get(i_);
|
||||
if(category != null)
|
||||
button.displayString = I18n.translateToLocal(category.getUnlocalizedName());
|
||||
button.displayString = I18n.format(category.getUnlocalizedName());
|
||||
else {
|
||||
button.displayString = I18n.translateToLocal("botaniamisc.lexiconIndex");
|
||||
button.displayString = I18n.format("botaniamisc.lexiconIndex");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -511,9 +511,9 @@ public class GuiLexicon extends GuiScreen {
|
||||
}
|
||||
|
||||
if(isMainPage())
|
||||
buttonList.add(new GuiButtonHistory(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, I18n.translateToLocal("botaniamisc.history"), this));
|
||||
buttonList.add(new GuiButtonHistory(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, I18n.format("botaniamisc.history"), this));
|
||||
else if(isChallenge())
|
||||
buttonList.add(new GuiButtonChallengeInfo(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, I18n.translateToLocal("botaniamisc.info"), this));
|
||||
buttonList.add(new GuiButtonChallengeInfo(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, I18n.format("botaniamisc.info"), this));
|
||||
}
|
||||
|
||||
public static void startTutorial() {
|
||||
@@ -638,9 +638,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
return "index";
|
||||
}
|
||||
|
||||
public void load(NBTTagCompound cmp) {
|
||||
// NO-OP
|
||||
}
|
||||
public void load(NBTTagCompound cmp) {}
|
||||
|
||||
public GuiLexicon copy() {
|
||||
return new GuiLexicon();
|
||||
|
||||
@@ -13,9 +13,9 @@ package vazkii.botania.client.gui.lexicon;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import vazkii.botania.client.challenge.Challenge;
|
||||
import vazkii.botania.client.challenge.ModChallenges;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
@@ -44,7 +44,7 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
public void setTitle() {
|
||||
title = challenge == null ? "(null)" : I18n.translateToLocal(challenge.unlocalizedName);
|
||||
title = challenge == null ? "(null)" : I18n.format(challenge.unlocalizedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,8 +69,8 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
|
||||
|
||||
boolean unicode = fontRendererObj.getUnicodeFlag();
|
||||
fontRendererObj.setUnicodeFlag(true);
|
||||
fontRendererObj.drawString(TextFormatting.BOLD + I18n.translateToLocal(challenge.unlocalizedName), left + 38, top + 13, 0);
|
||||
fontRendererObj.drawString(I18n.translateToLocal(challenge.level.getName()) + " / " + (challenge.complete ? TextFormatting.DARK_GREEN : TextFormatting.DARK_RED) + I18n.translateToLocal(challenge.complete ? "botaniamisc.completed" : "botaniamisc.notCompleted"), left + 38, top + 23, 0);
|
||||
fontRendererObj.drawString(TextFormatting.BOLD + I18n.format(challenge.unlocalizedName), left + 38, top + 13, 0);
|
||||
fontRendererObj.drawString(I18n.format(challenge.level.getName()) + " / " + (challenge.complete ? TextFormatting.DARK_GREEN : TextFormatting.DARK_RED) + I18n.format(challenge.complete ? "botaniamisc.completed" : "botaniamisc.notCompleted"), left + 38, top + 23, 0);
|
||||
|
||||
int width = guiWidth - 30;
|
||||
int x = left + 16;
|
||||
@@ -116,7 +116,7 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
void setCompleteButtonTitle() {
|
||||
completeButton.displayString = I18n.translateToLocal(challenge.complete ? "botaniamisc.markNotCompleted" : "botaniamisc.markCompleted");
|
||||
completeButton.displayString = I18n.format(challenge.complete ? "botaniamisc.markNotCompleted" : "botaniamisc.markCompleted");
|
||||
}
|
||||
|
||||
void back() {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
package vazkii.botania.client.gui.lexicon;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import vazkii.botania.client.challenge.Challenge;
|
||||
import vazkii.botania.client.challenge.EnumChallengeLevel;
|
||||
import vazkii.botania.client.challenge.ModChallenges;
|
||||
@@ -30,13 +30,13 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
|
||||
public GuiLexiconChallengesList() {
|
||||
parent = new GuiLexicon();
|
||||
title = I18n.translateToLocal("botaniamisc.challenges");
|
||||
title = I18n.format("botaniamisc.challenges");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitGui() {
|
||||
super.onInitGui();
|
||||
title = I18n.translateToLocal("botaniamisc.challenges");
|
||||
title = I18n.format("botaniamisc.challenges");
|
||||
|
||||
buttonList.add(backButton = new GuiButtonBack(12, left + guiWidth / 2 - 8, top + guiHeight + 2));
|
||||
|
||||
@@ -67,7 +67,7 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
if(c.complete)
|
||||
complete++;
|
||||
|
||||
fontRendererObj.drawString(TextFormatting.BOLD + I18n.translateToLocal(level.getName()) + TextFormatting.RESET + " (" + complete + "/" + list.size() + ")", left + 20, top + 11 + level.ordinal() * 44, 0);
|
||||
fontRendererObj.drawString(TextFormatting.BOLD + I18n.format(level.getName()) + TextFormatting.RESET + " (" + complete + "/" + list.size() + ")", left + 20, top + 11 + level.ordinal() * 44, 0);
|
||||
}
|
||||
fontRendererObj.setUnicodeFlag(unicode);
|
||||
}
|
||||
|
||||
@@ -13,11 +13,11 @@ package vazkii.botania.client.gui.lexicon;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.internal.IGuiLexiconEntry;
|
||||
@@ -66,9 +66,9 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
return;
|
||||
}
|
||||
|
||||
title = I18n.translateToLocal(entry.getUnlocalizedName());
|
||||
title = I18n.format(entry.getUnlocalizedName());
|
||||
if(entry instanceof IAddonEntry)
|
||||
subtitle = I18n.translateToLocal(((IAddonEntry) entry).getSubtitle());
|
||||
subtitle = I18n.format(((IAddonEntry) entry).getSubtitle());
|
||||
else subtitle = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
*/
|
||||
package vazkii.botania.client.gui.lexicon;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import vazkii.botania.api.lexicon.ILexicon;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class GuiLexiconHistory extends GuiLexiconIndex {
|
||||
|
||||
public GuiLexiconHistory() {
|
||||
super(null);
|
||||
title = I18n.translateToLocal("botaniamisc.historyLong");
|
||||
title = I18n.format("botaniamisc.historyLong");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -33,7 +33,7 @@ public class GuiLexiconHistory extends GuiLexiconIndex {
|
||||
ILexicon lex = (ILexicon) stackUsed.getItem();
|
||||
for(int i = history.size() - 1; i >= 0; i--) {
|
||||
LexiconEntry entry = history.get(i);
|
||||
if(lex.isKnowledgeUnlocked(stackUsed, entry.getKnowledgeType()) && I18n.translateToLocal(entry.getUnlocalizedName()).toLowerCase().contains(searchField.getText().toLowerCase().trim()))
|
||||
if(lex.isKnowledgeUnlocked(stackUsed, entry.getKnowledgeType()) && I18n.format(entry.getUnlocalizedName()).toLowerCase().contains(searchField.getText().toLowerCase().trim()))
|
||||
entriesToDisplay.add(entry);
|
||||
}
|
||||
}
|
||||
@@ -50,9 +50,7 @@ public class GuiLexiconHistory extends GuiLexiconIndex {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound cmp) {
|
||||
// NO-OP
|
||||
}
|
||||
public void load(NBTTagCompound cmp) {}
|
||||
|
||||
@Override
|
||||
public String getNotesKey() {
|
||||
|
||||
@@ -14,11 +14,11 @@ import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.ILexicon;
|
||||
@@ -28,7 +28,7 @@ import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonBack;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonInvisible;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonPage;
|
||||
import vazkii.botania.common.lexicon.DLexiconEntry;
|
||||
import vazkii.botania.common.lexicon.DogLexiconEntry;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -54,7 +54,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
LexiconEntry currentEntry;
|
||||
float infoTime;
|
||||
|
||||
List<LexiconEntry> entriesToDisplay = new ArrayList<>();
|
||||
final List<LexiconEntry> entriesToDisplay = new ArrayList<>();
|
||||
|
||||
public GuiLexiconIndex() {
|
||||
parent = new GuiLexicon();
|
||||
@@ -67,7 +67,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
public void setTitle() {
|
||||
title = I18n.translateToLocal(category == null ? "botaniamisc.lexiconIndex" : category.getUnlocalizedName());
|
||||
title = I18n.format(category == null ? "botaniamisc.lexiconIndex" : category.getUnlocalizedName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -135,7 +135,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
return true;
|
||||
|
||||
search = search.toLowerCase();
|
||||
if(I18n.translateToLocal(e.getUnlocalizedName()).toLowerCase().contains(search))
|
||||
if(I18n.format(e.getUnlocalizedName()).toLowerCase().contains(search))
|
||||
return true;
|
||||
|
||||
for(ItemStack stack : e.getDisplayedRecipes()) {
|
||||
@@ -155,12 +155,12 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
GuiButtonInvisible button = (GuiButtonInvisible) buttonList.get(i - page * 12);
|
||||
LexiconEntry entry = i >= entriesToDisplay.size() ? null : entriesToDisplay.get(i);
|
||||
if(entry != null) {
|
||||
button.displayString = entry.getKnowledgeType().color + "" + (entry.isPriority() ? TextFormatting.ITALIC : "") + I18n.translateToLocal(entry.getUnlocalizedName());
|
||||
button.displayString = entry.getKnowledgeType().color + "" + (entry.isPriority() ? TextFormatting.ITALIC : "") + I18n.format(entry.getUnlocalizedName());
|
||||
button.displayStack = entry.getIcon();
|
||||
if(entry == tutEntry)
|
||||
tutPage = page;
|
||||
|
||||
if(entry instanceof DLexiconEntry)
|
||||
if(entry instanceof DogLexiconEntry)
|
||||
button.dog = true;
|
||||
} else button.displayString = "";
|
||||
}
|
||||
@@ -186,14 +186,14 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
if(entriesToDisplay.size() == 1) {
|
||||
boolean unicode = mc.fontRendererObj.getUnicodeFlag();
|
||||
mc.fontRendererObj.setUnicodeFlag(true);
|
||||
String s = I18n.translateToLocal("botaniamisc.enterToView");
|
||||
String s = I18n.format("botaniamisc.enterToView");
|
||||
mc.fontRendererObj.drawString(s, left + guiWidth / 2 - mc.fontRendererObj.getStringWidth(s) / 2, top + 30, 0x666666);
|
||||
mc.fontRendererObj.setUnicodeFlag(unicode);
|
||||
}
|
||||
} else {
|
||||
boolean unicode = mc.fontRendererObj.getUnicodeFlag();
|
||||
mc.fontRendererObj.setUnicodeFlag(true);
|
||||
String s = I18n.translateToLocal("botaniamisc.typeToSearch");
|
||||
String s = I18n.format("botaniamisc.typeToSearch");
|
||||
mc.fontRendererObj.drawString(s, left + 120 - mc.fontRendererObj.getStringWidth(s), top + guiHeight - 18, 0x666666);
|
||||
mc.fontRendererObj.setUnicodeFlag(unicode);
|
||||
}
|
||||
@@ -206,8 +206,8 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
infoTime = Math.max(0, infoTime - timeDelta);
|
||||
|
||||
if(currentButton != null && infoTime == 0) {
|
||||
int x = par1 + 10;
|
||||
int y = par2;
|
||||
int x;
|
||||
int y;
|
||||
|
||||
x = currentButton.xPosition - 20;
|
||||
y = currentButton.yPosition;
|
||||
@@ -224,7 +224,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
|
||||
int x = currentButton.xPosition;
|
||||
int y = currentButton.yPosition;
|
||||
String s = I18n.translateToLocal(currentEntry.getTagline());
|
||||
String s = I18n.format(currentEntry.getTagline());
|
||||
boolean unicode = mc.fontRendererObj.getUnicodeFlag();
|
||||
mc.fontRendererObj.setUnicodeFlag(true);
|
||||
int width = mc.fontRendererObj.getStringWidth(s);
|
||||
|
||||
@@ -12,8 +12,8 @@ package vazkii.botania.client.gui.lexicon.button;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
|
||||
@@ -37,7 +37,7 @@ public class GuiButtonAchievement extends GuiButtonLexicon {
|
||||
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 109 : 98, 191, 11, 11);
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
tooltip.add(TextFormatting.YELLOW + I18n.translateToLocal("botaniamisc.achievements"));
|
||||
tooltip.add(TextFormatting.YELLOW + I18n.format("botaniamisc.achievements"));
|
||||
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
if(k == 2)
|
||||
|
||||
@@ -12,7 +12,7 @@ package vazkii.botania.client.gui.lexicon.button;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class GuiButtonBack extends GuiButtonLexicon {
|
||||
}
|
||||
|
||||
public List<String> getTooltip() {
|
||||
return Collections.singletonList(I18n.translateToLocal("botaniamisc.back"));
|
||||
return Collections.singletonList(I18n.format("botaniamisc.back"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
package vazkii.botania.client.gui.lexicon.button;
|
||||
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -24,7 +24,7 @@ public class GuiButtonBackWithShift extends GuiButtonBack {
|
||||
|
||||
@Override
|
||||
public List<String> getTooltip() {
|
||||
return Arrays.asList(I18n.translateToLocal("botaniamisc.back"), TextFormatting.GRAY + I18n.translateToLocal("botaniamisc.clickToIndex"));
|
||||
return Arrays.asList(I18n.format("botaniamisc.back"), TextFormatting.GRAY + I18n.format("botaniamisc.clickToIndex"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package vazkii.botania.client.gui.lexicon.button;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonBookmark extends GuiButtonLexicon {
|
||||
|
||||
GuiLexicon gui;
|
||||
final GuiLexicon gui;
|
||||
|
||||
public GuiButtonBookmark(int par1, int par2, int par3, GuiLexicon gui, String str) {
|
||||
super(par1, par2, par3, gui.bookmarkWidth(str) + 5, 11, str);
|
||||
@@ -27,11 +27,11 @@ public class GuiButtonBookmark extends GuiButtonLexicon {
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
if(displayString.equals("+"))
|
||||
tooltip.add(I18n.translateToLocal("botaniamisc.clickToAdd"));
|
||||
tooltip.add(I18n.format("botaniamisc.clickToAdd"));
|
||||
else {
|
||||
tooltip.add(String.format(I18n.translateToLocal("botaniamisc.bookmark"), id - GuiLexicon.BOOKMARK_START + 1));
|
||||
tooltip.add(TextFormatting.GRAY + I18n.translateToLocal("botaniamisc.clickToSee"));
|
||||
tooltip.add(TextFormatting.GRAY + I18n.translateToLocal("botaniamisc.shiftToRemove"));
|
||||
tooltip.add(I18n.format("botaniamisc.bookmark", id - GuiLexicon.BOOKMARK_START + 1));
|
||||
tooltip.add(TextFormatting.GRAY + I18n.format("botaniamisc.clickToSee"));
|
||||
tooltip.add(TextFormatting.GRAY + I18n.format("botaniamisc.shiftToRemove"));
|
||||
}
|
||||
|
||||
int tooltipY = (tooltip.size() + 1) * 5;
|
||||
|
||||
@@ -15,7 +15,7 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import org.lwjgl.opengl.ARBMultitexture;
|
||||
import org.lwjgl.opengl.ARBShaderObjects;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -36,13 +36,13 @@ public class GuiButtonCategory extends GuiButtonLexicon {
|
||||
|
||||
private static boolean boundStencil = false;
|
||||
|
||||
GuiLexicon gui;
|
||||
private LexiconCategory category;
|
||||
final GuiLexicon gui;
|
||||
private final LexiconCategory category;
|
||||
private ResourceLocation resource = null;
|
||||
private float ticksHovered = 0F;
|
||||
private float time = 12F;
|
||||
private final float time = 12F;
|
||||
|
||||
private ShaderCallback shaderCallback = shader -> {
|
||||
private final ShaderCallback shaderCallback = shader -> {
|
||||
TextureManager r = Minecraft.getMinecraft().renderEngine;
|
||||
int heightMatchUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "heightMatch");
|
||||
int imageUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "image");
|
||||
@@ -122,7 +122,7 @@ public class GuiButtonCategory extends GuiButtonLexicon {
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
if(inside)
|
||||
gui.categoryHighlight = I18n.translateToLocal(getTooltipText());
|
||||
gui.categoryHighlight = I18n.format(getTooltipText());
|
||||
}
|
||||
|
||||
private String getTooltipText() {
|
||||
|
||||
@@ -14,7 +14,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import vazkii.botania.client.challenge.Challenge;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -23,7 +23,7 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonChallengeIcon extends GuiButtonLexicon {
|
||||
|
||||
public Challenge challenge;
|
||||
public final Challenge challenge;
|
||||
|
||||
public GuiButtonChallengeIcon(int id, int x, int y, Challenge challenge) {
|
||||
super(id, x, y, 16, 16, "");
|
||||
@@ -50,7 +50,7 @@ public class GuiButtonChallengeIcon extends GuiButtonLexicon {
|
||||
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
tooltip.add(TextFormatting.AQUA + I18n.translateToLocal(challenge.unlocalizedName));
|
||||
tooltip.add(TextFormatting.AQUA + I18n.format(challenge.unlocalizedName));
|
||||
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
if(k == 2)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
package vazkii.botania.client.gui.lexicon.button;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonChallengeInfo extends GuiButtonLexicon {
|
||||
|
||||
GuiLexicon gui;
|
||||
final GuiLexicon gui;
|
||||
|
||||
public GuiButtonChallengeInfo(int par1, int par2, int par3, String str, GuiLexicon gui) {
|
||||
super(par1, par2, par3, gui.bookmarkWidth(str) + 5, 11, str);
|
||||
@@ -35,7 +35,7 @@ public class GuiButtonChallengeInfo extends GuiButtonLexicon {
|
||||
int k = getHoverState(hovered);
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
tooltip.add(I18n.translateToLocal("botaniamisc.challengeInfo"));
|
||||
tooltip.add(I18n.format("botaniamisc.challengeInfo"));
|
||||
|
||||
int tooltipY = (tooltip.size() + 1) * 5;
|
||||
if(k == 2)
|
||||
|
||||
@@ -13,7 +13,7 @@ package vazkii.botania.client.gui.lexicon.button;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
|
||||
@@ -37,7 +37,7 @@ public class GuiButtonChallenges extends GuiButtonLexicon {
|
||||
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 131 : 120, 180, 11, 11);
|
||||
|
||||
List<String> tooltip = new ArrayList();
|
||||
tooltip.add(TextFormatting.YELLOW + I18n.translateToLocal("botaniamisc.challenges"));
|
||||
tooltip.add(TextFormatting.YELLOW + I18n.format("botaniamisc.challenges"));
|
||||
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
if(k == 2)
|
||||
|
||||
@@ -12,7 +12,7 @@ package vazkii.botania.client.gui.lexicon.button;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonHistory extends GuiButtonLexicon {
|
||||
|
||||
GuiLexicon gui;
|
||||
final GuiLexicon gui;
|
||||
|
||||
public GuiButtonHistory(int par1, int par2, int par3, String str, GuiLexicon gui) {
|
||||
super(par1, par2, par3, gui.bookmarkWidth(str) + 5, 11, str);
|
||||
@@ -36,8 +36,8 @@ public class GuiButtonHistory extends GuiButtonLexicon {
|
||||
int k = getHoverState(hovered);
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
tooltip.add(I18n.translateToLocal("botaniamisc.historyLong"));
|
||||
tooltip.add(TextFormatting.GRAY + I18n.translateToLocal("botaniamisc.historyDesc"));
|
||||
tooltip.add(I18n.format("botaniamisc.historyLong"));
|
||||
tooltip.add(TextFormatting.GRAY + I18n.format("botaniamisc.historyDesc"));
|
||||
|
||||
int tooltipY = (tooltip.size() + 1) * 5;
|
||||
if(k == 2)
|
||||
|
||||
@@ -30,7 +30,7 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
|
||||
|
||||
private static final ResourceLocation dogResource = new ResourceLocation(LibResources.GUI_DOG);
|
||||
|
||||
GuiLexiconIndex gui;
|
||||
final GuiLexiconIndex gui;
|
||||
public ItemStack displayStack = null;
|
||||
public boolean dog = false;
|
||||
float timeHover = 0;
|
||||
@@ -56,12 +56,12 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(dogResource);
|
||||
float f = 1F / 64F;
|
||||
GL11.glTranslated(dogPos, 0, 0);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GlStateManager.translate(dogPos, 0, 0);
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
vazkii.botania.client.core.helper.RenderHelper.drawTexturedModalRect(0, yPosition, zLevel + 10, (dogPos % 100 < 50) ? 23 : 0, 0, 23, 19, f, f);
|
||||
xPosition = (int) Math.max(xPosition, dogPos + 10);
|
||||
|
||||
GL11.glTranslated(-dogPos, 0, 0);
|
||||
GlStateManager.translate(-dogPos, 0, 0);
|
||||
}
|
||||
|
||||
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
|
||||
@@ -17,13 +17,13 @@ import vazkii.botania.api.sound.BotaniaSoundEvents;
|
||||
|
||||
public class GuiButtonLexicon extends GuiButton {
|
||||
|
||||
public GuiButtonLexicon(int p_i1021_1_, int p_i1021_2_, int p_i1021_3_, int p_i1021_4_, int p_i1021_5_, String p_i1021_6_) {
|
||||
super(p_i1021_1_, p_i1021_2_, p_i1021_3_, p_i1021_4_, p_i1021_5_, p_i1021_6_);
|
||||
public GuiButtonLexicon(int id, int x, int y, int width, int height, String text) {
|
||||
super(id, x, y, width, height, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playPressSound(SoundHandler p_146113_1_) {
|
||||
p_146113_1_.playSound(PositionedSoundRecord.getMasterRecord(BotaniaSoundEvents.lexiconPage, 1.0F));
|
||||
public void playPressSound(SoundHandler handler) {
|
||||
handler.playSound(PositionedSoundRecord.getMasterRecord(BotaniaSoundEvents.lexiconPage, 1.0F));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,7 +13,7 @@ package vazkii.botania.client.gui.lexicon.button;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonNotes extends GuiButtonLexicon {
|
||||
|
||||
GuiLexicon parent;
|
||||
final GuiLexicon parent;
|
||||
|
||||
public GuiButtonNotes(GuiLexicon parent, int id, int x, int y) {
|
||||
super(id, x, y, 11, 11, "");
|
||||
@@ -41,9 +41,9 @@ public class GuiButtonNotes extends GuiButtonLexicon {
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
if(GuiLexicon.notesEnabled)
|
||||
tooltip.add(TextFormatting.GREEN + I18n.translateToLocal("botaniamisc.hideNotes"));
|
||||
tooltip.add(TextFormatting.GREEN + I18n.format("botaniamisc.hideNotes"));
|
||||
else {
|
||||
tooltip.add(TextFormatting.GREEN + I18n.translateToLocal("botaniamisc.showNotes"));
|
||||
tooltip.add(TextFormatting.GREEN + I18n.format("botaniamisc.showNotes"));
|
||||
if(parent.note != null && !parent.note.isEmpty())
|
||||
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow("!", xPosition + 10, yPosition, 0xFF0000);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ package vazkii.botania.client.gui.lexicon.button;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
|
||||
@@ -38,7 +38,7 @@ public class GuiButtonOptions extends GuiButtonLexicon {
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
for(int i = 0; i < 3; i++)
|
||||
tooltip.add((i == 0 ? TextFormatting.RED : TextFormatting.GRAY) + I18n.translateToLocal("botaniamisc.lexiconOptions" + i));
|
||||
tooltip.add((i == 0 ? TextFormatting.RED : TextFormatting.GRAY) + I18n.format("botaniamisc.lexiconOptions" + i));
|
||||
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
if(k == 2)
|
||||
|
||||
@@ -12,7 +12,7 @@ package vazkii.botania.client.gui.lexicon.button;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.Collections;
|
||||
|
||||
public class GuiButtonPage extends GuiButtonLexicon {
|
||||
|
||||
boolean right;
|
||||
final boolean right;
|
||||
|
||||
public GuiButtonPage(int par1, int par2, int par3, boolean right) {
|
||||
super(par1, par2, par3, 18, 10, "");
|
||||
@@ -39,7 +39,7 @@ public class GuiButtonPage extends GuiButtonLexicon {
|
||||
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 18 : 0, right ? 180 : 190, 18, 10);
|
||||
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3, Collections.singletonList(I18n.translateToLocal(right ? "botaniamisc.nextPage" : "botaniamisc.prevPage")));
|
||||
RenderHelper.renderTooltip(par2, par3, Collections.singletonList(I18n.format(right ? "botaniamisc.nextPage" : "botaniamisc.prevPage")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ package vazkii.botania.client.gui.lexicon.button;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
|
||||
@@ -43,6 +43,6 @@ public class GuiButtonShare extends GuiButtonLexicon {
|
||||
}
|
||||
|
||||
public List<String> getTooltip() {
|
||||
return Collections.singletonList(TextFormatting.AQUA + I18n.translateToLocal("botaniamisc.clickToShare"));
|
||||
return Collections.singletonList(TextFormatting.AQUA + I18n.format("botaniamisc.clickToShare"));
|
||||
}
|
||||
}
|
||||
Loaded 100 of 1385 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user