Chisel 1.5.2

This commit is contained in:
asiekierka committed 2014-03-17 19:00:49 +01:00
1 parent 1efc4a0ad4
commit 1525907cdd
1526 files changed
+132 -61

No files matched your search

@@ -1,6 +1,7 @@
package info.jbcs.minecraft.chisel;
import info.jbcs.minecraft.chisel.CarvableVariation.CarvableVariationCTM;
import info.jbcs.minecraft.chisel.block.BlockCarvableGlass;
import info.jbcs.minecraft.chisel.block.BlockMarbleSlab;
import info.jbcs.minecraft.chisel.item.ItemCarvable;
import info.jbcs.minecraft.chisel.render.CTM;
@@ -251,26 +252,21 @@ public class CarvableHelper {
register(block, name, ItemCarvable.class);
}
void register(Block block, String name, int metaBegin, int metaEnd) {
register(block, name, metaBegin, metaEnd, ItemCarvable.class);
void registerBlock(Block block, String name) {
registerBlock(block, name, ItemCarvable.class);
}
void register(Block block, String name, Class cl) {
register(block, name, 0, 15, cl);
}
private boolean hasRegisteredBlock = false;
void register(Block block, String name, int metaBegin, int metaEnd, Class cl) {
void registerBlock(Block block, String name, Class cl) {
block.setBlockName(name);
if(!hasRegisteredBlock) {
GameRegistry.registerBlock(block, cl, name);
hasRegisteredBlock = true;
}
GameRegistry.registerBlock(block, cl, "chisel." + name);
chiselBlocks.add(block);
}
void register(Block block, String name, Class cl) {
registerBlock(block, name, cl);
if (block instanceof BlockMarbleSlab) {
BlockMarbleSlab slab = (BlockMarbleSlab) block;
GameRegistry.registerBlock(slab.top, cl, name + ".top");
}
for (CarvableVariation variation : variations) {
@@ -286,12 +282,9 @@ public class CarvableHelper {
}
}
}
chiselBlocks.add(block);
}
public void registerVariation(String name, CarvableVariation variation, Block block, int blockMeta) {
LanguageRegistry.addName(new ItemStack(block, 1, blockMeta),
Chisel.blockDescriptions?
variation.blockName:
@@ -29,5 +29,4 @@ public class CarvableVariation {
static class CarvableVariationCTM {
TextureSubmap seams[] = new TextureSubmap[3];
}
}
@@ -11,19 +11,6 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
public class Carving {
class CarvingGroup{
public CarvingGroup(String n) {
name=n;
}
String name;
String className;
String sound;
String oreName;
ArrayList<CarvingVariation> variations=new ArrayList<CarvingVariation>();
};
HashMap<String,CarvingGroup> carvingGroupsByName=new HashMap<String,CarvingGroup>();
HashMap<String,CarvingGroup> carvingGroupsByOre=new HashMap<String,CarvingGroup>();
HashMap<String,CarvingGroup> carvingGroupsByVariation=new HashMap<String,CarvingGroup>();
@@ -105,6 +92,7 @@ public class Carving {
public CarvingGroup getGroup(Block block,int metadata) {
if(block.equals(Blocks.stone)) block=Blocks.stonebrick;
// Check name first
CarvingGroup res;
if((res=carvingGroupsByOre.get(OreDictionary.getOreName(OreDictionary.getOreID(new ItemStack(block,1,metadata)))))!=null)
@@ -0,0 +1,16 @@
package info.jbcs.minecraft.chisel;
import java.util.ArrayList;
public class CarvingGroup{
public CarvingGroup(String n) {
name=n;
}
String name;
String className;
String sound;
String oreName;
ArrayList<CarvingVariation> variations=new ArrayList<CarvingVariation>();
}
@@ -129,8 +129,8 @@ public class Chisel {
public static BlockSpikes blockSpiketrap;
// 1.7
public static BlockCarvableGlass[] blockStainedGlass = new BlockCarvableGlass[16];
public static BlockCarvablePane[] blockStainedGlassPane = new BlockCarvablePane[16];
public static BlockCarvableGlass[] blockStainedGlass = new BlockCarvableGlass[4];
public static BlockCarvablePane[] blockStainedGlassPane = new BlockCarvablePane[8];
public static CreativeTabs tabChisel;
@@ -1129,7 +1129,7 @@ public class Chisel {
blockFactory.carverHelper.register(blockFactory, "blockFactory");
// 1.7! Let's go! Let's go-go!
/*
String[] sGNames = new String[]{
"White", "Orange", "Magenta", "Light Blue",
"Yellow", "Lime", "Pink", "Gray",
@@ -1138,21 +1138,53 @@ public class Chisel {
};
for(int i = 0; i < 16; i++) {
String odName = "stainedGlass" + sGNames[i].replaceAll(" ", "");
String blockName = "chisel.stainedGlass" + sGNames[i].replaceAll(" ", "");
String oreName = "stainedGlass" + sGNames[i].replaceAll(" ", "");
String texName = "glassdyed/" + sGNames[i].toLowerCase().replaceAll(" ", "") + "-";
int glassPrefix = 0;
int glassId = i;
blockStainedGlass[glassId] = (BlockCarvableGlass) new BlockCarvableGlass().setHardness(0.3F).setStepSound(Block.soundTypeGlass);
blockStainedGlass[glassId].carverHelper.addVariation(sGNames[i] + " Stained Glass", glassPrefix + 0, Blocks.stained_glass, i);
blockStainedGlass[glassId].carverHelper.addVariation(sGNames[i] + " Bubble Stained Glass", glassPrefix + 1, texName + "bubble");
blockStainedGlass[glassId].carverHelper.addVariation(sGNames[i] + " Stained Glass Panel", glassPrefix + 2, texName + "panel");
blockStainedGlass[glassId].carverHelper.addVariation(sGNames[i] + " Fancy Stained Glass Panel", glassPrefix + 3, texName + "panel-fancy");
blockStainedGlass[glassId].carverHelper.addVariation(sGNames[i] + " Small Stained Glass", glassPrefix + 4, texName + "quad");
blockStainedGlass[glassId].carverHelper.addVariation(sGNames[i] + " Small Fancy Stained Glass", glassPrefix + 5, texName + "quad-fancy");
blockStainedGlass[glassId].carverHelper.addVariation(sGNames[i] + " Borderless Stained Glass", glassPrefix + 6, texName + "transparent");
blockStainedGlass[glassId].carverHelper.register(blockStainedGlass[glassId], "stainedGlass."+glassId, glassPrefix, glassPrefix+7);
int glassPrefix = (i & 3) << 2;
int glassId = i >> 2;
if(glassPrefix == 0) {
blockStainedGlass[glassId] = (BlockCarvableGlass) new BlockCarvableGlass().setStained(true).setHardness(0.3F).setStepSound(Block.soundTypeGlass).setBlockName("Stained Glass");
blockStainedGlass[glassId].carverHelper.registerBlock(blockStainedGlass[glassId], blockName);
blockStainedGlass[glassId].carverHelper.blockName = "Stained Glass";
}
blockStainedGlass[glassId].carverHelper.addVariation(sGNames[i] + " bubble glass", glassPrefix + 0, texName + "bubble");
blockStainedGlass[glassId].carverHelper.addVariation(sGNames[i] + " glass panel", glassPrefix + 1, texName + "panel");
blockStainedGlass[glassId].carverHelper.addVariation(sGNames[i] + " fancy glass panel", glassPrefix + 2, texName + "panel-fancy");
blockStainedGlass[glassId].carverHelper.addVariation(sGNames[i] + " borderless glass", glassPrefix + 3, texName + "transparent");
OreDictionary.registerOre(oreName, new ItemStack(Blocks.stained_glass, 1, i));
Carving.chisel.registerOre(blockName, oreName);
for(CarvableVariation cv: blockStainedGlass[glassId].carverHelper.variations) {
if(cv.metadata < glassPrefix || cv.metadata >= glassPrefix+4) continue;
blockStainedGlass[glassId].carverHelper.registerVariation(blockName, cv, blockStainedGlass[glassId], cv.metadata);
}
}
*/
for(int i = 0; i < 16; i++) {
String blockName = "chisel.stainedGlassPane" + sGNames[i].replaceAll(" ", "");
String oreName = "stainedGlassPane" + sGNames[i].replaceAll(" ", "");
String texName = "glasspanedyed/" + sGNames[i].toLowerCase().replaceAll(" ", "") + "-";
int glassPrefix = (i & 1) << 3;
int glassId = i >> 1;
if(glassPrefix == 0) {
blockStainedGlassPane[glassId] = (BlockCarvablePane) new BlockCarvablePane(Material.glass, false).setStained(true).setHardness(0.3F).setStepSound(Block.soundTypeGlass).setBlockName("Stained Glass Pane");
blockStainedGlassPane[glassId].carverHelper.registerBlock(blockStainedGlassPane[glassId], blockName);
blockStainedGlassPane[glassId].carverHelper.blockName = "Stained Glass Pane";
}
blockStainedGlassPane[glassId].carverHelper.addVariation(sGNames[i] + " bubble glass", glassPrefix + 0, texName + "bubble");
blockStainedGlassPane[glassId].carverHelper.addVariation(sGNames[i] + " glass panel", glassPrefix + 1, texName + "panel");
blockStainedGlassPane[glassId].carverHelper.addVariation(sGNames[i] + " fancy glass panel", glassPrefix + 2, texName + "panel-fancy");
blockStainedGlassPane[glassId].carverHelper.addVariation(sGNames[i] + " borderless glass", glassPrefix + 3, texName + "transparent");
blockStainedGlassPane[glassId].carverHelper.addVariation(sGNames[i] + " quadrant glass", glassPrefix + 4, texName + "quad");
blockStainedGlassPane[glassId].carverHelper.addVariation(sGNames[i] + " fancy quadrant glass", glassPrefix + 5, texName + "quad-fancy");
OreDictionary.registerOre(oreName, new ItemStack(Blocks.stained_glass_pane, 1, i));
Carving.chisel.registerOre(blockName, oreName);
for(CarvableVariation cv: blockStainedGlassPane[glassId].carverHelper.variations) {
if(cv.metadata < glassPrefix || cv.metadata >= glassPrefix+8) continue;
blockStainedGlassPane[glassId].carverHelper.registerVariation(blockName, cv, blockStainedGlassPane[glassId], cv.metadata);
}
}
Blocks.stone.setHarvestLevel("chisel", 0, 0);
proxy.preInit();
@@ -7,6 +7,8 @@ import info.jbcs.minecraft.chisel.api.Carvable;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -17,7 +19,8 @@ import net.minecraft.world.IBlockAccess;
public class BlockCarvable extends Block implements Carvable {
public CarvableHelper carverHelper;
private boolean isAlpha;
public BlockCarvable() {
this(Material.rock);
}
@@ -30,6 +33,18 @@ public class BlockCarvable extends Block implements Carvable {
setCreativeTab(Chisel.tabChisel);
}
public BlockCarvable setStained(boolean a) {
this.isAlpha = a;
return this;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass()
{
return isAlpha ? 1 : 0;
}
@Override
public IIcon getIcon(int side, int metadata) {
return carverHelper.getIcon(side, metadata);
@@ -7,6 +7,8 @@ import info.jbcs.minecraft.chisel.api.Carvable;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockGlass;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -16,7 +18,8 @@ import net.minecraft.util.IIcon;
public class BlockCarvableGlass extends BlockGlass implements Carvable {
public CarvableHelper carverHelper;
private boolean isAlpha = false;
public BlockCarvableGlass() {
super(Material.glass, false);
@@ -25,6 +28,11 @@ public class BlockCarvableGlass extends BlockGlass implements Carvable {
setCreativeTab(Chisel.tabChisel);
}
public BlockCarvableGlass setStained(boolean a) {
this.isAlpha = a;
return this;
}
@Override
public boolean renderAsNormalBlock() {
return false;
@@ -59,4 +67,11 @@ public class BlockCarvableGlass extends BlockGlass implements Carvable {
public CarvableVariation getVariation(int metadata) {
return carverHelper.getVariation(metadata);
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass()
{
return isAlpha ? 1 : 0;
}
}
@@ -8,6 +8,8 @@ import info.jbcs.minecraft.chisel.render.BlockMarblePaneRenderer;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPane;
import net.minecraft.block.material.Material;
@@ -18,7 +20,8 @@ import net.minecraft.util.IIcon;
public class BlockCarvablePane extends BlockPane implements Carvable {
public CarvableHelper carverHelper;
private boolean isAlpha;
public BlockCarvablePane(Material material, boolean drops) {
super("", "", material, drops);
@@ -27,8 +30,18 @@ public class BlockCarvablePane extends BlockPane implements Carvable {
setCreativeTab(Chisel.tabChisel);
}
public BlockCarvablePane setStained(boolean a) {
this.isAlpha = a;
return this;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass()
{
return isAlpha ? 1 : 0;
}
@Override
public int getRenderType() {
return BlockMarblePaneRenderer.id;
@@ -36,16 +36,12 @@ public class RenderBlocksCTM extends RenderBlocks {
tessellator = Tessellator.instance;
tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
tessellator.xOffset+=x;
tessellator.yOffset+=y;
tessellator.zOffset+=z;
tessellator.addTranslation(x, y, z);
boolean res=super.renderStandardBlock(block, x, y, z);
tessellator.xOffset-=x;
tessellator.yOffset-=y;
tessellator.zOffset-=z;
tessellator.addTranslation(-x, -y, -z);
return res;
}