Getting started with the Petal Apothecary.

This commit is contained in:
Vasco Lavos committed 2014-01-21 20:56:06 +00:00
1 parent e7d84d6376
commit 0cc1e1faa7
15 files changed
+319 -4

No files matched your search

@@ -12,17 +12,38 @@
package vazkii.botania.client.core.proxy;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.world.World;
import vazkii.botania.api.LexiconEntry;
import vazkii.botania.client.fx.FXSparkle;
import vazkii.botania.client.gui.GuiLexicon;
import vazkii.botania.client.gui.GuiLexiconEntry;
import vazkii.botania.client.gui.GuiLexiconIndex;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.client.render.block.RenderAltar;
import vazkii.botania.client.render.tile.RenderTileAltar;
import vazkii.botania.common.block.tile.TileAltar;
import vazkii.botania.common.core.proxy.CommonProxy;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.event.FMLInitializationEvent;
public class ClientProxy extends CommonProxy {
@Override
public void init(FMLInitializationEvent event) {
super.init(event);
initRenderers();
}
private void initRenderers() {
LibRenderIDs.idAltar = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(new RenderAltar());
ClientRegistry.bindTileEntitySpecialRenderer(TileAltar.class, new RenderTileAltar());
}
@Override
public void setEntryToOpen(LexiconEntry entry) {
GuiLexicon.currentOpenLexicon = new GuiLexiconEntry(entry, new GuiLexiconIndex(entry.category));
@@ -0,0 +1,18 @@
/**
* 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 a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Jan 21, 2014, 8:03:06 PM (GMT)]
*/
package vazkii.botania.client.lib;
public final class LibRenderIDs {
public static int idAltar = -1;
}
@@ -18,9 +18,9 @@ public final class LibResources {
public static final String PREFIX_LANG = "/assets/botania/lang/";
public static final String PREFIX_GUI = PREFIX_MOD + "textures/gui/";
public static final String PREFIX_ENTRIES = PREFIX_GUI + "entries/";
public static final String PREFIX_MISC = PREFIX_MOD + "textures/misc/";
public static final String PREFIX_ENTRIES = PREFIX_GUI + "entries/";
public static final String PREFIX_MODEL = PREFIX_MOD + "textures/model/";
public static final String PREFIX_MISC = PREFIX_MOD + "textures/misc/";
public static final String EMTPY_TEXTURE = "emptyTexture";
@@ -29,6 +29,8 @@ public final class LibResources {
public static final String ENTRY_FLOWERS = PREFIX_ENTRIES + "flowers.png";
public static final String MODEL_ALTAR = PREFIX_MODEL + "altar.png";
public static final String MISC_PARTICLES = PREFIX_MISC + "particles.png";
public static final String MISC_WISP_LARGE = PREFIX_MISC + "wispLarge.png";
public static final String MISC_WISP_SMALL = PREFIX_MISC + "wispSmall.png";
@@ -0,0 +1,89 @@
/**
* 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 a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Jan 21, 2014, 7:56:15 PM (GMT)]
*/
package vazkii.botania.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
public class ModelAltar extends ModelBase {
ModelRenderer gobletBase;
ModelRenderer gobletBase2;
ModelRenderer gobletBase3;
ModelRenderer gobletStand;
ModelRenderer kelkBase;
ModelRenderer kelkBase2;
ModelRenderer kelkWall1;
ModelRenderer kelkWall2;
ModelRenderer kelkWall3;
ModelRenderer kelkWall4;
public ModelAltar() {
textureWidth = 256;
textureHeight = 128;
gobletBase = new ModelRenderer(this, 0, 0);
gobletBase.addBox(0F, 0F, 0F, 16, 2, 16);
gobletBase.setRotationPoint(-8F, 22F, -8F);
gobletBase.setTextureSize(256, 128);
gobletBase2 = new ModelRenderer(this, 0, 18);
gobletBase2.addBox(0F, 0F, 0F, 14, 1, 14);
gobletBase2.setRotationPoint(-7F, 21F, -7F);
gobletBase2.setTextureSize(256, 128);
gobletStand = new ModelRenderer(this, 68, 0);
gobletStand.addBox(0F, 0F, 0F, 6, 8, 6);
gobletStand.setRotationPoint(-3F, 12F, -3F);
gobletStand.setTextureSize(256, 128);
gobletBase3 = new ModelRenderer(this, 0, 33);
gobletBase3.addBox(0F, 0F, 0F, 12, 1, 12);
gobletBase3.setRotationPoint(-6F, 20F, -6F);
gobletBase3.setTextureSize(256, 128);
kelkBase = new ModelRenderer(this, 72, 45);
kelkBase.addBox(0F, 0F, 0F, 8, 1, 8);
kelkBase.setRotationPoint(-4F, 11F, -4F);
kelkBase.setTextureSize(256, 128);
kelkBase2 = new ModelRenderer(this, 72, 34);
kelkBase2.addBox(0F, 0F, 0F, 10, 1, 10);
kelkBase2.setRotationPoint(-5F, 10F, -5F);
kelkBase2.setTextureSize(256, 128);
kelkWall1 = new ModelRenderer(this, 72, 18);
kelkWall1.addBox(0F, 0F, 0F, 1, 6, 10);
kelkWall1.setRotationPoint(5F, 4F, -5F);
kelkWall1.setTextureSize(256, 128);
kelkWall2 = new ModelRenderer(this, 72, 18);
kelkWall2.addBox(0F, 0F, 0F, 1, 6, 10);
kelkWall2.setRotationPoint(-6F, 4F, -5F);
kelkWall2.setTextureSize(256, 128);
kelkWall3 = new ModelRenderer(this, 94, 18);
kelkWall3.addBox(0F, 0F, 0F, 10, 6, 1);
kelkWall3.setRotationPoint(-5F, 4F, 5F);
kelkWall3.setTextureSize(256, 128);
kelkWall4 = new ModelRenderer(this, 94, 18);
kelkWall4.addBox(0F, 0F, 0F, 10, 6, 1);
kelkWall4.setRotationPoint(-5F, 4F, -6F);
kelkWall4.setTextureSize(256, 128);
}
public void render() {
float f = 1F / 16F;
gobletBase.render(f);
gobletBase2.render(f);
gobletBase3.render(f);
gobletStand.render(f);
kelkBase.render(f);
kelkBase2.render(f);
kelkWall1.render(f);
kelkWall2.render(f);
kelkWall3.render(f);
kelkWall4.render(f);
}
}
@@ -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 a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Jan 21, 2014, 8:02:01 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.TileEntityRenderer;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileAltar;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderAltar implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, -0.6F, -0.5F);
GL11.glScalef(0.9F, 0.9F, 0.9F);
TileEntityRenderer.instance.renderTileEntityAt(new TileAltar(), 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 boolean shouldRender3DInInventory() {
return true;
}
@Override
public int getRenderId() {
return LibRenderIDs.idAltar;
}
}
@@ -0,0 +1,44 @@
/**
* 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 a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Jan 21, 2014, 7:55:47 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.ModelAltar;
public class RenderTileAltar extends TileEntitySpecialRenderer {
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_ALTAR);
ModelAltar model = new ModelAltar();
@Override
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glColor4f(1F, 1F, 1F, 1F);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
GL11.glTranslated(d0 + 0.5, d1 + 1.5, d2 + 0.5);
GL11.glScalef(1F, -1F, -1F);
model.render();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
@@ -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 a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Jan 21, 2014, 7:48:54 PM (GMT)]
*/
package vazkii.botania.common.block;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileAltar;
import vazkii.botania.common.lib.LibBlockIDs;
import vazkii.botania.common.lib.LibBlockNames;
public class BlockAltar extends BlockModContainer {
protected BlockAltar() {
super(LibBlockIDs.idAltar, Material.rock);
setHardness(3.5F);
setStepSound(soundStoneFootstep);
setUnlocalizedName(LibBlockNames.ALTAR);
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
public int getRenderType() {
return LibRenderIDs.idAltar;
}
@Override
public TileEntity createNewTileEntity(World world) {
return new TileAltar();
}
}
@@ -11,6 +11,7 @@
*/
package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
@@ -18,6 +19,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.core.BotaniaCreativeTab;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -29,6 +31,12 @@ public abstract class BlockModContainer<T extends TileEntity> extends BlockConta
setCreativeTab(BotaniaCreativeTab.INSTANCE);
}
@Override
public Block setUnlocalizedName(String par1Str) {
GameRegistry.registerBlock(this, par1Str);
return super.setUnlocalizedName(par1Str);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
@@ -11,20 +11,30 @@
*/
package vazkii.botania.common.block;
import vazkii.botania.common.lib.LibOreDict;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import vazkii.botania.common.block.tile.TileAltar;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibOreDict;
import cpw.mods.fml.common.registry.GameRegistry;
public final class ModBlocks {
public static Block flower;
public static Block altar;
public static void init() {
flower = new BlockModFlower();
altar = new BlockAltar();
for(int i = 0; i < 16; i++)
OreDictionary.registerOre(LibOreDict.FLOWER[i], new ItemStack(flower.blockID, 1, i));
initTileEntities();
}
private static void initTileEntities() {
GameRegistry.registerTileEntity(TileAltar.class, LibBlockNames.ALTAR);
}
}
@@ -0,0 +1,18 @@
/**
* 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 a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Jan 21, 2014, 7:51:36 PM (GMT)]
*/
package vazkii.botania.common.block.tile;
import net.minecraft.tileentity.TileEntity;
public class TileAltar extends TileEntity {
}
@@ -46,6 +46,8 @@ public final class BotaniaCreativeTab extends CreativeTabs {
addItem(ModItems.pestleAndMortar);
addItem(ModItems.dye);
addItem(ModItems.twigWand);
addBlock(ModBlocks.altar);
}
private void addItem(Item item) {
@@ -14,5 +14,6 @@ package vazkii.botania.common.lib;
public final class LibBlockIDs {
public static int idFlower = 1955;
public static int idAltar = 1956;
}
@@ -16,5 +16,6 @@ import vazkii.botania.client.lib.LibResources;
public final class LibBlockNames {
public static final String FLOWER = LibResources.PREFIX_MOD + "flower";
public static final String ALTAR = LibResources.PREFIX_MOD + "altar";
}
+1
View File
@@ -24,6 +24,7 @@ tile.botania:flower12.name=Mystical Brown Flower
tile.botania:flower13.name=Mystical Green Flower
tile.botania:flower14.name=Mystical Red Flower
tile.botania:flower15.name=Mystical Black Flower
tile.botania:altar.name=Petal Apothecary
# ITEM NAMES
item.botania:lexicon.name=Lexica Botania
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB