Compare commits

...
129 Commits
Author SHA1 Message Date
Vincent Lee 779cc7604c Tweak corporea funnel behavior to accomodate 1.8 item frame changes. Closes #81. 2016-01-26 12:39:32 -06:00
Vincent Lee ad8cf9de8a Blockstate tweak in flowers, pick block fix for tall flowers 2016-01-26 12:18:23 -06:00
Vincent Lee 78308cdb01 Probably should have teh null check first. CLoses #73 2016-01-26 11:35:49 -06:00
Vincent Lee d203cf3fe4 Fix water bowls being unacquirable. Closes #75. 2016-01-26 11:28:39 -06:00
Vincent Lee 9c58319e68 Fix rod of the seas using faulty placement logic that's gone in 1.8. Closes #78. 2016-01-26 11:19:22 -06:00
Vincent Lee a7080b2439 Working! now need to smooth it out 2016-01-25 12:35:39 -06:00
Vincent Lee becc642b85 Animation now correct 2016-01-25 12:25:54 -06:00
Vincent Lee a94a86b9ce Minor hourglass optimization. Closes #76 2016-01-25 10:07:50 -06:00
Vincent Lee 4926137ff0 ITS ALIVE 2016-01-25 09:52:04 -06:00
Vincent Lee 67605075d8 More work on animation api 2016-01-25 09:38:04 -06:00
Vincent Lee 89e00c7ae8 First attempt at animation API 2016-01-25 00:19:04 -06:00
Vincent Lee 7601eecba3 Fix pylons not showing their fancy particles 2016-01-24 18:19:24 -06:00
Vincent Lee 0887f76575 Some cleanup in incense plate tesr, move red string tesr to fasttesr, remove life imbuer tesr 2016-01-24 18:10:41 -06:00
Vincent Lee 79210e484c Delete unneeded LibRenderIDs 2016-01-24 14:18:30 -06:00
Vincent Lee fddf546474 Cleanup and reformat: Delete all ISBRH's and IItemRenderers besides book, reformat to tabs in my new classes, add missing copylefts 2016-01-24 14:15:41 -06:00
Vincent Lee eb7a6aee50 Tweak the bandaid 2016-01-23 23:55:05 -06:00
Vincent Lee 5104ff52d6 Tweak to bandaid 2016-01-23 23:13:59 -06:00
Vincent Lee aee5b8c0c2 Revert "Giant annoying message to see where this happens"
This reverts commit 08fa70e25c.
2016-01-23 22:45:43 -06:00
Vincent Lee 08fa70e25c Giant annoying message to see where this happens 2016-01-23 22:41:20 -06:00
Vincent Lee ac72a5a660 Attempt number 991298 to patch the stupid client crash 2016-01-23 22:36:49 -06:00
Vincent Lee 400bf95a44 Fix some lingering GoG worldgen and rendering issues. Closes #8. 2016-01-23 16:56:30 -06:00
Vincent Lee ba3d9ff9f8 Update garden of glass 2016-01-23 16:44:34 -06:00
Vincent Lee b3a140b8dd Temporary bandaid for thaumcraft brew integration. Closes #69. 2016-01-23 12:50:47 -06:00
Vincent Lee fabedeb31a Bump forge version, improve brewery JEI integration 2016-01-23 12:22:33 -06:00
Vincent Lee 2a738209b7 Revert "Tentative fix for multiblock transparency"
This reverts commit 03cfbfa73e.
2016-01-22 23:47:41 -06:00
Vincent Lee 03cfbfa73e Tentative fix for multiblock transparency 2016-01-22 23:28:46 -06:00
Vincent Lee eece9a08c1 Actually commit spreader blockstate json 2016-01-22 23:20:04 -06:00
Vincent Lee e5ee04113f placeholder model for spreader so it shows in JEI. make monocle use blockstates like it should 2016-01-22 22:32:02 -06:00
Vincent Lee 4bf8fd3b98 Remove some unused states from tiny potato 2016-01-22 21:18:54 -06:00
Vincent Lee 09fb64982a A bunch of more baubles 2016-01-22 20:42:12 -06:00
Vincent Lee b012f5152d Fix fab pools not being special snowflakes (colors same between all) 2016-01-21 23:14:45 -06:00
Vincent Lee 540baa4152 A little debug thign 2016-01-21 23:06:24 -06:00
Vincent Lee 77cd24b58a Merge upstream 2016-01-21 22:04:45 -06:00
Vincent Lee 98620bb1c5 Serverside the distributor. Closes #63 2016-01-21 21:30:22 -06:00
Vincent Lee 071bcefa6f Anotehr hoepful bandaid for all the clientside crashes 2016-01-21 21:23:23 -06:00
Vincent Lee 2a077adb6f Safeguard in the smartmodels. Closes #66 2016-01-21 21:21:26 -06:00
Vincent Lee 3d821e5da4 Fix some recipes not taking vanilla prismarine. closes #62 2016-01-21 21:16:00 -06:00
TheWhiteWolves 275729d54e Popped a null check in onEquipped() to ensure player isn't null, hopefully helps with Issue #1757 2016-01-21 23:13:41 +00:00
TheWhiteWolves adc06dc6ce Added a blacklist to the Rod of the Shaded Mesa 2016-01-21 22:46:02 +00:00
Vincent Lee 5991387f22 Actually close #59 2016-01-20 21:35:14 -06:00
Vincent Lee d0e4e436ad MOve recipes to init and remove thaumcraft after requirement. CLoses #53 2016-01-20 19:52:38 -06:00
Vincent Lee 27be487b7e Add a gradlew.bat. Closes #56 2016-01-20 19:15:46 -06:00
Vincent Lee 36976e6321 Fix divining rod looking up blocks with no item form in the OD. CLoses #57 2016-01-20 19:12:22 -06:00
Vincent Lee a6d89e3d4d Fix thorn chakram impact crash. Closes #59 2016-01-20 19:08:48 -06:00
Vincent Lee ab3bc85f20 Fix magic missile crash. closes #54 2016-01-20 19:07:29 -06:00
Jonathan Smith d8a46650ee Merge pull request #1762 from NatsuArashi/patch-14
Update zh_TW.lang
2016-01-19 14:26:26 +00:00
NatsuArashi 177c5b1d1b Update zh_TW.lang
FIX SOMETHING...?
2016-01-19 19:31:17 +08:00
Vincent Lee ebf399edaa Most body based cosmetic baubles 2016-01-18 17:08:31 -06:00
Vincent Lee 4448a6a498 Blood, ice, lava, super lava pendants and itemfinder bauble renders 2016-01-18 15:41:55 -06:00
Vincent Lee a13d6fca53 Sideonly some things 2016-01-18 15:16:48 -06:00
Vincent Lee fef9f1b406 Flugel tiara bauble render 2016-01-18 15:12:57 -06:00
Vincent Lee 86ce88f068 Diva charm and golden laurel baubles render 2016-01-18 14:55:28 -06:00
Vincent Lee 9b2fa9de65 Monocle baubles render 2016-01-18 14:11:21 -06:00
Vincent Lee f87e2373f8 Tiny planet bauble render 2016-01-18 13:22:54 -06:00
Vincent Lee 4df1d500ed Remove unnecessary face from creative pool item json 2016-01-18 12:45:52 -06:00
Vincent Lee cec10471fb Fix two multiblock crashes, closes #48 2016-01-18 12:15:56 -06:00
Vincent Lee 177f50ca61 Bandaid for more client chunk unload crashes >.> 2016-01-18 11:45:07 -06:00
Vincent Lee e184394f55 Fix mana tablets and terrasteel helm will rendering 2016-01-18 11:30:13 -06:00
Vincent Lee eb28396d98 Fully fix contributor fanciness renders. Fix mana gun not being held like a tool in third person 2016-01-18 10:31:05 -06:00
Jonathan Smith 089c8c674c Merge pull request #1760 from Eladkay/patch-3
Fixed license link in FAQ page.
2016-01-18 16:14:45 +00:00
Eladkay 2df3b356fd Fixed license link in FAQ page.
If issue is not obvious: https://gyazo.com/c4657c529a337f37a3c67925e8e5e61e
2016-01-18 15:00:17 +02:00
Vincent Lee dda3151b73 Fix piston lens not working properly. Serverside some of the other lenses where safe 2016-01-17 17:30:01 -06:00
Vincent Lee 4e5cb59ebe Fix crash and possible desync in flash lens. Closes #47 2016-01-17 16:41:37 -06:00
Vincent Lee fef0857603 Desert, forest, fungal apothecary textures 2016-01-17 16:31:01 -06:00
TheWhiteWolves a6896f250f bump API version 2016-01-17 14:51:51 +00:00
TheWhiteWolves d431207eec Change to use API version of disposable blocks and implement semi-disposable 2016-01-17 14:51:39 +00:00
TheWhiteWolves c0e7353192 Move disposable blocks list to API and add hook and semi disposable list 2016-01-17 14:50:50 +00:00
Vincent Lee 8922ad5362 Use the non-insane calendar API 2016-01-16 18:38:22 -06:00
Vincent Lee be2b66dddf Partially restore bauble rendering. Everything is probably in the wrong place, but should render. 2016-01-16 18:25:31 -06:00
Vincent Lee 6e870f4e79 Remove some leftover debug messages 2016-01-16 16:57:51 -06:00
Vincent Lee 4d4ba74ac1 Fix ender air bottle event handler not being registered, closes #44 2016-01-16 16:56:17 -06:00
Vincent Lee 5e3345a1d7 Fix terra pick and elementium shovel not working correctly. Closes #43 2016-01-16 13:37:18 -06:00
Vincent Lee 568ee043df God dammit 2016-01-16 12:33:05 -06:00
Jonathan Smith f2eea3ce92 Merge pull request #1754 from blacksmithgu/swapper-sides
Bugfix followup - Block swappers use sidedness to control concurrency
2016-01-16 11:19:02 +00:00
Vincent Lee a615538289 Stop spamming packets when done digesting 2016-01-16 02:07:18 -06:00
Vincent Lee 7907d1d582 Fix passives decaying directly into nothing instead of a dead bush 2016-01-16 01:57:31 -06:00
Vincent Lee 46900df6cb Serverside gourmaryllis 2016-01-16 01:42:07 -06:00
Vincent Lee 1d8c536139 Fix pool minecart rendery fully 2016-01-15 21:48:29 -06:00
Vincent Lee eb028d6c05 Fully fix mana pool models 2016-01-15 21:20:49 -06:00
Michael Brenan 24cf30a29e Bugfix followup - Block swappers use sidedness to control concurrency 2016-01-15 18:28:06 -06:00
Jonathan Smith 5bc520368d Merge pull request #1752 from blacksmithgu/patch-1749
Fix #1749 - Mana Tablets no longer lose durability in storage drawer
2016-01-15 21:28:32 +00:00
Vincent Lee 406f89a968 Cleanup, implement some easter egg models I missed 2016-01-15 14:14:10 -06:00
Vincent Lee 2c15b6150c Lots of MOP guards. closes #41 2016-01-15 11:27:32 -06:00
Vincent Lee bee13337ad Made laputa shard save string block id's instead of integer id's. Also, a possible fix for #40 2016-01-15 10:56:23 -06:00
Michael Brenan 54f1dd0478 Fix #1749 - Mana Tablets no longer lose durability in storage drawer 2016-01-15 03:26:31 -06:00
Jonathan Smith b7c0c12e5b Merge pull request #1750 from blacksmithgu/swapper-concurrency
Add preemptive bugfix - Swappers now threadsafe
2016-01-15 09:09:26 +00:00
Michael Brenan 5438138c93 Add preemptive bugfix - Swappers now threadsafe 2016-01-14 22:56:01 -06:00
Vincent Lee 98e28a0967 Made some things one sided only 2016-01-14 22:44:50 -06:00
Vincent Lee 4a4e583aa8 Fix wonky petal apothecary collision 2016-01-14 21:53:18 -06:00
Vincent Lee 300b1926de Possible fix for #38 2016-01-14 17:20:05 -06:00
Vincent Lee 3818d2879d no longer register gaia tesr onto vanilla skulls 2016-01-14 16:47:48 -06:00
Vincent Lee e12163f70c Merge upstream 2016-01-14 16:40:14 -06:00
Vincent Lee dcb236607d Fix hopperhock placing items one block too far away. Closes #39 2016-01-14 12:08:57 -06:00
Vincent Lee 08de553593 No longer use the raw potion array, use potio registry 2016-01-14 11:54:08 -06:00
Jonathan Smith f6bf6589ad Merge pull request #1743 from yrsegal/master
IslandTypes can now be added by addons
2016-01-14 16:59:20 +00:00
Jonathan Smith da43dd8ca0 Merge pull request #1748 from blacksmithgu/patch-1722
Hotfix #1722 - Allow client to control sash speedup and slowdown
2016-01-14 16:55:01 +00:00
Jonathan Smith fdd1ad8d4e Merge pull request #1747 from blacksmithgu/patch-1726
Fix #1726 - Accessories on other players now render in the proper position
2016-01-14 16:54:53 +00:00
Jonathan Smith d4dd4cf42f Merge pull request #1746 from blacksmithgu/gaia-head
Clean up common/item/ItemGaiaHead.java
2016-01-14 16:54:46 +00:00
Michael Brenan 0595397943 Hotfix #1722 - Allow client to control sash speedup and slowdown 2016-01-13 23:07:47 -06:00
Michael Brenan d0faf3c3c6 Fix #1726 - Accessories on other players now render in the proper position 2016-01-13 22:53:21 -06:00
Vincent Lee b01e9dfed7 Staging changes would be a good idea. Also fix possible potion crash 2016-01-13 17:14:12 -06:00
yrsegal cbac5fbb32 IslandTypes can now be added by addons 2016-01-13 17:44:47 -05:00
Michael Brenan f5210997ca Clean up common/item/ItemGaiaHead.java 2016-01-13 16:21:47 -06:00
Vincent Lee 4b7608fc2a Add nag that this is unofficial right now 2016-01-13 14:13:19 -06:00
Vincent Lee 103efe9c7b Destitch cocoon texmap 2016-01-13 12:54:02 -06:00
Vincent Lee 1402e2a50a Start work on destitching apothecary texmaps 2016-01-13 12:37:15 -06:00
Vincent Lee c8d9764fe3 Read atlas size dynamically 2016-01-13 10:59:10 -06:00
Jonathan Smith d3055c4c4d Merge pull request #1742 from blacksmithgu/patch-1700
Fix #1700 - Terra Axe strictly follow 32 block range and leaf logic
2016-01-13 12:24:40 +00:00
Jonathan Smith c94df0bf67 Merge pull request #1738 from blacksmithgu/master
Fix #1728 - Grass seeds will not spread to dirt/grass blocks under other blocks
2016-01-13 12:24:32 +00:00
Michael Brenan 4abb2cdd89 Fix #1700 - Terra Axe strictly follow 32 block range and leaf logic 2016-01-13 03:42:32 -06:00
Jonathan Smith cabcab80e2 Merge pull request #1739 from blacksmithgu/patch-1724
Fix #1724 - Slabs and snow don't prevent Rod of Shifting Crust replacement
2016-01-13 09:36:21 +00:00
Vincent Lee 3e19a84b6d Fix terra shatterer tooltip darkening screen. Closes #37 2016-01-13 00:42:32 -06:00
Vincent Lee a30887d6f9 Debug thing for me, to dump the texture atlas 2016-01-13 00:02:18 -06:00
Vincent Lee 80bd63be0b Bunch of TE particle textures. Fix a bellows crash and teru teru bozu not working with sunflower 2016-01-12 23:27:36 -06:00
Vincent Lee 6c9a01978a Cocoon of caprice model 2016-01-12 15:04:08 -06:00
Vincent Lee 19e387f359 Fix off by one in forest drum meta to state 2016-01-12 13:58:19 -06:00
Vincent Lee f799f7bc32 Revert "Trying to render AO pool"
This reverts commit d8a74e2e44.
2016-01-12 12:00:29 -06:00
Jonathan Smith a2f1776245 Merge pull request #1735 from yrsegal/master
Make baubles able to IBlockProvide
2016-01-12 12:59:05 +00:00
yrsegal c20247b680 Baubles now able to IBlockProvide
This allows for things like Botanical Addons’ Toolbelt to provide from
the tools in them while worn.
2016-01-12 07:47:30 -05:00
Jonathan Smith a7000e8a47 Add Material.gourd to Axe materials.
Closes #1732. 

Allows use of the quickest mining tool for items with Material.gourd (Pumpkins, Melons, etc.)
2016-01-12 12:12:20 +00:00
Michael Brenan ac88d0627a Fix #1724 - Slabs and snow prevent Rod of Shifting Crust replacement 2016-01-12 01:32:15 -06:00
Vincent Lee d8a74e2e44 Trying to render AO pool 2016-01-11 20:06:59 -06:00
Michael Brenan cbcc49b896 Fix #1728 - Pasture seed grass spreading obeys grass block growth rules 2016-01-11 18:28:01 -06:00
Vincent Lee 30578abfb4 Merge pull request #36 from GirafiStudios/MC18
Fixed special named Tiny Potatoes. (Besides Ible)
2016-01-11 17:14:30 -06:00
GirafiStudios a172a325e1 Fixed named Tiny Potatoes rendering (Besides Ible) 2016-01-11 23:45:43 +01:00
Vasco Lavos b7975401b3 Merge pull request #1727 from yrsegal/master
Make CanFit (IFlowerComponent) affect items fitting into petal apothecary
2016-01-09 22:36:57 +00:00
yrsegal f641e165b0 actually call canFit 2016-01-09 17:35:14 -05:00
Jonathan Smith 7e5974cd7c Merge pull request #1721 from AlterAkima/patch-2
Brew related pages
2016-01-08 21:33:08 +00:00
Patric Alexandre 753a03b291 Brew relataded pages 2016-01-08 14:04:34 -03:00
352 changed files with 4773 additions and 4408 deletions

No files matched your search

