-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added waila features to the 1.8.8 port of v1.8.2
- Scanner doors now only display the "Hello X" message when opening the closed door (most current changes included in the initial v1.8.2 release)
- Loading branch information
1 parent
15172ad
commit 069360a
Showing
8 changed files
with
150 additions
and
14 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
13 changes: 13 additions & 0 deletions
13
1.8.8/src/main/java/net/geforcemods/securitycraft/imc/waila/ICustomWailaDisplay.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,13 @@ | ||
package net.geforcemods.securitycraft.imc.waila; | ||
|
||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.BlockPos; | ||
import net.minecraft.world.World; | ||
|
||
public interface ICustomWailaDisplay { | ||
|
||
public ItemStack getDisplayStack(World world, IBlockState state, BlockPos pos); | ||
|
||
public boolean shouldShowSCInfo(World world, IBlockState state, BlockPos pos); | ||
} |
88 changes: 88 additions & 0 deletions
88
1.8.8/src/main/java/net/geforcemods/securitycraft/imc/waila/WailaDataProvider.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,88 @@ | ||
package net.geforcemods.securitycraft.imc.waila; | ||
|
||
import java.util.List; | ||
|
||
import mcp.mobius.waila.api.IWailaConfigHandler; | ||
import mcp.mobius.waila.api.IWailaDataAccessor; | ||
import mcp.mobius.waila.api.IWailaDataProvider; | ||
import mcp.mobius.waila.api.IWailaRegistrar; | ||
import net.geforcemods.securitycraft.api.CustomizableSCTE; | ||
import net.geforcemods.securitycraft.api.INameable; | ||
import net.geforcemods.securitycraft.api.IOwnable; | ||
import net.geforcemods.securitycraft.api.IPasswordProtected; | ||
import net.geforcemods.securitycraft.main.mod_SecurityCraft; | ||
import net.geforcemods.securitycraft.misc.EnumCustomModules; | ||
import net.minecraft.entity.player.EntityPlayerMP; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import net.minecraft.tileentity.TileEntity; | ||
import net.minecraft.util.BlockPos; | ||
import net.minecraft.util.StatCollector; | ||
import net.minecraft.world.World; | ||
|
||
public class WailaDataProvider implements IWailaDataProvider { | ||
|
||
public static void callbackRegister(IWailaRegistrar registrar){ | ||
mod_SecurityCraft.log("Adding Waila support!"); | ||
|
||
registrar.addConfig("SecurityCraft", "securitycraft.showowner", StatCollector.translateToLocal("waila.displayOwner")); | ||
registrar.addConfig("SecurityCraft", "securitycraft.showmodules", StatCollector.translateToLocal("waila.showModules")); | ||
registrar.addConfig("SecurityCraft", "securitycraft.showpasswords", StatCollector.translateToLocal("waila.showPasswords")); | ||
registrar.addConfig("SecurityCraft", "securitycraft.showcustomname", StatCollector.translateToLocal("waila.showCustomName")); | ||
registrar.registerBodyProvider(new WailaDataProvider(), IOwnable.class); | ||
registrar.registerStackProvider(new WailaDataProvider(), ICustomWailaDisplay.class); | ||
} | ||
|
||
public ItemStack getWailaStack(IWailaDataAccessor data, IWailaConfigHandler config) { | ||
if(data.getBlock() instanceof ICustomWailaDisplay) { | ||
return ((ICustomWailaDisplay) data.getBlock()).getDisplayStack(data.getWorld(), data.getBlockState(), data.getPosition()); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
public List<String> getWailaHead(ItemStack itemStack, List<String> tipList, IWailaDataAccessor iDataAccessor, IWailaConfigHandler iConfigHandler) { | ||
return tipList; | ||
} | ||
|
||
public List<String> getWailaBody(ItemStack itemStack, List<String> tipList, IWailaDataAccessor iDataAccessor, IWailaConfigHandler iConfigHandler) { | ||
if(iDataAccessor.getBlock() instanceof ICustomWailaDisplay && !((ICustomWailaDisplay) iDataAccessor.getBlock()).shouldShowSCInfo(iDataAccessor.getWorld(), iDataAccessor.getBlockState(), iDataAccessor.getPosition())) return tipList; | ||
|
||
if(iConfigHandler.getConfig("securitycraft.showowner") && iDataAccessor.getTileEntity() instanceof IOwnable){ | ||
tipList.add(StatCollector.translateToLocal("waila.owner") + " " + ((IOwnable) iDataAccessor.getTileEntity()).getOwner().getName()); | ||
} | ||
|
||
if(iConfigHandler.getConfig("securitycraft.showmodules") && iDataAccessor.getTileEntity() instanceof CustomizableSCTE && ((CustomizableSCTE) iDataAccessor.getTileEntity()).getOwner().isOwner(iDataAccessor.getPlayer())){ | ||
if(!((CustomizableSCTE) iDataAccessor.getTileEntity()).getModules().isEmpty()){ | ||
tipList.add(StatCollector.translateToLocal("waila.equipped")); | ||
} | ||
|
||
for(EnumCustomModules module : ((CustomizableSCTE) iDataAccessor.getTileEntity()).getModules()){ | ||
tipList.add("- " + module.getName()); | ||
} | ||
} | ||
|
||
if(iConfigHandler.getConfig("securitycraft.showpasswords") && iDataAccessor.getTileEntity() instanceof IPasswordProtected && ((IOwnable) iDataAccessor.getTileEntity()).getOwner().isOwner(iDataAccessor.getPlayer())){ | ||
String password = ((IPasswordProtected) iDataAccessor.getTileEntity()).getPassword(); | ||
|
||
tipList.add(StatCollector.translateToLocal("waila.password") + " " + (password != null && !password.isEmpty() ? password : StatCollector.translateToLocal("waila.password.notSet"))); | ||
} | ||
|
||
if(iConfigHandler.getConfig("securitycraft.showcustomname") && iDataAccessor.getTileEntity() instanceof INameable && ((INameable) iDataAccessor.getTileEntity()).canBeNamed()){ | ||
String name = ((INameable) iDataAccessor.getTileEntity()).getCustomName(); | ||
|
||
tipList.add(StatCollector.translateToLocal("waila.customName") + " " + (((INameable) iDataAccessor.getTileEntity()).hasCustomName() ? name : StatCollector.translateToLocal("waila.customName.notSet"))); | ||
} | ||
|
||
return tipList; | ||
} | ||
|
||
public List<String> getWailaTail(ItemStack itemstack, List<String> tail, IWailaDataAccessor data, IWailaConfigHandler config) { | ||
return tail; | ||
} | ||
|
||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity tileEntity, NBTTagCompound tagCompound, World world, BlockPos pos) { | ||
return tagCompound; | ||
} | ||
|
||
} |
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