Skip to content

Commit

Permalink
Bug Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mooy1 committed Apr 17, 2021
1 parent 0a455f8 commit f08c00e
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 34 deletions.
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<dependency>
<groupId>io.github.mooy1</groupId>
<artifactId>InfinityLib</artifactId>
<version>17d0687</version>
<version>6092ae7</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand All @@ -67,7 +67,6 @@
<finalName>${project.name} v${project.version}</finalName>
<defaultGoal>clean package</defaultGoal>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>

<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public final class SlimefunExtension {
HeadTexture.CAPACITOR_25,
"&8Void Capacitor",
"",
"&8\u21E8 &e\u26A1 " + LorePreset.roundHundreds(VOID_CAPACITY) + " &7J Capacity"
"&8\u21E8 &e\u26A1 " + LorePreset.format(VOID_CAPACITY) + " &7J Capacity"
);

public static void setup(InfinityExpansion plugin) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import io.github.mooy1.infinityexpansion.InfinityExpansion;
import io.github.mooy1.infinityexpansion.categories.Categories;
import io.github.mooy1.infinityexpansion.implementation.materials.Items;
import io.github.mooy1.infinitylib.items.LoreUtils;
import io.github.mooy1.infinitylib.items.StackUtils;
import io.github.mooy1.infinitylib.players.CoolDownMap;
import io.github.thebusybiscuit.slimefun4.core.attributes.NotPlaceable;
Expand Down Expand Up @@ -167,7 +166,7 @@ public static void setVeinMiner(@Nullable ItemStack item, boolean makeVeinMiner)
if (makeVeinMiner && !isVeinMiner) {
container.set(key, PersistentDataType.BYTE, (byte) 1);
item.setItemMeta(meta);
LoreUtils.addLore(item, LORE);
StackUtils.addLore(item, LORE);
}

