Compare commits

...
99 Commits
Author SHA1 Message Date
Vincent Lee 37d2f8190e Update README.md 2016-09-05 17:19:59 -05:00
Vincent Lee 7eb9a89ef4 Disable bergamute on custom sound classes. Closes #458 2016-09-03 17:00:02 -05:00
Vincent Lee adf0d08cde Fix avatar icon and cocoon hitbox 2016-09-02 12:36:33 -05:00
Vincent Lee ec4fe8bdb9 Bump pack_format to 2 (1.9) even though it doesn't really matter 2016-08-28 12:43:07 -05:00
Vincent Lee 7837381123 Split floating island jsons 2016-08-28 12:32:32 -05:00
Vincent Lee f0d863d30f Move colorhandlers and get rid of icolorable 2016-08-28 11:50:06 -05:00
Vincent Lee f6a68a0d83 Eliminate the IRegisterCallback shim 2016-08-28 10:33:29 -05:00
Vincent Lee e5ec84e040 Build 320 2016-08-28 09:03:21 -05:00
Vincent Lee 8ac2d2fb19 Missing sideonly 2016-08-28 08:39:17 -05:00
Vincent Lee ae84d99013 Delete mana petal class 2016-08-28 08:39:05 -05:00
Vincent Lee 659ab9cf5c Fix item sideonly derps 2016-08-28 08:34:33 -05:00
Vincent Lee c077d4d464 Remove category from sounds.json as it is no longer used by vanilla 2016-08-27 19:46:50 -05:00
Vincent Lee 2aa05a4b07 Clean up libobf more 2016-08-27 19:34:08 -05:00
Vincent Lee d57354de2f Remove unnecessary new String[] libobfuscation 2016-08-27 19:12:04 -05:00
Vincent Lee 392a02e945 Modernize GoG skybox code. Fixes #460 2016-08-27 19:08:43 -05:00
Vincent Lee 0642754886 Build 319 2016-08-27 12:57:21 -05:00
Vincent Lee 2d225337af Stop spawning particles serverside 2016-08-27 12:53:33 -05:00
Vincent Lee 9f66216832 Item sideonly checks 2016-08-26 20:14:42 -05:00
Vincent Lee ed1cbbe9dd Merge pull request #455 from LGcommisar/master
Added textures for shields, see Issue #453.
2016-08-24 21:28:21 -05:00
Vincent Lee 6db2aa7dee Merge branch 'master' of github.com:williewillus/Botania 2016-08-24 21:27:50 -05:00
Vincent Lee 4ce5b40ebb Build 318 metadata 2016-08-24 21:27:44 -05:00
Vincent Lee c969ea3f72 Merge pull request #456 from pau101/master
Add floral powder to ore dictionary for wildcard dye
2016-08-24 21:27:06 -05:00
Vincent Lee 90085c4379 Fix comodification derpage 2016-08-24 21:22:25 -05:00
Vincent Lee 14851e751d Build 317 2016-08-24 21:19:24 -05:00
pau101 c3da70b52e Add floral powder to ore dictionary for wildcard dye 2016-08-23 21:02:25 -07:00
LGcommisar 29868d7d8e Delete keep 2016-08-23 23:42:59 -04:00
LGcommisar 656c0de2a3 Shield textures 2016-08-23 23:42:09 -04:00
LGcommisar b777e5856e Create keep 2016-08-23 23:41:42 -04:00
Vincent Lee f3dea919a6 Fix banner textures not being reversed properly 2016-08-23 17:02:29 -05:00
Vincent Lee af9588ff11 Pylons use new hidden model system instead of OBJState 2016-08-23 12:11:09 -05:00
Vincent Lee 8d52bb686f Merge branch 'master' of github.com:williewillus/Botania 2016-08-23 11:21:48 -05:00
Vincent Lee d4d42208a2 Merge pull request #454 from Luxor5393/master
Update crafty crate entry picture.
2016-08-23 11:12:59 -05:00
Vincent Lee fb34e7e848 Shorten config name 2016-08-23 11:09:54 -05:00
Luxor5393 53a582e188 Update crafty crate picture 2016-08-23 15:53:16 +02:00
Vincent Lee bffa5a1171 Remove redundant code and fix pixies being slow 2016-08-22 15:10:41 -05:00
Vincent Lee a47619879a Fix pixies instantly despawning clientside 2016-08-22 14:42:26 -05:00
Vincent Lee 6545845850 Reduce watch task range 2016-08-22 14:13:38 -05:00
Vincent Lee 8809524d6d Imports 2016-08-22 13:13:14 -05:00
Vincent Lee a9062856d1 Extend entityliving instead of entitycreature 2016-08-22 13:12:40 -05:00
Vincent Lee ddcff076a7 Cleanup and pull unneeded stuff out of datawatcher 2016-08-20 16:44:27 -05:00
Vincent Lee 9e56e04e6c Remove potions more cleanly 2016-08-20 16:32:37 -05:00
Vincent Lee b91ab69cea Remove unneeded world arg from particle methods 2016-08-20 14:38:24 -05:00
Vincent Lee d12717c29f Get rid of silly common proxy pattern 2016-08-20 14:31:25 -05:00
Vincent Lee 808d80affa Add note to refresh rendering after toggling config option 2016-08-19 20:33:32 -05:00
Vincent Lee 6478eb907e Localize config option 2016-08-19 20:21:14 -05:00
Vincent Lee 334d910086 Merge branch 'master' of github.com:williewillus/Botania 2016-08-19 20:19:11 -05:00
Vincent Lee 1b97974d0e Add config to render floating flowers in static renderer 2016-08-19 20:19:00 -05:00
Vincent Lee 2fe7d5e025 Slightly more efficient quad gathering 2016-08-19 19:57:51 -05:00
Vincent Lee 360a398fca Delete old model 2016-08-19 19:54:41 -05:00
Vincent Lee a9171cd215 Merge branch 'improvedfloaters' 2016-08-19 19:53:47 -05:00
Vincent Lee 815cdc9f52 Fix all textures 2016-08-19 16:09:18 -05:00
Vincent Lee 0a235cf5e8 Finish UV remapping 2016-08-19 15:12:52 -05:00
Vincent Lee 25a4877e1a Halved the texture size 2016-08-19 12:52:22 -05:00
Vincent Lee 28febcac08 UV map the bottom of the model. Add placeholders for sides 2016-08-19 12:42:30 -05:00
Vincent Lee 757abbe6d7 Merge pull request #448 from 3TUSK/zhCN
Update zh_CN.lang
2016-08-16 20:57:36 -05:00
3TUSK 28aa8bc0d5 Update zh_CN.lang
Signed-off-by: 3TUSK <urey.s.knowledge@gmail.com>
2016-08-16 21:20:42 -04:00
Vincent Lee 5392f00ff9 Fix orechid running clientside, closes #447 2016-08-16 18:09:06 -05:00
Vincent Lee 64712d315f WIP 2016-08-15 17:14:40 -05:00
Vincent Lee 789832bdc1 Merge branch 'master' into improvedfloaters 2016-08-15 15:55:50 -05:00
Vincent Lee a0a7428116 Bergamute now blocks moving/ticking sounds. Closes #407 2016-08-15 15:52:51 -05:00
Vincent Lee 37eb1a781c Fix bergamute having a nonmatching color 2016-08-15 15:34:06 -05:00
Vincent Lee a0a78ea203 Build 316 2016-08-15 13:43:18 -05:00
Vincent Lee ba3f337520 Remove moss stone botaina recipe, remove old tooltips 2016-08-15 12:11:51 -05:00
Vincent Lee 9e13eda148 Add missing sideonly to blocks 2016-08-15 12:00:51 -05:00
Vincent Lee 4f26ea9893 Use vanilla mechanisms to sync TE's instead of rolling own 2016-08-14 11:46:45 -05:00
Vincent Lee 878c0dbeba Make ender hand less desyncy and clean some old filesy 2016-08-14 10:46:10 -05:00
Vincent Lee 687d475aeb Corporea no longer runs clientside 2016-08-13 15:21:32 -05:00
Vincent Lee 1eafb2e85e Update forge, fix tooltips additions not matching item tooltip. Closes #219 2016-08-13 14:26:10 -05:00
Vincent Lee 2877d304ce Mana blaster now shows active lens on model 2016-08-13 12:50:17 -05:00
Vincent Lee dc1eab4dd8 Fix weird model name clash. Closes #436 2016-08-12 22:17:12 -05:00
Vincent Lee f71b4b6cf2 Fix all other potatoes. Closes #409 2016-08-12 21:41:27 -05:00
Vincent Lee 2b3cfd985c Don't spam quite so many stacks 2016-08-11 21:00:04 -05:00
Vincent Lee 2a4b489eca Bunch more potato fixes, and one for me! 2016-08-11 20:38:54 -05:00
Vincent Lee 348b52eb9f Fix some of the easier potatoes 2016-08-11 19:50:01 -05:00
Vincent Lee 12be321b73 Merge pull request #433 from yrsegal/potatoes
Do initial work on potatoes
2016-08-11 18:27:12 -05:00
Vincent Lee 07f68b37da Fix missing sideonly 2016-08-09 21:04:09 -05:00
Vincent Lee 8d9996cb6b Fix corporea retainer comparator output not working. Closes #430 2016-08-09 19:57:41 -05:00
Vincent Lee 32a28e83a5 Magic flowers now show properly in JEI. Closes #431 2016-08-09 19:48:54 -05:00
Vincent Lee 0b34fe7193 Fix porting derp in flare lens. Closes #429 2016-08-08 20:17:22 -05:00
Vincent Lee a3e8d88f1c Fix a corproea animation being absent 2016-08-07 20:10:44 -05:00
Vincent Lee 8423607b29 Reinstate null subtile check. Closes #428 2016-08-07 18:30:31 -05:00
Vincent Lee 90c42b25c7 Get rid of some triple nested for loops 2016-08-07 12:27:01 -05:00
Vincent Lee ddda9db4ac Make bubbell less laggy 2016-08-07 12:00:52 -05:00
Vincent Lee 16615ce429 Tweak cacophonium interactions 2016-08-06 12:04:18 -05:00
Vincent Lee aeaa2a76c4 Tweak black hole talisman interactions, fix a crash 2016-08-06 11:48:01 -05:00
Vincent Lee 921825aca3 Fix pickup delay not getting set properly in thrown items 2016-08-05 20:59:05 -05:00
Vincent Lee c3e4a02825 A few inconsequential cleanups 2016-08-05 20:51:21 -05:00
Vincent Lee 3d7c9e8b94 Update forge, remove some unneeded particle methods 2016-08-05 20:21:50 -05:00
Vincent Lee a0aac5a9bf Stupid compile derp 2016-08-05 18:36:04 -05:00
Vincent Lee acd5cce7ce Fix a bunch of things assuming the player only has main hand. Closes #424 2016-08-05 18:31:44 -05:00
Vincent Lee 8eccfad65e If we can't see the extended state bail. This is not a big deal. CLose #423 2016-08-04 19:54:16 -05:00
Vincent Lee 59771083d2 Merge branch 'master' of github.com:williewillus/Botania 2016-08-03 20:31:05 -05:00
Vincent Lee 3a5e78a4c6 Build 315 2016-08-03 20:30:33 -05:00
Vincent Lee b648c36111 Merge pull request #420 from shadowfacts/master
Allow Elven Trade recipes to have multiple outputs
2016-08-02 18:49:16 -05:00
Shadowfacts 5e8eaf8c77 Fix Elven Trade JEI handling for trades with multiple outputs 2016-08-02 16:34:59 -04:00
Shadowfacts 6cde8299c4 Modify Elven Trade recipes to allow for recipes with multiple outputs 2016-08-02 16:23:40 -04:00
Vincent Lee 947a225d23 TIL you don't set default values for unlisted properties 2016-07-31 20:55:04 -05:00
Vincent Lee 4656680250 New optimized floating island model 2016-07-31 17:05:51 -05:00
yrsegal f8abe9d7b1 initial work on potatoes 2016-07-30 00:07:20 -04:00
325 changed files with 3164 additions and 2991 deletions

No files matched your search

