Cocoon of Caprice.

This commit is contained in:
Lizbeth Rika committed 2015-07-08 17:29:58 +01:00
1 parent e7b3f055ab
commit 7c16064326
14 files changed
+285 -36

No files matched your search

@@ -88,6 +88,7 @@ import vazkii.botania.client.render.item.RenderTransparentItem;
import vazkii.botania.client.render.tile.RenderTileAlfPortal;
import vazkii.botania.client.render.tile.RenderTileAltar;
import vazkii.botania.client.render.tile.RenderTileBrewery;
import vazkii.botania.client.render.tile.RenderTileCocoon;
import vazkii.botania.client.render.tile.RenderTileCorporeaCrystalCube;
import vazkii.botania.client.render.tile.RenderTileCorporeaIndex;
import vazkii.botania.client.render.tile.RenderTileEnchanter;
@@ -111,6 +112,7 @@ import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.TileAlfPortal;
import vazkii.botania.common.block.tile.TileAltar;
import vazkii.botania.common.block.tile.TileBrewery;
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;
@@ -225,6 +227,7 @@ public class ClientProxy extends CommonProxy {
LibRenderIDs.idCorporeaCrystalCybe = RenderingRegistry.getNextAvailableRenderId();
LibRenderIDs.idIncensePlate = RenderingRegistry.getNextAvailableRenderId();
LibRenderIDs.idHourglass = RenderingRegistry.getNextAvailableRenderId();
LibRenderIDs.idCocoon = RenderingRegistry.getNextAvailableRenderId();
RenderSpecialFlower specialFlowerRender = new RenderSpecialFlower(LibRenderIDs.idSpecialFlower);
RenderingRegistry.registerBlockHandler(new RenderAltar());
@@ -283,6 +286,7 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileIncensePlate.class, new RenderTileIncensePlate());
ClientRegistry.bindTileEntitySpecialRenderer(TileHourglass.class, new RenderTileHourglass());
ClientRegistry.bindTileEntitySpecialRenderer(TileSparkChanger.class, new RenderTileSparkChanger());
ClientRegistry.bindTileEntitySpecialRenderer(TileCocoon.class, new RenderTileCocoon());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySkull.class, new RenderTileSkullOverride());
@@ -27,5 +27,6 @@ public final class LibRenderIDs {
public static int idCorporeaCrystalCybe = -1;
public static int idIncensePlate = -1;
public static int idHourglass = -1;
public static int idCocoon = -1;
}
@@ -104,6 +104,7 @@ public final class LibResources {
public static final String MODEL_CRYSTAL_CUBE = PREFIX_MODEL + "crystalCube.png";
public static final String MODEL_INCENSE_PLATE = PREFIX_MODEL + "incensePlate.png";
public static final String MODEL_HOURGLASS = PREFIX_MODEL + "hourglass.png";
public static final String MODEL_COCOON = PREFIX_MODEL + "cocoon.png";
public static final String MISC_PARTICLES = PREFIX_MISC + "particles.png";
public static final String MISC_WISP_LARGE = PREFIX_MISC + "wispLarge.png";
@@ -0,0 +1,33 @@
/**
* 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 ModelCocoon extends ModelBase {
public ModelRenderer shape;
public ModelCocoon() {
textureWidth = 48;
textureHeight = 32;
shape = new ModelRenderer(this, 0, 0);
shape.setRotationPoint(0.0F, 22.0F, 0.0F);
shape.addBox(-5.0F, -8.0F, -7.0F, 10, 10, 14, 0.0F);
}
public void render() {
shape.render(1F / 16F);
}
}
@@ -0,0 +1,57 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jul 8, 2015, 4:44:23 PM (GMT)]
*/
package vazkii.botania.client.render.tile;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.client.model.ModelCocoon;
import vazkii.botania.common.block.tile.TileCocoon;
public class RenderTileCocoon extends TileEntitySpecialRenderer {
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_COCOON);
ModelCocoon model = new ModelCocoon();
@Override
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
TileCocoon cocoon = (TileCocoon) tileentity;
float rot = 0F;
float modval = 60F - (float) cocoon.timePassed / (float) TileCocoon.TOTAL_TIME * 30F;
if(cocoon.timePassed % modval < 10) {
float mod = (cocoon.timePassed + f) % (float) modval;
float v = (float) mod / 5 * (float) Math.PI * 2;
rot = (float) Math.sin(v) * (float) Math.log(cocoon.timePassed + f);
}
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glTranslated(d0, d1, d2);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
GL11.glRotatef(90F, 1F, 0F, 0F);
GL11.glTranslatef(0.5F, -0.5F - 3F / 16F, -0.5F + 1F / 16F);
GL11.glRotatef(rot, 0F, 1F, 0F);
model.render();
GL11.glColor3f(1F, 1F, 1F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
@@ -0,0 +1,80 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jul 8, 2015, 4:29:01 PM (GMT)]
*/
package vazkii.botania.common.block;
import java.util.ArrayList;
import java.util.Random;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileCocoon;
import vazkii.botania.common.lib.LibBlockNames;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class BlockCocoon extends BlockModContainer {
protected BlockCocoon() {
super(Material.cloth);
setHardness(3.0F);
setResistance(50.0F);
setStepSound(soundTypeCloth);
setBlockName(LibBlockNames.COCOON);
float f = 3F / 16F;
float f1 = 14F / 16F;
setBlockBounds(f, 0F, f, 1F - f, f1, 1F - f);
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
// NO-OP
}
@Override
public IIcon getIcon(int p_149691_1_, int p_149691_2_) {
return Blocks.web.getBlockTextureFromSide(0);
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public int getRenderType() {
return LibRenderIDs.idCocoon;
}
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
return new ArrayList();
}
@Override
protected boolean canSilkHarvest() {
return false;
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileCocoon();
}
}
@@ -112,6 +112,7 @@ import vazkii.botania.common.block.tile.TileAlfPortal;
import vazkii.botania.common.block.tile.TileAltar;
import vazkii.botania.common.block.tile.TileBifrost;
import vazkii.botania.common.block.tile.TileBrewery;
import vazkii.botania.common.block.tile.TileCocoon;
import vazkii.botania.common.block.tile.TileCraftCrate;
import vazkii.botania.common.block.tile.TileEnchanter;
import vazkii.botania.common.block.tile.TileEnderEye;
@@ -233,6 +234,7 @@ public final class ModBlocks {
public static Block sparkChanger;
public static Block root;
public static Block felPumpkin;
public static Block cocoon;
public static void init() {
flower = new BlockModFlower();
@@ -309,6 +311,7 @@ public final class ModBlocks {
sparkChanger = new BlockSparkChanger();
root = new BlockRoot();
felPumpkin = new BlockFelPumpkin();
cocoon = new BlockCocoon();
ModFluffBlocks.init();
@@ -399,6 +402,7 @@ public final class ModBlocks {
registerTile(TileIncensePlate.class, LibBlockNames.INCENSE_PLATE);
registerTile(TileHourglass.class, LibBlockNames.HOURGLASS);
registerTile(TileSparkChanger.class, LibBlockNames.SPARK_CHANGER);
registerTile(TileCocoon.class, LibBlockNames.COCOON);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_PUREDAISY, SubTilePureDaisy.class);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_MANASTAR, SubTileManastar.class);
@@ -0,0 +1,101 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jul 8, 2015, 4:32:34 PM (GMT)]
*/
package vazkii.botania.common.block.tile;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityChicken;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntityMooshroom;
import net.minecraft.entity.passive.EntityOcelot;
import net.minecraft.entity.passive.EntityPig;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.nbt.NBTTagCompound;
public class TileCocoon extends TileMod {
private static final String TAG_TIME_PASSED = "timePassed";
public static final int TOTAL_TIME = 2400;
public int timePassed;
@Override
public void updateEntity() {
timePassed++;
if(timePassed >= TOTAL_TIME)
hatch();
}
public void hatch() {
if(!worldObj.isRemote) {
worldObj.playAuxSFX(2001, xCoord, yCoord, zCoord, Block.getIdFromBlock(getBlockType()));
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
EntityAnimal entity = null;
float specialChance = 0.05F;
if(Math.random() < specialChance) {
int entityType = worldObj.rand.nextInt(3);
switch(entityType) {
case 0:
entity = new EntityHorse(worldObj);
break;
case 1:
entity = new EntityWolf(worldObj);
break;
case 2:
entity = new EntityOcelot(worldObj);
break;
}
} else {
int entityType = worldObj.rand.nextInt(4);
switch(entityType) {
case 0:
entity = new EntitySheep(worldObj);
break;
case 1:
if(Math.random() < 0.01)
entity = new EntityMooshroom(worldObj);
else entity = new EntityCow(worldObj);
break;
case 2:
entity = new EntityPig(worldObj);
break;
case 3:
entity = new EntityChicken(worldObj);
break;
}
}
if(entity != null) {
entity.setPosition(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
entity.setGrowingAge(-24000);
worldObj.spawnEntityInWorld(entity);
entity.spawnExplosionParticle();
}
}
}
@Override
public void writeCustomNBT(NBTTagCompound cmp) {
cmp.setInteger(TAG_TIME_PASSED, timePassed);
}
@Override
public void readCustomNBT(NBTTagCompound cmp) {
timePassed = cmp.getInteger(TAG_TIME_PASSED);
}
}
@@ -105,6 +105,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
addItem(ModItems.craftingHalo);
addItem(ModItems.spawnerMover);
addBlock(ModBlocks.spawnerClaw);
addBlock(ModBlocks.cocoon);
addItem(ModItems.blackHoleTalisman);
if(Botania.gardenOfGlassLoaded)
@@ -775,7 +775,7 @@ public final class LexiconData {
spawnerMover = new ALexiconEntry(LibLexicon.ENDER_SPAWNER_MOVER, categoryEnder);
spawnerMover.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeSpawnerMover));
keepIvy = new ALexiconEntry(LibLexicon.ENDER_KEEP_IVY, categoryEnder);
keepIvy = new ALexiconEntry(LibLexicon.ENDER_KEEP_IVY, categoryEnder);
keepIvy.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeKeepIvy));
blackHoleTalisman = new ALexiconEntry(LibLexicon.ENDER_BLACK_HOLE_TALISMAN, categoryEnder);
@@ -89,6 +89,7 @@ public final class LibBlockNames {
public static final String SPARK_CHANGER = "sparkChanger";
public static final String ROOT = "root";
public static final String FEL_PUMPKIN = "felPumpkin";
public static final String COCOON = "cocoon";
public static final String SUBTILE_PUREDAISY = "puredaisy";
public static final String SUBTILE_MANASTAR = "manastar";