mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-12 16:27:45 +00:00
Completely modularize submap and RenderBlocks managing
- Fix RenderBlocksCTM ignoring the renderMin/Max values - Add custom handler for carpet to avoid hardcoding - TODO blocks that use existing blocks as icons, e.g. ice stairs
This commit is contained in:
1 parent
80149390b6
commit
41877f3543
23 files changed
+661
-493
No files matched your search
@@ -18,9 +18,9 @@ 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;
|
||||
import com.cricketcraft.chisel.carving.Carving;
|
||||
import com.cricketcraft.chisel.carving.CarvingGroup;
|
||||
import com.cricketcraft.chisel.client.render.SubmapManagerCarpetFloor;
|
||||
import com.cricketcraft.chisel.client.render.SubmapManagerFakeController;
|
||||
import com.cricketcraft.chisel.compat.fmp.ItemBlockChiselTorchPart;
|
||||
import com.cricketcraft.chisel.config.Configurations;
|
||||
@@ -107,7 +107,7 @@ public enum Features {
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockCarvable andesite = (BlockCarvable) new BlockCarvable(Material.rock).setHardness(2.0F).setResistance(10.0F).setCreativeTab(ChiselTabs.tabStoneChiselBlocks);
|
||||
andesite.carverHelper.setChiselBlockName("andesite");
|
||||
|
||||
andesite.carverHelper.addVariation("tile.andesite.0.desc", 0, "andesite/andesite");
|
||||
andesite.carverHelper.addVariation("tile.andesite.1.desc", 1, "andesite/andesitePolished");
|
||||
andesite.carverHelper.addVariation("tile.andesite.2.desc", 2, "andesite/andesitePillar");
|
||||
@@ -130,7 +130,7 @@ public enum Features {
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockCarvable antiBlock = (BlockCarvable) new BlockCarvableAntiBlock().setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
antiBlock.carverHelper.setChiselBlockName("Anti Block");
|
||||
|
||||
if (!Configurations.allowChiselCrossColors) {
|
||||
antiBlock.carverHelper.forbidChiseling = true;
|
||||
}
|
||||
@@ -321,7 +321,7 @@ public enum Features {
|
||||
void addBlocks() {
|
||||
BlockCarvable carpet_block = (BlockCarvable) new BlockCarvable(Material.cloth).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(2.0F).setResistance(10F)
|
||||
.setStepSound(Block.soundTypeCloth);
|
||||
carpet_block.carverHelper.setChiselBlockName("Carpet Block");
|
||||
|
||||
carpet_block.carverHelper.addVariation("tile.carpet_block.0.desc", 0, "carpet/white");
|
||||
carpet_block.carverHelper.addVariation("tile.carpet_block.1.desc", 1, "carpet/orange");
|
||||
carpet_block.carverHelper.addVariation("tile.carpet_block.2.desc", 2, "carpet/lily");
|
||||
@@ -362,23 +362,23 @@ public enum Features {
|
||||
void addBlocks() {
|
||||
BlockMarbleCarpet carpet = (BlockMarbleCarpet) new BlockMarbleCarpet(Material.cloth).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(0.1F).setStepSound(Block.soundTypeCloth)
|
||||
.setLightOpacity(0).setStepSound(Block.soundTypeCloth);
|
||||
carpet.carverHelper.setChiselBlockName("Carpet");
|
||||
carpet.carverHelper.addVariation("tile.carpet.0.desc", 0, "carpet/white");
|
||||
carpet.carverHelper.addVariation("tile.carpet.1.desc", 1, "carpet/orange");
|
||||
carpet.carverHelper.addVariation("tile.carpet.2.desc", 2, "carpet/lily");
|
||||
carpet.carverHelper.addVariation("tile.carpet.3.desc", 3, "carpet/lightblue");
|
||||
carpet.carverHelper.addVariation("tile.carpet.4.desc", 4, "carpet/yellow");
|
||||
carpet.carverHelper.addVariation("tile.carpet.5.desc", 5, "carpet/lightgreen");
|
||||
carpet.carverHelper.addVariation("tile.carpet.6.desc", 6, "carpet/pink");
|
||||
carpet.carverHelper.addVariation("tile.carpet.7.desc", 7, "carpet/darkgrey");
|
||||
carpet.carverHelper.addVariation("tile.carpet.8.desc", 8, "carpet/grey");
|
||||
carpet.carverHelper.addVariation("tile.carpet.9.desc", 9, "carpet/teal");
|
||||
carpet.carverHelper.addVariation("tile.carpet.10.desc", 10, "carpet/purple");
|
||||
carpet.carverHelper.addVariation("tile.carpet.11.desc", 11, "carpet/darkblue");
|
||||
carpet.carverHelper.addVariation("tile.carpet.12.desc", 12, "carpet/brown");
|
||||
carpet.carverHelper.addVariation("tile.carpet.13.desc", 13, "carpet/green");
|
||||
carpet.carverHelper.addVariation("tile.carpet.14.desc", 14, "carpet/red");
|
||||
carpet.carverHelper.addVariation("tile.carpet.15.desc", 15, "carpet/black");
|
||||
|
||||
carpet.carverHelper.addVariation("tile.carpet.0.desc", 0, new SubmapManagerCarpetFloor("white"));
|
||||
carpet.carverHelper.addVariation("tile.carpet.1.desc", 1, new SubmapManagerCarpetFloor("orange"));
|
||||
carpet.carverHelper.addVariation("tile.carpet.2.desc", 2, new SubmapManagerCarpetFloor("lily"));
|
||||
carpet.carverHelper.addVariation("tile.carpet.3.desc", 3, new SubmapManagerCarpetFloor("lightblue"));
|
||||
carpet.carverHelper.addVariation("tile.carpet.4.desc", 4, new SubmapManagerCarpetFloor("yellow"));
|
||||
carpet.carverHelper.addVariation("tile.carpet.5.desc", 5, new SubmapManagerCarpetFloor("lightgreen"));
|
||||
carpet.carverHelper.addVariation("tile.carpet.6.desc", 6, new SubmapManagerCarpetFloor("pink"));
|
||||
carpet.carverHelper.addVariation("tile.carpet.7.desc", 7, new SubmapManagerCarpetFloor("darkgrey"));
|
||||
carpet.carverHelper.addVariation("tile.carpet.8.desc", 8, new SubmapManagerCarpetFloor("grey"));
|
||||
carpet.carverHelper.addVariation("tile.carpet.9.desc", 9, new SubmapManagerCarpetFloor("teal"));
|
||||
carpet.carverHelper.addVariation("tile.carpet.10.desc", 10, new SubmapManagerCarpetFloor("purple"));
|
||||
carpet.carverHelper.addVariation("tile.carpet.11.desc", 11, new SubmapManagerCarpetFloor("darkblue"));
|
||||
carpet.carverHelper.addVariation("tile.carpet.12.desc", 12, new SubmapManagerCarpetFloor("brown"));
|
||||
carpet.carverHelper.addVariation("tile.carpet.13.desc", 13, new SubmapManagerCarpetFloor("green"));
|
||||
carpet.carverHelper.addVariation("tile.carpet.14.desc", 14, new SubmapManagerCarpetFloor("red"));
|
||||
carpet.carverHelper.addVariation("tile.carpet.15.desc", 15, new SubmapManagerCarpetFloor("black"));
|
||||
if (!Configurations.allowChiselCrossColors) {
|
||||
carpet.carverHelper.forbidChiseling = true;
|
||||
}
|
||||
@@ -595,7 +595,7 @@ public enum Features {
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockCarvable diorite = (BlockCarvable) new BlockCarvable(Material.rock).setHardness(2.0F).setResistance(10.0F).setCreativeTab(ChiselTabs.tabStoneChiselBlocks);
|
||||
diorite.carverHelper.setChiselBlockName("diorite");
|
||||
|
||||
diorite.carverHelper.addVariation("tile.diorite.0.desc", 0, "diorite/diorite");
|
||||
diorite.carverHelper.addVariation("tile.diorite.1.desc", 1, "diorite/dioritePolished");
|
||||
diorite.carverHelper.addVariation("tile.diorite.2.desc", 2, "diorite/dioritePillar");
|
||||
@@ -620,7 +620,7 @@ public enum Features {
|
||||
BlockCarvable dirt = (BlockCarvable) new BlockCarvable(Material.ground).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(0.5F).setStepSound(Block.soundTypeGravel)
|
||||
.setBlockName("dirt.default");
|
||||
Carving.chisel.addVariation("dirt", Blocks.dirt, 0, 0);
|
||||
dirt.carverHelper.setChiselBlockName("Dirt");
|
||||
|
||||
// dirt.carverHelper.addVariation("Dirt", 0, Blocks.dirt);
|
||||
dirt.carverHelper.addVariation("tile.dirt.0.desc", 0, "dirt/bricks");
|
||||
dirt.carverHelper.addVariation("tile.dirt.1.desc", 1, "dirt/netherbricks");
|
||||
@@ -682,7 +682,7 @@ public enum Features {
|
||||
void addBlocks() {
|
||||
BlockCarvable factoryblock = (BlockCarvable) new BlockCarvable(Material.iron).setCreativeTab(ChiselTabs.tabMetalChiselBlocks).setHardness(2.0F).setResistance(10F)
|
||||
.setStepSound(Chisel.soundMetalFootstep);
|
||||
factoryblock.carverHelper.setChiselBlockName("factoryblock");
|
||||
|
||||
factoryblock.carverHelper.addVariation("tile.factory.0.desc", 0, "factory/dots");
|
||||
factoryblock.carverHelper.addVariation("tile.factory.1.desc", 1, "factory/rust2");
|
||||
factoryblock.carverHelper.addVariation("tile.factory.2.desc", 2, "factory/rust");
|
||||
@@ -724,7 +724,7 @@ public enum Features {
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockCarvable fantasyblock = (BlockCarvable) new BlockCarvable(Material.rock).setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setHardness(2.0F).setResistance(10F);
|
||||
fantasyblock.carverHelper.setChiselBlockName("Fantasy Block");
|
||||
|
||||
fantasyblock.carverHelper.addVariation("tile.fantasyblock.0.desc", 0, "fantasy/brick");
|
||||
fantasyblock.carverHelper.addVariation("tile.fantasyblock.1.desc", 1, "fantasy/brick-faded");
|
||||
fantasyblock.carverHelper.addVariation("tile.fantasyblock.2.desc", 2, "fantasy/brick-wear");
|
||||
@@ -904,7 +904,6 @@ public enum Features {
|
||||
stainedGlassPane[glassId] = (BlockCarvablePane) new BlockCarvablePane(Material.glass, true).setStained(true).setHardness(0.3F).setStepSound(Block.soundTypeGlass)
|
||||
.setBlockName("Stained Glass Pane").setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||
stainedGlassPane[glassId].carverHelper.registerBlock(stainedGlassPane[glassId], blockName);
|
||||
stainedGlassPane[glassId].carverHelper.blockName = "Stained Glass Pane";
|
||||
}
|
||||
stainedGlassPane[glassId].carverHelper.addVariation(sGNames[i] + " bubble glass", glassPrefix, texName + "bubble");
|
||||
stainedGlassPane[glassId].carverHelper.addVariation(sGNames[i] + " glass panel", glassPrefix + 1, texName + "panel");
|
||||
@@ -992,7 +991,7 @@ public enum Features {
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockCarvable granite = (BlockCarvable) new BlockCarvable(Material.rock).setHardness(2.0F).setResistance(10.0F).setCreativeTab(ChiselTabs.tabStoneChiselBlocks);
|
||||
granite.carverHelper.setChiselBlockName("granite");
|
||||
|
||||
granite.carverHelper.addVariation("tile.granite.0.desc", 0, "granite/granite");
|
||||
granite.carverHelper.addVariation("tile.granite.1.desc", 1, "granite/granitePolished");
|
||||
granite.carverHelper.addVariation("tile.granite.2.desc", 2, "granite/granitePillar");
|
||||
@@ -1135,7 +1134,7 @@ public enum Features {
|
||||
void addBlocks() {
|
||||
BlockCarvableIcePillar ice_pillar = (BlockCarvableIcePillar) new BlockCarvableIcePillar(Material.ice).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(0.5F).setLightOpacity(3)
|
||||
.setStepSound(Block.soundTypeGlass);
|
||||
ice_pillar.carverHelper.setChiselBlockName("Ice Pillar");
|
||||
|
||||
ice_pillar.carverHelper.addVariation("tile.icePillar.0.desc", 0, "icepillar/plainplain");
|
||||
ice_pillar.carverHelper.addVariation("tile.icePillar.1.desc", 1, "icepillar/plaingreek");
|
||||
ice_pillar.carverHelper.addVariation("tile.icePillar.2.desc", 2, "icepillar/greekplain");
|
||||
@@ -1157,8 +1156,8 @@ public enum Features {
|
||||
@Override
|
||||
void addBlocks() {
|
||||
CarvableStairsMaker makerIceStairs = new CarvableStairsMaker(Blocks.ice);
|
||||
makerIceStairs.carverHelper.setChiselBlockName("Ice Stairs");
|
||||
makerIceStairs.carverHelper.addVariation("tile.ice_stairs.0.desc", 0, Blocks.ice);
|
||||
|
||||
// TODO makerIceStairs.carverHelper.addVariation("tile.ice_stairs.0.desc", 0, Blocks.ice);
|
||||
makerIceStairs.carverHelper.addVariation("tile.ice_stairs.1.desc", 1, "ice/a1-ice-light");
|
||||
makerIceStairs.carverHelper.addVariation("tile.ice_stairs.2.desc", 2, "ice/a1-stonecobble-icecobble");
|
||||
makerIceStairs.carverHelper.addVariation("tile.ice_stairs.3.desc", 3, "ice/a1-netherbrick-ice");
|
||||
@@ -1267,7 +1266,7 @@ public enum Features {
|
||||
void addBlocks() {
|
||||
BlockCarvable laboratoryblock = (BlockCarvable) new BlockCarvable(Material.iron).setCreativeTab(ChiselTabs.tabMetalChiselBlocks).setHardness(2.0F).setResistance(10F)
|
||||
.setStepSound(Chisel.soundMetalFootstep);
|
||||
laboratoryblock.carverHelper.setChiselBlockName("laboratoryblock");
|
||||
|
||||
laboratoryblock.carverHelper.addVariation("tile.laboratory.0.desc", 0, "laboratory/wallpanel");
|
||||
laboratoryblock.carverHelper.addVariation("tile.laboratory.1.desc", 1, "laboratory/dottedpanel");
|
||||
laboratoryblock.carverHelper.addVariation("tile.laboratory.2.desc", 2, "laboratory/largewall");
|
||||
@@ -1412,7 +1411,7 @@ public enum Features {
|
||||
void addBlocks() {
|
||||
BlockCarvable limestone = (BlockCarvable) new BlockCarvable(Material.rock).setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setHardness(2.0F).setResistance(10F)
|
||||
.setStepSound(Block.soundTypeStone);
|
||||
limestone.carverHelper.setChiselBlockName("Limestone");
|
||||
|
||||
limestone.carverHelper.addVariation("tile.limestone.0.desc", 0, "limestone");
|
||||
limestone.carverHelper.addVariation("tile.limestone.1.desc", 1, "limestone/terrain-cobbsmalltilelight");
|
||||
limestone.carverHelper.addVariation("tile.limestone.2.desc", 2, "limestone/terrain-cob-frenchlight");
|
||||
@@ -1434,7 +1433,7 @@ public enum Features {
|
||||
Carving.chisel.registerOre("limestone", "limestone");
|
||||
|
||||
BlockCarvableSlab limestone_slab = (BlockCarvableSlab) new BlockCarvableSlab(limestone).setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setHardness(2.0F).setResistance(10F);
|
||||
limestone_slab.carverHelper.setChiselBlockName("Limestone Slab");
|
||||
|
||||
limestone_slab.carverHelper.addVariation("tile.limestoneSlab.0.desc", 0, "limestone");
|
||||
limestone_slab.carverHelper.addVariation("tile.limestoneSlab.1.desc", 1, "limestone/terrain-cobbsmalltilelight");
|
||||
limestone_slab.carverHelper.addVariation("tile.limestoneSlab.2.desc", 2, "limestone/terrain-cob-frenchlight");
|
||||
@@ -1456,7 +1455,7 @@ public enum Features {
|
||||
Carving.chisel.registerOre("limestone_slab", "limestone_slab");
|
||||
|
||||
CarvableStairsMaker makerLimestoneStairs = new CarvableStairsMaker(limestone);
|
||||
makerLimestoneStairs.carverHelper.setChiselBlockName("Limestone Stairs");
|
||||
|
||||
makerLimestoneStairs.carverHelper.addVariation("tile.limestoneStairs.0.desc", 0, "limestone");
|
||||
makerLimestoneStairs.carverHelper.addVariation("tile.limestoneStairs.1.desc", 1, "limestone/terrain-cobbsmalltilelight");
|
||||
makerLimestoneStairs.carverHelper.addVariation("tile.limestoneStairs.2.desc", 2, "limestone/terrain-cob-frenchlight");
|
||||
@@ -1489,7 +1488,7 @@ public enum Features {
|
||||
void addBlocks() {
|
||||
BlockCarvable marble = (BlockCarvable) new BlockCarvable(Material.rock).setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setHardness(2.0F).setResistance(10F)
|
||||
.setStepSound(Block.soundTypeStone);
|
||||
marble.carverHelper.setChiselBlockName("Marble");
|
||||
|
||||
marble.carverHelper.addVariation("tile.marble.0.desc", 0, "marble");
|
||||
marble.carverHelper.addVariation("tile.marble.1.desc", 1, "marble/a1-stoneornamental-marblebrick");
|
||||
marble.carverHelper.addVariation("tile.marble.2.desc", 2, "marble/a1-stoneornamental-marbleclassicpanel");
|
||||
@@ -1512,7 +1511,7 @@ public enum Features {
|
||||
Carving.chisel.registerOre("marble", "marble");
|
||||
|
||||
BlockCarvableSlab marble_slab = (BlockCarvableSlab) new BlockCarvableSlab(marble).setHardness(2.0F).setResistance(10F);
|
||||
marble_slab.carverHelper.setChiselBlockName("Marble Slab");
|
||||
|
||||
marble_slab.carverHelper.addVariation("tile.marbleSlab.0.desc", 0, "marble");
|
||||
marble_slab.carverHelper.addVariation("tile.marbleSlab.1.desc", 1, "marbleslab/a1-stoneornamental-marblebrick");
|
||||
marble_slab.carverHelper.addVariation("tile.marbleSlab.2.desc", 2, "marbleslab/a1-stoneornamental-marbleclassicpanel");
|
||||
@@ -1534,7 +1533,7 @@ public enum Features {
|
||||
Carving.chisel.registerOre("marble_slab", "marble_slab");
|
||||
|
||||
CarvableStairsMaker makerMarbleStairs = new CarvableStairsMaker(marble);
|
||||
makerMarbleStairs.carverHelper.setChiselBlockName("Marble Stairs");
|
||||
|
||||
makerMarbleStairs.carverHelper.addVariation("tile.marbleStairs.0.desc", 0, "marble");
|
||||
makerMarbleStairs.carverHelper.addVariation("tile.marbleStairs.6.desc", 1, "marbleslab/a1-stoneornamental-marblebrick");
|
||||
makerMarbleStairs.carverHelper.addVariation("tile.marbleStairs.2.desc", 2, "marbleslab/a1-stoneornamental-marbleclassicpanel");
|
||||
@@ -1570,7 +1569,7 @@ public enum Features {
|
||||
if (Configurations.oldPillars) {
|
||||
marble_pillar = (BlockCarvable) new BlockCarvable(Material.rock).setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setHardness(2.0F).setResistance(10F)
|
||||
.setStepSound(Block.soundTypeStone);
|
||||
marble_pillar.carverHelper.setChiselBlockName("Marble Pillar");
|
||||
|
||||
marble_pillar.carverHelper.addVariation("tile.marblePillarOld.0.desc", 0, "marblepillarold/column");
|
||||
marble_pillar.carverHelper.addVariation("tile.marblePillarOld.1.desc", 1, "marblepillarold/capstone");
|
||||
marble_pillar.carverHelper.addVariation("tile.marblePillarOld.2.desc", 2, "marblepillarold/base");
|
||||
@@ -1590,7 +1589,7 @@ public enum Features {
|
||||
} else {
|
||||
marble_pillar = (BlockCarvable) new BlockCarvablePillar(Material.rock).setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setHardness(2.0F).setResistance(10F)
|
||||
.setStepSound(Block.soundTypeStone);
|
||||
marble_pillar.carverHelper.setChiselBlockName("Marble Pillar");
|
||||
|
||||
marble_pillar.carverHelper.addVariation("tile.marblePillar.0.desc", 0, "marblepillar/pillar");
|
||||
marble_pillar.carverHelper.addVariation("tile.marblePillar.1.desc", 1, "marblepillar/default");
|
||||
marble_pillar.carverHelper.addVariation("tile.marblePillar.2.desc", 2, "marblepillar/simple");
|
||||
@@ -1612,7 +1611,7 @@ public enum Features {
|
||||
|
||||
BlockCarvableSlab marble_pillar_slab = (BlockCarvableSlab) new BlockCarvableSlab(marble_pillar).setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setHardness(2.0F).setResistance(10F)
|
||||
.setStepSound(Block.soundTypeStone);
|
||||
marble_pillar_slab.carverHelper.setChiselBlockName("Marble Pillar Slab");
|
||||
|
||||
if (Configurations.oldPillars) {
|
||||
marble_pillar_slab.carverHelper.addVariation("tile.marblePillarSlabOld.0.desc", 0, "marblepillarslabold/column");
|
||||
marble_pillar_slab.carverHelper.addVariation("tile.marblePillarSlabOld.1.desc", 1, "marblepillarslabold/capstone");
|
||||
@@ -1812,7 +1811,7 @@ public enum Features {
|
||||
void addBlocks() {
|
||||
BlockCarvablePackedIcePillar packedice_pillar = (BlockCarvablePackedIcePillar) new BlockCarvablePackedIcePillar(Material.ice).setCreativeTab(ChiselTabs.tabOtherChiselBlocks)
|
||||
.setHardness(0.5F).setLightOpacity(3).setStepSound(Block.soundTypeGlass);
|
||||
packedice_pillar.carverHelper.setChiselBlockName("Packed Ice Pillar");
|
||||
|
||||
packedice_pillar.carverHelper.addVariation("tile.packedice_pillar.0.desc", 0, "icepillar/plainplain");
|
||||
packedice_pillar.carverHelper.addVariation("tile.packedice_pillar.1.desc", 1, "icepillar/plaingreek");
|
||||
packedice_pillar.carverHelper.addVariation("tile.packedice_pillar.2.desc", 2, "icepillar/greekplain");
|
||||
@@ -1829,8 +1828,8 @@ public enum Features {
|
||||
@Override
|
||||
void addBlocks() {
|
||||
CarvableStairsMaker makerPackedIceStairs = new CarvableStairsMaker(Blocks.packed_ice);
|
||||
makerPackedIceStairs.carverHelper.setChiselBlockName("Packed Ice Stairs");
|
||||
makerPackedIceStairs.carverHelper.addVariation("tile.packedice_stairs.0.desc", 0, Blocks.packed_ice);
|
||||
|
||||
// TODO makerPackedIceStairs.carverHelper.addVariation("tile.packedice_stairs.0.desc", 0, Blocks.packed_ice);
|
||||
makerPackedIceStairs.carverHelper.addVariation("tile.packedice_stairs.1.desc", 1, "ice/a1-ice-light");
|
||||
makerPackedIceStairs.carverHelper.addVariation("tile.packedice_stairs.2.desc", 2, "ice/a1-stonecobble-icecobble");
|
||||
makerPackedIceStairs.carverHelper.addVariation("tile.packedice_stairs.3.desc", 3, "ice/a1-netherbrick-ice");
|
||||
@@ -1862,7 +1861,7 @@ public enum Features {
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockCarvablePane paperwall = (BlockCarvablePane) new BlockCarvablePane(Material.ground, true).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(0.5F).setResistance(0.5F);
|
||||
paperwall.carverHelper.setChiselBlockName("Paper Wall");
|
||||
|
||||
paperwall.carverHelper.addVariation("tile.paperwall.0.desc", 0, "paper/box");
|
||||
paperwall.carverHelper.addVariation("tile.paperwall.1.desc", 1, "paper/throughMiddle");
|
||||
paperwall.carverHelper.addVariation("tile.paperwall.2.desc", 2, "paper/cross");
|
||||
@@ -1877,7 +1876,7 @@ public enum Features {
|
||||
Carving.chisel.registerOre("paperwall", "paperwall");
|
||||
|
||||
BlockCarvable paperwall_block = (BlockCarvable) new BlockCarvable(Material.ground).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(0.5F).setResistance(0.5F);
|
||||
paperwall_block.carverHelper.setChiselBlockName("Paper Wall Block");
|
||||
|
||||
paperwall_block.carverHelper.addVariation("tile.paperwall.0.desc", 0, "paper/box");
|
||||
paperwall_block.carverHelper.addVariation("tile.paperwall.1.desc", 1, "paper/throughMiddle");
|
||||
paperwall_block.carverHelper.addVariation("tile.paperwall.2.desc", 2, "paper/cross");
|
||||
@@ -1905,7 +1904,8 @@ public enum Features {
|
||||
void addBlocks() {
|
||||
BlockPresent present = (BlockPresent) new BlockPresent().setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(2.0F).setResistance(10.0F).setBlockName("chisel.present");
|
||||
for (int i = 0; i < 16; i++) {
|
||||
present.carverHelper.addVariation("tile.chisel.present.desc", i, Blocks.chest);
|
||||
// TODO
|
||||
present.carverHelper.addVariation("tile.chisel.present.desc", i, "paper/box");
|
||||
}
|
||||
present.carverHelper.registerAll(present, "present", ItemBlockPresent.class);
|
||||
Carving.chisel.registerOre("present", "chest");
|
||||
@@ -2421,7 +2421,7 @@ public enum Features {
|
||||
void addBlocks() {
|
||||
BlockCarvable templeblock = (BlockCarvable) new BlockEldritch().setHardness(2.0F).setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setResistance(10F)
|
||||
.setStepSound(Chisel.soundTempleFootstep);
|
||||
templeblock.carverHelper.setChiselBlockName("Temple Block");
|
||||
|
||||
templeblock.carverHelper.addVariation("tile.templeblock.0.desc", 0, "temple/cobble");
|
||||
templeblock.carverHelper.addVariation("tile.templeblock.1.desc", 1, "temple/ornate");
|
||||
templeblock.carverHelper.addVariation("tile.templeblock.2.desc", 2, "temple/plate");
|
||||
@@ -2454,7 +2454,7 @@ public enum Features {
|
||||
void addBlocks() {
|
||||
BlockCarvable mossy_templeblock = (BlockCarvable) new BlockEldritch().setHardness(2.0F).setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setResistance(10F)
|
||||
.setStepSound(Chisel.soundTempleFootstep);
|
||||
mossy_templeblock.carverHelper.setChiselBlockName("Mossy Temple Block");
|
||||
|
||||
mossy_templeblock.carverHelper.addVariation("tile.mossy_templeblock.0.desc", 0, "templemossy/cobble");
|
||||
mossy_templeblock.carverHelper.addVariation("tile.mossy_templeblock.1.desc", 1, "templemossy/ornate");
|
||||
mossy_templeblock.carverHelper.addVariation("tile.mossy_templeblock.2.desc", 2, "templemossy/plate");
|
||||
@@ -2585,7 +2585,7 @@ public enum Features {
|
||||
void addBlocks() {
|
||||
BlockCarvable tyrian = (BlockCarvable) new BlockCarvable(Material.iron).setCreativeTab(ChiselTabs.tabMetalChiselBlocks).setHardness(5.0F).setResistance(10.0F)
|
||||
.setStepSound(Block.soundTypeMetal);
|
||||
tyrian.carverHelper.setChiselBlockName("Futuristic Armor Plating Block");
|
||||
|
||||
tyrian.carverHelper.addVariation("tile.tyrian.0.desc", 0, "tyrian/shining");
|
||||
tyrian.carverHelper.addVariation("tile.tyrian.1.desc", 1, "tyrian/tyrian");
|
||||
tyrian.carverHelper.addVariation("tile.tyrian.2.desc", 2, "tyrian/chaotic");
|
||||
@@ -2689,7 +2689,7 @@ public enum Features {
|
||||
Carving.chisel.registerOre("voidstone2", "voidstone2");
|
||||
|
||||
BlockCarvable voidstoneRunic = (BlockCarvable) new BlockCarvable(Material.rock).setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setHardness(5.0F).setResistance(10.0F);
|
||||
voidstoneRunic.carverHelper.setChiselBlockName("Voidstone Runic");
|
||||
|
||||
|
||||
for (int i = 1; i < 16; i++)
|
||||
voidstoneRunic.carverHelper.addVariation("tile.voidstoneRunic." + sGNames[i].replaceAll(" ", "").toLowerCase() + ".desc", i, "voidstone/runes/rune" + sGNames[i].replaceAll(" ", ""));
|
||||
@@ -2796,7 +2796,7 @@ public enum Features {
|
||||
final String name = n.replace('-', '_') + "_planks";
|
||||
|
||||
planks[i] = (BlockCarvable) (new BlockCarvable(Material.wood)).setCreativeTab(ChiselTabs.tabWoodChiselBlocks).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood);
|
||||
planks[i].carverHelper.setChiselBlockName(u + " Wood Planks");
|
||||
|
||||
planks[i].carverHelper.addVariation("Smooth " + n + " wood planks", 1, "planks-" + n + "/clean");
|
||||
planks[i].carverHelper.addVariation("Short " + n + " wood planks", 2, "planks-" + n + "/short");
|
||||
planks[i].carverHelper.addVariation("Fancy " + n + " wood plank arrangement", 6, "planks-" + n + "/fancy");
|
||||
@@ -2826,7 +2826,7 @@ public enum Features {
|
||||
@Override
|
||||
void addBlocks() {
|
||||
BlockCarvable woolen_clay = (BlockCarvable) new BlockCarvable(Material.clay).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(2F).setResistance(10F);
|
||||
woolen_clay.carverHelper.setChiselBlockName("Woolen Clay");
|
||||
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
woolen_clay.carverHelper.addVariation("tile.woolenClay." + i + ".desc", i, "woolenClay/" + sGNames[i].replaceAll(" ", "").toLowerCase());
|
||||
@@ -2847,8 +2847,7 @@ public enum Features {
|
||||
boolean needsMetaRecipes() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
;
|
||||
};
|
||||
|
||||
private static final String[] dyeOres = { "dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", "dyePink", "dyeLime", "dyeYellow",
|
||||
"dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite" };
|
||||
|
||||
@@ -4,7 +4,7 @@ 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.api.rendering.ISubmapManager;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cricketcraft.chisel.api.carving;
|
||||
|
||||
import com.cricketcraft.chisel.api.client.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.rendering.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureType;
|
||||
|
||||
public interface IVariationInfo {
|
||||
|
||||
@@ -9,4 +10,6 @@ public interface IVariationInfo {
|
||||
ICarvingVariation getVariation();
|
||||
|
||||
String getDescription();
|
||||
|
||||
TextureType getType();
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cricketcraft.chisel.api.carving;
|
||||
|
||||
import com.cricketcraft.chisel.api.client.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.rendering.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureType;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
@@ -9,11 +10,17 @@ public class VariationInfoBase implements IVariationInfo {
|
||||
private ICarvingVariation variation;
|
||||
private String unlocDesc;
|
||||
private ISubmapManager manager;
|
||||
|
||||
private TextureType type;
|
||||
|
||||
public VariationInfoBase(ICarvingVariation variation, String unlocDesc, ISubmapManager manager) {
|
||||
this(variation, unlocDesc, manager, TextureType.CUSTOM);
|
||||
}
|
||||
|
||||
public VariationInfoBase(ICarvingVariation variation, String unlocDesc, ISubmapManager manager, TextureType type) {
|
||||
this.variation = variation;
|
||||
this.unlocDesc = unlocDesc;
|
||||
this.manager = manager;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -30,4 +37,9 @@ public class VariationInfoBase implements IVariationInfo {
|
||||
public ISubmapManager getSubmapManager() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureType getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
+8
-5
@@ -1,4 +1,4 @@
|
||||
package com.cricketcraft.chisel.api.client;
|
||||
package com.cricketcraft.chisel.api.rendering;
|
||||
|
||||
import gnu.trove.map.TIntObjectMap;
|
||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||
@@ -12,7 +12,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import com.cricketcraft.chisel.api.IFacade;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import static com.cricketcraft.chisel.api.client.Dir.*;
|
||||
import static com.cricketcraft.chisel.api.rendering.Dir.*;
|
||||
|
||||
// @formatter:off
|
||||
/**
|
||||
@@ -68,15 +68,15 @@ import static com.cricketcraft.chisel.api.client.Dir.*;
|
||||
public class CTM {
|
||||
|
||||
/** Some hardcoded offset values for the different corner indeces */
|
||||
private int[] submapOffsets = { 4, 5, 1, 0 };
|
||||
private TIntObjectMap<Dir[]> submapMap = new TIntObjectHashMap<Dir[]>();
|
||||
private static int[] submapOffsets = { 4, 5, 1, 0 };
|
||||
private static TIntObjectMap<Dir[]> submapMap = new TIntObjectHashMap<Dir[]>();
|
||||
private static EnumMap<Dir, Boolean> connectionMap = Maps.newEnumMap(Dir.class);
|
||||
/** For use via the Chisel 2 config only, altering this could cause unintended behavior */
|
||||
public static boolean disableObscuredFaceCheckConfig = false;
|
||||
|
||||
public Boolean disableObscuredFaceCheck = null;
|
||||
|
||||
private CTM() {
|
||||
static {
|
||||
for (Dir dir : Dir.VALUES) {
|
||||
connectionMap.put(dir, false);
|
||||
}
|
||||
@@ -86,6 +86,9 @@ public class CTM {
|
||||
submapMap.put(2, new Dir[] { TOP, RIGHT, TOP_RIGHT });
|
||||
submapMap.put(3, new Dir[] { TOP, LEFT, TOP_LEFT });
|
||||
}
|
||||
|
||||
private CTM() {
|
||||
}
|
||||
|
||||
public static CTM getInstance() {
|
||||
return new CTM();
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cricketcraft.chisel.api.client;
|
||||
package com.cricketcraft.chisel.api.rendering;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
+4
-1
@@ -1,6 +1,7 @@
|
||||
package com.cricketcraft.chisel.api.client;
|
||||
package com.cricketcraft.chisel.api.rendering;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -34,4 +35,6 @@ public interface ISubmapManager {
|
||||
* The IIconRegister instance.
|
||||
*/
|
||||
void registerIcons(String modName, Block block, IIconRegister register);
|
||||
|
||||
RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world);
|
||||
}
|
||||
+6
-4
@@ -1,4 +1,4 @@
|
||||
package com.cricketcraft.chisel.api.client;
|
||||
package com.cricketcraft.chisel.api.rendering;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -79,9 +79,11 @@ public class TextureSubmap {
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public final void TexturesStitched(TextureStitchEvent.Post event) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
icons[x][y] = new TextureVirtual(getBaseIcon(), width, height, x, y);
|
||||
for (TextureSubmap ts : submaps) {
|
||||
for (int x = 0; x < ts.width; x++) {
|
||||
for (int y = 0; y < ts.height; y++) {
|
||||
ts.icons[x][y] = new TextureVirtual(ts.getBaseIcon(), ts.width, ts.height, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,391 @@
|
||||
package com.cricketcraft.chisel.api.rendering;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.commons.lang3.tuple.Triple;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.client.render.RenderBlocksCTM;
|
||||
import com.cricketcraft.chisel.client.render.RenderBlocksColumn;
|
||||
|
||||
/**
|
||||
* Handles all default {@link ISubmapManager} behavior
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public enum TextureType {
|
||||
|
||||
// @formatter:off
|
||||
TOPSIDE("top", "side") {
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return new IIcon[]{
|
||||
register.registerIcon(modName + ":" + texturePath + "-side"),
|
||||
register.registerIcon(modName + ":" + texturePath + "-top")
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
IIcon[] icons = (IIcon[]) cachedObject;
|
||||
return side > 1 ? icons[0] : icons[1];
|
||||
}
|
||||
},
|
||||
TOPBOTSIDE("top", "bottom", "side"){
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return new IIcon[]{
|
||||
register.registerIcon(modName + ":" + texturePath + "-side"),
|
||||
register.registerIcon(modName + ":" + texturePath + "-bottom"),
|
||||
register.registerIcon(modName + ":" + texturePath + "-top")
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
IIcon[] icons = (IIcon[]) cachedObject;
|
||||
return side > 1 ? icons[0] : icons[side + 1];
|
||||
}
|
||||
},
|
||||
CTMV("ctmv", "top"){
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return Pair.of(new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-ctmv"), 2, 2), register.registerIcon(modName + ":" + texturePath + "-top"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
Pair<TextureSubmap, IIcon> data = (Pair<TextureSubmap, IIcon>) cachedObject;
|
||||
return side < 2 ? data.getRight() : data.getLeft().getSubIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
Pair<IIcon, TextureSubmap> data = (Pair<IIcon, TextureSubmap>) cachedObject;
|
||||
if (side < 2)
|
||||
return data.getLeft();
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
boolean topConnected = ctm.isConnected(world, x, y + 1, z, side, block, meta);
|
||||
boolean botConnected = ctm.isConnected(world, x, y - 1, z, side, block, meta);
|
||||
|
||||
TextureSubmap map = data.getRight();
|
||||
if (topConnected && botConnected)
|
||||
return map.getSubIcon(0, 1);
|
||||
if (topConnected && !botConnected)
|
||||
return map.getSubIcon(1, 1);
|
||||
if (!topConnected && botConnected)
|
||||
return map.getSubIcon(1, 0);
|
||||
return map.getSubIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world, Object cachedObject) {
|
||||
RenderBlocksColumn ret = theRenderBlocksColumn;
|
||||
Pair<IIcon, TextureSubmap> data = (Pair<IIcon, TextureSubmap>) cachedObject;
|
||||
|
||||
ret.blockAccess = world;
|
||||
ret.renderMaxX = 1.0;
|
||||
ret.renderMaxY = 1.0;
|
||||
ret.renderMaxZ = 1.0;
|
||||
|
||||
ret.submap = data.getRight();
|
||||
ret.iconTop = data.getLeft();
|
||||
return ret;
|
||||
}
|
||||
},
|
||||
CTMH("ctmh", "top"){
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return Pair.of(new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-ctmh"), 2, 2), register.registerIcon(modName + ":" + texturePath + "-top"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return CTMV.getIcon(variation, cachedObject, side, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
Pair<IIcon, TextureSubmap> data = (Pair<IIcon, TextureSubmap>) cachedObject;
|
||||
if (side < 2)
|
||||
return data.getLeft();
|
||||
|
||||
Block block = ctm.getBlockOrFacade(world, x, y, z, side);
|
||||
|
||||
boolean p;
|
||||
boolean n;
|
||||
boolean reverse = side == 2 || side == 5;
|
||||
|
||||
if (side < 4) {
|
||||
p = ctm.isConnected(world, x - 1, y, z, side, block, meta);
|
||||
n = ctm.isConnected(world, x + 1, y, z, side, block, meta);
|
||||
} else {
|
||||
p = ctm.isConnected(world, x, y, z - 1, side, block, meta);
|
||||
n = ctm.isConnected(world, x, y, z + 1, side, block, meta);
|
||||
}
|
||||
|
||||
TextureSubmap map = data.getRight();
|
||||
if (p && n)
|
||||
return map.getSubIcon(1, 0);
|
||||
else if (p)
|
||||
return map.getSubIcon(reverse ? 0 : 1, 1);
|
||||
else if (n)
|
||||
return map.getSubIcon(reverse ? 0 : 1, 1);
|
||||
return map.getSubIcon(0, 0);
|
||||
}
|
||||
},
|
||||
V9("v9"){
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-v9"), 3, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return ((TextureSubmap)cachedObject).getSubIcon(1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
int variationSize = (this == TextureType.V9) ? 3 : 2;
|
||||
TextureSubmap map = (TextureSubmap) cachedObject;
|
||||
|
||||
int xModulus = x % variationSize;
|
||||
int zModulus = z % variationSize;
|
||||
//This ensures that blocks placed near 0,0 or it's axis' do not misbehave
|
||||
int textureX = (xModulus < 0) ? (xModulus + variationSize) : xModulus;
|
||||
int textureZ = (zModulus < 0) ? (zModulus + variationSize) : zModulus;
|
||||
//Always invert the y index
|
||||
int textureY = (variationSize - (y % variationSize) - 1);
|
||||
|
||||
if (side == 2 || side == 5) {
|
||||
//For WEST, SOUTH reverse the indexes for both X and Z
|
||||
textureX = (variationSize - textureX - 1);
|
||||
textureZ = (variationSize - textureZ - 1);
|
||||
} /*else if (side == 0) {
|
||||
//For DOWN, reverse the indexes for only Z
|
||||
textureZ = (variationSize - textureZ - 1);
|
||||
}*/
|
||||
|
||||
int index;
|
||||
if (side == 0 || side == 1) {
|
||||
// DOWN || UP
|
||||
index = textureX + textureZ * variationSize;
|
||||
} else if (side == 2 || side == 3) {
|
||||
// NORTH || SOUTH
|
||||
index = textureX + textureY * variationSize;
|
||||
} else {
|
||||
// WEST || EAST
|
||||
index = textureZ + textureY * variationSize;
|
||||
}
|
||||
|
||||
return map.getSubIcon(index % variationSize, index / variationSize);
|
||||
}
|
||||
},
|
||||
V4("v4"){
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-v4"), 3, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return ((TextureSubmap)cachedObject).getSubIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
return V9.getIcon(variation, cachedObject, world, x, y, z, side, meta);
|
||||
}
|
||||
},
|
||||
CTMX("", "ctm"){
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
IIcon baseIcon = register.registerIcon(modName + ":" + texturePath);
|
||||
return Triple.of(
|
||||
baseIcon,
|
||||
new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-ctm"), 4, 4),
|
||||
new TextureSubmap(baseIcon, 2, 2)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return ((Triple<IIcon, ?, ?>)cachedObject).getLeft();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world, Object cachedObject) {
|
||||
RenderBlocksCTM ret = theRenderBlocksCTM;
|
||||
Triple<?, TextureSubmap, TextureSubmap> data = (Triple<?, TextureSubmap, TextureSubmap>) cachedObject;
|
||||
ret.blockAccess = world;
|
||||
ret.renderMaxX = 1.0;
|
||||
ret.renderMaxY = 1.0;
|
||||
ret.renderMaxZ = 1.0;
|
||||
|
||||
ret.submap = data.getMiddle();
|
||||
ret.submapSmall = data.getRight();
|
||||
|
||||
ret.rendererOld = rendererOld;
|
||||
return ret;
|
||||
}
|
||||
},
|
||||
R16("r16"){
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-r16"), 4, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return V9.getIcon(variation, cachedObject, side, meta);
|
||||
}
|
||||
},
|
||||
R9("r9"){
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-r9"), 3, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return V9.getIcon(variation, cachedObject, side, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
return R4.getIcon(variation, cachedObject, side, meta);
|
||||
}
|
||||
},
|
||||
R4("r4"){
|
||||
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-r4"), 2, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return V4.getIcon(variation, cachedObject, side, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
rand.setSeed(x + y + z + side);
|
||||
rand.nextBoolean();
|
||||
int size = this == TextureType.R4 ? 2 : 3;
|
||||
return ((TextureSubmap)cachedObject).getSubIcon(rand.nextInt(size), rand.nextInt(size));
|
||||
}
|
||||
},
|
||||
NORMAL,
|
||||
CUSTOM;
|
||||
|
||||
private static final TextureType[] VALUES;
|
||||
private static final CTM ctm = CTM.getInstance();
|
||||
private static final Random rand = new Random();
|
||||
private static final RenderBlocksCTM theRenderBlocksCTM = new RenderBlocksCTM();
|
||||
private static final RenderBlocksColumn theRenderBlocksColumn = new RenderBlocksColumn();
|
||||
|
||||
private String[] suffixes;
|
||||
static {
|
||||
VALUES = ArrayUtils.subarray(values(), 0, values().length - 1);
|
||||
}
|
||||
|
||||
private TextureType(String... suffixes) {
|
||||
this.suffixes = suffixes.length == 0 ? new String[] { "" } : suffixes;
|
||||
}
|
||||
|
||||
public ISubmapManager createManagerFor(ICarvingVariation variation, String texturePath) {
|
||||
return new SubmapManagerDefault(this, variation, texturePath);
|
||||
}
|
||||
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return register.registerIcon(modName + ":" + texturePath);
|
||||
}
|
||||
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return (IIcon) cachedObject;
|
||||
}
|
||||
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
return getIcon(variation, cachedObject, side, meta);
|
||||
}
|
||||
|
||||
protected RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world, Object cachedObject) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static TextureType getTypeFor(CarvableHelper inst, String modid, String path) {
|
||||
if (path == null) {
|
||||
return CUSTOM;
|
||||
}
|
||||
for (TextureType t : VALUES) {
|
||||
boolean matches = true;
|
||||
for (String s : t.suffixes) {
|
||||
if (!exists(modid, path, s.isEmpty() ? s : "-" + s)) {
|
||||
matches = false;
|
||||
}
|
||||
}
|
||||
if (matches) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return CUSTOM;
|
||||
}
|
||||
|
||||
// This is ugly, but faster than class.getResource
|
||||
private static boolean exists(String modid, String path, String postfix) {
|
||||
ResourceLocation rl = new ResourceLocation(modid, "textures/blocks/" + path + postfix + ".png");
|
||||
try {
|
||||
Minecraft.getMinecraft().getResourceManager().getAllResources(rl);
|
||||
return true;
|
||||
} catch (Throwable t) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static class SubmapManagerDefault implements ISubmapManager {
|
||||
|
||||
private TextureType type;
|
||||
private ICarvingVariation variation;
|
||||
private Object cachedObject;
|
||||
private String texturePath;
|
||||
|
||||
private SubmapManagerDefault(TextureType type, ICarvingVariation variation, String texturePath) {
|
||||
this.type = type;
|
||||
this.variation = variation;
|
||||
this.texturePath = texturePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return type.getIcon(variation, cachedObject, side, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return type.getIcon(variation, cachedObject, world, x, y, z, side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
cachedObject = type.registerIcons(variation, modName, texturePath, register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world) {
|
||||
return type.createRenderContext(rendererOld, world, cachedObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@API(apiVersion = ChiselAPIProps.VERSION, owner = "Chisel", provides = "ChiselAPI|Rendering")
|
||||
package com.cricketcraft.chisel.api.rendering;
|
||||
|
||||
import com.cricketcraft.chisel.api.ChiselAPIProps;
|
||||
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -37,13 +37,14 @@ public class BlockCarvablePillar extends BlockCarvable {
|
||||
var = carverHelper.infoList.get(metadata);
|
||||
else
|
||||
var = carverHelper.infoList.get(0);
|
||||
return var.getSubmapManager().getIcon(0, metadata);
|
||||
|
||||
// TODO this...
|
||||
if (index >= 4)
|
||||
return var.iconTop;
|
||||
if (var.seamsCtmVert == null)
|
||||
return var.icon;
|
||||
return var.seamsCtmVert.getSubIcon(index % 2, index / 2);
|
||||
// if (index >= 4)
|
||||
// return var.iconTop;
|
||||
// if (var.seamsCtmVert == null)
|
||||
// return var.icon;
|
||||
// return var.seamsCtmVert.getSubIcon(index % 2, index / 2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,91 +4,39 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPane;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
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;
|
||||
import com.cricketcraft.chisel.api.rendering.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureType;
|
||||
import com.cricketcraft.chisel.compat.fmp.FMPIMC;
|
||||
import com.cricketcraft.chisel.item.ItemCarvable;
|
||||
import com.cricketcraft.chisel.utils.GeneralClient;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
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"),
|
||||
CTMH("ctmh", "top"),
|
||||
V9("v9"),
|
||||
V4("v4"),
|
||||
CTMX("", "ctm"),
|
||||
R16("r16"),
|
||||
R9("r9"),
|
||||
R4("r4"),
|
||||
NORMAL,
|
||||
CUSTOM;
|
||||
|
||||
private static final TextureType[] VALUES;
|
||||
private String[] suffixes;
|
||||
static {
|
||||
VALUES = ArrayUtils.subarray(values(), 0, values().length - 1);
|
||||
}
|
||||
|
||||
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) {
|
||||
boolean matches = true;
|
||||
for (String s : t.suffixes) {
|
||||
if (!inst.exists(modid, path, s.isEmpty() ? s : "-" + s)) {
|
||||
matches = false;
|
||||
}
|
||||
}
|
||||
if (matches) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return CUSTOM;
|
||||
}
|
||||
}
|
||||
|
||||
private Block theBlock;
|
||||
|
||||
public ArrayList<IVariationInfo> infoList = new ArrayList<IVariationInfo>();
|
||||
IVariationInfo[] infoMap = new IVariationInfo[16];
|
||||
public boolean forbidChiseling = false;
|
||||
|
||||
public CarvableHelper(Block block) {
|
||||
this.theBlock = block;
|
||||
}
|
||||
|
||||
private static CTM ctm = CTM.getInstance();
|
||||
|
||||
public ArrayList<IVariationInfo> infoList = new ArrayList<IVariationInfo>();
|
||||
IVariationInfo[] infoMap = new IVariationInfo[16];
|
||||
public boolean forbidChiseling = false;
|
||||
public String blockName;
|
||||
public void addVariation(String description, int metadata, ISubmapManager manager) {
|
||||
addVariation(description, metadata, null, manager);
|
||||
}
|
||||
|
||||
public void addVariation(String description, int metadata, Block bb) {
|
||||
addVariation(description, metadata, null, bb, 0, Chisel.MOD_ID);
|
||||
@@ -135,11 +83,6 @@ public class CarvableHelper {
|
||||
if (infoList.size() >= 16)
|
||||
return;
|
||||
|
||||
if (blockName == null && block != null)
|
||||
blockName = block.getLocalizedName();
|
||||
else if (blockName == null && description != null)
|
||||
blockName = description;
|
||||
|
||||
CarvingVariation var = new CarvingVariation(theBlock, metadata, metadata);
|
||||
TextureType type = TextureType.getTypeFor(this, modid, texture);
|
||||
if (type == TextureType.CUSTOM && customManager == null) {
|
||||
@@ -150,7 +93,7 @@ public class CarvableHelper {
|
||||
if (customManager != null) {
|
||||
info = new VariationInfoBase(var, description, customManager);
|
||||
} else {
|
||||
info = new VariationInfoBase(var, description, type.createManagerFor(var));
|
||||
info = new VariationInfoBase(var, description, type.createManagerFor(var, texture));
|
||||
}
|
||||
|
||||
// TODO handling for block texture override params
|
||||
@@ -159,82 +102,27 @@ public class CarvableHelper {
|
||||
infoMap[metadata] = info;
|
||||
}
|
||||
|
||||
// This is ugly, but faster than class.getResource
|
||||
private boolean exists(String modid, String path, String postfix) {
|
||||
ResourceLocation rl = new ResourceLocation(modid, "textures/blocks/" + path + postfix + ".png");
|
||||
try {
|
||||
Minecraft.getMinecraft().getResourceManager().getAllResources(rl);
|
||||
return true;
|
||||
} catch (Throwable t) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public IVariationInfo getVariation(int metadata) {
|
||||
if (metadata < 0 || metadata > 15)
|
||||
metadata = 0;
|
||||
|
||||
IVariationInfo variation = infoMap[metadata];
|
||||
if (variation == null)
|
||||
IVariationInfo info = infoMap[metadata];
|
||||
if (info == null)
|
||||
return null;
|
||||
|
||||
return variation;
|
||||
return info;
|
||||
}
|
||||
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
if (metadata < 0 || metadata > 15)
|
||||
metadata = 0;
|
||||
|
||||
IVariationInfo variation = infoMap[metadata];
|
||||
if (variation == null)
|
||||
IVariationInfo info = infoMap[metadata];
|
||||
if (info == null)
|
||||
return GeneralClient.getMissingIcon();
|
||||
|
||||
return variation.getSubmapManager().getIcon(side, metadata);
|
||||
|
||||
/*
|
||||
switch (variation.type) {
|
||||
case NORMAL:
|
||||
return variation.icon;
|
||||
case TOPSIDE:
|
||||
if (side == 0 || side == 1)
|
||||
return variation.iconTop;
|
||||
else
|
||||
return variation.icon;
|
||||
case TOPBOTSIDE:
|
||||
if (side == 1)
|
||||
return variation.iconTop;
|
||||
else if (side == 0)
|
||||
return variation.iconBot;
|
||||
else
|
||||
return variation.icon;
|
||||
case CTMV:
|
||||
if (side < 2)
|
||||
return variation.iconTop;
|
||||
else
|
||||
return variation.seamsCtmVert.getSubIcon(0, 0);
|
||||
case CTMH:
|
||||
if (side < 2)
|
||||
return variation.iconTop;
|
||||
else
|
||||
return variation.seamsCtmVert.getSubIcon(0, 0);
|
||||
case V9:
|
||||
return variation.variations9.getSubIcon(1, 1);
|
||||
case V4:
|
||||
return variation.variations9.getSubIcon(0, 0);
|
||||
case CTMX:
|
||||
return variation.icon;
|
||||
case R16:
|
||||
return variation.variations9.getSubIcon(1, 1);
|
||||
case R9:
|
||||
return variation.variations9.getSubIcon(1, 1);
|
||||
case R4:
|
||||
return variation.variations9.getSubIcon(0, 0);
|
||||
case CUSTOM:
|
||||
return variation.manager.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
return GeneralClient.getMissingIcon();
|
||||
*/
|
||||
return info.getSubmapManager().getIcon(side, metadata);
|
||||
}
|
||||
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
@@ -243,117 +131,11 @@ public class CarvableHelper {
|
||||
if (metadata < 0 || metadata > 15)
|
||||
metadata = 0;
|
||||
|
||||
IVariationInfo variation = infoMap[metadata];
|
||||
if (variation == null)
|
||||
IVariationInfo info = infoMap[metadata];
|
||||
if (info == null)
|
||||
return GeneralClient.getMissingIcon();
|
||||
|
||||
return variation.getSubmapManager().getIcon(world, x, y, z, side);
|
||||
|
||||
/*
|
||||
switch (variation.type) {
|
||||
case NORMAL:
|
||||
case TOPSIDE:
|
||||
case TOPBOTSIDE:
|
||||
return getIcon(side, metadata);
|
||||
case CTMV: {
|
||||
if (side < 2)
|
||||
return variation.iconTop;
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
boolean topConnected = ctm.isConnected(world, x, y + 1, z, side, block, metadata);
|
||||
boolean botConnected = ctm.isConnected(world, x, y - 1, z, side, block, metadata);
|
||||
|
||||
if (topConnected && botConnected)
|
||||
return variation.seamsCtmVert.getSubIcon(0, 1);
|
||||
if (topConnected && !botConnected)
|
||||
return variation.seamsCtmVert.getSubIcon(1, 1);
|
||||
if (!topConnected && botConnected)
|
||||
return variation.seamsCtmVert.getSubIcon(1, 0);
|
||||
return variation.seamsCtmVert.getSubIcon(0, 0);
|
||||
}
|
||||
case CTMH:
|
||||
if (side < 2)
|
||||
return variation.iconTop;
|
||||
|
||||
Block block = ctm.getBlockOrFacade(world, x, y, z, side);
|
||||
|
||||
boolean p;
|
||||
boolean n;
|
||||
boolean reverse = side == 2 || side == 5;
|
||||
|
||||
if (side < 4) {
|
||||
p = ctm.isConnected(world, x - 1, y, z, side, block, metadata);
|
||||
n = ctm.isConnected(world, x + 1, y, z, side, block, metadata);
|
||||
} else {
|
||||
p = ctm.isConnected(world, x, y, z - 1, side, block, metadata);
|
||||
n = ctm.isConnected(world, x, y, z + 1, side, block, metadata);
|
||||
}
|
||||
|
||||
if (p && n)
|
||||
return variation.seamsCtmVert.getSubIcon(1, 0);
|
||||
else if (p)
|
||||
return variation.seamsCtmVert.getSubIcon(reverse ? 0 : 1, 1);
|
||||
else if (n)
|
||||
return variation.seamsCtmVert.getSubIcon(reverse ? 0 : 1, 1);
|
||||
return variation.seamsCtmVert.getSubIcon(0, 0);
|
||||
case V9:
|
||||
case V4:
|
||||
int variationSize = (variation.type == TextureType.V9) ? 3 : 2;
|
||||
|
||||
int xModulus = x % variationSize;
|
||||
int zModulus = z % variationSize;
|
||||
//This ensures that blocks placed near 0,0 or it's axis' do not misbehave
|
||||
int textureX = (xModulus < 0) ? (xModulus + variationSize) : xModulus;
|
||||
int textureZ = (zModulus < 0) ? (zModulus + variationSize) : zModulus;
|
||||
//Always invert the y index
|
||||
int textureY = (variationSize - (y % variationSize) - 1);
|
||||
|
||||
if (side == 2 || side == 5) {
|
||||
//For WEST, SOUTH reverse the indexes for both X and Z
|
||||
textureX = (variationSize - textureX - 1);
|
||||
textureZ = (variationSize - textureZ - 1);
|
||||
} /*else if (side == 0) {
|
||||
//For DOWN, reverse the indexes for only Z
|
||||
textureZ = (variationSize - textureZ - 1);
|
||||
}//*/
|
||||
/*
|
||||
int index;
|
||||
if (side == 0 || side == 1) {
|
||||
// DOWN || UP
|
||||
index = textureX + textureZ * variationSize;
|
||||
} else if (side == 2 || side == 3) {
|
||||
// NORTH || SOUTH
|
||||
index = textureX + textureY * variationSize;
|
||||
} else {
|
||||
// WEST || EAST
|
||||
index = textureZ + textureY * variationSize;
|
||||
}
|
||||
|
||||
return variation.variations9.getSubIcon(index % variationSize, index / variationSize);
|
||||
case CTMX:
|
||||
return variation.icon;
|
||||
case R16:
|
||||
case R9:
|
||||
case R4:
|
||||
|
||||
int indexRan = x + y + z;
|
||||
if ((side == 2) || (side == 5)) {
|
||||
indexRan = -indexRan;
|
||||
}
|
||||
while (indexRan < 0) {
|
||||
indexRan = indexRan + 10000;
|
||||
}
|
||||
int size = variation.type == TextureType.V4 ? 2 : 3;
|
||||
|
||||
// rand.setSeed(indexRan); // Broken
|
||||
|
||||
return variation.variations9.getSubIcon(indexRan % size, indexRan / size);
|
||||
case CUSTOM:
|
||||
return variation.manager.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
return GeneralClient.getMissingIcon();
|
||||
*/
|
||||
return info.getSubmapManager().getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
public void registerAll(Block block, String name) {
|
||||
@@ -398,81 +180,6 @@ public class CarvableHelper {
|
||||
for (IVariationInfo info : infoList) {
|
||||
info.getSubmapManager().registerIcons(modName, block, register);
|
||||
}
|
||||
/*
|
||||
if (info.block != null) {
|
||||
info.block.registerBlockIcons(register);
|
||||
|
||||
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 (info.type) {
|
||||
case NORMAL:
|
||||
info.icon = info.block.getIcon(2, info.blockMeta);
|
||||
break;
|
||||
case TOPSIDE:
|
||||
info.icon = info.block.getIcon(2, info.blockMeta);
|
||||
info.iconTop = info.block.getIcon(0, info.blockMeta);
|
||||
break;
|
||||
case TOPBOTSIDE:
|
||||
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 (info.type) {
|
||||
case NORMAL:
|
||||
info.icon = register.registerIcon(modName + ":" + info.texture);
|
||||
break;
|
||||
case TOPSIDE:
|
||||
info.icon = register.registerIcon(modName + ":" + info.texture + "-side");
|
||||
info.iconTop = register.registerIcon(modName + ":" + info.texture + "-top");
|
||||
break;
|
||||
case TOPBOTSIDE:
|
||||
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:
|
||||
info.seamsCtmVert = new TextureSubmap(register.registerIcon(modName + ":" + info.texture + "-ctmv"), 2, 2);
|
||||
info.iconTop = register.registerIcon(modName + ":" + info.texture + "-top");
|
||||
break;
|
||||
case CTMH:
|
||||
info.seamsCtmVert = new TextureSubmap(register.registerIcon(modName + ":" + info.texture + "-ctmh"), 2, 2);
|
||||
info.iconTop = register.registerIcon(modName + ":" + info.texture + "-top");
|
||||
break;
|
||||
case V9:
|
||||
info.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + info.texture + "-v9"), 3, 3);
|
||||
break;
|
||||
case V4:
|
||||
info.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + info.texture + "-v4"), 2, 2);
|
||||
break;
|
||||
case CTMX:
|
||||
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:
|
||||
info.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + info.texture + "-r16"), 4, 4);
|
||||
break;
|
||||
case R9:
|
||||
info.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + info.texture + "-r9"), 3, 3);
|
||||
break;
|
||||
case R4:
|
||||
info.variations9 = new TextureSubmap(register.registerIcon(modName + ":" + info.texture + "-r4"), 2, 2);
|
||||
break;
|
||||
case CUSTOM:
|
||||
info.manager.registerIcons(modName, block, register);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public void registerSubBlocks(Block block, CreativeTabs tabs, List<ItemStack> list) {
|
||||
@@ -481,10 +188,6 @@ public class CarvableHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public void setChiselBlockName(String name) {
|
||||
blockName = name;
|
||||
}
|
||||
|
||||
public void registerOre(String ore) {
|
||||
OreDictionary.registerOre(ore, infoList.get(0).getVariation().getBlock());
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import com.cricketcraft.chisel.api.client.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.client.TextureSubmap;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper.TextureType;
|
||||
import com.cricketcraft.chisel.api.rendering.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureSubmap;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureType;
|
||||
|
||||
public class CarvableVariation {
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import com.cricketcraft.chisel.api.client.CTM;
|
||||
import com.cricketcraft.chisel.api.client.TextureSubmap;
|
||||
import com.cricketcraft.chisel.api.rendering.CTM;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureSubmap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -67,8 +67,11 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
inst.tessellator.setColorOpaque_F(inst.redCache[cacheID], inst.grnCache[cacheID], inst.bluCache[cacheID]);
|
||||
inst.tessellator.setBrightness(inst.lightingCache[cacheID]);
|
||||
}
|
||||
double xDiff = inst.renderMaxX - inst.renderMinX;
|
||||
double yDiff = inst.renderMaxY - inst.renderMinY;
|
||||
double zDiff = inst.renderMaxZ - inst.renderMinZ;
|
||||
|
||||
inst.tessellator.addVertexWithUV(x, y, z, inst.uCache[cacheID], inst.vCache[cacheID]);
|
||||
inst.tessellator.addVertexWithUV(inst.renderMinX + (x * xDiff), inst.renderMinY + (y * yDiff), inst.renderMinZ + (z * zDiff), inst.uCache[cacheID], inst.vCache[cacheID]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +120,7 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
int blueBitChannel = 0;
|
||||
int sunlightBitChannel = 0;
|
||||
|
||||
RenderBlocksCTM() {
|
||||
public RenderBlocksCTM() {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -128,9 +131,9 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
float[] redCache = new float[4];
|
||||
float[] grnCache = new float[4];
|
||||
float[] bluCache = new float[4];
|
||||
TextureSubmap submap;
|
||||
TextureSubmap submapSmall;
|
||||
RenderBlocks rendererOld;
|
||||
public TextureSubmap submap;
|
||||
public TextureSubmap submapSmall;
|
||||
public RenderBlocks rendererOld;
|
||||
|
||||
int[][] lightmap = new int[3][3];
|
||||
float[][] redmap = new float[3][3];
|
||||
@@ -282,10 +285,10 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) {
|
||||
IIcon i = rendererOld.overrideBlockTexture;
|
||||
|
||||
tessellator.addVertexWithUV(0.0, 1.0, 0.0, i.getMinU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 0.0, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 1.0, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(0.0, 1.0, 1.0, i.getMaxU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(renderMinX, renderMaxY, renderMinZ, i.getMinU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(renderMinX, renderMinY, renderMinZ, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(renderMinX, renderMinY, renderMaxZ, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(renderMinX, renderMaxY, renderMaxZ, i.getMaxU(), i.getMinV());
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 4);
|
||||
|
||||
@@ -310,10 +313,10 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) {
|
||||
IIcon i = rendererOld.overrideBlockTexture;
|
||||
|
||||
tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMinU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(renderMaxX, renderMaxY, renderMaxZ, i.getMaxU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(renderMaxX, renderMinY, renderMaxZ, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(renderMaxX, renderMinY, renderMinZ, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(renderMaxX, renderMaxY, renderMinZ, i.getMinU(), i.getMinV());
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 5);
|
||||
|
||||
@@ -337,10 +340,10 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) {
|
||||
IIcon i = rendererOld.overrideBlockTexture;
|
||||
|
||||
tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMaxU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 0.0, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(0.0, 1.0, 0.0, i.getMinU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(renderMaxX, renderMaxY, renderMinZ, i.getMaxU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(renderMaxX, renderMinY, renderMinZ, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(renderMinX, renderMinY, renderMinZ, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(renderMinX, renderMaxY, renderMinZ, i.getMinU(), i.getMinV());
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 2);
|
||||
|
||||
@@ -364,10 +367,10 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) {
|
||||
IIcon i = rendererOld.overrideBlockTexture;
|
||||
|
||||
tessellator.addVertexWithUV(0.0, 1.0, 1.0, i.getMinU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 1.0, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(renderMinX, renderMaxY, renderMaxZ, i.getMinU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(renderMinX, renderMinY, renderMaxZ, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(renderMaxX, renderMinY, renderMaxZ, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(renderMaxX, renderMaxY, renderMaxZ, i.getMaxU(), i.getMinV());
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 3);
|
||||
|
||||
@@ -391,10 +394,10 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) {
|
||||
IIcon i = rendererOld.overrideBlockTexture;
|
||||
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 1.0, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(0.0, 0.0, 0.0, i.getMinU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 0.0, i.getMaxU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(1.0, 0.0, 1.0, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(renderMinX, renderMinY, renderMaxZ, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(renderMinX, renderMinY, renderMinZ, i.getMinU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(renderMaxX, renderMinY, renderMinZ, i.getMaxU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(renderMaxX, renderMinY, renderMaxZ, i.getMaxU(), i.getMaxV());
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 0);
|
||||
|
||||
@@ -418,10 +421,10 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
if (rendererOld != null && rendererOld.hasOverrideBlockTexture()) {
|
||||
IIcon i = rendererOld.overrideBlockTexture;
|
||||
|
||||
tessellator.addVertexWithUV(0.0, 1.0, 0.0, i.getMinU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(0.0, 1.0, 1.0, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 1.0, 1.0, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(1.0, 1.0, 0.0, i.getMaxU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(renderMinX, renderMaxY, renderMinZ, i.getMinU(), i.getMinV());
|
||||
tessellator.addVertexWithUV(renderMinX, renderMaxY, renderMaxZ, i.getMinU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(renderMaxX, renderMaxY, renderMaxZ, i.getMaxU(), i.getMaxV());
|
||||
tessellator.addVertexWithUV(renderMaxX, renderMaxY, renderMinZ, i.getMaxU(), i.getMinV());
|
||||
} else {
|
||||
int tex[] = ctm.getSubmapIndices(blockAccess, bx, by, bz, 1);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import net.minecraft.util.IIcon;
|
||||
|
||||
public class RenderBlocksCTMCarpet extends RenderBlocksCTM {
|
||||
|
||||
RenderBlocksCTMCarpet() {
|
||||
public RenderBlocksCTMCarpet() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import com.cricketcraft.chisel.api.client.CTM;
|
||||
import com.cricketcraft.chisel.api.client.TextureSubmap;
|
||||
import com.cricketcraft.chisel.api.rendering.CTM;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureSubmap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import com.cricketcraft.chisel.api.client.CTM;
|
||||
import com.cricketcraft.chisel.api.client.TextureSubmap;
|
||||
import com.cricketcraft.chisel.api.rendering.CTM;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureSubmap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -10,12 +10,13 @@ import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class RenderBlocksColumn extends RenderBlocks {
|
||||
|
||||
TextureSubmap submap;
|
||||
IIcon iconTop;
|
||||
IIcon sides[] = new IIcon[6];
|
||||
CTM ctm = CTM.getInstance();
|
||||
public TextureSubmap submap;
|
||||
public IIcon iconTop;
|
||||
|
||||
private IIcon sides[] = new IIcon[6];
|
||||
private CTM ctm = CTM.getInstance();
|
||||
|
||||
RenderBlocksColumn() {
|
||||
public RenderBlocksColumn() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ 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.utils.Drawing;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
@@ -38,39 +37,15 @@ public class RendererCTM implements ISimpleBlockRenderingHandler {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
IVariationInfo var = ((ICarvable) block).getVariation(world, x, y, z, meta);
|
||||
|
||||
if (rendererOld.hasOverrideBlockTexture()) {
|
||||
// breaking anim
|
||||
rendererOld.renderStandardBlock(block, x, y, z);
|
||||
return true;
|
||||
|
||||
if (!rendererOld.hasOverrideBlockTexture() && var != null) {
|
||||
RenderBlocks rb = var.getSubmapManager().createRenderContext(rendererOld, world);
|
||||
if (rb != null) {
|
||||
return rb.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
switch (var == null ? TextureType.NORMAL : var.type) {
|
||||
case CTMX:
|
||||
rendererCTM.blockAccess = world;
|
||||
rendererCTM.renderMaxX = 1.0;
|
||||
rendererCTM.renderMaxY = 1.0;
|
||||
rendererCTM.renderMaxZ = 1.0;
|
||||
|
||||
rendererCTM.submap = var.submap;
|
||||
rendererCTM.submapSmall = var.submapSmall;
|
||||
|
||||
rendererCTM.rendererOld = rendererOld;
|
||||
|
||||
return rendererCTM.renderStandardBlock(block, x, y, z);
|
||||
case CTMV:
|
||||
rendererColumn.blockAccess = world;
|
||||
rendererColumn.renderMaxX = 1.0;
|
||||
rendererColumn.renderMaxY = 1.0;
|
||||
rendererColumn.renderMaxZ = 1.0;
|
||||
|
||||
rendererColumn.submap = var.seamsCtmVert;
|
||||
rendererColumn.iconTop = var.iconTop;
|
||||
|
||||
return rendererColumn.renderStandardBlock(block, x, y, z);
|
||||
default:
|
||||
return rendererOld.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
return rendererOld.renderStandardBlock(block, x, y, z) || rendererOld.hasOverrideBlockTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,8 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper.TextureType;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureType;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
import com.cricketcraft.chisel.utils.Drawing;
|
||||
|
||||
@@ -34,27 +35,29 @@ public class RendererCTMFullbright implements ISimpleBlockRenderingHandler {
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
// TODO this needs to go...amalgamate into RendererCTM
|
||||
@Override
|
||||
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);
|
||||
|
||||
if (var != null && var.type == TextureType.CTMX) {
|
||||
rendererCTMNoLight.blockAccess = world;
|
||||
rendererCTMNoLight.renderMaxX = 1.0;
|
||||
rendererCTMNoLight.renderMaxY = 1.0;
|
||||
rendererCTMNoLight.renderMaxZ = 1.0;
|
||||
|
||||
rendererCTMNoLight.submap = var.submap;
|
||||
rendererCTMNoLight.submapSmall = var.submapSmall;
|
||||
|
||||
rendererCTMNoLight.rendererOld = rendererOld;
|
||||
|
||||
return rendererCTMNoLight.renderStandardBlock(block, x, y, z);
|
||||
} else {
|
||||
return rendererOld.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
// int meta = world.getBlockMetadata(x, y, z);
|
||||
//
|
||||
// IVariationInfo var = ((ICarvable) block).getVariation(world, x, y, z, meta);
|
||||
//
|
||||
// if (var != null && var.getType() == TextureType.CTMX) {
|
||||
// rendererCTMNoLight.blockAccess = world;
|
||||
// rendererCTMNoLight.renderMaxX = 1.0;
|
||||
// rendererCTMNoLight.renderMaxY = 1.0;
|
||||
// rendererCTMNoLight.renderMaxZ = 1.0;
|
||||
//
|
||||
// rendererCTMNoLight.submap = var.submap;
|
||||
// rendererCTMNoLight.submapSmall = var.submapSmall;
|
||||
//
|
||||
// rendererCTMNoLight.rendererOld = rendererOld;
|
||||
//
|
||||
// return rendererCTMNoLight.renderStandardBlock(block, x, y, z);
|
||||
// } else {
|
||||
// return rendererOld.renderStandardBlock(block, x, y, z);
|
||||
// }
|
||||
return rendererOld.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,8 +6,8 @@ import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.cricketcraft.chisel.api.rendering.TextureType;
|
||||
import com.cricketcraft.chisel.block.BlockCarvablePillar;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper.TextureType;
|
||||
import com.cricketcraft.chisel.utils.Drawing;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
@@ -39,6 +39,7 @@ public class RendererPillar implements ISimpleBlockRenderingHandler {
|
||||
|
||||
}
|
||||
|
||||
// TODO this is a hardcoded mess...icon decisions should be left to the ISubmapManager, not here
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block blck, int modelId, RenderBlocks renderer) {
|
||||
if (!(blck instanceof BlockCarvablePillar))
|
||||
@@ -52,7 +53,7 @@ public class RendererPillar implements ISimpleBlockRenderingHandler {
|
||||
if (metadata >= block.carverHelper.infoList.size()) {
|
||||
metadata = 0;
|
||||
} else {
|
||||
if (block.carverHelper.infoList.get(metadata).type != TextureType.CTMV) {
|
||||
if (block.carverHelper.infoList.get(metadata).getType() != 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);
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.api.rendering.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureSubmap;
|
||||
|
||||
|
||||
public class SubmapManagerCarpetFloor implements ISubmapManager {
|
||||
|
||||
private static RenderBlocksCTMCarpet rb = new RenderBlocksCTMCarpet();
|
||||
|
||||
private TextureSubmap submap;
|
||||
private TextureSubmap submapSmall;
|
||||
private String color;
|
||||
|
||||
public SubmapManagerCarpetFloor(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return submapSmall.getBaseIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
String path = modName + ":carpet/" + color;
|
||||
submap = new TextureSubmap(register.registerIcon(path + "-ctm"), 4, 4);
|
||||
submapSmall = new TextureSubmap(register.registerIcon(path), 2, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world) {
|
||||
rb.blockAccess = world;
|
||||
rb.renderMaxX = 1.0;
|
||||
rb.renderMaxY = 1f / 16f;
|
||||
rb.renderMaxZ = 1.0;
|
||||
|
||||
rb.submap = submap;
|
||||
rb.submapSmall = submapSmall;
|
||||
|
||||
rb.rendererOld = rendererOld;
|
||||
return rb;
|
||||
}
|
||||
}
|
||||
+10
-4
@@ -1,16 +1,17 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.api.client.CTM;
|
||||
import com.cricketcraft.chisel.api.client.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.client.TextureSubmap;
|
||||
import com.cricketcraft.chisel.api.rendering.CTM;
|
||||
import com.cricketcraft.chisel.api.rendering.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureSubmap;
|
||||
import com.cricketcraft.chisel.init.ChiselBlocks;
|
||||
|
||||
import static com.cricketcraft.chisel.api.client.Dir.*;
|
||||
import static com.cricketcraft.chisel.api.rendering.Dir.*;
|
||||
|
||||
public class SubmapManagerFakeController implements ISubmapManager {
|
||||
|
||||
@@ -44,4 +45,9 @@ public class SubmapManagerFakeController implements ISubmapManager {
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
map = new TextureSubmap(register.registerIcon(modName + ":futura/WIP/controllerWIP-ctm"), 2, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world) {
|
||||
return rendererOld;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package com.cricketcraft.chisel.config;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.Features;
|
||||
import com.cricketcraft.chisel.api.client.CTM;
|
||||
import com.cricketcraft.chisel.api.rendering.CTM;
|
||||
|
||||
import net.minecraft.item.ItemDye;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
Reference in new issue
Block a user