Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions src/main/java/fox/spiteful/avaritia/items/ItemMatterCluster.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void addInformation(ItemStack stack, EntityPlayer player, List<String> to

tooltip.add(
clustertag.getInteger(MAINCOUNTTAG) + "/"
+ MAX_CAPACITY
+ Math.max(MAX_CAPACITY, clustertag.getInteger(MAINCOUNTTAG))
+ " "
+ StatCollector.translateToLocal("tooltip.matter_cluster.counter"));
tooltip.add("");
Expand All @@ -93,6 +93,7 @@ public void addInformation(ItemStack stack, EntityPlayer player, List<String> to
}
} else {
tooltip.add(EnumChatFormatting.DARK_GRAY + StatCollector.translateToLocal("tooltip.matter_cluster.desc"));
tooltip.add(EnumChatFormatting.DARK_GRAY + StatCollector.translateToLocal("tooltip.matter_cluster.desc3"));
tooltip.add(
EnumChatFormatting.DARK_GRAY.toString() + EnumChatFormatting.ITALIC
+ StatCollector.translateToLocal("tooltip.matter_cluster.desc2"));
Expand Down Expand Up @@ -126,7 +127,7 @@ public static List<ItemStack> makeClusters(List<ItemStack> input) {
itemlist.remove(0);
}

if (currentTotal == MAX_CAPACITY) {
if (currentTotal >= MAX_CAPACITY) {
ItemStack cluster = makeCluster(currentItems);

clusters.add(cluster);
Expand Down Expand Up @@ -155,6 +156,18 @@ public static ItemStack makeCluster(Map<ItemStackWrapper, Integer> input) {
return cluster;
}

public static ItemStack makeCluster(ItemStack input) {
HashMap<ItemStackWrapper, Integer> map = new HashMap<>();

ItemStack input2 = input.copy();
input2.stackSize = 1;
map.put(new ItemStackWrapper(input2), input.stackSize);

ItemStack cluster = new ItemStack(LudicrousItems.matter_cluster);
setClusterData(cluster, map, input.stackSize);
return cluster;
}

public static Map<ItemStackWrapper, Integer> getClusterData(ItemStack cluster) {
if (!cluster.hasTagCompound() || !cluster.getTagCompound().hasKey(MAINTAG)) {
return new HashMap<>();
Expand Down Expand Up @@ -186,7 +199,7 @@ public static int getClusterSize(ItemStack cluster) {
}

public static boolean isClusterFull(ItemStack cluster) {
return getClusterSize(cluster) == MAX_CAPACITY;
return getClusterSize(cluster) >= MAX_CAPACITY;
}

public static void setClusterData(ItemStack stack, Map<ItemStackWrapper, Integer> data, int count) {
Expand All @@ -212,7 +225,7 @@ public static void mergeClusters(ItemStack donor, ItemStack recipient) {
int donorcount = getClusterSize(donor);
int recipientcount = getClusterSize(recipient);

if (donorcount == 0 || donorcount == MAX_CAPACITY || recipientcount == MAX_CAPACITY) {
if (donorcount == 0 || donorcount >= MAX_CAPACITY || recipientcount >= MAX_CAPACITY) {
return;
}

Expand Down Expand Up @@ -255,6 +268,9 @@ public static void mergeClusters(ItemStack donor, ItemStack recipient) {

@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
// Do nothing for super critical clusters
if (getClusterSize(stack) > MAX_CAPACITY) return stack;

if (!world.isRemote) {
List<ItemStack> drops = ToolHelper.collateMatterClusterContents(ItemMatterCluster.getClusterData(stack));

Expand All @@ -275,7 +291,7 @@ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer pla
@Override
public IIcon getMaskTexture(ItemStack stack, EntityPlayer player) {
int count = getClusterSize(stack);
if (count == MAX_CAPACITY) {
if (count >= MAX_CAPACITY) {
return cosmicIconFull;
}
return cosmicIcon;
Expand All @@ -284,13 +300,13 @@ public IIcon getMaskTexture(ItemStack stack, EntityPlayer player) {
@Override
public float getMaskMultiplier(ItemStack stack, EntityPlayer player) {
int count = getClusterSize(stack);
return count / (float) MAX_CAPACITY;
return Math.min(1f, count / (float) MAX_CAPACITY);
}

@Override
public IIcon getIcon(ItemStack stack, int pass) {
int count = getClusterSize(stack);
if (count == MAX_CAPACITY) {
if (count >= MAX_CAPACITY) {
return iconFull;
}
return super.getIcon(stack, pass);
Expand All @@ -307,6 +323,9 @@ public String getUnlocalizedName(ItemStack stack) {
if (count == MAX_CAPACITY) {
return super.getUnlocalizedName(stack) + ".full";
}
if (count > MAX_CAPACITY) {
return super.getUnlocalizedName(stack) + ".veryfull";
}
return super.getUnlocalizedName(stack);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,14 @@ public static void removeBlockWithDrops(EntityPlayer player, ItemStack stack, Wo
ItemStack drop = blk
.getPickBlock(raytraceFromEntity(world, player, true, 10), world, x, y, z, player);
if (drop == null) drop = new ItemStack(blk, 1, meta);
dropItem(drop, world, x, y, z);

List<ItemStack> drops = hammerdrops.get(player);

if (drops != null) {
drops.add(drop);
} else {
dropItem(drop, world, x, y, z);
}
}
blk.harvestBlock(world, player, x, y, z, localMeta);
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/avaritia/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ item.avaritia_fracturedore.name=Unknown Fractured Ore
item.avaritia_fracturedore.prefix=Fractured
item.avaritia_mattercluster.name=Matter Cluster
item.avaritia_mattercluster.full.name=Critical Matter Cluster
item.avaritia_mattercluster.veryfull.name=Super-Critical Matter Cluster
item.morvinabox.name=Morv-In-A-Box (WIP)(WILL LIGHT YOU ON FIRE)
item.avaritia.comb.nerfed.name=Nerfed Comb
item.avaritia.comb.cosmic.name=Cosmic Comb
Expand Down Expand Up @@ -83,6 +84,7 @@ tooltip.starfuel.desc=The light of the cosmos in a convenient chunk of earth
tooltip.skullfire_sword.desc=Beheads skeletons and scorches them black.
tooltip.matter_cluster.desc=Right click to deconstruct.
tooltip.matter_cluster.desc2=Hold SHIFT for contents.
tooltip.matter_cluster.desc3=Use a Matter Cluster Decompressor for large clusters.
tooltip.matter_cluster.counter=items
tooltip.morvinabox.desc=Instant housing
tooltip.morvinabox.subdesc=In Canada, Morvy comes in bags.
Expand Down