Compare commits

...
115 Commits
Author SHA1 Message Date
Vincent Lee 6b10ada28a Build 310 I need sleep 2016-06-17 00:21:01 -05:00
Vincent Lee f3a3e80334 Revert "Revert "Fix other mods crashing because of alternate implementations of metadata""
This reverts commit fc23dedd05.
2016-06-17 00:17:51 -05:00
Vincent Lee 5cdd2ee32f Revert "Cleaner solution"
This reverts commit a9cc76576a.
2016-06-17 00:17:48 -05:00
Vincent Lee a9cc76576a Cleaner solution 2016-06-17 00:03:35 -05:00
Vincent Lee fc23dedd05 Revert "Fix other mods crashing because of alternate implementations of metadata"
This reverts commit 25cd574662.
2016-06-17 00:03:04 -05:00
Vincent Lee 65bf209835 Merge branch 'MC19' of github.com:williewillus/Botania into MC19 2016-06-16 23:46:35 -05:00
Vincent Lee d2e84babb7 Fix flowers popping off on relay and mycelium 2016-06-16 23:44:44 -05:00
Vincent Lee 850ea37f4d Merge pull request #354 from yrsegal/patch-1
Fix other mods crashing because of alternate implementations of metadata
2016-06-16 23:32:23 -05:00
Vincent Lee 2d0af453b3 Tweak various model transforms. Closes #350: 2016-06-16 23:30:23 -05:00
Vincent Lee d5c9c7815e Clean up lightning code 2016-06-16 23:12:22 -05:00
Wire Segal 25cd574662 Fix other mods crashing because of alternate implementations of metadata
Closes #352
Closes #353
2016-06-16 23:57:43 -04:00
Vincent Lee 3cf1619b2e Build 309 2016-06-16 21:22:51 -05:00
Vincent Lee 73c06c10eb Fix server crash 2016-06-16 21:18:35 -05:00
Vincent Lee 1d5dfa149e TIL Collection.removeIf 2016-06-16 21:04:36 -05:00
Vincent Lee c1fff324d1 Remove extraneous debug print 2016-06-16 20:59:52 -05:00
Vincent Lee 95f1e768fe Update forge, fix mana blaster overrides 2016-06-16 20:40:11 -05:00
Vincent Lee ec9496b0e7 Remove some unused stuff 2016-06-16 19:48:14 -05:00
Vincent Lee 5f3951c7fa Fix solegnolia having lower range than advertised. Closes #346 2016-06-16 19:39:26 -05:00
Vincent Lee 47ac6fc65a Check for blocks with no item in overgrowth seed. Closes #347 2016-06-16 19:26:29 -05:00
Vincent Lee ae0894a8d0 Fix keybinding crash. Closes #344 2016-06-16 19:24:12 -05:00
Vincent Lee 96bf87333b Clean up lightning code, batch the render by 200's to not overflow the tess. Closes #342 2016-06-14 20:30:52 -05:00
Vincent Lee 9e09a3f42d Update forge and fix pylon transforms, closes #252 2016-06-12 13:19:31 -05:00
Vincent Lee bc0ca77960 Terra blade now respects 1.9 cooldown 2016-06-11 21:11:47 -05:00
Vincent Lee 8bca8bb5f6 Get rid of some of the many stupid parXX parameter names 2016-06-11 14:42:18 -05:00
Vincent Lee ece95aca1c Big parameter name cleanup, part 1 2016-06-11 14:28:22 -05:00
Vincent Lee c357ab68c3 Super minor optimization for object alloc 2016-06-11 13:58:05 -05:00
Vincent Lee cfc1ba8baf Gaia head can now be worn. Closes #305 2016-06-11 12:57:46 -05:00
Vincent Lee f56eca23fc Fix #330 2016-06-11 11:24:00 -05:00
Vincent Lee b7aab995db Merge pull request #337 from yrsegal/MC19
Fix all outstanding auxiliary renders.
2016-06-10 22:48:18 -05:00
yrsegal ec5fcef90c fix devil tail 2016-06-10 23:22:41 -04:00
yrsegal f4d7a80e49 Fix all cosmetic baubles and use NONE 2016-06-10 22:49:53 -04:00
Vincent Lee c289edd825 Serverside normal sparks 2016-06-10 20:31:34 -05:00
Vincent Lee 5ac09b830d Some net stuff for later 2016-06-10 19:52:05 -05:00
Vincent Lee 709fc130d5 Merge branch 'MC19' of github.com:williewillus/Botania into MC19 2016-06-10 19:31:29 -05:00
Vincent Lee 873aedf4e5 Fix #332 2016-06-10 19:31:11 -05:00
Vincent Lee 27410530d6 Tweak horn sidings 2016-06-10 19:18:28 -05:00
yrsegal 491452ac7b Fix all outstanding auxiliary renders.
close #49 until the next time renders break
2016-06-10 16:56:39 -04:00
Vincent Lee 4e905ede36 Merge pull request #336 from isambourgg/patch-1
Update fr_FR.lang
2016-06-10 14:46:44 -05:00
Vincent Lee 6afc33c57b Merge branch 'MC19' of github.com:williewillus/Botania into MC19 2016-06-09 20:50:15 -05:00
Vincent Lee 5f35b8aef0 Readd old overrides, not working because of forge bug 2016-06-09 20:49:49 -05:00
isambourgg 699ee5027a Update fr_FR.lang
Relecture et correction jusqu'à la Ligne 559.
2016-06-09 16:42:34 -04:00
Vincent Lee 7c32f5fbaf Merge pull request #331 from yrsegal/patch
Fix sneaking transforms being out of place for baubles
2016-06-08 18:08:35 -05:00
yrsegal 3c0fe199d5 Fix sneaking transforms being out of place for baubles 2016-06-08 17:02:41 -04:00
Vincent Lee c15f08b066 Remove unofficial port message from login nag 2016-06-07 20:18:05 -05:00
Vincent Lee c47de38ec9 Fix inventory transforms for floating flowers 2016-06-05 18:14:07 -05:00
Vincent Lee 9b3c1d721d Minor potion cleanup 2016-06-05 17:45:58 -05:00
Vincent Lee 5d19a0dd6c Workaround for armorstand helmets. Closes #23 2016-06-05 16:37:52 -05:00
Vincent Lee 89834b4053 Clean up some other models 2016-06-05 15:15:45 -05:00
Vincent Lee 85eef6c461 Steal the transforms from Psi :P 2016-06-05 15:11:17 -05:00
Vincent Lee 9897d3ed80 Merge branch 'newblaster' into MC19 2016-06-05 14:57:44 -05:00
Vincent Lee 02cfe14d94 Move bauble box to caps as well. Closes #297 2016-06-05 14:32:08 -05:00
Vincent Lee 4b4b9a308c Tweaks to previous commit 2016-06-04 23:14:33 -05:00
Vincent Lee 55df4f0619 Move flower pouch to caps 2016-06-04 22:59:53 -05:00
Vincent Lee c83578b920 Clean up basic section lexicon and some misc lang entries 2016-06-04 21:35:43 -05:00
Vincent Lee 39517588e7 Clean up some todos 2016-06-04 20:10:13 -05:00
Vincent Lee 14f0c43850 Fix armor material registration, buff terrasteel armor slightly 2016-06-04 20:00:10 -05:00
Vincent Lee 05c6a07bc2 Clean up logging and log spam. #cleanloginitiative 2016-06-04 19:01:34 -05:00
Vincent Lee d241f95bee Zap some duplicated code 2016-06-04 12:06:39 -05:00
Vincent Lee 49a6f00b41 Update Forge, some fluid cap stuff 2016-06-03 23:10:33 -05:00
Vincent Lee 14b2a35862 Clean up English present in es_ES, fr_FR. My pinkie hurts. 2016-06-03 20:41:32 -05:00
Vincent Lee 4aeed07f75 Clean up English present in nl_NL, pt_BR 2016-06-03 20:27:21 -05:00
Vincent Lee cdcfe75325 Clean up English present in es_AR, ru_RU 2016-06-03 20:20:51 -05:00
Vincent Lee 303e89f6c5 Clean up English present in ja_JP and ko_KR 2016-06-03 20:11:55 -05:00
Vincent Lee c9e501fd02 Clean up English present in zh_CN, zh_TW 2016-06-03 20:03:19 -05:00
Vincent Lee 3049ac9767 Clean up English present in de_DE 2016-06-03 19:52:54 -05:00
Vincent Lee 11c0e4b274 Add warning header to all lang files 2016-06-03 19:41:54 -05:00
Vincent Lee fab5fc0087 Remove ColoredLights integration 2016-06-03 19:28:15 -05:00
Vincent Lee a5df917d5a Update BM mod id 2016-06-03 18:56:06 -05:00
Vincent Lee c2931d1517 Merge branch 'MC19' of github.com:williewillus/Botania into MC19 2016-06-02 21:41:10 -05:00
Vincent Lee b71cb163a7 Fix fallback for contributors with flowers not in main botania. Closes #321 2016-06-02 21:40:36 -05:00
Vincent Lee ff69a2e458 Merge pull request #320 from yrsegal/MC19
Make the lexicon recipe mappings accept the wildcard value
2016-06-01 21:20:35 -05:00
Vincent Lee 4cfd420cc1 Let some technical blocks drop normal drop from weight lens 2016-06-01 21:09:33 -05:00
Vincent Lee 95bd4689d6 Fix halo crashing, also tweak visuals slightly. Closes #314 2016-06-01 20:39:49 -05:00
Vincent Lee d2aa4e0ebc Fix some missing glstatemanager substitutions. Fixes #307 2016-06-01 20:19:40 -05:00
yrsegal 1bff638075 Make the lexicon recipe mappings accept the wildcard value 2016-06-01 18:39:36 -04:00
Vincent Lee 78f296d0cf Merge branch 'MC19' of github.com:williewillus/Botania into MC19 2016-05-31 20:58:30 -05:00
Vincent Lee 6014df2b12 Fix a couple baubles 2016-05-31 20:57:45 -05:00
Vincent Lee 30c208aa55 Merge pull request #315 from howtonotwin/258-bhtalisman
Limit BH Talisman to world height. Fixes #258
2016-05-31 20:35:52 -05:00
Vincent Lee 96a2da61f5 Fix wrong import 2016-05-31 20:03:39 -05:00
Howtonotwin fd35d25423 Limit BH Talisman to world height. Fixes #258 2016-05-31 17:17:20 -04:00
Vincent Lee 2065f01b8d Fix pool crafting particles 2016-05-30 21:37:56 -05:00
Vincent Lee 6c52c4f5f9 Fix chakrams being weird. Closes #306 2016-05-30 17:14:06 -05:00
Vincent Lee 307068c9c4 Lower spawn fuzz to 0 in gog, fixes #287 2016-05-30 16:21:56 -05:00
Vincent Lee 688da731ab Spell cloth can no longer be enchanted at an anvil, closes #308 2016-05-30 12:57:21 -05:00
Vincent Lee ac003f1307 Gaia guardian now looks like whoever is viewing it. spooky. 2016-05-28 16:45:57 -05:00
Vincent Lee 3e0f5da01d Clean up gaia head renderer. Closes #303 2016-05-28 15:44:20 -05:00
Vincent Lee cc1b66f3cd Gradle script automatically updates update.json 2016-05-28 12:50:41 -05:00
Vincent Lee c08fa024a0 Add update.json not done yet, bump forge minimum req version 2016-05-28 11:46:06 -05:00
Vincent Lee 4f0d63f5a0 Build 308 2016-05-28 11:09:08 -05:00
Vincent Lee 8ef557e51b Remove loot debug -.- 2016-05-28 11:04:40 -05:00
Vincent Lee 974e8d0316 Build 307 2016-05-27 20:55:48 -05:00
Vincent Lee cf82603f04 Update bow methods. Closes #300 2016-05-27 20:26:54 -05:00
Vincent Lee 1d54442e01 Fix axe digging closes #301 2016-05-27 19:56:07 -05:00
Vincent Lee a07f7914ae Add chest textures, update Forge 2016-05-27 19:51:59 -05:00
Vincent Lee 51c7d310a7 Moar clenaup 2016-05-26 23:22:50 -05:00
Vincent Lee e3e6f8996f Cleanup 2016-05-26 23:08:53 -05:00
Vincent Lee 7f759c1b88 Fix ender air bottle being underpowered 2016-05-24 21:16:18 -05:00
Vincent Lee 57e1fd5b41 Merge branch 'master' of https://github.com/Vazkii/Botania into MC19 2016-05-22 13:20:39 -05:00
Vincent Lee 8b88289789 Fix issues associated with last commit 2016-05-22 13:19:11 -05:00
Vincent Lee ff2afbf037 Untested: replace most uses of common i18n with client one 2016-05-22 11:41:33 -05:00
Vincent Lee 41b3e6cd4f Use all bits for effect packet args. Closes #296 2016-05-21 23:40:10 -05:00
Vincent Lee 930703b5c1 Workaround for 'global' particles at small render distances. Close #15 (mostly) 2016-05-21 23:38:17 -05:00
Vincent Lee f52dca111f Flower bag plays sound and animation. Closes #295 2016-05-21 22:55:30 -05:00
Vincent Lee 9694664922 Fix mana cookie lasting too short (thanks wiresegal) 2016-05-21 22:13:52 -05:00
Vincent Lee e2e00f7ef1 Use chunk util method that exists instead of own thing 2016-05-21 12:13:37 -05:00
Vincent Lee c9de3bcc03 Mana pools now try catalyst recipes first before recipes without catalyst specified. Also make mana bar not render in spectator. Closes #291 2016-05-20 14:36:28 -05:00
Vincent Lee 995c19c04a Fix TE syncing on login, 2 minor optimizations 2016-05-19 14:07:52 -05:00
Vincent Lee 96983a1d6b Merge branch 'MC19' of github.com:williewillus/Botania into MC19 2016-05-19 10:03:48 -05:00
Vincent Lee 8f00e9bdd6 Build 306 2016-05-19 10:03:24 -05:00
Jonathan Smith 5495271fa2 Merge pull request #1849 from NatsuArashi/patch-3
Update zh_TW.lang
2016-05-18 10:49:15 +01:00
NatsuArashi 588a02f385 Update zh_TW.lang
*部分日本語使用原文
2016-05-18 17:39:27 +08:00
Vasco Lavos da11e497fc Update contributors.properties 2016-04-22 02:41:54 +01:00
Vincent Lee b7fead0e4d Initial stuff 2016-04-16 17:34:17 -05:00
Jonathan Smith 3fb76acf57 Merge pull request #1835 from elbo2525/master
Update ja_JP.lang
2016-04-07 09:42:02 +01:00
elbo2525 2471642df7 Update ja_JP.lang 2016-04-07 15:53:52 +09:00
429 changed files with 4956 additions and 10475 deletions

No files matched your search

