Compare commits

...
Author SHA1 Message Date
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
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
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
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
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
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
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
245 changed files with 2203 additions and 1192 deletions

No files matched your search

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
@@ -1,10 +1,14 @@
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.subtile.SubTileEntity;
import vazkii.botania.api.item.IFloatingFlower;
import java.util.Collections;
import java.util.Map;
@@ -15,8 +19,9 @@ 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.
@@ -29,13 +34,14 @@ public final class BotaniaAPIClient {
* @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);
Preconditions.checkState(Loader.instance().isInState(LoaderState.PREINITIALIZATION));
subtileBlockModels.put(subTileName, model);
subtileItemModels.put(subTileName, itemModel);
}
/**
* 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.
* 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
*
@@ -56,17 +62,35 @@ public final class BotaniaAPIClient {
}
/**
* @return An immutable view of the registered subtile block model map
* @return An immutable and live view of the registered subtile block model map
*/
public static Map<String, ModelResourceLocation> getRegisteredSubtileBlockModels() {
return Collections.unmodifiableMap(queuedBlockModels);
return Collections.unmodifiableMap(subtileBlockModels);
}
/**
* @return An immutable view of the registered subtile item model map
* @return An immutable and live view of the registered subtile item model map
*/
public static Map<String, ModelResourceLocation> getRegisteredSubtileItemModels() {
return Collections.unmodifiableMap(queuedItemModels);
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);
}
private BotaniaAPIClient() {}
@@ -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);
}
@@ -8,7 +8,6 @@
*/
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.*;
/**
@@ -28,10 +29,13 @@ public class BotaniaStateProps {
/** Unlisted properties **/
// The property for specialFlower subtile id
public static final PropertyString SUBTILE_ID = new PropertyString("subtile_id");
public static final PropertyObject<String> SUBTILE_ID = new PropertyObject<>("subtile_id", String.class);
// The property for floating flower island type
public static final PropertyObject<IFloatingFlower.IslandType> ISLAND_TYPE = new PropertyObject<>("islandtype", IFloatingFlower.IslandType.class);
// The property for platform held blockstate id
public static final PropertyState HELD_STATE = new PropertyState("held_state");
public static final PropertyObject<IBlockState> HELD_STATE = new PropertyObject<>("held_state", IBlockState.class);
/** Common properties to all blocks to use **/
@@ -0,0 +1,46 @@
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;
}
}
@@ -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();
@@ -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);
@@ -429,7 +469,6 @@ public final class ModelHandler {
registerItemModel(blackLotus);
registerItemModel(blackLotus, 1);
registerItemModel(lexicon);
registerItemModel(manaCookie);
registerItemModel(manasteelHelm);
registerItemModel(manasteelHelmRevealing);
@@ -451,7 +490,6 @@ public final class ModelHandler {
registerItemModel(elementiumPick);
registerItemModel(elementiumShovel);
registerItemModel(elementiumAxe);
registerItemModel(elementiumShears);
registerItemModel(elementiumSword);
registerItemModel(terrasteelHelm);
@@ -560,11 +598,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
@@ -761,6 +798,14 @@ 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());
ModelLoader.setCustomStateMapper(ModBlocks.pump, new StateMap.Builder().ignore(BotaniaStateProps.CARDINALS).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,7 +29,6 @@ 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;
@@ -197,7 +197,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 +209,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;
}
@@ -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()];
@@ -8,10 +8,8 @@
*/
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;
@@ -35,10 +33,12 @@ 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.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.api.item.IFloatingFlower;
import vazkii.botania.common.item.block.ItemBlockFloatingSpecialFlower;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
@@ -79,12 +79,12 @@ public class FloatingFlowerModel implements ISmartItemModel, ISmartBlockModel, I
@Override
public IBakedModel handleBlockState(IBlockState state) {
IFloatingFlower.IslandType islandType = state.getValue(BlockFloatingFlower.ISLAND_TYPE);
IExtendedBlockState realState = ((IExtendedBlockState) state);
IFloatingFlower.IslandType islandType = realState.getValue(BotaniaStateProps.ISLAND_TYPE);
String identifier;
if (state.getBlock() == ModBlocks.floatingSpecialFlower) {
// Magic flower
IExtendedBlockState realState = ((IExtendedBlockState) state);
identifier = realState.getValue(BotaniaStateProps.SUBTILE_ID);
} else {
// Mundane flower
@@ -101,7 +101,7 @@ public class FloatingFlowerModel implements ISmartItemModel, ISmartBlockModel, I
if (CACHE.contains(islandType, identifier)) {
return CACHE.get(islandType, identifier);
} else {
IBakedModel islandModel = modelManager.getModel(new ModelResourceLocation("botania:miniIsland", "variant=" + islandType.getName()));
IBakedModel islandModel = modelManager.getModel(BotaniaAPIClient.getRegisteredIslandTypeModels().get(islandType));
IBakedModel flowerModel;
if (identifier.startsWith(MUNDANE_PREFIX)) {
@@ -113,6 +113,7 @@ public class FloatingFlowerModel implements ISmartItemModel, ISmartBlockModel, I
// 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;
}
@@ -42,7 +42,7 @@ 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.api.item.IFloatingFlower;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import javax.vecmath.Matrix4f;
@@ -72,10 +72,8 @@ public class SpecialFlowerModel implements IModelCustomData {
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();
}
@@ -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);
}
@@ -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 {
@@ -22,6 +22,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 +31,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,11 +62,13 @@ 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;
@@ -75,37 +76,21 @@ public class RenderTilePool extends TileEntitySpecialRenderer<TilePool> {
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
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 +102,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 +146,7 @@ public class RenderTilePool extends TileEntitySpecialRenderer<TilePool> {
}
GlStateManager.popMatrix();
forceMeta = 0;
forceVariant = PoolVariant.DEFAULT;
forceMana = false;
forceManaNumber = -1;
}
@@ -35,7 +35,7 @@ public class RenderTileSkullOverride extends TileEntitySkullRenderer {
@Override
public void renderTileEntityAt(TileEntitySkull p_147500_1_, double p_147500_2_, double p_147500_4_, double p_147500_6_, float p_147500_8_, int digProgress) {
if (p_147500_1_ != null) {
render(p_147500_1_, (float) p_147500_2_, (float) p_147500_4_, (float) p_147500_6_, EnumFacing.getFront(p_147500_1_.getBlockMetadata() & 7) /*todo 1.8*/, p_147500_1_.getSkullRotation() * 360 / 16.0F, p_147500_1_.getSkullType(), p_147500_1_.getPlayerProfile(), digProgress);
render(p_147500_1_, (float) p_147500_2_, (float) p_147500_4_, (float) p_147500_6_, EnumFacing.getFront(p_147500_1_.getBlockMetadata() & 7), p_147500_1_.getSkullRotation() * 360 / 16.0F, p_147500_1_.getSkullType(), p_147500_1_.getPlayerProfile(), digProgress);
} else {
render(null, ((float) p_147500_2_), ((float) p_147500_4_), ((float) p_147500_6_), EnumFacing.NORTH, 0, 3, null, 0);
}
@@ -43,18 +43,9 @@ public class RenderTileSkullOverride extends TileEntitySkullRenderer {
public void render(TileEntitySkull skull, float par1, float par2, float par3, EnumFacing par4, float par5, int par6, GameProfile gameProfile, int digProgress) {
boolean gaia = skull == null || skull instanceof TileGaiaHead;
if(par6 == 3 || gaia) {
ResourceLocation resourcelocation = DefaultPlayerSkin.getDefaultSkinLegacy();
if(gaia) {
Minecraft minecraft = Minecraft.getMinecraft();
if(gaia)
resourcelocation = minecraft.thePlayer.getLocationSkin();
else if(gameProfile != null) {
Map map = minecraft.getSkinManager().loadSkinFromCache(gameProfile);
if (map.containsKey(MinecraftProfileTexture.Type.SKIN)) {
resourcelocation = minecraft.getSkinManager().loadSkin((MinecraftProfileTexture)map.get(MinecraftProfileTexture.Type.SKIN), MinecraftProfileTexture.Type.SKIN);
}
}
ResourceLocation resourcelocation = minecraft.thePlayer.getLocationSkin();
bindTexture(resourcelocation);
GlStateManager.pushMatrix();
GlStateManager.disableCull();
@@ -81,13 +72,11 @@ public class RenderTileSkullOverride extends TileEntitySkullRenderer {
GlStateManager.enableRescaleNormal();
GlStateManager.scale(-1.0F, -1.0F, 1.0F);
GlStateManager.enableAlpha();
if(gaia)
ShaderHelper.useShader(ShaderHelper.doppleganger, RenderDoppleganger.defaultCallback);
ShaderHelper.useShader(ShaderHelper.doppleganger, RenderDoppleganger.defaultCallback);
modelSkull.render(null, 0F, 0F, 0F, par5, 0F, 0.0625F);
if(gaia)
ShaderHelper.releaseShader();
ShaderHelper.releaseShader();
GlStateManager.popMatrix();
} else super.renderSkull(par1, par2, par3, par4, par5, par6, gameProfile, digProgress);
}
@@ -22,11 +22,7 @@ import net.minecraft.util.ResourceLocation;
import vazkii.botania.common.block.tile.TileStarfield;
// THIS CODE WAS STOLEN FROM THE END PORTAL
// OH GOD
// I HAVE NO IDEA WHAT I'M DOING
// SO MUCH STUFF I DON'T UNDERSTAND D:
// HELP
// This is copied from the vanilla end portal TESR, relevant edits are commented
public class RenderTileStarfield extends TileEntitySpecialRenderer<TileStarfield> {
private static final ResourceLocation END_SKY_TEXTURE = new ResourceLocation("textures/environment/end_sky.png");
@@ -10,31 +10,30 @@
*/
package vazkii.botania.client.render.tile;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.MinecraftForge;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.item.TinyPotatoRenderEvent;
import vazkii.botania.client.core.handler.ContributorFancinessHandler;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.core.proxy.ClientProxy;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.client.model.ModelTinyPotato;
import vazkii.botania.common.block.tile.TileTinyPotato;
@@ -42,290 +41,302 @@ import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPotato> {
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_TINY_POTATO);
private static final ResourceLocation textureGrayscale = new ResourceLocation(LibResources.MODEL_TINY_POTATO_GS);
private static final ResourceLocation textureHalloween = new ResourceLocation(LibResources.MODEL_TINY_POTATO_HALLOWEEN);
private static final ModelTinyPotato model = new ModelTinyPotato();
@Override
public void renderTileEntityAt(TileTinyPotato potato, double d0, double d1, double d2, float var8, int digProgress) {
public void renderTileEntityAt(TileTinyPotato potato, double x, double y, double z, float partialTicks, int destroyStage) {
if (potato != null && potato.getWorld() != null && !potato.getWorld().isBlockLoaded(potato.getPos(), false)) {
return;
}
GlStateManager.pushMatrix();
GlStateManager.enableRescaleNormal();
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.translate(d0, d1, d2);
GlStateManager.translate(x, y, z);
Minecraft mc = Minecraft.getMinecraft();
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
mc.renderEngine.bindTexture(ClientProxy.dootDoot ? textureHalloween : texture);
String name = potato.name.toLowerCase();
boolean usedShader = false;
if(name.startsWith("gaia ")) {
if (name.startsWith("gaia ")) {
ShaderHelper.useShader(ShaderHelper.doppleganger);
name = name.substring(5);
usedShader = true;
} else if(name.startsWith("hot ")) {
} else if (name.startsWith("hot ")) {
ShaderHelper.useShader(ShaderHelper.halo);
name = name.substring(4);
usedShader = true;
} else if(name.startsWith("magic ")) {
} else if (name.startsWith("magic ")) {
ShaderHelper.useShader(ShaderHelper.enchanterRune);
name = name.substring(6);
usedShader = true;
} else if(name.startsWith("gold ")) {
} else if (name.startsWith("gold ")) {
ShaderHelper.useShader(ShaderHelper.gold);
name = name.substring(5);
usedShader = true;
} else if(name.startsWith("snoop ")) {
} else if (name.startsWith("snoop ")) {
ShaderHelper.useShader(ShaderHelper.terraPlateRune);
name = name.substring(6);
usedShader = true;
}
float jump = potato.jumpTicks;
if(jump > 0)
jump -= var8;
GlStateManager.translate(0.5F, 1.5F, 0.5F);
GlStateManager.scale(1F, -1F, -1F);
int meta = potato.getWorld() == null ? 3 : potato.getBlockMetadata();
float rotY = meta * 90F - 180F;
GlStateManager.rotate(rotY, 0F, 1F, 0F);
float up = (float) Math.abs(Math.sin(jump / 10 * Math.PI)) * 0.2F;
float jump = potato.jumpTicks;
if (jump > 0)
jump -= partialTicks;
float up = (float) -Math.abs(Math.sin(jump / 10 * Math.PI)) * 0.2F;
float rotZ = (float) Math.sin(jump / 10 * Math.PI) * 2;
GlStateManager.translate(0F, up, 0F);
GlStateManager.rotate(rotZ, 0F, 0F, 1F);
GlStateManager.pushMatrix();
if(name.equals("pahimar")) {
if (name.equals("pahimar")) {
GlStateManager.scale(1F, 0.3F, 1F);
//GlStateManager.translate(0F, 3.5F, 0F);
} else if(name.equals("kyle hyde")) {
// 1.8: handled using getActualState - mc.renderEngine.bindTexture(textureGrayscale);
} else if(name.equals("dinnerbone") || name.equals("grumm")) {
GlStateManager.translate(0F, 3.5F, 0F);
} else if (name.equals("kyle hyde"))
mc.renderEngine.bindTexture(textureGrayscale);
else if (name.equals("dinnerbone") || name.equals("grumm")) {
GlStateManager.rotate(180F, 0F, 0F, 1F);
//GlStateManager.translate(0F, -2.625F, 0F);
} else if(name.equals("aureylian"))
GlStateManager.translate(0F, -2.625F, 0F);
} else if (name.equals("aureylian"))
GlStateManager.color(1F, 0.5F, 1F);
IBlockState state = potato.getWorld().getBlockState(potato.getPos());
state = state.getBlock().getActualState(state, potato.getWorld(), potato.getPos());
IBakedModel bakedModel = mc.getBlockRendererDispatcher().getBlockModelShapes().getModelForState(state);
boolean render = !(name.equals("mami") || name.equals("soaryn") || name.equals("eloraam") && jump != 0);
if(render) {
GlStateManager.rotate(-90, 0, 1, 0);
mc.getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightness(bakedModel, potato.getWorld().getBlockState(potato.getPos()), 1.0F, false);
GlStateManager.rotate(90, 0, 1, 0);
//model.render();
}
if(name.equals("kingdaddydmac")) {
GlStateManager.translate(-0.5F, 0F, 0F);
mc.getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightness(bakedModel, potato.getWorld().getBlockState(potato.getPos()), 1.0F, false);
//model.render();
if (render)
model.render();
if (name.equals("kingdaddydmac")) {
GlStateManager.translate(0.5F, 0F, 0F);
model.render();
}
if(usedShader)
if (usedShader)
ShaderHelper.releaseShader();
GlStateManager.popMatrix();
if(!name.isEmpty()) {
if (!name.isEmpty()) {
GlStateManager.pushMatrix();
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
ContributorFancinessHandler.firstStart();
// todo 1.8 refine all below
float scale = 1F / 4F;
GlStateManager.translate(0F, 1F, 0F);
GlStateManager.scale(scale, scale, scale);
if(name.equals("phi") || name.equals("vazkii")) {
if (name.equals("phi") || name.equals("vazkii")) {
GlStateManager.translate(0.45F, 0F, 0.4F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.rotate(20F, 1F, 0F, 1F);
renderIcon(MiscellaneousIcons.INSTANCE.phiFlowerIcon);
if(name.equals("vazkii")) {
if (name.equals("vazkii")) {
GlStateManager.rotate(-20F, 1F, 0F, 1F);
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(-1.5F, -1.3F, -0.75F);
renderIcon(MiscellaneousIcons.INSTANCE.nerfBatIcon);
}
} else if(name.equals("skull kid")) {
} else if (name.equals("skull kid")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(-0.5F, -1.2F, -0.4F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(ModItems.cosmetic, 1, 23), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("kamina")) {
GlStateManager.translate(0F, -0.7F, -0.4F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 23));
} else if (name.equals("kamina")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(-0.5F, -1.1F, -0.4F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(ModItems.cosmetic, 1, 26), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("haighyorkie")) {
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, -0.6F, 0.4F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 26));
} else if (name.equals("haighyorkie")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.translate(-0.5F, -1.2F, -0.4F);
renderIcon(MiscellaneousIcons.INSTANCE.goldfishIcon);
} else if(name.equals("chitoge")) {
} else if (name.equals("chitoge")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(-0.5F, -0.7F, 0.1F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(ModItems.cosmetic, 1, 7), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("direwolf20")) {
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, -0.2F, 0.1F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 7));
} else if (name.equals("direwolf20")) {
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(-0.5F, -2.2F, -0.5F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(ModItems.cosmetic, 1, 0), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("doctor")) {
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, -1.7F, 0.5F);
renderItem(new ItemStack(ModItems.cosmetic));
} else if (name.equals("doctor")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(-0.5F, -1.15F, -0.4F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(ModItems.cosmetic, 1, 25), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("snoo")) {
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, -0.65F, 0.4F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 25));
} else if (name.equals("snoo")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(-0.5F, -0.7F, 0.1F);
GlStateManager.rotate(20F, 0F, 0F, 1F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(ModItems.cosmetic, 1, 24), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("charlotte")) {
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0.2F, 0F, -0.05F);
GlStateManager.rotate(-20F, 0F, 0F, 1F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 24));
} else if (name.equals("charlotte")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(-0.5F, -1.2F, -0.4F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(ModItems.cosmetic, 1, 12), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("greg") || name.equals("gregorioust")) {
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, -0.7F, 0.4F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 12));
} else if (name.equals("greg") || name.equals("gregorioust")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.translate(-0.5F, -1.5F, -0.4F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(Items.book, 1, 0), ItemCameraTransforms.TransformType.THIRD_PERSON);
GlStateManager.rotate(270F, 0F, 1F, 0F);
GlStateManager.translate(0F, -1F, 0.4F);
renderItem(new ItemStack(Items.book));
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
GlStateManager.translate(0.5F, 0.5F, 0F);
GlStateManager.scale(0.3F, 0.3F, 0.3F);
mc.getBlockRendererDispatcher().renderBlockBrightness(Blocks.iron_ore.getDefaultState(), 1F);
} else if(name.equals("profmobius")) {
renderItem(new ItemStack(Blocks.iron_ore));
} else if (name.equals("profmobius")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.translate(-0.5F, -1.2F, -0.4F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(Items.bread, 1, 0), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("martysgames") || name.equals("marty")) {
GlStateManager.rotate(270F, 0F, 1F, 0F);
GlStateManager.translate(0F, -0.7F, 0.4F);
renderItem(new ItemStack(Items.bread));
} else if (name.equals("martysgames") || name.equals("marty")) {
GlStateManager.scale(0.7F, 0.7F, 0.7F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(-0.75F, -2.4F, -0.7F);
GlStateManager.rotate(10F, 0F, 0F, 1F);
ItemStack renderStack = new ItemStack(ModItems.infiniteFruit, 1);
renderStack.setStackDisplayName("das boot");
Minecraft.getMinecraft().getRenderItem().renderItem(renderStack, ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("tromped")) {
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0.3F, -1.8F, 0.7F);
GlStateManager.rotate(-15F, 0F, 0F, 1F);
renderItem(new ItemStack(ModItems.infiniteFruit, 1).setStackDisplayName("das boot"));
} else if (name.equals("tromped")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(270F, 0F, 1F, 0F);
GlStateManager.translate(0F, -0.7F, 0.4F);
renderItem(new ItemStack(ModItems.cacophonium));
} else if (name.equals("kain vinosec")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.translate(-0.5F, -1.2F, -0.4F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(ModItems.cacophonium, 1, 0), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("kain vinosec")) {
GlStateManager.translate(-0.3F, -1F, 0.4F);
renderItem(new ItemStack(ModItems.recordGaia1));
GlStateManager.scale(0.5F, 0.5F, 0.5F);
GlStateManager.translate(0F, 0F, -0.85F);
renderItem(new ItemStack(ModItems.recordGaia2));
} else if (name.equals("mankrik")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.translate(-0.3F, -1.5F, -0.4F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(ModItems.recordGaia1, 1, 0), ItemCameraTransforms.TransformType.THIRD_PERSON);
GlStateManager.translate(0F, 0F, 0.85F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(ModItems.recordGaia2, 1, 0), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("mankrik")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(-0.5F, -0.2F, -0.1F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(ModItems.cosmetic, 1, 31), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("kurumi")) {
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, 0.3F, 0.1F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 31));
} else if (name.equals("kurumi")) {
GlStateManager.scale(0.4F, 0.4F, 0.4F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(-0.9F, -2.5F, -1.3F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(ModItems.cosmetic, 1, 17), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("ichun")) {
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0.4F, -2F, 1.3F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 17));
} else if (name.equals("ichun")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(-0.5F, -1.2F, -0.4F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(ModItems.cosmetic, 1, 15), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("wiiv") || name.equals("dylan4ever") || name.equals("dylankaiser")) {
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, -0.7F, 0.4F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 15));
} else if (name.equals("wiiv") || name.equals("dylan4ever") || name.equals("dylankaiser")) {
GlStateManager.scale(1.5F, 1.5F, 1.5F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.translate(-0.5F, -1.1F, -0.325F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(Items.painting, 1, 0), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("jibril")) {
GlStateManager.translate(-0.1F, -0.6F, -0.325F);
renderItem(new ItemStack(Items.painting));
} else if (name.equals("jibril")) {
GlStateManager.scale(1.5F, 1.5F, 1.5F);
GlStateManager.translate(0F, 0.7F, 0F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
ItemFlightTiara.renderHalo(null, var8);
} else if(name.equals("nebris")) {
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
ItemFlightTiara.renderHalo(null, partialTicks);
} else if (name.equals("nebris")) {
GlStateManager.scale(2F, 2F, 2F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
mc.getBlockRendererDispatcher().renderBlockBrightness(Blocks.glowstone.getDefaultState(), 1F);
} else if(name.equals("ible")) {
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
renderItem(new ItemStack(Blocks.glowstone));
} else if (name.equals("ible")) {
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
GlStateManager.scale(1.2F, 1.2F, 1.2F);
GlStateManager.translate(0F, 0.7F, 0F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.translate(-0.5F, 0F, -0.5F);
GlStateManager.rotate(180F, 1F, 1F, 0F);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
mc.getBlockRendererDispatcher().renderBlockBrightness(Blocks.portal.getDefaultState(), 1F);
} else if(name.equals("razz") || name.equals("razzleberryfox")) {
renderBlock(Blocks.portal);
} else if (name.equals("razz") || name.equals("razzleberryfox")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.translate(-0.5F, -1F, 0.45F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(ModItems.cosmetic, 1, 8), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("etho") || name.equals("ethoslab")) {
GlStateManager.translate(0, -0.5F, 0.45F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 8));
} else if (name.equals("etho") || name.equals("ethoslab")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.translate(-0.5F, -1.2F, -0.4F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(Items.cookie, 1, 0), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("sethbling")) {
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
GlStateManager.translate(0F, -0.7F, 0.4F);
renderItem(new ItemStack(Items.cookie));
} else if (name.equals("sethbling")) {
GlStateManager.scale(1.2F, 1.2F, 1.2F);
GlStateManager.translate(0F, 0.9F, 0F);
GlStateManager.translate(-0.5F, 1.4F, -0.5F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
mc.getBlockRendererDispatcher().renderBlockBrightness(Blocks.command_block.getDefaultState(), 1F);
} else if(name.equals("bdoubleo100") || name.equals("bdoubleo")) {
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
renderBlock(Blocks.command_block);
} else if (name.equals("bdoubleo100") || name.equals("bdoubleo")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(-1F, -1.1F, -0.1F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(Items.stick, 1, 0), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("kingdaddydmac")) {
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0.5F, -0.6F, 0.1F);
renderItem(new ItemStack(Items.stick));
} else if (name.equals("kingdaddydmac")) {
GlStateManager.scale(0.5F, 0.5F, 0.5F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.translate(-0.3F, -2.5F, 1.075F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(ModItems.manaRing, 1, 0), ItemCameraTransforms.TransformType.THIRD_PERSON);
GlStateManager.translate(0F, 0F, -4F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(ModItems.manaRing, 1, 0), ItemCameraTransforms.TransformType.THIRD_PERSON);
GlStateManager.rotate(270F, 0F, 1F, 0F);
GlStateManager.translate(-0.3F, -2F, -1.075F);
renderItem(new ItemStack(ModItems.manaRing, 1, 0));
GlStateManager.scale(0.5F, 0.5F, 0.5F);
GlStateManager.translate(0F, 0F, 4F);
renderItem(new ItemStack(ModItems.manaRing, 1, 0));
GlStateManager.scale(0.8F, 0.8F, 0.8F);
GlStateManager.translate(-1.7F, -1.2F, -0.1F);
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
GlStateManager.scale(1.5F, 1.5F, 1.5F);
GlStateManager.translate(1.5F, -0.5F, 0.7F);
mc.getBlockRendererDispatcher().renderBlockBrightness(Blocks.cake.getDefaultState(), 1.0F);
} else if(name.equals("sjin")) {
renderBlock(Blocks.cake);
} else if (name.equals("sjin")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(-0.5F, -1.27F, -0.4F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(ModItems.cosmetic, 1, 27), ItemCameraTransforms.TransformType.THIRD_PERSON);
} else if(name.equals("martyn") || name.equals("inthelittlewood")) {
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, -0.77F, 0.4F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 27));
} else if (name.equals("martyn") || name.equals("inthelittlewood")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(-0.5F, -0.45F, -0.1F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, 0.05F, 0.1F);
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(Blocks.sapling, 1, 0), ItemCameraTransforms.TransformType.THIRD_PERSON);
}else if(ContributorFancinessHandler.flowerMap != null && ContributorFancinessHandler.flowerMap.containsKey(name)) {
renderItem(new ItemStack(Blocks.sapling, 0, 0));
} else if (ContributorFancinessHandler.flowerMap != null && ContributorFancinessHandler.flowerMap.containsKey(name)) {
ItemStack icon = ContributorFancinessHandler.flowerMap.get(name);
if(icon != null) {
if (icon != null) {
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.translate(-0.5F, -0.5F, 0F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, 0F, 0F);
ShaderHelper.useShader(ShaderHelper.gold);
Minecraft.getMinecraft().getRenderItem().renderItem(icon, ItemCameraTransforms.TransformType.THIRD_PERSON);
renderItem(icon);
ShaderHelper.releaseShader();
}
}
@@ -333,15 +344,17 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
GlStateManager.popMatrix();
}
MinecraftForge.EVENT_BUS.post(new TinyPotatoRenderEvent(potato, potato.name, d0, d1, d2, var8));
MinecraftForge.EVENT_BUS.post(new TinyPotatoRenderEvent(potato, potato.name, x, y, z, partialTicks, destroyStage));
GlStateManager.rotate(-rotZ, 0F, 0F, 1F);
GlStateManager.rotate(-rotY, 0F, 1F, 0F);
GlStateManager.color(1F, 1F, 1F);
GlStateManager.scale(1F, -1F, -1F);
MovingObjectPosition pos = mc.objectMouseOver;
if(!name.isEmpty() && pos != null && potato.getPos().equals(pos.getBlockPos())) {
if (!name.isEmpty() && pos != null && pos.getBlockPos() != null && potato.getPos().equals(pos.getBlockPos())) {
GlStateManager.pushMatrix();
GlStateManager.translate(0.5F, 0.75F, 0.5F);
GlStateManager.translate(0F, -0.6F, 0F);
GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(mc.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F);
float f = 1.6F;
@@ -353,30 +366,31 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
GlStateManager.enableBlend();
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
GlStateManager.disableTexture2D();
tessellator.getWorldRenderer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
int i = mc.fontRendererObj.getStringWidth(potato.name) / 2;
tessellator.getWorldRenderer().pos(-i - 1, -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
tessellator.getWorldRenderer().pos(-i - 1, 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
tessellator.getWorldRenderer().pos(i + 1, 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
tessellator.getWorldRenderer().pos(i + 1, -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
worldrenderer.pos(-i - 1, -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
worldrenderer.pos(-i - 1, 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
worldrenderer.pos(i + 1, 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
worldrenderer.pos(i + 1, -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.depthMask(true);
mc.fontRendererObj.drawString(potato.name, -mc.fontRendererObj.getStringWidth(potato.name) / 2, 0, 0xFFFFFF);
if(name.equals("pahimar") || name.equals("soaryn")) {
if (name.equals("pahimar") || name.equals("soaryn")) {
GlStateManager.translate(0F, 14F, 0F);
String s = name.equals("pahimar") ? "[WIP]" : "(soon)";
GlStateManager.depthMask(false);
GlStateManager.enableBlend();
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GlStateManager.disableTexture2D();
tessellator.getWorldRenderer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
i = mc.fontRendererObj.getStringWidth(s) / 2;
tessellator.getWorldRenderer().pos(-i - 1, -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
tessellator.getWorldRenderer().pos(-i - 1, 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
tessellator.getWorldRenderer().pos(i + 1, 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
tessellator.getWorldRenderer().pos(i + 1, -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
worldrenderer.pos(-i - 1, -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
worldrenderer.pos(-i - 1, 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
worldrenderer.pos(i + 1, 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
worldrenderer.pos(i + 1, -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.depthMask(true);
@@ -400,4 +414,12 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
float f3 = icon.getMaxV();
IconHelper.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
}
public void renderItem(ItemStack stack) {
Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.HEAD);
}
public void renderBlock(Block block) {
Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlockBrightness(block.getDefaultState(), 1.0F);
}
}
@@ -10,6 +10,17 @@
*/
package vazkii.botania.common;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.event.ClickEvent;
import net.minecraft.event.HoverEvent;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
import vazkii.botania.common.core.handler.IMCHandler;
import vazkii.botania.common.core.handler.ManaNetworkHandler;
import vazkii.botania.common.core.proxy.CommonProxy;
@@ -63,7 +74,28 @@ public class Botania {
lightHelper = coloredLightsLoaded ? new LightHelperColored() : new LightHelperVanilla();
proxy.preInit(event);
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent // todo temporary nag, remove when merging back into master
public void nagUnofficial(PlayerEvent.PlayerLoggedInEvent evt) {
EntityPlayer player = evt.player;
IChatComponent message = new ChatComponentTranslation("botaniamisc.unofficial.nag");
message.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED).setUnderlined(true));
IChatComponent message2 = new ChatComponentTranslation("botaniamisc.unofficial.report");
message2.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW));
IChatComponent url = new ChatComponentText("https://github.com/williewillus/Botania/issues");
url.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://github.com/williewillus/Botania/issues"));
url.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText("CLICK")));
player.addChatComponentMessage(message);
player.addChatComponentMessage(message2.appendSibling(url));
}
@EventHandler
public void init(FMLInitializationEvent event) {
proxy.init(event);
@@ -72,21 +72,6 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
);
}
@Override
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) {
if (collidingEntity instanceof EntityItem) {
float f = 1F / 16F * 2F;
// Todo 1.8 temporary hack to let items collide from the top. Figure out what changed to break this.
setBlockBounds(f, f, f, 1F - f, 0.65F, 1F -f);
super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
setBlockBounds(f, f, f, 1F - f, 1F / 16F * 20F, 1F - f);
return;
} else {
super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
}
}
@Override
public BlockState createBlockState() {
return new BlockState(this, BotaniaStateProps.ALTAR_VARIANT);
@@ -26,7 +26,9 @@ import net.minecraft.util.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameRegistry;
import vazkii.botania.common.block.tile.TileFakeAir;
import vazkii.botania.common.item.block.ItemBlockPool;
import vazkii.botania.common.lib.LibBlockNames;
public class BlockFakeAir extends BlockModContainer {
@@ -43,6 +45,17 @@ public class BlockFakeAir extends BlockModContainer {
return -1;
}
@Override
protected boolean shouldRegisterInNameSet() {
return false;
}
@Override
public Block setUnlocalizedName(String par1Str) {
GameRegistry.registerBlock(this, null, par1Str);
return super.setUnlocalizedName(par1Str);
}
@Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block block) {
if(shouldRemove(world, pos))
@@ -44,7 +44,7 @@ import vazkii.botania.api.subtile.ISpecialFlower;
import vazkii.botania.api.wand.IWandHUD;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.common.block.decor.BlockFloatingFlower;
import vazkii.botania.common.block.decor.IFloatingFlower;
import vazkii.botania.api.item.IFloatingFlower;
import vazkii.botania.common.block.tile.TileFloatingSpecialFlower;
import vazkii.botania.common.block.tile.TileSpecialFlower;
import vazkii.botania.common.crafting.recipe.SpecialFloatingFlowerRecipe;
@@ -62,19 +62,19 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
GameRegistry.addRecipe(new SpecialFloatingFlowerRecipe());
RecipeSorter.register("botania:floatingSpecialFlower", SpecialFloatingFlowerRecipe.class, Category.SHAPELESS, "");
setDefaultState(((IExtendedBlockState) blockState.getBaseState())
.withProperty(BotaniaStateProps.ISLAND_TYPE, IFloatingFlower.IslandType.GRASS)
.withProperty(BotaniaStateProps.SUBTILE_ID, "daybloom")
.withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE)
.withProperty(ISLAND_TYPE, IFloatingFlower.IslandType.GRASS));
.withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
}
@Override
public BlockState createBlockState() {
return new ExtendedBlockState(this, new IProperty[] { ISLAND_TYPE, BotaniaStateProps.COLOR }, new IUnlistedProperty[] { BotaniaStateProps.SUBTILE_ID });
return new ExtendedBlockState(this, new IProperty[] { BotaniaStateProps.COLOR }, new IUnlistedProperty[] { BotaniaStateProps.SUBTILE_ID, BotaniaStateProps.ISLAND_TYPE });
}
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
state = getActualState(state, world, pos);
state = super.getExtendedState(state, world, pos);
TileEntity te = world.getTileEntity(pos);
if (te instanceof TileFloatingSpecialFlower) {
state = ((IExtendedBlockState) state).withProperty(BotaniaStateProps.SUBTILE_ID, ((TileFloatingSpecialFlower) te).subTileName);
@@ -39,7 +39,7 @@ public class BlockTeruTeruBozu extends BlockModContainer implements ILexiconable
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, Entity e) {
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity e) {
if(!world.isRemote && e instanceof EntityItem) {
EntityItem item = (EntityItem) e;
ItemStack stack = item.getEntityItem();
@@ -10,12 +10,9 @@
*/
package vazkii.botania.common.block.decor;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.particle.EffectRenderer;
@@ -35,35 +32,37 @@ import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import thaumcraft.api.crafting.IInfusionStabiliser;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.item.IFloatingFlower;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.BlockModContainer;
import vazkii.botania.common.block.decor.IFloatingFlower.IslandType;
import vazkii.botania.api.item.IFloatingFlower.IslandType;
import vazkii.botania.common.block.tile.TileFloatingFlower;
import vazkii.botania.common.block.tile.TileFloatingSpecialFlower;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.integration.coloredlights.ColoredLightHelper;
import vazkii.botania.common.item.ItemGrassSeeds;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.IFloatingFlowerVariant;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import net.minecraftforge.fml.common.Optional;
import net.minecraftforge.fml.common.registry.GameRegistry;
import java.util.List;
import java.util.Random;
@Optional.Interface(modid = "Thaumcraft", iface = "thaumcraft.api.crafting.IInfusionStabiliser", striprefs = true)
public class BlockFloatingFlower extends BlockModContainer implements ILexiconable, IInfusionStabiliser {
// Island type (floating flowers)
// Not in BotaniaStateProps so we don't have to bundle IslandType in the API
public static final PropertyEnum<IslandType> ISLAND_TYPE = PropertyEnum.create("islandtype", IFloatingFlower.IslandType.class);
public BlockFloatingFlower() {
this(LibBlockNames.MINI_ISLAND);
}
@@ -77,9 +76,9 @@ public class BlockFloatingFlower extends BlockModContainer implements ILexiconab
float f = 0.1F;
setBlockBounds(f, f, f, 1F - f, 1F - f, 1F - f);
setDefaultState(blockState.getBaseState()
.withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE)
.withProperty(ISLAND_TYPE, IFloatingFlower.IslandType.GRASS));
setDefaultState(((IExtendedBlockState) blockState.getBaseState())
.withProperty(BotaniaStateProps.ISLAND_TYPE, IslandType.GRASS)
.withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
}
@Override
@@ -89,7 +88,7 @@ public class BlockFloatingFlower extends BlockModContainer implements ILexiconab
@Override
public BlockState createBlockState() {
return new BlockState(this, BotaniaStateProps.COLOR, ISLAND_TYPE);
return new ExtendedBlockState(this, new IProperty[] { BotaniaStateProps.COLOR }, new IUnlistedProperty[] { BotaniaStateProps.ISLAND_TYPE });
}
@Override
@@ -106,12 +105,13 @@ public class BlockFloatingFlower extends BlockModContainer implements ILexiconab
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
state = getActualState(state, world, pos);
TileEntity te = world.getTileEntity(pos);
if (te instanceof TileFloatingFlower) {
state = state.withProperty(ISLAND_TYPE, ((TileFloatingFlower) te).getIslandType());
state = ((IExtendedBlockState) state).withProperty(BotaniaStateProps.ISLAND_TYPE, ((TileFloatingFlower) te).getIslandType());
} else if (te instanceof TileFloatingSpecialFlower) {
state = state.withProperty(ISLAND_TYPE, ((TileFloatingSpecialFlower) te).getIslandType());
state = ((IExtendedBlockState) state).withProperty(BotaniaStateProps.ISLAND_TYPE, ((TileFloatingSpecialFlower) te).getIslandType());
}
return state;
}
@@ -211,8 +211,8 @@ public class BlockFloatingFlower extends BlockModContainer implements ILexiconab
IslandType type = null;
if(stack.getItem() == Items.snowball)
type = IslandType.SNOW;
else if(stack.getItem() == ModItems.grassSeeds) {
IslandType newType = ItemGrassSeeds.getIslandType(stack);
else if(stack.getItem() instanceof IFloatingFlowerVariant) {
IslandType newType = ((IFloatingFlowerVariant) stack.getItem()).getIslandType(stack);
if(newType != null)
type = newType;
}
@@ -52,7 +52,7 @@ public class BlockManaGlass extends BlockMod implements ILexiconable {
@Override
public boolean shouldSideBeRendered(IBlockAccess world, BlockPos pos, EnumFacing side) {
return shouldSideBeRendered1(world, pos, side.getOpposite()); // todo 1.8 recheck (was 1 - sideInt)
return shouldSideBeRendered1(world, pos, side.getOpposite());
}
@Override
@@ -1,65 +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 @ [Nov 17, 2014, 6:05:18 PM (GMT)]
*/
package vazkii.botania.common.block.decor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.client.lib.LibResources;
import java.util.Locale;
public interface IFloatingFlower {
public ItemStack getDisplayStack();
public IslandType getIslandType();
public void setIslandType(IslandType type);
public static enum IslandType implements IStringSerializable {
GRASS(LibResources.MODEL_MINI_ISLAND),
PODZOL(LibResources.MODEL_MINI_ISLAND_PODZOL),
MYCEL(LibResources.MODEL_MINI_ISLAND_MYCEL),
SNOW(LibResources.MODEL_MINI_ISLAND_SNOW),
DRY(LibResources.MODEL_MINI_ISLAND_DRY),
GOLDEN(LibResources.MODEL_MINI_ISLAND_GOLDEN),
VIVID(LibResources.MODEL_MINI_ISLAND_VIVID),
SCORCHED(LibResources.MODEL_MINI_ISLAND_SCORCHED),
INFUSED(LibResources.MODEL_MINI_ISLAND_INFUSED),
MUTATED(LibResources.MODEL_MINI_ISLAND_MUTATED);
private IslandType(String s) {
res = new ResourceLocation(s);
}
private final ResourceLocation res;
public static IslandType ofType(String typeStr) {
for(IslandType type : IslandType.class.getEnumConstants())
if(type.toString().equals(typeStr))
return type;
return GRASS;
}
public ResourceLocation getResource() {
return res;
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
}
@@ -17,6 +17,8 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.mana.IPoolOverlayProvider;
@@ -45,6 +47,7 @@ public class BlockAlchemyCatalyst extends BlockMod implements ILexiconable, IPoo
}
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIcon(World world, BlockPos pos) {
return MiscellaneousIcons.INSTANCE.alchemyCatalystOverlay;
}
@@ -55,6 +55,9 @@ public class BlockBellows extends BlockModContainer implements ILexiconable {
@Override
public IBlockState getStateFromMeta(int meta) {
if (meta < 2 || meta > 5) {
meta = 2;
}
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.getFront(meta));
}
@@ -69,7 +69,7 @@ public class BlockForestDrum extends BlockMod implements IManaTrigger, ILexicona
@Override
public IBlockState getStateFromMeta(int meta) {
if (meta > DrumVariant.values().length) {
if (meta >= DrumVariant.values().length) {
meta = 0;
}
return getDefaultState().withProperty(BotaniaStateProps.DRUM_VARIANT, DrumVariant.values()[meta]);
@@ -18,6 +18,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.mana.IPoolOverlayProvider;
@@ -48,6 +50,7 @@ public class BlockManaVoid extends BlockModContainer implements ILexiconable, IP
}
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getIcon(World world, BlockPos pos) {
return MiscellaneousIcons.INSTANCE.manaVoidOverlay;
}
@@ -88,7 +88,7 @@ public class SubTileHopperhock extends SubTileFunctional {
for(EnumFacing dir : EnumFacing.VALUES) {
BlockPos pos_ = pos.offset(dir);
IInventory inv = InventoryHelper.getInventory(supertile.getWorld(), pos_, dir);
IInventory inv = InventoryHelper.getInventory(supertile.getWorld(), pos_);
if(inv != null) {
List<ItemStack> filter = getFilterForInventory(inv, pos_, true);
boolean canAccept = canAcceptItem(stack, filter, filterType);
@@ -40,7 +40,7 @@ import vazkii.botania.api.subtile.ISubTileContainer;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.SubTileEntity;
import vazkii.botania.api.subtile.SubTileFunctional;
import vazkii.botania.common.block.decor.IFloatingFlower;
import vazkii.botania.api.item.IFloatingFlower;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.lexicon.LexiconData;
@@ -12,6 +12,7 @@ package vazkii.botania.common.block.subtile.generating;
import java.util.List;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
@@ -19,6 +20,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.WorldServer;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
@@ -38,9 +40,12 @@ public class SubTileGourmaryllis extends SubTileGenerating {
public void onUpdate() {
super.onUpdate();
if(cooldown > 0)
if (supertile.getWorld().isRemote)
return;
if(cooldown > -1)
cooldown--;
if(cooldown == 0 && !supertile.getWorld().isRemote) {
if(cooldown == 0) {
mana = Math.min(getMaxMana(), mana + storedMana);
storedMana = 0;
sync();
@@ -48,32 +53,21 @@ public class SubTileGourmaryllis extends SubTileGenerating {
int slowdown = getSlowdownFactor();
boolean remote = supertile.getWorld().isRemote;
List<EntityItem> items = supertile.getWorld().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
for(EntityItem item : items) {
ItemStack stack = item.getEntityItem();
if(stack != null && stack.getItem() instanceof ItemFood && !item.isDead && ((Integer) ObfuscationReflectionHelper.getPrivateValue(EntityItem.class, item, LibObfuscation.AGE)) >= slowdown) {
if(cooldown == 0) {
if(!remote) {
int val = ((ItemFood) stack.getItem()).getHealAmount(stack);
storedMana = val * val * 64;
cooldown = val * 10;
supertile.getWorld().playSoundEffect(supertile.getPos().getX(), supertile.getPos().getY(), supertile.getPos().getZ(), "random.eat", 0.2F, 0.5F + (float) Math.random() * 0.5F);
sync();
} else
for(int i = 0; i < 10; i++) {
float m = 0.2F;
float mx = (float) (Math.random() - 0.5) * m;
float my = (float) (Math.random() - 0.5) * m;
float mz = (float) (Math.random() - 0.5) * m;
supertile.getWorld().spawnParticle(EnumParticleTypes.ITEM_CRACK, item.posX, item.posY, item.posZ, mx, my, mz, Item.getIdFromItem(stack.getItem()), stack.getItemDamage());
}
if(cooldown <= 0) {
int val = ((ItemFood) stack.getItem()).getHealAmount(stack);
storedMana = val * val * 64;
cooldown = val * 10;
supertile.getWorld().playSoundEffect(supertile.getPos().getX(), supertile.getPos().getY(), supertile.getPos().getZ(), "random.eat", 0.2F, 0.5F + (float) Math.random() * 0.5F);
sync();
((WorldServer) supertile.getWorld()).spawnParticle(EnumParticleTypes.ITEM_CRACK, false, item.posX, item.posY, item.posZ, 20, 0.1D, 0.1D, 0.1D, 0.05D, Item.getIdFromItem(stack.getItem()), stack.getItemDamage());
}
if(!remote)
item.setDead();
item.setDead();
}
}
}
@@ -17,6 +17,7 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
@@ -24,6 +25,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidBase;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.signature.PassiveFlower;
@@ -62,7 +64,8 @@ public class SubTileHydroangeas extends SubTilePassiveGenerating {
BlockPos pos = supertile.getPos().add(offset);
Material search = getMaterialToSearchFor();
if(supertile.getWorld().getBlockState(pos).getBlock().getMaterial() == search && (getBlockToSearchBelow() == null || supertile.getWorld().getBlockState(pos.down()).getBlock() == getBlockToSearchBelow()) && supertile.getWorld().getBlockState(pos).getValue(BlockLiquid.LEVEL)/* todo 1.8 may crash */ == 0) {
PropertyInteger prop = supertile.getWorld().getBlockState(pos).getBlock() instanceof BlockLiquid ? BlockLiquid.LEVEL : supertile.getWorld().getBlockState(pos).getBlock() instanceof BlockFluidBase ? BlockFluidBase.LEVEL : null;
if(supertile.getWorld().getBlockState(pos).getBlock().getMaterial() == search && (getBlockToSearchBelow() == null || supertile.getWorld().getBlockState(pos.down()).getBlock() == getBlockToSearchBelow()) && (prop == null || supertile.getWorld().getBlockState(pos).getValue(prop) == 0)) {
if(search != Material.water)
supertile.getWorld().setBlockToAir(pos);
else {
@@ -66,7 +66,6 @@ public class SubTileRafflowsia extends SubTileGenerating {
float mod = 1F / lastFlowerTimes;
// todo 1.8 why is meta +1 'ed ?? int meta = supertile.getWorld().getBlockMetadata(x, y, z) + 1;
IBlockState state = supertile.getWorld().getBlockState(pos);
supertile.getWorld().setBlockToAir(pos);
@@ -68,7 +68,6 @@ public class SubTileSpectrolus extends SubTileGenerating {
float mx = (float) (Math.random() - 0.5) * m;
float my = (float) (Math.random() - 0.5) * m;
float mz = (float) (Math.random() - 0.5) * m;
// todo 1.8.8 verify. old: supertile.getWorld().spawnParticle("blockcrack_" + Item.getIdFromItem(stack.getItem()) + "_" + meta, item.posX, item.posY, item.posZ, mx, my, mz);
supertile.getWorld().spawnParticle(EnumParticleTypes.ITEM_CRACK, item.posX, item.posY, item.posZ, mx, my, mz, Item.getIdFromItem(stack.getItem()), stack.getItemDamage());
}
}
@@ -102,7 +102,7 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory, I
boolean didChange = false;
if(stack.getItem() instanceof IFlowerComponent) {
if(stack.getItem() instanceof IFlowerComponent && ((IFlowerComponent) stack.getItem()).canFit(stack, this)) {
if(getStackInSlot(getSizeInventory() - 1) != null)
return false;
@@ -227,10 +227,9 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory, I
@Override
public void updateEntity() {
List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos.add(0, 1D / 16D * 20D, 0), pos.add(1, 1D / 16D * 21D,1)));
List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos.add(0, 1D / 16D * 20D, 0), pos.add(1, 1D / 16D * 32D, 1)));
boolean didChange = false;
for(EntityItem item : items)
didChange = collideEntityItem(item) || didChange;
@@ -92,7 +92,10 @@ public class TileCraftCrate extends TileOpenCrate {
@Override
public void updateEntity() {
if(!worldObj.isRemote && (craft(true) && canEject() || isFull()))
if (worldObj.isRemote)
return;
if(craft(true) && canEject() || isFull())
ejectAll();
int newSignal = 0;
@@ -12,6 +12,7 @@ package vazkii.botania.common.block.tile;
import java.util.List;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
@@ -20,6 +21,7 @@ import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ITickable;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.WorldServer;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.item.equipment.tool.ToolCommons;
@@ -28,6 +30,9 @@ public class TileEnderEye extends TileMod {
@Override
public void updateEntity() {
if (worldObj.isRemote)
return;
boolean wasLooking = worldObj.getBlockState(getPos()).getValue(BotaniaStateProps.POWERED);
int range = 80;
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(pos.add(-range, -range, -range), pos.add(range, range, range)));
@@ -39,7 +44,7 @@ public class TileEnderEye extends TileMod {
continue;
MovingObjectPosition pos = ToolCommons.raytraceFromEntity(worldObj, player, true, 64);
if(pos != null && pos.getBlockPos().equals(getPos())) {
if(pos != null && pos.getBlockPos() != null && pos.getBlockPos().equals(getPos())) {
looking = true;
break;
}
@@ -52,8 +57,8 @@ public class TileEnderEye extends TileMod {
double x = getPos().getX() - 0.1 + Math.random() * 1.2;
double y = getPos().getY() - 0.1 + Math.random() * 1.2;
double z = getPos().getZ() - 0.1 + Math.random() * 1.2;
worldObj.spawnParticle(EnumParticleTypes.REDSTONE, x, y, z, 1, 0, 0);
((WorldServer) worldObj).spawnParticle(EnumParticleTypes.REDSTONE, false, x, y, z, 0, 1.0D, 0.0D, 0.0D, 1.0D);
}
}
@@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.decor.IFloatingFlower;
import vazkii.botania.api.item.IFloatingFlower;
public class TileFloatingFlower extends TileMod implements IFloatingFlower {
@@ -12,7 +12,7 @@ package vazkii.botania.common.block.tile;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import vazkii.botania.common.block.decor.IFloatingFlower;
import vazkii.botania.api.item.IFloatingFlower;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
public class TileFloatingSpecialFlower extends TileSpecialFlower implements IFloatingFlower {
@@ -54,11 +54,12 @@ public class TileFloatingSpecialFlower extends TileSpecialFlower implements IFlo
@Override
public int getSlowdownFactor() {
switch(getIslandType()) {
case MYCEL: return SLOWDOWN_FACTOR_MYCEL;
case PODZOL: return SLOWDOWN_FACTOR_PODZOL;
default: return 0;
}
IslandType type = getIslandType();
if (type == IslandType.MYCEL)
return SLOWDOWN_FACTOR_MYCEL;
else if (type == IslandType.PODZOL)
return SLOWDOWN_FACTOR_PODZOL;
return 0;
}
}
@@ -20,6 +20,8 @@ public class TileForestEye extends TileMod {
@Override
public void updateEntity() {
if (worldObj.isRemote)
return;
int range = 6;
int entityCount = worldObj.getEntitiesWithinAABB(EntityAnimal.class, new AxisAlignedBB(pos.add(-range, -range, -range), pos.add(range + 1, range + 1, range + 1))).size();
if(entityCount != entities) {
@@ -52,8 +52,10 @@ public class TileHourglass extends TileSimpleInventory {
time = 0;
flip = !flip;
flipTicks = 4;
worldObj.setBlockState(getPos(), worldObj.getBlockState(getPos()).withProperty(BotaniaStateProps.POWERED, true), 1 | 2);
worldObj.scheduleUpdate(pos, getBlockType(), getBlockType().tickRate(worldObj));
if (!worldObj.isRemote) {
worldObj.setBlockState(getPos(), worldObj.getBlockState(getPos()).withProperty(BotaniaStateProps.POWERED, true), 1 | 2);
worldObj.scheduleUpdate(pos, getBlockType(), getBlockType().tickRate(worldObj));
}
}
timeFraction = (float) time / (float) totalTime;
} else {
@@ -22,6 +22,7 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ITickable;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.common.registry.GameData;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.brew.Brew;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
@@ -52,8 +53,8 @@ public class TileIncensePlate extends TileSimpleInventory implements ISidedInven
if(!worldObj.isRemote) {
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(pos.getX() + 0.5 - RANGE, pos.getY() + 0.5 - RANGE, pos.getZ() + 0.5 - RANGE, pos.getX() + 0.5 + RANGE, pos.getY() + 0.5 + RANGE, pos.getZ() + 0.5 + RANGE));
for(EntityPlayer player : players) {
PotionEffect currentEffect = player.getActivePotionEffect(Potion.potionTypes[effect.getPotionID()]);
boolean nightVision = effect.getPotionID() == Potion.nightVision.id;
PotionEffect currentEffect = player.getActivePotionEffect(GameData.getPotionRegistry().getObjectById(effect.getPotionID()));
boolean nightVision = effect.getPotionID() == Potion.nightVision.getId();
if(currentEffect == null || currentEffect.getDuration() < (nightVision ? 205 : 3)) {
PotionEffect applyEffect = new PotionEffect(effect.getPotionID(), nightVision ? 285 : 80, effect.getAmplifier(), true, true);
player.addPotionEffect(applyEffect);
@@ -35,7 +35,7 @@ public class TileManaFlame extends TileMod {
public void updateEntity() {
float c = 0.3F;
if(Math.random() < c) {
if(worldObj.isRemote && Math.random() < c) {
float v = 0.1F;
float r = (float) (color >> 16 & 0xFF) / 0xFF + (float) (Math.random() - 0.5) * v;
@@ -64,10 +64,8 @@ public class TileMod extends TileEntity implements ITickable {
@Override
public final void update() {
if (worldObj.isBlockLoaded(getPos(), false)) {
if (!isInvalid() && worldObj.isBlockLoaded(getPos(), false)) {
updateEntity();
} else {
System.out.println("Skipping a tick because our chunk unloaded");
}
}
@@ -42,6 +42,9 @@ public class TileOpenCrate extends TileSimpleInventory {
@Override
public void updateEntity() {
if (worldObj.isRemote)
return;
boolean redstone = false;
for(EnumFacing dir : EnumFacing.VALUES) {
int redstoneSide = worldObj.getRedstonePower(pos.offset(dir), dir);
@@ -73,8 +76,7 @@ public class TileOpenCrate extends TileSimpleInventory {
ObfuscationReflectionHelper.setPrivateValue(EntityItem.class, item, -200, LibObfuscation.AGE);
setInventorySlotContents(0, null);
if(!worldObj.isRemote)
worldObj.spawnEntityInWorld(item);
worldObj.spawnEntityInWorld(item);
}
public boolean onWanded(EntityPlayer player, ItemStack stack) {
@@ -42,7 +42,7 @@ public class TilePylon extends TileEntity implements ITickable {
PylonVariant variant = worldObj.getBlockState(getPos()).getValue(BotaniaStateProps.PYLON_VARIANT);
if(activated && worldObj.isRemote) {
if(worldObj.getBlockState(centerPos).getBlock() != getBlockForMeta() || variant != PylonVariant.MANA && portalOff()) { // todo 1.8 clarify
if(worldObj.getBlockState(centerPos).getBlock() != getBlockForMeta() || variant != PylonVariant.MANA && portalOff()) {
activated = false;
return;
}
@@ -16,6 +16,9 @@ public class TileTeruTeruBozu extends TileMod {
@Override
public void updateEntity() {
if (worldObj.isRemote)
return;
boolean isRaining = worldObj.isRaining();
if(isRaining && worldObj.rand.nextInt(9600) == 0)
worldObj.getWorldInfo().setRaining(false);
@@ -19,6 +19,7 @@ import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.block.subtile.functional.SubTileExoflame;
import vazkii.botania.common.block.tile.TileMod;
@@ -115,9 +116,8 @@ public class TileBellows extends TileMod {
}
public TileEntity getLinkedTile() {
return null;
// EnumFacing side = ((EnumFacing) worldObj.getBlockState(getPos()).getValue(BotaniaStateProps.CARDINALS));
// return worldObj.getTileEntity(getPos().offset(side));
EnumFacing side = worldObj.getBlockState(getPos()).getValue(BotaniaStateProps.CARDINALS);
return worldObj.getTileEntity(getPos().offset(side));
}
@Override
@@ -31,7 +31,7 @@ public class TileDistributor extends TileMod implements IManaReceiver {
validPools.clear();
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS) {
TileEntity tileAt = worldObj.getTileEntity(pos.offset(dir));
if(tileAt != null && tileAt instanceof IManaPool) {
if(tileAt != null && tileAt instanceof IManaPool && !tileAt.isInvalid()) {
IManaReceiver receiver = (IManaReceiver) tileAt;
if(!receiver.isFull())
validPools.add(receiver);
@@ -25,16 +25,14 @@ public class TileManaDetector extends TileMod implements IManaCollisionGhost {
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
boolean state = worldObj.getBlockState(getPos()).getValue(BotaniaStateProps.POWERED);
boolean expectedState = worldObj.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)), Predicates.instanceOf(IManaBurst.class)).size() != 0;
if(state != expectedState)
worldObj.setBlockState(getPos(), worldObj.getBlockState(getPos()).withProperty(BotaniaStateProps.POWERED, expectedState), 1 | 2);
boolean state = worldObj.getBlockState(getPos()).getValue(BotaniaStateProps.POWERED);
boolean expectedState = worldObj.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)), Predicates.instanceOf(IManaBurst.class)).size() != 0;
if(state != expectedState && !worldObj.isRemote)
worldObj.setBlockState(getPos(), worldObj.getBlockState(getPos()).withProperty(BotaniaStateProps.POWERED, expectedState), 1 | 2);
if(expectedState)
for(int i = 0; i < 4; i++)
Botania.proxy.sparkleFX(getWorld(), pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 1F, 0.2F, 0.2F, 0.7F + 0.5F * (float) Math.random(), 5);
}
if(expectedState)
for(int i = 0; i < 4; i++)
Botania.proxy.sparkleFX(getWorld(), pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 1F, 0.2F, 0.2F, 0.7F + 0.5F * (float) Math.random(), 5);
}
@Override
@@ -181,7 +181,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
for(EnumFacing dir : EnumFacing.VALUES) {
TileEntity tileAt = worldObj.getTileEntity(pos.offset(dir));
if(tileAt instanceof IManaPool) {
if(worldObj.isBlockLoaded(pos.offset(dir), false) && tileAt instanceof IManaPool) {
IManaPool pool = (IManaPool) tileAt;
if(wasInNetwork && (pool != receiver || isRedstone())) {
if(pool instanceof IKeyLocked && !((IKeyLocked) pool).getOutputKey().equals(getInputKey()))
@@ -36,6 +36,9 @@ public class TileTurntable extends TileMod {
@Override
public void updateEntity() {
if (worldObj.isRemote)
return;
boolean redstone = false;
for(EnumFacing dir : EnumFacing.VALUES) {
@@ -10,13 +10,13 @@
*/
package vazkii.botania.common.brew;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.fml.common.registry.GameData;
public class BrewModPotion extends BrewMod {
public BrewModPotion(String key, int cost, PotionEffect... effects) {
super(key, Potion.potionTypes[effects[0].getPotionID()].getLiquidColor(), cost, effects);
super(key, GameData.getPotionRegistry().getObjectById(effects[0].getPotionID()).getLiquidColor(), cost, effects);
}
}
@@ -12,6 +12,7 @@ package vazkii.botania.common.brew;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.fml.common.registry.GameData;
import vazkii.botania.api.brew.Brew;
import vazkii.botania.common.lib.LibBrewNames;
@@ -67,7 +68,7 @@ public class ModBrews {
public static void initTC() {
Potion warpWardPotion = null;
for(Potion potion : Potion.potionTypes)
for(Potion potion : GameData.getPotionRegistry().typeSafeIterable())
if(potion != null && potion.getName().equals("potion.warpward")) {
warpWardPotion = potion;
break;
@@ -31,9 +31,6 @@ public class ModPotions {
public static Potion clear;
public static void init() {
if(Potion.potionTypes.length < 256)
extendPotionArray();
soulCross = new PotionSoulCross();
featherfeet = new PotionFeatherfeet();
emptiness = new PotionEmptiness();
@@ -42,27 +39,4 @@ public class ModPotions {
clear = new PotionClear();
}
private static void extendPotionArray() {
Potion[] potionTypes = null;
for (Field f : Potion.class.getDeclaredFields()) {
f.setAccessible(true);
try {
if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a")) {
Field modfield = Field.class.getDeclaredField("modifiers");
modfield.setAccessible(true);
modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL);
potionTypes = (Potion[])f.get(null);
final Potion[] newPotionTypes = new Potion[256];
System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length);
f.set(null, newPotionTypes);
}
} catch (Exception e) {
System.err.println("Severe error, please report this to the mod author:");
e.printStackTrace();
}
}
}
}
@@ -101,7 +101,7 @@ public final class ConfigHandler {
public static int mushroomQuantity = 40;
private static boolean verifiedPotionArray = false;
private static int potionArrayLimit = 0;
private static int potionArrayLimit = 0; // todo 1.8 potion things should be unneeded thanks to potion registry
public static int potionIDSoulCross = 91;
public static int potionIDFeatherfeet = 92;
@@ -282,12 +282,12 @@ public final class ConfigHandler {
desc = "The quantity of Botania mushrooms to generate underground, in the world, defaults to 40, the lower the number the less patches generate.";
mushroomQuantity = loadPropInt("worldgen.mushroom.quantity", desc, mushroomQuantity);
potionIDSoulCross = loadPropPotionId(LibPotionNames.SOUL_CROSS, potionIDSoulCross);
potionIDFeatherfeet = loadPropPotionId(LibPotionNames.FEATHER_FEET, potionIDFeatherfeet);
potionIDEmptiness = loadPropPotionId(LibPotionNames.EMPTINESS, potionIDEmptiness);
potionIDBloodthirst = loadPropPotionId(LibPotionNames.BLOODTHIRST, potionIDBloodthirst);
potionIDAllure = loadPropPotionId(LibPotionNames.ALLURE, potionIDAllure);
potionIDClear = loadPropPotionId(LibPotionNames.CLEAR, potionIDClear);
// potionIDSoulCross = loadPropPotionId(LibPotionNames.SOUL_CROSS, potionIDSoulCross); todo 1.8 should be unneeded thanks to potion registry
// potionIDFeatherfeet = loadPropPotionId(LibPotionNames.FEATHER_FEET, potionIDFeatherfeet);
// potionIDEmptiness = loadPropPotionId(LibPotionNames.EMPTINESS, potionIDEmptiness);
// potionIDBloodthirst = loadPropPotionId(LibPotionNames.BLOODTHIRST, potionIDBloodthirst);
// potionIDAllure = loadPropPotionId(LibPotionNames.ALLURE, potionIDAllure);
// potionIDClear = loadPropPotionId(LibPotionNames.CLEAR, potionIDClear);
if(config.hasChanged())
config.save();
@@ -94,6 +94,17 @@ public class CommonProxy {
ModPotions.init();
ModBrews.init();
ModAchievements.init();
ModMultiblocks.init();
ModBanners.init();
ChestGenHandler.init();
if(Botania.gardenOfGlassLoaded)
new WorldTypeSkyblock();
}
public void init(FMLInitializationEvent event) {
ModCraftingRecipes.init();
ModPetalRecipes.init();
ModPureDaisyRecipes.init();
@@ -103,19 +114,8 @@ public class CommonProxy {
ModManaInfusionRecipes.init();
ModElvenTradeRecipes.init();
ModBrewRecipes.init();
ModAchievements.init();
ModMultiblocks.init();
ModBanners.init();
ChestGenHandler.init();
LexiconData.init();
if(Botania.gardenOfGlassLoaded)
new WorldTypeSkyblock();
}
public void init(FMLInitializationEvent event) {
NetworkRegistry.INSTANCE.registerGuiHandler(Botania.instance, new GuiHandler());
MinecraftForge.TERRAIN_GEN_BUS.register(new BiomeDecorationHandler());
@@ -41,6 +41,8 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemRecord;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.pathfinding.PathNavigateGround;
import net.minecraft.pathfinding.PathNavigateSwimmer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntityBeacon;
@@ -49,6 +51,7 @@ import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.fml.common.registry.GameData;
import org.lwjgl.opengl.ARBShaderObjects;
import vazkii.botania.api.boss.IBotaniaBossWithShader;
@@ -117,7 +120,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
public EntityDoppleganger(World par1World) {
super(par1World);
setSize(0.6F, 1.8F);
//todo 1.8 new AI getNavigator().setCanSwim(true);
((PathNavigateGround) getNavigator()).setCanSwim(true);
tasks.addTask(0, new EntityAISwimming(this));
tasks.addTask(1, new EntityAIWatchClosest(this, EntityPlayer.class, Float.MAX_VALUE));
isImmuneToFire = true;
@@ -578,7 +581,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
List<PotionEffect> remove = new ArrayList();
Collection<PotionEffect> active = player.getActivePotionEffects();
for(PotionEffect effect : active)
if(effect.getDuration() < 200 && effect.getIsAmbient() && !ReflectionHelper.<Boolean, Potion>getPrivateValue(Potion.class, Potion.potionTypes[effect.getPotionID()], LibObfuscation.IS_BAD_EFFECT))
if(effect.getDuration() < 200 && effect.getIsAmbient() && !GameData.getPotionRegistry().getObjectById(effect.getPotionID()).isBadEffect())
remove.add(effect);
active.removeAll(remove);
@@ -181,10 +181,23 @@ public class EntityMagicMissile extends EntityThrowable {
@Override
protected void onImpact(MovingObjectPosition pos) {
Block block = worldObj.getBlockState(pos.getBlockPos()).getBlock();
if(!(block instanceof BlockBush) && !(block instanceof BlockLeaves) && (pos.entityHit == null || getTargetEntity() == pos.entityHit))
setDead();
switch (pos.typeOfHit) {
case BLOCK: {
Block block = worldObj.getBlockState(pos.getBlockPos()).getBlock();
if(!(block instanceof BlockBush) && !(block instanceof BlockLeaves))
setDead();
break;
}
case ENTITY: {
if (pos.entityHit == getTargetEntity())
setDead();
break;
}
default: {
setDead();
break;
}
}
}
}
@@ -12,16 +12,40 @@ package vazkii.botania.common.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.ai.EntityAIArrowAttack;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAITasks;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import java.util.Iterator;
public class EntityPinkWither extends EntityWither {
public EntityPinkWither(World p_i1701_1_) {
super(p_i1701_1_);
Iterator<EntityAITasks.EntityAITaskEntry> taskIter = this.tasks.taskEntries.iterator();
while (taskIter.hasNext()) {
EntityAITasks.EntityAITaskEntry entry = taskIter.next();
if (entry.action instanceof EntityAIArrowAttack) {
taskIter.remove(); // Remove firing wither skulls
}
}
Iterator<EntityAITasks.EntityAITaskEntry> targetTaskIter = this.targetTasks.taskEntries.iterator();
while (targetTaskIter.hasNext()) {
EntityAITasks.EntityAITaskEntry entry = targetTaskIter.next();
if (entry.action instanceof EntityAIHurtByTarget
|| entry.action instanceof EntityAINearestAttackableTarget) {
targetTaskIter.remove(); // Remove revenge and aggro
}
}
}
@Override
@@ -42,11 +66,6 @@ public class EntityPinkWither extends EntityWither {
// NO-OP
}
// @Override todo 1.8 mtd no longer exists?
// protected void attackEntity(Entity p_70785_1_, float p_70785_2_) {
// // NO-OP
// }
@Override
public boolean attackEntityAsMob(Entity p_70652_1_) {
return false;
@@ -61,11 +80,6 @@ public class EntityPinkWither extends EntityWither {
return false;
}
// @Override todo 1.8 new AI
// protected boolean isAIEnabled() {
// return false;
// }
@Override
protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) {
// NO-OP
@@ -60,39 +60,39 @@ public class EntityPixie extends EntityFlyingCreature {
this.effect = effect;
}
// @Override todo 1.8 uh oh ... we can't override this anymore
// protected void updateEntityActionState() {
// EntityLivingBase target = getAttackTarget();
// if(target != null) {
// double d0 = target.posX + target.width / 2 - posX;
// double d1 = target.posY + target.height / 2 - posY;
// double d2 = target.posZ + target.width / 2 - posZ;
// double d3 = d0 * d0 + d1 * d1 + d2 * d2;
//
// float mod = 0.45F;
// if(getType() == 1)
// mod = 0.1F;
//
// motionX += d0 / d3 * mod;
// motionY += d1 / d3 * mod;
// motionZ += d2 / d3 * mod;
//
// if(Math.sqrt(d3) < 1F) {
// if(summoner != null) {
// if(summoner instanceof EntityPlayer)
// target.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) summoner), damage);
// else {
// target.attackEntityFrom(DamageSource.causeMobDamage(summoner), damage);
// }
// } else target.attackEntityFrom(DamageSource.causeMobDamage(this), damage);
// if(effect != null && !(target instanceof EntityPlayer))
// target.addPotionEffect(effect);
// die();
// }
// }
//
// renderYawOffset = rotationYaw = -((float)Math.atan2(motionX, motionZ)) * 180.0F / (float)Math.PI;
// }
@Override
protected void updateAITasks() {
EntityLivingBase target = getAttackTarget();
if(target != null) {
double d0 = target.posX + target.width / 2 - posX;
double d1 = target.posY + target.height / 2 - posY;
double d2 = target.posZ + target.width / 2 - posZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
float mod = 0.45F;
if(getType() == 1)
mod = 0.1F;
motionX += d0 / d3 * mod;
motionY += d1 / d3 * mod;
motionZ += d2 / d3 * mod;
if(Math.sqrt(d3) < 1F) {
if(summoner != null) {
if(summoner instanceof EntityPlayer)
target.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) summoner), damage);
else {
target.attackEntityFrom(DamageSource.causeMobDamage(summoner), damage);
}
} else target.attackEntityFrom(DamageSource.causeMobDamage(this), damage);
if(effect != null && !(target instanceof EntityPlayer))
target.addPotionEffect(effect);
die();
}
}
renderYawOffset = rotationYaw = -((float)Math.atan2(motionX, motionZ)) * 180.0F / (float)Math.PI;
}
@Override
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) {
@@ -111,10 +111,12 @@ public class EntityThornChakram extends EntityThrowable {
if(noClip)
return;
Block block = worldObj.getBlockState(pos.getBlockPos()).getBlock();
worldObj.getTileEntity(pos.getBlockPos());
if(block instanceof BlockBush || block instanceof BlockLeaves)
return;
if (pos.getBlockPos() != null) {
Block block = worldObj.getBlockState(pos.getBlockPos()).getBlock();
worldObj.getTileEntity(pos.getBlockPos());
if(block instanceof BlockBush || block instanceof BlockLeaves)
return;
}
boolean fire = isFire();
EntityLivingBase thrower = getThrower();
@@ -3,10 +3,13 @@ package vazkii.botania.common.integration.buildcraft;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import buildcraft.api.statements.IStatement;
import buildcraft.api.statements.IStatementParameter;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public abstract class StatementBase implements IStatement {
@Override
@SideOnly(Side.CLIENT)
public abstract TextureAtlasSprite getGuiSprite();
@Override
@@ -6,6 +6,8 @@ import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.common.Botania;
@@ -17,6 +19,7 @@ import buildcraft.api.statements.ITriggerInternal;
public class TriggerManaDetector extends StatementBase implements ITriggerInternal {
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getGuiSprite() {
return MiscellaneousIcons.INSTANCE.manaDetectorIcon;
}
@@ -5,6 +5,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.text.WordUtils;
import vazkii.botania.api.mana.IManaBlock;
@@ -35,6 +37,7 @@ public class TriggerManaLevel extends StatementBase implements ITriggerExternal
}
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getGuiSprite() {
return MiscellaneousIcons.INSTANCE.manaLevelTriggerIcons.get(state);
}
@@ -4,6 +4,8 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.common.block.tile.TileRuneAltar;
import vazkii.botania.common.lib.LibTriggerNames;
@@ -19,6 +21,7 @@ public class TriggerRuneAltarCanCraft extends StatementBase implements ITriggerE
}
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getGuiSprite() {
return MiscellaneousIcons.INSTANCE.runeAltarTriggerIcon;
}
@@ -0,0 +1,18 @@
/**
* This class was created by <WireSegal>. 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 13, 2016, 6:02:31 PM (GMT)]
*/
package vazkii.botania.common.item;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.item.IFloatingFlower.IslandType;
public interface IFloatingFlowerVariant {
public IslandType getIslandType(ItemStack stack);
}
@@ -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
*
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
*
* File Created @ [Sep 23, 2015, 11:40:51 PM (GMT)]
*/
package vazkii.botania.common.item;
@@ -31,9 +31,7 @@ public class ItemGaiaHead extends ItemMod {
setUnlocalizedName(LibItemNames.GAIA_HEAD);
}
// Copypasta from ItemSkull and I'm not even going to bother to clean it up
//
// Deal with it.
// Copied from vanila skull itemBlock. Relevant edits are indicated.
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
@@ -123,6 +121,7 @@ public class ItemGaiaHead extends ItemMod {
return true;
}
}
}
@@ -51,8 +51,6 @@ public class ItemGrassHorn extends ItemMod {
list.add(new ItemStack(item, 1, i));
}
// todo 1.8 return par1ItemStack.getDisplayName().toLowerCase().contains("vuvuzela") ? vuvuzelaIcon : super.getIconIndex(par1ItemStack);
@Override
public String getUnlocalizedName(ItemStack par1ItemStack) {
return getUnlocalizedNameLazy(par1ItemStack) + par1ItemStack.getItemDamage();
@@ -12,6 +12,7 @@ package vazkii.botania.common.item;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
@@ -32,13 +33,13 @@ import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.AltGrassVariant;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.decor.IFloatingFlower.IslandType;
import vazkii.botania.api.item.IFloatingFlower.IslandType;
import vazkii.botania.common.lib.LibItemNames;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
public class ItemGrassSeeds extends ItemMod {
public class ItemGrassSeeds extends ItemMod implements IFloatingFlowerVariant {
private static Map<Integer, List<BlockSwapper>> blockSwappers = new HashMap();
@@ -153,10 +154,14 @@ public class ItemGrassSeeds extends ItemMod {
int dim = event.world.provider.getDimensionId();
if(blockSwappers.containsKey(dim)) {
List<BlockSwapper> swappers = blockSwappers.get(dim);
List<BlockSwapper> swappersSafe = new ArrayList(swappers);
for(BlockSwapper s : swappersSafe)
s.tick(swappers);
Iterator<BlockSwapper> iter = swappers.listIterator();
while(iter.hasNext()) {
BlockSwapper next = iter.next();
if(!next.tick())
iter.remove();
}
}
}
}
@@ -186,58 +191,128 @@ public class ItemGrassSeeds extends ItemMod {
}
}
/**
* A block swapper for the Pasture Seeds, which swaps dirt and grass blocks
* centered around a provided point to a provided block/metadata.
*/
private static class BlockSwapper {
/**
* The range of the block swapper, in blocks.
*/
public static final int RANGE = 3;
final World world;
final Random rand;
final IBlockState stateToSet;
BlockPos startCoords;
int ticksExisted = 0;
/**
* The range around which a block can spread in a single tick.
*/
public static final int TICK_RANGE = 1;
BlockSwapper(World world, BlockPos coords, IBlockState state) {
private final World world;
private final Random rand;
private final IBlockState stateToSet;
private BlockPos startCoords;
private int ticksExisted = 0;
/**
* Constructs a new block swapper with the provided world, starting
* coordinates, target block, and target metadata.
* @param world The world to swap blocks in.
* @param coords The central coordinates to swap blocks around.
* @param state The target blockstate to swap dirt and grass to.
*/
public BlockSwapper(World world, BlockPos coords, IBlockState state) {
this.world = world;
stateToSet = state;
rand = new Random(coords.hashCode());
startCoords = coords;
this.stateToSet = state;
this.rand = new Random(coords.hashCode());
this.startCoords = coords;
}
void tick(List<BlockSwapper> list) {
/**
* Ticks this block swapper, allowing it to make an action during
* this game tick. This method should return "false" when the swapper
* has finished operation and should be removed from the world.
* @return true if the swapper should continue to exist, false if it
* should be removed.
*/
public boolean tick() {
++ticksExisted;
int range = 3;
for(int i = -range; i < range + 1; i++)
for(int j = -range; j < range + 1; j++) {
// Go through all blocks in the specified RANGE, and then
// try and spread around that block if it is our target block already
for(int i = -RANGE; i <= RANGE; i++) {
for(int j = -RANGE; j <= RANGE; j++) {
BlockPos pos = startCoords.add(i, 0, j);
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();
if(state == stateToSet) {
if(ticksExisted % 20 == 0) {
List<BlockPos> validCoords = new ArrayList();
for(int k = -1; k < 2; k++)
for(int l = -1; l < 2; l++) {
BlockPos pos1 = pos.add(k, 0, l);
IBlockState state1 = world.getBlockState(pos1);
if((state1.getBlock() == Blocks.dirt
&& state1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT)
|| state1.getBlock() == Blocks.grass)
validCoords.add(pos1);
}
// Only make changes every 20 ticks
if(ticksExisted % 20 != 0) continue;
if(!validCoords.isEmpty() && !world.isRemote) {
BlockPos coords = validCoords.get(rand.nextInt(validCoords.size()));
world.setBlockState(coords, stateToSet, 1 | 2);
}
}
tickBlock(pos);
}
}
}
if(ticksExisted >= 80)
list.remove(this);
// This swapper should exist for 80 ticks
return ticksExisted < 80;
}
/**
* Tick a specific block position, finding the valid blocks
* immediately adjacent to it and then replacing one at random.
* @param pos The positions to use.
*/
public void tickBlock(BlockPos pos) {
List<BlockPos> validCoords = new ArrayList<BlockPos>();
// Go around this block and aggregate valid blocks.
for(int xOffset = -TICK_RANGE; xOffset <= TICK_RANGE; xOffset++) {
for(int zOffset = -TICK_RANGE; zOffset <= TICK_RANGE; zOffset++) {
// Skip the current block
if(xOffset == 0 && zOffset == 0) continue;
if(isValidSwapPosition(pos.add(xOffset, 0, zOffset)))
validCoords.add(pos.add(xOffset, 0, zOffset));
}
}
// If we can make changes, and have at least 1 block to swap,
// then swap a random block from the valid blocks we could swap.
if(!validCoords.isEmpty() && !world.isRemote) {
BlockPos toSwap = validCoords.get(rand.nextInt(validCoords.size()));
world.setBlockState(toSwap, stateToSet, 1 | 2);
}
}
/**
* Determines if a given position is a valid location to spread to, which
* means that the block must be either dirt or grass (with meta 0),
* and have a block above it which does not block grass growth.
* @param pos The position to check.
* @return True if the position is valid to swap, false otherwise.
*/
public boolean isValidSwapPosition(BlockPos pos) {
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();
Block aboveBlock = world.getBlockState(pos.up()).getBlock();
// Valid blocks to spread to are either dirt or grass, and do not
// have blocks which block grass growth.
// See http://minecraft.gamepedia.com/Grass_Block
// The major rule is that a block which reduces light
// levels by 2 or more blocks grass growth.
return (block == Blocks.dirt || block == Blocks.grass)
&& (block != Blocks.dirt || state.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT)
&& (aboveBlock.getLightOpacity(world, pos.up()) <= 1);
}
}
public static IslandType getIslandType(ItemStack stack) {
public IslandType getIslandType(ItemStack stack) {
return ISLAND_TYPES[Math.min(stack.getItemDamage(), ISLAND_TYPES.length - 1)];
}
@@ -18,12 +18,14 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameData;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.mana.BurstProperties;
import vazkii.botania.api.mana.ILaputaImmobile;
@@ -38,6 +40,7 @@ import vazkii.botania.common.lib.LibItemNames;
public class ItemLaputaShard extends ItemMod implements ILensEffect, ITinyPlanetExcempt {
private static final String TAG_BLOCK = "_block";
private static final String TAG_BLOCK_NAME = "_blockname";
private static final String TAG_META = "_meta";
private static final String TAG_TILE = "_tile";
private static final String TAG_X = "_x";
@@ -72,7 +75,7 @@ public class ItemLaputaShard extends ItemMod implements ILensEffect, ITinyPlanet
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, BlockPos pos, EnumFacing side, float par8, float par9, float par10) {
if(pos.getY() < 160 && !par3World.provider.doesWaterVaporize()) {
if(!par3World.isRemote && pos.getY() < 160 && !par3World.provider.doesWaterVaporize()) {
par3World.playSound(pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, "botania:laputaStart", 1.0F + par3World.rand.nextFloat(), par3World.rand.nextFloat() * 0.7F + 1.3F, false);
spawnBurstFirst(par3World, pos, par1ItemStack);
par1ItemStack.stackSize--;
@@ -130,7 +133,7 @@ public class ItemLaputaShard extends ItemMod implements ILensEffect, ITinyPlanet
world.playAuxSFX(2001, pos_, Block.getStateId(state));
ItemStack copyLens = new ItemStack(this, 1, lens.getItemDamage());
ItemNBTHelper.setInt(copyLens, TAG_BLOCK, id);
ItemNBTHelper.setString(copyLens, TAG_BLOCK_NAME, GameData.getBlockRegistry().getNameForObject(block).toString());
ItemNBTHelper.setInt(copyLens, TAG_META, block.getMetaFromState(state));
NBTTagCompound cmp = new NBTTagCompound();
if(tile != null)
@@ -224,8 +227,15 @@ public class ItemLaputaShard extends ItemMod implements ILensEffect, ITinyPlanet
BlockPos pos = new BlockPos(x, y, z);
if(entity.worldObj.isAirBlock(pos)) {
int id = ItemNBTHelper.getInt(lens, TAG_BLOCK, 0);
Block block = Block.getBlockById(id);
Block block = Blocks.air;
if (lens.hasTagCompound()) {
if (lens.getTagCompound().hasKey(TAG_BLOCK_NAME)) {
block = Block.getBlockFromName(ItemNBTHelper.getString(lens, TAG_BLOCK_NAME, ""));
} else if (lens.getTagCompound().hasKey(TAG_BLOCK)) {
// Attempt to read legacy tag (integer ID) if string block ID is absent
block = Block.getBlockById(ItemNBTHelper.getInt(lens, TAG_BLOCK, 0));
}
}
int meta = ItemNBTHelper.getInt(lens, TAG_META, 0);
TileEntity tile = null;
@@ -250,8 +260,8 @@ public class ItemLaputaShard extends ItemMod implements ILensEffect, ITinyPlanet
public boolean doParticles(IManaBurst burst, ItemStack stack) {
EntityThrowable entity = (EntityThrowable) burst;
ItemStack lens = burst.getSourceLens();
int id = ItemNBTHelper.getInt(lens, TAG_BLOCK, 0);
Block b = Block.getBlockById(id);
String id = ItemNBTHelper.getString(lens, TAG_BLOCK_NAME, "minecraft:air");
Block b = Block.getBlockFromName(id);
int meta = ItemNBTHelper.getInt(lens, TAG_META, 0);
entity.worldObj.spawnParticle(EnumParticleTypes.BLOCK_CRACK, entity.posX, entity.posY, entity.posZ, entity.motionX, entity.motionY, entity.motionZ, Block.getStateId(b.getStateFromMeta(meta)));
@@ -48,6 +48,4 @@ public class ItemManaCookie extends ItemFood {
return super.getUnlocalizedNameInefficiently(par1ItemStack).replaceAll("item.", "item." + LibResources.PREFIX_MOD);
}
// todo 1.8 return stack.getDisplayName().toLowerCase().equals("totalbiscuit") ? totalBiscuitIcon : super.getIconIndex(stack);
}
@@ -100,7 +100,7 @@ public class ItemSextant extends ItemMod {
if(!par3EntityPlayer.isSneaking()) {
MovingObjectPosition pos = ToolCommons.raytraceFromEntity(par2World, par3EntityPlayer, false, 128);
if(pos != null && pos.entityHit == null) {
if(pos != null && pos.entityHit == null && pos.getBlockPos() != null) {
if(!par2World.isRemote) {
ItemNBTHelper.setInt(par1ItemStack, TAG_SOURCE_X, pos.getBlockPos().getX());
ItemNBTHelper.setInt(par1ItemStack, TAG_SOURCE_Y, pos.getBlockPos().getY());
@@ -171,11 +171,10 @@ public class ItemSextant extends ItemMod {
@Override
public Map<EnumFacing, Multiblock> createRotations() {
Map<EnumFacing, Multiblock> ret = new EnumMap<>(EnumFacing.class);
for (EnumFacing e : EnumFacing.HORIZONTALS) {
for (EnumFacing e : EnumFacing.VALUES) {
ret.put(e, this);
}
return ret;
// return new Multiblock[] { this }; todo 1.8 verify, this was only the first direction
}
}
@@ -19,8 +19,6 @@ import vazkii.botania.common.lib.LibItemNames;
public class ItemSlimeBottle extends ItemMod {
// todo 1.8 smart model?
public ItemSlimeBottle() {
setUnlocalizedName(LibItemNames.SLIME_BOTTLE);
setMaxStackSize(1);
@@ -25,6 +25,7 @@ import net.minecraft.stats.Achievement;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameData;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.brew.Brew;
import vazkii.botania.api.brew.IBrewItem;
@@ -78,7 +79,7 @@ public abstract class ItemBrewBase extends ItemMod implements IBrewItem, IPickup
if(!world.isRemote) {
for(PotionEffect effect : getBrew(stack).getPotionEffects(stack)) {
PotionEffect newEffect = new PotionEffect(effect.getPotionID(), effect.getDuration(), effect.getAmplifier(), true, true);
Potion potion = Potion.potionTypes[newEffect.getPotionID()];
Potion potion = GameData.getPotionRegistry().getObjectById(effect.getPotionID());
if(potion.isInstant())
potion.affectEntity(player, player, player, newEffect.getAmplifier(), 1F);
else player.addPotionEffect(newEffect);
@@ -137,7 +138,7 @@ public abstract class ItemBrewBase extends ItemMod implements IBrewItem, IPickup
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean adv) {
Brew brew = getBrew(stack);
for(PotionEffect effect : brew.getPotionEffects(stack)) {
Potion potion = Potion.potionTypes[effect.getPotionID()];
Potion potion = GameData.getPotionRegistry().getObjectById(effect.getPotionID());
EnumChatFormatting format = potion.isBadEffect() ? EnumChatFormatting.RED : EnumChatFormatting.GRAY;
list.add(format + StatCollector.translateToLocal(effect.getEffectName()) + (effect.getAmplifier() == 0 ? "" : " " + StatCollector.translateToLocal("botania.roman" + (effect.getAmplifier() + 1))) + EnumChatFormatting.GRAY + (potion.isInstant() ? "" : " (" + Potion.getDurationString(effect) + ")"));
}
@@ -21,6 +21,7 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fml.common.registry.GameData;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.brew.Brew;
import vazkii.botania.api.brew.IBrewContainer;
@@ -79,7 +80,7 @@ public class ItemIncenseStick extends ItemMod implements IBrewItem, IBrewContain
addStringToTooltip(EnumChatFormatting.LIGHT_PURPLE + String.format(StatCollector.translateToLocal("botaniamisc.brewOf"), StatCollector.translateToLocal(brew.getUnlocalizedName(stack))), list);
for(PotionEffect effect : brew.getPotionEffects(stack)) {
Potion potion = Potion.potionTypes[effect.getPotionID()];
Potion potion = GameData.getPotionRegistry().getObjectById(effect.getPotionID());
EnumChatFormatting format = potion.isBadEffect() ? EnumChatFormatting.RED : EnumChatFormatting.GRAY;
PotionEffect longEffect = new PotionEffect(effect.getPotionID(), effect.getDuration() * TIME_MULTIPLIER, effect.getAmplifier(), false, true);
addStringToTooltip(" " + format + StatCollector.translateToLocal(effect.getEffectName()) + (effect.getAmplifier() == 0 ? "" : " " + StatCollector.translateToLocal("botania.roman" + (effect.getAmplifier() + 1))) + EnumChatFormatting.GRAY + (potion.isInstant() ? "" : " (" + Potion.getDurationString(longEffect) + ")"), list);
@@ -106,7 +107,7 @@ public class ItemIncenseStick extends ItemMod implements IBrewItem, IBrewContain
@Override
public ItemStack getItemForBrew(Brew brew, ItemStack stack) {
if(!brew.canInfuseIncense() || brew.getPotionEffects(stack).size() != 1 || Potion.potionTypes[brew.getPotionEffects(stack).get(0).getPotionID()].isInstant())
if(!brew.canInfuseIncense() || brew.getPotionEffects(stack).size() != 1 || GameData.getPotionRegistry().getObjectById(brew.getPotionEffects(stack).get(0).getPotionID()).isInstant())
return null;
ItemStack brewStack = new ItemStack(this);
@@ -12,7 +12,10 @@ package vazkii.botania.common.item.equipment.armor.terrasteel;
import java.util.List;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -20,15 +23,14 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import vazkii.botania.api.item.IAncientWillContainer;
import vazkii.botania.api.item.IBaubleRender;
import vazkii.botania.api.mana.IManaDiscountArmor;
import vazkii.botania.api.mana.IManaGivingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.lib.LibItemNames;
@@ -39,23 +41,15 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemTerrasteelHelm extends ItemTerrasteelArmor implements IManaDiscountArmor, IAncientWillContainer, IManaGivingItem {
private static final String TAG_ANCIENT_WILL = "AncientWill";
static TextureAtlasSprite willIcon;
public ItemTerrasteelHelm() {
this(LibItemNames.TERRASTEEL_HELM);
MinecraftForge.EVENT_BUS.register(this);
}
public ItemTerrasteelHelm(String name) {
super(0, name);
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onTextureStitch(TextureStitchEvent evt) {
willIcon = IconHelper.forName(evt.map, "willFlame", "items");
}
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
super.onArmorTick(world, player, stack);
@@ -104,24 +98,22 @@ public class ItemTerrasteelHelm extends ItemTerrasteelArmor implements IManaDisc
}
@SideOnly(Side.CLIENT)
public static void renderOnPlayer(ItemStack stack, RenderPlayerEvent event) {
/*
public static void renderOnPlayer(ItemStack stack, EntityPlayer player) {
if(hasAnyWill(stack) && !((ItemTerrasteelArmor) stack.getItem()).hasPhantomInk(stack)) {
GlStateManager.pushMatrix();
float f = willIcon.getMinU();
float f1 = willIcon.getMaxU();
float f2 = willIcon.getMinV();
float f3 = willIcon.getMaxV();
Helper.translateToHeadLevel(event.entityPlayer);
float f = MiscellaneousIcons.INSTANCE.terrasteelHelmWillIcon.getMinU();
float f1 = MiscellaneousIcons.INSTANCE.terrasteelHelmWillIcon.getMaxU();
float f2 = MiscellaneousIcons.INSTANCE.terrasteelHelmWillIcon.getMinV();
float f3 = MiscellaneousIcons.INSTANCE.terrasteelHelmWillIcon.getMaxV();
IBaubleRender.Helper.translateToHeadLevel(player);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.translate(-0.26F, 0.15F, -0.39F);
GlStateManager.translate(-0.26F, -1.45F, -0.39F);
GlStateManager.scale(0.5F, 0.5F, 0.5F);
IconHelper.renderItemIn2D(Tessellator.getInstance(), f1, f2, f, f3, willIcon.getIconWidth(), willIcon.getIconHeight(), 1F / 16F);
IconHelper.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, MiscellaneousIcons.INSTANCE.terrasteelHelmWillIcon.getIconWidth(), MiscellaneousIcons.INSTANCE.terrasteelHelmWillIcon.getIconHeight(), 1F / 16F);
GlStateManager.popMatrix();
}
*/
}
@SubscribeEvent
@@ -14,13 +14,13 @@ import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.RecipeSorter.Category;
@@ -70,10 +70,10 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
}
@Override
public void onPlayerBaubleRender(ItemStack stack, RenderPlayerEvent event, RenderType type) {
public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
if(type == RenderType.HEAD) {
Helper.translateToHeadLevel(event.entityPlayer);
Helper.translateToHeadLevel(player);
switch(stack.getItemDamage()) {
case 2:
faceTranslate();
@@ -196,7 +196,7 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
break;
case 26:
faceTranslate();
GlStateManager.translate(-0.1F, -0.5F, 0F);
GlStateManager.translate(-0.1F, -0.4F, 0F);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color(1F, 1F, 1F, 0.7F);
@@ -205,7 +205,7 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
case 27:
faceTranslate();
scale(0.75F);
GlStateManager.translate(0.04F, -0.5F, 0F);
GlStateManager.translate(0.04F, -0.65F, 0F);
renderIcon(27);
break;
case 28:
@@ -231,37 +231,32 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
break;
}
} else {
Helper.rotateIfSneaking(event.entityPlayer);
Helper.rotateIfSneaking(player);
switch(stack.getItemDamage()) {
case 0:
chestTranslate();
scale(0.5F);
GlStateManager.translate(0.5F, 0.7F, 0F);
renderIcon(0);
break;
case 1:
chestTranslate();
scale(0.75F);
GlStateManager.translate(0.15F, -0.1F, 0F);
GlStateManager.translate(0F, 0F, 0.2F);
renderIcon(1);
break;
case 3:
chestTranslate();
scale(0.6F);
GlStateManager.translate(0.35F, 0.3F, 0F);
GlStateManager.translate(0F, 0F, 0.15F);
renderIcon(3);
break;
case 12:
chestTranslate();
scale(0.225F);
GlStateManager.translate(1.2F, 1.9F, 0F);
GlStateManager.translate(-0.725F, 0.45F, -0.6F);
renderIcon(12);
break;
case 13:
chestTranslate();
GlStateManager.rotate(-90F, 0F, 1F, 0F);
scale(0.5F);
GlStateManager.translate(-1.3F, -0.4F, -1F);
GlStateManager.rotate(-90F, 0F, 0F, 1F);
GlStateManager.translate(0.33F, -0.15F, 0.55F);
renderIcon(13);
break;
case 14:
@@ -278,20 +273,19 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
case 16:
chestTranslate();
scale(0.225F);
GlStateManager.translate(2.3F, 1.9F, 0F);
GlStateManager.translate(0.725F, 0.45F, -0.6F);
renderIcon(16);
break;
case 21:
chestTranslate();
scale(0.3F);
GlStateManager.translate(1.2F, 0.5F, 0F);
scale(0.5F);
GlStateManager.translate(0F, 0.15F, 0.32F);
renderIcon(21);
break;
case 29:
chestTranslate();
scale(0.8F);
GlStateManager.translate(0.2F, -0.2F, -0.35F);
GlStateManager.rotate(10F, 0F, 0F, 1F);
GlStateManager.translate(0.05F, -0.25F, 0.25F);
GlStateManager.rotate(8F, 0F, 1F, 0F);
renderIcon(29);
break;
}
@@ -305,8 +299,8 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
}
public void chestTranslate() {
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.translate(-0.5F, -0.7F, 0.15F);
GlStateManager.translate(0F, 0.5F, 0F);
GlStateManager.rotate(-90F, 1F, 0F, 0F);
}
public void scale(float f) {
@@ -314,13 +308,7 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
}
public void renderIcon(int i) {
/*
IIcon icon = icons[i];
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
ItemRenderer.renderItemIn2D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
*/
ItemStack stack = new ItemStack(this, 1, i);
Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.THIRD_PERSON);
}
}
@@ -16,6 +16,8 @@ import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
@@ -26,8 +28,9 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry;
import net.minecraftforge.fml.common.registry.GameData;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
@@ -38,6 +41,8 @@ import vazkii.botania.api.item.IBaubleRender;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.lib.LibItemNames;
import baubles.api.BaubleType;
@@ -92,7 +97,7 @@ public class ItemBloodPendant extends ItemBauble implements IBrewContainer, IBre
addStringToTooltip(EnumChatFormatting.LIGHT_PURPLE + String.format(StatCollector.translateToLocal("botaniamisc.brewOf"), StatCollector.translateToLocal(brew.getUnlocalizedName(stack))), list);
for(PotionEffect effect : brew.getPotionEffects(stack)) {
Potion potion = Potion.potionTypes[effect.getPotionID()];
Potion potion = GameData.getPotionRegistry().getObjectById(effect.getPotionID());
EnumChatFormatting format = potion.isBadEffect() ? EnumChatFormatting.RED : EnumChatFormatting.GRAY;
addStringToTooltip(" " + format + StatCollector.translateToLocal(effect.getEffectName()) + (effect.getAmplifier() == 0 ? "" : " " + StatCollector.translateToLocal("botania.roman" + (effect.getAmplifier() + 1))), list);
}
@@ -112,7 +117,7 @@ public class ItemBloodPendant extends ItemBauble implements IBrewContainer, IBre
float cost = (float) brew.getManaCost(stack) / effect.getDuration() / (1 + effect.getAmplifier()) * 2.5F;
boolean doRand = cost < 1;
if(ManaItemHandler.requestManaExact(stack, eplayer, (int) Math.ceil(cost), false)) {
PotionEffect currentEffect = player.getActivePotionEffect(Potion.potionTypes[effect.getPotionID()]);
PotionEffect currentEffect = player.getActivePotionEffect(GameData.getPotionRegistry().getObjectById(effect.getPotionID()));
boolean nightVision = effect.getPotionID() == Potion.nightVision.id;
if(currentEffect == null || currentEffect.getDuration() < (nightVision ? 205 : 3)) {
PotionEffect applyEffect = new PotionEffect(effect.getPotionID(), nightVision ? 285 : 80, effect.getAmplifier(), true, true);
@@ -141,7 +146,8 @@ public class ItemBloodPendant extends ItemBauble implements IBrewContainer, IBre
@Override
public ItemStack getItemForBrew(Brew brew, ItemStack stack) {
if(!brew.canInfuseBloodPendant() || brew.getPotionEffects(stack).size() != 1 || Potion.potionTypes[brew.getPotionEffects(stack).get(0).getPotionID()].isInstant())
FMLControlledNamespacedRegistry<Potion> potionRegistry = GameData.getPotionRegistry();
if(!brew.canInfuseBloodPendant() || brew.getPotionEffects(stack).size() != 1 || potionRegistry.getObjectById(brew.getPotionEffects(stack).get(0).getPotionID()).isInstant())
return null;
ItemStack brewStack = new ItemStack(this);
@@ -160,22 +166,21 @@ public class ItemBloodPendant extends ItemBauble implements IBrewContainer, IBre
}
@Override
public void onPlayerBaubleRender(ItemStack stack, RenderPlayerEvent event, RenderType type) {
public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks) {
if(type == RenderType.BODY) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
Helper.rotateIfSneaking(event.entityPlayer);
boolean armor = event.entityPlayer.getCurrentArmor(2) != null;
Helper.rotateIfSneaking(player);
boolean armor = player.getCurrentArmor(2) != null;
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.translate(-0.26F, -0.4F, armor ? 0.2F : 0.15F);
GlStateManager.scale(0.5F, 0.5F, 0.5F);
for(int i = 2; i < 4; i++) {
/*IIcon icon = icons[i];
for(TextureAtlasSprite icon : new TextureAtlasSprite[] { MiscellaneousIcons.INSTANCE.bloodPendantChain, MiscellaneousIcons.INSTANCE.bloodPendantGem }) {
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
ItemRenderer.renderItemIn2D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 32F);*/
IconHelper.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 32F);
Color color = new Color(getColorFromItemStack(stack, 1));
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
@@ -13,6 +13,10 @@ package vazkii.botania.common.item.equipment.bauble;
import java.util.List;
import com.google.common.base.Predicates;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.monster.EntityCreeper;
@@ -20,7 +24,6 @@ import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
@@ -92,23 +95,16 @@ public class ItemDivaCharm extends ItemBauble implements IManaUsingItem, IBauble
@Override
@SideOnly(Side.CLIENT)
public void onPlayerBaubleRender(ItemStack stack, RenderPlayerEvent event, RenderType type) {
/*
public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks) {
if(type == RenderType.HEAD) {
float f = itemIcon.getMinU();
float f1 = itemIcon.getMaxU();
float f2 = itemIcon.getMinV();
float f3 = itemIcon.getMaxV();
boolean armor = event.entityPlayer.getCurrentArmor(3) != null;
Helper.translateToHeadLevel(event.entityPlayer);
boolean armor = player.getCurrentArmor(3) != null;
Helper.translateToHeadLevel(player);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.translate(-0.4F, 0.1F, armor ? -0.35F : -0.3F);
GlStateManager.scale(0.5F, 0.5F, 0.5F);
ItemRenderer.renderItemIn2D(Tessellator.getInstance(), f1, f2, f, f3, itemIcon.getIconWidth(), itemIcon.getIconHeight(), 1F / 16F);
GlStateManager.scale(0.8F, 0.8F, 0.8F);
GlStateManager.rotate(90, 0, 0, 1);
GlStateManager.translate(1.475F, armor ? -0.57F : -0.5F, 0.53F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(this, 1), ItemCameraTransforms.TransformType.THIRD_PERSON);
}
*/
}
}
@@ -37,7 +37,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
@@ -330,17 +329,17 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
@Override
@SideOnly(Side.CLIENT)
public void onPlayerBaubleRender(ItemStack stack, RenderPlayerEvent event, RenderType type) {
public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks) {
int meta = stack.getItemDamage();
if(type == RenderType.BODY) {
if(meta > 0 && meta <= MiscellaneousIcons.INSTANCE.tiaraWingIcons.length) {
TextureAtlasSprite icon = MiscellaneousIcons.INSTANCE.tiaraWingIcons[meta - 1];
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
boolean flying = event.entityPlayer.capabilities.isFlying;
boolean flying = player.capabilities.isFlying;
float rz = 120F;
float rx = 20F + (float) ((Math.sin((double) (event.entityPlayer.ticksExisted + event.partialRenderTick) * (flying ? 0.4F : 0.2F)) + 0.5F) * (flying ? 30F : 5F));
float rx = 20F + (float) ((Math.sin((double) (player.ticksExisted + partialTicks) * (flying ? 0.4F : 0.2F)) + 0.5F) * (flying ? 30F : 5F));
float ry = 0F;
float h = 0.2F;
float i = 0.15F;
@@ -374,7 +373,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
rz = 180F;
h = 0.5F;
rx = 20F;
ry = -(float) ((Math.sin((double) (event.entityPlayer.ticksExisted + event.partialRenderTick) * (flying ? 0.4F : 0.2F)) + 0.6F) * (flying ? 30F : 5F));
ry = -(float) ((Math.sin((double) (player.ticksExisted + partialTicks) * (flying ? 0.4F : 0.2F)) + 0.6F) * (flying ? 30F : 5F));
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
break;
}
@@ -395,7 +394,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
rz = 0F;
ry = -rx;
rx = 0F;
GlStateManager.color(1F, 1F, 1F, 0.5F + (float) Math.cos((double) (event.entityPlayer.ticksExisted + event.partialRenderTick) * 0.3F) * 0.2F);
GlStateManager.color(1F, 1F, 1F, 0.5F + (float) Math.cos((double) (player.ticksExisted + partialTicks) * 0.3F) * 0.2F);
break;
}
case 8 : { // Mega Ultra Chicken
@@ -408,7 +407,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
rx = 0F;
s = 1.5F;
h = 1.2F;
GlStateManager.color(1F, 1F, 1F, 0.5F + (flying ? (float) Math.cos((double) (event.entityPlayer.ticksExisted + event.partialRenderTick) * 0.3F) * 0.25F + 0.25F : 0F));
GlStateManager.color(1F, 1F, 1F, 0.5F + (flying ? (float) Math.cos((double) (player.ticksExisted + partialTicks) * 0.3F) * 0.25F + 0.25F : 0F));
}
}
@@ -418,7 +417,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
float f3 = icon.getMaxV();
float sr = 1F / s;
Helper.rotateIfSneaking(event.entityPlayer);
Helper.rotateIfSneaking(player);
GlStateManager.translate(0F, h, i);
@@ -449,7 +448,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
GlStateManager.popMatrix();
}
} else if(meta == 1) // Jibril's Halo
renderHalo(event.entityPlayer, event.partialRenderTick);
renderHalo(player, partialTicks);
}
@SideOnly(Side.CLIENT)
@@ -466,6 +465,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
if(player != null)
Helper.translateToHeadLevel(player);
GlStateManager.translate(0, 1.5F, 0);
GlStateManager.rotate(30, 1, 0, -1);
GlStateManager.translate(-0.1F, -0.5F, -0.1F);
if(player != null)
@@ -10,12 +10,15 @@
*/
package vazkii.botania.common.item.equipment.bauble;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
@@ -59,26 +62,18 @@ public class ItemGoldenLaurel extends ItemBauble implements IBaubleRender {
@Override
@SideOnly(Side.CLIENT)
public void onPlayerBaubleRender(ItemStack stack, RenderPlayerEvent event, RenderType type) {
/*
public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks) {
if(type == RenderType.HEAD) {
float f = itemIcon.getMinU();
float f1 = itemIcon.getMaxU();
float f2 = itemIcon.getMinV();
float f3 = itemIcon.getMaxV();
boolean armor = event.entityPlayer.getCurrentArmor(3) != null;
Helper.translateToHeadLevel(event.entityPlayer);
boolean armor = player.getCurrentArmor(3) != null;
Helper.translateToHeadLevel(player);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.rotate(-100F, 1F, 0F, 0F);
GlStateManager.translate(-0.5F, -0.55F, 0.3F);
GlStateManager.rotate(-90F, 0F, 1F, 0F);
GlStateManager.scale(2.2F, 2.2F, 2.2F); // TODO 1.8 could use further refinement
GlStateManager.translate(0, 0.425F, 0.425);
if(armor) {
GlStateManager.scale(1.1F, 1.1F, 1F);
GlStateManager.translate(-0.05F, -0.1F, 0F);
GlStateManager.scale(1.1F, 1.1F, 1.1F);
}
ItemRenderer.renderItemIn2D(Tessellator.getInstance(), f1, f2, f, f3, itemIcon.getIconWidth(), itemIcon.getIconHeight(), 1F / 32F);
Minecraft.getMinecraft().getRenderItem().renderItem(new ItemStack(this), ItemCameraTransforms.TransformType.THIRD_PERSON);
}
*/
}
}
@@ -17,7 +17,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
@@ -126,11 +125,11 @@ public class ItemHolyCloak extends ItemBauble implements IBaubleRender {
@Override
@SideOnly(Side.CLIENT)
public void onPlayerBaubleRender(ItemStack stack, RenderPlayerEvent event, RenderType type) {
public void onPlayerBaubleRender(ItemStack stack, EntityPlayer player, RenderType type, float partialTicks) {
if(type == RenderType.BODY) {
Minecraft.getMinecraft().renderEngine.bindTexture(getRenderTexture());
Helper.rotateIfSneaking(event.entityPlayer);
boolean armor = event.entityPlayer.getCurrentArmor(2) != null;
Helper.rotateIfSneaking(player);
boolean armor = player.getCurrentArmor(2) != null;
GlStateManager.translate(0F, armor ? -0.07F : -0.01F, 0F);
float s = 0.1F;
Loaded 100 of 245 files, more files were not shown because too many files have changed in this diff. Show more