Teru Teru Bozu.

This commit is contained in:
Vasco Lavos committed 2015-10-01 22:51:11 +01:00
1 parent 9c48ef2fb4
commit e67b3e9d0b
12 files changed
+279 -4

No files matched your search

@@ -75,6 +75,7 @@ import vazkii.botania.client.render.block.RenderPylon;
import vazkii.botania.client.render.block.RenderSpawnerClaw;
import vazkii.botania.client.render.block.RenderSpecialFlower;
import vazkii.botania.client.render.block.RenderSpreader;
import vazkii.botania.client.render.block.RenderTeruTeruBozu;
import vazkii.botania.client.render.block.RenderTinyPotato;
import vazkii.botania.client.render.entity.RenderBabylonWeapon;
import vazkii.botania.client.render.entity.RenderCorporeaSpark;
@@ -114,6 +115,7 @@ import vazkii.botania.client.render.tile.RenderTileSpawnerClaw;
import vazkii.botania.client.render.tile.RenderTileSpreader;
import vazkii.botania.client.render.tile.RenderTileStarfield;
import vazkii.botania.client.render.tile.RenderTileTerraPlate;
import vazkii.botania.client.render.tile.RenderTileTeruTeruBozu;
import vazkii.botania.client.render.tile.RenderTileTinyPotato;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.TileAlfPortal;
@@ -133,6 +135,7 @@ import vazkii.botania.common.block.tile.TileSparkChanger;
import vazkii.botania.common.block.tile.TileSpawnerClaw;
import vazkii.botania.common.block.tile.TileStarfield;
import vazkii.botania.common.block.tile.TileTerraPlate;
import vazkii.botania.common.block.tile.TileTeruTeruBozu;
import vazkii.botania.common.block.tile.TileTinyPotato;
import vazkii.botania.common.block.tile.corporea.TileCorporeaCrystalCube;
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
@@ -244,6 +247,7 @@ public class ClientProxy extends CommonProxy {
LibRenderIDs.idCocoon = RenderingRegistry.getNextAvailableRenderId();
LibRenderIDs.idLightRelay = RenderingRegistry.getNextAvailableRenderId();
LibRenderIDs.idBellows = RenderingRegistry.getNextAvailableRenderId();
LibRenderIDs.idTeruTeruBozu = RenderingRegistry.getNextAvailableRenderId();
RenderSpecialFlower specialFlowerRender = new RenderSpecialFlower(LibRenderIDs.idSpecialFlower);
RenderingRegistry.registerBlockHandler(new RenderAltar());
@@ -263,6 +267,7 @@ public class ClientProxy extends CommonProxy {
RenderingRegistry.registerBlockHandler(new RenderHourglass());
RenderingRegistry.registerBlockHandler(new RenderCocoon());
RenderingRegistry.registerBlockHandler(new RenderBellows());
RenderingRegistry.registerBlockHandler(new RenderTeruTeruBozu());
IMultiblockRenderHook.renderHooks.put(ModBlocks.flower, specialFlowerRender);
IMultiblockRenderHook.renderHooks.put(ModBlocks.shinyFlower, specialFlowerRender);
@@ -308,6 +313,7 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileLightRelay.class, new RenderTileLightRelay());
ClientRegistry.bindTileEntitySpecialRenderer(TileBellows.class, new RenderTileBellows());
ClientRegistry.bindTileEntitySpecialRenderer(TileGaiaHead.class, new RenderTileSkullOverride());
ClientRegistry.bindTileEntitySpecialRenderer(TileTeruTeruBozu.class, new RenderTileTeruTeruBozu());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySkull.class, new RenderTileSkullOverride());
@@ -30,5 +30,6 @@ public final class LibRenderIDs {
public static int idCocoon = -1;
public static int idLightRelay = -1;
public static int idBellows = -1;
public static int idTeruTeruBozu = -1;
}
@@ -111,6 +111,7 @@ public final class LibResources {
public static final String MODEL_HOURGLASS = PREFIX_MODEL + "hourglass.png";
public static final String MODEL_COCOON = PREFIX_MODEL + "cocoon.png";
public static final String MODEL_BELLOWS = PREFIX_MODEL + "bellows.png";
public static final String MODEL_TERU_TERU_BOZU = PREFIX_MODEL + "teruTeruBozu.png";
public static final String MISC_PARTICLES = PREFIX_MISC + "particles.png";
public static final String MISC_WISP_LARGE = PREFIX_MISC + "wispLarge.png";
@@ -10,6 +10,7 @@
*/
package vazkii.botania.client.model;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
@@ -41,10 +42,11 @@ public class ModelTeruTeruBozu extends ModelBase {
this.setRotateAngle(cloth, 0.7853981633974483F, 2.2689280275926285F, 1.5707963267948966F);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
this.sadFace.render(f5);
this.happyFace.render(f5);
public void render() {
float f5 = 1F / 16F;
if(Minecraft.getMinecraft().theWorld.isRaining())
this.sadFace.render(f5);
else this.happyFace.render(f5);
this.thread.render(f5);
this.cloth.render(f5);
}
@@ -0,0 +1,50 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Oct 1, 2015, 9:40:27 PM (GMT)]
*/
package vazkii.botania.client.render.block;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileHourglass;
import vazkii.botania.common.block.tile.TileTeruTeruBozu;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderTeruTeruBozu implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, -0.3F, -0.5F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileTeruTeruBozu(), 0.0D, 0.0D, 0.0D, 0.0F);
GL11.glPopMatrix();
}
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
@Override
public int getRenderId() {
return LibRenderIDs.idTeruTeruBozu;
}
@Override
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
@@ -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 @ [Oct 1, 2015, 9:02:30 PM (GMT)]
*/
package vazkii.botania.client.render.tile;
import java.util.Random;
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.client.model.ModelTeruTeruBozu;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.tile.TileCocoon;
import vazkii.botania.common.block.tile.TileTeruTeruBozu;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
public class RenderTileTeruTeruBozu extends TileEntitySpecialRenderer {
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_TERU_TERU_BOZU);
ModelTeruTeruBozu model = new ModelTeruTeruBozu();
@Override
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
TileTeruTeruBozu tile = (TileTeruTeruBozu) tileentity;
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_CULL_FACE);
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(180F, 1F, 0F, 0F);
double time = Botania.proxy.getWorldElapsedTicks() + f;
boolean hasWorld = tileentity.getWorldObj() != null;
if(hasWorld)
time += new Random(tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord).nextInt(1000);
GL11.glTranslatef(0.5F, -1.25F + (hasWorld ? ((float) Math.sin(time * 0.01F) * 0.05F) : 0F), -0.5F);
if(hasWorld) {
GL11.glRotated(time * 0.3, 0F, 1F, 0F);
GL11.glRotatef(4F * (float) Math.sin(time * 0.05F), 0F, 0F, 1F);
float s = 0.75F;
GL11.glScalef(s, s, s);
}
model.render();
GL11.glColor3f(1F, 1F, 1F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
}
}
@@ -0,0 +1,113 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Oct 1, 2015, 1:11:26 PM (GMT)]
*/
package vazkii.botania.common.block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileTeruTeruBozu;
import vazkii.botania.common.lib.LibBlockNames;
public class BlockTeruTeruBozu extends BlockModContainer {
public BlockTeruTeruBozu() {
super(Material.cloth);
setBlockName(LibBlockNames.TERU_TERU_BOZU);
float f = 0.25F;
setBlockBounds(f, 0.01F, f, 1F - f, 0.99F, 1F - f);
}
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity e) {
if(!world.isRemote && e instanceof EntityItem) {
EntityItem item = (EntityItem) e;
ItemStack stack = item.getEntityItem();
if(isSunflower(stack) && removeRain(world)) {
stack.stackSize--;
if(stack.stackSize == 0)
e.setDead();
}
}
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int s, float xs, float ys, float zs) {
ItemStack stack = player.getCurrentEquippedItem();
if(stack != null && isSunflower(stack) && removeRain(world)) {
if(!player.capabilities.isCreativeMode)
stack.stackSize--;
return true;
}
return false;
}
public boolean isSunflower(ItemStack stack) {
return stack.getItem() == Item.getItemFromBlock(Blocks.double_plant) && stack.getItemDamage() == 0;
}
public boolean removeRain(World world) {
if(world.isRaining()) {
world.getWorldInfo().setRaining(false);
return true;
}
return false;
}
@Override
public boolean hasComparatorInputOverride() {
return true;
}
@Override
public int getComparatorInputOverride(World world, int x, int y, int z, int s) {
return world.isRaining() ? 15 : 0;
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
// NO-OP
}
@Override
public IIcon getIcon(int side, int meta) {
return Blocks.wool.getIcon(0, 0);
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public int getRenderType() {
return LibRenderIDs.idTeruTeruBozu;
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileTeruTeruBozu();
}
}
@@ -142,6 +142,7 @@ import vazkii.botania.common.block.tile.TileSpawnerClaw;
import vazkii.botania.common.block.tile.TileSpecialFlower;
import vazkii.botania.common.block.tile.TileStarfield;
import vazkii.botania.common.block.tile.TileTerraPlate;
import vazkii.botania.common.block.tile.TileTeruTeruBozu;
import vazkii.botania.common.block.tile.TileTinyPlanet;
import vazkii.botania.common.block.tile.TileTinyPotato;
import vazkii.botania.common.block.tile.corporea.TileCorporeaCrystalCube;
@@ -258,6 +259,7 @@ public final class ModBlocks {
public static Block redStringInterceptor;
public static Block gaiaHead;
public static Block corporeaRetainer;
public static Block teruTeruBozu;
public static void init() {
flower = new BlockModFlower();
@@ -345,6 +347,7 @@ public final class ModBlocks {
redStringInterceptor = new BlockRedStringInterceptor();
gaiaHead = new BlockGaiaHead();
corporeaRetainer = new BlockCorporeaRetainer();
teruTeruBozu = new BlockTeruTeruBozu();
ModFluffBlocks.init();
@@ -445,6 +448,7 @@ public final class ModBlocks {
registerTile(TileRedStringInterceptor.class, LibBlockNames.RED_STRING_INTERCEPTOR);
registerTile(TileGaiaHead.class, LibBlockNames.GAIA_HEAD);
registerTile(TileCorporeaRetainer.class, LibBlockNames.CORPOREA_RETAINER);
registerTile(TileTeruTeruBozu.class, LibBlockNames.TERU_TERU_BOZU);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_PUREDAISY, SubTilePureDaisy.class);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_MANASTAR, SubTileManastar.class);
@@ -0,0 +1,28 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Oct 1, 2015, 1:11:44 PM (GMT)]
*/
package vazkii.botania.common.block.tile;
public class TileTeruTeruBozu extends TileMod {
public boolean wasRaining = false;
@Override
public void updateEntity() {
boolean isRaining = worldObj.isRaining();
if(isRaining && worldObj.rand.nextInt(9600) == 0)
worldObj.getWorldInfo().setRaining(false);
if(wasRaining != isRaining)
worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
wasRaining = isRaining;
}
}
@@ -112,6 +112,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
addItem(ModItems.spawnerMover);
addBlock(ModBlocks.spawnerClaw);
addBlock(ModBlocks.cocoon);
addBlock(ModBlocks.teruTeruBozu);
addItem(ModItems.slimeBottle);
addItem(ModItems.blackHoleTalisman);
@@ -101,6 +101,7 @@ public final class LibBlockNames {
public static final String CELL_BLOCK = "cellBlock";
public static final String GAIA_HEAD = "gaiaHeadBlock";
public static final String CORPOREA_RETAINER = "corporeaRetainer";
public static final String TERU_TERU_BOZU = "teruTeruBozu";
public static final String SUBTILE_PUREDAISY = "puredaisy";
public static final String SUBTILE_MANASTAR = "manastar";