Started on Bone Segments, currently the metdata isn't playing nicely for some reason :/

This commit is contained in:
Adubbz 2013-05-23 06:08:28 +10:00
parent 6ccd3f590d
commit d9b3519b65
7 changed files with 296 additions and 12 deletions

View file

@ -1,19 +1,23 @@
package biomesoplenty; package biomesoplenty;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelSlime; import net.minecraft.client.model.ModelSlime;
import net.minecraft.client.particle.EntityBreakingFX; import net.minecraft.client.particle.EntityBreakingFX;
import net.minecraft.client.particle.EntityFX; import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.entity.RenderSlime; import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.client.renderer.entity.RenderSnowball;
import org.lwjgl.opengl.GL11;
import biomesoplenty.api.Items; import biomesoplenty.api.Items;
import biomesoplenty.blocks.renderers.FoliageRenderer; import biomesoplenty.blocks.renderers.FoliageRenderer;
import biomesoplenty.blocks.renderers.PlantsRenderer; import biomesoplenty.blocks.renderers.PlantsRenderer;
import biomesoplenty.blocks.renderers.SmallBlockRenderer;
import biomesoplenty.items.projectiles.EntityDart; import biomesoplenty.items.projectiles.EntityDart;
import biomesoplenty.items.projectiles.EntityMudball; import biomesoplenty.items.projectiles.EntityMudball;
import biomesoplenty.items.projectiles.EntityPoisonDart;
import biomesoplenty.items.projectiles.RenderDart; import biomesoplenty.items.projectiles.RenderDart;
import biomesoplenty.items.projectiles.RenderPoisonDart;
import biomesoplenty.mobs.EntityGlob; import biomesoplenty.mobs.EntityGlob;
import biomesoplenty.mobs.RenderGlob; import biomesoplenty.mobs.RenderGlob;
import biomesoplenty.particles.EntityDandelionFX; import biomesoplenty.particles.EntityDandelionFX;
@ -34,6 +38,7 @@ public class ClientProxy extends CommonProxy {
RenderingRegistry.registerBlockHandler(new FoliageRenderer()); RenderingRegistry.registerBlockHandler(new FoliageRenderer());
RenderingRegistry.registerBlockHandler(new PlantsRenderer()); RenderingRegistry.registerBlockHandler(new PlantsRenderer());
RenderingRegistry.registerBlockHandler(new SmallBlockRenderer());
} }
@Override @Override
@ -56,4 +61,37 @@ public class ClientProxy extends CommonProxy {
{ {
return RenderingRegistry.addNewArmourRendererPrefix(armor); return RenderingRegistry.addNewArmourRendererPrefix(armor);
} }
@Override
public void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta)
{
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F);
renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
} }

View file

@ -1,9 +1,7 @@
package biomesoplenty; package biomesoplenty;
import biomesoplenty.api.Items; import net.minecraft.block.Block;
import net.minecraft.client.particle.EntityBreakingFX; import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.world.World;
public class CommonProxy { public class CommonProxy {
public static String ARMOR_MUD1_PNG = "/mods/BiomesOPlenty/textures/armor/mud_1.png"; public static String ARMOR_MUD1_PNG = "/mods/BiomesOPlenty/textures/armor/mud_1.png";
@ -24,4 +22,8 @@ public class CommonProxy {
public void spawnParticle(String string, double x, double y, double z) public void spawnParticle(String string, double x, double y, double z)
{ {
} }
public void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta)
{
}
} }

View file