if (!makeVeinMiner && isVeinMiner) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public int getGeneratedOutput(@Nonnull Location l, @Nonnull Config data) {
Material.GREEN_STAINED_GLASS_PANE,
"&aGeneration",
"&7Type: &6" + type.status,
"&7Generating: &6" + LorePreset.roundHundreds(gen * TickerUtils.TPS) + " J/s ",
"&7Generating: &6" + LorePreset.format(gen * TickerUtils.TPS) + " J/s ",
"&7Stored: &6" + LorePreset.format(getCharge(l)) + " J"
));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import io.github.mooy1.infinityexpansion.implementation.SlimefunExtension;
import io.github.mooy1.infinityexpansion.implementation.blocks.InfinityWorkbench;
import io.github.mooy1.infinityexpansion.implementation.materials.Items;
import io.github.mooy1.infinitylib.items.LoreUtils;
import io.github.mooy1.infinitylib.items.StackUtils;
import io.github.mooy1.infinitylib.slimefun.abstracts.AbstractContainer;
import io.github.mooy1.infinitylib.slimefun.presets.LorePreset;
Expand Down Expand Up @@ -217,12 +216,12 @@ public List<ItemStack> getDisplayRecipes() {
List<ItemStack> items = new ArrayList<>();

ItemStack item = Items.INFINITY.clone();
LoreUtils.addLore(item, "", ChatColor.GOLD + "Lasts for 1 day");
StackUtils.addLore(item, "", ChatColor.GOLD + "Lasts for 1 day");
items.add(item);
items.add(null);

item = Items.VOID_INGOT.clone();
LoreUtils.addLore(item, "", ChatColor.GOLD + "Lasts for 4 hours");
StackUtils.addLore(item, "", ChatColor.GOLD + "Lasts for 4 hours");
items.add(item);
items.add(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import io.github.mooy1.infinityexpansion.categories.Categories;
import io.github.mooy1.infinityexpansion.implementation.blocks.InfinityWorkbench;
import io.github.mooy1.infinityexpansion.implementation.machines.VoidHarvester;
import io.github.mooy1.infinitylib.slimefun.presets.RecipePreset;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
Expand All @@ -22,13 +21,41 @@
public final class Items {

public static void setup() {
registerEnhanced(COBBLE_1, RecipePreset.Compress(new ItemStack(Material.COBBLESTONE)));
registerEnhanced(COBBLE_2, RecipePreset.Compress(COBBLE_1));
registerEnhanced(COBBLE_3, RecipePreset.Compress(COBBLE_2));
registerEnhanced(COBBLE_4, RecipePreset.Compress(COBBLE_3));
registerEnhanced(COBBLE_5, RecipePreset.Compress(COBBLE_4));
registerEnhanced(VOID_DUST, RecipePreset.Compress(VOID_BIT));
registerEnhanced(VOID_INGOT, RecipePreset.Compress(VOID_DUST));
registerEnhanced(COBBLE_1, new ItemStack[] {
new ItemStack(Material.COBBLESTONE), new ItemStack(Material.COBBLESTONE), new ItemStack(Material.COBBLESTONE),
new ItemStack(Material.COBBLESTONE), new ItemStack(Material.COBBLESTONE), new ItemStack(Material.COBBLESTONE),
new ItemStack(Material.COBBLESTONE), new ItemStack(Material.COBBLESTONE), new ItemStack(Material.COBBLESTONE)
});
registerEnhanced(COBBLE_2, new ItemStack[] {
COBBLE_1, COBBLE_1, COBBLE_1,
COBBLE_1, COBBLE_1, COBBLE_1,
COBBLE_1, COBBLE_1, COBBLE_1
});
registerEnhanced(COBBLE_3, new ItemStack[] {
COBBLE_2, COBBLE_2, COBBLE_2,
COBBLE_2, COBBLE_2, COBBLE_2,
COBBLE_2, COBBLE_2, COBBLE_2
});
registerEnhanced(COBBLE_4, new ItemStack[] {
COBBLE_3, COBBLE_3, COBBLE_3,
COBBLE_3, COBBLE_3, COBBLE_3,
COBBLE_3, COBBLE_3, COBBLE_3
});
registerEnhanced(COBBLE_5, new ItemStack[] {
COBBLE_4, COBBLE_4, COBBLE_4,
COBBLE_4, COBBLE_4, COBBLE_4,
COBBLE_4, COBBLE_4, COBBLE_4
});
registerEnhanced(VOID_DUST, new ItemStack[] {
VOID_BIT, VOID_BIT, VOID_BIT,
VOID_BIT, VOID_BIT, VOID_BIT,
VOID_BIT, VOID_BIT, VOID_BIT
});
registerEnhanced(VOID_INGOT, new ItemStack[] {
VOID_DUST, VOID_DUST, VOID_DUST,
VOID_DUST, VOID_DUST, VOID_DUST,
VOID_DUST, VOID_DUST, VOID_DUST
});
registerSmeltery(INFINITY, EARTH, MYTHRIL, FORTUNE, MAGIC, VOID_INGOT, METAL);
registerSmeltery(FORTUNE, Singularity.GOLD, Singularity.DIAMOND, Singularity.EMERALD, Singularity.NETHERITE, ADAMANTITE);
registerSmeltery(MAGIC, Singularity.REDSTONE, Singularity.LAPIS, Singularity.QUARTZ, Singularity.MAGNESIUM, MAGNONIUM);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.github.mooy1.infinityexpansion.implementation.storage;

import java.util.List;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
Expand All @@ -14,7 +16,6 @@

import io.github.mooy1.infinityexpansion.InfinityExpansion;
import io.github.mooy1.infinityexpansion.utils.Util;
import io.github.mooy1.infinitylib.items.LoreUtils;
import io.github.mooy1.infinitylib.items.StackUtils;
import io.github.mooy1.infinitylib.slimefun.presets.LorePreset;
import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag;
Expand Down Expand Up @@ -82,7 +83,7 @@ final class StorageCache {
this.unit = unit;
this.menu = menu;
this.voidExcess = BlockStorage.getLocationInfo(block.getLocation(), VOID_EXCESS) != null;
this.amount = Util.getIntData(STORED_AMOUNT, block.getLocation());
this.amount = Util.getIntData(STORED_AMOUNT, menu.getLocation());

if (this.amount == 0) {
// empty
Expand Down Expand Up @@ -226,6 +227,7 @@ void output(boolean partial) {
}

void updateStatus(Block block) {
this.amount = Util.getIntData(STORED_AMOUNT, this.menu.getLocation());
if (this.menu.hasViewer()) {
if (this.amount == 0) {
this.menu.replaceExistingItem(STATUS_SLOT, new CustomItem(
Expand Down Expand Up @@ -294,15 +296,14 @@ private void interactHandler(Player p, ClickAction action) {
}

private void voidExcessHandler() {
if (this.voidExcess) {
BlockStorage.addBlockInfo(this.menu.getLocation(), VOID_EXCESS, null);
LoreUtils.replaceLine(this.menu.getItemInSlot(STATUS_SLOT), VOID_EXCESS_TRUE, VOID_EXCESS_FALSE);
this.voidExcess = false;
} else {
BlockStorage.addBlockInfo(this.menu.getLocation(), VOID_EXCESS, "true");
LoreUtils.replaceLine(this.menu.getItemInSlot(STATUS_SLOT), VOID_EXCESS_FALSE, VOID_EXCESS_TRUE);
this.voidExcess = true;
}
this.voidExcess = !this.voidExcess;
BlockStorage.addBlockInfo(this.menu.getLocation(), VOID_EXCESS, this.voidExcess ? "true" : null);
ItemStack item = this.menu.getItemInSlot(STATUS_SLOT);
ItemMeta meta = item.getItemMeta();
List<String> lore = meta.getLore();
lore.set(1, this.voidExcess ? VOID_EXCESS_TRUE : VOID_EXCESS_FALSE);
meta.setLore(lore);
item.setItemMeta(meta);
}

private void setStored(ItemStack input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,25 +86,25 @@ public static void setup(InfinityExpansion plugin) {
"BASIC_STORAGE",
Material.OAK_WOOD,
"&9Basic &8Storage Unit",
LorePreset.storesItem(StorageUnit.BASIC_STORAGE)
"&6Capacity: &e" + LorePreset.format(BASIC_STORAGE) + " &eitems"
);
public static final SlimefunItemStack ADVANCED = new SlimefunItemStack(
"ADVANCED_STORAGE",
Material.DARK_OAK_WOOD,
"&cAdvanced &8Storage Unit",
LorePreset.storesItem(StorageUnit.ADVANCED_STORAGE)
"&6Capacity: &e" + LorePreset.format(ADVANCED_STORAGE) + " &eitems"
);
public static final SlimefunItemStack REINFORCED = new SlimefunItemStack(
"REINFORCED_STORAGE",
Material.ACACIA_WOOD,
"&fReinforced &8Storage Unit",
LorePreset.storesItem(StorageUnit.REINFORCED_STORAGE)
"&6Capacity: &e" + LorePreset.format(REINFORCED_STORAGE) + " &eitems"
);
public static final SlimefunItemStack VOID = new SlimefunItemStack(
"VOID_STORAGE",
Material.CRIMSON_HYPHAE,
"&8Void &8Storage Unit",
LorePreset.storesItem(StorageUnit.VOID_STORAGE)
"&6Capacity: &e" + LorePreset.format(VOID_STORAGE) + " &eitems"
);
public static final SlimefunItemStack INFINITY = new SlimefunItemStack(
"INFINITY_STORAGE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.bukkit.inventory.ItemStack;

import io.github.mooy1.infinityexpansion.InfinityExpansion;
import io.github.mooy1.infinitylib.items.LoreUtils;
import io.github.mooy1.infinitylib.items.StackUtils;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.Slimefun.api.BlockStorage;

Expand All @@ -41,7 +41,7 @@ public final class Util {

@Nonnull
public static ItemStack getDisplayItem(@Nonnull ItemStack output) {
LoreUtils.addLore(output, "", "&a-------------------", "&a\u21E8 Click to craft", "&a-------------------");
StackUtils.addLore(output, "", "&a-------------------", "&a\u21E8 Click to craft", "&a-------------------");
return output;
}

Expand Down

0 comments on commit f08c00e

Please sign in to comment.