forked from AppliedEnergistics/Applied-Energistics-2
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Annihilation Plane enchantment support, deprecate Identity (#510)
- Loading branch information
1 parent
925cf09
commit 7f2318f
Showing
15 changed files
with
365 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/appeng/integration/modules/waila/part/AnnihilationPlaneDataProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package appeng.integration.modules.waila.part; | ||
|
||
import appeng.api.parts.IPart; | ||
import appeng.core.localization.WailaText; | ||
import appeng.parts.automation.PartAnnihilationPlane; | ||
import appeng.parts.automation.PartIdentityAnnihilationPlane; | ||
import appeng.util.EnchantmentUtil; | ||
import mcp.mobius.waila.api.IWailaConfigHandler; | ||
import mcp.mobius.waila.api.IWailaDataAccessor; | ||
import net.minecraft.enchantment.Enchantment; | ||
import net.minecraft.entity.player.EntityPlayerMP; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import net.minecraft.tileentity.TileEntity; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class AnnihilationPlaneDataProvider extends BasePartWailaDataProvider { | ||
@Override | ||
public List<String> getWailaBody(IPart part, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { | ||
if (part instanceof PartIdentityAnnihilationPlane) { | ||
currentToolTip.add(WailaText.IdentityDeprecated.getLocal()); | ||
} else if (part instanceof PartAnnihilationPlane plane) { | ||
NBTTagCompound nbtData = accessor.getNBTData(); | ||
Map<Enchantment, Integer> enchantments = EnchantmentUtil.getEnchantments(nbtData); | ||
if (!enchantments.isEmpty()) { | ||
currentToolTip.add(WailaText.EnchantedWith.getLocal()); | ||
for (var enchantment : enchantments.keySet()) { | ||
currentToolTip.add(enchantment.getTranslatedName(enchantments.get(enchantment))); | ||
} | ||
} | ||
} | ||
|
||
return currentToolTip; | ||
} | ||
|
||
@Override | ||
public NBTTagCompound getNBTData(EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) { | ||
if (part instanceof PartAnnihilationPlane plane) { | ||
plane.writeEnchantments(tag); | ||
} | ||
|
||
return tag; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.