@ -46,8 +46,8 @@ public class Blocks
public static Optional<? extends Block> redCobbleStairs = Optional.absent(); public static Optional<? extends Block> redCobbleStairs = Optional.absent();
public static Optional<? extends Block> redBricksStairs = Optional.absent(); public static Optional<? extends Block> redBricksStairs = Optional.absent();
public static Optional<? extends Block> mudBricksStairs = Optional.absent(); public static Optional<? extends Block> mudBricksStairs = Optional.absent();
public static Optional<? extends Block> holyCobbleStairs = Optional.absent(); public static Optional<? extends Block> holyCobbleStairs = Optional.absent();
public static Optional<? extends Block> holyBricksStairs = Optional.absent(); public static Optional<? extends Block> holyBricksStairs = Optional.absent();
// Slabs // Slabs
public static Optional<? extends BlockHalfSlab> woodenSingleSlab1 = Optional.absent(); public static Optional<? extends BlockHalfSlab> woodenSingleSlab1 = Optional.absent();
@ -70,12 +70,15 @@ public class Blocks
public static Optional<? extends Block> saplings = Optional.absent(); public static Optional<? extends Block> saplings = Optional.absent();
public static Optional<? extends Block> colorizedSaplings = Optional.absent(); public static Optional<? extends Block> colorizedSaplings = Optional.absent();
public static Optional<? extends Block> willow = Optional.absent(); public static Optional<? extends Block> willow = Optional.absent();
public static Optional<? extends Block> ivy = Optional.absent(); public static Optional<? extends Block> ivy = Optional.absent();
public static Optional<? extends Block> treeMoss = Optional.absent(); public static Optional<? extends Block> treeMoss = Optional.absent();
public static Optional<? extends Block> moss = Optional.absent(); public static Optional<? extends Block> moss = Optional.absent();
public static Optional<? extends Block> petals = Optional.absent(); public static Optional<? extends Block> petals = Optional.absent();
public static Optional<? extends Block> bamboo = Optional.absent(); public static Optional<? extends Block> bamboo = Optional.absent();
public static Optional<? extends Block> cloud = Optional.absent(); public static Optional<? extends Block> cloud = Optional.absent();
//Nether
public static Optional<? extends Block> bones = Optional.absent();
// public static Optional<? extends Block> amethystBlock = Optional.absent(); // public static Optional<? extends Block> amethystBlock = Optional.absent();
public static Optional<? extends Block> amethystOre = Optional.absent(); public static Optional<? extends Block> amethystOre = Optional.absent();

View file

@ -0,0 +1,162 @@
package biomesoplenty.blocks;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.Blocks;
import biomesoplenty.blocks.renderers.SmallBlockRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockBones extends Block {
private static final String[] boneTypes = new String[] {"bones_small", "bones_medium", "bones_large"};
private Icon[] textures;
public BlockBones(int blockID)
{
super(blockID, Material.rock);
setHardness(3.0F);
setResistance(5.0F);
this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
}
@Override
public void registerIcons(IconRegister iconRegister)
{
textures = new Icon[boneTypes.length];
for (int i = 0; i < boneTypes.length; ++i)
textures[i] = iconRegister.registerIcon("BiomesOPlenty:"+boneTypes[i]);
}
@Override
public Icon getIcon(int side, int meta)
{
if (meta < 0 || meta >= textures.length)
meta = 0;
return textures[meta];
}
/*@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0)
{
return AxisAlignedBB.getBoundingBox((double) x + 0.25D, y, (double) z + 0.25D, (double) x + 0.75D, (double) y + 0.5D, (double) z + 0.75D);
}
if (meta == 1)
{
return AxisAlignedBB.getBoundingBox((double) x + 0.125D, y, (double) z + 0.125D, (double) x + 0.875D, (double) y + 0.75D, (double) z + 0.875D);
}
else
{
return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 1.0D, (double) z + 1.0D);
}
}
@Override
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0)
{
return AxisAlignedBB.getBoundingBox((double) x + 0.25D, y, (double) z + 0.25D, (double) x + 0.75D, (double) y + 0.5D, (double) z + 0.75D);
}
else if (meta == 1)
{
return AxisAlignedBB.getBoundingBox((double) x + 0.125D, y, (double) z + 0.125D, (double) x + 0.875D, (double) y + 0.75D, (double) z + 0.875D);
}
else
{
return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 1.0D, (double) z + 1.0D);
}
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, int x, int y, int z)
{
int meta = iblockaccess.getBlockMetadata(x, y, z);
float minX;
float minY = 0F;
float minZ;
float maxX;
float maxY;
float maxZ;
if (meta == 0)
{
minX = minZ = 0.25F;
maxX = maxZ = 0.75F;
maxY = 0.5F;
}
else if (meta == 1)
{
minX = minZ = 0.125F;
maxX = maxZ = 0.875F;
maxY = 0.75F;
}
else
{
minX = minZ = 0.0F;
maxX = maxZ = 1.0F;
maxY = 1.0F;
}
setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
}*/
@Override
public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list)
{
for (int i = 0; i < boneTypes.length; ++i)
list.add(new ItemStack(blockID, 1, i));
}/*
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public int getRenderType()
{
return SmallBlockRenderer.bonesModel;
}
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
return true;
}*/
@Override
public int damageDropped(int meta)
{
return meta;
}
}

