mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-11 15:57:31 +00:00
More API cleanup. ICarvableVariation no longer extends Comparable.
This commit is contained in:
1 parent
a110c4e8ef
commit
4bcaa62ca7
5 files changed
+19
-20
No files matched your search
@@ -2,6 +2,14 @@ package com.cricketcraft.chisel.api.carving;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a group of chiselable blocks.
|
||||
* <p>
|
||||
* This is an object that contains a collection of {@link ICarvingVariation} objects, and keeps them sorted. You may sort them in any way (or not at all), and {@link ICarvingVariation#getOrder()} will
|
||||
* likely be of use to do so.
|
||||
* <p>
|
||||
* It also defines what sound and oredict name the group as a whole has.
|
||||
*/
|
||||
public interface ICarvingGroup {
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,11 +5,8 @@ import net.minecraft.item.Item;
|
||||
|
||||
/**
|
||||
* Represents a variation of a chiselable block.
|
||||
* <p>
|
||||
* Do note that while this interface extends {@link Comparable}, a default implementation of {@link Comparable#compareTo(Object)} is provided in
|
||||
* {@link CarvingUtils#compare(ICarvingVariation, ICarvingVariation)}
|
||||
*/
|
||||
public interface ICarvingVariation extends Comparable<ICarvingVariation> {
|
||||
public interface ICarvingVariation {
|
||||
|
||||
/**
|
||||
* The base block of this variation.
|
||||
@@ -33,10 +30,9 @@ public interface ICarvingVariation extends Comparable<ICarvingVariation> {
|
||||
int getItemMeta();
|
||||
|
||||
/**
|
||||
* The "order" of this variation. Represents its position in the list of variations.
|
||||
* The "order" of this variation. Represents its position in the list of variations held by a group.
|
||||
*
|
||||
* @return An integer to represent the position of this variation in the list of all variations in the group
|
||||
*/
|
||||
int getOrder();
|
||||
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.cricketcraft.chisel.carving;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvingUtils;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -27,7 +29,13 @@ public class CarvingGroup implements ICarvingGroup {
|
||||
@Override
|
||||
public void addVariation(ICarvingVariation variation) {
|
||||
variations.add(variation);
|
||||
Collections.sort(variations);
|
||||
Collections.sort(variations, new Comparator<ICarvingVariation>() {
|
||||
|
||||
@Override
|
||||
public int compare(ICarvingVariation o1, ICarvingVariation o2) {
|
||||
return CarvingUtils.compare(o1, o2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.cricketcraft.chisel.carving;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvingUtils;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
|
||||
public class CarvingVariation implements ICarvingVariation {
|
||||
@@ -39,9 +37,4 @@ public class CarvingVariation implements ICarvingVariation {
|
||||
public int getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(ICarvingVariation o) {
|
||||
return CarvingUtils.compare(this, o);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
@@ -49,11 +48,6 @@ public class GroupList implements Set<ICarvingGroup> {
|
||||
data = Pair.of(block, blockMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(ICarvingVariation o) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock() {
|
||||
return data.getLeft();
|
||||
|
||||
Reference in new issue
Block a user