+3 -7
View File
@@ -1,14 +1,10 @@
README:
This is williewillus' port and continuation of Botania for Minecraft versions 1.8.x and above
This is williewillus' old port and of Botania for Minecraft versions 1.8.x up to 1.10.2, build 320.
All licensing and distribution rights are exactly as 1.7.10 Botania.
Vazkii took a break from Botania from 2016-02-25 to 2016-09-05, I have ported it in this time and fixed things here and there.
Use at your own risk as bugs may pop up unexpectedly.
As of 2016 02 25, Vazkii has stopped working on Botania. Requests for design changes will still not be accepted here (post them on reddit). Even then, don't expect anything to be added without severe deliberation scrutiny.
Please report all 1.8+ issues to this repository.
Future development is now at Vazkii's BotaniaV2 Repository; remaining issues in this repository will be fixed, but new issue reports will not be accepted. Thanks!
These non-CurseForge builds can be openly used in modpacks of any kind, in accordance with the requirements of the license of this mod.
+3 -3
View File
@@ -1,9 +1,9 @@
#
#Fri Jul 29 18:40:22 CDT 2016
#Sun Aug 28 08:42:14 CDT 2016
version=r1.8
dir_output=../Build Output/Botania/
forge_version=12.18.1.2044
forge_version=12.18.1.2056
mc_version=1.10.2
dir_repo=./
build_number=315
build_number=321
mod_name=Botania
@@ -495,16 +495,26 @@ public final class BotaniaAPI {
/**
* Registers a Elven Trade recipe (throw an item in an Alfheim Portal).
* @param output The ItemStack to return.
* @param outputs The ItemStacks to return.
* @param inputs The items required, can be ItemStack or ore dictionary entry string.
* @return The recipe created.
*/
public static RecipeElvenTrade registerElvenTradeRecipe(ItemStack output, Object... inputs) {
RecipeElvenTrade recipe = new RecipeElvenTrade(output, inputs);
public static RecipeElvenTrade registerElvenTradeRecipe(ItemStack[] outputs, Object... inputs) {
RecipeElvenTrade recipe = new RecipeElvenTrade(outputs, inputs);
elvenTradeRecipes.add(recipe);
return recipe;
}
/**
* Registers a Elven Trade recipe (throw an item into an Alfeim Portal).
* @param output The ItemStack to return
* @param inputs The items required, can be an ItemStack or an Ore Dictionary entry string.
* @return The recipe created.
*/
public static RecipeElvenTrade registerElvenTradeRecipe(ItemStack output, Object... inputs) {
return registerElvenTradeRecipe(new ItemStack[]{ output }, inputs);
}
/**
* Registers a Brew Recipe (for the Botanical Brewery).
* @param brew The brew in to be set in this recipe.
@@ -10,6 +10,7 @@
*/
package vazkii.botania.api.internal;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
@@ -21,23 +22,8 @@ import net.minecraft.world.WorldServer;
public final class VanillaPacketDispatcher {
public static void dispatchTEToNearbyPlayers(TileEntity tile) {
if(tile.getWorld() instanceof WorldServer) {
WorldServer ws = ((WorldServer) tile.getWorld());
SPacketUpdateTileEntity packet = tile.getUpdatePacket();
if(packet == null)
return;
for (EntityPlayer player : ws.playerEntities) {
EntityPlayerMP playerMP = ((EntityPlayerMP) player);
if (playerMP.getDistanceSq(tile.getPos()) < 64 * 64
&& ws.getPlayerChunkMap().isPlayerWatchingChunk(playerMP, tile.getPos().getX() >> 4, tile.getPos().getZ() >> 4)) {
playerMP.connection.sendPacket(packet);
}
}
}
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
tile.getWorld().notifyBlockUpdate(tile.getPos(), state, state, 8);
}
public static void dispatchTEToNearbyPlayers(World world, BlockPos pos) {
@@ -9,11 +9,11 @@ import java.util.List;
public class RecipeElvenTrade {
private final ItemStack output;
private final ImmutableList<ItemStack> outputs;
private final ImmutableList<Object> inputs;
public RecipeElvenTrade(ItemStack output, Object... inputs) {
this.output = output;
public RecipeElvenTrade(ItemStack[] outputs, Object... inputs) {
this.outputs = ImmutableList.copyOf(outputs);
ImmutableList.Builder<Object> inputsToSet = ImmutableList.builder();
for(Object obj : inputs) {
@@ -88,8 +88,8 @@ public class RecipeElvenTrade {
return inputs;
}
public ItemStack getOutput() {
return output;
public List<ItemStack> getOutputs() {
return outputs;
}
}
@@ -14,6 +14,8 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* Any block that implements this has a HUD rendered when being hovered
@@ -21,6 +23,7 @@ import net.minecraft.world.World;
*/
public interface IWandHUD {
@SideOnly(Side.CLIENT)
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos);
}
@@ -2,6 +2,7 @@ package vazkii.botania.client.core.handler;
import com.google.common.base.Throwables;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import vazkii.botania.common.Botania;
@@ -15,7 +16,8 @@ import java.lang.reflect.Method;
public final class ClientMethodHandles {
public static final MethodHandle
renderPosX_getter, renderPosY_getter, renderPosZ_getter; // RenderManager
renderPosX_getter, renderPosY_getter, renderPosZ_getter, // RenderManager
starGLCallList_getter, starVBO_getter, glSkyList_getter, skyVBO_getter; // RenderGlobal
static {
try {
@@ -30,6 +32,22 @@ public final class ClientMethodHandles {
f = ReflectionHelper.findField(RenderManager.class, LibObfuscation.RENDERPOSZ);
f.setAccessible(true);
renderPosZ_getter = MethodHandles.publicLookup().unreflectGetter(f);
f = ReflectionHelper.findField(RenderGlobal.class, LibObfuscation.STAR_GL_CALL_LIST);
f.setAccessible(true);
starGLCallList_getter = MethodHandles.publicLookup().unreflectGetter(f);
f = ReflectionHelper.findField(RenderGlobal.class, LibObfuscation.STAR_VBO);
f.setAccessible(true);
starVBO_getter = MethodHandles.publicLookup().unreflectGetter(f);
f = ReflectionHelper.findField(RenderGlobal.class, LibObfuscation.GL_SKY_LIST);
f.setAccessible(true);
glSkyList_getter = MethodHandles.publicLookup().unreflectGetter(f);
f = ReflectionHelper.findField(RenderGlobal.class, LibObfuscation.SKY_VBO);
f.setAccessible(true);
skyVBO_getter = MethodHandles.publicLookup().unreflectGetter(f);
} catch (IllegalAccessException e) {
Botania.LOGGER.fatal("Couldn't initialize client methodhandles! Things will be broken!");
e.printStackTrace();
@@ -50,7 +50,6 @@ public final class ClientTickHandler {
if(event.phase == Phase.START)
partialTicks = event.renderTickTime;
else {
TooltipAdditionDisplayHandler.render();
calcDelta();
}
}
@@ -5,28 +5,36 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.common.registry.RegistryDelegate;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.brew.Brew;
import vazkii.botania.api.brew.IBrewItem;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.PoolVariant;
import vazkii.botania.api.state.enums.SpreaderVariant;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.BlockCamo;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.TileCamo;
import vazkii.botania.common.item.IColorable;
import vazkii.botania.common.block.tile.mana.TilePool;
import vazkii.botania.common.entity.EntityManaBurst;
import vazkii.botania.common.item.ItemManaGun;
import vazkii.botania.common.item.ItemManaMirror;
import vazkii.botania.common.item.ItemManaTablet;
import vazkii.botania.common.item.ItemSignalFlare;
import vazkii.botania.common.item.ItemTwigWand;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.bauble.ItemBloodPendant;
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraPick;
import vazkii.botania.common.item.lens.ItemLens;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.awt.*;
import java.util.Map;
@@ -87,17 +95,69 @@ public final class ColorHandler {
ItemColors items = Minecraft.getMinecraft().getItemColors();
items.registerItemColorHandler((stack, tintIndex) -> {
Item item = stack.getItem();
if (item instanceof IColorable) {
return ((IColorable) item).getColorFromItemStack(stack, tintIndex);
} else {
return 0xFFFFFF;
}
}, ModItems.manaResource, ModItems.twigWand, ModItems.dye, ModItems.petal, ModItems.manaGun, ModItems.manaMirror, ModItems.manaTablet, ModItems.signalFlare,
ModItems.spellCloth, ModItems.brewFlask, ModItems.brewVial, ModItems.incenseStick, ModItems.bloodPendant, ModItems.enderDagger,
ModItems.terraPick, ModItems.lens, Item.getItemFromBlock(ModBlocks.manaBeacon), Item.getItemFromBlock(ModBlocks.petalBlock),
Item.getItemFromBlock(ModBlocks.unstableBlock), Item.getItemFromBlock(ModBlocks.pool), Item.getItemFromBlock(ModBlocks.spreader));
items.registerItemColorHandler((s, t) -> (s.getItemDamage() == 5 || s.getItemDamage() == 14)
? Color.HSBtoRGB(Botania.proxy.getWorldElapsedTicks() * 2 % 360 / 360F, 0.25F, 1F) : -1,
ModItems.manaResource);
items.registerItemColorHandler((s, t) ->
t == 1 ? EnumDyeColor.byMetadata(ItemTwigWand.getColor1(s)).getMapColor().colorValue
: t == 2 ? EnumDyeColor.byMetadata(ItemTwigWand.getColor2(s)).getMapColor().colorValue
: -1,
ModItems.twigWand);
items.registerItemColorHandler((s, t) -> EnumDyeColor.byMetadata(s.getItemDamage()).getMapColor().colorValue, ModItems.dye, ModItems.petal);
items.registerItemColorHandler((s, t) -> Minecraft.getMinecraft().getBlockColors().colorMultiplier(((ItemBlock)s.getItem()).block.getStateFromMeta(s.getMetadata()), null, null, t),
ModBlocks.manaBeacon, ModBlocks.petalBlock, ModBlocks.unstableBlock, ModBlocks.pool, ModBlocks.spreader);
items.registerItemColorHandler((s, t) -> t == 1 ? Color.HSBtoRGB(0.528F, ((ItemManaMirror) ModItems.manaMirror).getMana(s) / TilePool.MAX_MANA, 1F) : -1, ModItems.manaMirror);
items.registerItemColorHandler((s, t) -> t == 1 ? Color.HSBtoRGB(0.528F, ((ItemManaTablet) ModItems.manaTablet).getMana(s) / ItemManaTablet.MAX_MANA, 1F) : -1, ModItems.manaTablet);
items.registerItemColorHandler((s, t) -> t == 1 ? EnumDyeColor.byMetadata(ItemSignalFlare.getColor(s)).getMapColor().colorValue : -1, ModItems.signalFlare);
items.registerItemColorHandler((s, t) -> Color.HSBtoRGB(0.55F, ((float) s.getMaxDamage() - (float) s.getItemDamage()) / s.getMaxDamage() * 0.5F, 1F), ModItems.spellCloth);
items.registerItemColorHandler((s, t) -> {
if(t != 1)
return -1;
Brew brew = ((IBrewItem) s.getItem()).getBrew(s);
if(brew == BotaniaAPI.fallbackBrew)
return s.getItem() instanceof ItemBloodPendant ? 0xC6000E : 0x989898;
Color color = new Color(brew.getColor(s));
double speed = s.getItem() == ModItems.brewFlask || s.getItem() == ModItems.brewVial ? 0.1 : 0.2;
int add = (int) (Math.sin(ClientTickHandler.ticksInGame * speed) * 24);
int r = Math.max(0, Math.min(255, color.getRed() + add));
int g = Math.max(0, Math.min(255, color.getGreen() + add));
int b = Math.max(0, Math.min(255, color.getBlue() + add));
return r << 16 | g << 8 | b;
}, ModItems.bloodPendant, ModItems.incenseStick, ModItems.brewFlask, ModItems.brewVial);
items.registerItemColorHandler((s, t) -> {
ItemStack lens = ItemManaGun.getLens(s);
if(lens != null && t == 0)
return Minecraft.getMinecraft().getItemColors().getColorFromItemstack(lens, t);
if(t == 2) {
EntityManaBurst burst = ((ItemManaGun) s.getItem()).getBurst(Minecraft.getMinecraft().thePlayer, s, false);
Color color = new Color(burst == null ? 0x20FF20 : burst.getColor());
float mul = (float) (Math.sin((double) ClientTickHandler.ticksInGame / 5) * 0.15F);
int c = (int) (255 * mul);
return new Color(Math.max(0, Math.min(255, color.getRed() + c)), Math.max(0, Math.min(255, color.getGreen() + c)), Math.max(0, Math.min(255, color.getBlue() + c))).getRGB();
} else return -1;
}, ModItems.manaGun);
items.registerItemColorHandler((s, t) -> t == 1 ? Color.HSBtoRGB(0.75F, 1F, 1.5F - (float) Math.min(1F, Math.sin(System.currentTimeMillis() / 100D) * 0.5 + 1.2F)) : -1, ModItems.enderDagger);
items.registerItemColorHandler((s, t) -> t == 1 && ItemTerraPick.isEnabled(s) ? Color.HSBtoRGB(0.375F, (float) Math.min(1F, Math.sin(System.currentTimeMillis() / 200D) * 0.5 + 1F), 1F) : -1, ModItems.terraPick);
items.registerItemColorHandler((s, t) -> t == 0 ? ((ItemLens) s.getItem()).getLensColor(s) : -1, ModItems.lens);
}
private ColorHandler() {}
@@ -84,8 +84,12 @@ public final class DebugHandler {
state = state.getActualState(world, pos);
state = state.getBlock().getExtendedState(state, world, pos);
if (state instanceof IExtendedBlockState) {
for (Map.Entry<IUnlistedProperty<?>, Optional<?>> e : ((IExtendedBlockState) state).getUnlistedProperties().entrySet()) {
event.getRight().add(e.getKey().getName() + ": " + e.getValue().orNull());
try {
for (Map.Entry<IUnlistedProperty<?>, Optional<?>> e : ((IExtendedBlockState) state).getUnlistedProperties().entrySet()) {
event.getRight().add(TextFormatting.LIGHT_PURPLE + e.getKey().getName() + ": " + TextFormatting.RESET + e.getValue().orNull());
}
} catch (Throwable t) {
event.getRight().add("Error getting extended state");
}
}
}
@@ -10,6 +10,7 @@ package vazkii.botania.client.core.handler;
import com.google.common.collect.Maps;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
@@ -24,6 +25,7 @@ import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.client.model.FloatingFlowerModel;
import vazkii.botania.client.model.GunModel;
import vazkii.botania.client.model.LexiconModel;
import vazkii.botania.client.model.PlatformModel;
import vazkii.botania.common.Botania;
@@ -97,6 +99,15 @@ public class MiscellaneousIcons {
// Lexicon
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:lexicon", "inventory"), new LexiconModel());
// Mana Blaster
ModelResourceLocation key = new ModelResourceLocation("botania:manaGun", "inventory");
IBakedModel originalModel = evt.getModelRegistry().getObject(key);
evt.getModelRegistry().putObject(key, new GunModel(originalModel));
key = new ModelResourceLocation("botania:manaGunClip", "inventory");
originalModel = evt.getModelRegistry().getObject(key);
evt.getModelRegistry().putObject(key, new GunModel(originalModel));
}
@SubscribeEvent
@@ -25,6 +25,8 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.client.event.RenderTooltipEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -47,133 +49,105 @@ public final class TooltipAdditionDisplayHandler {
private static float lexiconLookupTime = 0F;
public static void render() {
@SubscribeEvent
public static void onToolTipRender(RenderTooltipEvent.PostText evt) {
if(evt.getStack() == null)
return;
ItemStack stack = evt.getStack();
Minecraft mc = Minecraft.getMinecraft();
GuiScreen gui = mc.currentScreen;
if(gui != null && gui instanceof GuiContainer && mc.thePlayer != null && mc.thePlayer.inventory.getItemStack() == null) {
GuiContainer container = (GuiContainer) gui;
Slot slot = container.getSlotUnderMouse();
if(slot != null && slot.getHasStack()) {
ItemStack stack = slot.getStack();
if(stack != null) {
ScaledResolution res = new ScaledResolution(mc);
FontRenderer font = mc.fontRendererObj;
int mouseX = Mouse.getX() * res.getScaledWidth() / mc.displayWidth;
int mouseY = res.getScaledHeight() - Mouse.getY() * res.getScaledHeight() / mc.displayHeight;
int width = evt.getWidth();
int height = 3;
int tooltipX = evt.getX();
int tooltipY = evt.getY() - 4;
FontRenderer font = evt.getFontRenderer();
List<String> tooltip;
try {
tooltip = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips);
} catch(Exception e) {
tooltip = new ArrayList<>();
if(stack.getItem() instanceof ItemTerraPick)
drawTerraPick(stack, tooltipX, tooltipY, width, height, font);
else if(stack.getItem() instanceof IManaTooltipDisplay)
drawManaBar(stack, (IManaTooltipDisplay) stack.getItem(), tooltipX, tooltipY, width, height);
EntryData data = LexiconRecipeMappings.getDataForStack(stack);
if(data != null) {
int lexSlot = -1;
ItemStack lexiconStack = null;
for(int i = 0; i < InventoryPlayer.getHotbarSize(); i++) {
ItemStack stackAt = mc.thePlayer.inventory.getStackInSlot(i);
if(stackAt != null && stackAt.getItem() instanceof ILexicon && ((ILexicon) stackAt.getItem()).isKnowledgeUnlocked(stackAt, data.entry.getKnowledgeType())) {
lexiconStack = stackAt;
lexSlot = i;
break;
}
}
if(lexSlot > -1) {
int x = tooltipX - 34;
GlStateManager.disableDepth();
Gui.drawRect(x - 4, tooltipY - 4, x + 20, tooltipY + 26, 0x44000000);
Gui.drawRect(x - 6, tooltipY - 6, x + 22, tooltipY + 28, 0x44000000);
if(ConfigHandler.useShiftForQuickLookup ? GuiScreen.isShiftKeyDown() : GuiScreen.isCtrlKeyDown()) {
lexiconLookupTime += ClientTickHandler.delta;
int cx = x + 8;
int cy = tooltipY + 8;
float r = 12;
float time = 20F;
float angles = lexiconLookupTime / time * 360F;
GlStateManager.disableLighting();
GlStateManager.disableTexture2D();
GlStateManager.shadeModel(GL11.GL_SMOOTH);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
VertexBuffer buf = Tessellator.getInstance().getBuffer();
buf.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
float a = 0.5F + 0.2F * ((float) Math.cos((double) (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) / 10) * 0.5F + 0.5F);
buf.pos(cx, cy, 0).color(0F, 0.5F, 0F, a).endVertex();
for(float i = angles; i > 0; i--) {
double rad = (i - 90) / 180F * Math.PI;
buf.pos(cx + Math.cos(rad) * r, cy + Math.sin(rad) * r, 0).color(0F, 1F, 0F, 1F).endVertex();
}
int width = 0;
for(String s : tooltip)
width = Math.max(width, font.getStringWidth(s) + 2);
int tooltipHeight = (tooltip.size() - 1) * 10 + 5;
int height = 3;
int offx = 11;
int offy = 17;
buf.pos(cx, cy, 0).color(0F, 1F, 0F, 0F).endVertex();
Tessellator.getInstance().draw();
boolean offscreen = mouseX + width + 19 >= res.getScaledWidth();
GlStateManager.disableBlend();
GlStateManager.enableTexture2D();
GlStateManager.shadeModel(GL11.GL_FLAT);
int fixY = res.getScaledHeight() - (mouseY + tooltipHeight);
if(fixY < 0)
offy -= fixY;
if(offscreen)
offx = -13 - width;
if(lexiconLookupTime >= time) {
mc.thePlayer.inventory.currentItem = lexSlot;
Botania.proxy.setEntryToOpen(data.entry);
Botania.proxy.setLexiconStack(lexiconStack);
mc.thePlayer.closeScreen();
ItemLexicon.openBook(mc.thePlayer, lexiconStack, mc.theWorld, false);
if(stack.getItem() instanceof ItemTerraPick)
drawTerraPick(stack, mouseX, mouseY, offx, offy, width, height, font);
else if(stack.getItem() instanceof IManaTooltipDisplay)
drawManaBar(stack, (IManaTooltipDisplay) stack.getItem(), mouseX, mouseY, offx, offy, width, height);
EntryData data = LexiconRecipeMappings.getDataForStack(stack);
if(data != null) {
int lexSlot = -1;
ItemStack lexiconStack = null;
for(int i = 0; i < InventoryPlayer.getHotbarSize(); i++) {
ItemStack stackAt = mc.thePlayer.inventory.getStackInSlot(i);
if(stackAt != null && stackAt.getItem() instanceof ILexicon && ((ILexicon) stackAt.getItem()).isKnowledgeUnlocked(stackAt, data.entry.getKnowledgeType())) {
lexiconStack = stackAt;
lexSlot = i;
break;
}
}
if(lexSlot > -1) {
int x = mouseX + offx - 34;
int y = mouseY - offy;
GlStateManager.disableDepth();
Gui.drawRect(x - 4, y - 4, x + 20, y + 26, 0x44000000);
Gui.drawRect(x - 6, y - 6, x + 22, y + 28, 0x44000000);
if(ConfigHandler.useShiftForQuickLookup ? GuiScreen.isShiftKeyDown() : GuiScreen.isCtrlKeyDown()) {
lexiconLookupTime += ClientTickHandler.delta;
int cx = x + 8;
int cy = y + 8;
float r = 12;
float time = 20F;
float angles = lexiconLookupTime / time * 360F;
GlStateManager.disableLighting();
GlStateManager.disableTexture2D();
GlStateManager.shadeModel(GL11.GL_SMOOTH);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
VertexBuffer buf = Tessellator.getInstance().getBuffer();
buf.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
float a = 0.5F + 0.2F * ((float) Math.cos((double) (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) / 10) * 0.5F + 0.5F);
buf.pos(cx, cy, 0).color(0F, 0.5F, 0F, a).endVertex();
for(float i = angles; i > 0; i--) {
double rad = (i - 90) / 180F * Math.PI;
buf.pos(cx + Math.cos(rad) * r, cy + Math.sin(rad) * r, 0).color(0F, 1F, 0F, 1F).endVertex();
}
buf.pos(cx, cy, 0).color(0F, 1F, 0F, 0F).endVertex();
Tessellator.getInstance().draw();
GlStateManager.disableBlend();
GlStateManager.enableTexture2D();
GlStateManager.shadeModel(GL11.GL_FLAT);
if(lexiconLookupTime >= time) {
mc.thePlayer.inventory.currentItem = lexSlot;
Botania.proxy.setEntryToOpen(data.entry);
Botania.proxy.setLexiconStack(lexiconStack);
mc.thePlayer.closeScreen();
ItemLexicon.openBook(mc.thePlayer, lexiconStack, mc.theWorld, false);
}
} else lexiconLookupTime = 0F;
mc.getRenderItem().renderItemIntoGUI(new ItemStack(ModItems.lexicon), x, y);
GlStateManager.disableLighting();
font.drawStringWithShadow("?", x + 10, y + 8, 0xFFFFFFFF);
GlStateManager.scale(0.5F, 0.5F, 1F);
boolean mac = Minecraft.IS_RUNNING_ON_MAC;
mc.fontRendererObj.drawStringWithShadow(TextFormatting.BOLD + (ConfigHandler.useShiftForQuickLookup ? "Shift" : mac ? "Cmd" : "Ctrl"), (x + 10) * 2 - 16, (y + 8) * 2 + 20, 0xFFFFFFFF);
GlStateManager.scale(2F, 2F, 1F);
GlStateManager.enableDepth();
} else lexiconLookupTime = 0F;
} else lexiconLookupTime = 0F;
}
} else lexiconLookupTime = 0F;
mc.getRenderItem().renderItemIntoGUI(new ItemStack(ModItems.lexicon), x, tooltipY);
GlStateManager.disableLighting();
font.drawStringWithShadow("?", x + 10, tooltipY + 8, 0xFFFFFFFF);
GlStateManager.scale(0.5F, 0.5F, 1F);
boolean mac = Minecraft.IS_RUNNING_ON_MAC;
mc.fontRendererObj.drawStringWithShadow(TextFormatting.BOLD + (ConfigHandler.useShiftForQuickLookup ? "Shift" : mac ? "Cmd" : "Ctrl"), (x + 10) * 2 - 16, (tooltipY + 8) * 2 + 20, 0xFFFFFFFF);
GlStateManager.scale(2F, 2F, 1F);
GlStateManager.enableDepth();
} else lexiconLookupTime = 0F;
} else lexiconLookupTime = 0F;
}
private static void drawTerraPick(ItemStack stack, int mouseX, int mouseY, int offx, int offy, int width, int height, FontRenderer font) {
private static void drawTerraPick(ItemStack stack, int mouseX, int mouseY, int width, int height, FontRenderer font) {
int level = ItemTerraPick.getLevel(stack);
int max = ItemTerraPick.LEVELS[Math.min(ItemTerraPick.LEVELS.length - 1, level + 1)];
boolean ss = level >= ItemTerraPick.LEVELS.length - 1;
@@ -184,33 +158,33 @@ public final class TooltipAdditionDisplayHandler {
float hueOff = (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.01F;
GlStateManager.disableDepth();
Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, 0xFF000000);
Gui.drawRect(mouseX - 1, mouseY - height - 1, mouseX + width + 1, mouseY, 0xFF000000);
for(int i = 0; i < rainbowWidth; i++)
Gui.drawRect(mouseX + offx + i, mouseY - offy - height, mouseX + offx + i + 1, mouseY - offy, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
Gui.drawRect(mouseX + offx + rainbowWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, 0xFF555555);
Gui.drawRect(mouseX + i, mouseY - height, mouseX + i + 1, mouseY, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
Gui.drawRect(mouseX + rainbowWidth, mouseY - height, mouseX + width, mouseY, 0xFF555555);
String rank = I18n.format("botania.rank" + level).replaceAll("&", "\u00a7");
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
GlStateManager.disableLighting();
font.drawStringWithShadow(rank, mouseX + offx, mouseY - offy - 12, 0xFFFFFF);
font.drawStringWithShadow(rank, mouseX, mouseY - 12, 0xFFFFFF);
if(!ss) {
rank = I18n.format("botania.rank" + (level + 1)).replaceAll("&", "\u00a7");
font.drawStringWithShadow(rank, mouseX + offx + width - font.getStringWidth(rank), mouseY - offy - 12, 0xFFFFFF);
font.drawStringWithShadow(rank, mouseX + width - font.getStringWidth(rank), mouseY - 12, 0xFFFFFF);
}
GlStateManager.enableLighting();
GlStateManager.enableDepth();
GL11.glPopAttrib();
}
private static void drawManaBar(ItemStack stack, IManaTooltipDisplay display, int mouseX, int mouseY, int offx, int offy, int width, int height) {
private static void drawManaBar(ItemStack stack, IManaTooltipDisplay display, int mouseX, int mouseY, int width, int height) {
float fraction = display.getManaFractionForDisplay(stack);
int manaBarWidth = (int) Math.ceil(width * fraction);
GlStateManager.disableDepth();
Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, 0xFF000000);
Gui.drawRect(mouseX + offx, mouseY - offy - height, mouseX + offx + manaBarWidth, mouseY - offy, Color.HSBtoRGB(0.528F, ((float) Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2) + 1F) * 0.3F + 0.4F, 1F));
Gui.drawRect(mouseX + offx + manaBarWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, 0xFF555555);
Gui.drawRect(mouseX - 1, mouseY - height - 1, mouseX + width + 1, mouseY, 0xFF000000);
Gui.drawRect(mouseX, mouseY - height, mouseX + manaBarWidth, mouseY, Color.HSBtoRGB(0.528F, ((float) Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2) + 1F) * 0.3F + 0.4F, 1F));
Gui.drawRect(mouseX + manaBarWidth, mouseY - height, mouseX + width, mouseY, 0xFF555555);
}
}
@@ -24,12 +24,6 @@ public final class TooltipHandler {
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void onTooltipEvent(ItemTooltipEvent event) {
if(event.getItemStack().getItem() == Item.getItemFromBlock(Blocks.DIRT) && event.getItemStack().getItemDamage() == 1) {
event.getToolTip().add(I18n.format("botaniamisc.coarseDirt0"));
event.getToolTip().add(I18n.format("botaniamisc.coarseDirt1"));
} else if(event.getItemStack().getItem() == Item.getItemFromBlock(Blocks.MOB_SPAWNER) && event.getEntityPlayer().capabilities.isCreativeMode)
event.getToolTip().add(I18n.format("botaniamisc.spawnerTip"));
if(ItemNBTHelper.detectNBT(event.getItemStack()) && ItemNBTHelper.getBoolean(event.getItemStack(), ItemRegenIvy.TAG_REGEN, false))
event.getToolTip().add(I18n.format("botaniamisc.hasIvy"));
if(ItemNBTHelper.detectNBT(event.getItemStack()) && ItemNBTHelper.getBoolean(event.getItemStack(), ItemKeepIvy.TAG_KEEP, false))
@@ -30,10 +30,12 @@ import net.minecraftforge.client.model.animation.AnimationTESR;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.fml.relauncher.Side;
import vazkii.botania.api.boss.IBotaniaBoss;
import vazkii.botania.api.item.IExtendedPlayerController;
import vazkii.botania.api.lexicon.LexiconEntry;
@@ -60,6 +62,7 @@ import vazkii.botania.client.core.handler.MultiblockRenderHandler;
import vazkii.botania.client.core.handler.PersistentVariableHelper;
import vazkii.botania.client.core.handler.RenderLexicon;
import vazkii.botania.client.core.handler.SubTileRadiusRenderHandler;
import vazkii.botania.client.core.handler.TooltipAdditionDisplayHandler;
import vazkii.botania.client.core.handler.TooltipHandler;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.fx.FXLightning;
@@ -136,7 +139,7 @@ import vazkii.botania.common.block.tile.string.TileRedString;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.helper.MathHelper;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.core.proxy.CommonProxy;
import vazkii.botania.common.core.proxy.IProxy;
import vazkii.botania.common.core.version.AdaptorNotifier;
import vazkii.botania.common.core.version.VersionChecker;
import vazkii.botania.common.entity.EntityBabylonWeapon;
@@ -164,7 +167,7 @@ import java.time.LocalDateTime;
import java.time.Month;
import java.util.Map;
public class ClientProxy extends CommonProxy {
public class ClientProxy implements IProxy {
public static boolean jingleTheBells = false;
public static boolean dootDoot = false;
@@ -184,8 +187,6 @@ public class ClientProxy extends CommonProxy {
Botania.LOGGER.fatal("Persistent Variables couldn't load!!");
}
super.preInit(event);
MinecraftForge.EVENT_BUS.register(MiscellaneousIcons.INSTANCE);
ModelHandler.registerModels();
initRenderers();
@@ -193,7 +194,6 @@ public class ClientProxy extends CommonProxy {
@Override
public void init(FMLInitializationEvent event) {
super.init(event);
ColorHandler.init();
initAuxiliaryRender();
@@ -205,6 +205,7 @@ public class ClientProxy extends CommonProxy {
if(ConfigHandler.boundBlockWireframe)
MinecraftForge.EVENT_BUS.register(BoundTileRenderer.class);
MinecraftForge.EVENT_BUS.register(TooltipHandler.class);
MinecraftForge.EVENT_BUS.register(TooltipAdditionDisplayHandler.class);
MinecraftForge.EVENT_BUS.register(DebugHandler.class);
MinecraftForge.EVENT_BUS.register(SubTileRadiusRenderHandler.class);
MinecraftForge.EVENT_BUS.register(MultiblockRenderHandler.class);
@@ -230,7 +231,6 @@ public class ClientProxy extends CommonProxy {
@Override
public void postInit(FMLPostInitializationEvent event) {
super.postInit(event);
CorporeaAutoCompleteHandler.updateItemList();
}
@@ -327,7 +327,6 @@ public class ClientProxy extends CommonProxy {
@Override
public void setExtraReach(EntityLivingBase entity, float reach) {
super.setExtraReach(entity, reach);
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer player = mc.thePlayer;
if(entity == player) {
@@ -433,11 +432,11 @@ public class ClientProxy extends CommonProxy {
}
@Override
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) {
if(!doParticle(world) && !fake)
public void sparkleFX(double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) {
if(!doParticle() && !fake)
return;
FXSparkle sparkle = new FXSparkle(world, x, y, z, size, r, g, b, m);
FXSparkle sparkle = new FXSparkle(Minecraft.getMinecraft().theWorld, x, y, z, size, r, g, b, m);
sparkle.fake = sparkle.noClip = fake;
if(noclipEnabled)
sparkle.noClip = true;
@@ -460,17 +459,17 @@ public class ClientProxy extends CommonProxy {
}
@Override
public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz, float maxAgeMul) {
if(!doParticle(world))
public void wispFX(double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz, float maxAgeMul) {
if(!doParticle())
return;
FXWisp wisp = new FXWisp(world, x, y, z, size, r, g, b, distanceLimit, depthTest, maxAgeMul);
FXWisp wisp = new FXWisp(Minecraft.getMinecraft().theWorld, x, y, z, size, r, g, b, distanceLimit, depthTest, maxAgeMul);
wisp.setSpeed(motionx, motiony, motionz);
Minecraft.getMinecraft().effectRenderer.addEffect(wisp);
}
private boolean doParticle(World world) {
if(!world.isRemote)
private boolean doParticle() {
if(FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER)
return false;
if(!ConfigHandler.useVanillaParticleLimiter)
@@ -486,8 +485,8 @@ public class ClientProxy extends CommonProxy {
}
@Override
public void lightningFX(World world, Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
Minecraft.getMinecraft().effectRenderer.addEffect(new FXLightning(world, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner));
public void lightningFX(Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
Minecraft.getMinecraft().effectRenderer.addEffect(new FXLightning(Minecraft.getMinecraft().theWorld, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner));
}
@Override
@@ -34,6 +34,7 @@ import java.util.Queue;
public class FXSparkle extends Particle {
private static final ResourceLocation vanillaParticles = new ResourceLocation("textures/particle/particles.png");
public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_PARTICLES);
private static final Queue<FXSparkle> queuedRenders = new ArrayDeque<>();
@@ -73,7 +74,7 @@ public class FXSparkle extends Particle {
ParticleRenderDispatcher.fakeSparkleFxCount = 0;
GlStateManager.color(1.0F, 1.0F, 1.0F, 0.75F);
Minecraft.getMinecraft().renderEngine.bindTexture(ConfigHandler.matrixMode ? ReflectionHelper.getPrivateValue(ParticleManager.class, null, LibObfuscation.PARTICLE_TEXTURES) : particles);
Minecraft.getMinecraft().renderEngine.bindTexture(ConfigHandler.matrixMode ? vanillaParticles : particles);
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
for(FXSparkle sparkle : queuedRenders)
@@ -32,6 +32,7 @@ import java.util.Queue;
public class FXWisp extends Particle {
private static final ResourceLocation vanillaParticles = new ResourceLocation("textures/particle/particles.png");
public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_WISP_LARGE);
private static final Queue<FXWisp> queuedRenders = new ArrayDeque<>();
@@ -81,7 +82,7 @@ public class FXWisp extends Particle {
ParticleRenderDispatcher.depthIgnoringWispFxCount = 0;
GlStateManager.color(1.0F, 1.0F, 1.0F, 0.75F);
Minecraft.getMinecraft().renderEngine.bindTexture(ConfigHandler.matrixMode ? ReflectionHelper.getPrivateValue(ParticleManager.class, null, LibObfuscation.PARTICLE_TEXTURES) : particles);
Minecraft.getMinecraft().renderEngine.bindTexture(ConfigHandler.matrixMode ? vanillaParticles : particles);
if(!queuedRenders.isEmpty()) {
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
@@ -14,6 +14,7 @@ import mezz.jei.api.IModPlugin;
import mezz.jei.api.IModRegistry;
import mezz.jei.api.JEIPlugin;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.state.enums.AltarVariant;
@@ -44,6 +45,9 @@ public class JEIBotaniaPlugin implements IModPlugin {
public void register(@Nonnull IModRegistry registry) {
IJeiHelpers jeiHelpers = registry.getJeiHelpers();
jeiHelpers.getSubtypeRegistry().registerNbtInterpreter(Item.getItemFromBlock(ModBlocks.specialFlower), ItemBlockSpecialFlower::getType);
jeiHelpers.getSubtypeRegistry().registerNbtInterpreter(Item.getItemFromBlock(ModBlocks.floatingSpecialFlower), ItemBlockSpecialFlower::getType);
registry.addRecipeCategories(
new BreweryRecipeCategory(jeiHelpers.getGuiHelper()),
new PureDaisyRecipeCategory(jeiHelpers.getGuiHelper()),
@@ -106,8 +106,11 @@ public class ElvenTradeRecipeCategory implements IRecipeCategory {
posX += 18;
}
recipeLayout.getItemStacks().init(index, false, 93, 41);
recipeLayout.getItemStacks().set(index, wrapper.getOutputs().get(0));
for (int i = 0; i < wrapper.getOutputs().size(); i++) {
ItemStack stack = wrapper.getOutputs().get(i);
recipeLayout.getItemStacks().init(index + i, false, 93 + (i % 2 * 20), 41 + (i / 2 * 20));
recipeLayout.getItemStacks().set(index + i, stack);
}
}
}
@@ -22,7 +22,7 @@ import java.util.List;
public class ElvenTradeRecipeWrapper implements IRecipeWrapper {
private final List input;
private final ItemStack output;
private final List<ItemStack> outputs;
@SuppressWarnings("unchecked")
public ElvenTradeRecipeWrapper(RecipeElvenTrade recipe) {
@@ -36,7 +36,7 @@ public class ElvenTradeRecipeWrapper implements IRecipeWrapper {
}
}
input = builder.build();
output = recipe.getOutput();
outputs = ImmutableList.copyOf(recipe.getOutputs());
}
@Override
@@ -46,7 +46,7 @@ public class ElvenTradeRecipeWrapper implements IRecipeWrapper {
@Override
public List<ItemStack> getOutputs() {
return ImmutableList.of(output);
return outputs;
}
@Override
@@ -167,12 +167,10 @@ public class FloatingFlowerModel implements IBakedModel {
faceQuads.put(e, new ArrayList<>());
// Add flower quads, scaled and translated
for(BakedQuad quad : flower.getQuads(null, null, 0)) {
genBuilder.add(transform(quad, transform));
}
flower.getQuads(null, null, 0).stream().map(q -> transform(q, transform)).forEach(genBuilder::add);
for(EnumFacing e : EnumFacing.VALUES) {
faceQuads.get(e).addAll(flower.getQuads(null, e, 0).stream().map(input -> transform(input, transform)).collect(Collectors.toList()));
List<BakedQuad> faceQ = faceQuads.get(e);
flower.getQuads(null, e, 0).stream().map(input -> transform(input, transform)).forEach(faceQ::add);
}
// Add island quads
@@ -0,0 +1,171 @@
package vazkii.botania.client.model;
import com.google.common.base.Preconditions;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.block.model.ModelManager;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.client.model.IPerspectiveAwareModel;
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import net.minecraftforge.client.model.pipeline.VertexTransformer;
import net.minecraftforge.common.model.TRSRTransformation;
import org.apache.commons.lang3.tuple.Pair;
import vazkii.botania.common.Botania;
import vazkii.botania.common.item.ItemManaGun;
import vazkii.botania.common.item.ModItems;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
import javax.vecmath.Vector3f;
import javax.vecmath.Vector4f;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class GunModel implements IBakedModel {
private final IBakedModel originalModel;
public GunModel(IBakedModel originalModel) {
this.originalModel = Preconditions.checkNotNull(originalModel);
}
private final ItemOverrideList itemHandler = new ItemOverrideList(ImmutableList.of()) {
@Nonnull
@Override
public IBakedModel handleItemState(@Nonnull IBakedModel model, ItemStack stack, @Nonnull World world, @Nonnull EntityLivingBase entity) {
ItemStack lens = ItemManaGun.getLens(stack);
if(lens != null) {
IBakedModel lensModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(lens);
return GunModel.this.getModel(lensModel);
}
else return GunModel.this;
}
};
@Nonnull
@Override
public ItemOverrideList getOverrides() {
return itemHandler;
}
@Nonnull @Override public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { return originalModel.getQuads(state, side, rand); }
@Override public boolean isAmbientOcclusion() { return originalModel.isAmbientOcclusion(); }
@Override public boolean isGui3d() { return originalModel.isGui3d(); }
@Override public boolean isBuiltInRenderer() { return originalModel.isBuiltInRenderer(); }
@Nonnull @Override public TextureAtlasSprite getParticleTexture() { return originalModel.getParticleTexture(); }
@Nonnull @Override public ItemCameraTransforms getItemCameraTransforms() { return originalModel.getItemCameraTransforms(); }
private final IdentityHashMap<IBakedModel, CompositeBakedModel> cache = new IdentityHashMap<>();
private CompositeBakedModel getModel(IBakedModel lens) {
CompositeBakedModel model = cache.get(lens);
if(model == null) {
model = new CompositeBakedModel(lens, originalModel);
cache.put(lens, model);
}
return model;
}
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 class CompositeBakedModel implements IPerspectiveAwareModel {
private final IBakedModel gun;
private final List<BakedQuad> genQuads;
private final Map<EnumFacing, List<BakedQuad>> faceQuads = new EnumMap<>(EnumFacing.class);
CompositeBakedModel(IBakedModel lens, IBakedModel gun) {
this.gun = gun;
ImmutableList.Builder<BakedQuad> genBuilder = ImmutableList.builder();
final TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(-0.4F, 0.25F, 0), null, new Vector3f(0.625F, 0.625F, 0.625F), TRSRTransformation.quatFromXYZ(0, (float) Math.PI / 2, 0)));
for(EnumFacing e : EnumFacing.VALUES)
faceQuads.put(e, new ArrayList<>());
// Add lens quads, scaled and translated
for(BakedQuad quad : lens.getQuads(null, null, 0)) {
genBuilder.add(transform(quad, transform));
}
for(EnumFacing e : EnumFacing.VALUES) {
faceQuads.get(e).addAll(lens.getQuads(null, e, 0).stream().map(input -> transform(input, transform)).collect(Collectors.toList()));
}
// Add gun quads
genBuilder.addAll(gun.getQuads(null, null, 0));
for(EnumFacing e : EnumFacing.VALUES) {
faceQuads.get(e).addAll(gun.getQuads(null, e, 0));
}
genQuads = genBuilder.build();
}
@Nonnull @Override public List<BakedQuad> getQuads(IBlockState state, EnumFacing face, long rand) { return face == null ? genQuads : faceQuads.get(face); }
// Forward all to gun model
@Override public boolean isAmbientOcclusion() { return gun.isAmbientOcclusion(); }
@Override public boolean isGui3d() { return gun.isGui3d(); }
@Override public boolean isBuiltInRenderer() { return gun.isBuiltInRenderer(); }
@Nonnull @Override public TextureAtlasSprite getParticleTexture() { return gun.getParticleTexture();}
@Nonnull @Override public ItemCameraTransforms getItemCameraTransforms() { return gun.getItemCameraTransforms(); }
@Nonnull @Override public ItemOverrideList getOverrides() { return ItemOverrideList.NONE; }
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
if(gun instanceof IPerspectiveAwareModel) {
Pair<? extends IBakedModel, Matrix4f> pair = ((IPerspectiveAwareModel) gun).handlePerspective(cameraTransformType);
if(pair != null && pair.getRight() != null)
return Pair.of(this, pair.getRight());
}
return Pair.of(this, TRSRTransformation.identity().getMatrix());
}
}
}
@@ -1,102 +0,0 @@
/**
* This class was created by <wiiv>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [? (GMT)]
*/
package vazkii.botania.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelBlackHoleCube extends ModelBase {
public final ModelRenderer shape1;
public final ModelRenderer shape1_1;
public final ModelRenderer shape1_2;
public final ModelRenderer shape1_3;
public final ModelRenderer shape1_4;
public final ModelRenderer shape1_5;
public final ModelRenderer shape1_6;
public final ModelRenderer shape1_7;
public final ModelRenderer shape1_8;
public final ModelRenderer shape1_9;
public final ModelRenderer shape1_10;
public final ModelRenderer shape1_11;
public ModelBlackHoleCube() {
textureWidth = 36;
textureHeight = 2;
shape1_3 = new ModelRenderer(this, 0, 0);
shape1_3.setRotationPoint(0.0F, 16.0F, 0.0F);
shape1_3.addBox(-7.0F, 7.0F, -8.0F, 14, 1, 1, 0.0F);
setRotateAngle(shape1_3, 0.0F, 1.5707963267948966F, 0.0F);
shape1_7 = new ModelRenderer(this, 0, 0);
shape1_7.setRotationPoint(0.0F, 16.0F, 0.0F);
shape1_7.addBox(-7.0F, -8.0F, -8.0F, 14, 1, 1, 0.0F);
setRotateAngle(shape1_7, 0.0F, 1.5707963267948966F, 0.0F);
shape1_9 = new ModelRenderer(this, 0, 0);
shape1_9.setRotationPoint(0.0F, 16.0F, 0.0F);
shape1_9.addBox(-7.0F, 7.0F, 7.0F, 14, 1, 1, 0.0F);
setRotateAngle(shape1_9, 0.0F, 3.141592653589793F, 1.5707963267948966F);
shape1_11 = new ModelRenderer(this, 0, 0);
shape1_11.setRotationPoint(0.0F, 16.0F, 0.0F);
shape1_11.addBox(-7.0F, 7.0F, -8.0F, 14, 1, 1, 0.0F);
setRotateAngle(shape1_11, 0.0F, 3.141592653589793F, 1.5707963267948966F);
shape1 = new ModelRenderer(this, 0, 0);
shape1.setRotationPoint(0.0F, 16.0F, 0.0F);
shape1.addBox(-8.0F, 7.0F, 7.0F, 16, 1, 1, 0.0F);
shape1_4 = new ModelRenderer(this, 0, 0);
shape1_4.setRotationPoint(0.0F, 16.0F, 0.0F);
shape1_4.addBox(-8.0F, 7.0F, -8.0F, 16, 1, 1, 0.0F);
shape1_8 = new ModelRenderer(this, 0, 0);
shape1_8.setRotationPoint(0.0F, 16.0F, 0.0F);
shape1_8.addBox(-7.0F, -8.0F, -8.0F, 14, 1, 1, 0.0F);
setRotateAngle(shape1_8, 0.0F, 3.141592653589793F, 1.5707963267948966F);
shape1_2 = new ModelRenderer(this, 0, 0);
shape1_2.setRotationPoint(0.0F, 16.0F, 0.0F);
shape1_2.addBox(-8.0F, -8.0F, -8.0F, 16, 1, 1, 0.0F);
shape1_1 = new ModelRenderer(this, 0, 0);
shape1_1.setRotationPoint(0.0F, 16.0F, 0.0F);
shape1_1.addBox(-8.0F, -8.0F, 7.0F, 16, 1, 1, 0.0F);
shape1_6 = new ModelRenderer(this, 0, 0);
shape1_6.setRotationPoint(0.0F, 16.0F, 0.0F);
shape1_6.addBox(-7.0F, -8.0F, -8.0F, 14, 1, 1, 0.0F);
setRotateAngle(shape1_6, 0.0F, -1.5707963267948966F, 0.0F);
shape1_10 = new ModelRenderer(this, 0, 0);
shape1_10.setRotationPoint(0.0F, 16.0F, 0.0F);
shape1_10.addBox(-7.0F, -8.0F, 7.0F, 14, 1, 1, 0.0F);
setRotateAngle(shape1_10, 0.0F, 3.141592653589793F, 1.5707963267948966F);
shape1_5 = new ModelRenderer(this, 0, 0);
shape1_5.setRotationPoint(0.0F, 16.0F, 0.0F);
shape1_5.addBox(-7.0F, 7.0F, -8.0F, 14, 1, 1, 0.0F);
setRotateAngle(shape1_5, 0.0F, -1.5707963267948966F, 0.0F);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
shape1_3.render(f5);
shape1_7.render(f5);
shape1_9.render(f5);
shape1_11.render(f5);
shape1.render(f5);
shape1_4.render(f5);
shape1_8.render(f5);
shape1_2.render(f5);
shape1_1.render(f5);
shape1_6.render(f5);
shape1_10.render(f5);
shape1_5.render(f5);
}
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
@@ -10,6 +10,7 @@
*/
package vazkii.botania.client.model;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import net.minecraft.client.Minecraft;
@@ -20,23 +21,29 @@ import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.crash.CrashReport;
import net.minecraft.util.ReportedException;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.Attributes;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.obj.OBJLoader;
import net.minecraftforge.client.model.obj.OBJModel;
import net.minecraftforge.client.model.pipeline.LightUtil;
import net.minecraftforge.common.model.IModelPart;
import net.minecraftforge.common.model.IModelState;
import net.minecraftforge.common.model.Models;
import net.minecraftforge.common.model.TRSRTransformation;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.state.enums.PylonVariant;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
public class ModelPylon implements IPylonModel {
private static final Function<ResourceLocation, TextureAtlasSprite> TEXTUREGETTER = input -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(input.toString());
private IBakedModel manaCrystal;
private IBakedModel manaRingsAndPanes;
private IBakedModel manaGems;
@@ -57,23 +64,23 @@ public class ModelPylon implements IPylonModel {
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)
// Hide necessary groups and bake
VertexFormat format = Attributes.DEFAULT_BAKED_FORMAT;
IModelState hideGroups = hideGroups(ImmutableList.of("Crystal_Ring", "Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04",
"Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"));
manaCrystal = manaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
naturaCrystal = naturaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
gaiaCrystal = gaiaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
// Turn on "Crystal"
manaCrystal = manaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
naturaCrystal = naturaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
gaiaCrystal = gaiaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
hideGroups = hideGroups(ImmutableList.of("Crystal", "Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"));
manaRingsAndPanes = manaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
naturaRingsAndPanes = naturaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
gaiaRingsAndPanes = gaiaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
// Turn on "Crystal_Ring", and "Ring_Panel0x"
manaRingsAndPanes = manaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal_Ring", "Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
naturaRingsAndPanes = naturaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal_Ring", "Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
gaiaRingsAndPanes = gaiaModel.bake(new OBJModel.OBJState(ImmutableList.of("Crystal_Ring", "Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
// Turn on "Ring_Gem0x"
manaGems = manaModel.bake(new OBJModel.OBJState(ImmutableList.of("Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
naturaGems = naturaModel.bake(new OBJModel.OBJState(ImmutableList.of("Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
gaiaGems = gaiaModel.bake(new OBJModel.OBJState(ImmutableList.of("Ring_Gem01", "Ring_Gem02", "Ring_Gem03", "Ring_Gem04"), false), Attributes.DEFAULT_BAKED_FORMAT, TEXTUREGETTER::apply);
hideGroups = hideGroups(ImmutableList.of("Crystal", "Crystal_Ring", "Ring_Panel01", "Ring_Panel02", "Ring_Panel03", "Ring_Panel04"));
manaGems = manaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
naturaGems = naturaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
gaiaGems = gaiaModel.bake(hideGroups, format, ModelLoader.defaultTextureGetter());
} catch(Exception e) {
throw new ReportedException(new CrashReport("Error making pylon submodels for TESR!", e));
}
@@ -129,21 +136,30 @@ public class ModelPylon implements IPylonModel {
}
private void renderModel(IBakedModel model) {
renderModel(model, -1);
}
private void renderModel(IBakedModel model, int color) {
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer worldrenderer = tessellator.getBuffer();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
this.renderQuads(worldrenderer, model.getQuads(null, null, 0), color);
for(BakedQuad bakedquad : model.getQuads(null, null, 0))
LightUtil.renderQuadColor(worldrenderer, bakedquad, -1);
tessellator.draw();
}
private void renderQuads(VertexBuffer renderer, List<BakedQuad> quads, int color) {
for(BakedQuad bakedquad : quads)
LightUtil.renderQuadColor(renderer, bakedquad, color);
private IModelState hideGroups(List<String> groups) {
return part -> {
if (part.isPresent()) {
List<String> parts = new ArrayList<>();
Models.getParts(part.get()).forEachRemaining(parts::add);
for (String s : parts) {
if (groups.contains(s)) {
// Hide it
return Optional.of(TRSRTransformation.identity());
}
}
}
return Optional.absent();
};
}
}
@@ -1,50 +0,0 @@
/**
* This class was created by <Kihira>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [? (GMT)]
*/
package vazkii.botania.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelSkullOverride extends ModelBase {
private final ModelRenderer bipedHead;
private final ModelRenderer bipedHeadwear;
public ModelSkullOverride() {
textureWidth = 64;
textureHeight = 32;
bipedHead = new ModelRenderer(this, 0, 0);
bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0F);
bipedHead.setRotationPoint(0.0F, 0.0F, 0.0F);
bipedHeadwear = new ModelRenderer(this, 32, 0);
bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.5F);
bipedHeadwear.setRotationPoint(0.0F, 0.0F, 0.0F);
}
public void renderWithoutRotation(float par1) {
bipedHead.render(par1);
bipedHeadwear.render(par1);
}
@Override
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) {
setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
bipedHead.render(par7);
bipedHeadwear.render(par7);
}
@Override
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) {
bipedHead.rotateAngleY = bipedHeadwear.rotateAngleY = par4 / (180F / (float)Math.PI);
bipedHead.rotateAngleX = bipedHeadwear.rotateAngleX = par5 / (180F / (float)Math.PI);
}
}
@@ -192,15 +192,16 @@ public class SpecialFlowerModel implements IModelCustomData {
@Override
public Optional<IBakedModel> load(@Nonnull String key) {
if (key == null) Botania.LOGGER.error("Null passed to special model cacheloader?!");
Map<Optional<String>, ModelResourceLocation> loadFrom = loadBlocks ? blockModels : itemModels;
ModelResourceLocation loc = loadFrom.get(Optional.of(key));
if(loc == null)
return Optional.empty();
IModel model = ModelLoaderRegistry.getModelOrMissing(loc);
if(model == ModelLoaderRegistry.getMissingModel())
return Optional.empty();
return Optional.of(model.bake(new SimpleModelState(transforms), DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter()));
}
}
@@ -208,18 +209,18 @@ public class SpecialFlowerModel implements IModelCustomData {
@Nonnull
@Override
public List<BakedQuad> getQuads(IBlockState state, EnumFacing face, long rand) {
if(state.getBlock() != ModBlocks.specialFlower)
if(state.getBlock() != ModBlocks.specialFlower) {
Botania.LOGGER.fatal("FOREIGN BLOCK: " + state);
return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel().getQuads(state, face, rand);
Botania.LOGGER.info("Getting " + (face == null ? "gen" : face.getName()) + " quads");
}
IExtendedBlockState extendedState = ((IExtendedBlockState) state);
String subtileId = extendedState.getValue(BotaniaStateProps.SUBTILE_ID);
IBakedModel ret = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel();
if(subtileId != null) { // Todo remove - workaround for subtile ID being null?
Optional<IBakedModel> specialModel = bakedBlockModels.getUnchecked(extendedState.getValue(BotaniaStateProps.SUBTILE_ID));
if(specialModel.isPresent())
ret = specialModel.get();
}
Optional<IBakedModel> specialModel = bakedBlockModels.getUnchecked(subtileId == null ? "" : subtileId);
if(specialModel.isPresent())
ret = specialModel.get();
return ret.getQuads(state, face, rand);
}
@@ -10,11 +10,18 @@
*/
package vazkii.botania.client.render.entity;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.network.datasync.DataParameter;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.entity.EntityCorporeaSpark;
public class RenderCorporeaSpark extends RenderSparkBase<EntityCorporeaSpark> {
@@ -48,13 +55,16 @@ public class RenderCorporeaSpark extends RenderSparkBase<EntityCorporeaSpark> {
@Override
public void renderCallback(EntityCorporeaSpark entity, float pticks) {
/*
int time = entity.getItemDisplayTicks();
if(time == 0)
return;
float absTime = Math.abs(time) - pticks;
ItemStack stack = entity.getDisplayedItem().orNull();
if(stack == null)
return;
GlStateManager.pushMatrix();
GlStateManager.rotate(90F, 1F, 0F, 0F);
float scalef = 1F / 6F;
@@ -64,14 +74,8 @@ public class RenderCorporeaSpark extends RenderSparkBase<EntityCorporeaSpark> {
GlStateManager.color(1F, 1F, 1F, absTime / 10);
GlStateManager.translate(0F, 0F, -2F + (time < 0 ? -absTime : absTime) / 6);
ItemStack stack = entity.getDisplayedItem();
if(stack == null)
return;
Item item = stack.getItem();
boolean block = item instanceof ItemBlock;
Minecraft.getMinecraft().renderEngine.bindTexture(block ? TextureMap.LOCATION_BLOCKS_TEXTURE : TextureMap.locationItemsTexture);
IIcon icon = block ? Block.getBlockFromItem(item).getBlockTextureFromSide(ForgeDirection.UP.ordinal()) : item.getIcon(stack, 0);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
TextureAtlasSprite icon = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, entity.worldObj, null).getParticleTexture();
if(icon != null) {
float minU = icon.getMinU();
@@ -91,7 +95,7 @@ public class RenderCorporeaSpark extends RenderSparkBase<EntityCorporeaSpark> {
GlStateManager.translate(gap * i, 0F, 0F);
for(int j = -shift; j < shift; j++) {
GlStateManager.translate(0F, gap * j, 0F);
ItemRenderer.renderItemIn2D(Tessellator.getInstance(), minU + stepU * (i + shift), minV + stepV * (j + shift + 1), minU + stepU * (i + shift + 1), minV + stepV * (j + shift), icon.getIconWidth() / pieces, icon.getIconHeight() / pieces, 1F / 8F);
IconHelper.renderIconIn3D(Tessellator.getInstance(), minU + stepU * (i + shift), minV + stepV * (j + shift + 1), minU + stepU * (i + shift + 1), minV + stepV * (j + shift), icon.getIconWidth() / pieces, icon.getIconHeight() / pieces, 1F / 8F);
GlStateManager.translate(0F, -gap * j, 0F);
}
GlStateManager.translate(-gap * i, 0F, 0F);
@@ -100,7 +104,6 @@ public class RenderCorporeaSpark extends RenderSparkBase<EntityCorporeaSpark> {
GlStateManager.disableBlend();
GlStateManager.popMatrix();
*/
}
}
@@ -20,6 +20,7 @@ import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.common.core.handler.ConfigHandler;
import javax.annotation.Nonnull;
import java.util.Random;
@@ -28,6 +29,9 @@ public class RenderTileFloatingFlower extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(@Nonnull TileEntity tile, double d0, double d1, double d2, float t, int digProgress) {
if(ConfigHandler.staticFloaters)
return;
if (tile != null)
if (!tile.getWorld().isBlockLoaded(tile.getPos(), false))
return;
@@ -36,13 +36,8 @@ import java.util.Random;
public class RenderTilePylon extends TileEntitySpecialRenderer<TilePylon> {
private static final ResourceLocation textureOld = new ResourceLocation(LibResources.MODEL_PYLON_OLD);
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_PYLON);
private static final ResourceLocation textureGreenOld = new ResourceLocation(LibResources.MODEL_PYLON_GREEN_OLD);
private static final ResourceLocation textureGreen = new ResourceLocation(LibResources.MODEL_PYLON_GREEN);
private static final ResourceLocation texturePinkOld = new ResourceLocation(LibResources.MODEL_PYLON_PINK_OLD);
private static final ResourceLocation texturePink = new ResourceLocation(LibResources.MODEL_PYLON_PINK);
IPylonModel model;
public static boolean green = false;
@@ -39,15 +39,27 @@ import vazkii.botania.client.model.ModelTinyPotato;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.TileTinyPotato;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.bauble.ItemBaubleCosmetic;
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
import javax.annotation.Nonnull;
import java.util.Arrays;
public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPotato> {
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_TINY_POTATO);
private static final ResourceLocation textureGrayscale = new ResourceLocation(LibResources.MODEL_TINY_POTATO_GS);
private static final ResourceLocation textureHalloween = new ResourceLocation(LibResources.MODEL_TINY_POTATO_HALLOWEEN);
private static final ModelTinyPotato model = new ModelTinyPotato();
private final ItemStack[] cosmetics = Arrays.stream(ItemBaubleCosmetic.Variants.values()).map(v -> new ItemStack(ModItems.cosmetic, 1, v.ordinal())).toArray(ItemStack[]::new);
private static boolean matches(String name, String match) {
return name.equals(match) || name.startsWith(match + " ");
}
private static String removeFromFront(String name, String match) {
return name.substring(match.length()).trim();
}
@Override
public void renderTileEntityAt(@Nonnull TileTinyPotato potato, double x, double y, double z, float partialTicks, int destroyStage) {
@@ -62,28 +74,28 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
Minecraft mc = Minecraft.getMinecraft();
mc.renderEngine.bindTexture(ClientProxy.dootDoot ? textureHalloween : texture);
String name = potato.name.toLowerCase();
String name = potato.name.toLowerCase().trim();
boolean usedShader = false;
if (name.startsWith("gaia ")) {
if (matches(name, "gaia")) {
ShaderHelper.useShader(ShaderHelper.doppleganger);
name = name.substring(5);
name = removeFromFront(name, "gaia");
usedShader = true;
} else if (name.startsWith("hot ")) {
} else if (matches(name, "hot")) {
ShaderHelper.useShader(ShaderHelper.halo);
name = name.substring(4);
name = removeFromFront(name, "hot");
usedShader = true;
} else if (name.startsWith("magic ")) {
} else if (matches(name, "magic")) {
ShaderHelper.useShader(ShaderHelper.enchanterRune);
name = name.substring(6);
name = removeFromFront(name, "magic");
usedShader = true;
} else if (name.startsWith("gold ")) {
} else if (matches(name, "gold")) {
ShaderHelper.useShader(ShaderHelper.gold);
name = name.substring(5);
name = removeFromFront(name, "gold");
usedShader = true;
} else if (name.startsWith("snoop ")) {
} else if (matches(name, "snoop")) {
ShaderHelper.useShader(ShaderHelper.terraPlateRune);
name = name.substring(6);
name = removeFromFront(name, "snoop");
usedShader = true;
}
@@ -104,16 +116,23 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
GlStateManager.rotate(rotZ, 0F, 0F, 1F);
GlStateManager.pushMatrix();
if (name.equals("pahimar")) {
GlStateManager.scale(1F, 0.3F, 1F);
GlStateManager.translate(0F, 3.5F, 0F);
} else if (name.equals("kyle hyde"))
mc.renderEngine.bindTexture(textureGrayscale);
else if (name.equals("dinnerbone") || name.equals("grumm")) {
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(0F, -2.625F, 0F);
} else if (name.equals("aureylian"))
GlStateManager.color(1F, 0.5F, 1F);
switch (name) {
case "pahimar":
GlStateManager.scale(1F, 0.3F, 1F);
GlStateManager.translate(0F, 3.5F, 0F);
break;
case "kyle hyde":
mc.renderEngine.bindTexture(textureGrayscale);
break;
case "dinnerbone":
case "grumm":
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(0F, -2.625F, 0F);
break;
case "aureylian":
GlStateManager.color(1F, 0.5F, 1F);
break;
}
boolean render = !(name.equals("mami") || name.equals("soaryn") || name.equals("eloraam") && jump != 0);
@@ -154,14 +173,15 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
} else if (name.equals("skull kid")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(0F, -0.7F, -0.4F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 23));
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, -1.6F, 0F);
renderItem(cosmetics[23]);
} else if (name.equals("kamina")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, -0.6F, 0.4F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 26));
GlStateManager.translate(0F, -1.4F, 0F);
renderItem(cosmetics[26]);
} else if (name.equals("haighyorkie")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
@@ -171,103 +191,98 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
} else if (name.equals("chitoge")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, -0.2F, 0.1F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 7));
GlStateManager.translate(0F, -1F, -0.4F);
renderItem(cosmetics[7]);
} else if (name.equals("direwolf20")) {
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, -1.7F, 0.5F);
renderItem(new ItemStack(ModItems.cosmetic));
GlStateManager.translate(0F, -2.5F, 0.125F);
renderItem(cosmetics[0]);
} else if (name.equals("doctor")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, -0.65F, 0.4F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 25));
GlStateManager.translate(0F, -1.45F, 0F);
renderItem(cosmetics[25]);
} else if (name.equals("snoo")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0.2F, 0F, -0.05F);
GlStateManager.rotate(-20F, 0F, 0F, 1F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 24));
GlStateManager.translate(0F, -0.75F, -0.5F);
renderItem(cosmetics[24]);
} else if (name.equals("charlotte")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, -0.7F, 0.4F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 12));
GlStateManager.translate(0F, -1.6F, 0F);
renderItem(cosmetics[12]);
} else if (name.equals("greg") || name.equals("gregorioust")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.rotate(270F, 0F, 1F, 0F);
GlStateManager.translate(0F, -1F, 0.4F);
GlStateManager.translate(0F, -1.5F, -0.9F);
renderItem(new ItemStack(Items.BOOK));
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.scale(0.3F, 0.3F, 0.3F);
GlStateManager.translate(0F, 2.5F, 1.5F);
renderItem(new ItemStack(Blocks.IRON_ORE));
} else if (name.equals("profmobius")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.rotate(270F, 0F, 1F, 0F);
GlStateManager.translate(0F, -0.7F, 0.4F);
GlStateManager.translate(0F, -1.5F, -0.9F);
renderItem(new ItemStack(Items.BREAD));
} else if (name.equals("martysgames") || name.equals("marty")) {
GlStateManager.scale(0.7F, 0.7F, 0.7F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0.3F, -1.8F, 0.7F);
GlStateManager.rotate(-15F, 0F, 0F, 1F);
GlStateManager.translate(-0.3F, -2.7F, -1.2F);
GlStateManager.rotate(15F, 0F, 0F, 1F);
renderItem(new ItemStack(ModItems.infiniteFruit, 1).setStackDisplayName("das boot"));
} else if (name.equals("tromped")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.rotate(270F, 0F, 1F, 0F);
GlStateManager.translate(0F, -0.7F, 0.4F);
GlStateManager.translate(0F, -1.5F, -0.9F);
renderItem(new ItemStack(ModItems.cacophonium));
} else if (name.equals("kain vinosec")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.translate(-0.3F, -1F, 0.4F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.rotate(270F, 0F, 1F, 0F);
GlStateManager.translate(0.25F, -1.8F, -0.9F);
renderItem(new ItemStack(ModItems.recordGaia1));
GlStateManager.scale(0.5F, 0.5F, 0.5F);
GlStateManager.translate(0F, 0F, -0.85F);
GlStateManager.translate(0F, 0F, 0.85F);
renderItem(new ItemStack(ModItems.recordGaia2));
} else if (name.equals("mankrik")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, 0.3F, 0.1F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 31));
GlStateManager.translate(0F, -0.5F, -0.5F);
renderItem(cosmetics[31]);
} else if (name.equals("kurumi")) {
GlStateManager.scale(0.4F, 0.4F, 0.4F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0.4F, -2F, 1.3F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 17));
GlStateManager.translate(-0.45F, -2.85F, -1.75F);
renderItem(cosmetics[17]);
} else if (name.equals("ichun")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, -0.7F, 0.4F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 15));
GlStateManager.translate(0F, -1.45F, 0F);
renderItem(cosmetics[15]);
} else if (name.equals("wiiv") || name.equals("dylan4ever") || name.equals("dylankaiser")) {
GlStateManager.scale(1.5F, 1.5F, 1.5F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.translate(-0.1F, -0.6F, -0.325F);
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.rotate(270F, 0F, 1F, 0F);
GlStateManager.translate(0F, -1.5F, -0.9F);
renderItem(new ItemStack(Items.PAINTING));
} else if (name.equals("jibril")) {
GlStateManager.scale(1.5F, 1.5F, 1.5F);
GlStateManager.translate(0F, 0.7F, 0F);
GlStateManager.translate(0F, -0.8F, 0F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
ItemFlightTiara.renderHalo(null, partialTicks);
GlStateManager.disableBlend();
GlStateManager.disableLighting();
} else if (name.equals("nebris")) {
GlStateManager.scale(2F, 2F, 2F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
renderItem(new ItemStack(Blocks.GLOWSTONE));
@@ -281,56 +296,64 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
renderBlock(Blocks.PORTAL);
} else if (name.equals("razz") || name.equals("razzleberryfox")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.translate(0, -0.5F, 0.45F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 8));
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.rotate(270F, 0F, 1F, 0F);
GlStateManager.translate(0F, -1.5F, 0F);
renderItem(cosmetics[8]);
} else if (name.equals("etho") || name.equals("ethoslab")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.translate(0F, -0.7F, 0.4F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.rotate(270F, 0F, 1F, 0F);
GlStateManager.translate(0F, -1.5F, -0.9F);
renderItem(new ItemStack(Items.COOKIE));
} else if (name.equals("sethbling")) {
GlStateManager.scale(1.2F, 1.2F, 1.2F);
GlStateManager.rotate(-90F, 0F, 1F, 0F);
GlStateManager.translate(-0.5F, 1.4F, -0.5F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
renderBlock(Blocks.COMMAND_BLOCK);
} else if (name.equals("bdoubleo100") || name.equals("bdoubleo")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0.5F, -0.6F, 0.1F);
GlStateManager.translate(-0.65F, -1.5F, -0.45F);
renderItem(new ItemStack(Items.STICK));
} else if (name.equals("kingdaddydmac")) {
GlStateManager.scale(0.5F, 0.5F, 0.5F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(270F, 0F, 1F, 0F);
GlStateManager.translate(-0.3F, -2F, -1.075F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.translate(0F, -3F, 0.65F);
renderItem(new ItemStack(ModItems.manaRing, 1, 0));
GlStateManager.scale(0.5F, 0.5F, 0.5F);
GlStateManager.translate(0F, 0F, 4F);
GlStateManager.translate(0F, 0F, -4F);
renderItem(new ItemStack(ModItems.manaRing, 1, 0));
GlStateManager.scale(0.8F, 0.8F, 0.8F);
GlStateManager.translate(-1.7F, -1.2F, -0.1F);
GlStateManager.translate(1.25F, -1.25F, 2.25F);
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
renderBlock(Blocks.CAKE);
} else if (name.equals("sjin")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, -0.77F, 0.4F);
renderItem(new ItemStack(ModItems.cosmetic, 1, 27));
GlStateManager.translate(0F, -1.6F, 0F);
renderItem(cosmetics[27]);
} else if (name.equals("martyn") || name.equals("inthelittlewood")) {
GlStateManager.scale(1.25F, 1.25F, 1.25F);
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.rotate(180F, 0F, 1F, 0F);
GlStateManager.translate(0F, 0.05F, 0.1F);
GlStateManager.translate(0F, -0.8F, -0.2F);
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
renderItem(new ItemStack(Blocks.SAPLING, 0, 0));
} else if (name.equals("williewillus")) {
GlStateManager.rotate(180F, 1F, 0F, 0F);
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
renderItem(new ItemStack(Blocks.RED_NETHER_BRICK));
GlStateManager.scale(0.75F, 0.75F, 0.75F);
GlStateManager.translate(-1.1F, -1.25F, 0F);
renderItem(new ItemStack(Blocks.CHORUS_FLOWER));
GlStateManager.translate(2.2F, 0F, 0F);
renderItem(new ItemStack(Blocks.PRISMARINE));
} else if (ContributorFancinessHandler.flowerMap != null && ContributorFancinessHandler.flowerMap.containsKey(name)) {
ItemStack icon = ContributorFancinessHandler.flowerMap.get(name);
if (icon != null) {
@@ -410,7 +433,7 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
GlStateManager.popMatrix();
}
public void renderIcon(TextureAtlasSprite icon) {
private void renderIcon(TextureAtlasSprite icon) {
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
@@ -418,11 +441,12 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
IconHelper.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
}
public void renderItem(ItemStack stack) {
private void renderItem(ItemStack stack) {
Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.HEAD);
}
public void renderBlock(Block block) {
private void renderBlock(Block block) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlockBrightness(block.getDefaultState(), 1.0F);
}
}
}
@@ -13,9 +13,11 @@ package vazkii.botania.client.render.world;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
@@ -23,6 +25,7 @@ import net.minecraft.util.math.Vec3d;
import net.minecraftforge.client.IRenderHandler;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.core.handler.ClientMethodHandles;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.lib.LibObfuscation;
@@ -33,8 +36,8 @@ public class SkyblockSkyRenderer extends IRenderHandler {
private static final ResourceLocation textureSkybox = new ResourceLocation(LibResources.MISC_SKYBOX);
private static final ResourceLocation textureRainbow = new ResourceLocation(LibResources.MISC_RAINBOW);
private static final ResourceLocation textureMoonPhases = new ResourceLocation("textures/environment/moon_phases.png");
private static final ResourceLocation textureSun = new ResourceLocation("textures/environment/sun.png");
private static final ResourceLocation MOON_PHASES_TEXTURES = new ResourceLocation("textures/environment/moon_phases.png");
private static final ResourceLocation SUN_TEXTURES = new ResourceLocation("textures/environment/sun.png");
private static final ResourceLocation[] planetTextures = new ResourceLocation[] {
new ResourceLocation(LibResources.MISC_PLANET + "0.png"),
new ResourceLocation(LibResources.MISC_PLANET + "1.png"),
@@ -44,94 +47,129 @@ public class SkyblockSkyRenderer extends IRenderHandler {
new ResourceLocation(LibResources.MISC_PLANET + "5.png")
};
// Copy of overworld section of RenderGlobal.renderSky(), heavily modified
@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
boolean test = false;
if(test)
return;
// Environment setup
int glSkyList;
net.minecraft.client.renderer.vertex.VertexBuffer skyVBO;
int glSkyList = ReflectionHelper.getPrivateValue(RenderGlobal.class, mc.renderGlobal, LibObfuscation.GL_SKY_LIST);
int glSkyList2 = ReflectionHelper.getPrivateValue(RenderGlobal.class, mc.renderGlobal, LibObfuscation.GL_SKY_LIST2); // Horizon line. We don't have it here
int starGLCallList = ReflectionHelper.getPrivateValue(RenderGlobal.class, mc.renderGlobal, LibObfuscation.STAR_GL_CALL_LIST);
try {
glSkyList = (int) ClientMethodHandles.glSkyList_getter.invokeExact(mc.renderGlobal);
skyVBO = (net.minecraft.client.renderer.vertex.VertexBuffer) ClientMethodHandles.skyVBO_getter.invokeExact(mc.renderGlobal);
} catch (Throwable t) { return; }
// Begin
GlStateManager.disableTexture2D();
Vec3d vec3 = world.getSkyColor(mc.getRenderViewEntity(), partialTicks);
float f1 = (float)vec3.xCoord;
float f2 = (float)vec3.yCoord;
float f3 = (float)vec3.zCoord;
float f6;
Vec3d vec3d = world.getSkyColor(mc.getRenderViewEntity(), partialTicks);
float f = (float)vec3d.xCoord;
float f1 = (float)vec3d.yCoord;
float f2 = (float)vec3d.zCoord;
// Botania - darken when in void
float insideVoid = 0;
if(mc.thePlayer.posY <= -2)
insideVoid = (float) Math.min(1F, -(mc.thePlayer.posY + 2) / 30F);
f = Math.max(0F, f - insideVoid);
f1 = Math.max(0F, f1 - insideVoid);
f2 = Math.max(0F, f2 - insideVoid);
f3 = Math.max(0F, f3 - insideVoid);
Tessellator tessellator1 = Tessellator.getInstance();
/*if (pass != 2) Botania - no anaglyph stuff
{
float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F;
float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F;
float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F;
f = f3;
f1 = f4;
f2 = f5;
}*/
GlStateManager.color(f, f1, f2);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
GlStateManager.depthMask(false);
GlStateManager.enableFog();
GlStateManager.color(f1, f2, f3);
GlStateManager.callList(glSkyList);
GlStateManager.color(f, f1, f2);
if (OpenGlHelper.useVbo())
{
skyVBO.bindBuffer();
GlStateManager.glEnableClientState(32884);
GlStateManager.glVertexPointer(3, 5126, 12, 0);
skyVBO.drawArrays(7);
skyVBO.unbindBuffer();
GlStateManager.glDisableClientState(32884);
}
else
{
GlStateManager.callList(glSkyList);
}
GlStateManager.disableFog();
GlStateManager.disableAlpha();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
RenderHelper.disableStandardItemLighting();
float[] afloat = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(partialTicks), partialTicks);
float f7;
float f8;
float f9;
float f10;
// === Sunset
if(afloat != null) {
if (afloat != null)
{
GlStateManager.disableTexture2D();
GlStateManager.shadeModel(GL11.GL_SMOOTH);
GlStateManager.shadeModel(7425);
GlStateManager.pushMatrix();
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(MathHelper.sin(world.getCelestialAngleRadians(partialTicks)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
f6 = afloat[0];
f7 = afloat[1];
f8 = afloat[2];
float f11;
float f6 = afloat[0];
float f7 = afloat[1];
float f8 = afloat[2];
tessellator1.getBuffer().begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
tessellator1.getBuffer().pos(0.0D, 100.0D, 0.0D).color(f6, f7, f8, afloat[3] * (1F - insideVoid)).endVertex();
byte b0 = 16;
/*if (pass != 2) Botania - no anaglyph stuff
{
float f9 = (f6 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F;
float f10 = (f6 * 30.0F + f7 * 70.0F) / 100.0F;
float f11 = (f6 * 30.0F + f8 * 70.0F) / 100.0F;
f6 = f9;
f7 = f10;
f8 = f11;
}*/
for(int j = 0; j <= b0; ++j) {
f11 = (float)j * (float)Math.PI * 2.0F / (float)b0;
float f12 = MathHelper.sin(f11);
float f13 = MathHelper.cos(f11);
tessellator1.getBuffer().pos((double)(f12 * 120.0F), (double)(f13 * 120.0F), (double)(-f13 * 40.0F * afloat[3])).color(afloat[0], afloat[1], afloat[2], 0.0F).endVertex();
vertexbuffer.begin(6, DefaultVertexFormats.POSITION_COLOR);
vertexbuffer.pos(0.0D, 100.0D, 0.0D).color(f6, f7, f8, afloat[3] * (1F - insideVoid)).endVertex(); // Botania - darken in void
int j = 16;
for (int l = 0; l <= 16; ++l)
{
float f21 = (float)l * ((float)Math.PI * 2F) / 16.0F;
float f12 = MathHelper.sin(f21);
float f13 = MathHelper.cos(f21);
vertexbuffer.pos((double)(f12 * 120.0F), (double)(f13 * 120.0F), (double)(-f13 * 40.0F * afloat[3])).color(afloat[0], afloat[1], afloat[2], 0.0F).endVertex();
}
tessellator1.draw();
tessellator.draw();
GlStateManager.popMatrix();
GlStateManager.shadeModel(GL11.GL_FLAT);
GlStateManager.shadeModel(7424);
}
GlStateManager.enableTexture2D();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.pushMatrix();
f6 = Math.max(0.2F, 1.0F - world.getRainStrength(partialTicks)) * (1F - insideVoid);
f7 = 0.0F;
f8 = 0.0F;
f9 = 0.0F;
GlStateManager.translate(f7, f8, f9);
float f16 = 1.0F - world.getRainStrength(partialTicks);
GlStateManager.color(1.0F, 1.0F, 1.0F, f16);
GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
float f17; // Botania - move declaration up from below "extra stuff"
// Botania - Begin extra stuff
float celAng = world.getCelestialAngle(partialTicks);
float effCelAng = celAng;
if(celAng > 0.5)
effCelAng = 0.5F - (celAng - 0.5F);
// === Planets
f10 = 20F;
float lowA = Math.max(0F, effCelAng - 0.3F) * f6;
f17 = 20F;
float lowA = Math.max(0F, effCelAng - 0.3F) * f16;
float a = Math.max(0.1F, lowA);
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
@@ -140,37 +178,42 @@ public class SkyblockSkyRenderer extends IRenderHandler {
GlStateManager.rotate(90F, 0.5F, 0.5F, 0.0F);
for(int p = 0; p < planetTextures.length; p++) {
mc.renderEngine.bindTexture(planetTextures[p]);
drawObject(tessellator1, f10);
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
tessellator.getBuffer().pos(-f17, 100.0D, -f17).tex(0.0D, 0.0D).endVertex();
tessellator.getBuffer().pos(f17, 100.0D, -f17).tex(1.0D, 0.0D).endVertex();
tessellator.getBuffer().pos(f17, 100.0D, f17).tex(1.0D, 1.0D).endVertex();
tessellator.getBuffer().pos(-f17, 100.0D, f17).tex(0.0D, 1.0D).endVertex();
tessellator.draw();
switch(p) {
case 0:
GlStateManager.rotate(70F, 1F, 0F, 0F);
f10 = 12F;
break;
case 1:
GlStateManager.rotate(120F, 0F, 0F, 1F);
f10 = 15F;
break;
case 2:
GlStateManager.rotate(80F, 1F, 0F, 1F);
f10 = 25F;
break;
case 3:
GlStateManager.rotate(100F, 0F, 0F, 1F);
f10 = 10F;
break;
case 4:
GlStateManager.rotate(-60F, 1F, 0F, 0.5F);
f10 = 40F;
case 0:
GlStateManager.rotate(70F, 1F, 0F, 0F);
f17 = 12F;
break;
case 1:
GlStateManager.rotate(120F, 0F, 0F, 1F);
f17 = 15F;
break;
case 2:
GlStateManager.rotate(80F, 1F, 0F, 1F);
f17 = 25F;
break;
case 3:
GlStateManager.rotate(100F, 0F, 0F, 1F);
f17 = 10F;
break;
case 4:
GlStateManager.rotate(-60F, 1F, 0F, 0.5F);
f17 = 40F;
}
}
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.popMatrix();
// === Rays
mc.renderEngine.bindTexture(textureSkybox);
mc.renderEngine.bindTexture(textureSkybox);
f10 = 20F;
f17 = 20F;
a = lowA;
GlStateManager.pushMatrix();
GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0);
@@ -192,42 +235,42 @@ public class SkyblockSkyRenderer extends IRenderHandler {
float baseAngle = rotSpeed * rotSpeedMod * (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks);
GlStateManager.rotate((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.25F * rotSpeed * rotSpeedMod, 0F, 1F, 0F);
tessellator1.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
for(int i = 0; i < angles; i++) {
int j = i;
if(i % 2 == 0)
j--;
float ang = j * anglePer + baseAngle;
double xp = Math.cos(ang * Math.PI / 180F) * f10;
double zp = Math.sin(ang * Math.PI / 180F) * f10;
double xp = Math.cos(ang * Math.PI / 180F) * f17;
double zp = Math.sin(ang * Math.PI / 180F) * f17;
double yo = Math.sin(fuzzPer * j) * 1;
float ut = ang * uPer;
if(i % 2 == 0) {
tessellator1.getBuffer().pos(xp, yo + y0 + y, zp).tex(ut, 1F).endVertex();
tessellator1.getBuffer().pos(xp, yo + y0, zp).tex(ut, 0).endVertex();
tessellator.getBuffer().pos(xp, yo + y0 + y, zp).tex(ut, 1F).endVertex();
tessellator.getBuffer().pos(xp, yo + y0, zp).tex(ut, 0).endVertex();
} else {
tessellator1.getBuffer().pos(xp, yo + y0, zp).tex(ut, 0).endVertex();
tessellator1.getBuffer().pos(xp, yo + y0 + y, zp).tex(ut, 1F).endVertex();
tessellator.getBuffer().pos(xp, yo + y0, zp).tex(ut, 0).endVertex();
tessellator.getBuffer().pos(xp, yo + y0 + y, zp).tex(ut, 1F).endVertex();
}
}
tessellator1.draw();
tessellator.draw();
switch(p) {
case 0:
GlStateManager.rotate(20F, 1F, 0F, 0F);
GlStateManager.color(1F, 0.4F, 0.4F, a);
fuzzPer = (Math.PI * 14) / angles;
rotSpeed = 0.2F;
break;
case 1:
GlStateManager.rotate(50F, 1F, 0F, 0F);
GlStateManager.color(0.4F, 1F, 0.7F, a);
fuzzPer = (Math.PI * 6) / angles;
rotSpeed = 2F;
break;
case 0:
GlStateManager.rotate(20F, 1F, 0F, 0F);
GlStateManager.color(1F, 0.4F, 0.4F, a);
fuzzPer = (Math.PI * 14) / angles;
rotSpeed = 0.2F;
break;
case 1:
GlStateManager.rotate(50F, 1F, 0F, 0F);
GlStateManager.color(0.4F, 1F, 0.7F, a);
fuzzPer = (Math.PI * 6) / angles;
rotSpeed = 2F;
break;
}
}
GlStateManager.popMatrix();
@@ -235,8 +278,8 @@ public class SkyblockSkyRenderer extends IRenderHandler {
// === Rainbow
GlStateManager.pushMatrix();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
mc.renderEngine.bindTexture(textureRainbow);
f10 = 10F;
mc.renderEngine.bindTexture(textureRainbow);
f17 = 10F;
float effCelAng1 = celAng;
if(effCelAng1 > 0.25F)
effCelAng1 = 1F - effCelAng1;
@@ -251,117 +294,225 @@ public class SkyblockSkyRenderer extends IRenderHandler {
GlStateManager.rotate(angle1, 0F, 1F, 0F);
GlStateManager.rotate(angle2, 0F, 0F, 1F);
tessellator1.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
for(int i = 0; i < angles; i++) {
int j = i;
if(i % 2 == 0)
j--;
float ang = j * anglePer;
double xp = Math.cos(ang * Math.PI / 180F) * f10;
double zp = Math.sin(ang * Math.PI / 180F) * f10;
double xp = Math.cos(ang * Math.PI / 180F) * f17;
double zp = Math.sin(ang * Math.PI / 180F) * f17;
double yo = 0;
float ut = ang * uPer;
if(i % 2 == 0) {
tessellator1.getBuffer().pos(xp, yo + y0 + y, zp).tex(ut, 1F).endVertex();
tessellator1.getBuffer().pos(xp, yo + y0, zp).tex(ut, 0).endVertex();
tessellator.getBuffer().pos(xp, yo + y0 + y, zp).tex(ut, 1F).endVertex();
tessellator.getBuffer().pos(xp, yo + y0, zp).tex(ut, 0).endVertex();
} else {
tessellator1.getBuffer().pos(xp, yo + y0, zp).tex(ut, 0).endVertex();
tessellator1.getBuffer().pos(xp, yo + y0 + y, zp).tex(ut, 1F).endVertex();
tessellator.getBuffer().pos(xp, yo + y0, zp).tex(ut, 0).endVertex();
tessellator.getBuffer().pos(xp, yo + y0 + y, zp).tex(ut, 1F).endVertex();
}
}
tessellator1.draw();
tessellator.draw();
GlStateManager.popMatrix();
GlStateManager.color(1F, 1F, 1F, 1F - insideVoid);
GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0);
// === Sun
// Botania - End extra stuff
GlStateManager.rotate(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
f10 = 60.0F;
mc.renderEngine.bindTexture(textureSun);
drawObject(tessellator1, f10);
// === Moon
f10 = 60.0F;
mc.renderEngine.bindTexture(textureMoonPhases);
int k = world.getMoonPhase();
int l = k % 4;
int i1 = k / 4 % 2;
float f14 = (float)(l + 0) / 4.0F;
float f15 = (float)(i1 + 0) / 2.0F;
float f16 = (float)(l + 1) / 4.0F;
float f17 = (float)(i1 + 1) / 2.0F;
tessellator1.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
tessellator1.getBuffer().pos((double)(-f10), -100.0D, (double)f10).tex((double)f16, (double)f17).endVertex();
tessellator1.getBuffer().pos((double)f10, -100.0D, (double)f10).tex((double)f14, (double)f17).endVertex();
tessellator1.getBuffer().pos((double)f10, -100.0D, (double)(-f10)).tex((double)f14, (double)f15).endVertex();
tessellator1.getBuffer().pos((double)(-f10), -100.0D, (double)(-f10)).tex((double)f16, (double)f15).endVertex();
tessellator1.draw();
// === Stars
f6 *= Math.max(0.1F, effCelAng * 2);
float t = (ClientTickHandler.ticksInGame + partialTicks + 2000) * 0.005F;
GlStateManager.pushMatrix();
/*float*/ f17 = 60.0F; // Botania - 30 -> 60 and move declaration above "extra stuff"
mc.renderEngine.bindTexture(SUN_TEXTURES);
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
vertexbuffer.pos((double)(-f17), 100.0D, (double)(-f17)).tex(0.0D, 0.0D).endVertex();
vertexbuffer.pos((double)f17, 100.0D, (double)(-f17)).tex(1.0D, 0.0D).endVertex();
vertexbuffer.pos((double)f17, 100.0D, (double)f17).tex(1.0D, 1.0D).endVertex();
vertexbuffer.pos((double)(-f17), 100.0D, (double)f17).tex(0.0D, 1.0D).endVertex();
tessellator.draw();
f17 = 60.0F; // Botania - 20 -> 60
mc.renderEngine.bindTexture(MOON_PHASES_TEXTURES);
int i = world.getMoonPhase();
int k = i % 4;
int i1 = i / 4 % 2;
float f22 = (float)(k + 0) / 4.0F;
float f23 = (float)(i1 + 0) / 2.0F;
float f24 = (float)(k + 1) / 4.0F;
float f14 = (float)(i1 + 1) / 2.0F;
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
vertexbuffer.pos((double)(-f17), -100.0D, (double)f17).tex((double)f24, (double)f14).endVertex();
vertexbuffer.pos((double)f17, -100.0D, (double)f17).tex((double)f22, (double)f14).endVertex();
vertexbuffer.pos((double)f17, -100.0D, (double)(-f17)).tex((double)f22, (double)f23).endVertex();
vertexbuffer.pos((double)(-f17), -100.0D, (double)(-f17)).tex((double)f24, (double)f23).endVertex();
tessellator.draw();
GlStateManager.disableTexture2D();
// Botania - Custom star rendering
{
f16 *= Math.max(0.1F, effCelAng * 2);
renderStars(mc, f16, partialTicks);
}
/*float f15 = this.theWorld.getStarBrightness(partialTicks) * f16;
GlStateManager.pushMatrix();
GlStateManager.rotate(t * 3, 0F, 1F, 0F);
GlStateManager.color(1F, 1F, 1F, f6);
GlStateManager.callList(starGLCallList);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.rotate(t, 0F, 1F, 0F);
GlStateManager.color(0.5F, 1F, 1F, f6);
GlStateManager.callList(starGLCallList);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.rotate(t * 2, 0F, 1F, 0F);
GlStateManager.color(1F, 0.75F, 0.75F, f6);
GlStateManager.callList(starGLCallList);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.rotate(t * 3, 0F, 0F, 1F);
GlStateManager.color(1F, 1F, 1F, 0.25F * f6);
GlStateManager.callList(starGLCallList);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.rotate(t, 0F, 0F, 1F);
GlStateManager.color(0.5F, 1F, 1F, 0.25F * f6);
GlStateManager.callList(starGLCallList);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.rotate(t * 2, 0F, 0F, 1F);
GlStateManager.color(1F, 0.75F, 0.75F, 0.25F * f6);
GlStateManager.callList(starGLCallList);
GlStateManager.popMatrix();
GlStateManager.enableTexture2D();
GlStateManager.popMatrix();
if (f15 > 0.0F)
{
GlStateManager.color(f15, f15, f15, f15);
if (this.vboEnabled)
{
this.starVBO.bindBuffer();
GlStateManager.glEnableClientState(32884);
GlStateManager.glVertexPointer(3, 5126, 12, 0);
this.starVBO.drawArrays(7);
this.starVBO.unbindBuffer();
GlStateManager.glDisableClientState(32884);
}
else
{
GlStateManager.callList(this.starGLCallList);
}
}*/
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableFog();
GlStateManager.popMatrix();
// Botania - no horizon rendering
/* GlStateManager.disableTexture2D();
GlStateManager.color(0.0F, 0.0F, 0.0F);
double d0 = this.mc.thePlayer.getPositionEyes(partialTicks).yCoord - this.theWorld.getHorizon();
if (d0 < 0.0D)
{
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, 12.0F, 0.0F);
if (this.vboEnabled)
{
this.sky2VBO.bindBuffer();
GlStateManager.glEnableClientState(32884);
GlStateManager.glVertexPointer(3, 5126, 12, 0);
this.sky2VBO.drawArrays(7);
this.sky2VBO.unbindBuffer();
GlStateManager.glDisableClientState(32884);
}
else
{
GlStateManager.callList(this.glSkyList2);
}
GlStateManager.popMatrix();
float f18 = 1.0F;
float f19 = -((float)(d0 + 65.0D));
float f20 = -1.0F;
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
vertexbuffer.pos(-1.0D, (double)f19, 1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(1.0D, (double)f19, 1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(-1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(-1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(1.0D, (double)f19, -1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(-1.0D, (double)f19, -1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(1.0D, (double)f19, 1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(1.0D, (double)f19, -1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(-1.0D, (double)f19, -1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(-1.0D, (double)f19, 1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(-1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(-1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(-1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(-1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
vertexbuffer.pos(1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex();
tessellator.draw();
}
if (this.theWorld.provider.isSkyColored())
{
GlStateManager.color(f * 0.2F + 0.04F, f1 * 0.2F + 0.04F, f2 * 0.6F + 0.1F);
}
else
{
GlStateManager.color(f, f1, f2);
}
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, -((float)(d0 - 16.0D)), 0.0F);
GlStateManager.callList(this.glSkyList2);
GlStateManager.popMatrix();*/
GlStateManager.enableTexture2D();
GlStateManager.depthMask(true);
}
private void renderStars(Minecraft mc, float alpha, float partialTicks) {
int starGLCallList;
net.minecraft.client.renderer.vertex.VertexBuffer starVBO;
private void drawObject(Tessellator tess, float f10) {
tess.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
tess.getBuffer().pos((double)(-f10), 100.0D, (double)(-f10)).tex(0.0D, 0.0D).endVertex();
tess.getBuffer().pos((double)(f10), 100.0D, (double)(-f10)).tex(1.0D, 0.0D).endVertex();
tess.getBuffer().pos((double)(f10), 100.0D, (double)(f10)).tex(1.0D, 1.0D).endVertex();
tess.getBuffer().pos((double)(-f10), 100.0D, (double)(f10)).tex(0.0D, 1.0D).endVertex();
tess.draw();
try {
starGLCallList = (int) ClientMethodHandles.starGLCallList_getter.invokeExact(mc.renderGlobal);
starVBO = (net.minecraft.client.renderer.vertex.VertexBuffer) ClientMethodHandles.starVBO_getter.invokeExact(mc.renderGlobal);
} catch (Throwable t) { return; }
float t = (ClientTickHandler.ticksInGame + partialTicks + 2000) * 0.005F;
GlStateManager.pushMatrix();
GlStateManager.pushMatrix();
GlStateManager.rotate(t * 3, 0F, 1F, 0F);
GlStateManager.color(1F, 1F, 1F, alpha);
drawVboOrList(starVBO, starGLCallList);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.rotate(t, 0F, 1F, 0F);
GlStateManager.color(0.5F, 1F, 1F, alpha);
drawVboOrList(starVBO, starGLCallList);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.rotate(t * 2, 0F, 1F, 0F);
GlStateManager.color(1F, 0.75F, 0.75F, alpha);
drawVboOrList(starVBO, starGLCallList);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.rotate(t * 3, 0F, 0F, 1F);
GlStateManager.color(1F, 1F, 1F, 0.25F * alpha);
drawVboOrList(starVBO, starGLCallList);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.rotate(t, 0F, 0F, 1F);
GlStateManager.color(0.5F, 1F, 1F, 0.25F * alpha);
drawVboOrList(starVBO, starGLCallList);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.rotate(t * 2, 0F, 0F, 1F);
GlStateManager.color(1F, 0.75F, 0.75F, 0.25F * alpha);
drawVboOrList(starVBO, starGLCallList);
GlStateManager.popMatrix();
GlStateManager.popMatrix();
}
// Excised from many occurences in RenderGlobal
private void drawVboOrList(net.minecraft.client.renderer.vertex.VertexBuffer vbo, int displayList) {
if (OpenGlHelper.useVbo())
{
vbo.bindBuffer();
GlStateManager.glEnableClientState(GL11.GL_VERTEX_ARRAY);
GlStateManager.glVertexPointer(3, GL11.GL_FLOAT, 12, 0);
vbo.drawArrays(GL11.GL_QUADS);
vbo.unbindBuffer();
GlStateManager.glDisableClientState(GL11.GL_VERTEX_ARRAY);
}
else
{
GlStateManager.callList(displayList);
}
}
}
@@ -10,6 +10,16 @@
*/
package vazkii.botania.common;
import net.minecraft.entity.Entity;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityDragonPart;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.item.EntityEnderCrystal;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.entity.item.EntityPainting;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
@@ -23,12 +33,64 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.ITwoNamedPage;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconPage;
import vazkii.botania.common.achievement.ModAchievements;
import vazkii.botania.common.block.ModBanners;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.ModMultiblocks;
import vazkii.botania.common.block.subtile.generating.SubTileNarslimmus;
import vazkii.botania.common.block.tile.TileLightRelay;
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
import vazkii.botania.common.brew.ModBrews;
import vazkii.botania.common.brew.ModPotions;
import vazkii.botania.common.core.command.CommandOpen;
import vazkii.botania.common.core.command.CommandShare;
import vazkii.botania.common.core.command.CommandSkyblockSpread;
import vazkii.botania.common.core.handler.BiomeDecorationHandler;
import vazkii.botania.common.core.handler.CommonTickHandler;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.handler.IMCHandler;
import vazkii.botania.common.core.handler.InternalMethodHandler;
import vazkii.botania.common.core.handler.ManaNetworkHandler;
import vazkii.botania.common.core.proxy.CommonProxy;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.core.handler.PixieHandler;
import vazkii.botania.common.core.handler.SheddingHandler;
import vazkii.botania.common.core.loot.LootHandler;
import vazkii.botania.common.core.proxy.IProxy;
import vazkii.botania.common.crafting.ModBrewRecipes;
import vazkii.botania.common.crafting.ModCraftingRecipes;
import vazkii.botania.common.crafting.ModElvenTradeRecipes;
import vazkii.botania.common.crafting.ModManaAlchemyRecipes;
import vazkii.botania.common.crafting.ModManaConjurationRecipes;
import vazkii.botania.common.crafting.ModManaInfusionRecipes;
import vazkii.botania.common.crafting.ModMigrationRecipes;
import vazkii.botania.common.crafting.ModPetalRecipes;
import vazkii.botania.common.crafting.ModPureDaisyRecipes;
import vazkii.botania.common.crafting.ModRuneRecipes;
import vazkii.botania.common.entity.EntityCorporeaSpark;
import vazkii.botania.common.entity.EntityDoppleganger;
import vazkii.botania.common.entity.EntityFlameRing;
import vazkii.botania.common.entity.EntityMagicLandmine;
import vazkii.botania.common.entity.EntityMagicMissile;
import vazkii.botania.common.entity.EntityManaBurst;
import vazkii.botania.common.entity.EntityPinkWither;
import vazkii.botania.common.entity.EntitySignalFlare;
import vazkii.botania.common.entity.EntitySpark;
import vazkii.botania.common.entity.ModEntities;
import vazkii.botania.common.integration.buildcraft.StatementAPIPlugin;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.network.GuiHandler;
import vazkii.botania.common.network.PacketHandler;
import vazkii.botania.common.world.SkyblockWorldEvents;
import vazkii.botania.common.world.WorldTypeSkyblock;
@Mod(modid = LibMisc.MOD_ID, name = LibMisc.MOD_NAME, version = LibMisc.VERSION, dependencies = LibMisc.DEPENDENCIES,
guiFactory = LibMisc.GUI_FACTORY, acceptedMinecraftVersions = LibMisc.MC_VERSIONS, updateJSON = LibMisc.UPDATE_JSON)
@@ -48,8 +110,8 @@ public class Botania {
@Instance(LibMisc.MOD_ID)
public static Botania instance;
@SidedProxy(serverSide = LibMisc.PROXY_COMMON, clientSide = LibMisc.PROXY_CLIENT)
public static CommonProxy proxy;
@SidedProxy(serverSide = LibMisc.PROXY_SERVER, clientSide = LibMisc.PROXY_CLIENT)
public static IProxy proxy;
public static final Logger LOGGER = LogManager.getLogger(LibMisc.MOD_ID);
@@ -67,27 +129,116 @@ public class Botania {
storageDrawersLoaded = Loader.isModLoaded("StorageDrawers");
BotaniaAPI.internalHandler = new InternalMethodHandler();
ConfigHandler.loadConfig(event.getSuggestedConfigurationFile());
PacketHandler.init();
ModSounds.init();
ModBlocks.init();
ModItems.init();
ModEntities.init();
ModPotions.init();
ModBrews.init();
ModAchievements.init();
ModMultiblocks.init();
ModBanners.init();
if(Botania.gardenOfGlassLoaded)
new WorldTypeSkyblock();
proxy.preInit(event);
}
@EventHandler
public void init(FMLInitializationEvent event) {
ModCraftingRecipes.init();
ModMigrationRecipes.init();
ModPetalRecipes.init();
ModPureDaisyRecipes.init();
ModRuneRecipes.init();
ModManaAlchemyRecipes.init();
ModManaConjurationRecipes.init();
ModManaInfusionRecipes.init();
ModElvenTradeRecipes.init();
ModBrewRecipes.init();
LexiconData.init();
NetworkRegistry.INSTANCE.registerGuiHandler(Botania.instance, new GuiHandler());
MinecraftForge.TERRAIN_GEN_BUS.register(BiomeDecorationHandler.class);
MinecraftForge.EVENT_BUS.register(ManaNetworkHandler.instance);
MinecraftForge.EVENT_BUS.register(PixieHandler.class);
MinecraftForge.EVENT_BUS.register(SheddingHandler.class);
MinecraftForge.EVENT_BUS.register(SubTileNarslimmus.SpawnIntercepter.class);
MinecraftForge.EVENT_BUS.register(TileCorporeaIndex.getInputHandler());
MinecraftForge.EVENT_BUS.register(new LootHandler());
if(Botania.gardenOfGlassLoaded)
MinecraftForge.EVENT_BUS.register(SkyblockWorldEvents.class);
MinecraftForge.EVENT_BUS.register(CommonTickHandler.class);
FMLInterModComms.sendMessage("ProjectE", "interdictionblacklist", EntityManaBurst.class.getCanonicalName());
if(Botania.bcTriggersLoaded)
new StatementAPIPlugin();
proxy.init(event);
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
if(Botania.thaumcraftLoaded) {
ModBrews.initTC();
ModBrewRecipes.initTC();
try {
@SuppressWarnings("unchecked")
Class<? extends Entity> clazz = (Class<? extends Entity>) Class.forName("thaumcraft.common.lib.aura.EntityAuraNode");
BotaniaAPI.blacklistEntityFromGravityRod(clazz);
} catch (ClassNotFoundException ignored) {}
}
ModBlocks.addDispenserBehaviours();
ModBlocks.registerMultiparts();
ConfigHandler.loadPostInit();
LexiconData.postInit();
int words = 0;
for(LexiconEntry entry : BotaniaAPI.getAllEntries())
for(LexiconPage page : entry.pages) {
words += countWords(page.getUnlocalizedName());
if(page instanceof ITwoNamedPage)
words += countWords(((ITwoNamedPage) page).getSecondUnlocalizedName());
}
Botania.LOGGER.info("The Lexica Botania has {} words.", words);
registerDefaultEntityBlacklist();
proxy.postInit(event);
}
// Overriding the internal method handler will break everything as it changes regularly.
// So just don't be a moron and don't override it. Thanks.
@EventHandler
public void serverStarting(FMLServerAboutToStartEvent event) {
proxy.serverAboutToStart(event);
String clname = BotaniaAPI.internalHandler.getClass().getName();
String expect = "vazkii.botania.common.core.handler.InternalMethodHandler";
if(!clname.equals(expect)) {
new IllegalAccessError("The Botania API internal method handler has been overriden. "
+ "This will cause crashes and compatibility issues, and that's why it's marked as"
+ " \"Do not Override\". Whoever had the brilliant idea of overriding it needs to go"
+ " back to elementary school and learn to read. (Expected classname: " + expect + ", Actual classname: " + clname + ")").printStackTrace();
FMLCommonHandler.instance().exitJava(1, true);
}
}
@EventHandler
public void serverStarting(FMLServerStartingEvent event) {
proxy.serverStarting(event);
// todo 1.8 - we don't have a file server yet. event.registerServerCommand(new CommandDownloadLatest());
event.registerServerCommand(new CommandShare());
event.registerServerCommand(new CommandOpen());
if(Botania.gardenOfGlassLoaded)
event.registerServerCommand(new CommandSkyblockSpread());
}
@EventHandler
@@ -100,4 +251,31 @@ public class Botania {
IMCHandler.processMessages(event.getMessages());
}
private int countWords(String s) {
String s1 = I18n.translateToLocal(s);
return s1.split("\\s+").length;
}
private void registerDefaultEntityBlacklist() {
// Vanilla
BotaniaAPI.blacklistEntityFromGravityRod(EntityDragon.class);
BotaniaAPI.blacklistEntityFromGravityRod(EntityDragonPart.class);
BotaniaAPI.blacklistEntityFromGravityRod(EntityWither.class);
BotaniaAPI.blacklistEntityFromGravityRod(EntityItemFrame.class);
BotaniaAPI.blacklistEntityFromGravityRod(EntityEnderCrystal.class);
BotaniaAPI.blacklistEntityFromGravityRod(EntityPainting.class);
// Botania
BotaniaAPI.blacklistEntityFromGravityRod(EntityCorporeaSpark.class);
BotaniaAPI.blacklistEntityFromGravityRod(EntityDoppleganger.class);
BotaniaAPI.blacklistEntityFromGravityRod(EntityFlameRing.class);
BotaniaAPI.blacklistEntityFromGravityRod(EntityMagicLandmine.class);
BotaniaAPI.blacklistEntityFromGravityRod(EntityMagicMissile.class);
BotaniaAPI.blacklistEntityFromGravityRod(EntityManaBurst.class);
BotaniaAPI.blacklistEntityFromGravityRod(EntityPinkWither.class);
BotaniaAPI.blacklistEntityFromGravityRod(EntitySignalFlare.class);
BotaniaAPI.blacklistEntityFromGravityRod(EntitySpark.class);
BotaniaAPI.blacklistEntityFromGravityRod(TileLightRelay.EntityPlayerMover.class);
}
}
@@ -39,7 +39,6 @@ public class BlockAlfPortal extends BlockMod implements IWandable, ILexiconable
super(Material.WOOD, LibBlockNames.ALF_PORTAL);
setHardness(10F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.ALFPORTAL_STATE, AlfPortalState.OFF));
}
@Nonnull
@@ -62,6 +61,11 @@ public class BlockAlfPortal extends BlockMod implements IWandable, ILexiconable
return state.getValue(BotaniaStateProps.ALFPORTAL_STATE).ordinal();
}
@Override
public IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.ALFPORTAL_STATE, AlfPortalState.OFF);
}
@Override
public boolean hasTileEntity(IBlockState state) {
return true;
@@ -51,7 +51,6 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
super(Material.GRASS, LibBlockNames.ALT_GRASS);
setHardness(0.6F);
setSoundType(SoundType.PLANT);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.ALTGRASS_VARIANT, AltGrassVariant.DRY));
setTickRandomly(true);
}
@@ -61,6 +60,11 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.ALTGRASS_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.ALTGRASS_VARIANT, AltGrassVariant.DRY);
}
@Override
public boolean isToolEffective(String type, @Nonnull IBlockState state) {
return type.equals("shovel");
@@ -82,6 +86,7 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> list) {
for(int i = 0; i < 6; i++)
@@ -120,6 +125,7 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
return type == EnumPlantType.Plains || type == EnumPlantType.Beach;
}
@SideOnly(Side.CLIENT)
@Override
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random r) {
if (state.getBlock() != this)
@@ -138,13 +144,13 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
break;
case INFUSED:
if(r.nextInt(100) == 0)
Botania.proxy.sparkleFX(world, pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 0F, 1F, 1F, r.nextFloat() * 0.2F + 1F, 5);
Botania.proxy.sparkleFX(pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 0F, 1F, 1F, r.nextFloat() * 0.2F + 1F, 5);
break;
case MUTATED:
if(r.nextInt(100) == 0) {
if(r.nextInt(100) > 25)
Botania.proxy.sparkleFX(world, pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 1F, 0F, 1F, r.nextFloat() * 0.2F + 1F, 5);
else Botania.proxy.sparkleFX(world, pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 1F, 1F, 0F, r.nextFloat() * 0.2F + 1F, 5);
Botania.proxy.sparkleFX(pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 1F, 0F, 1F, r.nextFloat() * 0.2F + 1F, 5);
else Botania.proxy.sparkleFX(pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 1F, 1F, 0F, r.nextFloat() * 0.2F + 1F, 5);
}
break;
}
@@ -65,9 +65,6 @@ public class BlockAltar extends BlockMod implements ILexiconable {
super(Material.ROCK, LibBlockNames.ALTAR);
setHardness(3.5F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState()
.withProperty(BotaniaStateProps.ALTAR_VARIANT, AltarVariant.DEFAULT)
);
}
@Nonnull
@@ -82,6 +79,12 @@ public class BlockAltar extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.ALTAR_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState()
.withProperty(BotaniaStateProps.ALTAR_VARIANT, AltarVariant.DEFAULT);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.ALTAR_VARIANT).ordinal();
@@ -110,6 +113,7 @@ public class BlockAltar extends BlockMod implements ILexiconable {
return state;
}
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
@@ -121,6 +125,7 @@ public class BlockAltar extends BlockMod implements ILexiconable {
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> list) {
for(int i = 0; i < 9; i++)
@@ -179,7 +184,7 @@ public class BlockAltar extends BlockMod implements ILexiconable {
} else if(stack != null && stack.getItem() == Items.BUCKET && (tile.hasWater || tile.hasLava) && !Botania.gardenOfGlassLoaded) {
ItemStack bucket = tile.hasLava ? new ItemStack(Items.LAVA_BUCKET) : new ItemStack(Items.WATER_BUCKET);
if(stack.stackSize == 1)
player.inventory.setInventorySlotContents(player.inventory.currentItem, bucket);
player.setHeldItem(hand, bucket);
else {
if(!player.inventory.addItemStackToInventory(bucket))
player.dropItem(bucket, false);
@@ -56,7 +56,6 @@ public class BlockAvatar extends BlockMod implements ILexiconable {
super(Material.WOOD, LibBlockNames.AVATAR);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.NORTH));
}
@Nonnull
@@ -73,6 +72,11 @@ public class BlockAvatar extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.CARDINALS);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.NORTH);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.CARDINALS).getIndex();
@@ -159,7 +163,6 @@ public class BlockAvatar extends BlockMod implements ILexiconable {
ModelLoader.setCustomStateMapper(this, new StateMap.Builder().ignore(BotaniaStateProps.CARDINALS).build());
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(this), 0, TileAvatar.class);
ModelHandler.registerCustomItemblock(this, "avatar");
super.registerModels();
}
}
@@ -24,6 +24,8 @@ import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.block.tile.TileBifrost;
@@ -66,6 +68,7 @@ public class BlockBifrost extends BlockMod implements ILexiconable {
return block != this && super.shouldSideBeRendered(state, world, pos, side);
}
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
@@ -20,6 +20,8 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.Botania;
@@ -56,9 +58,10 @@ public class BlockBifrostPerm extends BlockMod implements ILexiconable {
@Override
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
if(rand.nextBoolean())
Botania.proxy.sparkleFX(world, pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.45F + 0.2F * (float) Math.random(), 6);
Botania.proxy.sparkleFX(pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.45F + 0.2F * (float) Math.random(), 6);
}
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
@@ -34,7 +34,6 @@ public class BlockCacophonium extends BlockMod {
protected BlockCacophonium() {
super(Material.WOOD, LibBlockNames.CACOPHONIUM);
setHardness(0.8F);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -43,6 +42,11 @@ public class BlockCacophonium extends BlockMod {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 8 : 0;
@@ -34,7 +34,6 @@ public abstract class BlockCamo extends BlockMod {
}
@Override
@SuppressWarnings("unchecked")
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack currentStack, EnumFacing side, float hitX, float hitY, float hitZ) {
TileEntity tile = world.getTileEntity(pos);
@@ -36,7 +36,7 @@ import java.util.List;
public class BlockCocoon extends BlockMod implements ILexiconable {
private static final AxisAlignedBB AABB = new AxisAlignedBB(3.0/16, 0, 3.0/16, 0.125, 0.875, 0.125);
private static final AxisAlignedBB AABB = new AxisAlignedBB(3.0/16, 0, 3.0/16, 13.0/16, 0.875, 13.0/16);;
protected BlockCocoon() {
super(Material.CLOTH, LibBlockNames.COCOON);
@@ -37,7 +37,6 @@ public class BlockEnderEye extends BlockMod implements ILexiconable {
setHardness(3F);
setResistance(10F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -46,6 +45,11 @@ public class BlockEnderEye extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
@@ -36,7 +36,7 @@ public class BlockFakeAir extends BlockMod {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
public BlockFakeAir() {
super(Material.AIR, LibBlockNames.FAKE_AIR);
super(Material.STRUCTURE_VOID, LibBlockNames.FAKE_AIR);
setTickRandomly(true);
}
@@ -68,7 +68,7 @@ public class BlockFakeAir extends BlockMod {
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
if(shouldRemove(world, pos))
world.setBlockState(pos, Blocks.WATER.getDefaultState());
world.setBlockState(pos, rand.nextInt(10) == 0 ? Blocks.WATER.getDefaultState() : Blocks.AIR.getDefaultState());
}
@Override
@@ -47,7 +47,6 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable {
setHardness(1F);
setSoundType(SoundType.WOOD);
MinecraftForge.EVENT_BUS.register(BlockFelPumpkin.class);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
}
@Nonnull
@@ -56,6 +55,11 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.CARDINALS);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.CARDINALS).getHorizontalIndex();
@@ -64,10 +64,6 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
GameRegistry.addRecipe(new SpecialFloatingFlowerRecipe());
RecipeSorter.register("botania:floatingSpecialFlower", SpecialFloatingFlowerRecipe.class, Category.SHAPELESS, "");
setDefaultState(((IExtendedBlockState) blockState.getBaseState())
.withProperty(BotaniaStateProps.ISLAND_TYPE, IFloatingFlower.IslandType.GRASS)
.withProperty(BotaniaStateProps.SUBTILE_ID, "daybloom")
.withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
}
@Nonnull
@@ -208,6 +204,7 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
((TileSpecialFlower) world.getTileEntity(pos)).onBlockAdded(world, pos, state);
}
@SideOnly(Side.CLIENT)
@Override
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
((TileSpecialFlower) world.getTileEntity(pos)).renderHUD(mc, res);
@@ -38,11 +38,11 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class BlockGaiaHead extends BlockSkull implements IModelRegister, IRegisterCallback {
public class BlockGaiaHead extends BlockSkull implements IModelRegister {
public BlockGaiaHead() {
ModBlocks.ALL_BLOCKS.add(this);
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.GAIA_HEAD));
GameRegistry.register(this);
setUnlocalizedName(LibBlockNames.GAIA_HEAD);
setHardness(1.0F);
}
@@ -91,9 +91,4 @@ public class BlockGaiaHead extends BlockSkull implements IModelRegister, IRegist
public void registerModels() {
ModelLoader.setCustomStateMapper(this, new StateMap.Builder().ignore(FACING, NODROP).build());
}
@Override
public void register() {
GameRegistry.register(this);
}
}
@@ -40,18 +40,19 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
public class BlockGhostRail extends BlockRailBase implements ILexiconable, IRegisterCallback, IModelRegister {
public class BlockGhostRail extends BlockRailBase implements ILexiconable, IModelRegister {
private static final String TAG_FLOAT_TICKS = "Botania_FloatTicks";
public BlockGhostRail() {
super(true);
setCreativeTab(BotaniaCreativeTab.INSTANCE);
ModBlocks.ALL_BLOCKS.add(this);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.RAIL_DIRECTION, EnumRailDirection.NORTH_SOUTH));
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.GHOST_RAIL));
GameRegistry.register(this);
GameRegistry.register(new ItemBlockMod(this), getRegistryName());
setUnlocalizedName(LibBlockNames.GHOST_RAIL);
MinecraftForge.EVENT_BUS.register(BlockGhostRail.class);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.RAIL_DIRECTION, EnumRailDirection.NORTH_SOUTH));
}
@Nonnull
@@ -113,12 +114,6 @@ public class BlockGhostRail extends BlockRailBase implements ILexiconable, IRegi
return BlockRailPowered.SHAPE;
}
@Override
public void register() {
GameRegistry.register(this);
GameRegistry.register(new ItemBlockMod(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void registerModels() {
@@ -62,7 +62,6 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
super(Material.IRON, LibBlockNames.HOURGLASS);
setHardness(2.0F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -77,6 +76,11 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 1 : 0;
@@ -191,6 +195,7 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
return false;
}
@SideOnly(Side.CLIENT)
@Override
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
TileHourglass tile = (TileHourglass) world.getTileEntity(pos);
@@ -44,7 +44,6 @@ public class BlockIncensePlate extends BlockMod implements ILexiconable {
super(Material.WOOD, LibBlockNames.INCENSE_PLATE);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
}
@Nonnull
@@ -53,6 +52,11 @@ public class BlockIncensePlate extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.CARDINALS);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.CARDINALS).getIndex();
@@ -45,7 +45,6 @@ public class BlockLightLauncher extends BlockMod implements ILexiconable {
super(Material.WOOD, LibBlockNames.LIGHT_LAUNCHER);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -60,6 +59,11 @@ public class BlockLightLauncher extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 8 : 0;
@@ -49,7 +49,6 @@ public class BlockLightRelay extends BlockMod implements IWandable, ILexiconable
protected BlockLightRelay() {
super(Material.GLASS, LibBlockNames.LIGHT_RELAY);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.LUMINIZER_VARIANT, LuminizerVariant.DEFAULT).withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -64,6 +63,11 @@ public class BlockLightRelay extends BlockMod implements IWandable, ILexiconable
return new BlockStateContainer(this, BotaniaStateProps.LUMINIZER_VARIANT, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.LUMINIZER_VARIANT, LuminizerVariant.DEFAULT).withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
int meta = state.getValue(BotaniaStateProps.LUMINIZER_VARIANT) == LuminizerVariant.DETECTOR ? 1 : 0;
@@ -88,6 +92,7 @@ public class BlockLightRelay extends BlockMod implements IWandable, ILexiconable
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> list) {
for(int i = 0; i < 2; i++)
@@ -43,7 +43,6 @@ public class BlockLivingrock extends BlockMod implements ILexiconable {
setHardness(2.0F);
setResistance(10.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.LIVINGROCK_VARIANT, LivingRockVariant.DEFAULT));
}
@Nonnull
@@ -52,6 +51,11 @@ public class BlockLivingrock extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.LIVINGROCK_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.LIVINGROCK_VARIANT, LivingRockVariant.DEFAULT);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.LIVINGROCK_VARIANT).ordinal();
@@ -76,6 +80,7 @@ public class BlockLivingrock extends BlockMod implements ILexiconable {
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> stacks) {
for(int i = 0; i < LivingRockVariant.values().length; i++)
@@ -47,7 +47,6 @@ public class BlockLivingwood extends BlockMod implements ILexiconable {
super(Material.WOOD, name);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.LIVINGWOOD_VARIANT, LivingWoodVariant.DEFAULT));
}
@Nonnull
@@ -56,6 +55,11 @@ public class BlockLivingwood extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.LIVINGWOOD_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.LIVINGWOOD_VARIANT, LivingWoodVariant.DEFAULT);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.LIVINGWOOD_VARIANT).ordinal();
@@ -80,6 +84,7 @@ public class BlockLivingwood extends BlockMod implements ILexiconable {
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> stacks) {
for(int i = 0; i < LivingWoodVariant.values().length; i++)
@@ -12,6 +12,7 @@ package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
@@ -25,19 +26,23 @@ import vazkii.botania.common.item.block.ItemBlockElven;
import vazkii.botania.common.item.block.ItemBlockMod;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
public class BlockMod extends Block implements IModelRegister, IRegisterCallback {
public abstract class BlockMod extends Block implements IModelRegister {
public BlockMod(Material par2Material, String name) {
super(par2Material);
setUnlocalizedName(name);
ModBlocks.ALL_BLOCKS.add(this);
setDefaultState(pickDefaultState()); // This MUST happen before registering the block
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
GameRegistry.register(this);
registerItemForm();
if(registerInCreative())
setCreativeTab(BotaniaCreativeTab.INSTANCE);
}
protected IBlockState pickDefaultState() {
return blockState.getBaseState();
}
public void registerItemForm() {
GameRegistry.register(this instanceof IElvenItem ? new ItemBlockElven(this) : new ItemBlockMod(this), getRegistryName());
}
@@ -52,10 +57,4 @@ public class BlockMod extends Block implements IModelRegister, IRegisterCallback
if(Item.getItemFromBlock(this) != null)
ModelHandler.registerBlockToState(this, 0, getDefaultState());
}
@Override
public void register() {
GameRegistry.register(this);
registerItemForm();
}
}
@@ -52,7 +52,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public abstract class BlockModDoubleFlower extends BlockDoublePlant implements ILexiconable, IRegisterCallback, IModelRegister {
public abstract class BlockModDoubleFlower extends BlockDoublePlant implements ILexiconable, IModelRegister {
private static final int COUNT = 8;
private final boolean second;
@@ -62,8 +62,10 @@ public abstract class BlockModDoubleFlower extends BlockDoublePlant implements I
this.setHardness(0.0F);
this.setSoundType(SoundType.PLANT);
String name = LibBlockNames.DOUBLE_FLOWER + (second ? 2 : 1);
ModBlocks.ALL_BLOCKS.add(this);
setDefaultState(pickDefaultState());
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
GameRegistry.register(this);
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
setUnlocalizedName(name);
setHardness(0F);
setTickRandomly(false);
@@ -74,6 +76,8 @@ public abstract class BlockModDoubleFlower extends BlockDoublePlant implements I
@Override
public abstract BlockStateContainer createBlockState();
protected abstract IBlockState pickDefaultState();
@Override
public abstract int getMetaFromState(IBlockState state);
@@ -189,7 +193,7 @@ public abstract class BlockModDoubleFlower extends BlockDoublePlant implements I
int b = (hex & 0xFF);
if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency)
Botania.proxy.sparkleFX(world, pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
}
@@ -221,12 +225,6 @@ public abstract class BlockModDoubleFlower extends BlockDoublePlant implements I
return new ItemStack(Item.getItemFromBlock(state.getBlock()), 1, state.getValue(prop).ordinal() - (second ? 8 : 0));
}
@Override
public final void register() {
GameRegistry.register(this);
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void registerModels() {
@@ -16,11 +16,6 @@ import javax.annotation.Nonnull;
public class BlockModDoubleFlower1 extends BlockModDoubleFlower {
public BlockModDoubleFlower1() {
super(false);
setDefaultState(blockState.getBaseState()
.withProperty(FACING, EnumFacing.SOUTH)
.withProperty(VARIANT, EnumPlantType.SUNFLOWER)
.withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER)
.withProperty(BotaniaStateProps.DOUBLEFLOWER_VARIANT_1, EnumDyeColor.WHITE));
}
@Nonnull
@@ -29,6 +24,15 @@ public class BlockModDoubleFlower1 extends BlockModDoubleFlower {
return new BlockStateContainer(this, FACING, VARIANT, HALF, BotaniaStateProps.DOUBLEFLOWER_VARIANT_1);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState()
.withProperty(FACING, EnumFacing.SOUTH)
.withProperty(VARIANT, EnumPlantType.SUNFLOWER)
.withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER)
.withProperty(BotaniaStateProps.DOUBLEFLOWER_VARIANT_1, EnumDyeColor.WHITE);
}
@Override
public int getMetaFromState(IBlockState state) {
int meta = state.getValue(BotaniaStateProps.DOUBLEFLOWER_VARIANT_1).getMetadata();
@@ -17,11 +17,6 @@ public class BlockModDoubleFlower2 extends BlockModDoubleFlower {
public BlockModDoubleFlower2() {
super(true);
setDefaultState(blockState.getBaseState()
.withProperty(FACING, EnumFacing.SOUTH)
.withProperty(VARIANT, EnumPlantType.SUNFLOWER)
.withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER)
.withProperty(BotaniaStateProps.DOUBLEFLOWER_VARIANT_2, EnumDyeColor.SILVER));
}
@Nonnull
@@ -30,6 +25,15 @@ public class BlockModDoubleFlower2 extends BlockModDoubleFlower {
return new BlockStateContainer(this, FACING, VARIANT, HALF, BotaniaStateProps.DOUBLEFLOWER_VARIANT_2);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState()
.withProperty(FACING, EnumFacing.SOUTH)
.withProperty(VARIANT, EnumPlantType.SUNFLOWER)
.withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER)
.withProperty(BotaniaStateProps.DOUBLEFLOWER_VARIANT_2, EnumDyeColor.SILVER);
}
@Override
public int getMetaFromState(IBlockState state) {
int meta = state.getValue(BotaniaStateProps.DOUBLEFLOWER_VARIANT_2).getMetadata() - 8;
@@ -53,7 +53,7 @@ import javax.annotation.Nonnull;
import java.util.List;
import java.util.Random;
public class BlockModFlower extends BlockFlower implements ILexiconable, IPickupAchievement, IGrowable, IRegisterCallback, IModelRegister {
public class BlockModFlower extends BlockFlower implements ILexiconable, IPickupAchievement, IGrowable, IModelRegister {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.3, 0, 0.3, 0.8, 1, 0.8);
@@ -63,13 +63,14 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
protected BlockModFlower(String name) {
setUnlocalizedName(name);
ModBlocks.ALL_BLOCKS.add(this);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE).withProperty(type, EnumFlowerType.POPPY));
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
GameRegistry.register(this);
registerItemForm();
setHardness(0F);
setSoundType(SoundType.PLANT);
setTickRandomly(false);
setCreativeTab(registerInCreative() ? BotaniaCreativeTab.INSTANCE : null);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE).withProperty(type, EnumFlowerType.POPPY));
}
public void registerItemForm() {
@@ -118,6 +119,7 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
return true;
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, @Nonnull List<ItemStack> stacks) {
for(int i = 0; i < 16; i++)
@@ -129,6 +131,7 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
return getMetaFromState(state);
}
@SideOnly(Side.CLIENT)
@Override
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
int hex = state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
@@ -137,7 +140,7 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
int b = (hex & 0xFF);
if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency)
Botania.proxy.sparkleFX(world, pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
}
@Override
@@ -171,12 +174,6 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
world.setBlockState(pos.up(), flower.getDefaultState().withProperty(color.getMetadata() >= 8 ? BotaniaStateProps.DOUBLEFLOWER_VARIANT_2 : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1, color).withProperty(BlockDoublePlant.HALF, BlockDoublePlant.EnumBlockHalf.UPPER), flags);
}
@Override
public void register() {
GameRegistry.register(this);
registerItemForm();
}
@SideOnly(Side.CLIENT)
@Override
public void registerModels() {
@@ -58,9 +58,6 @@ public class BlockOpenCrate extends BlockMod implements ILexiconable, IWandable,
super(Material.WOOD, LibBlockNames.OPEN_CRATE);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState()
.withProperty(BotaniaStateProps.CRATE_VARIANT, CrateVariant.OPEN)
.withProperty(BotaniaStateProps.CRATE_PATTERN, CratePattern.NONE));
}
@Nonnull
@@ -69,6 +66,13 @@ public class BlockOpenCrate extends BlockMod implements ILexiconable, IWandable,
return new BlockStateContainer(this, BotaniaStateProps.CRATE_VARIANT, BotaniaStateProps.CRATE_PATTERN);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState()
.withProperty(BotaniaStateProps.CRATE_VARIANT, CrateVariant.OPEN)
.withProperty(BotaniaStateProps.CRATE_PATTERN, CratePattern.NONE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.CRATE_VARIANT).ordinal();
@@ -101,6 +105,7 @@ public class BlockOpenCrate extends BlockMod implements ILexiconable, IWandable,
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> stacks) {
for(int i = 0; i < CrateVariant.values().length; i++)
@@ -156,6 +161,7 @@ public class BlockOpenCrate extends BlockMod implements ILexiconable, IWandable,
return crate.onWanded(world, player, stack);
}
@SideOnly(Side.CLIENT)
@Override
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
TileEntity tile = world.getTileEntity(pos);
@@ -58,11 +58,6 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable,
setHardness(2.0F);
setResistance(5.0F);
setSoundType(SoundType.WOOD);
setDefaultState(((IExtendedBlockState) blockState.getBaseState())
.withProperty(BotaniaStateProps.HELD_STATE, null)
.withProperty(BotaniaStateProps.HELD_WORLD, null)
.withProperty(BotaniaStateProps.HELD_POS, null)
.withProperty(BotaniaStateProps.PLATFORM_VARIANT, PlatformVariant.ABSTRUSE));
}
@Nonnull
@@ -72,6 +67,11 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable,
new IUnlistedProperty[] { BotaniaStateProps.HELD_STATE, BotaniaStateProps.HELD_WORLD, BotaniaStateProps.HELD_POS });
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.PLATFORM_VARIANT, PlatformVariant.ABSTRUSE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.PLATFORM_VARIANT).ordinal();
@@ -116,6 +116,7 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable,
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> stacks) {
for(int i = 0; i < PlatformVariant.values().length; i++)
@@ -53,8 +53,6 @@ public class BlockPylon extends BlockMod implements ILexiconable, IInfusionStabi
setHardness(5.5F);
setSoundType(SoundType.METAL);
setLightLevel(0.5F);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.PYLON_VARIANT, PylonVariant.MANA));
}
@Nonnull
@@ -69,6 +67,11 @@ public class BlockPylon extends BlockMod implements ILexiconable, IInfusionStabi
return new BlockStateContainer(this, BotaniaStateProps.PYLON_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.PYLON_VARIANT, PylonVariant.MANA);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.PYLON_VARIANT).ordinal();
@@ -93,6 +96,7 @@ public class BlockPylon extends BlockMod implements ILexiconable, IInfusionStabi
return getMetaFromState(state);
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs par2, List<ItemStack> par3) {
for(int i = 0; i < PylonVariant.values().length; i++)
@@ -32,11 +32,11 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import java.util.Random;
public class BlockSolidVines extends BlockVine implements ILexiconable, IRegisterCallback {
public class BlockSolidVines extends BlockVine implements ILexiconable {
public BlockSolidVines() {
ModBlocks.ALL_BLOCKS.add(this);
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.SOLID_VINE));
GameRegistry.register(this);
setUnlocalizedName(LibBlockNames.SOLID_VINE);
setHardness(0.5F);
setSoundType(SoundType.PLANT);
@@ -66,9 +66,4 @@ public class BlockSolidVines extends BlockVine implements ILexiconable, IRegiste
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
return LexiconData.vineBall;
}
@Override
public void register() {
GameRegistry.register(this);
}
}
@@ -48,7 +48,6 @@ public class BlockSparkChanger extends BlockMod implements ILexiconable {
setHardness(2.0F);
setResistance(10.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, true));
}
@Nonnull
@@ -63,6 +62,11 @@ public class BlockSparkChanger extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, true);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 8 : 0;
@@ -119,7 +123,7 @@ public class BlockSparkChanger extends BlockMod implements ILexiconable {
pstack.stackSize--;
if(pstack.stackSize == 0)
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
player.setHeldItem(hand, null);
return true;
}
@@ -10,7 +10,6 @@
*/
package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.SoundType;
import net.minecraft.block.properties.IProperty;
@@ -18,8 +17,6 @@ import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.particle.ParticleDigging;
import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
@@ -32,11 +29,9 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@@ -57,6 +52,7 @@ import vazkii.botania.api.wand.IWandHUD;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.client.core.handler.ModelHandler;
import vazkii.botania.client.render.IModelRegister;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.tile.TileSpecialFlower;
import vazkii.botania.common.core.BotaniaCreativeTab;
import vazkii.botania.common.item.ModItems;
@@ -69,7 +65,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, IWandable, ILexiconable, IWandHUD, IRegisterCallback, IModelRegister {
public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, IWandable, ILexiconable, IWandHUD, IModelRegister {
static {
BotaniaAPI.subtilesForCreativeMenu.addAll(Arrays.asList(
@@ -125,17 +121,15 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.3, 0, 0.3, 0.8, 1, 0.8);
protected BlockSpecialFlower() {
ModBlocks.ALL_BLOCKS.add(this);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE).withProperty(type, EnumFlowerType.POPPY));
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.SPECIAL_FLOWER));
GameRegistry.register(this);
GameRegistry.register(new ItemBlockSpecialFlower(this), getRegistryName());
setUnlocalizedName(LibBlockNames.SPECIAL_FLOWER);
setHardness(0.1F);
setSoundType(SoundType.PLANT);
setTickRandomly(false);
setCreativeTab(BotaniaCreativeTab.INSTANCE);
setDefaultState(((IExtendedBlockState) blockState.getBaseState())
.withProperty(BotaniaStateProps.SUBTILE_ID, "daybloom")
.withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE).withProperty(type, EnumFlowerType.POPPY)
);
}
@Nonnull
@@ -210,12 +204,14 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
return true;
}
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT;
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, @Nonnull List<ItemStack> stacks) {
for(String s : BotaniaAPI.subtilesForCreativeMenu) {
@@ -342,51 +338,12 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
return ((TileSpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, hand, stack, side, hitX, hitY, hitZ);
}
@SideOnly(Side.CLIENT)
@Override
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
((TileSpecialFlower) world.getTileEntity(pos)).renderHUD(mc, res);
}
@Override
public boolean addLandingEffects(IBlockState state, net.minecraft.world.WorldServer worldObj, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles) {
float f = (float) MathHelper.ceiling_float_int(entity.fallDistance - 3.0F);
double d0 = (double)Math.min(0.2F + f / 15.0F, 10.0F);
if (d0 > 2.5D) {
d0 = 2.5D;
}
int i = (int)(150.0D * d0);
worldObj.spawnParticle(EnumParticleTypes.BLOCK_DUST, entity.posX, entity.posY, entity.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, Block.getStateId(Blocks.WATERLILY.getDefaultState()));
return true;
}
@Override
@SideOnly(Side.CLIENT)
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager effectRenderer) {
if (world.getBlockState(pos).getBlock() == this) {
int i = 4;
ParticleDigging.Factory factory = new ParticleDigging.Factory();
for (int j = 0; j < i; ++j) {
for (int k = 0; k < i; ++k) {
for (int l = 0; l < i; ++l) {
double d0 = (double)pos.getX() + ((double)j + 0.5D) / (double)i;
double d1 = (double)pos.getY() + ((double)k + 0.5D) / (double)i;
double d2 = (double)pos.getZ() + ((double)l + 0.5D) / (double)i;
effectRenderer.addEffect(factory.getEntityFX(-1, world, d0, d1, d2, d0 - (double)pos.getX() - 0.5D, d1 - (double)pos.getY() - 0.5D, d2 - (double)pos.getZ() - 0.5D, Block.getStateId(Blocks.WATERLILY.getDefaultState())));
}
}
}
return true;
} else {
return false;
}
}
@Override
public void register() {
GameRegistry.register(this);
GameRegistry.register(new ItemBlockSpecialFlower(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void registerModels() {
@@ -43,7 +43,6 @@ public class BlockStorage extends BlockMod implements ILexiconable {
setHardness(3F);
setResistance(10F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.STORAGE_VARIANT, StorageVariant.MANASTEEL));
}
@Nonnull
@@ -52,6 +51,11 @@ public class BlockStorage extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.STORAGE_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.STORAGE_VARIANT, StorageVariant.MANASTEEL);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.STORAGE_VARIANT).ordinal();
@@ -66,6 +70,7 @@ public class BlockStorage extends BlockMod implements ILexiconable {
return getDefaultState().withProperty(BotaniaStateProps.STORAGE_VARIANT, StorageVariant.values()[meta]);
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs par2, List<ItemStack> par3) {
for(int i = 0; i < StorageVariant.values().length; i++)
@@ -1,8 +0,0 @@
package vazkii.botania.common.block;
public interface IRegisterCallback {
/**
* Register block and any itemblocks
*/
void register();
}
@@ -180,7 +180,6 @@ import java.util.Set;
public final class ModBlocks {
public static final Set<Block> ALL_BLOCKS = new HashSet<>();
public static Block flower;
public static Block altar;
public static Block livingrock;
@@ -356,14 +355,6 @@ public final class ModBlocks {
ModFluffBlocks.init();
for (Block b : ALL_BLOCKS) {
if (b instanceof IRegisterCallback) {
((IRegisterCallback) b).register();
} else {
throw new RuntimeException(b.getRegistryName() + " doesn't have register callbacks!");
}
}
for(int i = 0; i < 16; i++)
OreDictionary.registerOre(LibOreDict.FLOWER[i], new ItemStack(flower, 1, i));
@@ -49,7 +49,6 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexi
super(Material.IRON, LibBlockNames.CORPOREA_CRYSTAL_CUBE);
setHardness(5.5F);
setSoundType(SoundType.METAL);
setDefaultState(((IExtendedBlockState) blockState.getBaseState()).withProperty(Properties.AnimationProperty, null).withProperty(Properties.StaticProperty, true));
}
@Nonnull
@@ -58,6 +57,11 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexi
return new ExtendedBlockState(this, new IProperty[] { Properties.StaticProperty }, new IUnlistedProperty[] { Properties.AnimationProperty } );
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(Properties.StaticProperty, true);
}
@Override
public int getMetaFromState(IBlockState state) {
return 0;
@@ -35,7 +35,6 @@ public class BlockCorporeaFunnel extends BlockCorporeaBase implements ILexiconab
super(Material.IRON, LibBlockNames.CORPOREA_FUNNEL);
setHardness(5.5F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -44,6 +43,11 @@ public class BlockCorporeaFunnel extends BlockCorporeaBase implements ILexiconab
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 8 : 0;
@@ -37,7 +37,6 @@ public class BlockCorporeaInterceptor extends BlockCorporeaBase implements ILexi
super(Material.IRON, LibBlockNames.CORPOREA_INTERCEPTOR);
setHardness(5.5F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -46,6 +45,11 @@ public class BlockCorporeaInterceptor extends BlockCorporeaBase implements ILexi
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 1 : 0;
@@ -40,7 +40,6 @@ public class BlockCorporeaRetainer extends BlockMod implements ILexiconable, ICr
super(Material.IRON, LibBlockNames.CORPOREA_RETAINER);
setHardness(5.5F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -49,6 +48,11 @@ public class BlockCorporeaRetainer extends BlockMod implements ILexiconable, ICr
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 8 : 0;
@@ -46,6 +46,7 @@ public class BlockBuriedPetals extends BlockModFlower {
return AABB;
}
@SideOnly(Side.CLIENT)
@Override
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
EnumDyeColor color = state.getValue(BotaniaStateProps.COLOR);
@@ -55,7 +56,7 @@ public class BlockBuriedPetals extends BlockModFlower {
int b = (hex & 0xFF);
Botania.proxy.setSparkleFXNoClip(true);
Botania.proxy.sparkleFX(world, pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.1 + rand.nextFloat() * 0.1, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.1 + rand.nextFloat() * 0.1, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
Botania.proxy.setSparkleFXNoClip(false);
}
@@ -44,7 +44,6 @@ public class BlockCustomBrick extends BlockMod implements ILexiconable {
setHardness(2.0F);
setResistance(5.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CUSTOMBRICK_VARIANT, CustomBrickVariant.HELLISH_BRICK));
}
@Nonnull
@@ -53,6 +52,11 @@ public class BlockCustomBrick extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.CUSTOMBRICK_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.CUSTOMBRICK_VARIANT, CustomBrickVariant.HELLISH_BRICK);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.CUSTOMBRICK_VARIANT).ordinal();
@@ -77,6 +81,7 @@ public class BlockCustomBrick extends BlockMod implements ILexiconable {
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> stacks) {
for(int i = 0; i < CustomBrickVariant.values().length; i++)
@@ -10,31 +10,25 @@
*/
package vazkii.botania.common.block.decor;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.particle.ParticleDigging;
import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.model.ModelLoader;
@@ -81,10 +75,6 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu
setHardness(0.5F);
setSoundType(SoundType.GROUND);
setLightLevel(1F);
setDefaultState(((IExtendedBlockState) blockState.getBaseState())
.withProperty(BotaniaStateProps.ISLAND_TYPE, IslandType.GRASS)
.withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
}
@Nonnull
@@ -96,7 +86,13 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu
@Nonnull
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
return ConfigHandler.staticFloaters ? EnumBlockRenderType.MODEL : EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
}
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT;
}
@Nonnull
@@ -105,6 +101,11 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu
return new ExtendedBlockState(this, new IProperty[] { BotaniaStateProps.COLOR }, new IUnlistedProperty[] { BotaniaStateProps.ISLAND_TYPE });
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.COLOR).getMetadata();
@@ -132,40 +133,6 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu
return state;
}
@Override
public boolean addLandingEffects(IBlockState state, net.minecraft.world.WorldServer worldObj, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles) {
float f = (float) MathHelper.ceiling_float_int(entity.fallDistance - 3.0F);
double d0 = (double)Math.min(0.2F + f / 15.0F, 10.0F);
if (d0 > 2.5D) {
d0 = 2.5D;
}
int i = (int)(150.0D * d0);
worldObj.spawnParticle(EnumParticleTypes.BLOCK_DUST, entity.posX, entity.posY, entity.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, Block.getStateId(Blocks.DIRT.getDefaultState()));
return true;
}
@Override
@SideOnly(Side.CLIENT)
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager effectRenderer) {
if (world.getBlockState(pos).getBlock() == this) {
int i = 4;
ParticleDigging.Factory factory = new ParticleDigging.Factory();
for (int j = 0; j < i; ++j) {
for (int k = 0; k < i; ++k) {
for (int l = 0; l < i; ++l) {
double d0 = (double)pos.getX() + ((double)j + 0.5D) / (double)i;
double d1 = (double)pos.getY() + ((double)k + 0.5D) / (double)i;
double d2 = (double)pos.getZ() + ((double)l + 0.5D) / (double)i;
effectRenderer.addEffect(factory.getEntityFX(-1, world, d0, d1, d2, d0 - (double)pos.getX() - 0.5D, d1 - (double)pos.getY() - 0.5D, d2 - (double)pos.getZ() - 0.5D, Block.getStateId(Blocks.DIRT.getDefaultState())));
}
}
}
return true;
} else {
return false;
}
}
@Override
public void registerItemForm() {
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
@@ -180,7 +147,7 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu
int b = (hex & 0xFF);
if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency)
Botania.proxy.sparkleFX(world, pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
}
@SideOnly(Side.CLIENT)
@@ -35,7 +35,7 @@ import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.client.core.handler.ModelHandler;
import vazkii.botania.common.block.BlockMod;
import vazkii.botania.common.block.tile.TileManaBeacon;
import vazkii.botania.common.item.block.ItemBlockWithMetaNameAndColor;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
@@ -51,7 +51,6 @@ public class BlockManaBeacon extends BlockMod implements ILexiconable {
setHardness(5.0F);
setResistance(10.0F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
}
@Nonnull
@@ -60,6 +59,11 @@ public class BlockManaBeacon extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.COLOR);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.COLOR).getMetadata();
@@ -80,6 +84,7 @@ public class BlockManaBeacon extends BlockMod implements ILexiconable {
return AABB;
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> stacks) {
for(int i = 0; i < 16; i++)
@@ -88,7 +93,7 @@ public class BlockManaBeacon extends BlockMod implements ILexiconable {
@Override
public void registerItemForm() {
GameRegistry.register(new ItemBlockWithMetaNameAndColor(this), getRegistryName());
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@Override
@@ -91,7 +91,7 @@ public class BlockManaFlame extends BlockMod implements ILexiconable {
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos) {
return null;
return NULL_AABB;
}
@Override
@@ -21,6 +21,8 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.block.BlockMod;
@@ -47,12 +49,14 @@ public class BlockManaGlass extends BlockMod implements ILexiconable {
return false;
}
@SideOnly(Side.CLIENT)
@Override
public boolean shouldSideBeRendered(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side) {
Block block = world.getBlockState(pos.offset(side)).getBlock();
return block == this ? false : super.shouldSideBeRendered(state, world, pos, side);
}
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
@@ -54,12 +54,11 @@ import java.util.List;
import java.util.Random;
@Optional.Interface(modid = "Thaumcraft", iface = "thaumcraft.api.crafting.IInfusionStabiliser", striprefs = true)
public class BlockModMushroom extends BlockMushroom implements IInfusionStabiliser, IHornHarvestable, ILexiconable, IRegisterCallback, IModelRegister {
public class BlockModMushroom extends BlockMushroom implements IInfusionStabiliser, IHornHarvestable, ILexiconable, IModelRegister {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.3, 0, 0.3, 0.8, 1, 0.8);
public BlockModMushroom() {
ModBlocks.ALL_BLOCKS.add(this);
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.MUSHROOM));
setUnlocalizedName(LibBlockNames.MUSHROOM);
setLightLevel(0.2F);
@@ -68,6 +67,8 @@ public class BlockModMushroom extends BlockMushroom implements IInfusionStabilis
setTickRandomly(false);
setCreativeTab(BotaniaCreativeTab.INSTANCE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
GameRegistry.register(this);
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@Nonnull
@@ -131,7 +132,7 @@ public class BlockModMushroom extends BlockMushroom implements IInfusionStabilis
int b = (hex & 0xFF);
if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency * 0.25F)
Botania.proxy.sparkleFX(world, pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
}
@Override
@@ -157,12 +158,6 @@ public class BlockModMushroom extends BlockMushroom implements IInfusionStabilis
@Override
public void harvestByHorn(World world, BlockPos pos, ItemStack stack, EnumHornType hornType) {}
@Override
public void register() {
GameRegistry.register(this);
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void registerModels() {
@@ -43,7 +43,6 @@ public class BlockPavement extends BlockMod {
setHardness(2.0F);
setResistance(10.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.PAVEMENT_COLOR, EnumDyeColor.WHITE));
}
@Nonnull
@@ -52,6 +51,11 @@ public class BlockPavement extends BlockMod {
return new BlockStateContainer(this, BotaniaStateProps.PAVEMENT_COLOR);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.PAVEMENT_COLOR, EnumDyeColor.WHITE);
}
@Override
public int getMetaFromState(IBlockState state) {
switch (state.getValue(BotaniaStateProps.PAVEMENT_COLOR)) {
@@ -95,6 +99,7 @@ public class BlockPavement extends BlockMod {
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> stacks) {
for(int i = 0; i < TYPES; i++)
@@ -31,7 +31,7 @@ import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.client.core.handler.ModelHandler;
import vazkii.botania.common.block.BlockMod;
import vazkii.botania.common.item.block.ItemBlockWithMetaNameAndColor;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
@@ -44,7 +44,6 @@ public class BlockPetalBlock extends BlockMod implements ILexiconable {
super(Material.PLANTS, LibBlockNames.PETAL_BLOCK);
setHardness(0.4F);
setSoundType(SoundType.PLANT);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
}
@Nonnull
@@ -53,6 +52,11 @@ public class BlockPetalBlock extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.COLOR);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.COLOR).getMetadata();
@@ -67,6 +71,7 @@ public class BlockPetalBlock extends BlockMod implements ILexiconable {
return getDefaultState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.byMetadata(meta));
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> list) {
for(int i = 0; i < 16; i++)
@@ -75,7 +80,7 @@ public class BlockPetalBlock extends BlockMod implements ILexiconable {
@Override
public void registerItemForm() {
GameRegistry.register(new ItemBlockWithMetaNameAndColor(this), getRegistryName());
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@Override
@@ -22,6 +22,8 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.state.BotaniaStateProps;
@@ -41,7 +43,6 @@ public class BlockStarfield extends BlockMod implements ILexiconable {
setHardness(5F);
setResistance(2000F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -50,6 +51,7 @@ public class BlockStarfield extends BlockMod implements ILexiconable {
return AABB;
}
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
@@ -62,6 +64,11 @@ public class BlockStarfield extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 1 : 0;
@@ -47,9 +47,6 @@ public class BlockTinyPotato extends BlockMod implements ILexiconable {
public BlockTinyPotato() {
super(Material.CLOTH, LibBlockNames.TINY_POTATO);
setHardness(0.25F);
setDefaultState(blockState.getBaseState()
.withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH)
);
}
@Nonnull
@@ -58,6 +55,12 @@ public class BlockTinyPotato extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.CARDINALS);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState()
.withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH);
}
@Override
public int getMetaFromState(IBlockState state) {
switch (state.getValue(BotaniaStateProps.CARDINALS)) {
@@ -95,6 +98,7 @@ public class BlockTinyPotato extends BlockMod implements ILexiconable {
public void registerItemForm() {
GameRegistry.register(new ItemBlockTinyPotato(this), getRegistryName());
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9) {
TileEntity tile = world.getTileEntity(pos);
@@ -36,7 +36,7 @@ import vazkii.botania.client.core.handler.ModelHandler;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.BlockMod;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.item.block.ItemBlockWithMetaNameAndColor;
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
@@ -54,7 +54,6 @@ public class BlockUnstable extends BlockMod implements ILexiconable {
setHardness(5.0F);
setResistance(10.0F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
}
@Nonnull
@@ -63,6 +62,11 @@ public class BlockUnstable extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.COLOR);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.COLOR).getMetadata();
@@ -83,6 +87,7 @@ public class BlockUnstable extends BlockMod implements ILexiconable {
return AABB;
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> stacks) {
for(int i = 0; i < 16; i++)
@@ -91,7 +96,7 @@ public class BlockUnstable extends BlockMod implements ILexiconable {
@Override
public void registerItemForm() {
GameRegistry.register(new ItemBlockWithMetaNameAndColor(this), getRegistryName());
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@Override
@@ -113,7 +118,7 @@ public class BlockUnstable extends BlockMod implements ILexiconable {
Vector3 origVector = new Vector3(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
Vector3 endVector = origVector.add(world.rand.nextDouble() * 2 - 1, world.rand.nextDouble() * 2 - 1, world.rand.nextDouble() * 2 - 1);
Botania.proxy.lightningFX(world, origVector, endVector, 5F, colorDark, colorBright);
Botania.proxy.lightningFX(origVector, endVector, 5F, colorDark, colorBright);
}
@Override
@@ -21,6 +21,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.block.BlockMod;
@@ -39,6 +41,7 @@ public class BlockBiomeStone extends BlockMod implements ILexiconable {
setSoundType(SoundType.STONE);
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> list) {
for(int i = 0; i < 16; i++)
@@ -25,7 +25,6 @@ public class BlockBiomeStoneA extends BlockBiomeStone {
public BlockBiomeStoneA() {
super(LibBlockNames.BIOME_STONE_A);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.BIOMESTONE_VARIANT, BiomeStoneVariant.FOREST));
}
@Nonnull
@@ -34,6 +33,11 @@ public class BlockBiomeStoneA extends BlockBiomeStone {
return new BlockStateContainer(this, BotaniaStateProps.BIOMESTONE_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.BIOMESTONE_VARIANT, BiomeStoneVariant.FOREST);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.BIOMESTONE_VARIANT).ordinal();
@@ -25,7 +25,6 @@ public class BlockBiomeStoneB extends BlockBiomeStone {
public BlockBiomeStoneB() {
super(LibBlockNames.BIOME_STONE_B);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.BIOMEBRICK_VARIANT, BiomeBrickVariant.FOREST));
}
@Nonnull
@@ -34,6 +33,11 @@ public class BlockBiomeStoneB extends BlockBiomeStone {
return new BlockStateContainer(this, BotaniaStateProps.BIOMEBRICK_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.BIOMEBRICK_VARIANT, BiomeBrickVariant.FOREST);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.BIOMEBRICK_VARIANT).ordinal();
@@ -24,6 +24,7 @@ public class BlockAlfglassPane extends BlockModPane {
super(ModBlocks.elfGlass);
}
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
@@ -24,6 +24,7 @@ public class BlockBifrostPane extends BlockModPane {
super(ModBlocks.bifrostPerm);
}
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
@@ -24,6 +24,7 @@ public class BlockManaglassPane extends BlockModPane {
super(ModBlocks.manaGlass);
}
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
@@ -28,14 +28,15 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
public class BlockModPane extends BlockPane implements IRegisterCallback, IModelRegister {
public class BlockModPane extends BlockPane implements IModelRegister {
public BlockModPane(Block source) {
super(Material.GLASS, false);
// Backward compat don't kill me
String name = source.getUnlocalizedName().replaceAll("tile.", "") + "Pane";
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
ModBlocks.ALL_BLOCKS.add(this);
GameRegistry.register(this);
GameRegistry.register(new ItemBlockMod(this), getRegistryName());
setUnlocalizedName(name);
setCreativeTab(BotaniaCreativeTab.INSTANCE);
setHardness(0.3F);
@@ -55,12 +56,6 @@ public class BlockModPane extends BlockPane implements IRegisterCallback, IModel
return block == ModBlocks.elfGlass || block == ModBlocks.manaGlass || block == ModBlocks.bifrostPerm || super.canPaneConnectTo(world, pos, dir);
}
@Override
public void register() {
GameRegistry.register(this);
GameRegistry.register(new ItemBlockMod(this), getRegistryName());
}
@Override
public void registerModels() {}
}
@@ -46,7 +46,6 @@ public class BlockSpecialQuartz extends BlockMod implements ILexiconable {
this.type = type;
setHardness(0.8F);
setResistance(10F);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.QUARTZ_VARIANT, QuartzVariant.NORMAL));
}
@Nonnull
@@ -55,6 +54,11 @@ public class BlockSpecialQuartz extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.QUARTZ_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.QUARTZ_VARIANT, QuartzVariant.NORMAL);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.QUARTZ_VARIANT).ordinal();
@@ -35,7 +35,7 @@ import javax.annotation.Nonnull;
import java.util.Locale;
import java.util.Random;
public abstract class BlockModSlab extends BlockSlab implements ILexiconable, IModelRegister, IRegisterCallback {
public abstract class BlockModSlab extends BlockSlab implements ILexiconable, IModelRegister {
private final String name;
private final boolean doubleSlab;
@@ -46,13 +46,15 @@ public abstract class BlockModSlab extends BlockSlab implements ILexiconable, IM
this.name = name;
setUnlocalizedName(name);
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
ModBlocks.ALL_BLOCKS.add(this);
doubleSlab = full;
if(!full) {
setCreativeTab(BotaniaCreativeTab.INSTANCE);
useNeighborBrightness = true;
}
setDefaultState(blockState.getBaseState().withProperty(HALF, EnumBlockHalf.BOTTOM).withProperty(DUMMY, DummyEnum.SINGLETON));
GameRegistry.register(this);
if (!isDouble())
GameRegistry.register(new ItemBlockModSlab(this), getRegistryName());
}
@Nonnull
@@ -100,13 +102,6 @@ public abstract class BlockModSlab extends BlockSlab implements ILexiconable, IM
return new ItemStack(getSingleBlock());
}
@Override
public void register() {
GameRegistry.register(this);
if (!isDouble())
GameRegistry.register(new ItemBlockModSlab(this), getRegistryName());
}
@Nonnull
@Override
public String getUnlocalizedName(int i) {
@@ -23,12 +23,13 @@ import vazkii.botania.common.item.block.ItemBlockMod;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
public class BlockModStairs extends BlockStairs implements ILexiconable, IModelRegister, IRegisterCallback {
public class BlockModStairs extends BlockStairs implements ILexiconable, IModelRegister {
public BlockModStairs(IBlockState state, String name) {
super(state);
ModBlocks.ALL_BLOCKS.add(this);
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
GameRegistry.register(this);
GameRegistry.register(new ItemBlockMod(this), getRegistryName());
setUnlocalizedName(name);
setCreativeTab(BotaniaCreativeTab.INSTANCE);
useNeighborBrightness = true;
@@ -44,10 +45,4 @@ public class BlockModStairs extends BlockStairs implements ILexiconable, IModelR
public void registerModels() {
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "inventory"));
}
@Override
public void register() {
GameRegistry.register(this);
GameRegistry.register(new ItemBlockMod(this), getRegistryName());
}
}
@@ -43,7 +43,6 @@ public class BlockBiomeStoneWall extends BlockModWall {
super(ModFluffBlocks.biomeStoneA, 0);
setHardness(1.5F);
setResistance(10F);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.BIOMESTONEWALL_VARIANT, BiomeStoneVariant.FOREST_COBBLE).withProperty(VARIANT, EnumType.NORMAL));
}
@Nonnull
@@ -52,6 +51,11 @@ public class BlockBiomeStoneWall extends BlockModWall {
return new BlockStateContainer(this, VARIANT, UP, NORTH, SOUTH, WEST, EAST, BotaniaStateProps.BIOMESTONEWALL_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return super.pickDefaultState().withProperty(BotaniaStateProps.BIOMESTONEWALL_VARIANT, BiomeStoneVariant.FOREST_COBBLE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.BIOMESTONEWALL_VARIANT).ordinal() - 8;
@@ -72,6 +76,7 @@ public class BlockBiomeStoneWall extends BlockModWall {
GameRegistry.register(new ItemBlockWithMetadataAndName(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tabs, @Nonnull List<ItemStack> list) {
for(int i = 0; i < 8; i++)
@@ -40,23 +40,16 @@ import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import java.util.List;
public abstract class BlockModWall extends BlockWall implements ILexiconable, IModelRegister, IRegisterCallback {
public abstract class BlockModWall extends BlockWall implements ILexiconable, IModelRegister {
public BlockModWall(Block block, int meta) {
super(block);
// For backward compat don't kill me
String name = block.getUnlocalizedName().replaceAll("tile.", "") + meta + "Wall";
setRegistryName(name);
ModBlocks.ALL_BLOCKS.add(this);
setUnlocalizedName(name);
setDefaultState(blockState.getBaseState()
.withProperty(UP, false)
.withProperty(NORTH, false)
.withProperty(SOUTH, false)
.withProperty(WEST, false)
.withProperty(EAST, false)
.withProperty(VARIANT, EnumType.NORMAL)
);
setDefaultState(pickDefaultState());
register();
setCreativeTab(BotaniaCreativeTab.INSTANCE);
}
@@ -77,6 +70,16 @@ public abstract class BlockModWall extends BlockWall implements ILexiconable, IM
return new BlockStateContainer(this, VARIANT, UP, NORTH, SOUTH, WEST, EAST);
}
protected IBlockState pickDefaultState() {
return blockState.getBaseState()
.withProperty(UP, false)
.withProperty(NORTH, false)
.withProperty(SOUTH, false)
.withProperty(WEST, false)
.withProperty(EAST, false)
.withProperty(VARIANT, EnumType.NORMAL);
}
@Override
public int getMetaFromState(IBlockState state) {
return 0;
@@ -93,12 +96,12 @@ public abstract class BlockModWall extends BlockWall implements ILexiconable, IM
return true;
}
@Override
public void register() {
GameRegistry.register(this);
GameRegistry.register(new ItemBlockMod(this), getRegistryName());
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tabs, @Nonnull List<ItemStack> list) {
list.add(new ItemStack(item));
@@ -51,7 +51,6 @@ public class BlockBellows extends BlockMod implements ILexiconable {
super(Material.WOOD, LibBlockNames.BELLOWS);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
}
@Nonnull
@@ -60,6 +59,11 @@ public class BlockBellows extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.CARDINALS);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.CARDINALS).getIndex();
@@ -58,7 +58,6 @@ public class BlockBrewery extends BlockMod implements ILexiconable, IWandHUD {
setHardness(2.0F);
setResistance(10.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -67,6 +66,11 @@ public class BlockBrewery extends BlockMod implements ILexiconable, IWandHUD {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 1 : 0;
@@ -93,7 +97,7 @@ public class BlockBrewery extends BlockMod implements ILexiconable, IWandHUD {
InventoryHelper.withdrawFromInventory(brew, player);
} else {
if(stack != null)
return brew.addItem(player, stack);
return brew.addItem(player, stack, hand);
}
return false;
}
@@ -150,6 +154,7 @@ public class BlockBrewery extends BlockMod implements ILexiconable, IWandHUD {
return LexiconData.brewery;
}
@SideOnly(Side.CLIENT)
@Override
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
((TileBrewery) world.getTileEntity(pos)).renderHUD(mc, res);
@@ -31,12 +31,14 @@ import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.ItemHandlerHelper;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.wand.IWandHUD;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.client.core.handler.ModelHandler;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.BlockMod;
import vazkii.botania.common.block.tile.TileEnchanter;
import vazkii.botania.common.item.ModItems;
@@ -56,7 +58,6 @@ public class BlockEnchanter extends BlockMod implements IWandable, ILexiconable,
setResistance(5.0F);
setLightLevel(1.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.ENCHANTER_DIRECTION, EnumFacing.Axis.X));
}
@Nonnull
@@ -65,6 +66,11 @@ public class BlockEnchanter extends BlockMod implements IWandable, ILexiconable,
return new BlockStateContainer(this, BotaniaStateProps.ENCHANTER_DIRECTION);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.ENCHANTER_DIRECTION, EnumFacing.Axis.X);
}
@Override
public int getMetaFromState(IBlockState state) {
switch (state.getValue(BotaniaStateProps.ENCHANTER_DIRECTION)) {
@@ -112,19 +118,21 @@ public class BlockEnchanter extends BlockMod implements IWandable, ILexiconable,
if(stack != null && stack.getItem() == ModItems.twigWand)
return false;
boolean stackEnchantable = stack != null && stack.getItem() != Items.BOOK && stack.isItemEnchantable() && stack.stackSize == 1 && stack.getItem().getItemEnchantability(stack) > 0;
boolean stackEnchantable = stack != null
&& stack.getItem() != Items.BOOK
&& stack.isItemEnchantable()
&& stack.stackSize == 1;
if(enchanter.itemToEnchant == null) {
if(stackEnchantable) {
enchanter.itemToEnchant = stack.copy();
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
player.setHeldItem(hand, null);
enchanter.sync();
}
} else if(enchanter.stage == TileEnchanter.State.IDLE) {
if(player.inventory.addItemStackToInventory(enchanter.itemToEnchant.copy())) {
enchanter.itemToEnchant = null;
enchanter.sync();
} else player.addChatMessage(new TextComponentTranslation("botaniamisc.invFull"));
ItemHandlerHelper.giveItemToPlayer(player, enchanter.itemToEnchant.copy());
enchanter.itemToEnchant = null;
enchanter.sync();
}
return true;
@@ -175,6 +183,7 @@ public class BlockEnchanter extends BlockMod implements IWandable, ILexiconable,
return LexiconData.manaEnchanting;
}
@SideOnly(Side.CLIENT)
@Override
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
((TileEnchanter) world.getTileEntity(pos)).renderHUD(res);
@@ -59,7 +59,6 @@ public class BlockForestDrum extends BlockMod implements IManaTrigger, ILexicona
super(Material.WOOD, LibBlockNames.FOREST_DRUM);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.DRUM_VARIANT, DrumVariant.WILD));
}
@Nonnull
@@ -74,6 +73,11 @@ public class BlockForestDrum extends BlockMod implements IManaTrigger, ILexicona
return new BlockStateContainer(this, BotaniaStateProps.DRUM_VARIANT);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.DRUM_VARIANT, DrumVariant.WILD);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.DRUM_VARIANT).ordinal();
@@ -108,6 +112,7 @@ public class BlockForestDrum extends BlockMod implements IManaTrigger, ILexicona
return state.getBlock().getMetaFromState(state);
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> list) {
for(int i = 0; i < 3; i++)
@@ -43,7 +43,6 @@ public class BlockManaDetector extends BlockMod implements ILexiconable, IManaCo
setHardness(2.0F);
setResistance(10.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@@ -52,6 +51,11 @@ public class BlockManaDetector extends BlockMod implements ILexiconable, IManaCo
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 1 : 0;
@@ -69,9 +69,6 @@ public class BlockPool extends BlockMod implements IWandHUD, IWandable, ILexicon
setHardness(2.0F);
setResistance(10.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState()
.withProperty(BotaniaStateProps.POOL_VARIANT, PoolVariant.DEFAULT)
.withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE));
BotaniaAPI.blacklistBlockFromMagnet(this, Short.MAX_VALUE);
}
@@ -81,6 +78,13 @@ public class BlockPool extends BlockMod implements IWandHUD, IWandable, ILexicon
return new BlockStateContainer(this, BotaniaStateProps.POOL_VARIANT, BotaniaStateProps.COLOR);
}
@Override
protected IBlockState pickDefaultState() {
return blockState.getBaseState()
.withProperty(BotaniaStateProps.POOL_VARIANT, PoolVariant.DEFAULT)
.withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POOL_VARIANT).ordinal();
@@ -140,6 +144,7 @@ public class BlockPool extends BlockMod implements IWandHUD, IWandable, ILexicon
return drops;
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(@Nonnull Item item, CreativeTabs par2, List<ItemStack> par3) {
par3.add(new ItemStack(item, 1, 0));
Loaded 100 of 325 files, more files were not shown because too many files have changed in this diff. Show more