mirror of
https://github.com/GTNewHorizons/Hardcore-Ender-Expansion.git
synced 2026-10-26 14:24:03 +00:00
Merge remote-tracking branch 'origin/pouch-bauble' into dev
This commit is contained in:
12 files changed
+148
-41
No files matched your search
@@ -4,6 +4,7 @@ dependencies {
|
||||
implementation('com.github.GTNewHorizons:GTNHLib:0.6.38:dev')
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.7.66-GTNH:dev')
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.1.9-GTNH:dev')
|
||||
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
compileOnly('com.github.GTNewHorizons:Mobs-Info:0.5.3-GTNH:dev')
|
||||
}
|
||||
@@ -63,7 +63,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
version = Tags.VERSION,
|
||||
useMetadata = true,
|
||||
guiFactory = "chylex.hee.gui.core.ModGuiFactory",
|
||||
dependencies = "required-after:gtnhlib@[0.5.22,)")
|
||||
dependencies = "required-after:gtnhlib@[0.5.22,);after:Baubles|Expanded")
|
||||
public class HardcoreEnderExpansion {
|
||||
|
||||
@Instance("HardcoreEnderExpansion")
|
||||
@@ -146,6 +146,10 @@ public class HardcoreEnderExpansion {
|
||||
PlayerTransportBeacons.register();
|
||||
DragonChunkManager.register();
|
||||
|
||||
// COMPAT
|
||||
|
||||
ModIntegrationManager.preInit();
|
||||
|
||||
Stopwatch.finish("PreInitEvent - events");
|
||||
|
||||
proxy.registerSidedEvents();
|
||||
@@ -179,7 +183,7 @@ public class HardcoreEnderExpansion {
|
||||
KnowledgeRegistrations.initialize();
|
||||
OrbAcquirableItems.initialize(true);
|
||||
OrbSpawnableMobs.initialize();
|
||||
ModIntegrationManager.integrateMods();
|
||||
ModIntegrationManager.postInit();
|
||||
DimensionOverride.postInit();
|
||||
|
||||
UnitTester.trigger(RunTime.POSTINIT);
|
||||
|
||||
@@ -2,42 +2,56 @@ package chylex.hee.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.IBauble;
|
||||
import baubles.api.expanded.IBaubleExpanded;
|
||||
import chylex.hee.HardcoreEnderExpansion;
|
||||
import chylex.hee.init.ItemList;
|
||||
import chylex.hee.mechanics.charms.CharmPouchInfo;
|
||||
import chylex.hee.mechanics.charms.handler.CharmPouchHandler;
|
||||
import chylex.hee.mechanics.charms.handler.CharmPouchHandlerClient;
|
||||
import chylex.hee.system.achievements.AchievementManager;
|
||||
import chylex.hee.system.integration.ModIntegrationManager;
|
||||
import chylex.hee.system.integration.handlers.BaublesExpandedIntegration;
|
||||
import chylex.hee.system.util.ItemUtil;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemCharmPouch extends Item {
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "baubles.api.expanded.IBaubleExpanded", modid = "Baubles|Expanded"),
|
||||
@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles") })
|
||||
public class ItemCharmPouch extends Item implements IBauble, IBaubleExpanded {
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack is, World world, Entity entity, int slot, boolean isHeld) {
|
||||
if (ItemUtil.getTagRoot(is, false).getBoolean("isPouchActive") && entity instanceof EntityPlayer) {
|
||||
if (world.isRemote) CharmPouchHandlerClient.onActivePouchUpdate((EntityPlayer) entity, is);
|
||||
else {
|
||||
CharmPouchInfo pouchInfo = CharmPouchHandler.getActivePouch((EntityPlayer) entity);
|
||||
if (!ItemUtil.getTagRoot(is, false).getBoolean("isPouchActive") || !(entity instanceof EntityPlayer)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pouchInfo == null) {
|
||||
CharmPouchHandler.setActivePouch((EntityPlayer) entity, is);
|
||||
CharmPouchHandler.getActivePouch((EntityPlayer) entity).update(world);
|
||||
} else if (pouchInfo.pouchID != getPouchID(is)) is.getTagCompound().setBoolean("isPouchActive", false);
|
||||
else pouchInfo.update(world);
|
||||
}
|
||||
if (world.isRemote) CharmPouchHandlerClient.onActivePouchUpdate((EntityPlayer) entity, is);
|
||||
else {
|
||||
CharmPouchInfo pouchInfo = CharmPouchHandler.getActivePouch((EntityPlayer) entity);
|
||||
|
||||
if (pouchInfo == null) {
|
||||
CharmPouchHandler.setActivePouch((EntityPlayer) entity, is);
|
||||
CharmPouchHandler.getActivePouch((EntityPlayer) entity).update(world);
|
||||
} else if (pouchInfo.pouchID != getPouchID(is)) is.getTagCompound().setBoolean("isPouchActive", false);
|
||||
else pouchInfo.update(world);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,11 +87,23 @@ public class ItemCharmPouch extends Item {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack is, EntityPlayer player, List textLines, boolean showAdvancedInfo) {
|
||||
public void addInformation(ItemStack is, EntityPlayer player, List<String> textLines, boolean showAdvancedInfo) {
|
||||
textLines.add(
|
||||
I18n.format(
|
||||
ItemUtil.getTagRoot(is, false).getBoolean("isPouchActive") ? "item.charmPouch.info.active"
|
||||
: "item.charmPouch.info.inactive"));
|
||||
if (ModIntegrationManager.baublesLoaded) addBaubleInformation(textLines);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Optional.Method(modid = "Baubles")
|
||||
private void addBaubleInformation(List<String> textLines) {
|
||||
if (ModIntegrationManager.baublesExpandedLoaded) {
|
||||
if (GuiScreen.isShiftKeyDown()) {
|
||||
textLines.add(StatCollector.translateToLocal("tooltip.compatibleslots"));
|
||||
textLines.add(StatCollector.translateToLocal("slot.charmpouch"));
|
||||
} else textLines.add(StatCollector.translateToLocal("tooltip.shiftprompt"));
|
||||
} else textLines.add(StatCollector.translateToLocal("baubletype.belt"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,7 +112,7 @@ public class ItemCharmPouch extends Item {
|
||||
return ItemUtil.getTagRoot(is, false).getBoolean("isPouchActive");
|
||||
}
|
||||
|
||||
public static final long getPouchID(ItemStack is) {
|
||||
public static long getPouchID(ItemStack is) {
|
||||
if (is.getItem() != ItemList.charm_pouch) return 0;
|
||||
|
||||
NBTTagCompound nbt = ItemUtil.getTagRoot(is, true);
|
||||
@@ -96,7 +122,7 @@ public class ItemCharmPouch extends Item {
|
||||
return id;
|
||||
}
|
||||
|
||||
public static final ItemStack[] getPouchCharms(ItemStack is) {
|
||||
public static ItemStack[] getPouchCharms(ItemStack is) {
|
||||
if (is.getItem() != ItemList.charm_pouch) return new ItemStack[0];
|
||||
|
||||
NBTTagList tagCharms = ItemUtil.getTagRoot(is, true).getTagList("pouchCharms", Constants.NBT.TAG_COMPOUND);
|
||||
@@ -111,7 +137,7 @@ public class ItemCharmPouch extends Item {
|
||||
return items;
|
||||
}
|
||||
|
||||
public static final void setPouchCharms(ItemStack pouch, ItemStack[] charms) {
|
||||
public static void setPouchCharms(ItemStack pouch, ItemStack[] charms) {
|
||||
if (pouch.getItem() != ItemList.charm_pouch) return;
|
||||
|
||||
NBTTagList tagCharms = new NBTTagList();
|
||||
@@ -126,4 +152,49 @@ public class ItemCharmPouch extends Item {
|
||||
|
||||
ItemUtil.getTagRoot(pouch, true).setTag("pouchCharms", tagCharms);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "Baubles|Expanded")
|
||||
public String[] getBaubleTypes(ItemStack itemstack) {
|
||||
return new String[] { BaublesExpandedIntegration.BAUBLESLOT };
|
||||
}
|
||||
|
||||
// Fallback for base Baubles
|
||||
@Override
|
||||
@Optional.Method(modid = "Baubles")
|
||||
public BaubleType getBaubleType(ItemStack itemStack) {
|
||||
return BaubleType.BELT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "Baubles")
|
||||
public void onWornTick(ItemStack itemstack, EntityLivingBase player) {
|
||||
onUpdate(itemstack, player.worldObj, player, 0, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "Baubles")
|
||||
public void onEquipped(ItemStack itemstack, EntityLivingBase player) {
|
||||
EntityPlayer entityPlayer = (EntityPlayer) player;
|
||||
CharmPouchHandler.setActivePouch(entityPlayer, itemstack);
|
||||
ItemUtil.getTagRoot(itemstack, true).setBoolean("isPouchActive", true);
|
||||
CharmPouchHandler.getActivePouch(entityPlayer).update(player.worldObj);
|
||||
}
|
||||
|
||||
// Should not be toggled off because it still can be active in the inventory
|
||||
@Override
|
||||
@Optional.Method(modid = "Baubles")
|
||||
public void onUnequipped(ItemStack itemstack, EntityLivingBase player) {}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "Baubles")
|
||||
public boolean canEquip(ItemStack itemstack, EntityLivingBase player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "Baubles")
|
||||
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -8,12 +8,9 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import chylex.hee.init.ItemList;
|
||||
import chylex.hee.mechanics.charms.CharmPouchInfo;
|
||||
import chylex.hee.system.util.ItemUtil;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedOutEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
|
||||
@@ -63,19 +60,6 @@ public final class CharmPouchHandler {
|
||||
refresh = false;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerLoggedIn(PlayerLoggedInEvent e) {
|
||||
ItemStack[] mainInv = e.player.inventory.mainInventory;
|
||||
|
||||
for (int a = 0; a < mainInv.length; a++) {
|
||||
if (mainInv[a] != null && mainInv[a].getItem() == ItemList.charm_pouch
|
||||
&& ItemUtil.getTagRoot(mainInv[a], false).getBoolean("isPouchActive")) {
|
||||
setActivePouch(e.player, mainInv[a]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerLoggedOut(PlayerLoggedOutEvent e) {
|
||||
if (activePouchIDs.remove(e.player.getGameProfile().getId()) != null) refresh = true;
|
||||
|
||||
@@ -1052,7 +1052,8 @@ public final class KnowledgeRegistrations {
|
||||
new KnowledgeFragmentCrafting(521)
|
||||
.setRecipe(new ItemStack(ItemList.charm_pouch)).setPrice(10)
|
||||
.setUnlockRequirements(520).setUnlockCascade(533),
|
||||
new KnowledgeFragmentText(522).setPrice(5).setUnlockRequirements(520) }),
|
||||
new KnowledgeFragmentText(522).setPrice(5).setUnlockRequirements(520),
|
||||
new KnowledgeFragmentText(523).setPrice(2).setUnlockRequirements(522) }),
|
||||
|
||||
RUNES.setPos(3, 18).setUnlockPrice(25).setDiscoveryReward(18).addFragments(
|
||||
new KnowledgeFragment[] {
|
||||
|
||||
@@ -3,6 +3,7 @@ package chylex.hee.system.integration;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import chylex.hee.system.integration.handlers.BaublesExpandedIntegration;
|
||||
import chylex.hee.system.integration.handlers.MineFactoryReloadedIntegration;
|
||||
import chylex.hee.system.integration.handlers.NotEnoughItemsIntegration;
|
||||
import chylex.hee.system.integration.handlers.ThaumcraftIntegration;
|
||||
@@ -12,10 +13,33 @@ import cpw.mods.fml.common.Loader;
|
||||
|
||||
public final class ModIntegrationManager {
|
||||
|
||||
public static boolean baublesLoaded;
|
||||
public static boolean baublesExpandedLoaded;
|
||||
|
||||
public static final Set<String> blacklistedMods = new HashSet<>();
|
||||
|
||||
public static final void integrateMods() {
|
||||
Stopwatch.time("ModIntegrationManager - integrateMods");
|
||||
public static void preInit() {
|
||||
Stopwatch.time("ModIntegrationManager - preInit");
|
||||
baublesLoaded = Loader.isModLoaded("Baubles");
|
||||
baublesExpandedLoaded = Loader.isModLoaded("Baubles|Expanded");
|
||||
|
||||
Class[] handlerClasses = new Class[] { BaublesExpandedIntegration.class };
|
||||
|
||||
for (Class<? extends IIntegrationHandler> cls : handlerClasses) {
|
||||
try {
|
||||
IIntegrationHandler handler = cls.newInstance();
|
||||
String modId = handler.getModId();
|
||||
if (Loader.isModLoaded(modId) && !blacklistedMods.contains(modId)) handler.integrate();
|
||||
} catch (Throwable e) {
|
||||
Log.throwable(e, "Unable to integrate with mod $0.", cls.getSimpleName());
|
||||
}
|
||||
}
|
||||
|
||||
Stopwatch.finish("ModIntegrationManager - preInit");
|
||||
}
|
||||
|
||||
public static void postInit() {
|
||||
Stopwatch.time("ModIntegrationManager - postInit");
|
||||
|
||||
Class[] handlerClasses = new Class[] { NotEnoughItemsIntegration.class, ThaumcraftIntegration.class,
|
||||
MineFactoryReloadedIntegration.class };
|
||||
@@ -30,6 +54,6 @@ public final class ModIntegrationManager {
|
||||
}
|
||||
}
|
||||
|
||||
Stopwatch.finish("ModIntegrationManager - integrateMods");
|
||||
Stopwatch.finish("ModIntegrationManager - postInit");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package chylex.hee.system.integration.handlers;
|
||||
|
||||
import baubles.api.expanded.BaubleExpandedSlots;
|
||||
import chylex.hee.system.integration.IIntegrationHandler;
|
||||
|
||||
public class BaublesExpandedIntegration implements IIntegrationHandler {
|
||||
|
||||
public static final String BAUBLESLOT = "charmpouch";
|
||||
|
||||
@Override
|
||||
public String getModId() {
|
||||
return "Baubles|Expanded";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void integrate() {
|
||||
BaubleExpandedSlots.tryRegisterType(BAUBLESLOT);
|
||||
BaubleExpandedSlots.tryAssignSlotOfType(BAUBLESLOT);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
@@ -1,4 +1,3 @@
|
||||
# DO NOT MODIFY THIS FILE!
|
||||
ec.title.stronghold=Stronghold
|
||||
ec.title.dragonLair=Dragon Lair
|
||||
ec.title.endstoneBlob=Endstone Blob
|
||||
@@ -375,7 +374,8 @@ ec.reg.514=Slab made of $b:~ravaged_brick/0, weaker than the full block.
|
||||
ec.reg.516=Fence made of $b:~ravaged_brick/0, weaker than the full block.
|
||||
|
||||
ec.reg.520=Magical pouch that allows creating, holding and activating $i:~charm:Charms$.
|
||||
ec.reg.522=Sneaking and using the pouch activates or deactives the $i:~charm:Charms$. Only one pouch can be active at a time.
|
||||
ec.reg.522=Sneaking and using the pouch activates or deactivates the $i:~charm:Charms$. Only one pouch can be active at a time.
|
||||
ec.reg.523=The Charm Pouch must stay in the inventory for its $i:~charm:Charms$ to grant their effects. It may also be equipped to a Baubles or Baubles Expanded slot if either of those mods is present.
|
||||
|
||||
ec.reg.530=Runes are used to create $i:~charm:Charms$, and craft $i:~charm_pouch.
|
||||
ec.reg.531=There are 6 types of Runes - Power, Agility, Vigor, Defense, Magic and Void. The Void rune is less common than other types.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# DO NOT MODIFY THIS FILE!
|
||||
ec.title.stronghold=Крепость
|
||||
ec.title.dragonLair=Логово Дракона
|
||||
ec.title.endstoneBlob=Эндер-остров
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# DO NOT MODIFY THIS FILE!
|
||||
# Update by Athloniux for v1.8.6
|
||||
# Thanks to Yoooo And Rudis From NGACraft
|
||||
# Proofread by Kiwi233
|
||||
|
||||
@@ -384,3 +384,7 @@ challenge.difficulty.mediumorhard=Normal / Hard difficulty
|
||||
baconizer.bacon=bacon
|
||||
|
||||
fluid.enderGoo=Ender Goo
|
||||
|
||||
# Baubles (Expanded) Compat
|
||||
baubletype.belt=Equippable in the §aBelt§7 slot
|
||||
slot.charmpouch=§aCharm Pouch§7
|
||||
Reference in new issue
Block a user