+24 -8
View File
@@ -1,3 +1,6 @@
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
buildscript {
repositories {
mavenCentral()
@@ -75,6 +78,9 @@ compileJava {
targetCompatibility = 1.8
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
processResources {
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
@@ -112,8 +118,22 @@ task incrementBuildNumber(dependsOn: 'reobfJar') << {
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
// Add to version section
updateJson."${minecraft.version}"."${version}" = "See https://github.com/williewillus/Botania/releases/${version}"
// Update promos
updateJson.promos."${minecraft.version}-latest" = "${version}"
updateJson.promos."${minecraft.version}-recommended" = "${version}"
updateJsonFile.write(JsonOutput.prettyPrint(JsonOutput.toJson(updateJson)))
}
/* Unused - Forgecraft and web server stuff
// I have no idea what I'm doing
task wtfGradle2(type: Copy) {
from(jar.destinationDir)
@@ -151,9 +171,7 @@ task sort(type: Delete) {
delete "${config.dir_output}/${deobfJar.archiveName}", "${config.dir_output}/wtf"
}
/**
* This is the upload task from the build.xml
*/
// This is the upload task from the build.xml
task upload() << {
scp('/files') {
fileset(file: jar.archivePath)
@@ -169,9 +187,7 @@ task upload() << {
}
}
/**
* This is deply_web task
*/
// This is deploy_web task
task deployWeb << {
scp('/') {
fileset(dir: 'web') //everything from the web directory
@@ -199,6 +215,7 @@ def scp(String dir, Closure antFileset = {}) {
}
}
}
*/
def parseConfig(File config) {
config.withReader {
@@ -221,8 +238,7 @@ curseforge {
See https://github.com/williewillus/Botania/releases/tag/${version}
"""
releaseType = "beta"
addGameVersion '1.9'
addGameVersion 'Java 8'
addGameVersion '1.9.4'
relations {
requiredLibrary 'baubles'
}
+4 -4
View File
@@ -1,9 +1,9 @@
#
#Tue May 10 23:24:10 CDT 2016
#Fri Jun 17 00:20:23 CDT 2016
version=r1.8
dir_output=../Build Output/Botania/
dir_repo=./
forge_version=12.17.0.1965
mc_version=1.9.4
forge_version=12.17.0.1909-1.9.4
build_number=306
dir_repo=./
build_number=311
mod_name=Botania
+1
View File
@@ -56,3 +56,4 @@ loraanicus=10
samerater=8
coolcabbage16=13
eladkay=3
tobiasling=9
+2 -2
View File
@@ -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
@@ -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");
@@ -11,9 +11,7 @@
package vazkii.botania.api.boss;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.BossInfo;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.internal.ShaderCallback;
@@ -10,8 +10,8 @@
package vazkii.botania.api.corporea;
public class CorporeaRequest {
public Object matcher;
public boolean checkNBT;
public final Object matcher;
public final boolean checkNBT;
public int count;
public int foundItems = 0;
public int extractedItems = 0;
@@ -25,7 +25,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandlerModifiable;
import vazkii.botania.api.boss.IBotaniaBoss;
import vazkii.botania.api.corporea.IWrappedInventory;
import vazkii.botania.api.corporea.InvWithLocation;
import vazkii.botania.api.lexicon.LexiconPage;
@@ -26,7 +26,6 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandlerModifiable;
import vazkii.botania.api.boss.IBotaniaBoss;
import vazkii.botania.api.corporea.IWrappedInventory;
import vazkii.botania.api.corporea.InvWithLocation;
import vazkii.botania.api.lexicon.LexiconPage;
@@ -13,7 +13,6 @@ package vazkii.botania.api.internal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.server.management.PlayerChunkMapEntry;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -24,17 +23,17 @@ public final class VanillaPacketDispatcher {
public static void dispatchTEToNearbyPlayers(TileEntity tile) {
if(tile.getWorld() instanceof WorldServer) {
WorldServer ws = ((WorldServer) tile.getWorld());
PlayerChunkMapEntry chunk = ws.getPlayerChunkMap().getEntry(tile.getPos().getX() >> 4, tile.getPos().getZ() >> 4);
SPacketUpdateTileEntity packet = tile.getUpdatePacket();
if(chunk == null)
if(packet == null)
return;
for (EntityPlayer player : ws.playerEntities) {
EntityPlayerMP playerMP = ((EntityPlayerMP) player);
if (playerMP.getDistanceSq(tile.getPos()) < 64 * 64
&& chunk.containsPlayer(playerMP)) {
playerMP.connection.sendPacket(tile.getUpdatePacket());
&& ws.getPlayerChunkMap().isPlayerWatchingChunk(playerMP, tile.getPos().getX() >> 4, tile.getPos().getZ() >> 4)) {
playerMP.connection.sendPacket(packet);
}
}
@@ -13,6 +13,7 @@ package vazkii.botania.api.item;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
/**
* A Bauble Item that implements this will be have hooks to render something on
@@ -34,24 +35,67 @@ public interface IBaubleRender {
/**
* A few helper methods for the render.
*/
public static class Helper {
final class Helper {
/**
* Rotates the render for a bauble correctly if the player is sneaking.
* Use for renders under {@link RenderType#BODY}.
*/
public static void rotateIfSneaking(EntityPlayer player) {
if(player.isSneaking())
applySneakingRotation();
}
/**
* Rotates the render for a bauble correctly for a sneaking player.
* Use for renders under {@link RenderType#BODY}.
*/
public static void applySneakingRotation() {
GlStateManager.rotate(28.64789F, 1.0F, 0.0F, 0.0F);
GlStateManager.translate(0F, 0.2F, 0F);
GlStateManager.rotate(90F / (float) Math.PI, 1.0F, 0.0F, 0.0F);
}
/**
* Shifts the render for a bauble correctly to the head, including sneaking rotation.
* Use for renders under {@link RenderType#HEAD}.
*/
public static void translateToHeadLevel(EntityPlayer player) {
GlStateManager.translate(0, -player.getDefaultEyeHeight() + (player.isSneaking() ? 0.25 : 0), 0);
GlStateManager.translate(0, -player.getDefaultEyeHeight(), 0);
if (player.isSneaking())
GlStateManager.translate(0.25F * MathHelper.sin(player.rotationPitch * (float) Math.PI / 180), 0.25F * MathHelper.cos(player.rotationPitch * (float) Math.PI / 180), 0F);
}
/**
* Shifts the render for a bauble correctly to the face.
* Use for renders under {@link RenderType#HEAD}, and usually after calling {@link Helper#translateToHeadLevel(EntityPlayer)}.
*/
public static void translateToFace() {
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.translate(0f, -4.35f, -1.27f);
}
/**
* Scales down the render to a correct size.
* Use for any render.
*/
public static void defaultTransforms() {
GlStateManager.translate(0.0, 3.0, 1.0);
GlStateManager.scale(0.55, 0.55, 0.55);
}
/**
* Shifts the render for a bauble correctly to the chest.
* Use for renders under {@link RenderType#BODY}, and usually after calling {@link Helper#rotateIfSneaking(EntityPlayer)}.
*/
public static void translateToChest() {
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.translate(0F, -3.2F, -0.85F);
}
}
public static enum RenderType {
enum RenderType {
/**
* Render Type for the player's body, translations apply on the player's rotation.
* Sneaking is not handled and should be done during the render.
@@ -61,7 +105,7 @@ public interface IBaubleRender {
/**
* Render Type for the player's body, translations apply on the player's head rotations.
* Sneaking is not handled and should be done during the render.~
* Sneaking is not handled and should be done during the render.
* @see IBaubleRender.Helper
*/
HEAD;
@@ -23,7 +23,7 @@ public interface IFloatingFlower {
public void setIslandType(IslandType type);
public class IslandType {
private static HashMap<String, IslandType> registry = new HashMap<>();
private static final HashMap<String, IslandType> registry = new HashMap<>();
public static final IslandType GRASS = new IslandType("GRASS");
public static final IslandType PODZOL = new IslandType("PODZOL");
@@ -22,7 +22,7 @@ public interface IManaDissolvable {
/**
* Called for every tick the item is on a mana pool. If the stack has stack
* size 0 the item is killed. This is called in both the server and client.
* size 0 the item is killed. This is called serverside.
*/
public void onDissolveTick(IManaPool pool, ItemStack stack, EntityItem item);
@@ -28,11 +28,11 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
private KnowledgeType type = BotaniaAPI.basicKnowledge;
public List<LexiconPage> pages = new ArrayList<>();
public final List<LexiconPage> pages = new ArrayList<>();
private boolean priority = false;
private ItemStack icon = null;
private List<ItemStack> extraDisplayedRecipes = new ArrayList<>();
private final List<ItemStack> extraDisplayedRecipes = new ArrayList<>();
/**
* @param unlocalizedName The unlocalized name of this entry. This will be localized by the client display.
@@ -11,6 +11,7 @@
package vazkii.botania.api.lexicon;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import vazkii.botania.api.mana.IManaItem;
import java.util.HashMap;
@@ -23,7 +24,7 @@ import java.util.Map;
*/
public final class LexiconRecipeMappings {
private static Map<String, EntryData> mappings = new HashMap<>();
private static final Map<String, EntryData> mappings = new HashMap<>();
/**
* Maps the given stack to the given page of the entry.
@@ -47,21 +48,28 @@ public final class LexiconRecipeMappings {
}
public static EntryData getDataForStack(ItemStack stack) {
String wildKey = stackToString(stack, true);
if (mappings.containsKey(wildKey))
return mappings.get(wildKey);
return mappings.get(stackToString(stack));
}
public static String stackToString(ItemStack stack) {
return stackToString(stack, false);
}
public static String stackToString(ItemStack stack, boolean forceIgnore) {
if(stack == null || stack.getItem() == null)
return "NULL";
if(stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider)
return ((IRecipeKeyProvider) stack.getItem()).getKey(stack);
return stack.getUnlocalizedName() + (ignoreMeta(stack) ? "" : "~" + stack.getItemDamage());
return stack.getUnlocalizedName() + (forceIgnore || ignoreMeta(stack) ? "" : "~" + stack.getItemDamage());
}
public static boolean ignoreMeta(ItemStack stack) {
return stack.isItemStackDamageable() || stack.getItem() instanceof IManaItem;
return stack.isItemStackDamageable() || stack.getItem() instanceof IManaItem || stack.getItemDamage() == OreDictionary.WILDCARD_VALUE;
}
public static class EntryData {
@@ -29,14 +29,14 @@ import java.util.Map;
*/
public class Multiblock {
public List<MultiblockComponent> components = new ArrayList<>();
public List<ItemStack> materials = new ArrayList<>();
public final List<MultiblockComponent> components = new ArrayList<>();
public final List<ItemStack> materials = new ArrayList<>();
public BlockPos minPos = BlockPos.ORIGIN;
public BlockPos maxPos = BlockPos.ORIGIN;
public BlockPos offPos = BlockPos.ORIGIN;
public HashMap<BlockPos, MultiblockComponent> locationCache = new HashMap<>();
public final HashMap<BlockPos, MultiblockComponent> locationCache = new HashMap<>();
/**
* Adds a multiblock component to this multiblock. The component's x y z
@@ -27,7 +27,7 @@ public class MultiblockComponent {
protected BlockPos relPos;
protected final IBlockState state;
protected final TileEntity tileEntity;
private boolean doFancyRender;
private final boolean doFancyRender;
public MultiblockComponent(BlockPos relPos, IBlockState state) {
this(relPos, state, null);
@@ -145,7 +145,7 @@ public final class ManaItemHandler {
if(stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canExportManaToItem(stack, stackInSlot))
continue;
int received = 0;
int received;
if(manaItemSlot.getMana(stackInSlot) + manaToSend <= manaItemSlot.getMaxMana(stackInSlot))
received = manaToSend;
else received = manaToSend - (manaItemSlot.getMana(stackInSlot) + manaToSend - manaItemSlot.getMaxMana(stackInSlot));
@@ -12,6 +12,7 @@ package vazkii.botania.api.subtile;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -19,7 +20,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.IManaNetwork;
import vazkii.botania.api.mana.IManaPool;
@@ -211,9 +213,10 @@ public class SubTileFunctional extends SubTileEntity {
return linkedPool != null && linkedPool.hasWorldObj() && !linkedPool.isInvalid() && supertile.getWorld().isBlockLoaded(linkedPool.getPos(), false) && supertile.getWorld().getTileEntity(linkedPool.getPos()) == linkedPool;
}
@SideOnly(Side.CLIENT)
@Override
public void renderHUD(Minecraft mc, ScaledResolution res) {
String name = I18n.translateToLocal("tile.botania:flower." + getUnlocalizedName() + ".name");
String name = I18n.format("tile.botania:flower." + getUnlocalizedName() + ".name");
int color = getColor();
BotaniaAPI.internalHandler.drawComplexManaHUD(color, knownMana, getMaxMana(), name, res, BotaniaAPI.internalHandler.getBindDisplayForFlowerType(this), isValidBinding());
}
@@ -14,6 +14,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@@ -23,8 +24,9 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.IManaNetwork;
import vazkii.botania.api.mana.IManaCollector;
@@ -302,9 +304,10 @@ public class SubTileGenerating extends SubTileEntity {
return linkedCollector != null && !linkedCollector.isInvalid() && supertile.getWorld().getTileEntity(linkedCollector.getPos()) == linkedCollector;
}
@SideOnly(Side.CLIENT)
@Override
public void renderHUD(Minecraft mc, ScaledResolution res) {
String name = I18n.translateToLocal("tile.botania:flower." + getUnlocalizedName() + ".name");
String name = I18n.format("tile.botania:flower." + getUnlocalizedName() + ".name");
int color = getColor();
BotaniaAPI.internalHandler.drawComplexManaHUD(color, knownMana, getMaxMana(), name, res, BotaniaAPI.internalHandler.getBindDisplayForFlowerType(this), isValidBinding());
}
@@ -17,7 +17,7 @@ public enum EnumChallengeLevel {
HARD("botania.challengelevel.hard"),
LUNATIC("botania.challengelevel.lunatic");
String name;
final String name;
private EnumChallengeLevel(String name) {
this.name = name;
@@ -38,7 +38,7 @@ import javax.annotation.Nonnull;
public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
@Override
public void doRenderLayer(@Nonnull EntityPlayer player, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
public void doRenderLayer(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if(!ConfigHandler.renderBaubles || player.getActivePotionEffect(MobEffects.INVISIBILITY) != null)
return;
@@ -25,7 +25,6 @@ import vazkii.botania.client.lib.LibResources;
import java.awt.*;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import java.util.WeakHashMap;
@@ -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
@@ -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;
@@ -67,7 +67,7 @@ public final class ClientMethodHandles {
// 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;
@@ -57,7 +56,6 @@ public class ClientTickHandler {
@SubscribeEvent
public 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;
@@ -41,7 +43,7 @@ public final class ColorHandler {
blocks.registerBlockColorHandler(
new IBlockColor() {
@Override
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess p_186720_2_, BlockPos pos, int tintIndex) {
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex) {
return state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
}
},
@@ -51,10 +53,10 @@ public final class ColorHandler {
blocks.registerBlockColorHandler(
new IBlockColor() {
@Override
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess p_186720_2_, BlockPos pos, int tintIndex) {
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess world, 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();
return MathHelper.hsvToRGB(time * 0.005F, 0.6F, 1F);
} else {
return state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
}
@@ -67,11 +69,11 @@ public final class ColorHandler {
blocks.registerBlockColorHandler(
new IBlockColor() {
@Override
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess p_186720_2_, BlockPos pos, int tintIndex) {
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess world, 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();
return MathHelper.hsvToRGB((time * 5) % 360 / 360F, 0.4F, 0.9F);
}
},
ModBlocks.spreader
@@ -81,13 +83,15 @@ public final class ColorHandler {
blocks.registerBlockColorHandler(
new IBlockColor() {
@Override
public int colorMultiplier(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex) {
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);
public int colorMultiplier(@Nonnull IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int 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 0xFFFFFF;
}
@@ -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,10 @@ 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)
if(BotaniaAPIClient.getRegisteredSubtileItemModels().containsKey(value))
flowerMap.put(key, ItemBlockSpecialFlower.ofType(value));
else
flowerMap.put(key, new ItemStack(Blocks.RED_FLOWER));
}
}
}
@@ -205,7 +208,7 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
load(props);
}
} catch (IOException e) {
FMLLog.info("[Botania] Could not load contributors list. Either you're offline or github is down. Nothing to worry about, carry on~");
Botania.LOGGER.info("Could not load contributors list. Either you're offline or github is down. Nothing to worry about, carry on~");
}
VersionChecker.doneChecking = true;
}
@@ -40,7 +40,7 @@ public class CorporeaAutoCompleteHandler {
private List<CompletionData> completions = new ArrayList<>();
private int position;
static TreeSet<String> itemNames = new TreeSet<>(String::compareToIgnoreCase);
static final TreeSet<String> itemNames = new TreeSet<>(String::compareToIgnoreCase);
private boolean tabLastTick = false;
@@ -165,8 +165,8 @@ public class CorporeaAutoCompleteHandler {
private static class CompletionData implements Comparable<CompletionData> {
private String string;
private int prefixLength;
private final String string;
private final int prefixLength;
public CompletionData(String string, int prefixLength) {
this.string = string;
@@ -21,6 +21,7 @@ import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
@@ -30,14 +31,12 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.ILexicon;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
@@ -137,15 +136,19 @@ public final class HUDHandler {
if(MultiblockRenderHandler.currentMultiblock != null && MultiblockRenderHandler.anchor == null) {
profiler.startSection("multiblockRightClick");
String s = I18n.translateToLocal("botaniamisc.rightClickToAnchor");
String s = I18n.format("botaniamisc.rightClickToAnchor");
mc.fontRendererObj.drawStringWithShadow(s, event.getResolution().getScaledWidth() / 2 - mc.fontRendererObj.getStringWidth(s) / 2, event.getResolution().getScaledHeight() / 2 - 30, 0xFFFFFF);
profiler.endSection();
}
if(main != null && main.getItem() instanceof ItemCraftingHalo) {
profiler.startSection("craftingHalo");
profiler.startSection("craftingHalo_main");
ItemCraftingHalo.renderHUD(event.getResolution(), mc.thePlayer, main);
profiler.endSection();
} else if(offhand != null && offhand.getItem() instanceof ItemCraftingHalo) {
profiler.startSection("craftingHalo_off");
ItemCraftingHalo.renderHUD(event.getResolution(), mc.thePlayer, offhand);
profiler.endSection();
}
if(main != null && main.getItem() instanceof ItemSextant) {
@@ -167,44 +170,47 @@ public final class HUDHandler {
}
profiler.startSection("manaBar");
EntityPlayer player = mc.thePlayer;
int totalMana = 0;
int totalMaxMana = 0;
boolean anyRequest = false;
boolean creative = false;
if(!player.isSpectator()) {
int totalMana = 0;
int totalMaxMana = 0;
boolean anyRequest = false;
boolean creative = false;
IInventory mainInv = player.inventory;
IInventory baublesInv = PlayerHandler.getPlayerBaubles(player);
IInventory mainInv = player.inventory;
IInventory baublesInv = PlayerHandler.getPlayerBaubles(player);
int invSize = mainInv.getSizeInventory();
int size = invSize;
if(baublesInv != null)
size += baublesInv.getSizeInventory();
int invSize = mainInv.getSizeInventory();
int size = invSize;
if(baublesInv != null)
size += baublesInv.getSizeInventory();
for(int i = 0; i < size; i++) {
boolean useBaubles = i >= invSize;
IInventory inv = useBaubles ? baublesInv : mainInv;
ItemStack stack = inv.getStackInSlot(i - (useBaubles ? invSize : 0));
for(int i = 0; i < size; i++) {
boolean useBaubles = i >= invSize;
IInventory inv = useBaubles ? baublesInv : mainInv;
ItemStack stack = inv.getStackInSlot(i - (useBaubles ? invSize : 0));
if(stack != null) {
Item item = stack.getItem();
if(item instanceof IManaUsingItem)
anyRequest = anyRequest || ((IManaUsingItem) item).usesMana(stack);
if(stack != null) {
Item item = stack.getItem();
if(item instanceof IManaUsingItem)
anyRequest = anyRequest || ((IManaUsingItem) item).usesMana(stack);
if(item instanceof IManaItem) {
if(!((IManaItem) item).isNoExport(stack)) {
totalMana += ((IManaItem) item).getMana(stack);
totalMaxMana += ((IManaItem) item).getMaxMana(stack);
if(item instanceof IManaItem) {
if(!((IManaItem) item).isNoExport(stack)) {
totalMana += ((IManaItem) item).getMana(stack);
totalMaxMana += ((IManaItem) item).getMaxMana(stack);
}
}
if(item instanceof ICreativeManaProvider && ((ICreativeManaProvider) item).isCreative(stack))
creative = true;
}
if(item instanceof ICreativeManaProvider && ((ICreativeManaProvider) item).isCreative(stack))
creative = true;
}
}
if(anyRequest)
renderManaInvBar(event.getResolution(), creative, totalMana, totalMaxMana);
if(anyRequest)
renderManaInvBar(event.getResolution(), creative, totalMana, totalMaxMana);
}
profiler.endStartSection("itemsRemaining");
ItemsRemainingRenderHandler.render(event.getResolution(), event.getPartialTicks());
@@ -225,7 +231,7 @@ public final class HUDHandler {
if(ticks > 0) {
int alpha = Math.min(255, (int) (ticks * 256.0F / 10.0F));
int color = 0x00CC00 + (alpha << 24);
String disp = I18n.translateToLocal(ItemTwigWand.getModeString(stack));
String disp = I18n.format(ItemTwigWand.getModeString(stack));
int x = res.getScaledWidth() / 2 - mc.fontRendererObj.getStringWidth(disp) / 2;
int y = res.getScaledHeight() - 70;
@@ -272,36 +278,29 @@ public final class HUDHandler {
Profiler profiler = mc.mcProfiler;
profiler.startSection("poolRecipe");
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
if(recipe.matches(stack)) {
if(recipe.getCatalyst() == null || recipe.getCatalyst() == tile.getWorld().getBlockState(tile.getPos().down())) {
int x = res.getScaledWidth() / 2 - 11;
int y = res.getScaledHeight() / 2 + 10;
RecipeManaInfusion recipe = TilePool.getMatchingRecipe(stack, tile.getWorld().getBlockState(tile.getPos().down()));
if(recipe != null) {
int x = res.getScaledWidth() / 2 - 11;
int y = res.getScaledHeight() / 2 + 10;
int u = tile.getCurrentMana() >= recipe.getManaToConsume() ? 0 : 22;
int v = mc.thePlayer.getName().equals("haighyorkie") && mc.thePlayer.isSneaking() ? 23 : 8;
int u = tile.getCurrentMana() >= recipe.getManaToConsume() ? 0 : 22;
int v = mc.thePlayer.getName().equals("haighyorkie") && mc.thePlayer.isSneaking() ? 23 : 8;
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
mc.renderEngine.bindTexture(manaBar);
RenderHelper.drawTexturedModalRect(x, y, 0, u, v, 22, 15);
GlStateManager.color(1F, 1F, 1F, 1F);
mc.renderEngine.bindTexture(manaBar);
RenderHelper.drawTexturedModalRect(x, y, 0, u, v, 22, 15);
GlStateManager.color(1F, 1F, 1F, 1F);
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
mc.getRenderItem().renderItemAndEffectIntoGUI(stack, x - 20, y);
mc.getRenderItem().renderItemAndEffectIntoGUI(recipe.getOutput(), x + 26, y);
mc.getRenderItem().renderItemOverlayIntoGUI(mc.fontRendererObj, recipe.getOutput(), x + 26, y, "");
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
mc.getRenderItem().renderItemAndEffectIntoGUI(stack, x - 20, y);
mc.getRenderItem().renderItemAndEffectIntoGUI(recipe.getOutput(), x + 26, y);
mc.getRenderItem().renderItemOverlayIntoGUI(mc.fontRendererObj, recipe.getOutput(), x + 26, y, "");
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
GlStateManager.disableLighting();
GlStateManager.disableBlend();
break;
}
}
GlStateManager.disableLighting();
GlStateManager.disableBlend();
}
profiler.endSection();
}
@@ -354,8 +353,8 @@ public final class HUDHandler {
if(!((ILexicon) stack.getItem()).isKnowledgeUnlocked(stack, entry.getKnowledgeType()))
font = mc.standardGalacticFontRenderer;
drawStr = I18n.translateToLocal(entry.getUnlocalizedName());
secondLine = TextFormatting.ITALIC + I18n.translateToLocal(entry.getTagline());
drawStr = I18n.format(entry.getUnlocalizedName());
secondLine = TextFormatting.ITALIC + I18n.format(entry.getTagline());
draw = true;
}
}
@@ -401,9 +400,9 @@ public final class HUDHandler {
private void renderNearIndexDisplay(ScaledResolution res) {
Minecraft mc = Minecraft.getMinecraft();
String txt0 = I18n.translateToLocal("botaniamisc.nearIndex0");
String txt1 = TextFormatting.GRAY + I18n.translateToLocal("botaniamisc.nearIndex1");
String txt2 = TextFormatting.GRAY + I18n.translateToLocal("botaniamisc.nearIndex2");
String txt0 = I18n.format("botaniamisc.nearIndex0");
String txt1 = TextFormatting.GRAY + I18n.format("botaniamisc.nearIndex1");
String txt2 = TextFormatting.GRAY + I18n.format("botaniamisc.nearIndex2");
int l = Math.max(mc.fontRendererObj.getStringWidth(txt0), Math.max(mc.fontRendererObj.getStringWidth(txt1), mc.fontRendererObj.getStringWidth(txt2))) + 20;
int x = res.getScaledWidth() - l - 20;
@@ -436,7 +435,7 @@ public final class HUDHandler {
renderManaBar(x, y, color, mana < 0 ? 0.5F : 1F, mana, maxMana);
if(mana < 0) {
String text = I18n.translateToLocal("botaniamisc.statusUnknown");
String text = I18n.format("botaniamisc.statusUnknown");
x = res.getScaledWidth() / 2 - mc.fontRendererObj.getStringWidth(text) / 2;
y -= 1;
mc.fontRendererObj.drawString(text, x, y, color);
@@ -25,8 +25,8 @@ import java.util.regex.Pattern;
public final class ItemsRemainingRenderHandler {
private static int maxTicks = 30;
private static int leaveTicks = 20;
private static final int maxTicks = 30;
private static final int leaveTicks = 20;
private static ItemStack stack;
private static int ticks, count;
@@ -10,48 +10,30 @@
*/
package vazkii.botania.client.core.handler;
import gnu.trove.map.hash.TIntIntHashMap;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.core.handler.LightningHandler.LightningBolt.Segment;
import vazkii.botania.client.fx.FXLightning;
import vazkii.botania.client.fx.ParticleRenderDispatcher;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.core.helper.Vector3;
import java.awt.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Random;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.ArrayDeque;
import java.util.Deque;
public class LightningHandler {
private 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) {
@@ -83,17 +65,35 @@ public class LightningHandler {
ParticleRenderDispatcher.lightningCount = 0;
render.bindTexture(outsideResource);
int counter = 0;
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
for(LightningBolt bolt : LightningBolt.boltlist)
renderBolt(bolt, tessellator, frame, ActiveRenderInfo.getRotationX(), ActiveRenderInfo.getRotationXZ(), ActiveRenderInfo.getRotationZ(), ActiveRenderInfo.getRotationXY(), 0, false);
for (FXLightning bolt : queuedLightningBolts) {
bolt.renderBolt(0, false);
if(counter % BATCH_THRESHOLD == BATCH_THRESHOLD - 1) {
tessellator.draw();
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
}
counter++;
}
tessellator.draw();
render.bindTexture(insideResource);
counter = 0;
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
for(LightningBolt bolt : LightningBolt.boltlist)
renderBolt(bolt, tessellator, frame, ActiveRenderInfo.getRotationX(), ActiveRenderInfo.getRotationXZ(), ActiveRenderInfo.getRotationZ(), ActiveRenderInfo.getRotationXY(), 1, true);
for (FXLightning bolt : queuedLightningBolts) {
bolt.renderBolt(1, true);
if(counter % BATCH_THRESHOLD == BATCH_THRESHOLD - 1) {
tessellator.draw();
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
}
counter++;
}
tessellator.draw();
queuedLightningBolts.clear();
GlStateManager.disableBlend();
GlStateManager.depthMask(true);
@@ -104,386 +104,4 @@ public class LightningHandler {
profiler.endSection();
}
public static void spawnLightningBolt(World world, Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
LightningBolt bolt = new LightningBolt(world, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner);
bolt.defaultFractal();
bolt.finalizeBolt();
LightningBolt.boltlist.add(bolt);
}
private void renderBolt(LightningBolt bolt, Tessellator tessellator, float partialframe, float cosyaw, float cospitch, float sinyaw, float cossinpitch, int pass, boolean inner) {
ParticleRenderDispatcher.lightningCount++;
float boltage = bolt.particleAge < 0 ? 0 : (float) bolt.particleAge / (float) bolt.particleMaxAge;
float mainalpha = 1;
if(pass == 0)
mainalpha = (1 - boltage) * 0.4F;
else mainalpha = 1 - boltage * 0.5F;
int expandTime = (int) (bolt.length * bolt.speed);
int renderstart = (int) ((expandTime / 2 - bolt.particleMaxAge + bolt.particleAge) / (float) (expandTime / 2) * bolt.numsegments0);
int renderend = (int) ((bolt.particleAge + expandTime) / (float) expandTime * bolt.numsegments0);
for(Segment rendersegment : bolt.segments) {
if(rendersegment.segmentno < renderstart || rendersegment.segmentno > renderend)
continue;
Vector3 playervec = getRelativeViewVector(rendersegment.startpoint.point).multiply(-1);
double width = 0.025F * (playervec.mag() / 5 + 1) * (1 + rendersegment.light) * 0.5F;
Vector3 diff1 = playervec.copy().crossProduct(rendersegment.prevdiff).normalize().multiply(width / rendersegment.sinprev);
Vector3 diff2 = playervec.copy().crossProduct(rendersegment.nextdiff).normalize().multiply(width / rendersegment.sinnext);
Vector3 startvec = rendersegment.startpoint.point;
Vector3 endvec = rendersegment.endpoint.point;
int color = inner ? bolt.colorInner : bolt.colorOuter;
int r = (color & 0xFF0000) >> 16;
int g = (color & 0xFF00) >> 8;
int b = (color & 0xFF);
int a = (int) (mainalpha * rendersegment.light * new Color(color).getAlpha());
tessellator.getBuffer().pos(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(startvec.x + diff1.x, startvec.y + diff1.y, startvec.z + diff1.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
if(rendersegment.next == null) {
Vector3 roundend = rendersegment.endpoint.point.copy().add(rendersegment.diff.copy().normalize().multiply(width));
tessellator.getBuffer().pos(roundend.x - diff2.x, roundend.y - diff2.y, roundend.z - diff2.z).tex(0, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(roundend.x + diff2.x, roundend.y + diff2.y, roundend.z + diff2.z).tex(0, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
}
if(rendersegment.prev == null) {
Vector3 roundend = rendersegment.startpoint.point.copy().subtract(rendersegment.diff.copy().normalize().multiply(width));
tessellator.getBuffer().pos(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(roundend.x - diff1.x, roundend.y - diff1.y, roundend.z - diff1.z).tex(0, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(roundend.x + diff1.x, roundend.y + diff1.y, roundend.z + diff1.z).tex(0, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(startvec.x + diff1.x, startvec.y + diff1.y, startvec.z + diff1.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
}
}
}
public static class LightningBolt {
public ArrayList<Segment> segments = new ArrayList<>();
public Vector3 start;
public Vector3 end;
BlockPos target;
TIntIntHashMap splitparents = new TIntIntHashMap();
public double length;
public int numsegments0;
private int numsplits;
private boolean finalized;
private Random rand;
public long seed;
public int particleAge;
public int particleMaxAge;
public boolean isDead;
private AxisAlignedBB boundingBox;
private World world;
private Entity source;
public static final ConcurrentLinkedQueue<LightningBolt> boltlist = new ConcurrentLinkedQueue<>();
public float speed = 1.5F;
public static final int fadetime = 20;
public static int playerdamage = 1;
public static int entitydamage = 1;
public int colorOuter;
public int colorInner;
public static class BoltPoint {
public BoltPoint(Vector3 basepoint, Vector3 offsetvec) {
point = basepoint.copy().add(offsetvec);
this.basepoint = basepoint;
this.offsetvec = offsetvec;
}
public Vector3 point;
Vector3 basepoint;
Vector3 offsetvec;
}
private static final Comparator<Segment> SEGMENT_SORTER = (o1, o2) -> {
int comp = Integer.valueOf(o1.splitno).compareTo(o2.splitno);
if(comp == 0)
return Integer.valueOf(o1.segmentno).compareTo(o2.segmentno);
else return comp;
};
private static final Comparator<Segment> SEGMENT_LIGHT_SORTER = (o1, o2) -> Float.compare(o2.light, o1.light);
public class Segment {
public Segment(BoltPoint start, BoltPoint end, float light, int segmentnumber, int splitnumber) {
startpoint = start;
endpoint = end;
this.light = light;
segmentno = segmentnumber;
splitno = splitnumber;
calcDiff();
}
public Segment(Vector3 start, Vector3 end) {
this(new BoltPoint(start, new Vector3(0, 0, 0)), new BoltPoint(end, new Vector3(0, 0, 0)), 1, 0, 0);
}
public void calcDiff() {
diff = endpoint.point.copy().subtract(startpoint.point);
}
public void calcEndDiffs() {
if(prev != null) {
Vector3 prevdiffnorm = prev.diff.copy().normalize();
Vector3 thisdiffnorm = diff.copy().normalize();
prevdiff = thisdiffnorm.copy().add(prevdiffnorm).normalize();
sinprev = (float) Math.sin(thisdiffnorm.angle(prevdiffnorm.multiply(-1)) / 2);
} else {
prevdiff = diff.copy().normalize();
sinprev = 1;
}
if(next != null) {
Vector3 nextdiffnorm = next.diff.copy().normalize();
Vector3 thisdiffnorm = diff.copy().normalize();
nextdiff = thisdiffnorm.add(nextdiffnorm).normalize();
sinnext = (float) Math.sin(thisdiffnorm.angle(nextdiffnorm.multiply(-1)) / 2);
} else {
nextdiff = diff.copy().normalize();
sinnext = 1;
}
}
@Override
public String toString() {
return startpoint.point.toString() + " " + endpoint.point.toString();
}
public BoltPoint startpoint;
public BoltPoint endpoint;
public Vector3 diff;
public Segment prev;
public Segment next;
public Vector3 nextdiff;
public Vector3 prevdiff;
public float sinprev;
public float sinnext;
public float light;
public int segmentno;
public int splitno;
}
public LightningBolt(World world, Vector3 sourcevec, Vector3 targetvec, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
this.world = world;
this.seed = seed;
rand = new Random(seed);
start = sourcevec;
end = targetvec;
speed = ticksPerMeter;
this.colorOuter = colorOuter;
this.colorInner = colorInner;
numsegments0 = 1;
length = end.copy().subtract(start).mag();
particleMaxAge = fadetime + rand.nextInt(fadetime) - fadetime / 2;
particleAge = -(int) (length * speed);
boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
boundingBox = new AxisAlignedBB(Math.min(start.x, end.x), Math.min(start.y, end.y), Math.min(start.z, end.z), Math.max(start.x, end.x), Math.max(start.y, end.y), Math.max(start.z, end.z)).expand(length / 2, length / 2, length / 2);
segments.add(new Segment(start, end));
}
public static Vector3 getFocalPoint(TileEntity tile) {
return Vector3.fromTileEntityCenter(tile);
}
public LightningBolt(World world, Vector3 sourcevec, TileEntity target, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
this(world, sourcevec, getFocalPoint(target), ticksPerMeter, seed, colorOuter, colorInner);
this.target = target.getPos();
}
public void setWrapper(Entity entity) {
source = entity;
}
public void fractal(int splits, double amount, double splitchance, double splitlength, double splitangle) {
if(finalized)
return;
ArrayList<Segment> oldsegments = segments;
segments = new ArrayList<>();
Segment prev = null;
for(Segment segment : oldsegments) {
prev = segment.prev;
Vector3 subsegment = segment.diff.copy().multiply(1F / splits);
BoltPoint[] newpoints = new BoltPoint[splits + 1];
Vector3 startpoint = segment.startpoint.point;
newpoints[0] = segment.startpoint;
newpoints[splits] = segment.endpoint;
for(int i = 1; i < splits; i++) {
Vector3 randoff = segment.diff.copy().perpendicular().normalize().rotate(rand.nextFloat() * 360, segment.diff);
randoff.multiply((rand.nextFloat() - 0.5F) * amount * 2);
Vector3 basepoint = startpoint.copy().add(subsegment.copy().multiply(i));
newpoints[i] = new BoltPoint(basepoint, randoff);
}
for(int i = 0; i < splits; i++) {
Segment next = new Segment(newpoints[i], newpoints[i + 1], segment.light, segment.segmentno * splits + i, segment.splitno);
next.prev = prev;
if (prev != null)
prev.next = next;
if(i != 0 && rand.nextFloat() < splitchance) {
Vector3 splitrot = next.diff.copy().xCrossProduct().rotate(rand.nextFloat() * 360, next.diff);
Vector3 diff = next.diff.copy().rotate((rand.nextFloat() * 0.66F + 0.33F) * splitangle, splitrot).multiply(splitlength);
numsplits++;
splitparents.put(numsplits, next.splitno);
Segment split = new Segment(newpoints[i], new BoltPoint(newpoints[i + 1].basepoint, newpoints[i + 1].offsetvec.copy().add(diff)), segment.light / 2F, next.segmentno, numsplits);
split.prev = prev;
segments.add(split);
}
prev = next;
segments.add(next);
}
if(segment.next != null)
segment.next.prev = prev;
}
numsegments0 *= splits;
}
public void defaultFractal() {
fractal(2, length / 1.5, 0.7F, 0.7F, 45);
fractal(2, length / 4, 0.5F, 0.8F, 50);
fractal(2, length / 15, 0.5F, 0.9F, 55);
fractal(2, length / 30, 0.5F, 1.0F, 60);
fractal(2, length / 60, 0, 0, 0);
fractal(2, length / 100, 0, 0, 0);
fractal(2, length / 400, 0, 0, 0);
}
private float rayTraceResistance(Vector3 start, Vector3 end, float prevresistance) {
RayTraceResult mop = world.rayTraceBlocks(start.toVec3D(), end.toVec3D());
if(mop == null)
return prevresistance;
if(mop.typeOfHit == RayTraceResult.Type.BLOCK) {
Block block = world.getBlockState(mop.getBlockPos()).getBlock();
if(world.isAirBlock(mop.getBlockPos()))
return prevresistance;
return prevresistance + block.getExplosionResistance(source) + 0.3F;
} else return prevresistance;
}
private void calculateCollisionAndDiffs() {
TIntIntHashMap lastactivesegment = new TIntIntHashMap();
Collections.sort(segments, SEGMENT_SORTER);
int lastsplitcalc = 0;
int lastactiveseg = 0;// unterminated
float splitresistance = 0;
for(Segment segment : segments) {
if(segment.splitno > lastsplitcalc) {
lastactivesegment.put(lastsplitcalc, lastactiveseg);
lastsplitcalc = segment.splitno;
lastactiveseg = lastactivesegment.get(splitparents.get(segment.splitno));
splitresistance = lastactiveseg < segment.segmentno ? 50 : 0;
}
if(splitresistance >= 40 * segment.light)
continue;
splitresistance = rayTraceResistance(segment.startpoint.point, segment.endpoint.point, splitresistance);
lastactiveseg = segment.segmentno;
}
lastactivesegment.put(lastsplitcalc, lastactiveseg);
lastsplitcalc = 0;
lastactiveseg = lastactivesegment.get(0);
for(Iterator<Segment> iterator = segments.iterator(); iterator.hasNext();) {
Segment segment = iterator.next();
if(lastsplitcalc != segment.splitno) {
lastsplitcalc = segment.splitno;
lastactiveseg = lastactivesegment.get(segment.splitno);
}
if(segment.segmentno > lastactiveseg)
iterator.remove();
segment.calcEndDiffs();
}
}
public void finalizeBolt() {
if(finalized)
return;
finalized = true;
calculateCollisionAndDiffs();
Collections.sort(segments, SEGMENT_LIGHT_SORTER);
boltlist.add(this);
}
public void onUpdate() {
particleAge++;
if (particleAge >= particleMaxAge)
isDead = true;
}
// Called in ClientTickHandler
public static void update() {
for(Iterator<LightningBolt> iterator = boltlist.iterator(); iterator.hasNext();) {
LightningBolt bolt = iterator.next();
bolt.onUpdate();
if(bolt.isDead)
iterator.remove();
}
}
}
}
@@ -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;
@@ -63,7 +63,7 @@ public class MiscellaneousIcons {
public TextureAtlasSprite[] sparkUpgradeIcons;
public TextureAtlasSprite[] kingKeyWeaponIcons;
public Map<TriggerManaLevel.State, TextureAtlasSprite> manaLevelTriggerIcons = Maps.newEnumMap(TriggerManaLevel.State.class);
public final Map<TriggerManaLevel.State, TextureAtlasSprite> manaLevelTriggerIcons = Maps.newEnumMap(TriggerManaLevel.State.class);
public TextureAtlasSprite[] tiaraWingIcons;
// begin dank_memes
@@ -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");
}
}
@@ -16,11 +16,9 @@ import net.minecraft.block.BlockFlower;
import net.minecraft.block.BlockSkull;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.BlockWall;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraft.client.resources.IReloadableResourceManager;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -52,7 +50,6 @@ import vazkii.botania.api.state.enums.PrismarineVariant;
import vazkii.botania.api.state.enums.PylonVariant;
import vazkii.botania.api.state.enums.SpreaderVariant;
import vazkii.botania.api.state.enums.StorageVariant;
import vazkii.botania.client.model.FloatingFlowerModel;
import vazkii.botania.client.model.SpecialFlowerModel;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.ModFluffBlocks;
@@ -124,7 +121,6 @@ import static vazkii.botania.common.item.ModItems.*;
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));
@@ -528,7 +524,7 @@ public final class ModelHandler {
registerItemModel(ModBlocks.avatar);
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.avatar), 0, TileAvatar.class);
registerItemModel(ModBlocks.bellows); // todo await animation api
registerItemModel(ModBlocks.bellows);
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.bellows), 0, TileBellows.class);
registerItemModel(ModBlocks.brewery);
@@ -537,13 +533,13 @@ public final class ModelHandler {
registerItemModel(ModBlocks.corporeaCrystalCube);
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.corporeaCrystalCube), 0, TileCorporeaCrystalCube.class);
registerItemModel(ModBlocks.corporeaIndex); // todo json maybe? await animation api
registerItemModel(ModBlocks.corporeaIndex);
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?
registerItemModel(ModBlocks.hourglass);
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.hourglass), 0, TileHourglass.class);
registerItemModel(ModBlocks.teruTeruBozu);
@@ -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;
}
@@ -40,7 +40,7 @@ import vazkii.botania.common.block.ModBlocks;
public final class MultiblockRenderHandler {
private static MultiblockBlockAccess blockAccess = new MultiblockBlockAccess();
private static final MultiblockBlockAccess blockAccess = new MultiblockBlockAccess();
private static int dimension;
public static boolean rendering = false;
@@ -8,6 +8,7 @@ import net.minecraft.client.model.ModelBook;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -15,13 +16,12 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.client.event.RenderHandEvent;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.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,12 +30,12 @@ import vazkii.botania.common.item.ModItems;
// Hacky way to render 3D lexicon, will be reevaluated in the future.
public class RenderLexicon {
ModelBook model = new ModelBook();
ResourceLocation texture = new ResourceLocation(LibResources.MODEL_LEXICA);
final ModelBook model = new ModelBook();
final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_LEXICA);
@SubscribeEvent
public void renderItem(RenderHandEvent evt) {
Minecraft mc = Minecraft.getMinecraft();
Minecraft mc;
if(true || !ConfigHandler.lexicon3dModel || mc.gameSettings.thirdPersonView != 0 || !PlayerHelper.hasHeldItem(mc.thePlayer, ModItems.lexicon))
return;
evt.setCanceled(true);
@@ -95,8 +95,7 @@ public class RenderLexicon {
}
// End EntityRenderer.renderHand copy
} catch (Throwable throwable) {
FMLLog.warning("[Botania]: Failed to render lexicon");
throwable.printStackTrace();
Botania.LOGGER.warn("Failed to render lexicon");
}
}
@@ -127,8 +126,8 @@ public class RenderLexicon {
private void doRender() {
GlStateManager.pushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
float opening = 0F;
float pageFlip = 0F;
float opening;
float pageFlip;
float ticks = ClientTickHandler.ticksWithLexicaOpen;
if(ticks > 0 && ticks < 10) {
@@ -164,30 +163,30 @@ public class RenderLexicon {
if(stack != null)
title = stack.getDisplayName();
if(title.equals(origTitle) && bevo)
title = I18n.translateToLocal("item.botania:lexicon.bevo");
title = I18n.format("item.botania:lexicon.bevo");
if(title.equals(origTitle) && saice)
title = I18n.translateToLocal("item.botania:lexicon.saice");
title = I18n.format("item.botania:lexicon.saice");
font.drawString(font.trimStringToWidth(title, 80), 0, 0, 0xD69700);
GlStateManager.translate(0F, 10F, 0F);
GlStateManager.scale(0.6F, 0.6F, 0.6F);
font.drawString(TextFormatting.ITALIC + "" + TextFormatting.BOLD + String.format(I18n.translateToLocal("botaniamisc.edition"), ItemLexicon.getEdition()), 0, 0, 0xA07100);
font.drawString(TextFormatting.ITALIC + "" + TextFormatting.BOLD + I18n.format("botaniamisc.edition", ItemLexicon.getEdition()), 0, 0, 0xA07100);
GlStateManager.translate(0F, 15F, 0F);
font.drawString(I18n.translateToLocal("botaniamisc.lexiconcover0"), 0, 0, 0x79ff92);
font.drawString(I18n.format("botaniamisc.lexiconcover0"), 0, 0, 0x79ff92);
GlStateManager.translate(0F, 10F, 0F);
font.drawString(I18n.translateToLocal("botaniamisc.lexiconcover1"), 0, 0, 0x79ff92);
font.drawString(I18n.format("botaniamisc.lexiconcover1"), 0, 0, 0x79ff92);
GlStateManager.translate(0F, 50F, 0F);
font.drawString(I18n.translateToLocal("botaniamisc.lexiconcover2"), 0, 0, 0x79ff92);
font.drawString(I18n.format("botaniamisc.lexiconcover2"), 0, 0, 0x79ff92);
GlStateManager.translate(0F, 10F, 0F);
font.drawString(TextFormatting.UNDERLINE + "" + TextFormatting.ITALIC + I18n.translateToLocal("botaniamisc.lexiconcover3"), 0, 0, 0x79ff92);
font.drawString(TextFormatting.UNDERLINE + "" + TextFormatting.ITALIC + I18n.format("botaniamisc.lexiconcover3"), 0, 0, 0x79ff92);
if(bevo || saice) {
GlStateManager.translate(0F, 10F, 0F);
font.drawString(I18n.translateToLocal("botaniamisc.lexiconcover" + (bevo ? 4 : 5)), 0, 0, 0x79ff92);
font.drawString(I18n.format("botaniamisc.lexiconcover" + (bevo ? 4 : 5)), 0, 0, 0x79ff92);
}
}
@@ -17,11 +17,11 @@ 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.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -185,13 +185,13 @@ public final class TooltipAdditionDisplayHandler {
Gui.drawRect(mouseX + offx + i, mouseY - offy - height, mouseX + offx + i + 1, mouseY - offy, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
Gui.drawRect(mouseX + offx + rainbowWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, 0xFF555555);
String rank = I18n.translateToLocal("botania.rank" + level).replaceAll("&", "\u00a7");
String rank = I18n.format("botania.rank" + level).replaceAll("&", "\u00a7");
GL11.glPushAttrib(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_LIGHTING);
font.drawStringWithShadow(rank, mouseX + offx, mouseY - offy - 12, 0xFFFFFF);
if(!ss) {
rank = I18n.translateToLocal("botania.rank" + (level + 1)).replaceAll("&", "\u00a7");
rank = I18n.format("botania.rank" + (level + 1)).replaceAll("&", "\u00a7");
font.drawStringWithShadow(rank, mouseX + offx + width - font.getStringWidth(rank), mouseY - offy - 12, 0xFFFFFF);
}
@@ -10,9 +10,9 @@
*/
package vazkii.botania.client.core.handler;
import net.minecraft.client.resources.I18n;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@@ -25,15 +25,15 @@ public final class TooltipHandler {
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onTooltipEvent(ItemTooltipEvent event) {
if(event.getItemStack().getItem() == Item.getItemFromBlock(Blocks.DIRT) && event.getItemStack().getItemDamage() == 1) {
event.getToolTip().add(I18n.translateToLocal("botaniamisc.coarseDirt0"));
event.getToolTip().add(I18n.translateToLocal("botaniamisc.coarseDirt1"));
event.getToolTip().add(I18n.format("botaniamisc.coarseDirt0"));
event.getToolTip().add(I18n.format("botaniamisc.coarseDirt1"));
} else if(event.getItemStack().getItem() == Item.getItemFromBlock(Blocks.MOB_SPAWNER) && event.getEntityPlayer().capabilities.isCreativeMode)
event.getToolTip().add(I18n.translateToLocal("botaniamisc.spawnerTip"));
event.getToolTip().add(I18n.format("botaniamisc.spawnerTip"));
if(ItemNBTHelper.detectNBT(event.getItemStack()) && ItemNBTHelper.getBoolean(event.getItemStack(), ItemRegenIvy.TAG_REGEN, false))
event.getToolTip().add(I18n.translateToLocal("botaniamisc.hasIvy"));
event.getToolTip().add(I18n.format("botaniamisc.hasIvy"));
if(ItemNBTHelper.detectNBT(event.getItemStack()) && ItemNBTHelper.getBoolean(event.getItemStack(), ItemKeepIvy.TAG_KEEP, false))
event.getToolTip().add(I18n.translateToLocal("botaniamisc.hasKeepIvy"));
event.getToolTip().add(I18n.format("botaniamisc.hasKeepIvy"));
}
}
@@ -241,7 +241,7 @@ public final class RenderHelper {
KeyBinding[] keys = Minecraft.getMinecraft().gameSettings.keyBindings;
for(KeyBinding otherKey : keys)
if(otherKey.getKeyDescription().equals(keyName)) {
key = Keyboard.getKeyName(otherKey.getKeyCode());
key = otherKey.getDisplayName();
break;
}
@@ -11,8 +11,6 @@
package vazkii.botania.client.core.helper;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraftforge.fml.common.FMLLog;
import org.apache.logging.log4j.Level;
import org.lwjgl.opengl.ARBFragmentShader;
import org.lwjgl.opengl.ARBShaderObjects;
import org.lwjgl.opengl.ARBVertexShader;
@@ -20,6 +18,7 @@ import org.lwjgl.opengl.GL11;
import vazkii.botania.api.internal.ShaderCallback;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.handler.ConfigHandler;
import java.io.BufferedReader;
@@ -92,7 +91,7 @@ public final class ShaderHelper {
// http://lwjgl.org/wiki/index.php?title=GLSL_Shaders_with_LWJGL
private static int createProgram(String vert, String frag) {
int vertId = 0, fragId = 0, program = 0;
int vertId = 0, fragId = 0, program;
if(vert != null)
vertId = createShader(vert, VERT);
if(frag != null)
@@ -109,13 +108,13 @@ public final class ShaderHelper {
ARBShaderObjects.glLinkProgramARB(program);
if(ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE) {
FMLLog.log(Level.ERROR, getLogInfo(program));
Botania.LOGGER.error(getLogInfo(program));
return 0;
}
ARBShaderObjects.glValidateProgramARB(program);
if (ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE) {
FMLLog.log(Level.ERROR, getLogInfo(program));
Botania.LOGGER.error(getLogInfo(program));
return 0;
}
@@ -12,6 +12,7 @@ package vazkii.botania.client.core.proxy;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.renderer.entity.RenderPlayer;
@@ -30,7 +31,6 @@ 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 +63,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 +97,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 +105,7 @@ 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.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);
@@ -252,7 +259,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 +285,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
@@ -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
@@ -490,5 +499,15 @@ public class ClientProxy extends CommonProxy {
public void removeBoss(IBotaniaBoss boss) {
BossBarHandler.bosses.remove(boss);
}
@Override
public int getClientRenderDistance() {
return Minecraft.getMinecraft().gameSettings.renderDistanceChunks;
}
@Override
public ModelBiped getEmptyModelBiped() {
return EMPTY_MODEL;
}
}
@@ -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.copy().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.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 ? 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.copy().add(rendersegment.diff.copy().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.copy().subtract(rendersegment.diff.copy().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.copy().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.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 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.copy().xCrossProduct().rotate(rand.nextFloat() * 360, next.diff);
Vector3 diff = next.diff.copy().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.copy().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.copy().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.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();
}
}
@@ -18,9 +18,9 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import org.lwjgl.opengl.GL11;
@@ -36,8 +36,8 @@ public class FXSparkle extends Particle {
public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_PARTICLES);
private static Queue<FXSparkle> queuedRenders = new ArrayDeque<>();
private static Queue<FXSparkle> queuedCorruptRenders = new ArrayDeque<>();
private static final Queue<FXSparkle> queuedRenders = new ArrayDeque<>();
private static final Queue<FXSparkle> queuedCorruptRenders = new ArrayDeque<>();
// Queue values
private float f;
@@ -117,7 +117,7 @@ public class FXSparkle extends Particle {
}
@Override
public void renderParticle(VertexBuffer worldRendererIn, Entity p_180434_2_, float f, float f1, float f2, float f3, float f4, float f5) {
public void renderParticle(VertexBuffer worldRendererIn, Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
this.f = f;
this.f1 = f1;
this.f2 = f2;
@@ -142,7 +142,7 @@ public class FXSparkle extends Particle {
motionY -= 0.04D * particleGravity;
if (!noClip && !fake)
pushOutOfBlocks(posX, (getEntityBoundingBox().minY + getEntityBoundingBox().maxY) / 2.0D, posZ);
wiggleAround(posX, (getEntityBoundingBox().minY + getEntityBoundingBox().maxY) / 2.0D, posZ);
posX += motionX;
posY += motionY;
@@ -167,98 +167,83 @@ public class FXSparkle extends Particle {
particleGravity = value;
}
private boolean pushOutOfBlocks(double par1, double par3, double par5) {
int var7 = MathHelper.floor_double(par1);
int var8 = MathHelper.floor_double(par3);
int var9 = MathHelper.floor_double(par5);
double var10 = par1 - var7;
double var12 = par3 - var8;
double var14 = par5 - var9;
// Copy of Entity.pushOutOfBlocks with several important changes
private boolean wiggleAround(double x, double y, double z)
{
BlockPos blockpos = new BlockPos(x, y, z);
double d0 = x - (double)blockpos.getX();
double d1 = y - (double)blockpos.getY();
double d2 = z - (double)blockpos.getZ();
BlockPos bPos = new BlockPos(var7, var8, var9);
if (!worldObj.isAirBlock(bPos)) {
boolean var16 = !worldObj.isBlockNormalCube(bPos.west(), false);
boolean var17 = !worldObj.isBlockNormalCube(bPos.east(), false);
boolean var18 = !worldObj.isBlockNormalCube(bPos.down(), false);
boolean var19 = !worldObj.isBlockNormalCube(bPos.up(), false);
boolean var20 = !worldObj.isBlockNormalCube(bPos.north(), false);
boolean var21 = !worldObj.isBlockNormalCube(bPos.south(), false);
byte var22 = -1;
double var23 = 9999.0D;
// Botania - change collision box list check to !airblock check
if (!worldObj.isAirBlock(blockpos))
{
EnumFacing enumfacing = EnumFacing.UP;
double d3 = Double.MAX_VALUE;
if (var16 && var10 < var23) {
var23 = var10;
var22 = 0;
if (!this.worldObj.isBlockFullCube(blockpos.west()) && d0 < d3)
{
d3 = d0;
enumfacing = EnumFacing.WEST;
}
if (var17 && 1.0D - var10 < var23) {
var23 = 1.0D - var10;
var22 = 1;
if (!this.worldObj.isBlockFullCube(blockpos.east()) && 1.0D - d0 < d3)
{
d3 = 1.0D - d0;
enumfacing = EnumFacing.EAST;
}
if (var18 && var12 < var23) {
var23 = var12;
var22 = 2;
if (!this.worldObj.isBlockFullCube(blockpos.north()) && d2 < d3)
{
d3 = d2;
enumfacing = EnumFacing.NORTH;
}
if (var19 && 1.0D - var12 < var23) {
var23 = 1.0D - var12;
var22 = 3;
if (!this.worldObj.isBlockFullCube(blockpos.south()) && 1.0D - d2 < d3)
{
d3 = 1.0D - d2;
enumfacing = EnumFacing.SOUTH;
}
if (var20 && var14 < var23) {
var23 = var14;
var22 = 4;
if (!this.worldObj.isBlockFullCube(blockpos.up()) && 1.0D - d1 < d3)
{
d3 = 1.0D - d1;
enumfacing = EnumFacing.UP;
}
if (var21 && 1.0D - var14 < var23) {
var23 = 1.0D - var14;
var22 = 5;
float f = this.rand.nextFloat() * 0.05F + 0.01F; // Botania - made multiplier and add both smaller
float f1 = (float)enumfacing.getAxisDirection().getOffset();
float secondary = (rand.nextFloat() - rand.nextFloat()) * 0.1F; // Botania - Make and use a secondary movement variable below
if (enumfacing.getAxis() == EnumFacing.Axis.X)
{
this.motionX += (double)(f1 * f);
this.motionY = this.motionZ = secondary;
}
float var25 = rand.nextFloat() * 0.05F + 0.025F;
float var26 = (rand.nextFloat() - rand.nextFloat()) * 0.1F;
if (var22 == 0) {
motionX = -var25;
motionY=motionZ=var26;
else if (enumfacing.getAxis() == EnumFacing.Axis.Y)
{
this.motionY += (double)(f1 * f);
this.motionX = this.motionZ = secondary;
}
if (var22 == 1) {
motionX = var25;
motionY=motionZ=var26;
}
if (var22 == 2) {
motionY = -var25;
motionX=motionZ=var26;
}
if (var22 == 3) {
motionY = var25;
motionX=motionZ=var26;
}
if (var22 == 4) {
motionZ = -var25;
motionY=motionX=var26;
}
if (var22 == 5) {
motionZ = var25;
motionY=motionX=var26;
else if (enumfacing.getAxis() == EnumFacing.Axis.Z)
{
this.motionZ += (double)(f1 * f);
this.motionX = this.motionY = secondary;
}
return true;
} else return false;
}
return false;
}
public boolean corrupt = false;
public boolean fake = false;
private int multiplier = 2;
private boolean shrink = true;
public int particle = 16;
private final boolean shrink = true;
public final int particle = 16;
public boolean tinkle = false;
public boolean slowdown = true;
public final boolean slowdown = true;
public int currentColor = 0;
}
@@ -34,8 +34,8 @@ public class FXWisp extends Particle {
public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_WISP_LARGE);
private static Queue<FXWisp> queuedRenders = new ArrayDeque<>();
private static Queue<FXWisp> queuedDepthIgnoringRenders = new ArrayDeque<>();
private static final Queue<FXWisp> queuedRenders = new ArrayDeque<>();
private static final Queue<FXWisp> queuedDepthIgnoringRenders = new ArrayDeque<>();
// Queue values
private float f;
@@ -171,8 +171,8 @@ public class FXWisp extends Particle {
private boolean depthTest = true;
public boolean distanceLimit = true;
private float moteParticleScale;
private int moteHalfLife;
private final float moteParticleScale;
private final int moteHalfLife;
public boolean tinkle = false;
public int blendmode = 1;
}
@@ -18,8 +18,8 @@ import vazkii.botania.common.achievement.ModAchievements;
public class GuiAchievementsHacky extends GuiAchievements {
public GuiAchievementsHacky(GuiScreen p_i45026_1_, StatisticsManager p_i45026_2_) {
super(p_i45026_1_, p_i45026_2_);
public GuiAchievementsHacky(GuiScreen screen, StatisticsManager stats) {
super(screen, stats);
ReflectionHelper.setPrivateValue(GuiAchievements.class, this, ModAchievements.pageIndex, "currentPage");
}
@@ -17,17 +17,17 @@ import net.minecraft.item.ItemStack;
public class SlotLocked extends Slot {
public SlotLocked(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
public SlotLocked(IInventory inv, int index, int xPos, int yPos) {
super(inv, index, xPos, yPos);
}
@Override
public boolean canTakeStack(EntityPlayer p_82869_1_) {
public boolean canTakeStack(EntityPlayer player) {
return false;
}
@Override
public boolean isItemValid(ItemStack p_75214_1_) {
public boolean isItemValid(ItemStack stack) {
return false;
}
@@ -11,30 +11,31 @@
package vazkii.botania.client.gui.bag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.SlotItemHandler;
import vazkii.botania.client.gui.SlotLocked;
import javax.annotation.Nonnull;
public class ContainerFlowerBag extends Container {
InventoryFlowerBag flowerBagInv;
private final InventoryFlowerBag flowerBagInv;
public ContainerFlowerBag(EntityPlayer player) {
public ContainerFlowerBag(InventoryPlayer playerInv, InventoryFlowerBag flowerBagInv) {
int i;
int j;
int slot = player.inventory.currentItem;
IInventory playerInv = player.inventory;
flowerBagInv = new InventoryFlowerBag(player, slot);
this.flowerBagInv = flowerBagInv;
for(i = 0; i < 2; ++i)
for(j = 0; j < 8; ++j) {
int k = j + i * 8;
addSlotToContainer(new SlotFlower(flowerBagInv, k, 17 + j * 18, 26 + i * 18, k));
addSlotToContainer(new SlotItemHandler(flowerBagInv, k, 17 + j * 18, 26 + i * 18));
}
for(i = 0; i < 3; ++i)
@@ -42,7 +43,7 @@ public class ContainerFlowerBag extends Container {
addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
for(i = 0; i < 9; ++i) {
if(player.inventory.currentItem == i)
if(playerInv.getStackInSlot(i) == flowerBagInv.bag)
addSlotToContainer(new SlotLocked(playerInv, i, 8 + i * 18, 142));
else addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142));
}
@@ -51,29 +52,20 @@ public class ContainerFlowerBag extends Container {
@Override
public boolean canInteractWith(@Nonnull EntityPlayer player) {
boolean can = flowerBagInv.isUseableByPlayer(player);
if(!can)
onContainerClosed(player);
return can;
return player.getHeldItemMainhand() == flowerBagInv.bag
|| player.getHeldItemOffhand() == flowerBagInv.bag;
}
@Override
public void onContainerClosed(EntityPlayer player) {
super.onContainerClosed(player);
flowerBagInv.pushInventory();
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
ItemStack itemstack = null;
Slot slot = inventorySlots.get(p_82846_2_);
Slot slot = inventorySlots.get(slotIndex);
if(slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if(p_82846_2_ < 16) {
if(slotIndex < 16) {
if(!mergeItemStack(itemstack1, 16, 52, true))
return null;
} else {
@@ -92,7 +84,7 @@ public class ContainerFlowerBag extends Container {
if(itemstack1.stackSize == itemstack.stackSize)
return null;
slot.onPickupFromSlot(p_82846_1_, itemstack1);
slot.onPickupFromSlot(player, itemstack1);
}
return itemstack;
@@ -13,11 +13,13 @@ package vazkii.botania.client.gui.bag;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.items.SlotItemHandler;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.block.ModBlocks;
@@ -27,19 +29,19 @@ public class GuiFlowerBag extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_FLOWER_BAG);
public GuiFlowerBag(EntityPlayer player) {
super(new ContainerFlowerBag(player));
public GuiFlowerBag(InventoryPlayer playerInv, InventoryFlowerBag flowerBagInv) {
super(new ContainerFlowerBag(playerInv, flowerBagInv));
}
@Override
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String s = I18n.translateToLocal("item.botania:flowerBag.name");
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
String s = I18n.format("item.botania:flowerBag.name");
fontRendererObj.drawString(s, xSize / 2 - fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
fontRendererObj.drawString(I18n.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 4210752);
fontRendererObj.drawString(I18n.format("container.inventory"), 8, ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(texture);
int k = (width - xSize) / 2;
@@ -48,10 +50,10 @@ public class GuiFlowerBag extends GuiContainer {
List<Slot> slotList = inventorySlots.inventorySlots;
for(Slot slot : slotList)
if(slot instanceof SlotFlower) {
SlotFlower slotf = (SlotFlower) slot;
if(slot instanceof SlotItemHandler) {
SlotItemHandler slotf = (SlotItemHandler) slot;
if(!slotf.getHasStack()) {
ItemStack stack = new ItemStack(ModBlocks.flower, 0, slotf.color);
ItemStack stack = new ItemStack(ModBlocks.flower, 0, slotf.getSlotIndex()); // index matches colors
int x = guiLeft + slotf.xDisplayPosition;
int y = guiTop + slotf.yDisplayPosition;
RenderHelper.enableGUIStandardItemLighting();
@@ -62,9 +64,4 @@ public class GuiFlowerBag extends GuiContainer {
}
}
@Override
protected boolean checkHotbarKeys(int p_146983_1_) {
return false;
}
}
@@ -10,183 +10,42 @@
*/
package vazkii.botania.client.gui.bag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import vazkii.botania.common.item.ItemFlowerBag;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibItemNames;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import javax.annotation.Nonnull;
import java.util.Arrays;
public class InventoryFlowerBag implements IItemHandlerModifiable {
public class InventoryFlowerBag implements IInventory {
private final IItemHandlerModifiable bagInv;
final ItemStack bag;
private static final ItemStack[] FALLBACK_INVENTORY = new ItemStack[16];
EntityPlayer player;
int slot;
ItemStack[] stacks = null;
boolean invPushed = false;
ItemStack storedInv = null;
public InventoryFlowerBag(EntityPlayer player, int slot) {
this.player = player;
this.slot = slot;
}
public static boolean isFlowerBag(ItemStack stack) {
return stack != null && stack.getItem() == ModItems.flowerBag;
}
ItemStack getStack() {
ItemStack stack = player.inventory.getStackInSlot(slot);
if(stack != null)
storedInv = stack;
return stack;
}
ItemStack[] getInventory() {
if(stacks != null)
return stacks;
ItemStack stack = getStack();
if(isFlowerBag(getStack())) {
stacks = ItemFlowerBag.loadStacks(stack);
return stacks;
}
return FALLBACK_INVENTORY;
}
public void pushInventory() {
if(invPushed)
return;
ItemStack stack = getStack();
if(stack == null)
stack = storedInv;
if(stack != null) {
ItemStack[] inv = getInventory();
ItemFlowerBag.setStacks(stack, inv);
}
invPushed = true;
public InventoryFlowerBag(ItemStack bag) {
this.bag = bag;
this.bagInv = (IItemHandlerModifiable) bag.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
}
@Override
public int getSizeInventory() {
return 16;
public void setStackInSlot(int slot, ItemStack stack) {
bagInv.setStackInSlot(slot, stack);
}
@Override
public ItemStack getStackInSlot(int i) {
return getInventory()[i];
public int getSlots() {
return bagInv.getSlots();
}
@Override
public ItemStack decrStackSize(int i, int j) {
ItemStack[] inventorySlots = getInventory();
if (inventorySlots[i] != null) {
ItemStack stackAt;
if (inventorySlots[i].stackSize <= j) {
stackAt = inventorySlots[i];
inventorySlots[i] = null;
return stackAt;
} else {
stackAt = inventorySlots[i].splitStack(j);
if (inventorySlots[i].stackSize == 0)
inventorySlots[i] = null;
return stackAt;
}
}
return null;
public ItemStack getStackInSlot(int slot) {
return bagInv.getStackInSlot(slot);
}
@Override
public ItemStack removeStackFromSlot(int i) {
return getStackInSlot(i);
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
return bagInv.insertItem(slot, stack, simulate);
}
@Override
public void setInventorySlotContents(int i, ItemStack itemstack) {
ItemStack[] inventorySlots = getInventory();
inventorySlots[i] = itemstack;
public ItemStack extractItem(int slot, int amount, boolean simulate) {
return bagInv.extractItem(slot, amount, simulate);
}
@Override
public int getInventoryStackLimit() {
return isFlowerBag(getStack()) ? 64 : 0;
}
@Override
public boolean isUseableByPlayer(@Nonnull EntityPlayer entityplayer) {
return isFlowerBag(getStack());
}
@Override
public boolean isItemValidForSlot(int i, @Nonnull ItemStack itemstack) {
return isFlowerBag(getStack());
}
@Override
public int getField(int id) {
return 0;
}
@Override
public void setField(int id, int value) {}
@Override
public int getFieldCount() {
return 0;
}
@Override
public void clear() {
if (stacks != null) {
Arrays.fill(stacks, null);
}
}
@Override
public boolean hasCustomName() {
return false;
}
@Nonnull
@Override
public ITextComponent getDisplayName() {
return new TextComponentString(getName());
}
@Override
public void openInventory(@Nonnull EntityPlayer player) {
// NO-OP
}
@Override
public void closeInventory(@Nonnull EntityPlayer player) {
// NO-OP
}
@Nonnull
@Override
public String getName() {
return LibItemNames.FLOWER_BAG;
}
@Override
public void markDirty() {
// NO-OP
}
}
@@ -1,39 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Mar 16, 2015, 7:20:05 PM (GMT)]
*/
package vazkii.botania.client.gui.bag;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.block.ModBlocks;
public class SlotFlower extends Slot {
InventoryFlowerBag inv;
int color;
public SlotFlower(InventoryFlowerBag p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_, int color) {
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
this.color = color;
inv = p_i1824_1_;
}
@Override
public void onSlotChange(ItemStack oldStack, ItemStack newStack) {
inv.setInventorySlotContents(color, newStack);
}
@Override
public boolean isItemValid(ItemStack stack) {
return stack.getItem() == Item.getItemFromBlock(ModBlocks.flower) && stack.getItemDamage() == color;
}
}
@@ -20,6 +20,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.SlotItemHandler;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.client.gui.SlotLocked;
@@ -27,16 +28,15 @@ import javax.annotation.Nonnull;
public class ContainerBaubleBox extends Container {
InventoryBaubleBox baubleBoxInv;
InventoryBaubles baubles;
private final InventoryBaubleBox baubleBoxInv;
private final InventoryBaubles baubles;
public ContainerBaubleBox(EntityPlayer player) {
public ContainerBaubleBox(EntityPlayer player, InventoryBaubleBox boxInv) {
int i;
int j;
int slot = player.inventory.currentItem;
IInventory playerInv = player.inventory;
baubleBoxInv = new InventoryBaubleBox(player, slot);
baubleBoxInv = boxInv;
baubles = new InventoryBaubles(player);
baubles.setEventHandler(this);
@@ -51,7 +51,7 @@ public class ContainerBaubleBox extends Container {
for(i = 0; i < 4; ++i)
for(j = 0; j < 6; ++j) {
int k = j + i * 6;
addSlotToContainer(new SlotAnyBauble(baubleBoxInv, k, 62 + j * 18, 8 + i * 18));
addSlotToContainer(new SlotItemHandler(baubleBoxInv, k, 62 + j * 18, 8 + i * 18));
}
for(i = 0; i < 3; ++i)
@@ -59,7 +59,7 @@ public class ContainerBaubleBox extends Container {
addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
for(i = 0; i < 9; ++i) {
if(player.inventory.currentItem == i)
if(playerInv.getStackInSlot(i) == baubleBoxInv.box)
addSlotToContainer(new SlotLocked(playerInv, i, 8 + i * 18, 142));
else addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142));
}
@@ -68,39 +68,34 @@ public class ContainerBaubleBox extends Container {
@Override
public boolean canInteractWith(@Nonnull EntityPlayer player) {
boolean can = baubleBoxInv.isUseableByPlayer(player);
if(!can)
onContainerClosed(player);
return can;
return player.getHeldItemMainhand() == baubleBoxInv.box
|| player.getHeldItemOffhand() == baubleBoxInv.box;
}
@Override
public void onContainerClosed(EntityPlayer player) {
super.onContainerClosed(player);
baubleBoxInv.pushInventory();
if(!player.worldObj.isRemote)
PlayerHandler.setPlayerBaubles(player, baubles);
}
@Override
public void putStacksInSlots(ItemStack[] p_75131_1_) {
public void putStacksInSlots(ItemStack[] arr) {
baubles.blockEvents = true;
super.putStacksInSlots(p_75131_1_);
super.putStacksInSlots(arr);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
ItemStack itemstack = null;
Slot slot = inventorySlots.get(p_82846_2_);
Slot slot = inventorySlots.get(slotIndex);
if(slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
System.out.println(p_82846_2_ + " " + itemstack);
if(p_82846_2_ < 28) {
if(slotIndex < 28) {
if(!mergeItemStack(itemstack1, 28, 64, true))
return null;
} else {
@@ -115,7 +110,7 @@ public class ContainerBaubleBox extends Container {
if(itemstack1.stackSize == itemstack.stackSize)
return null;
slot.onPickupFromSlot(p_82846_1_, itemstack1);
slot.onPickupFromSlot(player, itemstack1);
}
return itemstack;
@@ -22,17 +22,12 @@ public class GuiBaubleBox extends InventoryEffectRenderer {
private static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_BAUBLE_BOX);
public GuiBaubleBox(EntityPlayer player) {
super(new ContainerBaubleBox(player));
public GuiBaubleBox(EntityPlayer player, InventoryBaubleBox box) {
super(new ContainerBaubleBox(player, box));
}
@Override
protected boolean checkHotbarKeys(int p_146983_1_) {
return false;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
@@ -43,7 +38,7 @@ public class GuiBaubleBox extends InventoryEffectRenderer {
drawTexturedModalRect(guiLeft+slot.xDisplayPosition, guiTop+slot.yDisplayPosition, 200, 0, 16, 16);
}
GuiInventory.drawEntityOnScreen(guiLeft + 43, guiTop + 61, 20, guiLeft + 43 - p_146976_2_, guiTop + 45 - 30 - p_146976_3_, mc.thePlayer);
GuiInventory.drawEntityOnScreen(guiLeft + 43, guiTop + 61, 20, guiLeft + 43 - mouseX, guiTop + 45 - 30 - mouseY, mc.thePlayer);
}
}
@@ -10,182 +10,43 @@
*/
package vazkii.botania.client.gui.box;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import vazkii.botania.common.item.ItemBaubleBox;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibItemNames;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import javax.annotation.Nonnull;
import java.util.Arrays;
public class InventoryBaubleBox implements IItemHandlerModifiable {
public class InventoryBaubleBox implements IInventory {
private final IItemHandlerModifiable boxInv;
final ItemStack box;
private static final ItemStack[] FALLBACK_INVENTORY = new ItemStack[16];
EntityPlayer player;
int slot;
ItemStack[] stacks = null;
boolean invPushed = false;
ItemStack storedInv = null;
public InventoryBaubleBox(EntityPlayer player, int slot) {
this.player = player;
this.slot = slot;
}
public static boolean isBaubleBox(ItemStack stack) {
return stack != null && stack.getItem() == ModItems.baubleBox;
}
ItemStack getStack() {
ItemStack stack = player.inventory.getStackInSlot(slot);
if(stack != null)
storedInv = stack;
return stack;
}
ItemStack[] getInventory() {
if(stacks != null)
return stacks;
ItemStack stack = getStack();
if(isBaubleBox(getStack())) {
stacks = ItemBaubleBox.loadStacks(stack);
return stacks;
}
return FALLBACK_INVENTORY;
}
public void pushInventory() {
if(invPushed)
return;
ItemStack stack = getStack();
if(stack == null)
stack = storedInv;
if(stack != null) {
ItemStack[] inv = getInventory();
ItemBaubleBox.setStacks(stack, inv);
}
invPushed = true;
public InventoryBaubleBox(ItemStack box) {
this.box = box;
this.boxInv = (IItemHandlerModifiable) box.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
}
@Override
public int getSizeInventory() {
return 16;
public void setStackInSlot(int slot, ItemStack stack) {
boxInv.setStackInSlot(slot, stack);
}
@Override
public ItemStack getStackInSlot(int i) {
return getInventory()[i];
public int getSlots() {
return boxInv.getSlots();
}
@Override
public ItemStack decrStackSize(int i, int j) {
ItemStack[] inventorySlots = getInventory();
if (inventorySlots[i] != null) {
ItemStack stackAt;
if (inventorySlots[i].stackSize <= j) {
stackAt = inventorySlots[i];
inventorySlots[i] = null;
return stackAt;
} else {
stackAt = inventorySlots[i].splitStack(j);
if (inventorySlots[i].stackSize == 0)
inventorySlots[i] = null;
return stackAt;
}
}
return null;
public ItemStack getStackInSlot(int slot) {
return boxInv.getStackInSlot(slot);
}
@Override
public ItemStack removeStackFromSlot(int i) {
return getStackInSlot(i);
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
return boxInv.insertItem(slot, stack, simulate);
}
@Override
public void setInventorySlotContents(int slot, ItemStack itemstack) {
ItemStack[] inventorySlots = getInventory();
inventorySlots[slot] = itemstack;
}
@Override
public int getInventoryStackLimit() {
return isBaubleBox(getStack()) ? 64 : 0;
}
@Override
public boolean isUseableByPlayer(@Nonnull EntityPlayer entityplayer) {
return isBaubleBox(getStack());
}
@Override
public boolean isItemValidForSlot(int i, @Nonnull ItemStack itemstack) {
return isBaubleBox(getStack());
}
@Override
public int getField(int id) {
return 0;
}
@Override
public void setField(int id, int value) {}
@Override
public int getFieldCount() {
return 0;
}
@Override
public void clear() {
if (stacks != null)
Arrays.fill(stacks, null);
}
@Override
public boolean hasCustomName() {
return false;
}
@Nonnull
@Override
public ITextComponent getDisplayName() {
return new TextComponentString(getName());
}
@Override
public void openInventory(@Nonnull EntityPlayer player) {
// NO-OP
}
@Override
public void closeInventory(@Nonnull EntityPlayer player) {
// NO-OP
}
@Nonnull
@Override
public String getName() {
return LibItemNames.BAUBLE_BOX;
}
@Override
public void markDirty() {
// NO-OP
public ItemStack extractItem(int slot, int amount, boolean simulate) {
return boxInv.extractItem(slot, amount, simulate);
}
}
@@ -1,37 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [25/11/2015, 19:59:22 (GMT)]
*/
package vazkii.botania.client.gui.box;
import baubles.api.IBauble;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.mana.IManaItem;
public class SlotAnyBauble extends Slot {
InventoryBaubleBox inv;
public SlotAnyBauble(InventoryBaubleBox p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
inv = p_i1824_1_;
}
@Override
public void onSlotChange(ItemStack oldStack, ItemStack newStack) {
inv.setInventorySlotContents(slotNumber, newStack);
}
@Override
public boolean isItemValid(ItemStack stack) {
return stack.getItem() instanceof IBauble || stack.getItem() instanceof IManaItem;
}
}
@@ -22,8 +22,8 @@ import javax.annotation.Nonnull;
public class ContainerCraftingHalo extends ContainerWorkbench {
public ContainerCraftingHalo(InventoryPlayer p_i1808_1_, World p_i1808_2_) {
super(p_i1808_1_, p_i1808_2_, BlockPos.ORIGIN);
public ContainerCraftingHalo(InventoryPlayer playerInv, World world) {
super(playerInv, world, BlockPos.ORIGIN);
craftMatrix = new InventoryCraftingHalo(this, 3, 3);
@@ -31,7 +31,7 @@ public class ContainerCraftingHalo extends ContainerWorkbench {
inventoryItemStacks.clear();
// Le copypasta
addSlotToContainer(new SlotCrafting(p_i1808_1_.player, craftMatrix, craftResult, 0, 124, 35));
addSlotToContainer(new SlotCrafting(playerInv.player, craftMatrix, craftResult, 0, 124, 35));
int l;
int i1;
@@ -47,20 +47,20 @@ public class ContainerCraftingHalo extends ContainerWorkbench {
{
for (i1 = 0; i1 < 9; ++i1)
{
addSlotToContainer(new Slot(p_i1808_1_, i1 + l * 9 + 9, 8 + i1 * 18, 84 + l * 18));
addSlotToContainer(new Slot(playerInv, i1 + l * 9 + 9, 8 + i1 * 18, 84 + l * 18));
}
}
for (l = 0; l < 9; ++l)
{
addSlotToContainer(new Slot(p_i1808_1_, l, 8 + l * 18, 142));
addSlotToContainer(new Slot(playerInv, l, 8 + l * 18, 142));
}
onCraftMatrixChanged(craftMatrix);
}
@Override
public boolean canInteractWith(@Nonnull EntityPlayer p_75145_1_) {
public boolean canInteractWith(@Nonnull EntityPlayer player) {
return true;
}
}
@@ -22,18 +22,18 @@ public class GuiCraftingHalo extends GuiContainer {
private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation("textures/gui/container/crafting_table.png");
public GuiCraftingHalo(InventoryPlayer p_i1084_1_, World p_i1084_2_) {
super(new ContainerCraftingHalo(p_i1084_1_, p_i1084_2_));
public GuiCraftingHalo(InventoryPlayer playerInv, World world) {
super(new ContainerCraftingHalo(playerInv, world));
}
@Override
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
fontRendererObj.drawString(I18n.format("container.crafting"), 28, 6, 4210752);
fontRendererObj.drawString(I18n.format("container.inventory"), 8, ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(craftingTableGuiTextures);
int k = (width - xSize) / 2;
@@ -15,8 +15,8 @@ import net.minecraft.inventory.InventoryCrafting;
public class InventoryCraftingHalo extends InventoryCrafting {
public InventoryCraftingHalo(Container p_i1807_1_, int p_i1807_2_, int p_i1807_3_) {
super(p_i1807_1_, p_i1807_2_, p_i1807_3_);
public InventoryCraftingHalo(Container container, int width, int height) {
super(container, width, height);
}
}
@@ -16,12 +16,12 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatAllowedCharacters;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.common.MinecraftForge;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
@@ -110,8 +110,8 @@ public class GuiLexicon extends GuiScreen {
List<LexiconCategory> allCategories;
String title;
int guiWidth = 146;
int guiHeight = 180;
final int guiWidth = 146;
final int guiHeight = 180;
int left, top;
@Override
@@ -155,7 +155,7 @@ public class GuiLexicon extends GuiScreen {
} else if(isCategoryIndex()) {
int categories = allCategories.size();
for(int i = 0; i < categories + 1; i++) {
LexiconCategory category = null;
LexiconCategory category;
category = i >= categories ? null : allCategories.get(i);
int perline = 5;
int x = i % perline;
@@ -285,7 +285,7 @@ public class GuiLexicon extends GuiScreen {
if(notesEnabled && ClientTickHandler.ticksInGame % 20 < 10)
noteDisplay += "&r_";
fontRendererObj.drawString(I18n.translateToLocal("botaniamisc.notes"), x + 5, y - 7, 0x666666);
fontRendererObj.drawString(I18n.format("botaniamisc.notes"), x + 5, y - 7, 0x666666);
boolean unicode = fontRendererObj.getUnicodeFlag();
fontRendererObj.setUnicodeFlag(true);
@@ -340,7 +340,7 @@ public class GuiLexicon extends GuiScreen {
boolean unicode = fontRendererObj.getUnicodeFlag();
fontRendererObj.drawString(title, left + 18, top + 13, color);
fontRendererObj.setUnicodeFlag(true);
fontRendererObj.drawString(String.format(I18n.translateToLocal("botaniamisc.edition"), ItemLexicon.getEdition()), left + 24, top + 22, color);
fontRendererObj.drawString(I18n.format("botaniamisc.edition", ItemLexicon.getEdition()), left + 24, top + 22, color);
String s = TextFormatting.BOLD + categoryHighlight;
fontRendererObj.drawString(s, left + guiWidth / 2 - fontRendererObj.getStringWidth(s) / 2, top + 36, 0);
@@ -481,9 +481,9 @@ public class GuiLexicon extends GuiScreen {
GuiButtonInvisible button = (GuiButtonInvisible) buttonList.get(i);
LexiconCategory category = i_ >= categoryList.size() ? null : categoryList.get(i_);
if(category != null)
button.displayString = I18n.translateToLocal(category.getUnlocalizedName());
button.displayString = I18n.format(category.getUnlocalizedName());
else {
button.displayString = I18n.translateToLocal("botaniamisc.lexiconIndex");
button.displayString = I18n.format("botaniamisc.lexiconIndex");
break;
}
}
@@ -511,9 +511,9 @@ public class GuiLexicon extends GuiScreen {
}
if(isMainPage())
buttonList.add(new GuiButtonHistory(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, I18n.translateToLocal("botaniamisc.history"), this));
buttonList.add(new GuiButtonHistory(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, I18n.format("botaniamisc.history"), this));
else if(isChallenge())
buttonList.add(new GuiButtonChallengeInfo(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, I18n.translateToLocal("botaniamisc.info"), this));
buttonList.add(new GuiButtonChallengeInfo(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, I18n.format("botaniamisc.info"), this));
}
public static void startTutorial() {
@@ -13,9 +13,9 @@ package vazkii.botania.client.gui.lexicon;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.resources.I18n;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import vazkii.botania.client.challenge.Challenge;
import vazkii.botania.client.challenge.ModChallenges;
import vazkii.botania.client.core.handler.ClientTickHandler;
@@ -44,7 +44,7 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
}
public void setTitle() {
title = challenge == null ? "(null)" : I18n.translateToLocal(challenge.unlocalizedName);
title = challenge == null ? "(null)" : I18n.format(challenge.unlocalizedName);
}
@Override
@@ -69,8 +69,8 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
boolean unicode = fontRendererObj.getUnicodeFlag();
fontRendererObj.setUnicodeFlag(true);
fontRendererObj.drawString(TextFormatting.BOLD + I18n.translateToLocal(challenge.unlocalizedName), left + 38, top + 13, 0);
fontRendererObj.drawString(I18n.translateToLocal(challenge.level.getName()) + " / " + (challenge.complete ? TextFormatting.DARK_GREEN : TextFormatting.DARK_RED) + I18n.translateToLocal(challenge.complete ? "botaniamisc.completed" : "botaniamisc.notCompleted"), left + 38, top + 23, 0);
fontRendererObj.drawString(TextFormatting.BOLD + I18n.format(challenge.unlocalizedName), left + 38, top + 13, 0);
fontRendererObj.drawString(I18n.format(challenge.level.getName()) + " / " + (challenge.complete ? TextFormatting.DARK_GREEN : TextFormatting.DARK_RED) + I18n.format(challenge.complete ? "botaniamisc.completed" : "botaniamisc.notCompleted"), left + 38, top + 23, 0);
int width = guiWidth - 30;
int x = left + 16;
@@ -116,7 +116,7 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
}
void setCompleteButtonTitle() {
completeButton.displayString = I18n.translateToLocal(challenge.complete ? "botaniamisc.markNotCompleted" : "botaniamisc.markCompleted");
completeButton.displayString = I18n.format(challenge.complete ? "botaniamisc.markNotCompleted" : "botaniamisc.markCompleted");
}
void back() {
@@ -11,8 +11,8 @@
package vazkii.botania.client.gui.lexicon;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import vazkii.botania.client.challenge.Challenge;
import vazkii.botania.client.challenge.EnumChallengeLevel;
import vazkii.botania.client.challenge.ModChallenges;
@@ -30,13 +30,13 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
public GuiLexiconChallengesList() {
parent = new GuiLexicon();
title = I18n.translateToLocal("botaniamisc.challenges");
title = I18n.format("botaniamisc.challenges");
}
@Override
public void onInitGui() {
super.onInitGui();
title = I18n.translateToLocal("botaniamisc.challenges");
title = I18n.format("botaniamisc.challenges");
buttonList.add(backButton = new GuiButtonBack(12, left + guiWidth / 2 - 8, top + guiHeight + 2));
@@ -67,7 +67,7 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
if(c.complete)
complete++;
fontRendererObj.drawString(TextFormatting.BOLD + I18n.translateToLocal(level.getName()) + TextFormatting.RESET + " (" + complete + "/" + list.size() + ")", left + 20, top + 11 + level.ordinal() * 44, 0);
fontRendererObj.drawString(TextFormatting.BOLD + I18n.format(level.getName()) + TextFormatting.RESET + " (" + complete + "/" + list.size() + ")", left + 20, top + 11 + level.ordinal() * 44, 0);
}
fontRendererObj.setUnicodeFlag(unicode);
}
@@ -13,11 +13,11 @@ package vazkii.botania.client.gui.lexicon;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import org.lwjgl.input.Mouse;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.IGuiLexiconEntry;
@@ -66,9 +66,9 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
return;
}
title = I18n.translateToLocal(entry.getUnlocalizedName());
title = I18n.format(entry.getUnlocalizedName());
if(entry instanceof IAddonEntry)
subtitle = I18n.translateToLocal(((IAddonEntry) entry).getSubtitle());
subtitle = I18n.format(((IAddonEntry) entry).getSubtitle());
else subtitle = null;
}
@@ -10,8 +10,8 @@
*/
package vazkii.botania.client.gui.lexicon;
import net.minecraft.client.resources.I18n;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.text.translation.I18n;
import vazkii.botania.api.lexicon.ILexicon;
import vazkii.botania.api.lexicon.LexiconEntry;
@@ -24,7 +24,7 @@ public class GuiLexiconHistory extends GuiLexiconIndex {
public GuiLexiconHistory() {
super(null);
title = I18n.translateToLocal("botaniamisc.historyLong");
title = I18n.format("botaniamisc.historyLong");
}
@Override
@@ -33,7 +33,7 @@ public class GuiLexiconHistory extends GuiLexiconIndex {
ILexicon lex = (ILexicon) stackUsed.getItem();
for(int i = history.size() - 1; i >= 0; i--) {
LexiconEntry entry = history.get(i);
if(lex.isKnowledgeUnlocked(stackUsed, entry.getKnowledgeType()) && I18n.translateToLocal(entry.getUnlocalizedName()).toLowerCase().contains(searchField.getText().toLowerCase().trim()))
if(lex.isKnowledgeUnlocked(stackUsed, entry.getKnowledgeType()) && I18n.format(entry.getUnlocalizedName()).toLowerCase().contains(searchField.getText().toLowerCase().trim()))
entriesToDisplay.add(entry);
}
}
@@ -14,11 +14,11 @@ import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import org.lwjgl.input.Mouse;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.ILexicon;
@@ -54,7 +54,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
LexiconEntry currentEntry;
float infoTime;
List<LexiconEntry> entriesToDisplay = new ArrayList<>();
final List<LexiconEntry> entriesToDisplay = new ArrayList<>();
public GuiLexiconIndex() {
parent = new GuiLexicon();
@@ -67,7 +67,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
}
public void setTitle() {
title = I18n.translateToLocal(category == null ? "botaniamisc.lexiconIndex" : category.getUnlocalizedName());
title = I18n.format(category == null ? "botaniamisc.lexiconIndex" : category.getUnlocalizedName());
}
@Override
@@ -135,7 +135,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
return true;
search = search.toLowerCase();
if(I18n.translateToLocal(e.getUnlocalizedName()).toLowerCase().contains(search))
if(I18n.format(e.getUnlocalizedName()).toLowerCase().contains(search))
return true;
for(ItemStack stack : e.getDisplayedRecipes()) {
@@ -155,7 +155,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
GuiButtonInvisible button = (GuiButtonInvisible) buttonList.get(i - page * 12);
LexiconEntry entry = i >= entriesToDisplay.size() ? null : entriesToDisplay.get(i);
if(entry != null) {
button.displayString = entry.getKnowledgeType().color + "" + (entry.isPriority() ? TextFormatting.ITALIC : "") + I18n.translateToLocal(entry.getUnlocalizedName());
button.displayString = entry.getKnowledgeType().color + "" + (entry.isPriority() ? TextFormatting.ITALIC : "") + I18n.format(entry.getUnlocalizedName());
button.displayStack = entry.getIcon();
if(entry == tutEntry)
tutPage = page;
@@ -186,14 +186,14 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
if(entriesToDisplay.size() == 1) {
boolean unicode = mc.fontRendererObj.getUnicodeFlag();
mc.fontRendererObj.setUnicodeFlag(true);
String s = I18n.translateToLocal("botaniamisc.enterToView");
String s = I18n.format("botaniamisc.enterToView");
mc.fontRendererObj.drawString(s, left + guiWidth / 2 - mc.fontRendererObj.getStringWidth(s) / 2, top + 30, 0x666666);
mc.fontRendererObj.setUnicodeFlag(unicode);
}
} else {
boolean unicode = mc.fontRendererObj.getUnicodeFlag();
mc.fontRendererObj.setUnicodeFlag(true);
String s = I18n.translateToLocal("botaniamisc.typeToSearch");
String s = I18n.format("botaniamisc.typeToSearch");
mc.fontRendererObj.drawString(s, left + 120 - mc.fontRendererObj.getStringWidth(s), top + guiHeight - 18, 0x666666);
mc.fontRendererObj.setUnicodeFlag(unicode);
}
@@ -206,8 +206,8 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
infoTime = Math.max(0, infoTime - timeDelta);
if(currentButton != null && infoTime == 0) {
int x = par1 + 10;
int y = par2;
int x;
int y;
x = currentButton.xPosition - 20;
y = currentButton.yPosition;
@@ -224,7 +224,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
int x = currentButton.xPosition;
int y = currentButton.yPosition;
String s = I18n.translateToLocal(currentEntry.getTagline());
String s = I18n.format(currentEntry.getTagline());
boolean unicode = mc.fontRendererObj.getUnicodeFlag();
mc.fontRendererObj.setUnicodeFlag(true);
int width = mc.fontRendererObj.getStringWidth(s);
@@ -12,8 +12,8 @@ package vazkii.botania.client.gui.lexicon.button;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
@@ -37,7 +37,7 @@ public class GuiButtonAchievement extends GuiButtonLexicon {
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 109 : 98, 191, 11, 11);
List<String> tooltip = new ArrayList<>();
tooltip.add(TextFormatting.YELLOW + I18n.translateToLocal("botaniamisc.achievements"));
tooltip.add(TextFormatting.YELLOW + I18n.format("botaniamisc.achievements"));
int tooltipY = (tooltip.size() - 1) * 10;
if(k == 2)
@@ -12,7 +12,7 @@ package vazkii.botania.client.gui.lexicon.button;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
@@ -44,7 +44,7 @@ public class GuiButtonBack extends GuiButtonLexicon {
}
public List<String> getTooltip() {
return Collections.singletonList(I18n.translateToLocal("botaniamisc.back"));
return Collections.singletonList(I18n.format("botaniamisc.back"));
}
}
@@ -11,7 +11,7 @@
package vazkii.botania.client.gui.lexicon.button;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import java.util.Arrays;
import java.util.List;
@@ -24,7 +24,7 @@ public class GuiButtonBackWithShift extends GuiButtonBack {
@Override
public List<String> getTooltip() {
return Arrays.asList(I18n.translateToLocal("botaniamisc.back"), TextFormatting.GRAY + I18n.translateToLocal("botaniamisc.clickToIndex"));
return Arrays.asList(I18n.format("botaniamisc.back"), TextFormatting.GRAY + I18n.format("botaniamisc.clickToIndex"));
}
}
@@ -2,7 +2,7 @@ package vazkii.botania.client.gui.lexicon.button;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
@@ -12,7 +12,7 @@ import java.util.List;
public class GuiButtonBookmark extends GuiButtonLexicon {
GuiLexicon gui;
final GuiLexicon gui;
public GuiButtonBookmark(int par1, int par2, int par3, GuiLexicon gui, String str) {
super(par1, par2, par3, gui.bookmarkWidth(str) + 5, 11, str);
@@ -27,11 +27,11 @@ public class GuiButtonBookmark extends GuiButtonLexicon {
List<String> tooltip = new ArrayList<>();
if(displayString.equals("+"))
tooltip.add(I18n.translateToLocal("botaniamisc.clickToAdd"));
tooltip.add(I18n.format("botaniamisc.clickToAdd"));
else {
tooltip.add(String.format(I18n.translateToLocal("botaniamisc.bookmark"), id - GuiLexicon.BOOKMARK_START + 1));
tooltip.add(TextFormatting.GRAY + I18n.translateToLocal("botaniamisc.clickToSee"));
tooltip.add(TextFormatting.GRAY + I18n.translateToLocal("botaniamisc.shiftToRemove"));
tooltip.add(I18n.format("botaniamisc.bookmark", id - GuiLexicon.BOOKMARK_START + 1));
tooltip.add(TextFormatting.GRAY + I18n.format("botaniamisc.clickToSee"));
tooltip.add(TextFormatting.GRAY + I18n.format("botaniamisc.shiftToRemove"));
}
int tooltipY = (tooltip.size() + 1) * 5;
@@ -15,7 +15,7 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import org.lwjgl.opengl.ARBMultitexture;
import org.lwjgl.opengl.ARBShaderObjects;
import org.lwjgl.opengl.GL11;
@@ -36,13 +36,13 @@ public class GuiButtonCategory extends GuiButtonLexicon {
private static boolean boundStencil = false;
GuiLexicon gui;
private LexiconCategory category;
final GuiLexicon gui;
private final LexiconCategory category;
private ResourceLocation resource = null;
private float ticksHovered = 0F;
private float time = 12F;
private final float time = 12F;
private ShaderCallback shaderCallback = shader -> {
private final ShaderCallback shaderCallback = shader -> {
TextureManager r = Minecraft.getMinecraft().renderEngine;
int heightMatchUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "heightMatch");
int imageUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "image");
@@ -122,7 +122,7 @@ public class GuiButtonCategory extends GuiButtonLexicon {
GlStateManager.popMatrix();
if(inside)
gui.categoryHighlight = I18n.translateToLocal(getTooltipText());
gui.categoryHighlight = I18n.format(getTooltipText());
}
private String getTooltipText() {
@@ -14,7 +14,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import vazkii.botania.client.challenge.Challenge;
import javax.annotation.Nonnull;
@@ -23,7 +23,7 @@ import java.util.List;
public class GuiButtonChallengeIcon extends GuiButtonLexicon {
public Challenge challenge;
public final Challenge challenge;
public GuiButtonChallengeIcon(int id, int x, int y, Challenge challenge) {
super(id, x, y, 16, 16, "");
@@ -50,7 +50,7 @@ public class GuiButtonChallengeIcon extends GuiButtonLexicon {
List<String> tooltip = new ArrayList<>();
tooltip.add(TextFormatting.AQUA + I18n.translateToLocal(challenge.unlocalizedName));
tooltip.add(TextFormatting.AQUA + I18n.format(challenge.unlocalizedName));
int tooltipY = (tooltip.size() - 1) * 10;
if(k == 2)
@@ -11,7 +11,7 @@
package vazkii.botania.client.gui.lexicon.button;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
@@ -21,7 +21,7 @@ import java.util.List;
public class GuiButtonChallengeInfo extends GuiButtonLexicon {
GuiLexicon gui;
final GuiLexicon gui;
public GuiButtonChallengeInfo(int par1, int par2, int par3, String str, GuiLexicon gui) {
super(par1, par2, par3, gui.bookmarkWidth(str) + 5, 11, str);
@@ -35,7 +35,7 @@ public class GuiButtonChallengeInfo extends GuiButtonLexicon {
int k = getHoverState(hovered);
List<String> tooltip = new ArrayList<>();
tooltip.add(I18n.translateToLocal("botaniamisc.challengeInfo"));
tooltip.add(I18n.format("botaniamisc.challengeInfo"));
int tooltipY = (tooltip.size() + 1) * 5;
if(k == 2)
@@ -13,7 +13,7 @@ package vazkii.botania.client.gui.lexicon.button;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
@@ -37,7 +37,7 @@ public class GuiButtonChallenges extends GuiButtonLexicon {
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 131 : 120, 180, 11, 11);
List<String> tooltip = new ArrayList();
tooltip.add(TextFormatting.YELLOW + I18n.translateToLocal("botaniamisc.challenges"));
tooltip.add(TextFormatting.YELLOW + I18n.format("botaniamisc.challenges"));
int tooltipY = (tooltip.size() - 1) * 10;
if(k == 2)
@@ -12,7 +12,7 @@ package vazkii.botania.client.gui.lexicon.button;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
@@ -22,7 +22,7 @@ import java.util.List;
public class GuiButtonHistory extends GuiButtonLexicon {
GuiLexicon gui;
final GuiLexicon gui;
public GuiButtonHistory(int par1, int par2, int par3, String str, GuiLexicon gui) {
super(par1, par2, par3, gui.bookmarkWidth(str) + 5, 11, str);
@@ -36,8 +36,8 @@ public class GuiButtonHistory extends GuiButtonLexicon {
int k = getHoverState(hovered);
List<String> tooltip = new ArrayList<>();
tooltip.add(I18n.translateToLocal("botaniamisc.historyLong"));
tooltip.add(TextFormatting.GRAY + I18n.translateToLocal("botaniamisc.historyDesc"));
tooltip.add(I18n.format("botaniamisc.historyLong"));
tooltip.add(TextFormatting.GRAY + I18n.format("botaniamisc.historyDesc"));
int tooltipY = (tooltip.size() + 1) * 5;
if(k == 2)
@@ -30,7 +30,7 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
private static final ResourceLocation dogResource = new ResourceLocation(LibResources.GUI_DOG);
GuiLexiconIndex gui;
final GuiLexiconIndex gui;
public ItemStack displayStack = null;
public boolean dog = false;
float timeHover = 0;
@@ -56,12 +56,12 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
par1Minecraft.renderEngine.bindTexture(dogResource);
float f = 1F / 64F;
GL11.glTranslated(dogPos, 0, 0);
GL11.glColor4f(1F, 1F, 1F, 1F);
GlStateManager.translate(dogPos, 0, 0);
GlStateManager.color(1F, 1F, 1F, 1F);
vazkii.botania.client.core.helper.RenderHelper.drawTexturedModalRect(0, yPosition, zLevel + 10, (dogPos % 100 < 50) ? 23 : 0, 0, 23, 19, f, f);
xPosition = (int) Math.max(xPosition, dogPos + 10);
GL11.glTranslated(-dogPos, 0, 0);
GlStateManager.translate(-dogPos, 0, 0);
}
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
@@ -17,13 +17,13 @@ import vazkii.botania.api.sound.BotaniaSoundEvents;
public class GuiButtonLexicon extends GuiButton {
public GuiButtonLexicon(int p_i1021_1_, int p_i1021_2_, int p_i1021_3_, int p_i1021_4_, int p_i1021_5_, String p_i1021_6_) {
super(p_i1021_1_, p_i1021_2_, p_i1021_3_, p_i1021_4_, p_i1021_5_, p_i1021_6_);
public GuiButtonLexicon(int id, int x, int y, int width, int height, String text) {
super(id, x, y, width, height, text);
}
@Override
public void playPressSound(SoundHandler p_146113_1_) {
p_146113_1_.playSound(PositionedSoundRecord.getMasterRecord(BotaniaSoundEvents.lexiconPage, 1.0F));
public void playPressSound(SoundHandler handler) {
handler.playSound(PositionedSoundRecord.getMasterRecord(BotaniaSoundEvents.lexiconPage, 1.0F));
}
}
@@ -13,7 +13,7 @@ package vazkii.botania.client.gui.lexicon.button;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
@@ -23,7 +23,7 @@ import java.util.List;
public class GuiButtonNotes extends GuiButtonLexicon {
GuiLexicon parent;
final GuiLexicon parent;
public GuiButtonNotes(GuiLexicon parent, int id, int x, int y) {
super(id, x, y, 11, 11, "");
@@ -41,9 +41,9 @@ public class GuiButtonNotes extends GuiButtonLexicon {
List<String> tooltip = new ArrayList<>();
if(GuiLexicon.notesEnabled)
tooltip.add(TextFormatting.GREEN + I18n.translateToLocal("botaniamisc.hideNotes"));
tooltip.add(TextFormatting.GREEN + I18n.format("botaniamisc.hideNotes"));
else {
tooltip.add(TextFormatting.GREEN + I18n.translateToLocal("botaniamisc.showNotes"));
tooltip.add(TextFormatting.GREEN + I18n.format("botaniamisc.showNotes"));
if(parent.note != null && !parent.note.isEmpty())
Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow("!", xPosition + 10, yPosition, 0xFF0000);
}
@@ -13,7 +13,7 @@ package vazkii.botania.client.gui.lexicon.button;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
@@ -38,7 +38,7 @@ public class GuiButtonOptions extends GuiButtonLexicon {
List<String> tooltip = new ArrayList<>();
for(int i = 0; i < 3; i++)
tooltip.add((i == 0 ? TextFormatting.RED : TextFormatting.GRAY) + I18n.translateToLocal("botaniamisc.lexiconOptions" + i));
tooltip.add((i == 0 ? TextFormatting.RED : TextFormatting.GRAY) + I18n.format("botaniamisc.lexiconOptions" + i));
int tooltipY = (tooltip.size() - 1) * 10;
if(k == 2)
@@ -12,7 +12,7 @@ package vazkii.botania.client.gui.lexicon.button;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
@@ -21,7 +21,7 @@ import java.util.Collections;
public class GuiButtonPage extends GuiButtonLexicon {
boolean right;
final boolean right;
public GuiButtonPage(int par1, int par2, int par3, boolean right) {
super(par1, par2, par3, 18, 10, "");
@@ -39,7 +39,7 @@ public class GuiButtonPage extends GuiButtonLexicon {
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 18 : 0, right ? 180 : 190, 18, 10);
if(k == 2)
RenderHelper.renderTooltip(par2, par3, Collections.singletonList(I18n.translateToLocal(right ? "botaniamisc.nextPage" : "botaniamisc.prevPage")));
RenderHelper.renderTooltip(par2, par3, Collections.singletonList(I18n.format(right ? "botaniamisc.nextPage" : "botaniamisc.prevPage")));
}
}
@@ -13,7 +13,7 @@ package vazkii.botania.client.gui.lexicon.button;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
@@ -43,6 +43,6 @@ public class GuiButtonShare extends GuiButtonLexicon {
}
public List<String> getTooltip() {
return Collections.singletonList(TextFormatting.AQUA + I18n.translateToLocal("botaniamisc.clickToShare"));
return Collections.singletonList(TextFormatting.AQUA + I18n.format("botaniamisc.clickToShare"));
}
}
@@ -13,7 +13,7 @@ package vazkii.botania.client.gui.lexicon.button;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.handler.PersistentVariableHelper;
import vazkii.botania.client.core.helper.RenderHelper;
@@ -46,7 +46,7 @@ public class GuiButtonUpdateWarning extends GuiButtonLexicon {
List<String> tooltip = new ArrayList<>();
String version = PersistentVariableHelper.lastBotaniaVersion;
for(int i = 0; i < 6; i++) {
tooltip.add(TextFormatting.GRAY + String.format(I18n.translateToLocal("botaniamisc.changes" + i), version).replaceAll("&", "\u00a7"));
tooltip.add(TextFormatting.GRAY + I18n.format("botaniamisc.changes" + i, version).replaceAll("&", "\u00a7"));
if(i == 3)
tooltip.add("");
}
@@ -13,7 +13,7 @@ package vazkii.botania.client.gui.lexicon.button;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
@@ -36,7 +36,7 @@ public class GuiButtonViewOnline extends GuiButtonLexicon {
GlStateManager.color(1F, 1F, 1F, 1F);
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 41 : 30, 200, 11, 11);
List<String> tooltip = Collections.singletonList(TextFormatting.AQUA + I18n.translateToLocal("botaniamisc.viewOnline"));
List<String> tooltip = Collections.singletonList(TextFormatting.AQUA + I18n.format("botaniamisc.viewOnline"));
int tooltipY = (tooltip.size() - 1) * 10;
if(k == 2)
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
@@ -33,7 +33,6 @@ import vazkii.botania.client.integration.jei.runicaltar.RunicAltarRecipeCategory
import vazkii.botania.client.integration.jei.runicaltar.RunicAltarRecipeHandler;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.block.ItemBlockFloatingSpecialFlower;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import javax.annotation.Nonnull;
@@ -17,7 +17,7 @@ import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import javax.annotation.Nonnull;
import java.util.Collection;
@@ -32,7 +32,7 @@ public class BreweryRecipeCategory implements IRecipeCategory {
public BreweryRecipeCategory(IGuiHelper guiHelper) {
ResourceLocation location = new ResourceLocation("botania", "textures/gui/neiBrewery.png");
background = guiHelper.createDrawable(location, 0, 0, 166, 65, 0, 0, 0, 0);
localizedName = I18n.translateToLocal("botania.nei.brewery");
localizedName = I18n.format("botania.nei.brewery");
}
@Nonnull
@@ -22,7 +22,7 @@ import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
@@ -37,7 +37,7 @@ public class ElvenTradeRecipeCategory implements IRecipeCategory {
private final IDrawable overlay;
public ElvenTradeRecipeCategory(IGuiHelper guiHelper) {
localizedName = I18n.translateToLocal("botania.nei.elvenTrade");
localizedName = I18n.format("botania.nei.elvenTrade");
background = guiHelper.createBlankDrawable(145, 95);
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/elvenTradeOverlay.png"), 0, 15, 140, 90);
}
@@ -17,7 +17,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.helper.ItemNBTHelper;
@@ -34,7 +34,7 @@ public class ManaPoolRecipeCategory implements IRecipeCategory {
public ManaPoolRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(168, 64);
localizedName = I18n.translateToLocal("botania.nei.manaPool");
localizedName = I18n.format("botania.nei.manaPool");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
0, 0, 64, 46);
ItemNBTHelper.setBoolean(renderStack, "RenderFull", true);
@@ -18,7 +18,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import vazkii.botania.common.block.ModBlocks;
import javax.annotation.Nonnull;
@@ -34,7 +34,7 @@ public class PetalApothecaryRecipeCategory implements IRecipeCategory {
public PetalApothecaryRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(150, 110);
localizedName = I18n.translateToLocal("botania.nei.petalApothecary");
localizedName = I18n.format("botania.nei.petalApothecary");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/petalOverlay.png"),
0, 0, 150, 110);
}
@@ -17,7 +17,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.client.resources.I18n;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.lib.LibBlockNames;
@@ -33,7 +33,7 @@ public class PureDaisyRecipeCategory implements IRecipeCategory {
public PureDaisyRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(168, 64);
localizedName = I18n.translateToLocal("botania.nei.pureDaisy");
localizedName = I18n.format("botania.nei.pureDaisy");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
0, 0, 64, 46);
}
@@ -15,9 +15,9 @@ import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import vazkii.botania.common.block.ModBlocks;
import javax.annotation.Nonnull;
@@ -33,7 +33,7 @@ public class RunicAltarRecipeCategory implements IRecipeCategory {
public RunicAltarRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(150, 110);
localizedName = I18n.translateToLocal("botania.nei.runicAltar");
localizedName = I18n.format("botania.nei.runicAltar");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/petalOverlay.png"),
0, 0, 150, 110);
}
@@ -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,23 @@ 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.List;
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 +81,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 +128,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,18 +143,18 @@ 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;
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));
@@ -183,41 +179,35 @@ public class FloatingFlowerModel implements IBakedModel, IResourceManagerReloadL
}
// Forward all to flower model
@Nonnull
@Override
public List<BakedQuad> getQuads(IBlockState state, EnumFacing face, long rand) {
@Nonnull @Override public List<BakedQuad> getQuads(IBlockState state, EnumFacing face, long rand) {
return genQuads;
}
@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()) {
@@ -15,12 +15,12 @@ import net.minecraft.client.model.ModelRenderer;
public class ModelAvatar extends ModelBase {
public ModelRenderer body;
public ModelRenderer rightarm;
public ModelRenderer leftarm;
public ModelRenderer rightleg;
public ModelRenderer leftleg;
public ModelRenderer head;
public final ModelRenderer body;
public final ModelRenderer rightarm;
public final ModelRenderer leftarm;
public final ModelRenderer rightleg;
public final ModelRenderer leftleg;
public final ModelRenderer head;
public ModelAvatar() {
textureWidth = 32;
@@ -16,13 +16,13 @@ import net.minecraft.client.renderer.GlStateManager;
public class ModelBellows extends ModelBase {
ModelRenderer Base;
ModelRenderer Top;
ModelRenderer Funnel;
ModelRenderer Pipe;
ModelRenderer Handle1;
ModelRenderer Handle2;
ModelRenderer Handle3;
final ModelRenderer Base;
final ModelRenderer Top;
final ModelRenderer Funnel;
final ModelRenderer Pipe;
final ModelRenderer Handle1;
final ModelRenderer Handle2;
final ModelRenderer Handle3;
public ModelBellows() {
textureWidth = 64;
@@ -15,18 +15,18 @@ import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelBlackHoleCube extends ModelBase {
public ModelRenderer shape1;
public ModelRenderer shape1_1;
public ModelRenderer shape1_2;
public ModelRenderer shape1_3;
public ModelRenderer shape1_4;
public ModelRenderer shape1_5;
public ModelRenderer shape1_6;
public ModelRenderer shape1_7;
public ModelRenderer shape1_8;
public ModelRenderer shape1_9;
public ModelRenderer shape1_10;
public ModelRenderer shape1_11;
public final ModelRenderer shape1;
public final ModelRenderer shape1_1;
public final ModelRenderer shape1_2;
public final ModelRenderer shape1_3;
public final ModelRenderer shape1_4;
public final ModelRenderer shape1_5;
public final ModelRenderer shape1_6;
public final ModelRenderer shape1_7;
public final ModelRenderer shape1_8;
public final ModelRenderer shape1_9;
public final ModelRenderer shape1_10;
public final ModelRenderer shape1_11;
public ModelBlackHoleCube() {
textureWidth = 36;
@@ -17,10 +17,10 @@ import vazkii.botania.client.render.tile.RenderTileBrewery;
public class ModelBrewery extends ModelBase {
ModelRenderer Pole;
ModelRenderer Top;
ModelRenderer Bottom;
ModelRenderer Plate;
final ModelRenderer Pole;
final ModelRenderer Top;
final ModelRenderer Bottom;
final ModelRenderer Plate;
public ModelBrewery() {
textureWidth = 64;
@@ -14,9 +14,9 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
public class ModelCrystalCube extends ModelBase {
public ModelRenderer cube;
public ModelRenderer base1;
public ModelRenderer base2;
public final ModelRenderer cube;
public final ModelRenderer base1;
public final ModelRenderer base2;
public ModelCrystalCube() {
textureWidth = 48;
@@ -19,13 +19,13 @@ import java.awt.*;
public class ModelHourglass extends ModelBase {
public ModelRenderer ring;
public ModelRenderer base1;
public ModelRenderer base2;
public ModelRenderer glass1;
public ModelRenderer sand1;
public ModelRenderer glass2;
public ModelRenderer sand2;
public final ModelRenderer ring;
public final ModelRenderer base1;
public final ModelRenderer base2;
public final ModelRenderer glass1;
public final ModelRenderer sand1;
public final ModelRenderer glass2;
public final ModelRenderer sand2;
public ModelHourglass() {
textureWidth = 48;
@@ -17,9 +17,9 @@ import net.minecraft.util.math.MathHelper;
public class ModelPixie extends ModelBase {
ModelRenderer Body;
ModelRenderer LeftWing;
ModelRenderer RightWing;
final ModelRenderer Body;
final ModelRenderer LeftWing;
final ModelRenderer RightWing;
public ModelPixie() {
textureWidth = 64;
@@ -10,7 +10,6 @@
*/
package vazkii.botania.client.model;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import net.minecraft.client.Minecraft;
@@ -33,6 +32,7 @@ import org.lwjgl.opengl.GL11;
import vazkii.botania.api.state.enums.PylonVariant;
import java.util.List;
import java.util.function.Function;
public class ModelPylon implements IPylonModel {
@@ -61,19 +61,19 @@ public class ModelPylon implements IPylonModel {
// (OBJState constructor is derp, so the boolean condition is inverted - pass false to turn on a group)
// Turn on "Crystal"
manaCrystal = manaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER);
naturaCrystal = naturaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER);
gaiaCrystal = gaiaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER);
manaCrystal = manaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
naturaCrystal = naturaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
gaiaCrystal = gaiaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
// Turn on "Crystal_Ring", and "Ring_Panel0x"
manaRingsAndPanes = manaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal_Ring", "Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER);
naturaRingsAndPanes = naturaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal_Ring", "Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER);
gaiaRingsAndPanes = gaiaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal_Ring", "Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER);
manaRingsAndPanes = manaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal_Ring", "Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
naturaRingsAndPanes = naturaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal_Ring", "Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
gaiaRingsAndPanes = gaiaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal_Ring", "Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
// Turn on "Ring_Gem0x"
manaGems = manaModel.bake(new OBJModel.OBJState(ImmutableList.of("Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER);
naturaGems = naturaModel.bake(new OBJModel.OBJState(ImmutableList.of("Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER);
gaiaGems = gaiaModel.bake(new OBJModel.OBJState(ImmutableList.of("Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER);
manaGems = manaModel.bake(new OBJModel.OBJState(ImmutableList.of("Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
naturaGems = naturaModel.bake(new OBJModel.OBJState(ImmutableList.of("Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
gaiaGems = gaiaModel.bake(new OBJModel.OBJState(ImmutableList.of("Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
} catch(Exception e) {
throw new ReportedException(new CrashReport("Error making pylon submodels for TESR!", e));
}
@@ -16,22 +16,22 @@ import vazkii.botania.api.state.enums.PylonVariant;
public class ModelPylonOld extends ModelBase implements IPylonModel {
ModelRenderer crystal1;
ModelRenderer crystal2;
ModelRenderer crystal3;
ModelRenderer crystal4;
ModelRenderer crystal5;
ModelRenderer crystal6;
ModelRenderer crystal7;
ModelRenderer crystal8;
ModelRenderer outside1;
ModelRenderer outside2;
ModelRenderer outside3;
ModelRenderer outside4;
ModelRenderer outside5;
ModelRenderer outside6;
ModelRenderer outside7;
ModelRenderer outside8;
final ModelRenderer crystal1;
final ModelRenderer crystal2;
final ModelRenderer crystal3;
final ModelRenderer crystal4;
final ModelRenderer crystal5;
final ModelRenderer crystal6;
final ModelRenderer crystal7;
final ModelRenderer crystal8;
final ModelRenderer outside1;
final ModelRenderer outside2;
final ModelRenderer outside3;
final ModelRenderer outside4;
final ModelRenderer outside5;
final ModelRenderer outside6;
final ModelRenderer outside7;
final ModelRenderer outside8;
public ModelPylonOld() {
textureWidth = 64;
Loaded 100 of 429 files, more files were not shown because too many files have changed in this diff. Show more