mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-12 16:27:45 +00:00
Begin CarvableVariation nuke, have hit some roadblocks in CTM rendering
This commit is contained in:
1 parent
d50f2c9da5
commit
bc607a3104
29 files changed
+266
-198
No files matched your search
@@ -1,6 +1,21 @@
|
||||
package com.cricketcraft.chisel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemDye;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.block.*;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
@@ -15,7 +30,14 @@ import com.cricketcraft.chisel.entity.EntitySmashingRock;
|
||||
import com.cricketcraft.chisel.init.ChiselBlocks;
|
||||
import com.cricketcraft.chisel.init.ChiselItems;
|
||||
import com.cricketcraft.chisel.init.ChiselTabs;
|
||||
import com.cricketcraft.chisel.item.*;
|
||||
import com.cricketcraft.chisel.item.ItemBallOMoss;
|
||||
import com.cricketcraft.chisel.item.ItemBlockPresent;
|
||||
import com.cricketcraft.chisel.item.ItemCarvable;
|
||||
import com.cricketcraft.chisel.item.ItemCarvablePumpkin;
|
||||
import com.cricketcraft.chisel.item.ItemCarvableSlab;
|
||||
import com.cricketcraft.chisel.item.ItemCloudInABottle;
|
||||
import com.cricketcraft.chisel.item.ItemSmashingRock;
|
||||
import com.cricketcraft.chisel.item.ItemUpgrade;
|
||||
import com.cricketcraft.chisel.item.chisel.ItemChisel;
|
||||
import com.cricketcraft.chisel.item.chisel.ItemChisel.ChiselType;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -23,20 +45,6 @@ import com.google.common.collect.Lists;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemDye;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.cricketcraft.chisel.init.ChiselBlocks.*;
|
||||
import static com.cricketcraft.chisel.utils.General.sGNames;
|
||||
@@ -872,10 +880,10 @@ public enum Features {
|
||||
stainedGlass[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 : stainedGlass[glassId].carverHelper.variations) {
|
||||
if (cv.metadata < glassPrefix || cv.metadata >= glassPrefix + 4)
|
||||
for (IVariationInfo info : stainedGlass[glassId].carverHelper.infoList) {
|
||||
if (info.getVariation().getBlockMeta() < glassPrefix || info.getVariation().getBlockMeta() >= glassPrefix + 4)
|
||||
continue;
|
||||
stainedGlass[glassId].carverHelper.registerVariation(blockName, cv, stainedGlass[glassId], cv.metadata);
|
||||
stainedGlass[glassId].carverHelper.registerVariation(blockName, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -906,10 +914,10 @@ public enum Features {
|
||||
stainedGlassPane[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 : stainedGlassPane[glassId].carverHelper.variations) {
|
||||
if (cv.metadata < glassPrefix || cv.metadata >= glassPrefix + 8)
|
||||
for (IVariationInfo info : stainedGlassPane[glassId].carverHelper.infoList) {
|
||||
if (info.getVariation().getBlockMeta() < glassPrefix || info.getVariation().getBlockMeta() >= glassPrefix + 8)
|
||||
continue;
|
||||
stainedGlassPane[glassId].carverHelper.registerVariation(blockName, cv, stainedGlassPane[glassId], cv.metadata);
|
||||
stainedGlassPane[glassId].carverHelper.registerVariation(blockName, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
package com.cricketcraft.chisel.api;
|
||||
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.api.client.ISubmapManager;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
|
||||
/**
|
||||
* To be implemented on blocks that can be chiseled and need advanced metadata to variation mapping. Currently not very usable without internal classes.
|
||||
*/
|
||||
public interface ICarvable {
|
||||
|
||||
/**
|
||||
* Gets a {@link CarvableVariation} from this block, based on metadata.
|
||||
* Gets a {@link ISubmapManager} from this block, based on metadata.
|
||||
* <p>
|
||||
* Typically you can refer this method to {@link CarvableHelper#getVariation(int)} but this method is provided for more complex metadata handling.
|
||||
*
|
||||
@@ -28,16 +29,17 @@ public interface ICarvable {
|
||||
* Z coord of the block
|
||||
* @param metadata
|
||||
* The metadata of the block
|
||||
* @return The {@link CarvableVariation} that represents this block in the world.
|
||||
* @return The {@link ISubmapManager} that represents this block in the world.
|
||||
*/
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata);
|
||||
public IVariationInfo getVariation(IBlockAccess world, int x, int y, int z, int metadata);
|
||||
|
||||
/**
|
||||
* Gets the {@link CarvableVariation} for this block when it is in item form.
|
||||
* Gets the {@link ISubmapManager} for this block when it is in item form.
|
||||
*
|
||||
* @param stack
|
||||
* The {@link ItemStack} representing this block;
|
||||
* @return A {@link CarvableVariation}
|
||||
* @return A {@link ISubmapManager}
|
||||
*/
|
||||
public CarvableVariation getVariation(ItemStack stack);
|
||||
public IVariationInfo getVariation(ItemStack stack);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.cricketcraft.chisel.api.carving;
|
||||
|
||||
import com.cricketcraft.chisel.api.client.ISubmapManager;
|
||||
|
||||
public interface IVariationInfo {
|
||||
|
||||
ISubmapManager getSubmapManager();
|
||||
|
||||
ICarvingVariation getVariation();
|
||||
|
||||
String getDescription();
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.cricketcraft.chisel.api.carving;
|
||||
|
||||
import com.cricketcraft.chisel.api.client.ISubmapManager;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class VariationInfoBase implements IVariationInfo {
|
||||
|
||||
private ICarvingVariation variation;
|
||||
private String unlocDesc;
|
||||
private ISubmapManager manager;
|
||||
|
||||
public VariationInfoBase(ICarvingVariation variation, String unlocDesc, ISubmapManager manager) {
|
||||
this.variation = variation;
|
||||
this.unlocDesc = unlocDesc;
|
||||
this.manager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICarvingVariation getVariation() {
|
||||
return variation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return StatCollector.translateToLocal(unlocDesc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubmapManager getSubmapManager() {
|
||||
return manager;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,7 @@
|
||||
package com.cricketcraft.chisel.block;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.init.ChiselTabs;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -16,7 +11,14 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import java.util.List;
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.init.ChiselTabs;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCarvable extends Block implements ICarvable {
|
||||
|
||||
@@ -32,7 +34,7 @@ public class BlockCarvable extends Block implements ICarvable {
|
||||
if (m == Material.rock || m == Material.iron) {
|
||||
setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
carverHelper = new CarvableHelper();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
setResistance(10.0F);
|
||||
setHardness(2.0F);
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
@@ -80,12 +82,12 @@ public class BlockCarvable extends Block implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
public IVariationInfo getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
public IVariationInfo getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public class BlockCarvableAntiBlock extends BlockCarvableColor implements ICarva
|
||||
|
||||
public BlockCarvableAntiBlock() {
|
||||
super(Material.rock);
|
||||
carverHelper = new CarvableHelper();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,8 +13,8 @@ import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.init.ChiselTabs;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -28,7 +28,7 @@ public class BlockCarvableGlass extends BlockGlass implements ICarvable {
|
||||
public BlockCarvableGlass() {
|
||||
super(Material.glass, false);
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
}
|
||||
|
||||
@@ -73,12 +73,12 @@ public class BlockCarvableGlass extends BlockGlass implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
public IVariationInfo getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
public IVariationInfo getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
|
||||
public class BlockCarvableIce extends BlockIce implements ICarvable {
|
||||
|
||||
@@ -24,7 +24,7 @@ public class BlockCarvableIce extends BlockIce implements ICarvable {
|
||||
|
||||
public BlockCarvableIce() {
|
||||
super();
|
||||
carverHelper = new CarvableHelper();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,12 +58,12 @@ public class BlockCarvableIce extends BlockIce implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
public IVariationInfo getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
public IVariationInfo getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -16,8 +16,8 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
|
||||
public class BlockCarvablePackedIce extends Block implements ICarvable {
|
||||
|
||||
@@ -25,7 +25,7 @@ public class BlockCarvablePackedIce extends Block implements ICarvable {
|
||||
|
||||
public BlockCarvablePackedIce() {
|
||||
super(Material.ice);
|
||||
carverHelper = new CarvableHelper();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,12 +64,12 @@ public class BlockCarvablePackedIce extends Block implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
public IVariationInfo getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
public IVariationInfo getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,8 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.client.render.RendererCTMPane;
|
||||
import com.cricketcraft.chisel.init.ChiselTabs;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class BlockCarvablePane extends BlockPane implements ICarvable {
|
||||
public BlockCarvablePane(Material material, boolean drops) {
|
||||
super("", "", material, drops);
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
}
|
||||
@@ -70,12 +70,12 @@ public class BlockCarvablePane extends BlockPane implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
public IVariationInfo getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
public IVariationInfo getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.client.render.RendererPillar;
|
||||
|
||||
public class BlockCarvablePillar extends BlockCarvable {
|
||||
@@ -32,12 +32,13 @@ public class BlockCarvablePillar extends BlockCarvable {
|
||||
|
||||
public IIcon getCtmIcon(int index, int metadata) {
|
||||
// Workaround to prevent crash with invalid meta
|
||||
CarvableVariation var = null;
|
||||
if (metadata <= carverHelper.variations.size())
|
||||
var = carverHelper.variations.get(metadata);
|
||||
IVariationInfo var = null;
|
||||
if (metadata <= carverHelper.infoList.size())
|
||||
var = carverHelper.infoList.get(metadata);
|
||||
else
|
||||
var = carverHelper.variations.get(0);
|
||||
var = carverHelper.infoList.get(0);
|
||||
|
||||
// TODO this...
|
||||
if (index >= 4)
|
||||
return var.iconTop;
|
||||
if (var.seamsCtmVert == null)
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.cricketcraft.chisel.block;
|
||||
|
||||
import com.cricketcraft.chisel.entity.EntityChiselSnowman;
|
||||
import com.cricketcraft.chisel.init.ChiselBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPumpkin;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -10,15 +8,16 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.entity.EntityChiselSnowman;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockCarvablePumpkin extends BlockPumpkin implements ICarvable {
|
||||
|
||||
@@ -34,7 +33,7 @@ public class BlockCarvablePumpkin extends BlockPumpkin implements ICarvable {
|
||||
this.setStepSound(Block.soundTypeWood);
|
||||
if (isOn)
|
||||
setLightLevel(10.0F);
|
||||
carverHelper = new CarvableHelper();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,12 +111,12 @@ public class BlockCarvablePumpkin extends BlockPumpkin implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
public IVariationInfo getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
public IVariationInfo getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.init.ChiselTabs;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -27,7 +27,7 @@ public class BlockCarvableSand extends BlockSand implements ICarvable {
|
||||
|
||||
public BlockCarvableSand() {
|
||||
super();
|
||||
carverHelper = new CarvableHelper();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
}
|
||||
|
||||
@@ -73,12 +73,12 @@ public class BlockCarvableSand extends BlockSand implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
public IVariationInfo getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
public IVariationInfo getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,9 @@
|
||||
package com.cricketcraft.chisel.block;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.DOWN;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockCompressedPowered;
|
||||
import net.minecraft.block.BlockFarmland;
|
||||
import net.minecraft.block.BlockHopper;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.BlockSnow;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -26,6 +17,8 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
|
||||
public class BlockCarvableSlab extends BlockCarvable {
|
||||
|
||||
public Block master;
|
||||
|
||||
@@ -15,8 +15,8 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.client.render.RendererStairs;
|
||||
|
||||
public class BlockCarvableStairs extends BlockStairs implements ICarvable {
|
||||
@@ -82,12 +82,12 @@ public class BlockCarvableStairs extends BlockStairs implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
public IVariationInfo getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(blockMeta + (metadata / 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
public IVariationInfo getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(blockMeta + (stack.getItemDamage() / 8));
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,8 @@ import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.init.ChiselTabs;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -26,7 +26,7 @@ public class BlockCarvableTorch extends BlockTorch implements ICarvable {
|
||||
|
||||
public BlockCarvableTorch(int idx, String tex) {
|
||||
super();
|
||||
carverHelper = new CarvableHelper();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
setLightLevel(0.9375F);
|
||||
setBlockName("torch");
|
||||
@@ -35,12 +35,12 @@ public class BlockCarvableTorch extends BlockTorch implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
public IVariationInfo getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
public IVariationInfo getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
|
||||
|
||||
@@ -13,15 +13,15 @@ import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
|
||||
public class BlockMarbleCarpet extends BlockCarpet implements ICarvable {
|
||||
|
||||
public CarvableHelper carverHelper;
|
||||
|
||||
public BlockMarbleCarpet(Material m) {
|
||||
carverHelper = new CarvableHelper();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -55,12 +55,12 @@ public class BlockMarbleCarpet extends BlockCarpet implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
public IVariationInfo getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
public IVariationInfo getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ public class BlockMarbleWall extends BlockWall {
|
||||
public BlockMarbleWall(Block block) {
|
||||
super(block);
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,8 +12,8 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
|
||||
public class BlockMultiLayer extends BlockMultiLayerBase implements ICarvable {
|
||||
|
||||
@@ -22,13 +22,13 @@ public class BlockMultiLayer extends BlockMultiLayerBase implements ICarvable {
|
||||
public BlockMultiLayer(Material mat, String baseIcon) {
|
||||
super(mat, baseIcon);
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
|
||||
public BlockMultiLayer(Material mat, Block block) {
|
||||
super(mat, block);
|
||||
|
||||
carverHelper = new CarvableHelper();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,12 +54,12 @@ public class BlockMultiLayer extends BlockMultiLayerBase implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
public IVariationInfo getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
public IVariationInfo getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
}
|
||||
@@ -21,9 +21,9 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.block.tileentity.TileEntityPresent;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -36,7 +36,7 @@ public class BlockPresent extends Block implements ICarvable {
|
||||
|
||||
public BlockPresent() {
|
||||
super(Material.wood);
|
||||
carverHelper = new CarvableHelper();
|
||||
carverHelper = new CarvableHelper(this);
|
||||
minX = 0.0625F;
|
||||
minZ = 0.0625F;
|
||||
maxX = 0.9375F;
|
||||
@@ -215,12 +215,12 @@ public class BlockPresent extends Block implements ICarvable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
public IVariationInfo getVariation(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||
return carverHelper.getVariation(metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarvableVariation getVariation(ItemStack stack) {
|
||||
public IVariationInfo getVariation(ItemStack stack) {
|
||||
return carverHelper.getVariation(stack.getItemDamage());
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package com.cricketcraft.chisel.block;
|
||||
|
||||
import com.cricketcraft.chisel.client.GeneralChiselClient;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
import com.cricketcraft.chisel.client.GeneralChiselClient;
|
||||
|
||||
public class BlockSnakestoneObsidian extends BlockSnakestone {
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.cricketcraft.chisel.block;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.item.ItemCarvable;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
@@ -17,7 +17,7 @@ public class CarvableStairsMaker {
|
||||
String blockName;
|
||||
|
||||
public CarvableStairsMaker(Block base) {
|
||||
carverHelper = new CarvableHelper();
|
||||
carverHelper = new CarvableHelper(base);
|
||||
blockBase = base;
|
||||
}
|
||||
|
||||
@@ -33,10 +33,10 @@ public class CarvableStairsMaker {
|
||||
blocks[i].setBlockName("chisel." + n);
|
||||
GameRegistry.registerBlock(blocks[i], ItemCarvable.class, n);
|
||||
|
||||
for (int meta = 0; meta < 2 && i * 2 + meta < carverHelper.variations.size(); meta++) {
|
||||
CarvableVariation variation = carverHelper.variations.get(i * 2 + meta);
|
||||
for (int meta = 0; meta < 2 && i * 2 + meta < carverHelper.infoList.size(); meta++) {
|
||||
IVariationInfo info = carverHelper.infoList.get(i * 2 + meta);
|
||||
|
||||
carverHelper.registerVariation(name, variation, blocks[i], meta * 8);
|
||||
carverHelper.registerVariation(name, info);
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(blocks[i], 4, meta * 8), "* ", "** ", "***", '*', new ItemStack(blockBase, 1, i * 2 + meta));
|
||||
}
|
||||
|
||||
@@ -18,6 +18,9 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.api.carving.VariationInfoBase;
|
||||
import com.cricketcraft.chisel.api.client.CTM;
|
||||
import com.cricketcraft.chisel.api.client.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.client.TextureSubmap;
|
||||
@@ -32,6 +35,7 @@ public class CarvableHelper {
|
||||
|
||||
public enum TextureType {
|
||||
|
||||
// TODO decide if this is the correct way to go about it...then implement the abstract method
|
||||
TOPSIDE("top", "side"),
|
||||
TOPBOTSIDE("top", "bottom", "side"),
|
||||
CTMV("ctmv", "top"),
|
||||
@@ -54,6 +58,8 @@ public class CarvableHelper {
|
||||
private TextureType(String... suffixes) {
|
||||
this.suffixes = suffixes.length == 0 ? new String[] { "" } : suffixes;
|
||||
}
|
||||
|
||||
public abstract ISubmapManager createManagerFor(ICarvingVariation variation);
|
||||
|
||||
public static TextureType getTypeFor(CarvableHelper inst, String modid, String path) {
|
||||
for (TextureType t : VALUES) {
|
||||
@@ -71,10 +77,16 @@ public class CarvableHelper {
|
||||
}
|
||||
}
|
||||
|
||||
private Block theBlock;
|
||||
|
||||
public CarvableHelper(Block block) {
|
||||
this.theBlock = block;
|
||||
}
|
||||
|
||||
private static CTM ctm = CTM.getInstance();
|
||||
|
||||
public ArrayList<CarvableVariation> variations = new ArrayList<CarvableVariation>();
|
||||
CarvableVariation[] map = new CarvableVariation[16];
|
||||
public ArrayList<IVariationInfo> infoList = new ArrayList<IVariationInfo>();
|
||||
IVariationInfo[] infoMap = new IVariationInfo[16];
|
||||
public boolean forbidChiseling = false;
|
||||
public String blockName;
|
||||
|
||||
@@ -120,7 +132,7 @@ public class CarvableHelper {
|
||||
|
||||
public void addVariation(String description, int metadata, String texture, Block block, int blockMeta, String modid, ISubmapManager customManager) {
|
||||
|
||||
if (variations.size() >= 16)
|
||||
if (infoList.size() >= 16)
|
||||
return;
|
||||
|
||||
if (blockName == null && block != null)
|
||||
@@ -128,26 +140,23 @@ public class CarvableHelper {
|
||||
else if (blockName == null && description != null)
|
||||
blockName = description;
|
||||
|
||||
CarvableVariation variation = new CarvableVariation();
|
||||
variation.setDescriptionUnloc(description);
|
||||
variation.metadata = metadata;
|
||||
variation.blockName = blockName;
|
||||
|
||||
if (texture != null && FMLCommonHandler.instance().getSide().isClient()) {
|
||||
variation.texture = texture;
|
||||
variation.type = (TextureType) TextureType.getTypeFor(this, modid, variation.texture);
|
||||
if (variation.type == TextureType.CUSTOM && customManager == null) {
|
||||
throw new IllegalArgumentException(String.format("Could not find texture %s, and no custom texture manager was provided.", texture));
|
||||
}
|
||||
variation.manager = customManager;
|
||||
} else {
|
||||
variation.block = block;
|
||||
variation.type = TextureType.TOPBOTSIDE;
|
||||
variation.blockMeta = blockMeta;
|
||||
CarvingVariation var = new CarvingVariation(theBlock, metadata, metadata);
|
||||
TextureType type = TextureType.getTypeFor(this, modid, texture);
|
||||
if (type == TextureType.CUSTOM && customManager == null) {
|
||||
throw new IllegalArgumentException(String.format("Could not find texture %s, and no custom texture manager was provided.", texture));
|
||||
}
|
||||
|
||||
IVariationInfo info;
|
||||
if (customManager != null) {
|
||||
info = new VariationInfoBase(var, description, customManager);
|
||||
} else {
|
||||
info = new VariationInfoBase(var, description, type.createManagerFor(var));
|
||||
}
|
||||
|
||||
// TODO handling for block texture override params
|
||||
|
||||
variations.add(variation);
|
||||
map[metadata] = variation;
|
||||
infoList.add(info);
|
||||
infoMap[metadata] = info;
|
||||
}
|
||||
|
||||
// This is ugly, but faster than class.getResource
|
||||
@@ -161,11 +170,11 @@ public class CarvableHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public CarvableVariation getVariation(int metadata) {
|
||||
public IVariationInfo getVariation(int metadata) {
|
||||
if (metadata < 0 || metadata > 15)
|
||||
metadata = 0;
|
||||
|
||||
CarvableVariation variation = map[metadata];
|
||||
IVariationInfo variation = infoMap[metadata];
|
||||
if (variation == null)
|
||||
return null;
|
||||
|
||||
@@ -176,10 +185,13 @@ public class CarvableHelper {
|
||||
if (metadata < 0 || metadata > 15)
|
||||
metadata = 0;
|
||||
|
||||
CarvableVariation variation = map[metadata];
|
||||
IVariationInfo variation = infoMap[metadata];
|
||||
if (variation == null)
|
||||
return GeneralClient.getMissingIcon();
|
||||
|
||||
return variation.getSubmapManager().getIcon(side, metadata);
|
||||
|
||||
/*
|
||||
switch (variation.type) {
|
||||
case NORMAL:
|
||||
return variation.icon;
|
||||
@@ -222,6 +234,7 @@ public class CarvableHelper {
|
||||
}
|
||||
|
||||
return GeneralClient.getMissingIcon();
|
||||
*/
|
||||
}
|
||||
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
@@ -230,10 +243,13 @@ public class CarvableHelper {
|
||||
if (metadata < 0 || metadata > 15)
|
||||
metadata = 0;
|
||||
|
||||
CarvableVariation variation = map[metadata];
|
||||
IVariationInfo variation = infoMap[metadata];
|
||||
if (variation == null)
|
||||
return GeneralClient.getMissingIcon();
|
||||
|
||||
return variation.getSubmapManager().getIcon(world, x, y, z, side);
|
||||
|
||||
/*
|
||||
switch (variation.type) {
|
||||
case NORMAL:
|
||||
case TOPSIDE:
|
||||
@@ -300,7 +316,7 @@ public class CarvableHelper {
|
||||
//For DOWN, reverse the indexes for only Z
|
||||
textureZ = (variationSize - textureZ - 1);
|
||||
}//*/
|
||||
|
||||
/*
|
||||
int index;
|
||||
if (side == 0 || side == 1) {
|
||||
// DOWN || UP
|
||||
@@ -337,6 +353,7 @@ public class CarvableHelper {
|
||||
}
|
||||
|
||||
return GeneralClient.getMissingIcon();
|
||||
*/
|
||||
}
|
||||
|
||||
public void registerAll(Block block, String name) {
|
||||
@@ -358,103 +375,109 @@ public class CarvableHelper {
|
||||
}
|
||||
|
||||
public void registerVariations(String name, Block block) {
|
||||
for (CarvableVariation variation : variations) {
|
||||
registerVariation(name, variation, block, variation.metadata);
|
||||
for (IVariationInfo info : infoList) {
|
||||
registerVariation(name, info);
|
||||
}
|
||||
}
|
||||
|
||||
public void registerVariation(String name, CarvableVariation variation, Block block, int blockMeta) {
|
||||
public void registerVariation(String name, IVariationInfo info) {
|
||||
|
||||
Block block = info.getVariation().getBlock();
|
||||
|
||||
if (block.renderAsNormalBlock() || block.isOpaqueCube() || block.isNormalCube()) {
|
||||
FMPIMC.registerFMP(block, blockMeta);
|
||||
FMPIMC.registerFMP(block, info.getVariation().getBlockMeta());
|
||||
}
|
||||
|
||||
if (forbidChiseling)
|
||||
return;
|
||||
|
||||
Carving.chisel.addVariation(name, block, blockMeta, variation.metadata);
|
||||
Carving.chisel.addVariation(name, info.getVariation());
|
||||
}
|
||||
|
||||
public void registerBlockIcons(String modName, Block block, IIconRegister register) {
|
||||
for (CarvableVariation variation : variations) {
|
||||
if (variation.block != null) {
|
||||
variation.block.registerBlockIcons(register);
|
||||
for (IVariationInfo info : infoList) {
|
||||
info.getSubmapManager().registerIcons(modName, block, register);
|
||||
}
|
||||
/*
|
||||
if (info.block != null) {
|
||||
info.block.registerBlockIcons(register);
|
||||
|
||||
if (variation.block instanceof BlockPane) {
|
||||
variation.icon = variation.block.getBlockTextureFromSide(2);
|
||||
variation.iconTop = ((BlockPane) variation.block).getBlockTextureFromSide(0);
|
||||
variation.iconBot = ((BlockPane) variation.block).getBlockTextureFromSide(0);
|
||||
if (info.block instanceof BlockPane) {
|
||||
info.icon = info.block.getBlockTextureFromSide(2);
|
||||
info.iconTop = ((BlockPane) info.block).getBlockTextureFromSide(0);
|
||||
info.iconBot = ((BlockPane) info.block).getBlockTextureFromSide(0);
|
||||
|
||||
} else {
|
||||
switch (variation.type) {
|
||||
switch (info.type) {
|
||||
case NORMAL:
|
||||
variation.icon = variation.block.getIcon(2, variation.blockMeta);
|
||||
info.icon = info.block.getIcon(2, info.blockMeta);
|
||||
break;
|
||||
case TOPSIDE:
|
||||
variation.icon = variation.block.getIcon(2, variation.blockMeta);
|
||||
variation.iconTop = variation.block.getIcon(0, variation.blockMeta);
|
||||
info.icon = info.block.getIcon(2, info.blockMeta);
|
||||
info.iconTop = info.block.getIcon(0, info.blockMeta);
|
||||
break;
|
||||
case TOPBOTSIDE:
|
||||
variation.icon = variation.block.getIcon(2, variation.blockMeta);
|
||||
variation.iconTop = variation.block.getIcon(1, variation.blockMeta);
|
||||
variation.iconBot = variation.block.getIcon(0, variation.blockMeta);
|
||||
info.icon = info.block.getIcon(2, info.blockMeta);
|
||||
info.iconTop = info.block.getIcon(1, info.blockMeta);
|
||||
info.iconBot = info.block.getIcon(0, info.blockMeta);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch (variation.type) {
|
||||
switch (info.type) {
|
||||
case NORMAL:
|
||||
variation.icon = register.registerIcon(modName + ":" + variation.texture);
|
||||
info.icon = register.registerIcon(modName + ":" + info.texture);
|
||||
break;
|
||||
case TOPSIDE:
|
||||
variation.icon = register.registerIcon(modName + ":" + variation.texture + "-side");
|
||||
variation.iconTop = register.registerIcon(modName + ":" + variation.texture + "-top");
|
||||
info.icon = register.registerIcon(modName + ":" + info.texture + "-side");
|
||||
info.iconTop = register.registerIcon(modName + ":" + info.texture + "-top");
|
||||
break;
|
||||
case TOPBOTSIDE:
|
||||
variation.icon = register.registerIcon(modName + ":" + variation.texture + "-side");
|
||||
variation.iconTop = register.registerIcon(modName + ":" + variation.texture + "-top");
|
||||
variation.iconBot = register.registerIcon(modName + ":" + variation.texture + "-bottom");
|
||||
info.icon = register.registerIcon(modName + ":" + info.texture + "-side");
|
||||
info.iconTop = register.registerIcon(modName + ":" + info.texture + "-top");
|
||||
info.iconBot = register.registerIcon(modName + ":" + info.texture + "-bottom");
|
||||
break;
|
||||
case CTMV:
|
||||
variation.seamsCtmVert = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-ctmv"), 2, 2);
|
||||
variation.iconTop = register.registerIcon(modName + ":" + variation.texture + "-top");
|
||||
info.seamsCtmVert = new TextureSubmap(register.registerIcon(modName + ":" + info.texture + "-ctmv"), 2, 2);
|
||||
info.iconTop = register.registerIcon(modName + ":" + info.texture + "-top");
|
||||
break;
|
||||
case CTMH:
|
||||
variation.seamsCtmVert = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-ctmh"), 2, 2);
|
||||
variation.iconTop = register.registerIcon(modName + ":" + variation.texture + "-top");
|
||||
info.seamsCtmVert = new TextureSubmap(register.registerIcon(modName + ":" + info.texture + "-ctmh"), 2, 2);
|
||||
info.iconTop = register.registerIcon(modName + ":" + info.texture + "-top");
|
||||
break;
|
||||
case V9:
|
||||
variation.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-v9"), 3, 3);
|
||||
info.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + info.texture + "-v9"), 3, 3);
|
||||
break;
|
||||
case V4:
|
||||
variation.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-v4"), 2, 2);
|
||||
info.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + info.texture + "-v4"), 2, 2);
|
||||
break;
|
||||
case CTMX:
|
||||
variation.icon = register.registerIcon(modName + ":" + variation.texture);
|
||||
variation.submap = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-ctm"), 4, 4);
|
||||
variation.submapSmall = new TextureSubmap(variation.icon, 2, 2);
|
||||
info.icon = register.registerIcon(modName + ":" + info.texture);
|
||||
info.submap = new TextureSubmap(register.registerIcon(modName + ":" + info.texture + "-ctm"), 4, 4);
|
||||
info.submapSmall = new TextureSubmap(info.icon, 2, 2);
|
||||
break;
|
||||
case R16:
|
||||
variation.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-r16"), 4, 4);
|
||||
info.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + info.texture + "-r16"), 4, 4);
|
||||
break;
|
||||
case R9:
|
||||
variation.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-r9"), 3, 3);
|
||||
info.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + info.texture + "-r9"), 3, 3);
|
||||
break;
|
||||
case R4:
|
||||
variation.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + variation.texture + "-r4"), 2, 2);
|
||||
info.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + info.texture + "-r4"), 2, 2);
|
||||
break;
|
||||
case CUSTOM:
|
||||
variation.manager.registerIcons(modName, block, register);
|
||||
info.manager.registerIcons(modName, block, register);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public void registerSubBlocks(Block block, CreativeTabs tabs, List<ItemStack> list) {
|
||||
for (CarvableVariation variation : variations) {
|
||||
list.add(new ItemStack(block, 1, variation.metadata));
|
||||
for (IVariationInfo info : infoList) {
|
||||
list.add(new ItemStack(block, 1, info.getVariation().getItemMeta()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,6 +486,6 @@ public class CarvableHelper {
|
||||
}
|
||||
|
||||
public void registerOre(String ore) {
|
||||
OreDictionary.registerOre(ore, variations.get(0).block);
|
||||
OreDictionary.registerOre(ore, infoList.get(0).getVariation().getBlock());
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,6 @@ public class CarvableVariation {
|
||||
public IIcon iconBot;
|
||||
public IIcon iconTop;
|
||||
|
||||
public CarvableVariationCTM ctm;
|
||||
public TextureSubmap seamsCtmVert;
|
||||
public TextureSubmap variations9;
|
||||
|
||||
@@ -40,9 +39,4 @@ public class CarvableVariation {
|
||||
public void setDescriptionUnloc(String desc) {
|
||||
this.descriptionUnloc = desc;
|
||||
}
|
||||
|
||||
static class CarvableVariationCTM {
|
||||
|
||||
TextureSubmap seams[] = new TextureSubmap[3];
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,8 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper.TextureType;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.utils.Drawing;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
@@ -37,7 +37,7 @@ public class RendererCTM implements ISimpleBlockRenderingHandler {
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks rendererOld) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
CarvableVariation var = ((ICarvable) block).getVariation(world, x, y, z, meta);
|
||||
IVariationInfo var = ((ICarvable) block).getVariation(world, x, y, z, meta);
|
||||
|
||||
if (rendererOld.hasOverrideBlockTexture()) {
|
||||
// breaking anim
|
||||
|
||||
@@ -49,10 +49,10 @@ public class RendererPillar implements ISimpleBlockRenderingHandler {
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
// Probably not the best way to handle this...
|
||||
if (metadata >= block.carverHelper.variations.size()) {
|
||||
if (metadata >= block.carverHelper.infoList.size()) {
|
||||
metadata = 0;
|
||||
} else {
|
||||
if (block.carverHelper.variations.get(metadata).type != TextureType.CTMV) {
|
||||
if (block.carverHelper.infoList.get(metadata).type != TextureType.CTMV) {
|
||||
block.sides[0] = block.carverHelper.getIcon(0, metadata);
|
||||
block.sides[1] = block.carverHelper.getIcon(1, metadata);
|
||||
block.sides[2] = block.carverHelper.getIcon(2, metadata);
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.config.Configurations;
|
||||
import com.cricketcraft.chisel.utils.General;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ItemCarvable extends ItemBlock {
|
||||
return;
|
||||
|
||||
ICarvable carvable = (ICarvable) block;
|
||||
CarvableVariation var = carvable.getVariation(stack);
|
||||
IVariationInfo var = carvable.getVariation(stack);
|
||||
if (var == null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.cricketcraft.chisel.item;
|
||||
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.config.Configurations;
|
||||
import com.cricketcraft.chisel.utils.General;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -12,7 +10,10 @@ import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.config.Configurations;
|
||||
import com.cricketcraft.chisel.utils.General;
|
||||
|
||||
public class ItemCarvablePumpkin extends ItemBlock {
|
||||
|
||||
@@ -52,7 +53,7 @@ public class ItemCarvablePumpkin extends ItemBlock {
|
||||
return;
|
||||
|
||||
ICarvable carvable = (ICarvable) block;
|
||||
CarvableVariation var = carvable.getVariation(stack);
|
||||
IVariationInfo var = carvable.getVariation(stack);
|
||||
if (var == null)
|
||||
return;
|
||||
|
||||
|
||||
Reference in new issue
Block a user