mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-10-26 22:34:08 +00:00
Compare commits
222
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67ef25de09 | ||
|
|
072e3a693b | ||
|
|
b29c810a80 | ||
|
|
3f8e3f72d9 | ||
|
|
5041e23ede | ||
|
|
21a35c9c92 | ||
|
|
6d542dec5a | ||
|
|
4552a451ae | ||
|
|
5c33e95a54 | ||
|
|
1e2bd1d4cd | ||
|
|
1cc995c986 | ||
|
|
1799380064 | ||
|
|
0d3ffa2598 | ||
|
|
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 | ||
|
|
b7fead0e4d |
No files matched your search
+27
-10
@@ -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"
|
||||
@@ -113,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)
|
||||
@@ -154,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)
|
||||
@@ -172,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
|
||||
@@ -202,6 +218,7 @@ def scp(String dir, Closure antFileset = {}) {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
def parseConfig(File config) {
|
||||
config.withReader {
|
||||
@@ -223,8 +240,8 @@ curseforge {
|
||||
changelog = """
|
||||
See https://github.com/williewillus/Botania/releases/tag/${version}
|
||||
"""
|
||||
releaseType = "beta"
|
||||
addGameVersion '1.9.4'
|
||||
releaseType = "release"
|
||||
addGameVersion "${minecraft.version}"
|
||||
relations {
|
||||
requiredLibrary 'baubles'
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
#
|
||||
#Fri May 27 20:53:49 CDT 2016
|
||||
#Fri Jul 29 18:40:22 CDT 2016
|
||||
version=r1.8
|
||||
dir_output=../Build Output/Botania/
|
||||
forge_version=12.18.1.2044
|
||||
mc_version=1.10.2
|
||||
dir_repo=./
|
||||
mc_version=1.9.4
|
||||
forge_version=12.17.0.1922-1.9.4
|
||||
build_number=308
|
||||
build_number=315
|
||||
mod_name=Botania
|
||||
+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");
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -150,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) {
|
||||
@@ -165,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) {
|
||||
@@ -205,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) {
|
||||
@@ -225,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) {}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,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";
|
||||
|
||||
@@ -117,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,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";
|
||||
|
||||
@@ -142,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -31,13 +31,15 @@ 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,14 +39,14 @@ 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 {
|
||||
@@ -55,9 +56,8 @@ public class ClientTickHandler {
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@@ -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,19 @@ 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) {
|
||||
for (Map.Entry<IUnlistedProperty<?>, Optional<?>> e : ((IExtendedBlockState) state).getUnlistedProperties().entrySet()) {
|
||||
event.getRight().add(e.getKey().getName() + ": " + e.getValue().orNull());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(Minecraft.IS_RUNNING_ON_MAC)
|
||||
event.getLeft().add(PREFIX + "SHIFT+CMD for context");
|
||||
else event.getLeft().add(PREFIX + "SHIFT+CTRL for context");
|
||||
|
||||
@@ -70,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;
|
||||
|
||||
@@ -90,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();
|
||||
@@ -142,9 +144,13 @@ public final class HUDHandler {
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -217,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;
|
||||
|
||||
@@ -240,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;
|
||||
@@ -269,7 +275,7 @@ 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;
|
||||
|
||||
@@ -301,7 +307,7 @@ public final class HUDHandler {
|
||||
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;
|
||||
|
||||
@@ -327,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;
|
||||
@@ -394,7 +400,7 @@ public final class HUDHandler {
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
private void renderNearIndexDisplay(ScaledResolution res) {
|
||||
private static void renderNearIndexDisplay(ScaledResolution res) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
String txt0 = I18n.format("botaniamisc.nearIndex0");
|
||||
String txt1 = TextFormatting.GRAY + I18n.format("botaniamisc.nearIndex1");
|
||||
|
||||
@@ -10,50 +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.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");
|
||||
@@ -82,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);
|
||||
|
||||
@@ -103,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;
|
||||
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 final Vector3 start;
|
||||
public final Vector3 end;
|
||||
BlockPos target;
|
||||
final TIntIntHashMap splitparents = new TIntIntHashMap();
|
||||
|
||||
public final double length;
|
||||
public int numsegments0;
|
||||
private int numsplits;
|
||||
private boolean finalized;
|
||||
private final Random rand;
|
||||
public final long seed;
|
||||
|
||||
public int particleAge;
|
||||
public final int particleMaxAge;
|
||||
public boolean isDead;
|
||||
private AxisAlignedBB boundingBox;
|
||||
|
||||
private final 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 final int colorOuter;
|
||||
public final int colorInner;
|
||||
|
||||
public static class BoltPoint {
|
||||
|
||||
public BoltPoint(Vector3 basepoint, Vector3 offsetvec) {
|
||||
point = basepoint.copy().add(offsetvec);
|
||||
this.basepoint = basepoint;
|
||||
this.offsetvec = offsetvec;
|
||||
}
|
||||
|
||||
public final Vector3 point;
|
||||
final Vector3 basepoint;
|
||||
final 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 final BoltPoint startpoint;
|
||||
public final BoltPoint endpoint;
|
||||
|
||||
public Vector3 diff;
|
||||
|
||||
public Segment prev;
|
||||
public Segment 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 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;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,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;
|
||||
@@ -27,6 +26,7 @@ import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.client.model.FloatingFlowerModel;
|
||||
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;
|
||||
@@ -161,7 +161,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 +191,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,57 +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.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.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.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;
|
||||
@@ -96,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() {
|
||||
@@ -278,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,6 +40,8 @@ import vazkii.botania.common.block.ModBlocks;
|
||||
|
||||
public final class MultiblockRenderHandler {
|
||||
|
||||
private MultiblockRenderHandler() {}
|
||||
|
||||
private static final MultiblockBlockAccess blockAccess = new MultiblockBlockAccess();
|
||||
private static int dimension;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -12,16 +12,19 @@ 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.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 {
|
||||
|
||||
final ModelBook model = new ModelBook();
|
||||
final 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) {
|
||||
Minecraft mc;
|
||||
if(true || !ConfigHandler.lexicon3dModel || mc.gameSettings.thirdPersonView != 0 || !PlayerHelper.hasHeldItem(mc.thePlayer, ModItems.lexicon))
|
||||
public void renderItem(RenderSpecificHandEvent evt) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
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);
|
||||
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,13 +101,12 @@ 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)
|
||||
@@ -189,56 +135,37 @@ public class RenderLexicon {
|
||||
GlStateManager.translate(0F, 10F, 0F);
|
||||
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 {
|
||||
|
||||
+15
-11
@@ -17,6 +17,9 @@ 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;
|
||||
@@ -49,7 +52,7 @@ public final class TooltipAdditionDisplayHandler {
|
||||
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);
|
||||
Slot slot = container.getSlotUnderMouse();
|
||||
if(slot != null && slot.getHasStack()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
if(stack != null) {
|
||||
@@ -122,19 +125,20 @@ public final class TooltipAdditionDisplayHandler {
|
||||
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);
|
||||
|
||||
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);
|
||||
GlStateManager.color(0F, 0.5F, 0F, a);
|
||||
GL11.glVertex2i(cx, cy);
|
||||
GlStateManager.color(0F, 1F, 0F, 1F);
|
||||
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;
|
||||
GL11.glVertex2d(cx + Math.cos(rad) * r, cy + Math.sin(rad) * r);
|
||||
buf.pos(cx + Math.cos(rad) * r, cy + Math.sin(rad) * r, 0).color(0F, 1F, 0F, 1F).endVertex();
|
||||
}
|
||||
GL11.glVertex2i(cx, cy);
|
||||
GL11.glEnd();
|
||||
|
||||
buf.pos(cx, cy, 0).color(0F, 1F, 0F, 0F).endVertex();
|
||||
Tessellator.getInstance().draw();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableTexture2D();
|
||||
@@ -187,14 +191,14 @@ public final class TooltipAdditionDisplayHandler {
|
||||
|
||||
String rank = I18n.format("botania.rank" + level).replaceAll("&", "\u00a7");
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
|
||||
GlStateManager.disableLighting();
|
||||
font.drawStringWithShadow(rank, mouseX + offx, mouseY - offy - 12, 0xFFFFFF);
|
||||
if(!ss) {
|
||||
rank = I18n.format("botania.rank" + (level + 1)).replaceAll("&", "\u00a7");
|
||||
font.drawStringWithShadow(rank, mouseX + offx + width - font.getStringWidth(rank), mouseY - offy - 12, 0xFFFFFF);
|
||||
}
|
||||
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableDepth();
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import vazkii.botania.common.item.ItemRegenIvy;
|
||||
public final class TooltipHandler {
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public void onTooltipEvent(ItemTooltipEvent event) {
|
||||
public static void onTooltipEvent(ItemTooltipEvent event) {
|
||||
if(event.getItemStack().getItem() == Item.getItemFromBlock(Blocks.DIRT) && event.getItemStack().getItemDamage() == 1) {
|
||||
event.getToolTip().add(I18n.format("botaniamisc.coarseDirt0"));
|
||||
event.getToolTip().add(I18n.format("botaniamisc.coarseDirt1"));
|
||||
|
||||
@@ -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;
|
||||
@@ -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,12 +26,10 @@ 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.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
@@ -63,11 +62,13 @@ import vazkii.botania.client.core.handler.RenderLexicon;
|
||||
import vazkii.botania.client.core.handler.SubTileRadiusRenderHandler;
|
||||
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 +96,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 +104,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;
|
||||
@@ -166,6 +169,11 @@ public class ClientProxy extends CommonProxy {
|
||||
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,8 +181,7 @@ 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);
|
||||
@@ -192,23 +199,24 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
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(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();
|
||||
@@ -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
|
||||
@@ -322,12 +332,11 @@ public class ClientProxy extends CommonProxy {
|
||||
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;
|
||||
@@ -478,7 +487,7 @@ 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);
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new FXLightning(world, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -495,5 +504,10 @@ public class ClientProxy extends CommonProxy {
|
||||
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;
|
||||
@@ -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,89 +167,75 @@ 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) {
|
||||
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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
final 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;
|
||||
|
||||
@@ -15,9 +15,11 @@ 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.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_) {
|
||||
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.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];
|
||||
|
||||
final EntityPlayer player;
|
||||
final 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 {
|
||||
|
||||
final InventoryFlowerBag inv;
|
||||
final 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 {
|
||||
|
||||
final InventoryBaubleBox baubleBoxInv;
|
||||
final 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];
|
||||
|
||||
final EntityPlayer player;
|
||||
final 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 {
|
||||
|
||||
final 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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
@@ -160,7 +160,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
if(entry == tutEntry)
|
||||
tutPage = page;
|
||||
|
||||
if(entry instanceof DLexiconEntry)
|
||||
if(entry instanceof DogLexiconEntry)
|
||||
button.dog = true;
|
||||
} else button.displayString = "";
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,6 +28,12 @@ public class BreweryRecipeHandler implements IRecipeHandler<RecipeBrew> {
|
||||
return "botania.brewery";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid(@Nonnull RecipeBrew recipe) { // o is erased type param
|
||||
return getRecipeCategoryUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeBrew recipe) {
|
||||
|
||||
+6
@@ -28,6 +28,12 @@ public class ElvenTradeRecipeHandler implements IRecipeHandler<RecipeElvenTrade>
|
||||
return "botania.elvenTrade";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid(@Nonnull RecipeElvenTrade recipe) { // o is erased type param
|
||||
return getRecipeCategoryUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeElvenTrade recipe) {
|
||||
|
||||
+6
@@ -28,6 +28,12 @@ public class ManaPoolRecipeHandler implements IRecipeHandler<RecipeManaInfusion>
|
||||
return "botania.manaPool";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid(@Nonnull RecipeManaInfusion recipe) { // o is erased type param
|
||||
return getRecipeCategoryUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeManaInfusion recipe) {
|
||||
|
||||
+6
@@ -28,6 +28,12 @@ public class PetalApothecaryRecipeHandler implements IRecipeHandler<RecipePetals
|
||||
return "botania.petals";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid(@Nonnull RecipePetals recipe) { // o is erased type param
|
||||
return getRecipeCategoryUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipePetals recipe) {
|
||||
|
||||
+6
@@ -28,6 +28,12 @@ public class PureDaisyRecipeHandler implements IRecipeHandler<RecipePureDaisy> {
|
||||
return "botania.pureDaisy";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid(@Nonnull RecipePureDaisy recipe) { // o is erased type param
|
||||
return getRecipeCategoryUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipePureDaisy recipe) {
|
||||
|
||||
+6
@@ -28,6 +28,12 @@ public class RunicAltarRecipeHandler implements IRecipeHandler<RecipeRuneAltar>
|
||||
return "botania.runicAltar";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid(@Nonnull RecipeRuneAltar recipe) { // o is erased type param
|
||||
return getRecipeCategoryUid();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeRuneAltar recipe) {
|
||||
|
||||
@@ -22,12 +22,11 @@ import net.minecraft.client.renderer.block.model.ModelManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
|
||||
@@ -35,21 +34,26 @@ import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
||||
import net.minecraftforge.client.model.pipeline.VertexTransformer;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import vazkii.botania.api.BotaniaAPIClient;
|
||||
import vazkii.botania.api.item.IFloatingFlower;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.item.block.ItemBlockFloatingSpecialFlower;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.vecmath.Matrix4f;
|
||||
import javax.vecmath.Vector3f;
|
||||
import javax.vecmath.Vector4f;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class FloatingFlowerModel implements IBakedModel, IResourceManagerReloadListener {
|
||||
public class FloatingFlowerModel implements IBakedModel {
|
||||
|
||||
private static final String MUNDANE_PREFIX = "botania:shimmeringFlower_";
|
||||
private final Table<IFloatingFlower.IslandType, String, CompositeBakedModel> CACHE = HashBasedTable.create();
|
||||
@@ -80,11 +84,6 @@ public class FloatingFlowerModel implements IBakedModel, IResourceManagerReloadL
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResourceManagerReload(@Nonnull IResourceManager resourceManager) {
|
||||
CACHE.clear();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing face, long rand) {
|
||||
@@ -132,7 +131,7 @@ public class FloatingFlowerModel implements IBakedModel, IResourceManagerReloadL
|
||||
|
||||
// Enhance!
|
||||
CompositeBakedModel model = new CompositeBakedModel(flowerModel, islandModel);
|
||||
FMLLog.info("[Botania]: Cached floating flower model for islandtype %s and flowertype %s", islandType, identifier);
|
||||
Botania.LOGGER.debug("Cached floating flower model for islandtype %s and flowertype %s", islandType, identifier);
|
||||
CACHE.put(islandType, identifier, model);
|
||||
return model;
|
||||
}
|
||||
@@ -147,22 +146,25 @@ public class FloatingFlowerModel implements IBakedModel, IResourceManagerReloadL
|
||||
@Override public boolean isAmbientOcclusion() { return false; }
|
||||
@Override public boolean isGui3d() { return true; }
|
||||
@Override public boolean isBuiltInRenderer() { return false; }
|
||||
@Nonnull
|
||||
@Override public TextureAtlasSprite getParticleTexture() { return null; }
|
||||
@Nonnull
|
||||
@Override public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; }
|
||||
@Nonnull @Override public TextureAtlasSprite getParticleTexture() { return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/dirt"); }
|
||||
@Nonnull @Override public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; }
|
||||
|
||||
private static class CompositeBakedModel implements IBakedModel {
|
||||
private static class CompositeBakedModel implements IPerspectiveAwareModel {
|
||||
|
||||
private final IBakedModel base;
|
||||
private final IBakedModel flower;
|
||||
private final IBakedModel island;
|
||||
private final List<BakedQuad> genQuads;
|
||||
private final Map<EnumFacing, List<BakedQuad>> faceQuads = new EnumMap<>(EnumFacing.class);
|
||||
|
||||
public CompositeBakedModel(IBakedModel flower, IBakedModel island) {
|
||||
this.base = flower;
|
||||
this.flower = flower;
|
||||
this.island = island;
|
||||
|
||||
ImmutableList.Builder<BakedQuad> genBuilder = ImmutableList.builder();
|
||||
final TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0F, 0.2F, 0F), null, new Vector3f(0.5F, 0.5F, 0.5F), null));
|
||||
|
||||
for(EnumFacing e : EnumFacing.VALUES)
|
||||
faceQuads.put(e, new ArrayList<>());
|
||||
|
||||
// Add flower quads, scaled and translated
|
||||
for(BakedQuad quad : flower.getQuads(null, null, 0)) {
|
||||
@@ -170,54 +172,48 @@ public class FloatingFlowerModel implements IBakedModel, IResourceManagerReloadL
|
||||
}
|
||||
|
||||
for(EnumFacing e : EnumFacing.VALUES) {
|
||||
genBuilder.addAll(flower.getQuads(null, e, 0).stream().map(input -> transform(input, transform)).collect(Collectors.toList()));
|
||||
faceQuads.get(e).addAll(flower.getQuads(null, e, 0).stream().map(input -> transform(input, transform)).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
// Add island quads
|
||||
genBuilder.addAll(island.getQuads(null, null, 0));
|
||||
for(EnumFacing e : EnumFacing.VALUES) {
|
||||
genBuilder.addAll(island.getQuads(null, e, 0));
|
||||
faceQuads.get(e).addAll(island.getQuads(null, e, 0));
|
||||
}
|
||||
|
||||
genQuads = genBuilder.build();
|
||||
}
|
||||
|
||||
// Forward all to flower model
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing face, long rand) {
|
||||
return genQuads;
|
||||
@Nonnull @Override public List<BakedQuad> getQuads(IBlockState state, EnumFacing face, long rand) {
|
||||
return face == null ? genQuads : faceQuads.get(face);
|
||||
}
|
||||
@Override public boolean isAmbientOcclusion() {
|
||||
return flower.isAmbientOcclusion();
|
||||
}
|
||||
@Override public boolean isGui3d() {
|
||||
return flower.isGui3d();
|
||||
}
|
||||
@Override public boolean isBuiltInRenderer() {
|
||||
return flower.isBuiltInRenderer();
|
||||
}
|
||||
@Nonnull @Override public TextureAtlasSprite getParticleTexture() {
|
||||
return flower.getParticleTexture();
|
||||
}
|
||||
@Nonnull @Override public ItemCameraTransforms getItemCameraTransforms() {
|
||||
return flower.getItemCameraTransforms();
|
||||
}
|
||||
@Nonnull @Override public ItemOverrideList getOverrides() { return ItemOverrideList.NONE; }
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion() {
|
||||
return base.isAmbientOcclusion();
|
||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
|
||||
if(island instanceof IPerspectiveAwareModel) {
|
||||
Pair<? extends IBakedModel, Matrix4f> pair = ((IPerspectiveAwareModel) island).handlePerspective(cameraTransformType);
|
||||
if(pair != null && pair.getRight() != null)
|
||||
return Pair.of(this, pair.getRight());
|
||||
}
|
||||
return Pair.of(this, TRSRTransformation.identity().getMatrix());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGui3d() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltInRenderer() {
|
||||
return base.isBuiltInRenderer();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
return base.getParticleTexture();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemCameraTransforms getItemCameraTransforms() {
|
||||
return base.getItemCameraTransforms();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override public ItemOverrideList getOverrides() { return ItemOverrideList.NONE; }
|
||||
}
|
||||
|
||||
private final ItemOverrideList itemHandler = new ItemOverrideList(ImmutableList.of()) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.vecmath.Matrix4f;
|
||||
@@ -25,20 +26,18 @@ public class LexiconModel implements IPerspectiveAwareModel {
|
||||
@Override
|
||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
|
||||
IBakedModel original = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getModel(path);
|
||||
/*if(cameraTransformType == ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND && ConfigHandler.lexicon3dModel)
|
||||
return Pair.of(this, null); todo 1.9 */
|
||||
if((cameraTransformType == ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND
|
||||
|| cameraTransformType == ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND)
|
||||
&& ConfigHandler.lexicon3dModel)
|
||||
return Pair.of(this, null);
|
||||
return ((IPerspectiveAwareModel) original).handlePerspective(cameraTransformType);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) { return ImmutableList.of(); }
|
||||
@Nonnull @Override public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) { return ImmutableList.of(); }
|
||||
@Override public boolean isAmbientOcclusion() { return false; }
|
||||
@Override public boolean isGui3d() { return false; }
|
||||
@Override public boolean isBuiltInRenderer() { return false; }
|
||||
@Nonnull
|
||||
@Override public TextureAtlasSprite getParticleTexture() { return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("botania:items/lexicon"); }
|
||||
@Nonnull
|
||||
@Override public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; }
|
||||
@Nonnull
|
||||
@Override public ItemOverrideList getOverrides() { return ItemOverrideList.NONE; }
|
||||
@Nonnull @Override public TextureAtlasSprite getParticleTexture() { return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("botania:items/lexicon"); }
|
||||
@Nonnull @Override public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; }
|
||||
@Nonnull @Override public ItemOverrideList getOverrides() { return ItemOverrideList.NONE; }
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class ModelHourglass extends ModelBase {
|
||||
base2.render(f);
|
||||
Color c = new Color(color);
|
||||
GL11.glColor3ub((byte) c.getRed(), (byte) c.getGreen(), (byte) c.getBlue());
|
||||
GL11.glPushAttrib(GL11.GL_NORMALIZE);
|
||||
GL11.glPushAttrib(GL11.GL_TRANSFORM_BIT);
|
||||
GlStateManager.enableNormalize();
|
||||
|
||||
if(fract1 > 0) {
|
||||
|
||||
@@ -152,8 +152,6 @@ public class ModelPylonOld extends ModelBase implements IPylonModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderGems(PylonVariant variant) {
|
||||
// NO-OP
|
||||
}
|
||||
public void renderGems(PylonVariant variant) {}
|
||||
|
||||
}
|
||||
@@ -121,19 +121,6 @@ public class PlatformModel implements IBakedModel {
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(@Nonnull BlockPos pos) {
|
||||
/* todo is this actually needed? if so this can't be an iblockaccess anymore
|
||||
IBlockState state = getBlockState(pos);
|
||||
if(state == null || !state.getBlock().hasTileEntity(state))
|
||||
return null;
|
||||
|
||||
TileEntity tile = state.getBlock().createTileEntity(this, state);
|
||||
if(tile == null)
|
||||
return null;
|
||||
|
||||
tile.setWorldObj(this);
|
||||
tile.setPos(pos);
|
||||
|
||||
return tile;*/
|
||||
return compose.getTileEntity(pos);
|
||||
}
|
||||
|
||||
@@ -159,13 +146,8 @@ public class PlatformModel implements IBakedModel {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Biome getBiomeGenForCoords(@Nonnull BlockPos pos) {
|
||||
return compose.getBiomeGenForCoords(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean extendedLevelsInChunkCache() {
|
||||
return compose.extendedLevelsInChunkCache();
|
||||
public Biome getBiome(@Nonnull BlockPos pos) {
|
||||
return compose.getBiome(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
@@ -27,6 +29,7 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -41,10 +44,10 @@ import net.minecraftforge.client.model.SimpleModelState;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import vazkii.botania.api.BotaniaAPIClient;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
|
||||
@@ -54,6 +57,7 @@ import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class SpecialFlowerModel implements IModelCustomData {
|
||||
|
||||
@@ -105,7 +109,7 @@ public class SpecialFlowerModel implements IModelCustomData {
|
||||
|
||||
for(String key : customData.keySet()) {
|
||||
if("base".equals(key)) {
|
||||
blockBuilder.put(Optional.absent(), getLocation(customData.get(key)));
|
||||
blockBuilder.put(Optional.empty(), getLocation(customData.get(key)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +131,7 @@ public class SpecialFlowerModel implements IModelCustomData {
|
||||
if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isString()) {
|
||||
return new ModelResourceLocation(e.getAsString());
|
||||
}
|
||||
FMLLog.severe("Expect ModelResourceLocation, got: ", json);
|
||||
Botania.LOGGER.error("Expect ModelResourceLocation, got: ", json);
|
||||
return new ModelResourceLocation("builtin/missing", "missing");
|
||||
}
|
||||
|
||||
@@ -153,64 +157,52 @@ public class SpecialFlowerModel implements IModelCustomData {
|
||||
}
|
||||
}
|
||||
|
||||
public static class SpecialFlowerBakedModel implements IPerspectiveAwareModel {
|
||||
private static class SpecialFlowerBakedModel implements IPerspectiveAwareModel {
|
||||
|
||||
private final ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms;
|
||||
private final ImmutableMap<Optional<String>, ModelResourceLocation> blockModels;
|
||||
private final ImmutableMap<Optional<String>, ModelResourceLocation> itemModels;
|
||||
|
||||
private IBakedModel baseModel;
|
||||
private ImmutableMap<String, IBakedModel> bakedBlockModels;
|
||||
private ImmutableMap<String, IBakedModel> bakedItemModels;
|
||||
private final IBakedModel baseModel;
|
||||
private final LoadingCache<String, Optional<IBakedModel>> bakedBlockModels;
|
||||
private final LoadingCache<String, Optional<IBakedModel>> bakedItemModels;
|
||||
|
||||
public SpecialFlowerBakedModel(ImmutableMap<Optional<String>, ModelResourceLocation> blockModels,
|
||||
SpecialFlowerBakedModel(ImmutableMap<Optional<String>, ModelResourceLocation> blockModels,
|
||||
ImmutableMap<Optional<String>, ModelResourceLocation> itemModels, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> cameraTransforms) {
|
||||
this.blockModels = blockModels;
|
||||
this.itemModels = itemModels;
|
||||
this.transforms = cameraTransforms;
|
||||
|
||||
ModelResourceLocation baseModelPath = blockModels.getOrDefault(Optional.empty(),
|
||||
new ModelResourceLocation("builtin/missing", "missing"));
|
||||
this.baseModel = ModelLoaderRegistry.getModelOrMissing(baseModelPath)
|
||||
.bake(new SimpleModelState(transforms), DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter());
|
||||
|
||||
this.bakedBlockModels = CacheBuilder.newBuilder().build(new Loader(true));
|
||||
this.bakedItemModels = CacheBuilder.newBuilder().build(new Loader(false));
|
||||
}
|
||||
|
||||
private void refreshBakedModels() {
|
||||
if(baseModel == null) {
|
||||
// If not done already, bake and cache all models
|
||||
baseModel = getBlockModel(Optional.absent());
|
||||
private class Loader extends CacheLoader<String, Optional<IBakedModel>> {
|
||||
|
||||
ImmutableMap.Builder<String, IBakedModel> builder = ImmutableMap.builder();
|
||||
for(Map.Entry<Optional<String>, ModelResourceLocation> e : blockModels.entrySet()) {
|
||||
if(e.getKey().isPresent()) {
|
||||
builder.put(e.getKey().get(), getBlockModel(e.getKey()));
|
||||
}
|
||||
}
|
||||
private final boolean loadBlocks;
|
||||
|
||||
bakedBlockModels = builder.build();
|
||||
|
||||
ImmutableMap.Builder<String, IBakedModel> builder2 = ImmutableMap.builder();
|
||||
for(Map.Entry<Optional<String>, ModelResourceLocation> e : itemModels.entrySet()) {
|
||||
if(e.getKey().isPresent()) {
|
||||
builder2.put(e.getKey().get(), getItemModel(e.getKey()));
|
||||
}
|
||||
}
|
||||
|
||||
bakedItemModels = builder2.build();
|
||||
Loader(boolean blocks) {
|
||||
this.loadBlocks = blocks;
|
||||
}
|
||||
}
|
||||
|
||||
private IBakedModel getBlockModel(Optional<String> opt) {
|
||||
ModelResourceLocation loc = blockModels.get(opt);
|
||||
if(loc == null) {
|
||||
loc = new ModelResourceLocation("builtin/missing", "missing");
|
||||
}
|
||||
IModel model = ModelLoaderRegistry.getModelOrMissing(loc);
|
||||
return model.bake(new SimpleModelState(transforms), DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter());
|
||||
}
|
||||
@Override
|
||||
public Optional<IBakedModel> load(@Nonnull String key) {
|
||||
if (key == null) Botania.LOGGER.error("Null passed to special model cacheloader?!");
|
||||
Map<Optional<String>, ModelResourceLocation> loadFrom = loadBlocks ? blockModels : itemModels;
|
||||
|
||||
private IBakedModel getItemModel(Optional<String> opt) {
|
||||
ModelResourceLocation loc = itemModels.get(opt);
|
||||
if(loc == null) {
|
||||
loc = new ModelResourceLocation("builtin/missing", "missing");
|
||||
ModelResourceLocation loc = loadFrom.get(Optional.of(key));
|
||||
if(loc == null)
|
||||
return Optional.empty();
|
||||
IModel model = ModelLoaderRegistry.getModelOrMissing(loc);
|
||||
if(model == ModelLoaderRegistry.getMissingModel())
|
||||
return Optional.empty();
|
||||
return Optional.of(model.bake(new SimpleModelState(transforms), DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter()));
|
||||
}
|
||||
IModel model = ModelLoaderRegistry.getModelOrMissing(loc);
|
||||
return model.bake(new SimpleModelState(transforms), DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -218,11 +210,17 @@ public class SpecialFlowerModel implements IModelCustomData {
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing face, long rand) {
|
||||
if(state.getBlock() != ModBlocks.specialFlower)
|
||||
return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel().getQuads(state, face, rand);
|
||||
refreshBakedModels();
|
||||
Botania.LOGGER.info("Getting " + (face == null ? "gen" : face.getName()) + " quads");
|
||||
IExtendedBlockState extendedState = ((IExtendedBlockState) state);
|
||||
IBakedModel ret = bakedBlockModels.get(extendedState.getValue(BotaniaStateProps.SUBTILE_ID));
|
||||
if(ret == null)
|
||||
ret = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
|
||||
String subtileId = extendedState.getValue(BotaniaStateProps.SUBTILE_ID);
|
||||
|
||||
IBakedModel ret = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
|
||||
if(subtileId != null) { // Todo remove - workaround for subtile ID being null?
|
||||
Optional<IBakedModel> specialModel = bakedBlockModels.getUnchecked(extendedState.getValue(BotaniaStateProps.SUBTILE_ID));
|
||||
if(specialModel.isPresent())
|
||||
ret = specialModel.get();
|
||||
}
|
||||
|
||||
return ret.getQuads(state, face, rand);
|
||||
}
|
||||
|
||||
@@ -232,42 +230,41 @@ public class SpecialFlowerModel implements IModelCustomData {
|
||||
return itemHandler;
|
||||
}
|
||||
|
||||
private final ItemStack roseFallback = new ItemStack(Blocks.RED_FLOWER);
|
||||
|
||||
private final ItemOverrideList itemHandler = new ItemOverrideList(ImmutableList.of()) {
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBakedModel handleItemState(@Nonnull IBakedModel original, ItemStack stack, @Nonnull World world, @Nonnull EntityLivingBase living) {
|
||||
refreshBakedModels();
|
||||
IBakedModel item = bakedItemModels.get(ItemBlockSpecialFlower.getType(stack));
|
||||
if(item == null) {
|
||||
item = bakedBlockModels.get(ItemBlockSpecialFlower.getType(stack));
|
||||
}
|
||||
Optional<IBakedModel> item = bakedItemModels.getUnchecked(ItemBlockSpecialFlower.getType(stack));
|
||||
|
||||
return item == null ? Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel() : item;
|
||||
if(!item.isPresent())
|
||||
item = bakedBlockModels.getUnchecked(ItemBlockSpecialFlower.getType(stack));
|
||||
|
||||
return item.isPresent()
|
||||
? item.get()
|
||||
: Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(roseFallback);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion() {
|
||||
refreshBakedModels();
|
||||
return baseModel.isAmbientOcclusion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGui3d() {
|
||||
refreshBakedModels();
|
||||
return baseModel.isGui3d();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltInRenderer() {
|
||||
refreshBakedModels();
|
||||
return baseModel.isBuiltInRenderer();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
refreshBakedModels();
|
||||
return baseModel.getParticleTexture();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,44 +14,46 @@ import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityArmorStand;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
import vazkii.botania.common.Botania;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ModelArmorElementium extends ModelBiped {
|
||||
|
||||
public final ModelRenderer helm;
|
||||
private final ModelRenderer helm;
|
||||
public final ModelRenderer body;
|
||||
public final ModelRenderer armR;
|
||||
public final ModelRenderer armL;
|
||||
private final ModelRenderer armR;
|
||||
private final ModelRenderer armL;
|
||||
public final ModelRenderer belt;
|
||||
public final ModelRenderer bootR;
|
||||
public final ModelRenderer bootL;
|
||||
public final ModelRenderer helm1;
|
||||
public final ModelRenderer helm2;
|
||||
public final ModelRenderer helm3;
|
||||
public final ModelRenderer fairy;
|
||||
public final ModelRenderer helmWing1;
|
||||
public final ModelRenderer helmWing2;
|
||||
public final ModelRenderer helmWing3;
|
||||
public final ModelRenderer helmWing4;
|
||||
public final ModelRenderer body2;
|
||||
public final ModelRenderer armRpauldron;
|
||||
public final ModelRenderer wing1;
|
||||
public final ModelRenderer wing2;
|
||||
public final ModelRenderer armLpauldron;
|
||||
public final ModelRenderer wing1_1;
|
||||
public final ModelRenderer wing2_1;
|
||||
public final ModelRenderer legR;
|
||||
public final ModelRenderer legL;
|
||||
public final ModelRenderer bootR1;
|
||||
public final ModelRenderer wing1_2;
|
||||
public final ModelRenderer wing2_2;
|
||||
public final ModelRenderer bootL1;
|
||||
public final ModelRenderer wing1_3;
|
||||
public final ModelRenderer wing2_3;
|
||||
private final ModelRenderer bootR;
|
||||
private final ModelRenderer bootL;
|
||||
private final ModelRenderer helm1;
|
||||
private final ModelRenderer helm2;
|
||||
private final ModelRenderer helm3;
|
||||
private final ModelRenderer fairy;
|
||||
private final ModelRenderer helmWing1;
|
||||
private final ModelRenderer helmWing2;
|
||||
private final ModelRenderer helmWing3;
|
||||
private final ModelRenderer helmWing4;
|
||||
private final ModelRenderer body2;
|
||||
private final ModelRenderer armRpauldron;
|
||||
private final ModelRenderer wing1;
|
||||
private final ModelRenderer wing2;
|
||||
private final ModelRenderer armLpauldron;
|
||||
private final ModelRenderer wing1_1;
|
||||
private final ModelRenderer wing2_1;
|
||||
private final ModelRenderer legR;
|
||||
private final ModelRenderer legL;
|
||||
private final ModelRenderer bootR1;
|
||||
private final ModelRenderer wing1_2;
|
||||
private final ModelRenderer wing2_2;
|
||||
private final ModelRenderer bootL1;
|
||||
private final ModelRenderer wing1_3;
|
||||
private final ModelRenderer wing2_3;
|
||||
|
||||
private final EntityEquipmentSlot slot;
|
||||
|
||||
@@ -212,7 +214,13 @@ public class ModelArmorElementium extends ModelBiped {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(@Nonnull Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
public void render(@Nonnull Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
|
||||
if(entity instanceof EntityArmorStand) {
|
||||
// Hack so helmets look right on armor stand
|
||||
netHeadYaw = 0;
|
||||
}
|
||||
|
||||
helm.showModel = slot == EntityEquipmentSlot.HEAD;
|
||||
body.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
armR.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
@@ -235,56 +243,10 @@ public class ModelArmorElementium extends ModelBiped {
|
||||
bipedLeftLeg = bootL;
|
||||
}
|
||||
|
||||
prepareForRender(entity);
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
super.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
|
||||
}
|
||||
|
||||
public void prepareForRender(Entity entity) {
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
isSneak = living != null && living.isSneaking();
|
||||
isChild = living != null && living.isChild();
|
||||
if(living != null) {
|
||||
ModelBiped.ArmPose mainPose = ArmPose.EMPTY;
|
||||
ModelBiped.ArmPose offPose = ArmPose.EMPTY;
|
||||
|
||||
// Copy from RenderPlayer.setModelVisibilities
|
||||
if(living.getHeldItemMainhand() != null) {
|
||||
mainPose = ArmPose.ITEM;
|
||||
if (living.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction = living.getHeldItemMainhand().getItemUseAction();
|
||||
|
||||
if (enumaction == EnumAction.BLOCK) {
|
||||
mainPose = ModelBiped.ArmPose.BLOCK;
|
||||
} else if (enumaction == EnumAction.BOW) {
|
||||
mainPose = ModelBiped.ArmPose.BOW_AND_ARROW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (living.getHeldItemOffhand() != null) {
|
||||
offPose = ModelBiped.ArmPose.ITEM;
|
||||
|
||||
if (living.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction1 = living.getHeldItemOffhand().getItemUseAction();
|
||||
|
||||
if (enumaction1 == EnumAction.BLOCK) {
|
||||
offPose = ModelBiped.ArmPose.BLOCK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(living.getPrimaryHand() == EnumHandSide.RIGHT) {
|
||||
rightArmPose = mainPose;
|
||||
leftArmPose = offPose;
|
||||
} else {
|
||||
rightArmPose = offPose;
|
||||
leftArmPose = mainPose;
|
||||
}
|
||||
// End copy RenderPlayer.setModelVisibilities
|
||||
}
|
||||
}
|
||||
|
||||
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
private void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
modelRenderer.rotateAngleX = x;
|
||||
modelRenderer.rotateAngleY = y;
|
||||
modelRenderer.rotateAngleZ = z;
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityArmorStand;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
@@ -23,25 +24,25 @@ import javax.annotation.Nonnull;
|
||||
public class ModelArmorManasteel extends ModelBiped {
|
||||
|
||||
|
||||
public final ModelRenderer helm;
|
||||
private final ModelRenderer helm;
|
||||
public final ModelRenderer body;
|
||||
public final ModelRenderer armR;
|
||||
public final ModelRenderer armL;
|
||||
private final ModelRenderer armR;
|
||||
private final ModelRenderer armL;
|
||||
public final ModelRenderer belt;
|
||||
public final ModelRenderer bootR;
|
||||
public final ModelRenderer bootL;
|
||||
public final ModelRenderer helm1;
|
||||
public final ModelRenderer helm2;
|
||||
public final ModelRenderer helm3;
|
||||
public final ModelRenderer helm4;
|
||||
public final ModelRenderer helm5;
|
||||
public final ModelRenderer helm6;
|
||||
public final ModelRenderer helm7;
|
||||
public final ModelRenderer body2;
|
||||
public final ModelRenderer armRpauldron;
|
||||
public final ModelRenderer armLpauldron;
|
||||
public final ModelRenderer legR;
|
||||
public final ModelRenderer legL;
|
||||
private final ModelRenderer bootR;
|
||||
private final ModelRenderer bootL;
|
||||
private final ModelRenderer helm1;
|
||||
private final ModelRenderer helm2;
|
||||
private final ModelRenderer helm3;
|
||||
private final ModelRenderer helm4;
|
||||
private final ModelRenderer helm5;
|
||||
private final ModelRenderer helm6;
|
||||
private final ModelRenderer helm7;
|
||||
private final ModelRenderer body2;
|
||||
private final ModelRenderer armRpauldron;
|
||||
private final ModelRenderer armLpauldron;
|
||||
private final ModelRenderer legR;
|
||||
private final ModelRenderer legL;
|
||||
|
||||
private final EntityEquipmentSlot slot;
|
||||
|
||||
@@ -142,7 +143,12 @@ public class ModelArmorManasteel extends ModelBiped {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(@Nonnull Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
public void render(@Nonnull Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
if(entity instanceof EntityArmorStand) {
|
||||
// Hack so helmets look right on armor stand
|
||||
netHeadYaw = 0;
|
||||
}
|
||||
|
||||
helm.showModel = slot == EntityEquipmentSlot.HEAD;
|
||||
body.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
armR.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
@@ -165,56 +171,10 @@ public class ModelArmorManasteel extends ModelBiped {
|
||||
bipedLeftLeg = bootL;
|
||||
}
|
||||
|
||||
prepareForRender(entity);
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
super.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
|
||||
}
|
||||
|
||||
public void prepareForRender(Entity entity) {
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
isSneak = living != null && living.isSneaking();
|
||||
isChild = living != null && living.isChild();
|
||||
if(living != null) {
|
||||
ModelBiped.ArmPose mainPose = ArmPose.EMPTY;
|
||||
ModelBiped.ArmPose offPose = ArmPose.EMPTY;
|
||||
|
||||
// Copy from RenderPlayer.setModelVisibilities
|
||||
if(living.getHeldItemMainhand() != null) {
|
||||
mainPose = ArmPose.ITEM;
|
||||
if (living.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction = living.getHeldItemMainhand().getItemUseAction();
|
||||
|
||||
if (enumaction == EnumAction.BLOCK) {
|
||||
mainPose = ModelBiped.ArmPose.BLOCK;
|
||||
} else if (enumaction == EnumAction.BOW) {
|
||||
mainPose = ModelBiped.ArmPose.BOW_AND_ARROW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (living.getHeldItemOffhand() != null) {
|
||||
offPose = ModelBiped.ArmPose.ITEM;
|
||||
|
||||
if (living.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction1 = living.getHeldItemOffhand().getItemUseAction();
|
||||
|
||||
if (enumaction1 == EnumAction.BLOCK) {
|
||||
offPose = ModelBiped.ArmPose.BLOCK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(living.getPrimaryHand() == EnumHandSide.RIGHT) {
|
||||
rightArmPose = mainPose;
|
||||
leftArmPose = offPose;
|
||||
} else {
|
||||
rightArmPose = offPose;
|
||||
leftArmPose = mainPose;
|
||||
}
|
||||
// End copy RenderPlayer.setModelVisibilities
|
||||
}
|
||||
}
|
||||
|
||||
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
private void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
modelRenderer.rotateAngleX = x;
|
||||
modelRenderer.rotateAngleY = y;
|
||||
modelRenderer.rotateAngleZ = z;
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityArmorStand;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
@@ -22,26 +23,26 @@ import javax.annotation.Nonnull;
|
||||
|
||||
public class ModelArmorManaweave extends ModelBiped {
|
||||
|
||||
public final ModelRenderer helm;
|
||||
private final ModelRenderer helm;
|
||||
public final ModelRenderer body;
|
||||
public final ModelRenderer armR;
|
||||
public final ModelRenderer armL;
|
||||
public final ModelRenderer legR;
|
||||
public final ModelRenderer legL;
|
||||
public final ModelRenderer bootR;
|
||||
public final ModelRenderer bootL;
|
||||
public final ModelRenderer helm2;
|
||||
public final ModelRenderer helm3;
|
||||
public final ModelRenderer helm4;
|
||||
public final ModelRenderer helmSeam1;
|
||||
public final ModelRenderer helmSeam2;
|
||||
public final ModelRenderer helmSeam3;
|
||||
public final ModelRenderer helmSeam4;
|
||||
public final ModelRenderer body2;
|
||||
public final ModelRenderer armRpauldron;
|
||||
public final ModelRenderer armLpauldron;
|
||||
public final ModelRenderer skirtR;
|
||||
public final ModelRenderer skirtL;
|
||||
private final ModelRenderer armR;
|
||||
private final ModelRenderer armL;
|
||||
private final ModelRenderer legR;
|
||||
private final ModelRenderer legL;
|
||||
private final ModelRenderer bootR;
|
||||
private final ModelRenderer bootL;
|
||||
private final ModelRenderer helm2;
|
||||
private final ModelRenderer helm3;
|
||||
private final ModelRenderer helm4;
|
||||
private final ModelRenderer helmSeam1;
|
||||
private final ModelRenderer helmSeam2;
|
||||
private final ModelRenderer helmSeam3;
|
||||
private final ModelRenderer helmSeam4;
|
||||
private final ModelRenderer body2;
|
||||
private final ModelRenderer armRpauldron;
|
||||
private final ModelRenderer armLpauldron;
|
||||
private final ModelRenderer skirtR;
|
||||
private final ModelRenderer skirtL;
|
||||
|
||||
private final EntityEquipmentSlot slot;
|
||||
|
||||
@@ -142,7 +143,12 @@ public class ModelArmorManaweave extends ModelBiped {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(@Nonnull Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
public void render(@Nonnull Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
if(entity instanceof EntityArmorStand) {
|
||||
// Hack so helmets look right on armor stand
|
||||
netHeadYaw = 0;
|
||||
}
|
||||
|
||||
helm.showModel = slot == EntityEquipmentSlot.HEAD;
|
||||
body.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
armR.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
@@ -165,56 +171,10 @@ public class ModelArmorManaweave extends ModelBiped {
|
||||
bipedLeftLeg = bootL;
|
||||
}
|
||||
|
||||
prepareForRender(entity);
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
super.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
|
||||
}
|
||||
|
||||
public void prepareForRender(Entity entity) {
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
isSneak = living != null && living.isSneaking();
|
||||
isChild = living != null && living.isChild();
|
||||
if(living != null) {
|
||||
ModelBiped.ArmPose mainPose = ArmPose.EMPTY;
|
||||
ModelBiped.ArmPose offPose = ArmPose.EMPTY;
|
||||
|
||||
// Copy from RenderPlayer.setModelVisibilities
|
||||
if(living.getHeldItemMainhand() != null) {
|
||||
mainPose = ArmPose.ITEM;
|
||||
if (living.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction = living.getHeldItemMainhand().getItemUseAction();
|
||||
|
||||
if (enumaction == EnumAction.BLOCK) {
|
||||
mainPose = ModelBiped.ArmPose.BLOCK;
|
||||
} else if (enumaction == EnumAction.BOW) {
|
||||
mainPose = ModelBiped.ArmPose.BOW_AND_ARROW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (living.getHeldItemOffhand() != null) {
|
||||
offPose = ModelBiped.ArmPose.ITEM;
|
||||
|
||||
if (living.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction1 = living.getHeldItemOffhand().getItemUseAction();
|
||||
|
||||
if (enumaction1 == EnumAction.BLOCK) {
|
||||
offPose = ModelBiped.ArmPose.BLOCK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(living.getPrimaryHand() == EnumHandSide.RIGHT) {
|
||||
rightArmPose = mainPose;
|
||||
leftArmPose = offPose;
|
||||
} else {
|
||||
rightArmPose = offPose;
|
||||
leftArmPose = mainPose;
|
||||
}
|
||||
// End copy RenderPlayer.setModelVisibilities
|
||||
}
|
||||
}
|
||||
|
||||
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
private void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
modelRenderer.rotateAngleX = x;
|
||||
modelRenderer.rotateAngleY = y;
|
||||
modelRenderer.rotateAngleZ = z;
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityArmorStand;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
@@ -22,39 +23,39 @@ import javax.annotation.Nonnull;
|
||||
|
||||
public class ModelArmorTerrasteel extends ModelBiped {
|
||||
|
||||
public final ModelRenderer helm;
|
||||
private final ModelRenderer helm;
|
||||
public final ModelRenderer body;
|
||||
public final ModelRenderer armr;
|
||||
public final ModelRenderer armL;
|
||||
private final ModelRenderer armr;
|
||||
private final ModelRenderer armL;
|
||||
public final ModelRenderer belt;
|
||||
public final ModelRenderer bootR;
|
||||
public final ModelRenderer bootL;
|
||||
public final ModelRenderer helm2;
|
||||
public final ModelRenderer helm3;
|
||||
public final ModelRenderer helm4;
|
||||
public final ModelRenderer helmLeaf1;
|
||||
public final ModelRenderer helmLeaf2;
|
||||
public final ModelRenderer helmLeaf3;
|
||||
public final ModelRenderer helmLeaf4;
|
||||
public final ModelRenderer helmLeaf5;
|
||||
public final ModelRenderer helmLeaf6;
|
||||
public final ModelRenderer helmbranch1;
|
||||
public final ModelRenderer helmbranch2;
|
||||
public final ModelRenderer helmbranch3;
|
||||
public final ModelRenderer helmbranch4;
|
||||
public final ModelRenderer body2;
|
||||
public final ModelRenderer armRpauldron;
|
||||
public final ModelRenderer armRbranch1;
|
||||
public final ModelRenderer armRbranch2;
|
||||
public final ModelRenderer armLpauldron;
|
||||
public final ModelRenderer armLbranch1;
|
||||
public final ModelRenderer armLbranch2;
|
||||
public final ModelRenderer legR;
|
||||
public final ModelRenderer legL;
|
||||
public final ModelRenderer bootR1;
|
||||
public final ModelRenderer bootRbranch;
|
||||
public final ModelRenderer bootL2;
|
||||
public final ModelRenderer bootLbranch;
|
||||
private final ModelRenderer bootR;
|
||||
private final ModelRenderer bootL;
|
||||
private final ModelRenderer helm2;
|
||||
private final ModelRenderer helm3;
|
||||
private final ModelRenderer helm4;
|
||||
private final ModelRenderer helmLeaf1;
|
||||
private final ModelRenderer helmLeaf2;
|
||||
private final ModelRenderer helmLeaf3;
|
||||
private final ModelRenderer helmLeaf4;
|
||||
private final ModelRenderer helmLeaf5;
|
||||
private final ModelRenderer helmLeaf6;
|
||||
private final ModelRenderer helmbranch1;
|
||||
private final ModelRenderer helmbranch2;
|
||||
private final ModelRenderer helmbranch3;
|
||||
private final ModelRenderer helmbranch4;
|
||||
private final ModelRenderer body2;
|
||||
private final ModelRenderer armRpauldron;
|
||||
private final ModelRenderer armRbranch1;
|
||||
private final ModelRenderer armRbranch2;
|
||||
private final ModelRenderer armLpauldron;
|
||||
private final ModelRenderer armLbranch1;
|
||||
private final ModelRenderer armLbranch2;
|
||||
private final ModelRenderer legR;
|
||||
private final ModelRenderer legL;
|
||||
private final ModelRenderer bootR1;
|
||||
private final ModelRenderer bootRbranch;
|
||||
private final ModelRenderer bootL2;
|
||||
private final ModelRenderer bootLbranch;
|
||||
|
||||
private final EntityEquipmentSlot slot;
|
||||
|
||||
@@ -233,7 +234,12 @@ public class ModelArmorTerrasteel extends ModelBiped {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(@Nonnull Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
public void render(@Nonnull Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
if(entity instanceof EntityArmorStand) {
|
||||
// Hack so helmets look right on armor stand
|
||||
netHeadYaw = 0;
|
||||
}
|
||||
|
||||
helm.showModel = slot == EntityEquipmentSlot.HEAD;
|
||||
body.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
armr.showModel = slot == EntityEquipmentSlot.CHEST;
|
||||
@@ -256,56 +262,10 @@ public class ModelArmorTerrasteel extends ModelBiped {
|
||||
bipedLeftLeg = bootL;
|
||||
}
|
||||
|
||||
prepareForRender(entity);
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
super.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
|
||||
}
|
||||
|
||||
public void prepareForRender(Entity entity) {
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
isSneak = living != null && living.isSneaking();
|
||||
isChild = living != null && living.isChild();
|
||||
if(living != null) {
|
||||
ModelBiped.ArmPose mainPose = ArmPose.EMPTY;
|
||||
ModelBiped.ArmPose offPose = ArmPose.EMPTY;
|
||||
|
||||
// Copy from RenderPlayer.setModelVisibilities
|
||||
if(living.getHeldItemMainhand() != null) {
|
||||
mainPose = ArmPose.ITEM;
|
||||
if (living.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction = living.getHeldItemMainhand().getItemUseAction();
|
||||
|
||||
if (enumaction == EnumAction.BLOCK) {
|
||||
mainPose = ModelBiped.ArmPose.BLOCK;
|
||||
} else if (enumaction == EnumAction.BOW) {
|
||||
mainPose = ModelBiped.ArmPose.BOW_AND_ARROW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (living.getHeldItemOffhand() != null) {
|
||||
offPose = ModelBiped.ArmPose.ITEM;
|
||||
|
||||
if (living.getItemInUseCount() > 0) {
|
||||
EnumAction enumaction1 = living.getHeldItemOffhand().getItemUseAction();
|
||||
|
||||
if (enumaction1 == EnumAction.BLOCK) {
|
||||
offPose = ModelBiped.ArmPose.BLOCK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(living.getPrimaryHand() == EnumHandSide.RIGHT) {
|
||||
rightArmPose = mainPose;
|
||||
leftArmPose = offPose;
|
||||
} else {
|
||||
rightArmPose = offPose;
|
||||
leftArmPose = mainPose;
|
||||
}
|
||||
// End copy RenderPlayer.setModelVisibilities
|
||||
}
|
||||
}
|
||||
|
||||
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
private void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
modelRenderer.rotateAngleX = x;
|
||||
modelRenderer.rotateAngleY = y;
|
||||
modelRenderer.rotateAngleZ = z;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package vazkii.botania.client.render;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IModelRegister {
|
||||
/**
|
||||
* Do whatever needs to be done to register models
|
||||
* For Blocks, statemapper registration needs to be done BEFORE itemblock registration
|
||||
* Exceptions to that rule are noted
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerModels();
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package vazkii.botania.client.render.entity;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.client.render.tile.RenderTileGaiaHead;
|
||||
import vazkii.botania.common.block.tile.TileGaiaHead;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class LayerGaiaHead implements LayerRenderer<EntityPlayer> {
|
||||
|
||||
private final ModelRenderer modelRenderer;
|
||||
|
||||
public LayerGaiaHead(ModelRenderer modelRenderer)
|
||||
{
|
||||
this.modelRenderer = modelRenderer;
|
||||
}
|
||||
|
||||
// Copied from LayerCustomHead, edits noted
|
||||
@Override
|
||||
public void doRenderLayer(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
ItemStack itemstack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
|
||||
|
||||
if (itemstack != null && itemstack.getItem() == ModItems.gaiaHead) // Botania - check for head
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
if (player.isSneaking())
|
||||
{
|
||||
GlStateManager.translate(0.0F, 0.2F, 0.0F);
|
||||
}
|
||||
|
||||
/*boolean flag = player instanceof EntityVillager || player instanceof EntityZombie && ((EntityZombie)player).isVillager();
|
||||
|
||||
if (player.isChild() && !(player instanceof EntityVillager))
|
||||
{
|
||||
float f = 2.0F;
|
||||
float f1 = 1.4F;
|
||||
GlStateManager.translate(0.0F, 0.5F * scale, 0.0F);
|
||||
GlStateManager.scale(f1 / f, f1 / f, f1 / f);
|
||||
GlStateManager.translate(0.0F, 16.0F * scale, 0.0F);
|
||||
} Botania - N/A */
|
||||
|
||||
this.modelRenderer.postRender(0.0625F);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
float f2 = 1.1875F;
|
||||
GlStateManager.scale(f2, -f2, -f2);
|
||||
|
||||
// Botania - remove if check for skull and else branch. Check done above.
|
||||
|
||||
/*if (flag)
|
||||
{
|
||||
GlStateManager.translate(0.0F, 0.0625F, 0.0F);
|
||||
} Botania - N/A */
|
||||
|
||||
/*GameProfile gameprofile = null;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
{
|
||||
NBTTagCompound nbttagcompound = itemstack.getTagCompound();
|
||||
|
||||
if (nbttagcompound.hasKey("SkullOwner", 10))
|
||||
{
|
||||
gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner"));
|
||||
}
|
||||
else if (nbttagcompound.hasKey("SkullOwner", 8))
|
||||
{
|
||||
String s = nbttagcompound.getString("SkullOwner");
|
||||
|
||||
if (!StringUtils.isNullOrEmpty(s))
|
||||
{
|
||||
gameprofile = TileEntitySkull.updateGameprofile(new GameProfile((UUID)null, s));
|
||||
nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile));
|
||||
}
|
||||
}
|
||||
} Botania - Don't do skin stuff */
|
||||
|
||||
// Botania - use gaia TESR
|
||||
ShaderHelper.useShader(ShaderHelper.doppleganger, RenderDoppleganger.defaultCallback);
|
||||
((RenderTileGaiaHead) (TileEntitySpecialRenderer) TileEntityRendererDispatcher.instance.getSpecialRendererByClass(TileGaiaHead.class))
|
||||
.renderSkull(-0.5F, 0.0F, -0.5F, EnumFacing.UP, 180.0F, itemstack.getMetadata(), null, -1, limbSwing);
|
||||
ShaderHelper.releaseShader();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCombineTextures() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -107,8 +107,8 @@ public class RenderBabylonWeapon extends Render<EntityBabylonWeapon> {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(@Nonnull EntityBabylonWeapon p_110775_1_) {
|
||||
return null;
|
||||
protected ResourceLocation getEntityTexture(@Nonnull EntityBabylonWeapon entity) {
|
||||
return TextureMap.LOCATION_BLOCKS_TEXTURE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,8 +19,8 @@ import vazkii.botania.common.entity.EntityCorporeaSpark;
|
||||
|
||||
public class RenderCorporeaSpark extends RenderSparkBase<EntityCorporeaSpark> {
|
||||
|
||||
public RenderCorporeaSpark(RenderManager p_i46185_1_) {
|
||||
super(p_i46185_1_);
|
||||
public RenderCorporeaSpark(RenderManager manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
protected DataParameter<Integer> getInvisibilityParam() {
|
||||
|
||||
@@ -10,10 +10,13 @@
|
||||
*/
|
||||
package vazkii.botania.client.render.entity;
|
||||
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelPlayer;
|
||||
import net.minecraft.client.renderer.entity.RenderBiped;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.resources.DefaultPlayerSkin;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.ARBShaderObjects;
|
||||
import vazkii.botania.api.internal.ShaderCallback;
|
||||
@@ -21,6 +24,8 @@ import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.common.entity.EntityDoppleganger;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class RenderDoppleganger extends RenderBiped<EntityDoppleganger> {
|
||||
|
||||
@@ -73,7 +78,25 @@ public class RenderDoppleganger extends RenderBiped<EntityDoppleganger> {
|
||||
@Nonnull
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(@Nonnull EntityDoppleganger par1Entity) {
|
||||
return DefaultPlayerSkin.getDefaultSkinLegacy();
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
if(!(mc.getRenderViewEntity() instanceof EntityPlayer))
|
||||
return DefaultPlayerSkin.getDefaultSkinLegacy();
|
||||
|
||||
EntityPlayer view = (EntityPlayer) mc.getRenderViewEntity();
|
||||
|
||||
// Adapated from TileEntitySkullRenderer.renderTileEntityAt
|
||||
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = mc.getSkinManager().loadSkinFromCache(view.getGameProfile());
|
||||
|
||||
if (map.containsKey(MinecraftProfileTexture.Type.SKIN))
|
||||
{
|
||||
return mc.getSkinManager().loadSkin(map.get(MinecraftProfileTexture.Type.SKIN), MinecraftProfileTexture.Type.SKIN);
|
||||
}
|
||||
else
|
||||
{
|
||||
UUID uuid = EntityPlayer.getUUID(view.getGameProfile());
|
||||
return DefaultPlayerSkin.getDefaultSkin(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ package vazkii.botania.client.render.entity;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.common.entity.EntityManaStorm;
|
||||
@@ -39,8 +40,8 @@ public class RenderManaStorm extends Render<EntityManaStorm> {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(@Nonnull EntityManaStorm p_110775_1_) {
|
||||
return null;
|
||||
protected ResourceLocation getEntityTexture(@Nonnull EntityManaStorm entity) {
|
||||
return TextureMap.LOCATION_BLOCKS_TEXTURE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,13 +22,13 @@ public class RenderPinkWither extends RenderWither {
|
||||
|
||||
private static final ResourceLocation resource = new ResourceLocation(LibResources.MODEL_PINK_WITHER);
|
||||
|
||||
public RenderPinkWither(RenderManager p_i46130_1_) {
|
||||
super(p_i46130_1_);
|
||||
public RenderPinkWither(RenderManager manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityWither p_110775_1_) {
|
||||
protected ResourceLocation getEntityTexture(EntityWither entity) {
|
||||
return resource;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@ import javax.annotation.Nonnull;
|
||||
|
||||
public class RenderPoolMinecart extends RenderMinecart<EntityPoolMinecart> {
|
||||
|
||||
public RenderPoolMinecart(RenderManager p_i46155_1_) {
|
||||
super(p_i46155_1_);
|
||||
public RenderPoolMinecart(RenderManager manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderCartContents(EntityPoolMinecart poolCart, float p_147910_2_, @Nonnull IBlockState state) {
|
||||
protected void renderCartContents(EntityPoolMinecart poolCart, float partialTicks, @Nonnull IBlockState state) {
|
||||
RenderTilePool.forceVariant = PoolVariant.DEFAULT;
|
||||
RenderTilePool.forceManaNumber = poolCart.getMana();
|
||||
TileEntityRendererDispatcher.instance.getSpecialRendererByClass(TilePool.class).renderTileEntityAt(null, poolCart.posX, poolCart.posY, poolCart.posZ, ClientTickHandler.partialTicks, -1);
|
||||
|
||||
@@ -29,8 +29,8 @@ import java.util.Random;
|
||||
|
||||
public abstract class RenderSparkBase<T extends Entity> extends Render<T> {
|
||||
|
||||
public RenderSparkBase(RenderManager p_i46185_1_) {
|
||||
super(p_i46185_1_);
|
||||
public RenderSparkBase(RenderManager manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,21 +84,17 @@ public abstract class RenderSparkBase<T extends Entity> extends Render<T> {
|
||||
return MiscellaneousIcons.INSTANCE.sparkWorldIcon;
|
||||
}
|
||||
|
||||
protected void colorSpinningIcon(T entity, float a) {
|
||||
// NO-OP
|
||||
}
|
||||
protected void colorSpinningIcon(T entity, float a) {}
|
||||
|
||||
protected TextureAtlasSprite getSpinningIcon(T entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void renderCallback(T entity, float pticks) {
|
||||
// NO-OP
|
||||
}
|
||||
protected void renderCallback(T entity, float pticks) {}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(@Nonnull Entity p_110775_1_) {
|
||||
protected ResourceLocation getEntityTexture(@Nonnull Entity entity) {
|
||||
return TextureMap.LOCATION_BLOCKS_TEXTURE;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,13 +31,13 @@ public class RenderThornChakram extends Render<EntityThornChakram> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(@Nonnull EntityThornChakram c, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) {
|
||||
public void doRender(@Nonnull EntityThornChakram c, double x, double y, double z, float entityYaw, float partialTicks) {
|
||||
boolean fire = c.isFire();
|
||||
TextureAtlasSprite iicon = null;//ModItems.thornChakram.getIconFromDamage(fire ? 1 : 0);
|
||||
|
||||
if(iicon != null) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
|
||||
GlStateManager.translate((float)x, (float)y, (float)z);
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.scale(0.5F, 0.5F, 0.5F);
|
||||
bindEntityTexture(c);
|
||||
|
||||
@@ -31,17 +31,17 @@ import javax.annotation.Nonnull;
|
||||
|
||||
public class RenderTileEnchanter extends TileEntitySpecialRenderer<TileEnchanter> {
|
||||
|
||||
EntityItem item;
|
||||
private EntityItem item;
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(@Nonnull TileEnchanter enchanter, double d0, double d1, double d2, float f, int digProgress) {
|
||||
float alphaMod = 0F;
|
||||
|
||||
if(enchanter.stage == 2)
|
||||
if(enchanter.stage == TileEnchanter.State.GATHER_MANA)
|
||||
alphaMod = Math.min(20, enchanter.stageTicks) / 20F;
|
||||
else if(enchanter.stage == 4)
|
||||
else if(enchanter.stage == TileEnchanter.State.RESET)
|
||||
alphaMod = (20 - enchanter.stageTicks) / 20F;
|
||||
else if(enchanter.stage > 2)
|
||||
else if(enchanter.stage == TileEnchanter.State.DO_ENCHANT)
|
||||
alphaMod = 1F;
|
||||
|
||||
if(enchanter.itemToEnchant != null) {
|
||||
@@ -85,7 +85,7 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer<TileEnchanter
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
|
||||
if(enchanter.stage == 3 || enchanter.stage == 4) {
|
||||
if(enchanter.stage == TileEnchanter.State.DO_ENCHANT || enchanter.stage == TileEnchanter.State.RESET) {
|
||||
int ticks = enchanter.stageTicks + enchanter.stage3EndTicks;
|
||||
int angle = ticks * 2;
|
||||
float yTranslation = Math.min(20, ticks) / 20F * 1.15F;
|
||||
@@ -108,7 +108,7 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer<TileEnchanter
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
public void renderIcon(int par1, int par2, TextureAtlasSprite par3Icon, int par4, int par5, int brightness) {
|
||||
private void renderIcon(int par1, int par2, TextureAtlasSprite par3Icon, int par4, int par5, int brightness) {
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
//tessellator.getBuffer().setBrightness(brightness);
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* This class was created by <Kihira>. 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 @ [? (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.render.tile;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.boss.EntityWither;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.monster.EntityZombie;
|
||||
import net.minecraft.entity.monster.SkeletonType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntitySkull;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.client.render.entity.RenderDoppleganger;
|
||||
import vazkii.botania.common.Botania;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class RenderTileGaiaHead extends TileEntitySkullRenderer {
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntitySkull skull, double x, double y, double z, float partialTicks, int digProgress) {
|
||||
ShaderHelper.useShader(ShaderHelper.doppleganger, RenderDoppleganger.defaultCallback);
|
||||
|
||||
// Null-safe copy of super
|
||||
this.renderSkull((float)x, (float)y, (float)z,
|
||||
skull == null ? EnumFacing.NORTH : EnumFacing.getFront(skull.getBlockMetadata() & 7),
|
||||
skull == null ? 0 : skull.getSkullRotation() * 360 / 16.0F,
|
||||
3, null, digProgress, partialTicks);
|
||||
|
||||
ShaderHelper.releaseShader();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRendererDispatcher(@Nonnull TileEntityRendererDispatcher dispatcher) {
|
||||
this.rendererDispatcher = dispatcher;
|
||||
// Do not set `instance` to us, interferes with vanilla skulls
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderSkull(float x, float y, float z, @Nonnull EnumFacing facing, float rotation, int skullType, @Nullable GameProfile profile, int destroyStage, float animateTicks) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
Entity view = mc.getRenderViewEntity();
|
||||
|
||||
profile = null;
|
||||
|
||||
if(view instanceof EntityPlayer) {
|
||||
skullType = 3;
|
||||
profile = ((EntityPlayer) mc.getRenderViewEntity()).getGameProfile();
|
||||
} else if (view instanceof EntitySkeleton) {
|
||||
skullType = 0;
|
||||
if (((EntitySkeleton) view).getSkeletonType() == SkeletonType.WITHER)
|
||||
skullType = 1;
|
||||
} else if(view instanceof EntityWither)
|
||||
skullType = 1;
|
||||
else if(view instanceof EntityZombie)
|
||||
skullType = 2;
|
||||
else if(view instanceof EntityCreeper)
|
||||
skullType = 4;
|
||||
else if(view instanceof EntityDragon)
|
||||
skullType = 5;
|
||||
|
||||
super.renderSkull(x, y, z, facing, rotation, skullType, profile, destroyStage, animateTicks);
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.mana.IPoolOverlayProvider;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
@@ -68,7 +69,7 @@ public class RenderTilePool extends TileEntitySpecialRenderer<TilePool> {
|
||||
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
|
||||
if(pool != null)
|
||||
time += new Random(pool.getPos().getX() ^ pool.getPos().getY() ^ pool.getPos().getZ()).nextInt(100000);
|
||||
color = Color.getHSBColor(time * 0.005F, 0.6F, 1F).hashCode();
|
||||
color = Color.HSBtoRGB(time * 0.005F, 0.6F, 1F);
|
||||
}
|
||||
|
||||
if (fab || forceManaNumber > -1) {
|
||||
|
||||
@@ -47,21 +47,18 @@ public class RenderTileRuneAltar extends TileEntitySpecialRenderer<TileRuneAltar
|
||||
|
||||
double time = ClientTickHandler.ticksInGame + partticks;
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
for(int i = 0; i < altar.getSizeInventory(); i++) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.scale(0.5F, 0.5F, 0.5F);
|
||||
GlStateManager.translate(1F, 2.5F, 1F);
|
||||
GlStateManager.translate(0.5F, 1.25F, 0.5F);
|
||||
GlStateManager.rotate(angles[i] + (float) time, 0F, 1F, 0F);
|
||||
GlStateManager.translate(2.25F, 0F, 0.5F);
|
||||
GlStateManager.translate(1.125F, 0F, 0.25F);
|
||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||
GlStateManager.translate(0D, 0.15 * Math.sin((time + i * 10) / 5D), 0F);
|
||||
GlStateManager.translate(0D, 0.075 * Math.sin((time + i * 10) / 5D), 0F);
|
||||
ItemStack stack = altar.getItemHandler().getStackInSlot(i);
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(stack != null) {
|
||||
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
|
||||
mc.getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.GROUND);
|
||||
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Kihira>. 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 @ [? (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.render.tile;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
|
||||
import net.minecraft.tileentity.TileEntitySkull;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.client.model.ModelSkullOverride;
|
||||
import vazkii.botania.client.render.entity.RenderDoppleganger;
|
||||
import vazkii.botania.common.block.tile.TileGaiaHead;
|
||||
|
||||
public class RenderTileSkullOverride extends TileEntitySkullRenderer {
|
||||
|
||||
public static final ModelSkullOverride modelSkull = new ModelSkullOverride();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntitySkull p_147500_1_, double p_147500_2_, double p_147500_4_, double p_147500_6_, float p_147500_8_, int digProgress) {
|
||||
if (p_147500_1_ != null) {
|
||||
render(p_147500_1_, (float) p_147500_2_, (float) p_147500_4_, (float) p_147500_6_, EnumFacing.getFront(p_147500_1_.getBlockMetadata() & 7), p_147500_1_.getSkullRotation() * 360 / 16.0F, p_147500_1_.getSkullType(), p_147500_1_.getPlayerProfile(), digProgress);
|
||||
} else {
|
||||
render(null, ((float) p_147500_2_), ((float) p_147500_4_), ((float) p_147500_6_), EnumFacing.NORTH, 0, 3, null, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void render(TileEntitySkull skull, float par1, float par2, float par3, EnumFacing par4, float par5, int par6, GameProfile gameProfile, int digProgress) {
|
||||
boolean gaia = skull == null || skull instanceof TileGaiaHead;
|
||||
if(gaia) {
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
ResourceLocation resourcelocation = minecraft.thePlayer.getLocationSkin();
|
||||
bindTexture(resourcelocation);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.disableCull();
|
||||
if (par4 != EnumFacing.UP) {
|
||||
switch (par4) {
|
||||
case NORTH:
|
||||
GlStateManager.translate(par1 + 0.5F, par2 + 0.25F, par3 + 0.74F);
|
||||
break;
|
||||
case SOUTH:
|
||||
GlStateManager.translate(par1 + 0.5F, par2 + 0.25F, par3 + 0.26F);
|
||||
par5 = 180.0F;
|
||||
break;
|
||||
case WEST:
|
||||
GlStateManager.translate(par1 + 0.74F, par2 + 0.25F, par3 + 0.5F);
|
||||
par5 = 270.0F;
|
||||
break;
|
||||
case EAST:
|
||||
default:
|
||||
GlStateManager.translate(par1 + 0.26F, par2 + 0.25F, par3 + 0.5F);
|
||||
par5 = 90.0F;
|
||||
}
|
||||
} else GlStateManager.translate(par1 + 0.5F, par2, par3 + 0.5F);
|
||||
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.scale(-1.0F, -1.0F, 1.0F);
|
||||
GlStateManager.enableAlpha();
|
||||
ShaderHelper.useShader(ShaderHelper.doppleganger, RenderDoppleganger.defaultCallback);
|
||||
|
||||
modelSkull.render(null, 0F, 0F, 0F, par5, 0F, 0.0625F);
|
||||
|
||||
ShaderHelper.releaseShader();
|
||||
GlStateManager.popMatrix();
|
||||
} else super.renderSkull(par1, par2, par3, par4, par5, par6, gameProfile, digProgress, 0);
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import vazkii.botania.common.world.WorldTypeSkyblock;
|
||||
public final class SkyblockRenderEvents {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRender(RenderWorldLastEvent event) {
|
||||
public static void onRender(RenderWorldLastEvent event) {
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
if(ConfigHandler.enableFancySkybox && world.provider.getDimension() == 0 && (ConfigHandler.enableFancySkyboxInNormalWorlds || WorldTypeSkyblock.isWorldSkyblock(Minecraft.getMinecraft().theWorld))) {
|
||||
if(!(world.provider.getSkyRenderer() instanceof SkyblockSkyRenderer))
|
||||
|
||||
Loaded 100 of 1201 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user