BIN
View File
Binary file not shown.
+1 -1
View File
@@ -2,7 +2,7 @@
#Fri Jan 08 18:17:27 GMT 2016
version=r1.8
dir_output=../Build Output/Botania/
forge_version=11.15.0.1688
forge_version=11.15.0.1715
mc_version=1.8.9
dir_repo=./
build_number=249
Vendored Executable
+90
View File
@@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@@ -18,9 +18,14 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import net.minecraft.block.*;
import net.minecraft.block.BlockCarpet;
import net.minecraft.block.BlockColored;
import net.minecraft.block.BlockStainedGlass;
import net.minecraft.block.BlockStainedGlassPane;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor;
@@ -67,7 +72,10 @@ public final class BotaniaAPI {
public static Map<String, KnowledgeType> knowledgeTypes = new HashMap<>();
public static Map<String, Brew> brewMap = new LinkedHashMap<>();
public static Map<String, Brew> brewMap = new LinkedHashMap<String, Brew>();
public static List<String> disposableBlocks = new ArrayList<String>();
public static List<String> semiDisposableBlocks = new ArrayList<String>();
public static List<RecipePetals> petalRecipes = new ArrayList<>();
public static List<RecipePureDaisy> pureDaisyRecipes = new ArrayList<>();
@@ -90,6 +98,7 @@ public final class BotaniaAPI {
public static Set<Item> looniumBlacklist = new LinkedHashSet<>();
public static Map<Block, PropertyEnum<EnumDyeColor>> paintableBlocks = new LinkedHashMap<>();
public static Set<String> magnetBlacklist = new LinkedHashSet<>();
public static Set<Class<? extends Entity>> gravityRodBlacklist = new LinkedHashSet<Class<? extends Entity>>();
public static ArmorMaterial manasteelArmorMaterial = EnumHelper.addArmorMaterial("MANASTEEL", "manasteel", 16, new int[] { 2, 6, 5, 2 }, 18);
@@ -241,6 +250,16 @@ public final class BotaniaAPI {
registerPaintableBlock(Blocks.stained_hardened_clay, BlockColored.COLOR);
registerPaintableBlock(Blocks.wool, BlockColored.COLOR);
registerPaintableBlock(Blocks.carpet, BlockCarpet.COLOR);
registerDisposableBlock("dirt"); // Vanilla
registerDisposableBlock("sand"); // Vanilla
registerDisposableBlock("gravel"); // Vanilla
registerDisposableBlock("cobblestone"); // Vanilla
registerDisposableBlock("netherrack"); // Vanilla
registerSemiDisposableBlock("stoneAndesite"); // Vanilla
registerSemiDisposableBlock("stoneBasalt"); // Vanilla
registerSemiDisposableBlock("stoneDiorite"); // Vanilla
registerSemiDisposableBlock("stoneGranite"); // Vanilla
}
/**
@@ -280,6 +299,21 @@ public final class BotaniaAPI {
return fallbackBrew;
}
/*
* Registers a Block as disposable using its Ore Dictionary Name.
*/
public static void registerDisposableBlock(String oreDictName) {
disposableBlocks.add(oreDictName);
}
/*
* Registers a Block as semi disposable using its Ore Dictionary Name.
* This means it will not be trashed when sneaking.
*/
public static void registerSemiDisposableBlock(String oreDictName) {
semiDisposableBlocks.add(oreDictName);
}
/**
* Registers a paintableBlock and returns it.
* You must also provide the PropertyEnum that this block uses to express its color
@@ -290,6 +324,22 @@ public final class BotaniaAPI {
return paintable;
}
/*
* Blacklists an Entity from being affected by the Rod of the Shaded Mesa.
* Pass in the class for the Entity, e.g. EntityCow.class
*/
public static void blacklistEntityFromGravityRod(Class entity) {
gravityRodBlacklist.add(entity);
}
/*
* Checks if the provided Entity is contained in the Blacklist.
* Pass in the class for the Entity, e.g. entity.getClass()
*/
public static boolean isEntityBlacklistedFromGravityRod(Class entity) {
return gravityRodBlacklist.contains(entity);
}
/**
* Blacklists an item from being pulled by the Ring of Magnetization.
* Short.MAX_VALUE can be used as the stack's damage for a wildcard.
@@ -1,9 +1,21 @@
/**
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.api;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.LoaderState;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.item.IFloatingFlower;
import vazkii.botania.api.subtile.SubTileEntity;
import java.util.Collections;
@@ -15,60 +27,82 @@ import java.util.Map;
@SideOnly(Side.CLIENT)
public final class BotaniaAPIClient {
private static final Map<String, ModelResourceLocation> queuedBlockModels = Maps.newHashMap();
private static final Map<String, ModelResourceLocation> queuedItemModels = Maps.newHashMap();
private static final Map<String, ModelResourceLocation> subtileBlockModels = Maps.newHashMap();
private static final Map<String, ModelResourceLocation> subtileItemModels = Maps.newHashMap();
private static final Map<IFloatingFlower.IslandType, ModelResourceLocation> islandTypeModels = Maps.newHashMap();
/**
* Register your model for the given subtile class here.
* Call this DURING PREINIT. Calling it anytime after blockModels have already baked does not guarantee that your model will work.
* Your model json must specify key "tintindex" in all the faces it wants tint applied.
* Tint is applied whenever a player recolors the flower using floral dye
*
* @param subTileName The String ID of the subtile
* @param model A path to a blockstate json and variant to be used for this subtile
* @param itemModel A path to a blockstate json and variant to be used for this subtile's item form
*/
public static void registerSubtileModel(String subTileName, ModelResourceLocation model, ModelResourceLocation itemModel) {
queuedBlockModels.put(subTileName, model);
queuedItemModels.put(subTileName, itemModel);
}
private BotaniaAPIClient() {
}
/**
* Register your model for the given subtile class here.
* Call this DURING PREINIT. Calling it anytime after blockModels have already baked does not guarantee that your model will work.
* Your model json must specify key "tintindex" in all the faces it wants tint applied.
* Tint is applied whenever a player recolors the flower using floral dye
*
* @param subTileName The String ID of the subtile
* @param model A path to a blockstate json and variant to be used the block. The item model will be drawn from the same blockstate json, from variant "inventory"
*/
public static void registerSubtileModel(String subTileName, ModelResourceLocation model) {
registerSubtileModel(subTileName, model, new ModelResourceLocation(model.getResourceDomain() + ":" + model.getResourcePath(), "inventory"));
}
/**
* Register your model for the given subtile class here.
* Call this DURING PREINIT. Calling it anytime after blockModels have already baked does not guarantee that your model will work.
* Your model json must specify key "tintindex" in all the faces it wants tint applied.
* Tint is applied whenever a player recolors the flower using floral dye
*
* @param subTileName The String ID of the subtile
* @param model A path to a blockstate json and variant to be used for this subtile
* @param itemModel A path to a blockstate json and variant to be used for this subtile's item form
*/
public static void registerSubtileModel(String subTileName, ModelResourceLocation model, ModelResourceLocation itemModel) {
Preconditions.checkState(Loader.instance().isInState(LoaderState.PREINITIALIZATION));
subtileBlockModels.put(subTileName, model);
subtileItemModels.put(subTileName, itemModel);
}
// Convenience overloads for the above two calls
public static void registerSubtileModel(Class<? extends SubTileEntity> clazz, ModelResourceLocation model) {
registerSubtileModel(BotaniaAPI.getSubTileStringMapping(clazz), model);
}
/**
* Register your model for the given subtile class here.
* Call this DURING PREINIT.
* Your model json must specify key "tintindex" in all the faces it wants tint applied.
* Tint is applied whenever a player recolors the flower using floral dye
*
* @param subTileName The String ID of the subtile
* @param model A path to a blockstate json and variant to be used the block. The item model will be drawn from the same blockstate json, from variant "inventory"
*/
public static void registerSubtileModel(String subTileName, ModelResourceLocation model) {
registerSubtileModel(subTileName, model, new ModelResourceLocation(model.getResourceDomain() + ":" + model.getResourcePath(), "inventory"));
}
public static void registerSubtileModel(Class<? extends SubTileEntity> clazz, ModelResourceLocation model, ModelResourceLocation itemModel) {
registerSubtileModel(BotaniaAPI.getSubTileStringMapping(clazz), model, itemModel);
}
// Convenience overloads for the above two calls
public static void registerSubtileModel(Class<? extends SubTileEntity> clazz, ModelResourceLocation model) {
registerSubtileModel(BotaniaAPI.getSubTileStringMapping(clazz), model);
}
/**
* @return An immutable view of the registered subtile block model map
*/
public static Map<String, ModelResourceLocation> getRegisteredSubtileBlockModels() {
return Collections.unmodifiableMap(queuedBlockModels);
}
public static void registerSubtileModel(Class<? extends SubTileEntity> clazz, ModelResourceLocation model, ModelResourceLocation itemModel) {
registerSubtileModel(BotaniaAPI.getSubTileStringMapping(clazz), model, itemModel);
}
/**
* @return An immutable view of the registered subtile item model map
*/
public static Map<String, ModelResourceLocation> getRegisteredSubtileItemModels() {
return Collections.unmodifiableMap(queuedItemModels);
}
/**
* @return An immutable and live view of the registered subtile block model map
*/
public static Map<String, ModelResourceLocation> getRegisteredSubtileBlockModels() {
return Collections.unmodifiableMap(subtileBlockModels);
}
private BotaniaAPIClient() {}
/**
* @return An immutable and live view of the registered subtile item model map
*/
public static Map<String, ModelResourceLocation> getRegisteredSubtileItemModels() {
return Collections.unmodifiableMap(subtileItemModels);
}
/**
* Registers your model for island type islandType here.
* Call this DURING PREINIT.
*
* @param islandType The islandtype to register
* @param model The variant within a blockstate json to use as the islandtype's model
*/
public static void registerIslandTypeModel(IFloatingFlower.IslandType islandType, ModelResourceLocation model) {
Preconditions.checkState(Loader.instance().isInState(LoaderState.PREINITIALIZATION));
islandTypeModels.put(islandType, model);
}
/**
* @return An immutable and live view of the registered island type model map
*/
public static Map<IFloatingFlower.IslandType, ModelResourceLocation> getRegisteredIslandTypeModels() {
return Collections.unmodifiableMap(islandTypeModels);
}
}
@@ -13,7 +13,6 @@ package vazkii.botania.api.item;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -34,7 +33,7 @@ public interface IBaubleRender {
* has a cosmetic bauble attached to it.
*/
@SideOnly(Side.CLIENT)
public void onPlayerBaubleRender(ItemStack stack, RenderPlayerEvent event, RenderType type);
public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks);
/**
* A few helper methods for the render.
@@ -51,7 +50,7 @@ public interface IBaubleRender {
}
public static void translateToHeadLevel(EntityPlayer player) {
GlStateManager.translate(0, -player.getDefaultEyeHeight() + (player.isSneaking() ? 0.0625 : 0), 0);
GlStateManager.translate(0, -player.getDefaultEyeHeight() + (player.isSneaking() ? 0.25 : 0), 0);
}
}
@@ -0,0 +1,63 @@
/**
* 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 @ [Nov 17, 2014, 6:05:18 PM (GMT)]
*/
package vazkii.botania.api.item;
import net.minecraft.item.ItemStack;
import java.util.HashMap;
public interface IFloatingFlower {
public ItemStack getDisplayStack();
public IslandType getIslandType();
public void setIslandType(IslandType type);
public class IslandType {
private static HashMap<String, IslandType> registry = new HashMap<String, IslandType>();
public static final IslandType GRASS = new IslandType("GRASS");
public static final IslandType PODZOL = new IslandType("PODZOL");
public static final IslandType MYCEL = new IslandType("MYCEL");
public static final IslandType SNOW = new IslandType("SNOW");
public static final IslandType DRY = new IslandType("DRY");
public static final IslandType GOLDEN = new IslandType("GOLDEN");
public static final IslandType VIVID = new IslandType("VIVID");
public static final IslandType SCORCHED = new IslandType("SCORCHED");
public static final IslandType INFUSED = new IslandType("INFUSED");
public static final IslandType MUTATED = new IslandType("MUTATED");
/**
* Instantiates and registers a new floating flower island type
* Note that you need to register the model for this island type, see BotaniaAPIClient
* @param name The name of this floating flower island type
*/
public IslandType(String name) {
if (registry.containsKey(name)) throw new IllegalArgumentException(name+" already registered!");
this.typeName = name;
registry.put(name, this);
}
public final String typeName;
public static IslandType ofType(String typeStr) {
IslandType type = registry.get(typeStr);
return type == null ? GRASS : type;
}
@Override
public String toString() {
return this.typeName;
}
}
}
@@ -25,14 +25,15 @@ public class TinyPotatoRenderEvent extends Event {
public final String name;
public final double x, y, z;
public final float partTicks;
public final int destroyStage;
public TinyPotatoRenderEvent(TileEntity tile, String name, double x, double y, double z, float partTicks) {
public TinyPotatoRenderEvent(TileEntity tile, String name, double x, double y, double z, float partTicks, int destroyStage) {
this.tile = tile;
this.name = name;
this.x = x;
this.y = y;
this.z = z;
this.partTicks = partTicks;
this.destroyStage = destroyStage;
}
}
}
@@ -13,6 +13,8 @@ package vazkii.botania.api.mana;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* A block that implements this can provide an IIcon (block icons only)
@@ -21,6 +23,7 @@ import net.minecraft.world.World;
*/
public interface IPoolOverlayProvider {
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIcon(World world, BlockPos pos);
}
@@ -1,4 +1,4 @@
@API(owner = "Botania", apiVersion = "75", provides = "BotaniaAPI")
@API(owner = "Botania", apiVersion = "76", provides = "BotaniaAPI")
package vazkii.botania.api;
import net.minecraftforge.fml.common.API;
@@ -2,13 +2,12 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.api.state;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import net.minecraft.block.BlockRailBase;
import net.minecraft.block.BlockRailPowered;
@@ -16,8 +15,10 @@ import net.minecraft.block.BlockRotatedPillar;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.util.EnumFacing;
import vazkii.botania.api.item.IFloatingFlower;
import vazkii.botania.api.state.enums.*;
/**
@@ -25,133 +26,131 @@ import vazkii.botania.api.state.enums.*;
*/
public class BotaniaStateProps {
/** Unlisted properties **/
/** Unlisted properties **/
// The property for specialFlower subtile id
public static final PropertyString SUBTILE_ID = new PropertyString("subtile_id");
// The property for specialFlower subtile id
public static final PropertyObject<String> SUBTILE_ID = new PropertyObject<>("subtile_id", String.class);
// The property for platform held blockstate id
public static final PropertyState HELD_STATE = new PropertyState("held_state");
// The property for floating flower island type
public static final PropertyObject<IFloatingFlower.IslandType> ISLAND_TYPE = new PropertyObject<>("islandtype", IFloatingFlower.IslandType.class);
/** Common properties to all blocks to use **/
// The property for platform held blockstate id
public static final PropertyObject<IBlockState> HELD_STATE = new PropertyObject<>("held_state", IBlockState.class);
// The 16 Minecraft colors
public static final PropertyEnum<EnumDyeColor> COLOR = PropertyEnum.create("color", EnumDyeColor.class);
/** Common properties to all blocks to use **/
// The four cardinal directions
public static final PropertyEnum<EnumFacing> CARDINALS = PropertyEnum.create("facing", EnumFacing.class, EnumFacing.Plane.HORIZONTAL);
// The 16 Minecraft colors
public static final PropertyEnum<EnumDyeColor> COLOR = PropertyEnum.create("color", EnumDyeColor.class);
// All 6 directions
public static final PropertyEnum<EnumFacing> FACING = PropertyEnum.create("facing", EnumFacing.class);
// The four cardinal directions
public static final PropertyEnum<EnumFacing> CARDINALS = PropertyEnum.create("facing", EnumFacing.class, EnumFacing.Plane.HORIZONTAL);
// Redstone power - boolean
// Also for any other simple boolean "on/off" state
public static final PropertyBool POWERED = PropertyBool.create("powered");
// All 6 directions
public static final PropertyEnum<EnumFacing> FACING = PropertyEnum.create("facing", EnumFacing.class);
// Redstone power - int
public static final PropertyInteger POWER = PropertyInteger.create("power", 0, 15);
// Redstone power - boolean
// Also for any other simple boolean "on/off" state
public static final PropertyBool POWERED = PropertyBool.create("powered");
/** Properties for certain kinds of blocks **/
/** Properties for certain kinds of blocks **/
// The axis directions (think quartz pillars and wood logs)
public static final PropertyEnum<EnumFacing.Axis> AXIS_FACING = BlockRotatedPillar.AXIS;
// The axis directions (think quartz pillars and wood logs)
public static final PropertyEnum<EnumFacing.Axis> AXIS_FACING = BlockRotatedPillar.AXIS;
// Extra Quartz Blocks
public static final PropertyEnum<QuartzVariant> QUARTZ_VARIANT = PropertyEnum.create("variant", QuartzVariant.class);
// Extra Quartz Blocks
public static final PropertyEnum<QuartzVariant> QUARTZ_VARIANT = PropertyEnum.create("variant", QuartzVariant.class);
/** Properties for individual blocks **/
/** Properties for individual blocks **/
// Block18Stone
public static final PropertyEnum<FutureStoneVariant> FUTURESTONE_VARIANT = PropertyEnum.create("variant", FutureStoneVariant.class);
// Block18Stone
public static final PropertyEnum<FutureStoneVariant> FUTURESTONE_VARIANT = PropertyEnum.create("variant", FutureStoneVariant.class);
// Block18StoneWall
public static final PropertyEnum<FutureStoneVariant> FUTURESTONEWALL_VARIANT = PropertyEnum.create("variant", FutureStoneVariant.class, variant -> {
// Just the four kinds (no polished, chiseled, etc.)
return variant.ordinal() >= 0 && variant.ordinal() <= 3;
});
// Block18StoneWall
public static final PropertyEnum<FutureStoneVariant> FUTURESTONEWALL_VARIANT = PropertyEnum.create("variant", FutureStoneVariant.class, variant -> {
// Just the four kinds (no polished, chiseled, etc.)
return variant.ordinal() >= 0 && variant.ordinal() <= 3;
});
// BlockAlfPortal
public static final PropertyEnum<AlfPortalState> ALFPORTAL_STATE = PropertyEnum.create("state", AlfPortalState.class);
// BlockAlfPortal
public static final PropertyEnum<AlfPortalState> ALFPORTAL_STATE = PropertyEnum.create("state", AlfPortalState.class);
// BlockAltar
public static final PropertyEnum<AltarVariant> ALTAR_VARIANT = PropertyEnum.create("variant", AltarVariant.class);
// BlockAltar
public static final PropertyEnum<AltarVariant> ALTAR_VARIANT = PropertyEnum.create("variant", AltarVariant.class);
// BlockAltGrass
public static final PropertyEnum<AltGrassVariant> ALTGRASS_VARIANT = PropertyEnum.create("variant", AltGrassVariant.class);
// BlockAltGrass
public static final PropertyEnum<AltGrassVariant> ALTGRASS_VARIANT = PropertyEnum.create("variant", AltGrassVariant.class);
// BlockBiomeStoneA
public static final PropertyEnum<BiomeStoneVariant> BIOMESTONE_VARIANT = PropertyEnum.create("variant", BiomeStoneVariant.class);
// BlockBiomeStoneA
public static final PropertyEnum<BiomeStoneVariant> BIOMESTONE_VARIANT = PropertyEnum.create("variant", BiomeStoneVariant.class);
// BlockBiomeStoneB
public static final PropertyEnum<BiomeBrickVariant> BIOMEBRICK_VARIANT = PropertyEnum.create("variant", BiomeBrickVariant.class);
// BlockBiomeStoneB
public static final PropertyEnum<BiomeBrickVariant> BIOMEBRICK_VARIANT = PropertyEnum.create("variant", BiomeBrickVariant.class);
// BlockBiomeStoneWall
public static final PropertyEnum<BiomeStoneVariant> BIOMESTONEWALL_VARIANT = PropertyEnum.create("variant", BiomeStoneVariant.class, input -> input.getName().contains("cobble"));
// BlockBiomeStoneWall
public static final PropertyEnum<BiomeStoneVariant> BIOMESTONEWALL_VARIANT = PropertyEnum.create("variant", BiomeStoneVariant.class, input -> input.getName().contains("cobble"));
// BlockCustomBrick
public static final PropertyEnum<CustomBrickVariant> CUSTOMBRICK_VARIANT = PropertyEnum.create("variant", CustomBrickVariant.class);
// BlockCustomBrick
public static final PropertyEnum<CustomBrickVariant> CUSTOMBRICK_VARIANT = PropertyEnum.create("variant", CustomBrickVariant.class);
// BlockDreamWood, BlockLivingWood
public static final PropertyEnum<LivingWoodVariant> LIVINGWOOD_VARIANT = PropertyEnum.create("variant", LivingWoodVariant.class);
// BlockDreamWood, BlockLivingWood
public static final PropertyEnum<LivingWoodVariant> LIVINGWOOD_VARIANT = PropertyEnum.create("variant", LivingWoodVariant.class);
// BlockEnchanter
public static final PropertyEnum<EnumFacing.Axis> ENCHANTER_DIRECTION = PropertyEnum.create("facing", EnumFacing.Axis.class, Predicates.not(Predicates.equalTo(EnumFacing.Axis.Y)));
// BlockEnchanter
public static final PropertyEnum<EnumFacing.Axis> ENCHANTER_DIRECTION = PropertyEnum.create("facing", EnumFacing.Axis.class, Predicates.not(Predicates.equalTo(EnumFacing.Axis.Y)));
// BlockEndStoneBrick
public static final PropertyEnum<EndBrickVariant> ENDBRICK_VARIANT = PropertyEnum.create("variant", EndBrickVariant.class);
// BlockEndStoneBrick
public static final PropertyEnum<EndBrickVariant> ENDBRICK_VARIANT = PropertyEnum.create("variant", EndBrickVariant.class);
// BlockForestDrum
public static final PropertyEnum<DrumVariant> DRUM_VARIANT = PropertyEnum.create("variant", DrumVariant.class);
// BlockForestDrum
public static final PropertyEnum<DrumVariant> DRUM_VARIANT = PropertyEnum.create("variant", DrumVariant.class);
// BlockGhostRail
public static final PropertyEnum<BlockRailBase.EnumRailDirection> RAIL_DIRECTION = BlockRailPowered.SHAPE;
// BlockGhostRail
public static final PropertyEnum<BlockRailBase.EnumRailDirection> RAIL_DIRECTION = BlockRailPowered.SHAPE;
// BlockLightRelay
public static final PropertyEnum<LuminizerVariant> LUMINIZER_VARIANT = PropertyEnum.create("variant", LuminizerVariant.class);
// BlockLightRelay
public static final PropertyEnum<LuminizerVariant> LUMINIZER_VARIANT = PropertyEnum.create("variant", LuminizerVariant.class);
// BlockLivingRock
public static final PropertyEnum<LivingRockVariant> LIVINGROCK_VARIANT = PropertyEnum.create("variant", LivingRockVariant.class);
// BlockLivingRock
public static final PropertyEnum<LivingRockVariant> LIVINGROCK_VARIANT = PropertyEnum.create("variant", LivingRockVariant.class);
// BlockModDoubleFlower (white to gray)
public static final PropertyEnum<EnumDyeColor> DOUBLEFLOWER_VARIANT_1 = PropertyEnum.create("variant", EnumDyeColor.class, input -> input.ordinal() >= 0 && input.ordinal() <= 7);
// BlockModDoubleFlower (white to gray)
public static final PropertyEnum<EnumDyeColor> DOUBLEFLOWER_VARIANT_1 = PropertyEnum.create("variant", EnumDyeColor.class, input -> input.ordinal() >= 0 && input.ordinal() <= 7);
// (silver to black)
public static final PropertyEnum<EnumDyeColor> DOUBLEFLOWER_VARIANT_2 = PropertyEnum.create("variant", EnumDyeColor.class, input -> input.ordinal() >= 8 && input.ordinal() <= 15);
// (silver to black)
public static final PropertyEnum<EnumDyeColor> DOUBLEFLOWER_VARIANT_2 = PropertyEnum.create("variant", EnumDyeColor.class, input -> input.ordinal() >= 8 && input.ordinal() <= 15);
// BlockOpenCrate
public static final PropertyEnum<CrateVariant> CRATE_VARIANT = PropertyEnum.create("variant", CrateVariant.class);
public static final PropertyEnum<CratePattern> CRATE_PATTERN = PropertyEnum.create("pattern", CratePattern.class);
// BlockOpenCrate
public static final PropertyEnum<CrateVariant> CRATE_VARIANT = PropertyEnum.create("variant", CrateVariant.class);
public static final PropertyEnum<CratePattern> CRATE_PATTERN = PropertyEnum.create("pattern", CratePattern.class);
// BlockPavement
public static final PropertyEnum<EnumDyeColor> PAVEMENT_COLOR = PropertyEnum.create("color", EnumDyeColor.class, color ->
color == EnumDyeColor.WHITE || color == EnumDyeColor.BLACK
|| color == EnumDyeColor.BLUE || color == EnumDyeColor.RED
|| color == EnumDyeColor.YELLOW || color == EnumDyeColor.GREEN);
// BlockPavement
public static final PropertyEnum<EnumDyeColor> PAVEMENT_COLOR = PropertyEnum.create("color", EnumDyeColor.class, color ->
color == EnumDyeColor.WHITE || color == EnumDyeColor.BLACK
|| color == EnumDyeColor.BLUE || color == EnumDyeColor.RED
|| color == EnumDyeColor.YELLOW || color == EnumDyeColor.GREEN);
// BlockPlatform
public static final PropertyEnum<PlatformVariant> PLATFORM_VARIANT = PropertyEnum.create("variant", PlatformVariant.class);
// BlockPlatform
public static final PropertyEnum<PlatformVariant> PLATFORM_VARIANT = PropertyEnum.create("variant", PlatformVariant.class);
// BlockPool
public static final PropertyEnum<PoolVariant> POOL_VARIANT = PropertyEnum.create("variant", PoolVariant.class);
// BlockPool
public static final PropertyEnum<PoolVariant> POOL_VARIANT = PropertyEnum.create("variant", PoolVariant.class);
// BlockPrism
public static final PropertyBool HAS_LENS = PropertyBool.create("has_lens");
// BlockPrism
public static final PropertyBool HAS_LENS = PropertyBool.create("has_lens");
// BlockPrismarine
public static final PropertyEnum<PrismarineVariant> PRISMARINE_VARIANT = PropertyEnum.create("variant", PrismarineVariant.class);
// BlockPrismarine
public static final PropertyEnum<PrismarineVariant> PRISMARINE_VARIANT = PropertyEnum.create("variant", PrismarineVariant.class);
// BlockPylon
public static final PropertyEnum<PylonVariant> PYLON_VARIANT = PropertyEnum.create("variant", PylonVariant.class);
// BlockPylon
public static final PropertyEnum<PylonVariant> PYLON_VARIANT = PropertyEnum.create("variant", PylonVariant.class);
// BlockSpreader
public static final PropertyEnum<SpreaderVariant> SPREADER_VARIANT = PropertyEnum.create("variant", SpreaderVariant.class);
// BlockSpreader
public static final PropertyEnum<SpreaderVariant> SPREADER_VARIANT = PropertyEnum.create("variant", SpreaderVariant.class);
// BlockStorage
public static final PropertyEnum<StorageVariant> STORAGE_VARIANT = PropertyEnum.create("variant", StorageVariant.class);
// BlockStorage
public static final PropertyEnum<StorageVariant> STORAGE_VARIANT = PropertyEnum.create("variant", StorageVariant.class);
// BlockTinyPotato
public static final PropertyEnum<PotatoVariant> POTATO_VARIANT = PropertyEnum.create("variant", PotatoVariant.class);
private BotaniaStateProps() {}
private BotaniaStateProps() {
}
}
@@ -0,0 +1,54 @@
/**
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.api.state;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import net.minecraftforge.common.property.IUnlistedProperty;
// Generic base class for unlisted properties
public class PropertyObject<T> implements IUnlistedProperty<T> {
private final String name;
private final Class<T> clazz;
private final Predicate<T> validator;
private final Function<T, String> stringFunction;
public PropertyObject(String name, Class<T> clazz, Predicate<T> validator, Function<T, String> stringFunction) {
this.name = name;
this.clazz = clazz;
this.validator = validator;
this.stringFunction = stringFunction;
}
public PropertyObject(String name, Class<T> clazz) {
this(name, clazz, Predicates.alwaysTrue(), Object::toString);
}
@Override
public String getName() {
return name;
}
@Override
public boolean isValid(T value) {
return validator.apply(value);
}
@Override
public Class<T> getType() {
return clazz;
}
@Override
public String valueToString(T value) {
return stringFunction.apply(value);
}
}
@@ -1,43 +0,0 @@
/**
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.api.state;
import net.minecraft.block.state.IBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
// An unlisted property that holds an IBlockState. Used for platform rendering
public class PropertyState implements IUnlistedProperty<IBlockState> {
private final String name;
public PropertyState(String name) {
this.name = name;
}
@Override
public String getName() {
return name;
}
@Override
public boolean isValid(IBlockState value) {
return true;
}
@Override
public Class<IBlockState> getType() {
return IBlockState.class;
}
@Override
public String valueToString(IBlockState value) {
return value.toString();
}
}
@@ -1,41 +0,0 @@
/**
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.api.state;
import net.minecraftforge.common.property.IUnlistedProperty;
// An unlisted property that holds a String, used for subtile rendering
public class PropertyString implements IUnlistedProperty<String> {
private final String name;
public PropertyString(String name) {
this.name = name;
}
@Override
public String getName() {
return name;
}
@Override
public boolean isValid(String value) {
return true;
}
@Override
public Class<String> getType() {
return String.class;
}
@Override
public String valueToString(String value) {
return value;
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,13 +13,13 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum AlfPortalState implements IStringSerializable {
OFF,
ON_Z,
ON_X;
OFF,
ON_Z,
ON_X;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,16 +13,16 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum AltGrassVariant implements IStringSerializable {
DRY,
GOLDEN,
VIVID,
SCORCHED,
INFUSED,
MUTATED;
DRY,
GOLDEN,
VIVID,
SCORCHED,
INFUSED,
MUTATED;
@Override
public String getName() {
return this.name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return this.name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,20 +13,20 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum AltarVariant implements IStringSerializable {
DEFAULT,
FOREST,
PLAINS,
MOUNTAIN,
FUNGAL,
SWAMP,
DESERT,
TAIGA,
MESA,
MOSSY;
DEFAULT,
FOREST,
PLAINS,
MOUNTAIN,
FUNGAL,
SWAMP,
DESERT,
TAIGA,
MESA,
MOSSY;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,26 +13,26 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum BiomeBrickVariant implements IStringSerializable {
FOREST,
PLAINS,
MOUNTAIN,
FUNGAL,
SWAMP,
DESERT,
TAIGA,
MESA,
CHISELED_FOREST,
CHISELED_PLAINS,
CHISELED_MOUNTAIN,
CHISELED_FUNGAL,
CHISELED_SWAMP,
CHISELED_DESERT,
CHISELED_TAIGA,
CHISELED_MESA;
FOREST,
PLAINS,
MOUNTAIN,
FUNGAL,
SWAMP,
DESERT,
TAIGA,
MESA,
CHISELED_FOREST,
CHISELED_PLAINS,
CHISELED_MOUNTAIN,
CHISELED_FUNGAL,
CHISELED_SWAMP,
CHISELED_DESERT,
CHISELED_TAIGA,
CHISELED_MESA;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,26 +13,26 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum BiomeStoneVariant implements IStringSerializable {
FOREST,
PLAINS,
MOUNTAIN,
FUNGAL,
SWAMP,
DESERT,
TAIGA,
MESA,
FOREST_COBBLE,
PLAINS_COBBLE,
MOUNTAIN_COBBLE,
FUNGAL_COBBLE,
SWAMP_COBBLE,
DESERT_COBBLE,
TAIGA_COBBLE,
MESA_COBBLE;
FOREST,
PLAINS,
MOUNTAIN,
FUNGAL,
SWAMP,
DESERT,
TAIGA,
MESA,
FOREST_COBBLE,
PLAINS_COBBLE,
MOUNTAIN_COBBLE,
FUNGAL_COBBLE,
SWAMP_COBBLE,
DESERT_COBBLE,
TAIGA_COBBLE,
MESA_COBBLE;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,19 +13,19 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum CratePattern implements IStringSerializable {
NONE,
CRAFTY_1_1,
CRAFTY_2_2,
CRAFTY_1_2,
CRAFTY_2_1,
CRAFTY_1_3,
CRAFTY_3_1,
CRAFTY_2_3,
CRAFTY_3_2,
CRAFTY_DONUT;
NONE,
CRAFTY_1_1,
CRAFTY_2_2,
CRAFTY_1_2,
CRAFTY_2_1,
CRAFTY_1_3,
CRAFTY_3_1,
CRAFTY_2_3,
CRAFTY_3_2,
CRAFTY_DONUT;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,12 +13,12 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum CrateVariant implements IStringSerializable {
OPEN,
CRAFTY;
OPEN,
CRAFTY;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,26 +13,26 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum CustomBrickVariant implements IStringSerializable {
HELLISH_BRICK,
SOUL_BRICK,
FROSTY_BRICK,
ROOF_TILE,
AZULEJO_1,
AZULEJO_2,
AZULEJO_3,
AZULEJO_4,
AZULEJO_5,
AZULEJO_6,
AZULEJO_7,
AZULEJO_8,
AZULEJO_9,
AZULEJO_10,
AZULEJO_11,
AZULEJO_12;
HELLISH_BRICK,
SOUL_BRICK,
FROSTY_BRICK,
ROOF_TILE,
AZULEJO_1,
AZULEJO_2,
AZULEJO_3,
AZULEJO_4,
AZULEJO_5,
AZULEJO_6,
AZULEJO_7,
AZULEJO_8,
AZULEJO_9,
AZULEJO_10,
AZULEJO_11,
AZULEJO_12;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,13 +13,13 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum DrumVariant implements IStringSerializable {
WILD,
GATHERING,
CANOPY;
WILD,
GATHERING,
CANOPY;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,14 +13,14 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum EndBrickVariant implements IStringSerializable {
END_STONE_BRICKS,
CHISELED_END_STONE_BRICKS,
ENDER_BRICKS,
PILLAR_ENDER_BRICKS;
END_STONE_BRICKS,
CHISELED_END_STONE_BRICKS,
ENDER_BRICKS,
PILLAR_ENDER_BRICKS;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,26 +13,26 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum FutureStoneVariant implements IStringSerializable {
ANDESITE,
BASALT,
DIORITE,
GRANITE,
POLISHED_ANDESITE,
POLISHED_BASALT,
POLISHED_DIORITE,
POLISHED_GRANITE,
ANDESITE_BRICK,
BASALT_BRICK,
DIORITE_BRICK,
GRANITE_BRICK,
CHISELED_ANDESITE,
CHISELED_BASALT,
CHISELED_DIORITE,
CHISELED_GRANITE;
ANDESITE,
BASALT,
DIORITE,
GRANITE,
POLISHED_ANDESITE,
POLISHED_BASALT,
POLISHED_DIORITE,
POLISHED_GRANITE,
ANDESITE_BRICK,
BASALT_BRICK,
DIORITE_BRICK,
GRANITE_BRICK,
CHISELED_ANDESITE,
CHISELED_BASALT,
CHISELED_DIORITE,
CHISELED_GRANITE;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,15 +13,15 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum LivingRockVariant implements IStringSerializable {
DEFAULT,
BRICK,
MOSSY_BRICK,
CRACKED_BRICK,
CHISELED_BRICK;
DEFAULT,
BRICK,
MOSSY_BRICK,
CRACKED_BRICK,
CHISELED_BRICK;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,16 +13,16 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum LivingWoodVariant implements IStringSerializable {
DEFAULT,
PLANKS,
MOSSY_PLANKS,
FRAMED,
PATTERN_FRAMED,
GLIMMERING;
DEFAULT,
PLANKS,
MOSSY_PLANKS,
FRAMED,
PATTERN_FRAMED,
GLIMMERING;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,12 +13,12 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum LuminizerVariant implements IStringSerializable {
DEFAULT,
DETECTOR;
DEFAULT,
DETECTOR;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,13 +13,13 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum PlatformVariant implements IStringSerializable {
ABSTRUSE,
SPECTRAL,
INFRANGIBLE;
ABSTRUSE,
SPECTRAL,
INFRANGIBLE;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,14 +13,14 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum PoolVariant implements IStringSerializable {
DEFAULT,
CREATIVE,
DILUTED,
FABULOUS;
DEFAULT,
CREATIVE,
DILUTED,
FABULOUS;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -1,24 +0,0 @@
/**
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.api.state.enums;
import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum PotatoVariant implements IStringSerializable {
DEFAULT,
HALLOWEEN,
GRAYSCALE;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,13 +13,13 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum PrismarineVariant implements IStringSerializable {
PRISMARINE,
PRISMARINE_BRICKS,
DARK_PRISMARINE;
PRISMARINE,
PRISMARINE_BRICKS,
DARK_PRISMARINE;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,13 +13,13 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum PylonVariant implements IStringSerializable {
MANA,
NATURA,
GAIA;
MANA,
NATURA,
GAIA;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,15 +13,15 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum QuartzVariant implements IStringSerializable {
NORMAL,
CHISELED,
PILLAR_Y,
PILLAR_X,
PILLAR_Z;
NORMAL,
CHISELED,
PILLAR_Y,
PILLAR_X,
PILLAR_Z;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,14 +13,14 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum SpreaderVariant implements IStringSerializable {
MANA,
REDSTONE,
ELVEN,
GAIA;
MANA,
REDSTONE,
ELVEN,
GAIA;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,15 +13,15 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum StorageVariant implements IStringSerializable {
MANASTEEL,
TERRASTEEL,
ELEMENTIUM,
MANA_DIAMOND,
DRAGONSTONE;
MANASTEEL,
TERRASTEEL,
ELEMENTIUM,
MANA_DIAMOND,
DRAGONSTONE;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -206,7 +206,7 @@ public class SubTileFunctional extends SubTileEntity {
}
public boolean isValidBinding() {
return linkedPool != null && !linkedPool.isInvalid() && supertile.getWorld().getTileEntity(linkedPool.getPos()) == linkedPool;
return linkedPool != null && !linkedPool.isInvalid() && supertile.getWorld().isBlockLoaded(linkedPool.getPos(), false) && supertile.getWorld().getTileEntity(linkedPool.getPos()) == linkedPool;
}
@Override
@@ -100,7 +100,7 @@ public class SubTileGenerating extends SubTileEntity {
if(passive && muhBalance > 0 && passiveDecayTicks > muhBalance) {
supertile.getWorld().playAuxSFX(2001, supertile.getPos(), Block.getIdFromBlock(supertile.getBlockType()));
if(supertile.getWorld().getBlockState(supertile.getPos().down()).getBlock().isSideSolid(supertile.getWorld(), supertile.getPos().down(), EnumFacing.DOWN))
if(supertile.getWorld().getBlockState(supertile.getPos().down()).getBlock().isSideSolid(supertile.getWorld(), supertile.getPos().down(), EnumFacing.UP))
supertile.getWorld().setBlockState(supertile.getPos(), Blocks.deadbush.getDefaultState());
else supertile.getWorld().setBlockToAir(supertile.getPos());
}
@@ -14,13 +14,14 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraftforge.client.event.RenderPlayerEvent;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.item.IBaubleRender;
import vazkii.botania.api.item.IBaubleRender.Helper;
import vazkii.botania.api.item.IBaubleRender.RenderType;
@@ -33,38 +34,37 @@ import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public final class BaubleRenderHandler {
public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
@SubscribeEvent
public void onPlayerRender(RenderPlayerEvent.Specials.Post event) {
if(!ConfigHandler.renderBaubles || event.entityLiving.getActivePotionEffect(Potion.invisibility) != null)
@Override
public void doRenderLayer(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) {
if(!ConfigHandler.renderBaubles || player.getActivePotionEffect(Potion.invisibility) != null)
return;
EntityPlayer player = event.entityPlayer;
InventoryBaubles inv = PlayerHandler.getPlayerBaubles(player);
dispatchRenders(inv, event, RenderType.BODY);
dispatchRenders(inv, player, RenderType.BODY, partialTicks);
if(inv.getStackInSlot(3) != null)
renderManaTablet(event);
renderManaTablet(player);
float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * event.partialRenderTick;
float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * event.partialRenderTick;
float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * event.partialRenderTick;
float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks;
float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks;
float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks;
GlStateManager.pushMatrix();
GlStateManager.rotate(yawOffset, 0, -1, 0);
GlStateManager.rotate(yaw - 270, 0, 1, 0);
GlStateManager.rotate(pitch, 0, 0, 1);
dispatchRenders(inv, event, RenderType.HEAD);
dispatchRenders(inv, player, RenderType.HEAD, partialTicks);
ItemStack helm = player.inventory.armorItemInSlot(3);
if(helm != null && helm.getItem() instanceof ItemTerrasteelHelm)
ItemTerrasteelHelm.renderOnPlayer(helm, event);
ItemTerrasteelHelm.renderOnPlayer(helm, player);
GlStateManager.popMatrix();
}
private void dispatchRenders(InventoryBaubles inv, RenderPlayerEvent event, RenderType type) {
private void dispatchRenders(InventoryBaubles inv, EntityPlayer player, RenderType type, float partialTicks) {
for(int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if(stack != null) {
@@ -81,8 +81,9 @@ public final class BaubleRenderHandler {
ItemStack cosmetic = attachable.getCosmeticItem(stack);
if(cosmetic != null) {
GlStateManager.pushMatrix();
GL11.glColor3ub(((byte) 255), ((byte) 255), ((byte) 255)); // Some of the baubles use this so we must restore it manually as well
GlStateManager.color(1F, 1F, 1F, 1F);
((IBaubleRender) cosmetic.getItem()).onPlayerBaubleRender(cosmetic, event, type);
((IBaubleRender) cosmetic.getItem()).onPlayerBaubleRender(cosmetic, player, type, partialTicks);
GlStateManager.popMatrix();
continue;
}
@@ -90,29 +91,33 @@ public final class BaubleRenderHandler {
if(item instanceof IBaubleRender) {
GlStateManager.pushMatrix();
GL11.glColor3ub(((byte) 255), ((byte) 255), ((byte) 255)); // Some of the baubles use this so we must restore it manually as well
GlStateManager.color(1F, 1F, 1F, 1F);
((IBaubleRender) stack.getItem()).onPlayerBaubleRender(stack, event, type);
((IBaubleRender) stack.getItem()).onPlayerBaubleRender(stack, player, type, partialTicks);
GlStateManager.popMatrix();
}
}
}
}
private void renderManaTablet(RenderPlayerEvent event) {
EntityPlayer player = event.entityPlayer;
private void renderManaTablet(EntityPlayer player) {
boolean renderedOne = false;
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack stack = player.inventory.getStackInSlot(i);
if(stack != null && stack.getItem() == ModItems.manaTablet) {
Item item = stack.getItem();
GlStateManager.pushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
Helper.rotateIfSneaking(event.entityPlayer);
boolean armor = event.entityPlayer.getCurrentArmor(1) != null;
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.translate(-0.25F, -0.85F, renderedOne ? armor ? 0.2F : 0.28F : armor ? -0.3F : -0.25F);
GlStateManager.scale(0.5F, 0.5F, 0.5F);
Helper.rotateIfSneaking(player);
boolean armor = player.getCurrentArmor(1) != null;
GlStateManager.rotate(90, 0, 1, 0);
GlStateManager.rotate(90, 1, 0, 0);
if (renderedOne)
GlStateManager.translate(0F, armor ? 0.20F : 0.18F, -0.25F);
else
GlStateManager.translate(0F, armor ? -0.39F : -0.35F, -0.25F);
GlStateManager.scale(0.75F, 0.75F, 0.75F);
GlStateManager.color(1F, 1F, 1F);
int light = 15728880;
@@ -129,5 +134,8 @@ public final class BaubleRenderHandler {
}
}
@Override
public boolean shouldCombineTextures() {
return false;
}
}
@@ -48,6 +48,15 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
public void doRenderLayer(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) {
String name = player.getDisplayName().getUnformattedText();
float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks;
float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks;
float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks;
GlStateManager.pushMatrix();
GlStateManager.rotate(yawOffset, 0, -1, 0);
GlStateManager.rotate(yaw - 270, 0, 1, 0);
GlStateManager.rotate(pitch, 0, 0, 1);
if(name.equals("Vazkii") || name.equals("_phi")) {
if(phi)
renderPhiFlower(player);
@@ -60,6 +69,8 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
name = name.toLowerCase();
if(player.isWearing(EnumPlayerModelParts.CAPE) && flowerMap != null && flowerMap.containsKey(name))
renderFlower(player, flowerMap.get(name));
GlStateManager.popMatrix();
}
@Override
@@ -102,12 +113,12 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
Helper.translateToHeadLevel(player);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
GlStateManager.color(1F, 1F, 1F, 1F);
//GlStateManager.rotate(90F, 0F, 1F, 0F); todo 1.8 refine
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.translate(0, 1.62, 0);
float t = 0.13F;
GlStateManager.translate(t, -0.5F, -0.1F);
if(player.motionY < 0)
GlStateManager.rotate((float) player.motionY * 20F, -1F, 0F, 0F);
GlStateManager.rotate((float) player.motionY * 20F, 1F, 0F, 0F);
float r = -18F + (float) Math.sin((ClientTickHandler.ticksInGame + partialTicks) * 0.05F) * 2F;
GlStateManager.rotate(r, 0F, 0F, 1F);
@@ -135,11 +146,10 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.translate(-0.4F, 0.1F, -0.25F);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
// todo 1.8 refine
// GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.scale(0.4F, 0.4F, 0.4F);
GlStateManager.translate(0.70F, -3.5F, 0.125F);
// GlStateManager.rotate(20F, 1F, 0F, 0F);
GlStateManager.translate(-1F, -3.5F, 0.125F);
GlStateManager.rotate(20F, 1F, 0F, 0F);
IconHelper.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
GlStateManager.popMatrix();
}
@@ -153,9 +163,9 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
float f3 = icon.getMaxV();
Helper.rotateIfSneaking(player);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(-0.75F, 0.5F, 0F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.scale(0.4F, 0.4F, 0.4F);
GlStateManager.translate(1.2F, 0.5F, 0F);
GlStateManager.translate(-0.5F, 1.6F, 0F);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
IconHelper.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
GlStateManager.popMatrix();
@@ -166,7 +176,8 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
Helper.translateToHeadLevel(player);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
GlStateManager.rotate(-90, 1, 0, 0);
GlStateManager.translate(0, 0, 1.22); // todo 1.8 refine
GlStateManager.translate(0, 0, 1.22);
GlStateManager.rotate(90, 0, 0, 1);
ShaderHelper.useShader(ShaderHelper.gold);
Minecraft.getMinecraft().getRenderItem().renderItemModelForEntity(flower, player, ItemCameraTransforms.TransformType.THIRD_PERSON);
ShaderHelper.releaseShader();
@@ -12,6 +12,8 @@ package vazkii.botania.client.core.handler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
@@ -28,6 +30,8 @@ import vazkii.botania.common.core.handler.ManaNetworkHandler;
import vazkii.botania.common.lib.LibMisc;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.util.UUID;
public final class DebugHandler {
private static final String PREFIX = EnumChatFormatting.GREEN + "[Botania] " + EnumChatFormatting.RESET;
@@ -42,7 +46,16 @@ public final class DebugHandler {
version = "N/A";
event.left.add(PREFIX + "pS: " + ParticleRenderDispatcher.sparkleFxCount + ", pFS: " + ParticleRenderDispatcher.fakeSparkleFxCount + ", pW: " + ParticleRenderDispatcher.wispFxCount + ", pDIW: " + ParticleRenderDispatcher.depthIgnoringWispFxCount + ", pLB: " + ParticleRenderDispatcher.lightningCount);
event.left.add(PREFIX + "netColl: " + ManaNetworkHandler.instance.getAllCollectorsInWorld(world).size() + ", netPool: " + ManaNetworkHandler.instance.getAllPoolsInWorld(world).size() + ", rv: " + version);
event.left.add(PREFIX + "(CLIENT) netColl: " + ManaNetworkHandler.instance.getAllCollectorsInWorld(world).size() + ", netPool: " + ManaNetworkHandler.instance.getAllPoolsInWorld(world).size() + ", rv: " + version);
if (Minecraft.getMinecraft().isIntegratedServerRunning()) {
UUID id = Minecraft.getMinecraft().thePlayer.getUniqueID();
Entity ent = Minecraft.getMinecraft().getIntegratedServer().getEntityFromUuid(id);
if (ent != null) {
World serverWorld = Minecraft.getMinecraft().getIntegratedServer().getEntityFromUuid(id).worldObj;
event.left.add(PREFIX + String.format("(INTEGRATED SERVER DIM %d) netColl : %d, netPool: %d", serverWorld.provider.getDimensionId(), ManaNetworkHandler.instance.getAllCollectorsInWorld(serverWorld).size(), ManaNetworkHandler.instance.getAllPoolsInWorld(serverWorld).size()));
}
}
if(GuiScreen.isCtrlKeyDown() && GuiScreen.isShiftKeyDown()) {
event.left.add(PREFIX + "Config Context");
@@ -10,13 +10,21 @@ package vazkii.botania.client.core.handler;
import com.google.common.collect.Maps;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.statemap.DefaultStateMapper;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.launchwrapper.Launch;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.event.CommandEvent;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.apache.commons.lang3.text.WordUtils;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.client.model.FloatingFlowerModel;
import vazkii.botania.client.model.PlatformModel;
@@ -27,6 +35,11 @@ import vazkii.botania.common.item.ItemSparkUpgrade;
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
import vazkii.botania.common.item.relic.ItemKingKey;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.IntBuffer;
import java.util.Map;
public class MiscellaneousIcons {
@@ -47,7 +60,8 @@ public class MiscellaneousIcons {
corporeaIconStar,
sparkWorldIcon,
manaDetectorIcon,
runeAltarTriggerIcon;
runeAltarTriggerIcon,
terrasteelHelmWillIcon;
public TextureAtlasSprite[] sparkUpgradeIcons;
public TextureAtlasSprite[] kingKeyWeaponIcons;
@@ -61,6 +75,16 @@ public class MiscellaneousIcons {
public TextureAtlasSprite nerfBatIcon = null;
// end dank_memes
// Icons for baubles that don't render their own model on the player
public TextureAtlasSprite
bloodPendantChain,
bloodPendantGem,
snowflakePendantGem,
itemFinderGem,
pyroclastGem,
crimsonGem;
@SubscribeEvent
public void onModelBake(ModelBakeEvent evt) {
// BlockSpecialFlower
@@ -123,7 +147,59 @@ public class MiscellaneousIcons {
tiaraWingIcons = new TextureAtlasSprite[ItemFlightTiara.WING_TYPES];
for (int i = 0; i < tiaraWingIcons.length; i++) {
tiaraWingIcons[i] = IconHelper.forName(evt.map, "flightTiara" + i, "items");
tiaraWingIcons[i] = IconHelper.forName(evt.map, "flightTiara" + (i + 1), "items");
}
terrasteelHelmWillIcon = IconHelper.forName(evt.map, "willFlame", "items");
bloodPendantChain = IconHelper.forName(evt.map, "bloodPendant2", "items");
bloodPendantGem = IconHelper.forName(evt.map, "bloodPendant3", "items");
snowflakePendantGem = IconHelper.forName(evt.map, "icePendantGem", "items");
itemFinderGem = IconHelper.forName(evt.map, "itemFinderGem", "items");
pyroclastGem = IconHelper.forName(evt.map, "lavaPendantGem", "items");
crimsonGem = IconHelper.forName(evt.map, "superLavaPendantGem", "items");
}
@SubscribeEvent
public void dumpAtlas(ArrowLooseEvent evt) {
if (!evt.entityPlayer.worldObj.isRemote || !((Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment")))
return;
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
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);
System.out.printf("Atlas is %d wide by %d tall%n", width, height);
int pixels = width * height;
IntBuffer buffer = BufferUtils.createIntBuffer(pixels);
int[] pixelValues = new int[pixels];
GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, buffer);
buffer.get(pixelValues);
BufferedImage bufferedimage = new BufferedImage(width, height, 2);
for (int k = 0; k < height; ++k)
{
for (int l = 0; l < width; ++l)
{
bufferedimage.setRGB(l, k, pixelValues[k * width + l]);
}
}
File mcFolder = Minecraft.getMinecraft().mcDataDir;
File result = new File(mcFolder, "atlas.png");
try {
ImageIO.write(bufferedimage, "png", result);
} catch (IOException e) {
e.printStackTrace();
}
}
@@ -12,6 +12,7 @@ import com.google.common.collect.ImmutableList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDoublePlant;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.BlockSkull;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.BlockWall;
import net.minecraft.block.state.IBlockState;
@@ -33,6 +34,7 @@ import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.client.model.obj.OBJLoader;
import net.minecraftforge.fml.common.registry.GameData;
import vazkii.botania.api.BotaniaAPIClient;
import vazkii.botania.api.item.IFloatingFlower;
import vazkii.botania.api.state.enums.PlatformVariant;
import vazkii.botania.api.state.enums.SpreaderVariant;
import vazkii.botania.client.model.SpecialFlowerModel;
@@ -169,6 +171,24 @@ public final class ModelHandler {
// Cannot use lambdas directly yet because FG/SS can't reobfuscate them, need a dummy wrapper
// See https://github.com/MinecraftForge/ForgeGradle/issues/314.
ModelLoader.registerItemVariants(elementiumShears,
new ModelResourceLocation("botania:elementiumShears", "inventory"),
new ModelResourceLocation("botania:dammitReddit", "inventory"));
ModelLoader.setCustomMeshDefinition(elementiumShears, MesherWrapper.of(stack ->
stack.getDisplayName().equalsIgnoreCase("dammit reddit")
? new ModelResourceLocation("botania:dammitReddit", "inventory")
: new ModelResourceLocation("botania:elementiumShears", "inventory")));
ModelLoader.registerItemVariants(grassHorn,
new ModelResourceLocation("botania:grassHorn0", "inventory"),
new ModelResourceLocation("botania:grassHorn1", "inventory"),
new ModelResourceLocation("botania:grassHorn2", "inventory"),
new ModelResourceLocation("botania:vuvuzela", "inventory"));
ModelLoader.setCustomMeshDefinition(grassHorn, MesherWrapper.of(stack ->
stack.getDisplayName().toLowerCase().contains("vuvuzela")
? new ModelResourceLocation("botania:vuvuzela", "inventory")
: new ModelResourceLocation("botania:grassHorn" + stack.getMetadata(), "inventory")));
ModelLoader.registerItemVariants(infiniteFruit,
new ModelResourceLocation("botania:infiniteFruit", "inventory"),
new ModelResourceLocation("botania:infiniteFruitBoot", "inventory"));
@@ -219,6 +239,14 @@ public final class ModelHandler {
return new ModelResourceLocation(path + (ItemTwigWand.getBindMode(stack) ? "_bind" : ""), "inventory");
}));
ModelLoader.registerItemVariants(manaCookie,
new ModelResourceLocation("botania:manaCookie", "inventory"),
new ModelResourceLocation("botania:totalBiscuit", "inventory"));
ModelLoader.setCustomMeshDefinition(manaCookie, MesherWrapper.of(stack ->
stack.getDisplayName().toLowerCase().equals("totalbiscuit")
? new ModelResourceLocation("botania:totalBiscuit", "inventory")
: new ModelResourceLocation("botania:manaCookie", "inventory")));
ModelLoader.registerItemVariants(manaweaveBoots,
new ModelResourceLocation("botania:manaweaveBoots", "inventory"),
new ModelResourceLocation("botania:manaweaveBootsHoliday", "inventory"));
@@ -286,6 +314,17 @@ public final class ModelHandler {
}
private static void registerSubtiles() {
BotaniaAPIClient.registerIslandTypeModel(IFloatingFlower.IslandType.GRASS, new ModelResourceLocation("botania:miniIsland", "variant=grass"));
BotaniaAPIClient.registerIslandTypeModel(IFloatingFlower.IslandType.PODZOL, new ModelResourceLocation("botania:miniIsland", "variant=podzol"));
BotaniaAPIClient.registerIslandTypeModel(IFloatingFlower.IslandType.MYCEL, new ModelResourceLocation("botania:miniIsland", "variant=mycel"));
BotaniaAPIClient.registerIslandTypeModel(IFloatingFlower.IslandType.SNOW, new ModelResourceLocation("botania:miniIsland", "variant=snow"));
BotaniaAPIClient.registerIslandTypeModel(IFloatingFlower.IslandType.DRY, new ModelResourceLocation("botania:miniIsland", "variant=dry"));
BotaniaAPIClient.registerIslandTypeModel(IFloatingFlower.IslandType.GOLDEN, new ModelResourceLocation("botania:miniIsland", "variant=golden"));
BotaniaAPIClient.registerIslandTypeModel(IFloatingFlower.IslandType.VIVID, new ModelResourceLocation("botania:miniIsland", "variant=vivid"));
BotaniaAPIClient.registerIslandTypeModel(IFloatingFlower.IslandType.SCORCHED, new ModelResourceLocation("botania:miniIsland", "variant=scorched"));
BotaniaAPIClient.registerIslandTypeModel(IFloatingFlower.IslandType.INFUSED, new ModelResourceLocation("botania:miniIsland", "variant=infused"));
BotaniaAPIClient.registerIslandTypeModel(IFloatingFlower.IslandType.MUTATED, new ModelResourceLocation("botania:miniIsland", "variant=mutated"));
BotaniaAPIClient.registerSubtileModel(SubTileManastar.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_MANASTAR));
BotaniaAPIClient.registerSubtileModel(SubTilePureDaisy.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_PUREDAISY));
@@ -352,6 +391,7 @@ public final class ModelHandler {
registerItemModel(ModBlocks.cacophonium);
registerItemModel(ModBlocks.cellBlock);
registerItemModel(ModBlocks.conjurationCatalyst);
registerItemModel(ModBlocks.cocoon);
registerItemModel(ModBlocks.corporeaFunnel);
registerItemModel(ModBlocks.corporeaInterceptor);
registerItemModel(ModBlocks.corporeaRetainer);
@@ -420,6 +460,7 @@ public final class ModelHandler {
registerVariantsDefaulted(ModBlocks.platform, PlatformVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.prismarine, PrismarineVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.spreader, SpreaderVariant.class, "variant");
// todo 1.8 this is temporary until animation API is done, currnetly item model textures will not match true spreader texture
registerVariantsDefaulted(ModFluffBlocks.stone, FutureStoneVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.storage, StorageVariant.class, "variant");
}
@@ -429,7 +470,6 @@ public final class ModelHandler {
registerItemModel(blackLotus);
registerItemModel(blackLotus, 1);
registerItemModel(lexicon);
registerItemModel(manaCookie);
registerItemModel(manasteelHelm);
registerItemModel(manasteelHelmRevealing);
@@ -451,7 +491,6 @@ public final class ModelHandler {
registerItemModel(elementiumPick);
registerItemModel(elementiumShovel);
registerItemModel(elementiumAxe);
registerItemModel(elementiumShears);
registerItemModel(elementiumSword);
registerItemModel(terrasteelHelm);
@@ -560,11 +599,10 @@ public final class ModelHandler {
registerItemModelMetas(blackHoleTalisman, LibItemNames.BLACK_HOLE_TALISMAN, 2);
registerItemModelMetas(slimeBottle, LibItemNames.SLIME_BOTTLE, 2);
registerItemModelMetas(grassSeeds, LibItemNames.GRASS_SEEDS, 9);
registerItemModelMetas(quartz, LibItemNames.QUARTZ, 8);
registerItemModelMetas(quartz, LibItemNames.QUARTZ, 7);
registerItemModelMetas(cosmetic, LibItemNames.COSMETIC, 32);
registerItemModelMetas(craftPattern, LibItemNames.CRAFT_PATTERN, 9);
registerItemModelMetas(virus, LibItemNames.VIRUS, 2);
registerItemModelMetas(grassHorn, LibItemNames.GRASS_HORN, 3);
}
// Only for models that absolutely can't be converted to JSON. Use VERY sparingly
@@ -592,7 +630,7 @@ public final class ModelHandler {
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.hourglass), 0, TileHourglass.class);
registerItemModel(ModBlocks.pump); // todo await animation api
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.pump), 0, TilePump.class);
//ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.pump), 0, TilePump.class);
registerItemModel(ModBlocks.teruTeruBozu);
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.teruTeruBozu), 0, TileTeruTeruBozu.class);
@@ -761,6 +799,13 @@ public final class ModelHandler {
for (Block b : otherFullSlabs) {
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY, BlockSlab.HALF).build());
}
// Ignore everything in TESR items to suppress missing model errors
ModelLoader.setCustomStateMapper(ModBlocks.avatar, new StateMap.Builder().ignore(BotaniaStateProps.CARDINALS).build());
ModelLoader.setCustomStateMapper(ModBlocks.bellows, new StateMap.Builder().ignore(BotaniaStateProps.CARDINALS).build());
ModelLoader.setCustomStateMapper(ModBlocks.brewery, new StateMap.Builder().ignore(BotaniaStateProps.POWERED).build());
ModelLoader.setCustomStateMapper(ModBlocks.gaiaHead, new StateMap.Builder().ignore(BlockSkull.FACING, BlockSkull.NODROP).build());
ModelLoader.setCustomStateMapper(ModBlocks.hourglass, new StateMap.Builder().ignore(BotaniaStateProps.POWERED).build());
}
private static void registerMushrooms() {
@@ -86,7 +86,7 @@ public final class MultiblockRenderHandler {
public static void setMultiblock(MultiblockSet set) {
currentMultiblock = set;
anchor = null;
angle = EnumFacing.DOWN;
angle = EnumFacing.SOUTH;
Minecraft mc = Minecraft.getMinecraft();
if(mc.theWorld != null)
@@ -190,7 +190,7 @@ public final class TooltipAdditionDisplayHandler {
String rank = StatCollector.translateToLocal("botania.rank" + level).replaceAll("&", "\u00a7");
GL11.glPushAttrib(GL11.GL_LIGHTING);
GlStateManager.disableLighting();
GL11.glDisable(GL11.GL_LIGHTING);
font.drawStringWithShadow(rank, mouseX + offx, mouseY - offy - 12, 0xFFFFFF);
if(!ss) {
rank = StatCollector.translateToLocal("botania.rank" + (level + 1)).replaceAll("&", "\u00a7");
@@ -14,7 +14,8 @@ import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.Calendar;
import java.time.LocalDateTime;
import java.time.Month;
import java.util.Map;
import net.minecraft.block.Block;
@@ -28,12 +29,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemRecord;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntitySkull;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings.GameType;
import net.minecraftforge.client.model.animation.AnimationTESR;
import net.minecraftforge.common.MinecraftForge;
import vazkii.botania.api.item.IExtendedPlayerController;
import vazkii.botania.api.lexicon.LexiconEntry;
@@ -197,7 +198,6 @@ public class ClientProxy extends CommonProxy {
if(ConfigHandler.boundBlockWireframe)
MinecraftForge.EVENT_BUS.register(new BoundTileRenderer());
MinecraftForge.EVENT_BUS.register(new TooltipHandler());
MinecraftForge.EVENT_BUS.register(new BaubleRenderHandler());
MinecraftForge.EVENT_BUS.register(new DebugHandler());
MinecraftForge.EVENT_BUS.register(new SubTileRadiusRenderHandler());
MinecraftForge.EVENT_BUS.register(new MultiblockRenderHandler());
@@ -210,10 +210,10 @@ public class ClientProxy extends CommonProxy {
new VersionChecker().init();
if(ConfigHandler.enableSeasonalFeatures) {
Calendar calendar = Calendar.getInstance();
if((calendar.get(2) == 11 && calendar.get(5) >= 16) || (calendar.get(2) == 0 && calendar.get(5) <= 2))
LocalDateTime now = LocalDateTime.now();
if ((now.getMonth() == Month.DECEMBER && now.getDayOfMonth() >= 16) || (now.getMonth() == Month.JANUARY && now.getDayOfMonth() <= 2))
jingleTheBells = true;
if(calendar.get(2) == 9)
if(now.getMonth() == Month.OCTOBER)
dootDoot = true;
}
@@ -237,14 +237,13 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileFloatingFlower.class, renderTileFloatingFlower);
ClientRegistry.bindTileEntitySpecialRenderer(TileFloatingSpecialFlower.class, renderTileFloatingFlower);
ClientRegistry.bindTileEntitySpecialRenderer(TileTinyPotato.class, new RenderTileTinyPotato());
// ClientRegistry.bindTileEntitySpecialRenderer(TileSpawnerClaw.class, new RenderTileSpawnerClaw());
ClientRegistry.bindTileEntitySpecialRenderer(TileStarfield.class, new RenderTileStarfield());
ClientRegistry.bindTileEntitySpecialRenderer(TileBrewery.class, new RenderTileBrewery());
ClientRegistry.bindTileEntitySpecialRenderer(TileTerraPlate.class, new RenderTileTerraPlate());
ClientRegistry.bindTileEntitySpecialRenderer(TileRedString.class, new RenderTileRedString());
ClientRegistry.bindTileEntitySpecialRenderer(TilePrism.class, new RenderTilePrism());
ClientRegistry.bindTileEntitySpecialRenderer(TileCorporeaIndex.class, new RenderTileCorporeaIndex());
ClientRegistry.bindTileEntitySpecialRenderer(TilePump.class, new RenderTilePump());
ClientRegistry.bindTileEntitySpecialRenderer(TilePump.class, new AnimationTESR<>());
ClientRegistry.bindTileEntitySpecialRenderer(TileCorporeaCrystalCube.class, new RenderTileCorporeaCrystalCube());
ClientRegistry.bindTileEntitySpecialRenderer(TileIncensePlate.class, new RenderTileIncensePlate());
ClientRegistry.bindTileEntitySpecialRenderer(TileHourglass.class, new RenderTileHourglass());
@@ -256,8 +255,6 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileTeruTeruBozu.class, new RenderTileTeruTeruBozu());
ClientRegistry.bindTileEntitySpecialRenderer(TileAvatar.class, new RenderTileAvatar());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySkull.class, new RenderTileSkullOverride());
RenderingRegistry.registerEntityRenderingHandler(EntityPixie.class, RenderPixie::new);
RenderingRegistry.registerEntityRenderingHandler(EntityDoppleganger.class, RenderDoppleganger::new);
RenderingRegistry.registerEntityRenderingHandler(EntitySpark.class, RenderSpark::new);
@@ -276,10 +273,15 @@ public class ClientProxy extends CommonProxy {
private void initAuxiliaryRender() {
Map<String, RenderPlayer> skinMap = Minecraft.getMinecraft().getRenderManager().getSkinMap();
RenderPlayer render = skinMap.get("default");
RenderPlayer render;
render = skinMap.get("default");
render.addLayer(new ContributorFancinessHandler());
render.addLayer(new BaubleRenderHandler());
render = skinMap.get("slim");
render.addLayer(new ContributorFancinessHandler());
render.addLayer(new BaubleRenderHandler());
}
@Override
@@ -393,9 +395,6 @@ public class ClientProxy extends CommonProxy {
if((int) Math.floor(MathHelper.pointDistancePlane(xp, zp, x, z)) == (iradius - 1))
mb.addComponent(new AnyComponent(new BlockPos(xp - x, 1, zp - z), block.getDefaultState()));
if((int) Math.floor(MathHelper.pointDistancePlane(xp, zp, x, z)) == iradius - 1)
mb.addComponent(new AnyComponent(new BlockPos(xp - x, 1, zp - z), block.getDefaultState()));
}
MultiblockRenderHandler.setMultiblock(mb.makeSet());
@@ -53,6 +53,7 @@ public class FXSparkle extends EntityFX {
particleRed = red;
particleGreen = green;
particleBlue = blue;
particleAlpha = 0.5F; // So MC renders us on the alpha layer, value not actually used
particleGravity = 0;
motionX = motionY = motionZ = 0;
particleScale *= size;
@@ -50,6 +50,7 @@ public class FXWisp extends EntityFX {
particleRed = red;
particleGreen = green;
particleBlue = blue;
particleAlpha = 0.5F; // So MC renders us on the alpha layer, value not actually used
particleGravity = 0;
motionX = motionY = motionZ = 0;
particleScale *= size;
@@ -409,7 +409,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
@Override
public GuiLexicon copy() {
GuiLexiconEntry gui = new GuiLexiconEntry(entry, this.parent); // todo 1.8 recheck last param (was new GuiScreen())
GuiLexiconEntry gui = new GuiLexiconEntry(entry, this.parent);
gui.page = page;
gui.setTitle();
return gui;
@@ -107,7 +107,6 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
buttonList.add(leftButton = new GuiButtonPage(13, left, top + guiHeight - 10, false));
buttonList.add(rightButton = new GuiButtonPage(14, left + guiWidth - 18, top + guiHeight - 10, true));
// todo 1.8 verify componentID
searchField = new GuiTextField(15, fontRendererObj, left + guiWidth / 2 + 28, top + guiHeight + 6, 200, 10);
searchField.setCanLoseFocus(false);
searchField.setFocused(true);
@@ -86,7 +86,7 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
key = format.charAt(1);
for(EnumChatFormatting ecf : EnumChatFormatting.class.getEnumConstants())
if(ecf.toString().indexOf(ecf.toString().length() - 1) == key) { // todo 1.8 recheck (want last char of code)
if(ecf.toString().indexOf(ecf.toString().length() - 1) == key) {
if(ecf.ordinal() > 15)
ecf = EnumChatFormatting.BLACK;
color = LibMisc.CONTROL_CODE_COLORS[ecf.ordinal()];
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -31,50 +31,52 @@ import vazkii.botania.client.integration.jei.runicaltar.RunicAltarRecipeHandler;
@JEIPlugin
public class JEIBotaniaPlugin implements IModPlugin {
private IJeiHelpers jeiHelpers;
private IJeiHelpers jeiHelpers;
@Override
public boolean isModLoaded() {
return true;
}
@Override
public boolean isModLoaded() {
return true;
}
@Override
public void onJeiHelpersAvailable(IJeiHelpers jeiHelpers) {
this.jeiHelpers = jeiHelpers;
}
@Override
public void onJeiHelpersAvailable(IJeiHelpers jeiHelpers) {
this.jeiHelpers = jeiHelpers;
}
@Override
public void onItemRegistryAvailable(IItemRegistry itemRegistry) {}
@Override
public void onItemRegistryAvailable(IItemRegistry itemRegistry) {
}
@Override
public void register(IModRegistry registry) {
registry.addRecipeCategories(
new BreweryRecipeCategory(jeiHelpers.getGuiHelper()),
new PureDaisyRecipeCategory(jeiHelpers.getGuiHelper()),
new PetalApothecaryRecipeCategory(jeiHelpers.getGuiHelper()),
new ElvenTradeRecipeCategory(jeiHelpers.getGuiHelper()),
new RunicAltarRecipeCategory(jeiHelpers.getGuiHelper()),
new ManaPoolRecipeCategory(jeiHelpers.getGuiHelper())
);
@Override
public void register(IModRegistry registry) {
registry.addRecipeCategories(
new BreweryRecipeCategory(jeiHelpers.getGuiHelper()),
new PureDaisyRecipeCategory(jeiHelpers.getGuiHelper()),
new PetalApothecaryRecipeCategory(jeiHelpers.getGuiHelper()),
new ElvenTradeRecipeCategory(jeiHelpers.getGuiHelper()),
new RunicAltarRecipeCategory(jeiHelpers.getGuiHelper()),
new ManaPoolRecipeCategory(jeiHelpers.getGuiHelper())
);
registry.addRecipeHandlers(
new BreweryRecipeHandler(),
new PureDaisyRecipeHandler(),
new PetalApothecaryRecipeHandler(),
new ElvenTradeRecipeHandler(),
new RunicAltarRecipeHandler(),
new ManaPoolRecipeHandler()
);
registry.addRecipeHandlers(
new BreweryRecipeHandler(),
new PureDaisyRecipeHandler(),
new PetalApothecaryRecipeHandler(),
new ElvenTradeRecipeHandler(),
new RunicAltarRecipeHandler(),
new ManaPoolRecipeHandler()
);
registry.addRecipes(BotaniaAPI.brewRecipes);
registry.addRecipes(BotaniaAPI.pureDaisyRecipes);
registry.addRecipes(BotaniaAPI.petalRecipes);
registry.addRecipes(BotaniaAPI.elvenTradeRecipes);
registry.addRecipes(BotaniaAPI.runeAltarRecipes);
registry.addRecipes(BotaniaAPI.manaInfusionRecipes);
}
registry.addRecipes(BotaniaAPI.brewRecipes);
registry.addRecipes(BotaniaAPI.pureDaisyRecipes);
registry.addRecipes(BotaniaAPI.petalRecipes);
registry.addRecipes(BotaniaAPI.elvenTradeRecipes);
registry.addRecipes(BotaniaAPI.runeAltarRecipes);
registry.addRecipes(BotaniaAPI.manaInfusionRecipes);
}
@Override
public void onRecipeRegistryAvailable(IRecipeRegistry recipeRegistry) {}
@Override
public void onRecipeRegistryAvailable(IRecipeRegistry recipeRegistry) {
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -25,68 +25,71 @@ import java.util.List;
public class BreweryRecipeCategory implements IRecipeCategory {
private final IDrawableStatic background;
private final String localizedName;
private final IDrawableStatic background;
private final String localizedName;
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 = StatCollector.translateToLocal("botania.nei.brewery");
}
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 = StatCollector.translateToLocal("botania.nei.brewery");
}
@Nonnull
@Override
public String getUid() {
return "botania.brewery";
}
@Nonnull
@Override
public String getUid() {
return "botania.brewery";
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(Minecraft minecraft) {}
@Override
public void drawExtras(Minecraft minecraft) {
}
@Override
public void drawAnimations(Minecraft minecraft) {}
@Override
public void drawAnimations(Minecraft minecraft) {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if (!(recipeWrapper instanceof BreweryRecipeWrapper))
return;
BreweryRecipeWrapper wrapper = ((BreweryRecipeWrapper) recipeWrapper);
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if(!(recipeWrapper instanceof BreweryRecipeWrapper))
return;
BreweryRecipeWrapper wrapper = ((BreweryRecipeWrapper) recipeWrapper);
List inputs = wrapper.getInputs();
List inputs = wrapper.getInputs();
recipeLayout.getItemStacks().init(0, true, 39, 41);
if (inputs.get(0) instanceof ItemStack) {
recipeLayout.getItemStacks().set(0, ((ItemStack) inputs.get(0)));
} else {
recipeLayout.getItemStacks().set(0, ((Collection<ItemStack>) inputs.get(0)));
}
recipeLayout.getItemStacks().init(0, true, 39, 41);
if(inputs.get(0) instanceof ItemStack) {
recipeLayout.getItemStacks().set(0, ((ItemStack) inputs.get(0)));
} else {
recipeLayout.getItemStacks().set(0, ((Collection<ItemStack>) inputs.get(0)));
}
int index = 1, posX = 60;
for (Object o : wrapper.getInputs()) {
recipeLayout.getItemStacks().init(index, true, posX, 6);
if (o instanceof ItemStack) {
recipeLayout.getItemStacks().set(index, ((ItemStack) o));
} else if (o instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) o));
}
index++;
posX += 18;
}
int index = 1, posX = 60;
for(int i = 1; i < wrapper.getInputs().size(); i++) {
Object o = wrapper.getInputs().get(i);
recipeLayout.getItemStacks().init(index, true, posX, 6);
if(o instanceof ItemStack) {
recipeLayout.getItemStacks().set(index, ((ItemStack) o));
} else if(o instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) o));
}
index++;
posX += 18;
}
recipeLayout.getItemStacks().init(7, false, 87, 41);
recipeLayout.getItemStacks().set(7, wrapper.getOutputs().get(0));
}
recipeLayout.getItemStacks().init(7, false, 87, 41);
recipeLayout.getItemStacks().set(7, wrapper.getOutputs());
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -16,27 +16,27 @@ import javax.annotation.Nonnull;
public class BreweryRecipeHandler implements IRecipeHandler<RecipeBrew> {
@Nonnull
@Override
public Class<RecipeBrew> getRecipeClass() {
return RecipeBrew.class;
}
@Nonnull
@Override
public Class<RecipeBrew> getRecipeClass() {
return RecipeBrew.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.brewery";
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.brewery";
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeBrew recipe) {
return new BreweryRecipeWrapper(recipe);
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeBrew recipe) {
return new BreweryRecipeWrapper(recipe);
}
@Override
public boolean isRecipeValid(@Nonnull RecipeBrew recipe) {
return recipe.getInputs().size() <= 6;
}
@Override
public boolean isRecipeValid(@Nonnull RecipeBrew recipe) {
return recipe.getInputs().size() <= 6;
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -22,45 +22,51 @@ import java.util.List;
public class BreweryRecipeWrapper implements IRecipeWrapper {
private final List input;
private final ItemStack output;
private final List input;
private final List<ItemStack> output;
public BreweryRecipeWrapper(RecipeBrew recipeBrew) {
ImmutableList.Builder builder = ImmutableList.builder();
builder.add(new ItemStack(ModItems.vial));
for (Object o : recipeBrew.getInputs()) {
if (o instanceof ItemStack) {
builder.add(o);
}
if (o instanceof String) {
builder.add(OreDictionary.getOres(((String) o)));
}
}
public BreweryRecipeWrapper(RecipeBrew recipeBrew) {
ImmutableList.Builder builder = ImmutableList.builder();
builder.add(ImmutableList.of(new ItemStack(ModItems.vial, 1, 0), new ItemStack(ModItems.vial, 1, 1)));
for(Object o : recipeBrew.getInputs()) {
if(o instanceof ItemStack) {
builder.add(o);
}
if(o instanceof String) {
builder.add(OreDictionary.getOres(((String) o)));
}
}
input = builder.build();
output = recipeBrew.getOutput(new ItemStack(ModItems.vial)).copy();
}
input = builder.build();
output = ImmutableList.of(recipeBrew.getOutput(new ItemStack(ModItems.vial)).copy(), recipeBrew.getOutput(new ItemStack(ModItems.vial, 1, 1)).copy());
}
@Override
public List getInputs() {
return input;
}
@Override
public List getInputs() {
return input;
}
@Override
public List<ItemStack> getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<ItemStack> getOutputs() {
return output;
}
@Override
public List<FluidStack> getFluidInputs() { return ImmutableList.of(); }
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() { return ImmutableList.of(); }
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -31,81 +31,81 @@ import java.util.Collection;
public class ElvenTradeRecipeCategory implements IRecipeCategory {
private final String localizedName;
private final IDrawable background;
private final IDrawable overlay;
private final String localizedName;
private final IDrawable background;
private final IDrawable overlay;
public ElvenTradeRecipeCategory(IGuiHelper guiHelper) {
localizedName = StatCollector.translateToLocal("botania.nei.elvenTrade");
background = guiHelper.createBlankDrawable(145, 95);
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/elvenTradeOverlay.png"), 0, 15, 140, 90);
}
public ElvenTradeRecipeCategory(IGuiHelper guiHelper) {
localizedName = StatCollector.translateToLocal("botania.nei.elvenTrade");
background = guiHelper.createBlankDrawable(145, 95);
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/elvenTradeOverlay.png"), 0, 15, 140, 90);
}
@Nonnull
@Override
public String getUid() {
return "botania.elvenTrade";
}
@Nonnull
@Override
public String getUid() {
return "botania.elvenTrade";
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft, 0, 4);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft, 0, 4);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawAnimations(Minecraft minecraft) {
minecraft.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
TextureAtlasSprite sprite = MiscellaneousIcons.INSTANCE.alfPortalTex;
Tessellator tess = Tessellator.getInstance();
WorldRenderer wr = tess.getWorldRenderer();
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
int startX = 22;
int startY = 25;
int stopX = 70;
int stopY = 73;
wr.pos(startX, startY, 0).tex(sprite.getMinU(), sprite.getMinV()).endVertex();
wr.pos(startX, stopY, 0).tex(sprite.getMinU(), sprite.getMaxV()).endVertex();
wr.pos(stopX, stopY, 0).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex();
wr.pos(stopX, startY, 0).tex(sprite.getMaxU(), sprite.getMinV()).endVertex();
tess.draw();
}
@Override
public void drawAnimations(Minecraft minecraft) {
minecraft.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
TextureAtlasSprite sprite = MiscellaneousIcons.INSTANCE.alfPortalTex;
Tessellator tess = Tessellator.getInstance();
WorldRenderer wr = tess.getWorldRenderer();
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
int startX = 22;
int startY = 25;
int stopX = 70;
int stopY = 73;
wr.pos(startX, startY, 0).tex(sprite.getMinU(), sprite.getMinV()).endVertex();
wr.pos(startX, stopY, 0).tex(sprite.getMinU(), sprite.getMaxV()).endVertex();
wr.pos(stopX, stopY, 0).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex();
wr.pos(stopX, startY, 0).tex(sprite.getMaxU(), sprite.getMinV()).endVertex();
tess.draw();
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if (!(recipeWrapper instanceof ElvenTradeRecipeWrapper))
return;
ElvenTradeRecipeWrapper wrapper = ((ElvenTradeRecipeWrapper) recipeWrapper);
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if(!(recipeWrapper instanceof ElvenTradeRecipeWrapper))
return;
ElvenTradeRecipeWrapper wrapper = ((ElvenTradeRecipeWrapper) recipeWrapper);
int index = 0, posX = 42;
for (Object o : wrapper.getInputs()) {
recipeLayout.getItemStacks().init(index, true, posX, 0);
if (o instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) o));
} else {
recipeLayout.getItemStacks().set(index, ((ItemStack) o));
}
index++;
posX += 18;
}
int index = 0, posX = 42;
for(Object o : wrapper.getInputs()) {
recipeLayout.getItemStacks().init(index, true, posX, 0);
if(o instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) o));
} else {
recipeLayout.getItemStacks().set(index, ((ItemStack) o));
}
index++;
posX += 18;
}
recipeLayout.getItemStacks().init(index, false, 93, 41);
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
}
recipeLayout.getItemStacks().init(index, false, 93, 41);
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -16,27 +16,27 @@ import javax.annotation.Nonnull;
public class ElvenTradeRecipeHandler implements IRecipeHandler<RecipeElvenTrade> {
@Nonnull
@Override
public Class<RecipeElvenTrade> getRecipeClass() {
return RecipeElvenTrade.class;
}
@Nonnull
@Override
public Class<RecipeElvenTrade> getRecipeClass() {
return RecipeElvenTrade.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.elvenTrade";
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.elvenTrade";
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeElvenTrade recipe) {
return new ElvenTradeRecipeWrapper(recipe);
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeElvenTrade recipe) {
return new ElvenTradeRecipeWrapper(recipe);
}
@Override
public boolean isRecipeValid(@Nonnull RecipeElvenTrade recipe) {
return true;
}
@Override
public boolean isRecipeValid(@Nonnull RecipeElvenTrade recipe) {
return true;
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -21,47 +21,49 @@ import java.util.List;
public class ElvenTradeRecipeWrapper implements IRecipeWrapper {
private final List input;
private final ItemStack output;
private final List input;
private final ItemStack output;
public ElvenTradeRecipeWrapper(RecipeElvenTrade recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
for (Object o : recipe.getInputs()) {
if (o instanceof ItemStack) {
builder.add(o);
}
if (o instanceof String) {
builder.add(OreDictionary.getOres(((String) o)));
}
}
input = builder.build();
output = recipe.getOutput();
}
public ElvenTradeRecipeWrapper(RecipeElvenTrade recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
for(Object o : recipe.getInputs()) {
if(o instanceof ItemStack) {
builder.add(o);
}
if(o instanceof String) {
builder.add(OreDictionary.getOres(((String) o)));
}
}
input = builder.build();
output = recipe.getOutput();
}
@Override
public List getInputs() {
return input;
}
@Override
public List getInputs() {
return input;
}
@Override
public List<ItemStack> getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<ItemStack> getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -25,81 +25,82 @@ import java.util.Collection;
public class ManaPoolRecipeCategory implements IRecipeCategory {
private final IDrawable background;
private final String localizedName;
private final IDrawable overlay;
private final IDrawable background;
private final String localizedName;
private final IDrawable overlay;
public ManaPoolRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(168, 64);
localizedName = StatCollector.translateToLocal("botania.nei.manaPool");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
0, 0, 64, 46);
}
public ManaPoolRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(168, 64);
localizedName = StatCollector.translateToLocal("botania.nei.manaPool");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
0, 0, 64, 46);
}
@Nonnull
@Override
public String getUid() {
return "botania.manaPool";
}
@Nonnull
@Override
public String getUid() {
return "botania.manaPool";
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft, 48, 0);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft, 48, 0);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawAnimations(Minecraft minecraft) {}
@Override
public void drawAnimations(Minecraft minecraft) {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if (!(recipeWrapper instanceof ManaPoolRecipeWrapper))
return;
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if(!(recipeWrapper instanceof ManaPoolRecipeWrapper))
return;
ManaPoolRecipeWrapper wrapper = ((ManaPoolRecipeWrapper) recipeWrapper);
int index = 0;
ManaPoolRecipeWrapper wrapper = ((ManaPoolRecipeWrapper) recipeWrapper);
int index = 0;
recipeLayout.getItemStacks().init(index, true, 40, 12);
if (wrapper.getInputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) wrapper.getInputs().get(0)));
} else {
recipeLayout.getItemStacks().set(index, ((ItemStack) wrapper.getInputs().get(0)));
}
recipeLayout.getItemStacks().init(index, true, 40, 12);
if(wrapper.getInputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) wrapper.getInputs().get(0)));
} else {
recipeLayout.getItemStacks().set(index, ((ItemStack) wrapper.getInputs().get(0)));
}
index++;
index++;
if (wrapper.getInputs().size() > 1) {
// Has catalyst
recipeLayout.getItemStacks().init(index, true, 20, 12);
recipeLayout.getItemStacks().set(index, ((ItemStack) wrapper.getInputs().get(1)));
index++;
}
if(wrapper.getInputs().size() > 1) {
// Has catalyst
recipeLayout.getItemStacks().init(index, true, 20, 12);
recipeLayout.getItemStacks().set(index, ((ItemStack) wrapper.getInputs().get(1)));
index++;
}
recipeLayout.getItemStacks().init(index, true, 70, 12);
recipeLayout.getItemStacks().set(index, new ItemStack(ModBlocks.pool, 1, 0));
index++;
recipeLayout.getItemStacks().init(index, true, 70, 12);
recipeLayout.getItemStacks().set(index, new ItemStack(ModBlocks.pool, 1, 0));
index++;
recipeLayout.getItemStacks().init(index, false, 99, 12);
if (wrapper.getOutputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) wrapper.getOutputs().get(0)));
} else {
recipeLayout.getItemStacks().set(index, ((ItemStack) wrapper.getOutputs().get(0)));
}
}
recipeLayout.getItemStacks().init(index, false, 99, 12);
if(wrapper.getOutputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) wrapper.getOutputs().get(0)));
} else {
recipeLayout.getItemStacks().set(index, ((ItemStack) wrapper.getOutputs().get(0)));
}
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -16,27 +16,27 @@ import javax.annotation.Nonnull;
public class ManaPoolRecipeHandler implements IRecipeHandler<RecipeManaInfusion> {
@Nonnull
@Override
public Class<RecipeManaInfusion> getRecipeClass() {
return RecipeManaInfusion.class;
}
@Nonnull
@Override
public Class<RecipeManaInfusion> getRecipeClass() {
return RecipeManaInfusion.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.manaPool";
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.manaPool";
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeManaInfusion recipe) {
return new ManaPoolRecipeWrapper(recipe);
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeManaInfusion recipe) {
return new ManaPoolRecipeWrapper(recipe);
}
@Override
public boolean isRecipeValid(@Nonnull RecipeManaInfusion recipe) {
return recipe.getManaToConsume() <= 100000;
}
@Override
public boolean isRecipeValid(@Nonnull RecipeManaInfusion recipe) {
return recipe.getManaToConsume() <= 100000;
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -25,58 +25,59 @@ import java.util.List;
public class ManaPoolRecipeWrapper implements IRecipeWrapper {
private final List input;
private final ItemStack output;
private final int mana;
private final List input;
private final ItemStack output;
private final int mana;
public ManaPoolRecipeWrapper(RecipeManaInfusion recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
public ManaPoolRecipeWrapper(RecipeManaInfusion recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
if (recipe.getInput() instanceof ItemStack) {
builder.add(recipe.getInput());
} else if (recipe.getInput() instanceof String) {
builder.add(OreDictionary.getOres(((String) recipe.getInput())));
}
if(recipe.getInput() instanceof ItemStack) {
builder.add(recipe.getInput());
} else if(recipe.getInput() instanceof String) {
builder.add(OreDictionary.getOres(((String) recipe.getInput())));
}
if (recipe.isAlchemy()) {
builder.add(new ItemStack(ModBlocks.alchemyCatalyst));
} else if (recipe.isConjuration()) {
builder.add(new ItemStack(ModBlocks.conjurationCatalyst));
}
if(recipe.isAlchemy()) {
builder.add(new ItemStack(ModBlocks.alchemyCatalyst));
} else if(recipe.isConjuration()) {
builder.add(new ItemStack(ModBlocks.conjurationCatalyst));
}
input = builder.build();
output = recipe.getOutput();
mana = recipe.getManaToConsume();
}
input = builder.build();
output = recipe.getOutput();
mana = recipe.getManaToConsume();
}
@Override
public List getInputs() {
return input;
}
@Override
public List getInputs() {
return input;
}
@Override
public List getOutputs() {
return ImmutableList.of(output);
}
@Override
public List getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
GlStateManager.enableAlpha();
HUDHandler.renderManaBar(28, 50, 0x0000FF, 0.75F, mana, TilePool.MAX_MANA / 10);
GlStateManager.disableAlpha();
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
GlStateManager.enableAlpha();
HUDHandler.renderManaBar(28, 50, 0x0000FF, 0.75F, mana, TilePool.MAX_MANA / 10);
GlStateManager.disableAlpha();
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -27,81 +27,82 @@ import java.util.Collection;
public class PetalApothecaryRecipeCategory implements IRecipeCategory {
private final IDrawableStatic background;
private final String localizedName;
private final IDrawableStatic overlay;
private final IDrawableStatic background;
private final String localizedName;
private final IDrawableStatic overlay;
public PetalApothecaryRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(150, 110);
localizedName = StatCollector.translateToLocal("botania.nei.petalApothecary");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/petalOverlay.png"),
0, 0, 150, 110);
}
public PetalApothecaryRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(150, 110);
localizedName = StatCollector.translateToLocal("botania.nei.petalApothecary");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/petalOverlay.png"),
0, 0, 150, 110);
}
@Nonnull
@Override
public String getUid() {
return "botania.petals";
}
@Nonnull
@Override
public String getUid() {
return "botania.petals";
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawAnimations(Minecraft minecraft) {}
@Override
public void drawAnimations(Minecraft minecraft) {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if (!(recipeWrapper instanceof PetalApothecaryRecipeWrapper))
return;
PetalApothecaryRecipeWrapper wrapper = ((PetalApothecaryRecipeWrapper) recipeWrapper);
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if(!(recipeWrapper instanceof PetalApothecaryRecipeWrapper))
return;
PetalApothecaryRecipeWrapper wrapper = ((PetalApothecaryRecipeWrapper) recipeWrapper);
recipeLayout.getItemStacks().init(0, true, 64, 52);
recipeLayout.getItemStacks().set(0, new ItemStack(ModBlocks.altar));
recipeLayout.getItemStacks().init(0, true, 64, 52);
recipeLayout.getItemStacks().set(0, new ItemStack(ModBlocks.altar));
int index = 1;
double angleBetweenEach = 360.0 / wrapper.getInputs().size();
Point point = new Point(64, 20), center = new Point(64, 52);
int index = 1;
double angleBetweenEach = 360.0 / wrapper.getInputs().size();
Point point = new Point(64, 20), center = new Point(64, 52);
for (Object o : wrapper.getInputs()) {
recipeLayout.getItemStacks().init(index, true, point.x, point.y);
if (o instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) o));
}
if (o instanceof ItemStack) {
recipeLayout.getItemStacks().set(index, ((ItemStack) o));
}
index += 1;
point = rotatePointAbout(point, center, angleBetweenEach);
}
for(Object o : wrapper.getInputs()) {
recipeLayout.getItemStacks().init(index, true, point.x, point.y);
if(o instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) o));
}
if(o instanceof ItemStack) {
recipeLayout.getItemStacks().set(index, ((ItemStack) o));
}
index += 1;
point = rotatePointAbout(point, center, angleBetweenEach);
}
recipeLayout.getItemStacks().init(index, false, 103, 17);
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
}
recipeLayout.getItemStacks().init(index, false, 103, 17);
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
}
private Point rotatePointAbout(Point in, Point about, double degrees) {
double rad = degrees * Math.PI / 180.0;
double newX = Math.cos(rad) * (in.x - about.x) - Math.sin(rad) * (in.y - about.y) + about.x;
double newY = Math.sin(rad) * (in.x - about.x) + Math.cos(rad) * (in.y - about.y) + about.y;
return new Point(((int) newX), ((int) newY));
}
private Point rotatePointAbout(Point in, Point about, double degrees) {
double rad = degrees * Math.PI / 180.0;
double newX = Math.cos(rad) * (in.x - about.x) - Math.sin(rad) * (in.y - about.y) + about.x;
double newY = Math.sin(rad) * (in.x - about.x) + Math.cos(rad) * (in.y - about.y) + about.y;
return new Point(((int) newX), ((int) newY));
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -16,27 +16,27 @@ import javax.annotation.Nonnull;
public class PetalApothecaryRecipeHandler implements IRecipeHandler<RecipePetals> {
@Nonnull
@Override
public Class<RecipePetals> getRecipeClass() {
return RecipePetals.class;
}
@Nonnull
@Override
public Class<RecipePetals> getRecipeClass() {
return RecipePetals.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.petals";
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.petals";
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipePetals recipe) {
return new PetalApothecaryRecipeWrapper(recipe);
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipePetals recipe) {
return new PetalApothecaryRecipeWrapper(recipe);
}
@Override
public boolean isRecipeValid(@Nonnull RecipePetals recipe) {
return recipe.getInputs().size() <= 16;
}
@Override
public boolean isRecipeValid(@Nonnull RecipePetals recipe) {
return recipe.getInputs().size() <= 16;
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -21,47 +21,49 @@ import java.util.List;
public class PetalApothecaryRecipeWrapper implements IRecipeWrapper {
private final List input;
private final ItemStack output;
private final List input;
private final ItemStack output;
public PetalApothecaryRecipeWrapper(RecipePetals recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
for (Object o : recipe.getInputs()) {
if (o instanceof ItemStack) {
builder.add(o);
}
if (o instanceof String) {
builder.add(OreDictionary.getOres(((String) o)));
}
}
input = builder.build();
output = recipe.getOutput();
}
public PetalApothecaryRecipeWrapper(RecipePetals recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
for(Object o : recipe.getInputs()) {
if(o instanceof ItemStack) {
builder.add(o);
}
if(o instanceof String) {
builder.add(OreDictionary.getOres(((String) o)));
}
}
input = builder.build();
output = recipe.getOutput();
}
@Override
public List getInputs() {
return input;
}
@Override
public List getInputs() {
return input;
}
@Override
public List<ItemStack> getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<ItemStack> getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -26,83 +26,84 @@ import java.util.Collection;
public class PureDaisyRecipeCategory implements IRecipeCategory {
private final IDrawable background;
private final String localizedName;
private final IDrawable overlay;
private final IDrawable background;
private final String localizedName;
private final IDrawable overlay;
public PureDaisyRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(168, 64);
localizedName = StatCollector.translateToLocal("botania.nei.pureDaisy");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
0, 0, 64, 46);
}
public PureDaisyRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(168, 64);
localizedName = StatCollector.translateToLocal("botania.nei.pureDaisy");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
0, 0, 64, 46);
}
@Nonnull
@Override
public String getUid() {
return "botania.pureDaisy";
}
@Nonnull
@Override
public String getUid() {
return "botania.pureDaisy";
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft, 48, 0);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft, 48, 0);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawAnimations(Minecraft minecraft) {}
@Override
public void drawAnimations(Minecraft minecraft) {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if (!(recipeWrapper instanceof PureDaisyRecipeWrapper))
return;
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if(!(recipeWrapper instanceof PureDaisyRecipeWrapper))
return;
PureDaisyRecipeWrapper wrapper = ((PureDaisyRecipeWrapper) recipeWrapper);
boolean inputFluid = wrapper.getInputs().isEmpty();
boolean outputFluid = wrapper.getOutputs().isEmpty();
PureDaisyRecipeWrapper wrapper = ((PureDaisyRecipeWrapper) recipeWrapper);
boolean inputFluid = wrapper.getInputs().isEmpty();
boolean outputFluid = wrapper.getOutputs().isEmpty();
if (inputFluid) {
recipeLayout.getFluidStacks().init(0, true, 40, 12, 16, 16, 1000, false, null);
recipeLayout.getFluidStacks().set(0, wrapper.getFluidInputs().get(0));
} else {
recipeLayout.getItemStacks().init(0, true, 40, 12);
if (wrapper.getInputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(0, ((Collection<ItemStack>) wrapper.getInputs().get(0)));
} else {
recipeLayout.getItemStacks().set(0, ((ItemStack) wrapper.getInputs().get(0)));
}
}
if(inputFluid) {
recipeLayout.getFluidStacks().init(0, true, 40, 12, 16, 16, 1000, false, null);
recipeLayout.getFluidStacks().set(0, wrapper.getFluidInputs().get(0));
} else {
recipeLayout.getItemStacks().init(0, true, 40, 12);
if(wrapper.getInputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(0, ((Collection<ItemStack>) wrapper.getInputs().get(0)));
} else {
recipeLayout.getItemStacks().set(0, ((ItemStack) wrapper.getInputs().get(0)));
}
}
recipeLayout.getItemStacks().init(1, true, 70, 12);
recipeLayout.getItemStacks().set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY));
recipeLayout.getItemStacks().init(1, true, 70, 12);
recipeLayout.getItemStacks().set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY));
if (outputFluid) {
recipeLayout.getFluidStacks().init(2, false, 99, 12, 16, 16, 1000, false, null);
recipeLayout.getFluidStacks().set(2, wrapper.getFluidOutputs().get(0));
} else {
recipeLayout.getItemStacks().init(2, false, 99, 12);
if (wrapper.getOutputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(2, ((Collection<ItemStack>) wrapper.getOutputs().get(0)));
} else {
recipeLayout.getItemStacks().set(2, ((ItemStack) wrapper.getOutputs().get(0)));
}
}
}
if(outputFluid) {
recipeLayout.getFluidStacks().init(2, false, 99, 12, 16, 16, 1000, false, null);
recipeLayout.getFluidStacks().set(2, wrapper.getFluidOutputs().get(0));
} else {
recipeLayout.getItemStacks().init(2, false, 99, 12);
if(wrapper.getOutputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(2, ((Collection<ItemStack>) wrapper.getOutputs().get(0)));
} else {
recipeLayout.getItemStacks().set(2, ((ItemStack) wrapper.getOutputs().get(0)));
}
}
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -16,27 +16,27 @@ import javax.annotation.Nonnull;
public class PureDaisyRecipeHandler implements IRecipeHandler<RecipePureDaisy> {
@Nonnull
@Override
public Class<RecipePureDaisy> getRecipeClass() {
return RecipePureDaisy.class;
}
@Nonnull
@Override
public Class<RecipePureDaisy> getRecipeClass() {
return RecipePureDaisy.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.pureDaisy";
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.pureDaisy";
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipePureDaisy recipe) {
return new PureDaisyRecipeWrapper(recipe);
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipePureDaisy recipe) {
return new PureDaisyRecipeWrapper(recipe);
}
@Override
public boolean isRecipeValid(@Nonnull RecipePureDaisy recipe) {
return true;
}
@Override
public boolean isRecipeValid(@Nonnull RecipePureDaisy recipe) {
return true;
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -23,55 +23,57 @@ import java.util.List;
public class PureDaisyRecipeWrapper implements IRecipeWrapper {
private List inputs = ImmutableList.of();
private List outputs = ImmutableList.of();
private List<FluidStack> fluidInputs = ImmutableList.of();
private List<FluidStack> fluidOutputs = ImmutableList.of();
private List inputs = ImmutableList.of();
private List outputs = ImmutableList.of();
private List<FluidStack> fluidInputs = ImmutableList.of();
private List<FluidStack> fluidOutputs = ImmutableList.of();
public PureDaisyRecipeWrapper(RecipePureDaisy recipe) {
if (recipe.getInput() instanceof String) {
inputs = ImmutableList.of(OreDictionary.getOres(((String) recipe.getInput())));
} else if (recipe.getInput() instanceof Block) {
Block b = ((Block) recipe.getInput());
if (FluidRegistry.lookupFluidForBlock(b) != null) {
fluidInputs = ImmutableList.of(new FluidStack(FluidRegistry.lookupFluidForBlock(b), 1000));
} else {
inputs = ImmutableList.of(new ItemStack(b, 1, b.getMetaFromState(b.getDefaultState())));
}
}
public PureDaisyRecipeWrapper(RecipePureDaisy recipe) {
if(recipe.getInput() instanceof String) {
inputs = ImmutableList.of(OreDictionary.getOres(((String) recipe.getInput())));
} else if(recipe.getInput() instanceof Block) {
Block b = ((Block) recipe.getInput());
if(FluidRegistry.lookupFluidForBlock(b) != null) {
fluidInputs = ImmutableList.of(new FluidStack(FluidRegistry.lookupFluidForBlock(b), 1000));
} else {
inputs = ImmutableList.of(new ItemStack(b, 1, b.getMetaFromState(b.getDefaultState())));
}
}
Block outBlock = recipe.getOutputState().getBlock();
if (FluidRegistry.lookupFluidForBlock(outBlock) != null) {
fluidOutputs = ImmutableList.of(new FluidStack(FluidRegistry.lookupFluidForBlock(outBlock), 1000));
} else {
outputs = ImmutableList.of(new ItemStack(outBlock, 1, outBlock.getMetaFromState(recipe.getOutputState())));
}
}
Block outBlock = recipe.getOutputState().getBlock();
if(FluidRegistry.lookupFluidForBlock(outBlock) != null) {
fluidOutputs = ImmutableList.of(new FluidStack(FluidRegistry.lookupFluidForBlock(outBlock), 1000));
} else {
outputs = ImmutableList.of(new ItemStack(outBlock, 1, outBlock.getMetaFromState(recipe.getOutputState())));
}
}
@Override
public List getInputs() {
return inputs;
}
@Override
public List getInputs() {
return inputs;
}
@Override
public List getOutputs() {
return outputs;
}
@Override
public List getOutputs() {
return outputs;
}
@Override
public List<FluidStack> getFluidInputs() {
return fluidInputs;
}
@Override
public List<FluidStack> getFluidInputs() {
return fluidInputs;
}
@Override
public List<FluidStack> getFluidOutputs() {
return fluidOutputs;
}
@Override
public List<FluidStack> getFluidOutputs() {
return fluidOutputs;
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -26,81 +26,82 @@ import java.util.Collection;
public class RunicAltarRecipeCategory implements IRecipeCategory {
private final IDrawable background;
private final String localizedName;
private final IDrawable overlay;
private final IDrawable background;
private final String localizedName;
private final IDrawable overlay;
public RunicAltarRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(150, 110);
localizedName = StatCollector.translateToLocal("botania.nei.runicAltar");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/petalOverlay.png"),
0, 0, 150, 110);
}
public RunicAltarRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(150, 110);
localizedName = StatCollector.translateToLocal("botania.nei.runicAltar");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/petalOverlay.png"),
0, 0, 150, 110);
}
@Nonnull
@Override
public String getUid() {
return "botania.runicAltar";
}
@Nonnull
@Override
public String getUid() {
return "botania.runicAltar";
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawAnimations(Minecraft minecraft) {}
@Override
public void drawAnimations(Minecraft minecraft) {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if (!(recipeWrapper instanceof RunicAltarRecipeWrapper))
return;
RunicAltarRecipeWrapper wrapper = ((RunicAltarRecipeWrapper) recipeWrapper);
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if(!(recipeWrapper instanceof RunicAltarRecipeWrapper))
return;
RunicAltarRecipeWrapper wrapper = ((RunicAltarRecipeWrapper) recipeWrapper);
recipeLayout.getItemStacks().init(0, true, 64, 52);
recipeLayout.getItemStacks().set(0, new ItemStack(ModBlocks.runeAltar));
recipeLayout.getItemStacks().init(0, true, 64, 52);
recipeLayout.getItemStacks().set(0, new ItemStack(ModBlocks.runeAltar));
int index = 1;
double angleBetweenEach = 360.0 / wrapper.getInputs().size();
Point point = new Point(64, 20), center = new Point(64, 52);
int index = 1;
double angleBetweenEach = 360.0 / wrapper.getInputs().size();
Point point = new Point(64, 20), center = new Point(64, 52);
for (Object o : wrapper.getInputs()) {
recipeLayout.getItemStacks().init(index, true, point.x, point.y);
if (o instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) o));
}
if (o instanceof ItemStack) {
recipeLayout.getItemStacks().set(index, ((ItemStack) o));
}
index += 1;
point = rotatePointAbout(point, center, angleBetweenEach);
}
for(Object o : wrapper.getInputs()) {
recipeLayout.getItemStacks().init(index, true, point.x, point.y);
if(o instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) o));
}
if(o instanceof ItemStack) {
recipeLayout.getItemStacks().set(index, ((ItemStack) o));
}
index += 1;
point = rotatePointAbout(point, center, angleBetweenEach);
}
recipeLayout.getItemStacks().init(index, false, 103, 17);
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
}
recipeLayout.getItemStacks().init(index, false, 103, 17);
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
}
private Point rotatePointAbout(Point in, Point about, double degrees) {
double rad = degrees * Math.PI / 180.0;
double newX = Math.cos(rad) * (in.x - about.x) - Math.sin(rad) * (in.y - about.y) + about.x;
double newY = Math.sin(rad) * (in.x - about.x) + Math.cos(rad) * (in.y - about.y) + about.y;
return new Point(((int) newX), ((int) newY));
}
private Point rotatePointAbout(Point in, Point about, double degrees) {
double rad = degrees * Math.PI / 180.0;
double newX = Math.cos(rad) * (in.x - about.x) - Math.sin(rad) * (in.y - about.y) + about.x;
double newY = Math.sin(rad) * (in.x - about.x) + Math.cos(rad) * (in.y - about.y) + about.y;
return new Point(((int) newX), ((int) newY));
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -16,27 +16,27 @@ import javax.annotation.Nonnull;
public class RunicAltarRecipeHandler implements IRecipeHandler<RecipeRuneAltar> {
@Nonnull
@Override
public Class<RecipeRuneAltar> getRecipeClass() {
return RecipeRuneAltar.class;
}
@Nonnull
@Override
public Class<RecipeRuneAltar> getRecipeClass() {
return RecipeRuneAltar.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.runicAltar";
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.runicAltar";
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeRuneAltar recipe) {
return new RunicAltarRecipeWrapper(recipe);
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeRuneAltar recipe) {
return new RunicAltarRecipeWrapper(recipe);
}
@Override
public boolean isRecipeValid(@Nonnull RecipeRuneAltar recipe) {
return recipe.getInputs().size() <= 16;
}
@Override
public boolean isRecipeValid(@Nonnull RecipeRuneAltar recipe) {
return recipe.getInputs().size() <= 16;
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -24,53 +24,54 @@ import java.util.List;
public class RunicAltarRecipeWrapper implements IRecipeWrapper {
private final List input;
private final ItemStack output;
private final int manaUsage;
private final List input;
private final ItemStack output;
private final int manaUsage;
public RunicAltarRecipeWrapper(RecipeRuneAltar recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
for (Object o : recipe.getInputs()) {
if (o instanceof ItemStack) {
builder.add(o);
}
if (o instanceof String) {
builder.add(OreDictionary.getOres(((String) o)));
}
}
input = builder.build();
output = recipe.getOutput();
manaUsage = recipe.getManaUsage();
}
public RunicAltarRecipeWrapper(RecipeRuneAltar recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
for(Object o : recipe.getInputs()) {
if(o instanceof ItemStack) {
builder.add(o);
}
if(o instanceof String) {
builder.add(OreDictionary.getOres(((String) o)));
}
}
input = builder.build();
output = recipe.getOutput();
manaUsage = recipe.getManaUsage();
}
@Override
public List getInputs() {
return input;
}
@Override
public List getInputs() {
return input;
}
@Override
public List<ItemStack> getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<ItemStack> getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
GlStateManager.enableAlpha();
HUDHandler.renderManaBar(28, 113, 0x0000FF, 0.75F, manaUsage, TilePool.MAX_MANA / 10);
GlStateManager.disableAlpha();
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
GlStateManager.enableAlpha();
HUDHandler.renderManaBar(28, 113, 0x0000FF, 0.75F, manaUsage, TilePool.MAX_MANA / 10);
GlStateManager.disableAlpha();
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
}
@@ -1,36 +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 @ [Jan 21, 2014, 8:03:06 PM (GMT)]
*/
package vazkii.botania.client.lib;
public final class LibRenderIDs {
public static int idAltar = -1;
public static int idSpecialFlower = -1;
public static int idSpreader = -1;
public static int idPool = -1;
public static int idPylon = -1;
public static int idMiniIsland = -1;
public static int idTinyPotato = -1;
public static int idSpawnerClaw = -1;
public static int idBrewery = -1;
public static int idCorporeaIndex = -1;
public static int idPump = -1;
public static int idDoubleFlower = -1;
public static int idCorporeaCrystalCybe = -1;
public static int idIncensePlate = -1;
public static int idHourglass = -1;
public static int idCocoon = -1;
public static int idLightRelay = -1;
public static int idBellows = -1;
public static int idTeruTeruBozu = -1;
public static int idAvatar = -1;
}
@@ -2,16 +2,14 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.client.model;
import com.google.common.base.Function;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.Table;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@@ -25,7 +23,6 @@ import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.client.resources.model.ModelManager;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.client.model.ISmartBlockModel;
@@ -35,10 +32,11 @@ import net.minecraftforge.client.model.pipeline.IVertexConsumer;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import net.minecraftforge.client.model.pipeline.VertexTransformer;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.fml.common.FMLLog;
import vazkii.botania.api.BotaniaAPIClient;
import vazkii.botania.api.item.IFloatingFlower;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.decor.BlockFloatingFlower;
import vazkii.botania.common.block.decor.IFloatingFlower;
import vazkii.botania.common.item.block.ItemBlockFloatingSpecialFlower;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
@@ -49,160 +47,203 @@ import java.util.stream.Collectors;
public class FloatingFlowerModel implements ISmartItemModel, ISmartBlockModel, IResourceManagerReloadListener {
public static final FloatingFlowerModel INSTANCE = new FloatingFlowerModel();
public static final FloatingFlowerModel INSTANCE = new FloatingFlowerModel();
private static final String MUNDANE_PREFIX = "botania:shimmeringFlower_";
private static Table<IFloatingFlower.IslandType, String, CompositeBakedModel> CACHE = HashBasedTable.create();
private static Table<IFloatingFlower.IslandType, String, CompositeBakedModel> CACHE = HashBasedTable.create();
protected static BakedQuad transform(BakedQuad quad, final TRSRTransformation transform) {
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(DefaultVertexFormats.ITEM);
final IVertexConsumer consumer = new VertexTransformer(builder) {
@Override
public void put(int element, float... data) {
VertexFormatElement formatElement = DefaultVertexFormats.ITEM.getElement(element);
switch(formatElement.getUsage()) {
case POSITION: {
float[] newData = new float[4];
Vector4f vec = new Vector4f(data);
transform.getMatrix().transform(vec);
vec.get(newData);
parent.put(element, newData);
break;
}
default: {
parent.put(element, data);
break;
}
}
}
};
quad.pipe(consumer);
return builder.build();
}
private static final String MUNDANE_PREFIX = "botania:shimmeringFlower_";
@Override
public void onResourceManagerReload(IResourceManager resourceManager) {
CACHE.clear();
}
@Override
public void onResourceManagerReload(IResourceManager resourceManager) {
CACHE.clear();
}
@Override
public IBakedModel handleItemState(ItemStack stack) {
// Items always have GRASS island
IFloatingFlower.IslandType islandType = IFloatingFlower.IslandType.GRASS;
String identifier;
@Override
public IBakedModel handleItemState(ItemStack stack) {
// Items always have GRASS island
IFloatingFlower.IslandType islandType = IFloatingFlower.IslandType.GRASS;
String identifier;
if(Block.getBlockFromItem(stack.getItem()) == ModBlocks.floatingSpecialFlower) {
// Magic flower
identifier = ItemBlockFloatingSpecialFlower.getType(stack);
} else {
// Mundane flower
identifier = MUNDANE_PREFIX + stack.getItemDamage();
}
if (Block.getBlockFromItem(stack.getItem()) == ModBlocks.floatingSpecialFlower) {
// Magic flower
identifier = ItemBlockFloatingSpecialFlower.getType(stack);
} else {
// Mundane flower
identifier = MUNDANE_PREFIX + stack.getItemDamage();
}
return getModel(islandType, identifier);
}
return getModel(islandType, identifier);
}
@Override
public IBakedModel handleBlockState(IBlockState state) {
if(state.getBlock() != ModBlocks.floatingSpecialFlower && state.getBlock() != ModBlocks.floatingFlower)
return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
IExtendedBlockState realState = ((IExtendedBlockState) state);
IFloatingFlower.IslandType islandType = realState.getValue(BotaniaStateProps.ISLAND_TYPE);
String identifier;
@Override
public IBakedModel handleBlockState(IBlockState state) {
IFloatingFlower.IslandType islandType = state.getValue(BlockFloatingFlower.ISLAND_TYPE);
String identifier;
if(state.getBlock() == ModBlocks.floatingSpecialFlower) {
// Magic flower
identifier = realState.getValue(BotaniaStateProps.SUBTILE_ID);
} else {
// Mundane flower
identifier = MUNDANE_PREFIX + state.getValue(BotaniaStateProps.COLOR).getMetadata();
}
if (state.getBlock() == ModBlocks.floatingSpecialFlower) {
// Magic flower
IExtendedBlockState realState = ((IExtendedBlockState) state);
identifier = realState.getValue(BotaniaStateProps.SUBTILE_ID);
} else {
// Mundane flower
identifier = MUNDANE_PREFIX + state.getValue(BotaniaStateProps.COLOR).getMetadata();
}
return getModel(islandType, identifier);
}
return getModel(islandType, identifier);
}
// Get the model for this islandtype + flower type combination. If it's not cached already, generate it.
private CompositeBakedModel getModel(IFloatingFlower.IslandType islandType, String identifier) {
ModelManager modelManager = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager();
// Get the model for this islandtype + flower type combination. If it's not cached already, generate it.
private CompositeBakedModel getModel(IFloatingFlower.IslandType islandType, String identifier) {
ModelManager modelManager = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager();
if(CACHE.contains(islandType, identifier)) {
return CACHE.get(islandType, identifier);
} else {
IBakedModel islandModel = modelManager.getModel(BotaniaAPIClient.getRegisteredIslandTypeModels().get(islandType));
IBakedModel flowerModel;
if (CACHE.contains(islandType, identifier)) {
return CACHE.get(islandType, identifier);
} else {
IBakedModel islandModel = modelManager.getModel(new ModelResourceLocation("botania:miniIsland", "variant=" + islandType.getName()));
IBakedModel flowerModel;
if(identifier.startsWith(MUNDANE_PREFIX)) {
int meta = Integer.parseInt(identifier.substring(identifier.indexOf(MUNDANE_PREFIX) + MUNDANE_PREFIX.length()));
flowerModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(new ItemStack(ModBlocks.shinyFlower, 1, meta));
} else {
flowerModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(ItemBlockSpecialFlower.ofType(identifier));
}
if (identifier.startsWith(MUNDANE_PREFIX)) {
int meta = Integer.parseInt(identifier.substring(identifier.indexOf(MUNDANE_PREFIX) + MUNDANE_PREFIX.length()));
flowerModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(new ItemStack(ModBlocks.shinyFlower, 1, meta));
} else {
flowerModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(ItemBlockSpecialFlower.ofType(identifier));
}
// Enhance!
CompositeBakedModel model = new CompositeBakedModel(flowerModel, islandModel);
FMLLog.info("[Botania]: Cached floating flower model for islandtpye %s and flowertype %s", islandType, identifier);
CACHE.put(islandType, identifier, model);
return model;
}
}
// Enhance!
CompositeBakedModel model = new CompositeBakedModel(flowerModel, islandModel);
CACHE.put(islandType, identifier, model);
return model;
}
}
// Dummy results
@Override
public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) {
return ImmutableList.of();
}
protected static BakedQuad transform(BakedQuad quad, final TRSRTransformation transform) {
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(DefaultVertexFormats.ITEM);
final IVertexConsumer consumer = new VertexTransformer(builder) {
@Override
public void put(int element, float... data) {
VertexFormatElement formatElement = DefaultVertexFormats.ITEM.getElement(element);
switch (formatElement.getUsage()) {
case POSITION: {
float[] newData = new float[4];
Vector4f vec = new Vector4f(data);
transform.getMatrix().transform(vec);
vec.get(newData);
parent.put(element, newData);
break;
}
default: {
parent.put(element, data);
break;
}
}
}
};
quad.pipe(consumer);
return builder.build();
}
@Override
public List<BakedQuad> getGeneralQuads() {
return ImmutableList.of();
}
private static class CompositeBakedModel implements IBakedModel {
@Override
public boolean isAmbientOcclusion() {
return false;
}
private final IBakedModel base;
private final List<BakedQuad> genQuads;
@Override
public boolean isGui3d() {
return true;
}
public CompositeBakedModel(IBakedModel flower, IBakedModel island) {
this.base = flower;
@Override
public boolean isBuiltInRenderer() {
return false;
}
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));
@Override
public TextureAtlasSprite getParticleTexture() {
return null;
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return ItemCameraTransforms.DEFAULT;
}
private static class CompositeBakedModel implements IBakedModel {
private final IBakedModel base;
private final List<BakedQuad> genQuads;
public CompositeBakedModel(IBakedModel flower, IBakedModel island) {
this.base = flower;
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));
// Add flower quads, scaled and translated
for (BakedQuad quad : flower.getGeneralQuads()) {
genBuilder.add(transform(quad, transform));
}
// Add flower quads, scaled and translated
for(BakedQuad quad : flower.getGeneralQuads()) {
genBuilder.add(transform(quad, transform));
}
for (EnumFacing e : EnumFacing.VALUES) {
genBuilder.addAll(flower.getFaceQuads(e).stream().map(input -> transform(input, transform)).collect(Collectors.toList()));
}
for(EnumFacing e : EnumFacing.VALUES) {
genBuilder.addAll(flower.getFaceQuads(e).stream().map(input -> transform(input, transform)).collect(Collectors.toList()));
}
// Add island quads
genBuilder.addAll(island.getGeneralQuads());
for (EnumFacing e: EnumFacing.VALUES) {
genBuilder.addAll(island.getFaceQuads(e));
}
// Add island quads
genBuilder.addAll(island.getGeneralQuads());
for(EnumFacing e : EnumFacing.VALUES) {
genBuilder.addAll(island.getFaceQuads(e));
}
genQuads = genBuilder.build();
}
genQuads = genBuilder.build();
}
// Forward all to flower model
@Override public List<BakedQuad> getGeneralQuads() {
return genQuads;
}
@Override public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) { return ImmutableList.of(); }
@Override public boolean isAmbientOcclusion() {
return base.isAmbientOcclusion();
}
@Override public boolean isGui3d() {
return true;
}
@Override public boolean isBuiltInRenderer() {
return base.isBuiltInRenderer();
}
@Override public TextureAtlasSprite getParticleTexture() {
return base.getParticleTexture();
}
@Override public ItemCameraTransforms getItemCameraTransforms() {
return base.getItemCameraTransforms();
}
}
// Forward all to flower model
@Override
public List<BakedQuad> getGeneralQuads() {
return genQuads;
}
// Dummy results
@Override public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) { return ImmutableList.of(); }
@Override public List<BakedQuad> getGeneralQuads() { return ImmutableList.of(); }
@Override public boolean isAmbientOcclusion() { return false; }
@Override public boolean isGui3d() { return true; }
@Override public boolean isBuiltInRenderer() { return false; }
@Override public TextureAtlasSprite getParticleTexture() { return null; }
@Override public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; }
@Override
public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) {
return ImmutableList.of();
}
@Override
public boolean isAmbientOcclusion() {
return base.isAmbientOcclusion();
}
@Override
public boolean isGui3d() {
return true;
}
@Override
public boolean isBuiltInRenderer() {
return base.isBuiltInRenderer();
}
@Override
public TextureAtlasSprite getParticleTexture() {
return base.getParticleTexture();
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return base.getItemCameraTransforms();
}
}
}
@@ -2,10 +2,10 @@
* 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
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* <p>
* File Created @ [Apr 1, 2014, 6:21:48 PM (GMT)]
*/
package vazkii.botania.client.model;
@@ -38,23 +38,17 @@ import java.util.Set;
public class ModelPylon implements IPylonModel {
private static final Function<ResourceLocation, TextureAtlasSprite> TEXTUREGETTER = input -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(input.toString());
private IFlexibleBakedModel manaCrystal;
private IFlexibleBakedModel manaRingsAndPanes;
private IFlexibleBakedModel manaGems;
private IFlexibleBakedModel naturaCrystal;
private IFlexibleBakedModel naturaRingsAndPanes;
private IFlexibleBakedModel naturaGems;
private IFlexibleBakedModel gaiaCrystal;
private IFlexibleBakedModel gaiaRingsAndPanes;
private IFlexibleBakedModel gaiaGems;
private static final Function<ResourceLocation, TextureAtlasSprite> TEXTUREGETTER = input -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(input.toString());
private static final Set<String> GROUP_NAMES = ImmutableSet.of("Crystal", "Crystal_Ring", "Ring_Panel01", "Ring_Panel02",
"Ring_Panel03", "Ring_Panel04", "Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04");
public ModelPylon() {
try {
// Load the OBJ
@@ -82,27 +76,39 @@ public class ModelPylon implements IPylonModel {
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);
} catch (IOException e) {
} catch(IOException e) {
throw new ReportedException(new CrashReport("Error making pylon submodels for TESR!", e));
}
}
@Override
public void renderCrystal(PylonVariant variant) {
switch (variant) {
case MANA: renderModel(manaCrystal); break;
case NATURA: renderModel(naturaCrystal); break;
case GAIA: renderModel(gaiaCrystal); break;
switch(variant) {
case MANA:
renderModel(manaCrystal);
break;
case NATURA:
renderModel(naturaCrystal);
break;
case GAIA:
renderModel(gaiaCrystal);
break;
}
}
@Override
public void renderRing(PylonVariant variant) {
GlStateManager.disableLighting();
switch (variant) {
case MANA: renderModel(manaRingsAndPanes); break;
case NATURA: renderModel(naturaRingsAndPanes); break;
case GAIA: renderModel(gaiaRingsAndPanes); break;
switch(variant) {
case MANA:
renderModel(manaRingsAndPanes);
break;
case NATURA:
renderModel(naturaRingsAndPanes);
break;
case GAIA:
renderModel(gaiaRingsAndPanes);
break;
}
GlStateManager.enableLighting();
}
@@ -110,21 +116,25 @@ public class ModelPylon implements IPylonModel {
@Override
public void renderGems(PylonVariant variant) {
GlStateManager.disableLighting();
switch (variant) {
case MANA: renderModel(manaGems); break;
case NATURA: renderModel(naturaGems); break;
case GAIA: renderModel(gaiaGems); break;
switch(variant) {
case MANA:
renderModel(manaGems);
break;
case NATURA:
renderModel(naturaGems);
break;
case GAIA:
renderModel(gaiaGems);
break;
}
GlStateManager.enableLighting();
}
private void renderModel(IFlexibleBakedModel model)
{
private void renderModel(IFlexibleBakedModel model) {
renderModel(model, -1);
}
private void renderModel(IFlexibleBakedModel model, int color)
{
private void renderModel(IFlexibleBakedModel model, int color) {
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(GL11.GL_QUADS, model.getFormat());
@@ -133,9 +143,8 @@ public class ModelPylon implements IPylonModel {
tessellator.draw();
}
private void renderQuads(WorldRenderer renderer, List<BakedQuad> quads, int color)
{
for (BakedQuad bakedquad : quads)
private void renderQuads(WorldRenderer renderer, List<BakedQuad> quads, int color) {
for(BakedQuad bakedquad : quads)
LightUtil.renderQuadColor(renderer, bakedquad, color);
}
@@ -2,11 +2,11 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.client.model;
package vazkii.botania.client.model;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.state.IBlockState;
@@ -27,39 +27,66 @@ import java.util.List;
public class PlatformModel implements ISmartBlockModel {
@Override
public IBakedModel handleBlockState(IBlockState state) {
EnumWorldBlockLayer layer = MinecraftForgeClient.getRenderLayer();
IBlockState heldState = ((IExtendedBlockState) state).getValue(BotaniaStateProps.HELD_STATE);
@Override
public IBakedModel handleBlockState(IBlockState state) {
EnumWorldBlockLayer layer = MinecraftForgeClient.getRenderLayer();
IBlockState heldState = ((IExtendedBlockState) state).getValue(BotaniaStateProps.HELD_STATE);
Minecraft mc = Minecraft.getMinecraft();
if (heldState == null && layer == EnumWorldBlockLayer.SOLID) {
// No camo
ModelResourceLocation path = new ModelResourceLocation("botania:platform", "variant=" + state.getValue(BotaniaStateProps.PLATFORM_VARIANT).getName());
return mc.getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getModel(path);
} else if (heldState != null){
if (heldState.getBlock().canRenderInLayer(layer)) {
// Steal camo's model
IBakedModel model = mc.getBlockRendererDispatcher().getBlockModelShapes().getModelForState(heldState);
Minecraft mc = Minecraft.getMinecraft();
if(heldState == null && layer == EnumWorldBlockLayer.SOLID) {
// No camo
ModelResourceLocation path = new ModelResourceLocation("botania:platform", "variant=" + state.getValue(BotaniaStateProps.PLATFORM_VARIANT).getName());
return mc.getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getModel(path);
} else if(heldState != null) {
if(heldState.getBlock().canRenderInLayer(layer)) {
// Steal camo's model
IBakedModel model = mc.getBlockRendererDispatcher().getBlockModelShapes().getModelForState(heldState);
if (model instanceof ISmartBlockModel) {
// Their model can be smart too
model = ((ISmartBlockModel) model).handleBlockState(heldState);
}
if(model instanceof ISmartBlockModel) {
// Their model can be smart too
model = ((ISmartBlockModel) model).handleBlockState(heldState);
}
return model;
}
}
return model;
}
}
return this; // This smart model has no quads as seen below, so nothing actually renders
}
return this; // This smart model has no quads as seen below, so nothing actually renders
}
@Override public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) { return ImmutableList.of(); }
@Override public List<BakedQuad> getGeneralQuads() { return ImmutableList.of(); }
@Override public boolean isAmbientOcclusion() { return true; }
@Override public boolean isGui3d() { return true;}
@Override public boolean isBuiltInRenderer() { return false; }
@Override public TextureAtlasSprite getParticleTexture() { return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("botania:blocks/livingwood0"); }
@Override public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; }
@Override
public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) {
return ImmutableList.of();
}
@Override
public List<BakedQuad> getGeneralQuads() {
return ImmutableList.of();
}
@Override
public boolean isAmbientOcclusion() {
return true;
}
@Override
public boolean isGui3d() {
return true;
}
@Override
public boolean isBuiltInRenderer() {
return false;
}
@Override
public TextureAtlasSprite getParticleTexture() {
return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("botania:blocks/livingwood0");
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return ItemCameraTransforms.DEFAULT;
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -40,95 +40,160 @@ import java.util.List;
public class PylonItemModel implements ISmartItemModel {
private IBakedModel mana;
private IBakedModel natura;
private IBakedModel gaia;
private boolean cached = false;
private IBakedModel mana;
private IBakedModel natura;
private IBakedModel gaia;
private boolean cached = false;
@Override
public IBakedModel handleItemState(ItemStack stack) {
if (!cached) {
cacheModels();
}
@Override
public IBakedModel handleItemState(ItemStack stack) {
if(!cached) {
cacheModels();
}
switch (stack.getItemDamage()) {
case 2: return gaia;
case 1: return natura;
case 0: return mana;
default:
return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
}
}
switch(stack.getItemDamage()) {
case 2:
return gaia;
case 1:
return natura;
case 0:
return mana;
default:
return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
}
}
private void cacheModels() {
// Load the OBJ
OBJModel model = null;
try {
model = ((OBJModel) OBJLoader.instance.loadModel(new ResourceLocation("botania:models/block/pylon.obj")));
} catch (IOException e) {
FMLLog.log(Level.ERROR, "[Botania]: Error loading pylon item model, substituting missing model");
mana = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
natura = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
gaia = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
cached = true;
return;
}
private void cacheModels() {
// Load the OBJ
OBJModel model = null;
try {
model = ((OBJModel) OBJLoader.instance.loadModel(new ResourceLocation("botania:models/block/pylon.obj")));
} catch(IOException e) {
FMLLog.log(Level.ERROR, "[Botania]: Error loading pylon item model, substituting missing model");
mana = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
natura = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
gaia = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
cached = true;
return;
}
// Apply the texture and flip the v's of the model
IModel manaModel = ((OBJModel) model.retexture(ImmutableMap.of("#pylon", "botania:model/pylon"))).process(ImmutableMap.of("flip-v", "true"));
IModel naturaModel = ((OBJModel) model.retexture(ImmutableMap.of("#pylon", "botania:model/pylon1"))).process(ImmutableMap.of("flip-v", "true"));
IModel gaiaModel = ((OBJModel) model.retexture(ImmutableMap.of("#pylon", "botania:model/pylon2"))).process(ImmutableMap.of("flip-v", "true"));
// Apply the texture and flip the v's of the model
IModel manaModel = ((OBJModel) model.retexture(ImmutableMap.of("#pylon", "botania:model/pylon"))).process(ImmutableMap.of("flip-v", "true"));
IModel naturaModel = ((OBJModel) model.retexture(ImmutableMap.of("#pylon", "botania:model/pylon1"))).process(ImmutableMap.of("flip-v", "true"));
IModel gaiaModel = ((OBJModel) model.retexture(ImmutableMap.of("#pylon", "botania:model/pylon2"))).process(ImmutableMap.of("flip-v", "true"));
// All groups are off by default
// OBJState constructor is derp, so the boolean condition is inverted - pass false to turn on a group
// All groups are off by default
// OBJState constructor is derp, so the boolean condition is inverted - pass false to turn on a group
final Function<ResourceLocation, TextureAtlasSprite> textureGetter = input -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(input.toString());
final Function<ResourceLocation, TextureAtlasSprite> textureGetter = input -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(input.toString());
ImmutableList<String> standardGroups = ImmutableList.of("Crystal", "Crystal_Ring",
"Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04",
"Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04");
ImmutableList<String> standardGroups = ImmutableList.of("Crystal", "Crystal_Ring",
"Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04",
"Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04");
mana = new PerspectiveWrapper(manaModel.bake(new OBJModel.OBJState(standardGroups, false), Attributes.DEFAULT_BAKED_FORMAT, textureGetter));
// Natura model is just the crystal
natura = new PerspectiveWrapper(naturaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal"), false), Attributes.DEFAULT_BAKED_FORMAT, textureGetter));
gaia = new PerspectiveWrapper(gaiaModel.bake(new OBJModel.OBJState(standardGroups, false), Attributes.DEFAULT_BAKED_FORMAT, textureGetter));
cached = true;
}
mana = new PerspectiveWrapper(manaModel.bake(new OBJModel.OBJState(standardGroups, false), Attributes.DEFAULT_BAKED_FORMAT, textureGetter));
// Natura model is just the crystal
natura = new PerspectiveWrapper(naturaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal"), false), Attributes.DEFAULT_BAKED_FORMAT, textureGetter));
gaia = new PerspectiveWrapper(gaiaModel.bake(new OBJModel.OBJState(standardGroups, false), Attributes.DEFAULT_BAKED_FORMAT, textureGetter));
cached = true;
}
@Override public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) { return ImmutableList.of(); }
@Override public List<BakedQuad> getGeneralQuads() { return ImmutableList.of(); }
@Override public boolean isAmbientOcclusion() { return false; }
@Override public boolean isGui3d() { return true; }
@Override public boolean isBuiltInRenderer() { return false; }
@Override public TextureAtlasSprite getParticleTexture() { return null; }
@Override public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; }
@Override
public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) {
return ImmutableList.of();
}
// Wrapper to transform the model before rendering it, so it looks right in the inventory
private class PerspectiveWrapper implements IPerspectiveAwareModel {
@Override
public List<BakedQuad> getGeneralQuads() {
return ImmutableList.of();
}
private final IFlexibleBakedModel parent;
@Override
public boolean isAmbientOcclusion() {
return false;
}
public PerspectiveWrapper(IBakedModel pylonModel) {
this.parent = new IFlexibleBakedModel.Wrapper(pylonModel, Attributes.DEFAULT_BAKED_FORMAT);
}
@Override
public boolean isGui3d() {
return true;
}
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
switch(cameraTransformType) {
case FIRST_PERSON: return ImmutablePair.of(parent, new TRSRTransformation(new Vector3f(0, 0, 0.4F), null, new Vector3f(0.75F, 0.75F, 0.75F), null).getMatrix());
case GUI: return ImmutablePair.of(parent, TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0.5F, 0.1F, 0), null, null, null)).getMatrix());
case THIRD_PERSON: return ImmutablePair.of(parent, new TRSRTransformation(new Vector3f(0, -0.2F, 0.5F), null, null, null).getMatrix());
default: return ImmutablePair.of(parent, TRSRTransformation.identity().getMatrix());
}
}
@Override
public boolean isBuiltInRenderer() {
return false;
}
@Override public VertexFormat getFormat() { return Attributes.DEFAULT_BAKED_FORMAT; }
@Override public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) { return parent.getFaceQuads(p_177551_1_); }
@Override public List<BakedQuad> getGeneralQuads() { return parent.getGeneralQuads(); }
@Override public boolean isAmbientOcclusion() { return parent.isAmbientOcclusion(); }
@Override public boolean isGui3d() { return parent.isGui3d(); }
@Override public boolean isBuiltInRenderer() { return parent.isBuiltInRenderer(); }
@Override public TextureAtlasSprite getParticleTexture() { return parent.getParticleTexture(); }
@Override public ItemCameraTransforms getItemCameraTransforms() { return parent.getItemCameraTransforms(); }
}
@Override
public TextureAtlasSprite getParticleTexture() {
return null;
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return ItemCameraTransforms.DEFAULT;
}
// Wrapper to transform the model before rendering it, so it looks right in the inventory
private class PerspectiveWrapper implements IPerspectiveAwareModel {
private final IFlexibleBakedModel parent;
public PerspectiveWrapper(IBakedModel pylonModel) {
this.parent = new IFlexibleBakedModel.Wrapper(pylonModel, Attributes.DEFAULT_BAKED_FORMAT);
}
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
switch(cameraTransformType) {
case FIRST_PERSON:
return ImmutablePair.of(parent, new TRSRTransformation(new Vector3f(0, 0, 0.4F), null, new Vector3f(0.75F, 0.75F, 0.75F), null).getMatrix());
case GUI:
return ImmutablePair.of(parent, TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0.5F, 0.1F, 0), null, null, null)).getMatrix());
case THIRD_PERSON:
return ImmutablePair.of(parent, new TRSRTransformation(new Vector3f(0, -0.2F, 0.5F), null, null, null).getMatrix());
default:
return ImmutablePair.of(parent, TRSRTransformation.identity().getMatrix());
}
}
@Override
public VertexFormat getFormat() {
return Attributes.DEFAULT_BAKED_FORMAT;
}
@Override
public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) {
return parent.getFaceQuads(p_177551_1_);
}
@Override
public List<BakedQuad> getGeneralQuads() {
return parent.getGeneralQuads();
}
@Override
public boolean isAmbientOcclusion() {
return parent.isAmbientOcclusion();
}
@Override
public boolean isGui3d() {
return parent.isGui3d();
}
@Override
public boolean isBuiltInRenderer() {
return parent.isBuiltInRenderer();
}
@Override
public TextureAtlasSprite getParticleTexture() {
return parent.getParticleTexture();
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return parent.getItemCameraTransforms();
}
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -42,276 +42,275 @@ import net.minecraftforge.fml.common.FMLLog;
import org.apache.commons.lang3.tuple.Pair;
import vazkii.botania.api.BotaniaAPIClient;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.block.decor.IFloatingFlower;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import javax.vecmath.Matrix4f;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public class SpecialFlowerModel implements IModelCustomData {
// SpecialFlowerModel for when there are no blockModels registered for a subtile
public static final SpecialFlowerModel INSTANCE = new SpecialFlowerModel(ImmutableMap.<Optional<String>, ModelResourceLocation>of(), ImmutableMap.<Optional<String>, ModelResourceLocation>of());
// SpecialFlowerModel for when there are no blockModels registered for a subtile
public static final SpecialFlowerModel INSTANCE = new SpecialFlowerModel(ImmutableMap.<Optional<String>, ModelResourceLocation>of(), ImmutableMap.<Optional<String>, ModelResourceLocation>of());
private final ImmutableMap<Optional<String>, ModelResourceLocation> blockModels;
private final ImmutableMap<Optional<String>, ModelResourceLocation> itemModels;
private final ImmutableMap<Optional<String>, ModelResourceLocation> blockModels;
private final ImmutableMap<Optional<String>, ModelResourceLocation> itemModels;
public SpecialFlowerModel(ImmutableMap<Optional<String>, ModelResourceLocation> blockModels,
ImmutableMap<Optional<String>, ModelResourceLocation> itemModels) {
this.blockModels = blockModels;
this.itemModels = itemModels;
}
public SpecialFlowerModel(ImmutableMap<Optional<String>, ModelResourceLocation> blockModels,
ImmutableMap<Optional<String>, ModelResourceLocation> itemModels) {
this.blockModels = blockModels;
this.itemModels = itemModels;
}
@Override
public Collection<ResourceLocation> getDependencies() {
ImmutableSet.Builder<ResourceLocation> builder = ImmutableSet.builder();
builder.addAll(blockModels.values());
builder.addAll(itemModels.values());
@Override
public Collection<ResourceLocation> getDependencies() {
ImmutableSet.Builder<ResourceLocation> builder = ImmutableSet.builder();
builder.addAll(blockModels.values());
builder.addAll(itemModels.values());
// Force mini island model to be loaded and baked, for use elsewhere. See FloatingFlowerModel
for (IFloatingFlower.IslandType i : IFloatingFlower.IslandType.values()) {
builder.add(new ModelResourceLocation("botania:miniIsland", "variant=" + i.name().toLowerCase(Locale.ROOT)));
}
// Force island models to be loaded and baked. See FloatingFlowerModel.
builder.addAll(BotaniaAPIClient.getRegisteredIslandTypeModels().values());
return builder.build();
}
return builder.build();
}
@Override
public Collection<ResourceLocation> getTextures() {
return ImmutableList.of();
}
@Override
public Collection<ResourceLocation> getTextures() {
return ImmutableList.of();
}
@Override
public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
// "Bake" the SpecialFlowerModel (in reality, just create another wrapper for all the delegate blockModels)
return new SpecialFlowerBakedModel(blockModels, itemModels, format, IPerspectiveAwareModel.MapWrapper.getTransforms(state));
}
@Override
public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
// "Bake" the SpecialFlowerModel (in reality, just create another wrapper for all the delegate blockModels)
return new SpecialFlowerBakedModel(blockModels, itemModels, format, IPerspectiveAwareModel.MapWrapper.getTransforms(state));
}
@Override
public IModelState getDefaultState() {
return TRSRTransformation.identity();
}
@Override
public IModelState getDefaultState() {
return TRSRTransformation.identity();
}
@Override
public IModel process(ImmutableMap<String, String> customData) {
// Load the base variant from blockstate json, and also add all the model paths we received from external API
ImmutableMap.Builder<Optional<String>, ModelResourceLocation> blockBuilder = ImmutableMap.builder();
ImmutableMap.Builder<Optional<String>, ModelResourceLocation> itemBuilder = ImmutableMap.builder();
@Override
public IModel process(ImmutableMap<String, String> customData) {
// Load the base variant from blockstate json, and also add all the model paths we received from external API
ImmutableMap.Builder<Optional<String>, ModelResourceLocation> blockBuilder = ImmutableMap.builder();
ImmutableMap.Builder<Optional<String>, ModelResourceLocation> itemBuilder = ImmutableMap.builder();
for (String key : customData.keySet()) {
if ("base".equals(key)) {
blockBuilder.put(Optional.<String>absent(), getLocation(customData.get(key)));
}
}
for(String key : customData.keySet()) {
if("base".equals(key)) {
blockBuilder.put(Optional.<String>absent(), getLocation(customData.get(key)));
}
}
for (Map.Entry<String, ModelResourceLocation> e : BotaniaAPIClient.getRegisteredSubtileBlockModels().entrySet()) {
blockBuilder.put(Optional.of(e.getKey()), e.getValue());
}
for (Map.Entry<String, ModelResourceLocation> e : BotaniaAPIClient.getRegisteredSubtileItemModels().entrySet()) {
itemBuilder.put(Optional.of(e.getKey()), e.getValue());
}
for(Map.Entry<String, ModelResourceLocation> e : BotaniaAPIClient.getRegisteredSubtileBlockModels().entrySet()) {
blockBuilder.put(Optional.of(e.getKey()), e.getValue());
}
for(Map.Entry<String, ModelResourceLocation> e : BotaniaAPIClient.getRegisteredSubtileItemModels().entrySet()) {
itemBuilder.put(Optional.of(e.getKey()), e.getValue());
}
ImmutableMap<Optional<String>, ModelResourceLocation> blockModels = blockBuilder.build();
ImmutableMap<Optional<String>, ModelResourceLocation> itemModels = itemBuilder.build();
if (blockModels.isEmpty() && itemModels.isEmpty()) return INSTANCE;
return new SpecialFlowerModel(blockModels, itemModels);
}
ImmutableMap<Optional<String>, ModelResourceLocation> blockModels = blockBuilder.build();
ImmutableMap<Optional<String>, ModelResourceLocation> itemModels = itemBuilder.build();
if(blockModels.isEmpty() && itemModels.isEmpty()) return INSTANCE;
return new SpecialFlowerModel(blockModels, itemModels);
}
private ModelResourceLocation getLocation(String json) {
JsonElement e = new JsonParser().parse(json);
if (e.isJsonPrimitive() && e.getAsJsonPrimitive().isString()) {
return new ModelResourceLocation(e.getAsString());
}
FMLLog.severe("Expect ModelResourceLocation, got: ", json);
return new ModelResourceLocation("builtin/missing", "missing");
}
private ModelResourceLocation getLocation(String json) {
JsonElement e = new JsonParser().parse(json);
if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isString()) {
return new ModelResourceLocation(e.getAsString());
}
FMLLog.severe("Expect ModelResourceLocation, got: ", json);
return new ModelResourceLocation("builtin/missing", "missing");
}
public enum Loader implements ICustomModelLoader {
INSTANCE {
@Override
public void onResourceManagerReload(IResourceManager resourceManager) {
}
public enum Loader implements ICustomModelLoader {
INSTANCE {
@Override
public void onResourceManagerReload(IResourceManager resourceManager) {
}
@Override
public boolean accepts(ResourceLocation modelLocation) {
return modelLocation.getResourceDomain().equals("botania_special") && (
modelLocation.getResourcePath().equals("specialFlower") ||
modelLocation.getResourcePath().equals("models/block/specialFlower") ||
modelLocation.getResourcePath().equals("models/item/specialFlower"));
}
@Override
public boolean accepts(ResourceLocation modelLocation) {
return modelLocation.getResourceDomain().equals("botania_special") && (
modelLocation.getResourcePath().equals("specialFlower") ||
modelLocation.getResourcePath().equals("models/block/specialFlower") ||
modelLocation.getResourcePath().equals("models/item/specialFlower"));
}
@Override
public IModel loadModel(ResourceLocation modelLocation) throws IOException {
// Load a dummy model for now, all actual blockModels added in process().
return SpecialFlowerModel.INSTANCE;
}
}
}
@Override
public IModel loadModel(ResourceLocation modelLocation) throws IOException {
// Load a dummy model for now, all actual blockModels added in process().
return SpecialFlowerModel.INSTANCE;
}
}
}
public static class SpecialFlowerBakedModel implements IPerspectiveAwareModel, ISmartBlockModel, ISmartItemModel {
public static class SpecialFlowerBakedModel implements IPerspectiveAwareModel, ISmartBlockModel, ISmartItemModel {
private final ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms;
private final ImmutableMap<Optional<String>, ModelResourceLocation> blockModels;
private final ImmutableMap<Optional<String>, ModelResourceLocation> itemModels;
private final VertexFormat vertexFormat;
private final ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms;
private final ImmutableMap<Optional<String>, ModelResourceLocation> blockModels;
private final ImmutableMap<Optional<String>, ModelResourceLocation> itemModels;
private final VertexFormat vertexFormat;
private IBakedModel baseModel;
private ImmutableMap<String, IBakedModel> bakedBlockModels;
private ImmutableMap<String, IBakedModel> bakedItemModels;
private ImmutableMap<Optional<EnumFacing>, ImmutableList<BakedQuad>> quads;
private IBakedModel baseModel;
private ImmutableMap<String, IBakedModel> bakedBlockModels;
private ImmutableMap<String, IBakedModel> bakedItemModels;
private ImmutableMap<Optional<EnumFacing>, ImmutableList<BakedQuad>> quads;
public SpecialFlowerBakedModel(ImmutableMap<Optional<String>, ModelResourceLocation> blockModels,
ImmutableMap<Optional<String>, ModelResourceLocation> itemModels,
VertexFormat format, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> cameraTransforms) {
this.blockModels = blockModels;
this.itemModels = itemModels;
this.vertexFormat = format;
this.transforms = cameraTransforms;
}
public SpecialFlowerBakedModel(ImmutableMap<Optional<String>, ModelResourceLocation> blockModels,
ImmutableMap<Optional<String>, ModelResourceLocation> itemModels,
VertexFormat format, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> cameraTransforms) {
this.blockModels = blockModels;
this.itemModels = itemModels;
this.vertexFormat = format;
this.transforms = cameraTransforms;
}
private void refreshBakedModels() {
if (baseModel == null) {
// If not done already, steal all the real baked models and cache them
ModelManager manager = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager();
baseModel = getBlockModel(manager, Optional.<String>absent());
private void refreshBakedModels() {
if(baseModel == null) {
// If not done already, steal all the real baked models and cache them
ModelManager manager = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager();
baseModel = getBlockModel(manager, Optional.<String>absent());
ImmutableMap.Builder<String, IBakedModel> builder = ImmutableMap.builder();
for (Map.Entry<Optional<String>, ModelResourceLocation> e : blockModels.entrySet()) {
if (e.getKey().isPresent()) {
builder.put(e.getKey().get(), getBlockModel(manager, e.getKey()));
}
}
ImmutableMap.Builder<String, IBakedModel> builder = ImmutableMap.builder();
for(Map.Entry<Optional<String>, ModelResourceLocation> e : blockModels.entrySet()) {
if(e.getKey().isPresent()) {
builder.put(e.getKey().get(), getBlockModel(manager, e.getKey()));
}
}
bakedBlockModels = builder.build();
bakedBlockModels = builder.build();
ImmutableMap.Builder<String, IBakedModel> builder2 = ImmutableMap.builder();
for (Map.Entry<Optional<String>, ModelResourceLocation> e : itemModels.entrySet()) {
if (e.getKey().isPresent()) {
builder2.put(e.getKey().get(), getItemModel(manager, e.getKey()));
}
}
ImmutableMap.Builder<String, IBakedModel> builder2 = ImmutableMap.builder();
for(Map.Entry<Optional<String>, ModelResourceLocation> e : itemModels.entrySet()) {
if(e.getKey().isPresent()) {
builder2.put(e.getKey().get(), getItemModel(manager, e.getKey()));
}
}
bakedItemModels = builder2.build();
bakedItemModels = builder2.build();
ImmutableMap.Builder<Optional<EnumFacing>, ImmutableList<BakedQuad>> quadBuilder = ImmutableMap.builder();
quadBuilder.put(Optional.<EnumFacing>absent(), buildQuads(Optional.<EnumFacing>absent()));
for (EnumFacing side : EnumFacing.values()) {
quadBuilder.put(Optional.of(side), buildQuads(Optional.of(side)));
}
quads = quadBuilder.build();
}
}
ImmutableMap.Builder<Optional<EnumFacing>, ImmutableList<BakedQuad>> quadBuilder = ImmutableMap.builder();
quadBuilder.put(Optional.<EnumFacing>absent(), buildQuads(Optional.<EnumFacing>absent()));
for(EnumFacing side : EnumFacing.values()) {
quadBuilder.put(Optional.of(side), buildQuads(Optional.of(side)));
}
quads = quadBuilder.build();
}
}
private IBakedModel getBlockModel(ModelManager manager, Optional<String> opt) {
ModelResourceLocation loc = blockModels.get(opt);
if (loc == null) {
loc = new ModelResourceLocation("builtin/missing", "missing");
}
return manager.getModel(loc);
}
private IBakedModel getBlockModel(ModelManager manager, Optional<String> opt) {
ModelResourceLocation loc = blockModels.get(opt);
if(loc == null) {
loc = new ModelResourceLocation("builtin/missing", "missing");
}
return manager.getModel(loc);
}
private IBakedModel getItemModel(ModelManager manager, Optional<String> opt) {
ModelResourceLocation loc = itemModels.get(opt);
if (loc == null) {
loc = new ModelResourceLocation("builtin/missing", "missing");
}
return manager.getModel(loc);
}
private IBakedModel getItemModel(ModelManager manager, Optional<String> opt) {
ModelResourceLocation loc = itemModels.get(opt);
if(loc == null) {
loc = new ModelResourceLocation("builtin/missing", "missing");
}
return manager.getModel(loc);
}
private ImmutableList<BakedQuad> buildQuads(Optional<EnumFacing> side) {
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
for (IBakedModel model : bakedBlockModels.values()) {
if (side.isPresent()) {
builder.addAll(model.getFaceQuads(side.get()));
} else {
builder.addAll(model.getGeneralQuads());
}
}
private ImmutableList<BakedQuad> buildQuads(Optional<EnumFacing> side) {
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
for(IBakedModel model : bakedBlockModels.values()) {
if(side.isPresent()) {
builder.addAll(model.getFaceQuads(side.get()));
} else {
builder.addAll(model.getGeneralQuads());
}
}
for (IBakedModel model : bakedItemModels.values()) {
if (side.isPresent()) {
builder.addAll(model.getFaceQuads(side.get()));
} else {
builder.addAll(model.getGeneralQuads());
}
}
for(IBakedModel model : bakedItemModels.values()) {
if(side.isPresent()) {
builder.addAll(model.getFaceQuads(side.get()));
} else {
builder.addAll(model.getGeneralQuads());
}
}
return builder.build();
}
return builder.build();
}
@Override
public List<BakedQuad> getFaceQuads(EnumFacing side) {
refreshBakedModels();
return quads.get(Optional.of(side));
}
@Override
public List<BakedQuad> getFaceQuads(EnumFacing side) {
refreshBakedModels();
return quads.get(Optional.of(side));
}
@Override
public List<BakedQuad> getGeneralQuads() {
refreshBakedModels();
return quads.get(Optional.<EnumFacing>absent());
}
@Override
public List<BakedQuad> getGeneralQuads() {
refreshBakedModels();
return quads.get(Optional.<EnumFacing>absent());
}
@Override
public boolean isAmbientOcclusion() {
refreshBakedModels();
return baseModel.isAmbientOcclusion();
}
@Override
public boolean isAmbientOcclusion() {
refreshBakedModels();
return baseModel.isAmbientOcclusion();
}
@Override
public boolean isGui3d() {
refreshBakedModels();
return baseModel.isGui3d();
}
@Override
public boolean isGui3d() {
refreshBakedModels();
return baseModel.isGui3d();
}
@Override
public boolean isBuiltInRenderer() {
refreshBakedModels();
return baseModel.isBuiltInRenderer();
}
@Override
public boolean isBuiltInRenderer() {
refreshBakedModels();
return baseModel.isBuiltInRenderer();
}
@Override
public TextureAtlasSprite getParticleTexture() {
refreshBakedModels();
return baseModel.getParticleTexture();
}
@Override
public TextureAtlasSprite getParticleTexture() {
refreshBakedModels();
return baseModel.getParticleTexture();
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return ItemCameraTransforms.DEFAULT;
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return ItemCameraTransforms.DEFAULT;
}
@Override
public IBakedModel handleBlockState(IBlockState state) {
refreshBakedModels();
IExtendedBlockState extendedState = ((IExtendedBlockState) state);
IBakedModel ret = bakedBlockModels.get(extendedState.getValue(BotaniaStateProps.SUBTILE_ID));
return ret == null ? Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel() : ret;
}
@Override
public IBakedModel handleBlockState(IBlockState state) {
if(state.getBlock() != ModBlocks.specialFlower)
return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
refreshBakedModels();
IExtendedBlockState extendedState = ((IExtendedBlockState) state);
IBakedModel ret = bakedBlockModels.get(extendedState.getValue(BotaniaStateProps.SUBTILE_ID));
return ret == null ? Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel() : ret;
}
@Override
public VertexFormat getFormat() {
return vertexFormat;
}
@Override
public VertexFormat getFormat() {
return vertexFormat;
}
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, cameraTransformType);
}
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, cameraTransformType);
}
@Override
public IBakedModel handleItemState(ItemStack stack) {
refreshBakedModels();
IBakedModel item = bakedItemModels.get(ItemBlockSpecialFlower.getType(stack));
if (item == null) {
item = bakedBlockModels.get(ItemBlockSpecialFlower.getType(stack));
}
@Override
public IBakedModel handleItemState(ItemStack stack) {
refreshBakedModels();
IBakedModel item = bakedItemModels.get(ItemBlockSpecialFlower.getType(stack));
if(item == null) {
item = bakedBlockModels.get(ItemBlockSpecialFlower.getType(stack));
}
return item == null ? Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel() : item;
}
}
return item == null ? Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel() : item;
}
}
}
@@ -1,51 +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 @ [Oct 24, 2015, 11:06:11 PM (GMT)]
*/
/*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileAvatar;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderAvatar implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.6F, -0.5F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileAvatar(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public int getRenderId() {
return LibRenderIDs.idAvatar;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
*/
@@ -1,52 +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 @ [Aug 28, 2015, 7:13:45 PM (GMT)]
*/
/*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.mana.TileBellows;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderBellows implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.3F, -0.5F);
GlStateManager.scale(1.2F, 1.2F, 1.2F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileBellows(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return LibRenderIDs.idBellows;
}
}
*/
@@ -1,55 +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 @ [Oct 31, 2014, 5:00:12 PM (GMT)]
*/
/*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.client.render.tile.RenderTileBrewery;
import vazkii.botania.common.block.tile.TileBrewery;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderBrewery implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
GlStateManager.scale(1.2F, 1.2F, 1.2F);
RenderTileBrewery.rotate = false;
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileBrewery(), 0.0D, 0.0D, 0.0D, 0.0F);
RenderTileBrewery.rotate = true;
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return LibRenderIDs.idBrewery;
}
}
*/
@@ -1,51 +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 @ [Jul 8, 2015, 5:57:29 PM (GMT)]
*/
/*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileCocoon;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderCocoon implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileCocoon(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public int getRenderId() {
return LibRenderIDs.idCocoon;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
*/
@@ -1,53 +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 @ [Apr 30, 2015, 6:22:32 PM (GMT)]
*/
/*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.corporea.TileCorporeaCrystalCube;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderCorporeaCrystalCube implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
GlStateManager.disableAlpha();
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileCorporeaCrystalCube(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.enableAlpha();
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return LibRenderIDs.idCorporeaCrystalCybe;
}
}
*/
@@ -1,55 +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 @ [Feb 15, 2015, 1:57:50 AM (GMT)]
*/
/*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.client.render.tile.RenderTileCorporeaIndex;
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderCorporeaIndex implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.3F, -0.5F);
GlStateManager.scale(1.4F, 1.4F, 1.4F);
RenderTileCorporeaIndex.move = false;
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileCorporeaIndex(), 0.0D, 0.0D, 0.0D, 0.0F);
RenderTileCorporeaIndex.move = true;
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return LibRenderIDs.idCorporeaIndex;
}
}
*/
@@ -1,53 +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 @ [May 30, 2015, 3:17:41 PM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileHourglass;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderHourglass implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
GlStateManager.disableAlpha();
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileHourglass(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.enableAlpha();
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public int getRenderId() {
return LibRenderIDs.idHourglass;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
*/
@@ -1,52 +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 @ [May 15, 2015, 5:59:56 PM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileIncensePlate;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderIncensePlate implements ISimpleBlockRenderingHandler{
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.1F, -0.5F);
GlStateManager.scale(1.4F, 1.4F, 1.4F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileIncensePlate(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public int getRenderId() {
return LibRenderIDs.idIncensePlate;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
*/
@@ -1,54 +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 @ [Jan 26, 2014, 12:25:06 AM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.client.render.tile.RenderTilePool;
import vazkii.botania.common.block.tile.mana.TilePool;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderPool implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
RenderTilePool.forceMeta = metadata;
RenderTilePool.forceMana = RenderTilePool.forceMana | metadata == 1;
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TilePool(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public int getRenderId() {
return LibRenderIDs.idPool;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
*/
@@ -1,51 +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 18, 2015, 4:42:08 PM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.mana.TilePump;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderPump implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.25F, -0.5F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TilePump(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return LibRenderIDs.idPump;
}
}
*/
@@ -1,51 +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 @ [Jul 23, 2014, 6:23:54 PM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileSpawnerClaw;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderSpawnerClaw implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, 0F, -0.5F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileSpawnerClaw(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return LibRenderIDs.idSpawnerClaw;
}
}
*/
@@ -1,138 +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 @ [Jan 25, 2014, 4:15:46 PM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import vazkii.botania.api.lexicon.multiblock.IMultiblockRenderHook;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderSpecialFlower implements ISimpleBlockRenderingHandler, IMultiblockRenderHook {
int id;
public RenderSpecialFlower(int id) {
this.id = id;
}
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
// NO-OP
}
@Override
public boolean renderWorldBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return renderCrossedSquares(blockAccess, block, x, y, z, renderer);
}
// Copied from RenderBlocks
public static boolean renderCrossedSquares(IBlockAccess blockAccess, Block par1Block, int par2, int par3, int par4, RenderBlocks render) {
Tessellator tessellator = Tessellator.getInstance();
tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(blockAccess, par2, par3, par4));
float f = 1.0F;
int l = par1Block.colorMultiplier(blockAccess, par2, par3, par4);
float f1 = (l >> 16 & 255) / 255.0F;
float f2 = (l >> 8 & 255) / 255.0F;
float f3 = (l & 255) / 255.0F;
if(EntityRenderer.anaglyphEnable) {
float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
f1 = f4;
f2 = f5;
f3 = f6;
}
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
double d1 = par2;
double d2 = par3;
double d0 = par4;
long sh;
sh = par2 * 3129871 ^ par4 * 116129781L ^ par3;
sh = sh * sh * 42317861L + sh * 11L;
d1 += ((sh >> 16 & 15L) / 15.0F - 0.5D) * 0.3D;
d2 += (sh >> 32 & 15L) / 15.0F * -0.15D;
d0 += ((sh >> 24 & 15L) / 15.0F - 0.5D) * 0.3D;
// Only change here, to use xyz rather than side/meta
IIcon icon = render.getBlockIcon(par1Block, blockAccess, par2, par3, par4, 0);
drawCrossedSquares(blockAccess, par1Block, icon, par2, par3, par4, d1, d2, d0, 1.0F, render);
return true;
}
// Copied from RenderBlocks
public static void drawCrossedSquares(IBlockAccess blockAccess, Block par1Block, IIcon icon, int x, int y, int z, double par3, double par5, double par7, float par9, RenderBlocks render) {
Tessellator tessellator = Tessellator.getInstance();
double d3 = icon.getMinU();
double d4 = icon.getMinV();
double d5 = icon.getMaxU();
double d6 = icon.getMaxV();
double d7 = 0.45D * par9;
double d8 = par3 + 0.5D - d7;
double d9 = par3 + 0.5D + d7;
double d10 = par7 + 0.5D - d7;
double d11 = par7 + 0.5D + d7;
tessellator.getWorldRenderer().addVertexWithUV(d8, par5 + par9, d10, d3, d4);
tessellator.getWorldRenderer().addVertexWithUV(d8, par5 + 0.0D, d10, d3, d6);
tessellator.getWorldRenderer().addVertexWithUV(d9, par5 + 0.0D, d11, d5, d6);
tessellator.getWorldRenderer().addVertexWithUV(d9, par5 + par9, d11, d5, d4);
tessellator.getWorldRenderer().addVertexWithUV(d9, par5 + par9, d11, d3, d4);
tessellator.getWorldRenderer().addVertexWithUV(d9, par5 + 0.0D, d11, d3, d6);
tessellator.getWorldRenderer().addVertexWithUV(d8, par5 + 0.0D, d10, d5, d6);
tessellator.getWorldRenderer().addVertexWithUV(d8, par5 + par9, d10, d5, d4);
tessellator.getWorldRenderer().addVertexWithUV(d8, par5 + par9, d11, d3, d4);
tessellator.getWorldRenderer().addVertexWithUV(d8, par5 + 0.0D, d11, d3, d6);
tessellator.getWorldRenderer().addVertexWithUV(d9, par5 + 0.0D, d10, d5, d6);
tessellator.getWorldRenderer().addVertexWithUV(d9, par5 + par9, d10, d5, d4);
tessellator.getWorldRenderer().addVertexWithUV(d9, par5 + par9, d10, d3, d4);
tessellator.getWorldRenderer().addVertexWithUV(d9, par5 + 0.0D, d10, d3, d6);
tessellator.getWorldRenderer().addVertexWithUV(d8, par5 + 0.0D, d11, d5, d6);
tessellator.getWorldRenderer().addVertexWithUV(d8, par5 + par9, d11, d5, d4);
}
@Override
public int getRenderId() {
return id;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return false;
}
@Override
public void renderBlockForMultiblock(IBlockAccess world, Multiblock mb, Block block, int meta, RenderBlocks renderBlocks, MultiblockComponent comp, float alpha) {
Tessellator tess = Tessellator.getInstance();
tess.startDrawingQuads();
drawCrossedSquares(world, block, block.getIcon(0, meta), 0, 0, 0, -0.5, -0.5, -0.5, 1F, renderBlocks);
tess.draw();
}
@Override
public boolean needsTranslate(IBlockState state) {
return true;
}
}
*/
@@ -1,57 +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 @ [Jan 25, 2014, 9:45:58 PM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.mana.TileSpreader;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderSpreader implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
TileSpreader.staticRedstone = metadata == 1;
TileSpreader.staticDreamwood = metadata == 2 || metadata == 3;
TileSpreader.staticUltra = metadata == 3;
TileSpreader spreader = new TileSpreader();
spreader.rotationX = -180F;
TileEntityRendererDispatcher.instance.renderTileEntityAt(spreader, 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public int getRenderId() {
return LibRenderIDs.idSpreader;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
*/
@@ -1,51 +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 @ [Oct 1, 2015, 9:40:27 PM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileTeruTeruBozu;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderTeruTeruBozu implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.3F, -0.5F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileTeruTeruBozu(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public int getRenderId() {
return LibRenderIDs.idTeruTeruBozu;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
*/
@@ -1,51 +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 @ [Jul 18, 2014, 11:43:37 PM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileTinyPotato;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderTinyPotato implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, 0F, -0.5F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileTinyPotato(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return LibRenderIDs.idTinyPotato;
}
}
*/
@@ -60,7 +60,7 @@ public class RenderDoppleganger extends RenderBiped<EntityDoppleganger> {
};
public RenderDoppleganger(RenderManager renderManager) {
super(renderManager, new ModelPlayer(0.0F, false), 0F); // todo 1.8 was ModelBiped(0.5)
super(renderManager, new ModelPlayer(0.0F, false), 0F);
}
@Override
@@ -11,9 +11,15 @@
package vazkii.botania.client.render.entity;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderMinecart;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import vazkii.botania.api.state.enums.PoolVariant;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.render.tile.RenderTilePool;
import vazkii.botania.common.block.tile.mana.TilePool;
import vazkii.botania.common.entity.EntityPoolMinecart;
public class RenderPoolMinecart extends RenderMinecart<EntityPoolMinecart> {
@@ -24,8 +30,9 @@ public class RenderPoolMinecart extends RenderMinecart<EntityPoolMinecart> {
@Override
protected void func_180560_a(EntityPoolMinecart poolCart, float p_147910_2_, IBlockState state) {
RenderTilePool.forceVariant = PoolVariant.DEFAULT;
RenderTilePool.forceManaNumber = poolCart.getMana();
super.func_180560_a(poolCart, p_147910_2_, state);
TileEntityRendererDispatcher.instance.getSpecialRendererByClass(TilePool.class).renderTileEntityAt(null, poolCart.posX, poolCart.posY, poolCart.posZ, ClientTickHandler.partialTicks, -1);
}
@@ -1,96 +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 @ [Feb 28, 2015, 3:43:09 PM (GMT)]
*//*
package vazkii.botania.client.render.item;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import vazkii.botania.common.lib.LibObfuscation;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
public class RenderBow implements IItemRenderer {
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return type != ItemRenderType.INVENTORY;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
switch(type) {
case ENTITY : {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, 0F, 0F);
if(item.isOnItemFrame())
GlStateManager.translate(0F, -0.3F, 0.01F);
render(item, null, false);
GlStateManager.popMatrix();
break;
}
case EQUIPPED : {
render(item, data[1] instanceof EntityPlayer ? (EntityPlayer) data[1] : null, true);
break;
}
case EQUIPPED_FIRST_PERSON : {
render(item, data[1] instanceof EntityPlayer ? (EntityPlayer) data[1] : null, false);
break;
}
default : break;
}
}
public void render(ItemStack item, EntityPlayer player, boolean transform) {
int dmg = item.getItemDamage();
IIcon icon = item.getItem().getIconFromDamageForRenderPass(dmg, 0);
if(player != null) {
ItemStack using = ReflectionHelper.getPrivateValue(EntityPlayer.class, player, LibObfuscation.ITEM_IN_USE);
int time = ReflectionHelper.getPrivateValue(EntityPlayer.class, player, LibObfuscation.ITEM_IN_USE_COUNT);
icon = item.getItem().getIcon(item, 0, player, using, time);
if(transform) {
GlStateManager.translate(0.2F, -0.3F, 0.1F);
//GlStateManager.rotate(20.0F, 0.0F, 1.0F, 0.0F);
//GlStateManager.rotate(-100.0F, 1.0F, 0.0F, 0.0F);
}
}
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
float scale = 1F / 16F;
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color(1F, 1F, 1F, 1F);
ItemRenderer.renderItemIn2D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), scale);
GlStateManager.disableBlend();
GlStateManager.popMatrix();
GlStateManager.color(1F, 1F, 1F, 1F);
}
}
*/
@@ -1,124 +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 @ [Jan 31, 2014, 3:08:00 PM (GMT)]
*//*
package vazkii.botania.client.render.item;
import java.awt.Color;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.mana.ILens;
import vazkii.botania.common.item.lens.ItemLens;
public class RenderLens implements IItemRenderer {
static RenderItem render = new RenderItem();
ItemRenderer renderer = new ItemRenderer(Minecraft.getMinecraft());
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return type != ItemRenderType.INVENTORY;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
switch(type) {
case ENTITY : {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, 0F, 0F);
if(item.isOnItemFrame())
GlStateManager.translate(0F, -0.3F, 0.01F);
render(item);
GlStateManager.popMatrix();
break;
}
case EQUIPPED : {
render(item);
break;
}
case EQUIPPED_FIRST_PERSON : {
render(item);
break;
}
default : break;
}
}
public static void render(ItemStack item) {
Color color = new Color(((ILens) item.getItem()).getLensColor(item));
render(item, color.getRGB());
}
public static void render(ItemStack item, int color_) {
int dmg = item.getItemDamage();
IIcon icon = item.getItem().getIconFromDamageForRenderPass(dmg, 1);
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
float scale = 1F / 16F;
GlStateManager.color(1F, 1F, 1F, 1F);
ItemRenderer.renderItemIn2D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), scale);
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.enableCull();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
Color color = new Color(color_);
GlStateManager.color((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) 255);
boolean shiny = ItemLens.getStoredColor(item) != -1;
icon = ItemLens.iconGlass;
GlStateManager.scale(scale, scale, scale);
GlStateManager.translate(0F, 0F, -0.5F);
renderShinyLensIcon(icon, shiny);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(-16F, 0F, 0F);
renderShinyLensIcon(icon, shiny);
GlStateManager.disableCull();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
GlStateManager.color(1F, 1F, 1F, 1F);
}
public static void renderShinyLensIcon(IIcon icon, boolean shiny) {
float par1 = 0;
float par2 = 0;
float par4 = 16;
float par5 = 16;
float zLevel = 0F;
Tessellator tessellator = Tessellator.getInstance();
tessellator.getWorldRenderer().startDrawingQuads();
if(shiny)
tessellator.setBrightness(240);
tessellator.getWorldRenderer().addVertexWithUV(par1 + 0, par2 + par5, zLevel, icon.getMinU(), icon.getMaxV());
tessellator.getWorldRenderer().addVertexWithUV(par1 + par4, par2 + par5, zLevel, icon.getMaxU(), icon.getMaxV());
tessellator.getWorldRenderer().addVertexWithUV(par1 + par4, par2 + 0, zLevel, icon.getMaxU(), icon.getMinV());
tessellator.getWorldRenderer().addVertexWithUV(par1 + 0, par2 + 0, zLevel, icon.getMinU(), icon.getMinV());
tessellator.draw();
}
}*/
@@ -1,81 +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 @ [Aug 6, 2014, 10:04:57 PM (GMT)]
*//*
package vazkii.botania.client.render.item;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
public class RenderTransparentItem implements IItemRenderer {
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return type != ItemRenderType.INVENTORY;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
switch(type) {
case ENTITY : {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, 0F, 0F);
if(item.isOnItemFrame())
GlStateManager.translate(0F, -0.3F, 0.01F);
render(item);
GlStateManager.popMatrix();
break;
}
case EQUIPPED : {
render(item);
break;
}
case EQUIPPED_FIRST_PERSON : {
render(item);
break;
}
default : break;
}
}
public void render(ItemStack item) {
int dmg = item.getItemDamage();
IIcon icon = item.getItem().getIconFromDamageForRenderPass(dmg, 0);
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
float scale = 1F / 16F;
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color(1F, 1F, 1F, 1F);
ItemRenderer.renderItemIn2D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), scale);
GlStateManager.disableBlend();
GlStateManager.popMatrix();
GlStateManager.color(1F, 1F, 1F, 1F);
}
}
*/
@@ -10,9 +10,12 @@
*/
package vazkii.botania.client.render.tile;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@@ -41,12 +44,14 @@ public class RenderTileCocoon extends TileEntitySpecialRenderer<TileCocoon> {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.translate(d0, d1, d2);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
GlStateManager.rotate(90F, 1F, 0F, 0F);
GlStateManager.translate(0.5F, -0.5F - 3F / 16F, -0.5F + 1F / 16F);
GlStateManager.rotate(rot, 0F, 1F, 0F);
model.render();
GlStateManager.translate(d0, d1, d2 + 1);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
GlStateManager.translate(0.5F, 0, 0F);
GlStateManager.rotate(rot, 1F, 0F, 0F); // todo 1.8 fixme looks a little weird compared to 1.7
GlStateManager.translate(-0.5F, 0, 0F);
IBlockState state = cocoon.getWorld().getBlockState(cocoon.getPos());
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState(state);
Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightness(model, state, 1.0F, false);
GlStateManager.color(1F, 1F, 1F);
GlStateManager.enableRescaleNormal();
GlStateManager.popMatrix();
@@ -24,7 +24,7 @@ import net.minecraft.tileentity.TileEntity;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.model.FloatingFlowerModel;
import vazkii.botania.client.model.ModelMiniIsland;
import vazkii.botania.common.block.decor.IFloatingFlower;
import vazkii.botania.api.item.IFloatingFlower;
public class RenderTileFloatingFlower extends TileEntitySpecialRenderer {
@@ -10,6 +10,7 @@
*/
package vazkii.botania.client.render.tile;
import com.google.common.collect.ImmutableMap;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
@@ -26,14 +27,11 @@ import vazkii.botania.client.lib.LibResources;
import vazkii.botania.client.model.ModelIncensePlate;
import vazkii.botania.common.block.tile.TileIncensePlate;
import java.util.Map;
public class RenderTileIncensePlate extends TileEntitySpecialRenderer<TileIncensePlate> {
private static final float[] ROTATIONS = new float[] {
180F, 0F, 90F, 270F
};
ResourceLocation texture = new ResourceLocation(LibResources.MODEL_INCENSE_PLATE);
ModelIncensePlate model = new ModelIncensePlate();
private static final Map<EnumFacing, Integer> ROTATIONS = ImmutableMap.of(EnumFacing.NORTH, 180, EnumFacing.SOUTH, 0, EnumFacing.WEST, 270, EnumFacing.EAST, 90);
@Override
public void renderTileEntityAt(TileIncensePlate plate, double d0, double d1, double d2, float ticks, int digProgress) {
@@ -45,27 +43,17 @@ public class RenderTileIncensePlate extends TileEntitySpecialRenderer<TileIncens
GlStateManager.pushMatrix();
GlStateManager.enableRescaleNormal();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.translate(d0, d1, d2);
// Minecraft.getMinecraft().renderEngine.bindTexture(texture);
GlStateManager.translate(0.5F, 1.5F, 0.5F);
GlStateManager.scale(1F, -1F, -1F);
GlStateManager.rotate(ROTATIONS[Math.max(Math.min(ROTATIONS.length, facing.getIndex() - 2), 0)], 0F, 1F, 0F);
// model.render();
GlStateManager.scale(1F, -1F, -1F);
GlStateManager.rotate(ROTATIONS.get(facing), 0F, 1F, 0F);
ItemStack stack = plate.getStackInSlot(0);
if(stack != null) {
GlStateManager.pushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
float s = 0.4F;
GlStateManager.translate(-0.075F, -1.25F, 0F);
GlStateManager.scale(s, s, s);
//GlStateManager.rotate(180F, 0F, 1F, 0F);
Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.GROUND);
GlStateManager.popMatrix();
}
GlStateManager.color(1F, 1F, 1F);
GlStateManager.enableRescaleNormal();
@@ -11,6 +11,7 @@
package vazkii.botania.client.render.tile;
import java.awt.Color;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@@ -22,6 +23,7 @@ import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
@@ -30,23 +32,21 @@ import net.minecraftforge.client.model.pipeline.LightUtil;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.mana.IPoolOverlayProvider;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.PoolVariant;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.handler.MultiblockRenderHandler;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.client.model.ModelPool;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.mana.TilePool;
public class RenderTilePool extends TileEntitySpecialRenderer<TilePool> {
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_POOL);
private static final ResourceLocation textureInf = new ResourceLocation(LibResources.MODEL_INFINITE_POOL);
private static final ResourceLocation textureDil = new ResourceLocation(LibResources.MODEL_DILUTED_POOL);
private static final ModelPool model = new ModelPool();
public static int forceMeta = 0;
// Overrides for when we call this TESR without an actual pool
public static PoolVariant forceVariant = PoolVariant.DEFAULT;
public static boolean forceMana = false;
public static int forceManaNumber = -1;
@@ -63,49 +63,37 @@ public class RenderTilePool extends TileEntitySpecialRenderer<TilePool> {
float a = MultiblockRenderHandler.rendering ? 0.6F : 1F;
GlStateManager.color(1F, 1F, 1F, a);
GlStateManager.translate(d0, d1, d2);
boolean inf = pool.getWorld() == null ? forceMeta == 1 : pool.getBlockMetadata() == 1;
boolean dil = pool.getWorld() == null ? forceMeta == 2 : pool.getBlockMetadata() == 2;
boolean fab = pool.getWorld() == null ? forceMeta == 3 : pool.getBlockMetadata() == 3;
if (pool == null) { // A null pool means we are calling the TESR without a pool (on a minecart). Adjust accordingly
GlStateManager.translate(0, 0, -1);
} else {
GlStateManager.translate(d0, d1, d2);
}
boolean fab = pool == null ? forceVariant == PoolVariant.FABULOUS : pool.getWorld().getBlockState(pool.getPos()).getValue(BotaniaStateProps.POOL_VARIANT) == PoolVariant.FABULOUS;
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
int color;
if (fab) {
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
if(pool != null)
time += new Random(pool.getPos().getX() ^ pool.getPos().getY() ^ pool.getPos().getZ()).nextInt(100000);
color = Color.getHSBColor(time * 0.005F, 0.6F, 1F).hashCode();
} else {
color = pool.getColor().getMapColor().colorValue | 0xFF000000; // Add alpha
color = pool == null ? EnumDyeColor.WHITE.getMapColor().colorValue : pool.getColor().getMapColor().colorValue;
}
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState(pool.getWorld().getBlockState(pool.getPos()));
Tessellator tess = Tessellator.getInstance();
tess.getWorldRenderer().begin(GL11.GL_QUADS, Attributes.DEFAULT_BAKED_FORMAT);
GlStateManager.disableLighting();
for (BakedQuad quad : model.getGeneralQuads()) {
LightUtil.renderQuadColor(tess.getWorldRenderer(), quad, color);
}
for (EnumFacing e : EnumFacing.VALUES) {
for (BakedQuad quad: model.getFaceQuads(e)) {
LightUtil.renderQuadColor(tess.getWorldRenderer(), quad, color);
}
}
tess.draw();
GlStateManager.enableLighting();
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState(pool == null ? ModBlocks.pool.getDefaultState().withProperty(BotaniaStateProps.POOL_VARIANT, forceVariant) : pool.getWorld().getBlockState(pool.getPos()));
int red = (color & 0xFF0000) >> 16;
int green = (color & 0xFF00) >> 8;
int blue = (color & 0xFF) >> 0;
Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(model, 1.0F, red / 255F, green / 255F, blue / 255F);
GlStateManager.translate(0.5F, 1.5F, 0.5F);
GlStateManager.color(1, 1, 1, a);
GlStateManager.enableRescaleNormal();
int mana = pool.getCurrentMana();
if(forceManaNumber > -1)
mana = forceManaNumber;
int cap = pool.manaCap;
int mana = pool == null ? forceManaNumber : pool.getCurrentMana();
int cap = pool == null ? -1 : pool.manaCap;
if(cap == -1)
cap = TilePool.MAX_MANA;
@@ -117,7 +105,7 @@ public class RenderTilePool extends TileEntitySpecialRenderer<TilePool> {
float v = 1F / 8F;
float w = -v * 3.5F;
if(pool.getWorld() != null) {
if(pool != null) {
Block below = pool.getWorld().getBlockState(pool.getPos().down()).getBlock();
if(below instanceof IPoolOverlayProvider) {
TextureAtlasSprite overlay = ((IPoolOverlayProvider) below).getIcon(pool.getWorld(), pool.getPos());
@@ -161,7 +149,7 @@ public class RenderTilePool extends TileEntitySpecialRenderer<TilePool> {
}
GlStateManager.popMatrix();
forceMeta = 0;
forceVariant = PoolVariant.DEFAULT;
forceMana = false;
forceManaNumber = -1;
}
Loaded 100 of 352 files, more files were not shown because too many files have changed in this diff. Show more