Java Code Examples for net.minecraft.world.World#getCapability()
The following examples show how to use
net.minecraft.world.World#getCapability() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WizardryWorldCapability.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
public static WizardryWorld get(World world) { WizardryWorld cap = world.getCapability(capability(), null); if (cap == null) { throw new IllegalStateException("Missing capability: " + world.getWorldInfo().getWorldName() + "/" + world.provider.getDimensionType().getName()); } return cap; }
Example 2
Source File: ValkyrienUtils.java From Valkyrien-Skies with Apache License 2.0 | 5 votes |
/** * This method basically grabs the {@link IValkyrienSkiesWorldData} capability from the world * and then returns the QueryableShipData associated with it * * @param world The world we are getting the QueryableShipData from * @return The QueryableShipData corresponding to the given world */ public static QueryableShipData getQueryableData(World world) { IValkyrienSkiesWorldData worldData = world .getCapability(ValkyrienSkiesMod.VS_WORLD_DATA, null); if (worldData == null) { // I hate it when other mods add their custom worlds without calling the forge world // load events, so I don't feel bad crashing the game here. Although we could also get // away with just adding the capability to world instead of crashing. throw new IllegalStateException( "World " + world + " doesn't have an IVSWorldDataCapability. This is wrong!"); } return worldData.getQueryableShipData(); }