Cleanup and reformat: Delete all ISBRH's and IItemRenderers besides book, reformat to tabs in my new classes, add missing copylefts

This commit is contained in:
Vincent Lee committed 2016-01-24 14:15:41 -06:00
1 parent eb7a6aee50
commit fddf546474
66 files changed
+1877 -2879

No files matched your search

@@ -1,3 +1,11 @@
/**
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.api;
import com.google.common.base.Preconditions;
@@ -7,8 +15,8 @@ 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 vazkii.botania.api.subtile.SubTileEntity;
import java.util.Collections;
import java.util.Map;
@@ -19,80 +27,82 @@ import java.util.Map;
@SideOnly(Side.CLIENT)
public final class BotaniaAPIClient {
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();
private static final Map<String, ModelResourceLocation> subtileBlockModels = Maps.newHashMap();
private static final Map<String, ModelResourceLocation> subtileItemModels = Maps.newHashMap();
private static final Map<IFloatingFlower.IslandType, ModelResourceLocation> islandTypeModels = Maps.newHashMap();
/**
* Register your model for the given subtile class here.
* Call this DURING PREINIT. Calling it anytime after blockModels have already baked does not guarantee that your model will work.
* Your model json must specify key "tintindex" in all the faces it wants tint applied.
* Tint is applied whenever a player recolors the flower using floral dye
*
* @param subTileName The String ID of the subtile
* @param model A path to a blockstate json and variant to be used for this subtile
* @param itemModel A path to a blockstate json and variant to be used for this subtile's item form
*/
public static void registerSubtileModel(String subTileName, ModelResourceLocation model, ModelResourceLocation itemModel) {
Preconditions.checkState(Loader.instance().isInState(LoaderState.PREINITIALIZATION));
subtileBlockModels.put(subTileName, model);
subtileItemModels.put(subTileName, itemModel);
}
private BotaniaAPIClient() {
}
/**
* Register your model for the given subtile class here.
* Call this DURING PREINIT.
* Your model json must specify key "tintindex" in all the faces it wants tint applied.
* Tint is applied whenever a player recolors the flower using floral dye
*
* @param subTileName The String ID of the subtile
* @param model A path to a blockstate json and variant to be used the block. The item model will be drawn from the same blockstate json, from variant "inventory"
*/
public static void registerSubtileModel(String subTileName, ModelResourceLocation model) {
registerSubtileModel(subTileName, model, new ModelResourceLocation(model.getResourceDomain() + ":" + model.getResourcePath(), "inventory"));
}
/**
* Register your model for the given subtile class here.
* Call this DURING PREINIT. Calling it anytime after blockModels have already baked does not guarantee that your model will work.
* Your model json must specify key "tintindex" in all the faces it wants tint applied.
* Tint is applied whenever a player recolors the flower using floral dye
*
* @param subTileName The String ID of the subtile
* @param model A path to a blockstate json and variant to be used for this subtile
* @param itemModel A path to a blockstate json and variant to be used for this subtile's item form
*/
public static void registerSubtileModel(String subTileName, ModelResourceLocation model, ModelResourceLocation itemModel) {
Preconditions.checkState(Loader.instance().isInState(LoaderState.PREINITIALIZATION));
subtileBlockModels.put(subTileName, model);
subtileItemModels.put(subTileName, itemModel);
}
// Convenience overloads for the above two calls
public static void registerSubtileModel(Class<? extends SubTileEntity> clazz, ModelResourceLocation model) {
registerSubtileModel(BotaniaAPI.getSubTileStringMapping(clazz), model);
}
/**
* Register your model for the given subtile class here.
* Call this DURING PREINIT.
* Your model json must specify key "tintindex" in all the faces it wants tint applied.
* Tint is applied whenever a player recolors the flower using floral dye
*
* @param subTileName The String ID of the subtile
* @param model A path to a blockstate json and variant to be used the block. The item model will be drawn from the same blockstate json, from variant "inventory"
*/
public static void registerSubtileModel(String subTileName, ModelResourceLocation model) {
registerSubtileModel(subTileName, model, new ModelResourceLocation(model.getResourceDomain() + ":" + model.getResourcePath(), "inventory"));
}
public static void registerSubtileModel(Class<? extends SubTileEntity> clazz, ModelResourceLocation model, ModelResourceLocation itemModel) {
registerSubtileModel(BotaniaAPI.getSubTileStringMapping(clazz), model, itemModel);
}
// Convenience overloads for the above two calls
public static void registerSubtileModel(Class<? extends SubTileEntity> clazz, ModelResourceLocation model) {
registerSubtileModel(BotaniaAPI.getSubTileStringMapping(clazz), model);
}
/**
* @return An immutable and live view of the registered subtile block model map
*/
public static Map<String, ModelResourceLocation> getRegisteredSubtileBlockModels() {
return Collections.unmodifiableMap(subtileBlockModels);
}
public static void registerSubtileModel(Class<? extends SubTileEntity> clazz, ModelResourceLocation model, ModelResourceLocation itemModel) {
registerSubtileModel(BotaniaAPI.getSubTileStringMapping(clazz), model, itemModel);
}
/**
* @return An immutable and live view of the registered subtile item model map
*/
public static Map<String, ModelResourceLocation> getRegisteredSubtileItemModels() {
return Collections.unmodifiableMap(subtileItemModels);
}
/**
* @return An immutable and live view of the registered subtile block model map
*/
public static Map<String, ModelResourceLocation> getRegisteredSubtileBlockModels() {
return Collections.unmodifiableMap(subtileBlockModels);
}
/**
* 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 subtile item model map
*/
public static Map<String, ModelResourceLocation> getRegisteredSubtileItemModels() {
return Collections.unmodifiableMap(subtileItemModels);
}
/**
* @return An immutable and live view of the registered island type model map
*/
public static Map<IFloatingFlower.IslandType, ModelResourceLocation> getRegisteredIslandTypeModels() {
return Collections.unmodifiableMap(islandTypeModels);
}
/**
* 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);
}
private BotaniaAPIClient() {}
/**
* @return An immutable and live view of the registered island type model map
*/
public static Map<IFloatingFlower.IslandType, ModelResourceLocation> getRegisteredIslandTypeModels() {
return Collections.unmodifiableMap(islandTypeModels);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -26,133 +26,131 @@ import vazkii.botania.api.state.enums.*;
*/
public class BotaniaStateProps {
/** Unlisted properties **/
/** Unlisted properties **/
// The property for specialFlower subtile id
public static final PropertyObject<String> SUBTILE_ID = new PropertyObject<>("subtile_id", String.class);
// The property for specialFlower 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 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 PropertyObject<IBlockState> HELD_STATE = new PropertyObject<>("held_state", IBlockState.class);
// The property for platform held blockstate id
public static final PropertyObject<IBlockState> HELD_STATE = new PropertyObject<>("held_state", IBlockState.class);
/** Common properties to all blocks to use **/
/** Common properties to all blocks to use **/
// The 16 Minecraft colors
public static final PropertyEnum<EnumDyeColor> COLOR = PropertyEnum.create("color", EnumDyeColor.class);
// The 16 Minecraft colors
public static final PropertyEnum<EnumDyeColor> COLOR = PropertyEnum.create("color", EnumDyeColor.class);
// The four cardinal directions
public static final PropertyEnum<EnumFacing> CARDINALS = PropertyEnum.create("facing", EnumFacing.class, EnumFacing.Plane.HORIZONTAL);
// The four cardinal directions
public static final PropertyEnum<EnumFacing> CARDINALS = PropertyEnum.create("facing", EnumFacing.class, EnumFacing.Plane.HORIZONTAL);
// All 6 directions
public static final PropertyEnum<EnumFacing> FACING = PropertyEnum.create("facing", EnumFacing.class);
// All 6 directions
public static final PropertyEnum<EnumFacing> FACING = PropertyEnum.create("facing", EnumFacing.class);
// Redstone power - boolean
// Also for any other simple boolean "on/off" state
public static final PropertyBool POWERED = PropertyBool.create("powered");
// Redstone power - boolean
// Also for any other simple boolean "on/off" state
public static final PropertyBool POWERED = PropertyBool.create("powered");
// Redstone power - int
public static final PropertyInteger POWER = PropertyInteger.create("power", 0, 15);
/** Properties for certain kinds of blocks **/
/** Properties for certain kinds of blocks **/
// The axis directions (think quartz pillars and wood logs)
public static final PropertyEnum<EnumFacing.Axis> AXIS_FACING = BlockRotatedPillar.AXIS;
// The axis directions (think quartz pillars and wood logs)
public static final PropertyEnum<EnumFacing.Axis> AXIS_FACING = BlockRotatedPillar.AXIS;
// Extra Quartz Blocks
public static final PropertyEnum<QuartzVariant> QUARTZ_VARIANT = PropertyEnum.create("variant", QuartzVariant.class);
// Extra Quartz Blocks
public static final PropertyEnum<QuartzVariant> QUARTZ_VARIANT = PropertyEnum.create("variant", QuartzVariant.class);
/** Properties for individual blocks **/
/** Properties for individual blocks **/
// Block18Stone
public static final PropertyEnum<FutureStoneVariant> FUTURESTONE_VARIANT = PropertyEnum.create("variant", FutureStoneVariant.class);
// Block18Stone
public static final PropertyEnum<FutureStoneVariant> FUTURESTONE_VARIANT = PropertyEnum.create("variant", FutureStoneVariant.class);
// Block18StoneWall
public static final PropertyEnum<FutureStoneVariant> FUTURESTONEWALL_VARIANT = PropertyEnum.create("variant", FutureStoneVariant.class, variant -> {
// Just the four kinds (no polished, chiseled, etc.)
return variant.ordinal() >= 0 && variant.ordinal() <= 3;
});
// Block18StoneWall
public static final PropertyEnum<FutureStoneVariant> FUTURESTONEWALL_VARIANT = PropertyEnum.create("variant", FutureStoneVariant.class, variant -> {
// Just the four kinds (no polished, chiseled, etc.)
return variant.ordinal() >= 0 && variant.ordinal() <= 3;
});
// BlockAlfPortal
public static final PropertyEnum<AlfPortalState> ALFPORTAL_STATE = PropertyEnum.create("state", AlfPortalState.class);
// BlockAlfPortal
public static final PropertyEnum<AlfPortalState> ALFPORTAL_STATE = PropertyEnum.create("state", AlfPortalState.class);
// BlockAltar
public static final PropertyEnum<AltarVariant> ALTAR_VARIANT = PropertyEnum.create("variant", AltarVariant.class);
// BlockAltar
public static final PropertyEnum<AltarVariant> ALTAR_VARIANT = PropertyEnum.create("variant", AltarVariant.class);
// BlockAltGrass
public static final PropertyEnum<AltGrassVariant> ALTGRASS_VARIANT = PropertyEnum.create("variant", AltGrassVariant.class);
// BlockAltGrass
public static final PropertyEnum<AltGrassVariant> ALTGRASS_VARIANT = PropertyEnum.create("variant", AltGrassVariant.class);
// BlockBiomeStoneA
public static final PropertyEnum<BiomeStoneVariant> BIOMESTONE_VARIANT = PropertyEnum.create("variant", BiomeStoneVariant.class);
// BlockBiomeStoneA
public static final PropertyEnum<BiomeStoneVariant> BIOMESTONE_VARIANT = PropertyEnum.create("variant", BiomeStoneVariant.class);
// BlockBiomeStoneB
public static final PropertyEnum<BiomeBrickVariant> BIOMEBRICK_VARIANT = PropertyEnum.create("variant", BiomeBrickVariant.class);
// BlockBiomeStoneB
public static final PropertyEnum<BiomeBrickVariant> BIOMEBRICK_VARIANT = PropertyEnum.create("variant", BiomeBrickVariant.class);
// BlockBiomeStoneWall
public static final PropertyEnum<BiomeStoneVariant> BIOMESTONEWALL_VARIANT = PropertyEnum.create("variant", BiomeStoneVariant.class, input -> input.getName().contains("cobble"));
// BlockBiomeStoneWall
public static final PropertyEnum<BiomeStoneVariant> BIOMESTONEWALL_VARIANT = PropertyEnum.create("variant", BiomeStoneVariant.class, input -> input.getName().contains("cobble"));
// BlockCustomBrick
public static final PropertyEnum<CustomBrickVariant> CUSTOMBRICK_VARIANT = PropertyEnum.create("variant", CustomBrickVariant.class);
// BlockCustomBrick
public static final PropertyEnum<CustomBrickVariant> CUSTOMBRICK_VARIANT = PropertyEnum.create("variant", CustomBrickVariant.class);
// BlockDreamWood, BlockLivingWood
public static final PropertyEnum<LivingWoodVariant> LIVINGWOOD_VARIANT = PropertyEnum.create("variant", LivingWoodVariant.class);
// BlockDreamWood, BlockLivingWood
public static final PropertyEnum<LivingWoodVariant> LIVINGWOOD_VARIANT = PropertyEnum.create("variant", LivingWoodVariant.class);
// BlockEnchanter
public static final PropertyEnum<EnumFacing.Axis> ENCHANTER_DIRECTION = PropertyEnum.create("facing", EnumFacing.Axis.class, Predicates.not(Predicates.equalTo(EnumFacing.Axis.Y)));
// BlockEnchanter
public static final PropertyEnum<EnumFacing.Axis> ENCHANTER_DIRECTION = PropertyEnum.create("facing", EnumFacing.Axis.class, Predicates.not(Predicates.equalTo(EnumFacing.Axis.Y)));
// BlockEndStoneBrick
public static final PropertyEnum<EndBrickVariant> ENDBRICK_VARIANT = PropertyEnum.create("variant", EndBrickVariant.class);
// BlockEndStoneBrick
public static final PropertyEnum<EndBrickVariant> ENDBRICK_VARIANT = PropertyEnum.create("variant", EndBrickVariant.class);
// BlockForestDrum
public static final PropertyEnum<DrumVariant> DRUM_VARIANT = PropertyEnum.create("variant", DrumVariant.class);
// BlockForestDrum
public static final PropertyEnum<DrumVariant> DRUM_VARIANT = PropertyEnum.create("variant", DrumVariant.class);
// BlockGhostRail
public static final PropertyEnum<BlockRailBase.EnumRailDirection> RAIL_DIRECTION = BlockRailPowered.SHAPE;
// BlockGhostRail
public static final PropertyEnum<BlockRailBase.EnumRailDirection> RAIL_DIRECTION = BlockRailPowered.SHAPE;
// BlockLightRelay
public static final PropertyEnum<LuminizerVariant> LUMINIZER_VARIANT = PropertyEnum.create("variant", LuminizerVariant.class);
// BlockLightRelay
public static final PropertyEnum<LuminizerVariant> LUMINIZER_VARIANT = PropertyEnum.create("variant", LuminizerVariant.class);
// BlockLivingRock
public static final PropertyEnum<LivingRockVariant> LIVINGROCK_VARIANT = PropertyEnum.create("variant", LivingRockVariant.class);
// BlockLivingRock
public static final PropertyEnum<LivingRockVariant> LIVINGROCK_VARIANT = PropertyEnum.create("variant", LivingRockVariant.class);
// BlockModDoubleFlower (white to gray)
public static final PropertyEnum<EnumDyeColor> DOUBLEFLOWER_VARIANT_1 = PropertyEnum.create("variant", EnumDyeColor.class, input -> input.ordinal() >= 0 && input.ordinal() <= 7);
// BlockModDoubleFlower (white to gray)
public static final PropertyEnum<EnumDyeColor> DOUBLEFLOWER_VARIANT_1 = PropertyEnum.create("variant", EnumDyeColor.class, input -> input.ordinal() >= 0 && input.ordinal() <= 7);
// (silver to black)
public static final PropertyEnum<EnumDyeColor> DOUBLEFLOWER_VARIANT_2 = PropertyEnum.create("variant", EnumDyeColor.class, input -> input.ordinal() >= 8 && input.ordinal() <= 15);
// (silver to black)
public static final PropertyEnum<EnumDyeColor> DOUBLEFLOWER_VARIANT_2 = PropertyEnum.create("variant", EnumDyeColor.class, input -> input.ordinal() >= 8 && input.ordinal() <= 15);
// BlockOpenCrate
public static final PropertyEnum<CrateVariant> CRATE_VARIANT = PropertyEnum.create("variant", CrateVariant.class);
public static final PropertyEnum<CratePattern> CRATE_PATTERN = PropertyEnum.create("pattern", CratePattern.class);
// BlockOpenCrate
public static final PropertyEnum<CrateVariant> CRATE_VARIANT = PropertyEnum.create("variant", CrateVariant.class);
public static final PropertyEnum<CratePattern> CRATE_PATTERN = PropertyEnum.create("pattern", CratePattern.class);
// BlockPavement
public static final PropertyEnum<EnumDyeColor> PAVEMENT_COLOR = PropertyEnum.create("color", EnumDyeColor.class, color ->
color == EnumDyeColor.WHITE || color == EnumDyeColor.BLACK
|| color == EnumDyeColor.BLUE || color == EnumDyeColor.RED
|| color == EnumDyeColor.YELLOW || color == EnumDyeColor.GREEN);
// BlockPavement
public static final PropertyEnum<EnumDyeColor> PAVEMENT_COLOR = PropertyEnum.create("color", EnumDyeColor.class, color ->
color == EnumDyeColor.WHITE || color == EnumDyeColor.BLACK
|| color == EnumDyeColor.BLUE || color == EnumDyeColor.RED
|| color == EnumDyeColor.YELLOW || color == EnumDyeColor.GREEN);
// BlockPlatform
public static final PropertyEnum<PlatformVariant> PLATFORM_VARIANT = PropertyEnum.create("variant", PlatformVariant.class);
// BlockPlatform
public static final PropertyEnum<PlatformVariant> PLATFORM_VARIANT = PropertyEnum.create("variant", PlatformVariant.class);
// BlockPool
public static final PropertyEnum<PoolVariant> POOL_VARIANT = PropertyEnum.create("variant", PoolVariant.class);
// BlockPool
public static final PropertyEnum<PoolVariant> POOL_VARIANT = PropertyEnum.create("variant", PoolVariant.class);
// BlockPrism
public static final PropertyBool HAS_LENS = PropertyBool.create("has_lens");
// BlockPrism
public static final PropertyBool HAS_LENS = PropertyBool.create("has_lens");
// BlockPrismarine
public static final PropertyEnum<PrismarineVariant> PRISMARINE_VARIANT = PropertyEnum.create("variant", PrismarineVariant.class);
// BlockPrismarine
public static final PropertyEnum<PrismarineVariant> PRISMARINE_VARIANT = PropertyEnum.create("variant", PrismarineVariant.class);
// BlockPylon
public static final PropertyEnum<PylonVariant> PYLON_VARIANT = PropertyEnum.create("variant", PylonVariant.class);
// BlockPylon
public static final PropertyEnum<PylonVariant> PYLON_VARIANT = PropertyEnum.create("variant", PylonVariant.class);
// BlockSpreader
public static final PropertyEnum<SpreaderVariant> SPREADER_VARIANT = PropertyEnum.create("variant", SpreaderVariant.class);
// BlockSpreader
public static final PropertyEnum<SpreaderVariant> SPREADER_VARIANT = PropertyEnum.create("variant", SpreaderVariant.class);
// BlockStorage
public static final PropertyEnum<StorageVariant> STORAGE_VARIANT = PropertyEnum.create("variant", StorageVariant.class);
// BlockStorage
public static final PropertyEnum<StorageVariant> STORAGE_VARIANT = PropertyEnum.create("variant", StorageVariant.class);
private BotaniaStateProps() {}
private BotaniaStateProps() {
}
}
@@ -1,3 +1,11 @@
/**
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.api.state;
import com.google.common.base.Function;
@@ -8,39 +16,39 @@ 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;
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, 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);
}
public PropertyObject(String name, Class<T> clazz) {
this(name, clazz, Predicates.alwaysTrue(), Object::toString);
}
@Override
public String getName() {
return name;
}
@Override
public String getName() {
return name;
}
@Override
public boolean isValid(T value) {
return validator.apply(value);
}
@Override
public boolean isValid(T value) {
return validator.apply(value);
}
@Override
public Class<T> getType() {
return clazz;
}
@Override
public Class<T> getType() {
return clazz;
}
@Override
public String valueToString(T value) {
return stringFunction.apply(value);
}
@Override
public String valueToString(T value) {
return stringFunction.apply(value);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,13 +13,13 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum AlfPortalState implements IStringSerializable {
OFF,
ON_Z,
ON_X;
OFF,
ON_Z,
ON_X;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,16 +13,16 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum AltGrassVariant implements IStringSerializable {
DRY,
GOLDEN,
VIVID,
SCORCHED,
INFUSED,
MUTATED;
DRY,
GOLDEN,
VIVID,
SCORCHED,
INFUSED,
MUTATED;
@Override
public String getName() {
return this.name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return this.name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,20 +13,20 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum AltarVariant implements IStringSerializable {
DEFAULT,
FOREST,
PLAINS,
MOUNTAIN,
FUNGAL,
SWAMP,
DESERT,
TAIGA,
MESA,
MOSSY;
DEFAULT,
FOREST,
PLAINS,
MOUNTAIN,
FUNGAL,
SWAMP,
DESERT,
TAIGA,
MESA,
MOSSY;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,26 +13,26 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum BiomeBrickVariant implements IStringSerializable {
FOREST,
PLAINS,
MOUNTAIN,
FUNGAL,
SWAMP,
DESERT,
TAIGA,
MESA,
CHISELED_FOREST,
CHISELED_PLAINS,
CHISELED_MOUNTAIN,
CHISELED_FUNGAL,
CHISELED_SWAMP,
CHISELED_DESERT,
CHISELED_TAIGA,
CHISELED_MESA;
FOREST,
PLAINS,
MOUNTAIN,
FUNGAL,
SWAMP,
DESERT,
TAIGA,
MESA,
CHISELED_FOREST,
CHISELED_PLAINS,
CHISELED_MOUNTAIN,
CHISELED_FUNGAL,
CHISELED_SWAMP,
CHISELED_DESERT,
CHISELED_TAIGA,
CHISELED_MESA;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,26 +13,26 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum BiomeStoneVariant implements IStringSerializable {
FOREST,
PLAINS,
MOUNTAIN,
FUNGAL,
SWAMP,
DESERT,
TAIGA,
MESA,
FOREST_COBBLE,
PLAINS_COBBLE,
MOUNTAIN_COBBLE,
FUNGAL_COBBLE,
SWAMP_COBBLE,
DESERT_COBBLE,
TAIGA_COBBLE,
MESA_COBBLE;
FOREST,
PLAINS,
MOUNTAIN,
FUNGAL,
SWAMP,
DESERT,
TAIGA,
MESA,
FOREST_COBBLE,
PLAINS_COBBLE,
MOUNTAIN_COBBLE,
FUNGAL_COBBLE,
SWAMP_COBBLE,
DESERT_COBBLE,
TAIGA_COBBLE,
MESA_COBBLE;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,19 +13,19 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum CratePattern implements IStringSerializable {
NONE,
CRAFTY_1_1,
CRAFTY_2_2,
CRAFTY_1_2,
CRAFTY_2_1,
CRAFTY_1_3,
CRAFTY_3_1,
CRAFTY_2_3,
CRAFTY_3_2,
CRAFTY_DONUT;
NONE,
CRAFTY_1_1,
CRAFTY_2_2,
CRAFTY_1_2,
CRAFTY_2_1,
CRAFTY_1_3,
CRAFTY_3_1,
CRAFTY_2_3,
CRAFTY_3_2,
CRAFTY_DONUT;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,12 +13,12 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum CrateVariant implements IStringSerializable {
OPEN,
CRAFTY;
OPEN,
CRAFTY;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,26 +13,26 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum CustomBrickVariant implements IStringSerializable {
HELLISH_BRICK,
SOUL_BRICK,
FROSTY_BRICK,
ROOF_TILE,
AZULEJO_1,
AZULEJO_2,
AZULEJO_3,
AZULEJO_4,
AZULEJO_5,
AZULEJO_6,
AZULEJO_7,
AZULEJO_8,
AZULEJO_9,
AZULEJO_10,
AZULEJO_11,
AZULEJO_12;
HELLISH_BRICK,
SOUL_BRICK,
FROSTY_BRICK,
ROOF_TILE,
AZULEJO_1,
AZULEJO_2,
AZULEJO_3,
AZULEJO_4,
AZULEJO_5,
AZULEJO_6,
AZULEJO_7,
AZULEJO_8,
AZULEJO_9,
AZULEJO_10,
AZULEJO_11,
AZULEJO_12;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,13 +13,13 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum DrumVariant implements IStringSerializable {
WILD,
GATHERING,
CANOPY;
WILD,
GATHERING,
CANOPY;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,14 +13,14 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum EndBrickVariant implements IStringSerializable {
END_STONE_BRICKS,
CHISELED_END_STONE_BRICKS,
ENDER_BRICKS,
PILLAR_ENDER_BRICKS;
END_STONE_BRICKS,
CHISELED_END_STONE_BRICKS,
ENDER_BRICKS,
PILLAR_ENDER_BRICKS;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,26 +13,26 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum FutureStoneVariant implements IStringSerializable {
ANDESITE,
BASALT,
DIORITE,
GRANITE,
POLISHED_ANDESITE,
POLISHED_BASALT,
POLISHED_DIORITE,
POLISHED_GRANITE,
ANDESITE_BRICK,
BASALT_BRICK,
DIORITE_BRICK,
GRANITE_BRICK,
CHISELED_ANDESITE,
CHISELED_BASALT,
CHISELED_DIORITE,
CHISELED_GRANITE;
ANDESITE,
BASALT,
DIORITE,
GRANITE,
POLISHED_ANDESITE,
POLISHED_BASALT,
POLISHED_DIORITE,
POLISHED_GRANITE,
ANDESITE_BRICK,
BASALT_BRICK,
DIORITE_BRICK,
GRANITE_BRICK,
CHISELED_ANDESITE,
CHISELED_BASALT,
CHISELED_DIORITE,
CHISELED_GRANITE;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,15 +13,15 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum LivingRockVariant implements IStringSerializable {
DEFAULT,
BRICK,
MOSSY_BRICK,
CRACKED_BRICK,
CHISELED_BRICK;
DEFAULT,
BRICK,
MOSSY_BRICK,
CRACKED_BRICK,
CHISELED_BRICK;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,16 +13,16 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum LivingWoodVariant implements IStringSerializable {
DEFAULT,
PLANKS,
MOSSY_PLANKS,
FRAMED,
PATTERN_FRAMED,
GLIMMERING;
DEFAULT,
PLANKS,
MOSSY_PLANKS,
FRAMED,
PATTERN_FRAMED,
GLIMMERING;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,12 +13,12 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum LuminizerVariant implements IStringSerializable {
DEFAULT,
DETECTOR;
DEFAULT,
DETECTOR;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,13 +13,13 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum PlatformVariant implements IStringSerializable {
ABSTRUSE,
SPECTRAL,
INFRANGIBLE;
ABSTRUSE,
SPECTRAL,
INFRANGIBLE;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,14 +13,14 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum PoolVariant implements IStringSerializable {
DEFAULT,
CREATIVE,
DILUTED,
FABULOUS;
DEFAULT,
CREATIVE,
DILUTED,
FABULOUS;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,13 +13,13 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum PrismarineVariant implements IStringSerializable {
PRISMARINE,
PRISMARINE_BRICKS,
DARK_PRISMARINE;
PRISMARINE,
PRISMARINE_BRICKS,
DARK_PRISMARINE;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,13 +13,13 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum PylonVariant implements IStringSerializable {
MANA,
NATURA,
GAIA;
MANA,
NATURA,
GAIA;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,15 +13,15 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum QuartzVariant implements IStringSerializable {
NORMAL,
CHISELED,
PILLAR_Y,
PILLAR_X,
PILLAR_Z;
NORMAL,
CHISELED,
PILLAR_Y,
PILLAR_X,
PILLAR_Z;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,14 +13,14 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum SpreaderVariant implements IStringSerializable {
MANA,
REDSTONE,
ELVEN,
GAIA;
MANA,
REDSTONE,
ELVEN,
GAIA;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -13,15 +13,15 @@ import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum StorageVariant implements IStringSerializable {
MANASTEEL,
TERRASTEEL,
ELEMENTIUM,
MANA_DIAMOND,
DRAGONSTONE;
MANASTEEL,
TERRASTEEL,
ELEMENTIUM,
MANA_DIAMOND,
DRAGONSTONE;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -31,50 +31,52 @@ import vazkii.botania.client.integration.jei.runicaltar.RunicAltarRecipeHandler;
@JEIPlugin
public class JEIBotaniaPlugin implements IModPlugin {
private IJeiHelpers jeiHelpers;
private IJeiHelpers jeiHelpers;
@Override
public boolean isModLoaded() {
return true;
}
@Override
public boolean isModLoaded() {
return true;
}
@Override
public void onJeiHelpersAvailable(IJeiHelpers jeiHelpers) {
this.jeiHelpers = jeiHelpers;
}
@Override
public void onJeiHelpersAvailable(IJeiHelpers jeiHelpers) {
this.jeiHelpers = jeiHelpers;
}
@Override
public void onItemRegistryAvailable(IItemRegistry itemRegistry) {}
@Override
public void onItemRegistryAvailable(IItemRegistry itemRegistry) {
}
@Override
public void register(IModRegistry registry) {
registry.addRecipeCategories(
new BreweryRecipeCategory(jeiHelpers.getGuiHelper()),
new PureDaisyRecipeCategory(jeiHelpers.getGuiHelper()),
new PetalApothecaryRecipeCategory(jeiHelpers.getGuiHelper()),
new ElvenTradeRecipeCategory(jeiHelpers.getGuiHelper()),
new RunicAltarRecipeCategory(jeiHelpers.getGuiHelper()),
new ManaPoolRecipeCategory(jeiHelpers.getGuiHelper())
);
@Override
public void register(IModRegistry registry) {
registry.addRecipeCategories(
new BreweryRecipeCategory(jeiHelpers.getGuiHelper()),
new PureDaisyRecipeCategory(jeiHelpers.getGuiHelper()),
new PetalApothecaryRecipeCategory(jeiHelpers.getGuiHelper()),
new ElvenTradeRecipeCategory(jeiHelpers.getGuiHelper()),
new RunicAltarRecipeCategory(jeiHelpers.getGuiHelper()),
new ManaPoolRecipeCategory(jeiHelpers.getGuiHelper())
);
registry.addRecipeHandlers(
new BreweryRecipeHandler(),
new PureDaisyRecipeHandler(),
new PetalApothecaryRecipeHandler(),
new ElvenTradeRecipeHandler(),
new RunicAltarRecipeHandler(),
new ManaPoolRecipeHandler()
);
registry.addRecipeHandlers(
new BreweryRecipeHandler(),
new PureDaisyRecipeHandler(),
new PetalApothecaryRecipeHandler(),
new ElvenTradeRecipeHandler(),
new RunicAltarRecipeHandler(),
new ManaPoolRecipeHandler()
);
registry.addRecipes(BotaniaAPI.brewRecipes);
registry.addRecipes(BotaniaAPI.pureDaisyRecipes);
registry.addRecipes(BotaniaAPI.petalRecipes);
registry.addRecipes(BotaniaAPI.elvenTradeRecipes);
registry.addRecipes(BotaniaAPI.runeAltarRecipes);
registry.addRecipes(BotaniaAPI.manaInfusionRecipes);
}
registry.addRecipes(BotaniaAPI.brewRecipes);
registry.addRecipes(BotaniaAPI.pureDaisyRecipes);
registry.addRecipes(BotaniaAPI.petalRecipes);
registry.addRecipes(BotaniaAPI.elvenTradeRecipes);
registry.addRecipes(BotaniaAPI.runeAltarRecipes);
registry.addRecipes(BotaniaAPI.manaInfusionRecipes);
}
@Override
public void onRecipeRegistryAvailable(IRecipeRegistry recipeRegistry) {}
@Override
public void onRecipeRegistryAvailable(IRecipeRegistry recipeRegistry) {
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -18,7 +18,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import vazkii.botania.common.item.ModItems;
import javax.annotation.Nonnull;
import java.util.Collection;
@@ -26,69 +25,71 @@ import java.util.List;
public class BreweryRecipeCategory implements IRecipeCategory {
private final IDrawableStatic background;
private final String localizedName;
private final IDrawableStatic background;
private final String localizedName;
public BreweryRecipeCategory(IGuiHelper guiHelper) {
ResourceLocation location = new ResourceLocation("botania", "textures/gui/neiBrewery.png");
background = guiHelper.createDrawable(location, 0, 0, 166, 65, 0, 0, 0, 0);
localizedName = StatCollector.translateToLocal("botania.nei.brewery");
}
public BreweryRecipeCategory(IGuiHelper guiHelper) {
ResourceLocation location = new ResourceLocation("botania", "textures/gui/neiBrewery.png");
background = guiHelper.createDrawable(location, 0, 0, 166, 65, 0, 0, 0, 0);
localizedName = StatCollector.translateToLocal("botania.nei.brewery");
}
@Nonnull
@Override
public String getUid() {
return "botania.brewery";
}
@Nonnull
@Override
public String getUid() {
return "botania.brewery";
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(Minecraft minecraft) {}
@Override
public void drawExtras(Minecraft minecraft) {
}
@Override
public void drawAnimations(Minecraft minecraft) {}
@Override
public void drawAnimations(Minecraft minecraft) {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if (!(recipeWrapper instanceof BreweryRecipeWrapper))
return;
BreweryRecipeWrapper wrapper = ((BreweryRecipeWrapper) recipeWrapper);
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if(!(recipeWrapper instanceof BreweryRecipeWrapper))
return;
BreweryRecipeWrapper wrapper = ((BreweryRecipeWrapper) recipeWrapper);
List inputs = wrapper.getInputs();
List inputs = wrapper.getInputs();
recipeLayout.getItemStacks().init(0, true, 39, 41);
if (inputs.get(0) instanceof ItemStack) {
recipeLayout.getItemStacks().set(0, ((ItemStack) inputs.get(0)));
} else {
recipeLayout.getItemStacks().set(0, ((Collection<ItemStack>) inputs.get(0)));
}
recipeLayout.getItemStacks().init(0, true, 39, 41);
if(inputs.get(0) instanceof ItemStack) {
recipeLayout.getItemStacks().set(0, ((ItemStack) inputs.get(0)));
} else {
recipeLayout.getItemStacks().set(0, ((Collection<ItemStack>) inputs.get(0)));
}
int index = 1, posX = 60;
for (int i = 1; i < wrapper.getInputs().size(); i++) {
Object o = wrapper.getInputs().get(i);
recipeLayout.getItemStacks().init(index, true, posX, 6);
if (o instanceof ItemStack) {
recipeLayout.getItemStacks().set(index, ((ItemStack) o));
} else if (o instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) o));
}
index++;
posX += 18;
}
int index = 1, posX = 60;
for(int i = 1; i < wrapper.getInputs().size(); i++) {
Object o = wrapper.getInputs().get(i);
recipeLayout.getItemStacks().init(index, true, posX, 6);
if(o instanceof ItemStack) {
recipeLayout.getItemStacks().set(index, ((ItemStack) o));
} else if(o instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) o));
}
index++;
posX += 18;
}
recipeLayout.getItemStacks().init(7, false, 87, 41);
recipeLayout.getItemStacks().set(7, wrapper.getOutputs());
}
recipeLayout.getItemStacks().init(7, false, 87, 41);
recipeLayout.getItemStacks().set(7, wrapper.getOutputs());
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -16,27 +16,27 @@ import javax.annotation.Nonnull;
public class BreweryRecipeHandler implements IRecipeHandler<RecipeBrew> {
@Nonnull
@Override
public Class<RecipeBrew> getRecipeClass() {
return RecipeBrew.class;
}
@Nonnull
@Override
public Class<RecipeBrew> getRecipeClass() {
return RecipeBrew.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.brewery";
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.brewery";
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeBrew recipe) {
return new BreweryRecipeWrapper(recipe);
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeBrew recipe) {
return new BreweryRecipeWrapper(recipe);
}
@Override
public boolean isRecipeValid(@Nonnull RecipeBrew recipe) {
return recipe.getInputs().size() <= 6;
}
@Override
public boolean isRecipeValid(@Nonnull RecipeBrew recipe) {
return recipe.getInputs().size() <= 6;
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -22,45 +22,51 @@ import java.util.List;
public class BreweryRecipeWrapper implements IRecipeWrapper {
private final List input;
private final List<ItemStack> output;
private final List input;
private final List<ItemStack> output;
public BreweryRecipeWrapper(RecipeBrew recipeBrew) {
ImmutableList.Builder builder = ImmutableList.builder();
builder.add(ImmutableList.of(new ItemStack(ModItems.vial, 1, 0), new ItemStack(ModItems.vial, 1, 1)));
for (Object o : recipeBrew.getInputs()) {
if (o instanceof ItemStack) {
builder.add(o);
}
if (o instanceof String) {
builder.add(OreDictionary.getOres(((String) o)));
}
}
public BreweryRecipeWrapper(RecipeBrew recipeBrew) {
ImmutableList.Builder builder = ImmutableList.builder();
builder.add(ImmutableList.of(new ItemStack(ModItems.vial, 1, 0), new ItemStack(ModItems.vial, 1, 1)));
for(Object o : recipeBrew.getInputs()) {
if(o instanceof ItemStack) {
builder.add(o);
}
if(o instanceof String) {
builder.add(OreDictionary.getOres(((String) o)));
}
}
input = builder.build();
output = ImmutableList.of(recipeBrew.getOutput(new ItemStack(ModItems.vial)).copy(), recipeBrew.getOutput(new ItemStack(ModItems.vial, 1, 1)).copy());
}
input = builder.build();
output = ImmutableList.of(recipeBrew.getOutput(new ItemStack(ModItems.vial)).copy(), recipeBrew.getOutput(new ItemStack(ModItems.vial, 1, 1)).copy());
}
@Override
public List getInputs() {
return input;
}
@Override
public List getInputs() {
return input;
}
@Override
public List<ItemStack> getOutputs() {
return output;
}
@Override
public List<ItemStack> getOutputs() {
return output;
}
@Override
public List<FluidStack> getFluidInputs() { return ImmutableList.of(); }
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() { return ImmutableList.of(); }
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -31,81 +31,81 @@ import java.util.Collection;
public class ElvenTradeRecipeCategory implements IRecipeCategory {
private final String localizedName;
private final IDrawable background;
private final IDrawable overlay;
private final String localizedName;
private final IDrawable background;
private final IDrawable overlay;
public ElvenTradeRecipeCategory(IGuiHelper guiHelper) {
localizedName = StatCollector.translateToLocal("botania.nei.elvenTrade");
background = guiHelper.createBlankDrawable(145, 95);
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/elvenTradeOverlay.png"), 0, 15, 140, 90);
}
public ElvenTradeRecipeCategory(IGuiHelper guiHelper) {
localizedName = StatCollector.translateToLocal("botania.nei.elvenTrade");
background = guiHelper.createBlankDrawable(145, 95);
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/elvenTradeOverlay.png"), 0, 15, 140, 90);
}
@Nonnull
@Override
public String getUid() {
return "botania.elvenTrade";
}
@Nonnull
@Override
public String getUid() {
return "botania.elvenTrade";
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft, 0, 4);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft, 0, 4);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawAnimations(Minecraft minecraft) {
minecraft.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
TextureAtlasSprite sprite = MiscellaneousIcons.INSTANCE.alfPortalTex;
Tessellator tess = Tessellator.getInstance();
WorldRenderer wr = tess.getWorldRenderer();
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
int startX = 22;
int startY = 25;
int stopX = 70;
int stopY = 73;
wr.pos(startX, startY, 0).tex(sprite.getMinU(), sprite.getMinV()).endVertex();
wr.pos(startX, stopY, 0).tex(sprite.getMinU(), sprite.getMaxV()).endVertex();
wr.pos(stopX, stopY, 0).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex();
wr.pos(stopX, startY, 0).tex(sprite.getMaxU(), sprite.getMinV()).endVertex();
tess.draw();
}
@Override
public void drawAnimations(Minecraft minecraft) {
minecraft.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
TextureAtlasSprite sprite = MiscellaneousIcons.INSTANCE.alfPortalTex;
Tessellator tess = Tessellator.getInstance();
WorldRenderer wr = tess.getWorldRenderer();
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
int startX = 22;
int startY = 25;
int stopX = 70;
int stopY = 73;
wr.pos(startX, startY, 0).tex(sprite.getMinU(), sprite.getMinV()).endVertex();
wr.pos(startX, stopY, 0).tex(sprite.getMinU(), sprite.getMaxV()).endVertex();
wr.pos(stopX, stopY, 0).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex();
wr.pos(stopX, startY, 0).tex(sprite.getMaxU(), sprite.getMinV()).endVertex();
tess.draw();
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if (!(recipeWrapper instanceof ElvenTradeRecipeWrapper))
return;
ElvenTradeRecipeWrapper wrapper = ((ElvenTradeRecipeWrapper) recipeWrapper);
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if(!(recipeWrapper instanceof ElvenTradeRecipeWrapper))
return;
ElvenTradeRecipeWrapper wrapper = ((ElvenTradeRecipeWrapper) recipeWrapper);
int index = 0, posX = 42;
for (Object o : wrapper.getInputs()) {
recipeLayout.getItemStacks().init(index, true, posX, 0);
if (o instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) o));
} else {
recipeLayout.getItemStacks().set(index, ((ItemStack) o));
}
index++;
posX += 18;
}
int index = 0, posX = 42;
for(Object o : wrapper.getInputs()) {
recipeLayout.getItemStacks().init(index, true, posX, 0);
if(o instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) o));
} else {
recipeLayout.getItemStacks().set(index, ((ItemStack) o));
}
index++;
posX += 18;
}
recipeLayout.getItemStacks().init(index, false, 93, 41);
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
}
recipeLayout.getItemStacks().init(index, false, 93, 41);
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -16,27 +16,27 @@ import javax.annotation.Nonnull;
public class ElvenTradeRecipeHandler implements IRecipeHandler<RecipeElvenTrade> {
@Nonnull
@Override
public Class<RecipeElvenTrade> getRecipeClass() {
return RecipeElvenTrade.class;
}
@Nonnull
@Override
public Class<RecipeElvenTrade> getRecipeClass() {
return RecipeElvenTrade.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.elvenTrade";
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.elvenTrade";
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeElvenTrade recipe) {
return new ElvenTradeRecipeWrapper(recipe);
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeElvenTrade recipe) {
return new ElvenTradeRecipeWrapper(recipe);
}
@Override
public boolean isRecipeValid(@Nonnull RecipeElvenTrade recipe) {
return true;
}
@Override
public boolean isRecipeValid(@Nonnull RecipeElvenTrade recipe) {
return true;
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -21,47 +21,49 @@ import java.util.List;
public class ElvenTradeRecipeWrapper implements IRecipeWrapper {
private final List input;
private final ItemStack output;
private final List input;
private final ItemStack output;
public ElvenTradeRecipeWrapper(RecipeElvenTrade recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
for (Object o : recipe.getInputs()) {
if (o instanceof ItemStack) {
builder.add(o);
}
if (o instanceof String) {
builder.add(OreDictionary.getOres(((String) o)));
}
}
input = builder.build();
output = recipe.getOutput();
}
public ElvenTradeRecipeWrapper(RecipeElvenTrade recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
for(Object o : recipe.getInputs()) {
if(o instanceof ItemStack) {
builder.add(o);
}
if(o instanceof String) {
builder.add(OreDictionary.getOres(((String) o)));
}
}
input = builder.build();
output = recipe.getOutput();
}
@Override
public List getInputs() {
return input;
}
@Override
public List getInputs() {
return input;
}
@Override
public List<ItemStack> getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<ItemStack> getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -25,81 +25,82 @@ import java.util.Collection;
public class ManaPoolRecipeCategory implements IRecipeCategory {
private final IDrawable background;
private final String localizedName;
private final IDrawable overlay;
private final IDrawable background;
private final String localizedName;
private final IDrawable overlay;
public ManaPoolRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(168, 64);
localizedName = StatCollector.translateToLocal("botania.nei.manaPool");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
0, 0, 64, 46);
}
public ManaPoolRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(168, 64);
localizedName = StatCollector.translateToLocal("botania.nei.manaPool");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
0, 0, 64, 46);
}
@Nonnull
@Override
public String getUid() {
return "botania.manaPool";
}
@Nonnull
@Override
public String getUid() {
return "botania.manaPool";
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft, 48, 0);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft, 48, 0);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawAnimations(Minecraft minecraft) {}
@Override
public void drawAnimations(Minecraft minecraft) {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if (!(recipeWrapper instanceof ManaPoolRecipeWrapper))
return;
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if(!(recipeWrapper instanceof ManaPoolRecipeWrapper))
return;
ManaPoolRecipeWrapper wrapper = ((ManaPoolRecipeWrapper) recipeWrapper);
int index = 0;
ManaPoolRecipeWrapper wrapper = ((ManaPoolRecipeWrapper) recipeWrapper);
int index = 0;
recipeLayout.getItemStacks().init(index, true, 40, 12);
if (wrapper.getInputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) wrapper.getInputs().get(0)));
} else {
recipeLayout.getItemStacks().set(index, ((ItemStack) wrapper.getInputs().get(0)));
}
recipeLayout.getItemStacks().init(index, true, 40, 12);
if(wrapper.getInputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) wrapper.getInputs().get(0)));
} else {
recipeLayout.getItemStacks().set(index, ((ItemStack) wrapper.getInputs().get(0)));
}
index++;
index++;
if (wrapper.getInputs().size() > 1) {
// Has catalyst
recipeLayout.getItemStacks().init(index, true, 20, 12);
recipeLayout.getItemStacks().set(index, ((ItemStack) wrapper.getInputs().get(1)));
index++;
}
if(wrapper.getInputs().size() > 1) {
// Has catalyst
recipeLayout.getItemStacks().init(index, true, 20, 12);
recipeLayout.getItemStacks().set(index, ((ItemStack) wrapper.getInputs().get(1)));
index++;
}
recipeLayout.getItemStacks().init(index, true, 70, 12);
recipeLayout.getItemStacks().set(index, new ItemStack(ModBlocks.pool, 1, 0));
index++;
recipeLayout.getItemStacks().init(index, true, 70, 12);
recipeLayout.getItemStacks().set(index, new ItemStack(ModBlocks.pool, 1, 0));
index++;
recipeLayout.getItemStacks().init(index, false, 99, 12);
if (wrapper.getOutputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) wrapper.getOutputs().get(0)));
} else {
recipeLayout.getItemStacks().set(index, ((ItemStack) wrapper.getOutputs().get(0)));
}
}
recipeLayout.getItemStacks().init(index, false, 99, 12);
if(wrapper.getOutputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) wrapper.getOutputs().get(0)));
} else {
recipeLayout.getItemStacks().set(index, ((ItemStack) wrapper.getOutputs().get(0)));
}
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -16,27 +16,27 @@ import javax.annotation.Nonnull;
public class ManaPoolRecipeHandler implements IRecipeHandler<RecipeManaInfusion> {
@Nonnull
@Override
public Class<RecipeManaInfusion> getRecipeClass() {
return RecipeManaInfusion.class;
}
@Nonnull
@Override
public Class<RecipeManaInfusion> getRecipeClass() {
return RecipeManaInfusion.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.manaPool";
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.manaPool";
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeManaInfusion recipe) {
return new ManaPoolRecipeWrapper(recipe);
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeManaInfusion recipe) {
return new ManaPoolRecipeWrapper(recipe);
}
@Override
public boolean isRecipeValid(@Nonnull RecipeManaInfusion recipe) {
return recipe.getManaToConsume() <= 100000;
}
@Override
public boolean isRecipeValid(@Nonnull RecipeManaInfusion recipe) {
return recipe.getManaToConsume() <= 100000;
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -25,58 +25,59 @@ import java.util.List;
public class ManaPoolRecipeWrapper implements IRecipeWrapper {
private final List input;
private final ItemStack output;
private final int mana;
private final List input;
private final ItemStack output;
private final int mana;
public ManaPoolRecipeWrapper(RecipeManaInfusion recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
public ManaPoolRecipeWrapper(RecipeManaInfusion recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
if (recipe.getInput() instanceof ItemStack) {
builder.add(recipe.getInput());
} else if (recipe.getInput() instanceof String) {
builder.add(OreDictionary.getOres(((String) recipe.getInput())));
}
if(recipe.getInput() instanceof ItemStack) {
builder.add(recipe.getInput());
} else if(recipe.getInput() instanceof String) {
builder.add(OreDictionary.getOres(((String) recipe.getInput())));
}
if (recipe.isAlchemy()) {
builder.add(new ItemStack(ModBlocks.alchemyCatalyst));
} else if (recipe.isConjuration()) {
builder.add(new ItemStack(ModBlocks.conjurationCatalyst));
}
if(recipe.isAlchemy()) {
builder.add(new ItemStack(ModBlocks.alchemyCatalyst));
} else if(recipe.isConjuration()) {
builder.add(new ItemStack(ModBlocks.conjurationCatalyst));
}
input = builder.build();
output = recipe.getOutput();
mana = recipe.getManaToConsume();
}
input = builder.build();
output = recipe.getOutput();
mana = recipe.getManaToConsume();
}
@Override
public List getInputs() {
return input;
}
@Override
public List getInputs() {
return input;
}
@Override
public List getOutputs() {
return ImmutableList.of(output);
}
@Override
public List getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
GlStateManager.enableAlpha();
HUDHandler.renderManaBar(28, 50, 0x0000FF, 0.75F, mana, TilePool.MAX_MANA / 10);
GlStateManager.disableAlpha();
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
GlStateManager.enableAlpha();
HUDHandler.renderManaBar(28, 50, 0x0000FF, 0.75F, mana, TilePool.MAX_MANA / 10);
GlStateManager.disableAlpha();
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -27,81 +27,82 @@ import java.util.Collection;
public class PetalApothecaryRecipeCategory implements IRecipeCategory {
private final IDrawableStatic background;
private final String localizedName;
private final IDrawableStatic overlay;
private final IDrawableStatic background;
private final String localizedName;
private final IDrawableStatic overlay;
public PetalApothecaryRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(150, 110);
localizedName = StatCollector.translateToLocal("botania.nei.petalApothecary");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/petalOverlay.png"),
0, 0, 150, 110);
}
public PetalApothecaryRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(150, 110);
localizedName = StatCollector.translateToLocal("botania.nei.petalApothecary");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/petalOverlay.png"),
0, 0, 150, 110);
}
@Nonnull
@Override
public String getUid() {
return "botania.petals";
}
@Nonnull
@Override
public String getUid() {
return "botania.petals";
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawAnimations(Minecraft minecraft) {}
@Override
public void drawAnimations(Minecraft minecraft) {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if (!(recipeWrapper instanceof PetalApothecaryRecipeWrapper))
return;
PetalApothecaryRecipeWrapper wrapper = ((PetalApothecaryRecipeWrapper) recipeWrapper);
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if(!(recipeWrapper instanceof PetalApothecaryRecipeWrapper))
return;
PetalApothecaryRecipeWrapper wrapper = ((PetalApothecaryRecipeWrapper) recipeWrapper);
recipeLayout.getItemStacks().init(0, true, 64, 52);
recipeLayout.getItemStacks().set(0, new ItemStack(ModBlocks.altar));
recipeLayout.getItemStacks().init(0, true, 64, 52);
recipeLayout.getItemStacks().set(0, new ItemStack(ModBlocks.altar));
int index = 1;
double angleBetweenEach = 360.0 / wrapper.getInputs().size();
Point point = new Point(64, 20), center = new Point(64, 52);
int index = 1;
double angleBetweenEach = 360.0 / wrapper.getInputs().size();
Point point = new Point(64, 20), center = new Point(64, 52);
for (Object o : wrapper.getInputs()) {
recipeLayout.getItemStacks().init(index, true, point.x, point.y);
if (o instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) o));
}
if (o instanceof ItemStack) {
recipeLayout.getItemStacks().set(index, ((ItemStack) o));
}
index += 1;
point = rotatePointAbout(point, center, angleBetweenEach);
}
for(Object o : wrapper.getInputs()) {
recipeLayout.getItemStacks().init(index, true, point.x, point.y);
if(o instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) o));
}
if(o instanceof ItemStack) {
recipeLayout.getItemStacks().set(index, ((ItemStack) o));
}
index += 1;
point = rotatePointAbout(point, center, angleBetweenEach);
}
recipeLayout.getItemStacks().init(index, false, 103, 17);
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
}
recipeLayout.getItemStacks().init(index, false, 103, 17);
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
}
private Point rotatePointAbout(Point in, Point about, double degrees) {
double rad = degrees * Math.PI / 180.0;
double newX = Math.cos(rad) * (in.x - about.x) - Math.sin(rad) * (in.y - about.y) + about.x;
double newY = Math.sin(rad) * (in.x - about.x) + Math.cos(rad) * (in.y - about.y) + about.y;
return new Point(((int) newX), ((int) newY));
}
private Point rotatePointAbout(Point in, Point about, double degrees) {
double rad = degrees * Math.PI / 180.0;
double newX = Math.cos(rad) * (in.x - about.x) - Math.sin(rad) * (in.y - about.y) + about.x;
double newY = Math.sin(rad) * (in.x - about.x) + Math.cos(rad) * (in.y - about.y) + about.y;
return new Point(((int) newX), ((int) newY));
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -16,27 +16,27 @@ import javax.annotation.Nonnull;
public class PetalApothecaryRecipeHandler implements IRecipeHandler<RecipePetals> {
@Nonnull
@Override
public Class<RecipePetals> getRecipeClass() {
return RecipePetals.class;
}
@Nonnull
@Override
public Class<RecipePetals> getRecipeClass() {
return RecipePetals.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.petals";
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.petals";
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipePetals recipe) {
return new PetalApothecaryRecipeWrapper(recipe);
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipePetals recipe) {
return new PetalApothecaryRecipeWrapper(recipe);
}
@Override
public boolean isRecipeValid(@Nonnull RecipePetals recipe) {
return recipe.getInputs().size() <= 16;
}
@Override
public boolean isRecipeValid(@Nonnull RecipePetals recipe) {
return recipe.getInputs().size() <= 16;
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -21,47 +21,49 @@ import java.util.List;
public class PetalApothecaryRecipeWrapper implements IRecipeWrapper {
private final List input;
private final ItemStack output;
private final List input;
private final ItemStack output;
public PetalApothecaryRecipeWrapper(RecipePetals recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
for (Object o : recipe.getInputs()) {
if (o instanceof ItemStack) {
builder.add(o);
}
if (o instanceof String) {
builder.add(OreDictionary.getOres(((String) o)));
}
}
input = builder.build();
output = recipe.getOutput();
}
public PetalApothecaryRecipeWrapper(RecipePetals recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
for(Object o : recipe.getInputs()) {
if(o instanceof ItemStack) {
builder.add(o);
}
if(o instanceof String) {
builder.add(OreDictionary.getOres(((String) o)));
}
}
input = builder.build();
output = recipe.getOutput();
}
@Override
public List getInputs() {
return input;
}
@Override
public List getInputs() {
return input;
}
@Override
public List<ItemStack> getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<ItemStack> getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -26,83 +26,84 @@ import java.util.Collection;
public class PureDaisyRecipeCategory implements IRecipeCategory {
private final IDrawable background;
private final String localizedName;
private final IDrawable overlay;
private final IDrawable background;
private final String localizedName;
private final IDrawable overlay;
public PureDaisyRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(168, 64);
localizedName = StatCollector.translateToLocal("botania.nei.pureDaisy");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
0, 0, 64, 46);
}
public PureDaisyRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(168, 64);
localizedName = StatCollector.translateToLocal("botania.nei.pureDaisy");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
0, 0, 64, 46);
}
@Nonnull
@Override
public String getUid() {
return "botania.pureDaisy";
}
@Nonnull
@Override
public String getUid() {
return "botania.pureDaisy";
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft, 48, 0);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft, 48, 0);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawAnimations(Minecraft minecraft) {}
@Override
public void drawAnimations(Minecraft minecraft) {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if (!(recipeWrapper instanceof PureDaisyRecipeWrapper))
return;
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if(!(recipeWrapper instanceof PureDaisyRecipeWrapper))
return;
PureDaisyRecipeWrapper wrapper = ((PureDaisyRecipeWrapper) recipeWrapper);
boolean inputFluid = wrapper.getInputs().isEmpty();
boolean outputFluid = wrapper.getOutputs().isEmpty();
PureDaisyRecipeWrapper wrapper = ((PureDaisyRecipeWrapper) recipeWrapper);
boolean inputFluid = wrapper.getInputs().isEmpty();
boolean outputFluid = wrapper.getOutputs().isEmpty();
if (inputFluid) {
recipeLayout.getFluidStacks().init(0, true, 40, 12, 16, 16, 1000, false, null);
recipeLayout.getFluidStacks().set(0, wrapper.getFluidInputs().get(0));
} else {
recipeLayout.getItemStacks().init(0, true, 40, 12);
if (wrapper.getInputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(0, ((Collection<ItemStack>) wrapper.getInputs().get(0)));
} else {
recipeLayout.getItemStacks().set(0, ((ItemStack) wrapper.getInputs().get(0)));
}
}
if(inputFluid) {
recipeLayout.getFluidStacks().init(0, true, 40, 12, 16, 16, 1000, false, null);
recipeLayout.getFluidStacks().set(0, wrapper.getFluidInputs().get(0));
} else {
recipeLayout.getItemStacks().init(0, true, 40, 12);
if(wrapper.getInputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(0, ((Collection<ItemStack>) wrapper.getInputs().get(0)));
} else {
recipeLayout.getItemStacks().set(0, ((ItemStack) wrapper.getInputs().get(0)));
}
}
recipeLayout.getItemStacks().init(1, true, 70, 12);
recipeLayout.getItemStacks().set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY));
recipeLayout.getItemStacks().init(1, true, 70, 12);
recipeLayout.getItemStacks().set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY));
if (outputFluid) {
recipeLayout.getFluidStacks().init(2, false, 99, 12, 16, 16, 1000, false, null);
recipeLayout.getFluidStacks().set(2, wrapper.getFluidOutputs().get(0));
} else {
recipeLayout.getItemStacks().init(2, false, 99, 12);
if (wrapper.getOutputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(2, ((Collection<ItemStack>) wrapper.getOutputs().get(0)));
} else {
recipeLayout.getItemStacks().set(2, ((ItemStack) wrapper.getOutputs().get(0)));
}
}
}
if(outputFluid) {
recipeLayout.getFluidStacks().init(2, false, 99, 12, 16, 16, 1000, false, null);
recipeLayout.getFluidStacks().set(2, wrapper.getFluidOutputs().get(0));
} else {
recipeLayout.getItemStacks().init(2, false, 99, 12);
if(wrapper.getOutputs().get(0) instanceof Collection) {
recipeLayout.getItemStacks().set(2, ((Collection<ItemStack>) wrapper.getOutputs().get(0)));
} else {
recipeLayout.getItemStacks().set(2, ((ItemStack) wrapper.getOutputs().get(0)));
}
}
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -16,27 +16,27 @@ import javax.annotation.Nonnull;
public class PureDaisyRecipeHandler implements IRecipeHandler<RecipePureDaisy> {
@Nonnull
@Override
public Class<RecipePureDaisy> getRecipeClass() {
return RecipePureDaisy.class;
}
@Nonnull
@Override
public Class<RecipePureDaisy> getRecipeClass() {
return RecipePureDaisy.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.pureDaisy";
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.pureDaisy";
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipePureDaisy recipe) {
return new PureDaisyRecipeWrapper(recipe);
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipePureDaisy recipe) {
return new PureDaisyRecipeWrapper(recipe);
}
@Override
public boolean isRecipeValid(@Nonnull RecipePureDaisy recipe) {
return true;
}
@Override
public boolean isRecipeValid(@Nonnull RecipePureDaisy recipe) {
return true;
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -23,55 +23,57 @@ import java.util.List;
public class PureDaisyRecipeWrapper implements IRecipeWrapper {
private List inputs = ImmutableList.of();
private List outputs = ImmutableList.of();
private List<FluidStack> fluidInputs = ImmutableList.of();
private List<FluidStack> fluidOutputs = ImmutableList.of();
private List inputs = ImmutableList.of();
private List outputs = ImmutableList.of();
private List<FluidStack> fluidInputs = ImmutableList.of();
private List<FluidStack> fluidOutputs = ImmutableList.of();
public PureDaisyRecipeWrapper(RecipePureDaisy recipe) {
if (recipe.getInput() instanceof String) {
inputs = ImmutableList.of(OreDictionary.getOres(((String) recipe.getInput())));
} else if (recipe.getInput() instanceof Block) {
Block b = ((Block) recipe.getInput());
if (FluidRegistry.lookupFluidForBlock(b) != null) {
fluidInputs = ImmutableList.of(new FluidStack(FluidRegistry.lookupFluidForBlock(b), 1000));
} else {
inputs = ImmutableList.of(new ItemStack(b, 1, b.getMetaFromState(b.getDefaultState())));
}
}
public PureDaisyRecipeWrapper(RecipePureDaisy recipe) {
if(recipe.getInput() instanceof String) {
inputs = ImmutableList.of(OreDictionary.getOres(((String) recipe.getInput())));
} else if(recipe.getInput() instanceof Block) {
Block b = ((Block) recipe.getInput());
if(FluidRegistry.lookupFluidForBlock(b) != null) {
fluidInputs = ImmutableList.of(new FluidStack(FluidRegistry.lookupFluidForBlock(b), 1000));
} else {
inputs = ImmutableList.of(new ItemStack(b, 1, b.getMetaFromState(b.getDefaultState())));
}
}
Block outBlock = recipe.getOutputState().getBlock();
if (FluidRegistry.lookupFluidForBlock(outBlock) != null) {
fluidOutputs = ImmutableList.of(new FluidStack(FluidRegistry.lookupFluidForBlock(outBlock), 1000));
} else {
outputs = ImmutableList.of(new ItemStack(outBlock, 1, outBlock.getMetaFromState(recipe.getOutputState())));
}
}
Block outBlock = recipe.getOutputState().getBlock();
if(FluidRegistry.lookupFluidForBlock(outBlock) != null) {
fluidOutputs = ImmutableList.of(new FluidStack(FluidRegistry.lookupFluidForBlock(outBlock), 1000));
} else {
outputs = ImmutableList.of(new ItemStack(outBlock, 1, outBlock.getMetaFromState(recipe.getOutputState())));
}
}
@Override
public List getInputs() {
return inputs;
}
@Override
public List getInputs() {
return inputs;
}
@Override
public List getOutputs() {
return outputs;
}
@Override
public List getOutputs() {
return outputs;
}
@Override
public List<FluidStack> getFluidInputs() {
return fluidInputs;
}
@Override
public List<FluidStack> getFluidInputs() {
return fluidInputs;
}
@Override
public List<FluidStack> getFluidOutputs() {
return fluidOutputs;
}
@Override
public List<FluidStack> getFluidOutputs() {
return fluidOutputs;
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -26,81 +26,82 @@ import java.util.Collection;
public class RunicAltarRecipeCategory implements IRecipeCategory {
private final IDrawable background;
private final String localizedName;
private final IDrawable overlay;
private final IDrawable background;
private final String localizedName;
private final IDrawable overlay;
public RunicAltarRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(150, 110);
localizedName = StatCollector.translateToLocal("botania.nei.runicAltar");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/petalOverlay.png"),
0, 0, 150, 110);
}
public RunicAltarRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(150, 110);
localizedName = StatCollector.translateToLocal("botania.nei.runicAltar");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/petalOverlay.png"),
0, 0, 150, 110);
}
@Nonnull
@Override
public String getUid() {
return "botania.runicAltar";
}
@Nonnull
@Override
public String getUid() {
return "botania.runicAltar";
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawExtras(Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Override
public void drawAnimations(Minecraft minecraft) {}
@Override
public void drawAnimations(Minecraft minecraft) {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if (!(recipeWrapper instanceof RunicAltarRecipeWrapper))
return;
RunicAltarRecipeWrapper wrapper = ((RunicAltarRecipeWrapper) recipeWrapper);
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
if(!(recipeWrapper instanceof RunicAltarRecipeWrapper))
return;
RunicAltarRecipeWrapper wrapper = ((RunicAltarRecipeWrapper) recipeWrapper);
recipeLayout.getItemStacks().init(0, true, 64, 52);
recipeLayout.getItemStacks().set(0, new ItemStack(ModBlocks.runeAltar));
recipeLayout.getItemStacks().init(0, true, 64, 52);
recipeLayout.getItemStacks().set(0, new ItemStack(ModBlocks.runeAltar));
int index = 1;
double angleBetweenEach = 360.0 / wrapper.getInputs().size();
Point point = new Point(64, 20), center = new Point(64, 52);
int index = 1;
double angleBetweenEach = 360.0 / wrapper.getInputs().size();
Point point = new Point(64, 20), center = new Point(64, 52);
for (Object o : wrapper.getInputs()) {
recipeLayout.getItemStacks().init(index, true, point.x, point.y);
if (o instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) o));
}
if (o instanceof ItemStack) {
recipeLayout.getItemStacks().set(index, ((ItemStack) o));
}
index += 1;
point = rotatePointAbout(point, center, angleBetweenEach);
}
for(Object o : wrapper.getInputs()) {
recipeLayout.getItemStacks().init(index, true, point.x, point.y);
if(o instanceof Collection) {
recipeLayout.getItemStacks().set(index, ((Collection<ItemStack>) o));
}
if(o instanceof ItemStack) {
recipeLayout.getItemStacks().set(index, ((ItemStack) o));
}
index += 1;
point = rotatePointAbout(point, center, angleBetweenEach);
}
recipeLayout.getItemStacks().init(index, false, 103, 17);
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
}
recipeLayout.getItemStacks().init(index, false, 103, 17);
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
}
private Point rotatePointAbout(Point in, Point about, double degrees) {
double rad = degrees * Math.PI / 180.0;
double newX = Math.cos(rad) * (in.x - about.x) - Math.sin(rad) * (in.y - about.y) + about.x;
double newY = Math.sin(rad) * (in.x - about.x) + Math.cos(rad) * (in.y - about.y) + about.y;
return new Point(((int) newX), ((int) newY));
}
private Point rotatePointAbout(Point in, Point about, double degrees) {
double rad = degrees * Math.PI / 180.0;
double newX = Math.cos(rad) * (in.x - about.x) - Math.sin(rad) * (in.y - about.y) + about.x;
double newY = Math.sin(rad) * (in.x - about.x) + Math.cos(rad) * (in.y - about.y) + about.y;
return new Point(((int) newX), ((int) newY));
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -16,27 +16,27 @@ import javax.annotation.Nonnull;
public class RunicAltarRecipeHandler implements IRecipeHandler<RecipeRuneAltar> {
@Nonnull
@Override
public Class<RecipeRuneAltar> getRecipeClass() {
return RecipeRuneAltar.class;
}
@Nonnull
@Override
public Class<RecipeRuneAltar> getRecipeClass() {
return RecipeRuneAltar.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.runicAltar";
}
@Nonnull
@Override
public String getRecipeCategoryUid() {
return "botania.runicAltar";
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeRuneAltar recipe) {
return new RunicAltarRecipeWrapper(recipe);
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RecipeRuneAltar recipe) {
return new RunicAltarRecipeWrapper(recipe);
}
@Override
public boolean isRecipeValid(@Nonnull RecipeRuneAltar recipe) {
return recipe.getInputs().size() <= 16;
}
@Override
public boolean isRecipeValid(@Nonnull RecipeRuneAltar recipe) {
return recipe.getInputs().size() <= 16;
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -24,53 +24,54 @@ import java.util.List;
public class RunicAltarRecipeWrapper implements IRecipeWrapper {
private final List input;
private final ItemStack output;
private final int manaUsage;
private final List input;
private final ItemStack output;
private final int manaUsage;
public RunicAltarRecipeWrapper(RecipeRuneAltar recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
for (Object o : recipe.getInputs()) {
if (o instanceof ItemStack) {
builder.add(o);
}
if (o instanceof String) {
builder.add(OreDictionary.getOres(((String) o)));
}
}
input = builder.build();
output = recipe.getOutput();
manaUsage = recipe.getManaUsage();
}
public RunicAltarRecipeWrapper(RecipeRuneAltar recipe) {
ImmutableList.Builder builder = ImmutableList.builder();
for(Object o : recipe.getInputs()) {
if(o instanceof ItemStack) {
builder.add(o);
}
if(o instanceof String) {
builder.add(OreDictionary.getOres(((String) o)));
}
}
input = builder.build();
output = recipe.getOutput();
manaUsage = recipe.getManaUsage();
}
@Override
public List getInputs() {
return input;
}
@Override
public List getInputs() {
return input;
}
@Override
public List<ItemStack> getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<ItemStack> getOutputs() {
return ImmutableList.of(output);
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidInputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public List<FluidStack> getFluidOutputs() {
return ImmutableList.of();
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
GlStateManager.enableAlpha();
HUDHandler.renderManaBar(28, 113, 0x0000FF, 0.75F, manaUsage, TilePool.MAX_MANA / 10);
GlStateManager.disableAlpha();
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
GlStateManager.enableAlpha();
HUDHandler.renderManaBar(28, 113, 0x0000FF, 0.75F, manaUsage, TilePool.MAX_MANA / 10);
GlStateManager.disableAlpha();
}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {}
@Override
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -23,7 +23,6 @@ import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.client.resources.model.ModelManager;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.client.model.ISmartBlockModel;
@@ -35,10 +34,9 @@ import net.minecraftforge.client.model.pipeline.VertexTransformer;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.fml.common.FMLLog;
import vazkii.botania.api.BotaniaAPIClient;
import vazkii.botania.api.item.IFloatingFlower;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.decor.BlockFloatingFlower;
import vazkii.botania.api.item.IFloatingFlower;
import vazkii.botania.common.item.block.ItemBlockFloatingSpecialFlower;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
@@ -49,163 +47,203 @@ import java.util.stream.Collectors;
public class FloatingFlowerModel implements ISmartItemModel, ISmartBlockModel, IResourceManagerReloadListener {
public static final FloatingFlowerModel INSTANCE = new FloatingFlowerModel();
public static final FloatingFlowerModel INSTANCE = new FloatingFlowerModel();
private static final String MUNDANE_PREFIX = "botania:shimmeringFlower_";
private static Table<IFloatingFlower.IslandType, String, CompositeBakedModel> CACHE = HashBasedTable.create();
private static Table<IFloatingFlower.IslandType, String, CompositeBakedModel> CACHE = HashBasedTable.create();
protected static BakedQuad transform(BakedQuad quad, final TRSRTransformation transform) {
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(DefaultVertexFormats.ITEM);
final IVertexConsumer consumer = new VertexTransformer(builder) {
@Override
public void put(int element, float... data) {
VertexFormatElement formatElement = DefaultVertexFormats.ITEM.getElement(element);
switch(formatElement.getUsage()) {
case POSITION: {
float[] newData = new float[4];
Vector4f vec = new Vector4f(data);
transform.getMatrix().transform(vec);
vec.get(newData);
parent.put(element, newData);
break;
}
default: {
parent.put(element, data);
break;
}
}
}
};
quad.pipe(consumer);
return builder.build();
}
private static final String MUNDANE_PREFIX = "botania:shimmeringFlower_";
@Override
public void onResourceManagerReload(IResourceManager resourceManager) {
CACHE.clear();
}
@Override
public void onResourceManagerReload(IResourceManager resourceManager) {
CACHE.clear();
}
@Override
public IBakedModel handleItemState(ItemStack stack) {
// Items always have GRASS island
IFloatingFlower.IslandType islandType = IFloatingFlower.IslandType.GRASS;
String identifier;
@Override
public IBakedModel handleItemState(ItemStack stack) {
// Items always have GRASS island
IFloatingFlower.IslandType islandType = IFloatingFlower.IslandType.GRASS;
String identifier;
if(Block.getBlockFromItem(stack.getItem()) == ModBlocks.floatingSpecialFlower) {
// Magic flower
identifier = ItemBlockFloatingSpecialFlower.getType(stack);
} else {
// Mundane flower
identifier = MUNDANE_PREFIX + stack.getItemDamage();
}
if (Block.getBlockFromItem(stack.getItem()) == ModBlocks.floatingSpecialFlower) {
// Magic flower
identifier = ItemBlockFloatingSpecialFlower.getType(stack);
} else {
// Mundane flower
identifier = MUNDANE_PREFIX + stack.getItemDamage();
}
return getModel(islandType, identifier);
}
return getModel(islandType, identifier);
}
@Override
public IBakedModel handleBlockState(IBlockState state) {
if(state.getBlock() != ModBlocks.floatingSpecialFlower && state.getBlock() != ModBlocks.floatingFlower)
return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
IExtendedBlockState realState = ((IExtendedBlockState) state);
IFloatingFlower.IslandType islandType = realState.getValue(BotaniaStateProps.ISLAND_TYPE);
String identifier;
@Override
public IBakedModel handleBlockState(IBlockState state) {
if (state.getBlock() != ModBlocks.floatingSpecialFlower && state.getBlock() != ModBlocks.floatingFlower)
return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
IExtendedBlockState realState = ((IExtendedBlockState) state);
IFloatingFlower.IslandType islandType = realState.getValue(BotaniaStateProps.ISLAND_TYPE);
String identifier;
if(state.getBlock() == ModBlocks.floatingSpecialFlower) {
// Magic flower
identifier = realState.getValue(BotaniaStateProps.SUBTILE_ID);
} else {
// Mundane flower
identifier = MUNDANE_PREFIX + state.getValue(BotaniaStateProps.COLOR).getMetadata();
}
if (state.getBlock() == ModBlocks.floatingSpecialFlower) {
// Magic flower
identifier = realState.getValue(BotaniaStateProps.SUBTILE_ID);
} else {
// Mundane flower
identifier = MUNDANE_PREFIX + state.getValue(BotaniaStateProps.COLOR).getMetadata();
}
return getModel(islandType, identifier);
}
return getModel(islandType, identifier);
}
// Get the model for this islandtype + flower type combination. If it's not cached already, generate it.
private CompositeBakedModel getModel(IFloatingFlower.IslandType islandType, String identifier) {
ModelManager modelManager = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager();
// Get the model for this islandtype + flower type combination. If it's not cached already, generate it.
private CompositeBakedModel getModel(IFloatingFlower.IslandType islandType, String identifier) {
ModelManager modelManager = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager();
if(CACHE.contains(islandType, identifier)) {
return CACHE.get(islandType, identifier);
} else {
IBakedModel islandModel = modelManager.getModel(BotaniaAPIClient.getRegisteredIslandTypeModels().get(islandType));
IBakedModel flowerModel;
if (CACHE.contains(islandType, identifier)) {
return CACHE.get(islandType, identifier);
} else {
IBakedModel islandModel = modelManager.getModel(BotaniaAPIClient.getRegisteredIslandTypeModels().get(islandType));
IBakedModel flowerModel;
if(identifier.startsWith(MUNDANE_PREFIX)) {
int meta = Integer.parseInt(identifier.substring(identifier.indexOf(MUNDANE_PREFIX) + MUNDANE_PREFIX.length()));
flowerModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(new ItemStack(ModBlocks.shinyFlower, 1, meta));
} else {
flowerModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(ItemBlockSpecialFlower.ofType(identifier));
}
if (identifier.startsWith(MUNDANE_PREFIX)) {
int meta = Integer.parseInt(identifier.substring(identifier.indexOf(MUNDANE_PREFIX) + MUNDANE_PREFIX.length()));
flowerModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(new ItemStack(ModBlocks.shinyFlower, 1, meta));
} else {
flowerModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(ItemBlockSpecialFlower.ofType(identifier));
}
// Enhance!
CompositeBakedModel model = new CompositeBakedModel(flowerModel, islandModel);
FMLLog.info("[Botania]: Cached floating flower model for islandtpye %s and flowertype %s", islandType, identifier);
CACHE.put(islandType, identifier, model);
return model;
}
}
// Enhance!
CompositeBakedModel model = new CompositeBakedModel(flowerModel, islandModel);
FMLLog.info("[Botania]: Cached floating flower model for islandtpye %s and flowertype %s", islandType, identifier);
CACHE.put(islandType, identifier, model);
return model;
}
}
// Dummy results
@Override
public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) {
return ImmutableList.of();
}
protected static BakedQuad transform(BakedQuad quad, final TRSRTransformation transform) {
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(DefaultVertexFormats.ITEM);
final IVertexConsumer consumer = new VertexTransformer(builder) {
@Override
public void put(int element, float... data) {
VertexFormatElement formatElement = DefaultVertexFormats.ITEM.getElement(element);
switch (formatElement.getUsage()) {
case POSITION: {
float[] newData = new float[4];
Vector4f vec = new Vector4f(data);
transform.getMatrix().transform(vec);
vec.get(newData);
parent.put(element, newData);
break;
}
default: {
parent.put(element, data);
break;
}
}
}
};
quad.pipe(consumer);
return builder.build();
}
@Override
public List<BakedQuad> getGeneralQuads() {
return ImmutableList.of();
}
private static class CompositeBakedModel implements IBakedModel {
@Override
public boolean isAmbientOcclusion() {
return false;
}
private final IBakedModel base;
private final List<BakedQuad> genQuads;
@Override
public boolean isGui3d() {
return true;
}
public CompositeBakedModel(IBakedModel flower, IBakedModel island) {
this.base = flower;
@Override
public boolean isBuiltInRenderer() {
return false;
}
ImmutableList.Builder<BakedQuad> genBuilder = ImmutableList.builder();
final TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0F, 0.2F, 0F), null, new Vector3f(0.5F, 0.5F, 0.5F), null));
@Override
public TextureAtlasSprite getParticleTexture() {
return null;
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return ItemCameraTransforms.DEFAULT;
}
private static class CompositeBakedModel implements IBakedModel {
private final IBakedModel base;
private final List<BakedQuad> genQuads;
public CompositeBakedModel(IBakedModel flower, IBakedModel island) {
this.base = flower;
ImmutableList.Builder<BakedQuad> genBuilder = ImmutableList.builder();
final TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0F, 0.2F, 0F), null, new Vector3f(0.5F, 0.5F, 0.5F), null));
// Add flower quads, scaled and translated
for (BakedQuad quad : flower.getGeneralQuads()) {
genBuilder.add(transform(quad, transform));
}
// Add flower quads, scaled and translated
for(BakedQuad quad : flower.getGeneralQuads()) {
genBuilder.add(transform(quad, transform));
}
for (EnumFacing e : EnumFacing.VALUES) {
genBuilder.addAll(flower.getFaceQuads(e).stream().map(input -> transform(input, transform)).collect(Collectors.toList()));
}
for(EnumFacing e : EnumFacing.VALUES) {
genBuilder.addAll(flower.getFaceQuads(e).stream().map(input -> transform(input, transform)).collect(Collectors.toList()));
}
// Add island quads
genBuilder.addAll(island.getGeneralQuads());
for (EnumFacing e: EnumFacing.VALUES) {
genBuilder.addAll(island.getFaceQuads(e));
}
// Add island quads
genBuilder.addAll(island.getGeneralQuads());
for(EnumFacing e : EnumFacing.VALUES) {
genBuilder.addAll(island.getFaceQuads(e));
}
genQuads = genBuilder.build();
}
genQuads = genBuilder.build();
}
// Forward all to flower model
@Override public List<BakedQuad> getGeneralQuads() {
return genQuads;
}
@Override public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) { return ImmutableList.of(); }
@Override public boolean isAmbientOcclusion() {
return base.isAmbientOcclusion();
}
@Override public boolean isGui3d() {
return true;
}
@Override public boolean isBuiltInRenderer() {
return base.isBuiltInRenderer();
}
@Override public TextureAtlasSprite getParticleTexture() {
return base.getParticleTexture();
}
@Override public ItemCameraTransforms getItemCameraTransforms() {
return base.getItemCameraTransforms();
}
}
// Forward all to flower model
@Override
public List<BakedQuad> getGeneralQuads() {
return genQuads;
}
// Dummy results
@Override public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) { return ImmutableList.of(); }
@Override public List<BakedQuad> getGeneralQuads() { return ImmutableList.of(); }
@Override public boolean isAmbientOcclusion() { return false; }
@Override public boolean isGui3d() { return true; }
@Override public boolean isBuiltInRenderer() { return false; }
@Override public TextureAtlasSprite getParticleTexture() { return null; }
@Override public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; }
@Override
public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) {
return ImmutableList.of();
}
@Override
public boolean isAmbientOcclusion() {
return base.isAmbientOcclusion();
}
@Override
public boolean isGui3d() {
return true;
}
@Override
public boolean isBuiltInRenderer() {
return base.isBuiltInRenderer();
}
@Override
public TextureAtlasSprite getParticleTexture() {
return base.getParticleTexture();
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return base.getItemCameraTransforms();
}
}
}
@@ -2,10 +2,10 @@
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* <p>
* File Created @ [Apr 1, 2014, 6:21:48 PM (GMT)]
*/
package vazkii.botania.client.model;
@@ -38,23 +38,17 @@ import java.util.Set;
public class ModelPylon implements IPylonModel {
private static final Function<ResourceLocation, TextureAtlasSprite> TEXTUREGETTER = input -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(input.toString());
private IFlexibleBakedModel manaCrystal;
private IFlexibleBakedModel manaRingsAndPanes;
private IFlexibleBakedModel manaGems;
private IFlexibleBakedModel naturaCrystal;
private IFlexibleBakedModel naturaRingsAndPanes;
private IFlexibleBakedModel naturaGems;
private IFlexibleBakedModel gaiaCrystal;
private IFlexibleBakedModel gaiaRingsAndPanes;
private IFlexibleBakedModel gaiaGems;
private static final Function<ResourceLocation, TextureAtlasSprite> TEXTUREGETTER = input -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(input.toString());
private static final Set<String> GROUP_NAMES = ImmutableSet.of("Crystal", "Crystal_Ring", "Ring_Panel01", "Ring_Panel02",
"Ring_Panel03", "Ring_Panel04", "Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04");
public ModelPylon() {
try {
// Load the OBJ
@@ -82,27 +76,39 @@ public class ModelPylon implements IPylonModel {
manaGems = manaModel.bake(new OBJModel.OBJState(ImmutableList.of("Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER);
naturaGems = naturaModel.bake(new OBJModel.OBJState(ImmutableList.of("Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER);
gaiaGems = gaiaModel.bake(new OBJModel.OBJState(ImmutableList.of("Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER);
} catch (IOException e) {
} catch(IOException e) {
throw new ReportedException(new CrashReport("Error making pylon submodels for TESR!", e));
}
}
@Override
public void renderCrystal(PylonVariant variant) {
switch (variant) {
case MANA: renderModel(manaCrystal); break;
case NATURA: renderModel(naturaCrystal); break;
case GAIA: renderModel(gaiaCrystal); break;
switch(variant) {
case MANA:
renderModel(manaCrystal);
break;
case NATURA:
renderModel(naturaCrystal);
break;
case GAIA:
renderModel(gaiaCrystal);
break;
}
}
@Override
public void renderRing(PylonVariant variant) {
GlStateManager.disableLighting();
switch (variant) {
case MANA: renderModel(manaRingsAndPanes); break;
case NATURA: renderModel(naturaRingsAndPanes); break;
case GAIA: renderModel(gaiaRingsAndPanes); break;
switch(variant) {
case MANA:
renderModel(manaRingsAndPanes);
break;
case NATURA:
renderModel(naturaRingsAndPanes);
break;
case GAIA:
renderModel(gaiaRingsAndPanes);
break;
}
GlStateManager.enableLighting();
}
@@ -110,21 +116,25 @@ public class ModelPylon implements IPylonModel {
@Override
public void renderGems(PylonVariant variant) {
GlStateManager.disableLighting();
switch (variant) {
case MANA: renderModel(manaGems); break;
case NATURA: renderModel(naturaGems); break;
case GAIA: renderModel(gaiaGems); break;
switch(variant) {
case MANA:
renderModel(manaGems);
break;
case NATURA:
renderModel(naturaGems);
break;
case GAIA:
renderModel(gaiaGems);
break;
}
GlStateManager.enableLighting();
}
private void renderModel(IFlexibleBakedModel model)
{
private void renderModel(IFlexibleBakedModel model) {
renderModel(model, -1);
}
private void renderModel(IFlexibleBakedModel model, int color)
{
private void renderModel(IFlexibleBakedModel model, int color) {
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(GL11.GL_QUADS, model.getFormat());
@@ -133,9 +143,8 @@ public class ModelPylon implements IPylonModel {
tessellator.draw();
}
private void renderQuads(WorldRenderer renderer, List<BakedQuad> quads, int color)
{
for (BakedQuad bakedquad : quads)
private void renderQuads(WorldRenderer renderer, List<BakedQuad> quads, int color) {
for(BakedQuad bakedquad : quads)
LightUtil.renderQuadColor(renderer, bakedquad, color);
}
@@ -2,11 +2,11 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.client.model;
package vazkii.botania.client.model;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.state.IBlockState;
@@ -27,39 +27,66 @@ import java.util.List;
public class PlatformModel implements ISmartBlockModel {
@Override
public IBakedModel handleBlockState(IBlockState state) {
EnumWorldBlockLayer layer = MinecraftForgeClient.getRenderLayer();
IBlockState heldState = ((IExtendedBlockState) state).getValue(BotaniaStateProps.HELD_STATE);
@Override
public IBakedModel handleBlockState(IBlockState state) {
EnumWorldBlockLayer layer = MinecraftForgeClient.getRenderLayer();
IBlockState heldState = ((IExtendedBlockState) state).getValue(BotaniaStateProps.HELD_STATE);
Minecraft mc = Minecraft.getMinecraft();
if (heldState == null && layer == EnumWorldBlockLayer.SOLID) {
// No camo
ModelResourceLocation path = new ModelResourceLocation("botania:platform", "variant=" + state.getValue(BotaniaStateProps.PLATFORM_VARIANT).getName());
return mc.getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getModel(path);
} else if (heldState != null){
if (heldState.getBlock().canRenderInLayer(layer)) {
// Steal camo's model
IBakedModel model = mc.getBlockRendererDispatcher().getBlockModelShapes().getModelForState(heldState);
Minecraft mc = Minecraft.getMinecraft();
if(heldState == null && layer == EnumWorldBlockLayer.SOLID) {
// No camo
ModelResourceLocation path = new ModelResourceLocation("botania:platform", "variant=" + state.getValue(BotaniaStateProps.PLATFORM_VARIANT).getName());
return mc.getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getModel(path);
} else if(heldState != null) {
if(heldState.getBlock().canRenderInLayer(layer)) {
// Steal camo's model
IBakedModel model = mc.getBlockRendererDispatcher().getBlockModelShapes().getModelForState(heldState);
if (model instanceof ISmartBlockModel) {
// Their model can be smart too
model = ((ISmartBlockModel) model).handleBlockState(heldState);
}
if(model instanceof ISmartBlockModel) {
// Their model can be smart too
model = ((ISmartBlockModel) model).handleBlockState(heldState);
}
return model;
}
}
return model;
}
}
return this; // This smart model has no quads as seen below, so nothing actually renders
}
return this; // This smart model has no quads as seen below, so nothing actually renders
}
@Override public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) { return ImmutableList.of(); }
@Override public List<BakedQuad> getGeneralQuads() { return ImmutableList.of(); }
@Override public boolean isAmbientOcclusion() { return true; }
@Override public boolean isGui3d() { return true;}
@Override public boolean isBuiltInRenderer() { return false; }
@Override public TextureAtlasSprite getParticleTexture() { return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("botania:blocks/livingwood0"); }
@Override public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; }
@Override
public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) {
return ImmutableList.of();
}
@Override
public List<BakedQuad> getGeneralQuads() {
return ImmutableList.of();
}
@Override
public boolean isAmbientOcclusion() {
return true;
}
@Override
public boolean isGui3d() {
return true;
}
@Override
public boolean isBuiltInRenderer() {
return false;
}
@Override
public TextureAtlasSprite getParticleTexture() {
return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("botania:blocks/livingwood0");
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return ItemCameraTransforms.DEFAULT;
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -40,95 +40,160 @@ import java.util.List;
public class PylonItemModel implements ISmartItemModel {
private IBakedModel mana;
private IBakedModel natura;
private IBakedModel gaia;
private boolean cached = false;
private IBakedModel mana;
private IBakedModel natura;
private IBakedModel gaia;
private boolean cached = false;
@Override
public IBakedModel handleItemState(ItemStack stack) {
if (!cached) {
cacheModels();
}
@Override
public IBakedModel handleItemState(ItemStack stack) {
if(!cached) {
cacheModels();
}
switch (stack.getItemDamage()) {
case 2: return gaia;
case 1: return natura;
case 0: return mana;
default:
return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
}
}
switch(stack.getItemDamage()) {
case 2:
return gaia;
case 1:
return natura;
case 0:
return mana;
default:
return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
}
}
private void cacheModels() {
// Load the OBJ
OBJModel model = null;
try {
model = ((OBJModel) OBJLoader.instance.loadModel(new ResourceLocation("botania:models/block/pylon.obj")));
} catch (IOException e) {
FMLLog.log(Level.ERROR, "[Botania]: Error loading pylon item model, substituting missing model");
mana = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
natura = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
gaia = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
cached = true;
return;
}
private void cacheModels() {
// Load the OBJ
OBJModel model = null;
try {
model = ((OBJModel) OBJLoader.instance.loadModel(new ResourceLocation("botania:models/block/pylon.obj")));
} catch(IOException e) {
FMLLog.log(Level.ERROR, "[Botania]: Error loading pylon item model, substituting missing model");
mana = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
natura = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
gaia = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
cached = true;
return;
}
// Apply the texture and flip the v's of the model
IModel manaModel = ((OBJModel) model.retexture(ImmutableMap.of("#pylon", "botania:model/pylon"))).process(ImmutableMap.of("flip-v", "true"));
IModel naturaModel = ((OBJModel) model.retexture(ImmutableMap.of("#pylon", "botania:model/pylon1"))).process(ImmutableMap.of("flip-v", "true"));
IModel gaiaModel = ((OBJModel) model.retexture(ImmutableMap.of("#pylon", "botania:model/pylon2"))).process(ImmutableMap.of("flip-v", "true"));
// Apply the texture and flip the v's of the model
IModel manaModel = ((OBJModel) model.retexture(ImmutableMap.of("#pylon", "botania:model/pylon"))).process(ImmutableMap.of("flip-v", "true"));
IModel naturaModel = ((OBJModel) model.retexture(ImmutableMap.of("#pylon", "botania:model/pylon1"))).process(ImmutableMap.of("flip-v", "true"));
IModel gaiaModel = ((OBJModel) model.retexture(ImmutableMap.of("#pylon", "botania:model/pylon2"))).process(ImmutableMap.of("flip-v", "true"));
// All groups are off by default
// OBJState constructor is derp, so the boolean condition is inverted - pass false to turn on a group
// All groups are off by default
// OBJState constructor is derp, so the boolean condition is inverted - pass false to turn on a group
final Function<ResourceLocation, TextureAtlasSprite> textureGetter = input -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(input.toString());
final Function<ResourceLocation, TextureAtlasSprite> textureGetter = input -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(input.toString());
ImmutableList<String> standardGroups = ImmutableList.of("Crystal", "Crystal_Ring",
"Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04",
"Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04");
ImmutableList<String> standardGroups = ImmutableList.of("Crystal", "Crystal_Ring",
"Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04",
"Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04");
mana = new PerspectiveWrapper(manaModel.bake(new OBJModel.OBJState(standardGroups, false), Attributes.DEFAULT_BAKED_FORMAT, textureGetter));
// Natura model is just the crystal
natura = new PerspectiveWrapper(naturaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal"), false), Attributes.DEFAULT_BAKED_FORMAT, textureGetter));
gaia = new PerspectiveWrapper(gaiaModel.bake(new OBJModel.OBJState(standardGroups, false), Attributes.DEFAULT_BAKED_FORMAT, textureGetter));
cached = true;
}
mana = new PerspectiveWrapper(manaModel.bake(new OBJModel.OBJState(standardGroups, false), Attributes.DEFAULT_BAKED_FORMAT, textureGetter));
// Natura model is just the crystal
natura = new PerspectiveWrapper(naturaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal"), false), Attributes.DEFAULT_BAKED_FORMAT, textureGetter));
gaia = new PerspectiveWrapper(gaiaModel.bake(new OBJModel.OBJState(standardGroups, false), Attributes.DEFAULT_BAKED_FORMAT, textureGetter));
cached = true;
}
@Override public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) { return ImmutableList.of(); }
@Override public List<BakedQuad> getGeneralQuads() { return ImmutableList.of(); }
@Override public boolean isAmbientOcclusion() { return false; }
@Override public boolean isGui3d() { return true; }
@Override public boolean isBuiltInRenderer() { return false; }
@Override public TextureAtlasSprite getParticleTexture() { return null; }
@Override public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; }
@Override
public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) {
return ImmutableList.of();
}
// Wrapper to transform the model before rendering it, so it looks right in the inventory
private class PerspectiveWrapper implements IPerspectiveAwareModel {
@Override
public List<BakedQuad> getGeneralQuads() {
return ImmutableList.of();
}
private final IFlexibleBakedModel parent;
@Override
public boolean isAmbientOcclusion() {
return false;
}
public PerspectiveWrapper(IBakedModel pylonModel) {
this.parent = new IFlexibleBakedModel.Wrapper(pylonModel, Attributes.DEFAULT_BAKED_FORMAT);
}
@Override
public boolean isGui3d() {
return true;
}
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
switch(cameraTransformType) {
case FIRST_PERSON: return ImmutablePair.of(parent, new TRSRTransformation(new Vector3f(0, 0, 0.4F), null, new Vector3f(0.75F, 0.75F, 0.75F), null).getMatrix());
case GUI: return ImmutablePair.of(parent, TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0.5F, 0.1F, 0), null, null, null)).getMatrix());
case THIRD_PERSON: return ImmutablePair.of(parent, new TRSRTransformation(new Vector3f(0, -0.2F, 0.5F), null, null, null).getMatrix());
default: return ImmutablePair.of(parent, TRSRTransformation.identity().getMatrix());
}
}
@Override
public boolean isBuiltInRenderer() {
return false;
}
@Override public VertexFormat getFormat() { return Attributes.DEFAULT_BAKED_FORMAT; }
@Override public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) { return parent.getFaceQuads(p_177551_1_); }
@Override public List<BakedQuad> getGeneralQuads() { return parent.getGeneralQuads(); }
@Override public boolean isAmbientOcclusion() { return parent.isAmbientOcclusion(); }
@Override public boolean isGui3d() { return parent.isGui3d(); }
@Override public boolean isBuiltInRenderer() { return parent.isBuiltInRenderer(); }
@Override public TextureAtlasSprite getParticleTexture() { return parent.getParticleTexture(); }
@Override public ItemCameraTransforms getItemCameraTransforms() { return parent.getItemCameraTransforms(); }
}
@Override
public TextureAtlasSprite getParticleTexture() {
return null;
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return ItemCameraTransforms.DEFAULT;
}
// Wrapper to transform the model before rendering it, so it looks right in the inventory
private class PerspectiveWrapper implements IPerspectiveAwareModel {
private final IFlexibleBakedModel parent;
public PerspectiveWrapper(IBakedModel pylonModel) {
this.parent = new IFlexibleBakedModel.Wrapper(pylonModel, Attributes.DEFAULT_BAKED_FORMAT);
}
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
switch(cameraTransformType) {
case FIRST_PERSON:
return ImmutablePair.of(parent, new TRSRTransformation(new Vector3f(0, 0, 0.4F), null, new Vector3f(0.75F, 0.75F, 0.75F), null).getMatrix());
case GUI:
return ImmutablePair.of(parent, TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0.5F, 0.1F, 0), null, null, null)).getMatrix());
case THIRD_PERSON:
return ImmutablePair.of(parent, new TRSRTransformation(new Vector3f(0, -0.2F, 0.5F), null, null, null).getMatrix());
default:
return ImmutablePair.of(parent, TRSRTransformation.identity().getMatrix());
}
}
@Override
public VertexFormat getFormat() {
return Attributes.DEFAULT_BAKED_FORMAT;
}
@Override
public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) {
return parent.getFaceQuads(p_177551_1_);
}
@Override
public List<BakedQuad> getGeneralQuads() {
return parent.getGeneralQuads();
}
@Override
public boolean isAmbientOcclusion() {
return parent.isAmbientOcclusion();
}
@Override
public boolean isGui3d() {
return parent.isGui3d();
}
@Override
public boolean isBuiltInRenderer() {
return parent.isBuiltInRenderer();
}
@Override
public TextureAtlasSprite getParticleTexture() {
return parent.getParticleTexture();
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return parent.getItemCameraTransforms();
}
}
}
@@ -2,7 +2,7 @@
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
@@ -42,7 +42,6 @@ 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.api.item.IFloatingFlower;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
@@ -50,269 +49,268 @@ import javax.vecmath.Matrix4f;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public class SpecialFlowerModel implements IModelCustomData {
// SpecialFlowerModel for when there are no blockModels registered for a subtile
public static final SpecialFlowerModel INSTANCE = new SpecialFlowerModel(ImmutableMap.<Optional<String>, ModelResourceLocation>of(), ImmutableMap.<Optional<String>, ModelResourceLocation>of());
// SpecialFlowerModel for when there are no blockModels registered for a subtile
public static final SpecialFlowerModel INSTANCE = new SpecialFlowerModel(ImmutableMap.<Optional<String>, ModelResourceLocation>of(), ImmutableMap.<Optional<String>, ModelResourceLocation>of());
private final ImmutableMap<Optional<String>, ModelResourceLocation> blockModels;
private final ImmutableMap<Optional<String>, ModelResourceLocation> itemModels;
private final ImmutableMap<Optional<String>, ModelResourceLocation> blockModels;
private final ImmutableMap<Optional<String>, ModelResourceLocation> itemModels;
public SpecialFlowerModel(ImmutableMap<Optional<String>, ModelResourceLocation> blockModels,
ImmutableMap<Optional<String>, ModelResourceLocation> itemModels) {
this.blockModels = blockModels;
this.itemModels = itemModels;
}
public SpecialFlowerModel(ImmutableMap<Optional<String>, ModelResourceLocation> blockModels,
ImmutableMap<Optional<String>, ModelResourceLocation> itemModels) {
this.blockModels = blockModels;
this.itemModels = itemModels;
}
@Override
public Collection<ResourceLocation> getDependencies() {
ImmutableSet.Builder<ResourceLocation> builder = ImmutableSet.builder();
builder.addAll(blockModels.values());
builder.addAll(itemModels.values());
@Override
public Collection<ResourceLocation> getDependencies() {
ImmutableSet.Builder<ResourceLocation> builder = ImmutableSet.builder();
builder.addAll(blockModels.values());
builder.addAll(itemModels.values());
// Force island models to be loaded and baked. See FloatingFlowerModel.
builder.addAll(BotaniaAPIClient.getRegisteredIslandTypeModels().values());
// Force island models to be loaded and baked. See FloatingFlowerModel.
builder.addAll(BotaniaAPIClient.getRegisteredIslandTypeModels().values());
return builder.build();
}
return builder.build();
}
@Override
public Collection<ResourceLocation> getTextures() {
return ImmutableList.of();
}
@Override
public Collection<ResourceLocation> getTextures() {
return ImmutableList.of();
}
@Override
public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
// "Bake" the SpecialFlowerModel (in reality, just create another wrapper for all the delegate blockModels)
return new SpecialFlowerBakedModel(blockModels, itemModels, format, IPerspectiveAwareModel.MapWrapper.getTransforms(state));
}
@Override
public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
// "Bake" the SpecialFlowerModel (in reality, just create another wrapper for all the delegate blockModels)
return new SpecialFlowerBakedModel(blockModels, itemModels, format, IPerspectiveAwareModel.MapWrapper.getTransforms(state));
}
@Override
public IModelState getDefaultState() {
return TRSRTransformation.identity();
}
@Override
public IModelState getDefaultState() {
return TRSRTransformation.identity();
}
@Override
public IModel process(ImmutableMap<String, String> customData) {
// Load the base variant from blockstate json, and also add all the model paths we received from external API
ImmutableMap.Builder<Optional<String>, ModelResourceLocation> blockBuilder = ImmutableMap.builder();
ImmutableMap.Builder<Optional<String>, ModelResourceLocation> itemBuilder = ImmutableMap.builder();
@Override
public IModel process(ImmutableMap<String, String> customData) {
// Load the base variant from blockstate json, and also add all the model paths we received from external API
ImmutableMap.Builder<Optional<String>, ModelResourceLocation> blockBuilder = ImmutableMap.builder();
ImmutableMap.Builder<Optional<String>, ModelResourceLocation> itemBuilder = ImmutableMap.builder();
for (String key : customData.keySet()) {
if ("base".equals(key)) {
blockBuilder.put(Optional.<String>absent(), getLocation(customData.get(key)));
}
}
for(String key : customData.keySet()) {
if("base".equals(key)) {
blockBuilder.put(Optional.<String>absent(), getLocation(customData.get(key)));
}
}
for (Map.Entry<String, ModelResourceLocation> e : BotaniaAPIClient.getRegisteredSubtileBlockModels().entrySet()) {
blockBuilder.put(Optional.of(e.getKey()), e.getValue());
}
for (Map.Entry<String, ModelResourceLocation> e : BotaniaAPIClient.getRegisteredSubtileItemModels().entrySet()) {
itemBuilder.put(Optional.of(e.getKey()), e.getValue());
}
for(Map.Entry<String, ModelResourceLocation> e : BotaniaAPIClient.getRegisteredSubtileBlockModels().entrySet()) {
blockBuilder.put(Optional.of(e.getKey()), e.getValue());
}
for(Map.Entry<String, ModelResourceLocation> e : BotaniaAPIClient.getRegisteredSubtileItemModels().entrySet()) {
itemBuilder.put(Optional.of(e.getKey()), e.getValue());
}
ImmutableMap<Optional<String>, ModelResourceLocation> blockModels = blockBuilder.build();
ImmutableMap<Optional<String>, ModelResourceLocation> itemModels = itemBuilder.build();
if (blockModels.isEmpty() && itemModels.isEmpty()) return INSTANCE;
return new SpecialFlowerModel(blockModels, itemModels);
}
ImmutableMap<Optional<String>, ModelResourceLocation> blockModels = blockBuilder.build();
ImmutableMap<Optional<String>, ModelResourceLocation> itemModels = itemBuilder.build();
if(blockModels.isEmpty() && itemModels.isEmpty()) return INSTANCE;
return new SpecialFlowerModel(blockModels, itemModels);
}
private ModelResourceLocation getLocation(String json) {
JsonElement e = new JsonParser().parse(json);
if (e.isJsonPrimitive() && e.getAsJsonPrimitive().isString()) {
return new ModelResourceLocation(e.getAsString());
}
FMLLog.severe("Expect ModelResourceLocation, got: ", json);
return new ModelResourceLocation("builtin/missing", "missing");
}
private ModelResourceLocation getLocation(String json) {
JsonElement e = new JsonParser().parse(json);
if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isString()) {
return new ModelResourceLocation(e.getAsString());
}
FMLLog.severe("Expect ModelResourceLocation, got: ", json);
return new ModelResourceLocation("builtin/missing", "missing");
}
public enum Loader implements ICustomModelLoader {
INSTANCE {
@Override
public void onResourceManagerReload(IResourceManager resourceManager) {
}
public enum Loader implements ICustomModelLoader {
INSTANCE {
@Override
public void onResourceManagerReload(IResourceManager resourceManager) {
}
@Override
public boolean accepts(ResourceLocation modelLocation) {
return modelLocation.getResourceDomain().equals("botania_special") && (
modelLocation.getResourcePath().equals("specialFlower") ||
modelLocation.getResourcePath().equals("models/block/specialFlower") ||
modelLocation.getResourcePath().equals("models/item/specialFlower"));
}
@Override
public boolean accepts(ResourceLocation modelLocation) {
return modelLocation.getResourceDomain().equals("botania_special") && (
modelLocation.getResourcePath().equals("specialFlower") ||
modelLocation.getResourcePath().equals("models/block/specialFlower") ||
modelLocation.getResourcePath().equals("models/item/specialFlower"));
}
@Override
public IModel loadModel(ResourceLocation modelLocation) throws IOException {
// Load a dummy model for now, all actual blockModels added in process().
return SpecialFlowerModel.INSTANCE;
}
}
}
@Override
public IModel loadModel(ResourceLocation modelLocation) throws IOException {
// Load a dummy model for now, all actual blockModels added in process().
return SpecialFlowerModel.INSTANCE;
}
}
}
public static class SpecialFlowerBakedModel implements IPerspectiveAwareModel, ISmartBlockModel, ISmartItemModel {
public static class SpecialFlowerBakedModel implements IPerspectiveAwareModel, ISmartBlockModel, ISmartItemModel {
private final ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms;
private final ImmutableMap<Optional<String>, ModelResourceLocation> blockModels;
private final ImmutableMap<Optional<String>, ModelResourceLocation> itemModels;
private final VertexFormat vertexFormat;
private final ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms;
private final ImmutableMap<Optional<String>, ModelResourceLocation> blockModels;
private final ImmutableMap<Optional<String>, ModelResourceLocation> itemModels;
private final VertexFormat vertexFormat;
private IBakedModel baseModel;
private ImmutableMap<String, IBakedModel> bakedBlockModels;
private ImmutableMap<String, IBakedModel> bakedItemModels;
private ImmutableMap<Optional<EnumFacing>, ImmutableList<BakedQuad>> quads;
private IBakedModel baseModel;
private ImmutableMap<String, IBakedModel> bakedBlockModels;
private ImmutableMap<String, IBakedModel> bakedItemModels;
private ImmutableMap<Optional<EnumFacing>, ImmutableList<BakedQuad>> quads;
public SpecialFlowerBakedModel(ImmutableMap<Optional<String>, ModelResourceLocation> blockModels,
ImmutableMap<Optional<String>, ModelResourceLocation> itemModels,
VertexFormat format, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> cameraTransforms) {
this.blockModels = blockModels;
this.itemModels = itemModels;
this.vertexFormat = format;
this.transforms = cameraTransforms;
}
public SpecialFlowerBakedModel(ImmutableMap<Optional<String>, ModelResourceLocation> blockModels,
ImmutableMap<Optional<String>, ModelResourceLocation> itemModels,
VertexFormat format, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> cameraTransforms) {
this.blockModels = blockModels;
this.itemModels = itemModels;
this.vertexFormat = format;
this.transforms = cameraTransforms;
}
private void refreshBakedModels() {
if (baseModel == null) {
// If not done already, steal all the real baked models and cache them
ModelManager manager = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager();
baseModel = getBlockModel(manager, Optional.<String>absent());
private void refreshBakedModels() {
if(baseModel == null) {
// If not done already, steal all the real baked models and cache them
ModelManager manager = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager();
baseModel = getBlockModel(manager, Optional.<String>absent());
ImmutableMap.Builder<String, IBakedModel> builder = ImmutableMap.builder();
for (Map.Entry<Optional<String>, ModelResourceLocation> e : blockModels.entrySet()) {
if (e.getKey().isPresent()) {
builder.put(e.getKey().get(), getBlockModel(manager, e.getKey()));
}
}
ImmutableMap.Builder<String, IBakedModel> builder = ImmutableMap.builder();
for(Map.Entry<Optional<String>, ModelResourceLocation> e : blockModels.entrySet()) {
if(e.getKey().isPresent()) {
builder.put(e.getKey().get(), getBlockModel(manager, e.getKey()));
}
}
bakedBlockModels = builder.build();
bakedBlockModels = builder.build();
ImmutableMap.Builder<String, IBakedModel> builder2 = ImmutableMap.builder();
for (Map.Entry<Optional<String>, ModelResourceLocation> e : itemModels.entrySet()) {
if (e.getKey().isPresent()) {
builder2.put(e.getKey().get(), getItemModel(manager, e.getKey()));
}
}
ImmutableMap.Builder<String, IBakedModel> builder2 = ImmutableMap.builder();
for(Map.Entry<Optional<String>, ModelResourceLocation> e : itemModels.entrySet()) {
if(e.getKey().isPresent()) {
builder2.put(e.getKey().get(), getItemModel(manager, e.getKey()));
}
}
bakedItemModels = builder2.build();
bakedItemModels = builder2.build();
ImmutableMap.Builder<Optional<EnumFacing>, ImmutableList<BakedQuad>> quadBuilder = ImmutableMap.builder();
quadBuilder.put(Optional.<EnumFacing>absent(), buildQuads(Optional.<EnumFacing>absent()));
for (EnumFacing side : EnumFacing.values()) {
quadBuilder.put(Optional.of(side), buildQuads(Optional.of(side)));
}
quads = quadBuilder.build();
}
}
ImmutableMap.Builder<Optional<EnumFacing>, ImmutableList<BakedQuad>> quadBuilder = ImmutableMap.builder();
quadBuilder.put(Optional.<EnumFacing>absent(), buildQuads(Optional.<EnumFacing>absent()));
for(EnumFacing side : EnumFacing.values()) {
quadBuilder.put(Optional.of(side), buildQuads(Optional.of(side)));
}
quads = quadBuilder.build();
}
}
private IBakedModel getBlockModel(ModelManager manager, Optional<String> opt) {
ModelResourceLocation loc = blockModels.get(opt);
if (loc == null) {
loc = new ModelResourceLocation("builtin/missing", "missing");
}
return manager.getModel(loc);
}
private IBakedModel getBlockModel(ModelManager manager, Optional<String> opt) {
ModelResourceLocation loc = blockModels.get(opt);
if(loc == null) {
loc = new ModelResourceLocation("builtin/missing", "missing");
}
return manager.getModel(loc);
}
private IBakedModel getItemModel(ModelManager manager, Optional<String> opt) {
ModelResourceLocation loc = itemModels.get(opt);
if (loc == null) {
loc = new ModelResourceLocation("builtin/missing", "missing");
}
return manager.getModel(loc);
}
private IBakedModel getItemModel(ModelManager manager, Optional<String> opt) {
ModelResourceLocation loc = itemModels.get(opt);
if(loc == null) {
loc = new ModelResourceLocation("builtin/missing", "missing");
}
return manager.getModel(loc);
}
private ImmutableList<BakedQuad> buildQuads(Optional<EnumFacing> side) {
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
for (IBakedModel model : bakedBlockModels.values()) {
if (side.isPresent()) {
builder.addAll(model.getFaceQuads(side.get()));
} else {
builder.addAll(model.getGeneralQuads());
}
}
private ImmutableList<BakedQuad> buildQuads(Optional<EnumFacing> side) {
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
for(IBakedModel model : bakedBlockModels.values()) {
if(side.isPresent()) {
builder.addAll(model.getFaceQuads(side.get()));
} else {
builder.addAll(model.getGeneralQuads());
}
}
for (IBakedModel model : bakedItemModels.values()) {
if (side.isPresent()) {
builder.addAll(model.getFaceQuads(side.get()));
} else {
builder.addAll(model.getGeneralQuads());
}
}
for(IBakedModel model : bakedItemModels.values()) {
if(side.isPresent()) {
builder.addAll(model.getFaceQuads(side.get()));
} else {
builder.addAll(model.getGeneralQuads());
}
}
return builder.build();
}
return builder.build();
}
@Override
public List<BakedQuad> getFaceQuads(EnumFacing side) {
refreshBakedModels();
return quads.get(Optional.of(side));
}
@Override
public List<BakedQuad> getFaceQuads(EnumFacing side) {
refreshBakedModels();
return quads.get(Optional.of(side));
}
@Override
public List<BakedQuad> getGeneralQuads() {
refreshBakedModels();
return quads.get(Optional.<EnumFacing>absent());
}
@Override
public List<BakedQuad> getGeneralQuads() {
refreshBakedModels();
return quads.get(Optional.<EnumFacing>absent());
}
@Override
public boolean isAmbientOcclusion() {
refreshBakedModels();
return baseModel.isAmbientOcclusion();
}
@Override
public boolean isAmbientOcclusion() {
refreshBakedModels();
return baseModel.isAmbientOcclusion();
}
@Override
public boolean isGui3d() {
refreshBakedModels();
return baseModel.isGui3d();
}
@Override
public boolean isGui3d() {
refreshBakedModels();
return baseModel.isGui3d();
}
@Override
public boolean isBuiltInRenderer() {
refreshBakedModels();
return baseModel.isBuiltInRenderer();
}
@Override
public boolean isBuiltInRenderer() {
refreshBakedModels();
return baseModel.isBuiltInRenderer();
}
@Override
public TextureAtlasSprite getParticleTexture() {
refreshBakedModels();
return baseModel.getParticleTexture();
}
@Override
public TextureAtlasSprite getParticleTexture() {
refreshBakedModels();
return baseModel.getParticleTexture();
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return ItemCameraTransforms.DEFAULT;
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return ItemCameraTransforms.DEFAULT;
}
@Override
public IBakedModel handleBlockState(IBlockState state) {
if (state.getBlock() != ModBlocks.specialFlower)
return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
refreshBakedModels();
IExtendedBlockState extendedState = ((IExtendedBlockState) state);
IBakedModel ret = bakedBlockModels.get(extendedState.getValue(BotaniaStateProps.SUBTILE_ID));
return ret == null ? Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel() : ret;
}
@Override
public IBakedModel handleBlockState(IBlockState state) {
if(state.getBlock() != ModBlocks.specialFlower)
return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
refreshBakedModels();
IExtendedBlockState extendedState = ((IExtendedBlockState) state);
IBakedModel ret = bakedBlockModels.get(extendedState.getValue(BotaniaStateProps.SUBTILE_ID));
return ret == null ? Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel() : ret;
}
@Override
public VertexFormat getFormat() {
return vertexFormat;
}
@Override
public VertexFormat getFormat() {
return vertexFormat;
}
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, cameraTransformType);
}
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, cameraTransformType);
}
@Override
public IBakedModel handleItemState(ItemStack stack) {
refreshBakedModels();
IBakedModel item = bakedItemModels.get(ItemBlockSpecialFlower.getType(stack));
if (item == null) {
item = bakedBlockModels.get(ItemBlockSpecialFlower.getType(stack));
}
@Override
public IBakedModel handleItemState(ItemStack stack) {
refreshBakedModels();
IBakedModel item = bakedItemModels.get(ItemBlockSpecialFlower.getType(stack));
if(item == null) {
item = bakedBlockModels.get(ItemBlockSpecialFlower.getType(stack));
}
return item == null ? Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel() : item;
}
}
return item == null ? Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel() : item;
}
}
}
@@ -1,51 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Oct 24, 2015, 11:06:11 PM (GMT)]
*/
/*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileAvatar;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderAvatar implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.6F, -0.5F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileAvatar(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public int getRenderId() {
return LibRenderIDs.idAvatar;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
*/
@@ -1,52 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Aug 28, 2015, 7:13:45 PM (GMT)]
*/
/*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.mana.TileBellows;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderBellows implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.3F, -0.5F);
GlStateManager.scale(1.2F, 1.2F, 1.2F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileBellows(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return LibRenderIDs.idBellows;
}
}
*/
@@ -1,55 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Oct 31, 2014, 5:00:12 PM (GMT)]
*/
/*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.client.render.tile.RenderTileBrewery;
import vazkii.botania.common.block.tile.TileBrewery;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderBrewery implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
GlStateManager.scale(1.2F, 1.2F, 1.2F);
RenderTileBrewery.rotate = false;
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileBrewery(), 0.0D, 0.0D, 0.0D, 0.0F);
RenderTileBrewery.rotate = true;
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return LibRenderIDs.idBrewery;
}
}
*/
@@ -1,51 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jul 8, 2015, 5:57:29 PM (GMT)]
*/
/*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileCocoon;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderCocoon implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileCocoon(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public int getRenderId() {
return LibRenderIDs.idCocoon;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
*/
@@ -1,53 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Apr 30, 2015, 6:22:32 PM (GMT)]
*/
/*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.corporea.TileCorporeaCrystalCube;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderCorporeaCrystalCube implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
GlStateManager.disableAlpha();
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileCorporeaCrystalCube(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.enableAlpha();
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return LibRenderIDs.idCorporeaCrystalCybe;
}
}
*/
@@ -1,55 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Feb 15, 2015, 1:57:50 AM (GMT)]
*/
/*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.client.render.tile.RenderTileCorporeaIndex;
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderCorporeaIndex implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.3F, -0.5F);
GlStateManager.scale(1.4F, 1.4F, 1.4F);
RenderTileCorporeaIndex.move = false;
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileCorporeaIndex(), 0.0D, 0.0D, 0.0D, 0.0F);
RenderTileCorporeaIndex.move = true;
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return LibRenderIDs.idCorporeaIndex;
}
}
*/
@@ -1,53 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [May 30, 2015, 3:17:41 PM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileHourglass;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderHourglass implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
GlStateManager.disableAlpha();
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileHourglass(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.enableAlpha();
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public int getRenderId() {
return LibRenderIDs.idHourglass;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
*/
@@ -1,52 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [May 15, 2015, 5:59:56 PM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileIncensePlate;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderIncensePlate implements ISimpleBlockRenderingHandler{
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.1F, -0.5F);
GlStateManager.scale(1.4F, 1.4F, 1.4F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileIncensePlate(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public int getRenderId() {
return LibRenderIDs.idIncensePlate;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
*/
@@ -1,54 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 26, 2014, 12:25:06 AM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.client.render.tile.RenderTilePool;
import vazkii.botania.common.block.tile.mana.TilePool;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderPool implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
RenderTilePool.forceMeta = metadata;
RenderTilePool.forceMana = RenderTilePool.forceMana | metadata == 1;
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TilePool(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public int getRenderId() {
return LibRenderIDs.idPool;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
*/
@@ -1,51 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Mar 18, 2015, 4:42:08 PM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.mana.TilePump;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderPump implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.25F, -0.5F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TilePump(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return LibRenderIDs.idPump;
}
}
*/
@@ -1,51 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jul 23, 2014, 6:23:54 PM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileSpawnerClaw;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderSpawnerClaw implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, 0F, -0.5F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileSpawnerClaw(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return LibRenderIDs.idSpawnerClaw;
}
}
*/
@@ -1,138 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 25, 2014, 4:15:46 PM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import vazkii.botania.api.lexicon.multiblock.IMultiblockRenderHook;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderSpecialFlower implements ISimpleBlockRenderingHandler, IMultiblockRenderHook {
int id;
public RenderSpecialFlower(int id) {
this.id = id;
}
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
// NO-OP
}
@Override
public boolean renderWorldBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return renderCrossedSquares(blockAccess, block, x, y, z, renderer);
}
// Copied from RenderBlocks
public static boolean renderCrossedSquares(IBlockAccess blockAccess, Block par1Block, int par2, int par3, int par4, RenderBlocks render) {
Tessellator tessellator = Tessellator.getInstance();
tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(blockAccess, par2, par3, par4));
float f = 1.0F;
int l = par1Block.colorMultiplier(blockAccess, par2, par3, par4);
float f1 = (l >> 16 & 255) / 255.0F;
float f2 = (l >> 8 & 255) / 255.0F;
float f3 = (l & 255) / 255.0F;
if(EntityRenderer.anaglyphEnable) {
float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
f1 = f4;
f2 = f5;
f3 = f6;
}
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
double d1 = par2;
double d2 = par3;
double d0 = par4;
long sh;
sh = par2 * 3129871 ^ par4 * 116129781L ^ par3;
sh = sh * sh * 42317861L + sh * 11L;
d1 += ((sh >> 16 & 15L) / 15.0F - 0.5D) * 0.3D;
d2 += (sh >> 32 & 15L) / 15.0F * -0.15D;
d0 += ((sh >> 24 & 15L) / 15.0F - 0.5D) * 0.3D;
// Only change here, to use xyz rather than side/meta
IIcon icon = render.getBlockIcon(par1Block, blockAccess, par2, par3, par4, 0);
drawCrossedSquares(blockAccess, par1Block, icon, par2, par3, par4, d1, d2, d0, 1.0F, render);
return true;
}
// Copied from RenderBlocks
public static void drawCrossedSquares(IBlockAccess blockAccess, Block par1Block, IIcon icon, int x, int y, int z, double par3, double par5, double par7, float par9, RenderBlocks render) {
Tessellator tessellator = Tessellator.getInstance();
double d3 = icon.getMinU();
double d4 = icon.getMinV();
double d5 = icon.getMaxU();
double d6 = icon.getMaxV();
double d7 = 0.45D * par9;
double d8 = par3 + 0.5D - d7;
double d9 = par3 + 0.5D + d7;
double d10 = par7 + 0.5D - d7;
double d11 = par7 + 0.5D + d7;
tessellator.getWorldRenderer().addVertexWithUV(d8, par5 + par9, d10, d3, d4);
tessellator.getWorldRenderer().addVertexWithUV(d8, par5 + 0.0D, d10, d3, d6);
tessellator.getWorldRenderer().addVertexWithUV(d9, par5 + 0.0D, d11, d5, d6);
tessellator.getWorldRenderer().addVertexWithUV(d9, par5 + par9, d11, d5, d4);
tessellator.getWorldRenderer().addVertexWithUV(d9, par5 + par9, d11, d3, d4);
tessellator.getWorldRenderer().addVertexWithUV(d9, par5 + 0.0D, d11, d3, d6);
tessellator.getWorldRenderer().addVertexWithUV(d8, par5 + 0.0D, d10, d5, d6);
tessellator.getWorldRenderer().addVertexWithUV(d8, par5 + par9, d10, d5, d4);
tessellator.getWorldRenderer().addVertexWithUV(d8, par5 + par9, d11, d3, d4);
tessellator.getWorldRenderer().addVertexWithUV(d8, par5 + 0.0D, d11, d3, d6);
tessellator.getWorldRenderer().addVertexWithUV(d9, par5 + 0.0D, d10, d5, d6);
tessellator.getWorldRenderer().addVertexWithUV(d9, par5 + par9, d10, d5, d4);
tessellator.getWorldRenderer().addVertexWithUV(d9, par5 + par9, d10, d3, d4);
tessellator.getWorldRenderer().addVertexWithUV(d9, par5 + 0.0D, d10, d3, d6);
tessellator.getWorldRenderer().addVertexWithUV(d8, par5 + 0.0D, d11, d5, d6);
tessellator.getWorldRenderer().addVertexWithUV(d8, par5 + par9, d11, d5, d4);
}
@Override
public int getRenderId() {
return id;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return false;
}
@Override
public void renderBlockForMultiblock(IBlockAccess world, Multiblock mb, Block block, int meta, RenderBlocks renderBlocks, MultiblockComponent comp, float alpha) {
Tessellator tess = Tessellator.getInstance();
tess.startDrawingQuads();
drawCrossedSquares(world, block, block.getIcon(0, meta), 0, 0, 0, -0.5, -0.5, -0.5, 1F, renderBlocks);
tess.draw();
}
@Override
public boolean needsTranslate(IBlockState state) {
return true;
}
}
*/
@@ -1,57 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 25, 2014, 9:45:58 PM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.mana.TileSpreader;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderSpreader implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
TileSpreader.staticRedstone = metadata == 1;
TileSpreader.staticDreamwood = metadata == 2 || metadata == 3;
TileSpreader.staticUltra = metadata == 3;
TileSpreader spreader = new TileSpreader();
spreader.rotationX = -180F;
TileEntityRendererDispatcher.instance.renderTileEntityAt(spreader, 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public int getRenderId() {
return LibRenderIDs.idSpreader;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
*/
@@ -1,51 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Oct 1, 2015, 9:40:27 PM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileTeruTeruBozu;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderTeruTeruBozu implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, -0.3F, -0.5F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileTeruTeruBozu(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public int getRenderId() {
return LibRenderIDs.idTeruTeruBozu;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
*/
@@ -1,51 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jul 18, 2014, 11:43:37 PM (GMT)]
*//*
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileTinyPotato;
import net.minecraftforge.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderTinyPotato implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, 0F, -0.5F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileTinyPotato(), 0.0D, 0.0D, 0.0D, 0.0F);
GlStateManager.popMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@Override
public int getRenderId() {
return LibRenderIDs.idTinyPotato;
}
}
*/
@@ -1,96 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Feb 28, 2015, 3:43:09 PM (GMT)]
*//*
package vazkii.botania.client.render.item;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import vazkii.botania.common.lib.LibObfuscation;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
public class RenderBow implements IItemRenderer {
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return type != ItemRenderType.INVENTORY;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
switch(type) {
case ENTITY : {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, 0F, 0F);
if(item.isOnItemFrame())
GlStateManager.translate(0F, -0.3F, 0.01F);
render(item, null, false);
GlStateManager.popMatrix();
break;
}
case EQUIPPED : {
render(item, data[1] instanceof EntityPlayer ? (EntityPlayer) data[1] : null, true);
break;
}
case EQUIPPED_FIRST_PERSON : {
render(item, data[1] instanceof EntityPlayer ? (EntityPlayer) data[1] : null, false);
break;
}
default : break;
}
}
public void render(ItemStack item, EntityPlayer player, boolean transform) {
int dmg = item.getItemDamage();
IIcon icon = item.getItem().getIconFromDamageForRenderPass(dmg, 0);
if(player != null) {
ItemStack using = ReflectionHelper.getPrivateValue(EntityPlayer.class, player, LibObfuscation.ITEM_IN_USE);
int time = ReflectionHelper.getPrivateValue(EntityPlayer.class, player, LibObfuscation.ITEM_IN_USE_COUNT);
icon = item.getItem().getIcon(item, 0, player, using, time);
if(transform) {
GlStateManager.translate(0.2F, -0.3F, 0.1F);
//GlStateManager.rotate(20.0F, 0.0F, 1.0F, 0.0F);
//GlStateManager.rotate(-100.0F, 1.0F, 0.0F, 0.0F);
}
}
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
float scale = 1F / 16F;
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color(1F, 1F, 1F, 1F);
ItemRenderer.renderItemIn2D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), scale);
GlStateManager.disableBlend();
GlStateManager.popMatrix();
GlStateManager.color(1F, 1F, 1F, 1F);
}
}
*/
@@ -1,124 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 31, 2014, 3:08:00 PM (GMT)]
*//*
package vazkii.botania.client.render.item;
import java.awt.Color;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.mana.ILens;
import vazkii.botania.common.item.lens.ItemLens;
public class RenderLens implements IItemRenderer {
static RenderItem render = new RenderItem();
ItemRenderer renderer = new ItemRenderer(Minecraft.getMinecraft());
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return type != ItemRenderType.INVENTORY;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
switch(type) {
case ENTITY : {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, 0F, 0F);
if(item.isOnItemFrame())
GlStateManager.translate(0F, -0.3F, 0.01F);
render(item);
GlStateManager.popMatrix();
break;
}
case EQUIPPED : {
render(item);
break;
}
case EQUIPPED_FIRST_PERSON : {
render(item);
break;
}
default : break;
}
}
public static void render(ItemStack item) {
Color color = new Color(((ILens) item.getItem()).getLensColor(item));
render(item, color.getRGB());
}
public static void render(ItemStack item, int color_) {
int dmg = item.getItemDamage();
IIcon icon = item.getItem().getIconFromDamageForRenderPass(dmg, 1);
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
float scale = 1F / 16F;
GlStateManager.color(1F, 1F, 1F, 1F);
ItemRenderer.renderItemIn2D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), scale);
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.enableCull();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
Color color = new Color(color_);
GlStateManager.color((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) 255);
boolean shiny = ItemLens.getStoredColor(item) != -1;
icon = ItemLens.iconGlass;
GlStateManager.scale(scale, scale, scale);
GlStateManager.translate(0F, 0F, -0.5F);
renderShinyLensIcon(icon, shiny);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(-16F, 0F, 0F);
renderShinyLensIcon(icon, shiny);
GlStateManager.disableCull();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
GlStateManager.color(1F, 1F, 1F, 1F);
}
public static void renderShinyLensIcon(IIcon icon, boolean shiny) {
float par1 = 0;
float par2 = 0;
float par4 = 16;
float par5 = 16;
float zLevel = 0F;
Tessellator tessellator = Tessellator.getInstance();
tessellator.getWorldRenderer().startDrawingQuads();
if(shiny)
tessellator.setBrightness(240);
tessellator.getWorldRenderer().addVertexWithUV(par1 + 0, par2 + par5, zLevel, icon.getMinU(), icon.getMaxV());
tessellator.getWorldRenderer().addVertexWithUV(par1 + par4, par2 + par5, zLevel, icon.getMaxU(), icon.getMaxV());
tessellator.getWorldRenderer().addVertexWithUV(par1 + par4, par2 + 0, zLevel, icon.getMaxU(), icon.getMinV());
tessellator.getWorldRenderer().addVertexWithUV(par1 + 0, par2 + 0, zLevel, icon.getMinU(), icon.getMinV());
tessellator.draw();
}
}*/
@@ -1,81 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Aug 6, 2014, 10:04:57 PM (GMT)]
*//*
package vazkii.botania.client.render.item;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
public class RenderTransparentItem implements IItemRenderer {
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return type != ItemRenderType.INVENTORY;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
switch(type) {
case ENTITY : {
GlStateManager.pushMatrix();
GlStateManager.translate(-0.5F, 0F, 0F);
if(item.isOnItemFrame())
GlStateManager.translate(0F, -0.3F, 0.01F);
render(item);
GlStateManager.popMatrix();
break;
}
case EQUIPPED : {
render(item);
break;
}
case EQUIPPED_FIRST_PERSON : {
render(item);
break;
}
default : break;
}
}
public void render(ItemStack item) {
int dmg = item.getItemDamage();
IIcon icon = item.getItem().getIconFromDamageForRenderPass(dmg, 0);
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
float scale = 1F / 16F;
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color(1F, 1F, 1F, 1F);
ItemRenderer.renderItemIn2D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), scale);
GlStateManager.disableBlend();
GlStateManager.popMatrix();
GlStateManager.color(1F, 1F, 1F, 1F);
}
}
*/