Skip to content

Commit

Permalink
Loading bars!
Browse files Browse the repository at this point in the history
  • Loading branch information
strubium committed Jun 6, 2024
1 parent 85760b9 commit 4c93582
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/java/mcjty/theoneprobe/ForgeEventHandlers.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
}
}

@SideOnly(Side.SERVER)
@SubscribeEvent
public void onEntityConstructing(AttachCapabilitiesEvent<Entity> event){
if (event.getObject() instanceof EntityPlayer) {
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/mcjty/theoneprobe/items/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import net.minecraft.util.NonNullList;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fml.common.ProgressManager;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

Expand All @@ -34,25 +35,43 @@ public class ModItems {
private static final String PROBETAG_HAND = "theoneprobe_hand";

public static void init() {
int stepCount;
if (ModSetup.baubles) {
stepCount = 6;
}
else {
stepCount = 5;
}
final ProgressManager.ProgressBar bar = ProgressManager.push("Loading Mod Items", stepCount);

bar.step("Initializing Probe");
probe = new Probe();

bar.step("Initializing Creative Probe");
creativeProbe = new CreativeProbe();

bar.step("Creating Armor Materials");
ItemArmor.ArmorMaterial materialDiamondHelmet = EnumHelper.addArmorMaterial("diamond_helmet_probe", TheOneProbe.MODID + ":probe_diamond",
33, new int[]{3, 6, 8, 3}, 10, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 2.0F);
ItemArmor.ArmorMaterial materialGoldHelmet = EnumHelper.addArmorMaterial("gold_helmet_probe", TheOneProbe.MODID + ":probe_gold",
7, new int[]{1, 3, 5, 2}, 25, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 0.0F);
ItemArmor.ArmorMaterial materialIronHelmet = EnumHelper.addArmorMaterial("iron_helmet_probe", TheOneProbe.MODID + ":probe_iron",
15, new int[]{2, 5, 6, 2}, 9, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0.0F);

bar.step("Creating Armor Probes");
diamondHelmetProbe = makeHelmet(materialDiamondHelmet, 3, "diamond_helmet_probe");
goldHelmetProbe = makeHelmet(materialGoldHelmet, 4, "gold_helmet_probe");
ironHelmetProbe = makeHelmet(materialIronHelmet, 2, "iron_helmet_probe");

bar.step("Initializing Probe Note");
probeNote = new ProbeNote();

if (ModSetup.baubles) {
bar.step("Initializing Probe Goggles");
probeGoggles = BaubleTools.initProbeGoggle();
}

ProgressManager.pop(bar);
}

private static Item makeHelmet(ItemArmor.ArmorMaterial material, int renderIndex, String name) {
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/mcjty/theoneprobe/setup/ModSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ProgressManager;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
Expand Down Expand Up @@ -43,20 +44,23 @@ public void preInit(FMLPreInitializationEvent e) {

registerCapabilities();
TheOneProbeImp.registerElements();
final ProgressManager.ProgressBar bar = ProgressManager.push("Loading Providers", 2);
bar.step("Loading Block Providers");
TheOneProbe.theOneProbeImp.registerProvider(new DefaultProbeInfoProvider());
TheOneProbe.theOneProbeImp.registerProvider(new DebugProbeInfoProvider());
TheOneProbe.theOneProbeImp.registerProvider(new BlockProbeInfoProvider());
TheOneProbe.theOneProbeImp.registerProvider(new EnchantingPowerInfoProvider());
TheOneProbe.theOneProbeImp.registerProvider(new JukeboxProvider());
TheOneProbe.theOneProbeImp.registerProvider(new CauldronInfoProvider());
bar.step("Loading Entity Providers");
TheOneProbe.theOneProbeImp.registerEntityProvider(new DefaultProbeInfoEntityProvider());
TheOneProbe.theOneProbeImp.registerEntityProvider(new DebugProbeInfoEntityProvider());
TheOneProbe.theOneProbeImp.registerEntityProvider(new EntityProbeInfoEntityProvider());
TheOneProbe.theOneProbeImp.registerEntityProvider(new ChestHorseInfoProvider());
TheOneProbe.theOneProbeImp.registerEntityProvider(new MinecartInfoProvider());
TheOneProbe.theOneProbeImp.registerEntityProvider(new TNTInfoProvider());
TheOneProbe.theOneProbeImp.registerEntityProvider(new PaintingInfoProvider());

ProgressManager.pop(bar);
modConfigDir = e.getModConfigurationDirectory();
ConfigSetup.init();

Expand Down

0 comments on commit 4c93582

Please sign in to comment.