View file

@ -0,0 +1,66 @@
package biomesoplenty.blocks.renderers;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import biomesoplenty.BiomesOPlenty;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class SmallBlockRenderer implements ISimpleBlockRenderingHandler
{
public static int bonesModel = RenderingRegistry.getNextAvailableRenderId();
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
if (modelId == bonesModel)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0)
{
renderer.setRenderBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
renderer.renderStandardBlock(block, x, y, z);
}
else if (meta == 1)
{
renderer.setRenderBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.75F, 0.875F);
renderer.renderStandardBlock(block, x, y, z);
}
else
{
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
}
}
return true;
}
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == bonesModel)
{
Tessellator tessellator = Tessellator.instance;
renderer.setRenderBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
BiomesOPlenty.proxy.renderStandardInvBlock(renderer, block, metadata);
}
}
@Override
public boolean shouldRender3DInInventory()
{
return true;
}
@Override
public int getRenderId()
{
return bonesModel;
}
}

View file

@ -32,6 +32,7 @@ import biomesoplenty.blocks.BlockBOPSlab.SlabCategory;
import biomesoplenty.blocks.BlockBOPStairs; import biomesoplenty.blocks.BlockBOPStairs;
import biomesoplenty.blocks.BlockBOPStairs.Category; import biomesoplenty.blocks.BlockBOPStairs.Category;
import biomesoplenty.blocks.BlockBamboo; import biomesoplenty.blocks.BlockBamboo;
import biomesoplenty.blocks.BlockBones;
import biomesoplenty.blocks.BlockCloud; import biomesoplenty.blocks.BlockCloud;
import biomesoplenty.blocks.BlockIvy; import biomesoplenty.blocks.BlockIvy;
import biomesoplenty.blocks.BlockMoss; import biomesoplenty.blocks.BlockMoss;
@ -149,6 +150,8 @@ public class BOPBlocks {
// Blocks.grass = Optional.of(new BlockBOPGrass(3000).setUnlocalizedName("holyGrass")); // Blocks.grass = Optional.of(new BlockBOPGrass(3000).setUnlocalizedName("holyGrass"));
Blocks.cloud = Optional.of((new BlockCloud(BOPConfiguration.cloudID)).setHardness(0.1F).setLightOpacity(3).setStepSound(Block.soundClothFootstep).setUnlocalizedName("cloud")); Blocks.cloud = Optional.of((new BlockCloud(BOPConfiguration.cloudID)).setHardness(0.1F).setLightOpacity(3).setStepSound(Block.soundClothFootstep).setUnlocalizedName("cloud"));
Blocks.bones = Optional.of((new BlockBones(BOPConfiguration.bonesID)).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("bones"));
Blocks.planks = Optional.of((new BlockBOPPlank(BOPConfiguration.planksID)).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("planks")); Blocks.planks = Optional.of((new BlockBOPPlank(BOPConfiguration.planksID)).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("planks"));
Blocks.woodenDoubleSlab1 = Optional.of((BlockHalfSlab)(new BlockBOPSlab(BOPConfiguration.woodenDoubleSlab1ID, true, Material.wood, SlabCategory.WOOD1)).setUnlocalizedName("woodenDoubleSlab1")); Blocks.woodenDoubleSlab1 = Optional.of((BlockHalfSlab)(new BlockBOPSlab(BOPConfiguration.woodenDoubleSlab1ID, true, Material.wood, SlabCategory.WOOD1)).setUnlocalizedName("woodenDoubleSlab1"));
@ -220,6 +223,8 @@ public class BOPBlocks {
// GameRegistry.registerBlock(Blocks.amethyst.get(), ItemBOPAmethyst.class, "amethystOre1"); // GameRegistry.registerBlock(Blocks.amethyst.get(), ItemBOPAmethyst.class, "amethystOre1");
GameRegistry.registerBlock(Blocks.cloud.get(), "cloud"); GameRegistry.registerBlock(Blocks.cloud.get(), "cloud");
GameRegistry.registerBlock(Blocks.bones.get(), "bones");
ItemBOPSlab.setSlabs(Blocks.stoneSingleSlab.get(), Blocks.stoneDoubleSlab.get()); ItemBOPSlab.setSlabs(Blocks.stoneSingleSlab.get(), Blocks.stoneDoubleSlab.get());
GameRegistry.registerBlock(Blocks.stoneDoubleSlab.get(), ItemBOPSlab.class, "stoneDoubleSlab"); GameRegistry.registerBlock(Blocks.stoneDoubleSlab.get(), ItemBOPSlab.class, "stoneDoubleSlab");
GameRegistry.registerBlock(Blocks.stoneSingleSlab.get(), ItemBOPSlab.class, "stoneSingleSlab"); GameRegistry.registerBlock(Blocks.stoneSingleSlab.get(), ItemBOPSlab.class, "stoneSingleSlab");
@ -370,6 +375,10 @@ public class BOPBlocks {
LanguageRegistry.addName(new ItemStack(Blocks.mud.get(), 1, 1), "Quicksand"); LanguageRegistry.addName(new ItemStack(Blocks.mud.get(), 1, 1), "Quicksand");
LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,2), "Bamboo Sapling"); LanguageRegistry.addName(new ItemStack(Blocks.saplings.get(),1,2), "Bamboo Sapling");
LanguageRegistry.addName(new ItemStack(Blocks.bones.get(), 1, 0), "Small Bone Segment");
LanguageRegistry.addName(new ItemStack(Blocks.bones.get(), 1, 1), "Medium Bone Segment");
LanguageRegistry.addName(new ItemStack(Blocks.bones.get(), 1, 2), "Large Bone Segment");
LanguageRegistry.addName(new ItemStack(Blocks.planks.get(), 1, 0), "Acacia Wood Planks"); LanguageRegistry.addName(new ItemStack(Blocks.planks.get(), 1, 0), "Acacia Wood Planks");
LanguageRegistry.addName(new ItemStack(Blocks.planks.get(), 1, 1), "Cherry Wood Planks"); LanguageRegistry.addName(new ItemStack(Blocks.planks.get(), 1, 1), "Cherry Wood Planks");
LanguageRegistry.addName(new ItemStack(Blocks.planks.get(), 1, 2), "Dark Wood Planks"); LanguageRegistry.addName(new ItemStack(Blocks.planks.get(), 1, 2), "Dark Wood Planks");

View file

@ -183,6 +183,8 @@ public class BOPConfiguration {
public static int crystalID; public static int crystalID;
public static int cloudID; public static int cloudID;
public static int bonesID;
//Item IDs //Item IDs
public static int shroomPowderID; public static int shroomPowderID;
public static int sunflowerSeedsID; public static int sunflowerSeedsID;
@ -681,6 +683,8 @@ public class BOPConfiguration {
mushroomsID = config.getBlock("Mushroom ID", 1967, null).getInt(); mushroomsID = config.getBlock("Mushroom ID", 1967, null).getInt();
bonesID = config.getBlock("Bones ID", 1968, null).getInt();
// Get Item ID's // Get Item ID's
shroomPowderID = config.getItem("Shroom Powder ID", 21001, null).getInt(); shroomPowderID = config.getItem("Shroom Powder ID", 21001, null).getInt();
sunflowerSeedsID = config.getItem("Sunflower Seeds ID", 21002, null).getInt(); sunflowerSeedsID = config.getItem("Sunflower Seeds ID", 21002, null).getInt();