mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-11 15:57:31 +00:00
Left click chiseling will now go through oredict group members as well
This commit is contained in:
1 parent
a38b7c4f23
commit
f71fddf01e
3 files changed
+18
-6
No files matched your search
@@ -7,7 +7,6 @@ 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;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class CarvingGroup implements ICarvingGroup {
|
||||
@@ -23,7 +22,7 @@ public class CarvingGroup implements ICarvingGroup {
|
||||
}
|
||||
|
||||
public List<ICarvingVariation> getVariations() {
|
||||
return ImmutableList.copyOf(variations);
|
||||
return Lists.newArrayList(variations);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,9 +7,11 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.IChiselItem;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
import com.cricketcraft.chisel.carving.Carving;
|
||||
import com.cricketcraft.chisel.carving.CarvingVariation;
|
||||
@@ -48,10 +50,18 @@ public final class ChiselController {
|
||||
z = event.z;
|
||||
Block block = event.world.getBlock(x, y, z);
|
||||
int metadata = event.world.getBlockMetadata(x, y, z);
|
||||
List<ICarvingVariation> list = Carving.chisel.getVariations(block, metadata);
|
||||
ICarvingGroup group = Carving.chisel.getGroup(block, metadata);
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
break;
|
||||
List<ICarvingVariation> list = group.getVariations();
|
||||
|
||||
main: for (ItemStack stack : OreDictionary.getOres(group.getOreName())) {
|
||||
ICarvingVariation v = General.getVariation(stack);
|
||||
for (ICarvingVariation check : list) {
|
||||
if (check.getBlock() == v.getBlock() && check.getBlockMeta() == v.getBlockMeta()) {
|
||||
continue main;
|
||||
}
|
||||
}
|
||||
list.add(General.getVariation(stack));
|
||||
}
|
||||
|
||||
ICarvingVariation[] variations = list.toArray(new CarvingVariation[] {});
|
||||
@@ -73,6 +83,7 @@ public final class ChiselController {
|
||||
ICarvingVariation v = variations[i];
|
||||
if (v.getBlock() == block && v.getBlockMeta() == metadata) {
|
||||
idx = (i + 1) % variations.length; // move to the next in the group
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
import com.cricketcraft.chisel.carving.Carving;
|
||||
import com.cricketcraft.chisel.carving.CarvingVariation;
|
||||
import com.cricketcraft.chisel.item.chisel.ChiselMode;
|
||||
|
||||
public class General {
|
||||
@@ -137,6 +138,7 @@ public class General {
|
||||
}
|
||||
|
||||
public static ICarvingVariation getVariation(ItemStack stack) {
|
||||
return Carving.chisel.getVariation(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage());
|
||||
ICarvingVariation v = Carving.chisel.getVariation(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage());
|
||||
return v == null ? new CarvingVariation(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 99) : v;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user