Added the ability to get the Gaia Guardian's Head.

This commit is contained in:
Vasco Lavos committed 2015-09-24 00:25:28 +01:00
1 parent 739d46ce5a
commit 92412455f2
15 files changed
+277 -9

No files matched your search

@@ -123,6 +123,7 @@ import vazkii.botania.common.block.tile.TileCocoon;
import vazkii.botania.common.block.tile.TileEnchanter;
import vazkii.botania.common.block.tile.TileFloatingFlower;
import vazkii.botania.common.block.tile.TileFloatingSpecialFlower;
import vazkii.botania.common.block.tile.TileGaiaHead;
import vazkii.botania.common.block.tile.TileHourglass;
import vazkii.botania.common.block.tile.TileIncensePlate;
import vazkii.botania.common.block.tile.TileLightRelay;
@@ -305,6 +306,7 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileCocoon.class, new RenderTileCocoon());
ClientRegistry.bindTileEntitySpecialRenderer(TileLightRelay.class, new RenderTileLightRelay());
ClientRegistry.bindTileEntitySpecialRenderer(TileBellows.class, new RenderTileBellows());
ClientRegistry.bindTileEntitySpecialRenderer(TileGaiaHead.class, new RenderTileSkullOverride());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySkull.class, new RenderTileSkullOverride());
@@ -25,10 +25,13 @@ import vazkii.botania.common.entity.EntityDoppleganger;
public class RenderDoppleganger extends RenderBiped {
float grainIntensity = 0.05F;
float disfiguration = 0.025F;
public static float DEFAULT_GRAIN_INTENSITY = 0.05F;
public static float DEFAULT_DISFIGURATION = 0.025F;
ShaderCallback callback = new ShaderCallback() {
public static float grainIntensity = DEFAULT_GRAIN_INTENSITY;
public static float disfiguration = DEFAULT_DISFIGURATION;
public static ShaderCallback callback = new ShaderCallback() {
@Override
public void call(int shader) {
@@ -41,6 +44,20 @@ public class RenderDoppleganger extends RenderBiped {
ARBShaderObjects.glUniform1fARB(grainIntensityUniform, grainIntensity);
}
};
public static ShaderCallback defaultCallback = new ShaderCallback() {
@Override
public void call(int shader) {
// Frag Uniforms
int disfigurationUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "disfiguration");
ARBShaderObjects.glUniform1fARB(disfigurationUniform, DEFAULT_DISFIGURATION);
// Vert Uniforms
int grainIntensityUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "grainIntensity");
ARBShaderObjects.glUniform1fARB(grainIntensityUniform, DEFAULT_GRAIN_INTENSITY);
}
};
public RenderDoppleganger() {
super(new ModelBiped(0.5F), 0F);
@@ -21,7 +21,10 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.model.ModelSkullOverride;
import vazkii.botania.client.render.entity.RenderDoppleganger;
import vazkii.botania.common.block.tile.TileGaiaHead;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
@@ -36,10 +39,13 @@ public class RenderTileSkullOverride extends TileEntitySkullRenderer {
}
public void render(TileEntitySkull skull, float par1, float par2, float par3, int par4, float par5, int par6, GameProfile gameProfile) {
if (par6 == 3) {
boolean gaia = skull instanceof TileGaiaHead;
if(par6 == 3 || gaia) {
ResourceLocation resourcelocation = AbstractClientPlayer.locationStevePng;
if (gameProfile != null) {
Minecraft minecraft = Minecraft.getMinecraft();
Minecraft minecraft = Minecraft.getMinecraft();
if(gaia)
resourcelocation = minecraft.thePlayer.getLocationSkin();
else if(gameProfile != null) {
Map map = minecraft.func_152342_ad().func_152788_a(gameProfile);
if (map.containsKey(MinecraftProfileTexture.Type.SKIN)) {
@@ -72,7 +78,13 @@ public class RenderTileSkullOverride extends TileEntitySkullRenderer {
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(-1.0F, -1.0F, 1.0F);
GL11.glEnable(GL11.GL_ALPHA_TEST);
if(gaia)
ShaderHelper.useShader(ShaderHelper.doppleganger, RenderDoppleganger.defaultCallback);
modelSkull.render(null, 0F, 0F, 0F, par5, 0F, 0.0625F);
if(gaia)
ShaderHelper.releaseShader();
GL11.glPopMatrix();
} else super.func_152674_a(par1, par2, par3, par4, par5, par6, gameProfile);
}
@@ -0,0 +1,67 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Sep 23, 2015, 11:44:35 PM (GMT)]
*/
package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSkull;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntitySkull;
import net.minecraft.world.World;
import vazkii.botania.common.block.tile.TileGaiaHead;
import vazkii.botania.common.core.BotaniaCreativeTab;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.block.ItemBlockMod;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockGaiaHead extends BlockSkull {
public BlockGaiaHead() {
setBlockName(LibBlockNames.GAIA_HEAD);
}
@Override
public Block setBlockName(String par1Str) {
GameRegistry.registerBlock(this, ItemBlockMod.class, par1Str);
return super.setBlockName(par1Str);
}
@Override
@SideOnly(Side.CLIENT)
public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) {
return ModItems.gaiaHead;
}
@Override
public void registerBlockIcons(IIconRegister p_149651_1_) {
// NO-OP
}
@Override
public int getDamageValue(World p_149643_1_, int p_149643_2_, int p_149643_3_, int p_149643_4_) {
return 0;
}
@Override
public int damageDropped(int p_149692_1_) {
return 0;
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileGaiaHead();
}
}
@@ -125,6 +125,7 @@ import vazkii.botania.common.block.tile.TileFakeAir;
import vazkii.botania.common.block.tile.TileFloatingFlower;
import vazkii.botania.common.block.tile.TileFloatingSpecialFlower;
import vazkii.botania.common.block.tile.TileForestEye;
import vazkii.botania.common.block.tile.TileGaiaHead;
import vazkii.botania.common.block.tile.TileHourglass;
import vazkii.botania.common.block.tile.TileIncensePlate;
import vazkii.botania.common.block.tile.TileLightRelay;
@@ -252,6 +253,7 @@ public final class ModBlocks {
public static Block bifrostPerm;
public static Block cellBlock;
public static Block redStringInterceptor;
public static Block gaiaHead;
public static void init() {
flower = new BlockModFlower();
@@ -337,6 +339,7 @@ public final class ModBlocks {
bifrostPerm = new BlockBifrostPerm();
cellBlock = new BlockCell();
redStringInterceptor = new BlockRedStringInterceptor();
gaiaHead = new BlockGaiaHead();
ModFluffBlocks.init();
@@ -435,6 +438,7 @@ public final class ModBlocks {
registerTile(TileBellows.class, LibBlockNames.BELLOWS);
registerTile(TileCell.class, LibBlockNames.CELL_BLOCK);
registerTile(TileRedStringInterceptor.class, LibBlockNames.RED_STRING_INTERCEPTOR);
registerTile(TileGaiaHead.class, LibBlockNames.GAIA_HEAD);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_PUREDAISY, SubTilePureDaisy.class);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_MANASTAR, SubTileManastar.class);
@@ -0,0 +1,17 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Sep 23, 2015, 11:47:40 PM (GMT)]
*/
package vazkii.botania.common.block.tile;
import net.minecraft.tileentity.TileEntitySkull;
public class TileGaiaHead extends TileEntitySkull {
}
@@ -203,6 +203,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
addItem(ModItems.recordGaia2);
addItem(ModItems.ancientWill);
addItem(ModItems.pinkinator);
addItem(ModItems.gaiaHead);
if(ConfigHandler.relicsEnabled) {
addItem(ModItems.dice);
addItem(ModItems.infiniteFruit);
@@ -0,0 +1,136 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Sep 23, 2015, 11:40:51 PM (GMT)]
*/
package vazkii.botania.common.item;
import java.util.UUID;
import net.minecraft.block.BlockSkull;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntitySkull;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.lib.LibItemNames;
public class ItemGaiaHead extends ItemMod {
public ItemGaiaHead() {
setUnlocalizedName(LibItemNames.GAIA_HEAD);
}
// Copypasta from ItemSkull and I'm not even going to bother to clean it up
//
// Deal with it.
@Override
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
{
if(p_77648_3_.getBlock(p_77648_4_, p_77648_5_, p_77648_6_).isReplaceable(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_) && p_77648_7_ != 0)
{
p_77648_7_ = 1;
p_77648_5_--;
}
if (p_77648_7_ == 0)
{
return false;
}
else if (!p_77648_3_.isSideSolid(p_77648_4_, p_77648_5_, p_77648_6_, net.minecraftforge.common.util.ForgeDirection.getOrientation(p_77648_7_)))
{
return false;
}
else
{
if (p_77648_7_ == 1)
{
++p_77648_5_;
}
if (p_77648_7_ == 2)
{
--p_77648_6_;
}
if (p_77648_7_ == 3)
{
++p_77648_6_;
}
if (p_77648_7_ == 4)
{
--p_77648_4_;
}
if (p_77648_7_ == 5)
{
++p_77648_4_;
}
}
{
if (!p_77648_3_.isRemote)
{
if (!Blocks.skull.canPlaceBlockOnSide(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_)) return false;
p_77648_3_.setBlock(p_77648_4_, p_77648_5_, p_77648_6_, ModBlocks.gaiaHead, p_77648_7_, 2); // Gaia head instead of skull
int i1 = 0;
if (p_77648_7_ == 1)
{
i1 = MathHelper.floor_double((double)(p_77648_2_.rotationYaw * 16.0F / 360.0F) + 0.5D) & 15;
}
TileEntity tileentity = p_77648_3_.getTileEntity(p_77648_4_, p_77648_5_, p_77648_6_);
if (tileentity != null && tileentity instanceof TileEntitySkull)
{
/*if (p_77648_1_.getItemDamage() == 3)
{
GameProfile gameprofile = null;
if (p_77648_1_.hasTagCompound())
{
NBTTagCompound nbttagcompound = p_77648_1_.getTagCompound();
if (nbttagcompound.hasKey("SkullOwner", 10))
{
gameprofile = NBTUtil.func_152459_a(nbttagcompound.getCompoundTag("SkullOwner"));
}
else if (nbttagcompound.hasKey("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0)
{
gameprofile = new GameProfile((UUID)null, nbttagcompound.getString("SkullOwner"));
}
}
((TileEntitySkull)tileentity).func_152106_a(gameprofile);
}
else
{
((TileEntitySkull)tileentity).func_152107_a(p_77648_1_.getItemDamage());
}*/
((TileEntitySkull)tileentity).func_145903_a(i1);
((BlockSkull)Blocks.skull).func_149965_a(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, (TileEntitySkull)tileentity);
}
--p_77648_1_.stackSize;
}
return true;
}
}
}
@@ -264,6 +264,7 @@ public final class ModItems {
public static Item manaweaveLegs;
public static Item manaweaveBoots;
public static Item autocraftingHalo;
public static Item gaiaHead;
public static void init() {
lexicon = new ItemLexicon();
@@ -410,6 +411,7 @@ public final class ModItems {
manaweaveChest = new ItemManaweaveChest();
manaweaveBoots = new ItemManaweaveBoots();
autocraftingHalo = new ItemAutocraftingHalo();
gaiaHead = new ItemGaiaHead();
OreDictionary.registerOre(LibOreDict.LEXICON, lexicon);
for(int i = 0; i < 16; i++) {
@@ -15,6 +15,8 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.entity.EntityDoppleganger;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.tool.manasteel.ItemManasteelAxe;
import vazkii.botania.common.lib.LibItemNames;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -47,7 +49,8 @@ public class ItemElementiumAxe extends ItemManasteelAxe {
ItemStack stack = new ItemStack(Items.skull, 1, 3);
ItemNBTHelper.setString(stack, "SkullOwner", ((EntityPlayer)event.entityLiving).getCommandSenderName());
addDrop(event, stack);
}
} else if(event.entityLiving instanceof EntityDoppleganger && rand.nextInt(13) < 1 + looting)
addDrop(event, new ItemStack(ModItems.gaiaHead));
}
}
}
@@ -99,7 +99,8 @@ public final class LibBlockNames {
public static final String BIFROST_PERM = "bifrostPerm";
public static final String PAVEMENT = "pavement";
public static final String CELL_BLOCK = "cellBlock";
public static final String GAIA_HEAD = "gaiaHeadBlock";
public static final String SUBTILE_PUREDAISY = "puredaisy";
public static final String SUBTILE_MANASTAR = "manastar";
@@ -157,7 +157,8 @@ public final class LibItemNames {
public static final String MANAWEAVE_LEGS = "manaweaveLegs";
public static final String MANAWEAVE_BOOTS = "manaweaveBoots";
public static final String AUTOCRAFTING_HALO = "autocraftingHalo";
public static final String GAIA_HEAD = "gaiaHead";
public static final String[] LENS_NAMES = new String[] {
"lensNormal",
"lensSpeed",