Getting started with the Spreader.

This commit is contained in:
Vasco Lavos committed 2014-01-25 22:00:33 +00:00
1 parent ec6f8812c9
commit 67dc886b50
13 files changed
+228 -12

No files matched your search

@@ -23,8 +23,11 @@ import vazkii.botania.client.gui.GuiLexiconIndex;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.client.render.block.RenderAltar;
import vazkii.botania.client.render.block.RenderSpecialFlower;
import vazkii.botania.client.render.block.RenderSpreader;
import vazkii.botania.client.render.tile.RenderTileAltar;
import vazkii.botania.client.render.tile.RenderTileSpreader;
import vazkii.botania.common.block.tile.TileAltar;
import vazkii.botania.common.block.tile.TileSpreader;
import vazkii.botania.common.core.proxy.CommonProxy;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
@@ -44,11 +47,15 @@ public class ClientProxy extends CommonProxy {
private void initRenderers() {
LibRenderIDs.idAltar = RenderingRegistry.getNextAvailableRenderId();
LibRenderIDs.idSpecialFlower = RenderingRegistry.getNextAvailableRenderId();
LibRenderIDs.idSpreader = RenderingRegistry.getNextAvailableRenderId();
LibRenderIDs.idPool = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(new RenderAltar());
RenderingRegistry.registerBlockHandler(new RenderSpecialFlower());
RenderingRegistry.registerBlockHandler(new RenderSpreader());
ClientRegistry.bindTileEntitySpecialRenderer(TileAltar.class, new RenderTileAltar());
ClientRegistry.bindTileEntitySpecialRenderer(TileSpreader.class, new RenderTileSpreader());
}
@Override
@@ -15,5 +15,7 @@ public final class LibRenderIDs {
public static int idAltar = -1;
public static int idSpecialFlower = -1;
public static int idSpreader = -1;
public static int idPool = -1;
}
@@ -31,7 +31,9 @@ public final class LibResources {
public static final String ENTRY_APOTHECARY = PREFIX_ENTRIES + "apothecary.png";
public static final String MODEL_ALTAR = PREFIX_MODEL + "altar.png";
public static final String MODEL_SPREADER = PREFIX_MODEL + "spreader.png";
public static final String MODEL_POOL = PREFIX_MODEL + "pool.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";
@@ -33,43 +33,43 @@ public class ModelSpreader extends ModelBase {
cubeSide1 = new ModelRenderer(this, 0, 0);
cubeSide1.addBox(0F, 0F, 0F, 14, 1, 14);
cubeSide1.setRotationPoint(1F, 1F, 1F);
cubeSide1.setRotationPoint(-7F, 22F, -7F);
cubeSide1.setTextureSize(64, 32);
cubeSide2 = new ModelRenderer(this, 0, 0);
cubeSide2.addBox(0F, 0F, 0F, 14, 13, 1);
cubeSide2.setRotationPoint(1F, -12F, 1F);
cubeSide2.setRotationPoint(-7F, 9F, -7F);
cubeSide2.setTextureSize(64, 32);
cubeSide3 = new ModelRenderer(this, 0, 0);
cubeSide3.addBox(0F, 0F, 0F, 1, 13, 13);
cubeSide3.setRotationPoint(1F, -12F, 2F);
cubeSide3.setRotationPoint(-7F, 9F, -6F);
cubeSide3.setTextureSize(64, 32);
cubeSide4 = new ModelRenderer(this, 0, 0);
cubeSide4.addBox(0F, 0F, 0F, 1, 13, 13);
cubeSide4.setRotationPoint(14F, -12F, 2F);
cubeSide4.setRotationPoint(6F, 9F, -6F);
cubeSide4.setTextureSize(64, 32);
cubeSide5 = new ModelRenderer(this, 0, 0);
cubeSide5.addBox(0F, 0F, 0F, 12, 1, 13);
cubeSide5.setRotationPoint(2F, -12F, 2F);
cubeSide5.setRotationPoint(-6F, 9F, -6F);
cubeSide5.setTextureSize(64, 32);
cubeHole1 = new ModelRenderer(this, 0, 0);
cubeHole1.addBox(0F, 0F, 0F, 4, 12, 1);
cubeHole1.setRotationPoint(10F, -11F, 14F);
cubeHole1.setRotationPoint(2F, 10F, 6F);
cubeHole1.setTextureSize(64, 32);
cubeHole2 = new ModelRenderer(this, 0, 0);
cubeHole2.addBox(0F, 0F, 0F, 4, 12, 1);
cubeHole2.setRotationPoint(2F, -11F, 14F);
cubeHole2.setRotationPoint(-6F, 10F, 6F);
cubeHole2.setTextureSize(64, 32);
cubeHole3 = new ModelRenderer(this, 0, 0);
cubeHole3.addBox(0F, 0F, 0F, 4, 4, 1);
cubeHole3.setRotationPoint(6F, -3F, 14F);
cubeHole3.setRotationPoint(-2F, 18F, 6F);
cubeHole3.setTextureSize(64, 32);
cubeHole4 = new ModelRenderer(this, 0, 0);
cubeHole4.addBox(0F, 0F, 0F, 4, 4, 1);
cubeHole4.setRotationPoint(6F, -11F, 14F);
cubeHole4.setRotationPoint(-2F, 10F, 6F);
cubeHole4.setTextureSize(64, 32);
cubeInside = new ModelRenderer(this, 30, 17);
cubeInside.addBox(0F, 0F, 0F, 6, 6, 6);
cubeInside.setRotationPoint(5F, -8F, 5F);
cubeInside.setRotationPoint(-3F, 13F, -3F);
cubeInside.setTextureSize(64, 32);
}
@@ -0,0 +1,51 @@
/**
* 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 25, 2014, 9:45:58 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 vazkii.botania.common.block.tile.TileSpreader;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderSpreader implements ISimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
TileEntityRenderer.instance.renderTileEntityAt(new TileSpreader(), 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.idSpreader;
}
}
@@ -0,0 +1,47 @@
/**
* 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 25, 2014, 9:42:31 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.ModelSpreader;
import vazkii.botania.common.block.tile.TileSpreader;
public class RenderTileSpreader extends TileEntitySpecialRenderer {
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_SPREADER);
private static final ModelSpreader model = new ModelSpreader();
@Override
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
TileSpreader spreader = (TileSpreader) tileentity;
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glTranslated(d0, d1, d2);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
GL11.glScalef(1F, -1F, -1F);
model.render();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
@@ -0,0 +1,59 @@
/**
* 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 25, 2014, 9:38:23 PM (GMT)]
*/
package vazkii.botania.common.block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import vazkii.botania.api.IWandable;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileSpreader;
import vazkii.botania.common.lib.LibBlockIDs;
import vazkii.botania.common.lib.LibBlockNames;
public class BlockSpreader extends BlockModContainer implements IWandable {
protected BlockSpreader() {
super(LibBlockIDs.idSpreader, Material.wood);
setHardness(2.0F);
setStepSound(soundWoodFootstep);
setUnlocalizedName(LibBlockNames.SPREADER);
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public int getRenderType() {
return LibRenderIDs.idSpreader;
}
@Override
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
return false;
}
@Override
public TileEntity createNewTileEntity(World world) {
return new TileSpreader();
}
}
@@ -18,6 +18,7 @@ import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.common.block.subtile.generating.SubTileDaybloom;
import vazkii.botania.common.block.tile.TileAltar;
import vazkii.botania.common.block.tile.TileSpecialFlower;
import vazkii.botania.common.block.tile.TileSpreader;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibOreDict;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -27,11 +28,13 @@ public final class ModBlocks {
public static Block flower;
public static Block altar;
public static Block specialFlower;
public static Block spreader;
public static void init() {
flower = new BlockModFlower();
altar = new BlockAltar();
specialFlower = new BlockSpecialFlower();
spreader = new BlockSpreader();
for(int i = 0; i < 16; i++)
OreDictionary.registerOre(LibOreDict.FLOWER[i], new ItemStack(flower.blockID, 1, i));
@@ -42,7 +45,8 @@ public final class ModBlocks {
private static void initTileEntities() {
GameRegistry.registerTileEntity(TileAltar.class, LibBlockNames.ALTAR);
GameRegistry.registerTileEntity(TileSpecialFlower.class, LibBlockNames.SPECIAL_FLOWER);
GameRegistry.registerTileEntity(TileSpreader.class, LibBlockNames.SPREADER);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_DAYBLOOM, SubTileDaybloom.class);
}
}
@@ -0,0 +1,37 @@
/**
* 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 25, 2014, 9:40:57 PM (GMT)]
*/
package vazkii.botania.common.block.tile;
import net.minecraft.tileentity.TileEntity;
import vazkii.botania.api.IWandRotateable;
public class TileSpreader extends TileEntity implements IWandRotateable {
@Override
public int getHorizontalRotation() {
return 0;
}
@Override
public int getVerticalRotation() {
return 0;
}
@Override
public void changeRotation(float horizontal, float vertical) {
}
@Override
public void onClientTick() {
}
}
@@ -32,6 +32,8 @@ public final class ConfigHandler {
LibBlockIDs.idFlower = loadBlock(LibBlockNames.FLOWER, LibBlockIDs.idFlower);
LibBlockIDs.idAltar = loadBlock(LibBlockNames.ALTAR, LibBlockIDs.idAltar);
LibBlockIDs.idSpecialFlower = loadBlock(LibBlockNames.SPECIAL_FLOWER, LibBlockIDs.idSpecialFlower);
LibBlockIDs.idSpreader = loadBlock(LibBlockNames.SPREADER, LibBlockIDs.idSpreader);
LibBlockIDs.idPool = loadBlock(LibBlockNames.POOL, LibBlockIDs.idPool);
// Item IDs
LibItemIDs.idLexicon = loadItem(LibItemNames.LEXICON, LibItemIDs.idLexicon);
@@ -16,5 +16,7 @@ public final class LibBlockIDs {
public static int idFlower = 1955;
public static int idAltar = 1956;
public static int idSpecialFlower = 1957;
public static int idSpreader = 1958;
public static int idPool = 1959;
}
@@ -18,6 +18,8 @@ public final class LibBlockNames {
public static final String FLOWER = LibResources.PREFIX_MOD + "flower";
public static final String ALTAR = LibResources.PREFIX_MOD + "altar";
public static final String SPECIAL_FLOWER = LibResources.PREFIX_MOD + "specialFlower";
public static final String SPREADER = LibResources.PREFIX_MOD + "spreader";
public static final String POOL = LibResources.PREFIX_MOD + "pool";
public static final String SPECIAL_FLOWER_PREFIX = FLOWER + ".";
+1
View File
@@ -31,6 +31,7 @@ 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
tile.botania:spreader.name=Mana Spreader
tile.botania:flower..name=Botania Flower
tile.botania:flower.daybloom.name=Daybloom