mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-18 11:39:14 +00:00
Update to conform to new CTMLib layout. Bit hacky, unsure if final
This commit is contained in:
1 parent
8ab3c7159b
commit
9d9172fc75
23 files changed
+97
-142
No files matched your search
@@ -5,12 +5,13 @@ import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.ctmlib.ICTMBlock;
|
||||
import com.cricketcraft.ctmlib.ISubmapManager;
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
public interface ICarvable extends ICTMBlock<IVariationInfo> {
|
||||
|
||||
/**
|
||||
* Gets a {@link ISubmapManager} from this block, based on metadata.
|
||||
@@ -31,15 +32,12 @@ public interface ICarvable {
|
||||
* The metadata of the block
|
||||
* @return The {@link ISubmapManager} that represents this block in the world.
|
||||
*/
|
||||
public IVariationInfo getVariation(IBlockAccess world, int x, int y, int z, int metadata);
|
||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata);
|
||||
|
||||
/**
|
||||
* Gets the {@link ISubmapManager} for this block when it is in item form.
|
||||
*
|
||||
* @param stack
|
||||
* The {@link ItemStack} representing this block;
|
||||
* @return A {@link ISubmapManager}
|
||||
*/
|
||||
public IVariationInfo getVariation(ItemStack stack);
|
||||
public IVariationInfo getManager(int meta);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public class CarvableHelper {
|
||||
if (info == null)
|
||||
return getMissingIcon();
|
||||
|
||||
return info.getSubmapManager().getIcon(side, metadata);
|
||||
return info.getIcon(side, metadata);
|
||||
}
|
||||
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
@@ -155,7 +155,7 @@ public class CarvableHelper {
|
||||
if (info == null)
|
||||
return getMissingIcon();
|
||||
|
||||
return info.getSubmapManager().getIcon(world, x, y, z, side);
|
||||
return info.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
public void registerAll(Block block, String name) {
|
||||
@@ -199,7 +199,7 @@ public class CarvableHelper {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(String modName, Block block, IIconRegister register) {
|
||||
for (IVariationInfo info : infoList) {
|
||||
info.getSubmapManager().registerIcons(modName, block, register);
|
||||
info.registerIcons(modName, block, register);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,7 @@ package com.cricketcraft.chisel.api.carving;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureType;
|
||||
import com.cricketcraft.ctmlib.ISubmapManager;
|
||||
|
||||
public interface IVariationInfo {
|
||||
|
||||
ISubmapManager getSubmapManager();
|
||||
public interface IVariationInfo extends ISubmapManager {
|
||||
|
||||
ICarvingVariation getVariation();
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
package com.cricketcraft.chisel.api.carving;
|
||||
|
||||
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.util.StatCollector;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.cricketcraft.chisel.api.rendering.TextureType;
|
||||
import com.cricketcraft.ctmlib.ISubmapManager;
|
||||
@@ -33,13 +39,40 @@ public class VariationInfoBase implements IVariationInfo {
|
||||
return StatCollector.translateToLocal(unlocDesc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubmapManager getSubmapManager() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
// ISubmapManager delegation
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return manager.getIcon(side, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return manager.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
manager.registerIcons(modName, block, register);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
return manager.createRenderContext(rendererOld, block, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
manager.preRenderSide(renderer, world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
manager.postRenderSide(renderer, world, x, y, z, side);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user