mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-18 11:39:14 +00:00
Clean up in Carving API, add support for new API classes in Carving
This commit is contained in:
1 parent
f0e11d8eee
commit
a110c4e8ef
7 files changed
+53
-38
No files matched your search
@@ -1,18 +1,17 @@
|
||||
package com.cricketcraft.chisel.api;
|
||||
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.carving.CarvableVariation;
|
||||
|
||||
public interface ICarvable {
|
||||
|
||||
/**
|
||||
* This grabs the variations possible
|
||||
* Gets a {@link CarvableVariation} 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.
|
||||
*
|
||||
* @param metadata
|
||||
* This is the metadata that a block will use and the basis of
|
||||
* chisel Traditionally you make an instance of CarvableHelper
|
||||
* ex. CarvableHelper carverHelper = new CarvableHelper(); In
|
||||
* this method you return carverHelper.getVariation(metadata) and
|
||||
* that should be all you need if you register it correctly.
|
||||
* The metadata of the block
|
||||
*/
|
||||
public CarvableVariation getVariation(int metadata);
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.cricketcraft.chisel.api.carving;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CarvingUtils {
|
||||
|
||||
/**
|
||||
@@ -14,4 +16,15 @@ public class CarvingUtils {
|
||||
public static int compare(ICarvingVariation v1, ICarvingVariation v2) {
|
||||
return v1.getOrder() - v2.getOrder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link ItemStack} representing the passed {@link ICarvingVariation}.
|
||||
*
|
||||
* @param variation
|
||||
* An {@link ICarvingVariation}
|
||||
* @return An {@link ItemStack}
|
||||
*/
|
||||
public static ItemStack getStack(ICarvingVariation variation) {
|
||||
return new ItemStack(variation.getBlock(), 1, variation.getItemMeta());
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.cricketcraft.chisel.api.carving;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
/**
|
||||
* Represents a variation of a chiselable block.
|
||||
@@ -11,18 +11,26 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface ICarvingVariation extends Comparable<ICarvingVariation> {
|
||||
|
||||
/**
|
||||
* The base block of this variation.
|
||||
*
|
||||
* @return A {@link Block} that is the base of this variation
|
||||
*/
|
||||
Block getBlock();
|
||||
|
||||
/**
|
||||
* The metadata of this variation
|
||||
*
|
||||
* @return An int representing the metadata of this variation's {@link Block} in the world.
|
||||
*/
|
||||
int getBlockMeta();
|
||||
|
||||
int getItemMeta();
|
||||
|
||||
/**
|
||||
* Gets an {@link ItemStack} representing this variation.
|
||||
* The item metadata of this variation
|
||||
*
|
||||
* @return An {@link ItemStack} to represent this variation
|
||||
* @return An int representing the metadata of this variations's {@link Item}.
|
||||
*/
|
||||
ItemStack getStack();
|
||||
int getItemMeta();
|
||||
|
||||
/**
|
||||
* The "order" of this variation. Represents its position in the list of variations.
|
||||
|
||||
Reference in new issue
Block a user